Line data Source code
1 : /* -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40; -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #ifndef SKIA_GL_GLUE_H_
7 : #define SKIA_GL_GLUE_H_
8 :
9 : #ifdef USE_SKIA_GPU
10 :
11 : #include "skia/include/core/SkRefCnt.h"
12 : #include "mozilla/RefPtr.h"
13 :
14 : struct GrGLInterface;
15 : class GrContext;
16 :
17 : namespace mozilla {
18 : namespace gl {
19 :
20 : class GLContext;
21 :
22 : class SkiaGLGlue : public GenericAtomicRefCounted
23 : {
24 : public:
25 0 : MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SkiaGLGlue)
26 : explicit SkiaGLGlue(GLContext* context);
27 0 : GLContext* GetGLContext() const { return mGLContext.get(); }
28 0 : GrContext* GetGrContext() const { return mGrContext.get(); }
29 :
30 : protected:
31 : virtual ~SkiaGLGlue();
32 :
33 : private:
34 : RefPtr<GLContext> mGLContext;
35 : sk_sp<GrGLInterface> mGrGLInterface;
36 : sk_sp<GrContext> mGrContext;
37 : };
38 :
39 : } // namespace gl
40 : } // namespace mozilla
41 :
42 : #else // USE_SKIA_GPU
43 :
44 : class GrContext;
45 :
46 : namespace mozilla {
47 : namespace gl {
48 :
49 : class GLContext;
50 :
51 : class SkiaGLGlue : public GenericAtomicRefCounted
52 : {
53 : public:
54 : SkiaGLGlue(GLContext* context);
55 : GLContext* GetGLContext() const { return nullptr; }
56 : GrContext* GetGrContext() const { return nullptr; }
57 : };
58 :
59 : } // namespace gl
60 : } // namespace mozilla
61 :
62 : #endif // USE_SKIA_GPU
63 :
64 : #endif // SKIA_GL_GLUE_H_
|