changeset in /hg/icedtea: 2007-12-28 Lillian Angel <langel at red...

Lillian Angel langel at redhat.com
Fri Dec 28 07:14:02 PST 2007


changeset e7bd40b829be in /hg/icedtea
details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=e7bd40b829be
description:
	2007-12-28  Lillian Angel  <langel at redhat.com>

	        * rt/java/awt/image/Raster.java
	        (createPackedRaster): Added dataType check and fixed if-else
	        conditions.
	        (createPackedRaster): Likewise.

diffstat:

2 files changed, 20 insertions(+), 11 deletions(-)
ChangeLog                     |    7 +++++++
rt/java/awt/image/Raster.java |   24 +++++++++++++-----------

diffs (74 lines):

diff -r 4e2ae53637f0 -r e7bd40b829be ChangeLog
--- a/ChangeLog	Fri Dec 28 09:51:42 2007 -0500
+++ b/ChangeLog	Fri Dec 28 10:12:51 2007 -0500
@@ -1,3 +1,10 @@ 2007-12-28  Lillian Angel  <langel at redha
+2007-12-28  Lillian Angel  <langel at redhat.com>
+
+	* rt/java/awt/image/Raster.java
+	(createPackedRaster): Added dataType check and fixed if-else
+	conditions.
+	(createPackedRaster): Likewise.
+
 2007-12-28  Lillian Angel  <langel at redhat.com>
 
 	* rt/java/awt/image/Raster.java
diff -r 4e2ae53637f0 -r e7bd40b829be rt/java/awt/image/Raster.java
--- a/rt/java/awt/image/Raster.java	Fri Dec 28 09:51:42 2007 -0500
+++ b/rt/java/awt/image/Raster.java	Fri Dec 28 10:12:51 2007 -0500
@@ -325,6 +325,10 @@ public class Raster
     if (location == null)
       location = new Point(0,0);
 
+    if (dataType != DataBuffer.TYPE_BYTE && dataType != DataBuffer.TYPE_USHORT &&
+        dataType != DataBuffer.TYPE_INT)
+        throw new IllegalArgumentException("Data type is not supported.");
+
     if (bands == 1)
       {
         SampleModel sm = new MultiPixelPackedSampleModel(dataType, w, h, bitsPerBand);
@@ -332,10 +336,8 @@ public class Raster
         if ((dataType == DataBuffer.TYPE_BYTE) &&
             (bitsPerBand == 1 || bitsPerBand == 2 || bitsPerBand == 4))
           return new BytePackedRaster(sm, location);
-        else if (dataType == DataBuffer.TYPE_USHORT || dataType == DataBuffer.TYPE_INT)
+        else
           return new SunWritableRaster(sm, location);
-        else
-          throw new IllegalArgumentException("Data type is not supported.");
       }
     else
       {
@@ -355,10 +357,8 @@ public class Raster
           return new ByteInterleavedRaster(sm, location);
         else if (dataType == DataBuffer.TYPE_USHORT)
           return new ShortInterleavedRaster(sm, location);
-        else if (dataType == DataBuffer.TYPE_INT)
+        else 
           return new IntegerInterleavedRaster(sm, location);
-        else
-          throw new IllegalArgumentException("Data type is not supported.");
       }
   }
 
@@ -481,14 +481,16 @@ public class Raster
     if (location == null)
       location = new Point(0,0);
 
-    if ((dataBuffer.getDataType() == DataBuffer.TYPE_BYTE) &&
+    int dataType = dataBuffer.getDataType();
+    if (dataType != DataBuffer.TYPE_BYTE && dataType != DataBuffer.TYPE_USHORT &&
+	dataType != DataBuffer.TYPE_INT)
+	throw new IllegalArgumentException("Data type is not supported.");
+
+    if ((dataType == DataBuffer.TYPE_BYTE) &&
         (bitsPerPixel == 1 || bitsPerPixel == 2 || bitsPerPixel == 4))
       return new BytePackedRaster(sm, dataBuffer, location);
-    else if (dataBuffer.getDataType() == DataBuffer.TYPE_USHORT 
-      || dataBuffer.getDataType() == DataBuffer.TYPE_INT)
+    else
       return new SunWritableRaster(sm, dataBuffer, location);
-    else
-      throw new IllegalArgumentException("Data type is not supported.");
   }
     
   /**



More information about the distro-pkg-dev mailing list