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

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: Created 6 years, 8 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
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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, 478 bool SkBlurMask::BoxBlur(SkMask* dst, const SkMask& src,
479 SkScalar sigma, Style style, Quality quality, 479 SkScalar sigma, Style style, Quality quality,
480 SkIPoint* margin) { 480 SkIPoint* margin, bool force_quality) {
481 481
482 if (src.fFormat != SkMask::kA8_Format) { 482 if (src.fFormat != SkMask::kA8_Format) {
483 return false; 483 return false;
484 } 484 }
485 485
486 // Force high quality off for small radii (performance) 486 // Force high quality off for small radii (performance)
487 if (sigma <= SkIntToScalar(2)) { 487 if (!force_quality && sigma <= SkIntToScalar(2)) {
488 quality = kLow_Quality; 488 quality = kLow_Quality;
489 } 489 }
490 490
491 SkScalar passRadius; 491 SkScalar passRadius;
492 if (kHigh_Quality == quality) { 492 if (kHigh_Quality == quality) {
493 // 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
494 // 6*rad+1 while the full Gaussian width is 6*sigma. 494 // 6*rad+1 while the full Gaussian width is 6*sigma.
495 passRadius = sigma - (1/6.0f); 495 passRadius = sigma - (1/6.0f);
496 } else { 496 } else {
497 // 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
983 (void)autoCall.detach(); 983 (void)autoCall.detach();
984 } 984 }
985 985
986 if (style == kInner_Style) { 986 if (style == kInner_Style) {
987 dst->fBounds = src.fBounds; // restore trimmed bounds 987 dst->fBounds = src.fBounds; // restore trimmed bounds
988 dst->fRowBytes = src.fRowBytes; 988 dst->fRowBytes = src.fRowBytes;
989 } 989 }
990 990
991 return true; 991 return true;
992 } 992 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698