| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 return SkISize::Make(700, 500); | 112 return SkISize::Make(700, 500); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 115 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
| 116 SkPaint paint; | 116 SkPaint paint; |
| 117 | 117 |
| 118 paint.setMaskFilter(SkBlurMaskFilter::Create(kNormal_SkBlurStyle, | 118 paint.setMaskFilter(SkBlurMaskFilter::Create(kNormal_SkBlurStyle, |
| 119 2.3f))->unref(); | 119 2.3f))->unref(); |
| 120 | 120 |
| 121 SkRect outer = SkRect::MakeXYWH(10.125f, 10.125f, 100, 100); | 121 SkRect outer = SkRect::MakeXYWH(10.125f, 10.125f, 100, 100); |
| 122 SkRect inner = SkRect::MakeXYWH(20, 20, 80, 80); | 122 SkRect inner = SkRect::MakeXYWH(20.125f, 20.125f, 80, 80); |
| 123 SkPath path; | 123 SkPath path; |
| 124 path.addRect(outer, SkPath::kCW_Direction); | 124 path.addRect(outer, SkPath::kCW_Direction); |
| 125 path.addRect(inner, SkPath::kCCW_Direction); | 125 path.addRect(inner, SkPath::kCCW_Direction); |
| 126 | 126 |
| 127 canvas->drawPath(path, paint); | 127 canvas->drawPath(path, paint); |
| 128 // important to translate by a factional amount (.25) to exercise a diff
erent "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 canvas->translate(SkScalarRoundToScalar(path.getBounds().width()) + 14 +
0.25f, 0); | 130 SkScalar dx = SkScalarRoundToScalar(path.getBounds().width()) + 14 + 0.1
25f; |
| 131 canvas->translate(dx, 0); |
| 131 canvas->drawPath(path, paint); | 132 canvas->drawPath(path, paint); |
| 132 } | 133 } |
| 133 }; | 134 }; |
| 134 DEF_GM( return new Blur2RectsGM; ) | 135 DEF_GM( return new Blur2RectsGM; ) |
| OLD | NEW |