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

Unified Diff: dm/DMRecordTask.cpp

Issue 345553003: Support serialization in SkRecord-backed SkPictures. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: robert Created 6 years, 6 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/DMRecordTask.h ('k') | dm/DMReplayTask.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMRecordTask.cpp
diff --git a/dm/DMRecordTask.cpp b/dm/DMRecordTask.cpp
deleted file mode 100644
index 28633f20da10ac5598f35ae6658883a9b46da121..0000000000000000000000000000000000000000
--- a/dm/DMRecordTask.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-#include "DMRecordTask.h"
-#include "DMUtil.h"
-#include "DMWriteTask.h"
-#include "SkCommandLineFlags.h"
-#include "SkRecord.h"
-#include "SkRecordDraw.h"
-#include "SkRecordOpts.h"
-#include "SkRecorder.h"
-
-DEFINE_bool(skr, true, "If true, run SKR tests.");
-
-namespace DM {
-
-RecordTask::RecordTask(const Task& parent, skiagm::GM* gm, SkBitmap reference, Mode mode)
- : CpuTask(parent)
- , fOptimize(mode == kOptimize_Mode)
- , fName(UnderJoin(parent.name().c_str(), fOptimize ? "skr" : "skr-noopt"))
- , fGM(gm)
- , fReference(reference)
- {}
-
-RecordTask::RecordTask(const Task& parent, SkPicture* pic, SkBitmap reference, Mode mode)
- : CpuTask(parent)
- , fOptimize(mode == kOptimize_Mode)
- , fName(UnderJoin(parent.name().c_str(), fOptimize ? "skr" : "skr-noopt"))
- , fPicture(SkRef(pic))
- , fReference(reference)
- {}
-
-void RecordTask::draw() {
- // Record into an SkRecord.
- SkRecord record;
- SkRecorder recorder(&record, fReference.width(), fReference.height());
-
- if (fGM.get()) {
- recorder.concat(fGM->getInitialTransform());
- fGM->draw(&recorder);
- } else {
- fPicture->draw(&recorder);
- }
-
-
- if (fOptimize) {
- SkRecordOptimize(&record);
- }
-
- // Draw the SkRecord back into a bitmap.
- SkBitmap bitmap;
- AllocatePixels(fReference, &bitmap);
- SkCanvas target(bitmap);
- SkRecordDraw(record, &target);
-
- if (!BitmapsEqual(bitmap, fReference)) {
- this->fail();
- this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap)));
- }
-}
-
-bool RecordTask::shouldSkip() const {
- return !FLAGS_skr;
-}
-
-} // namespace DM
« no previous file with comments | « dm/DMRecordTask.h ('k') | dm/DMReplayTask.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698