From 454f308775b7a1da1105d62bc02fbbd0c3e043a5 Mon Sep 17 00:00:00 2001 From: Jeremy Chen Date: Tue, 29 Sep 2015 23:19:00 +0200 Subject: [PATCH] Bug 1195653 - Part1.1: Dump SecondaryEffects (EffectTypes::MASK) on Layerscope viewer. r=dglastonbury (v2, carry r+) --- gfx/layers/LayerScope.cpp | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/gfx/layers/LayerScope.cpp b/gfx/layers/LayerScope.cpp index 9c5bfd53e4ed..7979a1fe23d7 100644 --- a/gfx/layers/LayerScope.cpp +++ b/gfx/layers/LayerScope.cpp @@ -872,9 +872,11 @@ NS_IMPL_ISUPPORTS(DebugDataSender::SendTask, nsIRunnable); * 2. SendEffectChain * 1. SendTexturedEffect * -> SendTextureSource - * 2. SendYCbCrEffect + * 2. SendMaskEffect * -> SendTextureSource - * 3. SendColor + * 3. SendYCbCrEffect + * -> SendTextureSource + * 4. SendColor */ class SenderHelper { @@ -918,6 +920,9 @@ private: static void SendTexturedEffect(GLContext* aGLContext, void* aLayerRef, const TexturedEffect* aEffect); + static void SendMaskEffect(GLContext* aGLContext, + void* aLayerRef, + const EffectMask* aEffect); static void SendYCbCrEffect(GLContext* aGLContext, void* aLayerRef, const EffectYCbCr* aEffect); @@ -1123,6 +1128,24 @@ SenderHelper::SendTexturedEffect(GLContext* aGLContext, SendTextureSource(aGLContext, aLayerRef, source, texID, false); } +void +SenderHelper::SendMaskEffect(GLContext* aGLContext, + void* aLayerRef, + const EffectMask* aEffect) +{ + TextureSourceOGL* source = aEffect->mMaskTexture->AsSourceOGL(); + if (!source) { + return; + } + + GLuint texID = GetTextureID(aGLContext, source); + if (IsTextureIdContainsInList(texID)) { + return; + } + + SendTextureSource(aGLContext, aLayerRef, source, texID, false); +} + void SenderHelper::SendYCbCrEffect(GLContext* aGLContext, void* aLayerRef, @@ -1188,8 +1211,11 @@ SenderHelper::SendEffectChain(GLContext* aGLContext, break; } - //const Effect* secondaryEffect = aEffectChain.mSecondaryEffects[EffectTypes::MASK]; - // TODO: + if (aEffectChain.mSecondaryEffects[EffectTypes::MASK]) { + const EffectMask* effectMask = + static_cast(aEffectChain.mSecondaryEffects[EffectTypes::MASK].get()); + SendMaskEffect(aGLContext, aEffectChain.mLayerRef, effectMask); + } } void