OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #ifndef SkGLContext_DEFINED | 8 #ifndef SkGLContext_DEFINED |
9 #define SkGLContext_DEFINED | 9 #define SkGLContext_DEFINED |
10 | 10 |
11 #include "GrGLInterface.h" | 11 #include "GrGLInterface.h" |
12 | 12 |
13 /** | 13 /** |
14 * Create an offscreen opengl context with an RGBA8 / 8bit stencil FBO. | 14 * Create an offscreen opengl context with an RGBA8 / 8bit stencil FBO. |
15 * Provides a GrGLInterface struct of function pointers for the context. | 15 * Provides a GrGLInterface struct of function pointers for the context. |
16 */ | 16 */ |
17 | 17 |
18 class SK_API SkGLContext : public SkRefCnt { | 18 class SK_API SkGLContext : public SkRefCnt { |
19 public: | 19 public: |
20 SK_DECLARE_INST_COUNT(SkGLContext) | 20 SK_DECLARE_INST_COUNT(SkGLContext) |
21 | 21 |
22 virtual ~SkGLContext() SK_OVERRIDE; | 22 ~SkGLContext() SK_OVERRIDE; |
23 | 23 |
24 bool isValid() const { return NULL != gl(); } | 24 bool isValid() const { return NULL != gl(); } |
25 | 25 |
26 const GrGLInterface* gl() const { return fGL.get(); } | 26 const GrGLInterface* gl() const { return fGL.get(); } |
27 | 27 |
28 virtual void makeCurrent() const = 0; | 28 virtual void makeCurrent() const = 0; |
29 | 29 |
30 /** | 30 /** |
31 * The primary purpose of this function it to provide a means of scheduling | 31 * The primary purpose of this function it to provide a means of scheduling |
32 * work on the GPU (since all of the subclasses create primary buffers for | 32 * work on the GPU (since all of the subclasses create primary buffers for |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 * SK_GL(glCtx, GenTextures(1, &texID)); | 71 * SK_GL(glCtx, GenTextures(1, &texID)); |
72 */ | 72 */ |
73 #define SK_GL(ctx, X) (ctx).gl()->fFunctions.f ## X; \ | 73 #define SK_GL(ctx, X) (ctx).gl()->fFunctions.f ## X; \ |
74 SkASSERT(0 == (ctx).gl()->fFunctions.fGetError()) | 74 SkASSERT(0 == (ctx).gl()->fFunctions.fGetError()) |
75 #define SK_GL_RET(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X; \ | 75 #define SK_GL_RET(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X; \ |
76 SkASSERT(0 == (ctx).gl()->fFunctions.fGetError()) | 76 SkASSERT(0 == (ctx).gl()->fFunctions.fGetError()) |
77 #define SK_GL_NOERRCHECK(ctx, X) (ctx).gl()->fFunctions.f ## X | 77 #define SK_GL_NOERRCHECK(ctx, X) (ctx).gl()->fFunctions.f ## X |
78 #define SK_GL_RET_NOERRCHECK(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X | 78 #define SK_GL_RET_NOERRCHECK(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X |
79 | 79 |
80 #endif | 80 #endif |
OLD | NEW |