gfx/thebes/gfxQuartzSurface.h

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:30ec6b7e04fa
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/. */
5
6 #ifndef GFX_QUARTZSURFACE_H
7 #define GFX_QUARTZSURFACE_H
8
9 #include "gfxASurface.h"
10 #include "nsSize.h"
11 #include "gfxPoint.h"
12
13 #include <Carbon/Carbon.h>
14
15 class gfxContext;
16 class gfxImageSurface;
17
18 class gfxQuartzSurface : public gfxASurface {
19 public:
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);
26
27 virtual ~gfxQuartzSurface();
28
29 virtual already_AddRefed<gfxASurface> CreateSimilarSurface(gfxContentType aType,
30 const gfxIntSize& aSize);
31
32 virtual const gfxIntSize GetSize() const { return gfxIntSize(mSize.width, mSize.height); }
33
34 CGContextRef GetCGContext() { return mCGContext; }
35
36 CGContextRef GetCGContextWithClip(gfxContext *ctx);
37
38 virtual int32_t GetDefaultContextFlags() const;
39
40 already_AddRefed<gfxImageSurface> GetAsImageSurface();
41
42 void MovePixels(const nsIntRect& aSourceRect,
43 const nsIntPoint& aDestTopLeft)
44 {
45 FastMovePixels(aSourceRect, aDestTopLeft);
46 }
47
48 protected:
49 void MakeInvalid();
50
51 CGContextRef mCGContext;
52 gfxSize mSize;
53 bool mForPrinting;
54 };
55
56 #endif /* GFX_QUARTZSURFACE_H */

mercurial