Bug 794130 - Abort drawing if appropriate when using progressive tile updates. r=bgirard,blassey

Add a function to BasicLayerManager to check if it's appropriate to abort an
ongoing progressive update, and add an Android-specific implementation in
mobile/android/base/gfx/GeckoLayerClient.java.
This commit is contained in:
Chris Lord
2012-10-04 14:45:16 -04:00
parent cbc870f922
commit 4831ec5cb7
9 changed files with 159 additions and 10 deletions

View File

@@ -27,6 +27,10 @@
#include "mozilla/Preferences.h"
#include "nsIWidget.h"
#ifdef MOZ_WIDGET_ANDROID
#include "AndroidBridge.h"
#endif
using namespace mozilla::dom;
using namespace mozilla::gfx;
@@ -1272,6 +1276,32 @@ BasicShadowLayerManager::SetIsFirstPaint()
ShadowLayerForwarder::SetIsFirstPaint();
}
bool
BasicShadowLayerManager::ShouldAbortProgressiveUpdate(bool aHasPendingNewThebesContent)
{
#ifdef MOZ_WIDGET_ANDROID
Layer* primaryScrollable = GetPrimaryScrollableLayer();
if (primaryScrollable) {
const FrameMetrics& metrics = primaryScrollable->AsContainerLayer()->GetFrameMetrics();
// This is derived from the code in
// gfx/layers/ipc/CompositorParent.cpp::TransformShadowTree.
const gfx3DMatrix& rootTransform = GetRoot()->GetTransform();
float devPixelRatioX = 1 / rootTransform.GetXScale();
float devPixelRatioY = 1 / rootTransform.GetYScale();
gfx::Rect displayPort((metrics.mDisplayPort.x + metrics.mScrollOffset.x) * devPixelRatioX,
(metrics.mDisplayPort.y + metrics.mScrollOffset.y) * devPixelRatioY,
metrics.mDisplayPort.width * devPixelRatioX,
metrics.mDisplayPort.height * devPixelRatioY);
return AndroidBridge::Bridge()->ShouldAbortProgressiveUpdate(
aHasPendingNewThebesContent, displayPort, devPixelRatioX);
}
#endif
return false;
}
already_AddRefed<ThebesLayer>
BasicShadowLayerManager::CreateThebesLayer()
{