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

Unified Diff: src/core/SkMaskFilter.cpp

Issue 286273002: Optimize CSS box-shadow performance by caching the SkMask of the blur effect. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase with latest skia in git instead of svn trunk Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: src/core/SkMaskFilter.cpp
diff --git a/src/core/SkMaskFilter.cpp b/src/core/SkMaskFilter.cpp
index 2ab2843641a03580e698023af9b4ae05219178fb..6f9007d7d28a75e515bae5de84d0c5e4f3990351 100644
--- a/src/core/SkMaskFilter.cpp
+++ b/src/core/SkMaskFilter.cpp
@@ -211,15 +211,16 @@ bool SkMaskFilter::filterRRect(const SkRRect& devRRect, const SkMatrix& matrix,
// cannot be used, return false to allow our caller to recover and perform
// the drawing another way.
NinePatch patch;
- patch.fMask.fImage = NULL;
+ patch.fDiscardableMemoryMask.fMask.fImage = NULL;
if (kTrue_FilterReturn != this->filterRRectToNine(devRRect, matrix,
clip.getBounds(),
&patch)) {
- SkASSERT(NULL == patch.fMask.fImage);
+ SkASSERT(NULL == patch.fDiscardableMemoryMask.fMask.fImage);
return false;
}
- draw_nine(patch.fMask, patch.fOuterRect, patch.fCenter, true, clip, blitter);
- SkMask::FreeImage(patch.fMask.fImage);
+ draw_nine(patch.fDiscardableMemoryMask.fMask, patch.fOuterRect, patch.fCenter, true, clip, blitter);
+ SkScaledImageCache::Unlock(
reed1 2014/06/09 14:55:34 Who set fCacheId before this Unlock call?
+ static_cast<SkScaledImageCache::ID*>(patch.fDiscardableMemoryMask.fCacheId));
return true;
}
@@ -234,21 +235,22 @@ bool SkMaskFilter::filterPath(const SkPath& devPath, const SkMatrix& matrix,
if (rectCount > 0) {
NinePatch patch;
- patch.fMask.fImage = NULL;
+ patch.fDiscardableMemoryMask.fMask.fImage = NULL;
switch (this->filterRectsToNine(rects, rectCount, matrix,
clip.getBounds(), &patch)) {
case kFalse_FilterReturn:
- SkASSERT(NULL == patch.fMask.fImage);
+ SkASSERT(NULL == patch.fDiscardableMemoryMask.fMask.fImage);
return false;
case kTrue_FilterReturn:
- draw_nine(patch.fMask, patch.fOuterRect, patch.fCenter, 1 == rectCount, clip,
- blitter);
- SkMask::FreeImage(patch.fMask.fImage);
+ draw_nine(patch.fDiscardableMemoryMask.fMask, patch.fOuterRect, patch.fCenter,
+ 1 == rectCount, clip, blitter);
+ SkScaledImageCache::Unlock(
+ static_cast<SkScaledImageCache::ID*>(patch.fDiscardableMemoryMask.fCacheId));
return true;
case kUnimplemented_FilterReturn:
- SkASSERT(NULL == patch.fMask.fImage);
+ SkASSERT(NULL == patch.fDiscardableMemoryMask.fMask.fImage);
// fall through
break;
}

Powered by Google App Engine
This is Rietveld 408576698