Chromium Code Reviews| 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 16 matching lines...) Expand all Loading... | |
| 27 * Initializes the context and makes it current. | 27 * Initializes the context and makes it current. |
| 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 /** | |
| 38 * If the drawing surface provided by the platform is double buffered this | |
| 39 * call will cause the platform to swap with buffer is currently being | |
| 40 * targeted. If the current surface does not include a back buffer, this | |
| 41 * call has no effect. | |
|
bsalomon
2013/10/09 18:17:08
Maybe we should say that this is mostly used for s
| |
| 42 */ | |
| 43 virtual void swapBuffers() const = 0; | |
| 44 | |
| 37 bool hasExtension(const char* extensionName) const { | 45 bool hasExtension(const char* extensionName) const { |
| 38 SkASSERT(NULL != fGL); | 46 SkASSERT(NULL != fGL); |
| 39 return fExtensions.has(extensionName); | 47 return fExtensions.has(extensionName); |
| 40 } | 48 } |
| 41 | 49 |
| 42 protected: | 50 protected: |
| 43 /** | 51 /** |
| 44 * Subclass implements this to make a GL context. The returned GrGLInterface | 52 * Subclass implements this to make a GL context. The returned GrGLInterface |
| 45 * should be populated with functions compatible with the context. The | 53 * should be populated with functions compatible with the context. The |
| 46 * format and size of backbuffers does not matter since an FBO will be | 54 * format and size of backbuffers does not matter since an FBO will be |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 68 * SK_GL(glCtx, GenTextures(1, &texID)); | 76 * SK_GL(glCtx, GenTextures(1, &texID)); |
| 69 */ | 77 */ |
| 70 #define SK_GL(ctx, X) (ctx).gl()->f ## X; \ | 78 #define SK_GL(ctx, X) (ctx).gl()->f ## X; \ |
| 71 SkASSERT(GR_GL_NO_ERROR == (ctx).gl()->fGetError()) | 79 SkASSERT(GR_GL_NO_ERROR == (ctx).gl()->fGetError()) |
| 72 #define SK_GL_RET(ctx, RET, X) (RET) = (ctx).gl()->f ## X; \ | 80 #define SK_GL_RET(ctx, RET, X) (RET) = (ctx).gl()->f ## X; \ |
| 73 SkASSERT(GR_GL_NO_ERROR == (ctx).gl()->fGetError()) | 81 SkASSERT(GR_GL_NO_ERROR == (ctx).gl()->fGetError()) |
| 74 #define SK_GL_NOERRCHECK(ctx, X) (ctx).gl()->f ## X | 82 #define SK_GL_NOERRCHECK(ctx, X) (ctx).gl()->f ## X |
| 75 #define SK_GL_RET_NOERRCHECK(ctx, RET, X) (RET) = (ctx).gl()->f ## X | 83 #define SK_GL_RET_NOERRCHECK(ctx, RET, X) (RET) = (ctx).gl()->f ## X |
| 76 | 84 |
| 77 #endif | 85 #endif |
| OLD | NEW |