From 3d8bf232bd2e4903d2ee2bb575637e7555361604 Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Mon, 28 Apr 2014 19:49:24 +0000 Subject: Fast path for blurred round rects -- blur a small 9patch rect on the CPU And nonlinearly stretch the resulting texture across proxy geometry. BUG= Committed: http://code.google.com/p/skia/source/detail?r=14392 Committed: http://code.google.com/p/skia/source/detail?r=14404 R=bsalomon@google.com, reed@google.com Author: humper@google.com Review URL: https://codereview.chromium.org/248613004 git-svn-id: http://skia.googlecode.com/svn/trunk@14420 2bbb7eff-a529-9590-31e7-b0007b416f81 --- gm/blurroundrect.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'gm/blurroundrect.cpp') diff --git a/gm/blurroundrect.cpp b/gm/blurroundrect.cpp index 15f3efc4a4..6221480d55 100644 --- a/gm/blurroundrect.cpp +++ b/gm/blurroundrect.cpp @@ -106,30 +106,32 @@ protected: } virtual SkISize onISize() SK_OVERRIDE { - return SkISize::Make(750, 750); + return SkISize::Make(950, 950); } virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { canvas->scale(1.5f, 1.5f); + canvas->translate(50,50); - const int blurRadii[] = { 1, 3, 6, 10 }; - const int cornerRadii[] = { 1, 3, 6, 10 }; + const float blurRadii[] = { 1,5,10,20 }; + const int cornerRadii[] = { 1,5,10,20 }; const SkRect r = SkRect::MakeWH(SkIntToScalar(100), SkIntToScalar(100)); for (size_t i = 0; i < SK_ARRAY_COUNT(blurRadii); ++i) { SkAutoCanvasRestore autoRestore(canvas, true); - canvas->translate(0, (r.height() + SkIntToScalar(20)) * i); + canvas->translate(0, (r.height() + SkIntToScalar(50)) * i); for (size_t j = 0; j < SK_ARRAY_COUNT(cornerRadii); ++j) { SkMaskFilter* filter = SkBlurMaskFilter::Create( kNormal_SkBlurStyle, - SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(blurRadii[i]))); + SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(blurRadii[i])), + SkBlurMaskFilter::kHighQuality_BlurFlag); SkPaint paint; - paint.setColor(SK_ColorBLUE); + paint.setColor(SK_ColorBLACK); paint.setMaskFilter(filter)->unref(); SkRRect rrect; rrect.setRectXY(r, SkIntToScalar(cornerRadii[j]), SkIntToScalar(cornerRadii[j])); canvas->drawRRect(rrect, paint); - canvas->translate(r.width() + SkIntToScalar(10), 0); + canvas->translate(r.width() + SkIntToScalar(50), 0); } } } -- cgit v1.2.3