aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-03 17:20:38 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-03 17:20:38 +0000
commit2d6ef528e57928160aba6b628b2d84180ced97c3 (patch)
treede5aea102a6952ca33f02148b8020f244bf24a77 /gm
parentd5d9dadcdd5fdbc8a17f3f398e3199b9d12c8d70 (diff)
add helper drawSizeBounds to show the GM's size
git-svn-id: http://skia.googlecode.com/svn/trunk@2943 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm')
-rw-r--r--gm/gm.cpp9
-rw-r--r--gm/gm.h4
2 files changed, 13 insertions, 0 deletions
diff --git a/gm/gm.cpp b/gm/gm.cpp
index cf4b640691..f9c0e6637f 100644
--- a/gm/gm.cpp
+++ b/gm/gm.cpp
@@ -41,5 +41,14 @@ void GM::onDrawBackground(SkCanvas* canvas) {
canvas->drawColor(fBGColor);
}
+void GM::drawSizeBounds(SkCanvas* canvas, SkColor color) {
+ SkISize size = this->getISize();
+ SkRect r = SkRect::MakeWH(SkIntToScalar(size.width()),
+ SkIntToScalar(size.height()));
+ SkPaint paint;
+ paint.setColor(color);
+ canvas->drawRect(r, paint);
+}
+
// need to explicitly declare this, or we get some weird infinite loop llist
template GMRegistry* SkTRegistry<GM*, void*>::gHead;
diff --git a/gm/gm.h b/gm/gm.h
index 21366aadae..b0de9227f7 100644
--- a/gm/gm.h
+++ b/gm/gm.h
@@ -49,6 +49,10 @@ namespace skiagm {
SkColor getBGColor() const { return fBGColor; }
void setBGColor(SkColor);
+ // helper: fill a rect in the specified color based on the
+ // GM's getISize bounds.
+ void drawSizeBounds(SkCanvas*, SkColor);
+
protected:
virtual void onDraw(SkCanvas*) = 0;
virtual void onDrawBackground(SkCanvas*);