diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-02-04 16:56:15 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-02-04 16:56:15 +0000 |
commit | 83f7c659461d602e498569dab63f04b1b578b742 (patch) | |
tree | 45950f79b37420470088bd038bb70f954a524ddd /gm/aaclip.cpp | |
parent | 5b7bac5ce162eee6d73c33373029a4e5a9f94683 (diff) |
add new gms for shallow_gradient, in preparation for improving their quality
git-svn-id: http://skia.googlecode.com/svn/trunk@7544 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm/aaclip.cpp')
-rw-r--r-- | gm/aaclip.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gm/aaclip.cpp b/gm/aaclip.cpp index 88e1cd4606..f9cecf4e42 100644 --- a/gm/aaclip.cpp +++ b/gm/aaclip.cpp @@ -9,6 +9,19 @@ #include "SkCanvas.h" #include "SkPath.h" +#include "SkGradientShader.h" +static void test_shallow_gradient(SkCanvas* canvas, SkScalar width, SkScalar height) { + SkColor colors[] = { 0xFF7F7F7F, 0xFF7F7F7F, 0xFF000000 }; + SkScalar pos[] = { 0, 0.35f, SK_Scalar1 }; + SkPoint pts[] = { { 0, 0 }, { width, height } }; + SkShader* s = SkGradientShader::CreateLinear(pts, colors, pos, + SK_ARRAY_COUNT(colors), + SkShader::kClamp_TileMode); + SkPaint paint; + paint.setShader(s)->unref(); + canvas->drawPaint(paint); +} + #include "SkDashPathEffect.h" static void test_giant_dash(SkCanvas* canvas) { SkPaint paint; @@ -37,6 +50,8 @@ static void test_giant_dash(SkCanvas* canvas) { } } + + // Reproduces bug found here: http://jsfiddle.net/R8Cu5/1/ // #include "SkGradientShader.h" @@ -207,6 +222,11 @@ protected: virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { if (false) { + SkRect bounds; + canvas->getClipBounds(&bounds); + test_shallow_gradient(canvas, bounds.width(), bounds.height()); return; + } + if (false) { test_giant_dash(canvas); return; } if (false) { |