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

Unified Diff: dm/DMRecordTask.cpp

Issue 271443007: DM: test SkRecord with and without optimization. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: write only is fine Created 6 years, 7 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') | no next file » | 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
index d1c552f569ae55dffccc9681c3cbf1b6438e5175..531fe57f9476f489b1bd6157456b6eda28acd156 100644
--- a/dm/DMRecordTask.cpp
+++ b/dm/DMRecordTask.cpp
@@ -2,31 +2,40 @@
#include "DMUtil.h"
#include "DMWriteTask.h"
#include "SkCommandLineFlags.h"
-#include "SkRecording.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)
+RecordTask::RecordTask(const Task& parent, skiagm::GM* gm, SkBitmap reference, bool optimize)
: CpuTask(parent)
- , fName(UnderJoin(parent.name().c_str(), "skr"))
+ , fName(UnderJoin(parent.name().c_str(), optimize ? "skr" : "skr-noopt"))
, fGM(gm)
, fReference(reference)
+ , fOptimize(optimize)
{}
void RecordTask::draw() {
// Record the GM into an SkRecord.
- EXPERIMENTAL::SkRecording recording(fReference.width(), fReference.height());
- recording.canvas()->concat(fGM->getInitialTransform());
- fGM->draw(recording.canvas());
- SkAutoTDelete<const EXPERIMENTAL::SkPlayback> playback(recording.releasePlayback());
+ SkRecord record;
+ SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record,
+ fReference.width(), fReference.height());
+ recorder.concat(fGM->getInitialTransform());
+ fGM->draw(&recorder);
+
+ if (fOptimize) {
+ SkRecordOptimize(&record);
+ }
// Draw the SkRecord back into a bitmap.
SkBitmap bitmap;
SetupBitmap(fReference.colorType(), fGM.get(), &bitmap);
SkCanvas target(bitmap);
- playback->draw(&target);
+ SkRecordDraw(record, &target);
if (!BitmapsEqual(bitmap, fReference)) {
this->fail();
« no previous file with comments | « dm/DMRecordTask.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698