Bug 814437 - Address review comments that were missed. r=bgirard

In my haste, I forgot to address review comments before pushing. This
corrects indentation in PanningPerf.java, moves GetValidLowPrecisionRegion from
Layer to TiledLayerComposer and corrects checkerboard measurement when there
isn't a low precision buffer and when the display ports don't cover the screen.
This commit is contained in:
Chris Lord 2012-11-30 23:11:37 +00:00
Родитель 381173bc0f
Коммит 64f87da2cf
5 изменённых файлов: 49 добавлений и 12 удалений

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

@ -1148,7 +1148,6 @@ public:
* Can be used anytime
*/
const nsIntRegion& GetValidRegion() const { return mValidRegion; }
virtual const nsIntRegion& GetValidLowPrecisionRegion() const { return mValidRegion; }
virtual ThebesLayer* AsThebesLayer() { return this; }

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

@ -191,6 +191,12 @@ public:
virtual void PaintedTiledLayerBuffer(const BasicTiledLayerBuffer* aTiledBuffer) = 0;
virtual void MemoryPressure() = 0;
/**
* If some part of the buffer is being rendered at a lower precision, this
* returns that region. If it is not, an empty region will be returned.
*/
virtual const nsIntRegion& GetValidLowPrecisionRegion() const = 0;
};
// Normal integer division truncates towards zero,

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

@ -1684,11 +1684,24 @@ LayerManagerOGL::ComputeRenderIntegrityInternal(Layer* aLayer,
SubtractTransformedRegion(aScreenRegion, incompleteRegion, transformToScreen);
// See if there's any incomplete low-precision rendering
incompleteRegion.Sub(incompleteRegion, thebesLayer->GetValidLowPrecisionRegion());
TiledLayerComposer* composer = nullptr;
ShadowLayer* shadow = aLayer->AsShadowLayer();
if (shadow) {
composer = shadow->AsTiledLayerComposer();
if (composer) {
incompleteRegion.Sub(incompleteRegion, composer->GetValidLowPrecisionRegion());
if (!incompleteRegion.IsEmpty()) {
SubtractTransformedRegion(aLowPrecisionScreenRegion, incompleteRegion, transformToScreen);
}
}
}
// If we can't get a valid low precision region, assume it's the same as
// the high precision region.
if (!composer) {
SubtractTransformedRegion(aLowPrecisionScreenRegion, incompleteRegion, transformToScreen);
}
}
}
static int
@ -1748,7 +1761,6 @@ LayerManagerOGL::ComputeRenderIntegrity()
#ifdef MOZ_ANDROID_OMTC
// Use the transform on the primary scrollable layer and its FrameMetrics
// to find out how much of the viewport the current displayport covers
bool hasLowPrecision = true;
Layer* primaryScrollable = GetPrimaryScrollableLayer();
if (primaryScrollable) {
// This is derived from the code in
@ -1761,7 +1773,24 @@ LayerManagerOGL::ComputeRenderIntegrity()
transform.ScalePost(devPixelRatioX, devPixelRatioY, 1);
const FrameMetrics& metrics = primaryScrollable->AsContainerLayer()->GetFrameMetrics();
// Clip the screen rect to the document bounds
gfxRect documentBounds =
transform.TransformBounds(gfxRect(metrics.mScrollableRect.x - metrics.mScrollOffset.x,
metrics.mScrollableRect.y - metrics.mScrollOffset.y,
metrics.mScrollableRect.width,
metrics.mScrollableRect.height));
documentBounds.RoundOut();
screenRect = screenRect.Intersect(nsIntRect(documentBounds.x, documentBounds.y,
documentBounds.width, documentBounds.height));
// If the screen rect is empty, the user has scrolled entirely into
// over-scroll and so we can be considered to have full integrity.
if (screenRect.IsEmpty()) {
return 1.0f;
}
// Work out how much of the critical display-port covers the screen
bool hasLowPrecision = false;
if (!metrics.mCriticalDisplayPort.IsEmpty()) {
hasLowPrecision = true;
highPrecisionMultiplier =
@ -1774,11 +1803,16 @@ LayerManagerOGL::ComputeRenderIntegrity()
lowPrecisionMultiplier =
GetDisplayportCoverage(metrics.mDisplayPort, transform, screenRect);
} else {
highPrecisionMultiplier =
lowPrecisionMultiplier = highPrecisionMultiplier =
GetDisplayportCoverage(metrics.mDisplayPort, transform, screenRect);
}
}
}
// If none of the screen is covered, we have zero integrity.
if (highPrecisionMultiplier <= 0.0f && lowPrecisionMultiplier <= 0.0f) {
return 0.0f;
}
#endif // MOZ_ANDROID_OMTC
nsIntRegion screenRegion(screenRect);
@ -1798,7 +1832,7 @@ LayerManagerOGL::ComputeRenderIntegrity()
}
return ((highPrecisionIntegrity * highPrecisionMultiplier) +
(lowPrecisionIntegrity * lowPrecisionMultiplier)) / 2.f;
(lowPrecisionIntegrity * lowPrecisionMultiplier)) / 2;
}
return 1.f;

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

@ -113,9 +113,6 @@ public:
TiledThebesLayerOGL(LayerManagerOGL *aManager);
virtual ~TiledThebesLayerOGL();
// Layer implementation
const nsIntRegion& GetValidLowPrecisionRegion() const { return mLowPrecisionVideoMemoryTiledBuffer.GetValidRegion(); }
// LayerOGL impl
void Destroy() {}
Layer* GetLayer() { return this; }
@ -135,6 +132,7 @@ public:
void PaintedTiledLayerBuffer(const BasicTiledLayerBuffer* mTiledBuffer);
void ProcessUploadQueue();
void ProcessLowPrecisionUploadQueue();
const nsIntRegion& GetValidLowPrecisionRegion() const { return mLowPrecisionVideoMemoryTiledBuffer.GetValidRegion(); }
void MemoryPressure();