Bug 987311 - Fix a bad enum conversion bug found by converting TextureFlags to typed enums - r=nical

This commit is contained in:
Benoit Jacob 2014-03-31 05:10:49 -04:00
parent a080758483
commit 884b8d3ea5

View File

@ -38,6 +38,22 @@ using namespace gfx;
namespace layers { namespace layers {
static TextureFlags TextureFlagsForRotatedContentBufferFlags(uint32_t aBufferFlags)
{
TextureFlags result = 0;
if (aBufferFlags & RotatedContentBuffer::BUFFER_COMPONENT_ALPHA) {
result |= TEXTURE_COMPONENT_ALPHA;
}
if (aBufferFlags & RotatedContentBuffer::ALLOW_REPEAT) {
result |= TEXTURE_ALLOW_REPEAT;
}
return result;
}
/* static */ TemporaryRef<ContentClient> /* static */ TemporaryRef<ContentClient>
ContentClient::CreateContentClient(CompositableForwarder* aForwarder) ContentClient::CreateContentClient(CompositableForwarder* aForwarder)
{ {
@ -210,7 +226,7 @@ ContentClientRemoteBuffer::BuildTextureClients(SurfaceFormat aFormat,
mSurfaceFormat = aFormat; mSurfaceFormat = aFormat;
mSize = gfx::IntSize(aRect.width, aRect.height); mSize = gfx::IntSize(aRect.width, aRect.height);
mTextureInfo.mTextureFlags = aFlags & ~TEXTURE_DEALLOCATE_CLIENT; mTextureInfo.mTextureFlags = TextureFlagsForRotatedContentBufferFlags(aFlags);
if (!CreateAndAllocateTextureClient(mTextureClient, TEXTURE_ON_BLACK) || if (!CreateAndAllocateTextureClient(mTextureClient, TEXTURE_ON_BLACK) ||
!AddTextureClient(mTextureClient)) { !AddTextureClient(mTextureClient)) {
@ -396,7 +412,7 @@ DeprecatedContentClientRemoteBuffer::BuildDeprecatedTextureClients(ContentType a
mContentType = aType; mContentType = aType;
mSize = gfx::IntSize(aRect.width, aRect.height); mSize = gfx::IntSize(aRect.width, aRect.height);
mTextureInfo.mTextureFlags = aFlags & ~TEXTURE_DEALLOCATE_CLIENT; mTextureInfo.mTextureFlags = TextureFlagsForRotatedContentBufferFlags(aFlags);
if (!CreateAndAllocateDeprecatedTextureClient(mDeprecatedTextureClient)) { if (!CreateAndAllocateDeprecatedTextureClient(mDeprecatedTextureClient)) {
return; return;
@ -408,7 +424,6 @@ DeprecatedContentClientRemoteBuffer::BuildDeprecatedTextureClients(ContentType a
mDeprecatedTextureClient = nullptr; mDeprecatedTextureClient = nullptr;
return; return;
} }
mTextureInfo.mTextureFlags |= TEXTURE_COMPONENT_ALPHA;
} }
CreateFrontBufferAndNotify(aRect); CreateFrontBufferAndNotify(aRect);