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); | |
135 if (5 == i) { | 134 if (5 == i) { |
136 canvas->translate(SkIntToScalar(-32), 0); | 135 canvas->translate(SkIntToScalar(-32), 0); |
137 } else if (6 == i) { | 136 } else if (6 == i) { |
138 canvas->scale(SkScalarInvert(RESIZE_FACTOR), | 137 canvas->scale(SkScalarInvert(RESIZE_FACTOR), |
139 SkScalarInvert(RESIZE_FACTOR)); | 138 SkScalarInvert(RESIZE_FACTOR)); |
140 } | 139 } |
141 canvas->drawCircle(r.centerX(), r.centerY(), r.width()*2/5, pain
t); | 140 canvas->drawCircle(r.centerX(), r.centerY(), r.width()*2/5, pain
t); |
142 canvas->restore(); | 141 canvas->restore(); |
143 canvas->translate(r.width() * scales[j].fX + margin, 0); | 142 canvas->translate(r.width() * scales[j].fX + margin, 0); |
144 } | 143 } |
(...skipping 12 matching lines...) Expand all Loading... |
157 SkBitmap fGradientCircle; | 156 SkBitmap fGradientCircle; |
158 typedef GM INHERITED; | 157 typedef GM INHERITED; |
159 }; | 158 }; |
160 | 159 |
161 ////////////////////////////////////////////////////////////////////////////// | 160 ////////////////////////////////////////////////////////////////////////////// |
162 | 161 |
163 static GM* MyFactory(void*) { return new ImageFiltersScaledGM; } | 162 static GM* MyFactory(void*) { return new ImageFiltersScaledGM; } |
164 static GMRegistry reg(MyFactory); | 163 static GMRegistry reg(MyFactory); |
165 | 164 |
166 } | 165 } |
OLD | NEW |