Bug 1211615: Upload the full texture on the first upload for component alpha textures. r=nical

This commit is contained in:
Bas Schouten 2015-10-14 17:00:42 +02:00
parent 9561adfe2a
commit 026b90f054
2 changed files with 12 additions and 2 deletions

View File

@ -598,8 +598,13 @@ BufferTextureHost::Upload(nsIntRegion *aRegion)
}
} else {
// non-YCbCr case
nsIntRegion* regionToUpdate = aRegion;
if (!mFirstSource) {
mFirstSource = mCompositor->CreateDataTextureSource(mFlags);
if (mFlags & TextureFlags::COMPONENT_ALPHA) {
// Update the full region the first time for component alpha textures.
regionToUpdate = nullptr;
}
}
ImageDataDeserializer deserializer(GetBuffer(), GetBufferSize());
if (!deserializer.IsValid()) {
@ -612,7 +617,7 @@ BufferTextureHost::Upload(nsIntRegion *aRegion)
return false;
}
if (!mFirstSource->Update(surf.get(), aRegion)) {
if (!mFirstSource->Update(surf.get(), regionToUpdate)) {
NS_WARNING("failed to update the DataTextureSource");
return false;
}

View File

@ -860,12 +860,17 @@ TextureHostD3D9::UpdatedInternal(const nsIntRegion* aRegion)
return;
}
const nsIntRegion* regionToUpdate = aRegion;
if (!mTextureSource) {
mTextureSource = new DataTextureSourceD3D9(mFormat, mSize, mCompositor,
nullptr, mFlags);
if (mFlags & TextureFlags::COMPONENT_ALPHA) {
// Update the full region the first time for component alpha textures.
regionToUpdate = nullptr;
}
}
if (!mTextureSource->UpdateFromTexture(mTexture, aRegion)) {
if (!mTextureSource->UpdateFromTexture(mTexture, regionToUpdate)) {
gfxCriticalError() << "[D3D9] DataTextureSourceD3D9::UpdateFromTexture failed";
}
}