OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "sk_tool_utils.h" | 8 #include "sk_tool_utils.h" |
9 #include "SkBitmapSource.h" | 9 #include "SkBitmapSource.h" |
10 #include "SkBlurImageFilter.h" | 10 #include "SkBlurImageFilter.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 for (size_t j = 0; j < SK_ARRAY_COUNT(scales); ++j) { | 125 for (size_t j = 0; j < SK_ARRAY_COUNT(scales); ++j) { |
126 canvas->save(); | 126 canvas->save(); |
127 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) { | 127 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) { |
128 SkPaint paint; | 128 SkPaint paint; |
129 paint.setColor(SK_ColorBLUE); | 129 paint.setColor(SK_ColorBLUE); |
130 paint.setImageFilter(filters[i]); | 130 paint.setImageFilter(filters[i]); |
131 paint.setAntiAlias(true); | 131 paint.setAntiAlias(true); |
132 canvas->save(); | 132 canvas->save(); |
133 canvas->scale(scales[j].fX, scales[j].fY); | 133 canvas->scale(scales[j].fX, scales[j].fY); |
| 134 canvas->clipRect(r); |
134 if (5 == i) { | 135 if (5 == i) { |
135 canvas->translate(SkIntToScalar(-32), 0); | 136 canvas->translate(SkIntToScalar(-32), 0); |
136 } else if (6 == i) { | 137 } else if (6 == i) { |
137 canvas->scale(SkScalarInvert(RESIZE_FACTOR), | 138 canvas->scale(SkScalarInvert(RESIZE_FACTOR), |
138 SkScalarInvert(RESIZE_FACTOR)); | 139 SkScalarInvert(RESIZE_FACTOR)); |
139 } | 140 } |
140 canvas->drawCircle(r.centerX(), r.centerY(), r.width()*2/5, pain
t); | 141 canvas->drawCircle(r.centerX(), r.centerY(), r.width()*2/5, pain
t); |
141 canvas->restore(); | 142 canvas->restore(); |
142 canvas->translate(r.width() * scales[j].fX + margin, 0); | 143 canvas->translate(r.width() * scales[j].fX + margin, 0); |
143 } | 144 } |
(...skipping 12 matching lines...) Expand all Loading... |
156 SkBitmap fGradientCircle; | 157 SkBitmap fGradientCircle; |
157 typedef GM INHERITED; | 158 typedef GM INHERITED; |
158 }; | 159 }; |
159 | 160 |
160 ////////////////////////////////////////////////////////////////////////////// | 161 ////////////////////////////////////////////////////////////////////////////// |
161 | 162 |
162 static GM* MyFactory(void*) { return new ImageFiltersScaledGM; } | 163 static GM* MyFactory(void*) { return new ImageFiltersScaledGM; } |
163 static GMRegistry reg(MyFactory); | 164 static GMRegistry reg(MyFactory); |
164 | 165 |
165 } | 166 } |
OLD | NEW |