Bug 1382534 - Only reuse the cached path in SVGGeometryElement::GetOrBuildPath() if it has the fill rule we want. r=longsonr
MozReview-Commit-ID: 7G99pnifbTv
--- a/dom/svg/SVGGeometryElement.cpp
+++ b/dom/svg/SVGGeometryElement.cpp
@@ -101,21 +101,20 @@ SVGGeometryElement::GetOrBuildPath(const
// We only cache the path if it matches the backend used for screen painting:
bool cacheable = aDrawTarget.GetBackendType() ==
gfxPlatform::GetPlatform()->GetDefaultContentBackend();
// Checking for and returning mCachedPath before checking the pref means
// that the pref is only live on page reload (or app restart for SVG in
// chrome). The benefit is that we avoid causing a CPU memory cache miss by
// looking at the global variable that the pref's stored in.
- if (cacheable && mCachedPath) {
- if (aDrawTarget.GetBackendType() == mCachedPath->GetBackendType()) {
- RefPtr<Path> path(mCachedPath);
- return path.forget();
- }
+ if (cacheable && mCachedPath && mCachedPath->GetFillRule() == aFillRule &&
+ aDrawTarget.GetBackendType() == mCachedPath->GetBackendType()) {
+ RefPtr<Path> path(mCachedPath);
+ return path.forget();
}
RefPtr<PathBuilder> builder = aDrawTarget.CreatePathBuilder(aFillRule);
RefPtr<Path> path = BuildPath(builder);
if (cacheable && NS_SVGPathCachingEnabled()) {
mCachedPath = path;
}
return path.forget();
}