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

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

Issue 708073002: Use size of SkRect as the key for blur mask cache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix fractional rects 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/core/SkMaskCache.cpp ('k') | no next file » | 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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 if (smallR[0].width() < 2 || smallR[0].height() < 2) { 545 if (smallR[0].width() < 2 || smallR[0].height() < 2) {
546 return kUnimplemented_FilterReturn; 546 return kUnimplemented_FilterReturn;
547 } 547 }
548 if (2 == count) { 548 if (2 == count) {
549 smallR[1].set(rects[1].left(), rects[1].top(), 549 smallR[1].set(rects[1].left(), rects[1].top(),
550 rects[1].right() - dx, rects[1].bottom() - dy); 550 rects[1].right() - dx, rects[1].bottom() - dy);
551 SkASSERT(!smallR[1].isEmpty()); 551 SkASSERT(!smallR[1].isEmpty());
552 } 552 }
553 553
554 const SkScalar sigma = this->computeXformedSigma(matrix); 554 const SkScalar sigma = this->computeXformedSigma(matrix);
555 if (!find_cached_rects(&patch->fMask, sigma, fBlurStyle, this->getQuality(), rects, count)) { 555 if (!find_cached_rects(&patch->fMask, sigma, fBlurStyle, this->getQuality(), smallR, count)) {
556 if (count > 1 || !c_analyticBlurNinepatch) { 556 if (count > 1 || !c_analyticBlurNinepatch) {
557 if (!draw_rects_into_mask(smallR, count, &srcM)) { 557 if (!draw_rects_into_mask(smallR, count, &srcM)) {
558 return kFalse_FilterReturn; 558 return kFalse_FilterReturn;
559 } 559 }
560 560
561 SkAutoMaskFreeImage amf(srcM.fImage); 561 SkAutoMaskFreeImage amf(srcM.fImage);
562 562
563 if (!this->filterMask(&patch->fMask, srcM, matrix, &margin)) { 563 if (!this->filterMask(&patch->fMask, srcM, matrix, &margin)) {
564 return kFalse_FilterReturn; 564 return kFalse_FilterReturn;
565 } 565 }
566 } else { 566 } else {
567 if (!this->filterRectMask(&patch->fMask, smallR[0], matrix, &margin, 567 if (!this->filterRectMask(&patch->fMask, smallR[0], matrix, &margin,
568 SkMask::kComputeBoundsAndRenderImage_Creat eMode)) { 568 SkMask::kComputeBoundsAndRenderImage_Creat eMode)) {
569 return kFalse_FilterReturn; 569 return kFalse_FilterReturn;
570 } 570 }
571 } 571 }
572 add_cached_rects(patch->fMask, sigma, fBlurStyle, this->getQuality(), re cts, count); 572 add_cached_rects(patch->fMask, sigma, fBlurStyle, this->getQuality(), sm allR, count);
573 } 573 }
574 patch->fMask.fBounds.offsetTo(0, 0); 574 patch->fMask.fBounds.offsetTo(0, 0);
575 patch->fOuterRect = dstM.fBounds; 575 patch->fOuterRect = dstM.fBounds;
576 patch->fCenter = center; 576 patch->fCenter = center;
577 return kTrue_FilterReturn; 577 return kTrue_FilterReturn;
578 } 578 }
579 579
580 void SkBlurMaskFilterImpl::computeFastBounds(const SkRect& src, 580 void SkBlurMaskFilterImpl::computeFastBounds(const SkRect& src,
581 SkRect* dst) const { 581 SkRect* dst) const {
582 SkScalar pad = 3.0f * fSigma; 582 SkScalar pad = 3.0f * fSigma;
(...skipping 696 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/core/SkMaskCache.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698