--- a/gfx/layers/client/TiledContentClient.cpp
+++ b/gfx/layers/client/TiledContentClient.cpp
@@ -738,20 +738,22 @@ ClientTiledLayerBuffer::ValidateTile(Til
// the calling code will already have taken care of invalidating the entire
// layer.
if (HasFormatChanged()) {
aTile.DiscardBackBuffer();
aTile.DiscardFrontBuffer();
}
bool createdTextureClient = false;
- nsIntRegion offsetDirtyRegion = aDirtyRegion.MovedBy(-aTileOrigin);
+ nsIntRegion offsetScaledDirtyRegion = aDirtyRegion.MovedBy(-aTileOrigin);
+ offsetScaledDirtyRegion.ScaleRoundOut(mResolution, mResolution);
+
bool usingSinglePaintBuffer = !!mSinglePaintDrawTarget;
RefPtr<TextureClient> backBuffer =
- aTile.GetBackBuffer(offsetDirtyRegion,
+ aTile.GetBackBuffer(offsetScaledDirtyRegion,
mManager->GetTexturePool(gfxPlatform::GetPlatform()->Optimal2DFormatForContent(GetContentType())),
&createdTextureClient, !usingSinglePaintBuffer);
if (!backBuffer->Lock(OPEN_READ_WRITE)) {
NS_WARNING("Failed to lock tile TextureClient for updating.");
aTile.DiscardFrontBuffer();
return aTile;
}
@@ -787,53 +789,60 @@ ClientTiledLayerBuffer::ValidateTile(Til
drawTarget->CopySurface(source, copyRect, copyTarget);
// Mark the newly updated area as invalid in the front buffer
aTile.mInvalidFront.Or(aTile.mInvalidFront, nsIntRect(copyTarget.x, copyTarget.y, copyRect.width, copyRect.height));
}
// The new buffer is now validated, remove the dirty region from it.
aTile.mInvalidBack.Sub(nsIntRect(0, 0, TILEDLAYERBUFFER_TILE_SIZE, TILEDLAYERBUFFER_TILE_SIZE),
- offsetDirtyRegion);
+ offsetScaledDirtyRegion);
} else {
// Area of the full tile...
- nsIntRegion tileRegion = nsIntRect(aTileOrigin.x, aTileOrigin.y, TILEDLAYERBUFFER_TILE_SIZE, TILEDLAYERBUFFER_TILE_SIZE);
+ nsIntRegion tileRegion =
+ nsIntRect(aTileOrigin.x, aTileOrigin.y,
+ GetScaledTileLength(), GetScaledTileLength());
// Intersect this area with the portion that's dirty.
tileRegion = tileRegion.Intersect(aDirtyRegion);
- // Move invalid areas into layer space.
- aTile.mInvalidFront.MoveBy(aTileOrigin);
- aTile.mInvalidBack.MoveBy(aTileOrigin);
+ // Add the resolution scale to store the dirty region.
+ nsIntPoint unscaledTileOrigin = nsIntPoint(aTileOrigin.x * mResolution,
+ aTileOrigin.y * mResolution);
+ nsIntRegion unscaledTileRegion(tileRegion);
+ unscaledTileRegion.ScaleRoundOut(mResolution, mResolution);
+
+ // Move invalid areas into scaled layer space.
+ aTile.mInvalidFront.MoveBy(unscaledTileOrigin);
+ aTile.mInvalidBack.MoveBy(unscaledTileOrigin);
// Add the area that's going to be redrawn to the invalid area of the
// front region.
- aTile.mInvalidFront.Or(aTile.mInvalidFront, tileRegion);
+ aTile.mInvalidFront.Or(aTile.mInvalidFront, unscaledTileRegion);
// Add invalid areas of the backbuffer to the area to redraw.
tileRegion.Or(tileRegion, aTile.mInvalidBack);
// Move invalid areas back into tile space.
- aTile.mInvalidFront.MoveBy(-aTileOrigin);
+ aTile.mInvalidFront.MoveBy(-unscaledTileOrigin);
// This will be validated now.
aTile.mInvalidBack.SetEmpty();
nsIntRect bounds = tileRegion.GetBounds();
- bounds.ScaleRoundOut(mResolution, mResolution);
bounds.MoveBy(-aTileOrigin);
if (GetContentType() != gfxContentType::COLOR) {
drawTarget->ClearRect(Rect(bounds.x, bounds.y, bounds.width, bounds.height));
}
ctxt->NewPath();
ctxt->Clip(gfxRect(bounds.x, bounds.y, bounds.width, bounds.height));
+ ctxt->Translate(gfxPoint(-unscaledTileOrigin.x, -unscaledTileOrigin.y));
ctxt->Scale(mResolution, mResolution);
- ctxt->Translate(gfxPoint(-aTileOrigin.x, -aTileOrigin.y));
mCallback(mThebesLayer, ctxt,
tileRegion.GetBounds(),
DrawRegionClip::CLIP_NONE,
nsIntRegion(), mCallbackData);
}
#ifdef GFX_TILEDLAYER_DEBUG_OVERLAY