Bug 1082553 - Remove gfxContext::OriginalSurface. r=Bas
authorJonathan Watt <jwatt@jwatt.org>
Thu, 16 Oct 2014 10:51:13 +0100
changeset 210702 6342189dd83825452068e1c83067e6ff9be2688a
parent 210701 bb81f8c944ea9c7beb57617d87166802bd073eb1
child 210703 81ace8239653843a70f8349389742fc766fabd61
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersBas
bugs1082553
milestone36.0a1
Bug 1082553 - Remove gfxContext::OriginalSurface. r=Bas
gfx/thebes/gfxContext.cpp
gfx/thebes/gfxContext.h
--- a/gfx/thebes/gfxContext.cpp
+++ b/gfx/thebes/gfxContext.cpp
@@ -83,17 +83,16 @@ private:
   gfxContext *mContext;
   Pattern *mPattern;
 };
 
 gfxContext::gfxContext(DrawTarget *aTarget, const Point& aDeviceOffset)
   : mPathIsRect(false)
   , mTransformChanged(false)
   , mRefCairo(nullptr)
-  , mSurface(nullptr)
   , mFlags(0)
   , mDT(aTarget)
   , mOriginalDT(aTarget)
 {
   MOZ_ASSERT(aTarget, "Don't create a gfxContext without a DrawTarget");
 
   MOZ_COUNT_CTOR(gfxContext);
 
@@ -125,34 +124,16 @@ gfxContext::~gfxContext()
     if (mStateStack[i].clipWasReset) {
       break;
     }
   }
   mDT->Flush();
   MOZ_COUNT_DTOR(gfxContext);
 }
 
-gfxASurface *
-gfxContext::OriginalSurface()
-{
-    if (mSurface) {
-        return mSurface;
-    }
-
-    if (mOriginalDT && mOriginalDT->GetBackendType() == BackendType::CAIRO) {
-        cairo_surface_t *s =
-            (cairo_surface_t*)mOriginalDT->GetNativeSurface(NativeSurfaceType::CAIRO_SURFACE);
-        if (s) {
-            mSurface = gfxASurface::Wrap(s);
-            return mSurface;
-        }
-    }
-    return nullptr;
-}
-
 already_AddRefed<gfxASurface>
 gfxContext::CurrentSurface(gfxFloat *dx, gfxFloat *dy)
 {
   if (mDT->GetBackendType() == BackendType::CAIRO) {
     cairo_surface_t *s =
     (cairo_surface_t*)mDT->GetNativeSurface(NativeSurfaceType::CAIRO_SURFACE);
     if (s) {
       if (dx && dy) {
--- a/gfx/thebes/gfxContext.h
+++ b/gfx/thebes/gfxContext.h
@@ -56,21 +56,16 @@ public:
     /**
      * Create a new gfxContext wrapping aTarget and preserving aTarget's
      * transform. Note that the transform is moved from aTarget to the resulting
      * gfxContext, aTarget will no longer have its transform.
      */
     static already_AddRefed<gfxContext> ContextForDrawTarget(mozilla::gfx::DrawTarget* aTarget);
 
     /**
-     * Return the surface that this gfxContext was created with
-     */
-    gfxASurface *OriginalSurface();
-
-    /**
      * Return the current transparency group target, if any, along
      * with its device offsets from the top.  If no group is
      * active, returns the surface the gfxContext was created with,
      * and 0,0 in dx,dy.
      */
     already_AddRefed<gfxASurface> CurrentSurface(gfxFloat *dx, gfxFloat *dy);
     already_AddRefed<gfxASurface> CurrentSurface() {
         return CurrentSurface(nullptr, nullptr);
@@ -703,17 +698,16 @@ private:
   mozilla::RefPtr<Path> mPath;
   Matrix mTransform;
   nsTArray<AzureState> mStateStack;
 
   AzureState &CurrentState() { return mStateStack[mStateStack.Length() - 1]; }
   const AzureState &CurrentState() const { return mStateStack[mStateStack.Length() - 1]; }
 
   cairo_t *mRefCairo;
-  nsRefPtr<gfxASurface> mSurface;
   int32_t mFlags;
 
   mozilla::RefPtr<DrawTarget> mDT;
   mozilla::RefPtr<DrawTarget> mOriginalDT;
 };
 
 /**
  * Sentry helper class for functions with multiple return points that need to
@@ -877,22 +871,19 @@ public:
         if (aDisable) {
             mDT = aContext->GetDrawTarget();
             mSubpixelAntialiasingEnabled = mDT->GetPermitSubpixelAA();
             mDT->SetPermitSubpixelAA(false);
         }
     }
     ~gfxContextAutoDisableSubpixelAntialiasing()
     {
-        if (mSurface) {
-            mSurface->SetSubpixelAntialiasingEnabled(mSubpixelAntialiasingEnabled);
-        } else if (mDT) {
+        if (mDT) {
             mDT->SetPermitSubpixelAA(mSubpixelAntialiasingEnabled);
         }
     }
 
 private:
-    nsRefPtr<gfxASurface> mSurface;
     mozilla::RefPtr<mozilla::gfx::DrawTarget> mDT;
     bool mSubpixelAntialiasingEnabled;
 };
 
 #endif /* GFX_CONTEXT_H */