Index: tools/CopyTilesRenderer.cpp |
diff --git a/tools/CopyTilesRenderer.cpp b/tools/CopyTilesRenderer.cpp |
index 30a3256d63c2aa9d3d7e63c1663f3e64ae584b6a..6f95da758bea7f828612ab09ad67d14fcfca8ac3 100644 |
--- a/tools/CopyTilesRenderer.cpp |
+++ b/tools/CopyTilesRenderer.cpp |
@@ -10,6 +10,7 @@ |
#include "SkCanvas.h" |
#include "SkDevice.h" |
#include "SkImageEncoder.h" |
+#include "SkMultiPictureDraw.h" |
#include "SkPicture.h" |
#include "SkPixelRef.h" |
#include "SkRect.h" |
@@ -28,7 +29,7 @@ namespace sk_tools { |
#endif |
void CopyTilesRenderer::init(const SkPicture* pict, const SkString* writePath, |
const SkString* mismatchPath, const SkString* inputFilename, |
- bool useChecksumBasedFilenames) { |
+ bool useChecksumBasedFilenames, bool useMultiPictureDraw) { |
// Do not call INHERITED::init(), which would create a (potentially large) canvas which is |
// not used by bench_pictures. |
SkASSERT(pict != NULL); |
@@ -39,6 +40,7 @@ namespace sk_tools { |
this->CopyString(&fMismatchPath, mismatchPath); |
this->CopyString(&fInputFilename, inputFilename); |
fUseChecksumBasedFilenames = useChecksumBasedFilenames; |
+ fUseMultiPictureDraw = useMultiPictureDraw; |
this->buildBBoxHierarchy(); |
// In order to avoid allocating a large canvas (particularly important for GPU), create one |
// canvas that is a multiple of the tile size, and draw portions of the picture. |
@@ -61,7 +63,15 @@ namespace sk_tools { |
mat.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); |
fCanvas->setMatrix(mat); |
// Draw the picture |
- fCanvas->drawPicture(fPicture); |
+ if (fUseMultiPictureDraw) { |
+ SkMultiPictureDraw mpd; |
+ |
+ mpd.add(fCanvas, fPicture); |
+ |
+ mpd.draw(); |
+ } else { |
+ fCanvas->drawPicture(fPicture); |
+ } |
// Now extract the picture into tiles |
SkBitmap baseBitmap; |
fCanvas->readPixels(SkIRect::MakeSize(fCanvas->getBaseLayerSize()), &baseBitmap); |