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

Unified Diff: bench/DeferredSurfaceCopyBench.cpp

Issue 1269093002: remove SkDeferredCanvas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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 | dm/DM.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
deleted file mode 100644
index 3644627d31576e122bcf3c06622d79a6b71d0c74..0000000000000000000000000000000000000000
--- a/bench/DeferredSurfaceCopyBench.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-
-/*
- * Copyright 2013 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "Benchmark.h"
-#include "SkDeferredCanvas.h"
-#include "SkDevice.h"
-#include "SkImage.h"
-#include "SkSurface.h"
-#if SK_SUPPORT_GPU
-#include "GrRenderTarget.h"
-#endif
-
-class DeferredSurfaceCopyBench : public Benchmark {
- enum {
- kSurfaceWidth = 1000,
- kSurfaceHeight = 1000,
- };
-public:
- DeferredSurfaceCopyBench(bool discardableContents) {
- fDiscardableContents = discardableContents;
- }
-
-protected:
- const char* onGetName() override {
- return fDiscardableContents ? "DeferredSurfaceCopy_discardable" :
- "DeferredSurfaceCopy_nonDiscardable";
- }
-
- void onDraw(const int loops, SkCanvas* canvas) override {
- // The canvas is not actually used for this test except to provide
- // configuration information: gpu, multisampling, size, etc?
- SkImageInfo info = SkImageInfo::MakeN32Premul(kSurfaceWidth, kSurfaceHeight);
- const SkRect fullCanvasRect = SkRect::MakeWH(
- SkIntToScalar(kSurfaceWidth), SkIntToScalar(kSurfaceHeight));
- SkAutoTUnref<SkSurface> surface(canvas->newSurface(info));
-
- // newSurface() can return NULL for several reasons, so we need to check
- if (NULL == surface.get()) {
- SkDebugf("DeferredSurfaceCopyBench newSurface failed, bench results are meaningless\n");
- return; // should we signal the caller that we hit an error?
- }
-
- SkAutoTUnref<SkDeferredCanvas> drawingCanvas(SkDeferredCanvas::Create(surface));
-
- for (int iteration = 0; iteration < loops; iteration++) {
- drawingCanvas->clear(0);
- SkAutoTUnref<SkImage> image(drawingCanvas->newImageSnapshot());
- SkPaint paint;
- if (!fDiscardableContents) {
- // If paint is not opaque, prior canvas contents are
- // not discardable because they are needed for compositing.
- paint.setAlpha(127);
- }
- drawingCanvas->drawRect(fullCanvasRect, paint);
- // Trigger copy on write, which should be faster in the discardable case.
- drawingCanvas->flush();
- }
- }
-
-private:
- bool fDiscardableContents;
-
- typedef Benchmark INHERITED;
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-DEF_BENCH( return new DeferredSurfaceCopyBench(false); )
-DEF_BENCH( return new DeferredSurfaceCopyBench(true); )
« no previous file with comments | « no previous file | dm/DM.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698