OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "gm.h" | 8 #include "gm.h" |
9 #include "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
12 #include "SkColorFilter.h" | 12 #include "SkColorFilter.h" |
13 #include "SkLayerDrawLooper.h" | 13 #include "SkLayerDrawLooper.h" |
14 #include "SkPaint.h" | 14 #include "SkPaint.h" |
15 #include "SkPath.h" | 15 #include "SkPath.h" |
16 #include "SkPoint.h" | 16 #include "SkPoint.h" |
17 #include "SkRect.h" | 17 #include "SkRect.h" |
18 #include "SkRRect.h" | 18 #include "SkRRect.h" |
19 #include "SkString.h" | 19 #include "SkString.h" |
20 #include "SkXfermode.h" | 20 #include "SkXfermode.h" |
21 | 21 |
22 // This GM mimics a blurred RR seen in the wild. | 22 // This GM mimics a blurred RR seen in the wild. |
23 class BlurRoundRectGM : public skiagm::GM { | 23 class BlurRoundRectGM : public skiagm::GM { |
24 public: | 24 public: |
25 BlurRoundRectGM(int width, int height, int radius) | 25 BlurRoundRectGM(int width, int height, int radius) |
26 : fName("blurroundrect") | 26 : fName("blurroundrect") |
27 { | 27 { |
28 SkRect r = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height)); | 28 SkRect r = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height)); |
29 fRRect.setRectXY(r, SkIntToScalar(radius), SkIntToScalar(radius)); | 29 fRRect.setRectXY(r, SkIntToScalar(radius), SkIntToScalar(radius)); |
30 fName.appendf("-WH[%ix%i]-corner[%i]", width, height, radius); | 30 fName.appendf("-WH-%ix%i-corner-%i", width, height, radius); |
31 } | 31 } |
32 | 32 |
33 BlurRoundRectGM(int width, int height) | 33 BlurRoundRectGM(int width, int height) |
34 : fName("blurroundrect") { | 34 : fName("blurroundrect") { |
35 fName.appendf("-WH[%ix%i]-unevenCorners", | 35 fName.appendf("-WH-%ix%i-unevenCorners", width, height); |
36 width, height); | |
37 SkVector radii[4]; | 36 SkVector radii[4]; |
38 radii[0].set(SkIntToScalar(30), SkIntToScalar(30)); | 37 radii[0].set(SkIntToScalar(30), SkIntToScalar(30)); |
39 radii[1].set(SkIntToScalar(10), SkIntToScalar(10)); | 38 radii[1].set(SkIntToScalar(10), SkIntToScalar(10)); |
40 radii[2].set(SkIntToScalar(30), SkIntToScalar(30)); | 39 radii[2].set(SkIntToScalar(30), SkIntToScalar(30)); |
41 radii[3].set(SkIntToScalar(10), SkIntToScalar(10)); | 40 radii[3].set(SkIntToScalar(10), SkIntToScalar(10)); |
42 SkRect r = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height)); | 41 SkRect r = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height)); |
43 fRRect.setRectRadii(r, radii); | 42 fRRect.setRectRadii(r, radii); |
44 } | 43 } |
45 | 44 |
46 virtual uint32_t onGetFlags() const SK_OVERRIDE { | 45 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 // TODO(scroggo): Disabled in an attempt to rememdy | 153 // TODO(scroggo): Disabled in an attempt to rememdy |
155 // https://code.google.com/p/skia/issues/detail?id=1801 ('Win7 Test bots all fai
ling GenerateGMs: | 154 // https://code.google.com/p/skia/issues/detail?id=1801 ('Win7 Test bots all fai
ling GenerateGMs: |
156 // ran wrong number of tests') | 155 // ran wrong number of tests') |
157 //DEF_GM(return new BlurRoundRectGM(600, 5514, 6);) | 156 //DEF_GM(return new BlurRoundRectGM(600, 5514, 6);) |
158 | 157 |
159 // Rounded rect with two opposite corners with large radii, the other two | 158 // Rounded rect with two opposite corners with large radii, the other two |
160 // small. | 159 // small. |
161 DEF_GM(return new BlurRoundRectGM(100, 100);) | 160 DEF_GM(return new BlurRoundRectGM(100, 100);) |
162 | 161 |
163 DEF_GM(return new SimpleBlurRoundRectGM();) | 162 DEF_GM(return new SimpleBlurRoundRectGM();) |
OLD | NEW |