Bug 1278427 - Remove some code from gfxWindowsSurface. r=eflores
authorJonathan Watt <jwatt@jwatt.org>
Mon, 30 May 2016 16:26:30 +0100
changeset 300963 624915556f35d7e47f691ad1f914605ea14899b1
parent 300962 2b197e09ce5b50e40d153ac6ae3dfaadb9fd9346
child 300964 07270f1261e1d666cd0f10fb27ea1948864fe0b5
push id19599
push usercbook@mozilla.com
push dateWed, 08 Jun 2016 10:16:21 +0000
treeherderfx-team@81f4cc3f6f4c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerseflores
bugs1278427
milestone50.0a1
Bug 1278427 - Remove some code from gfxWindowsSurface. r=eflores
gfx/thebes/gfxWindowsSurface.cpp
gfx/thebes/gfxWindowsSurface.h
--- a/gfx/thebes/gfxWindowsSurface.cpp
+++ b/gfx/thebes/gfxWindowsSurface.cpp
@@ -9,23 +9,16 @@
 #include "mozilla/gfx/HelpersCairo.h"
 #include "mozilla/gfx/Logging.h"
 
 #include "cairo.h"
 #include "cairo-win32.h"
 
 #include "nsString.h"
 
-gfxWindowsSurface::gfxWindowsSurface(HWND wnd, uint32_t flags) :
-    mOwnsDC(true), mForPrinting(false), mWnd(wnd)
-{
-    mDC = ::GetDC(mWnd);
-    InitWithDC(flags);
-}
-
 gfxWindowsSurface::gfxWindowsSurface(HDC dc, uint32_t flags) :
     mOwnsDC(false), mForPrinting(false), mDC(dc), mWnd(nullptr)
 {
     if (flags & FLAG_TAKE_DC)
         mOwnsDC = true;
 
 #ifdef NS_PRINTING
     if (flags & FLAG_FOR_PRINTING) {
@@ -69,43 +62,16 @@ gfxWindowsSurface::gfxWindowsSurface(con
     if (CairoStatus() == CAIRO_STATUS_SUCCESS) {
         mDC = cairo_win32_surface_get_dc(CairoSurface());
         RecordMemoryUsed(size.width * size.height * 4 + sizeof(gfxWindowsSurface));
     } else {
         mDC = nullptr;
     }
 }
 
-gfxWindowsSurface::gfxWindowsSurface(HDC dc, const mozilla::gfx::IntSize& realSize, gfxImageFormat imageFormat) :
-    mOwnsDC(false), mForPrinting(false), mWnd(nullptr)
-{
-    mozilla::gfx::IntSize size(realSize);
-    if (!CheckSurfaceSize(size))
-        MakeInvalid(size);
-
-    cairo_format_t cformat = GfxFormatToCairoFormat(imageFormat);
-    cairo_surface_t *surf =
-        cairo_win32_surface_create_with_ddb(dc, cformat,
-                                            size.width, size.height);
-
-    Init(surf);
-
-    if (mSurfaceValid) {
-        // DDBs will generally only use 3 bytes per pixel when RGB24
-        int bytesPerPixel =
-            ((imageFormat == mozilla::gfx::SurfaceFormat::X8R8G8B8_UINT32) ? 3 : 4);
-        RecordMemoryUsed(size.width * size.height * bytesPerPixel + sizeof(gfxWindowsSurface));
-    }
-
-    if (CairoStatus() == 0)
-        mDC = cairo_win32_surface_get_dc(CairoSurface());
-    else
-        mDC = nullptr;
-}
-
 gfxWindowsSurface::gfxWindowsSurface(cairo_surface_t *csurf) :
     mOwnsDC(false), mForPrinting(false), mWnd(nullptr)
 {
     if (cairo_surface_status(csurf) == 0)
         mDC = cairo_win32_surface_get_dc(csurf);
     else
         mDC = nullptr;
 
--- a/gfx/thebes/gfxWindowsSurface.h
+++ b/gfx/thebes/gfxWindowsSurface.h
@@ -22,31 +22,25 @@ class gfxContext;
 class gfxWindowsSurface : public gfxASurface {
 public:
     enum {
         FLAG_TAKE_DC = (1 << 0),
         FLAG_FOR_PRINTING = (1 << 1),
         FLAG_IS_TRANSPARENT = (1 << 2)
     };
 
-    gfxWindowsSurface(HWND wnd, uint32_t flags = 0);
     gfxWindowsSurface(HDC dc, uint32_t flags = 0);
 
     // Create from a shared d3d9surface
     gfxWindowsSurface(IDirect3DSurface9 *surface, uint32_t flags = 0);
 
     // Create a DIB surface
     gfxWindowsSurface(const mozilla::gfx::IntSize& size,
                       gfxImageFormat imageFormat = mozilla::gfx::SurfaceFormat::X8R8G8B8_UINT32);
 
-    // Create a DDB surface; dc may be nullptr to use the screen DC
-    gfxWindowsSurface(HDC dc,
-                      const mozilla::gfx::IntSize& size,
-                      gfxImageFormat imageFormat = mozilla::gfx::SurfaceFormat::X8R8G8B8_UINT32);
-
     gfxWindowsSurface(cairo_surface_t *csurf);
 
     virtual already_AddRefed<gfxASurface> CreateSimilarSurface(gfxContentType aType,
                                                                const mozilla::gfx::IntSize& aSize);
 
     void InitWithDC(uint32_t flags);
 
     virtual ~gfxWindowsSurface();