Bug 611315 - Fix handling of rotated ShadowBufferOGL

Although we currently have buffer rotation disabled for shadow buffers when
using the GL layer manager, if you re-enable it, it will be broken. This is
because we don't take into account the rotation when handling updates.

This fixes that handling by offsetting the updated region by the rotation,
and if that new region crosses texture boundaries, splitting it into
multiple uploads.
This commit is contained in:
Chris Lord 2011-08-24 15:10:03 +01:00
parent 42d612afd7
commit 2aa06762af

View File

@ -847,6 +847,18 @@ ShadowBufferOGL::Upload(gfxASurface* aUpdate, const nsIntRegion& aUpdated,
nsIntPoint visTopLeft = mLayer->GetVisibleRegion().GetBounds().TopLeft();
destRegion.MoveBy(-visTopLeft);
// Correct for rotation
destRegion.MoveBy(aRotation);
nsIntRect destBounds = destRegion.GetBounds();
destRegion.MoveBy((destBounds.x >= size.width) ? -size.width : 0,
(destBounds.y >= size.height) ? -size.height : 0);
// There's code to make sure that updated regions don't cross rotation
// boundaries, so assert here that this is the case
NS_ASSERTION(((destBounds.x % size.width) + destBounds.width <= size.width) &&
((destBounds.y % size.height) + destBounds.height <= size.height),
"Updated region lies across rotation boundaries!");
// NB: this gfxContext must not escape EndUpdate() below
mTexImage->DirectUpdate(aUpdate, destRegion);