gfxWindowsSurface.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. #ifndef GFX_WINDOWSSURFACE_H
  6. #define GFX_WINDOWSSURFACE_H
  7. #include "gfxASurface.h"
  8. #include "gfxImageSurface.h"
  9. /* include windows.h for the HWND and HDC definitions that we need. */
  10. #include <windows.h>
  11. struct IDirect3DSurface9;
  12. /* undefine LoadImage because our code uses that name */
  13. #undef LoadImage
  14. class gfxContext;
  15. class gfxWindowsSurface : public gfxASurface {
  16. public:
  17. enum {
  18. FLAG_IS_TRANSPARENT = (1 << 2)
  19. };
  20. gfxWindowsSurface(HDC dc, uint32_t flags = 0);
  21. // Create from a shared d3d9surface
  22. gfxWindowsSurface(IDirect3DSurface9 *surface, uint32_t flags = 0);
  23. // Create a DIB surface
  24. gfxWindowsSurface(const mozilla::gfx::IntSize& size,
  25. gfxImageFormat imageFormat = mozilla::gfx::SurfaceFormat::X8R8G8B8_UINT32);
  26. gfxWindowsSurface(cairo_surface_t *csurf);
  27. virtual already_AddRefed<gfxASurface> CreateSimilarSurface(gfxContentType aType,
  28. const mozilla::gfx::IntSize& aSize);
  29. void InitWithDC(uint32_t flags);
  30. virtual ~gfxWindowsSurface();
  31. HDC GetDC();
  32. already_AddRefed<gfxImageSurface> GetAsImageSurface();
  33. const mozilla::gfx::IntSize GetSize() const;
  34. private:
  35. void MakeInvalid(mozilla::gfx::IntSize& size);
  36. bool mOwnsDC;
  37. HDC mDC;
  38. HWND mWnd;
  39. };
  40. #endif /* GFX_WINDOWSSURFACE_H */