diff --git a/mozilla/gfx/src/windows/nsDeviceContextWin.cpp b/mozilla/gfx/src/windows/nsDeviceContextWin.cpp index 4740040236f..0d6c105b80c 100644 --- a/mozilla/gfx/src/windows/nsDeviceContextWin.cpp +++ b/mozilla/gfx/src/windows/nsDeviceContextWin.cpp @@ -568,6 +568,16 @@ NS_IMETHODIMP nsDeviceContextWin :: GetSystemFont(nsSystemFontID anID, nsFont *a return status; } +NS_IMETHODIMP nsDeviceContextWin :: GetDrawingSurface(nsIRenderingContext &aContext, nsDrawingSurface &aSurface) +{ + if (NULL == mSurface) { + aContext.CreateDrawingSurface(nsnull, 0, mSurface); + } + + aSurface = mSurface; + return NS_OK; +} + int CALLBACK fontcallback(ENUMLOGFONT FAR *lpelf, NEWTEXTMETRIC FAR *lpntm, int FontType, LPARAM lParam) { diff --git a/mozilla/gfx/src/windows/nsDeviceContextWin.h b/mozilla/gfx/src/windows/nsDeviceContextWin.h index 512480bd278..db4c33c9d6f 100644 --- a/mozilla/gfx/src/windows/nsDeviceContextWin.h +++ b/mozilla/gfx/src/windows/nsDeviceContextWin.h @@ -63,6 +63,12 @@ public: NS_IMETHOD GetScrollBarDimensions(float &aWidth, float &aHeight) const; NS_IMETHOD GetSystemFont(nsSystemFontID anID, nsFont *aFont) const; + //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 + //already one in the device context. the drawing surface is then cached + //in the device context for re-use. + NS_IMETHOD GetDrawingSurface(nsIRenderingContext &aContext, nsDrawingSurface &aSurface); + NS_IMETHOD CheckFontExistence(const nsString& aFontName); NS_IMETHOD GetDepth(PRUint32& aDepth); diff --git a/mozilla/gfx/src/windows/nsImageWin.cpp b/mozilla/gfx/src/windows/nsImageWin.cpp index 274c53f027a..3bc6ae8126c 100644 --- a/mozilla/gfx/src/windows/nsImageWin.cpp +++ b/mozilla/gfx/src/windows/nsImageWin.cpp @@ -40,7 +40,7 @@ #include "nsImageWin.h" #include "nsRenderingContextWin.h" - +#include "nsDeviceContextWin.h" static nsresult BuildDIB(LPBITMAPINFOHEADER *aBHead,PRInt32 aWidth,PRInt32 aHeight,PRInt32 aDepth,PRInt8 *aNumBitPix); @@ -554,7 +554,8 @@ nsImageWin :: Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface, nsIDeviceContext *dx; aContext.GetDeviceContext(dx); nsDrawingSurface ds; - dx->GetDrawingSurface(aContext, ds); + + NS_STATIC_CAST(nsDeviceContextWin*, dx)->GetDrawingSurface(aContext, ds); nsDrawingSurfaceWin *srcDS = (nsDrawingSurfaceWin *)ds; HDC srcDC;