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

Side by Side Diff: dm/DMRecordTask.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/DMQuiltTask.cpp ('k') | dm/DMReplayTask.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 "DMRecordTask.h" 1 #include "DMRecordTask.h"
2 #include "DMUtil.h" 2 #include "DMUtil.h"
3 #include "DMWriteTask.h" 3 #include "DMWriteTask.h"
4 #include "SkCommandLineFlags.h" 4 #include "SkCommandLineFlags.h"
5 #include "SkRecord.h" 5 #include "SkRecord.h"
6 #include "SkRecordDraw.h" 6 #include "SkRecordDraw.h"
7 #include "SkRecordOpts.h" 7 #include "SkRecordOpts.h"
8 #include "SkRecorder.h" 8 #include "SkRecorder.h"
9 9
10 DEFINE_bool(skr, true, "If true, run SKR tests."); 10 DEFINE_bool(skr, true, "If true, run SKR tests.");
(...skipping 29 matching lines...) Expand all
40 fPicture->draw(&recorder); 40 fPicture->draw(&recorder);
41 } 41 }
42 42
43 43
44 if (fOptimize) { 44 if (fOptimize) {
45 SkRecordOptimize(&record); 45 SkRecordOptimize(&record);
46 } 46 }
47 47
48 // Draw the SkRecord back into a bitmap. 48 // Draw the SkRecord back into a bitmap.
49 SkBitmap bitmap; 49 SkBitmap bitmap;
50 if (fGM.get()) { 50 AllocatePixels(fReference, &bitmap);
51 SetupBitmap(fReference.colorType(), fGM.get(), &bitmap);
52 } else {
53 SetupBitmap(fReference.colorType(), *fPicture, &bitmap);
54 }
55 SkCanvas target(bitmap); 51 SkCanvas target(bitmap);
56 SkRecordDraw(record, &target); 52 SkRecordDraw(record, &target);
57 53
58 if (!BitmapsEqual(bitmap, fReference)) { 54 if (!BitmapsEqual(bitmap, fReference)) {
59 this->fail(); 55 this->fail();
60 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap))); 56 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap)));
61 } 57 }
62 } 58 }
63 59
64 bool RecordTask::shouldSkip() const { 60 bool RecordTask::shouldSkip() const {
65 return !FLAGS_skr; 61 return !FLAGS_skr;
66 } 62 }
67 63
68 } // namespace DM 64 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DMQuiltTask.cpp ('k') | dm/DMReplayTask.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698