Bug 1112332 - Disable all paint heuristics for layers not actively scrolled by APZ. r=kats

* * *
Bug NUMBER - #include CompositorChild.h to fix non-unified build bustage. r?
This commit is contained in:
Benoit Girard 2015-01-02 11:17:59 -05:00
parent d0f0e15823
commit 7d5dbc1211
2 changed files with 43 additions and 2 deletions

View File

@ -13,6 +13,7 @@
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
#include "mozilla/gfx/BaseSize.h" // for BaseSize
#include "mozilla/gfx/Rect.h" // for Rect, RectTyped
#include "mozilla/layers/CompositorChild.h"
#include "mozilla/layers/LayerMetricsWrapper.h" // for LayerMetricsWrapper
#include "mozilla/layers/LayersMessages.h"
#include "mozilla/mozalloc.h" // for operator delete, etc
@ -23,7 +24,6 @@
namespace mozilla {
namespace layers {
ClientTiledPaintedLayer::ClientTiledPaintedLayer(ClientLayerManager* const aManager,
ClientLayerManager::PaintedLayerCreationHint aCreationHint)
: PaintedLayer(aManager,
@ -177,6 +177,36 @@ ClientTiledPaintedLayer::BeginPaint()
TILING_LOG("TILING %p: Scroll offset %s\n", this, Stringify(mPaintData.mScrollOffset).c_str());
}
bool
ClientTiledPaintedLayer::IsScrollingOnCompositor(const FrameMetrics& aParentMetrics)
{
CompositorChild* compositor = nullptr;
if (Manager() && Manager()->AsClientLayerManager()) {
compositor = Manager()->AsClientLayerManager()->GetCompositorChild();
}
if (!compositor) {
return false;
}
FrameMetrics compositorMetrics;
if (!compositor->LookupCompositorFrameMetrics(aParentMetrics.GetScrollId(),
compositorMetrics)) {
return false;
}
// 1 is a tad high for a fuzzy equals epsilon however if our scroll delta
// is so small then we have nothing to gain from using paint heuristics.
float COORDINATE_EPSILON = 1.f;
return !FuzzyEqualsAdditive(compositorMetrics.GetScrollOffset().x,
aParentMetrics.GetScrollOffset().x,
COORDINATE_EPSILON) ||
!FuzzyEqualsAdditive(compositorMetrics.GetScrollOffset().y,
aParentMetrics.GetScrollOffset().y,
COORDINATE_EPSILON);
}
bool
ClientTiledPaintedLayer::UseFastPath()
{
@ -191,7 +221,13 @@ ClientTiledPaintedLayer::UseFastPath()
|| gfxPrefs::UseLowPrecisionBuffer()
|| !parentMetrics.GetCriticalDisplayPort().IsEmpty();
bool isFixed = GetIsFixedPosition() || GetParent()->GetIsFixedPosition();
return !multipleTransactionsNeeded || isFixed || parentMetrics.GetDisplayPort().IsEmpty();
bool isScrollable = parentMetrics.IsScrollable();
return !multipleTransactionsNeeded || isFixed || !isScrollable
#if !defined(MOZ_WIDGET_ANDROID) || defined(MOZ_ANDROID_APZ)
|| !IsScrollingOnCompositor(parentMetrics)
#endif
;
}
bool

View File

@ -101,6 +101,11 @@ private:
*/
bool UseFastPath();
/**
* Check if the layer is being scrolled by APZ on the compositor.
*/
bool IsScrollingOnCompositor(const FrameMetrics& aParentMetrics);
/**
* Helper function to do the high-precision paint.
* This function returns true if it updated the paint buffer.