gfxQuartzSurface.h (1192B)
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- 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 #ifdef MOZ_WIDGET_COCOA 14 # include <Carbon/Carbon.h> 15 #else 16 # include <CoreGraphics/CoreGraphics.h> 17 #endif 18 19 class gfxContext; 20 class gfxImageSurface; 21 22 class gfxQuartzSurface : public gfxASurface { 23 public: 24 gfxQuartzSurface(const mozilla::gfx::IntSize&, gfxImageFormat format); 25 gfxQuartzSurface(CGContextRef context, const mozilla::gfx::IntSize& size); 26 gfxQuartzSurface(cairo_surface_t* csurf, const mozilla::gfx::IntSize& aSize); 27 28 virtual ~gfxQuartzSurface(); 29 30 virtual const mozilla::gfx::IntSize GetSize() const { return mSize; } 31 32 CGContextRef GetCGContext() { return mCGContext; } 33 34 already_AddRefed<gfxImageSurface> GetAsImageSurface(); 35 36 protected: 37 void MakeInvalid(); 38 39 CGContextRef mCGContext; 40 mozilla::gfx::IntSize mSize; 41 }; 42 43 #endif /* GFX_QUARTZSURFACE_H */