зеркало из https://github.com/mozilla/gecko-dev.git
Bug 802143 - Fix calculation of content bounds in ReusableTileStoreOGL. r=bgirard
FrameMetrics changed at some point so that the content rect and scroll offset are stored pre-multiplied by the render resolution. The display-port calculation in this function appears to have always been wrong(?)
This commit is contained in:
Родитель
2e7d6e0063
Коммит
b774e1aa45
|
@ -218,15 +218,25 @@ ReusableTileStoreOGL::DrawTiles(TiledThebesLayerOGL* aLayer,
|
|||
if (parentMetrics.IsScrollable())
|
||||
scrollableLayer = parent;
|
||||
if (!parentMetrics.mDisplayPort.IsEmpty() && scrollableLayer) {
|
||||
displayPort = parent->GetEffectiveTransform().
|
||||
TransformBounds(gfxRect(
|
||||
parentMetrics.mDisplayPort.x, parentMetrics.mDisplayPort.y,
|
||||
parentMetrics.mDisplayPort.width, parentMetrics.mDisplayPort.height));
|
||||
// Get the display-port bounds
|
||||
displayPort = gfxRect(parentMetrics.mDisplayPort.x,
|
||||
parentMetrics.mDisplayPort.y,
|
||||
parentMetrics.mDisplayPort.width,
|
||||
parentMetrics.mDisplayPort.height);
|
||||
|
||||
// Check the scale transform applied to the root layer to determine
|
||||
// the content resolution.
|
||||
Layer* rootLayer = aLayer->Manager()->GetRoot();
|
||||
const gfx3DMatrix& rootTransform = rootLayer->GetTransform();
|
||||
float scaleX = rootTransform.GetXScale();
|
||||
float scaleY = rootTransform.GetYScale();
|
||||
|
||||
// Get the content document bounds
|
||||
const FrameMetrics& metrics = scrollableLayer->GetFrameMetrics();
|
||||
const nsIntSize& contentSize = metrics.mContentRect.Size();
|
||||
gfx::Point scrollOffset =
|
||||
gfx::Point(metrics.mScrollOffset.x * metrics.LayersPixelsPerCSSPixel().width,
|
||||
metrics.mScrollOffset.y * metrics.LayersPixelsPerCSSPixel().height);
|
||||
gfx::Point((metrics.mScrollOffset.x * metrics.LayersPixelsPerCSSPixel().width) / scaleX,
|
||||
(metrics.mScrollOffset.y * metrics.LayersPixelsPerCSSPixel().height) / scaleY);
|
||||
const nsIntPoint& contentOrigin = metrics.mContentRect.TopLeft() -
|
||||
nsIntPoint(NS_lround(scrollOffset.x), NS_lround(scrollOffset.y));
|
||||
gfxRect contentRect = gfxRect(contentOrigin.x, contentOrigin.y,
|
||||
|
|
Загрузка…
Ссылка в новой задаче