diff options
author | qiankun.miao <qiankun.miao@intel.com> | 2014-12-10 07:40:36 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-10 07:40:36 -0800 |
commit | 28828d00b20d90b6caf91e4b0b31e80acadf2d57 (patch) | |
tree | a63893aa71d54e17c872e5d1c11d4b43b2222777 /gm/blurs.cpp | |
parent | 3054be16dfdb0d06233770cbfc338958edef44ea (diff) |
Add GM for 2-rects blur which cannot break into nine-patch
BUG=skia:
Review URL: https://codereview.chromium.org/791943002
Diffstat (limited to 'gm/blurs.cpp')
-rw-r--r-- | gm/blurs.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gm/blurs.cpp b/gm/blurs.cpp index 69c7210d47..74189330a3 100644 --- a/gm/blurs.cpp +++ b/gm/blurs.cpp @@ -133,3 +133,37 @@ public: } }; DEF_GM( return new Blur2RectsGM; ) + +class Blur2RectsNonNinePatchGM : public skiagm::GM { +public: + SkString onShortName() SK_OVERRIDE { + return SkString("blur2rectsnonninepatch"); + } + + SkISize onISize() SK_OVERRIDE { + return SkISize::Make(700, 500); + } + + void onDraw(SkCanvas* canvas) SK_OVERRIDE { + SkPaint paint; + paint.setMaskFilter(SkBlurMaskFilter::Create(kNormal_SkBlurStyle, + 4.3f))->unref(); + + SkRect outer = SkRect::MakeXYWH(10, 110, 100, 100); + SkRect inner = SkRect::MakeXYWH(50, 150, 10, 10); + SkPath path; + path.addRect(outer, SkPath::kCW_Direction); + path.addRect(inner, SkPath::kCW_Direction); + canvas->drawPath(path, paint); + + SkScalar dx = SkScalarRoundToScalar(path.getBounds().width()) + 40 + 0.25f; + canvas->translate(dx, 0); + canvas->drawPath(path, paint); + + // Translate to outside of clip bounds. + canvas->translate(-dx, 0); + canvas->translate(-30, -150); + canvas->drawPath(path, paint); + } +}; +DEF_GM( return new Blur2RectsNonNinePatchGM; ) |