зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
76c4df4bd0
Коммит
258222aaaf
|
@ -5463,12 +5463,12 @@ CanvasRenderingContext2D::DrawDirectlyToCanvas(
|
||||||
uint32_t modifiedFlags = aImage.mDrawingFlags | imgIContainer::FLAG_CLAMP;
|
uint32_t modifiedFlags = aImage.mDrawingFlags | imgIContainer::FLAG_CLAMP;
|
||||||
|
|
||||||
CSSIntSize sz(scaledImageSize.width, scaledImageSize.height); // XXX hmm is scaledImageSize really in CSS pixels?
|
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->
|
auto result = aImage.mImgContainer->
|
||||||
Draw(context, scaledImageSize,
|
Draw(context, scaledImageSize,
|
||||||
ImageRegion::Create(gfxRect(aSrc.x, aSrc.y, aSrc.width, aSrc.height)),
|
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) {
|
if (result != DrawResult::SUCCESS) {
|
||||||
NS_WARNING("imgIContainer::Draw failed");
|
NS_WARNING("imgIContainer::Draw failed");
|
||||||
|
|
|
@ -793,7 +793,7 @@ struct SVGDrawingParameters
|
||||||
, viewportSize(aSize)
|
, viewportSize(aSize)
|
||||||
, animationTime(aAnimationTime)
|
, animationTime(aAnimationTime)
|
||||||
, flags(aFlags)
|
, flags(aFlags)
|
||||||
, opacity(aSVGContext ? aSVGContext->GetGlobalOpacity() : aOpacity)
|
, opacity(aOpacity)
|
||||||
{
|
{
|
||||||
if (aSVGContext) {
|
if (aSVGContext) {
|
||||||
auto sz = aSVGContext->GetViewportSize();
|
auto sz = aSVGContext->GetViewportSize();
|
||||||
|
|
|
@ -24,8 +24,7 @@ class SVGImageContext
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SVGImageContext()
|
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.
|
* the SVG image in question is being painted for an SVG <image> element.
|
||||||
*/
|
*/
|
||||||
explicit SVGImageContext(const Maybe<CSSIntSize>& aViewportSize,
|
explicit SVGImageContext(const Maybe<CSSIntSize>& aViewportSize,
|
||||||
const Maybe<SVGPreserveAspectRatio>& aPreserveAspectRatio = Nothing(),
|
const Maybe<SVGPreserveAspectRatio>& aPreserveAspectRatio = Nothing(),
|
||||||
gfxFloat aOpacity = 1.0,
|
|
||||||
bool aIsPaintingSVGImageElement = false)
|
bool aIsPaintingSVGImageElement = false)
|
||||||
: mViewportSize(aViewportSize)
|
: mViewportSize(aViewportSize)
|
||||||
, mPreserveAspectRatio(aPreserveAspectRatio)
|
, mPreserveAspectRatio(aPreserveAspectRatio)
|
||||||
, mGlobalOpacity(aOpacity)
|
|
||||||
, mIsPaintingSVGImageElement(aIsPaintingSVGImageElement)
|
, mIsPaintingSVGImageElement(aIsPaintingSVGImageElement)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
@ -77,10 +74,6 @@ public:
|
||||||
mPreserveAspectRatio = aPAR;
|
mPreserveAspectRatio = aPAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxFloat GetGlobalOpacity() const {
|
|
||||||
return mGlobalOpacity;
|
|
||||||
}
|
|
||||||
|
|
||||||
const SVGEmbeddingContextPaint* GetContextPaint() const {
|
const SVGEmbeddingContextPaint* GetContextPaint() const {
|
||||||
return mContextPaint.get();
|
return mContextPaint.get();
|
||||||
}
|
}
|
||||||
|
@ -100,7 +93,6 @@ public:
|
||||||
return contextPaintIsEqual &&
|
return contextPaintIsEqual &&
|
||||||
mViewportSize == aOther.mViewportSize &&
|
mViewportSize == aOther.mViewportSize &&
|
||||||
mPreserveAspectRatio == aOther.mPreserveAspectRatio &&
|
mPreserveAspectRatio == aOther.mPreserveAspectRatio &&
|
||||||
mGlobalOpacity == aOther.mGlobalOpacity &&
|
|
||||||
mIsPaintingSVGImageElement == aOther.mIsPaintingSVGImageElement;
|
mIsPaintingSVGImageElement == aOther.mIsPaintingSVGImageElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +108,6 @@ public:
|
||||||
return HashGeneric(hash,
|
return HashGeneric(hash,
|
||||||
mViewportSize.map(HashSize).valueOr(0),
|
mViewportSize.map(HashSize).valueOr(0),
|
||||||
mPreserveAspectRatio.map(HashPAR).valueOr(0),
|
mPreserveAspectRatio.map(HashPAR).valueOr(0),
|
||||||
HashBytes(&mGlobalOpacity, sizeof(mGlobalOpacity)),
|
|
||||||
mIsPaintingSVGImageElement);
|
mIsPaintingSVGImageElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +123,6 @@ private:
|
||||||
RefPtr<SVGEmbeddingContextPaint> mContextPaint;
|
RefPtr<SVGEmbeddingContextPaint> mContextPaint;
|
||||||
Maybe<CSSIntSize> mViewportSize;
|
Maybe<CSSIntSize> mViewportSize;
|
||||||
Maybe<SVGPreserveAspectRatio> mPreserveAspectRatio;
|
Maybe<SVGPreserveAspectRatio> mPreserveAspectRatio;
|
||||||
gfxFloat mGlobalOpacity;
|
|
||||||
bool mIsPaintingSVGImageElement;
|
bool mIsPaintingSVGImageElement;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -407,7 +407,7 @@ nsSVGImageFrame::PaintSVG(gfxContext& aContext,
|
||||||
const Maybe<SVGImageContext> context(
|
const Maybe<SVGImageContext> context(
|
||||||
Some(SVGImageContext(Some(CSSIntSize::Truncate(width, height)),
|
Some(SVGImageContext(Some(CSSIntSize::Truncate(width, height)),
|
||||||
Some(imgElem->mPreserveAspectRatio.GetAnimValue()),
|
Some(imgElem->mPreserveAspectRatio.GetAnimValue()),
|
||||||
1.0, /* aIsPaintingSVGImageElement */ true)));
|
/* aIsPaintingSVGImageElement */ true)));
|
||||||
|
|
||||||
// For the actual draw operation to draw crisply (and at the right size),
|
// 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*.
|
// our destination rect needs to be |width|x|height|, *in dev pixels*.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче