Bug 975121 - Fix reversed colors with gfx.xrender.enabled = false. r=gal
authorMorris Tseng <mtseng@mozilla.com>
Mon, 24 Feb 2014 10:09:55 -0500
changeset 170548 5fa7f5df67b342839cef5a928dd43d1eec9a1902
parent 170547 b3b8d728624319ccb3d51f3ad3a3e6caaaa37cbe
child 170549 c9de8e0ce7450bc27797523a96022a5b9d84b8ea
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersgal
bugs975121
milestone30.0a1
Bug 975121 - Fix reversed colors with gfx.xrender.enabled = false. r=gal
gfx/layers/opengl/CompositorOGL.cpp
--- a/gfx/layers/opengl/CompositorOGL.cpp
+++ b/gfx/layers/opengl/CompositorOGL.cpp
@@ -819,18 +819,25 @@ CompositorOGL::GetShaderConfigFor(Effect
   switch(aEffect->mType) {
   case EFFECT_SOLID_COLOR:
     config.SetRenderColor(true);
     break;
   case EFFECT_YCBCR:
     config.SetYCbCr(true);
     break;
   case EFFECT_COMPONENT_ALPHA:
+  {
     config.SetComponentAlpha(true);
+    EffectComponentAlpha* effectComponentAlpha =
+      static_cast<EffectComponentAlpha*>(aEffect);
+    gfx::SurfaceFormat format = effectComponentAlpha->mOnWhite->GetFormat();
+    config.SetRBSwap(format == gfx::SurfaceFormat::B8G8R8A8 ||
+                     format == gfx::SurfaceFormat::B8G8R8X8);
     break;
+  }
   case EFFECT_RENDER_TARGET:
     config.SetTextureTarget(mFBOTextureTarget);
     break;
   default:
   {
     MOZ_ASSERT(aEffect->mType == EFFECT_RGB);
     TexturedEffect* texturedEffect =
         static_cast<TexturedEffect*>(aEffect);