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

Side by Side Diff: dm/DMCpuTask.cpp

Issue 32613003: DM: add --serialize (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: no-find-copies Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « dm/DMComparisonTask.cpp ('k') | dm/DMGpuTask.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 "DMCpuTask.h" 1 #include "DMCpuTask.h"
2 #include "DMReplayTask.h" 2 #include "DMReplayTask.h"
3 #include "DMSerializeTask.h"
3 #include "DMUtil.h" 4 #include "DMUtil.h"
4 #include "DMWriteTask.h" 5 #include "DMWriteTask.h"
5 #include "SkCommandLineFlags.h"
6
7 DEFINE_bool(replay, false, "If true, run replay tests for each CpuTask.");
8 // TODO(mtklein): add the other various options
9 6
10 namespace DM { 7 namespace DM {
11 8
12 CpuTask::CpuTask(const char* name, 9 CpuTask::CpuTask(const char* name,
13 Reporter* reporter, 10 Reporter* reporter,
14 TaskRunner* taskRunner, 11 TaskRunner* taskRunner,
15 const skiagm::ExpectationsSource& expectations, 12 const skiagm::ExpectationsSource& expectations,
16 skiagm::GMRegistry::Factory gmFactory, 13 skiagm::GMRegistry::Factory gmFactory,
17 SkBitmap::Config config) 14 SkBitmap::Config config)
18 : Task(reporter, taskRunner) 15 : Task(reporter, taskRunner)
19 , fGMFactory(gmFactory) 16 , fGMFactory(gmFactory)
20 , fGM(fGMFactory(NULL)) 17 , fGM(fGMFactory(NULL))
21 , fName(underJoin(fGM->shortName(), name)) 18 , fName(UnderJoin(fGM->shortName(), name))
22 , fExpectations(expectations.get(png(fName).c_str())) 19 , fExpectations(expectations.get(Png(fName).c_str()))
23 , fConfig(config) 20 , fConfig(config)
24 {} 21 {}
25 22
26 void CpuTask::draw() { 23 void CpuTask::draw() {
27 SkBitmap bitmap; 24 SkBitmap bitmap;
28 bitmap.setConfig(fConfig, SkScalarCeilToInt(fGM->width()), SkScalarCeilToInt (fGM->height())); 25 SetupBitmap(fConfig, fGM.get(), &bitmap);
29 bitmap.allocPixels(); 26
30 bitmap.eraseColor(0x00000000);
31 SkCanvas canvas(bitmap); 27 SkCanvas canvas(bitmap);
32
33 canvas.concat(fGM->getInitialTransform()); 28 canvas.concat(fGM->getInitialTransform());
34 fGM->draw(&canvas); 29 fGM->draw(&canvas);
35 canvas.flush(); 30 canvas.flush();
36 31
37 if (!meetsExpectations(fExpectations, bitmap)) { 32 if (!MeetsExpectations(fExpectations, bitmap)) {
38 this->fail(); 33 this->fail();
39 } 34 }
40 35
41 if (FLAGS_replay) { 36 this->spawnChild(SkNEW_ARGS(ReplayTask, (*this, fGMFactory(NULL), bitmap)));
42 this->spawnChild(SkNEW_ARGS(ReplayTask, 37 this->spawnChild(SkNEW_ARGS(SerializeTask, (*this, fGMFactory(NULL), bitmap) ));
43 ("replay", *this, fGMFactory(NULL), bitmap))) ;
44 }
45 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap))); 38 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap)));
46 } 39 }
47 40
48 bool CpuTask::shouldSkip() const { 41 bool CpuTask::shouldSkip() const {
49 if (SkBitmap::kRGB_565_Config == fConfig && (fGM->getFlags() & skiagm::GM::k Skip565_Flag)) { 42 if (SkBitmap::kRGB_565_Config == fConfig && (fGM->getFlags() & skiagm::GM::k Skip565_Flag)) {
50 return true; 43 return true;
51 } 44 }
52 if (fGM->getFlags() & skiagm::GM::kGPUOnly_Flag) { 45 if (fGM->getFlags() & skiagm::GM::kGPUOnly_Flag) {
53 return true; 46 return true;
54 } 47 }
55 return false; 48 return false;
56 } 49 }
57 50
58 } // namespace DM 51 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DMComparisonTask.cpp ('k') | dm/DMGpuTask.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698