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

Side by Side Diff: dm/DMPDFRasterizeTask.cpp

Issue 849103004: Make SkStream *not* ref counted. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Treat SkFontMgr::createFromStream as taking ownership of the stream (is this correct?) Created 5 years, 11 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
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 "DMUtil.h" 9 #include "DMUtil.h"
10 #include "DMWriteTask.h" 10 #include "DMWriteTask.h"
11 #include "SkBitmap.h" 11 #include "SkBitmap.h"
12 #include "SkCanvas.h" 12 #include "SkCanvas.h"
13 #include "SkStream.h" 13 #include "SkStream.h"
14 14
15 namespace DM { 15 namespace DM {
16 16
17 PDFRasterizeTask::PDFRasterizeTask(const Task& parent, 17 PDFRasterizeTask::PDFRasterizeTask(const Task& parent,
18 SkStreamAsset* pdf, 18 SkStreamAsset* pdf,
19 RasterizePdfProc proc) 19 RasterizePdfProc proc)
20 : CpuTask(parent) 20 : CpuTask(parent)
21 , fName(UnderJoin(parent.name().c_str(), "rasterize")) 21 , fName(UnderJoin(parent.name().c_str(), "rasterize"))
22 , fPdf(pdf) 22 , fPdf(pdf)
23 , fRasterize(proc) { 23 , fRasterize(proc) {
24 SkASSERT(fPdf.get()); 24 SkASSERT(fPdf.get());
25 SkASSERT(fPdf->unique());
26 } 25 }
27 26
28 void PDFRasterizeTask::draw() { 27 void PDFRasterizeTask::draw() {
29 SkBitmap bitmap; 28 SkBitmap bitmap;
30 29
31 if (fRasterize(fPdf.get(), &bitmap)) { 30 if (fRasterize(fPdf.get(), &bitmap)) {
32 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, "PDF", bitmap))); 31 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, "PDF", bitmap)));
33 } else { 32 } else {
34 this->fail(); 33 this->fail();
35 } 34 }
36 } 35 }
37 36
38 } // namespace DM 37 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DMImageTask.cpp ('k') | dm/DMSerializeTask.cpp » ('j') | gm/gmmain.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698