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

Side by Side Diff: tools/VisualBench/WrappedBenchmark.h

Issue 1810813003: update callsites for Make image factories (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: start to take advantage of sk_sp drawImage Created 4 years, 9 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 | « tools/Resources.cpp ('k') | tools/debugger/SkDrawCommand.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 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef WrappedBenchmark_DEFINED 8 #ifndef WrappedBenchmark_DEFINED
9 #define WrappedBenchmark_DEFINED 9 #define WrappedBenchmark_DEFINED
10 10
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 public: 77 public:
78 explicit CpuWrappedBenchmark(const SkSurfaceProps& surfaceProps, Benchmark* bench) 78 explicit CpuWrappedBenchmark(const SkSurfaceProps& surfaceProps, Benchmark* bench)
79 : INHERITED(surfaceProps, bench) {} 79 : INHERITED(surfaceProps, bench) {}
80 80
81 private: 81 private:
82 void setupOffScreen(SkCanvas* canvas) override { 82 void setupOffScreen(SkCanvas* canvas) override {
83 fOffScreen.reset(SkSurface::NewRaster(canvas->imageInfo(), &this->surfac eProps())); 83 fOffScreen.reset(SkSurface::NewRaster(canvas->imageInfo(), &this->surfac eProps()));
84 } 84 }
85 85
86 void onBlitToScreen(SkCanvas* canvas, int w, int h) override { 86 void onBlitToScreen(SkCanvas* canvas, int w, int h) override {
87 SkAutoTUnref<SkImage> image(fOffScreen->newImageSnapshot()); 87 sk_sp<SkImage> image(fOffScreen->makeImageSnapshot());
88 SkPaint blitPaint; 88 SkPaint blitPaint;
89 blitPaint.setXfermodeMode(SkXfermode::kSrc_Mode); 89 blitPaint.setXfermodeMode(SkXfermode::kSrc_Mode);
90 canvas->drawImageRect(image, SkIRect::MakeWH(w, h), 90 canvas->drawImageRect(image.get(), SkIRect::MakeWH(w, h),
91 SkRect::MakeWH(SkIntToScalar(w), SkIntToScalar(h)) , &blitPaint); 91 SkRect::MakeWH(SkIntToScalar(w), SkIntToScalar(h)) , &blitPaint);
92 } 92 }
93 93
94 typedef WrappedBenchmark INHERITED; 94 typedef WrappedBenchmark INHERITED;
95 }; 95 };
96 96
97 // Create an MSAA & NVPR-enabled GPU backend 97 // Create an MSAA & NVPR-enabled GPU backend
98 class GpuWrappedBenchmark : public WrappedBenchmark { 98 class GpuWrappedBenchmark : public WrappedBenchmark {
99 public: 99 public:
100 explicit GpuWrappedBenchmark(const SkSurfaceProps& surfaceProps, Benchmark* bench, 100 explicit GpuWrappedBenchmark(const SkSurfaceProps& surfaceProps, Benchmark* bench,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 offscreenIter.next(); 133 offscreenIter.next();
134 SkASSERT(offscreenIter.done()); 134 SkASSERT(offscreenIter.done());
135 #endif 135 #endif
136 } 136 }
137 137
138 int fNumSamples; 138 int fNumSamples;
139 typedef WrappedBenchmark INHERITED; 139 typedef WrappedBenchmark INHERITED;
140 }; 140 };
141 141
142 #endif //WrappedBenchmark_DEFINED 142 #endif //WrappedBenchmark_DEFINED
OLDNEW
« no previous file with comments | « tools/Resources.cpp ('k') | tools/debugger/SkDrawCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698