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.

This commit is contained in:
dcone%netscape.com 2000-03-02 21:00:59 +00:00
Родитель 1c54ce1dd3
Коммит 6d1ec85910
1 изменённых файлов: 10 добавлений и 2 удалений

Просмотреть файл

@ -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);