From 20469d5ac9e54fcffe627161f1ba6c2193b98a9f Mon Sep 17 00:00:00 2001 From: "cbiesinger%web.de" Date: Wed, 29 Sep 2004 13:51:36 +0000 Subject: [PATCH] Bug 250786 [Xlib] scaled images render as garbage r=roland.mainz --- gfx/src/xlib/nsImageXlib.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gfx/src/xlib/nsImageXlib.cpp b/gfx/src/xlib/nsImageXlib.cpp index 42ad375fae9..5a5b3386f70 100644 --- a/gfx/src/xlib/nsImageXlib.cpp +++ b/gfx/src/xlib/nsImageXlib.cpp @@ -463,15 +463,15 @@ nsImageXlib::DrawScaled(nsIRenderingContext &aContext, Pixmap pixmap = 0; if (mAlphaDepth==1) { - PRUint32 scaledRowBytes = (aDWidth+7)>>3; // round to next byte - PRUint8 *scaledAlpha = (PRUint8 *)nsMemory::Alloc(aDHeight*scaledRowBytes); + PRUint32 scaledRowBytes = (origDWidth+7)>>3; // round to next byte + PRUint8 *scaledAlpha = (PRUint8 *)nsMemory::Alloc(origDHeight*scaledRowBytes); // code below attempts to draw the image without the mask if mask // creation fails for some reason. thus no easy-out "return" if (scaledAlpha) { - memset(scaledAlpha, 0, aDHeight*scaledRowBytes); + memset(scaledAlpha, 0, origDHeight*scaledRowBytes); RectStretch(mWidth, mHeight, origDWidth, origDHeight, - aDX, aDY, aDX + aDWidth - 1, aDY + aDHeight - 1, + 0, 0, aDWidth - 1, aDHeight - 1, mAlphaBits, mAlphaRowBytes, scaledAlpha, scaledRowBytes, 1); pixmap = XCreatePixmap(mDisplay, DefaultRootWindow(mDisplay), @@ -533,7 +533,7 @@ nsImageXlib::DrawScaled(nsIRenderingContext &aContext, PRUint8 *scaledRGB = (PRUint8 *)nsMemory::Alloc(3*aDWidth*aDHeight); if (scaledRGB && gc) { RectStretch(mWidth, mHeight, origDWidth, origDHeight, - aDX, aDY, aDX + aDWidth - 1, aDY + aDHeight - 1, + 0, 0, aDWidth - 1, aDHeight - 1, mImageBits, mRowBytes, scaledRGB, 3*aDWidth, 24); Drawable drawable; drawing->GetDrawable(drawable);