diff options
author | Mike Klein <mtklein@chromium.org> | 2017-05-01 21:33:55 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-05-01 21:34:00 +0000 |
commit | cea615b4970d30933b40aadd56a1608c6f26b564 (patch) | |
tree | ee66d340b7acce5ef99a1296108981862dbf962d | |
parent | 3354969a4a4adcea159f3a0b01ad0a7c04fc9115 (diff) |
Revert "Add a clip mask bench"
This reverts commit c59a38d12dce287427f3d3fe1d4b3ad8052cda35.
Reason for revert: whoops, sorry, this one must have been the problem.
Original change's description:
> Add a clip mask bench
>
> Change-Id: I230729492fc23e290136f7d62610abe5ca51c067
> Reviewed-on: https://skia-review.googlesource.com/14941
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Florin Malita <fmalita@chromium.org>
>
TBR=fmalita@chromium.org,reed@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Change-Id: Ifbd74a8985ebaa95e54032aaaa2891b0f1b67940
Reviewed-on: https://skia-review.googlesource.com/14957
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
-rw-r--r-- | bench/ClipMaskBench.cpp | 68 | ||||
-rw-r--r-- | gn/bench.gni | 1 |
2 files changed, 0 insertions, 69 deletions
diff --git a/bench/ClipMaskBench.cpp b/bench/ClipMaskBench.cpp deleted file mode 100644 index b678397816..0000000000 --- a/bench/ClipMaskBench.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2017 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 "sk_tool_utils.h" -#include "SkCanvas.h" -#include "SkColorSpace.h" -#include "SkImage.h" -#include "SkPictureRecorder.h" -#include "SkString.h" -#include "SkSurface.h" - -static void DrawMask(SkCanvas* canvas) { - sk_tool_utils::draw_checkerboard(canvas, SK_ColorTRANSPARENT, SK_ColorGREEN, 10); -} - -class ClipMaskBench : public Benchmark { -public: - using MaskMakerFunc = sk_sp<SkImage> (*)(int); - - ClipMaskBench(const char name[], const MaskMakerFunc maskMaker) - : fName(SkStringPrintf("clipmask_%s", name)) - , fClip(maskMaker(kSize)) {} - -protected: - const char* onGetName() override { return fName.c_str(); } - - void onDraw(int loops, SkCanvas* canvas) override { - SkCanvas::SaveLayerRec rec(nullptr, nullptr, nullptr, fClip, nullptr, 0); - - for (int i = 0; i < loops; ++i) { - canvas->saveLayer(rec); - canvas->drawColor(SK_ColorBLUE); - canvas->restore(); - } - } - -private: - static constexpr int kSize = 400; - - SkString fName; - sk_sp<SkImage> fClip; -}; - -DEF_BENCH(return new ClipMaskBench("a8", [](int size) -> sk_sp<SkImage> { - sk_sp<SkSurface> surface = SkSurface::MakeRaster(SkImageInfo::MakeA8(size, size)); - DrawMask(surface->getCanvas()); - return surface->makeImageSnapshot(); -});) - -DEF_BENCH(return new ClipMaskBench("8888", [](int size) -> sk_sp<SkImage> { - sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(size, size); - DrawMask(surface->getCanvas()); - return surface->makeImageSnapshot(); -});) - -DEF_BENCH(return new ClipMaskBench("picture", [](int size) -> sk_sp<SkImage> { - SkPictureRecorder recorder; - DrawMask(recorder.beginRecording(size, size)); - return SkImage::MakeFromPicture(recorder.finishRecordingAsPicture(), SkISize::Make(size, size), - nullptr, nullptr, SkImage::BitDepth::kU8, - SkColorSpace::MakeSRGB()); -});) - diff --git a/gn/bench.gni b/gn/bench.gni index 4364f6575d..5aff91b33d 100644 --- a/gn/bench.gni +++ b/gn/bench.gni @@ -27,7 +27,6 @@ bench_sources = [ "$_bench/ChartBench.cpp", "$_bench/ChecksumBench.cpp", "$_bench/ChromeBench.cpp", - "$_bench/ClipMaskBench.cpp", "$_bench/CmapBench.cpp", "$_bench/CodecBench.cpp", "$_bench/ColorCanvasDrawBitmapBench.cpp", |