From 6d1ec859100e55dc1ef4617185347f32975c5d9a Mon Sep 17 00:00:00 2001 From: "dcone%netscape.com" Date: Thu, 2 Mar 2000 21:00:59 +0000 Subject: [PATCH] draw only the part of the image that has been read in. This limits the size of the blitting.. which can be quite a few blits depending on the image and the incremental loading and drawing. r=kmclusk a=rickg. --- gfx/src/mac/nsImageMac.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gfx/src/mac/nsImageMac.cpp b/gfx/src/mac/nsImageMac.cpp index 486db999a3b..b5272962ade 100644 --- a/gfx/src/mac/nsImageMac.cpp +++ b/gfx/src/mac/nsImageMac.cpp @@ -207,7 +207,7 @@ nsImageMac::Init(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth, nsMaskRequirem return NS_ERROR_OUT_OF_MEMORY; } - ClearGWorld(mImageGWorld); + //ClearGWorld(mImageGWorld); // calculate the pixel data size PixMapHandle thePixMap = ::GetGWorldPixMap(mImageGWorld); @@ -252,7 +252,7 @@ nsImageMac::Init(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth, nsMaskRequirem if (mAlphaGWorld) { - ClearGWorld(mAlphaGWorld); + //ClearGWorld(mAlphaGWorld); // calculate the pixel data size PixMapHandle maskPixMap = GetGWorldPixMap(mAlphaGWorld); @@ -290,6 +290,14 @@ NS_IMETHODIMP nsImageMac::Draw(nsIRenderingContext &aContext, nsDrawingSurface a if (!mImageGWorld) return NS_ERROR_FAILURE; + // currently the top is 0, this may change and this code will have to reflect that + if (( mDecodedY2 < aSHeight) ) { + // adjust the source and dest height to reflect this + aDHeight = float(mDecodedY2/float(aSHeight)) * aDHeight; + aSHeight = mDecodedY2; + } + + ::SetRect(&srcRect, aSX, aSY, aSX + aSWidth, aSY + aSHeight); maskRect = srcRect; ::SetRect(&dstRect, aDX, aDY, aDX + aDWidth, aDY + aDHeight);