1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef GFX_QUARTZSURFACE_H
7 #define GFX_QUARTZSURFACE_H
9 #include "gfxASurface.h"
13 #include <Carbon/Carbon.h>
16 class gfxImageSurface
;
18 class gfxQuartzSurface
: public gfxASurface
{
20 gfxQuartzSurface(const gfxSize
& size
, gfxImageFormat format
, bool aForPrinting
= false);
21 gfxQuartzSurface(CGContextRef context
, const gfxSize
& size
, bool aForPrinting
= false);
22 gfxQuartzSurface(CGContextRef context
, const gfxIntSize
& size
, bool aForPrinting
= false);
23 gfxQuartzSurface(cairo_surface_t
*csurf
, const gfxIntSize
& aSize
, bool aForPrinting
= false);
24 gfxQuartzSurface(unsigned char *data
, const gfxSize
& size
, long stride
, gfxImageFormat format
, bool aForPrinting
= false);
25 gfxQuartzSurface(unsigned char *data
, const gfxIntSize
& size
, long stride
, gfxImageFormat format
, bool aForPrinting
= false);
27 virtual ~gfxQuartzSurface();
29 virtual already_AddRefed
<gfxASurface
> CreateSimilarSurface(gfxContentType aType
,
30 const gfxIntSize
& aSize
);
32 virtual const gfxIntSize
GetSize() const { return gfxIntSize(mSize
.width
, mSize
.height
); }
34 CGContextRef
GetCGContext() { return mCGContext
; }
36 CGContextRef
GetCGContextWithClip(gfxContext
*ctx
);
38 virtual int32_t GetDefaultContextFlags() const;
40 already_AddRefed
<gfxImageSurface
> GetAsImageSurface();
45 CGContextRef mCGContext
;
50 #endif /* GFX_QUARTZSURFACE_H */