зеркало из https://github.com/mozilla/pjs.git
Change to GetRenderingContext
This commit is contained in:
Родитель
ace2adf899
Коммит
45f4b12a38
|
@ -87,9 +87,10 @@ NS_IMETHODIMP nsDeviceContextMac :: GetScrollBarDimensions(float &aWidth, float
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
|
|
||||||
nsDrawingSurface nsDeviceContextMac :: GetDrawingSurface(nsIRenderingContext &aContext)
|
NS_IMETHODIMP nsDeviceContextMac :: GetDrawingSurface(nsIRenderingContext &aContext, nsDrawingSurface &aSurface)
|
||||||
{
|
{
|
||||||
return aContext.CreateDrawingSurface(nsnull);
|
aSurface = aContext.CreateDrawingSurface(nsnull);
|
||||||
|
return nsnull == aSurface ? NS_ERROR_OUT_OF_MEMORY : NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
|
|
|
@ -38,7 +38,7 @@ public:
|
||||||
NS_IMETHOD GetScrollBarDimensions(float &aWidth, float &aHeight) const;
|
NS_IMETHOD GetScrollBarDimensions(float &aWidth, float &aHeight) const;
|
||||||
|
|
||||||
void SetDrawingSurface(nsDrawingSurface aSurface) { mSurface = aSurface; }
|
void SetDrawingSurface(nsDrawingSurface aSurface) { mSurface = aSurface; }
|
||||||
virtual nsDrawingSurface GetDrawingSurface(nsIRenderingContext &aContext);
|
NS_IMETHOD GetDrawingSurface(nsIRenderingContext &aContext, nsDrawingSurface &aSurface);
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHOD CheckFontExistence(const nsString& aFontName);
|
NS_IMETHOD CheckFontExistence(const nsString& aFontName);
|
||||||
|
|
|
@ -99,9 +99,10 @@ NS_IMETHODIMP nsDeviceContextUnix :: GetScrollBarDimensions(float &aWidth, float
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsDrawingSurface nsDeviceContextUnix :: GetDrawingSurface(nsIRenderingContext &aContext)
|
NS_IMETHODIMP nsDeviceContextUnix :: GetDrawingSurface(nsIRenderingContext &aContext, nsDrawingSurface &aSurface)
|
||||||
{
|
{
|
||||||
return aContext.CreateDrawingSurface(nsnull);
|
aSurface = aContext.CreateDrawingSurface(nsnull);
|
||||||
|
return nsnull == aSurface ? NS_ERROR_OUT_OF_MEMORY : NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRUint32 nsDeviceContextUnix :: ConvertPixel(nscolor aColor)
|
PRUint32 nsDeviceContextUnix :: ConvertPixel(nscolor aColor)
|
||||||
|
@ -349,7 +350,7 @@ NS_IMETHODIMP nsDeviceContextUnix :: CheckFontExistence(const nsString& aFontNam
|
||||||
float t2d;
|
float t2d;
|
||||||
GetTwipsToDevUnits(t2d);
|
GetTwipsToDevUnits(t2d);
|
||||||
PRInt32 dpi = NSToIntRound(t2d * 1440);
|
PRInt32 dpi = NSToIntRound(t2d * 1440);
|
||||||
Display *dpy = XtDisplay((Widget)GetNativeWidget());
|
Display *dpy = XtDisplay((Widget)mWidget);
|
||||||
int numnames = 0;
|
int numnames = 0;
|
||||||
XFontStruct *fonts;
|
XFontStruct *fonts;
|
||||||
nsresult rv = NS_ERROR_FAILURE;
|
nsresult rv = NS_ERROR_FAILURE;
|
||||||
|
|
|
@ -69,7 +69,7 @@ public:
|
||||||
|
|
||||||
NS_IMETHOD GetScrollBarDimensions(float &aWidth, float &aHeight) const;
|
NS_IMETHOD GetScrollBarDimensions(float &aWidth, float &aHeight) const;
|
||||||
|
|
||||||
virtual nsDrawingSurface GetDrawingSurface(nsIRenderingContext &aContext);
|
NS_IMETHOD GetDrawingSurface(nsIRenderingContext &aContext, nsDrawingSurface &aSurface);
|
||||||
|
|
||||||
virtual PRUint32 ConvertPixel(nscolor aColor);
|
virtual PRUint32 ConvertPixel(nscolor aColor);
|
||||||
|
|
||||||
|
|
|
@ -47,9 +47,11 @@ nsFontMetricsUnix :: ~nsFontMetricsUnix()
|
||||||
if (nsnull != mXstring)
|
if (nsnull != mXstring)
|
||||||
PR_Free(mXstring);
|
PR_Free(mXstring);
|
||||||
|
|
||||||
if (nsnull != mFontHandle)
|
if (nsnull != mFontHandle) {
|
||||||
::XUnloadFont(XtDisplay((Widget)mContext->GetNativeWidget()), mFontHandle);
|
nsNativeWidget widget;
|
||||||
|
mContext->GetNativeWidget(widget);
|
||||||
|
::XUnloadFont(XtDisplay((Widget)widget, mFontHandle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS(nsFontMetricsUnix, kIFontMetricsIID)
|
NS_IMPL_ISUPPORTS(nsFontMetricsUnix, kIFontMetricsIID)
|
||||||
|
@ -72,7 +74,9 @@ nsresult nsFontMetricsUnix :: Init(const nsFont& aFont, nsIDeviceContext* aCX)
|
||||||
float t2d;
|
float t2d;
|
||||||
aCX->GetTwipsToDevUnits(t2d);
|
aCX->GetTwipsToDevUnits(t2d);
|
||||||
PRInt32 dpi = NSToIntRound(t2d * 1440);
|
PRInt32 dpi = NSToIntRound(t2d * 1440);
|
||||||
Display *dpy = XtDisplay((Widget)aCX->GetNativeWidget());
|
nsNativeWidget widget;
|
||||||
|
aCX->GetNativeWidget(widget);
|
||||||
|
Display *dpy = XtDisplay((Widget)widget);
|
||||||
|
|
||||||
if (nsnull == wildstring)
|
if (nsnull == wildstring)
|
||||||
return NS_ERROR_NOT_INITIALIZED;
|
return NS_ERROR_NOT_INITIALIZED;
|
||||||
|
@ -231,7 +235,9 @@ char * nsFontMetricsUnix::PickAppropriateSize(char **names, XFontStruct *fonts,
|
||||||
|
|
||||||
void nsFontMetricsUnix::RealizeFont()
|
void nsFontMetricsUnix::RealizeFont()
|
||||||
{
|
{
|
||||||
mFontInfo = ::XQueryFont(XtDisplay((Widget)mContext->GetNativeWidget()), mFontHandle);
|
nsNativeWidget widget;
|
||||||
|
mContext->GetNativeWidget(widget);
|
||||||
|
mFontInfo = ::XQueryFont(XtDisplay((Widget)widget, mFontHandle);
|
||||||
|
|
||||||
float f = mContext->GetDevUnitsToAppUnits();
|
float f = mContext->GetDevUnitsToAppUnits();
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ public:
|
||||||
//that is passed in is used to create the drawing surface if there isn't
|
//that is passed in is used to create the drawing surface if there isn't
|
||||||
//already one in the device context. the drawing surface is then cached
|
//already one in the device context. the drawing surface is then cached
|
||||||
//in the device context for re-use.
|
//in the device context for re-use.
|
||||||
virtual nsDrawingSurface GetDrawingSurface(nsIRenderingContext &aContext) = 0;
|
NS_IMETHOD GetDrawingSurface(nsIRenderingContext &aContext, nsDrawingSurface &aSurface) = 0;
|
||||||
|
|
||||||
//functions for handling gamma correction of output device
|
//functions for handling gamma correction of output device
|
||||||
NS_IMETHOD GetGamma(float &aGamms) = 0;
|
NS_IMETHOD GetGamma(float &aGamms) = 0;
|
||||||
|
|
|
@ -74,12 +74,14 @@ NS_IMETHODIMP nsDeviceContextWin :: GetScrollBarDimensions(float &aWidth, float
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsDrawingSurface nsDeviceContextWin :: GetDrawingSurface(nsIRenderingContext &aContext)
|
NS_IMETHODIMP nsDeviceContextWin :: GetDrawingSurface(nsIRenderingContext &aContext, nsDrawingSurface &aSurface)
|
||||||
{
|
{
|
||||||
if (NULL == mSurface)
|
if (NULL == mSurface) {
|
||||||
mSurface = aContext.CreateDrawingSurface(nsnull);
|
mSurface = aContext.CreateDrawingSurface(nsnull);
|
||||||
|
}
|
||||||
|
|
||||||
return mSurface;
|
aSurface = mSurface;
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CALLBACK fontcallback(ENUMLOGFONT FAR *lpelf, NEWTEXTMETRIC FAR *lpntm,
|
int CALLBACK fontcallback(ENUMLOGFONT FAR *lpelf, NEWTEXTMETRIC FAR *lpntm,
|
||||||
|
@ -94,8 +96,7 @@ int CALLBACK fontcallback(ENUMLOGFONT FAR *lpelf, NEWTEXTMETRIC FAR *lpntm,
|
||||||
NS_IMETHODIMP nsDeviceContextWin :: CheckFontExistence(const nsString& aFontName)
|
NS_IMETHODIMP nsDeviceContextWin :: CheckFontExistence(const nsString& aFontName)
|
||||||
{
|
{
|
||||||
nsNativeWidget widget;
|
nsNativeWidget widget;
|
||||||
GetNativeWidget(widget);
|
HWND hwnd = (HWND)mWidget;
|
||||||
HWND hwnd = (HWND)widget;
|
|
||||||
HDC hdc = ::GetDC(hwnd);
|
HDC hdc = ::GetDC(hwnd);
|
||||||
PRBool isthere = PR_FALSE;
|
PRBool isthere = PR_FALSE;
|
||||||
|
|
||||||
|
|
|
@ -27,23 +27,23 @@ class nsDeviceContextWin : public DeviceContextImpl
|
||||||
public:
|
public:
|
||||||
nsDeviceContextWin();
|
nsDeviceContextWin();
|
||||||
|
|
||||||
NS_IMETHOD Init(nsNativeWidget aWidget);
|
NS_IMETHOD Init(nsNativeWidget aWidget);
|
||||||
|
|
||||||
NS_IMETHOD GetScrollBarDimensions(float &aWidth, float &aHeight) const;
|
NS_IMETHOD GetScrollBarDimensions(float &aWidth, float &aHeight) const;
|
||||||
|
|
||||||
//get a low level drawing surface for rendering. the rendering context
|
//get a low level drawing surface for rendering. the rendering context
|
||||||
//that is passed in is used to create the drawing surface if there isn't
|
//that is passed in is used to create the drawing surface if there isn't
|
||||||
//already one in the device context. the drawing surface is then cached
|
//already one in the device context. the drawing surface is then cached
|
||||||
//in the device context for re-use.
|
//in the device context for re-use.
|
||||||
virtual nsDrawingSurface GetDrawingSurface(nsIRenderingContext &aContext);
|
NS_IMETHOD GetDrawingSurface(nsIRenderingContext &aContext, nsDrawingSurface &aSurface);
|
||||||
|
|
||||||
NS_IMETHOD CheckFontExistence(const nsString& aFontName);
|
NS_IMETHOD CheckFontExistence(const nsString& aFontName);
|
||||||
|
|
||||||
NS_IMETHOD GetDepth(PRUint32& aDepth);
|
NS_IMETHOD GetDepth(PRUint32& aDepth);
|
||||||
|
|
||||||
NS_IMETHOD GetILColorSpace(IL_ColorSpace*& aColorSpace);
|
NS_IMETHOD GetILColorSpace(IL_ColorSpace*& aColorSpace);
|
||||||
|
|
||||||
NS_IMETHOD GetPaletteInfo(nsPaletteInfo&);
|
NS_IMETHOD GetPaletteInfo(nsPaletteInfo&);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~nsDeviceContextWin();
|
virtual ~nsDeviceContextWin();
|
||||||
|
|
|
@ -334,7 +334,9 @@ PRBool nsImageWin :: Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurfa
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nsIDeviceContext *dx = aContext.GetDeviceContext();
|
nsIDeviceContext *dx = aContext.GetDeviceContext();
|
||||||
nsDrawingSurfaceWin *srcds = (nsDrawingSurfaceWin *)dx->GetDrawingSurface(aContext);
|
nsDrawingSurface ds;
|
||||||
|
dx->GetDrawingSurface(aContext, ds);
|
||||||
|
nsDrawingSurfaceWin *srcds = (nsDrawingSurfaceWin *)ds;
|
||||||
HDC srcdc;
|
HDC srcdc;
|
||||||
|
|
||||||
if (nsnull != srcds)
|
if (nsnull != srcds)
|
||||||
|
@ -418,7 +420,9 @@ PRBool nsImageWin :: Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurfa
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nsIDeviceContext *dx = aContext.GetDeviceContext();
|
nsIDeviceContext *dx = aContext.GetDeviceContext();
|
||||||
nsDrawingSurfaceWin *srcds = (nsDrawingSurfaceWin *)dx->GetDrawingSurface(aContext);
|
nsDrawingSurface ds;
|
||||||
|
dx->GetDrawingSurface(aContext, ds);
|
||||||
|
nsDrawingSurfaceWin *srcds = (nsDrawingSurfaceWin *)ds;
|
||||||
HDC srcdc;
|
HDC srcdc;
|
||||||
|
|
||||||
if (nsnull != srcds)
|
if (nsnull != srcds)
|
||||||
|
|
|
@ -87,9 +87,10 @@ NS_IMETHODIMP nsDeviceContextMac :: GetScrollBarDimensions(float &aWidth, float
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
|
|
||||||
nsDrawingSurface nsDeviceContextMac :: GetDrawingSurface(nsIRenderingContext &aContext)
|
NS_IMETHODIMP nsDeviceContextMac :: GetDrawingSurface(nsIRenderingContext &aContext, nsDrawingSurface &aSurface)
|
||||||
{
|
{
|
||||||
return aContext.CreateDrawingSurface(nsnull);
|
aSurface = aContext.CreateDrawingSurface(nsnull);
|
||||||
|
return nsnull == aSurface ? NS_ERROR_OUT_OF_MEMORY : NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
|
|
|
@ -38,7 +38,7 @@ public:
|
||||||
NS_IMETHOD GetScrollBarDimensions(float &aWidth, float &aHeight) const;
|
NS_IMETHOD GetScrollBarDimensions(float &aWidth, float &aHeight) const;
|
||||||
|
|
||||||
void SetDrawingSurface(nsDrawingSurface aSurface) { mSurface = aSurface; }
|
void SetDrawingSurface(nsDrawingSurface aSurface) { mSurface = aSurface; }
|
||||||
virtual nsDrawingSurface GetDrawingSurface(nsIRenderingContext &aContext);
|
NS_IMETHOD GetDrawingSurface(nsIRenderingContext &aContext, nsDrawingSurface &aSurface);
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHOD CheckFontExistence(const nsString& aFontName);
|
NS_IMETHOD CheckFontExistence(const nsString& aFontName);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче