Bug 895116: Fix masking with BasicCompositor r=mattwoodrow

This commit is contained in:
David Zbarsky 2013-07-23 16:38:46 -07:00
Родитель 679bf8971f
Коммит 9c6bad4ee6
1 изменённых файлов: 8 добавлений и 6 удалений

Просмотреть файл

@ -53,12 +53,10 @@ protected:
nsIntPoint*) MOZ_OVERRIDE
{
AutoOpenSurface surf(OPEN_READ_ONLY, aImage);
mFormat =
(surf.ContentType() == gfxASurface::CONTENT_COLOR_ALPHA) ? FORMAT_B8G8R8A8 :
FORMAT_B8G8R8X8;
mThebesSurface = ShadowLayerForwarder::OpenDescriptor(OPEN_READ_ONLY, aImage);
mThebesImage = mThebesSurface->GetAsImageSurface();
MOZ_ASSERT(mThebesImage);
mFormat = ImageFormatToSurfaceFormat(mThebesImage->Format());
mSurface = nullptr;
mSize = IntSize(mThebesImage->Width(), mThebesImage->Height());
}
@ -255,9 +253,13 @@ DrawSurfaceWithTextureCoords(DrawTarget *aDest,
gfxPoint(aDestRect.XMost(), aDestRect.YMost()));
Matrix matrix = ToMatrix(transform);
if (aMask) {
aDest->Mask(SurfacePattern(aSource, EXTEND_REPEAT, matrix),
SurfacePattern(aMask, EXTEND_CLAMP, aMaskTransform),
DrawOptions(aOpacity));
NS_ASSERTION(matrix._11 == 1.0f && matrix._12 == 0.0f &&
matrix._21 == 0.0f && matrix._22 == 1.0f,
"Can only handle translations for mask transform");
aDest->MaskSurface(SurfacePattern(aSource, EXTEND_CLAMP, matrix),
aMask,
Point(matrix._31, matrix._32),
DrawOptions(aOpacity));
} else {
aDest->FillRect(aDestRect,
SurfacePattern(aSource, EXTEND_REPEAT, matrix),