diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-01-03 17:20:38 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-01-03 17:20:38 +0000 |
commit | 2d6ef528e57928160aba6b628b2d84180ced97c3 (patch) | |
tree | de5aea102a6952ca33f02148b8020f244bf24a77 /gm | |
parent | d5d9dadcdd5fdbc8a17f3f398e3199b9d12c8d70 (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.cpp | 9 | ||||
-rw-r--r-- | gm/gm.h | 4 |
2 files changed, 13 insertions, 0 deletions
@@ -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; @@ -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*); |