| 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 #include "gl/SkGLContextHelper.h" | 8 #include "gl/SkGLContext.h" |
| 9 #include "GrGLUtil.h" | 9 #include "GrGLUtil.h" |
| 10 | 10 |
| 11 SkGLContextHelper::SkGLContextHelper() | 11 SkGLContext::SkGLContext() |
| 12 : fFBO(0) | 12 : fFBO(0) |
| 13 , fColorBufferID(0) | 13 , fColorBufferID(0) |
| 14 , fDepthStencilBufferID(0) | 14 , fDepthStencilBufferID(0) |
| 15 , fGL(NULL) { | 15 , fGL(NULL) { |
| 16 } | 16 } |
| 17 | 17 |
| 18 SkGLContextHelper::~SkGLContextHelper() { | 18 SkGLContext::~SkGLContext() { |
| 19 | 19 |
| 20 if (fGL) { | 20 if (fGL) { |
| 21 // TODO: determine why DeleteFramebuffers is generating a GL error in te
sts | 21 // TODO: determine why DeleteFramebuffers is generating a GL error in te
sts |
| 22 SK_GL_NOERRCHECK(*this, DeleteFramebuffers(1, &fFBO)); | 22 SK_GL_NOERRCHECK(*this, DeleteFramebuffers(1, &fFBO)); |
| 23 SK_GL_NOERRCHECK(*this, DeleteRenderbuffers(1, &fColorBufferID)); | 23 SK_GL_NOERRCHECK(*this, DeleteRenderbuffers(1, &fColorBufferID)); |
| 24 SK_GL_NOERRCHECK(*this, DeleteRenderbuffers(1, &fDepthStencilBufferID)); | 24 SK_GL_NOERRCHECK(*this, DeleteRenderbuffers(1, &fDepthStencilBufferID)); |
| 25 } | 25 } |
| 26 | 26 |
| 27 SkSafeUnref(fGL); | 27 SkSafeUnref(fGL); |
| 28 } | 28 } |
| 29 | 29 |
| 30 bool SkGLContextHelper::init(GrGLStandard forcedGpuAPI, int width, | 30 bool SkGLContext::init(GrGLStandard forcedGpuAPI, int width, |
| 31 int height) { | 31 int height) { |
| 32 if (fGL) { | 32 if (fGL) { |
| 33 fGL->unref(); | 33 fGL->unref(); |
| 34 this->destroyGLContext(); | 34 this->destroyGLContext(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 fGL = this->createGLContext(forcedGpuAPI); | 37 fGL = this->createGLContext(forcedGpuAPI); |
| 38 if (fGL) { | 38 if (fGL) { |
| 39 const GrGLubyte* temp; | 39 const GrGLubyte* temp; |
| 40 | 40 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 fGL = NULL; | 128 fGL = NULL; |
| 129 this->destroyGLContext(); | 129 this->destroyGLContext(); |
| 130 return false; | 130 return false; |
| 131 } else { | 131 } else { |
| 132 return true; | 132 return true; |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 return false; | 135 return false; |
| 136 } | 136 } |
| 137 | 137 |
| 138 void SkGLContextHelper::testAbandon() { | 138 void SkGLContext::testAbandon() { |
| 139 if (fGL) { | 139 if (fGL) { |
| 140 fGL->abandon(); | 140 fGL->abandon(); |
| 141 } | 141 } |
| 142 } | 142 } |
| OLD | NEW |