diff options
author | graydon hoare <graydon@pobox.com> | 2004-01-27 09:46:24 +0000 |
---|---|---|
committer | graydon hoare <graydon@pobox.com> | 2004-01-27 09:46:24 +0000 |
commit | 8df3e758246e5dba94a2b884272fd60f02f224e9 (patch) | |
tree | 67bc77b5146227178af37213de145fb467b2c6d3 /gnu | |
parent | ec8ea8f1852ab3b93b4a99fa6d91bde620b2a974 (diff) | |
download | classpath-8df3e758246e5dba94a2b884272fd60f02f224e9.tar.gz |
2004-01-22 Graydon Hoare <graydon@redhat.com>
* gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java:
* gnu/java/awt/peer/gtk/GdkGlyphVector.java:
Predicate static initialization on GtkToolkit.useGraphics2D().
* java/awt/Component.java (processPaintEvent): Consume event.
* javax/swing/AbstractButton.java: Reimplement, document.
* javax/swing/DefaultButtonModel.java: Reimplement, document.
* javax/swing/JComponent.java (paint): Use double buffer.
(listenerList): Enable member.
* javax/swing/ToggleButtonModel.java: Remove incorrect constructor.
* javax/swing/JToggleButton.java
(JToggleButton): Modify model constructor.
* javax/swing/SwingUtilities.java
(layoutCompoundLabel): Adjust arithmetic.
* javax/swing/plaf/basic/BasicButtonUI.java: Reimplement, document.
* javax/swing/plaf/basic/BasicGraphicsUtils.java
(getPreferredButtonSize): Include margins in calculation.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
(Java_gnu_java_awt_peer_gtk_GtkWindowPeer_connectSignals):
Receive up events from subordinate layout component.
2004-01-12 Graydon Hoare <graydon@redhat.com>
* gnu/java/awt/gtk/GdkGraphics2D.java
(static): Check GtkToolkit before initializing static state.
(Graphics2D): Don't construct transform with 0.5 unit offset.
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/java/awt/ClasspathToolkit.java | 3 | ||||
-rw-r--r-- | gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java | 4 | ||||
-rw-r--r-- | gnu/java/awt/peer/gtk/GdkGlyphVector.java | 4 | ||||
-rw-r--r-- | gnu/java/awt/peer/gtk/GdkGraphics2D.java | 82 |
4 files changed, 14 insertions, 79 deletions
diff --git a/gnu/java/awt/ClasspathToolkit.java b/gnu/java/awt/ClasspathToolkit.java index 789b2e53c..91401f4d5 100644 --- a/gnu/java/awt/ClasspathToolkit.java +++ b/gnu/java/awt/ClasspathToolkit.java @@ -182,8 +182,7 @@ public abstract class ClasspathToolkit public Font getFont (String name, Map attrs) { - // FIXME: name is ignored currently. - return new Font (attrs); + return new Font (name, attrs); } diff --git a/gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java b/gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java index ca262890b..1cf24a98d 100644 --- a/gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java +++ b/gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java @@ -70,7 +70,9 @@ public class GdkClasspathFontPeer extends ClasspathFontPeer { System.loadLibrary("gtkpeer"); } - initStaticState (); + + if (GtkToolkit.useGraphics2D ()) + initStaticState (); } native static void initStaticState (); private final int native_state = GtkGenericPeer.getUniqueInteger (); diff --git a/gnu/java/awt/peer/gtk/GdkGlyphVector.java b/gnu/java/awt/peer/gtk/GdkGlyphVector.java index 0ba45396b..ff6b4cd29 100644 --- a/gnu/java/awt/peer/gtk/GdkGlyphVector.java +++ b/gnu/java/awt/peer/gtk/GdkGlyphVector.java @@ -60,7 +60,9 @@ public class GdkGlyphVector extends GlyphVector { System.loadLibrary("gtkpeer"); } - initStaticState (); + + if (GtkToolkit.useGraphics2D ()) + initStaticState (); } native static void initStaticState (); private final int native_state = GtkGenericPeer.getUniqueInteger (); diff --git a/gnu/java/awt/peer/gtk/GdkGraphics2D.java b/gnu/java/awt/peer/gtk/GdkGraphics2D.java index 383dd571b..72164292d 100644 --- a/gnu/java/awt/peer/gtk/GdkGraphics2D.java +++ b/gnu/java/awt/peer/gtk/GdkGraphics2D.java @@ -68,7 +68,9 @@ public class GdkGraphics2D extends Graphics2D { System.loadLibrary("gtkpeer"); } - initStaticState (); + + if (GtkToolkit.useGraphics2D ()) + initStaticState (); } native static void initStaticState (); private final int native_state = GtkGenericPeer.getUniqueInteger(); @@ -129,7 +131,7 @@ public class GdkGraphics2D extends Graphics2D clip = new Rectangle (g.getClipBounds ()); if (g.transform == null) - transform = AffineTransform.getTranslateInstance (0.5, 0.5); + transform = new AffineTransform (); else transform = new AffineTransform (g.transform); @@ -154,7 +156,7 @@ public class GdkGraphics2D extends Graphics2D setBackground (Color.black); setPaint (getColor()); setFont (new Font("SansSerif", Font.PLAIN, 12)); - setTransform (AffineTransform.getTranslateInstance (0.5, 0.5)); + setTransform (new AffineTransform ()); setStroke (new BasicStroke ()); setRenderingHints (new HashMap ()); @@ -170,7 +172,7 @@ public class GdkGraphics2D extends Graphics2D setBackground (new Color (rgb[3], rgb[4], rgb[5])); setPaint (getColor()); setFont (new Font("SansSerif", Font.PLAIN, 12)); - setTransform (AffineTransform.getTranslateInstance (0.5, 0.5)); + setTransform (new AffineTransform ()); setStroke (new BasicStroke ()); setRenderingHints (new HashMap ()); @@ -587,7 +589,7 @@ public class GdkGraphics2D extends Graphics2D public void setXORMode (Color c) { - setComposite (new BitwiseXorComposite (c)); + setComposite (new gnu.java.awt.BitwiseXORComposite(c)); } public void setColor (Color c) @@ -1032,76 +1034,6 @@ public class GdkGraphics2D extends Graphics2D } - private class BitwiseXorComposite implements Composite - { - // this is a special class which does a bitwise XOR composite, for - // backwards compatibility sake. it does *not* implement the - // porter-duff XOR operator. the porter-duff XOR is unrelated to - // bitwise XOR; it just happens to have a similar name but it - // represents a desire to composite the exclusive or of overlapping - // subpixel regions. bitwise XOR is for drawing "highlights" such as - // cursors (in a cheap oldskool bitblit fashion) by inverting colors - // temporarily and then inverting them back. - - Color xorColor; - - class BitwiseXorCompositeContext implements CompositeContext - { - ColorModel srcColorModel; - ColorModel dstColorModel; - - public BitwiseXorCompositeContext (ColorModel s, - ColorModel d) - { - srcColorModel = s; - dstColorModel = d; - } - - public void dispose () - { - } - - public void compose (Raster src, - Raster dstIn, - WritableRaster dstOut) - { - Rectangle srcRect = src.getBounds (); - Rectangle dstInRect = dstIn.getBounds (); - Rectangle dstOutRect = dstOut.getBounds (); - - int xp = xorColor.getRGB (); - int x = 0, y = 0; - int w = Math.min (Math.min (srcRect.width, dstOutRect.width), dstInRect.width); - int h = Math.min (Math.min (srcRect.height, dstOutRect.height), dstInRect.height); - Object srcPix = null, dstPix = null; - - for (y = 0; y < h; y++) - for (x = 0; x < w; x++) - { - srcPix = src.getDataElements (x + srcRect.x, y + srcRect.y, srcPix); - dstPix = dstIn.getDataElements (x + dstInRect.x, y + dstInRect.y, dstPix); - int sp = srcColorModel.getRGB (srcPix); - int dp = dstColorModel.getRGB (dstPix); - int rp = sp ^ xp ^ dp; - dstOut.setDataElements (x + dstOutRect.x, y + dstOutRect.y, - dstColorModel.getDataElements (rp, null)); - } - } - } - - public BitwiseXorComposite (Color c) - { - xorColor = c; - } - - public CompositeContext createContext (ColorModel srcColorModel, - ColorModel dstColorModel, - RenderingHints hints) - { - return new BitwiseXorCompositeContext (srcColorModel, dstColorModel); - } - } - /////////////////////////////////////////////// ////// Unimplemented Stubs and Overloads ////// |