This fixes XGraphics2D:
- The rgb variable must be updated to receive the actual computed RGB
value, otherwise translucent images are not drawn correctly.
- Translucent images must not be cached, because we never know how their
background changes.

2008-02-18  Roman Kennke  <[EMAIL PROTECTED]>

        * gnu/java/awt/peer/x/XGraphics2D.java
        (rawDrawImage): Update the rgb variable correctly. Don't
        cache translucent images.

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: gnu/java/awt/peer/x/XGraphics2D.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/x/XGraphics2D.java,v
retrieving revision 1.7
diff -u -1 -0 -r1.7 XGraphics2D.java
--- gnu/java/awt/peer/x/XGraphics2D.java	20 Sep 2007 14:01:08 -0000	1.7
+++ gnu/java/awt/peer/x/XGraphics2D.java	18 Feb 2008 10:59:56 -0000
@@ -406,28 +406,30 @@
                                      + (255 - alpha) * zpixmap.get_red(xx, yy);
                             red = red / 255;
                             int green = 0xff & (rgb >> 8);
                             green = green * alpha
                                    + (255 - alpha) * zpixmap.get_green(xx, yy);
                             green = green / 255;
                             int blue = 0xff & rgb;
                             blue = blue * alpha
                                     + (255 - alpha) * zpixmap.get_blue(xx, yy);
                             blue = blue / 255;
+                            rgb = red << 16 | green << 8 | blue;
                           }
                         // else keep rgb value from source image.
 
                         zpixmap.set(xx, yy, rgb);
                       }
                   }
                 xdrawable.put_image(xgc, zpixmap, x, y);
-                imageCache.put(image, zpixmap);
+                // We can't cache prerendered translucent images, because
+                // we never know how the background changes.
               }
             ret = true;
           }
       }
     else
       {
         ret = super.rawDrawImage(image, x, y, obs);
       }
     return ret;
   }

Reply via email to