Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: tools/CopyTilesRenderer.cpp

Issue 639013003: Update old tools to allow MultiPictureDraw rendering (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update to ToT Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/CopyTilesRenderer.h ('k') | tools/PictureBenchmark.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « tools/CopyTilesRenderer.h ('k') | tools/PictureBenchmark.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698