[cp-patches] Performance improvement for FreetypeGlyphVector.java

Andrew Haley aph at redhat.com
Thu Nov 6 11:47:34 UTC 2008

Andrew Haley wrote:
> Mark Wielaard wrote:
>> Hi Andrew,
>> On Wed, 2008-11-05 at 14:17 +0000, Andrew Haley wrote:
>>> 2008-11-05  Andrew Haley  <aph at redhat.com>
>>> 	* gnu/java/awt/peer/gtk/FreetypeGlyphVector.java (getKerning):
>>> 	Return result in a float[], not a Point2D.
>>> 	(performDefaultLayout): Call getKerning with a float[].
>>> 	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c
>>> 	(getKerning): Return result in a float[], not a Point2D.
>> Thanks. This seems like a good speed improvement.
>> One nit. The default classpath build uses -Werror to keep the native
>> sources as clean as possible and with this it gave:
>> cc1: warnings being treated as errors
> Ah, right.  We should do that in the gcj build too.

I've just noticed something.  My patch uses a declaration (of pelements)
after some statements, and this is not legal C90, although most
compilers support it.  (OK, I confess, I forgot this was C and not
C++ :-)

Do we care?  -Wdeclaration-after-statement will warn for this.


  pango_fc_font_unlock_face( font );

  jfloat *pelements = (*env)->GetPrimitiveArrayCritical(env, p, NULL);
  pelements[0] = (jfloat)kern.x/64.0;
  pelements[1] = (jfloat)kern.y/64.0;
  (*env)->ReleasePrimitiveArrayCritical (env, p, pelements, 0);

More information about the Classpath-patches mailing list