From cd3cc3e99f33df97f21be6d60f242b5f5a31388b Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Wed, 29 Jul 2015 12:01:21 -0400 Subject: [PATCH] Bug 1180326 - Part 2: Add support for variable tile sizes. r=jrmuizel --- gfx/layers/TiledLayerBuffer.h | 3 ++- gfx/layers/client/TiledContentClient.cpp | 1 + gfx/layers/composite/TiledContentHost.cpp | 5 ++++- gfx/layers/ipc/LayersMessages.ipdlh | 2 ++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gfx/layers/TiledLayerBuffer.h b/gfx/layers/TiledLayerBuffer.h index 1c741184f35..7d764a9640a 100644 --- a/gfx/layers/TiledLayerBuffer.h +++ b/gfx/layers/TiledLayerBuffer.h @@ -150,7 +150,7 @@ public: gfx::IntPoint GetTileOffset(TileIntPoint aPosition) const { gfx::IntSize scaledTileSize = GetScaledTileSize(); return gfx::IntPoint(aPosition.x * scaledTileSize.width, - aPosition.y * scaledTileSize.height); + aPosition.y * scaledTileSize.height) + mTileOrigin; } const TilesPlacement& GetPlacement() const { return mTiles; } @@ -194,6 +194,7 @@ protected: TilesPlacement mTiles; float mResolution; gfx::IntSize mTileSize; + gfx::IntPoint mTileOrigin; }; template void diff --git a/gfx/layers/client/TiledContentClient.cpp b/gfx/layers/client/TiledContentClient.cpp index 9630746f3d5..1620ecc66c5 100644 --- a/gfx/layers/client/TiledContentClient.cpp +++ b/gfx/layers/client/TiledContentClient.cpp @@ -868,6 +868,7 @@ ClientMultiTiledLayerBuffer::GetSurfaceDescriptorTiles() } return SurfaceDescriptorTiles(mValidRegion, tiles, + mTileOrigin, mTileSize, mTiles.mFirst.x, mTiles.mFirst.y, mTiles.mSize.width, mTiles.mSize.height, mResolution, mFrameResolution.xScale, diff --git a/gfx/layers/composite/TiledContentHost.cpp b/gfx/layers/composite/TiledContentHost.cpp index a1ddf29ca4d..567bd37f6c6 100644 --- a/gfx/layers/composite/TiledContentHost.cpp +++ b/gfx/layers/composite/TiledContentHost.cpp @@ -242,7 +242,8 @@ TiledLayerBufferComposite::UseTiles(const SurfaceDescriptorTiles& aTiles, Compositor* aCompositor, ISurfaceAllocator* aAllocator) { - if (mResolution != aTiles.resolution()) { + if (mResolution != aTiles.resolution() || + aTiles.tileSize() != mTileSize) { Clear(); } MOZ_ASSERT(aAllocator); @@ -352,6 +353,8 @@ TiledLayerBufferComposite::UseTiles(const SurfaceDescriptorTiles& aTiles, } mTiles = newTiles; + mTileSize = aTiles.tileSize(); + mTileOrigin = aTiles.tileOrigin(); mValidRegion = aTiles.validRegion(); mResolution = aTiles.resolution(); mFrameResolution = CSSToParentLayerScale2D(aTiles.frameXResolution(), diff --git a/gfx/layers/ipc/LayersMessages.ipdlh b/gfx/layers/ipc/LayersMessages.ipdlh index 9e4590df046..ce75d526cb9 100644 --- a/gfx/layers/ipc/LayersMessages.ipdlh +++ b/gfx/layers/ipc/LayersMessages.ipdlh @@ -333,6 +333,8 @@ union TileDescriptor { struct SurfaceDescriptorTiles { nsIntRegion validRegion; TileDescriptor[] tiles; + IntPoint tileOrigin; + IntSize tileSize; int firstTileX; int firstTileY; int retainedWidth;