From 706ff2f4f6f0a46bc50401c0fdd70eb2eaafe2f0 Mon Sep 17 00:00:00 2001 From: "junov@chromium.org" Date: Wed, 19 Dec 2012 15:55:40 +0000 Subject: [PATCH] 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 --- gm/gmmain.cpp | 8 +++++--- 1 file 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();