зеркало из https://github.com/mozilla/gecko-dev.git
added ability to create a drawing surface from an HDC under windows.
This commit is contained in:
Родитель
1ea29c4972
Коммит
56739d78ed
|
@ -46,6 +46,8 @@ OBJS = \
|
|||
.\$(OBJDIR)\nsGfxFactoryWin.obj \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS=nsIRenderingContextWin.h
|
||||
|
||||
LINCS= \
|
||||
-I..\
|
||||
-I$(PUBLIC)\raptor \
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsIRenderingContextWin_h___
|
||||
#define nsIRenderingContextWin_h___
|
||||
|
||||
#include "nsIRenderingContext.h"
|
||||
#include <windows.h>
|
||||
|
||||
// IID for the nsIRenderingContext interface
|
||||
#define NS_IRENDERING_CONTEXT_WIN_IID \
|
||||
{ 0x0fcde820, 0x8ae2, 0x11d2, \
|
||||
{ 0xa8, 0x48, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9 } }
|
||||
|
||||
// RenderingContextWin interface
|
||||
class nsIRenderingContextWin : public nsISupports
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Create a new drawing surface to represent an HDC.
|
||||
* @param aDC Windows HDC.
|
||||
* @param aSurface out parameter for new drawing surface
|
||||
* @result error status
|
||||
*/
|
||||
NS_IMETHOD CreateDrawingSurface(HDC aDC, nsDrawingSurface &aSurface) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIRenderingContextWin_h___ */
|
|
@ -48,6 +48,7 @@
|
|||
|
||||
static NS_DEFINE_IID(kIDOMRenderingContextIID, NS_IDOMRENDERINGCONTEXT_IID);
|
||||
static NS_DEFINE_IID(kIRenderingContextIID, NS_IRENDERING_CONTEXT_IID);
|
||||
static NS_DEFINE_IID(kIRenderingContextWinIID, NS_IRENDERING_CONTEXT_WIN_IID);
|
||||
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
|
||||
|
||||
#define FLAG_CLIP_VALID 0x0001
|
||||
|
@ -311,8 +312,6 @@ nsresult nsDrawingSurfaceWin :: ReleaseDC()
|
|||
|
||||
#endif
|
||||
|
||||
static NS_DEFINE_IID(kRenderingContextIID, NS_IRENDERING_CONTEXT_IID);
|
||||
|
||||
#ifdef NGLAYOUT_DDRAW
|
||||
IDirectDraw *nsRenderingContextWin::mDDraw = NULL;
|
||||
IDirectDraw2 *nsRenderingContextWin::mDDraw2 = NULL;
|
||||
|
@ -493,6 +492,14 @@ nsRenderingContextWin :: QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aIID.Equals(kIRenderingContextWinIID))
|
||||
{
|
||||
nsIRenderingContextWin* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aIID.Equals(kIScriptObjectOwnerIID))
|
||||
{
|
||||
nsIScriptObjectOwner* tmp = this;
|
||||
|
@ -2051,3 +2058,18 @@ nsRenderingContextWin::DrawLine2(PRInt32 aX0, PRInt32 aY0,
|
|||
DrawLine(aX0, aY0, aX1, aY1);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRenderingContextWin :: CreateDrawingSurface(HDC aDC, nsDrawingSurface &aSurface)
|
||||
{
|
||||
nsDrawingSurfaceWin *surf = new nsDrawingSurfaceWin();
|
||||
|
||||
if (nsnull != surf)
|
||||
{
|
||||
NS_ADDREF(surf);
|
||||
surf->Init(aDC, PR_FALSE);
|
||||
}
|
||||
|
||||
aSurface = (nsDrawingSurface)surf;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "nsVoidArray.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIDOMRenderingContext.h"
|
||||
#include "nsIRenderingContextWin.h"
|
||||
|
||||
class GraphicsState;
|
||||
class nsDrawingSurfaceWin;
|
||||
|
@ -44,6 +45,7 @@ class nsDrawingSurfaceWin;
|
|||
#endif
|
||||
|
||||
class nsRenderingContextWin : public nsIRenderingContext,
|
||||
nsIRenderingContextWin,
|
||||
nsIDOMRenderingContext,
|
||||
nsIScriptObjectOwner
|
||||
{
|
||||
|
@ -158,6 +160,9 @@ public:
|
|||
// nsIDOMRenderingContext
|
||||
NS_DECL_IDOMRENDERINGCONTEXT
|
||||
|
||||
// nsIRenderingContextWin
|
||||
NS_IMETHOD CreateDrawingSurface(HDC aDC, nsDrawingSurface &aSurface);
|
||||
|
||||
// locals
|
||||
#ifdef NGLAYOUT_DDRAW
|
||||
nsresult GetDDraw(IDirectDraw2 **aDDraw);
|
||||
|
|
Загрузка…
Ссылка в новой задаче