Hi,
the attached patch removes an unneeded method from ColorModel (which did not
work anyway). The reason for the removal is that cloning of ColorModel instances
makes no sense as these instances are immutable.

Consequently I changed to location where the method is called.

Another small fix prevents a call the setRenderingHints() when the argument (a
Map) is null.

With these patches I can start and play jrisk.sf.net :)

ChangeLog:

2006-07-26  Robert Schuster <[EMAIL PROTECTED]>

        * java/awt/image/ColorConvertOp.java: Fixed copyright header.
        (copyimage): Do not call setRenderingHints() when the respective map
        does not exist.
        (filter): Removed code to clone the ColorModel instance.
        * java/awt/image/ColorModel.java:
        (cloneColorModel): Removed.


cya
Robert
Index: java/awt/image/ColorConvertOp.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/image/ColorConvertOp.java,v
retrieving revision 1.4
diff -u -r1.4 ColorConvertOp.java
--- java/awt/image/ColorConvertOp.java	2 Jul 2005 20:32:30 -0000	1.4
+++ java/awt/image/ColorConvertOp.java	26 Jul 2006 18:12:47 -0000
@@ -1,5 +1,5 @@
-/* ColorModel.java --
-   Copyright (C) 2004  Free Software Foundation
+/* ColorConvertOp.java --
+   Copyright (C) 2004, 2006  Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -177,8 +177,7 @@
     ColorModel scm = src.getColorModel();
     for (int i = 0; i < spaces.length; i++)
     {
-      ColorModel cm = scm.cloneColorModel(spaces[i]);
-      BufferedImage tmp = createCompatibleDestImage(src, cm);
+      BufferedImage tmp = createCompatibleDestImage(src, scm);
       copyimage(src, tmp);
       src = tmp;
     }
@@ -189,6 +188,7 @@
     
     // Apply final conversion
     copyimage(src, dst);
+    
     return dst;
   }
 
@@ -287,7 +287,12 @@
   private void copyimage(BufferedImage src, BufferedImage dst)
   {
     Graphics2D gg = dst.createGraphics();
-    gg.setRenderingHints(hints);
+    
+    // If no hints are set there is no need to call
+    // setRenderingHints on the Graphics2D object.
+    if (hints != null)
+      gg.setRenderingHints(hints);
+    
     gg.drawImage(src, 0, 0, null);
     gg.dispose();
   }
Index: java/awt/image/ColorModel.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/image/ColorModel.java,v
retrieving revision 1.29
diff -u -r1.29 ColorModel.java
--- java/awt/image/ColorModel.java	10 May 2006 10:02:28 -0000	1.29
+++ java/awt/image/ColorModel.java	26 Jul 2006 18:12:47 -0000
@@ -1,5 +1,5 @@
 /* ColorModel.java --
-   Copyright (C) 1999, 2000, 2002, 2003, 2004  Free Software Foundation
+   Copyright (C) 1999, 2000, 2002, 2003, 2004, 2006  Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -43,7 +43,6 @@
 import java.awt.Point;
 import java.awt.Transparency;
 import java.awt.color.ColorSpace;
-import java.lang.reflect.Constructor;
 import java.util.Arrays;
 
 /**
@@ -163,32 +162,6 @@
     this.transparency = transparency;
     this.transferType = transferType;
   }
-
-  // This is a hook for ColorConvertOp to create a colormodel with
-  // a new colorspace
-  ColorModel cloneColorModel(ColorSpace cspace)
-  {
-    Class cls = this.getClass();
-    ColorModel cm;
-    try {
-      // This constructor will exist.
-      Constructor ctor =
-        cls.getConstructor(new Class[]{int.class, int[].class,
-				       ColorSpace.class, boolean.class,
-				       boolean.class, int.class, int.class});
-      cm = (ColorModel)ctor.
-        newInstance(new Object[]{new Integer(pixel_bits),
-				 bits, cspace, Boolean.valueOf(hasAlpha),
-				 Boolean.valueOf(isAlphaPremultiplied),
-				 new Integer(transparency),
-				 new Integer(transferType)});
-    }
-    catch (Exception e)
-    {
-      throw new IllegalArgumentException();
-    }
-    return cm;
-  }
   
   public void finalize()
   {

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to