Backed out 3 changesets (bug 1396489) for unexpected assertion failures

Backed out changeset 75ffa3ed13d5 (bug 1396489)
Backed out changeset fc779b639aeb (bug 1396489)
Backed out changeset dcfd73044bba (bug 1396489)

MozReview-Commit-ID: DvGlDLZF2nO
This commit is contained in:
Phil Ringnalda 2017-09-04 21:09:04 -07:00
parent 5d0cbad001
commit e761d397b7
7 changed files with 54 additions and 32 deletions

View File

@ -96,7 +96,10 @@ BasicLayerManager::PushGroupForLayer(gfxContext* aContext, Layer* aLayer, const
gfxUtils::ClipToRegion(aGroupResult.mFinalTarget, aGroupResult.mVisibleRegion);
// PushGroup/PopGroup do not support non operator over.
gfxRect rect = aContext->GetClipExtents(gfxContext::eDeviceSpace);
gfxMatrix oldMat = aContext->CurrentMatrix();
aContext->SetMatrix(gfxMatrix());
gfxRect rect = aContext->GetClipExtents();
aContext->SetMatrix(oldMat);
rect.RoundOut();
IntRect surfRect;
ToRect(rect).ToIntRect(&surfRect);
@ -110,7 +113,7 @@ BasicLayerManager::PushGroupForLayer(gfxContext* aContext, Layer* aLayer, const
gfxCriticalNote << "BasicLayerManager context problem in PushGroupForLayer " << gfx::hexa(dt);
return false;
}
ctx->SetMatrix(aContext->CurrentMatrix());
ctx->SetMatrix(oldMat);
aGroupResult.mGroupOffset = surfRect.TopLeft();
aGroupResult.mGroupTarget = ctx;
@ -601,8 +604,13 @@ BasicLayerManager::EndTransactionInternal(DrawPaintedLayerCallback aCallback,
if (mTarget && mRoot &&
!(aFlags & END_NO_IMMEDIATE_REDRAW) &&
!(aFlags & END_NO_COMPOSITE)) {
IntRect clipRect =
ToOutsideIntRect(mTarget->GetClipExtents(gfxContext::eDeviceSpace));
IntRect clipRect;
{
gfxContextMatrixAutoSaveRestore save(mTarget);
mTarget->SetMatrix(gfxMatrix());
clipRect = ToOutsideIntRect(mTarget->GetClipExtents());
}
if (IsRetained()) {
nsIntRegion region;

View File

@ -595,7 +595,7 @@ gfxContext::PopClip()
}
gfxRect
gfxContext::GetClipExtents(ClipExtentsSpace aSpace) const
gfxContext::GetClipExtents()
{
Rect rect = GetAzureDeviceSpaceClipBounds();
@ -603,11 +603,9 @@ gfxContext::GetClipExtents(ClipExtentsSpace aSpace) const
return gfxRect(0, 0, 0, 0);
}
if (aSpace == eUserSpace) {
Matrix mat = mTransform;
mat.Invert();
rect = mat.TransformBounds(rect);
}
Matrix mat = mTransform;
mat.Invert();
rect = mat.TransformBounds(rect);
return ThebesRect(rect);
}
@ -818,13 +816,22 @@ gfxContext::PushGroupForBlendBack(gfxContentType content, Float aOpacity, Source
mDT->PushLayer(content == gfxContentType::COLOR, aOpacity, aMask, aMaskTransform);
}
static gfxRect
GetRoundOutDeviceClipExtents(gfxContext* aCtx)
{
gfxContextMatrixAutoSaveRestore save(aCtx);
aCtx->SetMatrix(gfxMatrix());
gfxRect r = aCtx->GetClipExtents();
r.RoundOut();
return r;
}
void
gfxContext::PushGroupAndCopyBackground(gfxContentType content, Float aOpacity, SourceSurface* aMask, const Matrix& aMaskTransform)
{
IntRect clipExtents;
if (mDT->GetFormat() != SurfaceFormat::B8G8R8X8) {
gfxRect clipRect = GetClipExtents(gfxContext::eDeviceSpace);
clipRect.RoundOut();
gfxRect clipRect = GetRoundOutDeviceClipExtents(this);
clipExtents = IntRect::Truncate(clipRect.x, clipRect.y, clipRect.width, clipRect.height);
}
bool pushOpaqueWithCopiedBG = (mDT->GetFormat() == SurfaceFormat::B8G8R8X8 ||
@ -1055,13 +1062,13 @@ gfxContext::ChangeTransform(const Matrix &aNewMatrix, bool aUpdatePatternTransfo
}
Rect
gfxContext::GetAzureDeviceSpaceClipBounds() const
gfxContext::GetAzureDeviceSpaceClipBounds()
{
Rect rect(CurrentState().deviceOffset.x, CurrentState().deviceOffset.y,
Float(mDT->GetSize().width), Float(mDT->GetSize().height));
for (unsigned int i = 0; i < mStateStack.Length(); i++) {
for (unsigned int c = 0; c < mStateStack[i].pushedClips.Length(); c++) {
const AzureState::PushedClip &clip = mStateStack[i].pushedClips[c];
AzureState::PushedClip &clip = mStateStack[i].pushedClips[c];
if (clip.path) {
Rect bounds = clip.path->GetBounds(clip.transform);
rect.IntersectRect(rect, bounds);

View File

@ -377,16 +377,11 @@ public:
void PopClip();
enum ClipExtentsSpace {
eUserSpace = 0,
eDeviceSpace = 1,
};
/**
* According to aSpace, this function will return the current bounds of
* the clip region in user space or device space.
* This will return the current bounds of the clip region in user
* space.
*/
gfxRect GetClipExtents(ClipExtentsSpace aSpace = eUserSpace) const;
gfxRect GetClipExtents();
/**
* Returns true if the given rectangle is fully contained in the current clip.
@ -524,7 +519,7 @@ private:
void FillAzure(const Pattern& aPattern, mozilla::gfx::Float aOpacity);
CompositionOp GetOp();
void ChangeTransform(const mozilla::gfx::Matrix &aNewMatrix, bool aUpdatePatternTransform = true);
Rect GetAzureDeviceSpaceClipBounds() const;
Rect GetAzureDeviceSpaceClipBounds();
Matrix GetDeviceTransform() const;
Matrix GetDTTransform() const;

View File

@ -785,8 +785,14 @@ GenerateAndPushTextMask(nsIFrame* aFrame, gfxContext* aContext,
}
// Evaluate required surface size.
IntRect drawRect =
RoundedOut(ToRect(sourceCtx->GetClipExtents(gfxContext::eDeviceSpace)));
IntRect drawRect;
{
gfxContextMatrixAutoSaveRestore matRestore(sourceCtx);
sourceCtx->SetMatrix(gfxMatrix());
gfxRect clipRect = sourceCtx->GetClipExtents();
drawRect = RoundedOut(ToRect(clipRect));
}
// Create a mask surface.
RefPtr<DrawTarget> sourceTarget = sourceCtx->GetDrawTarget();
@ -8596,9 +8602,11 @@ bool nsDisplaySVGEffects::ValidateSVGFrame()
static IntRect
ComputeClipExtsInDeviceSpace(gfxContext& aCtx)
{
gfxContextMatrixAutoSaveRestore matRestore(&aCtx);
// Get the clip extents in device space.
gfxRect clippedFrameSurfaceRect =
aCtx.GetClipExtents(gfxContext::eDeviceSpace);
aCtx.SetMatrix(gfxMatrix());
gfxRect clippedFrameSurfaceRect = aCtx.GetClipExtents();
clippedFrameSurfaceRect.RoundOut();
IntRect result;

View File

@ -85,8 +85,11 @@ already_AddRefed<DrawTarget>
nsSVGClipPathFrame::CreateClipMask(gfxContext& aReferenceContext,
IntPoint& aOffset)
{
IntRect bounds =
RoundedOut(ToRect(aReferenceContext.GetClipExtents(gfxContext::eDeviceSpace)));
gfxContextMatrixAutoSaveRestore autoRestoreMatrix(&aReferenceContext);
aReferenceContext.SetMatrix(gfxMatrix());
gfxRect rect = aReferenceContext.GetClipExtents();
IntRect bounds = RoundedOut(ToRect(rect));
if (bounds.IsEmpty()) {
// We don't need to create a mask surface, all drawing is clipped anyway.
return nullptr;

View File

@ -63,7 +63,8 @@ nsSVGMaskFrame::GetMaskForMaskedFrame(MaskParams& aParams)
// and maskArea) is important for performance.
context->Save();
nsSVGUtils::SetClipRect(context, aParams.toUserSpace, maskArea);
gfxRect maskSurfaceRect = context->GetClipExtents(gfxContext::eDeviceSpace);
context->SetMatrix(gfxMatrix());
gfxRect maskSurfaceRect = context->GetClipExtents();
maskSurfaceRect.RoundOut();
context->Restore();

View File

@ -639,8 +639,8 @@ private:
}
// Get the clip extents in device space.
gfxRect clippedFrameSurfaceRect =
mSourceCtx->GetClipExtents(gfxContext::eDeviceSpace);
mSourceCtx->SetMatrix(gfxMatrix());
gfxRect clippedFrameSurfaceRect = mSourceCtx->GetClipExtents();
clippedFrameSurfaceRect.RoundOut();
IntRect result;