зеркало из https://github.com/mozilla/gecko-dev.git
Bug 900133 - Recreate the TextureClient for an ImageClient if the image size changes. r=nical
This commit is contained in:
Родитель
60bea9af38
Коммит
1c112a09e7
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче