2006-05-29  Audrius Meskauskas  <[EMAIL PROTECTED]>

   * gnu/java/awt/peer/gtk/GdkGraphics2D.java (copying constructor):
   Do not reuse fg in the constructor.

Sven de Marothy wrote:
On Mon, 2006-05-29 at 09:23 +0200, Audrius Meskauskas wrote:
This patch forces to return early if the color being set is the same as the current color. It improves the paint performance test result from 78 till 66.

Actually that screws up the copying constructor
GdkGraphics2d(GdkGraphics2d c) which explicitly calls setColor(fg) for
updating Cairo's internal state to the current color.
Thanks for noticing.
These patches are a bit moot though because the pending Graphics2D patch
removes the class altogether.
A I understand, this code is not removed, it just now goes to the CairoGraphics2D.java. I will merge later.

Regards

Audrius.


Index: GdkGraphics2D.java
===================================================================
RCS file: /sources/classpath/classpath/gnu/java/awt/peer/gtk/GdkGraphics2D.java,v
retrieving revision 1.58
diff -u -r1.58 GdkGraphics2D.java
--- GdkGraphics2D.java	29 May 2006 07:24:57 -0000	1.58
+++ GdkGraphics2D.java	29 May 2006 10:12:43 -0000
@@ -152,15 +152,17 @@
 
   GdkGraphics2D(GdkGraphics2D g)
   {
+    Color foreground;
+    
     paint = g.paint;
     stroke = g.stroke;
     setRenderingHints(g.hints);
 
     if (g.fg.getAlpha() != -1)
-      fg = new Color(g.fg.getRed(), g.fg.getGreen(), g.fg.getBlue(),
+      foreground = new Color(g.fg.getRed(), g.fg.getGreen(), g.fg.getBlue(),
                      g.fg.getAlpha());
     else
-      fg = new Color(g.fg.getRGB());
+      foreground = new Color(g.fg.getRGB());
 
     if (g.bg != null)
       {
@@ -185,7 +187,7 @@
     component = g.component;
     copyState(g);
 
-    setColor(fg);
+    setColor(foreground);
     setBackground(bg);
     setPaint(paint);
     setStroke(stroke);

Reply via email to