Chromium Code Reviews| 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" |
| 11 #include <stdio.h> | 11 #include <stdio.h> |
| 12 #include <string> | |
| 12 | 13 |
| 13 void GrGLClearErr(const GrGLInterface* gl) { | 14 void GrGLClearErr(const GrGLInterface* gl) { |
| 14 while (GR_GL_NO_ERROR != gl->fFunctions.fGetError()) {} | 15 while (GR_GL_NO_ERROR != gl->fFunctions.fGetError()) {} |
| 15 } | 16 } |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| 18 const char *get_error_string(uint32_t err) { | 19 const char *get_error_string(uint32_t err) { |
| 19 switch (err) { | 20 switch (err) { |
| 20 case GR_GL_NO_ERROR: | 21 case GR_GL_NO_ERROR: |
| 21 return ""; | 22 return ""; |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 206 } | 207 } |
| 207 | 208 |
| 208 GrGLVendor GrGLGetVendorFromString(const char* vendorString) { | 209 GrGLVendor GrGLGetVendorFromString(const char* vendorString) { |
| 209 if (NULL != vendorString) { | 210 if (NULL != vendorString) { |
| 210 if (0 == strcmp(vendorString, "ARM")) { | 211 if (0 == strcmp(vendorString, "ARM")) { |
| 211 return kARM_GrGLVendor; | 212 return kARM_GrGLVendor; |
| 212 } | 213 } |
| 213 if (0 == strcmp(vendorString, "Imagination Technologies")) { | 214 if (0 == strcmp(vendorString, "Imagination Technologies")) { |
| 214 return kImagination_GrGLVendor; | 215 return kImagination_GrGLVendor; |
| 215 } | 216 } |
| 216 if (0 == strcmp(vendorString, "Intel")) { | 217 std::string vendorStringTmp(vendorString); |
| 218 if (0 == vendorStringTmp.compare(0, 6, "Intel ") || 0 == strcmp(vendorSt ring, "Intel")) { | |
|
bsalomon
2014/02/12 22:14:38
strncmp? Not totally opposed to std::string but si
| |
| 217 return kIntel_GrGLVendor; | 219 return kIntel_GrGLVendor; |
| 218 } | 220 } |
| 219 if (0 == strcmp(vendorString, "Qualcomm")) { | 221 if (0 == strcmp(vendorString, "Qualcomm")) { |
| 220 return kQualcomm_GrGLVendor; | 222 return kQualcomm_GrGLVendor; |
| 221 } | 223 } |
| 222 } | 224 } |
| 223 return kOther_GrGLVendor; | 225 return kOther_GrGLVendor; |
| 224 } | 226 } |
| 225 | 227 |
| 226 GrGLRenderer GrGLGetRendererFromString(const char* rendererString) { | 228 GrGLRenderer GrGLGetRendererFromString(const char* rendererString) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 293 dest[9] = 0; | 295 dest[9] = 0; |
| 294 dest[10] = 1; | 296 dest[10] = 1; |
| 295 dest[11] = 0; | 297 dest[11] = 0; |
| 296 | 298 |
| 297 // Col 3 | 299 // Col 3 |
| 298 dest[12] = SkScalarToFloat(src[SkMatrix::kMTransX]); | 300 dest[12] = SkScalarToFloat(src[SkMatrix::kMTransX]); |
| 299 dest[13] = SkScalarToFloat(src[SkMatrix::kMTransY]); | 301 dest[13] = SkScalarToFloat(src[SkMatrix::kMTransY]); |
| 300 dest[14] = 0; | 302 dest[14] = 0; |
| 301 dest[15] = SkScalarToFloat(src[SkMatrix::kMPersp2]); | 303 dest[15] = SkScalarToFloat(src[SkMatrix::kMPersp2]); |
| 302 } | 304 } |
| OLD | NEW |