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

Unified Diff: src/core/SkMaskFilter.cpp

Issue 471473002: Optimize CSS box-shadow performance (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: based on SkBitmapCache Created 6 years, 4 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 a2adc7c327555d9054b24063b6e698e8c54d52e8..f920386369e742775a2022c84dbcbc526b07e5c7 100644
--- a/src/core/SkMaskFilter.cpp
+++ b/src/core/SkMaskFilter.cpp
@@ -8,6 +8,7 @@
#include "SkMaskFilter.h"
+#include "SkBitmapCache.h"
#include "SkBlitter.h"
#include "SkDraw.h"
#include "SkRasterClip.h"
@@ -211,15 +212,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.fCachedMask.fMask.fImage = NULL;
if (kTrue_FilterReturn != this->filterRRectToNine(devRRect, matrix,
clip.getBounds(),
&patch)) {
- SkASSERT(NULL == patch.fMask.fImage);
+ SkASSERT(NULL == patch.fCachedMask.fMask.fImage);
return false;
}
- draw_nine(patch.fMask, patch.fOuterRect, patch.fCenter, true, clip, blitter);
- SkMask::FreeImage(patch.fMask.fImage);
+ draw_nine(patch.fCachedMask.fMask, patch.fOuterRect, patch.fCenter, true, clip, blitter);
+ SkBitmapCache::Unlock(
+ static_cast<SkBitmapCache::ID*>(patch.fCachedMask.fCacheId));
return true;
}
@@ -234,21 +236,22 @@ bool SkMaskFilter::filterPath(const SkPath& devPath, const SkMatrix& matrix,
if (rectCount > 0) {
NinePatch patch;
- patch.fMask.fImage = NULL;
+ patch.fCachedMask.fMask.fImage = NULL;
switch (this->filterRectsToNine(rects, rectCount, matrix,
clip.getBounds(), &patch)) {
case kFalse_FilterReturn:
- SkASSERT(NULL == patch.fMask.fImage);
+ SkASSERT(NULL == patch.fCachedMask.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.fCachedMask.fMask, patch.fOuterRect, patch.fCenter,
+ 1 == rectCount, clip, blitter);
+ SkBitmapCache::Unlock(
+ static_cast<SkBitmapCache::ID*>(patch.fCachedMask.fCacheId));
return true;
case kUnimplemented_FilterReturn:
- SkASSERT(NULL == patch.fMask.fImage);
+ SkASSERT(NULL == patch.fCachedMask.fMask.fImage);
// fall through
break;
}

Powered by Google App Engine
This is Rietveld 408576698