Bug 959121 - Moz2Dify ImageClientSingle::UpdateImage. r=nical

This commit is contained in:
Ali Akhtarzada 2014-02-12 10:24:21 -05:00
parent 1b57105f97
commit e3ab81296b

View File

@ -216,10 +216,10 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer,
GetForwarder()->UseTexture(this, mFrontBuffer);
} else {
nsRefPtr<gfxASurface> surface = image->DeprecatedGetAsSurface();
RefPtr<gfx::SourceSurface> surface = image->GetAsSourceSurface();
MOZ_ASSERT(surface);
gfx::IntSize size = gfx::IntSize(image->GetSize().width, image->GetSize().height);
gfx::IntSize size = image->GetSize();
if (mFrontBuffer &&
(mFrontBuffer->IsImmutable() || mFrontBuffer->GetSize() != size)) {
@ -230,7 +230,7 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer,
bool bufferCreated = false;
if (!mFrontBuffer) {
gfxImageFormat format
= gfxPlatform::GetPlatform()->OptimalFormatForContent(surface->GetContentType());
= gfxPlatform::GetPlatform()->OptimalFormatForContent(gfx::ContentForFormat(surface->GetFormat()));
mFrontBuffer = CreateTextureClientForDrawing(gfx::ImageFormatToSurfaceFormat(format),
mTextureFlags);
MOZ_ASSERT(mFrontBuffer->AsTextureClientDrawTarget());
@ -249,9 +249,8 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer,
{
// We must not keep a reference to the DrawTarget after it has been unlocked.
RefPtr<DrawTarget> dt = mFrontBuffer->AsTextureClientDrawTarget()->GetAsDrawTarget();
RefPtr<SourceSurface> source = gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(dt, surface);
MOZ_ASSERT(source.get());
dt->CopySurface(source, IntRect(IntPoint(), source->GetSize()), IntPoint());
MOZ_ASSERT(surface.get());
dt->CopySurface(surface, IntRect(IntPoint(), surface->GetSize()), IntPoint());
}
mFrontBuffer->Unlock();