harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r577248 - in /harmony/enhanced/classlib/trunk/modules/awt/src: main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java test/api/java/common/java/awt/Graphics2DTest.java
Date Wed, 19 Sep 2007 11:26:27 GMT
Author: apetrenko
Date: Wed Sep 19 04:26:27 2007
New Revision: 577248

URL: http://svn.apache.org/viewvc?rev=577248&view=rev
Log:
Patch for HARMONY-4799 "[classlib][awt] GetRenderingHint returns Null by default"

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java
    harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/Graphics2DTest.java

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java?rev=577248&r1=577247&r2=577248&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java
Wed Sep 19 04:26:27 2007
@@ -40,24 +40,24 @@
 import java.awt.Toolkit;
 import java.awt.font.FontRenderContext;
 import java.awt.font.GlyphVector;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Arc2D;
+import java.awt.geom.Ellipse2D;
+import java.awt.geom.Line2D;
+import java.awt.geom.PathIterator;
+import java.awt.geom.RoundRectangle2D;
 import java.awt.image.AffineTransformOp;
-import java.awt.image.ImageObserver;
 import java.awt.image.BufferedImage;
 import java.awt.image.BufferedImageOp;
+import java.awt.image.ImageObserver;
 import java.awt.image.Raster;
 import java.awt.image.RenderedImage;
 import java.awt.image.WritableRaster;
 import java.awt.image.renderable.RenderableImage;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Arc2D;
-import java.awt.geom.Ellipse2D;
-import java.awt.geom.Line2D;
-import java.awt.geom.PathIterator;
-import java.awt.geom.RoundRectangle2D;
 import java.text.AttributedCharacterIterator;
+import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.harmony.awt.gl.Surface;
 import org.apache.harmony.awt.gl.font.FontManager;
 import org.apache.harmony.awt.gl.font.fontlib.FLTextRenderer;
 import org.apache.harmony.awt.gl.image.OffscreenImage;
@@ -125,9 +125,22 @@
  *
  */
 public abstract class CommonGraphics2D extends Graphics2D {
+	
+	private static final Map<RenderingHints.Key, Object> DEFAULT_RENDERING_HINTS;
+
+	static {
+		DEFAULT_RENDERING_HINTS = new HashMap<RenderingHints.Key, Object>();
+		DEFAULT_RENDERING_HINTS.put(RenderingHints.KEY_TEXT_ANTIALIASING,
+				RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT);
+		DEFAULT_RENDERING_HINTS.put(RenderingHints.KEY_ANTIALIASING,
+				RenderingHints.VALUE_ANTIALIAS_OFF);
+		DEFAULT_RENDERING_HINTS.put(RenderingHints.KEY_STROKE_CONTROL,
+				RenderingHints.VALUE_STROKE_DEFAULT);
+	}
+	
     protected Surface dstSurf = null;
     protected Blitter blitter = NullBlitter.getInstance();
-    protected RenderingHints hints = new RenderingHints(null);
+    protected RenderingHints hints = new RenderingHints(DEFAULT_RENDERING_HINTS);
 
     // Clipping things
     protected MultiRectArea clip = null;

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/Graphics2DTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/Graphics2DTest.java?rev=577248&r1=577247&r2=577248&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/Graphics2DTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/Graphics2DTest.java
Wed Sep 19 04:26:27 2007
@@ -57,4 +57,16 @@
         assertNotNull(g2d.getPaint());        
     }
 
+    public void testGetRenderingHint() {
+		// Regression test for HARMONY-4799
+		final Graphics2D g2d = (Graphics2D) frame.getGraphics();
+
+		assertEquals(
+				g2d.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING),
+				RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT);
+		assertEquals(g2d.getRenderingHint(RenderingHints.KEY_ANTIALIASING),
+				RenderingHints.VALUE_ANTIALIAS_OFF);
+		assertEquals(g2d.getRenderingHint(RenderingHints.KEY_STROKE_CONTROL),
+				RenderingHints.VALUE_STROKE_DEFAULT);
+	}
 }



Mime
View raw message