Backed out 8 changesets (bug 1057212, bug 1059033) for Windows build bustage
authorPhil Ringnalda <philringnalda@gmail.com>
Sun, 31 Aug 2014 23:55:31 -0700
changeset 224495 6cddb4cf40e3216499500691e3e47086f824ed42
parent 224494 a54dbdca597b1dee86ba04b72bfe95d3ea865413
child 224496 7f50451d8ee348fe8a63c5a1fd48be0d8fe0d441
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1057212, 1059033
milestone34.0a1
backs outa54dbdca597b1dee86ba04b72bfe95d3ea865413
d8d79e4fbfc49f964743dfca2c7817c84dc8397e
87494588e4934b55ea92bb08b0eae7ec1962b67f
3e4105ea0a73383df0ac5dcc783273710502985c
e59430ea4256cd00c59a73b8a7992b62b9128113
301fdfea8fbfe14e1179b96a47b2c9a69f3a2bae
1ef5a3a9bb0641803493ec57d7ebbb2b3c91a108
a7eaac164c36c9a23df61c91bf3359ee0c296071
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 8 changesets (bug 1057212, bug 1059033) for Windows build bustage CLOSED TREE Backed out changeset a54dbdca597b (bug 1059033) Backed out changeset d8d79e4fbfc4 (bug 1059033) Backed out changeset 87494588e493 (bug 1057212) Backed out changeset 3e4105ea0a73 (bug 1059033) Backed out changeset e59430ea4256 (bug 1059033) Backed out changeset 301fdfea8fbf (bug 1059033) Backed out changeset 1ef5a3a9bb06 (bug 1059033) Backed out changeset a7eaac164c36 (bug 1059033)
gfx/2d/DrawTargetCG.cpp
gfx/2d/DrawTargetTiled.cpp
gfx/2d/DrawTargetTiled.h
gfx/2d/moz.build
gfx/layers/client/TextureClient.cpp
gfx/thebes/gfxContext.cpp
--- a/gfx/2d/DrawTargetCG.cpp
+++ b/gfx/2d/DrawTargetCG.cpp
@@ -249,22 +249,17 @@ GetRetainedImageFromSourceSurface(Source
 
 TemporaryRef<SourceSurface>
 DrawTargetCG::OptimizeSourceSurface(SourceSurface *aSurface) const
 {
   if (aSurface->GetType() == SurfaceType::COREGRAPHICS_IMAGE ||
       aSurface->GetType() == SurfaceType::COREGRAPHICS_CGCONTEXT) {
     return aSurface;
   }
-  RefPtr<DataSourceSurface> data = aSurface->GetDataSurface();
-
-  return CreateSourceSurfaceFromData(data->GetData(),
-                                     data->GetSize(),
-                                     data->Stride(),
-                                     data->GetFormat());
+  return aSurface->GetDataSurface();
 }
 
 class UnboundnessFixer
 {
     CGRect mClipBounds;
     CGLayerRef mLayer;
     CGContextRef mCg;
   public:
--- a/gfx/2d/DrawTargetTiled.cpp
+++ b/gfx/2d/DrawTargetTiled.cpp
@@ -1,16 +1,13 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#define _USE_MATH_DEFINES
-#include <cmath>
-
 #include "DrawTargetTiled.h"
 #include "Logging.h"
 
 using namespace std;
 
 namespace mozilla {
 namespace gfx {
 
@@ -43,140 +40,136 @@ DrawTargetTiled::Init(const TileSet& aTi
     mRect.y = min(mRect.y, mTiles[i].mTileOrigin.y);
     mRect.width = newXMost - mRect.x;
     mRect.height = newYMost - mRect.y;
   }
   mFormat = mTiles[0].mDrawTarget->GetFormat();
   return true;
 }
 
+class SnapshotTiled : public SourceSurface
+{
+public:
+  SnapshotTiled(const vector<Tile>& aTiles, const IntRect& aRect)
+    : mRect(aRect)
+  {
+    for (size_t i = 0; i < aTiles.size(); i++) {
+      mSnapshots.push_back(aTiles[i].mDrawTarget->Snapshot());
+      mOrigins.push_back(aTiles[i].mTileOrigin);
+    }
+  }
+
+  virtual SurfaceType GetType() const { return SurfaceType::TILED; }
+  virtual IntSize GetSize() const { return IntSize(mRect.XMost(), mRect.YMost()); }
+  virtual SurfaceFormat GetFormat() const { return mSnapshots[0]->GetFormat(); }
+
+  virtual TemporaryRef<DataSourceSurface> GetDataSurface()
+  {
+    RefPtr<DataSourceSurface> surf = Factory::CreateDataSourceSurface(GetSize(), GetFormat());
+    if (MOZ2D_WARN_IF(!surf)) {
+      return nullptr;
+    }
+
+    DataSourceSurface::MappedSurface mappedSurf;
+    surf->Map(DataSourceSurface::MapType::WRITE, &mappedSurf);
+
+    {
+      RefPtr<DrawTarget> dt =
+        Factory::CreateDrawTargetForData(BackendType::CAIRO, mappedSurf.mData,
+        GetSize(), mappedSurf.mStride, GetFormat());
+
+      for (size_t i = 0; i < mSnapshots.size(); i++) {
+        RefPtr<DataSourceSurface> dataSurf = mSnapshots[i]->GetDataSurface();
+        dt->CopySurface(dataSurf, IntRect(IntPoint(0, 0), mSnapshots[i]->GetSize()), mOrigins[i]);
+      }
+    }
+    surf->Unmap();
+
+    return surf.forget();
+  }
+private:
+  vector<RefPtr<SourceSurface>> mSnapshots;
+  vector<IntPoint> mOrigins;
+  IntRect mRect;
+};
+
 TemporaryRef<SourceSurface>
 DrawTargetTiled::Snapshot()
 {
   return new SnapshotTiled(mTiles, mRect);
 }
 
-// Skip the mClippedOut check since this is only used for Flush() which
-// should happen even if we're clipped.
 #define TILED_COMMAND(command) \
   void \
   DrawTargetTiled::command() \
   { \
     for (size_t i = 0; i < mTiles.size(); i++) { \
-      mTiles[i].mDrawTarget->command(); \
+    \
+    \
+    mTiles[i].mDrawTarget->command(); \
     } \
   }
 #define TILED_COMMAND1(command, type1) \
   void \
   DrawTargetTiled::command(type1 arg1) \
   { \
     for (size_t i = 0; i < mTiles.size(); i++) { \
-      if (!mTiles[i].mClippedOut) \
-        mTiles[i].mDrawTarget->command(arg1); \
+    \
+    \
+    mTiles[i].mDrawTarget->command(arg1); \
     } \
   }
 #define TILED_COMMAND3(command, type1, type2, type3) \
   void \
   DrawTargetTiled::command(type1 arg1, type2 arg2, type3 arg3) \
   { \
     for (size_t i = 0; i < mTiles.size(); i++) { \
-      if (!mTiles[i].mClippedOut) \
-        mTiles[i].mDrawTarget->command(arg1, arg2, arg3); \
+    \
+    \
+    mTiles[i].mDrawTarget->command(arg1, arg2, arg3); \
     } \
   }
 #define TILED_COMMAND4(command, type1, type2, type3, type4) \
   void \
   DrawTargetTiled::command(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
   { \
     for (size_t i = 0; i < mTiles.size(); i++) { \
-      if (!mTiles[i].mClippedOut) \
-        mTiles[i].mDrawTarget->command(arg1, arg2, arg3, arg4); \
+    \
+    \
+    mTiles[i].mDrawTarget->command(arg1, arg2, arg3, arg4); \
     } \
   }
 #define TILED_COMMAND5(command, type1, type2, type3, type4, type5) \
   void \
   DrawTargetTiled::command(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
   { \
     for (size_t i = 0; i < mTiles.size(); i++) { \
-      if (!mTiles[i].mClippedOut) \
-        mTiles[i].mDrawTarget->command(arg1, arg2, arg3, arg4, arg5); \
+    \
+    \
+    mTiles[i].mDrawTarget->command(arg1, arg2, arg3, arg4, arg5); \
     } \
   }
 
 TILED_COMMAND(Flush)
+TILED_COMMAND5(DrawSurface, SourceSurface*, const Rect&,
+                            const Rect&, const DrawSurfaceOptions&,
+                            const DrawOptions&)
 TILED_COMMAND4(DrawFilter, FilterNode*, const Rect&, const Point&, const DrawOptions&)
 TILED_COMMAND1(ClearRect, const Rect&)
 TILED_COMMAND4(MaskSurface, const Pattern&, SourceSurface*, Point, const DrawOptions&)
+TILED_COMMAND3(FillRect, const Rect&, const Pattern&, const DrawOptions&)
 TILED_COMMAND4(StrokeRect, const Rect&, const Pattern&, const StrokeOptions&, const DrawOptions&)
 TILED_COMMAND5(StrokeLine, const Point&, const Point&, const Pattern&, const StrokeOptions&, const DrawOptions&)
+TILED_COMMAND4(Stroke, const Path*, const Pattern&, const StrokeOptions&, const DrawOptions&)
+TILED_COMMAND3(Fill, const Path*, const Pattern&, const DrawOptions&)
 TILED_COMMAND5(FillGlyphs, ScaledFont*, const GlyphBuffer&, const Pattern&, const DrawOptions&, const GlyphRenderingOptions*)
 TILED_COMMAND3(Mask, const Pattern&, const Pattern&, const DrawOptions&)
-
-void
-DrawTargetTiled::PushClip(const Path* aPath)
-{
-  mClippedOutTilesStack.push_back(std::vector<uint32_t>());
-  std::vector<uint32_t>& clippedTiles = mClippedOutTilesStack.back();
-
-  Rect deviceRect = aPath->GetBounds(mTransform);
-
-  for (size_t i = 0; i < mTiles.size(); i++) {
-    if (!mTiles[i].mClippedOut) {
-      if (deviceRect.Intersects(Rect(mTiles[i].mTileOrigin.x,
-                                   mTiles[i].mTileOrigin.y,
-                                   mTiles[i].mDrawTarget->GetSize().width,
-                                   mTiles[i].mDrawTarget->GetSize().height))) {
-        mTiles[i].mDrawTarget->PushClip(aPath);
-      } else {
-        mTiles[i].mClippedOut = true;
-        clippedTiles.push_back(i);
-      }
-    }
-  }
-}
-
-void
-DrawTargetTiled::PushClipRect(const Rect& aRect)
-{
-  mClippedOutTilesStack.push_back(std::vector<uint32_t>());
-  std::vector<uint32_t>& clippedTiles = mClippedOutTilesStack.back();
-
-  Rect deviceRect = mTransform.TransformBounds(aRect);
-
-  for (size_t i = 0; i < mTiles.size(); i++) {
-    if (!mTiles[i].mClippedOut) {
-      if (deviceRect.Intersects(Rect(mTiles[i].mTileOrigin.x,
-                                   mTiles[i].mTileOrigin.y,
-                                   mTiles[i].mDrawTarget->GetSize().width,
-                                   mTiles[i].mDrawTarget->GetSize().height))) {
-        mTiles[i].mDrawTarget->PushClipRect(aRect);
-      } else {
-        mTiles[i].mClippedOut = true;
-        clippedTiles.push_back(i);
-      }
-    }
-  }
-}
-
-void
-DrawTargetTiled::PopClip()
-{
-  for (size_t i = 0; i < mTiles.size(); i++) {
-    if (!mTiles[i].mClippedOut) {
-      mTiles[i].mDrawTarget->PopClip();
-    }
-  }
-
-  std::vector<uint32_t>& clippedTiles = mClippedOutTilesStack.back();
-  for (size_t i = 0; i < clippedTiles.size(); i++) {
-    mTiles[clippedTiles[i]].mClippedOut = false;
-  }
-
-  mClippedOutTilesStack.pop_back();
-}
+TILED_COMMAND1(PushClip, const Path*)
+TILED_COMMAND1(PushClipRect, const Rect&)
+TILED_COMMAND(PopClip)
 
 void
 DrawTargetTiled::CopySurface(SourceSurface *aSurface,
                              const IntRect &aSourceRect,
                              const IntPoint &aDestination)
 {
   // CopySurface ignores the transform, account for that here.
   for (size_t i = 0; i < mTiles.size(); i++) {
@@ -200,100 +193,10 @@ DrawTargetTiled::SetTransform(const Matr
   for (size_t i = 0; i < mTiles.size(); i++) {
     Matrix mat = aTransform;
     mat.PostTranslate(Float(-mTiles[i].mTileOrigin.x), Float(-mTiles[i].mTileOrigin.y));
     mTiles[i].mDrawTarget->SetTransform(mat);
   }
   DrawTarget::SetTransform(aTransform);
 }
 
-void
-DrawTargetTiled::DrawSurface(SourceSurface* aSurface, const Rect& aDest, const Rect& aSource, const DrawSurfaceOptions& aSurfaceOptions, const DrawOptions& aDrawOptions)
-{
-  Rect deviceRect = mTransform.TransformBounds(aDest);
-  for (size_t i = 0; i < mTiles.size(); i++) {
-    if (!mTiles[i].mClippedOut &&
-        deviceRect.Intersects(Rect(mTiles[i].mTileOrigin.x,
-                                   mTiles[i].mTileOrigin.y,
-                                   mTiles[i].mDrawTarget->GetSize().width,
-                                   mTiles[i].mDrawTarget->GetSize().height))) {
-      mTiles[i].mDrawTarget->DrawSurface(aSurface, aDest, aSource, aSurfaceOptions, aDrawOptions);
-    }
-  }
-}
-
-void
-DrawTargetTiled::FillRect(const Rect& aRect, const Pattern& aPattern, const DrawOptions& aDrawOptions)
-{
-  Rect deviceRect = mTransform.TransformBounds(aRect);
-  for (size_t i = 0; i < mTiles.size(); i++) {
-    if (!mTiles[i].mClippedOut &&
-        deviceRect.Intersects(Rect(mTiles[i].mTileOrigin.x,
-                                   mTiles[i].mTileOrigin.y,
-                                   mTiles[i].mDrawTarget->GetSize().width,
-                                   mTiles[i].mDrawTarget->GetSize().height))) {
-      mTiles[i].mDrawTarget->FillRect(aRect, aPattern, aDrawOptions);
-    }
-  }
-}
-
-// The logic for this comes from _cairo_stroke_style_max_distance_from_path
-static Rect
-PathExtentsToMaxStrokeExtents(const StrokeOptions &aStrokeOptions,
-                              const Rect &aRect,
-                              const Matrix &aTransform)
-{
-  float styleExpansionFactor = 0.5f;
-
-  if (aStrokeOptions.mLineCap == CapStyle::SQUARE) {
-    styleExpansionFactor = M_SQRT1_2;
-  }
-
-  if (aStrokeOptions.mLineJoin == JoinStyle::MITER &&
-      styleExpansionFactor < M_SQRT2 * aStrokeOptions.mMiterLimit) {
-    styleExpansionFactor = M_SQRT2 * aStrokeOptions.mMiterLimit;
-  }
-
-  styleExpansionFactor *= aStrokeOptions.mLineWidth;
-
-  double dx = styleExpansionFactor * hypot(aTransform._11, aTransform._21);
-  double dy = styleExpansionFactor * hypot(aTransform._22, aTransform._12);
-
-  Rect result = aRect;
-  result.Inflate(dx, dy);
-  return result;
-}
-
-void
-DrawTargetTiled::Stroke(const Path* aPath, const Pattern& aPattern, const StrokeOptions& aStrokeOptions, const DrawOptions& aDrawOptions)
-{
-  // Approximate the stroke extents, since Path::GetStrokeExtents can be slow
-  Rect deviceRect = PathExtentsToMaxStrokeExtents(aStrokeOptions,
-                                                 aPath->GetBounds(mTransform),
-                                                 mTransform);
-  for (size_t i = 0; i < mTiles.size(); i++) {
-    if (!mTiles[i].mClippedOut &&
-        deviceRect.Intersects(Rect(mTiles[i].mTileOrigin.x,
-                                   mTiles[i].mTileOrigin.y,
-                                   mTiles[i].mDrawTarget->GetSize().width,
-                                   mTiles[i].mDrawTarget->GetSize().height))) {
-      mTiles[i].mDrawTarget->Stroke(aPath, aPattern, aStrokeOptions, aDrawOptions);
-    }
-  }
-}
-
-void
-DrawTargetTiled::Fill(const Path* aPath, const Pattern& aPattern, const DrawOptions& aDrawOptions)
-{
-  Rect deviceRect = aPath->GetBounds(mTransform);
-  for (size_t i = 0; i < mTiles.size(); i++) {
-    if (!mTiles[i].mClippedOut &&
-        deviceRect.Intersects(Rect(mTiles[i].mTileOrigin.x,
-                                   mTiles[i].mTileOrigin.y,
-                                   mTiles[i].mDrawTarget->GetSize().width,
-                                   mTiles[i].mDrawTarget->GetSize().height))) {
-      mTiles[i].mDrawTarget->Fill(aPath, aPattern, aDrawOptions);
-    }
-  }
-}
-
 }
 }
--- a/gfx/2d/DrawTargetTiled.h
+++ b/gfx/2d/DrawTargetTiled.h
@@ -9,30 +9,16 @@
 #include "2D.h"
 #include "Filters.h"
 
 #include <vector>
 
 namespace mozilla {
 namespace gfx {
 
-struct TileInternal : public Tile {
-  TileInternal()
-    : mClippedOut(false)
-  {}
-
-  TileInternal(const Tile& aOther)
-    : Tile(aOther)
-    , mClippedOut(false)
-  {}
-
-  bool mClippedOut;
-};
-
-
 class DrawTargetTiled : public DrawTarget
 {
 public:
   DrawTargetTiled();
 
   bool Init(const TileSet& mTiles);
 
   virtual bool IsTiledDrawTarget() const { return true; }
@@ -139,60 +125,16 @@ public:
     return mTiles[0].mDrawTarget->CreateGradientStops(aStops, aNumStops, aExtendMode);
   }
   virtual TemporaryRef<FilterNode> CreateFilter(FilterType aType)
   {
     return mTiles[0].mDrawTarget->CreateFilter(aType);
   }
 
 private:
-  std::vector<TileInternal> mTiles;
-  std::vector<std::vector<uint32_t> > mClippedOutTilesStack;
-  IntRect mRect;
-};
-
-class SnapshotTiled : public SourceSurface
-{
-public:
-  SnapshotTiled(const std::vector<TileInternal>& aTiles, const IntRect& aRect)
-    : mRect(aRect)
-  {
-    for (size_t i = 0; i < aTiles.size(); i++) {
-      mSnapshots.push_back(aTiles[i].mDrawTarget->Snapshot());
-      mOrigins.push_back(aTiles[i].mTileOrigin);
-    }
-  }
-
-  virtual SurfaceType GetType() const { return SurfaceType::TILED; }
-  virtual IntSize GetSize() const { return IntSize(mRect.XMost(), mRect.YMost()); }
-  virtual SurfaceFormat GetFormat() const { return mSnapshots[0]->GetFormat(); }
-
-  virtual TemporaryRef<DataSourceSurface> GetDataSurface()
-  {
-    RefPtr<DataSourceSurface> surf = Factory::CreateDataSourceSurface(GetSize(), GetFormat());
-
-    DataSourceSurface::MappedSurface mappedSurf;
-    surf->Map(DataSourceSurface::MapType::WRITE, &mappedSurf);
-
-    {
-      RefPtr<DrawTarget> dt =
-        Factory::CreateDrawTargetForData(BackendType::CAIRO, mappedSurf.mData,
-        GetSize(), mappedSurf.mStride, GetFormat());
-
-      for (size_t i = 0; i < mSnapshots.size(); i++) {
-        RefPtr<DataSourceSurface> dataSurf = mSnapshots[i]->GetDataSurface();
-        dt->CopySurface(dataSurf, IntRect(IntPoint(0, 0), mSnapshots[i]->GetSize()), mOrigins[i]);
-      }
-    }
-    surf->Unmap();
-
-    return surf.forget();
-  }
-
-  std::vector<RefPtr<SourceSurface>> mSnapshots;
-  std::vector<IntPoint> mOrigins;
+  std::vector<Tile> mTiles;
   IntRect mRect;
 };
 
 }
 }
 
 #endif
--- a/gfx/2d/moz.build
+++ b/gfx/2d/moz.build
@@ -16,17 +16,16 @@ EXPORTS.mozilla.gfx += [
     'BasePoint3D.h',
     'BasePoint4D.h',
     'BaseRect.h',
     'BaseSize.h',
     'Blur.h',
     'BorrowedContext.h',
     'Coord.h',
     'DataSurfaceHelpers.h',
-    'DrawTargetTiled.h',
     'Filters.h',
     'Helpers.h',
     'Logging.h',
     'Matrix.h',
     'PathHelpers.h',
     'Point.h',
     'Rect.h',
     'Scale.h',
@@ -103,16 +102,17 @@ UNIFIED_SOURCES += [
     'DataSourceSurface.cpp',
     'DataSurfaceHelpers.cpp',
     'DrawEventRecorder.cpp',
     'DrawTarget.cpp',
     'DrawTargetCairo.cpp',
     'DrawTargetCapture.cpp',
     'DrawTargetDual.cpp',
     'DrawTargetRecording.cpp',
+    'DrawTargetTiled.cpp',
     'Factory.cpp',
     'FilterNodeSoftware.cpp',
     'FilterProcessing.cpp',
     'FilterProcessingScalar.cpp',
     'ImageScaling.cpp',
     'Matrix.cpp',
     'Path.cpp',
     'PathCairo.cpp',
@@ -121,21 +121,16 @@ UNIFIED_SOURCES += [
     'RecordedEvent.cpp',
     'Scale.cpp',
     'ScaledFontBase.cpp',
     'ScaledFontCairo.cpp',
     'SourceSurfaceCairo.cpp',
     'SourceSurfaceRawData.cpp',
 ]
 
-SOURCES += [
-    'DrawTargetTiled.cpp',
-
-]
-
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
     SOURCES += [
         'MacIOSurface.cpp',
         'QuartzSupport.mm',
     ]
 
 FAIL_ON_WARNINGS = True
 
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -684,17 +684,16 @@ BufferTextureClient::AllocateForSurface(
 
 gfx::DrawTarget*
 BufferTextureClient::BorrowDrawTarget()
 {
   MOZ_ASSERT(IsValid());
   MOZ_ASSERT(mLocked, "BorrowDrawTarget should be called on locked textures only");
 
   if (mDrawTarget) {
-    mDrawTarget->SetTransform(Matrix());
     return mDrawTarget;
   }
 
   ImageDataSerializer serializer(GetBuffer(), GetBufferSize());
   if (!serializer.IsValid()) {
     return nullptr;
   }
 
@@ -734,16 +733,17 @@ BufferTextureClient::Unlock()
 
   if (mReadbackSink) {
     RefPtr<SourceSurface> snapshot = mDrawTarget->Snapshot();
     RefPtr<DataSourceSurface> dataSurf = snapshot->GetDataSurface();
     mReadbackSink->ProcessReadback(dataSurf);
   }
 
   mDrawTarget->Flush();
+  mDrawTarget = nullptr;
 }
 
 bool
 BufferTextureClient::UpdateYCbCr(const PlanarYCbCrData& aData)
 {
   MOZ_ASSERT(mLocked);
   MOZ_ASSERT(mFormat == gfx::SurfaceFormat::YUV, "This textureClient can only use YCbCr data");
   MOZ_ASSERT(!IsImmutable());
--- a/gfx/thebes/gfxContext.cpp
+++ b/gfx/thebes/gfxContext.cpp
@@ -19,17 +19,16 @@
 #include "gfxUtils.h"
 #include "gfxASurface.h"
 #include "gfxPattern.h"
 #include "gfxPlatform.h"
 #include "gfxTeeSurface.h"
 #include "GeckoProfiler.h"
 #include "gfx2DGlue.h"
 #include "mozilla/gfx/PathHelpers.h"
-#include "mozilla/gfx/DrawTargetTiled.h"
 #include <algorithm>
 
 #if CAIRO_HAS_DWRITE_FONT
 #include "gfxWindowsPlatform.h"
 #endif
 
 using namespace mozilla;
 using namespace mozilla::gfx;
@@ -1114,42 +1113,22 @@ gfxContext::PushGroupAndCopyBackground(g
     DrawTarget *oldDT = mDT;
     RefPtr<SourceSurface> source = mDT->Snapshot();
     Point oldDeviceOffset = CurrentState().deviceOffset;
 
     PushNewDT(gfxContentType::COLOR);
 
     Point offset = CurrentState().deviceOffset - oldDeviceOffset;
     Rect surfRect(0, 0, Float(mDT->GetSize().width), Float(mDT->GetSize().height));
-    Rect sourceRect = surfRect + offset;
+    Rect sourceRect = surfRect;
+    sourceRect.x += offset.x;
+    sourceRect.y += offset.y;
 
     mDT->SetTransform(Matrix());
-
-    // XXX: It's really sad that we have to do this (for performance).
-    // Once DrawTarget gets a PushLayer API we can implement this within
-    // DrawTargetTiled.
-    if (source->GetType() == SurfaceType::TILED) {
-      SnapshotTiled *sourceTiled = static_cast<SnapshotTiled*>(source.get());
-      for (uint32_t i = 0; i < sourceTiled->mSnapshots.size(); i++) {
-        Rect tileSourceRect = sourceRect.Intersect(Rect(sourceTiled->mOrigins[i].x,
-                                                        sourceTiled->mOrigins[i].y,
-                                                        sourceTiled->mSnapshots[i]->GetSize().width,
-                                                        sourceTiled->mSnapshots[i]->GetSize().height));
-
-        if (tileSourceRect.IsEmpty()) {
-          continue;
-        }
-        Rect tileDestRect = tileSourceRect - offset;
-        tileSourceRect -= sourceTiled->mOrigins[i];
-
-        mDT->DrawSurface(sourceTiled->mSnapshots[i], tileDestRect, tileSourceRect);
-      }
-    } else {
-      mDT->DrawSurface(source, surfRect, sourceRect);
-    }
+    mDT->DrawSurface(source, surfRect, sourceRect);
     mDT->SetOpaqueRect(oldDT->GetOpaqueRect());
 
     PushClipsToDT(mDT);
     mDT->SetTransform(GetDTTransform());
     return;
   }
   PushGroup(content);
 }