| OLD | NEW |
| 1 #include "DMBenchTask.h" | 1 #include "DMBenchTask.h" |
| 2 #include "DMUtil.h" | 2 #include "DMUtil.h" |
| 3 #include "SkSurface.h" | 3 #include "SkSurface.h" |
| 4 | 4 |
| 5 namespace DM { | 5 namespace DM { |
| 6 | 6 |
| 7 static SkString bench_name(const char* name, const char* config) { | 7 static SkString bench_name(const char* name, const char* config) { |
| 8 SkString result("bench "); | 8 SkString result("bench "); |
| 9 result.appendf("%s_%s", name, config); | 9 result.appendf("%s_%s", name, config); |
| 10 return result; | 10 return result; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 : CpuTask(reporter, tasks) | 26 : CpuTask(reporter, tasks) |
| 27 , fBench(factory(NULL)) | 27 , fBench(factory(NULL)) |
| 28 , fName(bench_name(fBench->getName(), config)) | 28 , fName(bench_name(fBench->getName(), config)) |
| 29 , fColorType(colorType) {} | 29 , fColorType(colorType) {} |
| 30 | 30 |
| 31 GpuBenchTask::GpuBenchTask(const char* config, | 31 GpuBenchTask::GpuBenchTask(const char* config, |
| 32 Reporter* reporter, | 32 Reporter* reporter, |
| 33 TaskRunner* tasks, | 33 TaskRunner* tasks, |
| 34 BenchRegistry::Factory factory, | 34 BenchRegistry::Factory factory, |
| 35 GrContextFactory::GLContextType contextType, | 35 GrContextFactory::GLContextType contextType, |
| 36 GrGLStandard gpuAPI, | |
| 37 int sampleCount) | 36 int sampleCount) |
| 38 : GpuTask(reporter, tasks) | 37 : GpuTask(reporter, tasks) |
| 39 , fBench(factory(NULL)) | 38 , fBench(factory(NULL)) |
| 40 , fName(bench_name(fBench->getName(), config)) | 39 , fName(bench_name(fBench->getName(), config)) |
| 41 , fContextType(contextType) | 40 , fContextType(contextType) |
| 42 , fGpuAPI(gpuAPI) | |
| 43 , fSampleCount(sampleCount) {} | 41 , fSampleCount(sampleCount) {} |
| 44 | 42 |
| 45 bool NonRenderingBenchTask::shouldSkip() const { | 43 bool NonRenderingBenchTask::shouldSkip() const { |
| 46 return !fBench->isSuitableFor(Benchmark::kNonRendering_Backend); | 44 return !fBench->isSuitableFor(Benchmark::kNonRendering_Backend); |
| 47 } | 45 } |
| 48 | 46 |
| 49 bool CpuBenchTask::shouldSkip() const { | 47 bool CpuBenchTask::shouldSkip() const { |
| 50 return !fBench->isSuitableFor(Benchmark::kRaster_Backend); | 48 return !fBench->isSuitableFor(Benchmark::kRaster_Backend); |
| 51 } | 49 } |
| 52 | 50 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 69 | 67 |
| 70 void CpuBenchTask::draw() { | 68 void CpuBenchTask::draw() { |
| 71 draw_raster(fBench.get(), fColorType); | 69 draw_raster(fBench.get(), fColorType); |
| 72 } | 70 } |
| 73 | 71 |
| 74 void GpuBenchTask::draw(GrContextFactory* grFactory) { | 72 void GpuBenchTask::draw(GrContextFactory* grFactory) { |
| 75 SkImageInfo info = SkImageInfo::Make(fBench->getSize().x(), | 73 SkImageInfo info = SkImageInfo::Make(fBench->getSize().x(), |
| 76 fBench->getSize().y(), | 74 fBench->getSize().y(), |
| 77 kN32_SkColorType, | 75 kN32_SkColorType, |
| 78 kPremul_SkAlphaType); | 76 kPremul_SkAlphaType); |
| 79 SkAutoTUnref<SkSurface> surface(NewGpuSurface(grFactory, fContextType, fGpuA
PI, info, | 77 SkAutoTUnref<SkSurface> surface(NewGpuSurface(grFactory, fContextType, info,
fSampleCount)); |
| 80 fSampleCount)); | 78 |
| 81 if (!surface) { | |
| 82 this->fail("Could not create context for the config and the api."); | |
| 83 return; | |
| 84 } | |
| 85 fBench->preDraw(); | 79 fBench->preDraw(); |
| 86 fBench->draw(1, surface->getCanvas()); | 80 fBench->draw(1, surface->getCanvas()); |
| 87 } | 81 } |
| 88 | 82 |
| 89 } // namespace DM | 83 } // namespace DM |
| OLD | NEW |