Backed out changeset 2b7b7ea014d8 (bug 1223736)

--HG--
extra : rebase_source : 39d8455a2a72359cedd605839233f9619aac241e
This commit is contained in:
Carsten "Tomcat" Book 2016-03-18 09:58:21 +01:00
parent 4d06a30807
commit b8b88ab9fb

View File

@ -397,25 +397,6 @@ RoundOut(Rect r)
return IntRect(r.x, r.y, r.width, r.height);
}
static void
SetupMask(const EffectChain& aEffectChain,
DrawTarget* aDest,
const IntPoint& aOffset,
RefPtr<SourceSurface>& aMaskSurface,
Matrix& aMaskTransform)
{
if (aEffectChain.mSecondaryEffects[EffectTypes::MASK]) {
EffectMask *effectMask = static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EffectTypes::MASK].get());
aMaskSurface = effectMask->mMaskTexture->AsSourceBasic()->GetSurface(aDest);
if (!aMaskSurface) {
gfxWarning() << "Invalid sourceMask effect";
}
MOZ_ASSERT(effectMask->mMaskTransform.Is2D(), "How did we end up with a 3D transform here?!");
aMaskTransform = effectMask->mMaskTransform.As2D();
aMaskTransform.PostTranslate(-aOffset.x, -aOffset.y);
}
}
void
BasicCompositor::DrawQuad(const gfx::Rect& aRect,
const gfx::Rect& aClipRect,
@ -461,8 +442,7 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect,
// When we apply the 3D transformation, we do it against a temporary
// surface, so undo the coordinate offset.
new3DTransform = aTransform;
new3DTransform.PreTranslate(aRect.x, aRect.y, 0);
new3DTransform = Matrix4x4::Translation(aRect.x, aRect.y, 0) * aTransform;
}
buffer->PushClipRect(aClipRect);
@ -472,8 +452,16 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect,
RefPtr<SourceSurface> sourceMask;
Matrix maskTransform;
if (aTransform.Is2D()) {
SetupMask(aEffectChain, dest, offset, sourceMask, maskTransform);
if (aEffectChain.mSecondaryEffects[EffectTypes::MASK]) {
EffectMask *effectMask = static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EffectTypes::MASK].get());
sourceMask = effectMask->mMaskTexture->AsSourceBasic()->GetSurface(dest);
if (!sourceMask) {
gfxWarning() << "Invalid sourceMask effect";
}
MOZ_ASSERT(effectMask->mMaskTransform.Is2D(), "How did we end up with a 3D transform here?!");
MOZ_ASSERT(!effectMask->mIs3D);
maskTransform = effectMask->mMaskTransform.As2D();
maskTransform.PostTranslate(-offset.x, -offset.y);
}
CompositionOp blendMode = CompositionOp::OP_OVER;
@ -580,40 +568,8 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect,
Transform(temp, source, new3DTransform, transformBounds.TopLeft());
SetupMask(aEffectChain, buffer, offset, sourceMask, maskTransform);
// Adjust for the fact that our content now start at 0,0 instead
// of the top left of transformBounds.
transformBounds.MoveTo(0, 0);
maskTransform.PostTranslate(-transformBounds.x, -transformBounds.y);
if (sourceMask) {
// Transform the source by it's normal transform, and then the inverse
// of the mask transform so that it's in the mask's untransformed
// coordinate space.
Matrix old = buffer->GetTransform();
Matrix sourceTransform = old;
Matrix inverseMask = maskTransform;
inverseMask.Invert();
sourceTransform *= inverseMask;
SurfacePattern source(temp, ExtendMode::CLAMP, sourceTransform);
buffer->PushClipRect(transformBounds);
// Mask in the untransformed coordinate space, and then transform
// by the mask transform to put the result back into destination
// coords.
buffer->SetTransform(maskTransform);
buffer->MaskSurface(source, sourceMask, Point(0, 0));
buffer->SetTransform(old);
buffer->PopClip();
} else {
buffer->DrawSurface(temp, transformBounds, transformBounds);
}
buffer->DrawSurface(temp, transformBounds, transformBounds);
}
buffer->PopClip();