Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Unified Diff: gm/blurroundrect.cpp

Issue 1562093002: Remove work from constructors to facilitate debugging. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use valid width and height. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gm/composeshader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/blurroundrect.cpp
diff --git a/gm/blurroundrect.cpp b/gm/blurroundrect.cpp
index 4b3f3bcc9a6349c8ebfcff648892d69cb0d38da3..c3cdb66673e19e3bde2ec4bf6aa1812cbd19fe7a 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;
};
« no previous file with comments | « no previous file | gm/composeshader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698