From b9645ce2cefc0ee6747376295c620bfb751efe08 Mon Sep 17 00:00:00 2001 From: "dcone%netscape.com" Date: Tue, 19 Feb 2002 03:10:42 +0000 Subject: [PATCH] b=122996 r=kmclusky sr=attinasi. Use patblt for windows background tiling git-svn-id: svn://10.0.0.236/trunk@114879 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/gfx/src/windows/nsImageWin.cpp | 22 ++++++++++++++++++---- mozilla/gfx/src/windows/nsImageWin.h | 4 +--- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/mozilla/gfx/src/windows/nsImageWin.cpp b/mozilla/gfx/src/windows/nsImageWin.cpp index 47277a34630..3c59f561a40 100644 --- a/mozilla/gfx/src/windows/nsImageWin.cpp +++ b/mozilla/gfx/src/windows/nsImageWin.cpp @@ -45,6 +45,8 @@ static nsresult BuildDIB(LPBITMAPINFOHEADER *aBHead,PRInt32 aWidth,PRInt32 aHeight,PRInt32 aDepth,PRInt8 *aNumBitPix); + + static PRBool IsWindowsNT() { @@ -823,9 +825,15 @@ NS_IMETHODIMP nsImageWin::DrawTile(nsIRenderingContext &aContext, } } return(PR_TRUE); - } else if(mAlphaDepth == 8 ){ - } + } + // now try to pattern blit.. if that fails.. we use our own algorithm to get + // things fast + if ( PR_TRUE == PatBltTile(aContext,aSurface,aX0,aY0,aX1,aY1) ){ + return(PR_TRUE); + } + + // create a larger tile from the smaller one ((nsDrawingSurfaceWin *)aSurface)->GetDC(&TheHDC); if (NULL == TheHDC){ @@ -948,8 +956,7 @@ NS_IMETHODIMP nsImageWin::DrawTile(nsIRenderingContext &aContext, */ PRBool nsImageWin :: PatBltTile(nsIRenderingContext &aContext, nsDrawingSurface aSurface, - nscoord aX0,nscoord aY0,nscoord aX1,nscoord aY1, - nscoord aWidth, nscoord aHeight) + nscoord aX0,nscoord aY0,nscoord aX1,nscoord aY1) { HDC TheHDC; HBRUSH hBrush,oldBrush; @@ -958,6 +965,13 @@ nsImageWin :: PatBltTile(nsIRenderingContext &aContext, nsDrawingSurface aSurfac HBITMAP theBits; POINT originalPoint; + + if (PR_TRUE != gIsWinNT) { + if((mBHead->biWidth<8)&&(mBHead->biHeight<8)){ + return PR_FALSE; // this does not seem to work on win 98 + } + } + if (PR_FALSE==mCanOptimize) { return (PR_FALSE); } diff --git a/mozilla/gfx/src/windows/nsImageWin.h b/mozilla/gfx/src/windows/nsImageWin.h index 54830d9136a..234f1229a67 100644 --- a/mozilla/gfx/src/windows/nsImageWin.h +++ b/mozilla/gfx/src/windows/nsImageWin.h @@ -131,11 +131,9 @@ public: * @param aSurface the surface to blit to * @param aX The destination horizontal location * @param aY The destination vertical location - * @param aWidth The destination width of the pixelmap - * @param aHeight The destination height of the pixelmap * @return if TRUE, no errors */ - PRBool PatBltTile(nsIRenderingContext &aContext, nsDrawingSurface aSurface,nscoord aX0,nscoord aY0,nscoord aX1,nscoord aY1,nscoord aWidth,nscoord aHeight); + PRBool PatBltTile(nsIRenderingContext &aContext, nsDrawingSurface aSurface,nscoord aX0,nscoord aY0,nscoord aX1,nscoord aY1); /**