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

Side by Side Diff: gm/imagefiltersscaled.cpp

Issue 1138263002: Revert of stop calling SkScalarDiv (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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/imagefiltersclipped.cpp ('k') | gm/resizeimagefilter.cpp » ('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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 paint.setImageFilter(filters[i]); 127 paint.setImageFilter(filters[i]);
128 paint.setAntiAlias(true); 128 paint.setAntiAlias(true);
129 canvas->save(); 129 canvas->save();
130 canvas->scale(scales[j].fX, scales[j].fY); 130 canvas->scale(scales[j].fX, scales[j].fY);
131 if (5 == i) { 131 if (5 == i) {
132 canvas->translate(SkIntToScalar(-32), 0); 132 canvas->translate(SkIntToScalar(-32), 0);
133 } else if (6 == i) { 133 } else if (6 == i) {
134 canvas->scale(SkScalarInvert(RESIZE_FACTOR), 134 canvas->scale(SkScalarInvert(RESIZE_FACTOR),
135 SkScalarInvert(RESIZE_FACTOR)); 135 SkScalarInvert(RESIZE_FACTOR));
136 } 136 }
137 canvas->drawCircle(r.centerX(), r.centerY(), r.width()*2/5, pain t); 137 canvas->drawCircle(r.centerX(), r.centerY(),
138 SkScalarDiv(r.width()*2, SkIntToScalar(5)), p aint);
138 canvas->restore(); 139 canvas->restore();
139 canvas->translate(r.width() * scales[j].fX + margin, 0); 140 canvas->translate(r.width() * scales[j].fX + margin, 0);
140 } 141 }
141 canvas->restore(); 142 canvas->restore();
142 canvas->translate(0, r.height() * scales[j].fY + margin); 143 canvas->translate(0, r.height() * scales[j].fY + margin);
143 } 144 }
144 145
145 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) { 146 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) {
146 filters[i]->unref(); 147 filters[i]->unref();
147 } 148 }
148 } 149 }
149 150
150 private: 151 private:
151 bool fInitialized; 152 bool fInitialized;
152 SkBitmap fCheckerboard; 153 SkBitmap fCheckerboard;
153 SkBitmap fGradientCircle; 154 SkBitmap fGradientCircle;
154 typedef GM INHERITED; 155 typedef GM INHERITED;
155 }; 156 };
156 157
157 ////////////////////////////////////////////////////////////////////////////// 158 //////////////////////////////////////////////////////////////////////////////
158 159
159 static GM* MyFactory(void*) { return new ImageFiltersScaledGM; } 160 static GM* MyFactory(void*) { return new ImageFiltersScaledGM; }
160 static GMRegistry reg(MyFactory); 161 static GMRegistry reg(MyFactory);
161 162
162 } 163 }
OLDNEW
« no previous file with comments | « gm/imagefiltersclipped.cpp ('k') | gm/resizeimagefilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698