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
This commit is contained in:
junov@chromium.org 2012-12-19 15:55:40 +00:00
parent c938c48bf4
commit 706ff2f4f6

View File

@ -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();