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

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

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

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

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

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

@ -131,7 +131,7 @@ ImageContainer::ImageContainer(int flag)
if (flag == ENABLE_ASYNC && ImageBridgeChild::IsCreated()) { if (flag == ENABLE_ASYNC && ImageBridgeChild::IsCreated()) {
// the refcount of this ImageClient is 1. we don't use a RefPtr here because the refcount // 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. // 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); MOZ_ASSERT(mImageClient);
} }
} }
@ -629,7 +629,7 @@ CairoImage::GetTextureClient(CompositableClient *aClient)
surface->GetSize()); surface->GetSize());
MOZ_ASSERT(textureClient->CanExposeDrawTarget()); MOZ_ASSERT(textureClient->CanExposeDrawTarget());
if (!textureClient->AllocateForSurface(surface->GetSize()) || if (!textureClient->AllocateForSurface(surface->GetSize()) ||
!textureClient->Lock(OPEN_WRITE_ONLY)) { !textureClient->Lock(OpenMode::OPEN_WRITE_ONLY)) {
return nullptr; return nullptr;
} }

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

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

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

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

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

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

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

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

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

@ -29,7 +29,7 @@ public:
ClientImageLayer(ClientLayerManager* aLayerManager) ClientImageLayer(ClientLayerManager* aLayerManager)
: ImageLayer(aLayerManager, : ImageLayer(aLayerManager,
static_cast<ClientLayer*>(MOZ_THIS_IN_INITIALIZER_LIST())) static_cast<ClientLayer*>(MOZ_THIS_IN_INITIALIZER_LIST()))
, mImageClientTypeContainer(BUFFER_UNKNOWN) , mImageClientTypeContainer(CompositableType::BUFFER_UNKNOWN)
{ {
MOZ_COUNT_CTOR(ClientImageLayer); MOZ_COUNT_CTOR(ClientImageLayer);
} }
@ -42,7 +42,7 @@ public:
virtual void SetContainer(ImageContainer* aContainer) MOZ_OVERRIDE virtual void SetContainer(ImageContainer* aContainer) MOZ_OVERRIDE
{ {
ImageLayer::SetContainer(aContainer); ImageLayer::SetContainer(aContainer);
mImageClientTypeContainer = BUFFER_UNKNOWN; mImageClientTypeContainer = CompositableType::BUFFER_UNKNOWN;
} }
virtual void SetVisibleRegion(const nsIntRegion& aRegion) virtual void SetVisibleRegion(const nsIntRegion& aRegion)
@ -94,12 +94,12 @@ protected:
CompositableType GetImageClientType() CompositableType GetImageClientType()
{ {
if (mImageClientTypeContainer != BUFFER_UNKNOWN) { if (mImageClientTypeContainer != CompositableType::BUFFER_UNKNOWN) {
return mImageClientTypeContainer; return mImageClientTypeContainer;
} }
if (mContainer->IsAsync()) { if (mContainer->IsAsync()) {
mImageClientTypeContainer = BUFFER_BRIDGE; mImageClientTypeContainer = CompositableType::BUFFER_BRIDGE;
return mImageClientTypeContainer; return mImageClientTypeContainer;
} }
@ -107,13 +107,13 @@ protected:
AutoLockImage autoLock(mContainer, &surface); AutoLockImage autoLock(mContainer, &surface);
#ifdef MOZ_WIDGET_GONK #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. // the buffer's usage conflict.
mImageClientTypeContainer = autoLock.GetImage() ? mImageClientTypeContainer = autoLock.GetImage() ?
BUFFER_IMAGE_BUFFERED : BUFFER_UNKNOWN; CompositableType::BUFFER_IMAGE_BUFFERED : CompositableType::BUFFER_UNKNOWN;
#else #else
mImageClientTypeContainer = autoLock.GetImage() ? mImageClientTypeContainer = autoLock.GetImage() ?
BUFFER_IMAGE_SINGLE : BUFFER_UNKNOWN; CompositableType::BUFFER_IMAGE_SINGLE : CompositableType::BUFFER_UNKNOWN;
#endif #endif
return mImageClientTypeContainer; return mImageClientTypeContainer;
} }
@ -140,7 +140,7 @@ ClientImageLayer::RenderLayer()
if (!mImageClient || if (!mImageClient ||
!mImageClient->UpdateImage(mContainer, GetContentFlags())) { !mImageClient->UpdateImage(mContainer, GetContentFlags())) {
CompositableType type = GetImageClientType(); CompositableType type = GetImageClientType();
if (type == BUFFER_UNKNOWN) { if (type == CompositableType::BUFFER_UNKNOWN) {
return; return;
} }
TextureFlags flags = TextureFlags::FRONT; TextureFlags flags = TextureFlags::FRONT;
@ -150,7 +150,7 @@ ClientImageLayer::RenderLayer()
mImageClient = ImageClient::CreateImageClient(type, mImageClient = ImageClient::CreateImageClient(type,
ClientManager()->AsShadowForwarder(), ClientManager()->AsShadowForwarder(),
flags); flags);
if (type == BUFFER_BRIDGE) { if (type == CompositableType::BUFFER_BRIDGE) {
static_cast<ImageClientBridge*>(mImageClient.get())->SetLayer(this); 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 // We just created the textures and we are about to get their draw targets
// so we have to lock them here. // 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"); MOZ_ASSERT(locked, "Could not lock the TextureClient");
*aBlackDT = mTextureClient->GetAsDrawTarget(); *aBlackDT = mTextureClient->GetAsDrawTarget();
if (aFlags & BUFFER_COMPONENT_ALPHA) { 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"); MOZ_ASSERT(locked, "Could not lock the second TextureClient for component alpha");
*aWhiteDT = mTextureClientOnWhite->GetAsDrawTarget(); *aWhiteDT = mTextureClientOnWhite->GetAsDrawTarget();
@ -426,11 +426,11 @@ void
ContentClientDoubleBuffered::FinalizeFrame(const nsIntRegion& aRegionToDraw) ContentClientDoubleBuffered::FinalizeFrame(const nsIntRegion& aRegionToDraw)
{ {
if (mTextureClient) { if (mTextureClient) {
DebugOnly<bool> locked = mTextureClient->Lock(OPEN_READ_WRITE); DebugOnly<bool> locked = mTextureClient->Lock(OpenMode::OPEN_READ_WRITE);
MOZ_ASSERT(locked); MOZ_ASSERT(locked);
} }
if (mTextureClientOnWhite) { if (mTextureClientOnWhite) {
DebugOnly<bool> locked = mTextureClientOnWhite->Lock(OPEN_READ_WRITE); DebugOnly<bool> locked = mTextureClientOnWhite->Lock(OpenMode::OPEN_READ_WRITE);
MOZ_ASSERT(locked); 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 // We need to ensure that we lock these two buffers in the same
// order as the compositor to prevent deadlocks. // order as the compositor to prevent deadlocks.
if (!mFrontClient->Lock(OPEN_READ_ONLY)) { if (!mFrontClient->Lock(OpenMode::OPEN_READ_ONLY)) {
return; return;
} }
if (mFrontClientOnWhite && if (mFrontClientOnWhite &&
!mFrontClientOnWhite->Lock(OPEN_READ_ONLY)) { !mFrontClientOnWhite->Lock(OpenMode::OPEN_READ_ONLY)) {
mFrontClient->Unlock(); mFrontClient->Unlock();
return; return;
} }
@ -539,11 +539,11 @@ void
ContentClientSingleBuffered::FinalizeFrame(const nsIntRegion& aRegionToDraw) ContentClientSingleBuffered::FinalizeFrame(const nsIntRegion& aRegionToDraw)
{ {
if (mTextureClient) { if (mTextureClient) {
DebugOnly<bool> locked = mTextureClient->Lock(OPEN_READ_WRITE); DebugOnly<bool> locked = mTextureClient->Lock(OpenMode::OPEN_READ_WRITE);
MOZ_ASSERT(locked); MOZ_ASSERT(locked);
} }
if (mTextureClientOnWhite) { if (mTextureClientOnWhite) {
DebugOnly<bool> locked = mTextureClientOnWhite->Lock(OPEN_READ_WRITE); DebugOnly<bool> locked = mTextureClientOnWhite->Lock(OpenMode::OPEN_READ_WRITE);
MOZ_ASSERT(locked); MOZ_ASSERT(locked);
} }
} }
@ -754,7 +754,7 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer,
if (createdBuffer) { if (createdBuffer) {
if (mHasBuffer && if (mHasBuffer &&
(mode != SurfaceMode::SURFACE_COMPONENT_ALPHA || mHasBufferOnWhite)) { (mode != SurfaceMode::SURFACE_COMPONENT_ALPHA || mHasBufferOnWhite)) {
mTextureInfo.mDeprecatedTextureHostFlags = TEXTURE_HOST_COPY_PREVIOUS; mTextureInfo.mDeprecatedTextureHostFlags = DeprecatedTextureHostFlags::COPY_PREVIOUS;
} }
mHasBuffer = true; mHasBuffer = true;
@ -851,7 +851,7 @@ ContentClientIncremental::Updated(const nsIntRegion& aRegionToDraw,
{ {
if (IsSurfaceDescriptorValid(mUpdateDescriptor)) { if (IsSurfaceDescriptorValid(mUpdateDescriptor)) {
mForwarder->UpdateTextureIncremental(this, mForwarder->UpdateTextureIncremental(this,
TextureFront, TextureIdentifier::Front,
mUpdateDescriptor, mUpdateDescriptor,
aRegionToDraw, aRegionToDraw,
mBufferRect, mBufferRect,
@ -860,7 +860,7 @@ ContentClientIncremental::Updated(const nsIntRegion& aRegionToDraw,
} }
if (IsSurfaceDescriptorValid(mUpdateDescriptorOnWhite)) { if (IsSurfaceDescriptorValid(mUpdateDescriptorOnWhite)) {
mForwarder->UpdateTextureIncremental(this, mForwarder->UpdateTextureIncremental(this,
TextureOnWhiteFront, TextureIdentifier::OnWhiteFront,
mUpdateDescriptorOnWhite, mUpdateDescriptorOnWhite,
aRegionToDraw, aRegionToDraw,
mBufferRect, mBufferRect,

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

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

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

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

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

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

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

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

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

@ -716,7 +716,7 @@ BufferTextureClient::GetAsDrawTarget()
} }
mUsingFallbackDrawTarget = true; mUsingFallbackDrawTarget = true;
if (mOpenMode & OPEN_READ) { if (mOpenMode & OpenMode::OPEN_READ) {
RefPtr<DataSourceSurface> surface = serializer.GetAsSurface(); RefPtr<DataSourceSurface> surface = serializer.GetAsSurface();
IntRect rect(0, 0, surface->GetSize().width, surface->GetSize().height); IntRect rect(0, 0, surface->GetSize().width, surface->GetSize().height);
mDrawTarget->CopySurface(surface, rect, IntPoint(0,0)); mDrawTarget->CopySurface(surface, rect, IntPoint(0,0));
@ -750,7 +750,7 @@ BufferTextureClient::Unlock()
MOZ_ASSERT(mDrawTarget->refCount() == 1); MOZ_ASSERT(mDrawTarget->refCount() == 1);
mDrawTarget->Flush(); 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 // When we are using a fallback DrawTarget, it means we could not create
// a DrawTarget wrapping the TextureClient's shared memory. In this scenario // 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 // 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: * This is typically used as follows:
* *
* if (!texture->Lock(OPEN_READ_WRITE)) { * if (!texture->Lock(OpenMode::OPEN_READ_WRITE)) {
* return false; * return false;
* } * }
* { * {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -569,7 +569,7 @@ LoadMaskTexture(Layer* aMask, IDirect3DDevice9* aDevice,
uint32_t uint32_t
DeviceManagerD3D9::SetShaderMode(ShaderMode aMode, MaskType aMaskType) DeviceManagerD3D9::SetShaderMode(ShaderMode aMode, MaskType aMaskType)
{ {
if (aMaskType == MaskNone) { if (aMaskType == MaskType::MaskNone) {
switch (aMode) { switch (aMode) {
case RGBLAYER: case RGBLAYER:
mDevice->SetVertexShader(mLayerVS); mDevice->SetVertexShader(mLayerVS);
@ -607,7 +607,7 @@ DeviceManagerD3D9::SetShaderMode(ShaderMode aMode, MaskType aMaskType)
maskTexRegister = 1; maskTexRegister = 1;
break; break;
case RGBALAYER: case RGBALAYER:
if (aMaskType == Mask2d) { if (aMaskType == MaskType::Mask2d) {
mDevice->SetVertexShader(mLayerVSMask); mDevice->SetVertexShader(mLayerVSMask);
mDevice->SetPixelShader(mRGBAPSMask); mDevice->SetPixelShader(mRGBAPSMask);
} else { } else {
@ -643,9 +643,9 @@ DeviceManagerD3D9::SetShaderMode(ShaderMode aMode, MaskType aMaskType)
void void
DeviceManagerD3D9::SetShaderMode(ShaderMode aMode, Layer* aMask, bool aIs2D) DeviceManagerD3D9::SetShaderMode(ShaderMode aMode, Layer* aMask, bool aIs2D)
{ {
MaskType maskType = MaskNone; MaskType maskType = MaskType::MaskNone;
if (aMask) { if (aMask) {
maskType = aIs2D ? Mask2d : Mask3d; maskType = aIs2D ? MaskType::Mask2d : MaskType::Mask3d;
} }
uint32_t maskTexRegister = SetShaderMode(aMode, maskType); uint32_t maskTexRegister = SetShaderMode(aMode, maskType);
if (aMask) { if (aMask) {
@ -654,7 +654,7 @@ DeviceManagerD3D9::SetShaderMode(ShaderMode aMode, Layer* aMask, bool aIs2D)
if (!LoadMaskTexture(aMask, mDevice, maskTexRegister)) { if (!LoadMaskTexture(aMask, mDevice, maskTexRegister)) {
// if we can't load the mask, fall back to unmasked rendering // if we can't load the mask, fall back to unmasked rendering
NS_WARNING("Could not load texture for mask layer."); 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 // 0 -> Full-tilt composite
if (gfxPrefs::LayersCompositionFrameRate() == 0 if (gfxPrefs::LayersCompositionFrameRate() == 0
|| mLayerManager->GetCompositor()->GetDiagnosticTypes() & DIAGNOSTIC_FLASH_BORDERS) { || mLayerManager->GetCompositor()->GetDiagnosticTypes() & DiagnosticTypes::FLASH_BORDERS) {
// Special full-tilt composite mode for performance testing // Special full-tilt composite mode for performance testing
ScheduleComposition(); ScheduleComposition();
} }

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

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

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

@ -91,7 +91,7 @@ SharedPlanarYCbCrImage::SetData(const PlanarYCbCrData& aData)
} }
MOZ_ASSERT(mTextureClient->AsTextureClientYCbCr()); 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."); MOZ_ASSERT(false, "Failed to lock the texture.");
return; return;
} }

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

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

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

@ -20,7 +20,7 @@
#include "mozilla/gfx/Rect.h" // for Rect, IntRect #include "mozilla/gfx/Rect.h" // for Rect, IntRect
#include "mozilla/gfx/Types.h" // for Float, SurfaceFormat, etc #include "mozilla/gfx/Types.h" // for Float, SurfaceFormat, etc
#include "mozilla/layers/Compositor.h" // for SurfaceInitMode, Compositor, 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 "mozilla/layers/LayersTypes.h"
#include "nsAutoPtr.h" // for nsRefPtr, nsAutoPtr #include "nsAutoPtr.h" // for nsRefPtr, nsAutoPtr
#include "nsCOMPtr.h" // for already_AddRefed #include "nsCOMPtr.h" // for already_AddRefed
@ -358,7 +358,7 @@ private:
gfx::Rect *aClipRectOut = nullptr, gfx::Rect *aClipRectOut = nullptr,
gfx::Rect *aRenderBoundsOut = nullptr) MOZ_OVERRIDE; 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); ShaderProgramOGL* GetShaderProgramFor(const ShaderConfigOGL &aConfig);
/** /**

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

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