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

Side by Side Diff: bench/BlurOccludedRRectBench.cpp

Issue 2201133002: Implement GPU occluded blur mask filter (Closed) Base URL: https://skia.googlesource.com/skia.git@occluded-blur
Patch Set: update to ToT 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 | gm/occludedrrectblur.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 2016 Google Inc. 2 * Copyright 2016 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 #include "Benchmark.h" 8 #include "Benchmark.h"
9 #include "SkBlurMaskFilter.h" 9 #include "SkBlurMaskFilter.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 17 matching lines...) Expand all
28 void onDraw(int loops, SkCanvas* canvas) override { 28 void onDraw(int loops, SkCanvas* canvas) override {
29 for (int l = 0; l < loops; ++l) { 29 for (int l = 0; l < loops; ++l) {
30 canvas->clear(0xFFFAFAFA); 30 canvas->clear(0xFFFAFAFA);
31 31
32 SkPaint opaque; 32 SkPaint opaque;
33 opaque.setAntiAlias(true); 33 opaque.setAntiAlias(true);
34 opaque.setColor(SK_ColorWHITE); 34 opaque.setColor(SK_ColorWHITE);
35 35
36 const SkRect r = SkRect::MakeWH(480, 230); 36 const SkRect r = SkRect::MakeWH(480, 230);
37 const SkRRect rr = SkRRect::MakeRectXY(r, 8, 8); 37 const SkRRect rr = SkRRect::MakeRectXY(r, 8, 8);
38 //SkRect occRect = sk_tool_utils::compute_central_occluder(rr); 38 SkRect occRect = sk_tool_utils::compute_central_occluder(rr);
39 39
40 for (int i = 0; i < 2; ++i) { 40 for (int i = 0; i < 2; ++i) {
41 canvas->save(); 41 canvas->save();
42 42
43 canvas->translate(i*502.0f+20, 10.0f); 43 canvas->translate(i*502.0f+20, 10.0f);
44 44
45 for (int j = 0; j < 8; ++j) { 45 for (int j = 0; j < 8; ++j) {
46 canvas->save(); 46 canvas->save();
47 47
48 canvas->translate(0.0f, j*256.0f); 48 canvas->translate(0.0f, j*256.0f);
49 49
50 SkPaint firstBlur; 50 SkPaint firstBlur;
51 firstBlur.setAntiAlias(true); 51 firstBlur.setAntiAlias(true);
52 firstBlur.setColor(0x09000000); 52 firstBlur.setColor(0x09000000);
53 firstBlur.setMaskFilter(SkBlurMaskFilter::Make(kNormal_S kBlurStyle, 53 firstBlur.setMaskFilter(SkBlurMaskFilter::Make(kNormal_S kBlurStyle,
54 2.5f)); 54 2.5f,
55 //, occRe ct)); 55 occRect)) ;
56 56
57 canvas->drawRRect(rr, firstBlur); 57 canvas->drawRRect(rr, firstBlur);
58 58
59 canvas->save(); 59 canvas->save();
60 canvas->translate(1.5f, 1.5f); 60 canvas->translate(1.5f, 1.5f);
61 61
62 SkPaint secondBlur; 62 SkPaint secondBlur;
63 secondBlur.setAntiAlias(true); 63 secondBlur.setAntiAlias(true);
64 secondBlur.setColor(0x30000000); 64 secondBlur.setColor(0x30000000);
65 secondBlur.setMaskFilter(SkBlurMaskFilter::Make(kNor mal_SkBlurStyle, 65 secondBlur.setMaskFilter(SkBlurMaskFilter::Make(kNor mal_SkBlurStyle,
66 6.0f )); 66 6.0f ,
67 //, occRect)); 67 occR ect));
68 68
69 canvas->drawRRect(rr, secondBlur); 69 canvas->drawRRect(rr, secondBlur);
70 70
71 canvas->restore(); 71 canvas->restore();
72 72
73 canvas->drawRRect(rr, opaque); 73 canvas->drawRRect(rr, opaque);
74 74
75 canvas->restore(); 75 canvas->restore();
76 } 76 }
77 77
78 canvas->restore(); 78 canvas->restore();
79 } 79 }
80 } 80 }
81 } 81 }
82 82
83 private: 83 private:
84 typedef Benchmark INHERITED; 84 typedef Benchmark INHERITED;
85 }; 85 };
86 86
87 DEF_BENCH(return new BlurOccludedRRectBench();) 87 DEF_BENCH(return new BlurOccludedRRectBench();)
OLDNEW
« no previous file with comments | « no previous file | gm/occludedrrectblur.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698