зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1325320 - change SVGGeometryElement::GetOrBuildPath to take DrawTarget as a pointer since all its callers have drawTarget as a pointer themselves.
This is consistent with most other methods that take a drawTarget parameter r=dholbert --HG-- extra : amend_source : 77aa7f7d9cb19f9aa08014fff3b209dc151b75f3
This commit is contained in:
Родитель
9cfc993eff
Коммит
81b5779eda
|
@ -98,11 +98,11 @@ SVGGeometryElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<Path>
|
already_AddRefed<Path>
|
||||||
SVGGeometryElement::GetOrBuildPath(const DrawTarget& aDrawTarget,
|
SVGGeometryElement::GetOrBuildPath(const DrawTarget* aDrawTarget,
|
||||||
FillRule aFillRule)
|
FillRule aFillRule)
|
||||||
{
|
{
|
||||||
// We only cache the path if it matches the backend used for screen painting:
|
// We only cache the path if it matches the backend used for screen painting:
|
||||||
bool cacheable = aDrawTarget.GetBackendType() ==
|
bool cacheable = aDrawTarget->GetBackendType() ==
|
||||||
gfxPlatform::GetPlatform()->GetDefaultContentBackend();
|
gfxPlatform::GetPlatform()->GetDefaultContentBackend();
|
||||||
|
|
||||||
// Checking for and returning mCachedPath before checking the pref means
|
// Checking for and returning mCachedPath before checking the pref means
|
||||||
|
@ -110,11 +110,11 @@ SVGGeometryElement::GetOrBuildPath(const DrawTarget& aDrawTarget,
|
||||||
// chrome). The benefit is that we avoid causing a CPU memory cache miss by
|
// 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.
|
// looking at the global variable that the pref's stored in.
|
||||||
if (cacheable && mCachedPath && mCachedPath->GetFillRule() == aFillRule &&
|
if (cacheable && mCachedPath && mCachedPath->GetFillRule() == aFillRule &&
|
||||||
aDrawTarget.GetBackendType() == mCachedPath->GetBackendType()) {
|
aDrawTarget->GetBackendType() == mCachedPath->GetBackendType()) {
|
||||||
RefPtr<Path> path(mCachedPath);
|
RefPtr<Path> path(mCachedPath);
|
||||||
return path.forget();
|
return path.forget();
|
||||||
}
|
}
|
||||||
RefPtr<PathBuilder> builder = aDrawTarget.CreatePathBuilder(aFillRule);
|
RefPtr<PathBuilder> builder = aDrawTarget->CreatePathBuilder(aFillRule);
|
||||||
RefPtr<Path> path = BuildPath(builder);
|
RefPtr<Path> path = BuildPath(builder);
|
||||||
if (cacheable && NS_SVGPathCachingEnabled()) {
|
if (cacheable && NS_SVGPathCachingEnabled()) {
|
||||||
mCachedPath = path;
|
mCachedPath = path;
|
||||||
|
|
|
@ -174,7 +174,7 @@ public:
|
||||||
* this element. May return nullptr if there is no [valid] path. The path
|
* this element. May return nullptr if there is no [valid] path. The path
|
||||||
* that is created may be cached and returned on subsequent calls.
|
* that is created may be cached and returned on subsequent calls.
|
||||||
*/
|
*/
|
||||||
virtual already_AddRefed<Path> GetOrBuildPath(const DrawTarget& aDrawTarget,
|
virtual already_AddRefed<Path> GetOrBuildPath(const DrawTarget* aDrawTarget,
|
||||||
FillRule fillRule);
|
FillRule fillRule);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -340,7 +340,7 @@ SVGGeometryFrame::GetFrameForPoint(const gfxPoint& aPoint)
|
||||||
// so that we get more consistent/backwards compatible results?
|
// so that we get more consistent/backwards compatible results?
|
||||||
RefPtr<DrawTarget> drawTarget =
|
RefPtr<DrawTarget> drawTarget =
|
||||||
gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget();
|
gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget();
|
||||||
RefPtr<Path> path = content->GetOrBuildPath(*drawTarget, fillRule);
|
RefPtr<Path> path = content->GetOrBuildPath(drawTarget, fillRule);
|
||||||
if (!path) {
|
if (!path) {
|
||||||
return nullptr; // no path, so we don't paint anything that can be hit
|
return nullptr; // no path, so we don't paint anything that can be hit
|
||||||
}
|
}
|
||||||
|
@ -547,7 +547,7 @@ SVGGeometryFrame::GetBBoxContribution(const Matrix &aToBBoxUserspace,
|
||||||
(GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD)
|
(GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD)
|
||||||
? StyleSVG()->mClipRule
|
? StyleSVG()->mClipRule
|
||||||
: StyleSVG()->mFillRule);
|
: StyleSVG()->mFillRule);
|
||||||
RefPtr<Path> pathInUserSpace = element->GetOrBuildPath(*tmpDT, fillRule);
|
RefPtr<Path> pathInUserSpace = element->GetOrBuildPath(tmpDT, fillRule);
|
||||||
if (!pathInUserSpace) {
|
if (!pathInUserSpace) {
|
||||||
return bbox;
|
return bbox;
|
||||||
}
|
}
|
||||||
|
@ -772,7 +772,7 @@ SVGGeometryFrame::Render(gfxContext* aContext,
|
||||||
if (GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD) {
|
if (GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD) {
|
||||||
// We don't complicate this code with GetAsSimplePath since the cost of
|
// We don't complicate this code with GetAsSimplePath since the cost of
|
||||||
// masking will dwarf Path creation overhead anyway.
|
// masking will dwarf Path creation overhead anyway.
|
||||||
RefPtr<Path> path = element->GetOrBuildPath(*drawTarget, fillRule);
|
RefPtr<Path> path = element->GetOrBuildPath(drawTarget, fillRule);
|
||||||
if (path) {
|
if (path) {
|
||||||
ColorPattern white(ToDeviceColor(Color(1.0f, 1.0f, 1.0f, 1.0f)));
|
ColorPattern white(ToDeviceColor(Color(1.0f, 1.0f, 1.0f, 1.0f)));
|
||||||
drawTarget->Fill(path, white,
|
drawTarget->Fill(path, white,
|
||||||
|
@ -786,7 +786,7 @@ SVGGeometryFrame::Render(gfxContext* aContext,
|
||||||
|
|
||||||
element->GetAsSimplePath(&simplePath);
|
element->GetAsSimplePath(&simplePath);
|
||||||
if (!simplePath.IsPath()) {
|
if (!simplePath.IsPath()) {
|
||||||
path = element->GetOrBuildPath(*drawTarget, fillRule);
|
path = element->GetOrBuildPath(drawTarget, fillRule);
|
||||||
if (!path) {
|
if (!path) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -817,7 +817,7 @@ SVGGeometryFrame::Render(gfxContext* aContext,
|
||||||
// A simple Rect can't be transformed with rotate/skew, so let's switch
|
// A simple Rect can't be transformed with rotate/skew, so let's switch
|
||||||
// to using a real path:
|
// to using a real path:
|
||||||
if (!path) {
|
if (!path) {
|
||||||
path = element->GetOrBuildPath(*drawTarget, fillRule);
|
path = element->GetOrBuildPath(drawTarget, fillRule);
|
||||||
if (!path) {
|
if (!path) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ nsSVGClipPathFrame::ApplyClipPath(gfxContext& aContext,
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(IsTrivial(), "Caller needs to use GetClipMask");
|
MOZ_ASSERT(IsTrivial(), "Caller needs to use GetClipMask");
|
||||||
|
|
||||||
DrawTarget& aDrawTarget = *aContext.GetDrawTarget();
|
const DrawTarget* drawTarget = aContext.GetDrawTarget();
|
||||||
|
|
||||||
// No need for AutoReferenceChainGuard since simple clip paths by definition
|
// No need for AutoReferenceChainGuard since simple clip paths by definition
|
||||||
// don't reference another clip path.
|
// don't reference another clip path.
|
||||||
|
@ -68,7 +68,7 @@ nsSVGClipPathFrame::ApplyClipPath(gfxContext& aContext,
|
||||||
aContext.SetMatrixDouble(newMatrix);
|
aContext.SetMatrixDouble(newMatrix);
|
||||||
FillRule clipRule =
|
FillRule clipRule =
|
||||||
nsSVGUtils::ToFillRule(pathFrame->StyleSVG()->mClipRule);
|
nsSVGUtils::ToFillRule(pathFrame->StyleSVG()->mClipRule);
|
||||||
clipPath = pathElement->GetOrBuildPath(aDrawTarget, clipRule);
|
clipPath = pathElement->GetOrBuildPath(drawTarget, clipRule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче