Bug 989144 - Convert EffectChain::mSecondaryEffects to be an EnumeratedArray - r=nical

This commit is contained in:
Benoit Jacob 2014-04-25 22:34:06 -04:00
parent 204c6f0755
commit 59d8409515
4 changed files with 8 additions and 6 deletions

View File

@ -17,6 +17,7 @@
#include "mozilla/layers/TextureHost.h" // for CompositingRenderTarget, etc #include "mozilla/layers/TextureHost.h" // for CompositingRenderTarget, etc
#include "mozilla/mozalloc.h" // for operator delete, etc #include "mozilla/mozalloc.h" // for operator delete, etc
#include "nscore.h" // for nsACString #include "nscore.h" // for nsACString
#include "mozilla/EnumeratedArray.h"
namespace mozilla { namespace mozilla {
namespace layers { namespace layers {
@ -164,7 +165,8 @@ struct EffectChain
explicit EffectChain(void* aLayerRef) : mLayerRef(aLayerRef) {} explicit EffectChain(void* aLayerRef) : mLayerRef(aLayerRef) {}
RefPtr<Effect> mPrimaryEffect; RefPtr<Effect> mPrimaryEffect;
RefPtr<Effect> mSecondaryEffects[size_t(EffectTypes::MAX_SECONDARY)]; EnumeratedArray<EffectTypes, EffectTypes::MAX_SECONDARY, RefPtr<Effect>>
mSecondaryEffects;
void* mLayerRef; //!< For LayerScope logging void* mLayerRef; //!< For LayerScope logging
}; };

View File

@ -291,8 +291,8 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect,
RefPtr<SourceSurface> sourceMask; RefPtr<SourceSurface> sourceMask;
Matrix maskTransform; Matrix maskTransform;
if (aEffectChain.mSecondaryEffects[size_t(EffectTypes::MASK)]) { if (aEffectChain.mSecondaryEffects[EffectTypes::MASK]) {
EffectMask *effectMask = static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[size_t(EffectTypes::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);

View File

@ -158,7 +158,7 @@ CompositableHost::AddMaskEffect(EffectChain& aEffects,
source->GetSize(), source->GetSize(),
aTransform); aTransform);
effect->mIs3D = aIs3D; effect->mIs3D = aIs3D;
aEffects.mSecondaryEffects[size_t(EffectTypes::MASK)] = effect; aEffects.mSecondaryEffects[EffectTypes::MASK] = effect;
return true; return true;
} }

View File

@ -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[size_t(EffectTypes::MASK)]) { if (aEffectChain.mSecondaryEffects[EffectTypes::MASK]) {
effectMask = static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[size_t(EffectTypes::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(),