harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r447201 - in /incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image: ImageFilter.java PixelGrabber.java
Date Mon, 18 Sep 2006 02:48:03 GMT
Author: ndbeyer
Date: Sun Sep 17 19:48:02 2006
New Revision: 447201

URL: http://svn.apache.org/viewvc?view=rev&rev=447201
Log:
Update setProperties method to Java 5 spec

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ImageFilter.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/PixelGrabber.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ImageFilter.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ImageFilter.java?view=diff&rev=447201&r1=447200&r2=447201
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ImageFilter.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ImageFilter.java
Sun Sep 17 19:48:02 2006
@@ -25,7 +25,9 @@
 
     protected ImageConsumer consumer;
 
-    public ImageFilter() {}
+    public ImageFilter() {
+        super();
+    }
 
     public ImageFilter getFilterInstance(ImageConsumer ic) {
         ImageFilter filter = (ImageFilter) clone();
@@ -33,24 +35,29 @@
         return filter;
     }
 
-    public void setProperties(Hashtable props) {
-        Hashtable fprops;
-        if(props == null) fprops = new Hashtable();
-        else fprops = (Hashtable) props.clone();
+    @SuppressWarnings("unchecked")
+    public void setProperties(Hashtable<?, ?> props) {
+        Hashtable<Object, Object> fprops;
+        if (props == null) {
+            fprops = new Hashtable<Object, Object>();
+        } else {
+            fprops = (Hashtable<Object, Object>) props.clone();
+        }
         String propName = "Filters";
-        String prop = "Null filter" ;
+        String prop = "Null filter";
         Object o = fprops.get(propName);
-        if(o != null){
-            if(o instanceof String){
-                prop = (String)o + "; " + prop;
-            }else{
-                prop =  o.toString() + "; " + prop;
+        if (o != null) {
+            if (o instanceof String) {
+                prop = (String) o + "; " + prop;
+            } else {
+                prop = o.toString() + "; " + prop;
             }
         }
         fprops.put(propName, prop);
         consumer.setProperties(fprops);
     }
 
+    @Override
     public Object clone() {
         try {
             return super.clone();
@@ -67,15 +74,13 @@
         consumer.setColorModel(model);
     }
 
-    public void setPixels(int x, int y, int w, int h, ColorModel model, 
-            int[] pixels, int off, int scansize) {
-        
+    public void setPixels(int x, int y, int w, int h, ColorModel model, int[] pixels, int
off,
+            int scansize) {
         consumer.setPixels(x, y, w, h, model, pixels, off, scansize);
     }
 
-    public void setPixels(int x, int y, int w, int h, ColorModel model, 
-            byte[] pixels, int off, int scansize) {
-        
+    public void setPixels(int x, int y, int w, int h, ColorModel model, byte[] pixels, int
off,
+            int scansize) {
         consumer.setPixels(x, y, w, h, model, pixels, off, scansize);
     }
 
@@ -92,4 +97,3 @@
     }
 
 }
-

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/PixelGrabber.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/PixelGrabber.java?view=diff&rev=447201&r1=447200&r2=447201
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/PixelGrabber.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/PixelGrabber.java
Sun Sep 17 19:48:02 2006
@@ -67,7 +67,7 @@
         initialize(img.getSource(), x, y, w, h, null, 0, 0, forceRGB);
     }
 
-    public void setProperties(Hashtable props) {
+    public void setProperties(Hashtable<?, ?> props) {
         return;
     }
 
@@ -90,7 +90,9 @@
             ColorModel model, byte[] pixels, int srcOff, int srcScan) {
         if(srcY < Y){
             int delta = Y - srcY;
-            if(delta >= height) return;
+            if(delta >= height) {
+                return;
+            }
             srcY += delta;
             srcH -= delta;
             srcOff += srcScan * delta;
@@ -98,12 +100,16 @@
 
         if(srcY + srcH > Y + height){
             srcH = Y + height - srcY;
-            if(srcH <= 0) return;
+            if(srcH <= 0) {
+                return;
+            }
         }
 
         if(srcX < X){
             int delta = X - srcX;
-            if(delta >= width) return;
+            if(delta >= width) {
+                return;
+            }
             srcW -= delta;
             srcX += delta;
             srcOff += delta;
@@ -111,9 +117,13 @@
 
         if(srcX + srcW > X + width){
             srcW = X + width - srcX;
-            if(srcW <= 0) return;
+            if(srcW <= 0) {
+                return;
+            }
+        }
+        if(scanline == 0) {
+            scanline = width;
         }
-        if(scanline == 0) scanline = width;
         int realOff = offset + (srcY - Y) * scanline + (srcX - X);
         switch(dataType){
         case DATA_TYPE_UNDEFINED:
@@ -155,7 +165,9 @@
 
         if(srcY < Y){
             int delta = Y - srcY;
-            if(delta >= height) return;
+            if(delta >= height) {
+                return;
+            }
             srcY += delta;
             srcH -= delta;
             srcOff += srcScan * delta;
@@ -163,12 +175,16 @@
 
         if(srcY + srcH > Y + height){
             srcH = Y + height - srcY;
-            if(srcH <= 0) return;
+            if(srcH <= 0) {
+                return;
+            }
         }
 
         if(srcX < X){
             int delta = X - srcX;
-            if(delta >= width) return;
+            if(delta >= width) {
+                return;
+            }
             srcW -= delta;
             srcX += delta;
             srcOff += delta;
@@ -176,9 +192,13 @@
 
         if(srcX + srcW > X + width){
             srcW = X + width - srcX;
-            if(srcW <= 0) return;
+            if(srcW <= 0) {
+                return;
+            }
+        }
+        if(scanline == 0) {
+            scanline = width;
         }
-        if(scanline == 0) scanline = width;
         int realOff = offset + (srcY - Y) * scanline + (srcX - X);
 
         switch(dataType){
@@ -186,8 +206,11 @@
             cm = model;
             iData = new int[width * height];
             dataType = DATA_TYPE_INT;
-            if(cm == ColorModel.getRGBdefault()) isRGB = true;
-            else isRGB = false;
+            if(cm == ColorModel.getRGBdefault()) {
+                isRGB = true;
+            } else {
+                isRGB = false;
+            }
 
         case DATA_TYPE_INT:
             if(cm == model){
@@ -231,7 +254,9 @@
         while((grabberStatus & GRABBING_STOP) == 0){
             if(ms != 0){
                 ms = start + ms - System.currentTimeMillis();
-                if(ms <= 0) break;
+                if(ms <= 0) {
+                    break;
+                }
             }
             wait(ms);
         }
@@ -240,8 +265,12 @@
     }
 
     public void setDimensions(int w, int h) {
-        if(width < 0) width = w - X;
-        if(height < 0) height = h - Y;
+        if(width < 0) {
+            width = w - X;
+        }
+        if(height < 0) {
+            height = h - Y;
+        }
 
         grabberStatus |= ImageObserver.WIDTH | ImageObserver.HEIGHT;
 
@@ -308,7 +337,9 @@
     }
 
     public synchronized int getWidth() {
-        if(width < 0) return -1;
+        if(width < 0) {
+            return -1;
+        }
         return width;
     }
 
@@ -317,7 +348,9 @@
     }
 
     public synchronized int getHeight() {
-        if(height < 0) return -1;
+        if(height < 0) {
+            return -1;
+        }
         return height;
     }
 
@@ -368,4 +401,3 @@
     }
 
 }
-



Mime
View raw message