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

Side by Side Diff: dm/DMPDFRasterizeTask.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, 3 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 unified diff | Download patch
« no previous file with comments | « dm/DMPDFRasterizeTask.h ('k') | dm/DMPDFTask.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "DMPDFRasterizeTask.h" 8 #include "DMPDFRasterizeTask.h"
9 #include "DMExpectationsTask.h" 9 #include "DMExpectationsTask.h"
10 #include "DMUtil.h" 10 #include "DMUtil.h"
11 #include "DMWriteTask.h" 11 #include "DMWriteTask.h"
12 #include "SkBitmap.h" 12 #include "SkBitmap.h"
13 #include "SkCanvas.h" 13 #include "SkCanvas.h"
14 #include "SkStream.h" 14 #include "SkStream.h"
15 15
16 namespace DM { 16 namespace DM {
17 17
18 PDFRasterizeTask::PDFRasterizeTask(const Task& parent, 18 PDFRasterizeTask::PDFRasterizeTask(const Task& parent,
19 SkData* pdf, 19 SkStreamAsset* pdf,
20 RasterizePdfProc proc) 20 RasterizePdfProc proc)
21 : CpuTask(parent) 21 : CpuTask(parent)
22 , fName(UnderJoin(parent.name().c_str(), "rasterize")) 22 , fName(UnderJoin(parent.name().c_str(), "rasterize"))
23 , fPdf(SkRef(pdf)) 23 , fPdf(pdf)
24 , fRasterize(proc) {} 24 , fRasterize(proc) {
25 SkASSERT(fPdf.get());
26 SkASSERT(fPdf->unique());
27 }
25 28
26 void PDFRasterizeTask::draw() { 29 void PDFRasterizeTask::draw() {
27 SkMemoryStream pdfStream(fPdf.get());
28 SkBitmap bitmap; 30 SkBitmap bitmap;
29 31
30 if (fRasterize(&pdfStream, &bitmap)) { 32 if (fRasterize(fPdf.get(), &bitmap)) {
31 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap))); 33 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap)));
32 } else { 34 } else {
33 this->fail(); 35 this->fail();
34 } 36 }
35 } 37 }
36 38
37 } // namespace DM 39 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DMPDFRasterizeTask.h ('k') | dm/DMPDFTask.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698