From 43c50123d12927f5c9800e21ee7a0d1777f958d9 Mon Sep 17 00:00:00 2001 From: "pavlov%netscape.com" Date: Fri, 30 Mar 2001 08:42:23 +0000 Subject: [PATCH] fix for animations on linux r=saari sr=waterson bug 73342 --- gfx/src/gtk/nsImageGTK.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/gfx/src/gtk/nsImageGTK.cpp b/gfx/src/gtk/nsImageGTK.cpp index 61850424c39..b7bd6861d02 100644 --- a/gfx/src/gtk/nsImageGTK.cpp +++ b/gfx/src/gtk/nsImageGTK.cpp @@ -1546,7 +1546,8 @@ nsImageGTK::SetDecodedRect(PRInt32 x1, PRInt32 y1, PRInt32 x2, PRInt32 y2 ) } #ifdef USE_IMG2 -NS_IMETHODIMP nsImageGTK::DrawToImage(nsIImage* aDstImage, nscoord aDX, nscoord aDY, +NS_IMETHODIMP nsImageGTK::DrawToImage(nsIImage* aDstImage, + nscoord aDX, nscoord aDY, nscoord aDWidth, nscoord aDHeight) { nsImageGTK *dest = NS_STATIC_CAST(nsImageGTK *, aDstImage); @@ -1554,20 +1555,30 @@ NS_IMETHODIMP nsImageGTK::DrawToImage(nsIImage* aDstImage, nscoord aDX, nscoord if (!dest) return NS_ERROR_FAILURE; - if (!dest->mImagePixmap) + if (!dest->mImagePixmap) { + dest->CreateOffscreenPixmap(dest->mWidth, dest->mHeight); + } + + if (!dest->mImagePixmap) { return NS_ERROR_FAILURE; + } if (!mImagePixmap) return NS_ERROR_FAILURE; - // XXX copy the mask too :-) - GdkGC *gc = gdk_gc_new(dest->mImagePixmap); + if (mAlphaDepth == 1) + CreateAlphaBitmap(mWidth, mHeight); + + if (mAlphaPixmap) { + SetupGCForAlpha(gc, 0, 0); + } + gdk_window_copy_area(dest->mImagePixmap, gc, aDX, aDY, mImagePixmap, - 0, 0, aDWidth, aDHeight); + 0, 0, mWidth, mHeight); gdk_gc_unref(gc);