Bug 1279473 - Remove more dead gfxASurface code. r=mstange
authorJonathan Watt <jwatt@jwatt.org>
Wed, 08 Jun 2016 20:26:56 +0100
changeset 377711 6d3a4e0d206ac0ef1d26cf7d4f033634a9a873a8
parent 377710 130240034c3777a1fb4359b18a803cf76b498787
child 377712 3e2b029c616d5cd48e7a6647181f392dd9d14ff8
push id20857
push userbmo:james@hoppipolla.co.uk
push dateSun, 12 Jun 2016 16:59:39 +0000
reviewersmstange
bugs1279473
milestone50.0a1
Bug 1279473 - Remove more dead gfxASurface code. r=mstange
gfx/thebes/gfxASurface.cpp
gfx/thebes/gfxASurface.h
--- a/gfx/thebes/gfxASurface.cpp
+++ b/gfx/thebes/gfxASurface.cpp
@@ -54,17 +54,17 @@
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 
 static cairo_user_data_key_t gfxasurface_pointer_key;
 
 gfxASurface::gfxASurface()
  : mSurface(nullptr), mFloatingRefs(0), mBytesRecorded(0),
-   mSurfaceValid(false), mAllowUseAsSource(true)
+   mSurfaceValid(false)
 {
     MOZ_COUNT_CTOR(gfxASurface);
 }
 
 gfxASurface::~gfxASurface()
 {
     RecordMemoryFreed();
 
@@ -112,28 +112,16 @@ gfxASurface::Release(void)
             delete this;
             return 0;
         }
 
         return mFloatingRefs;
     }
 }
 
-nsrefcnt
-gfxASurface::AddRefExternal(void)
-{
-  return AddRef();
-}
-
-nsrefcnt
-gfxASurface::ReleaseExternal(void)
-{
-  return Release();
-}
-
 void
 gfxASurface::SurfaceDestroyFunc(void *data) {
     gfxASurface *surf = (gfxASurface*) data;
     // fprintf (stderr, "Deleting wrapper for %p (wrapper: %p)\n", surf->mSurface, data);
     delete surf;
 }
 
 gfxASurface*
@@ -332,26 +320,16 @@ gfxASurface::CreateSimilarSurface(gfxCon
     }
 
     RefPtr<gfxASurface> result = Wrap(surface, aSize);
     cairo_surface_destroy(surface);
     return result.forget();
 }
 
 already_AddRefed<gfxImageSurface>
-gfxASurface::GetAsReadableARGB32ImageSurface()
-{
-    RefPtr<gfxImageSurface> imgSurface = GetAsImageSurface();
-    if (!imgSurface || imgSurface->Format() != SurfaceFormat::A8R8G8B8_UINT32) {
-      imgSurface = CopyToARGB32ImageSurface();
-    }
-    return imgSurface.forget();
-}
-
-already_AddRefed<gfxImageSurface>
 gfxASurface::CopyToARGB32ImageSurface()
 {
     if (!mSurface || !mSurfaceValid) {
       return nullptr;
     }
 
     const IntSize size = GetSize();
     RefPtr<gfxImageSurface> imgSurface =
@@ -468,39 +446,16 @@ gfxASurface::ContentFromFormat(gfxImageF
             return gfxContentType::ALPHA;
 
         case SurfaceFormat::UNKNOWN:
         default:
             return gfxContentType::COLOR;
     }
 }
 
-void
-gfxASurface::SetSubpixelAntialiasingEnabled(bool aEnabled)
-{
-#ifdef MOZ_TREE_CAIRO
-    if (!mSurfaceValid)
-        return;
-    cairo_surface_set_subpixel_antialiasing(mSurface,
-        aEnabled ? CAIRO_SUBPIXEL_ANTIALIASING_ENABLED : CAIRO_SUBPIXEL_ANTIALIASING_DISABLED);
-#endif
-}
-
-bool
-gfxASurface::GetSubpixelAntialiasingEnabled()
-{
-    if (!mSurfaceValid)
-      return false;
-#ifdef MOZ_TREE_CAIRO
-    return cairo_surface_get_subpixel_antialiasing(mSurface) == CAIRO_SUBPIXEL_ANTIALIASING_ENABLED;
-#else
-    return true;
-#endif
-}
-
 int32_t
 gfxASurface::BytePerPixelFromFormat(gfxImageFormat format)
 {
     switch (format) {
         case SurfaceFormat::A8R8G8B8_UINT32:
         case SurfaceFormat::X8R8G8B8_UINT32:
             return 4;
         case SurfaceFormat::R5G6B5_UINT16:
--- a/gfx/thebes/gfxASurface.h
+++ b/gfx/thebes/gfxASurface.h
@@ -31,20 +31,16 @@ struct already_AddRefed;
  * A surface is something you can draw on. Instantiate a subclass of this
  * abstract class, and use gfxContext to draw on this surface.
  */
 class gfxASurface {
 public:
 #ifdef MOZILLA_INTERNAL_API
     nsrefcnt AddRef(void);
     nsrefcnt Release(void);
-
-    // These functions exist so that browsercomps can refcount a gfxASurface
-    virtual nsrefcnt AddRefExternal(void);
-    virtual nsrefcnt ReleaseExternal(void);
 #else
     virtual nsrefcnt AddRef(void);
     virtual nsrefcnt Release(void);
 #endif
 
 public:
 
     /** Wrap the given cairo surface and return a gfxASurface for it.
@@ -93,23 +89,16 @@ public:
     /**
      * Returns an image surface for this surface, or nullptr if not supported.
      * This will not copy image data, just wraps an image surface around
      * pixel data already available in memory.
      */
     virtual already_AddRefed<gfxImageSurface> GetAsImageSurface();
 
     /**
-     * Returns a read-only ARGB32 image surface for this surface. If this is an
-     * optimized surface this may require a copy.
-     * Returns null on error.
-     */
-    virtual already_AddRefed<gfxImageSurface> GetAsReadableARGB32ImageSurface();
-
-    /**
      * Creates a new ARGB32 image surface with the same contents as this surface.
      * Returns null on error.
      */
     already_AddRefed<gfxImageSurface> CopyToARGB32ImageSurface();
 
     int CairoStatus();
 
     /* Make sure that the given dimensions don't overflow a 32-bit signed int
@@ -120,19 +109,16 @@ public:
 
     /* Provide a stride value that will respect all alignment requirements of
      * the accelerated image-rendering code.
      */
     static int32_t FormatStrideForWidth(gfxImageFormat format, int32_t width);
 
     static gfxContentType ContentFromFormat(gfxImageFormat format);
 
-    void SetSubpixelAntialiasingEnabled(bool aEnabled);
-    bool GetSubpixelAntialiasingEnabled();
-
     /**
      * Record number of bytes for given surface type.  Use positive bytes
      * for allocations and negative bytes for deallocations.
      */
     static void RecordMemoryUsedForSurfaceType(gfxSurfaceType aType,
                                                int32_t aBytes);
 
     /**
@@ -166,22 +152,16 @@ public:
     void SetOpaqueRect(const gfxRect& aRect);
 
     const gfxRect& GetOpaqueRect() {
         if (!!mOpaqueRect)
             return *mOpaqueRect;
         return GetEmptyOpaqueRect();
     }
 
-    /**
-     * Mark the surface as being allowed/not allowed to be used as a source.
-     */
-    void SetAllowUseAsSource(bool aAllow) { mAllowUseAsSource = aAllow; }
-    bool GetAllowUseAsSource() { return mAllowUseAsSource; }
-
     static uint8_t BytesPerPixel(gfxImageFormat aImageFormat);
 
 protected:
     gfxASurface();
 
     static gfxASurface* GetSurfaceWrapper(cairo_surface_t *csurf);
     static void SetSurfaceWrapper(cairo_surface_t *csurf, gfxASurface *asurf);
 
@@ -202,17 +182,16 @@ protected:
 private:
     static void SurfaceDestroyFunc(void *data);
 
     int32_t mFloatingRefs;
     int32_t mBytesRecorded;
 
 protected:
     bool mSurfaceValid;
-    bool mAllowUseAsSource;
 };
 
 /**
  * An Unknown surface; used to wrap unknown cairo_surface_t returns from cairo
  */
 class gfxUnknownSurface : public gfxASurface {
 public:
     gfxUnknownSurface(cairo_surface_t *surf, const mozilla::gfx::IntSize& aSize)