| Index: gm/blurs.cpp
|
| diff --git a/gm/blurs.cpp b/gm/blurs.cpp
|
| index ad363e425d6011fc62033cc777cc0f591c47c891..2ca1193e22e435f43fb21d9a5f7248c0ce66358a 100644
|
| --- a/gm/blurs.cpp
|
| +++ b/gm/blurs.cpp
|
| @@ -1,17 +1,15 @@
|
| -
|
| /*
|
| * Copyright 2011 Google Inc.
|
| *
|
| * Use of this source code is governed by a BSD-style license that can be
|
| * found in the LICENSE file.
|
| */
|
| +
|
| #include "gm.h"
|
| #include "SkBlurMask.h"
|
| #include "SkBlurMaskFilter.h"
|
|
|
| -namespace skiagm {
|
| -
|
| -class BlursGM : public GM {
|
| +class BlursGM : public skiagm::GM {
|
| public:
|
| BlursGM() {
|
| this->setBGColor(0xFFDDDDDD);
|
| @@ -92,12 +90,45 @@ protected:
|
| }
|
|
|
| private:
|
| - typedef GM INHERITED;
|
| + typedef skiagm::GM INHERITED;
|
| };
|
| +DEF_GM( return new BlursGM; )
|
| +
|
| +//////////////////////////////////////////////////////////////////////////////////////////////
|
| +
|
| +// exercise a special-case of blurs, which is two nested rects. These are drawn specially,
|
| +// and possibly cached.
|
| +//
|
| +// in particular, we want to notice that the 2nd rect draws slightly differently, since it
|
| +// is translated a fractional amount.
|
| +//
|
| +class Blur2RectsGM : public skiagm::GM {
|
| +public:
|
| + SkString onShortName() SK_OVERRIDE {
|
| + return SkString("blur2rects");
|
| + }
|
|
|
| -//////////////////////////////////////////////////////////////////////////////
|
| + SkISize onISize() SK_OVERRIDE {
|
| + return SkISize::Make(700, 500);
|
| + }
|
| +
|
| + void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
| + SkPaint paint;
|
|
|
| -static GM* MyFactory(void*) { return new BlursGM; }
|
| -static GMRegistry reg(MyFactory);
|
| + paint.setMaskFilter(SkBlurMaskFilter::Create(kNormal_SkBlurStyle,
|
| + 2.3f))->unref();
|
|
|
| -}
|
| + SkRect outer = SkRect::MakeXYWH(10.125f, 10.125f, 100, 100);
|
| + SkRect inner = SkRect::MakeXYWH(20, 20, 80, 80);
|
| + SkPath path;
|
| + path.addRect(outer, SkPath::kCW_Direction);
|
| + path.addRect(inner, SkPath::kCCW_Direction);
|
| +
|
| + canvas->drawPath(path, paint);
|
| + // important to translate by a factional amount (.25) to exercise a different "phase"
|
| + // of the same path w.r.t. the pixel grid
|
| + canvas->translate(SkScalarRoundToScalar(path.getBounds().width()) + 14 + 0.25f, 0);
|
| + canvas->drawPath(path, paint);
|
| + }
|
| +};
|
| +DEF_GM( return new Blur2RectsGM; )
|
|
|