Bug 900133 - Recreate the TextureClient for an ImageClient if the image size changes. r=nical

This commit is contained in:
Matt Woodrow 2013-08-03 13:29:18 -04:00
parent 8d1d162923
commit e49181d0be
4 changed files with 12 additions and 3 deletions

View File

@ -146,7 +146,10 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer,
nsRefPtr<gfxASurface> surface = image->GetAsSurface();
MOZ_ASSERT(surface);
if (mFrontBuffer && mFrontBuffer->IsImmutable()) {
gfx::IntSize size = gfx::IntSize(image->GetSize().width, image->GetSize().height);
if (mFrontBuffer &&
(mFrontBuffer->IsImmutable() || mFrontBuffer->GetSize() != size)) {
RemoveTextureClient(mFrontBuffer);
mFrontBuffer = nullptr;
}
@ -155,7 +158,6 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer,
gfxASurface::gfxImageFormat format
= gfxPlatform::GetPlatform()->OptimalFormatForContent(surface->GetContentType());
mFrontBuffer = CreateBufferTextureClient(gfx::ImageFormatToSurfaceFormat(format));
gfx::IntSize size = gfx::IntSize(image->GetSize().width, image->GetSize().height);
MOZ_ASSERT(mFrontBuffer->AsTextureClientSurface());
mFrontBuffer->AsTextureClientSurface()->AllocateForSurface(size);

View File

@ -187,6 +187,7 @@ BufferTextureClient::AllocateForSurface(gfx::IntSize aSize)
}
ImageDataSerializer serializer(GetBuffer());
serializer.InitializeBufferInfo(aSize, mFormat);
mSize = aSize;
return true;
}
@ -220,6 +221,7 @@ BufferTextureClient::AllocateForYCbCr(gfx::IntSize aYSize, gfx::IntSize aCbCrSiz
YCbCrImageDataSerializer serializer(GetBuffer());
serializer.InitializeBufferInfo(aYSize,
aCbCrSize);
mSize = aYSize;
return true;
}

View File

@ -124,6 +124,8 @@ public:
virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aDescriptor) = 0;
virtual gfx::IntSize GetSize() const = 0;
void SetFlags(TextureFlags aFlags)
{
MOZ_ASSERT(!IsSharedWithCompositor());
@ -193,6 +195,8 @@ public:
virtual size_t GetBufferSize() const = 0;
virtual gfx::IntSize GetSize() const { return mSize; }
// TextureClientSurface
virtual TextureClientSurface* AsTextureClientSurface() MOZ_OVERRIDE { return this; }
@ -214,6 +218,7 @@ public:
protected:
CompositableClient* mCompositable;
gfx::SurfaceFormat mFormat;
gfx::IntSize mSize;
};
/**

View File

@ -39,7 +39,7 @@ public:
bool aIsCrossProcess = false,
bool aInverted = false);
gfx::IntSize GetSize() const { return mSize; }
virtual gfx::IntSize GetSize() const { return mSize; }
protected:
gfx::IntSize mSize;