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
Родитель cd77a14ff1
Коммит b237e1af13
2 изменённых файлов: 43 добавлений и 2 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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.