Bug 1346618 - Part 2. Remove SVGImageContext::GetGlobalOpacity.
SVGDrawingParameters is the only user of SVGImageContext::GetGlobalOpacity and
we actually can also get opacity from aOpacity param in SVGDrawingParameters's
constructor. Remove this function since it seem not be necessary.
MozReview-Commit-ID: LTN91sRtz5x
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -5106,17 +5106,17 @@ CanvasRenderingContext2D::DrawDirectlyTo
uint32_t modifiedFlags = aImage.mDrawingFlags | imgIContainer::FLAG_CLAMP;
CSSIntSize sz(scaledImageSize.width, scaledImageSize.height); // XXX hmm is scaledImageSize really in CSS pixels?
SVGImageContext svgContext(Some(sz), Nothing(), CurrentState().globalAlpha);
auto result = aImage.mImgContainer->
Draw(context, scaledImageSize,
ImageRegion::Create(gfxRect(aSrc.x, aSrc.y, aSrc.width, aSrc.height)),
- aImage.mWhichFrame, SamplingFilter::GOOD, Some(svgContext), modifiedFlags, 1.0);
+ aImage.mWhichFrame, SamplingFilter::GOOD, Some(svgContext), modifiedFlags, CurrentState().globalAlpha);
if (result != DrawResult::SUCCESS) {
NS_WARNING("imgIContainer::Draw failed");
}
}
void
CanvasRenderingContext2D::SetGlobalCompositeOperation(const nsAString& aOp,
--- a/image/VectorImage.cpp
+++ b/image/VectorImage.cpp
@@ -781,17 +781,17 @@ struct SVGDrawingParameters
: context(aContext)
, size(aSize.width, aSize.height)
, region(aRegion)
, samplingFilter(aSamplingFilter)
, svgContext(aSVGContext)
, viewportSize(aSize)
, animationTime(aAnimationTime)
, flags(aFlags)
- , opacity(aSVGContext ? aSVGContext->GetGlobalOpacity() : aOpacity)
+ , opacity(aOpacity)
{
if (aSVGContext) {
auto sz = aSVGContext->GetViewportSize();
if (sz) {
viewportSize = nsIntSize(sz->width, sz->height); // XXX losing unit
}
}
}
--- a/layout/svg/SVGImageContext.h
+++ b/layout/svg/SVGImageContext.h
@@ -70,20 +70,16 @@ public:
const Maybe<SVGPreserveAspectRatio>& GetPreserveAspectRatio() const {
return mPreserveAspectRatio;
}
void SetPreserveAspectRatio(const Maybe<SVGPreserveAspectRatio>& aPAR) {
mPreserveAspectRatio = aPAR;
}
- gfxFloat GetGlobalOpacity() const {
- return mGlobalOpacity;
- }
-
const SVGContextPaint* GetContextPaint() const {
return mContextPaint.get();
}
bool IsPaintingForSVGImageElement() const {
return mIsPaintingSVGImageElement;
}