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" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 outlinePaint.setColor(SK_ColorRED); | 62 outlinePaint.setColor(SK_ColorRED); |
63 outlinePaint.setStyle(SkPaint::kStroke_Style); | 63 outlinePaint.setStyle(SkPaint::kStroke_Style); |
64 | 64 |
65 SkPaint blurPaint; | 65 SkPaint blurPaint; |
66 blurPaint.setAntiAlias(true); | 66 blurPaint.setAntiAlias(true); |
67 blurPaint.setColor(SK_ColorBLACK); | 67 blurPaint.setColor(SK_ColorBLACK); |
68 | 68 |
69 int desiredX = 0, desiredY = 0; | 69 int desiredX = 0, desiredY = 0; |
70 | 70 |
71 for (int i = 0; i < 2; ++i) { | 71 for (int i = 0; i < 2; ++i) { |
72 for (int j = 0; j < SkBlurMaskFilter::kBlurStyleCount; ++j) { | 72 for (int j = 0; j <= kLastEnum_SkBlurStyle; ++j) { |
73 SkMaskFilter* mf = SkBlurMaskFilter::Create((SkBlurMaskFilter::B
lurStyle)j, | 73 SkMaskFilter* mf = SkBlurMaskFilter::Create((SkBlurStyle)j, kSig
ma); |
74 kSigma); | |
75 blurPaint.setMaskFilter(mf)->unref(); | 74 blurPaint.setMaskFilter(mf)->unref(); |
76 | 75 |
77 for (int k = 0; k < (int)SK_ARRAY_COUNT(origins); ++k) { | 76 for (int k = 0; k < (int)SK_ARRAY_COUNT(origins); ++k) { |
78 canvas->save(); | 77 canvas->save(); |
79 | 78 |
80 SkRect clipRect = SkRect::MakeXYWH(SkIntToScalar(desiredX), | 79 SkRect clipRect = SkRect::MakeXYWH(SkIntToScalar(desiredX), |
81 SkIntToScalar(desiredY), | 80 SkIntToScalar(desiredY), |
82 SkIntToScalar(kCloseUpSiz
e), | 81 SkIntToScalar(kCloseUpSiz
e), |
83 SkIntToScalar(kCloseUpSiz
e)); | 82 SkIntToScalar(kCloseUpSiz
e)); |
84 | 83 |
(...skipping 15 matching lines...) Expand all Loading... |
100 | 99 |
101 desiredX = 0; | 100 desiredX = 0; |
102 desiredY += kCloseUpSize; | 101 desiredY += kCloseUpSize; |
103 } | 102 } |
104 } | 103 } |
105 } | 104 } |
106 | 105 |
107 private: | 106 private: |
108 static const int kCloseUpSize = 64; | 107 static const int kCloseUpSize = 64; |
109 static const int kWidth = 5 * kCloseUpSize; | 108 static const int kWidth = 5 * kCloseUpSize; |
110 static const int kHeight = 2 * SkBlurMaskFilter::kBlurStyleCount * kCloseUpS
ize; | 109 static const int kHeight = 2 * (kLastEnum_SkBlurStyle + 1) * kCloseUpSize; |
111 | 110 |
112 typedef GM INHERITED; | 111 typedef GM INHERITED; |
113 }; | 112 }; |
114 | 113 |
115 DEF_GM( return SkNEW(BigBlursGM); ) | 114 DEF_GM( return SkNEW(BigBlursGM); ) |
116 | 115 |
117 } | 116 } |
OLD | NEW |