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

Side by Side Diff: bench/BlurOccludedRRectBench.cpp

Issue 2203153002: Add new bench for occluded blurmaskfilter draws (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Appease compilers Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | tools/sk_tool_utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "Benchmark.h"
9 #include "SkBlurMaskFilter.h"
10 #include "SkCanvas.h"
11 #include "SkPaint.h"
12 #include "SkRRect.h"
13 #include "SkRect.h"
14 #include "sk_tool_utils.h"
15
16 class BlurOccludedRRectBench : public Benchmark {
17 public:
18 BlurOccludedRRectBench() {}
19
20 const char* onGetName() override {
21 return "bluroccludedrrect";
22 }
23
24 SkIPoint onGetSize() override {
25 return SkIPoint::Make(1024, 2048);
26 }
27
28 void onDraw(int loops, SkCanvas* canvas) override {
29 for (int l = 0; l < loops; ++l) {
30 canvas->clear(0xFFFAFAFA);
31
32 SkPaint opaque;
33 opaque.setAntiAlias(true);
34 opaque.setColor(SK_ColorWHITE);
35
36 const SkRect r = SkRect::MakeWH(480, 230);
37 const SkRRect rr = SkRRect::MakeRectXY(r, 8, 8);
38 //SkRect occRect = sk_tool_utils::compute_central_occluder(rr);
39
40 for (int i = 0; i < 2; ++i) {
41 canvas->save();
42
43 canvas->translate(i*502.0f+20, 10.0f);
44
45 for (int j = 0; j < 8; ++j) {
46 canvas->save();
47
48 canvas->translate(0.0f, j*256.0f);
49
50 SkPaint firstBlur;
51 firstBlur.setAntiAlias(true);
52 firstBlur.setColor(0x09000000);
53 firstBlur.setMaskFilter(SkBlurMaskFilter::Make(kNormal_S kBlurStyle,
54 2.5f));
55 //, occRe ct));
56
57 canvas->drawRRect(rr, firstBlur);
58
59 canvas->save();
60 canvas->translate(1.5f, 1.5f);
61
62 SkPaint secondBlur;
63 secondBlur.setAntiAlias(true);
64 secondBlur.setColor(0x30000000);
65 secondBlur.setMaskFilter(SkBlurMaskFilter::Make(kNor mal_SkBlurStyle,
66 6.0f ));
67 //, occRect));
68
69 canvas->drawRRect(rr, secondBlur);
70
71 canvas->restore();
72
73 canvas->drawRRect(rr, opaque);
74
75 canvas->restore();
76 }
77
78 canvas->restore();
79 }
80 }
81 }
82
83 private:
84 typedef Benchmark INHERITED;
85 };
86
87 DEF_BENCH(return new BlurOccludedRRectBench();)
OLDNEW
« no previous file with comments | « no previous file | tools/sk_tool_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698