OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "gm.h" | 9 #include "gm.h" |
10 #include "SkBlurMask.h" | 10 #include "SkBlurMask.h" |
11 #include "SkBlurMaskFilter.h" | 11 #include "SkBlurMaskFilter.h" |
12 | 12 |
13 namespace skiagm { | 13 namespace skiagm { |
14 | 14 |
15 // This GM exercises the blurred rect nine-patching special cases when the | 15 // This GM exercises the blurred rect nine-patching special cases when the |
16 // blurred rect is very large and/or very far from the origin. | 16 // blurred rect is very large and/or very far from the origin. |
17 // It creates a large blurred rect/rectori then renders the 4 corners and the | 17 // It creates a large blurred rect/rectori then renders the 4 corners and the |
18 // middle. | 18 // middle. |
19 class BigBlursGM : public GM { | 19 class BigBlursGM : public GM { |
20 public: | 20 public: |
21 BigBlursGM() { | 21 BigBlursGM() { |
22 this->setBGColor(0xFFDDDDDD); | 22 this->setBGColor(0xFFDDDDDD); |
23 } | 23 } |
24 | 24 |
25 protected: | 25 protected: |
26 virtual SkString onShortName() SK_OVERRIDE { | 26 SkString onShortName() SK_OVERRIDE { |
27 return SkString("bigblurs"); | 27 return SkString("bigblurs"); |
28 } | 28 } |
29 | 29 |
30 virtual SkISize onISize() SK_OVERRIDE { | 30 SkISize onISize() SK_OVERRIDE { |
31 return SkISize::Make(kWidth, kHeight); | 31 return SkISize::Make(kWidth, kHeight); |
32 } | 32 } |
33 | 33 |
34 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 34 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
35 static const int kBig = 65536; | 35 static const int kBig = 65536; |
36 static const SkScalar kSigma = SkBlurMask::ConvertRadiusToSigma(SkIntToS
calar(4)); | 36 static const SkScalar kSigma = SkBlurMask::ConvertRadiusToSigma(SkIntToS
calar(4)); |
37 | 37 |
38 const SkRect bigRect = SkRect::MakeWH(SkIntToScalar(kBig), SkIntToScalar
(kBig)); | 38 const SkRect bigRect = SkRect::MakeWH(SkIntToScalar(kBig), SkIntToScalar
(kBig)); |
39 SkRect insetRect = bigRect; | 39 SkRect insetRect = bigRect; |
40 insetRect.inset(20, 20); | 40 insetRect.inset(20, 20); |
41 | 41 |
42 SkPath rectori; | 42 SkPath rectori; |
43 | 43 |
44 rectori.addRect(bigRect); | 44 rectori.addRect(bigRect); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 static const int kCloseUpSize = 64; | 107 static const int kCloseUpSize = 64; |
108 static const int kWidth = 5 * kCloseUpSize; | 108 static const int kWidth = 5 * kCloseUpSize; |
109 static const int kHeight = 2 * (kLastEnum_SkBlurStyle + 1) * kCloseUpSize; | 109 static const int kHeight = 2 * (kLastEnum_SkBlurStyle + 1) * kCloseUpSize; |
110 | 110 |
111 typedef GM INHERITED; | 111 typedef GM INHERITED; |
112 }; | 112 }; |
113 | 113 |
114 DEF_GM( return SkNEW(BigBlursGM); ) | 114 DEF_GM( return SkNEW(BigBlursGM); ) |
115 | 115 |
116 } | 116 } |
OLD | NEW |