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

Side by Side Diff: dm/DMRecordTask.cpp

Issue 206313003: SkRecord strawman (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: IsSmall -> IsLarge: pithier Created 6 years, 8 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
« no previous file with comments | « dm/DMRecordTask.h ('k') | gyp/dm.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #include "DMRecordTask.h"
2 #include "DMUtil.h"
3 #include "DMWriteTask.h"
4 #include "SkCommandLineFlags.h"
5 #include "SkRecordDraw.h"
6 #include "SkRecorder.h"
7
8 DEFINE_bool(skr, false, "If true, run SKR tests.");
9
10 namespace DM {
11
12 RecordTask::RecordTask(const Task& parent, skiagm::GM* gm, SkBitmap reference)
13 : CpuTask(parent)
14 , fName(UnderJoin(parent.name().c_str(), "skr"))
15 , fGM(gm)
16 , fReference(reference)
17 {}
18
19 void RecordTask::draw() {
20 // Record the GM into an SkRecord.
21 SkRecord record;
22 SkRecorder canvas(&record, fReference.width(), fReference.height());
23 canvas.concat(fGM->getInitialTransform());
24 fGM->draw(&canvas);
25
26 // Draw the SkRecord back into a bitmap.
27 SkBitmap bitmap;
28 SetupBitmap(fReference.colorType(), fGM.get(), &bitmap);
29 SkCanvas target(bitmap);
30 record.visit(SkRecordDraw(&target));
31
32 if (!BitmapsEqual(bitmap, fReference)) {
33 this->fail();
34 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap)));
35 }
36 }
37
38 bool RecordTask::shouldSkip() const {
39 return !FLAGS_skr;
40 }
41
42 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DMRecordTask.h ('k') | gyp/dm.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698