This is the mail archive of the java-patches@gcc.gnu.org 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]

FYI: [gui] GdkGraphics2D.c and GdkClasspathFontPeerMetrics.ccleanups


Hi,

The following C source code cleanups come from GNU Classpath.
(It is now also possible to use --enable-gtk-cairo with GNU Classpath
CVS).

2004-08-14  Mark Wielaard  <mark@klomp.org>

        * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.c:
        Declare variables at top of functions/block.
        * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c: Likewise.

Committed,

Mark
--- jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.c	29 Mar 2004 07:07:26 -0000	1.5
+++ jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.c	14 Aug 2004 17:18:17 -0000
@@ -54,6 +54,8 @@
   jint *metrics;
   struct peerfont *pf = NULL;
   FT_Matrix mat;
+  double pointsize;
+  FT_Face face;
 
   pf = NSA_GET_FONT_PTR(env, font);
   g_assert (pf != NULL);
@@ -68,7 +70,7 @@
 #define DOUBLE_TO_16_16(d) ((FT_Fixed)((d) * 65536.0))
 #define DOUBLE_FROM_16_16(t) ((double)(t) / 65536.0)
 
-  double pointsize = pango_font_description_get_size (pf->desc);
+  pointsize = pango_font_description_get_size (pf->desc);
   pointsize /= (double) PANGO_SCALE;
 
   mat.xx = DOUBLE_TO_16_16(1);
@@ -76,7 +78,7 @@
   mat.yx = DOUBLE_TO_16_16(0);
   mat.yy = DOUBLE_TO_16_16(1);  
   
-  FT_Face face = pango_ft2_font_get_face (pf->font);  
+  face = pango_ft2_font_get_face (pf->font);  
   FT_Set_Transform(face, &mat, NULL);
   FT_Set_Char_Size( face, 
 		    DOUBLE_TO_26_6 (pointsize),

--- jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c	30 Jul 2004 16:01:47 -0000	1.9
+++ jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c	14 Aug 2004 17:18:17 -0000
@@ -400,7 +400,6 @@
   struct graphics2d *src = NULL, *dst = NULL;
   gint s_height, s_width, d_height, d_width, height, width;
   cairo_matrix_t *matrix;
-  GdkGC *gc;
   cairo_operator_t tmp_op;
 
   gdk_threads_enter();
@@ -605,20 +604,21 @@
      negate offsets. oh well.
      
    */
-
-  double a = (x2 - x1 == 0.) ? 0. : ((cyclic ? 3.0 : 2.0) / (x2 - x1));
-  double c = (y2 - y1 == 0.) ? 0. : (1. / (y2 - y1));
-  double dx = (x1 == 0.) ? 0. : 1. / x1;
-  double dy = (y1 == 0.) ? 0. : 1. / y1;
-
-  cairo_matrix_set_affine (mat,
-			   a, 0.,
-			   c, 0.,
-			   dx, dy);
-
-  cairo_surface_set_matrix (surf, mat);
-  cairo_matrix_destroy (mat);
-  cairo_surface_set_filter (surf, CAIRO_FILTER_BILINEAR);
+  {
+    double a = (x2 - x1 == 0.) ? 0. : ((cyclic ? 3.0 : 2.0) / (x2 - x1));
+    double c = (y2 - y1 == 0.) ? 0. : (1. / (y2 - y1));
+    double dx = (x1 == 0.) ? 0. : 1. / x1;
+    double dy = (y1 == 0.) ? 0. : 1. / y1;
+    
+    cairo_matrix_set_affine (mat,
+			     a, 0.,
+			     c, 0.,
+			     dx, dy);
+    
+    cairo_surface_set_matrix (surf, mat);
+    cairo_matrix_destroy (mat);
+    cairo_surface_set_filter (surf, CAIRO_FILTER_BILINEAR);
+  }
 
   /* FIXME: repeating gradients (not to mention hold gradients) don't seem to work. */
   /*   cairo_surface_set_repeat (surf, cyclic ? 1 : 0); */
@@ -751,7 +751,7 @@
   jint i, px;
 
   gdk_threads_enter();
-  if (peer_is_disposed(env, obj)) { gdk_threads_leave(); return; }
+  if (peer_is_disposed(env, obj)) { gdk_threads_leave(); return NULL; }
 
   gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
   g_assert (gr != NULL);

Attachment: signature.asc
Description: This is a digitally signed message part


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