Hi,

This patch removes GdkGraphics and enables GdkGraphics2D unconditionally to provide a Graphics2D implementation on the GTK peers.

As I tried to extend my GDK backend to AbstractGraphics2D, I found that at this point AbstractGraphics2D does not offer much benefit over just inheriting directly from Graphics2D. The more I added to the GDK backend, the more the result resembled what we currently have for GdkGraphics2D.

That said, I think that AbstractGraphics2D can provide functionality to GdkGraphics2D in the future. I see it implementing the customizable parts of the rendering pipeline, such as handling of custom color models and custom composites. These would be used to convert image data to forms that can be handled efficiently by the GdkGraphics2D backend.

I also agree with Sven that GdkGraphics2D needs to be cleaned up. Part of that cleanup may involve hoisting the generic parts of GdkGraphics2D into AbstractGraphics2D. And we should split GdkGraphics2D into surface-specific variants like Sven has done in his Qt peers.

A few other minor things that need done, preferably as separate patches after this one has gone in:

- I need to port my rate-limited flushing patch from GdkGraphics to GdkGraphics2D, for smooth animations.

- We need a GdkGraphics2D variant that paints onto a GtkImage.

- We need to implement GdkGraphics2D.setXORMode.

Some improvements that this patch introduces:

- All components are force-realized now, so native GdkGraphics2D methods can always assume that gr->drawable is valid after checking that the peer has not been disposed. That is, GdkGraphics2D methods can no longer be called before the widget->window that they're drawing onto has been created.

- With force-realization I was able to remove all GdkGraphics2D Unlocked variants.

- No more fiddling with -Dgnu.java.awt.peer.gtk.Graphics=GdkGraphics2D.

- No more fiddling with --enable-gtk-cairo.

This patch bumps the GTK requirement to 2.8 or greater, which implicitly requires Cairo. This allows us to eliminate the annoying -Dgnu.java.awt.peer.gtk.Graphics=GdkGraphics2D and --enable-gtk-cairo altogether -- with this patch, if you build the GTK peers, you implicitly also build and enable GdkGraphics2D.

Lillian and I have tested this backend on the GNU Classpath applets list:

http://developer.classpath.org/mediation/Applets

It introduces no regressions and makes several Java2D applets work that didn't before.

OK to commit?
Tom

2006-05-24  Thomas Fitzsimmons  <[EMAIL PROTECTED]>

        * INSTALL: Bump GTK requirement to 2.8 or higher.  Do not mention
        Cairo version requirement.  Do not mention --enable-gtk-cairo
        configure option.
        * NEWS: Add entry for GdkGraphics2D.
        * configure.ac: Remove --enable-gtk-cairo and explicit checks for
        Cairo library and headers.
        * .externalToolBuilders/Configure.launch: Remove
        --enable-gtk-cairo from configure line.
        * gnu/classpath/Configuration.java.in (GTK_CAIRO_ENABLED): Remove
        field.
        * gnu/java/awt/BitwiseXORComposite.java: Fix javadoc typo.
        * gnu/java/awt/peer/gtk/GdkFontPeer.java,
        native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c : Remove
        useGraphics2D references.  Always assume Graphics2D is enabled.
        * gnu/java/awt/peer/gtk/GdkGraphics.java,
        native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c: Remove.
        * gnu/java/awt/peer/gtk/GdkGraphics2D.java,
        native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c: Remove
        Unlocked method variants.  Remove GTK_CAIRO_ENABLED and
        useGraphics2D references.  Always assume Graphics2D is enabled.
        * gnu/java/awt/peer/gtk/GdkTextLayout.java: Remove instanceof
        Graphics2D check.  Always assume Graphics2D is enabled.
        * gnu/java/awt/peer/gtk/GtkCanvasPeer.java,
        native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
        (realize): Remove method.
        * gnu/java/awt/peer/gtk/GtkComponentPeer.java,
        native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
        (isRealized): Remove method.
        (realize): Implement as a native method.  Remove useGraphics2D
        references.  Always assume Graphics2D is enabled.
        * gnu/java/awt/peer/gtk/GtkImage.java,
        native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c: Replace
        GdkGraphics references with GdkGraphics2D references.
        * gnu/java/awt/peer/gtk/GtkToolkit.java,
        native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c: Remove
        useGraphics2D references.  Always assume Graphics2D is enabled.
        * include/Makefile.am (GTKPEER_H_FILES): Remove
        gnu_java_awt_peer_gtk_GdkGraphics.h.
        * include/gnu_java_awt_peer_gtk_GdkFontPeer.h: Regenerate.
        * include/gnu_java_awt_peer_gtk_GdkGraphics.h: Remove.
        * include/gnu_java_awt_peer_gtk_GdkGraphics2D.h: Regenerate.
        * include/gnu_java_awt_peer_gtk_GtkCanvasPeer.h: Likewise.
        * include/gnu_java_awt_peer_gtk_GtkComponentPeer.h: Likewise.
        * native/jawt/Makefile.am (AM_LDFLAGS): Remove CAIRO_LIBS.
        * native/jni/gtk-peer/Makefile.am (libgtkpeer_la_SOURCES): Remove
        gnu_java_awt_peer_gtk_GdkGraphics.c.  Include
        gnu_java_awt_peer_gtk_GdkGraphics2D.c unconditionally.
        (AM_LDFLAGS): Remove CAIRO_LIBS.
        (AM_CFLAGS): Remove CAIRO_CFLAGS.
        * native/jni/gtk-peer/gtkcairopeer.h: Remove.  Move declarations
        to ...
        * native/jni/gtk-peer/gtkpeer.h: Add Graphics2D declarations.

Attachment: peer-cairo-graphics2d-backend-2.patch.gz
Description: GNU Zip compressed data

Reply via email to