Bug 982651 - Make sure to retain the frame resolution of tiled buffers. r=nical
authorChris Lord <chrislord.net@gmail.com>
Fri, 14 Mar 2014 13:36:33 +0000
changeset 190858 7e40555e25f7db773925d361d0478eb0c953e09c
parent 190857 1e6deb0428f974b9e1ed4d86d03c73a03907ec1b
child 190859 6f9de0cc867b54e6ab091196c29dcc9d4cebbcdf
push idunknown
push userunknown
push dateunknown
reviewersnical
bugs982651
milestone30.0a1
Bug 982651 - Make sure to retain the frame resolution of tiled buffers. r=nical Make sure the frame resolution of tiled buffers isn't discarded when they're sent from client-side to host-side. This fixes drawing of low precision tiles when the zoom has changed since they were last drawn.
gfx/layers/client/SimpleTiledContentClient.cpp
gfx/layers/client/TiledContentClient.cpp
gfx/layers/composite/TiledContentHost.cpp
gfx/layers/ipc/LayersMessages.ipdlh
--- a/gfx/layers/client/SimpleTiledContentClient.cpp
+++ b/gfx/layers/client/SimpleTiledContentClient.cpp
@@ -198,17 +198,17 @@ SimpleTiledLayerBuffer::GetSurfaceDescri
   InfallibleTArray<TileDescriptor> tiles;
 
   for (size_t i = 0; i < mRetainedTiles.Length(); i++) {
     tiles.AppendElement(mRetainedTiles[i].GetTileDescriptor());
   }
 
   return SurfaceDescriptorTiles(mValidRegion, mPaintedRegion,
                                 tiles, mRetainedWidth, mRetainedHeight,
-                                mResolution);
+                                mResolution, mFrameResolution.scale);
 }
 
 bool
 SimpleTiledLayerBuffer::HasFormatChanged() const
 {
   return mThebesLayer->CanUseOpaqueSurface() != mLastPaintOpaque;
 }
 
--- a/gfx/layers/client/TiledContentClient.cpp
+++ b/gfx/layers/client/TiledContentClient.cpp
@@ -603,17 +603,17 @@ ClientTiledLayerBuffer::GetSurfaceDescri
       tileDesc = PlaceholderTileDescriptor();
     } else {
       tileDesc = mRetainedTiles[i].GetTileDescriptor();
     }
     tiles.AppendElement(tileDesc);
   }
   return SurfaceDescriptorTiles(mValidRegion, mPaintedRegion,
                                 tiles, mRetainedWidth, mRetainedHeight,
-                                mResolution);
+                                mResolution, mFrameResolution.scale);
 }
 
 void
 ClientTiledLayerBuffer::PaintThebes(const nsIntRegion& aNewValidRegion,
                                    const nsIntRegion& aPaintRegion,
                                    LayerManager::DrawThebesLayerCallback aCallback,
                                    void* aCallbackData)
 {
--- a/gfx/layers/composite/TiledContentHost.cpp
+++ b/gfx/layers/composite/TiledContentHost.cpp
@@ -29,25 +29,25 @@ TiledLayerBufferComposite::TiledLayerBuf
   : mFrameResolution(1.0)
   , mHasDoubleBufferedTiles(false)
   , mUninitialized(true)
 {}
 
 TiledLayerBufferComposite::TiledLayerBufferComposite(ISurfaceAllocator* aAllocator,
                                                      const SurfaceDescriptorTiles& aDescriptor,
                                                      const nsIntRegion& aOldPaintedRegion)
-  : mFrameResolution(1.0)
 {
   mUninitialized = false;
   mHasDoubleBufferedTiles = false;
   mValidRegion = aDescriptor.validRegion();
   mPaintedRegion = aDescriptor.paintedRegion();
   mRetainedWidth = aDescriptor.retainedWidth();
   mRetainedHeight = aDescriptor.retainedHeight();
   mResolution = aDescriptor.resolution();
+  mFrameResolution = CSSToScreenScale(aDescriptor.frameResolution());
 
   // Combine any valid content that wasn't already uploaded
   nsIntRegion oldPaintedRegion(aOldPaintedRegion);
   oldPaintedRegion.And(oldPaintedRegion, mValidRegion);
   mPaintedRegion.Or(mPaintedRegion, oldPaintedRegion);
 
   const InfallibleTArray<TileDescriptor>& tiles = aDescriptor.tiles();
   for(size_t i = 0; i < tiles.Length(); i++) {
--- a/gfx/layers/ipc/LayersMessages.ipdlh
+++ b/gfx/layers/ipc/LayersMessages.ipdlh
@@ -281,16 +281,17 @@ union TileDescriptor {
 
 struct SurfaceDescriptorTiles {
   nsIntRegion validRegion;
   nsIntRegion paintedRegion;
   TileDescriptor[] tiles;
   int         retainedWidth;
   int         retainedHeight;
   float       resolution;
+  float       frameResolution;
 };
 
 struct OpUseTiledLayerBuffer {
   PCompositable compositable;
   SurfaceDescriptorTiles tileLayerDescriptor;
 };
 
 struct OpCreatedTexture {