From 3cdde98a2868efe9747e8e0448ec175d8d602fe5 Mon Sep 17 00:00:00 2001 From: "dcone%netscape.com" Date: Tue, 27 Aug 2002 18:23:47 +0000 Subject: [PATCH] 148598 r=rods sr=kin, fix minor update issues with backgrounds git-svn-id: svn://10.0.0.236/trunk@128266 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/gfx/src/windows/nsImageWin.cpp | 40 +++++++++----------------- 1 file changed, 13 insertions(+), 27 deletions(-) diff --git a/mozilla/gfx/src/windows/nsImageWin.cpp b/mozilla/gfx/src/windows/nsImageWin.cpp index c589ce2c595..cc2d4af7de4 100644 --- a/mozilla/gfx/src/windows/nsImageWin.cpp +++ b/mozilla/gfx/src/windows/nsImageWin.cpp @@ -84,13 +84,10 @@ nsImageWin :: nsImageWin() mIsLocked = PR_FALSE; mDIBTemp = PR_FALSE; - - //CleanUp(PR_TRUE); CleanUpDIBSection(); CleanUpDDB(); CleanUpDIB(); - } @@ -100,7 +97,6 @@ nsImageWin :: nsImageWin() */ nsImageWin :: ~nsImageWin() { - //CleanUp(PR_TRUE); CleanUpDIBSection(); CleanUpDDB(); CleanUpDIB(); @@ -244,7 +240,6 @@ nsresult nsImageWin :: Init(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth,nsMa } } - return NS_OK; } @@ -258,10 +253,8 @@ nsImageWin :: ImageUpdated(nsIDeviceContext *aContext, PRUint8 aFlags, nsRect *a { } - //------------------------------------------------------------ - struct MONOBITMAPINFO { BITMAPINFOHEADER bmiHeader; RGBQUAD bmiColors[2]; @@ -565,10 +558,8 @@ nsImageWin :: Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface, if (nsnull != srcDS){ srcDS->GetDC(&srcDC); - rop = SRCCOPY; - if (nsnull != mAlphaBits){ if (1==mAlphaDepth){ MONOBITMAPINFO bmi(mAlphaWidth, mAlphaHeight); @@ -727,7 +718,7 @@ NS_IMETHODIMP nsImageWin :: Draw(nsIRenderingContext &aContext, nsDrawingSurface /** --------------------------------------------------- * See documentation in nsIRenderingContext.h - * @update 3/16/00 dwc + * @update 8/26/02 dwc */ NS_IMETHODIMP nsImageWin::DrawTile(nsIRenderingContext &aContext, nsDrawingSurface aSurface, @@ -847,6 +838,7 @@ NS_IMETHODIMP nsImageWin::DrawTile(nsIRenderingContext &aContext, for (int y = 0,byw=aSYOffset; y < height; y++,byw++) { + if (byw >= ScaledTileHeight) { byw = 0; } @@ -855,7 +847,11 @@ NS_IMETHODIMP nsImageWin::DrawTile(nsIRenderingContext &aContext, imageRow = adjImage - (byw * mRowBytes); alphaRow = adjAlpha - (byw * mARowBytes); - for (int x=0,bxw=0;x=ScaledTileWidth) { bxw = 0; @@ -882,17 +878,15 @@ NS_IMETHODIMP nsImageWin::DrawTile(nsIRenderingContext &aContext, } } - numTiles = (aDestRect.width*aDestRect.height)/(ScaledTileWidth*ScaledTileHeight); - // if alpha is less than 8,not printing, and not 8 bit palette image then we can do // a progressive tile and the tile is at least 8 times smaller than the area to update // if the number of tiles are less than 32 the progressive doubling can slow down // because of the creation of the offscreens, DC's etc. if ( (mAlphaDepth < 8) && (canRaster!=DT_RASPRINTER) && (256!=mNumPaletteColors) && (numTiles > 32) ) { - result = ProgressiveDoubleBlit(aSurface,aDestRect.width, aDestRect.height, + result = ProgressiveDoubleBlit(aSurface,x1-x0, y1-y0, ScaledTileWidth,ScaledTileHeight, x0,y0,x1,y1); if (result ) { return(NS_OK); @@ -914,7 +908,7 @@ NS_IMETHODIMP nsImageWin::DrawTile(nsIRenderingContext &aContext, /** --------------------------------------------------- * See documentation in nsImageWin.h - * @update 4/16/02 dwc + * @update 8/26/02 dwc */ PRBool nsImageWin::ProgressiveDoubleBlit(nsDrawingSurface aSurface, @@ -924,7 +918,7 @@ nsImageWin::ProgressiveDoubleBlit(nsDrawingSurface aSurface, PRInt32 aX1,PRInt32 aY1) { PRInt32 x,y,width,height; - nsRect destRect,srcRect; + nsRect srcRect; HDC theHDC,offDC,maskDC; HBITMAP maskBits,tileBits,oldBits,oldMaskBits; @@ -999,31 +993,23 @@ nsImageWin::ProgressiveDoubleBlit(nsDrawingSurface aSurface, ::BitBlt(offDC,0,0,aScaledTileWidth,aScaledTileHeight,theHDC,0,0,SRCCOPY); ::SelectObject(theHDC, oldBits); } - - + srcRect.SetRect(0,0,aScaledTileWidth,aScaledTileHeight); BuildTile(offDC,srcRect,aDestBufferWidth/2,aDestBufferHeight/2,SRCCOPY); - // now duplicate our tile into the background - destRect = srcRect; - width = destRect.width; - height = destRect.height; - + width = srcRect.width; + height = srcRect.height; if (1!=mAlphaDepth) { for (y=aY0;y