diff --git a/gfx/layers/Effects.h b/gfx/layers/Effects.h index b6f22f21b30..79c3fc24c2a 100644 --- a/gfx/layers/Effects.h +++ b/gfx/layers/Effects.h @@ -17,6 +17,7 @@ #include "mozilla/layers/TextureHost.h" // for CompositingRenderTarget, etc #include "mozilla/mozalloc.h" // for operator delete, etc #include "nscore.h" // for nsACString +#include "mozilla/EnumeratedArray.h" namespace mozilla { namespace layers { @@ -164,7 +165,8 @@ struct EffectChain explicit EffectChain(void* aLayerRef) : mLayerRef(aLayerRef) {} RefPtr mPrimaryEffect; - RefPtr mSecondaryEffects[size_t(EffectTypes::MAX_SECONDARY)]; + EnumeratedArray> + mSecondaryEffects; void* mLayerRef; //!< For LayerScope logging }; diff --git a/gfx/layers/basic/BasicCompositor.cpp b/gfx/layers/basic/BasicCompositor.cpp index 0efa2b36100..215e01f626b 100644 --- a/gfx/layers/basic/BasicCompositor.cpp +++ b/gfx/layers/basic/BasicCompositor.cpp @@ -291,8 +291,8 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect, RefPtr sourceMask; Matrix maskTransform; - if (aEffectChain.mSecondaryEffects[size_t(EffectTypes::MASK)]) { - EffectMask *effectMask = static_cast(aEffectChain.mSecondaryEffects[size_t(EffectTypes::MASK)].get()); + if (aEffectChain.mSecondaryEffects[EffectTypes::MASK]) { + EffectMask *effectMask = static_cast(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); diff --git a/gfx/layers/composite/CompositableHost.cpp b/gfx/layers/composite/CompositableHost.cpp index 62c56b31fcd..40f8b6c6c4c 100644 --- a/gfx/layers/composite/CompositableHost.cpp +++ b/gfx/layers/composite/CompositableHost.cpp @@ -158,7 +158,7 @@ CompositableHost::AddMaskEffect(EffectChain& aEffects, source->GetSize(), aTransform); effect->mIs3D = aIs3D; - aEffects.mSecondaryEffects[size_t(EffectTypes::MASK)] = effect; + aEffects.mSecondaryEffects[EffectTypes::MASK] = effect; return true; } diff --git a/gfx/layers/opengl/CompositorOGL.cpp b/gfx/layers/opengl/CompositorOGL.cpp index 5f751cf71d5..e7fec971212 100644 --- a/gfx/layers/opengl/CompositorOGL.cpp +++ b/gfx/layers/opengl/CompositorOGL.cpp @@ -909,8 +909,8 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect, EffectMask* effectMask; TextureSourceOGL* sourceMask = nullptr; gfx::Matrix4x4 maskQuadTransform; - if (aEffectChain.mSecondaryEffects[size_t(EffectTypes::MASK)]) { - effectMask = static_cast(aEffectChain.mSecondaryEffects[size_t(EffectTypes::MASK)].get()); + if (aEffectChain.mSecondaryEffects[EffectTypes::MASK]) { + effectMask = static_cast(aEffectChain.mSecondaryEffects[EffectTypes::MASK].get()); sourceMask = effectMask->mMaskTexture->AsSourceOGL(); // NS_ASSERTION(textureMask->IsAlpha(),