Bug 1102895 - Remove unused TextureFlags. r=sotaro

This commit is contained in:
Nicolas Silva 2014-11-25 20:19:04 +01:00
parent 7886743c26
commit 5400a728de
6 changed files with 23 additions and 59 deletions

View File

@ -19,32 +19,21 @@
namespace mozilla {
namespace layers {
typedef int32_t SurfaceDescriptorType;
const SurfaceDescriptorType SURFACEDESCRIPTOR_UNKNOWN = 0;
/**
* Flags used by texture clients and texture hosts. These are passed from client
* side to host side when textures and compositables are created. Usually set
* by the compositableCient, they may be modified by either the compositable or
* texture clients.
*
* XXX - switch to all caps constant names which seems to be the standard in gecko
*/
MOZ_BEGIN_ENUM_CLASS(TextureFlags, uint32_t)
NO_FLAGS = 0,
// Use nearest-neighbour texture filtering (as opposed to linear filtering).
USE_NEAREST_FILTER = 1 << 0,
// The texture should be flipped around the y-axis when composited.
// The texture should be flipped along the y-axis when composited.
NEEDS_Y_FLIP = 1 << 1,
// Force the texture to be represented using a single tile (note that this means
// tiled textures, not tiled layers).
DISALLOW_BIGIMAGE = 1 << 2,
// Allow using 'repeat' mode for wrapping.
ALLOW_REPEAT = 1 << 3,
// The texture represents a tile which is newly created.
NEW_TILE = 1 << 4,
// The texture is part of a component-alpha pair
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.
@ -52,45 +41,32 @@ MOZ_BEGIN_ENUM_CLASS(TextureFlags, uint32_t)
// For example, if the GraphicBuffer has an Android pixel format of
// PIXEL_FORMAT_RGBA_8888 and isRBSwapped is true, when it is sampled
// (for example, with GL), a BGRA shader should be used.
RB_SWAPPED = 1 << 6,
FRONT = 1 << 7,
// A texture host on white for component alpha
ON_WHITE = 1 << 8,
// A texture host on black for component alpha
ON_BLACK = 1 << 9,
// A texture host that supports tiling
TILE = 1 << 10,
// A texture should be recycled when no longer in used
RECYCLE = 1 << 11,
// Texture contents should be initialized
// from the previous texture.
COPY_PREVIOUS = 1 << 12,
// Who is responsible for deallocating the shared data.
// if DEALLOCATE_CLIENT is set, the shared data is deallocated on the
RB_SWAPPED = 1 << 3,
// Data in this texture has not been alpha-premultiplied.
// XXX - Apparently only used with ImageClient/Host
NON_PREMULTIPLIED = 1 << 4,
// The texture should be recycled when no longer in used
RECYCLE = 1 << 5,
// If DEALLOCATE_CLIENT is set, the shared data is deallocated on the
// client side and requires some extra synchronizaion to ensure race-free
// deallocation.
// The default behaviour is to deallocate on the host side.
DEALLOCATE_CLIENT = 1 << 13,
DEALLOCATE_CLIENT = 1 << 6,
// After being shared ith the compositor side, an immutable texture is never
// modified, it can only be read. It is safe to not Lock/Unlock immutable
// textures.
IMMUTABLE = 1 << 14,
IMMUTABLE = 1 << 7,
// The contents of the texture must be uploaded or copied immediately
// during the transaction, because the producer may want to write
// to it again.
IMMEDIATE_UPLOAD = 1 << 15,
// The texture is going to be used as part of a double
// buffered pair, and so we can guarantee that the producer/consumer
// won't be racing to access its contents.
DOUBLE_BUFFERED = 1 << 16,
// Data in this texture has not been alpha-premultiplied.
NON_PREMULTIPLIED = 1 << 18,
IMMEDIATE_UPLOAD = 1 << 8,
// The texture is part of a component-alpha pair
COMPONENT_ALPHA = 1 << 9,
// OR union of all valid bits
ALL_BITS = (1 << 19) - 1,
ALL_BITS = (1 << 10) - 1,
// the default flags
DEFAULT = FRONT
DEFAULT = NO_FLAGS
MOZ_END_ENUM_CLASS(TextureFlags)
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(TextureFlags)
@ -101,7 +77,6 @@ TextureRequiresLocking(TextureFlags aFlags)
// within a transaction, then we need to support
// locking correctly.
return !(aFlags & (TextureFlags::IMMEDIATE_UPLOAD |
TextureFlags::DOUBLE_BUFFERED |
TextureFlags::IMMUTABLE));
}
@ -176,6 +151,7 @@ MOZ_END_ENUM_CLASS(CompositableType)
/**
* How the texture host is used for composition,
* XXX - Only used by ContentClientIncremental
*/
MOZ_BEGIN_ENUM_CLASS(DeprecatedTextureHostFlags, uint8_t)
DEFAULT = 0, // The default texture host for the given SurfaceDescriptor
@ -217,8 +193,8 @@ struct TextureFactoryIdentifier
/**
* Identify a texture to a compositable. Many textures can have the same id, but
* the id is unique for any texture owned by a particular compositable.
* XXX - This is now redundant with TextureFlags. it ill be removed along with
* deprecated texture classes.
* XXX - We don't really need this, it will be removed along with the incremental
* ContentClient/Host.
*/
MOZ_BEGIN_ENUM_CLASS(TextureIdentifier, uint8_t)
Front = 1,
@ -238,6 +214,7 @@ MOZ_END_ENUM_CLASS(TextureIdentifier)
struct TextureInfo
{
CompositableType mCompositableType;
// XXX - only used by ContentClientIncremental
DeprecatedTextureHostFlags mDeprecatedTextureHostFlags;
TextureFlags mTextureFlags;

View File

@ -291,8 +291,6 @@ AppendToString(std::stringstream& aStream, TextureFlags flags,
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

@ -537,7 +537,7 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer,
nsIntRect drawBounds = result.mRegionToDraw.GetBounds();
RefPtr<DrawTarget> destDTBuffer;
RefPtr<DrawTarget> destDTBufferOnWhite;
uint32_t bufferFlags = canHaveRotation ? ALLOW_REPEAT : 0;
uint32_t bufferFlags = 0;
if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
bufferFlags |= BUFFER_COMPONENT_ALPHA;
}

View File

@ -302,14 +302,12 @@ public:
DrawIterator* aIter = nullptr);
enum {
ALLOW_REPEAT = 0x01,
BUFFER_COMPONENT_ALPHA = 0x02 // Dual buffers should be created for drawing with
// component alpha.
};
/**
* Return a new surface of |aSize| and |aType|.
* @param aFlags if ALLOW_REPEAT is set, then the buffer should be configured
* to allow repeat-mode, otherwise it should be in pad (clamp) mode
*
* If the created buffer supports azure content, then the result(s) will
* be returned in aBlackDT/aWhiteDT, otherwise aBlackSurface/aWhiteSurface
* will be used.

View File

@ -145,7 +145,7 @@ ClientImageLayer::RenderLayer()
if (type == CompositableType::BUFFER_UNKNOWN) {
return;
}
TextureFlags flags = TextureFlags::FRONT;
TextureFlags flags = TextureFlags::DEFAULT;
if (mDisallowBigImage) {
flags |= TextureFlags::DISALLOW_BIGIMAGE;
}

View File

@ -56,10 +56,6 @@ static TextureFlags TextureFlagsForRotatedContentBufferFlags(uint32_t aBufferFla
result |= TextureFlags::COMPONENT_ALPHA;
}
if (aBufferFlags & RotatedContentBuffer::ALLOW_REPEAT) {
result |= TextureFlags::ALLOW_REPEAT;
}
return result;
}
@ -702,9 +698,7 @@ ContentClientIncremental::BeginPaintBuffer(PaintedLayer* aLayer,
neededRegion = aLayer->GetVisibleRegion();
// If we're going to resample, we need a buffer that's in clamp mode.
canReuseBuffer = neededRegion.GetBounds().Size() <= mBufferRect.Size() &&
mHasBuffer &&
(!(aFlags & RotatedContentBuffer::PAINT_WILL_RESAMPLE) ||
!(mTextureInfo.mTextureFlags & TextureFlags::ALLOW_REPEAT));
mHasBuffer && !(aFlags & RotatedContentBuffer::PAINT_WILL_RESAMPLE);
if (canReuseBuffer) {
if (mBufferRect.Contains(neededRegion.GetBounds())) {
@ -800,9 +794,6 @@ ContentClientIncremental::BeginPaintBuffer(PaintedLayer* aLayer,
bool createdBuffer = false;
TextureFlags bufferFlags = TextureFlags::NO_FLAGS;
if (canHaveRotation) {
bufferFlags |= TextureFlags::ALLOW_REPEAT;
}
if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
bufferFlags |= TextureFlags::COMPONENT_ALPHA;
}