Back out 024f0c7ca3fc and 9f856ef0f078 (bug 778367) for Windows reftest failures
authorPhil Ringnalda <philringnalda@gmail.com>
Mon, 01 Oct 2012 17:29:40 -0700
changeset 108950 377cda004bd74736636556724ce69bf27d9c31b6
parent 108949 f625a0dc10524e71789677b09189eed777078333
child 108951 5b0107836b76b3ca9a9f6bdc18d3ed0a6c7a4579
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
bugs778367
milestone18.0a1
backs out024f0c7ca3fcc0f6b842fd4e47f8f77cfed20ccd
Back out 024f0c7ca3fc and 9f856ef0f078 (bug 778367) for Windows reftest failures
gfx/thebes/gfxContext.cpp
gfx/thebes/gfxContext.h
layout/reftests/scrolling/reftest.list
--- a/gfx/thebes/gfxContext.cpp
+++ b/gfx/thebes/gfxContext.cpp
@@ -39,20 +39,20 @@ public:
     gfxContext::AzureState &state = mContext->CurrentState();
 
     if (state.pattern) {
       return *state.pattern->GetPattern(mContext->mDT, state.patternTransformChanged ? &state.patternTransform : nullptr);
     } else if (state.sourceSurface) {
       Matrix transform = state.surfTransform;
 
       if (state.patternTransformChanged) {
-        Matrix mat = mContext->mTransform;
+        Matrix mat = mContext->mDT->GetTransform();
         mat.Invert();
 
-        transform = transform * state.patternTransform * mat;
+        transform = mat * state.patternTransform * transform;
       }
 
       mPattern = new (mSurfacePattern.addr())
         SurfacePattern(state.sourceSurface, EXTEND_CLAMP, transform);
       return *mPattern;
     } else {
       mPattern = new (mColorPattern.addr())
         ColorPattern(state.color);
@@ -178,17 +178,17 @@ gfxContext::GetCairo()
 }
 
 void
 gfxContext::Save()
 {
   if (mCairo) {
     cairo_save(mCairo);
   } else {
-    CurrentState().transform = mTransform;
+    CurrentState().transform = mDT->GetTransform();
     mStateStack.AppendElement(AzureState(CurrentState()));
     CurrentState().clipWasReset = false;
     CurrentState().pushedClips.Clear();
   }
 }
 
 void
 gfxContext::Restore()
@@ -207,23 +207,21 @@ gfxContext::Restore()
 
     mStateStack.RemoveElementAt(mStateStack.Length() - 1);
 
     if (mPathBuilder || mPath || mPathIsRect) {
       // 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;
+      mPathTransform = mDT->GetTransform();
     }
 
     mDT = CurrentState().drawTarget;
-
-    mTransform = CurrentState().transform;
-    mDT->SetTransform(GetDTTransform());
+    mDT->SetTransform(CurrentState().transform);
   }
 }
 
 // drawing
 void
 gfxContext::NewPath()
 {
   if (mCairo) {
@@ -457,17 +455,17 @@ gfxContext::Rectangle(const gfxRect& rec
 
     cairo_rectangle(mCairo, rect.X(), rect.Y(), rect.Width(), rect.Height());
   } else {
     Rect rec = ToRect(rect);
 
     if (snapToPixels) {
       gfxRect newRect(rect);
       if (UserToDevicePixelSnapped(newRect, true)) {
-        gfxMatrix mat = ThebesMatrix(mTransform);
+        gfxMatrix mat = ThebesMatrix(mDT->GetTransform());
         mat.Invert();
 
         // We need the user space rect.
         rec = ToRect(mat.TransformBounds(newRect));
       }
     }
 
     if (!mPathBuilder && !mPathIsRect) {
@@ -549,79 +547,77 @@ gfxContext::DrawSurface(gfxASurface *sur
 
 // transform stuff
 void
 gfxContext::Translate(const gfxPoint& pt)
 {
   if (mCairo) {
     cairo_translate(mCairo, pt.x, pt.y);
   } else {
-    Matrix newMatrix = mTransform;
+    Matrix newMatrix = mDT->GetTransform();
 
     ChangeTransform(newMatrix.Translate(Float(pt.x), Float(pt.y)));
   }
 }
 
 void
 gfxContext::Scale(gfxFloat x, gfxFloat y)
 {
   if (mCairo) {
     cairo_scale(mCairo, x, y);
   } else {
-    Matrix newMatrix = mTransform;
+    Matrix newMatrix = mDT->GetTransform();
 
     ChangeTransform(newMatrix.Scale(Float(x), Float(y)));
   }
 }
 
 void
 gfxContext::Rotate(gfxFloat angle)
 {
   if (mCairo) {
     cairo_rotate(mCairo, angle);
   } else {
     Matrix rotation = Matrix::Rotation(Float(angle));
-    ChangeTransform(rotation * mTransform);
+    ChangeTransform(rotation * mDT->GetTransform());
   }
 }
 
 void
 gfxContext::Multiply(const gfxMatrix& matrix)
 {
   if (mCairo) {
     const cairo_matrix_t& mat = reinterpret_cast<const cairo_matrix_t&>(matrix);
     cairo_transform(mCairo, &mat);
   } else {
-    ChangeTransform(ToMatrix(matrix) * mTransform);
+    ChangeTransform(ToMatrix(matrix) * mDT->GetTransform());
   }
 }
 
 void
 gfxContext::MultiplyAndNudgeToIntegers(const gfxMatrix& matrix)
 {
   if (mCairo) {
     const cairo_matrix_t& mat = reinterpret_cast<const cairo_matrix_t&>(matrix);
     cairo_transform(mCairo, &mat);
     // XXX nudging to integers not currently supported for Thebes
   } else {
-    Matrix transform = ToMatrix(matrix) * mTransform;
+    Matrix transform = ToMatrix(matrix) * mDT->GetTransform();
     transform.NudgeToIntegers();
     ChangeTransform(transform);
   }
 }
 
 void
 gfxContext::SetMatrix(const gfxMatrix& matrix)
 {
   if (mCairo) {
     const cairo_matrix_t& mat = reinterpret_cast<const cairo_matrix_t&>(matrix);
     cairo_set_matrix(mCairo, &mat);
   } else {
-    Matrix mat;
-    mat.Translate(-CurrentState().deviceOffset.x, -CurrentState().deviceOffset.y);
     ChangeTransform(ToMatrix(matrix));
   }
 }
 
 void
 gfxContext::IdentityMatrix()
 {
   if (mCairo) {
@@ -634,105 +630,105 @@ gfxContext::IdentityMatrix()
 gfxMatrix
 gfxContext::CurrentMatrix() const
 {
   if (mCairo) {
     cairo_matrix_t mat;
     cairo_get_matrix(mCairo, &mat);
     return gfxMatrix(*reinterpret_cast<gfxMatrix*>(&mat));
   } else {
-    return ThebesMatrix(mTransform);
+    return ThebesMatrix(mDT->GetTransform());
   }
 }
 
 void
 gfxContext::NudgeCurrentMatrixToIntegers()
 {
   if (mCairo) {
     cairo_matrix_t mat;
     cairo_get_matrix(mCairo, &mat);
     gfxMatrix(*reinterpret_cast<gfxMatrix*>(&mat)).NudgeToIntegers();
     cairo_set_matrix(mCairo, &mat);
   } else {
     gfxMatrix matrix = ThebesMatrix(mTransform);
     matrix.NudgeToIntegers();
-    ChangeTransform(ToMatrix(matrix));
+    mTransform = ToMatrix(matrix);
   }
 }
 
 gfxPoint
 gfxContext::DeviceToUser(const gfxPoint& point) const
 {
   if (mCairo) {
     gfxPoint ret = point;
     cairo_device_to_user(mCairo, &ret.x, &ret.y);
     return ret;
   } else {
-    Matrix matrix = mTransform;
+    Matrix matrix = mDT->GetTransform();
 
     matrix.Invert();
 
     return ThebesPoint(matrix * ToPoint(point));
   }
 }
 
 gfxSize
 gfxContext::DeviceToUser(const gfxSize& size) const
 {
   if (mCairo) {
     gfxSize ret = size;
     cairo_device_to_user_distance(mCairo, &ret.width, &ret.height);
     return ret;
   } else {
-    Matrix matrix = mTransform;
+    Matrix matrix = mDT->GetTransform();
 
     matrix.Invert();
 
     return ThebesSize(matrix * ToSize(size));
   }
 }
 
 gfxRect
 gfxContext::DeviceToUser(const gfxRect& rect) const
 {
   if (mCairo) {
     gfxRect ret = rect;
     cairo_device_to_user(mCairo, &ret.x, &ret.y);
     cairo_device_to_user_distance(mCairo, &ret.width, &ret.height);
     return ret;
   } else {
-    Matrix matrix = mTransform;
+    Matrix matrix = mDT->GetTransform();
 
     matrix.Invert();
 
     return ThebesRect(matrix.TransformBounds(ToRect(rect)));
   }
 }
 
 gfxPoint
 gfxContext::UserToDevice(const gfxPoint& point) const
 {
   if (mCairo) {
     gfxPoint ret = point;
     cairo_user_to_device(mCairo, &ret.x, &ret.y);
     return ret;
   } else {
-    return ThebesPoint(mTransform * ToPoint(point));
+    return ThebesPoint(mDT->GetTransform() * ToPoint(point));
   }
 }
 
 gfxSize
 gfxContext::UserToDevice(const gfxSize& size) const
 {
   if (mCairo) {
     gfxSize ret = size;
     cairo_user_to_device_distance(mCairo, &ret.width, &ret.height);
     return ret;
   } else {
-    const Matrix &matrix = mTransform;
+    const Matrix &matrix = mDT->GetTransform();
 
     gfxSize newSize = size;
     newSize.width = newSize.width * matrix._11 + newSize.height * matrix._12;
     newSize.height = newSize.width * matrix._21 + newSize.height * matrix._22;
     return newSize;
   }
 }
 
@@ -755,17 +751,17 @@ gfxContext::UserToDevice(const gfxRect& 
         xmin = NS_MIN(xmin, x[i]);
         xmax = NS_MAX(xmax, x[i]);
         ymin = NS_MIN(ymin, y[i]);
         ymax = NS_MAX(ymax, y[i]);
     }
 
     return gfxRect(xmin, ymin, xmax - xmin, ymax - ymin);
   } else {
-    const Matrix &matrix = mTransform;
+    const Matrix &matrix = mDT->GetTransform();
     return ThebesRect(matrix.TransformBounds(ToRect(rect)));
   }
 }
 
 bool
 gfxContext::UserToDevicePixelSnapped(gfxRect& rect, bool ignoreScale) const
 {
   if (GetFlags() & FLAG_DISABLE_SNAPPING)
@@ -779,17 +775,17 @@ gfxContext::UserToDevicePixelSnapped(gfx
   if (mCairo) {
     cairo_matrix_t mat;
     cairo_get_matrix(mCairo, &mat);
     if (!ignoreScale &&
         (!WITHIN_E(mat.xx,1.0) || !WITHIN_E(mat.yy,1.0) ||
           !WITHIN_E(mat.xy,0.0) || !WITHIN_E(mat.yx,0.0)))
         return false;
   } else {
-    Matrix mat = mTransform;
+    Matrix mat = mDT->GetTransform();
     if (!ignoreScale &&
         (!WITHIN_E(mat._11,1.0) || !WITHIN_E(mat._22,1.0) ||
           !WITHIN_E(mat._12,0.0) || !WITHIN_E(mat._21,0.0)))
         return false;
   }
 #undef WITHIN_E
 
   gfxPoint p1 = UserToDevice(rect.TopLeft());
@@ -829,17 +825,17 @@ gfxContext::UserToDevicePixelSnapped(gfx
   if (mCairo) {
     cairo_matrix_t mat;
     cairo_get_matrix(mCairo, &mat);
     if (!ignoreScale &&
         (!WITHIN_E(mat.xx,1.0) || !WITHIN_E(mat.yy,1.0) ||
           !WITHIN_E(mat.xy,0.0) || !WITHIN_E(mat.yx,0.0)))
         return false;
   } else {
-    Matrix mat = mTransform;
+    Matrix mat = mDT->GetTransform();
     if (!ignoreScale &&
         (!WITHIN_E(mat._11,1.0) || !WITHIN_E(mat._22,1.0) ||
           !WITHIN_E(mat._12,0.0) || !WITHIN_E(mat._21,0.0)))
         return false;
   }
 #undef WITHIN_E
 
   pt = UserToDevice(pt);
@@ -1120,37 +1116,37 @@ gfxContext::CurrentFillRule() const
 void
 gfxContext::Clip(const gfxRect& rect)
 {
   if (mCairo) {
     cairo_new_path(mCairo);
     cairo_rectangle(mCairo, rect.X(), rect.Y(), rect.Width(), rect.Height());
     cairo_clip(mCairo);
   } else {
-    AzureState::PushedClip clip = { NULL, ToRect(rect), mTransform };
+    AzureState::PushedClip clip = { NULL, ToRect(rect), mDT->GetTransform() };
     CurrentState().pushedClips.AppendElement(clip);
     mDT->PushClipRect(ToRect(rect));
     NewPath();
   }
 }
 
 void
 gfxContext::Clip()
 {
   if (mCairo) {
     cairo_clip_preserve(mCairo);
   } else {
     if (mPathIsRect && !mTransformChanged) {
-      AzureState::PushedClip clip = { NULL, mRect, mTransform };
+      AzureState::PushedClip clip = { NULL, mRect, mDT->GetTransform() };
       CurrentState().pushedClips.AppendElement(clip);
       mDT->PushClipRect(mRect);
     } else {
       EnsurePath();
       mDT->PushClip(mPath);
-      AzureState::PushedClip clip = { mPath, Rect(), mTransform };
+      AzureState::PushedClip clip = { mPath, Rect(), mDT->GetTransform() };
       CurrentState().pushedClips.AppendElement(clip);
     }
   }
 }
 
 void
 gfxContext::ResetClip()
 {
@@ -1187,23 +1183,41 @@ gfxContext::UpdateSurfaceClip()
 gfxRect
 gfxContext::GetClipExtents()
 {
   if (mCairo) {
     double xmin, ymin, xmax, ymax;
     cairo_clip_extents(mCairo, &xmin, &ymin, &xmax, &ymax);
     return gfxRect(xmin, ymin, xmax - xmin, ymax - ymin);
   } else {
-    Rect rect = GetAzureDeviceSpaceClipBounds();
+    unsigned int lastReset = 0;
+    for (int i = mStateStack.Length() - 1; i > 0; i--) {
+      if (mStateStack[i].clipWasReset) {
+        lastReset = i;
+      }
+    }
+
+    Rect rect(0, 0, Float(mDT->GetSize().width), Float(mDT->GetSize().height));
+    for (unsigned int i = lastReset; i < mStateStack.Length(); i++) {
+      for (unsigned int c = 0; c < mStateStack[i].pushedClips.Length(); c++) {
+        AzureState::PushedClip &clip = mStateStack[i].pushedClips[c];
+        if (clip.path) {
+          Rect bounds = clip.path->GetBounds(clip.transform);
+          rect.IntersectRect(rect, bounds);
+        } else {
+          rect.IntersectRect(rect, clip.transform.TransformBounds(clip.rect));
+        }
+      }
+    }
 
     if (rect.width == 0 || rect.height == 0) {
       return gfxRect(0, 0, 0, 0);
     }
 
-    Matrix mat = mTransform;
+    Matrix mat = mDT->GetTransform();
     mat.Invert();
     rect = mat.TransformBounds(rect);
 
     return ThebesRect(rect);
   }
 }
 
 bool
@@ -1450,33 +1464,25 @@ gfxContext::Paint(gfxFloat alpha)
 // groups
 
 void
 gfxContext::PushGroup(gfxASurface::gfxContentType content)
 {
   if (mCairo) {
     cairo_push_group_with_content(mCairo, (cairo_content_t) content);
   } else {
-    Rect clipBounds = GetAzureDeviceSpaceClipBounds();
-    clipBounds.RoundOut();
-
-    clipBounds.width = NS_MAX(1.0f, clipBounds.width);
-    clipBounds.height = NS_MAX(1.0f, clipBounds.height);
-
     RefPtr<DrawTarget> newDT =
-      mDT->CreateSimilarDrawTarget(IntSize(int32_t(clipBounds.width), int32_t(clipBounds.height)),
-                                   gfxPlatform::GetPlatform()->Optimal2DFormatForContent(content));
+      mDT->CreateSimilarDrawTarget(mDT->GetSize(), gfxPlatform::GetPlatform()->Optimal2DFormatForContent(content));
 
     Save();
 
     CurrentState().drawTarget = newDT;
-    CurrentState().deviceOffset = clipBounds.TopLeft();
 
     PushClipsToDT(newDT);
-    newDT->SetTransform(GetDTTransform());
+    newDT->SetTransform(mDT->GetTransform());
     mDT = newDT;
   }
 }
 
 static gfxRect
 GetRoundOutDeviceClipExtents(gfxContext* aCtx)
 {
   gfxContextMatrixAutoSaveRestore save(aCtx);
@@ -1535,27 +1541,21 @@ gfxContext::PushGroupAndCopyBackground(g
     if (mDT->GetFormat() != FORMAT_B8G8R8X8) {
       gfxRect clipRect = GetRoundOutDeviceClipExtents(this);
       clipExtents = IntRect(clipRect.x, clipRect.y, clipRect.width, clipRect.height);
     }
     if (mDT->GetFormat() == FORMAT_B8G8R8X8 ||
         mDT->GetOpaqueRect().Contains(clipExtents)) {
       DrawTarget *oldDT = mDT;
       RefPtr<SourceSurface> source = mDT->Snapshot();
-      Point oldDeviceOffset = CurrentState().deviceOffset;
       PushGroup(content);
-
-      Point offset = CurrentState().deviceOffset - oldDeviceOffset;
       Rect surfRect(0, 0, Float(mDT->GetSize().width), Float(mDT->GetSize().height));
-      Rect sourceRect = surfRect;
-      sourceRect.x += offset.x;
-      sourceRect.y += offset.y;
       Matrix oldTransform = mDT->GetTransform();
       mDT->SetTransform(Matrix());
-      mDT->DrawSurface(source, surfRect, sourceRect); 
+      mDT->DrawSurface(source, surfRect, surfRect); 
       mDT->SetTransform(oldTransform);
       mDT->SetOpaqueRect(oldDT->GetOpaqueRect());
       return;
     }
   }
   PushGroup(content);
 }
 
@@ -1565,52 +1565,43 @@ gfxContext::PopGroup()
   if (mCairo) {
     cairo_pattern_t *pat = cairo_pop_group(mCairo);
     gfxPattern *wrapper = new gfxPattern(pat);
     cairo_pattern_destroy(pat);
     NS_IF_ADDREF(wrapper);
     return wrapper;
   } else {
     RefPtr<SourceSurface> src = mDT->Snapshot();
-    Point deviceOffset = CurrentState().deviceOffset;
 
     Restore();
 
-    Matrix mat = mTransform;
+    Matrix mat = mDT->GetTransform();
     mat.Invert();
-
-    Matrix deviceOffsetTranslation;
-    deviceOffsetTranslation.Translate(deviceOffset.x, deviceOffset.y);
-
-    nsRefPtr<gfxPattern> pat = new gfxPattern(src, deviceOffsetTranslation * mat);
+    nsRefPtr<gfxPattern> pat = new gfxPattern(src, mat);
 
     return pat.forget();
   }
 }
 
 void
 gfxContext::PopGroupToSource()
 {
   if (mCairo) {
     cairo_pop_group_to_source(mCairo);
   } else {
     RefPtr<SourceSurface> src = mDT->Snapshot();
-    Point deviceOffset = CurrentState().deviceOffset;
     Restore();
     CurrentState().sourceSurfCairo = NULL;
     CurrentState().sourceSurface = src;
     CurrentState().pattern = NULL;
     CurrentState().patternTransformChanged = false;
 
-    Matrix mat = mTransform;
+    Matrix mat = mDT->GetTransform();
     mat.Invert();
-
-    Matrix deviceOffsetTranslation;
-    deviceOffsetTranslation.Translate(deviceOffset.x, deviceOffset.y);
-    CurrentState().surfTransform = deviceOffsetTranslation * mat;
+    CurrentState().surfTransform = mat;
   }
 }
 
 bool
 gfxContext::PointInFill(const gfxPoint& pt)
 {
   if (mCairo) {
     return cairo_in_fill(mCairo, pt.x, pt.y);
@@ -1926,17 +1917,17 @@ gfxContext::EnsurePath()
 {
   if (mPathBuilder) {
     mPath = mPathBuilder->Finish();
     mPathBuilder = NULL;
   }
 
   if (mPath) {
     if (mTransformChanged) {
-      Matrix mat = mTransform;
+      Matrix mat = mDT->GetTransform();
       mat.Invert();
       mat = mPathTransform * mat;
       mPathBuilder = mPath->TransformedCopyToBuilder(mat, CurrentState().fillRule);
       mPath = mPathBuilder->Finish();
       mPathBuilder = NULL;
 
       mTransformChanged = false;
     }
@@ -1974,17 +1965,17 @@ gfxContext::EnsurePathBuilder()
   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;
+    Matrix mat = mDT->GetTransform();
     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();
   }
@@ -2032,17 +2023,17 @@ gfxContext::PushClipsToDT(DrawTarget *aD
   }
 
   // Don't need to save the old transform, we'll be setting a new one soon!
 
   // Push all clips from the last state on the stack where the clip was
   // reset to the clip before ours.
   for (unsigned int i = lastReset; i < mStateStack.Length() - 1; i++) {
     for (unsigned int c = 0; c < mStateStack[i].pushedClips.Length(); c++) {
-      aDT->SetTransform(mStateStack[i].pushedClips[c].transform * GetDeviceTransform());
+      aDT->SetTransform(mStateStack[i].pushedClips[c].transform);
       if (mStateStack[i].pushedClips[c].path) {
         aDT->PushClip(mStateStack[i].pushedClips[c].path);
       } else {
         aDT->PushClipRect(mStateStack[i].pushedClips[c].rect);
       }
     }
   }
 }
@@ -2084,26 +2075,26 @@ gfxContext::GetOp()
  */
 void
 gfxContext::ChangeTransform(const Matrix &aNewMatrix)
 {
   AzureState &state = CurrentState();
 
   if ((state.pattern || state.sourceSurface)
       && !state.patternTransformChanged) {
-    state.patternTransform = mTransform;
+    state.patternTransform = mDT->GetTransform();
     state.patternTransformChanged = true;
   }
 
   if (mPathBuilder || mPathIsRect) {
     Matrix invMatrix = aNewMatrix;
     
     invMatrix.Invert();
 
-    Matrix toNewUS = mTransform * invMatrix;
+    Matrix toNewUS = mDT->GetTransform() * invMatrix;
 
     if (toNewUS.IsRectilinear() && mPathIsRect) {
       mRect = toNewUS.TransformBounds(mRect);
       mRect.NudgeToIntegers();
     } else if (mPathIsRect) {
       mPathBuilder = mDT->CreatePathBuilder(CurrentState().fillRule);
       
       mPathBuilder->MoveTo(toNewUS * mRect.TopLeft());
@@ -2115,56 +2106,10 @@ gfxContext::ChangeTransform(const Matrix
       RefPtr<Path> path = mPathBuilder->Finish();
       // Create path in device space.
       mPathBuilder = path->TransformedCopyToBuilder(toNewUS);
     }
     // No need to consider the transform changed now!
     mTransformChanged = false;
   }
 
-  mTransform = aNewMatrix;
-
-  mDT->SetTransform(GetDTTransform());
+  mDT->SetTransform(aNewMatrix);
 }
-
-Rect
-gfxContext::GetAzureDeviceSpaceClipBounds()
-{
-  unsigned int lastReset = 0;
-  for (int i = mStateStack.Length() - 1; i > 0; i--) {
-    if (mStateStack[i].clipWasReset) {
-      lastReset = i;
-    }
-  }
-
-  Rect rect(CurrentState().deviceOffset.x, CurrentState().deviceOffset.y,
-            Float(mDT->GetSize().width), Float(mDT->GetSize().height));
-  for (unsigned int i = lastReset; i < mStateStack.Length(); i++) {
-    for (unsigned int c = 0; c < mStateStack[i].pushedClips.Length(); c++) {
-      AzureState::PushedClip &clip = mStateStack[i].pushedClips[c];
-      if (clip.path) {
-        Rect bounds = clip.path->GetBounds(clip.transform);
-        rect.IntersectRect(rect, bounds);
-      } else {
-        rect.IntersectRect(rect, clip.transform.TransformBounds(clip.rect));
-      }
-    }
-  }
-
-  return rect;
-}
-
-Matrix
-gfxContext::GetDeviceTransform() const
-{
-  Matrix mat;
-  mat.Translate(-CurrentState().deviceOffset.x, -CurrentState().deviceOffset.y);
-  return mat;
-}
-
-Matrix
-gfxContext::GetDTTransform() const
-{
-  Matrix mat = mTransform;
-  mat._31 -= CurrentState().deviceOffset.x;
-  mat._32 -= CurrentState().deviceOffset.y;
-  return mat;
-}
\ No newline at end of file
--- a/gfx/thebes/gfxContext.h
+++ b/gfx/thebes/gfxContext.h
@@ -733,31 +733,26 @@ private:
     bool clipWasReset;
     mozilla::gfx::FillRule fillRule;
     StrokeOptions strokeOptions;
     mozilla::RefPtr<DrawTarget> drawTarget;
     mozilla::RefPtr<DrawTarget> parentTarget;
     mozilla::gfx::AntialiasMode aaMode;
     bool patternTransformChanged;
     Matrix patternTransform;
-    // This is used solely for using minimal intermediate surface size.
-    mozilla::gfx::Point deviceOffset;
   };
 
   // This ensures mPath contains a valid path (in user space!)
   void EnsurePath();
   // This ensures mPathBuilder contains a valid PathBuilder (in user space!)
   void EnsurePathBuilder();
   void FillAzure(mozilla::gfx::Float aOpacity);
   void PushClipsToDT(mozilla::gfx::DrawTarget *aDT);
   CompositionOp GetOp();
   void ChangeTransform(const mozilla::gfx::Matrix &aNewMatrix);
-  Rect GetAzureDeviceSpaceClipBounds();
-  Matrix GetDeviceTransform() const;
-  Matrix GetDTTransform() const;
 
   bool mPathIsRect;
   bool mTransformChanged;
   Matrix mPathTransform;
   Rect mRect;
   mozilla::RefPtr<PathBuilder> mPathBuilder;
   mozilla::RefPtr<Path> mPath;
   Matrix mTransform;
--- a/layout/reftests/scrolling/reftest.list
+++ b/layout/reftests/scrolling/reftest.list
@@ -1,17 +1,17 @@
 HTTP == fixed-1.html fixed-1.html?ref
 random-if(bug685516) HTTP == fixed-opacity-1.html fixed-opacity-1.html?ref
 random-if(bug685516) HTTP == fixed-opacity-2.html fixed-opacity-2.html?ref
 random-if(bug685516) HTTP == fixed-text-1.html fixed-text-1.html?ref
 random-if(bug685516) HTTP == fixed-text-2.html fixed-text-2.html?ref
 random-if(Android&&!browserIsRemote) == iframe-border-radius.html iframe-border-radius-ref.html # bug 760269
 random-if(Android) HTTP == image-1.html image-1.html?ref
 random-if(Android&&!browserIsRemote) HTTP == opacity-mixed-scrolling-1.html opacity-mixed-scrolling-1.html?ref # bug 760269
-fuzzy-if(d2d,10,606) random-if(cocoaWidget) HTTP == opacity-mixed-scrolling-2.html opacity-mixed-scrolling-2.html?ref # see bug 625357 - DWrite renders this subtly different on different size surfaces
+random-if(cocoaWidget) HTTP == opacity-mixed-scrolling-2.html opacity-mixed-scrolling-2.html?ref # see bug 625357
 random-if(bug685516) HTTP == simple-1.html simple-1.html?ref
 HTTP == subpixel-1.html#d subpixel-1-ref.html#d
 HTTP == text-1.html text-1.html?ref
 HTTP == text-2.html?up text-2.html?ref
 HTTP == transformed-1.html transformed-1.html?ref
 HTTP == transformed-1.html?up transformed-1.html?ref
 == uncovering-1.html uncovering-1-ref.html
 == uncovering-2.html uncovering-2-ref.html