Chromium Code Reviews| Index: src/gpu/gl/GrGLPathRendering.cpp |
| diff --git a/src/gpu/gl/GrGLPathRendering.cpp b/src/gpu/gl/GrGLPathRendering.cpp |
| index 441967edc5ab868966b2a9dce7f09da5549bfcf5..5ed37b22cd466c99c01d22fabf6efca20e5ab8c2 100644 |
| --- a/src/gpu/gl/GrGLPathRendering.cpp |
| +++ b/src/gpu/gl/GrGLPathRendering.cpp |
| @@ -49,6 +49,22 @@ GR_STATIC_ASSERT(3 == GrPathRendering::kTranslate_PathTransformType); |
| GR_STATIC_ASSERT(4 == GrPathRendering::kAffine_PathTransformType); |
| GR_STATIC_ASSERT(GrPathRendering::kAffine_PathTransformType == GrPathRendering::kLast_PathTransformType); |
| +#ifdef SK_DEBUG |
| +static const GrGLenum gXformType2ComponentCount[] = { |
| + 0, |
| + 1, |
| + 1, |
| + 2, |
| + 6 |
| +}; |
| + |
| +static void verify_floats(const float* floats, int count) { |
| + for (int i = 0; i < count; ++i) { |
| + SkASSERT(!SkScalarIsNaN(SkFloatToScalar(floats[i]))); |
| + } |
| +} |
| +#endif |
| + |
| static GrGLenum gr_stencil_op_to_gl_path_rendering_fill_mode(GrStencilOp op) { |
| switch (op) { |
| default: |
| @@ -155,6 +171,9 @@ void GrGLPathRendering::onDrawPaths(const DrawPathArgs& args, const GrPathRange* |
| const void* indices, PathIndexType indexType, |
| const float transformValues[], PathTransformType transformType, |
| int count) { |
| + SkDEBUGCODE( |
| + verify_floats(transformValues, gXformType2ComponentCount[transformType] * count)); |
| + |
| if (!this->gpu()->flushGLState(args)) { |
| return; |
| } |
| @@ -210,6 +229,8 @@ void GrGLPathRendering::setProgramPathFragmentInputTransform(GrGLuint program, G |
| coefficients[7] = SkScalarToFloat(matrix[SkMatrix::kMPersp1]); |
| coefficients[8] = SkScalarToFloat(matrix[SkMatrix::kMPersp2]); |
| } |
| + SkDEBUGCODE( |
|
jvanverth1
2016/03/03 15:29:06
Is there a reason this (and the change below it) i
Kimmo Kinnunen
2016/03/04 08:03:07
Done.
|
| + verify_floats(coefficients, components * 3)); |
| GL_CALL(ProgramPathFragmentInputGen(program, location, genMode, components, coefficients)); |
| } |
| @@ -232,6 +253,8 @@ void GrGLPathRendering::setProjectionMatrix(const SkMatrix& matrix, |
| float glMatrix[4 * 4]; |
| fHWProjectionMatrixState.getRTAdjustedGLMatrix<4>(glMatrix); |
| + SkDEBUGCODE( |
| + verify_floats(glMatrix, SK_ARRAY_COUNT(glMatrix))); |
| GL_CALL(MatrixLoadf(GR_GL_PATH_PROJECTION, glMatrix)); |
| } |