Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Side by Side Diff: gm/imagefiltersscaled.cpp

Issue 1301823005: Reland of Implement canComputeFastBounds() for image filters. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gm/colorfilterimagefilter.cpp ('k') | include/core/SkColorFilter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « gm/colorfilterimagefilter.cpp ('k') | include/core/SkColorFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698