Bug 1243589 - Use SingleTiledContentClient even for scrollable layers if the layer is smaller than a single tile. r=mattwoodrow

MozReview-Commit-ID: LHIrrtFfRgm
This commit is contained in:
Kartikaya Gupta 2016-02-11 16:49:04 -05:00
parent 244ab09ed6
commit e26ed3613b
7 changed files with 19 additions and 17 deletions

View File

@ -28,6 +28,7 @@ ClientTiledPaintedLayer::ClientTiledPaintedLayer(ClientLayerManager* const aMana
ClientLayerManager::PaintedLayerCreationHint aCreationHint)
: PaintedLayer(aManager, static_cast<ClientLayer*>(this), aCreationHint)
, mContentClient()
, mHaveSingleTiledContentClient(false)
{
MOZ_COUNT_CTOR(ClientTiledPaintedLayer);
mPaintData.mLastScrollOffset = ParentLayerPoint(0, 0);
@ -411,18 +412,26 @@ ClientTiledPaintedLayer::RenderLayer()
void *data = ClientManager()->GetPaintedLayerCallbackData();
IntSize layerSize = mVisibleRegion.ToUnknownRegion().GetBounds().Size();
if (mContentClient && !mContentClient->SupportsLayerSize(layerSize, ClientManager())) {
IntSize tileSize(gfxPlatform::GetPlatform()->GetTileWidth(),
gfxPlatform::GetPlatform()->GetTileHeight());
bool wantSingleTiledContentClient =
(mCreationHint == LayerManager::NONE || layerSize <= tileSize) &&
SingleTiledContentClient::ClientSupportsLayerSize(layerSize, ClientManager()) &&
gfxPrefs::LayersSingleTileEnabled();
if (mContentClient && mHaveSingleTiledContentClient && !wantSingleTiledContentClient) {
mContentClient = nullptr;
mValidRegion.SetEmpty();
}
if (!mContentClient) {
if (mCreationHint == LayerManager::NONE &&
SingleTiledContentClient::ClientSupportsLayerSize(layerSize, ClientManager()) &&
gfxPrefs::LayersSingleTileEnabled()) {
if (wantSingleTiledContentClient) {
mContentClient = new SingleTiledContentClient(this, ClientManager());
mHaveSingleTiledContentClient = true;
} else {
mContentClient = new MultiTiledContentClient(this, ClientManager());
mHaveSingleTiledContentClient = false;
}
mContentClient->Connect();

View File

@ -133,6 +133,9 @@ private:
void EndPaint();
RefPtr<TiledContentClient> mContentClient;
// Flag to indicate if mContentClient is a SingleTiledContentClient. This is
// only valid when mContentClient is non-null.
bool mHaveSingleTiledContentClient;
nsIntRegion mLowPrecisionValidRegion;
BasicTiledLayerPaintData mPaintData;
};

View File

@ -46,12 +46,6 @@ SingleTiledContentClient::ClientSupportsLayerSize(const gfx::IntSize& aSize, Cli
return aSize.width <= maxTextureSize && aSize.height <= maxTextureSize;
}
bool
SingleTiledContentClient::SupportsLayerSize(const gfx::IntSize& aSize, ClientLayerManager* aManager) const
{
return ClientSupportsLayerSize(aSize, aManager);
}
ClientSingleTiledLayerBuffer::ClientSingleTiledLayerBuffer(ClientTiledPaintedLayer* aPaintedLayer,
CompositableClient* aCompositableClient,
ClientLayerManager* aManager)

View File

@ -127,8 +127,6 @@ public:
virtual ClientTiledLayerBuffer* GetTiledBuffer() override { return mTiledBuffer; }
virtual ClientTiledLayerBuffer* GetLowPrecisionTiledBuffer() override { return nullptr; }
virtual bool SupportsLayerSize(const gfx::IntSize& aSize, ClientLayerManager* aManager) const override;
private:
RefPtr<ClientSingleTiledLayerBuffer> mTiledBuffer;
};

View File

@ -628,9 +628,6 @@ public:
};
virtual void UpdatedBuffer(TiledBufferType aType) = 0;
virtual bool SupportsLayerSize(const gfx::IntSize& aSize, ClientLayerManager* aManager) const
{ return true; }
private:
const char* mName;
};

View File

@ -51,7 +51,7 @@ pref(layout.animated-image-layers.enabled,true) skip-if(Android||gtkWidget) == t
!= clipped-animated-transform-1.html about:blank
!= paintedlayer-recycling-1.html about:blank
!= paintedlayer-recycling-2.html about:blank
!= paintedlayer-recycling-3.html about:blank
pref(layers.single-tile.enabled,false) != paintedlayer-recycling-3.html about:blank
!= paintedlayer-recycling-4.html about:blank
!= paintedlayer-recycling-5.html about:blank
!= paintedlayer-recycling-6.html about:blank
@ -67,7 +67,7 @@ pref(layout.animated-image-layers.enabled,true) skip-if(Android||gtkWidget) == t
!= layer-splitting-7.html about:blank
fuzzy-if(gtkWidget,2,4) fuzzy-if(asyncPan,2,3955) fuzzy-if(OSX,179,30) == image-scrolling-zoom-1.html image-scrolling-zoom-1-ref.html
!= image-scrolling-zoom-1-ref.html image-scrolling-zoom-1-notref.html
!= fast-scrolling.html about:blank
pref(layers.single-tile.enabled,false) != fast-scrolling.html about:blank
!= fractional-transform-1.html about:blank
!= fractional-transform-2.html about:blank
!= fractional-transform-3.html about:blank

View File

@ -4379,6 +4379,7 @@ pref("layers.draw-tile-borders", false);
pref("layers.draw-bigimage-borders", false);
pref("layers.frame-counter", false);
pref("layers.enable-tiles", false);
pref("layers.single-tile.enabled", true);
pref("layers.tiled-drawtarget.enabled", false);
pref("layers.low-precision-buffer", false);
pref("layers.progressive-paint", false);