Allow setting a scaleFactor in bench_pictures (and render_pictures).

In TiledPictureRenderer and CopyTilesRenderer, do a postTranslate so
the translate is not affected by the scale factor.

Likewise, use clipRegion for tiled renderer so it will be
unaffected by the scale factor.

Respect the viewport for record, playbackCreation, and pipe renderers.

Review URL: https://codereview.appspot.com/6947072

git-svn-id: http://skia.googlecode.com/svn/trunk@6853 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tools/CopyTilesRenderer.cpp b/tools/CopyTilesRenderer.cpp
index 0df43bb..e5cbdbd 100644
--- a/tools/CopyTilesRenderer.cpp
+++ b/tools/CopyTilesRenderer.cpp
@@ -41,7 +41,12 @@
         for (int x = 0; x < this->getViewWidth(); x += fLargeTileWidth) {
             for (int y = 0; y < this->getViewHeight(); y += fLargeTileHeight) {
                 SkAutoCanvasRestore autoRestore(fCanvas, true);
-                fCanvas->translate(SkIntToScalar(-x), SkIntToScalar(-y));
+                // Translate so that we draw the correct portion of the picture.
+                // Perform a postTranslate so that the scaleFactor does not interfere with the
+                // positioning.
+                SkMatrix mat(fCanvas->getTotalMatrix());
+                mat.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y));
+                fCanvas->setMatrix(mat);
                 // Draw the picture
                 fCanvas->drawPicture(*fPicture);
                 // Now extract the picture into tiles