harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r447218 - in /incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/renderable: ParameterBlock.java RenderContext.java RenderableImageOp.java RenderableImageProducer.java
Date Mon, 18 Sep 2006 03:41:50 GMT
Author: ndbeyer
Date: Sun Sep 17 20:41:49 2006
New Revision: 447218

URL: http://svn.apache.org/viewvc?view=rev&rev=447218
Log:
Clean up compiler warnings and add some braces.

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/renderable/ParameterBlock.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/renderable/RenderContext.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/renderable/RenderableImageOp.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/renderable/RenderableImageProducer.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/renderable/ParameterBlock.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/renderable/ParameterBlock.java?view=diff&rev=447218&r1=447217&r2=447218
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/renderable/ParameterBlock.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/renderable/ParameterBlock.java
Sun Sep 17 20:41:49 2006
@@ -101,6 +101,8 @@
         }
     }
 
+    @SuppressWarnings("unchecked")
+    @Override
     public Object clone() {
         ParameterBlock replica;
         try{
@@ -234,6 +236,4 @@
     public int getNumParameters() {
         return parameters.size();
     }
-
 }
-

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/renderable/RenderContext.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/renderable/RenderContext.java?view=diff&rev=447218&r1=447217&r2=447218
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/renderable/RenderContext.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/renderable/RenderContext.java
Sun Sep 17 20:41:49 2006
@@ -33,7 +33,6 @@
         this.transform = (AffineTransform)usr2dev.clone();
         this.aoi = aoi;
         this.hints = hints;
-
     }
 
     public RenderContext(AffineTransform usr2dev, Shape aoi) {
@@ -48,6 +47,7 @@
         this(usr2dev, null, null);
     }
 
+    @Override
     public Object clone() {
         return new RenderContext(transform, aoi, hints);
     }
@@ -99,6 +99,4 @@
     public RenderingHints getRenderingHints() {
         return hints;
     }
-
 }
-

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/renderable/RenderableImageOp.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/renderable/RenderableImageOp.java?view=diff&rev=447218&r1=447217&r2=447218
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/renderable/RenderableImageOp.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/renderable/RenderableImageOp.java
Sun Sep 17 20:41:49 2006
@@ -53,31 +53,33 @@
 
     public RenderedImage createRendering(RenderContext renderContext) {
 
-        Vector sources = getSources();
+        Vector<RenderableImage> sources = getSources();
         ParameterBlock rdParam = (ParameterBlock) paramBlock.clone();
 
-        if(sources != null){
+        if (sources != null) {
             Vector<Object> rdSources = new Vector<Object>();
             int i = 0;
-            while(i < sources.size()){
-                RenderContext newContext = CRIF.mapRenderContext(i, renderContext,
-                        paramBlock, this);
-                RenderedImage rdim =
-                    ((RenderableImage) sources.elementAt(i)).createRendering(newContext);
-
-                if(rdim != null) rdSources.addElement(rdim);
+            while (i < sources.size()) {
+                RenderContext newContext = CRIF.mapRenderContext(i, renderContext, paramBlock,
+                        this);
+                RenderedImage rdim = sources.elementAt(i).createRendering(newContext);
+
+                if (rdim != null) {
+                    rdSources.addElement(rdim);
+                }
                 i++;
             }
-            if(rdSources.size() > 0){
+            if (rdSources.size() > 0) {
                 rdParam.setSources(rdSources);
             }
         }
-        return CRIF.create(renderContext,rdParam);
+        return CRIF.create(renderContext, rdParam);
     }
 
     public RenderedImage createScaledRendering(int w, int h, RenderingHints hints) {
-        if(w == 0 && h == 0)
+        if(w == 0 && h == 0) {
             throw new IllegalArgumentException("Width and Height mustn't be equal zero both");
+        }
         if(w == 0){
             w = Math.round(h*(getWidth()/getHeight()));
         }
@@ -95,7 +97,9 @@
     }
 
     public Vector<RenderableImage> getSources() {
-        if(paramBlock.getNumSources() == 0) return null;
+        if(paramBlock.getNumSources() == 0) {
+            return null;
+        }
         Vector<RenderableImage> v = new Vector<RenderableImage>();
         int  i = 0;
         while(i < paramBlock.getNumSources()){

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/renderable/RenderableImageProducer.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/renderable/RenderableImageProducer.java?view=diff&rev=447218&r1=447217&r2=447218
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/renderable/RenderableImageProducer.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/renderable/RenderableImageProducer.java
Sun Sep 17 20:41:49 2006
@@ -24,14 +24,13 @@
 import java.awt.image.ImageProducer;
 import java.awt.image.Raster;
 import java.awt.image.RenderedImage;
-import java.util.Enumeration;
 import java.util.Vector;
 
 public class RenderableImageProducer implements ImageProducer, Runnable {
 
     RenderableImage rbl;
     RenderContext rc;
-    Vector consumers = new Vector();
+    Vector<ImageConsumer> consumers = new Vector<ImageConsumer>();
 
     public RenderableImageProducer(RenderableImage rdblImage, RenderContext rc) {
         this.rbl = rdblImage;
@@ -55,7 +54,9 @@
     public void requestTopDownLeftRightResend(ImageConsumer ic) {}
 
     public synchronized void removeConsumer(ImageConsumer ic) {
-        if(ic != null) consumers.removeElement(ic);
+        if(ic != null) {
+            consumers.removeElement(ic);
+        }
     }
 
     public synchronized void addConsumer(ImageConsumer ic) {
@@ -65,21 +66,27 @@
     }
 
     public void run() {
-        if(rbl == null) return;
+        if(rbl == null) {
+            return;
+        }
 
         RenderedImage rd;
-        if(rc != null) rd = rbl.createRendering(rc);
-        else rd = rbl.createDefaultRendering();
+        if(rc != null) {
+            rd = rbl.createRendering(rc);
+        } else {
+            rd = rbl.createDefaultRendering();
+        }
 
         ColorModel cm = rd.getColorModel();
-        if(cm == null) cm = ColorModel.getRGBdefault();
+        if(cm == null) {
+            cm = ColorModel.getRGBdefault();
+        }
 
         Raster r = rd.getData();
         int w = r.getWidth();
         int h = r.getHeight();
 
-        for(Enumeration e = consumers.elements(); e.hasMoreElements();){
-            ImageConsumer c = (ImageConsumer) e.nextElement();
+        for (ImageConsumer c : consumers) {
             c.setDimensions(w, h);
             c.setHints(ImageConsumer.TOPDOWNLEFTRIGHT |
                     ImageConsumer.COMPLETESCANLINES |
@@ -96,14 +103,12 @@
                 scanLine[x] = cm.getDataElement(pixel, 0);
             }
 
-            for(Enumeration e = consumers.elements(); e.hasMoreElements();){
-                ImageConsumer c = (ImageConsumer) e.nextElement();
+            for (ImageConsumer c : consumers) {
                 c.setPixels(0, y, w, 1, cm, scanLine, 0, w);
             }
         }
 
-        for(Enumeration e = consumers.elements(); e.hasMoreElements();){
-            ImageConsumer c = (ImageConsumer) e.nextElement();
+        for (ImageConsumer c : consumers) {
             c.imageComplete(ImageConsumer.STATICIMAGEDONE);
         }
     }



Mime
View raw message