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

Side by Side Diff: src/effects/SkBlurMaskFilter.cpp

Issue 742663002: add roundOut that returns its result (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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 | « src/effects/SkBitmapSource.cpp ('k') | src/effects/SkGpuBlurUtils.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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkBlurMaskFilter.h" 9 #include "SkBlurMaskFilter.h"
10 #include "SkBlurMask.h" 10 #include "SkBlurMask.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 180
181 return SkBlurMask::BlurRRect(sigma, dst, r, fBlurStyle, 181 return SkBlurMask::BlurRRect(sigma, dst, r, fBlurStyle,
182 margin, createMode); 182 margin, createMode);
183 } 183 }
184 184
185 #include "SkCanvas.h" 185 #include "SkCanvas.h"
186 186
187 static bool prepare_to_draw_into_mask(const SkRect& bounds, SkMask* mask) { 187 static bool prepare_to_draw_into_mask(const SkRect& bounds, SkMask* mask) {
188 SkASSERT(mask != NULL); 188 SkASSERT(mask != NULL);
189 189
190 bounds.roundOut(&mask->fBounds); 190 mask->fBounds = bounds.roundOut();
191 mask->fRowBytes = SkAlign4(mask->fBounds.width()); 191 mask->fRowBytes = SkAlign4(mask->fBounds.width());
192 mask->fFormat = SkMask::kA8_Format; 192 mask->fFormat = SkMask::kA8_Format;
193 const size_t size = mask->computeImageSize(); 193 const size_t size = mask->computeImageSize();
194 mask->fImage = SkMask::AllocImage(size); 194 mask->fImage = SkMask::AllocImage(size);
195 if (NULL == mask->fImage) { 195 if (NULL == mask->fImage) {
196 return false; 196 return false;
197 } 197 }
198 198
199 // FIXME: use sk_calloc in AllocImage? 199 // FIXME: use sk_calloc in AllocImage?
200 sk_bzero(mask->fImage, size); 200 sk_bzero(mask->fImage, size);
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 } 353 }
354 354
355 // TODO: take clipBounds into account to limit our coordinates up front 355 // TODO: take clipBounds into account to limit our coordinates up front
356 // for now, just skip too-large src rects (to take the old code path). 356 // for now, just skip too-large src rects (to take the old code path).
357 if (rect_exceeds(rrect.rect(), SkIntToScalar(32767))) { 357 if (rect_exceeds(rrect.rect(), SkIntToScalar(32767))) {
358 return kUnimplemented_FilterReturn; 358 return kUnimplemented_FilterReturn;
359 } 359 }
360 360
361 SkIPoint margin; 361 SkIPoint margin;
362 SkMask srcM, dstM; 362 SkMask srcM, dstM;
363 rrect.rect().roundOut(&srcM.fBounds); 363 srcM.fBounds = rrect.rect().roundOut();
364 srcM.fImage = NULL; 364 srcM.fImage = NULL;
365 srcM.fFormat = SkMask::kA8_Format; 365 srcM.fFormat = SkMask::kA8_Format;
366 srcM.fRowBytes = 0; 366 srcM.fRowBytes = 0;
367 367
368 bool filterResult = false; 368 bool filterResult = false;
369 if (c_analyticBlurRRect) { 369 if (c_analyticBlurRRect) {
370 // special case for fast round rect blur 370 // special case for fast round rect blur
371 // don't actually do the blur the first time, just compute the correct s ize 371 // don't actually do the blur the first time, just compute the correct s ize
372 filterResult = this->filterRRectMask(&dstM, rrect, matrix, &margin, 372 filterResult = this->filterRRectMask(&dstM, rrect, matrix, &margin,
373 SkMask::kJustComputeBounds_CreateMod e); 373 SkMask::kJustComputeBounds_CreateMod e);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 } 469 }
470 470
471 // TODO: take clipBounds into account to limit our coordinates up front 471 // TODO: take clipBounds into account to limit our coordinates up front
472 // for now, just skip too-large src rects (to take the old code path). 472 // for now, just skip too-large src rects (to take the old code path).
473 if (rect_exceeds(rects[0], SkIntToScalar(32767))) { 473 if (rect_exceeds(rects[0], SkIntToScalar(32767))) {
474 return kUnimplemented_FilterReturn; 474 return kUnimplemented_FilterReturn;
475 } 475 }
476 476
477 SkIPoint margin; 477 SkIPoint margin;
478 SkMask srcM, dstM; 478 SkMask srcM, dstM;
479 rects[0].roundOut(&srcM.fBounds); 479 srcM.fBounds = rects[0].roundOut();
480 srcM.fImage = NULL; 480 srcM.fImage = NULL;
481 srcM.fFormat = SkMask::kA8_Format; 481 srcM.fFormat = SkMask::kA8_Format;
482 srcM.fRowBytes = 0; 482 srcM.fRowBytes = 0;
483 483
484 bool filterResult = false; 484 bool filterResult = false;
485 if (count == 1 && c_analyticBlurNinepatch) { 485 if (count == 1 && c_analyticBlurNinepatch) {
486 // special case for fast rect blur 486 // special case for fast rect blur
487 // don't actually do the blur the first time, just compute the correct s ize 487 // don't actually do the blur the first time, just compute the correct s ize
488 filterResult = this->filterRectMask(&dstM, rects[0], matrix, &margin, 488 filterResult = this->filterRectMask(&dstM, rects[0], matrix, &margin,
489 SkMask::kJustComputeBounds_CreateMod e); 489 SkMask::kJustComputeBounds_CreateMod e);
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 } else { 1279 } else {
1280 str->append("None"); 1280 str->append("None");
1281 } 1281 }
1282 str->append("))"); 1282 str->append("))");
1283 } 1283 }
1284 #endif 1284 #endif
1285 1285
1286 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) 1286 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter)
1287 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) 1287 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl)
1288 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 1288 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/effects/SkBitmapSource.cpp ('k') | src/effects/SkGpuBlurUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698