I spoke to Sven about this patch. getData was returning an incorrect
array of pixels. It seems to work the best when getRGB is always used.

2006-06-19  Lillian Angel  <[EMAIL PROTECTED]>

        * gnu/java/awt/peer/gtk/CairoGraphics2D.java
        (drawImage): Should always use getRGB to get the pixels.
        getData returns an incorrect array of pixels.

Index: gnu/java/awt/peer/gtk/CairoGraphics2D.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java,v
retrieving revision 1.25
diff -u -r1.25 CairoGraphics2D.java
--- gnu/java/awt/peer/gtk/CairoGraphics2D.java	16 Jun 2006 10:27:29 -0000	1.25
+++ gnu/java/awt/peer/gtk/CairoGraphics2D.java	19 Jun 2006 20:26:25 -0000
@@ -1247,24 +1249,7 @@
 	setPaint( oldPaint );
       }
 
-    int[] pixels;
-
-    // Shortcut for easy color models.
-    if( b.getColorModel().equals(rgb32) )
-      {
-	pixels = ((DataBufferInt)db).getData();
-	for(int i = 0; i < pixels.length; i++)
-	  pixels[i] |= 0xFF000000;
-      }
-    else if( b.getColorModel().equals(argb32) )
-      {
-	pixels = ((DataBufferInt)db).getData();
-      }
-    else
-      {
-	pixels = b.getRGB(0, 0, width, height,
-			  null, 0, width);
-      }
+    int[] pixels = b.getRGB(0, 0, width, height, null, 0, width);
 
     drawPixels(nativePointer, pixels, width, height, width, i2u, alpha);
 

Reply via email to