This is the mail archive of the mailing list for the Java project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] enable Graphics2D at configure and runtime

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 ("" == "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("", 
> +                                       "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]