2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
2012-05-21 04:12:37 -07:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef GFX_QUARTZSURFACE_H
|
|
|
|
#define GFX_QUARTZSURFACE_H
|
|
|
|
|
|
|
|
#include "gfxASurface.h"
|
2008-01-28 11:05:44 -08:00
|
|
|
#include "gfxImageSurface.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#include <Carbon/Carbon.h>
|
|
|
|
|
2010-04-05 19:28:54 -07:00
|
|
|
class gfxContext;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
class THEBES_API gfxQuartzSurface : public gfxASurface {
|
|
|
|
public:
|
2011-09-28 23:19:26 -07:00
|
|
|
gfxQuartzSurface(const gfxSize& size, gfxImageFormat format, bool aForPrinting = false);
|
|
|
|
gfxQuartzSurface(CGContextRef context, const gfxSize& size, bool aForPrinting = false);
|
2011-12-13 06:58:11 -08:00
|
|
|
gfxQuartzSurface(CGContextRef context, const gfxIntSize& size, bool aForPrinting = false);
|
2011-09-28 23:19:26 -07:00
|
|
|
gfxQuartzSurface(cairo_surface_t *csurf, bool aForPrinting = false);
|
|
|
|
gfxQuartzSurface(unsigned char *data, const gfxSize& size, long stride, gfxImageFormat format, bool aForPrinting = false);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
virtual ~gfxQuartzSurface();
|
|
|
|
|
2010-05-31 16:37:44 -07:00
|
|
|
virtual already_AddRefed<gfxASurface> CreateSimilarSurface(gfxContentType aType,
|
|
|
|
const gfxIntSize& aSize);
|
|
|
|
|
2010-09-07 17:36:57 -07:00
|
|
|
virtual const gfxIntSize GetSize() const { return gfxIntSize(mSize.width, mSize.height); }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
CGContextRef GetCGContext() { return mCGContext; }
|
|
|
|
|
2010-04-05 19:28:54 -07:00
|
|
|
CGContextRef GetCGContextWithClip(gfxContext *ctx);
|
|
|
|
|
2008-01-06 16:50:18 -08:00
|
|
|
virtual PRInt32 GetDefaultContextFlags() const;
|
|
|
|
|
2010-11-11 12:31:23 -08:00
|
|
|
already_AddRefed<gfxImageSurface> GetAsImageSurface();
|
|
|
|
|
2011-05-07 18:19:11 -07:00
|
|
|
void MovePixels(const nsIntRect& aSourceRect,
|
|
|
|
const nsIntPoint& aDestTopLeft)
|
|
|
|
{
|
|
|
|
FastMovePixels(aSourceRect, aDestTopLeft);
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
2011-09-13 07:49:01 -07:00
|
|
|
void MakeInvalid();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
CGContextRef mCGContext;
|
2008-01-06 16:50:18 -08:00
|
|
|
gfxSize mSize;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mForPrinting;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* GFX_QUARTZSURFACE_H */
|