From fdee1bb8805c558e485332d53a966cc91c47f174 Mon Sep 17 00:00:00 2001 From: Bas Schouten Date: Wed, 4 Feb 2015 22:03:21 +0100 Subject: [PATCH] Bug 1083245: Pop all clips before copying to the destination blending surface. r=jrmuizel We need to pop the clips from the decide context before flushing and copying to the destination blending surface, otherwise drawing commands executed on a pushed layer for clipping will not be realized on the destination surface for blending. Note that this fixes most situation, but in the case of doing custom blending to an area of a surface which is not opaque while having a complex clip pushed this will still lead to some artifacts. I haven't seen this be a problem in practice though. --- gfx/2d/DrawTargetD2D1.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gfx/2d/DrawTargetD2D1.cpp b/gfx/2d/DrawTargetD2D1.cpp index e21c58fbe071..00bb0b34d5bc 100644 --- a/gfx/2d/DrawTargetD2D1.cpp +++ b/gfx/2d/DrawTargetD2D1.cpp @@ -968,6 +968,8 @@ DrawTargetD2D1::FinalizeDrawing(CompositionOp aOp, const Pattern &aPattern) mDC->CreateBitmap(D2DIntSize(mSize), D2D1::BitmapProperties(D2DPixelFormat(mFormat)), byRef(tmpBitmap)); // This flush is important since the copy method will not know about the context drawing to the surface. + // We also need to pop all the clips to make sure any drawn content will have made it to the final bitmap. + PopAllClips(); mDC->Flush(); // We need to use a copy here because affects don't accept a surface on @@ -978,6 +980,9 @@ DrawTargetD2D1::FinalizeDrawing(CompositionOp aOp, const Pattern &aPattern) mBlendEffect->SetInput(1, mTempBitmap); mBlendEffect->SetValue(D2D1_BLEND_PROP_MODE, D2DBlendMode(aOp)); + PushClipsToDC(mDC); + mClipsArePushed = true; + mDC->DrawImage(mBlendEffect, D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR, D2D1_COMPOSITE_MODE_BOUNDED_SOURCE_COPY); return; }