Bug 716639. Add a constructor for gfxQuartzSurface that takes a gfxIntSize. r=mwoodrow
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Tue, 13 Dec 2011 09:58:11 -0500
changeset 85862 1a2a2395cece68435b4e47dad294bf9753935a34
parent 85861 eb189727e43fe8d679a2f70781b0ae499764a64c
child 85863 e6e3821a4b95b3599d93ffd37e1c08abd0b4dc35
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmwoodrow
bugs716639
milestone12.0a1
Bug 716639. Add a constructor for gfxQuartzSurface that takes a gfxIntSize. r=mwoodrow
gfx/thebes/gfxQuartzSurface.cpp
gfx/thebes/gfxQuartzSurface.h
--- a/gfx/thebes/gfxQuartzSurface.cpp
+++ b/gfx/thebes/gfxQuartzSurface.cpp
@@ -76,16 +76,36 @@ gfxQuartzSurface::gfxQuartzSurface(CGCon
     gfxIntSize size((unsigned int) floor(desiredSize.width),
                     (unsigned int) floor(desiredSize.height));
     if (!CheckSurfaceSize(size))
         MakeInvalid();
 
     unsigned int width = static_cast<unsigned int>(mSize.width);
     unsigned int height = static_cast<unsigned int>(mSize.height);
 
+    cairo_surface_t *surf =
+        cairo_quartz_surface_create_for_cg_context(context,
+                                                   width, height);
+
+    CGContextRetain(mCGContext);
+
+    Init(surf);
+}
+
+gfxQuartzSurface::gfxQuartzSurface(CGContextRef context,
+                                   const gfxIntSize& size,
+                                   bool aForPrinting)
+    : mCGContext(context), mSize(size), mForPrinting(aForPrinting)
+{
+    if (!CheckSurfaceSize(size))
+        MakeInvalid();
+
+    unsigned int width = static_cast<unsigned int>(mSize.width);
+    unsigned int height = static_cast<unsigned int>(mSize.height);
+
     cairo_surface_t *surf = 
         cairo_quartz_surface_create_for_cg_context(context,
                                                    width, height);
 
     CGContextRetain(mCGContext);
 
     Init(surf);
 }
--- a/gfx/thebes/gfxQuartzSurface.h
+++ b/gfx/thebes/gfxQuartzSurface.h
@@ -45,16 +45,17 @@
 #include <Carbon/Carbon.h>
 
 class gfxContext;
 
 class THEBES_API gfxQuartzSurface : public gfxASurface {
 public:
     gfxQuartzSurface(const gfxSize& size, gfxImageFormat format, bool aForPrinting = false);
     gfxQuartzSurface(CGContextRef context, const gfxSize& size, bool aForPrinting = false);
+    gfxQuartzSurface(CGContextRef context, const gfxIntSize& size, bool aForPrinting = false);
     gfxQuartzSurface(cairo_surface_t *csurf, bool aForPrinting = false);
     gfxQuartzSurface(unsigned char *data, const gfxSize& size, long stride, gfxImageFormat format, bool aForPrinting = false);
 
     virtual ~gfxQuartzSurface();
 
     virtual already_AddRefed<gfxASurface> CreateSimilarSurface(gfxContentType aType,
                                                                const gfxIntSize& aSize);