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

Side by Side Diff: dm/DMReplayTask.cpp

Issue 377373003: Merge Replay and Quilt tasks, adding in all BBH implementations. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 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/DMReplayTask.h ('k') | dm/DMSKPTask.cpp » ('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 "DMReplayTask.h"
2 #include "DMWriteTask.h"
3 #include "DMUtil.h"
4
5 #include "SkBBHFactory.h"
6 #include "SkCommandLineFlags.h"
7 #include "SkPicture.h"
8
9 DEFINE_bool(replay, true, "If true, run picture replay tests.");
10 DEFINE_bool(rtree, true, "If true, run picture replay tests with an rtree.");
11 DEFINE_bool(skr, true, "If true, run picture replay tests with SkRecord backe nd.");
12
13 static const char* kSuffixes[] = { "replay", "rtree", "skr" };
14 static const bool* kEnabled[] = { &FLAGS_replay, &FLAGS_rtree, &FLAGS_skr };
15
16 namespace DM {
17
18 ReplayTask::ReplayTask(const Task& parent,
19 skiagm::GM* gm,
20 SkBitmap reference,
21 Mode mode)
22 : CpuTask(parent)
23 , fMode(mode)
24 , fName(UnderJoin(parent.name().c_str(), kSuffixes[mode]))
25 , fGM(gm)
26 , fReference(reference)
27 {}
28
29 void ReplayTask::draw() {
30 SkAutoTDelete<SkBBHFactory> factory;
31 if (kRTree_Mode == fMode) {
32 factory.reset(SkNEW(SkRTreeFactory));
33 }
34 SkAutoTUnref<SkPicture> recorded(
35 RecordPicture(fGM.get(), factory.get(), kSkRecord_Mode == fMode));
36
37 SkBitmap bitmap;
38 AllocatePixels(fReference, &bitmap);
39 DrawPicture(*recorded, &bitmap);
40 if (!BitmapsEqual(bitmap, fReference)) {
41 this->fail();
42 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap)));
43 }
44 }
45
46 bool ReplayTask::shouldSkip() const {
47 if (fGM->getFlags() & skiagm::GM::kSkipPicture_Flag) {
48 return true;
49 }
50 return !*kEnabled[fMode];
51 }
52
53 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DMReplayTask.h ('k') | dm/DMSKPTask.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698