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

Side by Side Diff: dm/DMReplayTask.cpp

Issue 286993005: refactor DM::SetupBitmap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « dm/DMRecordTask.cpp ('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
1 #include "DMReplayTask.h" 1 #include "DMReplayTask.h"
2 #include "DMWriteTask.h" 2 #include "DMWriteTask.h"
3 #include "DMUtil.h" 3 #include "DMUtil.h"
4 4
5 #include "SkBBHFactory.h" 5 #include "SkBBHFactory.h"
6 #include "SkCommandLineFlags.h" 6 #include "SkCommandLineFlags.h"
7 #include "SkPicture.h" 7 #include "SkPicture.h"
8 8
9 DEFINE_bool(replay, true, "If true, run picture replay tests."); 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."); 10 DEFINE_bool(rtree, true, "If true, run picture replay tests with an rtree.");
(...skipping 12 matching lines...) Expand all
23 {} 23 {}
24 24
25 void ReplayTask::draw() { 25 void ReplayTask::draw() {
26 SkAutoTDelete<SkBBHFactory> factory; 26 SkAutoTDelete<SkBBHFactory> factory;
27 if (fUseRTree) { 27 if (fUseRTree) {
28 factory.reset(SkNEW(SkRTreeFactory)); 28 factory.reset(SkNEW(SkRTreeFactory));
29 } 29 }
30 SkAutoTUnref<SkPicture> recorded(RecordPicture(fGM.get(), 0, factory.get())) ; 30 SkAutoTUnref<SkPicture> recorded(RecordPicture(fGM.get(), 0, factory.get())) ;
31 31
32 SkBitmap bitmap; 32 SkBitmap bitmap;
33 SetupBitmap(fReference.colorType(), fGM.get(), &bitmap); 33 AllocatePixels(fReference, &bitmap);
34 DrawPicture(recorded, &bitmap); 34 DrawPicture(recorded, &bitmap);
35 if (!BitmapsEqual(bitmap, fReference)) { 35 if (!BitmapsEqual(bitmap, fReference)) {
36 this->fail(); 36 this->fail();
37 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap))); 37 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap)));
38 } 38 }
39 } 39 }
40 40
41 bool ReplayTask::shouldSkip() const { 41 bool ReplayTask::shouldSkip() const {
42 if (fGM->getFlags() & skiagm::GM::kSkipPicture_Flag) { 42 if (fGM->getFlags() & skiagm::GM::kSkipPicture_Flag) {
43 return true; 43 return true;
44 } 44 }
45 45
46 if (FLAGS_rtree && fUseRTree) { 46 if (FLAGS_rtree && fUseRTree) {
47 return false; 47 return false;
48 } 48 }
49 if (FLAGS_replay && !fUseRTree) { 49 if (FLAGS_replay && !fUseRTree) {
50 return false; 50 return false;
51 } 51 }
52 return true; 52 return true;
53 } 53 }
54 54
55 } // namespace DM 55 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DMRecordTask.cpp ('k') | dm/DMSKPTask.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698