| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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/SkGLContext.h" | 8 #include "gl/SkGLContext.h" |
| 9 #include "AvailabilityMacros.h" | 9 #include "AvailabilityMacros.h" |
| 10 | 10 |
| 11 #include <OpenGL/OpenGL.h> | 11 #include <OpenGL/OpenGL.h> |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 class MacGLContext : public SkGLContext { | 14 class MacGLContext : public SkGLContext { |
| 15 public: | 15 public: |
| 16 MacGLContext(); | 16 MacGLContext(); |
| 17 virtual ~MacGLContext() SK_OVERRIDE; | 17 ~MacGLContext() SK_OVERRIDE; |
| 18 virtual void makeCurrent() const SK_OVERRIDE; | 18 void makeCurrent() const SK_OVERRIDE; |
| 19 virtual void swapBuffers() const SK_OVERRIDE; | 19 void swapBuffers() const SK_OVERRIDE; |
| 20 | 20 |
| 21 private: | 21 private: |
| 22 void destroyGLContext(); | 22 void destroyGLContext(); |
| 23 | 23 |
| 24 CGLContextObj fContext; | 24 CGLContextObj fContext; |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 MacGLContext::MacGLContext() | 27 MacGLContext::MacGLContext() |
| 28 : fContext(NULL) { | 28 : fContext(NULL) { |
| 29 CGLPixelFormatAttribute attributes[] = { | 29 CGLPixelFormatAttribute attributes[] = { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 if (kGLES_GrGLStandard == forcedGpuAPI) { | 92 if (kGLES_GrGLStandard == forcedGpuAPI) { |
| 93 return NULL; | 93 return NULL; |
| 94 } | 94 } |
| 95 MacGLContext* ctx = SkNEW(MacGLContext); | 95 MacGLContext* ctx = SkNEW(MacGLContext); |
| 96 if (!ctx->isValid()) { | 96 if (!ctx->isValid()) { |
| 97 SkDELETE(ctx); | 97 SkDELETE(ctx); |
| 98 return NULL; | 98 return NULL; |
| 99 } | 99 } |
| 100 return ctx; | 100 return ctx; |
| 101 } | 101 } |
| OLD | NEW |