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 SkGLContextHelper_DEFINED | 8 #ifndef SkGLContextHelper_DEFINED |
9 #define SkGLContextHelper_DEFINED | 9 #define SkGLContextHelper_DEFINED |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 */ | 28 */ |
29 bool init(const int width, const int height); | 29 bool init(const int width, const int height); |
30 | 30 |
31 int getFBOID() const { return fFBO; } | 31 int getFBOID() const { return fFBO; } |
32 | 32 |
33 const GrGLInterface* gl() const { return fGL; } | 33 const GrGLInterface* gl() const { return fGL; } |
34 | 34 |
35 virtual void makeCurrent() const = 0; | 35 virtual void makeCurrent() const = 0; |
36 | 36 |
37 bool hasExtension(const char* extensionName) const { | 37 bool hasExtension(const char* extensionName) const { |
38 GrAssert(NULL != fGL); | 38 SkASSERT(NULL != fGL); |
39 return fExtensions.has(extensionName); | 39 return fExtensions.has(extensionName); |
40 } | 40 } |
41 | 41 |
42 protected: | 42 protected: |
43 /** | 43 /** |
44 * Subclass implements this to make a GL context. The returned GrGLInterface | 44 * Subclass implements this to make a GL context. The returned GrGLInterface |
45 * should be populated with functions compatible with the context. The | 45 * should be populated with functions compatible with the context. The |
46 * format and size of backbuffers does not matter since an FBO will be | 46 * format and size of backbuffers does not matter since an FBO will be |
47 * created. | 47 * created. |
48 */ | 48 */ |
(...skipping 19 matching lines...) Expand all Loading... |
68 * SK_GL(glCtx, GenTextures(1, &texID)); | 68 * SK_GL(glCtx, GenTextures(1, &texID)); |
69 */ | 69 */ |
70 #define SK_GL(ctx, X) (ctx).gl()->f ## X; \ | 70 #define SK_GL(ctx, X) (ctx).gl()->f ## X; \ |
71 SkASSERT(GR_GL_NO_ERROR == (ctx).gl()->fGetError()) | 71 SkASSERT(GR_GL_NO_ERROR == (ctx).gl()->fGetError()) |
72 #define SK_GL_RET(ctx, RET, X) (RET) = (ctx).gl()->f ## X; \ | 72 #define SK_GL_RET(ctx, RET, X) (RET) = (ctx).gl()->f ## X; \ |
73 SkASSERT(GR_GL_NO_ERROR == (ctx).gl()->fGetError()) | 73 SkASSERT(GR_GL_NO_ERROR == (ctx).gl()->fGetError()) |
74 #define SK_GL_NOERRCHECK(ctx, X) (ctx).gl()->f ## X | 74 #define SK_GL_NOERRCHECK(ctx, X) (ctx).gl()->f ## X |
75 #define SK_GL_RET_NOERRCHECK(ctx, RET, X) (RET) = (ctx).gl()->f ## X | 75 #define SK_GL_RET_NOERRCHECK(ctx, RET, X) (RET) = (ctx).gl()->f ## X |
76 | 76 |
77 #endif | 77 #endif |
OLD | NEW |