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/SkGLContextHelper.h" |
9 #include "GrGLUtil.h" | 9 #include "GrGLUtil.h" |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 bool SkGLContextHelper::init(int width, int height) { | 30 bool SkGLContextHelper::init(int width, int height) { |
31 if (fGL) { | 31 if (fGL) { |
32 fGL->unref(); | 32 fGL->unref(); |
33 this->destroyGLContext(); | 33 this->destroyGLContext(); |
34 } | 34 } |
35 | 35 |
36 fGL = this->createGLContext(); | 36 fGL = this->createGLContext(); |
37 if (fGL) { | 37 if (fGL) { |
38 const GrGLubyte* temp; | 38 const GrGLubyte* temp; |
39 | 39 |
40 if (!fGL->validate() || !fExtensions.init(fGL)) { | 40 if (!fGL->validate()) { |
41 fGL = NULL; | 41 fGL = NULL; |
42 this->destroyGLContext(); | 42 this->destroyGLContext(); |
43 return false; | 43 return false; |
44 } | 44 } |
45 | 45 |
46 SK_GL_RET(*this, temp, GetString(GR_GL_VERSION)); | 46 SK_GL_RET(*this, temp, GetString(GR_GL_VERSION)); |
47 const char* versionStr = reinterpret_cast<const char*>(temp); | 47 const char* versionStr = reinterpret_cast<const char*>(temp); |
48 GrGLVersion version = GrGLGetVersionFromString(versionStr); | 48 GrGLVersion version = GrGLGetVersionFromString(versionStr); |
49 | 49 |
50 // clear any existing GL erorrs | 50 // clear any existing GL erorrs |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 fGL->unref(); | 126 fGL->unref(); |
127 fGL = NULL; | 127 fGL = NULL; |
128 this->destroyGLContext(); | 128 this->destroyGLContext(); |
129 return false; | 129 return false; |
130 } else { | 130 } else { |
131 return true; | 131 return true; |
132 } | 132 } |
133 } | 133 } |
134 return false; | 134 return false; |
135 } | 135 } |
OLD | NEW |