1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/thebes/gfxQuartzSurface.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,56 @@ 1.4 +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- 1.5 + * This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef GFX_QUARTZSURFACE_H 1.10 +#define GFX_QUARTZSURFACE_H 1.11 + 1.12 +#include "gfxASurface.h" 1.13 +#include "nsSize.h" 1.14 +#include "gfxPoint.h" 1.15 + 1.16 +#include <Carbon/Carbon.h> 1.17 + 1.18 +class gfxContext; 1.19 +class gfxImageSurface; 1.20 + 1.21 +class gfxQuartzSurface : public gfxASurface { 1.22 +public: 1.23 + gfxQuartzSurface(const gfxSize& size, gfxImageFormat format, bool aForPrinting = false); 1.24 + gfxQuartzSurface(CGContextRef context, const gfxSize& size, bool aForPrinting = false); 1.25 + gfxQuartzSurface(CGContextRef context, const gfxIntSize& size, bool aForPrinting = false); 1.26 + gfxQuartzSurface(cairo_surface_t *csurf, const gfxIntSize& aSize, bool aForPrinting = false); 1.27 + gfxQuartzSurface(unsigned char *data, const gfxSize& size, long stride, gfxImageFormat format, bool aForPrinting = false); 1.28 + gfxQuartzSurface(unsigned char *data, const gfxIntSize& size, long stride, gfxImageFormat format, bool aForPrinting = false); 1.29 + 1.30 + virtual ~gfxQuartzSurface(); 1.31 + 1.32 + virtual already_AddRefed<gfxASurface> CreateSimilarSurface(gfxContentType aType, 1.33 + const gfxIntSize& aSize); 1.34 + 1.35 + virtual const gfxIntSize GetSize() const { return gfxIntSize(mSize.width, mSize.height); } 1.36 + 1.37 + CGContextRef GetCGContext() { return mCGContext; } 1.38 + 1.39 + CGContextRef GetCGContextWithClip(gfxContext *ctx); 1.40 + 1.41 + virtual int32_t GetDefaultContextFlags() const; 1.42 + 1.43 + already_AddRefed<gfxImageSurface> GetAsImageSurface(); 1.44 + 1.45 + void MovePixels(const nsIntRect& aSourceRect, 1.46 + const nsIntPoint& aDestTopLeft) 1.47 + { 1.48 + FastMovePixels(aSourceRect, aDestTopLeft); 1.49 + } 1.50 + 1.51 +protected: 1.52 + void MakeInvalid(); 1.53 + 1.54 + CGContextRef mCGContext; 1.55 + gfxSize mSize; 1.56 + bool mForPrinting; 1.57 +}; 1.58 + 1.59 +#endif /* GFX_QUARTZSURFACE_H */