зеркало из https://github.com/mozilla/gecko-dev.git
Bug 900729: Make TextureFlags constant names (UseNearestFilter, NeedsYFlip, AllowRepeat, NewTile, ComponentAlpha) all caps in CompositorTypes.h and prefix them with TEXTURE_ for consistency and uniqueness. r=nsilva.
This commit is contained in:
Родитель
7e67aa6146
Коммит
56587a4366
|
@ -26,18 +26,18 @@ const SurfaceDescriptorType SURFACEDESCRIPTOR_UNKNOWN = 0;
|
|||
*/
|
||||
typedef uint32_t TextureFlags;
|
||||
// Use nearest-neighbour texture filtering (as opposed to linear filtering).
|
||||
const TextureFlags UseNearestFilter = 1 << 0;
|
||||
const TextureFlags TEXTURE_USE_NEAREST_FILTER = 1 << 0;
|
||||
// The texture should be flipped around the y-axis when composited.
|
||||
const TextureFlags NeedsYFlip = 1 << 1;
|
||||
const TextureFlags TEXTURE_NEEDS_Y_FLIP = 1 << 1;
|
||||
// Force the texture to be represented using a single tile (note that this means
|
||||
// tiled textures, not tiled layers).
|
||||
const TextureFlags TEXTURE_DISALLOW_BIGIMAGE = 1 << 2;
|
||||
// Allow using 'repeat' mode for wrapping.
|
||||
const TextureFlags AllowRepeat = 1 << 3;
|
||||
const TextureFlags TEXTURE_ALLOW_REPEAT = 1 << 3;
|
||||
// The texture represents a tile which is newly created.
|
||||
const TextureFlags NewTile = 1 << 4;
|
||||
const TextureFlags TEXTURE_NEW_TILE = 1 << 4;
|
||||
// The texture is part of a component-alpha pair
|
||||
const TextureFlags ComponentAlpha = 1 << 5;
|
||||
const TextureFlags TEXTURE_COMPONENT_ALPHA = 1 << 5;
|
||||
// The buffer will be treated as if the RB bytes are swapped.
|
||||
// This is useful for rendering using Cairo/Thebes, because there is no
|
||||
// BGRX Android pixel format, and so we have to do byte swapping.
|
||||
|
|
|
@ -210,11 +210,11 @@ AppendToString(nsACString& s, TextureFlags flags,
|
|||
} \
|
||||
}
|
||||
bool previous = false;
|
||||
AppendFlag(UseNearestFilter);
|
||||
AppendFlag(NeedsYFlip);
|
||||
AppendFlag(TEXTURE_USE_NEAREST_FILTER);
|
||||
AppendFlag(TEXTURE_NEEDS_Y_FLIP);
|
||||
AppendFlag(TEXTURE_DISALLOW_BIGIMAGE);
|
||||
AppendFlag(AllowRepeat);
|
||||
AppendFlag(NewTile);
|
||||
AppendFlag(TEXTURE_ALLOW_REPEAT);
|
||||
AppendFlag(TEXTURE_NEW_TILE);
|
||||
AppendFlag(TEXTURE_DEALLOCATE_HOST);
|
||||
|
||||
#undef AppendFlag
|
||||
|
|
|
@ -83,7 +83,7 @@ ClientCanvasLayer::RenderLayer()
|
|||
if (!mCanvasClient) {
|
||||
TextureFlags flags = TEXTURE_IMMEDIATE_UPLOAD;
|
||||
if (mNeedsYFlip) {
|
||||
flags |= NeedsYFlip;
|
||||
flags |= TEXTURE_NEEDS_Y_FLIP;
|
||||
}
|
||||
|
||||
bool isCrossProcess = !(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||
|
|
|
@ -188,7 +188,7 @@ ContentClientRemoteBuffer::BuildDeprecatedTextureClients(ContentType aType,
|
|||
if (!CreateAndAllocateDeprecatedTextureClient(mDeprecatedTextureClientOnWhite)) {
|
||||
return;
|
||||
}
|
||||
mTextureInfo.mTextureFlags |= ComponentAlpha;
|
||||
mTextureInfo.mTextureFlags |= TEXTURE_COMPONENT_ALPHA;
|
||||
}
|
||||
|
||||
CreateFrontBufferAndNotify(aRect);
|
||||
|
@ -305,7 +305,7 @@ ContentClientDoubleBuffered::CreateFrontBufferAndNotify(const nsIntRect& aBuffer
|
|||
return;
|
||||
}
|
||||
|
||||
if (mTextureInfo.mTextureFlags & ComponentAlpha) {
|
||||
if (mTextureInfo.mTextureFlags & TEXTURE_COMPONENT_ALPHA) {
|
||||
if (!CreateAndAllocateDeprecatedTextureClient(mFrontClientOnWhite)) {
|
||||
return;
|
||||
}
|
||||
|
@ -614,7 +614,7 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer,
|
|||
canReuseBuffer = neededRegion.GetBounds().Size() <= mBufferRect.Size() &&
|
||||
mHasBuffer &&
|
||||
(!(aFlags & ThebesLayerBuffer::PAINT_WILL_RESAMPLE) ||
|
||||
!(mTextureInfo.mTextureFlags & AllowRepeat));
|
||||
!(mTextureInfo.mTextureFlags & TEXTURE_ALLOW_REPEAT));
|
||||
|
||||
if (canReuseBuffer) {
|
||||
if (mBufferRect.Contains(neededRegion.GetBounds())) {
|
||||
|
@ -700,9 +700,9 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer,
|
|||
nsIntRect drawBounds = result.mRegionToDraw.GetBounds();
|
||||
bool createdBuffer = false;
|
||||
|
||||
uint32_t bufferFlags = canHaveRotation ? AllowRepeat : 0;
|
||||
uint32_t bufferFlags = canHaveRotation ? TEXTURE_ALLOW_REPEAT : 0;
|
||||
if (mode == Layer::SURFACE_COMPONENT_ALPHA) {
|
||||
bufferFlags |= ComponentAlpha;
|
||||
bufferFlags |= TEXTURE_COMPONENT_ALPHA;
|
||||
}
|
||||
if (canReuseBuffer) {
|
||||
nsIntRect keepArea;
|
||||
|
|
|
@ -510,7 +510,7 @@ ContentHostIncremental::TextureCreationRequest::Execute(ContentHostIncremental*
|
|||
newHost->SetCompositor(compositor);
|
||||
}
|
||||
RefPtr<DeprecatedTextureHost> newHostOnWhite;
|
||||
if (mTextureInfo.mTextureFlags & ComponentAlpha) {
|
||||
if (mTextureInfo.mTextureFlags & TEXTURE_COMPONENT_ALPHA) {
|
||||
newHostOnWhite =
|
||||
DeprecatedTextureHost::CreateDeprecatedTextureHost(SurfaceDescriptor::TShmem,
|
||||
mTextureInfo.mDeprecatedTextureHostFlags,
|
||||
|
|
|
@ -117,7 +117,7 @@ ImageHost::Composite(EffectChain& aEffectChain,
|
|||
rect = gfx::Rect(0, 0, textureSize.width, textureSize.height);
|
||||
}
|
||||
|
||||
if (mFrontBuffer->GetFlags() & NeedsYFlip) {
|
||||
if (mFrontBuffer->GetFlags() & TEXTURE_NEEDS_Y_FLIP) {
|
||||
effect->mTextureCoords.y = effect->mTextureCoords.YMost();
|
||||
effect->mTextureCoords.height = -effect->mTextureCoords.height;
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ DeprecatedImageHostSingle::Composite(EffectChain& aEffectChain,
|
|||
rect = gfx::Rect(0, 0, textureSize.width, textureSize.height);
|
||||
}
|
||||
|
||||
if (mDeprecatedTextureHost->GetFlags() & NeedsYFlip) {
|
||||
if (mDeprecatedTextureHost->GetFlags() & TEXTURE_NEEDS_Y_FLIP) {
|
||||
effect->mTextureCoords.y = effect->mTextureCoords.YMost();
|
||||
effect->mTextureCoords.height = -effect->mTextureCoords.height;
|
||||
}
|
||||
|
|
|
@ -304,7 +304,7 @@ TiledTexture::Validate(gfxReusableSurfaceWrapper* aReusableSurface, Compositor*
|
|||
TEXTURE_HOST_TILED,
|
||||
flags);
|
||||
mDeprecatedTextureHost->SetCompositor(aCompositor);
|
||||
flags |= NewTile;
|
||||
flags |= TEXTURE_NEW_TILE;
|
||||
}
|
||||
|
||||
mDeprecatedTextureHost->Update(aReusableSurface, flags, gfx::IntSize(aSize, aSize));
|
||||
|
|
|
@ -110,9 +110,9 @@ FlagsToGLFlags(TextureFlags aFlags)
|
|||
{
|
||||
uint32_t result = TextureImage::NoFlags;
|
||||
|
||||
if (aFlags & UseNearestFilter)
|
||||
if (aFlags & TEXTURE_USE_NEAREST_FILTER)
|
||||
result |= TextureImage::UseNearestFilter;
|
||||
if (aFlags & NeedsYFlip)
|
||||
if (aFlags & TEXTURE_NEEDS_Y_FLIP)
|
||||
result |= TextureImage::NeedsYFlip;
|
||||
if (aFlags & TEXTURE_DISALLOW_BIGIMAGE)
|
||||
result |= TextureImage::DisallowBigImage;
|
||||
|
@ -154,13 +154,13 @@ TextureImageTextureSourceOGL::Update(gfx::DataSourceSurface* aSurface,
|
|||
// the size of aSurface.
|
||||
mTexImage = mGL->CreateTextureImage(size,
|
||||
gfx::ContentForFormat(aSurface->GetFormat()),
|
||||
WrapMode(mGL, aFlags & AllowRepeat),
|
||||
WrapMode(mGL, aFlags & TEXTURE_ALLOW_REPEAT),
|
||||
FlagsToGLFlags(aFlags));
|
||||
} else {
|
||||
mTexImage = CreateBasicTextureImage(mGL,
|
||||
size,
|
||||
gfx::ContentForFormat(aSurface->GetFormat()),
|
||||
WrapMode(mGL, aFlags & AllowRepeat),
|
||||
WrapMode(mGL, aFlags & TEXTURE_ALLOW_REPEAT),
|
||||
FlagsToGLFlags(aFlags));
|
||||
}
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ TextureImageDeprecatedTextureHostOGL::EnsureBuffer(const nsIntSize& aSize,
|
|||
mTexture->GetContentType() != aContentType) {
|
||||
mTexture = mGL->CreateTextureImage(aSize,
|
||||
aContentType,
|
||||
WrapMode(mGL, mFlags & AllowRepeat),
|
||||
WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
|
||||
FlagsToGLFlags(mFlags));
|
||||
}
|
||||
mTexture->Resize(aSize);
|
||||
|
@ -430,7 +430,7 @@ TextureImageDeprecatedTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage
|
|||
mTexture->GetContentType() != surf.ContentType()) {
|
||||
mTexture = mGL->CreateTextureImage(size,
|
||||
surf.ContentType(),
|
||||
WrapMode(mGL, mFlags & AllowRepeat),
|
||||
WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
|
||||
FlagsToGLFlags(mFlags));
|
||||
}
|
||||
|
||||
|
@ -513,7 +513,7 @@ SharedDeprecatedTextureHostOGL::SwapTexturesImpl(const SurfaceDescriptor& aImage
|
|||
nsIntSize size = texture.size();
|
||||
mSize = gfx::IntSize(size.width, size.height);
|
||||
if (texture.inverted()) {
|
||||
mFlags |= NeedsYFlip;
|
||||
mFlags |= TEXTURE_NEEDS_Y_FLIP;
|
||||
}
|
||||
|
||||
if (mSharedHandle && mSharedHandle != newHandle) {
|
||||
|
@ -738,21 +738,21 @@ YCbCrDeprecatedTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage,
|
|||
mYTexture->mTexImage = CreateBasicTextureImage(mGL,
|
||||
gfxSize,
|
||||
gfxASurface::CONTENT_ALPHA,
|
||||
WrapMode(mGL, mFlags & AllowRepeat),
|
||||
WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
|
||||
FlagsToGLFlags(mFlags));
|
||||
}
|
||||
if (!mCbTexture->mTexImage || mCbTexture->mTexImage->GetSize() != gfxCbCrSize) {
|
||||
mCbTexture->mTexImage = CreateBasicTextureImage(mGL,
|
||||
gfxCbCrSize,
|
||||
gfxASurface::CONTENT_ALPHA,
|
||||
WrapMode(mGL, mFlags & AllowRepeat),
|
||||
WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
|
||||
FlagsToGLFlags(mFlags));
|
||||
}
|
||||
if (!mCrTexture->mTexImage || mCrTexture->mTexImage->GetSize() != gfxCbCrSize) {
|
||||
mCrTexture->mTexImage = CreateBasicTextureImage(mGL,
|
||||
gfxCbCrSize,
|
||||
gfxASurface::CONTENT_ALPHA,
|
||||
WrapMode(mGL, mFlags & AllowRepeat),
|
||||
WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
|
||||
FlagsToGLFlags(mFlags));
|
||||
}
|
||||
|
||||
|
@ -828,7 +828,7 @@ TiledDeprecatedTextureHostOGL::Update(gfxReusableSurfaceWrapper* aReusableSurfac
|
|||
{
|
||||
mSize = aSize;
|
||||
mGL->MakeCurrent();
|
||||
if (aFlags & NewTile) {
|
||||
if (aFlags & TEXTURE_NEW_TILE) {
|
||||
SetFlags(aFlags);
|
||||
mGL->fGenTextures(1, &mTextureHandle);
|
||||
mGL->fBindTexture(LOCAL_GL_TEXTURE_2D, mTextureHandle);
|
||||
|
@ -1107,7 +1107,7 @@ GrallocDeprecatedTextureHostOGL::GetRenderState()
|
|||
{
|
||||
if (mGraphicBuffer.get()) {
|
||||
|
||||
uint32_t flags = mFlags & NeedsYFlip ? LAYER_RENDER_STATE_Y_FLIPPED : 0;
|
||||
uint32_t flags = mFlags & TEXTURE_NEEDS_Y_FLIP ? LAYER_RENDER_STATE_Y_FLIPPED : 0;
|
||||
|
||||
/*
|
||||
* The 32 bit format of gralloc buffer is created as RGBA8888 or RGBX888 by default.
|
||||
|
|
Загрузка…
Ссылка в новой задаче