2006-02-22 04:44:31 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
2012-05-21 15:12:37 +04: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/. */
|
2006-02-22 04:44:31 +03:00
|
|
|
|
|
|
|
#ifndef GFX_QUARTZSURFACE_H
|
|
|
|
#define GFX_QUARTZSURFACE_H
|
|
|
|
|
|
|
|
#include "gfxASurface.h"
|
2008-01-28 22:05:44 +03:00
|
|
|
#include "gfxImageSurface.h"
|
2006-02-22 04:44:31 +03:00
|
|
|
|
|
|
|
#include <Carbon/Carbon.h>
|
|
|
|
|
2010-04-06 06:28:54 +04:00
|
|
|
class gfxContext;
|
|
|
|
|
2013-05-30 01:59:24 +04:00
|
|
|
class gfxQuartzSurface : public gfxASurface {
|
2006-02-22 04:44:31 +03:00
|
|
|
public:
|
2011-09-29 10:19:26 +04:00
|
|
|
gfxQuartzSurface(const gfxSize& size, gfxImageFormat format, bool aForPrinting = false);
|
|
|
|
gfxQuartzSurface(CGContextRef context, const gfxSize& size, bool aForPrinting = false);
|
2011-12-13 18:58:11 +04:00
|
|
|
gfxQuartzSurface(CGContextRef context, const gfxIntSize& size, bool aForPrinting = false);
|
2011-09-29 10:19:26 +04:00
|
|
|
gfxQuartzSurface(cairo_surface_t *csurf, bool aForPrinting = false);
|
|
|
|
gfxQuartzSurface(unsigned char *data, const gfxSize& size, long stride, gfxImageFormat format, bool aForPrinting = false);
|
2013-05-22 11:04:12 +04:00
|
|
|
gfxQuartzSurface(unsigned char *data, const gfxIntSize& size, long stride, gfxImageFormat format, bool aForPrinting = false);
|
2006-02-22 04:44:31 +03:00
|
|
|
|
|
|
|
virtual ~gfxQuartzSurface();
|
|
|
|
|
2010-06-01 03:37:44 +04:00
|
|
|
virtual already_AddRefed<gfxASurface> CreateSimilarSurface(gfxContentType aType,
|
|
|
|
const gfxIntSize& aSize);
|
|
|
|
|
2010-09-08 04:36:57 +04:00
|
|
|
virtual const gfxIntSize GetSize() const { return gfxIntSize(mSize.width, mSize.height); }
|
2006-02-22 04:44:31 +03:00
|
|
|
|
|
|
|
CGContextRef GetCGContext() { return mCGContext; }
|
2006-11-29 00:10:05 +03:00
|
|
|
|
2010-04-06 06:28:54 +04:00
|
|
|
CGContextRef GetCGContextWithClip(gfxContext *ctx);
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual int32_t GetDefaultContextFlags() const;
|
2008-01-07 03:50:18 +03:00
|
|
|
|
2010-11-11 23:31:23 +03:00
|
|
|
already_AddRefed<gfxImageSurface> GetAsImageSurface();
|
|
|
|
|
2011-05-08 05:19:11 +04:00
|
|
|
void MovePixels(const nsIntRect& aSourceRect,
|
|
|
|
const nsIntPoint& aDestTopLeft)
|
|
|
|
{
|
|
|
|
FastMovePixels(aSourceRect, aDestTopLeft);
|
|
|
|
}
|
|
|
|
|
2006-02-22 04:44:31 +03:00
|
|
|
protected:
|
2011-09-13 18:49:01 +04:00
|
|
|
void MakeInvalid();
|
|
|
|
|
2006-02-22 04:44:31 +03:00
|
|
|
CGContextRef mCGContext;
|
2008-01-07 03:50:18 +03:00
|
|
|
gfxSize mSize;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mForPrinting;
|
2006-02-22 04:44:31 +03:00
|
|
|
};
|
2007-02-08 23:47:48 +03:00
|
|
|
|
2006-02-22 04:44:31 +03:00
|
|
|
#endif /* GFX_QUARTZSURFACE_H */
|