| 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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 GR_GL_CALL_RET(gl, v, GetString(GR_GL_VENDOR)); | 327 GR_GL_CALL_RET(gl, v, GetString(GR_GL_VENDOR)); |
| 328 return GrGLGetVendorFromString((const char*) v); | 328 return GrGLGetVendorFromString((const char*) v); |
| 329 } | 329 } |
| 330 | 330 |
| 331 GrGLRenderer GrGLGetRenderer(const GrGLInterface* gl) { | 331 GrGLRenderer GrGLGetRenderer(const GrGLInterface* gl) { |
| 332 const GrGLubyte* v; | 332 const GrGLubyte* v; |
| 333 GR_GL_CALL_RET(gl, v, GetString(GR_GL_RENDERER)); | 333 GR_GL_CALL_RET(gl, v, GetString(GR_GL_RENDERER)); |
| 334 return GrGLGetRendererFromString((const char*) v); | 334 return GrGLGetRendererFromString((const char*) v); |
| 335 } | 335 } |
| 336 | 336 |
| 337 GrGLenum GrToGLStencilFunc(GrStencilFunc basicFunc) { | 337 GrGLenum GrToGLStencilFunc(GrStencilTest test) { |
| 338 static const GrGLenum gTable[] = { | 338 static const GrGLenum gTable[kGrStencilTestCount] = { |
| 339 GR_GL_ALWAYS, // kAlways_StencilFunc | 339 GR_GL_ALWAYS, // kAlways |
| 340 GR_GL_NEVER, // kNever_StencilFunc | 340 GR_GL_NEVER, // kNever |
| 341 GR_GL_GREATER, // kGreater_StencilFunc | 341 GR_GL_GREATER, // kGreater |
| 342 GR_GL_GEQUAL, // kGEqual_StencilFunc | 342 GR_GL_GEQUAL, // kGEqual |
| 343 GR_GL_LESS, // kLess_StencilFunc | 343 GR_GL_LESS, // kLess |
| 344 GR_GL_LEQUAL, // kLEqual_StencilFunc, | 344 GR_GL_LEQUAL, // kLEqual |
| 345 GR_GL_EQUAL, // kEqual_StencilFunc, | 345 GR_GL_EQUAL, // kEqual |
| 346 GR_GL_NOTEQUAL, // kNotEqual_StencilFunc, | 346 GR_GL_NOTEQUAL, // kNotEqual |
| 347 }; | 347 }; |
| 348 GR_STATIC_ASSERT(SK_ARRAY_COUNT(gTable) == kBasicStencilFuncCnt); | 348 GR_STATIC_ASSERT(0 == (int)GrStencilTest::kAlways); |
| 349 GR_STATIC_ASSERT(0 == kAlways_StencilFunc); | 349 GR_STATIC_ASSERT(1 == (int)GrStencilTest::kNever); |
| 350 GR_STATIC_ASSERT(1 == kNever_StencilFunc); | 350 GR_STATIC_ASSERT(2 == (int)GrStencilTest::kGreater); |
| 351 GR_STATIC_ASSERT(2 == kGreater_StencilFunc); | 351 GR_STATIC_ASSERT(3 == (int)GrStencilTest::kGEqual); |
| 352 GR_STATIC_ASSERT(3 == kGEqual_StencilFunc); | 352 GR_STATIC_ASSERT(4 == (int)GrStencilTest::kLess); |
| 353 GR_STATIC_ASSERT(4 == kLess_StencilFunc); | 353 GR_STATIC_ASSERT(5 == (int)GrStencilTest::kLEqual); |
| 354 GR_STATIC_ASSERT(5 == kLEqual_StencilFunc); | 354 GR_STATIC_ASSERT(6 == (int)GrStencilTest::kEqual); |
| 355 GR_STATIC_ASSERT(6 == kEqual_StencilFunc); | 355 GR_STATIC_ASSERT(7 == (int)GrStencilTest::kNotEqual); |
| 356 GR_STATIC_ASSERT(7 == kNotEqual_StencilFunc); | 356 SkASSERT(test < (GrStencilTest)kGrStencilTestCount); |
| 357 SkASSERT((unsigned) basicFunc < kBasicStencilFuncCnt); | |
| 358 | 357 |
| 359 return gTable[basicFunc]; | 358 return gTable[(int)test]; |
| 360 } | 359 } |
| OLD | NEW |