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 202983003: add --writeChecksumBasedFilenames flag to render_pictures (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: pass SkString pointers to init Created 6 years, 9 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.cpp » ('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 1298d43f0f42f3e8fd63e08c792e5a82e2d64639..341d93edaec4dfff4fc17d016c4ee3a24c30581d 100644
--- a/tools/CopyTilesRenderer.cpp
+++ b/tools/CopyTilesRenderer.cpp
@@ -20,11 +20,17 @@ namespace sk_tools {
: fXTilesPerLargeTile(x)
, fYTilesPerLargeTile(y) {
}
- void CopyTilesRenderer::init(SkPicture* pict) {
+ void CopyTilesRenderer::init(SkPicture* pict, const SkString* outputDir,
+ const SkString* inputFilename, bool useChecksumBasedFilenames) {
+ // Do not call INHERITED::init(), which would create a (potentially large) canvas which is
+ // not used by bench_pictures.
SkASSERT(pict != NULL);
// Only work with absolute widths (as opposed to percentages).
SkASSERT(this->getTileWidth() != 0 && this->getTileHeight() != 0);
fPicture = pict;
+ this->CopyString(&fOutputDir, outputDir);
+ this->CopyString(&fInputFilename, inputFilename);
+ fUseChecksumBasedFilenames = useChecksumBasedFilenames;
fPicture->ref();
this->buildBBoxHierarchy();
// In order to avoid allocating a large canvas (particularly important for GPU), create one
@@ -34,7 +40,7 @@ namespace sk_tools {
fCanvas.reset(this->INHERITED::setupCanvas(fLargeTileWidth, fLargeTileHeight));
}
- bool CopyTilesRenderer::render(const SkString* path, SkBitmap** out) {
+ bool CopyTilesRenderer::render(SkBitmap** out) {
int i = 0;
bool success = true;
SkBitmap dst;
@@ -59,10 +65,14 @@ namespace sk_tools {
SkDEBUGCODE(bool extracted =)
baseBitmap.extractSubset(&dst, subset);
SkASSERT(extracted);
- if (path != NULL) {
- // Similar to writeAppendNumber in PictureRenderer.cpp, but just encodes
+ if (!fOutputDir.isEmpty()) {
+ // Similar to write() in PictureRenderer.cpp, but just encodes
// a bitmap directly.
- SkString pathWithNumber(*path);
+ // TODO: Share more common code with write() to do this, to properly
+ // write out the JSON summary, etc.
+ SkString pathWithNumber;
+ make_filepath(&pathWithNumber, fOutputDir, fInputFilename);
+ pathWithNumber.remove(pathWithNumber.size() - 4, 4);
pathWithNumber.appendf("%i.png", i++);
SkBitmap copy;
#if SK_SUPPORT_GPU
« no previous file with comments | « tools/CopyTilesRenderer.h ('k') | tools/PictureBenchmark.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698