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

Side by Side Diff: dm/DMCpuGMTask.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/DMBenchTask.cpp ('k') | dm/DMPipeTask.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 "DMCpuGMTask.h" 1 #include "DMCpuGMTask.h"
2 #include "DMExpectationsTask.h" 2 #include "DMExpectationsTask.h"
3 #include "DMPipeTask.h" 3 #include "DMPipeTask.h"
4 #include "DMQuiltTask.h" 4 #include "DMQuiltTask.h"
5 #include "DMRecordTask.h" 5 #include "DMRecordTask.h"
6 #include "DMReplayTask.h" 6 #include "DMReplayTask.h"
7 #include "DMSerializeTask.h" 7 #include "DMSerializeTask.h"
8 #include "DMUtil.h" 8 #include "DMUtil.h"
9 #include "DMWriteTask.h" 9 #include "DMWriteTask.h"
10 10
11 namespace DM { 11 namespace DM {
12 12
13 CpuGMTask::CpuGMTask(const char* config, 13 CpuGMTask::CpuGMTask(const char* config,
14 Reporter* reporter, 14 Reporter* reporter,
15 TaskRunner* taskRunner, 15 TaskRunner* taskRunner,
16 const Expectations& expectations, 16 const Expectations& expectations,
17 skiagm::GMRegistry::Factory gmFactory, 17 skiagm::GMRegistry::Factory gmFactory,
18 SkColorType colorType) 18 SkColorType colorType)
19 : CpuTask(reporter, taskRunner) 19 : CpuTask(reporter, taskRunner)
20 , fGMFactory(gmFactory) 20 , fGMFactory(gmFactory)
21 , fGM(fGMFactory(NULL)) 21 , fGM(fGMFactory(NULL))
22 , fName(UnderJoin(fGM->getName(), config)) 22 , fName(UnderJoin(fGM->getName(), config))
23 , fExpectations(expectations) 23 , fExpectations(expectations)
24 , fColorType(colorType) 24 , fColorType(colorType)
25 {} 25 {}
26 26
27 void CpuGMTask::draw() { 27 void CpuGMTask::draw() {
28 SkBitmap bitmap; 28 SkBitmap bitmap;
29 SetupBitmap(fColorType, fGM.get(), &bitmap); 29 AllocatePixels(fColorType, fGM->getISize().width(), fGM->getISize().height() , &bitmap);
30 30
31 SkCanvas canvas(bitmap); 31 SkCanvas canvas(bitmap);
32 canvas.concat(fGM->getInitialTransform()); 32 canvas.concat(fGM->getInitialTransform());
33 fGM->draw(&canvas); 33 fGM->draw(&canvas);
34 canvas.flush(); 34 canvas.flush();
35 35
36 #define SPAWN(ChildTask, ...) this->spawnChild(SkNEW_ARGS(ChildTask, (*this, __V A_ARGS__))) 36 #define SPAWN(ChildTask, ...) this->spawnChild(SkNEW_ARGS(ChildTask, (*this, __V A_ARGS__)))
37 SPAWN(ExpectationsTask, fExpectations, bitmap); 37 SPAWN(ExpectationsTask, fExpectations, bitmap);
38 38
39 SPAWN(PipeTask, fGMFactory(NULL), bitmap, PipeTask::kInProcess_Mode); 39 SPAWN(PipeTask, fGMFactory(NULL), bitmap, PipeTask::kInProcess_Mode);
(...skipping 14 matching lines...) Expand all
54 if (kRGB_565_SkColorType == fColorType && (fGM->getFlags() & skiagm::GM::kSk ip565_Flag)) { 54 if (kRGB_565_SkColorType == fColorType && (fGM->getFlags() & skiagm::GM::kSk ip565_Flag)) {
55 return true; 55 return true;
56 } 56 }
57 if (fGM->getFlags() & skiagm::GM::kGPUOnly_Flag) { 57 if (fGM->getFlags() & skiagm::GM::kGPUOnly_Flag) {
58 return true; 58 return true;
59 } 59 }
60 return false; 60 return false;
61 } 61 }
62 62
63 } // namespace DM 63 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DMBenchTask.cpp ('k') | dm/DMPipeTask.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698