Index: tools/CopyTilesRenderer.cpp |
diff --git a/tools/CopyTilesRenderer.cpp b/tools/CopyTilesRenderer.cpp |
index 1298d43f0f42f3e8fd63e08c792e5a82e2d64639..d7ed910aa3ff5d51757536380881217b71e10cf0 100644 |
--- a/tools/CopyTilesRenderer.cpp |
+++ b/tools/CopyTilesRenderer.cpp |
@@ -20,11 +20,15 @@ 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) { |
robertphillips
2014/03/19 14:42:36
I think this should call INHERITED::init
epoger
2014/03/19 15:20:29
I disagree, but I'm not 100% certain about it.
IN
robertphillips
2014/03/19 16:06:50
You're right. We probably want a comment like the
epoger
2014/03/19 16:48:26
Done.
|
SkASSERT(pict != NULL); |
// Only work with absolute widths (as opposed to percentages). |
SkASSERT(this->getTileWidth() != 0 && this->getTileHeight() != 0); |
fPicture = pict; |
+ fOutputDir.set(outputDir); |
+ fInputFilename.set(inputFilename); |
+ fUseChecksumBasedFilenames = useChecksumBasedFilenames; |
fPicture->ref(); |
this->buildBBoxHierarchy(); |
// In order to avoid allocating a large canvas (particularly important for GPU), create one |
@@ -34,7 +38,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 +63,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 |