Bug 987311 - 2/6 - Make TextureFlags a typed enum, auto regex changes - r=nical

find gfx/layers -type f | xargs sed -i 's/\(^\|[^A-Za-z0-9_]\)TEXTURE_\(USE_NEAREST_FILTER\|NEEDS_Y_FLIP\|DISALLOW_BIGIMAGE\|ALLOW_REPEAT\|NEW_TILE\|COMPONENT_ALPHA\|RB_SWAPPED\|FRONT\|ON_WHITE\|ON_BLACK\|TILE\|RECYCLE\|COPY_PREVIOUS\|DEALLOCATE_CLIENT\|IMMUTABLE\|IMMEDIATE_UPLOAD\|DOUBLE_BUFFERED\|ALLOC_FALLBACK\)\($\|[^A-Za-z0-9_]\)/\1TextureFlags::\2\3/g'
find gfx/layers -type f | xargs sed -i 's/TEXTURE_FLAGS_DEFAULT/TextureFlags::DEFAULT/g'
This commit is contained in:
Benoit Jacob 2014-04-25 22:34:05 -04:00
parent 4945a223fa
commit 2128bb4f6f
34 changed files with 92 additions and 92 deletions

View File

@ -95,9 +95,9 @@ TextureRequiresLocking(TextureFlags aFlags)
// If we're not double buffered, or uploading
// within a transaction, then we need to support
// locking correctly.
return !(aFlags & (TEXTURE_IMMEDIATE_UPLOAD |
TEXTURE_DOUBLE_BUFFERED |
TEXTURE_IMMUTABLE));
return !(aFlags & (TextureFlags::IMMEDIATE_UPLOAD |
TextureFlags::DOUBLE_BUFFERED |
TextureFlags::IMMUTABLE));
}
/**

View File

@ -131,7 +131,7 @@ D3D9SurfaceImage::GetTextureClient(CompositableClient* aClient)
EnsureSynchronized();
if (!mTextureClient) {
RefPtr<SharedTextureClientD3D9> textureClient =
new SharedTextureClientD3D9(gfx::SurfaceFormat::B8G8R8X8, TEXTURE_FLAGS_DEFAULT);
new SharedTextureClientD3D9(gfx::SurfaceFormat::B8G8R8X8, TextureFlags::DEFAULT);
textureClient->InitWith(mTexture, mShareHandle, mDesc);
mTextureClient = textureClient;
}

View File

@ -624,7 +624,7 @@ CairoImage::GetTextureClient(CompositableClient *aClient)
// gfx::BackendType::NONE means default to content backend
textureClient = aClient->CreateTextureClientForDrawing(surface->GetFormat(),
TEXTURE_FLAGS_DEFAULT,
TextureFlags::DEFAULT,
gfx::BackendType::NONE,
surface->GetSize());
MOZ_ASSERT(textureClient->CanExposeDrawTarget());

View File

@ -195,11 +195,11 @@ AppendToString(nsACString& s, TextureFlags flags,
} \
}
bool previous = false;
AppendFlag(TEXTURE_USE_NEAREST_FILTER);
AppendFlag(TEXTURE_NEEDS_Y_FLIP);
AppendFlag(TEXTURE_DISALLOW_BIGIMAGE);
AppendFlag(TEXTURE_ALLOW_REPEAT);
AppendFlag(TEXTURE_NEW_TILE);
AppendFlag(TextureFlags::USE_NEAREST_FILTER);
AppendFlag(TextureFlags::NEEDS_Y_FLIP);
AppendFlag(TextureFlags::DISALLOW_BIGIMAGE);
AppendFlag(TextureFlags::ALLOW_REPEAT);
AppendFlag(TextureFlags::NEW_TILE);
#undef AppendFlag
}

View File

@ -14,7 +14,7 @@ MacIOSurfaceImage::GetTextureClient(CompositableClient* aClient)
{
if (!mTextureClient) {
RefPtr<MacIOSurfaceTextureClientOGL> buffer =
new MacIOSurfaceTextureClientOGL(TEXTURE_FLAGS_DEFAULT);
new MacIOSurfaceTextureClientOGL(TextureFlags::DEFAULT);
buffer->InitWith(mSurface);
mTextureClient = buffer;
}

View File

@ -71,7 +71,7 @@ TextureClientX11::ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor)
TextureClientData*
TextureClientX11::DropTextureData()
{
MOZ_ASSERT(!(mFlags & TEXTURE_DEALLOCATE_CLIENT));
MOZ_ASSERT(!(mFlags & TextureFlags::DEALLOCATE_CLIENT));
return nullptr;
}

View File

@ -19,7 +19,7 @@ namespace layers {
class TextureClientX11 : public TextureClient
{
public:
TextureClientX11(gfx::SurfaceFormat format, TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
TextureClientX11(gfx::SurfaceFormat format, TextureFlags aFlags = TextureFlags::DEFAULT);
~TextureClientX11();

View File

@ -43,7 +43,7 @@ CanvasClient::CreateCanvasClient(CanvasClientType aType,
#endif
if (aType == CanvasClientGLContext &&
aForwarder->GetCompositorBackendType() == LayersBackend::LAYERS_OPENGL) {
aFlags |= TEXTURE_DEALLOCATE_CLIENT;
aFlags |= TextureFlags::DEALLOCATE_CLIENT;
return new CanvasClientSurfaceStream(aForwarder, aFlags);
}
return new CanvasClient2D(aForwarder, aFlags);
@ -66,9 +66,9 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
: gfxContentType::COLOR_ALPHA;
gfxImageFormat format
= gfxPlatform::GetPlatform()->OptimalFormatForContent(contentType);
uint32_t flags = TEXTURE_FLAGS_DEFAULT;
if (mTextureFlags & TEXTURE_NEEDS_Y_FLIP) {
flags |= TEXTURE_NEEDS_Y_FLIP;
uint32_t flags = TextureFlags::DEFAULT;
if (mTextureFlags & TextureFlags::NEEDS_Y_FLIP) {
flags |= TextureFlags::NEEDS_Y_FLIP;
}
mBuffer = CreateBufferTextureClient(gfx::ImageFormatToSurfaceFormat(format),
flags,

View File

@ -133,18 +133,18 @@ ClientCanvasLayer::RenderLayer()
}
if (!mCanvasClient) {
TextureFlags flags = TEXTURE_IMMEDIATE_UPLOAD;
TextureFlags flags = TextureFlags::IMMEDIATE_UPLOAD;
if (mNeedsYFlip) {
flags |= TEXTURE_NEEDS_Y_FLIP;
flags |= TextureFlags::NEEDS_Y_FLIP;
}
if (!mGLContext) {
// We don't support locking for buffer surfaces currently
flags |= TEXTURE_IMMEDIATE_UPLOAD;
flags |= TextureFlags::IMMEDIATE_UPLOAD;
} else {
// GLContext's SurfaceStream handles ownership itself,
// and doesn't require layers to do any deallocation.
flags |= TEXTURE_DEALLOCATE_CLIENT;
flags |= TextureFlags::DEALLOCATE_CLIENT;
}
mCanvasClient = CanvasClient::CreateCanvasClient(GetCanvasClientType(),
ClientManager()->AsShadowForwarder(), flags);

View File

@ -143,9 +143,9 @@ ClientImageLayer::RenderLayer()
if (type == BUFFER_UNKNOWN) {
return;
}
TextureFlags flags = TEXTURE_FRONT;
TextureFlags flags = TextureFlags::FRONT;
if (mDisallowBigImage) {
flags |= TEXTURE_DISALLOW_BIGIMAGE;
flags |= TextureFlags::DISALLOW_BIGIMAGE;
}
mImageClient = ImageClient::CreateImageClient(type,
ClientManager()->AsShadowForwarder(),

View File

@ -82,7 +82,7 @@ public:
TemporaryRef<BufferTextureClient>
CreateBufferTextureClient(gfx::SurfaceFormat aFormat,
TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT,
TextureFlags aFlags = TextureFlags::DEFAULT,
gfx::BackendType aMoz2dBackend = gfx::BackendType::NONE);
TemporaryRef<TextureClient>

View File

@ -43,11 +43,11 @@ static TextureFlags TextureFlagsForRotatedContentBufferFlags(uint32_t aBufferFla
TextureFlags result = 0;
if (aBufferFlags & RotatedContentBuffer::BUFFER_COMPONENT_ALPHA) {
result |= TEXTURE_COMPONENT_ALPHA;
result |= TextureFlags::COMPONENT_ALPHA;
}
if (aBufferFlags & RotatedContentBuffer::ALLOW_REPEAT) {
result |= TEXTURE_ALLOW_REPEAT;
result |= TextureFlags::ALLOW_REPEAT;
}
return result;
@ -197,7 +197,7 @@ ContentClientRemoteBuffer::CreateAndAllocateTextureClient(RefPtr<TextureClient>&
if (!aClient->AllocateForSurface(mSize, ALLOC_CLEAR_BUFFER)) {
aClient = CreateTextureClientForDrawing(mSurfaceFormat,
mTextureInfo.mTextureFlags | TEXTURE_ALLOC_FALLBACK | aFlags,
mTextureInfo.mTextureFlags | TextureFlags::ALLOC_FALLBACK | aFlags,
gfx::BackendType::NONE,
mSize);
if (!aClient) {
@ -236,19 +236,19 @@ ContentClientRemoteBuffer::BuildTextureClients(SurfaceFormat aFormat,
mSize = gfx::IntSize(aRect.width, aRect.height);
mTextureInfo.mTextureFlags = TextureFlagsForRotatedContentBufferFlags(aFlags);
if (!CreateAndAllocateTextureClient(mTextureClient, TEXTURE_ON_BLACK) ||
if (!CreateAndAllocateTextureClient(mTextureClient, TextureFlags::ON_BLACK) ||
!AddTextureClient(mTextureClient)) {
AbortTextureClientCreation();
return;
}
if (aFlags & BUFFER_COMPONENT_ALPHA) {
if (!CreateAndAllocateTextureClient(mTextureClientOnWhite, TEXTURE_ON_WHITE) ||
if (!CreateAndAllocateTextureClient(mTextureClientOnWhite, TextureFlags::ON_WHITE) ||
!AddTextureClient(mTextureClientOnWhite)) {
AbortTextureClientCreation();
return;
}
mTextureInfo.mTextureFlags |= TEXTURE_COMPONENT_ALPHA;
mTextureInfo.mTextureFlags |= TextureFlags::COMPONENT_ALPHA;
}
CreateFrontBuffer(aRect);
@ -339,13 +339,13 @@ ContentClientRemoteBuffer::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
void
ContentClientDoubleBuffered::CreateFrontBuffer(const nsIntRect& aBufferRect)
{
if (!CreateAndAllocateTextureClient(mFrontClient, TEXTURE_ON_BLACK) ||
if (!CreateAndAllocateTextureClient(mFrontClient, TextureFlags::ON_BLACK) ||
!AddTextureClient(mFrontClient)) {
AbortTextureClientCreation();
return;
}
if (mTextureInfo.mTextureFlags & TEXTURE_COMPONENT_ALPHA) {
if (!CreateAndAllocateTextureClient(mFrontClientOnWhite, TEXTURE_ON_WHITE) ||
if (mTextureInfo.mTextureFlags & TextureFlags::COMPONENT_ALPHA) {
if (!CreateAndAllocateTextureClient(mFrontClientOnWhite, TextureFlags::ON_WHITE) ||
!AddTextureClient(mFrontClientOnWhite)) {
AbortTextureClientCreation();
return;
@ -601,7 +601,7 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer,
canReuseBuffer = neededRegion.GetBounds().Size() <= mBufferRect.Size() &&
mHasBuffer &&
(!(aFlags & RotatedContentBuffer::PAINT_WILL_RESAMPLE) ||
!(mTextureInfo.mTextureFlags & TEXTURE_ALLOW_REPEAT));
!(mTextureInfo.mTextureFlags & TextureFlags::ALLOW_REPEAT));
if (canReuseBuffer) {
if (mBufferRect.Contains(neededRegion.GetBounds())) {
@ -685,9 +685,9 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer,
nsIntRect drawBounds = result.mRegionToDraw.GetBounds();
bool createdBuffer = false;
uint32_t bufferFlags = canHaveRotation ? TEXTURE_ALLOW_REPEAT : 0;
uint32_t bufferFlags = canHaveRotation ? TextureFlags::ALLOW_REPEAT : 0;
if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
bufferFlags |= TEXTURE_COMPONENT_ALPHA;
bufferFlags |= TextureFlags::COMPONENT_ALPHA;
}
if (canReuseBuffer) {
nsIntRect keepArea;

View File

@ -445,7 +445,7 @@ private:
void NotifyBufferCreated(ContentType aType, uint32_t aFlags)
{
mTextureInfo.mTextureFlags = aFlags & ~TEXTURE_DEALLOCATE_CLIENT;
mTextureInfo.mTextureFlags = aFlags & ~TextureFlags::DEALLOCATE_CLIENT;
mContentType = aType;
mForwarder->CreatedIncrementalBuffer(this,

View File

@ -164,7 +164,7 @@ ImageClientSingle::UpdateImageInternal(ImageContainer* aContainer,
bool bufferCreated = false;
if (!mFrontBuffer) {
mFrontBuffer = CreateBufferTextureClient(gfx::SurfaceFormat::YUV, TEXTURE_FLAGS_DEFAULT);
mFrontBuffer = CreateBufferTextureClient(gfx::SurfaceFormat::YUV, TextureFlags::DEFAULT);
gfx::IntSize ySize(data->mYSize.width, data->mYSize.height);
gfx::IntSize cbCrSize(data->mCbCrSize.width, data->mCbCrSize.height);
if (!mFrontBuffer->AsTextureClientYCbCr()->AllocateForYCbCr(ySize, cbCrSize, data->mStereoMode)) {

View File

@ -72,10 +72,10 @@ SimpleTextureClientPool::GetTextureClient(bool aAutoRecycle)
// No unused clients in the pool, create one
if (gfxPrefs::ForceShmemTiles()) {
textureClient = TextureClient::CreateBufferTextureClient(mSurfaceAllocator,
mFormat, TEXTURE_IMMEDIATE_UPLOAD | TEXTURE_RECYCLE, gfx::BackendType::NONE);
mFormat, TextureFlags::IMMEDIATE_UPLOAD | TextureFlags::RECYCLE, gfx::BackendType::NONE);
} else {
textureClient = TextureClient::CreateTextureClientForDrawing(mSurfaceAllocator,
mFormat, TEXTURE_FLAGS_DEFAULT | TEXTURE_RECYCLE, gfx::BackendType::NONE, mSize);
mFormat, TextureFlags::DEFAULT | TextureFlags::RECYCLE, gfx::BackendType::NONE, mSize);
}
if (!textureClient->AllocateForSurface(mSize, ALLOC_DEFAULT)) {
NS_WARNING("TextureClient::AllocateForSurface failed!");

View File

@ -290,7 +290,7 @@ TextureClient::CreateTextureClientForDrawing(ISurfaceAllocator* aAllocator,
gfxWindowsPlatform::GetPlatform()->GetD2DDevice() &&
aSizeHint.width <= maxTextureSize &&
aSizeHint.height <= maxTextureSize &&
!(aTextureFlags & TEXTURE_ALLOC_FALLBACK)) {
!(aTextureFlags & TextureFlags::ALLOC_FALLBACK)) {
result = new TextureClientD3D11(aFormat, aTextureFlags);
}
if (parentBackend == LayersBackend::LAYERS_D3D9 &&
@ -298,7 +298,7 @@ TextureClient::CreateTextureClientForDrawing(ISurfaceAllocator* aAllocator,
aAllocator->IsSameProcess() &&
aSizeHint.width <= maxTextureSize &&
aSizeHint.height <= maxTextureSize &&
!(aTextureFlags & TEXTURE_ALLOC_FALLBACK)) {
!(aTextureFlags & TextureFlags::ALLOC_FALLBACK)) {
if (!gfxWindowsPlatform::GetPlatform()->GetD3D9Device()) {
result = new DIBTextureClientD3D9(aFormat, aTextureFlags);
} else {
@ -315,14 +315,14 @@ TextureClient::CreateTextureClientForDrawing(ISurfaceAllocator* aAllocator,
if (parentBackend == LayersBackend::LAYERS_BASIC &&
aMoz2DBackend == gfx::BackendType::CAIRO &&
type == gfxSurfaceType::Xlib &&
!(aTextureFlags & TEXTURE_ALLOC_FALLBACK))
!(aTextureFlags & TextureFlags::ALLOC_FALLBACK))
{
result = new TextureClientX11(aFormat, aTextureFlags);
}
#ifdef GL_PROVIDER_GLX
if (parentBackend == LayersBackend::LAYERS_OPENGL &&
type == gfxSurfaceType::Xlib &&
!(aTextureFlags & TEXTURE_ALLOC_FALLBACK) &&
!(aTextureFlags & TextureFlags::ALLOC_FALLBACK) &&
aFormat != SurfaceFormat::A8 &&
gl::sGLXLibrary.UseTextureFromPixmap())
{
@ -459,7 +459,7 @@ TextureClient::~TextureClient()
void TextureClient::ForceRemove()
{
if (mValid && mActor) {
if (GetFlags() & TEXTURE_DEALLOCATE_CLIENT) {
if (GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
mActor->SetTextureData(DropTextureData());
if (mActor->IPCOpen()) {
mActor->SendRemoveTextureSync();

View File

@ -129,7 +129,7 @@ class TextureClient
: public AtomicRefCountedWithFinalize<TextureClient>
{
public:
TextureClient(TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
TextureClient(TextureFlags aFlags = TextureFlags::DEFAULT);
virtual ~TextureClient();
static TemporaryRef<BufferTextureClient>
@ -261,7 +261,7 @@ public:
TextureFlags GetFlags() const { return mFlags; }
/**
* valid only for TEXTURE_RECYCLE TextureClient.
* valid only for TextureFlags::RECYCLE TextureClient.
* When called this texture client will grab a strong reference and release
* it once the compositor notifies that it is done with the texture.
* NOTE: In this stage the texture client can no longer be used by the
@ -274,9 +274,9 @@ public:
* modified, it can only be read. It is safe to not Lock/Unlock immutable
* textures.
*/
bool IsImmutable() const { return mFlags & TEXTURE_IMMUTABLE; }
bool IsImmutable() const { return mFlags & TextureFlags::IMMUTABLE; }
void MarkImmutable() { AddFlags(TEXTURE_IMMUTABLE); }
void MarkImmutable() { AddFlags(TextureFlags::IMMUTABLE); }
bool IsSharedWithCompositor() const { return mShared; }
@ -306,7 +306,7 @@ public:
/**
* Triggers the destruction of the shared data and the corresponding TextureHost.
*
* If the texture flags contain TEXTURE_DEALLOCATE_CLIENT, the destruction
* If the texture flags contain TextureFlags::DEALLOCATE_CLIENT, the destruction
* will be synchronously coordinated with the compositor side, otherwise it
* will be done asynchronously.
*/

View File

@ -57,10 +57,10 @@ TextureClientPool::GetTextureClient()
if (gfxPrefs::ForceShmemTiles()) {
// gfx::BackendType::NONE means use the content backend
textureClient = TextureClient::CreateBufferTextureClient(mSurfaceAllocator,
mFormat, TEXTURE_IMMEDIATE_UPLOAD, gfx::BackendType::NONE);
mFormat, TextureFlags::IMMEDIATE_UPLOAD, gfx::BackendType::NONE);
} else {
textureClient = TextureClient::CreateTextureClientForDrawing(mSurfaceAllocator,
mFormat, TEXTURE_IMMEDIATE_UPLOAD, gfx::BackendType::NONE, mSize);
mFormat, TextureFlags::IMMEDIATE_UPLOAD, gfx::BackendType::NONE, mSize);
}
textureClient->AllocateForSurface(mSize, ALLOC_DEFAULT);

View File

@ -488,7 +488,7 @@ ContentHostIncremental::TextureCreationRequest::Execute(ContentHostIncremental*
temp->AsSourceOGL()->AsTextureImageTextureSource();
RefPtr<TextureImageTextureSourceOGL> newSourceOnWhite;
if (mTextureInfo.mTextureFlags & TEXTURE_COMPONENT_ALPHA) {
if (mTextureInfo.mTextureFlags & TextureFlags::COMPONENT_ALPHA) {
temp =
compositor->CreateDataTextureSource(mTextureInfo.mTextureFlags);
MOZ_ASSERT(temp->AsSourceOGL() &&

View File

@ -148,7 +148,7 @@ ImageHost::Composite(EffectChain& aEffectChain,
rect = gfx::Rect(0, 0, textureSize.width, textureSize.height);
}
if (mFrontBuffer->GetFlags() & TEXTURE_NEEDS_Y_FLIP) {
if (mFrontBuffer->GetFlags() & TextureFlags::NEEDS_Y_FLIP) {
effect->mTextureCoords.y = effect->mTextureCoords.YMost();
effect->mTextureCoords.height = -effect->mTextureCoords.height;
}

View File

@ -233,7 +233,7 @@ TextureHost::~TextureHost()
void TextureHost::Finalize()
{
if (!(GetFlags() & TEXTURE_DEALLOCATE_CLIENT)) {
if (!(GetFlags() & TextureFlags::DEALLOCATE_CLIENT)) {
DeallocateSharedData();
DeallocateDeviceData();
}
@ -292,7 +292,7 @@ BufferTextureHost::Updated(const nsIntRegion* aRegion)
} else {
mPartialUpdate = false;
}
if (GetFlags() & TEXTURE_IMMEDIATE_UPLOAD) {
if (GetFlags() & TextureFlags::IMMEDIATE_UPLOAD) {
DebugOnly<bool> result = MaybeUpload(mPartialUpdate ? &mMaybeUpdatedRegion : nullptr);
NS_WARN_IF_FALSE(result, "Failed to upload a texture");
}
@ -411,9 +411,9 @@ BufferTextureHost::Upload(nsIntRegion *aRegion)
RefPtr<DataTextureSource> srcV;
if (!mFirstSource) {
// We don't support BigImages for YCbCr compositing.
srcY = mCompositor->CreateDataTextureSource(mFlags|TEXTURE_DISALLOW_BIGIMAGE);
srcU = mCompositor->CreateDataTextureSource(mFlags|TEXTURE_DISALLOW_BIGIMAGE);
srcV = mCompositor->CreateDataTextureSource(mFlags|TEXTURE_DISALLOW_BIGIMAGE);
srcY = mCompositor->CreateDataTextureSource(mFlags|TextureFlags::DISALLOW_BIGIMAGE);
srcU = mCompositor->CreateDataTextureSource(mFlags|TextureFlags::DISALLOW_BIGIMAGE);
srcV = mCompositor->CreateDataTextureSource(mFlags|TextureFlags::DISALLOW_BIGIMAGE);
mFirstSource = srcY;
srcY->SetNextSibling(srcU);
srcU->SetNextSibling(srcV);
@ -569,7 +569,7 @@ MemoryTextureHost::MemoryTextureHost(uint8_t* aBuffer,
MemoryTextureHost::~MemoryTextureHost()
{
DeallocateDeviceData();
NS_ASSERTION(!mBuffer || (mFlags & TEXTURE_DEALLOCATE_CLIENT),
NS_ASSERTION(!mBuffer || (mFlags & TextureFlags::DEALLOCATE_CLIENT),
"Leaking our buffer");
MOZ_COUNT_DTOR(MemoryTextureHost);
}
@ -644,7 +644,7 @@ TextureParent::CompositorRecycle()
// Don't forget to prepare for the next reycle
// if TextureClient request it.
if (mTextureHost->GetFlags() & TEXTURE_RECYCLE) {
if (mTextureHost->GetFlags() & TextureFlags::RECYCLE) {
mWaitForClientRecycle = mTextureHost;
}
}
@ -671,7 +671,7 @@ TextureParent::Init(const SurfaceDescriptor& aSharedData,
aFlags);
if (mTextureHost) {
mTextureHost->mActor = this;
if (aFlags & TEXTURE_RECYCLE) {
if (aFlags & TextureFlags::RECYCLE) {
mWaitForClientRecycle = mTextureHost;
RECYCLE_LOG("Setup recycling for tile %p\n", this);
}
@ -711,11 +711,11 @@ TextureParent::ActorDestroy(ActorDestroyReason why)
NS_RUNTIMEABORT("FailedConstructor isn't possible in PTexture");
}
if (mTextureHost->GetFlags() & TEXTURE_RECYCLE) {
if (mTextureHost->GetFlags() & TextureFlags::RECYCLE) {
RECYCLE_LOG("clear recycling for tile %p\n", this);
mTextureHost->ClearRecycleCallback();
}
if (mTextureHost->GetFlags() & TEXTURE_DEALLOCATE_CLIENT) {
if (mTextureHost->GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
mTextureHost->ForgetSharedData();
}

View File

@ -124,7 +124,7 @@ TiledLayerBufferComposite::Upload()
if(!IsValid()) {
return;
}
// The TextureClients were created with the TEXTURE_IMMEDIATE_UPLOAD flag,
// The TextureClients were created with the TextureFlags::IMMEDIATE_UPLOAD flag,
// so calling Update on all the texture hosts will perform the texture upload.
Update(mValidRegion, mPaintedRegion);
ClearPaintedRegion();
@ -145,7 +145,7 @@ TiledLayerBufferComposite::ValidateTile(TileHost aTile,
long start = PR_IntervalNow();
#endif
MOZ_ASSERT(aTile.mTextureHost->GetFlags() & TEXTURE_IMMEDIATE_UPLOAD);
MOZ_ASSERT(aTile.mTextureHost->GetFlags() & TextureFlags::IMMEDIATE_UPLOAD);
// We possibly upload the entire texture contents here. This is a purposeful
// decision, as sub-image upload can often be slow and/or unreliable, but
// we may want to reevaluate this in the future.

View File

@ -25,7 +25,7 @@ X11TextureHost::X11TextureHost(TextureFlags aFlags,
mSurface = surface.get();
// The host always frees the pixmap.
MOZ_ASSERT(!(aFlags & TEXTURE_DEALLOCATE_CLIENT));
MOZ_ASSERT(!(aFlags & TextureFlags::DEALLOCATE_CLIENT));
mSurface->TakePixmap();
}

View File

@ -361,7 +361,7 @@ DataTextureSourceD3D11::Update(DataSourceSurface* aSurface,
int32_t maxSize = mCompositor->GetMaxTextureSize();
if ((mSize.width <= maxSize && mSize.height <= maxSize) ||
(mFlags & TEXTURE_DISALLOW_BIGIMAGE)) {
(mFlags & TextureFlags::DISALLOW_BIGIMAGE)) {
D3D11_SUBRESOURCE_DATA initData;
initData.pSysMem = aSurface->GetData();
initData.SysMemPitch = aSurface->Stride();

View File

@ -412,7 +412,7 @@ DataTextureSourceD3D9::Update(gfx::DataSourceSurface* aSurface,
int32_t maxSize = mCompositor->GetMaxTextureSize();
DeviceManagerD3D9* deviceManager = gfxWindowsPlatform::GetPlatform()->GetD3D9DeviceManager();
if ((mSize.width <= maxSize && mSize.height <= maxSize) ||
(mFlags & TEXTURE_DISALLOW_BIGIMAGE)) {
(mFlags & TextureFlags::DISALLOW_BIGIMAGE)) {
mTexture = DataToTexture(deviceManager,
aSurface->GetData(), aSurface->Stride(),
IntSize(mSize), format, bpp);
@ -487,7 +487,7 @@ DataTextureSourceD3D9::Update(gfxWindowsSurface* aSurface)
int32_t maxSize = mCompositor->GetMaxTextureSize();
DeviceManagerD3D9* deviceManager = gfxWindowsPlatform::GetPlatform()->GetD3D9DeviceManager();
if ((mSize.width <= maxSize && mSize.height <= maxSize) ||
(mFlags & TEXTURE_DISALLOW_BIGIMAGE)) {
(mFlags & TextureFlags::DISALLOW_BIGIMAGE)) {
mTexture = SurfaceToTexture(deviceManager, aSurface, mSize, format);
if (!mTexture) {

View File

@ -106,14 +106,14 @@ class DataTextureSourceD3D9 : public DataTextureSource
public:
DataTextureSourceD3D9(gfx::SurfaceFormat aFormat,
CompositorD3D9* aCompositor,
TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT,
TextureFlags aFlags = TextureFlags::DEFAULT,
StereoMode aStereoMode = StereoMode::MONO);
DataTextureSourceD3D9(gfx::SurfaceFormat aFormat,
gfx::IntSize aSize,
CompositorD3D9* aCompositor,
IDirect3DTexture9* aTexture,
TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
TextureFlags aFlags = TextureFlags::DEFAULT);
virtual ~DataTextureSourceD3D9();

View File

@ -984,7 +984,7 @@ ImageBridgeChild::RemoveTextureFromCompositable(CompositableClient* aCompositabl
TextureClient* aTexture)
{
MOZ_ASSERT(!mShuttingDown);
if (aTexture->GetFlags() & TEXTURE_DEALLOCATE_CLIENT) {
if (aTexture->GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
mTxn->AddEdit(OpRemoveTexture(nullptr, aCompositable->GetIPDLActor(),
nullptr, aTexture->GetIPDLActor()));
} else {

View File

@ -367,7 +367,7 @@ ShadowLayerForwarder::UpdatedTexture(CompositableClient* aCompositable,
MOZ_ASSERT(aTexture->GetIPDLActor());
MaybeRegion region = aRegion ? MaybeRegion(*aRegion)
: MaybeRegion(null_t());
if (aTexture->GetFlags() & TEXTURE_IMMEDIATE_UPLOAD) {
if (aTexture->GetFlags() & TextureFlags::IMMEDIATE_UPLOAD) {
mTxn->AddPaint(OpUpdateTexture(nullptr, aCompositable->GetIPDLActor(),
nullptr, aTexture->GetIPDLActor(),
region));
@ -417,7 +417,7 @@ ShadowLayerForwarder::RemoveTextureFromCompositable(CompositableClient* aComposi
MOZ_ASSERT(aTexture->GetIPDLActor());
mTxn->AddEdit(OpRemoveTexture(nullptr, aCompositable->GetIPDLActor(),
nullptr, aTexture->GetIPDLActor()));
if (aTexture->GetFlags() & TEXTURE_DEALLOCATE_CLIENT) {
if (aTexture->GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
mTxn->MarkSyncTransaction();
}
// Hold texture until transaction complete.

View File

@ -234,14 +234,14 @@ GrallocTextureClientOGL::AllocateForSurface(gfx::IntSize aSize,
break;
case gfx::SurfaceFormat::B8G8R8A8:
format = android::PIXEL_FORMAT_RGBA_8888;
mFlags |= TEXTURE_RB_SWAPPED;
mFlags |= TextureFlags::RB_SWAPPED;
break;
case gfx::SurfaceFormat::R8G8B8X8:
format = android::PIXEL_FORMAT_RGBX_8888;
break;
case gfx::SurfaceFormat::B8G8R8X8:
format = android::PIXEL_FORMAT_RGBX_8888;
mFlags |= TEXTURE_RB_SWAPPED;
mFlags |= TextureFlags::RB_SWAPPED;
break;
case gfx::SurfaceFormat::R5G6B5:
format = android::PIXEL_FORMAT_RGB_565;

View File

@ -40,11 +40,11 @@ public:
GrallocTextureClientOGL(GrallocBufferActor* aActor,
gfx::IntSize aSize,
gfx::BackendType aMoz2dBackend,
TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
TextureFlags aFlags = TextureFlags::DEFAULT);
GrallocTextureClientOGL(ISurfaceAllocator* aAllocator,
gfx::SurfaceFormat aFormat,
gfx::BackendType aMoz2dBackend,
TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
TextureFlags aFlags = TextureFlags::DEFAULT);
~GrallocTextureClientOGL();

View File

@ -290,7 +290,7 @@ GrallocTextureHostOGL::GrallocTextureHostOGL(TextureFlags aFlags,
if (graphicBuffer) {
format =
SurfaceFormatForAndroidPixelFormat(graphicBuffer->getPixelFormat(),
aFlags & TEXTURE_RB_SWAPPED);
aFlags & TextureFlags::RB_SWAPPED);
}
mTextureSource = new GrallocTextureSourceOGL(nullptr,
graphicBuffer,
@ -370,10 +370,10 @@ GrallocTextureHostOGL::GetRenderState()
{
if (IsValid()) {
uint32_t flags = 0;
if (mFlags & TEXTURE_NEEDS_Y_FLIP) {
if (mFlags & TextureFlags::NEEDS_Y_FLIP) {
flags |= LAYER_RENDER_STATE_Y_FLIPPED;
}
if (mFlags & TEXTURE_RB_SWAPPED) {
if (mFlags & TextureFlags::RB_SWAPPED) {
flags |= LAYER_RENDER_STATE_FORMAT_RB_SWAP;
}
return LayerRenderState(mTextureSource->mGraphicBuffer.get(),

View File

@ -23,7 +23,7 @@ SharedTextureClientOGL::SharedTextureClientOGL(TextureFlags aFlags)
, mInverted(false)
{
// SharedTextureClient is always owned externally.
mFlags |= TEXTURE_DEALLOCATE_CLIENT;
mFlags |= TextureFlags::DEALLOCATE_CLIENT;
}
SharedTextureClientOGL::~SharedTextureClientOGL()
@ -56,7 +56,7 @@ SharedTextureClientOGL::InitWith(gl::SharedTextureHandle aHandle,
mShareType = aShareType;
mInverted = aInverted;
if (mInverted) {
AddFlags(TEXTURE_NEEDS_Y_FLIP);
AddFlags(TextureFlags::NEEDS_Y_FLIP);
}
}

View File

@ -106,11 +106,11 @@ FlagsToGLFlags(TextureFlags aFlags)
{
uint32_t result = TextureImage::NoFlags;
if (aFlags & TEXTURE_USE_NEAREST_FILTER)
if (aFlags & TextureFlags::USE_NEAREST_FILTER)
result |= TextureImage::UseNearestFilter;
if (aFlags & TEXTURE_NEEDS_Y_FLIP)
if (aFlags & TextureFlags::NEEDS_Y_FLIP)
result |= TextureImage::NeedsYFlip;
if (aFlags & TEXTURE_DISALLOW_BIGIMAGE)
if (aFlags & TextureFlags::DISALLOW_BIGIMAGE)
result |= TextureImage::DisallowBigImage;
return static_cast<gl::TextureImage::Flags>(result);
@ -229,10 +229,10 @@ TextureImageTextureSourceOGL::Update(gfx::DataSourceSurface* aSurface,
if (!mTexImage ||
(mTexImage->GetSize() != size && !aSrcOffset) ||
mTexImage->GetContentType() != gfx::ContentForFormat(aSurface->GetFormat())) {
if (mFlags & TEXTURE_DISALLOW_BIGIMAGE) {
if (mFlags & TextureFlags::DISALLOW_BIGIMAGE) {
mTexImage = CreateBasicTextureImage(mGL, size,
gfx::ContentForFormat(aSurface->GetFormat()),
WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
WrapMode(mGL, mFlags & TextureFlags::ALLOW_REPEAT),
FlagsToGLFlags(mFlags),
SurfaceFormatToImageFormat(aSurface->GetFormat()));
} else {
@ -243,7 +243,7 @@ TextureImageTextureSourceOGL::Update(gfx::DataSourceSurface* aSurface,
mTexImage = CreateTextureImage(mGL,
size,
gfx::ContentForFormat(aSurface->GetFormat()),
WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
WrapMode(mGL, mFlags & TextureFlags::ALLOW_REPEAT),
FlagsToGLFlags(mFlags),
SurfaceFormatToImageFormat(aSurface->GetFormat()));
}
@ -268,7 +268,7 @@ TextureImageTextureSourceOGL::EnsureBuffer(const nsIntSize& aSize,
mTexImage = CreateTextureImage(mGL,
aSize.ToIntSize(),
aContentType,
WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
WrapMode(mGL, mFlags & TextureFlags::ALLOW_REPEAT),
FlagsToGLFlags(mFlags));
}
mTexImage->Resize(aSize.ToIntSize());

View File

@ -196,7 +196,7 @@ class TextureImageTextureSourceOGL : public DataTextureSource
{
public:
TextureImageTextureSourceOGL(gl::GLContext* aGL,
TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT)
TextureFlags aFlags = TextureFlags::DEFAULT)
: mGL(aGL)
, mFlags(aFlags)
, mIterating(false)