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

Unified Diff: dm/DMPDFTask.cpp

Issue 502193002: SkData to SkStreamAsset to avoid unneeded copying (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Another Patch Set Created 6 years, 4 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 | « dm/DMPDFRasterizeTask.cpp ('k') | dm/DMWriteTask.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMPDFTask.cpp
diff --git a/dm/DMPDFTask.cpp b/dm/DMPDFTask.cpp
index 5fee403a5b9b5247fc18a58059c80848f1266c11..81fd307c0d8b535fc80f47c1925679f987b7fb5a 100644
--- a/dm/DMPDFTask.cpp
+++ b/dm/DMPDFTask.cpp
@@ -50,11 +50,11 @@ public:
SkCanvas* canvas() { return fCanvas; }
- SkData* end() {
+ SkStreamAsset* end() {
fCanvas->flush();
fDocument->endPage();
fDocument->close();
- return fWriteStream.copyToData();
+ return fWriteStream.detachAsStream();
}
private:
@@ -66,7 +66,7 @@ private:
} // namespace
void PDFTask::draw() {
- SkAutoTUnref<SkData> pdfData;
+ SkAutoTDelete<SkStreamAsset> pdfData;
bool rasterize = true;
if (fGM.get()) {
rasterize = 0 == (fGM->getFlags() & skiagm::GM::kSkipPDFRasterization_Flag);
@@ -83,9 +83,11 @@ void PDFTask::draw() {
SkASSERT(pdfData.get());
if (rasterize) {
- this->spawnChild(SkNEW_ARGS(PDFRasterizeTask, (*this, pdfData.get(), fRasterize)));
+ this->spawnChild(SkNEW_ARGS(PDFRasterizeTask,
+ (*this, pdfData->duplicate(), fRasterize)));
}
- this->spawnChild(SkNEW_ARGS(WriteTask, (*this, pdfData.get(), ".pdf")));
+ this->spawnChild(SkNEW_ARGS(WriteTask,
+ (*this, pdfData->duplicate(), ".pdf")));
}
bool PDFTask::shouldSkip() const {
« no previous file with comments | « dm/DMPDFRasterizeTask.cpp ('k') | dm/DMWriteTask.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698