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

Side by Side Diff: gm/blurrect.cpp

Issue 1539553002: Add default ctor to SkMask (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add warning for ignored return values Created 5 years 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 | « bench/BlurRectBench.cpp ('k') | include/core/SkMask.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 2012 Google Inc. 2 * Copyright 2012 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 SkRect r; 192 SkRect r;
193 r.setWH(SkIntToScalar(width), SkIntToScalar(height)); 193 r.setWH(SkIntToScalar(width), SkIntToScalar(height));
194 SkAutoCanvasRestore autoRestore(canvas, true); 194 SkAutoCanvasRestore autoRestore(canvas, true);
195 195
196 for (size_t j = 0 ; j < SK_ARRAY_COUNT(radii) ; j++) { 196 for (size_t j = 0 ; j < SK_ARRAY_COUNT(radii) ; j++) {
197 float radius = radii[j]; 197 float radius = radii[j];
198 for (size_t k = 0 ; k < SK_ARRAY_COUNT(styles) ; k++) { 198 for (size_t k = 0 ; k < SK_ARRAY_COUNT(styles) ; k++) {
199 SkBlurStyle style = styles[k]; 199 SkBlurStyle style = styles[k];
200 200
201 SkMask mask; 201 SkMask mask;
202 SkBlurMask::BlurRect(SkBlurMask::ConvertRadiusToSigma(radius ), &mask, r, style); 202 if (!SkBlurMask::BlurRect(SkBlurMask::ConvertRadiusToSigma(r adius),
203 &mask, r, style)) {
204 continue;
205 }
203 206
204 SkAutoMaskFreeImage amfi(mask.fImage); 207 SkAutoMaskFreeImage amfi(mask.fImage);
205 208
206 SkBitmap bm; 209 SkBitmap bm;
207 bm.installMaskPixels(mask); 210 bm.installMaskPixels(mask);
208 211
209 if (cur_x + bm.width() >= fGMWidth - fMargin) { 212 if (cur_x + bm.width() >= fGMWidth - fMargin) {
210 cur_x = 0; 213 cur_x = 0;
211 cur_y += max_height + fPadding; 214 cur_y += max_height + fPadding;
212 max_height = 0; 215 max_height = 0;
213 } 216 }
214 217
215 canvas->save(); 218 canvas->save();
216 canvas->translate((SkScalar)cur_x, (SkScalar)cur_y); 219 canvas->translate((SkScalar)cur_x, (SkScalar)cur_y);
217 canvas->translate(-(bm.width() - r.width())/2, -(bm.height() -r.height())/2); 220 canvas->translate(-(bm.width() - r.width())/2, -(bm.height() -r.height())/2);
218 canvas->drawBitmap(bm, 0.f, 0.f, nullptr); 221 canvas->drawBitmap(bm, 0.f, 0.f, nullptr);
219 canvas->restore(); 222 canvas->restore();
220 223
221 cur_x += bm.width() + fPadding; 224 cur_x += bm.width() + fPadding;
222 if (bm.height() > max_height) 225 if (bm.height() > max_height)
223 max_height = bm.height(); 226 max_height = bm.height();
224 } 227 }
225 } 228 }
226 } 229 }
227 } 230 }
228 231
229 ////////////////////////////////////////////////////////////////////////////// 232 //////////////////////////////////////////////////////////////////////////////
230 233
231 DEF_GM(return new BlurRectGM("blurrects", 0xFF);) 234 DEF_GM(return new BlurRectGM("blurrects", 0xFF);)
OLDNEW
« no previous file with comments | « bench/BlurRectBench.cpp ('k') | include/core/SkMask.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698