| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 #include "gl/SkNativeGLContext.h" | 8 #include "gl/SkGLContext.h" |
| 9 | 9 |
| 10 SkNativeGLContext::AutoContextRestore::AutoContextRestore() { | 10 #include <GLES2/gl2.h> |
| 11 } | 11 #include <EGL/egl.h> |
| 12 | 12 |
| 13 SkNativeGLContext::AutoContextRestore::~AutoContextRestore() { | 13 namespace { |
| 14 } | 14 class SkGLContextNACL : public SkGLContext { |
| 15 public: |
| 16 SkGLContextEGL(); |
| 15 | 17 |
| 16 SkNativeGLContext::SkNativeGLContext() | 18 virtual ~SkGLContextNACL(); |
| 19 |
| 20 virtual void makeCurrent() const SK_OVERRIDE; |
| 21 virtual void swapBuffers() const SK_OVERRIDE; |
| 22 protected: |
| 23 virtual const GrGLInterface* createGLContext(GrGLStandard forcedGpuAPI) SK_O
VERRIDE; |
| 24 virtual void destroyGLContext() SK_OVERRIDE; |
| 25 |
| 26 private: |
| 27 EGLContext fContext; |
| 28 EGLDisplay fDisplay; |
| 29 EGLSurface fSurface; |
| 30 }; |
| 31 |
| 32 SkGLContextNACL::SkGLContextNACL() |
| 17 : fContext(NULL) | 33 : fContext(NULL) |
| 18 , fDisplay(NULL) | 34 , fDisplay(NULL) |
| 19 { | 35 { |
| 20 } | 36 } |
| 21 | 37 |
| 22 SkNativeGLContext::~SkNativeGLContext() { | 38 SkGLContextNACL::~SkGLContextNACL() { |
| 23 this->destroyGLContext(); | 39 this->destroyGLContext(); |
| 24 } | 40 } |
| 25 | 41 |
| 26 void SkNativeGLContext::destroyGLContext() { | 42 void SkGLContextNACL::destroyGLContext() { |
| 27 } | 43 } |
| 28 | 44 |
| 29 const GrGLInterface* SkNativeGLContext::createGLContext(GrGLStandard forcedGpuAP
I) { | 45 const GrGLInterface* SkGLContextNACL::createGLContext(GrGLStandard forcedGpuAPI)
{ |
| 30 return NULL; | 46 return NULL; |
| 31 } | 47 } |
| 32 | 48 |
| 33 void SkNativeGLContext::makeCurrent() const { | 49 void SkGLContextNACL::makeCurrent() const { |
| 34 } | 50 } |
| 35 | 51 |
| 36 void SkNativeGLContext::swapBuffers() const { | 52 void SkGLContextNACL::swapBuffers() const { |
| 37 } | 53 } |
| 54 |
| 55 } // anonymous namespace |
| 56 |
| 57 SkGLContextNACL* SkCreateGLContext() { |
| 58 return SkNEW(SkGLContextNACL); |
| 59 } |
| 60 |
| OLD | NEW |