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(GrStencilTest test) { | 337 GrGLenum GrToGLStencilFunc(GrStencilFunc basicFunc) { |
338 static const GrGLenum gTable[kGrStencilTestCount] = { | 338 static const GrGLenum gTable[] = { |
339 GR_GL_ALWAYS, // kAlways | 339 GR_GL_ALWAYS, // kAlways_StencilFunc |
340 GR_GL_NEVER, // kNever | 340 GR_GL_NEVER, // kNever_StencilFunc |
341 GR_GL_GREATER, // kGreater | 341 GR_GL_GREATER, // kGreater_StencilFunc |
342 GR_GL_GEQUAL, // kGEqual | 342 GR_GL_GEQUAL, // kGEqual_StencilFunc |
343 GR_GL_LESS, // kLess | 343 GR_GL_LESS, // kLess_StencilFunc |
344 GR_GL_LEQUAL, // kLEqual | 344 GR_GL_LEQUAL, // kLEqual_StencilFunc, |
345 GR_GL_EQUAL, // kEqual | 345 GR_GL_EQUAL, // kEqual_StencilFunc, |
346 GR_GL_NOTEQUAL, // kNotEqual | 346 GR_GL_NOTEQUAL, // kNotEqual_StencilFunc, |
347 }; | 347 }; |
348 GR_STATIC_ASSERT(0 == (int)GrStencilTest::kAlways); | 348 GR_STATIC_ASSERT(SK_ARRAY_COUNT(gTable) == kBasicStencilFuncCnt); |
349 GR_STATIC_ASSERT(1 == (int)GrStencilTest::kNever); | 349 GR_STATIC_ASSERT(0 == kAlways_StencilFunc); |
350 GR_STATIC_ASSERT(2 == (int)GrStencilTest::kGreater); | 350 GR_STATIC_ASSERT(1 == kNever_StencilFunc); |
351 GR_STATIC_ASSERT(3 == (int)GrStencilTest::kGEqual); | 351 GR_STATIC_ASSERT(2 == kGreater_StencilFunc); |
352 GR_STATIC_ASSERT(4 == (int)GrStencilTest::kLess); | 352 GR_STATIC_ASSERT(3 == kGEqual_StencilFunc); |
353 GR_STATIC_ASSERT(5 == (int)GrStencilTest::kLEqual); | 353 GR_STATIC_ASSERT(4 == kLess_StencilFunc); |
354 GR_STATIC_ASSERT(6 == (int)GrStencilTest::kEqual); | 354 GR_STATIC_ASSERT(5 == kLEqual_StencilFunc); |
355 GR_STATIC_ASSERT(7 == (int)GrStencilTest::kNotEqual); | 355 GR_STATIC_ASSERT(6 == kEqual_StencilFunc); |
356 SkASSERT(test < (GrStencilTest)kGrStencilTestCount); | 356 GR_STATIC_ASSERT(7 == kNotEqual_StencilFunc); |
| 357 SkASSERT((unsigned) basicFunc < kBasicStencilFuncCnt); |
357 | 358 |
358 return gTable[(int)test]; | 359 return gTable[basicFunc]; |
359 } | 360 } |
OLD | NEW |