From 4a79834ac3b1c9a8adb035cd884b1005a44a0b81 Mon Sep 17 00:00:00 2001 From: "kmcclusk%netscape.com" Date: Mon, 30 Aug 1999 22:35:10 +0000 Subject: [PATCH] bug #8590 Modified nsImageWin::Init to call memset after allocating buffer for bits. --- gfx/src/windows/nsImageWin.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gfx/src/windows/nsImageWin.cpp b/gfx/src/windows/nsImageWin.cpp index 06b5ca7b5f96..a0bfc6aac6c2 100644 --- a/gfx/src/windows/nsImageWin.cpp +++ b/gfx/src/windows/nsImageWin.cpp @@ -124,12 +124,12 @@ nsresult nsImageWin :: Init(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth,nsMa // Allocate the image bits mImageBits = new unsigned char[mSizeImage]; - // XXX We don't need to waste time initializing the bits. The reason Purify - // complains about UMR is because when asked to Draw() we ask GDI to render - // bits that aren't valid yet. We need to fix that... -#if 0 - memset(mImageBits, 128, mSizeImage); -#endif + + // Need to clear the entire buffer so an incrementally loaded image + // will not have garbage rendered for the unloaded bits. + if (mImageBits != nsnull) { + memset(mImageBits, 128, mSizeImage); + } if (256 == mNumPaletteColors) { // Initialize the array of indexes into the logical palette