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

Side by Side Diff: dm/DMBenchTask.cpp

Issue 319043005: Support using OpenGL ES context on desktop (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 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
OLDNEW
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
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 forcedGpuApi,
36 int sampleCount) 37 int sampleCount)
37 : GpuTask(reporter, tasks) 38 : GpuTask(reporter, tasks)
38 , fBench(factory(NULL)) 39 , fBench(factory(NULL))
39 , fName(bench_name(fBench->getName(), config)) 40 , fName(bench_name(fBench->getName(), config))
40 , fContextType(contextType) 41 , fContextType(contextType)
42 , fForcedGpuApi(forcedGpuApi)
41 , fSampleCount(sampleCount) {} 43 , fSampleCount(sampleCount) {}
42 44
43 bool NonRenderingBenchTask::shouldSkip() const { 45 bool NonRenderingBenchTask::shouldSkip() const {
44 return !fBench->isSuitableFor(SkBenchmark::kNonRendering_Backend); 46 return !fBench->isSuitableFor(SkBenchmark::kNonRendering_Backend);
45 } 47 }
46 48
47 bool CpuBenchTask::shouldSkip() const { 49 bool CpuBenchTask::shouldSkip() const {
48 return !fBench->isSuitableFor(SkBenchmark::kRaster_Backend); 50 return !fBench->isSuitableFor(SkBenchmark::kRaster_Backend);
49 } 51 }
50 52
(...skipping 17 matching lines...) Expand all
68 70
69 void CpuBenchTask::draw() { 71 void CpuBenchTask::draw() {
70 draw_raster(fBench.get(), fColorType); 72 draw_raster(fBench.get(), fColorType);
71 } 73 }
72 74
73 void GpuBenchTask::draw(GrContextFactory* grFactory) { 75 void GpuBenchTask::draw(GrContextFactory* grFactory) {
74 SkImageInfo info = SkImageInfo::Make(fBench->getSize().x(), 76 SkImageInfo info = SkImageInfo::Make(fBench->getSize().x(),
75 fBench->getSize().y(), 77 fBench->getSize().y(),
76 kN32_SkColorType, 78 kN32_SkColorType,
77 kPremul_SkAlphaType); 79 kPremul_SkAlphaType);
78 SkAutoTUnref<SkSurface> surface(NewGpuSurface(grFactory, fContextType, info, fSampleCount)); 80 SkAutoTUnref<SkSurface> surface(NewGpuSurface(grFactory, fContextType, fForc edGpuApi, info,
79 81 fSampleCount));
82 if (!surface) {
83 this->fail("Could not create context for the config and the api.");
84 return;
85 }
80 fBench->preDraw(); 86 fBench->preDraw();
81 fBench->draw(1, surface->getCanvas()); 87 fBench->draw(1, surface->getCanvas());
82 fBench->postDraw(); 88 fBench->postDraw();
83 } 89 }
84 90
85 } // namespace DM 91 } // namespace DM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698