diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-06-10 18:58:11 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-06-10 18:58:11 +0000 |
commit | 4e05fd25c88bea64a988ededfc810770095ed97c (patch) | |
tree | 2b289b8b250ee5e1a16845d433969b7f1889b4ab /gm/aaclip.cpp | |
parent | 110aff281669d7e346d94cd1dfb681cb6b4a9ba9 (diff) |
add conic support to hairlines
git-svn-id: http://skia.googlecode.com/svn/trunk@9493 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm/aaclip.cpp')
-rw-r--r-- | gm/aaclip.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gm/aaclip.cpp b/gm/aaclip.cpp index f59f6aa2b3..6ebb88c0dc 100644 --- a/gm/aaclip.cpp +++ b/gm/aaclip.cpp @@ -9,6 +9,34 @@ #include "SkCanvas.h" #include "SkPath.h" +static void draw_conic(SkCanvas* canvas, SkScalar weight, const SkPaint& paint) { + SkPath path; + path.moveTo(100, 100); + path.conicTo(300, 100, 300, 300, weight); + canvas->drawPath(path, paint); +} + +static void test_conic(SkCanvas* canvas) { + SkPaint paint; + paint.setAntiAlias(true); + paint.setStyle(SkPaint::kStroke_Style); + + static const struct { + SkScalar fWeight; + SkColor fColor; + } gRec[] = { + { 2 , SK_ColorRED }, + { 1 , SK_ColorGREEN }, + { 0.5f, SK_ColorBLUE }, + }; + + for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) { + paint.setColor(gRec[i].fColor); + draw_conic(canvas, gRec[i].fWeight, paint); + canvas->translate(-30, 30); + } +} + #include "SkGradientShader.h" static void test_shallow_gradient(SkCanvas* canvas, SkScalar width, SkScalar height) { SkColor colors[] = { 0xFF7F7F7F, 0xFF7F7F7F, 0xFF000000 }; @@ -219,6 +247,7 @@ protected: } virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { + if (false) { test_conic(canvas); return; } if (false) { SkRect bounds; canvas->getClipBounds(&bounds); |