aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/filltypespersp.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-03-30 20:04:21 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-03-30 20:04:21 +0000
commitd42e3f60cd571afb6c0f1837f9e0996bfe149001 (patch)
tree33ac82a3cd588b20875d92c1d0b47e8b1a0cd531 /gm/filltypespersp.cpp
parentbbbe9ed59ee1d3077fa4e6368a4a7294240a5ec6 (diff)
defer drawing/work until first draw, to make debugging easier and speedup
instantiating the obj just to get its name. git-svn-id: http://skia.googlecode.com/svn/trunk@3568 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm/filltypespersp.cpp')
-rw-r--r--gm/filltypespersp.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/gm/filltypespersp.cpp b/gm/filltypespersp.cpp
index 33f3242493..e675990631 100644
--- a/gm/filltypespersp.cpp
+++ b/gm/filltypespersp.cpp
@@ -13,10 +13,14 @@ namespace skiagm {
class FillTypePerspGM : public GM {
SkPath fPath;
public:
- FillTypePerspGM() {
- const SkScalar radius = SkIntToScalar(45);
- fPath.addCircle(SkIntToScalar(50), SkIntToScalar(50), radius);
- fPath.addCircle(SkIntToScalar(100), SkIntToScalar(100), radius);
+ FillTypePerspGM() {}
+
+ void makePath() {
+ if (fPath.isEmpty()) {
+ const SkScalar radius = SkIntToScalar(45);
+ fPath.addCircle(SkIntToScalar(50), SkIntToScalar(50), radius);
+ fPath.addCircle(SkIntToScalar(100), SkIntToScalar(100), radius);
+ }
}
protected:
@@ -71,6 +75,8 @@ protected:
}
virtual void onDraw(SkCanvas* canvas) {
+ this->makePath();
+
// do perspective drawPaint as the background;
SkPaint bkgnrd;
SkPoint center = SkPoint::Make(SkIntToScalar(100),