harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r576299 - /harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Color.java
Date Mon, 17 Sep 2007 08:30:07 GMT
Author: ayza
Date: Mon Sep 17 01:30:05 2007
New Revision: 576299

URL: http://svn.apache.org/viewvc?rev=576299&view=rev
Log:
Patch from HARMONY-4801 ([classlib][awt] Performance improvement for java.awt.Color.ColorPaintContext)
was applied. Since the patch itself is small and obvious I don't think it should be considered
as a real "improvement" or "feature". The phrase "performance fix" better describes it. This
way, our feature freeze should not affect it IMO. 

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Color.java

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Color.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Color.java?rev=576299&r1=576298&r2=576299&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Color.java (original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Color.java Mon
Sep 17 01:30:05 2007
@@ -24,6 +24,7 @@
 import java.awt.geom.AffineTransform;
 import java.awt.geom.Rectangle2D;
 import java.awt.image.ColorModel;
+import java.awt.image.DirectColorModel;
 import java.awt.image.DataBufferInt;
 import java.awt.image.Raster;
 import java.awt.image.WritableRaster;
@@ -560,10 +561,16 @@
 
     class ColorPaintContext implements PaintContext {
         int rgbValue;
-        WritableRaster savedRaster = null;
+        WritableRaster savedRaster;
+        ColorModel cm;
 
         protected ColorPaintContext(int rgb) {
             rgbValue = rgb;
+            if((rgb & 0xFF000000) == 0xFF000000){
+                cm = new DirectColorModel(24, 0xFF0000, 0xFF00, 0xFF);
+            } else {
+                cm = ColorModel.getRGBdefault();
+            }
         }
 
         public void dispose() {
@@ -571,7 +578,7 @@
         }
 
         public ColorModel getColorModel() {
-            return ColorModel.getRGBdefault();
+            return cm;
         }
 
         public Raster getRaster(int x, int y, int w, int h) {



Mime
View raw message