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

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

Issue 248613004: Fast path for blurred round rects -- blur a small 9patch rect on the CPU (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: merge fully with Mike's new reorg" Created 6 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 | « src/effects/SkBlurMask.h ('k') | src/effects/SkBlurMaskFilter.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 9
10 #include "SkBlurMask.h" 10 #include "SkBlurMask.h"
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 468
469 /////////////////////////////////////////////////////////////////////////////// 469 ///////////////////////////////////////////////////////////////////////////////
470 470
471 // we use a local function to wrap the class static method to work around 471 // we use a local function to wrap the class static method to work around
472 // a bug in gcc98 472 // a bug in gcc98
473 void SkMask_FreeImage(uint8_t* image); 473 void SkMask_FreeImage(uint8_t* image);
474 void SkMask_FreeImage(uint8_t* image) { 474 void SkMask_FreeImage(uint8_t* image) {
475 SkMask::FreeImage(image); 475 SkMask::FreeImage(image);
476 } 476 }
477 477
478 bool SkBlurMask::BoxBlur(SkMask* dst, const SkMask& src, SkScalar sigma, SkBlurS tyle style, 478 bool SkBlurMask::BoxBlur(SkMask* dst, const SkMask& src,
479 SkBlurQuality quality, SkIPoint* margin) { 479 SkScalar sigma, SkBlurStyle style, SkBlurQuality qualit y,
480 SkIPoint* margin, bool force_quality) {
481
480 if (src.fFormat != SkMask::kA8_Format) { 482 if (src.fFormat != SkMask::kA8_Format) {
481 return false; 483 return false;
482 } 484 }
483 485
484 // Force high quality off for small radii (performance) 486 // Force high quality off for small radii (performance)
485 if (sigma <= SkIntToScalar(2)) { 487 if (!force_quality && sigma <= SkIntToScalar(2)) {
486 quality = kLow_SkBlurQuality; 488 quality = kLow_SkBlurQuality;
487 } 489 }
488 490
489 SkScalar passRadius; 491 SkScalar passRadius;
490 if (kHigh_SkBlurQuality == quality) { 492 if (kHigh_SkBlurQuality == quality) {
491 // For the high quality path the 3 pass box blur kernel width is 493 // For the high quality path the 3 pass box blur kernel width is
492 // 6*rad+1 while the full Gaussian width is 6*sigma. 494 // 6*rad+1 while the full Gaussian width is 6*sigma.
493 passRadius = sigma - (1/6.0f); 495 passRadius = sigma - (1/6.0f);
494 } else { 496 } else {
495 // For the low quality path we only attempt to cover 3*sigma of the 497 // For the low quality path we only attempt to cover 3*sigma of the
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 (void)autoCall.detach(); 983 (void)autoCall.detach();
982 } 984 }
983 985
984 if (style == kInner_SkBlurStyle) { 986 if (style == kInner_SkBlurStyle) {
985 dst->fBounds = src.fBounds; // restore trimmed bounds 987 dst->fBounds = src.fBounds; // restore trimmed bounds
986 dst->fRowBytes = src.fRowBytes; 988 dst->fRowBytes = src.fRowBytes;
987 } 989 }
988 990
989 return true; 991 return true;
990 } 992 }
OLDNEW
« no previous file with comments | « src/effects/SkBlurMask.h ('k') | src/effects/SkBlurMaskFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698