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 84637 1a2a2395cece68435b4e47dad294bf9753935a34
parent 84636 eb189727e43fe8d679a2f70781b0ae499764a64c
child 84638 e6e3821a4b95b3599d93ffd37e1c08abd0b4dc35
push id21868
push usermak77@bonardo.net
push dateTue, 17 Jan 2012 15:23:07 +0000
treeherdermozilla-central@ff1bedd7d463 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmwoodrow
bugs716639
milestone12.0a1
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
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);