This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: [PATCH] enable Graphics2D at configure and runtime
- From: Thomas Fitzsimmons <fitzsim at redhat dot com>
- To: graydon hoare <graydon at redhat dot com>
- Cc: java-patches at gcc dot gnu dot org, classpath at gnu dot org
- Date: Thu, 18 Dec 2003 17:30:02 -0500
- Subject: Re: [PATCH] enable Graphics2D at configure and runtime
- References: <3FE06B03.2020909@redhat.com>
On Wed, 2003-12-17 at 09:41, graydon hoare wrote:
> hi,
>
> this patch provides a new bit of configury (--enable-gtk-cairo) and a
> runtime system property ("gnu.java.awt.peer.gtk.Graphics" == "Graphics"
> or "Graphics2D") which permits the cairo/graphics2d code I've been
> working on to coexist with the existing GTK peers and GDK Graphics
> object, as an option at both compile and runtime.
>
> I'm sure there'll be a few suggestions about how "best" to do this, so I
> just picked what seemed like an unintrusive method and implemented it,
> to make sure it's even possible. any suggestions on how to do it better?
>
Nope, I think this approach is good.
A few comments:
> +dnl determine whether to enable the cairo GTK Graphics2D backend
> +AC_ARG_ENABLE(gtk-cairo, [ --enable-gtk-cairo build the cairo Graphics2D implementation on GTK])
> +AM_CONDITIONAL(GTK_CAIRO, test "x${enable_gtk_cairo}" = xyes)
> +if test "x${enable_gtk_cairo}" = xyes
> +then
> + AC_CHECK_LIB([cairo], [cairo_create])
> + AC_CHECK_LIB([pixman], [pixman_region_create])
> + if (echo $LIBS | grep -v -q cairo) || (echo $LIBS | grep -v -q pixman)
> + then
> + AC_MSG_ERROR(need both libcairo and libpixman for cairo support)
> + fi
I've got cairo installed in a non-standard prefix, and AC_CHECK_LIB
doesn't seem to like this (even when LD_LIBRARY_PATH is set to
$(nonstandardprefix)/lib). Can we use PKG_CHECK_MODULES here instead?
(We should be using PKG_CHECK_MODULES for GTK, GLib and libart as well,
I think).
> + public static boolean useGraphics2D()
> + {
> + if (useGraphics2dSet)
> + return useGraphics2d;
> + useGraphics2d = System.getProperty("gnu.java.awt.peer.gtk.Graphics",
> + "Graphics").equals("Graphics2D");
> + useGraphics2dSet = true;
> + }
There should be a return statement here.
> + /* newer method to produce a peer for a Font object, even though Sun's
> + design claims Font should now be peerless, we do not agree with this
> + model, hence "ClasspathFontPeer". */
> +
> + public ClasspathFontPeer getClasspathFontPeer (String name, Map attrs)
> + {
> + if (useGraphics2D)
This should be useGraphics2d.
I tested this patch, and apart from the problems I mentioned, it works
well.
Tom