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

Unified Diff: bench/DeferredSurfaceCopyBench.cpp

Issue 355193006: stop calling SkCanvas::getDevice (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: guard gpu code in no-gpu build 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gm/srcmode.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/DeferredSurfaceCopyBench.cpp
diff --git a/bench/DeferredSurfaceCopyBench.cpp b/bench/DeferredSurfaceCopyBench.cpp
index f4002b87be4c4a2ec2c089717edbc7b04eb0ba81..cbf98ec8a195c313835d3ebd2b1e552dc3ab2c75 100644
--- a/bench/DeferredSurfaceCopyBench.cpp
+++ b/bench/DeferredSurfaceCopyBench.cpp
@@ -34,26 +34,11 @@ protected:
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
// The canvas is not actually used for this test except to provide
// configuration information: gpu, multisampling, size, etc?
- SkImageInfo info;
- info.fWidth = kSurfaceWidth;
- info.fHeight = kSurfaceHeight;
- info.fColorType = kN32_SkColorType;
- info.fAlphaType = kPremul_SkAlphaType;
+ SkImageInfo info = SkImageInfo::MakeN32Premul(kSurfaceWidth, kSurfaceHeight);
const SkRect fullCanvasRect = SkRect::MakeWH(
SkIntToScalar(kSurfaceWidth), SkIntToScalar(kSurfaceHeight));
- SkSurface* surface;
-#if SK_SUPPORT_GPU
- GrRenderTarget* rt = reinterpret_cast<GrRenderTarget*>(
- canvas->getDevice()->accessRenderTarget());
- if (NULL != rt) {
- surface = SkSurface::NewRenderTarget(rt->getContext(), info, rt->numSamples());
- } else
-#endif
- {
- surface = SkSurface::NewRaster(info);
- }
+ SkAutoTUnref<SkSurface> surface(canvas->newSurface(info));
SkAutoTUnref<SkDeferredCanvas> drawingCanvas(SkDeferredCanvas::Create(surface));
- surface->unref();
for (int iteration = 0; iteration < loops; iteration++) {
drawingCanvas->clear(0);
« no previous file with comments | « no previous file | gm/srcmode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698