Bug 1276923. BasicCompositor: Properly transform the clip. r=mstange

We push the clip on the buffer while it has the original transform, and
then we overwrite the transform with something else. But the fast path
operates in device space and ignores the existing clip on the buffer, so
we need to know the original clip at the original transform.
This commit is contained in:
Jeff Muizelaar 2016-06-03 14:34:30 -04:00
parent 2c68379e9b
commit 1c35e2ccda

View File

@ -285,10 +285,10 @@ AttemptVideoScale(TextureSourceBasic* aSource, const SourceSurface* aSourceMask,
gfx::Float aOpacity, CompositionOp aBlendMode,
const TexturedEffect* aTexturedEffect,
const Matrix& aNewTransform, const gfx::Rect& aRect,
const gfx::IntRect& aClipRect,
const gfx::Rect& aClipRect,
DrawTarget* aDest, const DrawTarget* aBuffer)
{
if (true || !mozilla::supports_ssse3())
if (!mozilla::supports_ssse3())
return false;
if (aNewTransform.IsTranslation()) // unscaled painting should take the regular path
return false;
@ -305,6 +305,10 @@ AttemptVideoScale(TextureSourceBasic* aSource, const SourceSurface* aSourceMask,
if (!aNewTransform.TransformBounds(aRect).ToIntRect(&dstRect))
return false;
IntRect clipRect;
if (!aClipRect.ToIntRect(&clipRect))
return false;
if (!(aTexturedEffect->mTextureCoords == Rect(0.0f, 0.0f, 1.0f, 1.0f)))
return false;
if (aDest->GetFormat() == SurfaceFormat::R5G6B5_UINT16)
@ -320,7 +324,7 @@ AttemptVideoScale(TextureSourceBasic* aSource, const SourceSurface* aSourceMask,
IntRect fillRect = dstRect;
if (aDest == aBuffer) {
// we need to clip fillRect because LockBits ignores the clip on the aDest
fillRect = fillRect.Intersect(aClipRect);
fillRect = fillRect.Intersect(clipRect);
}
fillRect = fillRect.Intersect(IntRect(IntPoint(0, 0), aDest->GetSize()));
@ -391,6 +395,10 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect,
new3DTransform.PreTranslate(aRect.x, aRect.y, 0);
}
// XXX the transform is probably just an integer offset so this whole
// business here is a bit silly.
Rect transformedClipRect = buffer->GetTransform().TransformBounds(Rect(aClipRect));
buffer->PushClipRect(Rect(aClipRect));
newTransform.PostTranslate(-offset.x, -offset.y);
@ -435,7 +443,7 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect,
if (source->mFromYCBCR &&
AttemptVideoScale(source, sourceMask, aOpacity, blendMode,
texturedEffect,
newTransform, aRect, aClipRect - offset,
newTransform, aRect, transformedClipRect,
dest, buffer)) {
// we succeeded in scaling
} else {