Bug 1189710 - Use correct offset for LayerRenderState in TiledContentHost. r=jrmuizel
authorMatt Woodrow <mwoodrow@mozilla.com>
Fri, 31 Jul 2015 17:04:43 -0400
changeset 287411 5e2957aef3c4d26defce7240c2b026eb619280a7
parent 287410 37c0c54364f498f3e55228f520ad0f46d79a84f1
child 287412 dfbd02568bdb066a7c2db1fb77c2ec1446659076
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1189710
milestone42.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 1189710 - Use correct offset for LayerRenderState in TiledContentHost. r=jrmuizel
gfx/layers/composite/TiledContentHost.h
--- a/gfx/layers/composite/TiledContentHost.h
+++ b/gfx/layers/composite/TiledContentHost.h
@@ -190,24 +190,27 @@ public:
   virtual LayerRenderState GetRenderState() override
   {
     // If we have exactly one high precision tile, then we can support hwc.
     if (mTiledBuffer.GetTileCount() == 1 &&
         mLowPrecisionTiledBuffer.GetTileCount() == 0) {
       TextureHost* host = mTiledBuffer.GetTile(0).mTextureHost;
       if (host) {
         MOZ_ASSERT(!mTiledBuffer.GetTile(0).mTextureHostOnWhite, "Component alpha not supported!");
-        LayerRenderState state = host->GetRenderState();
 
-        // Offset by the distance between the start of the valid (visible) region and the top-left
-        // of the tile.
         gfx::IntPoint offset = mTiledBuffer.GetTileOffset(mTiledBuffer.GetPlacement().TilePosition(0));
 
-        state.SetOffset(offset - GetValidRegion().GetBounds().TopLeft());
-        return host->GetRenderState();
+        // Don't try to use HWC if the content doesn't start at the top-left of the tile.
+        if (offset != GetValidRegion().GetBounds().TopLeft()) {
+          return LayerRenderState();
+        }
+
+        LayerRenderState state = host->GetRenderState();
+        state.SetOffset(offset);
+        return state;
       }
     }
     return LayerRenderState();
   }
 
 
   virtual bool UpdateThebes(const ThebesBufferData& aData,
                             const nsIntRegion& aUpdated,