Fixing picture recording scale bug in gm
authorjunov@chromium.org <junov@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 19 Dec 2012 15:55:40 +0000 (15:55 +0000)
committerjunov@chromium.org <junov@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 19 Dec 2012 15:55:40 +0000 (15:55 +0000)
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

index 1e9e2a834130524d2eadb83fb15825329d0514f9..f4f1619e6d8ef051d5b0b57cdd934d9b73bd655f 100644 (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();