Bug 1346618 - Part 1. Remove SVGImageContext::mGlobalOpacity. r=mstange

MozReview-Commit-ID: ByiPa4sreEh

--HG--
extra : rebase_source : eda6104c00cbc7ebe7b9a5ddc9e2abc73fbc37df
extra : source : df69799726bdccc5a25d6190c0fe22645e264ab7
This commit is contained in:
cku 2017-04-15 02:01:22 +08:00
Родитель 76c4df4bd0
Коммит 258222aaaf
4 изменённых файлов: 6 добавлений и 16 удалений

Просмотреть файл

@ -5463,12 +5463,12 @@ CanvasRenderingContext2D::DrawDirectlyToCanvas(
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);
SVGImageContext svgContext(Some(sz));
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");

Просмотреть файл

@ -793,7 +793,7 @@ struct SVGDrawingParameters
, viewportSize(aSize)
, animationTime(aAnimationTime)
, flags(aFlags)
, opacity(aSVGContext ? aSVGContext->GetGlobalOpacity() : aOpacity)
, opacity(aOpacity)
{
if (aSVGContext) {
auto sz = aSVGContext->GetViewportSize();

Просмотреть файл

@ -24,8 +24,7 @@ class SVGImageContext
{
public:
SVGImageContext()
: mGlobalOpacity(1.0)
, mIsPaintingSVGImageElement(false)
: mIsPaintingSVGImageElement(false)
{ }
/**
@ -48,12 +47,10 @@ public:
* the SVG image in question is being painted for an SVG <image> element.
*/
explicit SVGImageContext(const Maybe<CSSIntSize>& aViewportSize,
const Maybe<SVGPreserveAspectRatio>& aPreserveAspectRatio = Nothing(),
gfxFloat aOpacity = 1.0,
const Maybe<SVGPreserveAspectRatio>& aPreserveAspectRatio = Nothing(),
bool aIsPaintingSVGImageElement = false)
: mViewportSize(aViewportSize)
, mPreserveAspectRatio(aPreserveAspectRatio)
, mGlobalOpacity(aOpacity)
, mIsPaintingSVGImageElement(aIsPaintingSVGImageElement)
{ }
@ -77,10 +74,6 @@ public:
mPreserveAspectRatio = aPAR;
}
gfxFloat GetGlobalOpacity() const {
return mGlobalOpacity;
}
const SVGEmbeddingContextPaint* GetContextPaint() const {
return mContextPaint.get();
}
@ -100,7 +93,6 @@ public:
return contextPaintIsEqual &&
mViewportSize == aOther.mViewportSize &&
mPreserveAspectRatio == aOther.mPreserveAspectRatio &&
mGlobalOpacity == aOther.mGlobalOpacity &&
mIsPaintingSVGImageElement == aOther.mIsPaintingSVGImageElement;
}
@ -116,7 +108,6 @@ public:
return HashGeneric(hash,
mViewportSize.map(HashSize).valueOr(0),
mPreserveAspectRatio.map(HashPAR).valueOr(0),
HashBytes(&mGlobalOpacity, sizeof(mGlobalOpacity)),
mIsPaintingSVGImageElement);
}
@ -132,7 +123,6 @@ private:
RefPtr<SVGEmbeddingContextPaint> mContextPaint;
Maybe<CSSIntSize> mViewportSize;
Maybe<SVGPreserveAspectRatio> mPreserveAspectRatio;
gfxFloat mGlobalOpacity;
bool mIsPaintingSVGImageElement;
};

Просмотреть файл

@ -407,7 +407,7 @@ nsSVGImageFrame::PaintSVG(gfxContext& aContext,
const Maybe<SVGImageContext> context(
Some(SVGImageContext(Some(CSSIntSize::Truncate(width, height)),
Some(imgElem->mPreserveAspectRatio.GetAnimValue()),
1.0, /* aIsPaintingSVGImageElement */ true)));
/* aIsPaintingSVGImageElement */ true)));
// For the actual draw operation to draw crisply (and at the right size),
// our destination rect needs to be |width|x|height|, *in dev pixels*.