diff options
author | herb <herb@google.com> | 2016-01-08 13:48:43 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-08 13:48:43 -0800 |
commit | b10fe4941b08172378d3d1928959122f106ced37 (patch) | |
tree | 259dbbf6382f4c58e5ea9bff2993c834102172eb /gm/blurroundrect.cpp | |
parent | cdee009886babe6df7743a9b5b3e2cc0a5f21adf (diff) |
Remove work from constructors to facilitate debugging.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1562093002
Review URL: https://codereview.chromium.org/1562093002
Diffstat (limited to 'gm/blurroundrect.cpp')
-rw-r--r-- | gm/blurroundrect.cpp | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/gm/blurroundrect.cpp b/gm/blurroundrect.cpp index 4b3f3bcc9a..c3cdb66673 100644 --- a/gm/blurroundrect.cpp +++ b/gm/blurroundrect.cpp @@ -22,24 +22,9 @@ // This GM mimics a blurred RR seen in the wild. class BlurRoundRectGM : public skiagm::GM { public: - BlurRoundRectGM(int width, int height, int radius) - : fName("blurroundrect") - { - SkRect r = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height)); - fRRect.setRectXY(r, SkIntToScalar(radius), SkIntToScalar(radius)); - fName.appendf("-WH-%ix%i-corner-%i", width, height, radius); - } - BlurRoundRectGM(int width, int height) - : fName("blurroundrect") { + : fName("blurroundrect"), fWidth(width), fHeight(height) { fName.appendf("-WH-%ix%i-unevenCorners", width, height); - SkVector radii[4]; - radii[0].set(SkIntToScalar(30), SkIntToScalar(30)); - radii[1].set(SkIntToScalar(10), SkIntToScalar(10)); - radii[2].set(SkIntToScalar(30), SkIntToScalar(30)); - radii[3].set(SkIntToScalar(10), SkIntToScalar(10)); - SkRect r = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height)); - fRRect.setRectRadii(r, radii); } SkString onShortName() override { @@ -47,8 +32,17 @@ public: } SkISize onISize() override { - return SkISize::Make(SkScalarCeilToInt(fRRect.rect().width()), - SkScalarCeilToInt(fRRect.rect().height())); + return SkISize::Make(fWidth, fHeight); + } + + void onOnceBeforeDraw() override { + SkVector radii[4]; + radii[0].set(SkIntToScalar(30), SkIntToScalar(30)); + radii[1].set(SkIntToScalar(10), SkIntToScalar(10)); + radii[2].set(SkIntToScalar(30), SkIntToScalar(30)); + radii[3].set(SkIntToScalar(10), SkIntToScalar(10)); + SkRect r = SkRect::MakeWH(SkIntToScalar(fWidth), SkIntToScalar(fHeight)); + fRRect.setRectRadii(r, radii); } void onDraw(SkCanvas* canvas) override { @@ -89,6 +83,7 @@ public: private: SkString fName; SkRRect fRRect; + int fWidth, fHeight; typedef skiagm::GM INHERITED; }; |