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 {
|
|
|
|
FLAG_TAKE_DC = (1 << 0),
|
2010-07-16 01:07:44 +04:00
|
|
|
FLAG_FOR_PRINTING = (1 << 1),
|
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(HWND wnd, uint32_t flags = 0);
|
|
|
|
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
|
2007-02-08 23:47:48 +03:00
|
|
|
gfxWindowsSurface(const gfxIntSize& size,
|
2013-09-25 00:45:13 +04:00
|
|
|
gfxImageFormat imageFormat = gfxImageFormatRGB24);
|
2006-08-10 02:43:06 +04:00
|
|
|
|
2013-07-31 19:44:31 +04:00
|
|
|
// Create a DDB surface; dc may be nullptr to use the screen DC
|
2006-02-16 02:35:53 +03:00
|
|
|
gfxWindowsSurface(HDC dc,
|
2007-02-08 23:47:48 +03:00
|
|
|
const gfxIntSize& size,
|
2013-09-25 00:45:13 +04:00
|
|
|
gfxImageFormat imageFormat = gfxImageFormatRGB24);
|
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,
|
|
|
|
const gfxIntSize& aSize);
|
|
|
|
|
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-04-06 06:28:54 +04:00
|
|
|
HDC GetDCWithClip(gfxContext *);
|
|
|
|
|
2010-11-11 23:31:22 +03:00
|
|
|
already_AddRefed<gfxImageSurface> GetAsImageSurface();
|
2006-08-10 02:43:06 +04:00
|
|
|
|
2006-02-01 08:21:59 +03:00
|
|
|
nsresult BeginPrinting(const nsAString& aTitle, const nsAString& aPrintToFileName);
|
|
|
|
nsresult EndPrinting();
|
|
|
|
nsresult AbortPrinting();
|
|
|
|
nsresult BeginPage();
|
|
|
|
nsresult EndPage();
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual int32_t GetDefaultContextFlags() const;
|
2007-11-29 23:06:56 +03:00
|
|
|
|
2011-11-18 08:00:37 +04:00
|
|
|
const gfxIntSize GetSize() const;
|
|
|
|
|
2011-05-08 05:19:11 +04:00
|
|
|
void MovePixels(const nsIntRect& aSourceRect,
|
|
|
|
const nsIntPoint& aDestTopLeft)
|
|
|
|
{
|
|
|
|
FastMovePixels(aSourceRect, aDestTopLeft);
|
|
|
|
}
|
|
|
|
|
2011-07-18 17:20:27 +04:00
|
|
|
// The memory used by this surface lives in this process's address space,
|
|
|
|
// but not in the heap.
|
2013-09-25 00:45:13 +04:00
|
|
|
virtual gfxMemoryLocation GetMemoryLocation() const;
|
2011-07-18 17:20:27 +04:00
|
|
|
|
2005-08-20 09:36:47 +04:00
|
|
|
private:
|
2011-09-13 18:49:01 +04:00
|
|
|
void MakeInvalid(gfxIntSize& size);
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mOwnsDC;
|
|
|
|
bool mForPrinting;
|
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 */
|