aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar junov@chromium.org <junov@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-19 15:55:40 +0000
committerGravatar junov@chromium.org <junov@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-19 15:55:40 +0000
commit706ff2f4f6f0a46bc50401c0fdd70eb2eaafe2f0 (patch)
tree234c51ea43949ed7ea02321f5266e835c30533cb
parentc938c48bf426c322e2cb45b4bfaf8a2ee5a2a3c5 (diff)
Fixing picture recording scale bug in gm
Review URL: https://codereview.appspot.com/6965047 git-svn-id: http://skia.googlecode.com/svn/trunk@6901 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--gm/gmmain.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index 1e9e2a8341..f4f1619e6d 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -675,15 +675,17 @@ public:
static SkPicture* generate_new_picture(GM* gm, BbhType bbhType, SkScalar scale = SK_Scalar1) {
// Pictures are refcounted so must be on heap
SkPicture* pict;
- SkISize size = gm->getISize();
+ int width = SkScalarCeilToInt(SkScalarMul(SkIntToScalar(gm->getISize().width()), scale));
+ int height = SkScalarCeilToInt(SkScalarMul(SkIntToScalar(gm->getISize().height()), scale));
+
if (kTileGrid_BbhType == bbhType) {
- pict = new SkTileGridPicture(16, 16, size.width(), size.height());
+ pict = new SkTileGridPicture(16, 16, width, height);
} else {
pict = new SkPicture;
}
uint32_t recordFlags = (kNone_BbhType == bbhType) ?
0 : SkPicture::kOptimizeForClippedPlayback_RecordingFlag;
- SkCanvas* cv = pict->beginRecording(size.width(), size.height(), recordFlags);
+ SkCanvas* cv = pict->beginRecording(width, height, recordFlags);
cv->scale(scale, scale);
invokeGM(gm, cv, false, false);
pict->endRecording();