michael@0: /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef GFX_QUARTZSURFACE_H michael@0: #define GFX_QUARTZSURFACE_H michael@0: michael@0: #include "gfxASurface.h" michael@0: #include "nsSize.h" michael@0: #include "gfxPoint.h" michael@0: michael@0: #include michael@0: michael@0: class gfxContext; michael@0: class gfxImageSurface; michael@0: michael@0: class gfxQuartzSurface : public gfxASurface { michael@0: public: michael@0: gfxQuartzSurface(const gfxSize& size, gfxImageFormat format, bool aForPrinting = false); michael@0: gfxQuartzSurface(CGContextRef context, const gfxSize& size, bool aForPrinting = false); michael@0: gfxQuartzSurface(CGContextRef context, const gfxIntSize& size, bool aForPrinting = false); michael@0: gfxQuartzSurface(cairo_surface_t *csurf, const gfxIntSize& aSize, bool aForPrinting = false); michael@0: gfxQuartzSurface(unsigned char *data, const gfxSize& size, long stride, gfxImageFormat format, bool aForPrinting = false); michael@0: gfxQuartzSurface(unsigned char *data, const gfxIntSize& size, long stride, gfxImageFormat format, bool aForPrinting = false); michael@0: michael@0: virtual ~gfxQuartzSurface(); michael@0: michael@0: virtual already_AddRefed CreateSimilarSurface(gfxContentType aType, michael@0: const gfxIntSize& aSize); michael@0: michael@0: virtual const gfxIntSize GetSize() const { return gfxIntSize(mSize.width, mSize.height); } michael@0: michael@0: CGContextRef GetCGContext() { return mCGContext; } michael@0: michael@0: CGContextRef GetCGContextWithClip(gfxContext *ctx); michael@0: michael@0: virtual int32_t GetDefaultContextFlags() const; michael@0: michael@0: already_AddRefed GetAsImageSurface(); michael@0: michael@0: void MovePixels(const nsIntRect& aSourceRect, michael@0: const nsIntPoint& aDestTopLeft) michael@0: { michael@0: FastMovePixels(aSourceRect, aDestTopLeft); michael@0: } michael@0: michael@0: protected: michael@0: void MakeInvalid(); michael@0: michael@0: CGContextRef mCGContext; michael@0: gfxSize mSize; michael@0: bool mForPrinting; michael@0: }; michael@0: michael@0: #endif /* GFX_QUARTZSURFACE_H */