OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 #include "GrGLUtil.h" | 9 #include "GrGLUtil.h" |
10 #include "SkMatrix.h" | 10 #include "SkMatrix.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 #endif | 92 #endif |
93 | 93 |
94 #if GR_GL_CHECK_ERROR | 94 #if GR_GL_CHECK_ERROR |
95 bool gCheckErrorGL = !!(GR_GL_CHECK_ERROR_START); | 95 bool gCheckErrorGL = !!(GR_GL_CHECK_ERROR_START); |
96 #endif | 96 #endif |
97 | 97 |
98 /////////////////////////////////////////////////////////////////////////////// | 98 /////////////////////////////////////////////////////////////////////////////// |
99 | 99 |
100 GrGLStandard GrGLGetStandardInUseFromString(const char* versionString) { | 100 GrGLStandard GrGLGetStandardInUseFromString(const char* versionString) { |
101 if (NULL == versionString) { | 101 if (NULL == versionString) { |
102 SkDEBUGFAIL("NULL GL version string."); | 102 SkDebugf("NULL GL version string."); |
103 return kNone_GrGLStandard; | 103 return kNone_GrGLStandard; |
104 } | 104 } |
105 | 105 |
106 int major, minor; | 106 int major, minor; |
107 | 107 |
108 // check for desktop | 108 // check for desktop |
109 int n = sscanf(versionString, "%d.%d", &major, &minor); | 109 int n = sscanf(versionString, "%d.%d", &major, &minor); |
110 if (2 == n) { | 110 if (2 == n) { |
111 return kGL_GrGLStandard; | 111 return kGL_GrGLStandard; |
112 } | 112 } |
(...skipping 19 matching lines...) Expand all Loading... |
132 int n = sscanf(versionString, "%d.%d Mesa %d.%d", &major, &minor, &mesaMajor
, &mesaMinor); | 132 int n = sscanf(versionString, "%d.%d Mesa %d.%d", &major, &minor, &mesaMajor
, &mesaMinor); |
133 return 4 == n; | 133 return 4 == n; |
134 } | 134 } |
135 | 135 |
136 bool GrGLIsChromiumFromRendererString(const char* rendererString) { | 136 bool GrGLIsChromiumFromRendererString(const char* rendererString) { |
137 return 0 == strcmp(rendererString, "Chromium"); | 137 return 0 == strcmp(rendererString, "Chromium"); |
138 } | 138 } |
139 | 139 |
140 GrGLVersion GrGLGetVersionFromString(const char* versionString) { | 140 GrGLVersion GrGLGetVersionFromString(const char* versionString) { |
141 if (NULL == versionString) { | 141 if (NULL == versionString) { |
142 SkDEBUGFAIL("NULL GL version string."); | 142 SkDebugf("NULL GL version string."); |
143 return GR_GL_INVALID_VER; | 143 return GR_GL_INVALID_VER; |
144 } | 144 } |
145 | 145 |
146 int major, minor; | 146 int major, minor; |
147 | 147 |
148 // check for mesa | 148 // check for mesa |
149 int mesaMajor, mesaMinor; | 149 int mesaMajor, mesaMinor; |
150 int n = sscanf(versionString, "%d.%d Mesa %d.%d", &major, &minor, &mesaMajor
, &mesaMinor); | 150 int n = sscanf(versionString, "%d.%d Mesa %d.%d", &major, &minor, &mesaMajor
, &mesaMinor); |
151 if (4 == n) { | 151 if (4 == n) { |
152 if (get_gl_version_for_mesa(mesaMajor, &major, &minor)) { | 152 if (get_gl_version_for_mesa(mesaMajor, &major, &minor)) { |
(...skipping 18 matching lines...) Expand all Loading... |
171 n = sscanf(versionString, "OpenGL ES %d.%d", &major, &minor); | 171 n = sscanf(versionString, "OpenGL ES %d.%d", &major, &minor); |
172 if (2 == n) { | 172 if (2 == n) { |
173 return GR_GL_VER(major, minor); | 173 return GR_GL_VER(major, minor); |
174 } | 174 } |
175 | 175 |
176 return GR_GL_INVALID_VER; | 176 return GR_GL_INVALID_VER; |
177 } | 177 } |
178 | 178 |
179 GrGLSLVersion GrGLGetGLSLVersionFromString(const char* versionString) { | 179 GrGLSLVersion GrGLGetGLSLVersionFromString(const char* versionString) { |
180 if (NULL == versionString) { | 180 if (NULL == versionString) { |
181 SkDEBUGFAIL("NULL GLSL version string."); | 181 SkDebugf("NULL GLSL version string."); |
182 return GR_GLSL_INVALID_VER; | 182 return GR_GLSL_INVALID_VER; |
183 } | 183 } |
184 | 184 |
185 int major, minor; | 185 int major, minor; |
186 | 186 |
187 int n = sscanf(versionString, "%d.%d", &major, &minor); | 187 int n = sscanf(versionString, "%d.%d", &major, &minor); |
188 if (2 == n) { | 188 if (2 == n) { |
189 return GR_GLSL_VER(major, minor); | 189 return GR_GLSL_VER(major, minor); |
190 } | 190 } |
191 | 191 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 dest[9] = 0; | 293 dest[9] = 0; |
294 dest[10] = 1; | 294 dest[10] = 1; |
295 dest[11] = 0; | 295 dest[11] = 0; |
296 | 296 |
297 // Col 3 | 297 // Col 3 |
298 dest[12] = SkScalarToFloat(src[SkMatrix::kMTransX]); | 298 dest[12] = SkScalarToFloat(src[SkMatrix::kMTransX]); |
299 dest[13] = SkScalarToFloat(src[SkMatrix::kMTransY]); | 299 dest[13] = SkScalarToFloat(src[SkMatrix::kMTransY]); |
300 dest[14] = 0; | 300 dest[14] = 0; |
301 dest[15] = SkScalarToFloat(src[SkMatrix::kMPersp2]); | 301 dest[15] = SkScalarToFloat(src[SkMatrix::kMPersp2]); |
302 } | 302 } |
OLD | NEW |