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

Unified Diff: dm/DMCpuGMTask.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/DMCpuGMTask.h ('k') | dm/DMGpuGMTask.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMCpuGMTask.cpp
diff --git a/dm/DMCpuGMTask.cpp b/dm/DMCpuGMTask.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..1a2c00d1d76019ebe1529bca96d10e4b81618e45
--- /dev/null
+++ b/dm/DMCpuGMTask.cpp
@@ -0,0 +1,56 @@
+#include "DMCpuGMTask.h"
+#include "DMPipeTask.h"
+#include "DMQuiltTask.h"
+#include "DMSerializeTask.h"
+#include "DMUtil.h"
+#include "DMWriteTask.h"
+
+namespace DM {
+
+CpuGMTask::CpuGMTask(const char* config,
+ Reporter* reporter,
+ TaskRunner* taskRunner,
+ skiagm::GMRegistry::Factory gmFactory,
+ SkColorType colorType)
+ : CpuTask(reporter, taskRunner)
+ , fGMFactory(gmFactory)
+ , fGM(fGMFactory(NULL))
+ , fName(UnderJoin(fGM->getName(), config))
+ , fColorType(colorType)
+ {}
+
+void CpuGMTask::draw() {
+ SkBitmap bm;
+ AllocatePixels(fColorType, fGM->getISize().width(), fGM->getISize().height(), &bm);
+
+ SkCanvas canvas(bm);
+ CanvasPreflight(&canvas);
+ canvas.concat(fGM->getInitialTransform());
+ fGM->draw(&canvas);
+ canvas.flush();
+
+#define SPAWN(ChildTask, ...) this->spawnChild(SkNEW_ARGS(ChildTask, (*this, __VA_ARGS__)))
+ SPAWN(PipeTask, fGMFactory(NULL), bm, PipeTask::kInProcess_Mode);
+ SPAWN(PipeTask, fGMFactory(NULL), bm, PipeTask::kCrossProcess_Mode);
+ SPAWN(PipeTask, fGMFactory(NULL), bm, PipeTask::kSharedAddress_Mode);
+
+ SPAWN(QuiltTask, fGMFactory(NULL), bm, QuiltTask::kNone_BBH);
+ SPAWN(QuiltTask, fGMFactory(NULL), bm, QuiltTask::kRTree_BBH);
+
+ SPAWN(SerializeTask, fGMFactory(NULL), bm);
+
+ SPAWN(WriteTask, "GM", bm);
+#undef SPAWN
+}
+
+bool CpuGMTask::shouldSkip() const {
+ if (kRGB_565_SkColorType == fColorType && (fGM->getFlags() & skiagm::GM::kSkip565_Flag)) {
+ return true;
+ }
+ if (fGM->getFlags() & skiagm::GM::kGPUOnly_Flag) {
+ return true;
+ }
+ return false;
+}
+
+} // namespace DM
« no previous file with comments | « dm/DMCpuGMTask.h ('k') | dm/DMGpuGMTask.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698