Backed out 2 changesets (bug 814952) because it breaks the build

Backed out changeset 974417414266 (bug 814952)
Backed out changeset 315707349606 (bug 814952)
This commit is contained in:
Ehsan Akhgari 2012-12-12 16:16:35 -05:00
parent b22e6d3b1c
commit b92a794517
5 changed files with 47 additions and 94 deletions

View File

@ -207,9 +207,18 @@ gfxContext::Restore()
mStateStack.RemoveElementAt(mStateStack.Length() - 1);
if ((mPathBuilder || mPath || mPathIsRect) && !mTransformChanged) {
// Support here isn't fully correct if the path is continued -after-
// the restore. We don't currently have users that do this and we should
// make sure there will not be any. Sadly we can't assert this easily.
mTransformChanged = true;
mPathTransform = mTransform;
}
mDT = CurrentState().drawTarget;
ChangeTransform(CurrentState().transform, false);
mTransform = CurrentState().transform;
mDT->SetTransform(GetDTTransform());
}
}
@ -281,8 +290,6 @@ gfxContext::Stroke()
} else {
AzureState &state = CurrentState();
if (mPathIsRect) {
MOZ_ASSERT(!mTransformChanged);
mDT->StrokeRect(mRect, GeneralPattern(this),
state.strokeOptions,
DrawOptions(1.0f, GetOp(), state.aaMode));
@ -467,10 +474,10 @@ gfxContext::Rectangle(const gfxRect& rect, bool snapToPixels)
mPathIsRect = true;
mRect = rec;
return;
} else if (!mPathBuilder) {
EnsurePathBuilder();
}
EnsurePathBuilder();
mPathBuilder->MoveTo(rec.TopLeft());
mPathBuilder->LineTo(rec.TopRight());
mPathBuilder->LineTo(rec.BottomRight());
@ -1131,9 +1138,7 @@ gfxContext::Clip()
if (mCairo) {
cairo_clip_preserve(mCairo);
} else {
if (mPathIsRect) {
MOZ_ASSERT(!mTransformChanged);
if (mPathIsRect && !mTransformChanged) {
AzureState::PushedClip clip = { NULL, mRect, mTransform };
CurrentState().pushedClips.AppendElement(clip);
mDT->PushClipRect(mRect);
@ -1945,50 +1950,33 @@ gfxContext::EnsurePath()
void
gfxContext::EnsurePathBuilder()
{
if (mPathBuilder && !mTransformChanged) {
if (mPathBuilder) {
return;
}
if (mPath) {
if (!mTransformChanged) {
mPathBuilder = mPath->CopyToBuilder(CurrentState().fillRule);
mPath = NULL;
} else {
Matrix invTransform = mTransform;
invTransform.Invert();
Matrix toNewUS = mPathTransform * invTransform;
mPathBuilder = mPath->TransformedCopyToBuilder(toNewUS, CurrentState().fillRule);
}
return;
mPathBuilder = mPath->CopyToBuilder(CurrentState().fillRule);
mPath = NULL;
}
DebugOnly<PathBuilder*> oldPath = mPathBuilder;
mPathBuilder = mDT->CreatePathBuilder(CurrentState().fillRule);
if (!mPathBuilder) {
mPathBuilder = mDT->CreatePathBuilder(CurrentState().fillRule);
if (mPathIsRect) {
mPathBuilder->MoveTo(mRect.TopLeft());
mPathBuilder->LineTo(mRect.TopRight());
mPathBuilder->LineTo(mRect.BottomRight());
mPathBuilder->LineTo(mRect.BottomLeft());
mPathBuilder->Close();
}
}
if (mTransformChanged) {
// This could be an else if since this should never happen when
// mPathBuilder is NULL and mPath is NULL. But this way we can assert
// if all the state is as expected.
MOZ_ASSERT(oldPath);
MOZ_ASSERT(!mPathIsRect);
Matrix invTransform = mTransform;
invTransform.Invert();
Matrix toNewUS = mPathTransform * invTransform;
RefPtr<Path> path = mPathBuilder->Finish();
mPathBuilder = path->TransformedCopyToBuilder(toNewUS, CurrentState().fillRule);
if (mPathIsRect && !mTransformChanged) {
mPathBuilder->MoveTo(mRect.TopLeft());
mPathBuilder->LineTo(mRect.TopRight());
mPathBuilder->LineTo(mRect.BottomRight());
mPathBuilder->LineTo(mRect.BottomLeft());
mPathBuilder->Close();
} else if (mPathIsRect) {
mTransformChanged = false;
Matrix mat = mTransform;
mat.Invert();
mat = mPathTransform * mat;
mPathBuilder->MoveTo(mat * mRect.TopLeft());
mPathBuilder->LineTo(mat * mRect.TopRight());
mPathBuilder->LineTo(mat * mRect.BottomRight());
mPathBuilder->LineTo(mat * mRect.BottomLeft());
mPathBuilder->Close();
}
mPathIsRect = false;
@ -2001,9 +1989,7 @@ gfxContext::FillAzure(Float aOpacity)
CompositionOp op = GetOp();
if (mPathIsRect) {
MOZ_ASSERT(!mTransformChanged);
if (mPathIsRect && !mTransformChanged) {
if (state.opIsClear) {
mDT->ClearRect(mRect);
} else if (op == OP_SOURCE) {
@ -2083,36 +2069,31 @@ gfxContext::GetOp()
/* SVG font code can change the transform after having set the pattern on the
* context. When the pattern is set it is in user space, if the transform is
* changed after doing so the pattern needs to be converted back into userspace.
* We just store the old pattern transform here so that we only do the work
* needed here if the pattern is actually used.
* We need to avoid doing this when this ChangeTransform comes from a restore,
* since the current pattern and the current transform are both part of the
* state we know the new CurrentState()'s values are valid. But if we assume
* a change they might become invalid since patternTransformChanged is part of
* the state and might be false for the restored AzureState.
* We just store the old pattern here so that we only do the work needed here
* if the pattern is actually used.
*/
void
gfxContext::ChangeTransform(const Matrix &aNewMatrix, bool aUpdatePatternTransform)
gfxContext::ChangeTransform(const Matrix &aNewMatrix)
{
AzureState &state = CurrentState();
if (aUpdatePatternTransform && (state.pattern || state.sourceSurface)
if ((state.pattern || state.sourceSurface)
&& !state.patternTransformChanged) {
state.patternTransform = mTransform;
state.patternTransformChanged = true;
}
if (mPathIsRect) {
if (mPathBuilder || mPathIsRect) {
Matrix invMatrix = aNewMatrix;
invMatrix.Invert();
Matrix toNewUS = mTransform * invMatrix;
if (toNewUS.IsRectilinear()) {
if (toNewUS.IsRectilinear() && mPathIsRect) {
mRect = toNewUS.TransformBounds(mRect);
mRect.NudgeToIntegers();
} else {
} else if (mPathIsRect) {
mPathBuilder = mDT->CreatePathBuilder(CurrentState().fillRule);
mPathBuilder->MoveTo(toNewUS * mRect.TopLeft());
@ -2120,15 +2101,13 @@ gfxContext::ChangeTransform(const Matrix &aNewMatrix, bool aUpdatePatternTransfo
mPathBuilder->LineTo(toNewUS * mRect.BottomRight());
mPathBuilder->LineTo(toNewUS * mRect.BottomLeft());
mPathBuilder->Close();
mPathIsRect = false;
} else {
RefPtr<Path> path = mPathBuilder->Finish();
// Create path in device space.
mPathBuilder = path->TransformedCopyToBuilder(toNewUS);
}
// No need to consider the transform changed now!
mTransformChanged = false;
} else if ((mPath || mPathBuilder) && !mTransformChanged) {
mTransformChanged = true;
mPathTransform = mTransform;
}
mTransform = aNewMatrix;

View File

@ -765,7 +765,7 @@ private:
void FillAzure(mozilla::gfx::Float aOpacity);
void PushClipsToDT(mozilla::gfx::DrawTarget *aDT);
CompositionOp GetOp();
void ChangeTransform(const mozilla::gfx::Matrix &aNewMatrix, bool aUpdatePatternTransform = true);
void ChangeTransform(const mozilla::gfx::Matrix &aNewMatrix);
Rect GetAzureDeviceSpaceClipBounds();
Matrix GetDeviceTransform() const;
Matrix GetDTTransform() const;

View File

@ -1,10 +0,0 @@
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>non-scaling-stroke reftest</title>
</head>
<body>
<svg height="2000" width="2000" xmlns="http://www.w3.org/2000/svg">
<path fill="red" stroke-width="2" stroke="black" d="m10,18 100,0 0,100 -100,00z"></path>
</svg>
</body></html>

View File

@ -1,15 +0,0 @@
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>non-scaling-stroke reftest</title>
<style>
* {
vector-effect: non-scaling-stroke;
}
</style>
</head>
<body>
<svg height="2000" width="2000" xmlns="http://www.w3.org/2000/svg">
<path fill="red" stroke-width="2" stroke="black" d="m10,18 100,0 0,100 -100,00z"></path>
</svg>
</body></html>

View File

@ -1734,6 +1734,5 @@ fuzzy(40,800) == 797797-2.html 797797-2-ref.html # 'opacity:N' and rgba(,,,N) te
== 812824-1.html 812824-1-ref.html
== 814677.html 814677-ref.html
== 815593-1.html 815593-1-ref.html
== 814592-1.html 814592-1-ref.html
== 816458-1.html 816458-1-ref.html
== 818276-1.html 818276-1-ref.html