2005-04-06 05:54:26 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
2012-05-21 15:12:37 +04:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2005-04-06 05:54:26 +04:00
|
|
|
|
2005-04-11 08:36:18 +04:00
|
|
|
#ifndef GFX_WINDOWSSURFACE_H
|
|
|
|
#define GFX_WINDOWSSURFACE_H
|
2005-04-06 05:54:26 +04:00
|
|
|
|
|
|
|
#include "gfxASurface.h"
|
2006-08-10 02:43:06 +04:00
|
|
|
#include "gfxImageSurface.h"
|
2005-04-06 05:54:26 +04:00
|
|
|
|
2013-03-26 01:53:54 +04:00
|
|
|
/* include windows.h for the HWND and HDC definitions that we need. */
|
2006-04-05 01:54:22 +04:00
|
|
|
#include <windows.h>
|
2013-09-05 00:53:54 +04:00
|
|
|
|
|
|
|
struct IDirect3DSurface9;
|
|
|
|
|
2013-03-26 01:53:54 +04:00
|
|
|
/* undefine LoadImage because our code uses that name */
|
|
|
|
#undef LoadImage
|
2005-04-06 05:54:26 +04:00
|
|
|
|
2010-04-06 06:28:54 +04:00
|
|
|
class gfxContext;
|
|
|
|
|
2013-05-30 01:59:24 +04:00
|
|
|
class gfxWindowsSurface : public gfxASurface {
|
2005-04-06 05:54:26 +04:00
|
|
|
public:
|
2007-09-25 02:50:44 +04:00
|
|
|
enum {
|
2010-08-20 22:19:38 +04:00
|
|
|
FLAG_IS_TRANSPARENT = (1 << 2)
|
2007-09-25 02:50:44 +04:00
|
|
|
};
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
gfxWindowsSurface(HDC dc, uint32_t flags = 0);
|
2006-08-10 02:43:06 +04:00
|
|
|
|
2013-09-05 00:53:54 +04:00
|
|
|
// Create from a shared d3d9surface
|
|
|
|
gfxWindowsSurface(IDirect3DSurface9 *surface, uint32_t flags = 0);
|
|
|
|
|
2006-08-10 02:43:06 +04:00
|
|
|
// Create a DIB surface
|
2015-06-01 11:26:19 +03:00
|
|
|
gfxWindowsSurface(const mozilla::gfx::IntSize& size,
|
2016-01-08 07:57:38 +03:00
|
|
|
gfxImageFormat imageFormat = mozilla::gfx::SurfaceFormat::X8R8G8B8_UINT32);
|
2006-08-10 02:43:06 +04:00
|
|
|
|
2006-04-05 01:54:22 +04:00
|
|
|
gfxWindowsSurface(cairo_surface_t *csurf);
|
2006-08-10 02:43:06 +04:00
|
|
|
|
2011-02-01 06:47:47 +03:00
|
|
|
virtual already_AddRefed<gfxASurface> CreateSimilarSurface(gfxContentType aType,
|
2015-06-01 11:26:19 +03:00
|
|
|
const mozilla::gfx::IntSize& aSize);
|
2011-02-01 06:47:47 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void InitWithDC(uint32_t flags);
|
2010-07-16 01:08:10 +04:00
|
|
|
|
2005-04-06 05:54:26 +04:00
|
|
|
virtual ~gfxWindowsSurface();
|
2005-08-20 09:36:47 +04:00
|
|
|
|
2013-09-05 00:53:54 +04:00
|
|
|
HDC GetDC();
|
2006-02-01 08:21:59 +03:00
|
|
|
|
2010-11-11 23:31:22 +03:00
|
|
|
already_AddRefed<gfxImageSurface> GetAsImageSurface();
|
2006-08-10 02:43:06 +04:00
|
|
|
|
2015-06-01 11:26:19 +03:00
|
|
|
const mozilla::gfx::IntSize GetSize() const;
|
2011-11-18 08:00:37 +04:00
|
|
|
|
2005-08-20 09:36:47 +04:00
|
|
|
private:
|
2015-06-01 11:26:19 +03:00
|
|
|
void MakeInvalid(mozilla::gfx::IntSize& size);
|
2011-09-13 18:49:01 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mOwnsDC;
|
2007-09-25 02:50:44 +04:00
|
|
|
|
2005-08-20 09:36:47 +04:00
|
|
|
HDC mDC;
|
2006-01-31 03:00:12 +03:00
|
|
|
HWND mWnd;
|
2005-04-06 05:54:26 +04:00
|
|
|
};
|
|
|
|
|
2005-04-11 08:36:18 +04:00
|
|
|
#endif /* GFX_WINDOWSSURFACE_H */
|