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

Unified Diff: src/core/SkMaskCache.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/effects/SkBlurMaskFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkMaskCache.cpp
diff --git a/src/core/SkMaskCache.cpp b/src/core/SkMaskCache.cpp
index e203081655a9fe0ef082884248176888d7126df1..b4b8b4faf359e18957c6a3b2998ee0c8bb39bb36 100644
--- a/src/core/SkMaskCache.cpp
+++ b/src/core/SkMaskCache.cpp
@@ -104,19 +104,27 @@ public:
, fQuality(quality)
{
SkASSERT(1 == count || 2 == count);
- fRects[0] = SkRect::MakeEmpty();
- fRects[1] = SkRect::MakeEmpty();
+ SkIRect ir;
+ rects[0].roundOut(&ir);
+ fSizes[0] = SkSize::Make(0, 0);
+ fSizes[1] = SkSize::Make(0, 0);
+ fSizes[2] = SkSize::Make(0, 0);
+ fSizes[3] = SkSize::Make(rects[0].x() - ir.x(), rects[0].y() - ir.y());
for (int i = 0; i < count; i++) {
- fRects[i] = rects[i];
+ fSizes[i] = SkSize::Make(rects[i].width(), rects[i].height());
}
+ if (2 == count) {
+ fSizes[2] = SkSize::Make(rects[0].x() - rects[1].x(), rects[0].y() - rects[1].y());
+ }
+
this->init(&gRectsBlurKeyNamespaceLabel,
- sizeof(fSigma) + sizeof(fStyle) + sizeof(fQuality) + sizeof(fRects));
+ sizeof(fSigma) + sizeof(fStyle) + sizeof(fQuality) + sizeof(fSizes));
}
SkScalar fSigma;
int32_t fStyle;
int32_t fQuality;
- SkRect fRects[2];
+ SkSize fSizes[4];
};
struct RectsBlurRec : public SkResourceCache::Rec {
« no previous file with comments | « no previous file | src/effects/SkBlurMaskFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698