Bug 635035, part 1: Separate the extended draw region and computed draw region so that shadow-layer readback gets the same quadrant as what was drawn. r=mattwoodrow

This commit is contained in:
Chris Jones
2011-03-09 11:27:37 -06:00
parent c3cfbf415d
commit e66e769b1e

View File

@@ -426,6 +426,7 @@ protected:
virtual void virtual void
PaintBuffer(gfxContext* aContext, PaintBuffer(gfxContext* aContext,
const nsIntRegion& aRegionToDraw, const nsIntRegion& aRegionToDraw,
const nsIntRegion& aExtendedRegionToDraw,
const nsIntRegion& aRegionToInvalidate, const nsIntRegion& aRegionToInvalidate,
LayerManager::DrawThebesLayerCallback aCallback, LayerManager::DrawThebesLayerCallback aCallback,
void* aCallbackData) void* aCallbackData)
@@ -434,14 +435,14 @@ protected:
BasicManager()->SetTransactionIncomplete(); BasicManager()->SetTransactionIncomplete();
return; return;
} }
aCallback(this, aContext, aRegionToDraw, aRegionToInvalidate, aCallback(this, aContext, aExtendedRegionToDraw, aRegionToInvalidate,
aCallbackData); aCallbackData);
// Everything that's visible has been validated. Do this instead of just // Everything that's visible has been validated. Do this instead of just
// OR-ing with aRegionToDraw, since that can lead to a very complex region // OR-ing with aRegionToDraw, since that can lead to a very complex region
// here (OR doesn't automatically simplify to the simplest possible // here (OR doesn't automatically simplify to the simplest possible
// representation of a region.) // representation of a region.)
nsIntRegion tmp; nsIntRegion tmp;
tmp.Or(mVisibleRegion, aRegionToDraw); tmp.Or(mVisibleRegion, aExtendedRegionToDraw);
mValidRegion.Or(mValidRegion, tmp); mValidRegion.Or(mValidRegion, tmp);
} }
@@ -599,12 +600,13 @@ BasicThebesLayer::PaintThebes(gfxContext* aContext,
// from RGB to RGBA, because we might need to repaint with // from RGB to RGBA, because we might need to repaint with
// subpixel AA) // subpixel AA)
state.mRegionToInvalidate.And(state.mRegionToInvalidate, mVisibleRegion); state.mRegionToInvalidate.And(state.mRegionToInvalidate, mVisibleRegion);
state.mRegionToDraw.ExtendForScaling(paintXRes, paintYRes); nsIntRegion extendedDrawRegion = state.mRegionToDraw;
extendedDrawRegion.ExtendForScaling(paintXRes, paintYRes);
mXResolution = paintXRes; mXResolution = paintXRes;
mYResolution = paintYRes; mYResolution = paintYRes;
SetAntialiasingFlags(this, state.mContext); SetAntialiasingFlags(this, state.mContext);
PaintBuffer(state.mContext, PaintBuffer(state.mContext,
state.mRegionToDraw, state.mRegionToInvalidate, state.mRegionToDraw, extendedDrawRegion, state.mRegionToInvalidate,
aCallback, aCallbackData); aCallback, aCallbackData);
Mutated(); Mutated();
} else { } else {
@@ -1795,6 +1797,7 @@ private:
NS_OVERRIDE virtual void NS_OVERRIDE virtual void
PaintBuffer(gfxContext* aContext, PaintBuffer(gfxContext* aContext,
const nsIntRegion& aRegionToDraw, const nsIntRegion& aRegionToDraw,
const nsIntRegion& aExtendedRegionToDraw,
const nsIntRegion& aRegionToInvalidate, const nsIntRegion& aRegionToInvalidate,
LayerManager::DrawThebesLayerCallback aCallback, LayerManager::DrawThebesLayerCallback aCallback,
void* aCallbackData); void* aCallbackData);
@@ -1854,11 +1857,13 @@ BasicShadowableThebesLayer::SetBackBufferAndAttrs(const ThebesBuffer& aBuffer,
void void
BasicShadowableThebesLayer::PaintBuffer(gfxContext* aContext, BasicShadowableThebesLayer::PaintBuffer(gfxContext* aContext,
const nsIntRegion& aRegionToDraw, const nsIntRegion& aRegionToDraw,
const nsIntRegion& aExtendedRegionToDraw,
const nsIntRegion& aRegionToInvalidate, const nsIntRegion& aRegionToInvalidate,
LayerManager::DrawThebesLayerCallback aCallback, LayerManager::DrawThebesLayerCallback aCallback,
void* aCallbackData) void* aCallbackData)
{ {
Base::PaintBuffer(aContext, aRegionToDraw, aRegionToInvalidate, Base::PaintBuffer(aContext,
aRegionToDraw, aExtendedRegionToDraw, aRegionToInvalidate,
aCallback, aCallbackData); aCallback, aCallbackData);
if (!HasShadow()) { if (!HasShadow()) {
return; return;
@@ -1875,7 +1880,8 @@ BasicShadowableThebesLayer::PaintBuffer(gfxContext* aContext,
updatedRegion = aRegionToDraw; updatedRegion = aRegionToDraw;
} }
NS_ASSERTION(mBuffer.BufferRect().Contains(aRegionToDraw.GetBounds()),
"Update outside of buffer rect!");
NS_ABORT_IF_FALSE(IsSurfaceDescriptorValid(mBackBuffer), NS_ABORT_IF_FALSE(IsSurfaceDescriptorValid(mBackBuffer),
"should have a back buffer by now"); "should have a back buffer by now");
BasicManager()->PaintedThebesBuffer(BasicManager()->Hold(this), BasicManager()->PaintedThebesBuffer(BasicManager()->Hold(this),