Bug 987311 - 5/6 - Convert the rest of CompositorTypes.h to typed enums, auto regex changes - r=nical

This commit is contained in:
Benoit Jacob 2014-04-25 22:34:06 -04:00
Родитель ea45d9907c
Коммит dc0b0c8367
39 изменённых файлов: 197 добавлений и 197 удалений

Просмотреть файл

@ -51,11 +51,11 @@ Compositor::AssertOnCompositorThread()
bool
Compositor::ShouldDrawDiagnostics(DiagnosticFlags aFlags)
{
if ((aFlags & DIAGNOSTIC_TILE) && !(mDiagnosticTypes & DIAGNOSTIC_TILE_BORDERS)) {
if ((aFlags & DiagnosticFlags::TILE) && !(mDiagnosticTypes & DiagnosticTypes::TILE_BORDERS)) {
return false;
}
if ((aFlags & DIAGNOSTIC_BIGIMAGE) &&
!(mDiagnosticTypes & DIAGNOSTIC_BIGIMAGE_BORDERS)) {
if ((aFlags & DiagnosticFlags::BIGIMAGE) &&
!(mDiagnosticTypes & DiagnosticTypes::BIGIMAGE_BORDERS)) {
return false;
}
if (!mDiagnosticTypes) {
@ -80,7 +80,7 @@ Compositor::DrawDiagnostics(DiagnosticFlags aFlags,
while (const nsIntRect* rect = screenIter.Next())
{
DrawDiagnostics(aFlags | DIAGNOSTIC_REGION_RECT,
DrawDiagnostics(aFlags | DiagnosticFlags::REGION_RECT,
ToRect(*rect), aClipRect, aTransform, aFlashCounter);
}
}
@ -153,23 +153,23 @@ Compositor::DrawDiagnosticsInternal(DiagnosticFlags aFlags,
float opacity = 0.7f;
gfx::Color color;
if (aFlags & DIAGNOSTIC_CONTENT) {
if (aFlags & DiagnosticFlags::CONTENT) {
color = gfx::Color(0.0f, 1.0f, 0.0f, 1.0f); // green
if (aFlags & DIAGNOSTIC_COMPONENT_ALPHA) {
if (aFlags & DiagnosticFlags::COMPONENT_ALPHA) {
color = gfx::Color(0.0f, 1.0f, 1.0f, 1.0f); // greenish blue
}
} else if (aFlags & DIAGNOSTIC_IMAGE) {
} else if (aFlags & DiagnosticFlags::IMAGE) {
color = gfx::Color(1.0f, 0.0f, 0.0f, 1.0f); // red
} else if (aFlags & DIAGNOSTIC_COLOR) {
} else if (aFlags & DiagnosticFlags::COLOR) {
color = gfx::Color(0.0f, 0.0f, 1.0f, 1.0f); // blue
} else if (aFlags & DIAGNOSTIC_CONTAINER) {
} else if (aFlags & DiagnosticFlags::CONTAINER) {
color = gfx::Color(0.8f, 0.0f, 0.8f, 1.0f); // purple
}
// make tile borders a bit more transparent to keep layer borders readable.
if (aFlags & DIAGNOSTIC_TILE ||
aFlags & DIAGNOSTIC_BIGIMAGE ||
aFlags & DIAGNOSTIC_REGION_RECT) {
if (aFlags & DiagnosticFlags::TILE ||
aFlags & DiagnosticFlags::BIGIMAGE ||
aFlags & DiagnosticFlags::REGION_RECT) {
lWidth = 1;
opacity = 0.5f;
color.r *= 0.7f;
@ -177,7 +177,7 @@ Compositor::DrawDiagnosticsInternal(DiagnosticFlags aFlags,
color.b *= 0.7f;
}
if (mDiagnosticTypes & DIAGNOSTIC_FLASH_BORDERS) {
if (mDiagnosticTypes & DiagnosticTypes::FLASH_BORDERS) {
float flash = (float)aFlashCounter / (float)DIAGNOSTIC_FLASH_COUNTER_MAX;
color.r *= flash;
color.g *= flash;

Просмотреть файл

@ -199,7 +199,7 @@ public:
Compositor(PCompositorParent* aParent = nullptr)
: mCompositorID(0)
, mDiagnosticTypes(DIAGNOSTIC_NONE)
, mDiagnosticTypes(DiagnosticTypes::NO_DIAGNOSTIC)
, mParent(aParent)
, mScreenRotation(ROTATION_0)
{

Просмотреть файл

@ -80,7 +80,7 @@ struct EffectMask : public Effect
EffectMask(TextureSource *aMaskTexture,
gfx::IntSize aSize,
const gfx::Matrix4x4 &aMaskTransform)
: Effect(EFFECT_MASK)
: Effect(EffectTypes::MASK)
, mMaskTexture(aMaskTexture)
, mIs3D(false)
, mSize(aSize)
@ -99,7 +99,7 @@ struct EffectMask : public Effect
struct EffectRenderTarget : public TexturedEffect
{
EffectRenderTarget(CompositingRenderTarget *aRenderTarget)
: TexturedEffect(EFFECT_RENDER_TARGET, aRenderTarget, true, gfx::Filter::LINEAR)
: TexturedEffect(EffectTypes::RENDER_TARGET, aRenderTarget, true, gfx::Filter::LINEAR)
, mRenderTarget(aRenderTarget)
{}
@ -115,7 +115,7 @@ struct EffectRGB : public TexturedEffect
bool aPremultiplied,
gfx::Filter aFilter,
bool aFlipped = false)
: TexturedEffect(EFFECT_RGB, aTexture, aPremultiplied, aFilter)
: TexturedEffect(EffectTypes::RGB, aTexture, aPremultiplied, aFilter)
{}
virtual const char* Name() { return "EffectRGB"; }
@ -124,7 +124,7 @@ struct EffectRGB : public TexturedEffect
struct EffectYCbCr : public TexturedEffect
{
EffectYCbCr(TextureSource *aSource, gfx::Filter aFilter)
: TexturedEffect(EFFECT_YCBCR, aSource, false, aFilter)
: TexturedEffect(EffectTypes::YCBCR, aSource, false, aFilter)
{}
virtual const char* Name() { return "EffectYCbCr"; }
@ -135,7 +135,7 @@ struct EffectComponentAlpha : public TexturedEffect
EffectComponentAlpha(TextureSource *aOnBlack,
TextureSource *aOnWhite,
gfx::Filter aFilter)
: TexturedEffect(EFFECT_COMPONENT_ALPHA, nullptr, false, aFilter)
: TexturedEffect(EffectTypes::COMPONENT_ALPHA, nullptr, false, aFilter)
, mOnBlack(aOnBlack)
, mOnWhite(aOnWhite)
{}
@ -149,7 +149,7 @@ struct EffectComponentAlpha : public TexturedEffect
struct EffectSolidColor : public Effect
{
EffectSolidColor(const gfx::Color &aColor)
: Effect(EFFECT_SOLID_COLOR)
: Effect(EffectTypes::SOLID_COLOR)
, mColor(aColor)
{}
@ -164,7 +164,7 @@ struct EffectChain
explicit EffectChain(void* aLayerRef) : mLayerRef(aLayerRef) {}
RefPtr<Effect> mPrimaryEffect;
RefPtr<Effect> mSecondaryEffects[EFFECT_MAX_SECONDARY];
RefPtr<Effect> mSecondaryEffects[EffectTypes::MAX_SECONDARY];
void* mLayerRef; //!< For LayerScope logging
};

Просмотреть файл

@ -131,7 +131,7 @@ ImageContainer::ImageContainer(int flag)
if (flag == ENABLE_ASYNC && ImageBridgeChild::IsCreated()) {
// the refcount of this ImageClient is 1. we don't use a RefPtr here because the refcount
// of this class must be done on the ImageBridge thread.
mImageClient = ImageBridgeChild::GetSingleton()->CreateImageClient(BUFFER_IMAGE_SINGLE).drop();
mImageClient = ImageBridgeChild::GetSingleton()->CreateImageClient(CompositableType::BUFFER_IMAGE_SINGLE).drop();
MOZ_ASSERT(mImageClient);
}
}
@ -629,7 +629,7 @@ CairoImage::GetTextureClient(CompositableClient *aClient)
surface->GetSize());
MOZ_ASSERT(textureClient->CanExposeDrawTarget());
if (!textureClient->AllocateForSurface(surface->GetSize()) ||
!textureClient->Lock(OPEN_WRITE_ONLY)) {
!textureClient->Lock(OpenMode::OPEN_WRITE_ONLY)) {
return nullptr;
}

Просмотреть файл

@ -778,20 +778,20 @@ LayerScope::SendEffectChain(GLContext* aGLContext,
const Effect* primaryEffect = aEffectChain.mPrimaryEffect;
switch (primaryEffect->mType) {
case EFFECT_RGB:
case EffectTypes::RGB:
{
const TexturedEffect* texturedEffect =
static_cast<const TexturedEffect*>(primaryEffect);
SendTexturedEffect(aGLContext, aEffectChain.mLayerRef, texturedEffect);
}
break;
case EFFECT_YCBCR:
case EffectTypes::YCBCR:
{
const EffectYCbCr* yCbCrEffect =
static_cast<const EffectYCbCr*>(primaryEffect);
SendYCbCrEffect(aGLContext, aEffectChain.mLayerRef, yCbCrEffect);
}
case EFFECT_SOLID_COLOR:
case EffectTypes::SOLID_COLOR:
{
const EffectSolidColor* solidColorEffect =
static_cast<const EffectSolidColor*>(primaryEffect);
@ -802,13 +802,13 @@ LayerScope::SendEffectChain(GLContext* aGLContext,
SendColor(aEffectChain.mLayerRef, color, aWidth, aHeight);
}
break;
case EFFECT_COMPONENT_ALPHA:
case EFFECT_RENDER_TARGET:
case EffectTypes::COMPONENT_ALPHA:
case EffectTypes::RENDER_TARGET:
default:
break;
}
//const Effect* secondaryEffect = aEffectChain.mSecondaryEffects[EFFECT_MASK];
//const Effect* secondaryEffect = aEffectChain.mSecondaryEffects[EffectTypes::MASK];
// TODO:
}

Просмотреть файл

@ -126,7 +126,7 @@ BasicCompositor::CreateDataTextureSource(TextureFlags aFlags)
bool
BasicCompositor::SupportsEffect(EffectTypes aEffect)
{
return static_cast<EffectTypes>(aEffect) != EFFECT_YCBCR;
return static_cast<EffectTypes>(aEffect) != EffectTypes::YCBCR;
}
static void
@ -291,8 +291,8 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect,
RefPtr<SourceSurface> sourceMask;
Matrix maskTransform;
if (aEffectChain.mSecondaryEffects[EFFECT_MASK]) {
EffectMask *effectMask = static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EFFECT_MASK].get());
if (aEffectChain.mSecondaryEffects[EffectTypes::MASK]) {
EffectMask *effectMask = static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EffectTypes::MASK].get());
sourceMask = effectMask->mMaskTexture->AsSourceBasic()->GetSurface();
MOZ_ASSERT(effectMask->mMaskTransform.Is2D(), "How did we end up with a 3D transform here?!");
MOZ_ASSERT(!effectMask->mIs3D);
@ -301,7 +301,7 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect,
}
switch (aEffectChain.mPrimaryEffect->mType) {
case EFFECT_SOLID_COLOR: {
case EffectTypes::SOLID_COLOR: {
EffectSolidColor* effectSolidColor =
static_cast<EffectSolidColor*>(aEffectChain.mPrimaryEffect.get());
@ -309,7 +309,7 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect,
DrawOptions(aOpacity), sourceMask, &maskTransform);
break;
}
case EFFECT_RGB: {
case EffectTypes::RGB: {
TexturedEffect* texturedEffect =
static_cast<TexturedEffect*>(aEffectChain.mPrimaryEffect.get());
TextureSourceBasic* source = texturedEffect->mTexture->AsSourceBasic();
@ -321,11 +321,11 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect,
aOpacity, sourceMask, &maskTransform);
break;
}
case EFFECT_YCBCR: {
case EffectTypes::YCBCR: {
NS_RUNTIMEABORT("Can't (easily) support component alpha with BasicCompositor!");
break;
}
case EFFECT_RENDER_TARGET: {
case EffectTypes::RENDER_TARGET: {
EffectRenderTarget* effectRenderTarget =
static_cast<EffectRenderTarget*>(aEffectChain.mPrimaryEffect.get());
RefPtr<BasicCompositingRenderTarget> surface
@ -339,7 +339,7 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect,
aOpacity, sourceMask, &maskTransform);
break;
}
case EFFECT_COMPONENT_ALPHA: {
case EffectTypes::COMPONENT_ALPHA: {
NS_RUNTIMEABORT("Can't (easily) support component alpha with BasicCompositor!");
break;
}

Просмотреть файл

@ -79,7 +79,7 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
bufferCreated = true;
}
if (!mBuffer->Lock(OPEN_WRITE_ONLY)) {
if (!mBuffer->Lock(OpenMode::OPEN_WRITE_ONLY)) {
mBuffer = nullptr;
return;
}

Просмотреть файл

@ -79,7 +79,7 @@ public:
TextureInfo GetTextureInfo() const
{
return TextureInfo(COMPOSITABLE_IMAGE);
return TextureInfo(CompositableType::IMAGE);
}
virtual void Clear() MOZ_OVERRIDE
@ -113,7 +113,7 @@ public:
TextureInfo GetTextureInfo() const
{
return TextureInfo(COMPOSITABLE_IMAGE);
return TextureInfo(CompositableType::IMAGE);
}
virtual void Clear() MOZ_OVERRIDE

Просмотреть файл

@ -29,7 +29,7 @@ public:
ClientImageLayer(ClientLayerManager* aLayerManager)
: ImageLayer(aLayerManager,
static_cast<ClientLayer*>(MOZ_THIS_IN_INITIALIZER_LIST()))
, mImageClientTypeContainer(BUFFER_UNKNOWN)
, mImageClientTypeContainer(CompositableType::BUFFER_UNKNOWN)
{
MOZ_COUNT_CTOR(ClientImageLayer);
}
@ -42,7 +42,7 @@ public:
virtual void SetContainer(ImageContainer* aContainer) MOZ_OVERRIDE
{
ImageLayer::SetContainer(aContainer);
mImageClientTypeContainer = BUFFER_UNKNOWN;
mImageClientTypeContainer = CompositableType::BUFFER_UNKNOWN;
}
virtual void SetVisibleRegion(const nsIntRegion& aRegion)
@ -94,12 +94,12 @@ protected:
CompositableType GetImageClientType()
{
if (mImageClientTypeContainer != BUFFER_UNKNOWN) {
if (mImageClientTypeContainer != CompositableType::BUFFER_UNKNOWN) {
return mImageClientTypeContainer;
}
if (mContainer->IsAsync()) {
mImageClientTypeContainer = BUFFER_BRIDGE;
mImageClientTypeContainer = CompositableType::BUFFER_BRIDGE;
return mImageClientTypeContainer;
}
@ -107,13 +107,13 @@ protected:
AutoLockImage autoLock(mContainer, &surface);
#ifdef MOZ_WIDGET_GONK
// gralloc buffer needs BUFFER_IMAGE_BUFFERED to prevent
// gralloc buffer needs CompositableType::BUFFER_IMAGE_BUFFERED to prevent
// the buffer's usage conflict.
mImageClientTypeContainer = autoLock.GetImage() ?
BUFFER_IMAGE_BUFFERED : BUFFER_UNKNOWN;
CompositableType::BUFFER_IMAGE_BUFFERED : CompositableType::BUFFER_UNKNOWN;
#else
mImageClientTypeContainer = autoLock.GetImage() ?
BUFFER_IMAGE_SINGLE : BUFFER_UNKNOWN;
CompositableType::BUFFER_IMAGE_SINGLE : CompositableType::BUFFER_UNKNOWN;
#endif
return mImageClientTypeContainer;
}
@ -140,7 +140,7 @@ ClientImageLayer::RenderLayer()
if (!mImageClient ||
!mImageClient->UpdateImage(mContainer, GetContentFlags())) {
CompositableType type = GetImageClientType();
if (type == BUFFER_UNKNOWN) {
if (type == CompositableType::BUFFER_UNKNOWN) {
return;
}
TextureFlags flags = TextureFlags::FRONT;
@ -150,7 +150,7 @@ ClientImageLayer::RenderLayer()
mImageClient = ImageClient::CreateImageClient(type,
ClientManager()->AsShadowForwarder(),
flags);
if (type == BUFFER_BRIDGE) {
if (type == CompositableType::BUFFER_BRIDGE) {
static_cast<ImageClientBridge*>(mImageClient.get())->SetLayer(this);
}

Просмотреть файл

@ -267,12 +267,12 @@ ContentClientRemoteBuffer::CreateBuffer(ContentType aType,
// We just created the textures and we are about to get their draw targets
// so we have to lock them here.
DebugOnly<bool> locked = mTextureClient->Lock(OPEN_READ_WRITE);
DebugOnly<bool> locked = mTextureClient->Lock(OpenMode::OPEN_READ_WRITE);
MOZ_ASSERT(locked, "Could not lock the TextureClient");
*aBlackDT = mTextureClient->GetAsDrawTarget();
if (aFlags & BUFFER_COMPONENT_ALPHA) {
locked = mTextureClientOnWhite->Lock(OPEN_READ_WRITE);
locked = mTextureClientOnWhite->Lock(OpenMode::OPEN_READ_WRITE);
MOZ_ASSERT(locked, "Could not lock the second TextureClient for component alpha");
*aWhiteDT = mTextureClientOnWhite->GetAsDrawTarget();
@ -426,11 +426,11 @@ void
ContentClientDoubleBuffered::FinalizeFrame(const nsIntRegion& aRegionToDraw)
{
if (mTextureClient) {
DebugOnly<bool> locked = mTextureClient->Lock(OPEN_READ_WRITE);
DebugOnly<bool> locked = mTextureClient->Lock(OpenMode::OPEN_READ_WRITE);
MOZ_ASSERT(locked);
}
if (mTextureClientOnWhite) {
DebugOnly<bool> locked = mTextureClientOnWhite->Lock(OPEN_READ_WRITE);
DebugOnly<bool> locked = mTextureClientOnWhite->Lock(OpenMode::OPEN_READ_WRITE);
MOZ_ASSERT(locked);
}
@ -464,11 +464,11 @@ ContentClientDoubleBuffered::FinalizeFrame(const nsIntRegion& aRegionToDraw)
// We need to ensure that we lock these two buffers in the same
// order as the compositor to prevent deadlocks.
if (!mFrontClient->Lock(OPEN_READ_ONLY)) {
if (!mFrontClient->Lock(OpenMode::OPEN_READ_ONLY)) {
return;
}
if (mFrontClientOnWhite &&
!mFrontClientOnWhite->Lock(OPEN_READ_ONLY)) {
!mFrontClientOnWhite->Lock(OpenMode::OPEN_READ_ONLY)) {
mFrontClient->Unlock();
return;
}
@ -539,11 +539,11 @@ void
ContentClientSingleBuffered::FinalizeFrame(const nsIntRegion& aRegionToDraw)
{
if (mTextureClient) {
DebugOnly<bool> locked = mTextureClient->Lock(OPEN_READ_WRITE);
DebugOnly<bool> locked = mTextureClient->Lock(OpenMode::OPEN_READ_WRITE);
MOZ_ASSERT(locked);
}
if (mTextureClientOnWhite) {
DebugOnly<bool> locked = mTextureClientOnWhite->Lock(OPEN_READ_WRITE);
DebugOnly<bool> locked = mTextureClientOnWhite->Lock(OpenMode::OPEN_READ_WRITE);
MOZ_ASSERT(locked);
}
}
@ -754,7 +754,7 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer,
if (createdBuffer) {
if (mHasBuffer &&
(mode != SurfaceMode::SURFACE_COMPONENT_ALPHA || mHasBufferOnWhite)) {
mTextureInfo.mDeprecatedTextureHostFlags = TEXTURE_HOST_COPY_PREVIOUS;
mTextureInfo.mDeprecatedTextureHostFlags = DeprecatedTextureHostFlags::COPY_PREVIOUS;
}
mHasBuffer = true;
@ -851,7 +851,7 @@ ContentClientIncremental::Updated(const nsIntRegion& aRegionToDraw,
{
if (IsSurfaceDescriptorValid(mUpdateDescriptor)) {
mForwarder->UpdateTextureIncremental(this,
TextureFront,
TextureIdentifier::Front,
mUpdateDescriptor,
aRegionToDraw,
mBufferRect,
@ -860,7 +860,7 @@ ContentClientIncremental::Updated(const nsIntRegion& aRegionToDraw,
}
if (IsSurfaceDescriptorValid(mUpdateDescriptorOnWhite)) {
mForwarder->UpdateTextureIncremental(this,
TextureOnWhiteFront,
TextureIdentifier::OnWhiteFront,
mUpdateDescriptorOnWhite,
aRegionToDraw,
mBufferRect,

Просмотреть файл

@ -314,7 +314,7 @@ public:
ContentClientDoubleBuffered(CompositableForwarder* aFwd)
: ContentClientRemoteBuffer(aFwd)
{
mTextureInfo.mCompositableType = COMPOSITABLE_CONTENT_DOUBLE;
mTextureInfo.mCompositableType = CompositableType::CONTENT_DOUBLE;
}
virtual ~ContentClientDoubleBuffered() {}
@ -368,7 +368,7 @@ public:
ContentClientSingleBuffered(CompositableForwarder* aFwd)
: ContentClientRemoteBuffer(aFwd)
{
mTextureInfo.mCompositableType = COMPOSITABLE_CONTENT_SINGLE;
mTextureInfo.mCompositableType = CompositableType::CONTENT_SINGLE;
}
virtual ~ContentClientSingleBuffered() {}
@ -394,7 +394,7 @@ public:
, mHasBuffer(false)
, mHasBufferOnWhite(false)
{
mTextureInfo.mCompositableType = BUFFER_CONTENT_INC;
mTextureInfo.mCompositableType = CompositableType::BUFFER_CONTENT_INC;
}
typedef RotatedContentBuffer::PaintState PaintState;

Просмотреть файл

@ -48,17 +48,17 @@ ImageClient::CreateImageClient(CompositableType aCompositableHostType,
{
RefPtr<ImageClient> result = nullptr;
switch (aCompositableHostType) {
case COMPOSITABLE_IMAGE:
case BUFFER_IMAGE_SINGLE:
result = new ImageClientSingle(aForwarder, aFlags, COMPOSITABLE_IMAGE);
case CompositableType::IMAGE:
case CompositableType::BUFFER_IMAGE_SINGLE:
result = new ImageClientSingle(aForwarder, aFlags, CompositableType::IMAGE);
break;
case BUFFER_IMAGE_BUFFERED:
result = new ImageClientBuffered(aForwarder, aFlags, COMPOSITABLE_IMAGE);
case CompositableType::BUFFER_IMAGE_BUFFERED:
result = new ImageClientBuffered(aForwarder, aFlags, CompositableType::IMAGE);
break;
case BUFFER_BRIDGE:
case CompositableType::BUFFER_BRIDGE:
result = new ImageClientBridge(aForwarder, aFlags);
break;
case BUFFER_UNKNOWN:
case CompositableType::BUFFER_UNKNOWN:
result = nullptr;
break;
default:
@ -86,7 +86,7 @@ ImageClientBuffered::ImageClientBuffered(CompositableForwarder* aFwd,
TextureInfo ImageClientSingle::GetTextureInfo() const
{
return TextureInfo(COMPOSITABLE_IMAGE);
return TextureInfo(CompositableType::IMAGE);
}
void
@ -174,7 +174,7 @@ ImageClientSingle::UpdateImageInternal(ImageContainer* aContainer,
bufferCreated = true;
}
if (!mFrontBuffer->Lock(OPEN_WRITE_ONLY)) {
if (!mFrontBuffer->Lock(OpenMode::OPEN_WRITE_ONLY)) {
mFrontBuffer = nullptr;
return false;
}
@ -242,7 +242,7 @@ ImageClientSingle::UpdateImageInternal(ImageContainer* aContainer,
bufferCreated = true;
}
if (!mFrontBuffer->Lock(OPEN_WRITE_ONLY)) {
if (!mFrontBuffer->Lock(OpenMode::OPEN_WRITE_ONLY)) {
mFrontBuffer = nullptr;
return false;
}
@ -335,7 +335,7 @@ ImageClient::UpdatePictureRect(nsIntRect aRect)
ImageClientBridge::ImageClientBridge(CompositableForwarder* aFwd,
TextureFlags aFlags)
: ImageClient(aFwd, aFlags, BUFFER_BRIDGE)
: ImageClient(aFwd, aFlags, CompositableType::BUFFER_BRIDGE)
, mAsyncContainerID(0)
, mLayer(nullptr)
{

Просмотреть файл

@ -90,7 +90,7 @@ SimpleTiledLayerBuffer::ValidateTile(SimpleTiledLayerTile aTile,
return SimpleTiledLayerTile();
}
if (!textureClient->Lock(OPEN_READ_WRITE)) {
if (!textureClient->Lock(OpenMode::OPEN_READ_WRITE)) {
NS_WARNING("TextureClient lock failed");
return SimpleTiledLayerTile();
}

Просмотреть файл

@ -144,7 +144,7 @@ public:
virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
{
return TextureInfo(BUFFER_SIMPLE_TILED);
return TextureInfo(CompositableType::BUFFER_SIMPLE_TILED);
}
void UseTiledLayerBuffer();

Просмотреть файл

@ -716,7 +716,7 @@ BufferTextureClient::GetAsDrawTarget()
}
mUsingFallbackDrawTarget = true;
if (mOpenMode & OPEN_READ) {
if (mOpenMode & OpenMode::OPEN_READ) {
RefPtr<DataSourceSurface> surface = serializer.GetAsSurface();
IntRect rect(0, 0, surface->GetSize().width, surface->GetSize().height);
mDrawTarget->CopySurface(surface, rect, IntPoint(0,0));
@ -750,7 +750,7 @@ BufferTextureClient::Unlock()
MOZ_ASSERT(mDrawTarget->refCount() == 1);
mDrawTarget->Flush();
if (mUsingFallbackDrawTarget && (mOpenMode & OPEN_WRITE)) {
if (mUsingFallbackDrawTarget && (mOpenMode & OpenMode::OPEN_WRITE)) {
// When we are using a fallback DrawTarget, it means we could not create
// a DrawTarget wrapping the TextureClient's shared memory. In this scenario
// we need to put the content of the fallback draw target back into our shared

Просмотреть файл

@ -175,7 +175,7 @@ public:
*
* This is typically used as follows:
*
* if (!texture->Lock(OPEN_READ_WRITE)) {
* if (!texture->Lock(OpenMode::OPEN_READ_WRITE)) {
* return false;
* }
* {

Просмотреть файл

@ -443,13 +443,13 @@ TileClient::ValidateBackBufferFromFront(const nsIntRegion& aDirtyRegion,
return;
}
if (!mFrontBuffer->Lock(OPEN_READ)) {
if (!mFrontBuffer->Lock(OpenMode::OPEN_READ)) {
NS_WARNING("Failed to lock the tile's front buffer");
return;
}
TextureClientAutoUnlock autoFront(mFrontBuffer);
if (!mBackBuffer->Lock(OPEN_WRITE)) {
if (!mBackBuffer->Lock(OpenMode::OPEN_WRITE)) {
NS_WARNING("Failed to lock the tile's back buffer");
return;
}
@ -749,7 +749,7 @@ ClientTiledLayerBuffer::ValidateTile(TileClient aTile,
mManager->GetTexturePool(gfxPlatform::GetPlatform()->Optimal2DFormatForContent(GetContentType())),
&createdTextureClient, !usingSinglePaintBuffer);
if (!backBuffer->Lock(OPEN_READ_WRITE)) {
if (!backBuffer->Lock(OpenMode::OPEN_READ_WRITE)) {
NS_WARNING("Failed to lock tile TextureClient for updating.");
aTile.DiscardFrontBuffer();
return aTile;

Просмотреть файл

@ -483,7 +483,7 @@ public:
virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
{
return TextureInfo(BUFFER_TILED);
return TextureInfo(CompositableType::BUFFER_TILED);
}
virtual void ClearCachedResources() MOZ_OVERRIDE;

Просмотреть файл

@ -44,9 +44,9 @@ bool
CanvasLayerComposite::SetCompositableHost(CompositableHost* aHost)
{
switch (aHost->GetType()) {
case BUFFER_IMAGE_SINGLE:
case BUFFER_IMAGE_BUFFERED:
case COMPOSITABLE_IMAGE:
case CompositableType::BUFFER_IMAGE_SINGLE:
case CompositableType::BUFFER_IMAGE_BUFFERED:
case CompositableType::IMAGE:
mImageHost = aHost;
return true;
default:

Просмотреть файл

@ -11,7 +11,7 @@
#include "mozilla/gfx/Rect.h" // for Rect
#include "mozilla/gfx/Types.h" // for Color
#include "mozilla/layers/Compositor.h" // for Compositor
#include "mozilla/layers/CompositorTypes.h" // for DIAGNOSTIC_COLOR
#include "mozilla/layers/CompositorTypes.h" // for DiagnosticFlags::COLOR
#include "mozilla/layers/Effects.h" // for Effect, EffectChain, etc
#include "mozilla/mozalloc.h" // for operator delete, etc
#include "nsPoint.h" // for nsIntPoint
@ -43,7 +43,7 @@ ColorLayerComposite::RenderLayer(const nsIntRect& aClipRect)
const gfx::Matrix4x4& transform = GetEffectiveTransform();
mCompositor->DrawQuad(rect, clipRect, effects, opacity, transform);
mCompositor->DrawDiagnostics(DIAGNOSTIC_COLOR,
mCompositor->DrawDiagnostics(DiagnosticFlags::COLOR,
rect, clipRect,
transform);
}

Просмотреть файл

@ -158,7 +158,7 @@ CompositableHost::AddMaskEffect(EffectChain& aEffects,
source->GetSize(),
aTransform);
effect->mIs3D = aIs3D;
aEffects.mSecondaryEffects[EFFECT_MASK] = effect;
aEffects.mSecondaryEffects[EffectTypes::MASK] = effect;
return true;
}
@ -179,23 +179,23 @@ CompositableHost::Create(const TextureInfo& aTextureInfo)
{
RefPtr<CompositableHost> result;
switch (aTextureInfo.mCompositableType) {
case BUFFER_BRIDGE:
case CompositableType::BUFFER_BRIDGE:
NS_ERROR("Cannot create an image bridge compositable this way");
break;
case BUFFER_CONTENT_INC:
case CompositableType::BUFFER_CONTENT_INC:
result = new ContentHostIncremental(aTextureInfo);
break;
case BUFFER_TILED:
case BUFFER_SIMPLE_TILED:
case CompositableType::BUFFER_TILED:
case CompositableType::BUFFER_SIMPLE_TILED:
result = new TiledContentHost(aTextureInfo);
break;
case COMPOSITABLE_IMAGE:
case CompositableType::IMAGE:
result = new ImageHost(aTextureInfo);
break;
case COMPOSITABLE_CONTENT_SINGLE:
case CompositableType::CONTENT_SINGLE:
result = new ContentHostSingleBuffered(aTextureInfo);
break;
case COMPOSITABLE_CONTENT_DOUBLE:
case CompositableType::CONTENT_DOUBLE:
result = new ContentHostDoubleBuffered(aTextureInfo);
break;
default:
@ -203,7 +203,7 @@ CompositableHost::Create(const TextureInfo& aTextureInfo)
}
// We know that Tiled buffers don't use the compositable backend-specific
// data, so don't bother creating it.
if (result && aTextureInfo.mCompositableType != BUFFER_TILED) {
if (result && aTextureInfo.mCompositableType != CompositableType::BUFFER_TILED) {
RefPtr<CompositableBackendSpecificData> data = CreateCompositableBackendSpecificDataOGL();
result->SetCompositableBackendSpecificData(data);
}

Просмотреть файл

@ -18,7 +18,7 @@
#include "mozilla/gfx/Point.h" // for Point, IntPoint
#include "mozilla/gfx/Rect.h" // for IntRect, Rect
#include "mozilla/layers/Compositor.h" // for Compositor, etc
#include "mozilla/layers/CompositorTypes.h" // for DIAGNOSTIC_CONTAINER
#include "mozilla/layers/CompositorTypes.h" // for DiagnosticFlags::CONTAINER
#include "mozilla/layers/Effects.h" // for Effect, EffectChain, etc
#include "mozilla/layers/TextureHost.h" // for CompositingRenderTarget
#include "mozilla/mozalloc.h" // for operator delete, etc
@ -413,7 +413,7 @@ ContainerRender(ContainerT* aContainer,
LayerRect layerBounds = ParentLayerRect(frame.mCompositionBounds) * ParentLayerToLayerScale(1.0);
gfx::Rect rect(layerBounds.x, layerBounds.y, layerBounds.width, layerBounds.height);
gfx::Rect clipRect(aClipRect.x, aClipRect.y, aClipRect.width, aClipRect.height);
aManager->GetCompositor()->DrawDiagnostics(DIAGNOSTIC_CONTAINER,
aManager->GetCompositor()->DrawDiagnostics(DiagnosticFlags::CONTAINER,
rect, clipRect,
aContainer->GetEffectiveTransform());
}

Просмотреть файл

@ -198,8 +198,8 @@ ContentHostBase::Composite(EffectChain& aEffectChain,
Float(tileRegionRect.height) / texRect.height);
GetCompositor()->DrawQuad(rect, aClipRect, aEffectChain, aOpacity, aTransform);
if (usingTiles) {
DiagnosticTypes diagnostics = DIAGNOSTIC_CONTENT | DIAGNOSTIC_BIGIMAGE;
diagnostics |= iterOnWhite ? DIAGNOSTIC_COMPONENT_ALPHA : 0;
DiagnosticTypes diagnostics = DiagnosticFlags::CONTENT | DiagnosticFlags::BIGIMAGE;
diagnostics |= iterOnWhite ? DiagnosticFlags::COMPONENT_ALPHA : 0;
GetCompositor()->DrawDiagnostics(diagnostics, rect, aClipRect,
aTransform, mFlashCounter);
}
@ -219,8 +219,8 @@ ContentHostBase::Composite(EffectChain& aEffectChain,
iterOnWhite->EndTileIteration();
}
DiagnosticTypes diagnostics = DIAGNOSTIC_CONTENT;
diagnostics |= iterOnWhite ? DIAGNOSTIC_COMPONENT_ALPHA : 0;
DiagnosticTypes diagnostics = DiagnosticFlags::CONTENT;
diagnostics |= iterOnWhite ? DiagnosticFlags::COMPONENT_ALPHA : 0;
GetCompositor()->DrawDiagnostics(diagnostics, *aVisibleRegion, aClipRect,
aTransform, mFlashCounter);
}
@ -496,7 +496,7 @@ ContentHostIncremental::TextureCreationRequest::Execute(ContentHostIncremental*
newSourceOnWhite = temp->AsSourceOGL()->AsTextureImageTextureSource();
}
if (mTextureInfo.mDeprecatedTextureHostFlags & TEXTURE_HOST_COPY_PREVIOUS) {
if (mTextureInfo.mDeprecatedTextureHostFlags & DeprecatedTextureHostFlags::COPY_PREVIOUS) {
nsIntRect bufferRect = aHost->mBufferRect;
nsIntPoint bufferRotation = aHost->mBufferRotation;
nsIntRect overlap;
@ -646,7 +646,7 @@ ContentHostIncremental::TextureUpdateRequest::Execute(ContentHostIncremental* aH
RefPtr<DataSourceSurface> surf = GetSurfaceForDescriptor(mDescriptor);
if (mTextureId == TextureFront) {
if (mTextureId == TextureIdentifier::Front) {
aHost->mSource->Update(surf, &mUpdated, &offset);
} else {
aHost->mSourceOnWhite->Update(surf, &mUpdated, &offset);

Просмотреть файл

@ -209,7 +209,7 @@ public:
virtual ~ContentHostDoubleBuffered() {}
virtual CompositableType GetType() { return COMPOSITABLE_CONTENT_DOUBLE; }
virtual CompositableType GetType() { return CompositableType::CONTENT_DOUBLE; }
virtual bool UpdateThebes(const ThebesBufferData& aData,
const nsIntRegion& aUpdated,
@ -232,7 +232,7 @@ public:
{}
virtual ~ContentHostSingleBuffered() {}
virtual CompositableType GetType() { return COMPOSITABLE_CONTENT_SINGLE; }
virtual CompositableType GetType() { return CompositableType::CONTENT_SINGLE; }
virtual bool UpdateThebes(const ThebesBufferData& aData,
const nsIntRegion& aUpdated,
@ -256,7 +256,7 @@ public:
ContentHostIncremental(const TextureInfo& aTextureInfo);
~ContentHostIncremental();
virtual CompositableType GetType() { return BUFFER_CONTENT_INC; }
virtual CompositableType GetType() { return CompositableType::BUFFER_CONTENT_INC; }
virtual LayerRenderState GetRenderState() MOZ_OVERRIDE { return LayerRenderState(); }

Просмотреть файл

@ -126,12 +126,12 @@ ImageHost::Composite(EffectChain& aEffectChain,
}
GetCompositor()->DrawQuad(rect, aClipRect, aEffectChain,
aOpacity, aTransform);
GetCompositor()->DrawDiagnostics(DIAGNOSTIC_IMAGE|DIAGNOSTIC_BIGIMAGE,
GetCompositor()->DrawDiagnostics(DiagnosticFlags::IMAGE|DIAGNOSTIC_BIGIMAGE,
rect, aClipRect, aTransform, mFlashCounter);
} while (it->NextTile());
it->EndTileIteration();
// layer border
GetCompositor()->DrawDiagnostics(DIAGNOSTIC_IMAGE,
GetCompositor()->DrawDiagnostics(DiagnosticFlags::IMAGE,
gfxPictureRect, aClipRect,
aTransform, mFlashCounter);
} else {
@ -155,7 +155,7 @@ ImageHost::Composite(EffectChain& aEffectChain,
GetCompositor()->DrawQuad(rect, aClipRect, aEffectChain,
aOpacity, aTransform);
GetCompositor()->DrawDiagnostics(DIAGNOSTIC_IMAGE,
GetCompositor()->DrawDiagnostics(DiagnosticFlags::IMAGE,
rect, aClipRect,
aTransform, mFlashCounter);
}

Просмотреть файл

@ -51,9 +51,9 @@ bool
ImageLayerComposite::SetCompositableHost(CompositableHost* aHost)
{
switch (aHost->GetType()) {
case BUFFER_IMAGE_SINGLE:
case BUFFER_IMAGE_BUFFERED:
case COMPOSITABLE_IMAGE:
case CompositableType::BUFFER_IMAGE_SINGLE:
case CompositableType::BUFFER_IMAGE_BUFFERED:
case CompositableType::IMAGE:
mImageHost = aHost;
return true;
default:

Просмотреть файл

@ -355,7 +355,7 @@ BufferTextureHost::GetFormat() const
// instead (see BufferTextureHost::Upload)
if (mFormat == gfx::SurfaceFormat::YUV &&
mCompositor &&
!mCompositor->SupportsEffect(EFFECT_YCBCR)) {
!mCompositor->SupportsEffect(EffectTypes::YCBCR)) {
return gfx::SurfaceFormat::R8G8B8X8;
}
return mFormat;
@ -397,7 +397,7 @@ BufferTextureHost::Upload(nsIntRegion *aRegion)
YCbCrImageDataDeserializer yuvDeserializer(GetBuffer(), GetBufferSize());
MOZ_ASSERT(yuvDeserializer.IsValid());
if (!mCompositor->SupportsEffect(EFFECT_YCBCR)) {
if (!mCompositor->SupportsEffect(EffectTypes::YCBCR)) {
RefPtr<gfx::DataSourceSurface> surf = yuvDeserializer.ToDataSourceSurface();
if (!mFirstSource) {
mFirstSource = mCompositor->CreateDataTextureSource(mFlags);

Просмотреть файл

@ -54,10 +54,10 @@ bool
ThebesLayerComposite::SetCompositableHost(CompositableHost* aHost)
{
switch (aHost->GetType()) {
case BUFFER_CONTENT_INC:
case BUFFER_TILED:
case COMPOSITABLE_CONTENT_SINGLE:
case COMPOSITABLE_CONTENT_DOUBLE:
case CompositableType::BUFFER_CONTENT_INC:
case CompositableType::BUFFER_TILED:
case CompositableType::CONTENT_SINGLE:
case CompositableType::CONTENT_DOUBLE:
mBuffer = static_cast<ContentHost*>(aHost);
return true;
default:

Просмотреть файл

@ -380,7 +380,7 @@ TiledContentHost::RenderTile(const TileHost& aTile,
textureRect.height / aTextureBounds.height);
mCompositor->DrawQuad(graphicsRect, aClipRect, aEffectChain, aOpacity, aTransform);
}
mCompositor->DrawDiagnostics(DIAGNOSTIC_CONTENT|DIAGNOSTIC_TILE,
mCompositor->DrawDiagnostics(DiagnosticFlags::CONTENT|DIAGNOSTIC_TILE,
aScreenRegion, aClipRect, aTransform, mFlashCounter);
}
@ -471,7 +471,7 @@ TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
}
gfx::Rect rect(visibleRect.x, visibleRect.y,
visibleRect.width, visibleRect.height);
GetCompositor()->DrawDiagnostics(DIAGNOSTIC_CONTENT,
GetCompositor()->DrawDiagnostics(DiagnosticFlags::CONTENT,
rect, aClipRect, aTransform, mFlashCounter);
}

Просмотреть файл

@ -219,7 +219,7 @@ public:
const nsIntRegion* aVisibleRegion = nullptr,
TiledLayerProperties* aLayerProperties = nullptr);
virtual CompositableType GetType() { return BUFFER_TILED; }
virtual CompositableType GetType() { return CompositableType::BUFFER_TILED; }
virtual TiledLayerComposer* AsTiledLayerComposer() MOZ_OVERRIDE { return this; }

Просмотреть файл

@ -478,21 +478,21 @@ void
CompositorD3D11::SetPSForEffect(Effect* aEffect, MaskType aMaskType, gfx::SurfaceFormat aFormat)
{
switch (aEffect->mType) {
case EFFECT_SOLID_COLOR:
case EffectTypes::SOLID_COLOR:
mContext->PSSetShader(mAttachments->mSolidColorShader[aMaskType], nullptr, 0);
return;
case EFFECT_RENDER_TARGET:
case EffectTypes::RENDER_TARGET:
mContext->PSSetShader(mAttachments->mRGBAShader[aMaskType], nullptr, 0);
return;
case EFFECT_RGB:
case EffectTypes::RGB:
mContext->PSSetShader((aFormat == SurfaceFormat::B8G8R8A8 || aFormat == SurfaceFormat::R8G8B8A8)
? mAttachments->mRGBAShader[aMaskType]
: mAttachments->mRGBShader[aMaskType], nullptr, 0);
return;
case EFFECT_YCBCR:
case EffectTypes::YCBCR:
mContext->PSSetShader(mAttachments->mYCbCrShader[aMaskType], nullptr, 0);
return;
case EFFECT_COMPONENT_ALPHA:
case EffectTypes::COMPONENT_ALPHA:
mContext->PSSetShader(mAttachments->mComponentAlphaShader[aMaskType], nullptr, 0);
return;
default:
@ -521,9 +521,9 @@ CompositorD3D11::ClearRect(const gfx::Rect& aRect)
scissor.bottom = aRect.YMost();
mContext->RSSetScissorRects(1, &scissor);
mContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
mContext->VSSetShader(mAttachments->mVSQuadShader[MaskNone], nullptr, 0);
mContext->VSSetShader(mAttachments->mVSQuadShader[MaskType::MaskNone], nullptr, 0);
mContext->PSSetShader(mAttachments->mSolidColorShader[MaskNone], nullptr, 0);
mContext->PSSetShader(mAttachments->mSolidColorShader[MaskType::MaskNone], nullptr, 0);
mPSConstants.layerColor[0] = 0;
mPSConstants.layerColor[1] = 0;
mPSConstants.layerColor[2] = 0;
@ -554,18 +554,18 @@ CompositorD3D11::DrawQuad(const gfx::Rect& aRect,
bool restoreBlendMode = false;
MaskType maskType = MaskNone;
MaskType maskType = MaskType::MaskNone;
if (aEffectChain.mSecondaryEffects[EFFECT_MASK]) {
if (aEffectChain.mSecondaryEffects[EffectTypes::MASK]) {
if (aTransform.Is2D()) {
maskType = Mask2d;
maskType = MaskType::Mask2d;
} else {
MOZ_ASSERT(aEffectChain.mPrimaryEffect->mType == EFFECT_RGB);
maskType = Mask3d;
MOZ_ASSERT(aEffectChain.mPrimaryEffect->mType == EffectTypes::RGB);
maskType = MaskType::Mask3d;
}
EffectMask* maskEffect =
static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EFFECT_MASK].get());
static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EffectTypes::MASK].get());
TextureSourceD3D11* source = maskEffect->mMaskTexture->AsSourceD3D11();
if (!source) {
@ -598,7 +598,7 @@ CompositorD3D11::DrawQuad(const gfx::Rect& aRect,
switch (aEffectChain.mPrimaryEffect->mType) {
case EFFECT_SOLID_COLOR: {
case EffectTypes::SOLID_COLOR: {
SetPSForEffect(aEffectChain.mPrimaryEffect, maskType, SurfaceFormat::UNKNOWN);
Color color =
@ -609,8 +609,8 @@ CompositorD3D11::DrawQuad(const gfx::Rect& aRect,
mPSConstants.layerColor[3] = color.a * aOpacity;
}
break;
case EFFECT_RGB:
case EFFECT_RENDER_TARGET:
case EffectTypes::RGB:
case EffectTypes::RENDER_TARGET:
{
TexturedEffect* texturedEffect =
static_cast<TexturedEffect*>(aEffectChain.mPrimaryEffect.get());
@ -640,7 +640,7 @@ CompositorD3D11::DrawQuad(const gfx::Rect& aRect,
SetSamplerForFilter(texturedEffect->mFilter);
}
break;
case EFFECT_YCBCR: {
case EffectTypes::YCBCR: {
EffectYCbCr* ycbcrEffect =
static_cast<EffectYCbCr*>(aEffectChain.mPrimaryEffect.get());
@ -680,7 +680,7 @@ CompositorD3D11::DrawQuad(const gfx::Rect& aRect,
mContext->PSSetShaderResources(0, 3, srViews);
}
break;
case EFFECT_COMPONENT_ALPHA:
case EffectTypes::COMPONENT_ALPHA:
{
MOZ_ASSERT(gfxPrefs::ComponentAlphaEnabled());
MOZ_ASSERT(mAttachments->mComponentBlendState);
@ -900,7 +900,7 @@ CompositorD3D11::CreateShaders()
hr = mDevice->CreateVertexShader(LayerQuadVS,
sizeof(LayerQuadVS),
nullptr,
byRef(mAttachments->mVSQuadShader[MaskNone]));
byRef(mAttachments->mVSQuadShader[MaskType::MaskNone]));
if (FAILED(hr)) {
return false;
}
@ -908,7 +908,7 @@ CompositorD3D11::CreateShaders()
hr = mDevice->CreateVertexShader(LayerQuadMaskVS,
sizeof(LayerQuadMaskVS),
nullptr,
byRef(mAttachments->mVSQuadShader[Mask2d]));
byRef(mAttachments->mVSQuadShader[MaskType::Mask2d]));
if (FAILED(hr)) {
return false;
}
@ -916,16 +916,16 @@ CompositorD3D11::CreateShaders()
hr = mDevice->CreateVertexShader(LayerQuadMask3DVS,
sizeof(LayerQuadMask3DVS),
nullptr,
byRef(mAttachments->mVSQuadShader[Mask3d]));
byRef(mAttachments->mVSQuadShader[MaskType::Mask3d]));
if (FAILED(hr)) {
return false;
}
#define LOAD_PIXEL_SHADER(x) hr = mDevice->CreatePixelShader(x, sizeof(x), nullptr, byRef(mAttachments->m##x[MaskNone])); \
#define LOAD_PIXEL_SHADER(x) hr = mDevice->CreatePixelShader(x, sizeof(x), nullptr, byRef(mAttachments->m##x[MaskType::MaskNone])); \
if (FAILED(hr)) { \
return false; \
} \
hr = mDevice->CreatePixelShader(x##Mask, sizeof(x##Mask), nullptr, byRef(mAttachments->m##x[Mask2d])); \
hr = mDevice->CreatePixelShader(x##Mask, sizeof(x##Mask), nullptr, byRef(mAttachments->m##x[MaskType::Mask2d])); \
if (FAILED(hr)) { \
return false; \
}
@ -943,7 +943,7 @@ CompositorD3D11::CreateShaders()
hr = mDevice->CreatePixelShader(RGBAShaderMask3D,
sizeof(RGBAShaderMask3D),
nullptr,
byRef(mAttachments->mRGBAShader[Mask3d]));
byRef(mAttachments->mRGBAShader[MaskType::Mask3d]));
if (FAILED(hr)) {
return false;
}

Просмотреть файл

@ -195,15 +195,15 @@ static DeviceManagerD3D9::ShaderMode
ShaderModeForEffectType(EffectTypes aEffectType, gfx::SurfaceFormat aFormat)
{
switch (aEffectType) {
case EFFECT_SOLID_COLOR:
case EffectTypes::SOLID_COLOR:
return DeviceManagerD3D9::SOLIDCOLORLAYER;
case EFFECT_RENDER_TARGET:
case EffectTypes::RENDER_TARGET:
return DeviceManagerD3D9::RGBALAYER;
case EFFECT_RGB:
case EffectTypes::RGB:
if (aFormat == SurfaceFormat::B8G8R8A8 || aFormat == SurfaceFormat::R8G8B8A8)
return DeviceManagerD3D9::RGBALAYER;
return DeviceManagerD3D9::RGBLAYER;
case EFFECT_YCBCR:
case EffectTypes::YCBCR:
return DeviceManagerD3D9::YCBCRLAYER;
}
@ -253,7 +253,7 @@ CompositorD3D9::DrawQuad(const gfx::Rect &aRect,
1);
bool target = false;
if (aEffectChain.mPrimaryEffect->mType != EFFECT_SOLID_COLOR) {
if (aEffectChain.mPrimaryEffect->mType != EffectTypes::SOLID_COLOR) {
float opacity[4];
/*
* We always upload a 4 component float, but the shader will use only the
@ -265,13 +265,13 @@ CompositorD3D9::DrawQuad(const gfx::Rect &aRect,
bool isPremultiplied = true;
MaskType maskType = MaskNone;
MaskType maskType = MaskType::MaskNone;
if (aEffectChain.mSecondaryEffects[EFFECT_MASK]) {
if (aEffectChain.mSecondaryEffects[EffectTypes::MASK]) {
if (aTransform.Is2D()) {
maskType = Mask2d;
maskType = MaskType::Mask2d;
} else {
maskType = Mask3d;
maskType = MaskType::Mask3d;
}
}
@ -284,7 +284,7 @@ CompositorD3D9::DrawQuad(const gfx::Rect &aRect,
uint32_t maskTexture = 0;
switch (aEffectChain.mPrimaryEffect->mType) {
case EFFECT_SOLID_COLOR:
case EffectTypes::SOLID_COLOR:
{
// output color is premultiplied, so we need to adjust all channels.
Color layerColor =
@ -301,8 +301,8 @@ CompositorD3D9::DrawQuad(const gfx::Rect &aRect,
->SetShaderMode(DeviceManagerD3D9::SOLIDCOLORLAYER, maskType);
}
break;
case EFFECT_RENDER_TARGET:
case EFFECT_RGB:
case EffectTypes::RENDER_TARGET:
case EffectTypes::RGB:
{
TexturedEffect* texturedEffect =
static_cast<TexturedEffect*>(aEffectChain.mPrimaryEffect.get());
@ -329,7 +329,7 @@ CompositorD3D9::DrawQuad(const gfx::Rect &aRect,
isPremultiplied = texturedEffect->mPremultiplied;
}
break;
case EFFECT_YCBCR:
case EffectTypes::YCBCR:
{
EffectYCbCr* ycbcrEffect =
static_cast<EffectYCbCr*>(aEffectChain.mPrimaryEffect.get());
@ -415,7 +415,7 @@ CompositorD3D9::DrawQuad(const gfx::Rect &aRect,
maskTexture = mDeviceManager->SetShaderMode(DeviceManagerD3D9::YCBCRLAYER, maskType);
}
break;
case EFFECT_COMPONENT_ALPHA:
case EffectTypes::COMPONENT_ALPHA:
{
MOZ_ASSERT(gfxPrefs::ComponentAlphaEnabled());
EffectComponentAlpha* effectComponentAlpha =
@ -476,7 +476,7 @@ void
CompositorD3D9::SetMask(const EffectChain &aEffectChain, uint32_t aMaskTexture)
{
EffectMask *maskEffect =
static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EFFECT_MASK].get());
static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EffectTypes::MASK].get());
if (!maskEffect) {
return;
}

Просмотреть файл

@ -569,7 +569,7 @@ LoadMaskTexture(Layer* aMask, IDirect3DDevice9* aDevice,
uint32_t
DeviceManagerD3D9::SetShaderMode(ShaderMode aMode, MaskType aMaskType)
{
if (aMaskType == MaskNone) {
if (aMaskType == MaskType::MaskNone) {
switch (aMode) {
case RGBLAYER:
mDevice->SetVertexShader(mLayerVS);
@ -607,7 +607,7 @@ DeviceManagerD3D9::SetShaderMode(ShaderMode aMode, MaskType aMaskType)
maskTexRegister = 1;
break;
case RGBALAYER:
if (aMaskType == Mask2d) {
if (aMaskType == MaskType::Mask2d) {
mDevice->SetVertexShader(mLayerVSMask);
mDevice->SetPixelShader(mRGBAPSMask);
} else {
@ -643,9 +643,9 @@ DeviceManagerD3D9::SetShaderMode(ShaderMode aMode, MaskType aMaskType)
void
DeviceManagerD3D9::SetShaderMode(ShaderMode aMode, Layer* aMask, bool aIs2D)
{
MaskType maskType = MaskNone;
MaskType maskType = MaskType::MaskNone;
if (aMask) {
maskType = aIs2D ? Mask2d : Mask3d;
maskType = aIs2D ? MaskType::Mask2d : MaskType::Mask3d;
}
uint32_t maskTexRegister = SetShaderMode(aMode, maskType);
if (aMask) {
@ -654,7 +654,7 @@ DeviceManagerD3D9::SetShaderMode(ShaderMode aMode, Layer* aMask, bool aIs2D)
if (!LoadMaskTexture(aMask, mDevice, maskTexRegister)) {
// if we can't load the mask, fall back to unmasked rendering
NS_WARNING("Could not load texture for mask layer.");
SetShaderMode(aMode, MaskNone);
SetShaderMode(aMode, MaskType::MaskNone);
}
}
}

Просмотреть файл

@ -679,7 +679,7 @@ CompositorParent::CompositeToTarget(DrawTarget* aTarget)
// 0 -> Full-tilt composite
if (gfxPrefs::LayersCompositionFrameRate() == 0
|| mLayerManager->GetCompositor()->GetDiagnosticTypes() & DIAGNOSTIC_FLASH_BORDERS) {
|| mLayerManager->GetCompositor()->GetDiagnosticTypes() & DiagnosticTypes::FLASH_BORDERS) {
// Special full-tilt composite mode for performance testing
ScheduleComposition();
}

Просмотреть файл

@ -166,7 +166,7 @@ CompositableForwarder::IdentifyTextureHost(const TextureFactoryIdentifier& aIden
}
ShadowLayerForwarder::ShadowLayerForwarder()
: mDiagnosticTypes(DIAGNOSTIC_NONE)
: mDiagnosticTypes(DiagnosticTypes::NO_DIAGNOSTIC)
, mIsFirstPaint(false)
, mWindowOverlayChanged(false)
{

Просмотреть файл

@ -91,7 +91,7 @@ SharedPlanarYCbCrImage::SetData(const PlanarYCbCrData& aData)
}
MOZ_ASSERT(mTextureClient->AsTextureClientYCbCr());
if (!mTextureClient->Lock(OPEN_WRITE_ONLY)) {
if (!mTextureClient->Lock(OpenMode::OPEN_WRITE_ONLY)) {
MOZ_ASSERT(false, "Failed to lock the texture.");
return;
}

Просмотреть файл

@ -803,13 +803,13 @@ CompositorOGL::GetShaderConfigFor(Effect *aEffect, MaskType aMask) const
ShaderConfigOGL config;
switch(aEffect->mType) {
case EFFECT_SOLID_COLOR:
case EffectTypes::SOLID_COLOR:
config.SetRenderColor(true);
break;
case EFFECT_YCBCR:
case EffectTypes::YCBCR:
config.SetYCbCr(true);
break;
case EFFECT_COMPONENT_ALPHA:
case EffectTypes::COMPONENT_ALPHA:
{
config.SetComponentAlpha(true);
EffectComponentAlpha* effectComponentAlpha =
@ -819,12 +819,12 @@ CompositorOGL::GetShaderConfigFor(Effect *aEffect, MaskType aMask) const
format == gfx::SurfaceFormat::B8G8R8X8);
break;
}
case EFFECT_RENDER_TARGET:
case EffectTypes::RENDER_TARGET:
config.SetTextureTarget(mFBOTextureTarget);
break;
default:
{
MOZ_ASSERT(aEffect->mType == EFFECT_RGB);
MOZ_ASSERT(aEffect->mType == EffectTypes::RGB);
TexturedEffect* texturedEffect =
static_cast<TexturedEffect*>(aEffect);
TextureSourceOGL* source = texturedEffect->mTexture->AsSourceOGL();
@ -839,8 +839,8 @@ CompositorOGL::GetShaderConfigFor(Effect *aEffect, MaskType aMask) const
break;
}
}
config.SetMask2D(aMask == Mask2d);
config.SetMask3D(aMask == Mask3d);
config.SetMask2D(aMask == MaskType::Mask2d);
config.SetMask3D(aMask == MaskType::Mask3d);
return config;
}
@ -909,8 +909,8 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
EffectMask* effectMask;
TextureSourceOGL* sourceMask = nullptr;
gfx::Matrix4x4 maskQuadTransform;
if (aEffectChain.mSecondaryEffects[EFFECT_MASK]) {
effectMask = static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EFFECT_MASK].get());
if (aEffectChain.mSecondaryEffects[EffectTypes::MASK]) {
effectMask = static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EffectTypes::MASK].get());
sourceMask = effectMask->mMaskTexture->AsSourceOGL();
// NS_ASSERTION(textureMask->IsAlpha(),
@ -932,10 +932,10 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
maskQuadTransform._42 = float(-bounds.y)/bounds.height;
maskType = effectMask->mIs3D
? Mask3d
: Mask2d;
? MaskType::Mask3d
: MaskType::Mask2d;
} else {
maskType = MaskNone;
maskType = MaskType::MaskNone;
}
mPixelsFilled += aRect.width * aRect.height;
@ -943,7 +943,7 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
// Determine the color if this is a color shader and fold the opacity into
// the color since color shaders don't have an opacity uniform.
Color color;
if (aEffectChain.mPrimaryEffect->mType == EFFECT_SOLID_COLOR) {
if (aEffectChain.mPrimaryEffect->mType == EffectTypes::SOLID_COLOR) {
EffectSolidColor* effectSolidColor =
static_cast<EffectSolidColor*>(aEffectChain.mPrimaryEffect.get());
color = effectSolidColor->mColor;
@ -978,10 +978,10 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
}
switch (aEffectChain.mPrimaryEffect->mType) {
case EFFECT_SOLID_COLOR: {
case EffectTypes::SOLID_COLOR: {
program->SetRenderColor(color);
if (maskType != MaskNone) {
if (maskType != MaskType::MaskNone) {
BindMaskForProgram(program, sourceMask, LOCAL_GL_TEXTURE0, maskQuadTransform);
}
@ -989,7 +989,7 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
}
break;
case EFFECT_RGB: {
case EffectTypes::RGB: {
TexturedEffect* texturedEffect =
static_cast<TexturedEffect*>(aEffectChain.mPrimaryEffect.get());
TextureSource *source = texturedEffect->mTexture;
@ -1019,7 +1019,7 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
program->SetTextureUnit(0);
if (maskType != MaskNone) {
if (maskType != MaskType::MaskNone) {
BindMaskForProgram(program, sourceMask, LOCAL_GL_TEXTURE1, maskQuadTransform);
}
@ -1032,7 +1032,7 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
}
}
break;
case EFFECT_YCBCR: {
case EffectTypes::YCBCR: {
EffectYCbCr* effectYCbCr =
static_cast<EffectYCbCr*>(aEffectChain.mPrimaryEffect.get());
TextureSource* sourceYCbCr = effectYCbCr->mTexture;
@ -1052,7 +1052,7 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
program->SetYCbCrTextureUnits(Y, Cb, Cr);
if (maskType != MaskNone) {
if (maskType != MaskType::MaskNone) {
BindMaskForProgram(program, sourceMask, LOCAL_GL_TEXTURE3, maskQuadTransform);
}
BindAndDrawQuadWithTextureRect(program,
@ -1061,7 +1061,7 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
sourceYCbCr->GetSubSource(Y));
}
break;
case EFFECT_RENDER_TARGET: {
case EffectTypes::RENDER_TARGET: {
EffectRenderTarget* effectRenderTarget =
static_cast<EffectRenderTarget*>(aEffectChain.mPrimaryEffect.get());
RefPtr<CompositingRenderTargetOGL> surface
@ -1077,7 +1077,7 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
program->SetTextureTransform(Matrix4x4::From2D(transform));
program->SetTextureUnit(0);
if (maskType != MaskNone) {
if (maskType != MaskType::MaskNone) {
sourceMask->BindTexture(LOCAL_GL_TEXTURE1, gfx::Filter::LINEAR);
program->SetMaskTextureUnit(1);
program->SetMaskLayerTransform(maskQuadTransform);
@ -1094,7 +1094,7 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
BindAndDrawQuad(program);
}
break;
case EFFECT_COMPONENT_ALPHA: {
case EffectTypes::COMPONENT_ALPHA: {
MOZ_ASSERT(gfxPrefs::ComponentAlphaEnabled());
EffectComponentAlpha* effectComponentAlpha =
static_cast<EffectComponentAlpha*>(aEffectChain.mPrimaryEffect.get());
@ -1114,7 +1114,7 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
program->SetWhiteTextureUnit(1);
program->SetTextureTransform(gfx::Matrix4x4());
if (maskType != MaskNone) {
if (maskType != MaskType::MaskNone) {
BindMaskForProgram(program, sourceMask, LOCAL_GL_TEXTURE2, maskQuadTransform);
}
// Pass 1.

Просмотреть файл

@ -20,7 +20,7 @@
#include "mozilla/gfx/Rect.h" // for Rect, IntRect
#include "mozilla/gfx/Types.h" // for Float, SurfaceFormat, etc
#include "mozilla/layers/Compositor.h" // for SurfaceInitMode, Compositor, etc
#include "mozilla/layers/CompositorTypes.h" // for MaskType::NumMaskTypes, etc
#include "mozilla/layers/CompositorTypes.h" // for MaskType::MaskType::NumMaskTypes, etc
#include "mozilla/layers/LayersTypes.h"
#include "nsAutoPtr.h" // for nsRefPtr, nsAutoPtr
#include "nsCOMPtr.h" // for already_AddRefed
@ -358,7 +358,7 @@ private:
gfx::Rect *aClipRectOut = nullptr,
gfx::Rect *aRenderBoundsOut = nullptr) MOZ_OVERRIDE;
ShaderConfigOGL GetShaderConfigFor(Effect *aEffect, MaskType aMask = MaskNone) const;
ShaderConfigOGL GetShaderConfigFor(Effect *aEffect, MaskType aMask = MaskType::MaskNone) const;
ShaderProgramOGL* GetShaderProgramFor(const ShaderConfigOGL &aConfig);
/**

Просмотреть файл

@ -145,10 +145,10 @@ GrallocTextureClientOGL::Lock(OpenMode aMode)
WaitReleaseFence();
uint32_t usage = 0;
if (aMode & OPEN_READ) {
if (aMode & OpenMode::OPEN_READ) {
usage |= GRALLOC_USAGE_SW_READ_OFTEN;
}
if (aMode & OPEN_WRITE) {
if (aMode & OpenMode::OPEN_WRITE) {
usage |= GRALLOC_USAGE_SW_WRITE_OFTEN;
}
int32_t rv = mGraphicBuffer->lock(usage, reinterpret_cast<void**>(&mMappedBuffer));