Bug 1323912 - Part 2. Pass opacity down to imgIContainer::Draw. r=mstange

Each concrete class of imgIContainer is able to handle opacity already. All we
need to do is pass opacity value to them.

MozReview-Commit-ID: EMkLnG3YXA1

--HG--
extra : rebase_source : 080a843b34cc1ca27831310d474243b4066f59f2
This commit is contained in:
cku 2017-01-03 13:53:22 +08:00
parent e36c492419
commit adab9bea9f
20 changed files with 128 additions and 73 deletions

View File

@ -5100,7 +5100,7 @@ CanvasRenderingContext2D::DrawDirectlyToCanvas(
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);
aImage.mWhichFrame, SamplingFilter::GOOD, Some(svgContext), modifiedFlags, 1.0);
if (result != DrawResult::SUCCESS) {
NS_WARNING("imgIContainer::Draw failed");

View File

@ -98,13 +98,15 @@ public:
const nsIntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aWhichFrame,
uint32_t aFlags)
uint32_t aFlags,
float aOpacity)
: mImage(aImage)
, mSize(aSize)
, mSVGContext(aSVGContext)
, mWhichFrame(aWhichFrame)
, mFlags(aFlags)
, mDrawResult(DrawResult::NOT_READY)
, mOpacity(aOpacity)
{
MOZ_ASSERT(mImage, "Must have an image to clip");
}
@ -122,7 +124,8 @@ public:
// arguments that guarantee we never tile.
mDrawResult =
mImage->DrawSingleTile(aContext, mSize, ImageRegion::Create(aFillRect),
mWhichFrame, aSamplingFilter, mSVGContext, mFlags);
mWhichFrame, aSamplingFilter, mSVGContext, mFlags,
mOpacity);
return true;
}
@ -136,6 +139,7 @@ private:
const uint32_t mWhichFrame;
const uint32_t mFlags;
DrawResult mDrawResult;
float mOpacity;
};
ClippedImage::ClippedImage(Image* aImage,
@ -258,7 +262,7 @@ ClippedImage::GetFrame(uint32_t aWhichFrame,
{
DrawResult result;
RefPtr<SourceSurface> surface;
Tie(result, surface) = GetFrameInternal(mClip.Size(), Nothing(), aWhichFrame, aFlags);
Tie(result, surface) = GetFrameInternal(mClip.Size(), Nothing(), aWhichFrame, aFlags, 1.0);
return surface.forget();
}
@ -276,7 +280,8 @@ Pair<DrawResult, RefPtr<SourceSurface>>
ClippedImage::GetFrameInternal(const nsIntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aWhichFrame,
uint32_t aFlags)
uint32_t aFlags,
float aOpacity)
{
if (!ShouldClip()) {
RefPtr<SourceSurface> surface = InnerImage()->GetFrame(aWhichFrame, aFlags);
@ -302,7 +307,8 @@ ClippedImage::GetFrameInternal(const nsIntSize& aSize,
// Create our callback.
RefPtr<DrawSingleTileCallback> drawTileCallback =
new DrawSingleTileCallback(this, aSize, aSVGContext, aWhichFrame, aFlags);
new DrawSingleTileCallback(this, aSize, aSVGContext, aWhichFrame, aFlags,
aOpacity);
RefPtr<gfxDrawable> drawable =
new gfxCallbackDrawable(drawTileCallback, aSize);
@ -371,11 +377,12 @@ ClippedImage::Draw(gfxContext* aContext,
uint32_t aWhichFrame,
SamplingFilter aSamplingFilter,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags)
uint32_t aFlags,
float aOpacity)
{
if (!ShouldClip()) {
return InnerImage()->Draw(aContext, aSize, aRegion, aWhichFrame,
aSamplingFilter, aSVGContext, aFlags);
aSamplingFilter, aSVGContext, aFlags, aOpacity);
}
// Check for tiling. If we need to tile then we need to create a
@ -386,7 +393,7 @@ ClippedImage::Draw(gfxContext* aContext,
DrawResult result;
RefPtr<SourceSurface> surface;
Tie(result, surface) =
GetFrameInternal(aSize, aSVGContext, aWhichFrame, aFlags);
GetFrameInternal(aSize, aSVGContext, aWhichFrame, aFlags, aOpacity);
if (!surface) {
MOZ_ASSERT(result != DrawResult::SUCCESS);
return result;
@ -398,13 +405,14 @@ ClippedImage::Draw(gfxContext* aContext,
// Draw.
gfxUtils::DrawPixelSnapped(aContext, drawable, aSize, aRegion,
SurfaceFormat::B8G8R8A8, aSamplingFilter);
SurfaceFormat::B8G8R8A8, aSamplingFilter,
aOpacity);
return result;
}
return DrawSingleTile(aContext, aSize, aRegion, aWhichFrame,
aSamplingFilter, aSVGContext, aFlags);
aSamplingFilter, aSVGContext, aFlags, aOpacity);
}
DrawResult
@ -414,7 +422,8 @@ ClippedImage::DrawSingleTile(gfxContext* aContext,
uint32_t aWhichFrame,
SamplingFilter aSamplingFilter,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags)
uint32_t aFlags,
float aOpacity)
{
MOZ_ASSERT(!MustCreateSurface(aContext, aSize, aRegion, aFlags),
"Shouldn't need to create a surface");
@ -470,7 +479,7 @@ ClippedImage::DrawSingleTile(gfxContext* aContext,
return InnerImage()->Draw(aContext, size, region,
aWhichFrame, aSamplingFilter,
aSVGContext.map(unclipViewport),
aFlags);
aFlags, aOpacity);
}
NS_IMETHODIMP

View File

@ -53,7 +53,8 @@ public:
uint32_t aWhichFrame,
gfx::SamplingFilter aSamplingFilter,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags) override;
uint32_t aFlags,
float aOpacity) override;
NS_IMETHOD RequestDiscard() override;
NS_IMETHOD_(Orientation) GetOrientation() override;
NS_IMETHOD_(nsIntRect) GetImageSpaceInvalidationRect(const nsIntRect& aRect)
@ -74,7 +75,8 @@ private:
GetFrameInternal(const nsIntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aWhichFrame,
uint32_t aFlags);
uint32_t aFlags,
float aOpacity);
bool ShouldClip();
DrawResult DrawSingleTile(gfxContext* aContext,
const nsIntSize& aSize,
@ -82,7 +84,8 @@ private:
uint32_t aWhichFrame,
gfx::SamplingFilter aSamplingFilter,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags);
uint32_t aFlags,
float aOpacity);
// If we are forced to draw a temporary surface, we cache it here.
UniquePtr<ClippedImageCachedSurface> mCachedSurface;

View File

@ -189,7 +189,8 @@ DynamicImage::GetFrameAtSize(const IntSize& aSize,
MOZ_ASSERT(context); // already checked the draw target above
auto result = Draw(context, aSize, ImageRegion::Create(aSize),
aWhichFrame, SamplingFilter::POINT, Nothing(), aFlags);
aWhichFrame, SamplingFilter::POINT, Nothing(), aFlags,
1.0);
return result == DrawResult::SUCCESS ? dt->Snapshot() : nullptr;
}
@ -219,7 +220,8 @@ DynamicImage::Draw(gfxContext* aContext,
uint32_t aWhichFrame,
SamplingFilter aSamplingFilter,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags)
uint32_t aFlags,
float aOpacity)
{
MOZ_ASSERT(!aSize.IsEmpty(), "Unexpected empty size");
@ -227,7 +229,8 @@ DynamicImage::Draw(gfxContext* aContext,
if (aSize == drawableSize) {
gfxUtils::DrawPixelSnapped(aContext, mDrawable, drawableSize, aRegion,
SurfaceFormat::B8G8R8A8, aSamplingFilter);
SurfaceFormat::B8G8R8A8, aSamplingFilter,
aOpacity);
return DrawResult::SUCCESS;
}
@ -241,7 +244,8 @@ DynamicImage::Draw(gfxContext* aContext,
aContext->Multiply(gfxMatrix::Scaling(scale.width, scale.height));
gfxUtils::DrawPixelSnapped(aContext, mDrawable, drawableSize, region,
SurfaceFormat::B8G8R8A8, aSamplingFilter);
SurfaceFormat::B8G8R8A8, aSamplingFilter,
aOpacity);
return DrawResult::SUCCESS;
}

View File

@ -78,10 +78,11 @@ FrozenImage::Draw(gfxContext* aContext,
uint32_t /* aWhichFrame - ignored */,
SamplingFilter aSamplingFilter,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags)
uint32_t aFlags,
float aOpacity)
{
return InnerImage()->Draw(aContext, aSize, aRegion, FRAME_FIRST,
aSamplingFilter, aSVGContext, aFlags);
aSamplingFilter, aSVGContext, aFlags, aOpacity);
}
NS_IMETHODIMP_(void)

View File

@ -52,7 +52,8 @@ public:
uint32_t aWhichFrame,
gfx::SamplingFilter aSamplingFilter,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags) override;
uint32_t aFlags,
float aOpacity) override;
NS_IMETHOD_(void) RequestRefresh(const TimeStamp& aTime) override;
NS_IMETHOD GetAnimationMode(uint16_t* aAnimationMode) override;
NS_IMETHOD SetAnimationMode(uint16_t aAnimationMode) override;

View File

@ -209,10 +209,11 @@ ImageWrapper::Draw(gfxContext* aContext,
uint32_t aWhichFrame,
SamplingFilter aSamplingFilter,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags)
uint32_t aFlags,
float aOpacity)
{
return mInnerImage->Draw(aContext, aSize, aRegion, aWhichFrame,
aSamplingFilter, aSVGContext, aFlags);
aSamplingFilter, aSVGContext, aFlags, aOpacity);
}
NS_IMETHODIMP

View File

@ -263,12 +263,13 @@ OrientedImage::Draw(gfxContext* aContext,
uint32_t aWhichFrame,
SamplingFilter aSamplingFilter,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags)
uint32_t aFlags,
float aOpacity)
{
if (mOrientation.IsIdentity()) {
return InnerImage()->Draw(aContext, aSize, aRegion,
aWhichFrame, aSamplingFilter,
aSVGContext, aFlags);
aSVGContext, aFlags, aOpacity);
}
// Update the image size to match the image's coordinate system. (This could
@ -300,8 +301,10 @@ OrientedImage::Draw(gfxContext* aContext,
aOldContext.GetPreserveAspectRatio());
};
return InnerImage()->Draw(aContext, size, region, aWhichFrame, aSamplingFilter,
aSVGContext.map(orientViewport), aFlags);
return InnerImage()->Draw(aContext, size, region, aWhichFrame,
aSamplingFilter,
aSVGContext.map(orientViewport), aFlags,
aOpacity);
}
nsIntSize

View File

@ -49,7 +49,8 @@ public:
uint32_t aWhichFrame,
gfx::SamplingFilter aSamplingFilter,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags) override;
uint32_t aFlags,
float aOpacity) override;
NS_IMETHOD_(nsIntRect) GetImageSpaceInvalidationRect(
const nsIntRect& aRect) override;
nsIntSize OptimalImageSizeForDest(const gfxSize& aDest,

View File

@ -1311,7 +1311,8 @@ RasterImage::DrawInternal(DrawableSurface&& aSurface,
const IntSize& aSize,
const ImageRegion& aRegion,
SamplingFilter aSamplingFilter,
uint32_t aFlags)
uint32_t aFlags,
float aOpacity)
{
gfxContextMatrixAutoSaveRestore saveMatrix(aContext);
ImageRegion region(aRegion);
@ -1330,7 +1331,7 @@ RasterImage::DrawInternal(DrawableSurface&& aSurface,
couldRedecodeForBetterFrame = CanDownscaleDuringDecode(aSize, aFlags);
}
if (!aSurface->Draw(aContext, region, aSamplingFilter, aFlags)) {
if (!aSurface->Draw(aContext, region, aSamplingFilter, aFlags, aOpacity)) {
RecoverFromInvalidFrames(aSize, aFlags);
return DrawResult::TEMPORARY_ERROR;
}
@ -1351,7 +1352,8 @@ RasterImage::Draw(gfxContext* aContext,
uint32_t aWhichFrame,
SamplingFilter aSamplingFilter,
const Maybe<SVGImageContext>& /*aSVGContext - ignored*/,
uint32_t aFlags)
uint32_t aFlags,
float aOpacity)
{
if (aWhichFrame > FRAME_MAX_VALUE) {
return DrawResult::BAD_ARGS;
@ -1397,7 +1399,7 @@ RasterImage::Draw(gfxContext* aContext,
surface->IsFinished();
auto result = DrawInternal(Move(surface), aContext, aSize,
aRegion, aSamplingFilter, flags);
aRegion, aSamplingFilter, flags, aOpacity);
if (shouldRecordTelemetry) {
TimeDuration drawLatency = TimeStamp::Now() - mDrawStartTime;

View File

@ -302,7 +302,8 @@ private:
const nsIntSize& aSize,
const ImageRegion& aRegion,
gfx::SamplingFilter aSamplingFilter,
uint32_t aFlags);
uint32_t aFlags,
float aOpacity);
Pair<DrawResult, RefPtr<gfx::SourceSurface>>
GetFrameInternal(const gfx::IntSize& aSize,

View File

@ -750,7 +750,8 @@ VectorImage::GetFrameAtSize(const IntSize& aSize,
MOZ_ASSERT(context); // already checked the draw target above
auto result = Draw(context, aSize, ImageRegion::Create(aSize),
aWhichFrame, SamplingFilter::POINT, Nothing(), aFlags);
aWhichFrame, SamplingFilter::POINT, Nothing(), aFlags,
1.0);
return result == DrawResult::SUCCESS ? dt->Snapshot() : nullptr;
}
@ -776,7 +777,8 @@ struct SVGDrawingParameters
SamplingFilter aSamplingFilter,
const Maybe<SVGImageContext>& aSVGContext,
float aAnimationTime,
uint32_t aFlags)
uint32_t aFlags,
float aOpacity)
: context(aContext)
, size(aSize.width, aSize.height)
, region(aRegion)
@ -785,7 +787,7 @@ struct SVGDrawingParameters
, viewportSize(aSize)
, animationTime(aAnimationTime)
, flags(aFlags)
, opacity(aSVGContext ? aSVGContext->GetGlobalOpacity() : 1.0)
, opacity(aSVGContext ? aSVGContext->GetGlobalOpacity() : aOpacity)
{
if (aSVGContext) {
CSSIntSize sz = aSVGContext->GetViewportSize();
@ -812,7 +814,8 @@ VectorImage::Draw(gfxContext* aContext,
uint32_t aWhichFrame,
SamplingFilter aSamplingFilter,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags)
uint32_t aFlags,
float aOpacity)
{
if (aWhichFrame > FRAME_MAX_VALUE) {
return DrawResult::BAD_ARGS;
@ -867,7 +870,7 @@ VectorImage::Draw(gfxContext* aContext,
SVGDrawingParameters params(aContext, aSize, aRegion, aSamplingFilter,
svgContext, animTime, aFlags);
svgContext, animTime, aFlags, aOpacity);
// If we have an prerasterized version of this image that matches the
// drawing parameters, use that.

View File

@ -539,7 +539,8 @@ imgFrame::SurfaceForDrawing(bool aDoPartialDecode,
}
bool imgFrame::Draw(gfxContext* aContext, const ImageRegion& aRegion,
SamplingFilter aSamplingFilter, uint32_t aImageFlags)
SamplingFilter aSamplingFilter, uint32_t aImageFlags,
float aOpacity)
{
PROFILER_LABEL("imgFrame", "Draw",
js::ProfileEntry::Category::GRAPHICS);
@ -581,7 +582,7 @@ bool imgFrame::Draw(gfxContext* aContext, const ImageRegion& aRegion,
if (surfaceResult.IsValid()) {
gfxUtils::DrawPixelSnapped(aContext, surfaceResult.mDrawable,
imageRect.Size(), region, surfaceResult.mFormat,
aSamplingFilter, aImageFlags);
aSamplingFilter, aImageFlags, aOpacity);
}
return true;
}

View File

@ -257,7 +257,8 @@ public:
void SetRawAccessOnly();
bool Draw(gfxContext* aContext, const ImageRegion& aRegion,
SamplingFilter aSamplingFilter, uint32_t aImageFlags);
SamplingFilter aSamplingFilter, uint32_t aImageFlags,
float aOpacity);
nsresult ImageUpdated(const nsIntRect& aUpdateRect);

View File

@ -407,7 +407,8 @@ interface imgIContainer : nsISupports
in uint32_t aWhichFrame,
in SamplingFilter aSamplingFilter,
[const] in MaybeSVGImageContext aSVGContext,
in uint32_t aFlags);
in uint32_t aFlags,
in float aOpacity);
/*
* Ensures that an image is decoding. Calling this function guarantees that

View File

@ -6462,7 +6462,8 @@ DrawImageInternal(gfxContext& aContext,
const nsRect& aDirty,
const SVGImageContext* aSVGContext,
uint32_t aImageFlags,
ExtendMode aExtendMode = ExtendMode::CLAMP)
ExtendMode aExtendMode = ExtendMode::CLAMP,
float aOpacity = 1.0)
{
DrawResult result = DrawResult::SUCCESS;
@ -6503,7 +6504,7 @@ DrawImageInternal(gfxContext& aContext,
result = aImage->Draw(destCtx, params.size, params.region,
imgIContainer::FRAME_CURRENT, aSamplingFilter,
svgContext, aImageFlags);
svgContext, aImageFlags, aOpacity);
}
@ -6675,7 +6676,8 @@ nsLayoutUtils::DrawBackgroundImage(gfxContext& aContext,
const nsPoint& aAnchor,
const nsRect& aDirty,
uint32_t aImageFlags,
ExtendMode aExtendMode)
ExtendMode aExtendMode,
float aOpacity)
{
PROFILER_LABEL("layout", "nsLayoutUtils::DrawBackgroundImage",
js::ProfileEntry::Category::GRAPHICS);
@ -6686,7 +6688,8 @@ nsLayoutUtils::DrawBackgroundImage(gfxContext& aContext,
if (aRepeatSize.width == aDest.width && aRepeatSize.height == aDest.height) {
return DrawImageInternal(aContext, aPresContext, aImage,
aSamplingFilter, aDest, aFill, aAnchor,
aDirty, &svgContext, aImageFlags, aExtendMode);
aDirty, &svgContext, aImageFlags, aExtendMode,
aOpacity);
}
nsPoint firstTilePos = aDest.TopLeft() +
@ -6697,7 +6700,8 @@ nsLayoutUtils::DrawBackgroundImage(gfxContext& aContext,
nsRect dest(i, j, aDest.width, aDest.height);
DrawResult result = DrawImageInternal(aContext, aPresContext, aImage, aSamplingFilter,
dest, dest, aAnchor, aDirty, &svgContext,
aImageFlags, ExtendMode::CLAMP);
aImageFlags, ExtendMode::CLAMP,
aOpacity);
if (result != DrawResult::SUCCESS) {
return result;
}
@ -6716,11 +6720,13 @@ nsLayoutUtils::DrawImage(gfxContext& aContext,
const nsRect& aFill,
const nsPoint& aAnchor,
const nsRect& aDirty,
uint32_t aImageFlags)
uint32_t aImageFlags,
float aOpacity)
{
return DrawImageInternal(aContext, aPresContext, aImage,
aSamplingFilter, aDest, aFill, aAnchor,
aDirty, nullptr, aImageFlags);
aDirty, nullptr, aImageFlags, ExtendMode::CLAMP,
aOpacity);
}
/* static */ nsRect

View File

@ -1765,7 +1765,8 @@ public:
const nsPoint& aAnchor,
const nsRect& aDirty,
uint32_t aImageFlags,
ExtendMode aExtendMode);
ExtendMode aExtendMode,
float aOpacity);
/**
* Draw an image.
@ -1790,7 +1791,8 @@ public:
const nsRect& aFill,
const nsPoint& aAnchor,
const nsRect& aDirty,
uint32_t aImageFlags);
uint32_t aImageFlags,
float aOpacity = 1.0);
static inline void InitDashPattern(StrokeOptions& aStrokeOptions,
uint8_t aBorderStyle) {

View File

@ -1778,12 +1778,14 @@ nsCSSRendering::PaintBGParams::ForAllLayers(nsPresContext& aPresCtx,
const nsRect& aDirtyRect,
const nsRect& aBorderArea,
nsIFrame *aFrame,
uint32_t aPaintFlags)
uint32_t aPaintFlags,
float aOpacity)
{
MOZ_ASSERT(aFrame);
PaintBGParams result(aPresCtx, aRenderingCtx, aDirtyRect, aBorderArea, aFrame,
aPaintFlags, -1, CompositionOp::OP_OVER);
PaintBGParams result(aPresCtx, aRenderingCtx, aDirtyRect, aBorderArea,
aFrame, aPaintFlags, -1, CompositionOp::OP_OVER,
aOpacity);
return result;
}
@ -1797,12 +1799,14 @@ nsCSSRendering::PaintBGParams::ForSingleLayer(nsPresContext& aPresCtx,
nsIFrame *aFrame,
uint32_t aPaintFlags,
int32_t aLayer,
CompositionOp aCompositionOp)
CompositionOp aCompositionOp,
float aOpacity)
{
MOZ_ASSERT(aFrame && (aLayer != -1));
PaintBGParams result(aPresCtx, aRenderingCtx, aDirtyRect, aBorderArea, aFrame,
aPaintFlags, aLayer, aCompositionOp);
PaintBGParams result(aPresCtx, aRenderingCtx, aDirtyRect, aBorderArea,
aFrame, aPaintFlags, aLayer, aCompositionOp,
aOpacity);
return result;
}
@ -3453,7 +3457,7 @@ nsCSSRendering::PaintStyleImageLayerWithSC(const PaintBGParams& aParams,
state.mDestArea, state.mFillArea,
state.mAnchor + paintBorderArea.TopLeft(),
clipState.mDirtyRect,
state.mRepeatSize);
state.mRepeatSize, aParams.opacity);
if (co != CompositionOp::OP_OVER) {
ctx->SetOp(CompositionOp::OP_OVER);
@ -5645,7 +5649,8 @@ nsImageRenderer::Draw(nsPresContext* aPresContext,
const nsRect& aFill,
const nsPoint& aAnchor,
const nsSize& aRepeatSize,
const CSSIntRect& aSrc)
const CSSIntRect& aSrc,
float aOpacity)
{
if (!IsReady()) {
NS_NOTREACHED("Ensure PrepareImage() has returned true before calling me");
@ -5696,7 +5701,7 @@ nsImageRenderer::Draw(nsPresContext* aPresContext,
aDest, aFill, aRepeatSize,
aAnchor, aDirtyRect,
ConvertImageRendererToDrawFlags(mFlags),
mExtendMode);
mExtendMode, aOpacity);
break;
}
case eStyleImageType_Gradient:
@ -5720,7 +5725,8 @@ nsImageRenderer::Draw(nsPresContext* aPresContext,
nsLayoutUtils::DrawImage(*ctx,
aPresContext, image,
samplingFilter, aDest, aFill, aAnchor, aDirtyRect,
ConvertImageRendererToDrawFlags(mFlags));
ConvertImageRendererToDrawFlags(mFlags),
aOpacity);
break;
}
case eStyleImageType_Null:
@ -5792,7 +5798,8 @@ nsImageRenderer::DrawLayer(nsPresContext* aPresContext,
const nsRect& aFill,
const nsPoint& aAnchor,
const nsRect& aDirty,
const nsSize& aRepeatSize)
const nsSize& aRepeatSize,
float aOpacity)
{
if (!IsReady()) {
NS_NOTREACHED("Ensure PrepareImage() has returned true before calling me");
@ -5807,7 +5814,8 @@ nsImageRenderer::DrawLayer(nsPresContext* aPresContext,
aDirty, aDest, aFill, aAnchor, aRepeatSize,
CSSIntRect(0, 0,
nsPresContext::AppUnitsToIntCSSPixels(mSize.width),
nsPresContext::AppUnitsToIntCSSPixels(mSize.height)));
nsPresContext::AppUnitsToIntCSSPixels(mSize.height)),
aOpacity);
}
/**
@ -6000,7 +6008,7 @@ nsImageRenderer::DrawBorderImageComponent(nsPresContext* aPresContext,
tile, fillRect, repeatSize,
tile.TopLeft(), aDirtyRect,
drawFlags,
ExtendMode::CLAMP);
ExtendMode::CLAMP, 1.0);
}
nsSize repeatSize(aFill.Size());

View File

@ -219,7 +219,8 @@ public:
const nsRect& aFill,
const nsPoint& aAnchor,
const nsRect& aDirty,
const nsSize& aRepeatSize);
const nsSize& aRepeatSize,
float aOpacity);
/**
* Draw the image to a single component of a border-image style rendering.
@ -281,7 +282,8 @@ private:
const nsRect& aFill,
const nsPoint& aAnchor,
const nsSize& aRepeatSize,
const mozilla::CSSIntRect& aSrc);
const mozilla::CSSIntRect& aSrc,
float aOpacity = 1.0);
/**
* Helper method for creating a gfxDrawable from mPaintServerFrame or
@ -634,13 +636,15 @@ struct nsCSSRendering {
// value means painting one specific
// layer only.
CompositionOp compositionOp;
float opacity;
static PaintBGParams ForAllLayers(nsPresContext& aPresCtx,
nsRenderingContext& aRenderingCtx,
const nsRect& aDirtyRect,
const nsRect& aBorderArea,
nsIFrame *aFrame,
uint32_t aPaintFlags);
uint32_t aPaintFlags,
float aOpacity = 1.0);
static PaintBGParams ForSingleLayer(nsPresContext& aPresCtx,
nsRenderingContext& aRenderingCtx,
const nsRect& aDirtyRect,
@ -648,7 +652,8 @@ struct nsCSSRendering {
nsIFrame *aFrame,
uint32_t aPaintFlags,
int32_t aLayer,
CompositionOp aCompositionOp = CompositionOp::OP_OVER);
CompositionOp aCompositionOp = CompositionOp::OP_OVER,
float aOpacity = 1.0);
private:
PaintBGParams(nsPresContext& aPresCtx,
@ -658,7 +663,8 @@ struct nsCSSRendering {
nsIFrame* aFrame,
uint32_t aPaintFlags,
int32_t aLayer,
CompositionOp aCompositionOp)
CompositionOp aCompositionOp,
float aOpacity)
: presCtx(aPresCtx),
renderingCtx(aRenderingCtx),
dirtyRect(aDirtyRect),
@ -666,7 +672,8 @@ struct nsCSSRendering {
frame(aFrame),
paintFlags(aPaintFlags),
layer(aLayer),
compositionOp(aCompositionOp) {}
compositionOp(aCompositionOp),
opacity(aOpacity) {}
};
static DrawResult PaintStyleImageLayer(const PaintBGParams& aParams);

View File

@ -757,7 +757,7 @@ nsBaseDragService::DrawDragForImage(nsPresContext* aPresContext,
imgContainer->Draw(ctx, destSize, ImageRegion::Create(destSize),
imgIContainer::FRAME_CURRENT,
SamplingFilter::GOOD, /* no SVGImageContext */ Nothing(),
imgIContainer::FLAG_SYNC_DECODE);
imgIContainer::FLAG_SYNC_DECODE, 1.0);
if (res == DrawResult::BAD_IMAGE || res == DrawResult::BAD_ARGS) {
return NS_ERROR_FAILURE;
}