gfxWindowsSurface.h (1404B)
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_WINDOWSSURFACE_H 7 #define GFX_WINDOWSSURFACE_H 8 9 #include "gfxASurface.h" 10 #include "gfxImageSurface.h" 11 12 /* include windows.h for the HWND and HDC definitions that we need. */ 13 #include <windows.h> 14 15 struct IDirect3DSurface9; 16 17 /* undefine LoadImage because our code uses that name */ 18 #undef LoadImage 19 20 class gfxContext; 21 22 class gfxWindowsSurface : public gfxASurface { 23 public: 24 enum { FLAG_IS_TRANSPARENT = (1 << 2) }; 25 26 explicit gfxWindowsSurface(HDC dc, uint32_t flags = 0); 27 28 // Create a DIB surface 29 explicit gfxWindowsSurface(const mozilla::gfx::IntSize& size, 30 gfxImageFormat imageFormat = 31 mozilla::gfx::SurfaceFormat::X8R8G8B8_UINT32); 32 33 explicit gfxWindowsSurface(cairo_surface_t* csurf); 34 35 void InitWithDC(uint32_t flags); 36 37 virtual ~gfxWindowsSurface(); 38 39 HDC GetDC(); 40 41 already_AddRefed<gfxImageSurface> GetAsImageSurface(); 42 43 const mozilla::gfx::IntSize GetSize() const; 44 45 private: 46 void MakeInvalid(mozilla::gfx::IntSize& size); 47 // NOTE: the DC is _not_ owned by us. 48 HDC mDC = nullptr; 49 }; 50 51 #endif /* GFX_WINDOWSSURFACE_H */