classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] fail on instantiation of GdkGraphics2D if Graphics2D is not


From: Thomas Fitzsimmons
Subject: [cp-patches] fail on instantiation of GdkGraphics2D if Graphics2D is not enabled
Date: Sat, 10 Sep 2005 01:02:01 -0400

Hi,

This patch moves the failure when Graphics2D is not enabled from
GdkGraphics2D's static initializer to its constructors.  I committed
this to mainline.

Tom

2005-09-10  Thomas Fitzsimmons  <address@hidden>

        * gnu/java/awt/peer/gtk/GdkGraphics2D.java (fail_g2d): New method.
        (GdkGraphics2D(GdkGraphics2D)): Call fail_g2d if Graphics2D not
        specified.
        (GdkGraphics2D(int,int)): Likewise.
        (GdkGraphics2D(GtkComponentPeer)): Likewise.

Index: gnu/java/awt/peer/gtk/GdkGraphics2D.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GdkGraphics2D.java,v
retrieving revision 1.47
diff -u -r1.47 GdkGraphics2D.java
--- gnu/java/awt/peer/gtk/GdkGraphics2D.java    10 Sep 2005 01:16:34 -0000      
1.47
+++ gnu/java/awt/peer/gtk/GdkGraphics2D.java    10 Sep 2005 05:03:56 -0000
@@ -107,15 +107,7 @@
     if (Configuration.INIT_LOAD_LIBRARY)
       System.loadLibrary("gtkpeer");
 
-    if (GtkToolkit.useGraphics2D ())
-      initStaticState();
-    else
-      {
-        System.err.println ("Attempted to instantiate GdkGraphics2D"
-                            + " but Graphics2D not enabled.  Try again with"
-                            + " -Dgnu.java.awt.peer.gtk.Graphics=Graphics2D");
-        System.exit (1);
-      }
+    initStaticState();
   }
   
   static native void initStaticState();
@@ -165,8 +157,19 @@
     return new GdkGraphics2D(width, height);
   }
 
+  private void fail_g2d ()
+  {
+    System.err.println ("Attempted to instantiate GdkGraphics2D"
+                       + " but Graphics2D not enabled.  Try again with"
+                       + " -Dgnu.java.awt.peer.gtk.Graphics=Graphics2D");
+    System.exit (1);
+  }
+
   GdkGraphics2D(GdkGraphics2D g)
   {
+    if (!GtkToolkit.useGraphics2D ())
+      fail_g2d ();
+
     paint = g.paint;
     stroke = g.stroke;
     setRenderingHints(g.hints);
@@ -208,6 +211,9 @@
 
   GdkGraphics2D(int width, int height)
   {
+    if (!GtkToolkit.useGraphics2D ())
+      fail_g2d ();
+
     initState(width, height);
 
     setColor(Color.black);
@@ -223,6 +229,9 @@
 
   GdkGraphics2D(GtkComponentPeer component)
   {
+    if (!GtkToolkit.useGraphics2D ())
+      fail_g2d ();
+
     this.component = component;
     
     if (component.isRealized())

reply via email to

[Prev in Thread] Current Thread [Next in Thread]