| Index: gm/bigblurs.cpp
|
| ===================================================================
|
| --- gm/bigblurs.cpp (revision 12202)
|
| +++ gm/bigblurs.cpp (working copy)
|
| @@ -13,9 +13,13 @@
|
| namespace skiagm {
|
|
|
| // This GM exercises the blurred rect nine-patching special cases when the
|
| -// blurred rect is very large and/or very far from the origin.
|
| -// It creates a large blurred rect/rectori then renders the 4 corners and the
|
| -// middle.
|
| +// blurred geometry is very large and/or very far from the origin.
|
| +// It creates large blurred geometry then renders the 4 corners and the middle.
|
| +// The three geometries tested are:
|
| +// a large rect
|
| +// a large thin rectorii (inner rect is only 20 inside outer rect)
|
| +// a large thick rectorii (inner rect is tiny compared to outer rect)
|
| +// This last case is inappropriate for the nine-patch fast path.
|
| class BigBlursGM : public GM {
|
| public:
|
| BigBlursGM() {
|
| @@ -39,11 +43,16 @@
|
| SkRect insetRect = bigRect;
|
| insetRect.inset(20, 20);
|
|
|
| - SkPath rectori;
|
| + SkPath thinRectori;
|
| + thinRectori.addRect(bigRect);
|
| + thinRectori.addRect(insetRect, SkPath::kCCW_Direction);
|
|
|
| - rectori.addRect(bigRect);
|
| - rectori.addRect(insetRect, SkPath::kCCW_Direction);
|
| + insetRect.inset(kBig/2-40, kBig/2-40);
|
|
|
| + SkPath thickRectori;
|
| + thickRectori.addRect(bigRect);
|
| + thickRectori.addRect(insetRect, SkPath::kCCW_Direction);
|
| +
|
| // The blur extends 3*kSigma out from the big rect.
|
| // Offset the close-up windows so we get the entire blur
|
| static const SkScalar kLeftTopPad = 3*kSigma; // use on left & up of big rect
|
| @@ -68,7 +77,7 @@
|
|
|
| int desiredX = 0, desiredY = 0;
|
|
|
| - for (int i = 0; i < 2; ++i) {
|
| + for (int i = 0; i < kNumGeometryTypes; ++i) {
|
| for (int j = 0; j < SkBlurMaskFilter::kBlurStyleCount; ++j) {
|
| SkMaskFilter* mf = SkBlurMaskFilter::Create((SkBlurMaskFilter::BlurStyle)j,
|
| kSigma);
|
| @@ -89,9 +98,12 @@
|
|
|
| if (0 == i) {
|
| canvas->drawRect(bigRect, blurPaint);
|
| + } else if (1 == i) {
|
| + canvas->drawPath(thinRectori, blurPaint);
|
| } else {
|
| - canvas->drawPath(rectori, blurPaint);
|
| + canvas->drawPath(thickRectori, blurPaint);
|
| }
|
| +
|
| canvas->restore();
|
| canvas->drawRect(clipRect, outlinePaint);
|
|
|
| @@ -105,9 +117,12 @@
|
| }
|
|
|
| private:
|
| + static const int kNumGeometryTypes = 3;
|
| static const int kCloseUpSize = 64;
|
| static const int kWidth = 5 * kCloseUpSize;
|
| - static const int kHeight = 2 * SkBlurMaskFilter::kBlurStyleCount * kCloseUpSize;
|
| + static const int kHeight = kNumGeometryTypes *
|
| + SkBlurMaskFilter::kBlurStyleCount *
|
| + kCloseUpSize;
|
|
|
| typedef GM INHERITED;
|
| };
|
|
|