Bug 1132626 - Indicate component alpha on layer borders of tiled layers + tiles. r=bgirard
authorMarkus Stange <mstange@themasta.com>
Thu, 12 Feb 2015 16:02:31 -0500
changeset 230024 13622d451fded39e5abe1991e7d4bc34119eb732
parent 230023 21771a04f183fa5b1db518d2b5a312f6bdd3c047
child 230025 dfb2d0f9a97c030fffc81a67dbee1efe94caaa06
push id55880
push usermstange@themasta.com
push dateFri, 20 Feb 2015 19:05:25 +0000
treeherdermozilla-inbound@13622d451fde [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgirard
bugs1132626
milestone38.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1132626 - Indicate component alpha on layer borders of tiled layers + tiles. r=bgirard
gfx/layers/composite/TiledContentHost.cpp
--- a/gfx/layers/composite/TiledContentHost.cpp
+++ b/gfx/layers/composite/TiledContentHost.cpp
@@ -527,17 +527,21 @@ TiledContentHost::RenderTile(const TileH
                      rect->width, rect->height);
 
     effect->mTextureCoords = Rect(textureRect.x / aTextureBounds.width,
                                   textureRect.y / aTextureBounds.height,
                                   textureRect.width / aTextureBounds.width,
                                   textureRect.height / aTextureBounds.height);
     mCompositor->DrawQuad(graphicsRect, aClipRect, aEffectChain, aOpacity, aTransform);
   }
-  mCompositor->DrawDiagnostics(DiagnosticFlags::CONTENT | DiagnosticFlags::TILE,
+  DiagnosticFlags flags = DiagnosticFlags::CONTENT | DiagnosticFlags::TILE;
+  if (aTile.mTextureHostOnWhite) {
+    flags |= DiagnosticFlags::COMPONENT_ALPHA;
+  }
+  mCompositor->DrawDiagnostics(flags,
                                aScreenRegion, aClipRect, aTransform, mFlashCounter);
 }
 
 void
 TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
                                     const gfxRGBA* aBackgroundColor,
                                     EffectChain& aEffectChain,
                                     float aOpacity,
@@ -574,16 +578,18 @@ TiledContentHost::RenderLayerBuffer(Tile
     maskRegion.ScaleRoundOut(layerScale.width, layerScale.height);
   }
 
   // Make sure the resolution and difference in frame resolution are accounted
   // for in the layer transform.
   aTransform.PreScale(1/(resolution * layerScale.width),
                       1/(resolution * layerScale.height), 1);
 
+  DiagnosticFlags componentAlphaDiagnostic = DiagnosticFlags::NO_DIAGNOSTIC;
+
   uint32_t rowCount = 0;
   uint32_t tileX = 0;
   nsIntRect visibleRect = aVisibleRegion.GetBounds();
   gfx::IntSize scaledTileSize = aLayerBuffer.GetScaledTileSize();
   for (int32_t x = visibleRect.x; x < visibleRect.x + visibleRect.width;) {
     rowCount++;
     int32_t tileStartX = aLayerBuffer.GetTileStart(x, scaledTileSize.width);
     int32_t w = scaledTileSize.width - tileStartX;
@@ -610,27 +616,30 @@ TiledContentHost::RenderLayerBuffer(Tile
         if (!tileDrawRegion.IsEmpty()) {
           tileDrawRegion.ScaleRoundOut(resolution, resolution);
           nsIntPoint tileOffset((x - tileStartX) * resolution,
                                 (y - tileStartY) * resolution);
           gfx::IntSize tileSize = aLayerBuffer.GetTileSize();
           RenderTile(tileTexture, aBackgroundColor, aEffectChain, aOpacity, aTransform,
                      aFilter, aClipRect, tileDrawRegion, tileOffset,
                      nsIntSize(tileSize.width, tileSize.height));
+          if (tileTexture.mTextureHostOnWhite) {
+            componentAlphaDiagnostic = DiagnosticFlags::COMPONENT_ALPHA;
+          }
         }
       }
       tileY++;
       y += h;
     }
     tileX++;
     x += w;
   }
   gfx::Rect rect(visibleRect.x, visibleRect.y,
                  visibleRect.width, visibleRect.height);
-  GetCompositor()->DrawDiagnostics(DiagnosticFlags::CONTENT,
+  GetCompositor()->DrawDiagnostics(DiagnosticFlags::CONTENT | componentAlphaDiagnostic,
                                    rect, aClipRect, aTransform, mFlashCounter);
 }
 
 void
 TiledContentHost::PrintInfo(std::stringstream& aStream, const char* aPrefix)
 {
   aStream << aPrefix;
   aStream << nsPrintfCString("TiledContentHost (0x%p)", this).get();