OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 canvas->drawPath(path, paint); | 127 canvas->drawPath(path, paint); |
128 // important to translate by a factional amount to exercise a different
"phase" | 128 // important to translate by a factional amount to exercise a different
"phase" |
129 // of the same path w.r.t. the pixel grid | 129 // of the same path w.r.t. the pixel grid |
130 SkScalar dx = SkScalarRoundToScalar(path.getBounds().width()) + 14 + 0.2
5f; | 130 SkScalar dx = SkScalarRoundToScalar(path.getBounds().width()) + 14 + 0.2
5f; |
131 canvas->translate(dx, 0); | 131 canvas->translate(dx, 0); |
132 canvas->drawPath(path, paint); | 132 canvas->drawPath(path, paint); |
133 } | 133 } |
134 }; | 134 }; |
135 DEF_GM( return new Blur2RectsGM; ) | 135 DEF_GM( return new Blur2RectsGM; ) |
| 136 |
| 137 class Blur2RectsNonNinePatchGM : public skiagm::GM { |
| 138 public: |
| 139 SkString onShortName() SK_OVERRIDE { |
| 140 return SkString("blur2rectsnonninepatch"); |
| 141 } |
| 142 |
| 143 SkISize onISize() SK_OVERRIDE { |
| 144 return SkISize::Make(700, 500); |
| 145 } |
| 146 |
| 147 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
| 148 SkPaint paint; |
| 149 paint.setMaskFilter(SkBlurMaskFilter::Create(kNormal_SkBlurStyle, |
| 150 4.3f))->unref(); |
| 151 |
| 152 SkRect outer = SkRect::MakeXYWH(10, 110, 100, 100); |
| 153 SkRect inner = SkRect::MakeXYWH(50, 150, 10, 10); |
| 154 SkPath path; |
| 155 path.addRect(outer, SkPath::kCW_Direction); |
| 156 path.addRect(inner, SkPath::kCW_Direction); |
| 157 canvas->drawPath(path, paint); |
| 158 |
| 159 SkScalar dx = SkScalarRoundToScalar(path.getBounds().width()) + 40 + 0.2
5f; |
| 160 canvas->translate(dx, 0); |
| 161 canvas->drawPath(path, paint); |
| 162 |
| 163 // Translate to outside of clip bounds. |
| 164 canvas->translate(-dx, 0); |
| 165 canvas->translate(-30, -150); |
| 166 canvas->drawPath(path, paint); |
| 167 } |
| 168 }; |
| 169 DEF_GM( return new Blur2RectsNonNinePatchGM; ) |
OLD | NEW |