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

Unified Diff: dm/DMPDFRasterizeTask.cpp

Issue 853883004: Revert of Sketch DM refactor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dm/DMPDFRasterizeTask.h ('k') | dm/DMPDFTask.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMPDFRasterizeTask.cpp
diff --git a/dm/DMPDFRasterizeTask.cpp b/dm/DMPDFRasterizeTask.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..d32178b78b8293bc34d601d4d28be54ae29f3af9
--- /dev/null
+++ b/dm/DMPDFRasterizeTask.cpp
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "DMPDFRasterizeTask.h"
+#include "DMUtil.h"
+#include "DMWriteTask.h"
+#include "SkBitmap.h"
+#include "SkCanvas.h"
+#include "SkStream.h"
+
+namespace DM {
+
+PDFRasterizeTask::PDFRasterizeTask(const Task& parent,
+ SkStreamAsset* pdf,
+ RasterizePdfProc proc)
+ : CpuTask(parent)
+ , fName(UnderJoin(parent.name().c_str(), "rasterize"))
+ , fPdf(pdf)
+ , fRasterize(proc) {
+ SkASSERT(fPdf.get());
+ SkASSERT(fPdf->unique());
+}
+
+void PDFRasterizeTask::draw() {
+ SkBitmap bitmap;
+
+ if (fRasterize(fPdf.get(), &bitmap)) {
+ this->spawnChild(SkNEW_ARGS(WriteTask, (*this, "PDF", bitmap)));
+ } else {
+ this->fail();
+ }
+}
+
+} // namespace DM
« no previous file with comments | « dm/DMPDFRasterizeTask.h ('k') | dm/DMPDFTask.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698