aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu/gl/SkDebugGLContext.h
diff options
context:
space:
mode:
authorGravatar kkinnunen <kkinnunen@nvidia.com>2014-10-15 23:03:54 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-10-15 23:03:54 -0700
commit30bc88ccd524c0372fd2f8f79190ea4b81685beb (patch)
treebc506a76edaa98c6285f6e2496c83585d1ada1cc /include/gpu/gl/SkDebugGLContext.h
parentde258cd6b402c4da78b66e88191ad02162d87916 (diff)
Refactor SkGLContext to be actually extendable
Refactor SkGLContext to be actually extendable. Before, non-trivial subclass would need to destroy the GL connection upon running the destructor. However, the base class would run GL commands in its own destructor (with destroyed GL connection) Refactor so that SkGLContext subclass object creation is completely done by the factory function. If the factory function returns a non-NULL ptr, it means the context is usable. The destruction is done with the destructor instead of virtual function called upon destruction. Make the destructors not to call virtual functions, for clarity. Remove custom 1x1 FBO setup code from the base class. It appears not to be used anymore. BUG=skia:2992 Review URL: https://codereview.chromium.org/640283004
Diffstat (limited to 'include/gpu/gl/SkDebugGLContext.h')
-rw-r--r--include/gpu/gl/SkDebugGLContext.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/include/gpu/gl/SkDebugGLContext.h b/include/gpu/gl/SkDebugGLContext.h
index 792666332e..ad157fa653 100644
--- a/include/gpu/gl/SkDebugGLContext.h
+++ b/include/gpu/gl/SkDebugGLContext.h
@@ -11,17 +11,19 @@
#include "SkGLContext.h"
class SkDebugGLContext : public SkGLContext {
-
public:
- SkDebugGLContext() {}
-
+ virtual ~SkDebugGLContext() SK_OVERRIDE;
virtual void makeCurrent() const SK_OVERRIDE {}
virtual void swapBuffers() const SK_OVERRIDE {}
-protected:
- virtual const GrGLInterface* createGLContext(GrGLStandard forcedGpuAPI) SK_OVERRIDE;
-
- virtual void destroyGLContext() SK_OVERRIDE {};
+ static SkDebugGLContext* Create(GrGLStandard forcedGpuAPI) {
+ if (kGLES_GrGLStandard == forcedGpuAPI) {
+ return NULL;
+ }
+ return SkNEW(SkDebugGLContext);
+ }
+private:
+ SkDebugGLContext();
};
#endif