mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 12:50:09 +00:00
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:
parent
2c68379e9b
commit
1c35e2ccda
@ -285,10 +285,10 @@ AttemptVideoScale(TextureSourceBasic* aSource, const SourceSurface* aSourceMask,
|
|||||||
gfx::Float aOpacity, CompositionOp aBlendMode,
|
gfx::Float aOpacity, CompositionOp aBlendMode,
|
||||||
const TexturedEffect* aTexturedEffect,
|
const TexturedEffect* aTexturedEffect,
|
||||||
const Matrix& aNewTransform, const gfx::Rect& aRect,
|
const Matrix& aNewTransform, const gfx::Rect& aRect,
|
||||||
const gfx::IntRect& aClipRect,
|
const gfx::Rect& aClipRect,
|
||||||
DrawTarget* aDest, const DrawTarget* aBuffer)
|
DrawTarget* aDest, const DrawTarget* aBuffer)
|
||||||
{
|
{
|
||||||
if (true || !mozilla::supports_ssse3())
|
if (!mozilla::supports_ssse3())
|
||||||
return false;
|
return false;
|
||||||
if (aNewTransform.IsTranslation()) // unscaled painting should take the regular path
|
if (aNewTransform.IsTranslation()) // unscaled painting should take the regular path
|
||||||
return false;
|
return false;
|
||||||
@ -305,6 +305,10 @@ AttemptVideoScale(TextureSourceBasic* aSource, const SourceSurface* aSourceMask,
|
|||||||
if (!aNewTransform.TransformBounds(aRect).ToIntRect(&dstRect))
|
if (!aNewTransform.TransformBounds(aRect).ToIntRect(&dstRect))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
IntRect clipRect;
|
||||||
|
if (!aClipRect.ToIntRect(&clipRect))
|
||||||
|
return false;
|
||||||
|
|
||||||
if (!(aTexturedEffect->mTextureCoords == Rect(0.0f, 0.0f, 1.0f, 1.0f)))
|
if (!(aTexturedEffect->mTextureCoords == Rect(0.0f, 0.0f, 1.0f, 1.0f)))
|
||||||
return false;
|
return false;
|
||||||
if (aDest->GetFormat() == SurfaceFormat::R5G6B5_UINT16)
|
if (aDest->GetFormat() == SurfaceFormat::R5G6B5_UINT16)
|
||||||
@ -320,7 +324,7 @@ AttemptVideoScale(TextureSourceBasic* aSource, const SourceSurface* aSourceMask,
|
|||||||
IntRect fillRect = dstRect;
|
IntRect fillRect = dstRect;
|
||||||
if (aDest == aBuffer) {
|
if (aDest == aBuffer) {
|
||||||
// we need to clip fillRect because LockBits ignores the clip on the aDest
|
// 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()));
|
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);
|
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));
|
buffer->PushClipRect(Rect(aClipRect));
|
||||||
|
|
||||||
newTransform.PostTranslate(-offset.x, -offset.y);
|
newTransform.PostTranslate(-offset.x, -offset.y);
|
||||||
@ -435,7 +443,7 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect,
|
|||||||
if (source->mFromYCBCR &&
|
if (source->mFromYCBCR &&
|
||||||
AttemptVideoScale(source, sourceMask, aOpacity, blendMode,
|
AttemptVideoScale(source, sourceMask, aOpacity, blendMode,
|
||||||
texturedEffect,
|
texturedEffect,
|
||||||
newTransform, aRect, aClipRect - offset,
|
newTransform, aRect, transformedClipRect,
|
||||||
dest, buffer)) {
|
dest, buffer)) {
|
||||||
// we succeeded in scaling
|
// we succeeded in scaling
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user