This provides a default impl for getDestinationRaster() in
AbstractGraphics2D. I hope that this fixes the build for the X peers.

2006-07-01  Roman Kennke  <[EMAIL PROTECTED]>

        * gnu/java/awt/java2d/AbstractGraphics2D.java
        (transform): Make field protected.
        (getDestinationRaster): Provide default implementation for
        previously abstract method.

/Roman

-- 
“Improvement makes straight roads, but the crooked roads, without
Improvement, are roads of Genius.” - William Blake
Index: gnu/java/awt/java2d/AbstractGraphics2D.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java,v
retrieving revision 1.10
diff -u -1 -2 -r1.10 AbstractGraphics2D.java
--- gnu/java/awt/java2d/AbstractGraphics2D.java	21 Jun 2006 08:06:29 -0000	1.10
+++ gnu/java/awt/java2d/AbstractGraphics2D.java	30 Jun 2006 23:16:47 -0000
@@ -64,24 +64,25 @@
 import java.awt.geom.Arc2D;
 import java.awt.geom.Area;
 import java.awt.geom.Ellipse2D;
 import java.awt.geom.GeneralPath;
 import java.awt.geom.Line2D;
 import java.awt.geom.NoninvertibleTransformException;
 import java.awt.geom.PathIterator;
 import java.awt.geom.Rectangle2D;
 import java.awt.geom.RoundRectangle2D;
 import java.awt.image.BufferedImage;
 import java.awt.image.BufferedImageOp;
 import java.awt.image.ColorModel;
+import java.awt.image.DataBuffer;
 import java.awt.image.ImageObserver;
 import java.awt.image.Raster;
 import java.awt.image.RenderedImage;
 import java.awt.image.WritableRaster;
 import java.awt.image.renderable.RenderableImage;
 import java.text.AttributedCharacterIterator;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 
 /**
@@ -136,25 +137,25 @@
 {
 
   /**
    * Accuracy of the sampling in the anti-aliasing shape filler.
    * Lower values give more speed, while higher values give more quality.
    * It is advisable to choose powers of two.
    */
   private static final int AA_SAMPLING = 8;
 
   /**
    * The transformation for this Graphics2D instance
    */
-  private AffineTransform transform;
+  protected AffineTransform transform;
 
   /**
    * The foreground.
    */
   private Paint paint;
 
   /**
    * The background.
    */
   private Color background;
 
   /**
@@ -2055,25 +2056,52 @@
     destinationRaster = getDestinationRaster();
     clip = getDeviceBounds();
   }
 
   /**
    * Returns a WritableRaster that is used by this class to perform the
    * rendering in. It is not necessary that the target surface immediately
    * reflects changes in the raster. Updates to the raster are notified via
    * [EMAIL PROTECTED] #updateRaster}.
    *
    * @return the destination raster
    */
-  protected abstract WritableRaster getDestinationRaster();
+  protected WritableRaster getDestinationRaster()
+  {
+    // TODO: Ideally we would fetch the xdrawable's surface pixels for
+    // initialization of the raster.
+    Rectangle db = getDeviceBounds();
+    if (destinationRaster == null)
+      {
+        int[] bandMasks = new int[]{ 0xFF0000, 0xFF00, 0xFF };
+        destinationRaster = Raster.createPackedRaster(DataBuffer.TYPE_INT,
+                                                      db.width, db.height,
+                                                      bandMasks, null);
+        // Initialize raster with white.
+        int x0 = destinationRaster.getMinX();
+        int x1 = destinationRaster.getWidth() + x0;
+        int y0 = destinationRaster.getMinY();
+        int y1 = destinationRaster.getHeight() + y0;
+        int numBands = destinationRaster.getNumBands();
+        for (int y = y0; y < y1; y++)
+          {
+            for (int x = x0; x < x1; x++)
+              {
+                for (int b = 0; b < numBands; b++)
+                  destinationRaster.setSample(x, y, b, 255);
+              }
+          }
+      }
+    return destinationRaster;
+  }
 
   /**
    * Notifies the backend that the raster has changed in the specified
    * rectangular area. The raster that is provided in this method is always
    * the same as the one returned in [EMAIL PROTECTED] #getDestinationRaster}.
    * Backends that reflect changes to this raster directly don't need to do
    * anything here.
    *
    * @param raster the updated raster, identical to the raster returned
    *        by [EMAIL PROTECTED] #getDestinationRaster()}
    * @param x the upper left corner of the updated region, X coordinate
    * @param y the upper lef corner of the updated region, Y coordinate

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

Reply via email to