From 3d1a6bc5f3124dd5cd237ccc39ead26fe4b3355f Mon Sep 17 00:00:00 2001 From: Florin Malita Date: Thu, 9 Feb 2017 15:05:15 -0500 Subject: [4fGradient] Relax interval checks for SkGradientShaderBase also Similar to https://skia-review.googlesource.com/8270, treat intervals as closed at both extremities in the 4f gradient fallback impl also. BUG=skia:6212 Change-Id: I7f164868202ae6a0f76cbcdbcbf8e62db12a1bd4 Reviewed-on: https://skia-review.googlesource.com/8277 Commit-Queue: Florin Malita Reviewed-by: Mike Reed --- tests/GradientTest.cpp | 45 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 9 deletions(-) (limited to 'tests/GradientTest.cpp') diff --git a/tests/GradientTest.cpp b/tests/GradientTest.cpp index dc8a2bd6a5..4cdd0c94bc 100644 --- a/tests/GradientTest.cpp +++ b/tests/GradientTest.cpp @@ -370,8 +370,18 @@ static void test_degenerate_linear(skiatest::Reporter*) { // "Interesting" fuzzer values. static void test_linear_fuzzer(skiatest::Reporter*) { static const SkColor gColors0[] = { 0x30303030, 0x30303030 }; + static const SkColor gColors1[] = { 0x30303030, 0x30303030, 0x30303030 }; + + static const SkScalar gPos1[] = { 0, 0, 1 }; + static const SkScalar gMatrix0[9] = - { 6.40969056e-10f, 0, 6.40969056e-10f, 0, 4.42539023e-39f, 6.40969056e-10f, 0, 0, 1 }; + { 6.40969056e-10f, 0 , 6.40969056e-10f, + 0 , 4.42539023e-39f, 6.40969056e-10f, + 0 , 0 , 1 }; + static const SkScalar gMatrix1[9] = + { -2.75294113f , 6.40969056e-10f, 6.40969056e-10f, + 6.40969056e-10f, 6.40969056e-10f, -3.32810161e+24f, + 6.40969056e-10f, 6.40969056e-10f, 0 }; static const struct { SkPoint fPts[2]; @@ -384,14 +394,24 @@ static void test_linear_fuzzer(skiatest::Reporter*) { const SkScalar* fGlobalMatrix; } gConfigs[] = { { - {{0, -2.752941f}, {0, 0}}, - gColors0, - nullptr, - SK_ARRAY_COUNT(gColors0), - SkShader::kClamp_TileMode, - 0, - gMatrix0, - nullptr + {{0, -2.752941f}, {0, 0}}, + gColors0, + nullptr, + SK_ARRAY_COUNT(gColors0), + SkShader::kClamp_TileMode, + 0, + gMatrix0, + nullptr + }, + { + {{4.42539023e-39f, -4.42539023e-39f}, {9.78041162e-15f, 4.42539023e-39f}}, + gColors1, + gPos1, + SK_ARRAY_COUNT(gColors1), + SkShader::kClamp_TileMode, + 0, + nullptr, + gMatrix1 }, }; @@ -417,6 +437,13 @@ static void test_linear_fuzzer(skiatest::Reporter*) { config.fTileMode, config.fFlags | forceFlags, localMatrix.getMaybeNull())); + if (config.fGlobalMatrix) { + SkMatrix m; + m.set9(config.fGlobalMatrix); + canvas->save(); + canvas->concat(m); + } + canvas->drawPaint(paint); } } -- cgit v1.2.3