[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: cairo updates

Kaffe CVS cvs-commits at kaffe.org
Sat Jun 11 15:12:50 PDT 2005


PatchSet 6634 
Date: 2005/06/11 22:04:42
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: cairo updates

Members: 
	ChangeLog:1.4160->1.4161 
	configure:1.456->1.457 
	configure.ac:1.143->1.144 
	libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c:1.11->1.12 
	libraries/javalib/Makefile.am:1.362->1.363 
	libraries/javalib/Makefile.in:1.452->1.453 
	libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphics2D.java:1.19->1.20 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4160 kaffe/ChangeLog:1.4161
--- kaffe/ChangeLog:1.4160	Sat Jun 11 21:43:13 2005
+++ kaffe/ChangeLog	Sat Jun 11 22:04:42 2005
@@ -1,6 +1,21 @@
 2005-06-11  Dalibor Topic  <robilad at kaffe.org>
 
 	Resynced with GNU Classpath.
+	
+	2005-06-08  Thomas Fitzsimmons  <fitzsim at redhat.com>
+
+	* gnu/java/awt/peer/gtk/GdkGraphics2D.java (cairoSetRGBColor,
+	cairoSetAlpha): Combine ...
+	(cairoSetRGBAColor): New method.
+	* include/gnu_java_awt_peer_gtk_GdkGraphics2D.h: Regenerate.
+	* include/gnu_java_awt_peer_gtk_GtkImage.h: Regenerate.
+	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c: Use
+	Cairo 0.5.0 APIs.
+	* configure.ac: Require Cairo 0.5.0.
+	
+2005-06-11  Dalibor Topic  <robilad at kaffe.org>
+
+	Resynced with GNU Classpath.
 
 	2005-06-08  David Gilbert  <david.gilbert at object-refinery.com>
 
Index: kaffe/configure
diff -u kaffe/configure:1.456 kaffe/configure:1.457
--- kaffe/configure:1.456	Thu May 26 12:20:15 2005
+++ kaffe/configure	Sat Jun 11 22:04:44 2005
@@ -48345,23 +48345,23 @@
   else
      PKG_CONFIG_MIN_VERSION=0.9.0
      if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
-        echo "$as_me:$LINENO: checking for cairo" >&5
-echo $ECHO_N "checking for cairo... $ECHO_C" >&6
+        echo "$as_me:$LINENO: checking for cairo >= 0.5.0" >&5
+echo $ECHO_N "checking for cairo >= 0.5.0... $ECHO_C" >&6
 
-        if $PKG_CONFIG --exists "cairo" ; then
+        if $PKG_CONFIG --exists "cairo >= 0.5.0" ; then
             echo "$as_me:$LINENO: result: yes" >&5
 echo "${ECHO_T}yes" >&6
             succeeded=yes
 
             echo "$as_me:$LINENO: checking CAIRO_CFLAGS" >&5
 echo $ECHO_N "checking CAIRO_CFLAGS... $ECHO_C" >&6
-            CAIRO_CFLAGS=`$PKG_CONFIG --cflags "cairo"`
+            CAIRO_CFLAGS=`$PKG_CONFIG --cflags "cairo >= 0.5.0"`
             echo "$as_me:$LINENO: result: $CAIRO_CFLAGS" >&5
 echo "${ECHO_T}$CAIRO_CFLAGS" >&6
 
             echo "$as_me:$LINENO: checking CAIRO_LIBS" >&5
 echo $ECHO_N "checking CAIRO_LIBS... $ECHO_C" >&6
-            CAIRO_LIBS=`$PKG_CONFIG --libs "cairo"`
+            CAIRO_LIBS=`$PKG_CONFIG --libs "cairo >= 0.5.0"`
             echo "$as_me:$LINENO: result: $CAIRO_LIBS" >&5
 echo "${ECHO_T}$CAIRO_LIBS" >&6
         else
@@ -48369,7 +48369,7 @@
             CAIRO_LIBS=""
             ## If we have a custom action on failure, don't print errors, but
             ## do set a variable so people can do so.
-            CAIRO_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "cairo"`
+            CAIRO_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "cairo >= 0.5.0"`
             echo $CAIRO_PKG_ERRORS
         fi
 
@@ -48384,8 +48384,8 @@
   if test $succeeded = yes; then
      :
   else
-     { { echo "$as_me:$LINENO: error: Library requirements (cairo) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
-echo "$as_me: error: Library requirements (cairo) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
+     { { echo "$as_me:$LINENO: error: Library requirements (cairo >= 0.5.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
+echo "$as_me: error: Library requirements (cairo >= 0.5.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
    { (exit 1); exit 1; }; }
   fi
 
Index: kaffe/configure.ac
diff -u kaffe/configure.ac:1.143 kaffe/configure.ac:1.144
--- kaffe/configure.ac:1.143	Thu May 26 12:20:20 2005
+++ kaffe/configure.ac	Sat Jun 11 22:04:49 2005
@@ -1804,7 +1804,7 @@
 
 	if test "x${enable_gtk_cairo}" = xyes
   	then
-		PKG_CHECK_MODULES(CAIRO, cairo)
+		PKG_CHECK_MODULES(CAIRO, cairo >= 0.5.0)
     		PKG_CHECK_MODULES(PANGOFT2, pangoft2)
   	fi
   	AC_SUBST(CAIRO_LIBS)
Index: kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
diff -u kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c:1.11 kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c:1.12
--- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c:1.11	Mon Feb 14 20:01:24 2005
+++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c	Sat Jun 11 22:04:52 2005
@@ -41,6 +41,7 @@
 #include <gdk/gdktypes.h>
 #include <gdk/gdkprivate.h>
 #include <gdk/gdkx.h>
+#include <X11/extensions/Xrender.h>
 
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <gdk-pixbuf/gdk-pixdata.h>
@@ -196,7 +197,7 @@
   g_assert (gdk_pixbuf_get_bits_per_sample (gr->drawbuf) == bits_per_sample);
   g_assert (gdk_pixbuf_get_n_channels (gr->drawbuf) == total_channels);
   
-  gr->surface = cairo_surface_create_for_image ((char *) gdk_pixbuf_get_pixels (gr->drawbuf), 
+  gr->surface = cairo_image_surface_create_for_data (gdk_pixbuf_get_pixels (gr->drawbuf), 
 						CAIRO_FORMAT_ARGB32, 
 						gdk_pixbuf_get_width (gr->drawbuf), 
 						gdk_pixbuf_get_height (gr->drawbuf), 
@@ -204,7 +205,8 @@
   g_assert (gr->surface != NULL);
   g_assert (gr->cr != NULL);
   gr->mode = MODE_DRAWABLE_NO_RENDER;
-  cairo_set_target_surface (gr->cr, gr->surface);
+  cairo_destroy (gr->cr);
+  gr->cr = cairo_create (gr->surface);
 }
 
 static void
@@ -234,7 +236,8 @@
   g_assert (gr->surface != NULL);
   g_assert (gr->cr != NULL);
   gr->mode = MODE_DRAWABLE_WITH_RENDER;
-  cairo_set_target_surface (gr->cr, gr->surface);
+  cairo_destroy (gr->cr);
+  gr->cr = cairo_create (gr->surface);
 }
 
 static void
@@ -273,14 +276,15 @@
 
     case MODE_JAVA_ARRAY:
       gr->javabuf = (*env)->GetIntArrayElements (env, gr->jarray, &gr->isCopy);
-      gr->surface = cairo_surface_create_for_image ((char *) gr->javabuf, 
+      gr->surface = cairo_image_surface_create_for_data ((unsigned char *) gr->javabuf, 
 						    CAIRO_FORMAT_ARGB32, 
 						    gr->width, 
 						    gr->height, 
 						    gr->width * 4);
       g_assert(gr->surface != NULL);
       g_assert(gr->cr != NULL);
-      cairo_set_target_surface (gr->cr, gr->surface);
+      cairo_destroy (gr->cr);
+      gr->cr = cairo_create (gr->surface);
       break;
     }
 }
@@ -333,21 +337,14 @@
 static void 
 update_pattern_transform (struct graphics2d *gr)
 {
-  double a, b, c, d, tx, ty;
-  cairo_matrix_t *mat = NULL;
+  cairo_matrix_t mat;
 
   g_assert (gr != NULL);
   if (gr->pattern == NULL)
     return;
 
-  return;
-  /* temporarily disabled: ambiguous behavior */
-  /*   cairo_get_matrix (gr->cr, &a, &b, &c, &d, &tx, &ty); */
-  mat = cairo_matrix_create ();
-  g_assert (mat != NULL);
-  cairo_matrix_set_affine (mat, a, b, c, d, tx, ty);
-  cairo_pattern_set_matrix (gr->pattern, mat);
-  cairo_matrix_destroy (mat);
+  cairo_get_matrix (gr->cr, &mat);
+  cairo_pattern_set_matrix (gr->pattern, &mat);
 }
 
 static void
@@ -396,8 +393,8 @@
       g->drawable = g_old->drawable;
 
       g_object_ref (g->drawable);
-  
-      g->cr = cairo_create();
+
+      g->cr = gdk_cairo_create (g->drawable);
       g_assert (g->cr != NULL);
 
       if (x_server_has_render_extension ())
@@ -406,7 +403,7 @@
 	init_graphics2d_as_pixbuf (g);
     }
 
-  cairo_surface_set_filter (g->surface, CAIRO_FILTER_FAST);
+  cairo_pattern_set_filter (g->pattern, CAIRO_FILTER_FAST);
 
   NSA_SET_G2D_PTR (env, obj, g);
   gdk_threads_leave();
@@ -429,7 +426,7 @@
   if (gr->debug) printf ("constructing java-backed image of size (%d,%d)\n",
 			 width, height);
   
-  gr->cr = cairo_create();
+  gr->cr = gdk_cairo_create (gr->drawable);
   g_assert (gr->cr != NULL);
 
   gr->width = width;
@@ -464,7 +461,7 @@
 						 gdk_rgb_get_visual ()->depth);
   g_assert (gr->drawable != NULL);
 
-  gr->cr = cairo_create();
+  gr->cr = gdk_cairo_create (gr->drawable);
   g_assert (gr->cr != NULL);
 
   if (x_server_has_render_extension ())
@@ -484,7 +481,7 @@
 {
   struct graphics2d *src = NULL, *dst = NULL;
   gint s_height, s_width, d_height, d_width, height, width;
-  cairo_matrix_t *matrix;
+  cairo_matrix_t matrix;
   cairo_operator_t tmp_op;
 
   gdk_threads_enter();
@@ -505,19 +502,18 @@
   width = min (s_width, d_width);
   height = min (s_height, d_height);
 
-  matrix = cairo_matrix_create ();
-  cairo_surface_get_matrix (src->surface, matrix);
-  cairo_matrix_translate (matrix, (double)-x, (double)-y);
-  cairo_surface_set_matrix (src->surface, matrix);
-
-  tmp_op = cairo_current_operator (dst->cr); 
-  cairo_set_operator(dst->cr, CAIRO_OPERATOR_SRC); 
-  cairo_show_surface (dst->cr, src->surface, width, height);
+  cairo_get_matrix (src->cr, &matrix);
+  cairo_matrix_translate (&matrix, (double)-x, (double)-y);
+  cairo_pattern_set_matrix (src->pattern, &matrix);
+
+  tmp_op = cairo_get_operator (dst->cr); 
+  cairo_set_operator(dst->cr, CAIRO_OPERATOR_SOURCE); 
+  cairo_set_source_surface (dst->cr, src->surface, width, height);
+  cairo_paint (dst->cr);
   cairo_set_operator(dst->cr, tmp_op);
 
-  cairo_matrix_translate (matrix, (double)x, (double)y);
-  cairo_surface_set_matrix (src->surface, matrix);
-  cairo_matrix_destroy (matrix);
+  cairo_matrix_translate (&matrix, (double)x, (double)y);
+  cairo_pattern_set_matrix (src->pattern, &matrix);
 
   gdk_flush();
 
@@ -546,15 +542,15 @@
 
   check_for_debug (gr);
 
-  gr->cr = cairo_create();
-  g_assert (gr->cr != NULL);
-
   widget = GTK_WIDGET (ptr);
   g_assert (widget != NULL);
 
   grab_current_drawable (widget, &(gr->drawable), &(gr->win));
   g_assert (gr->drawable != NULL);
 
+  gr->cr = gdk_cairo_create (gr->drawable);
+  g_assert (gr->cr != NULL);
+
   if (x_server_has_render_extension ())
     init_graphics2d_as_renderable (gr);
   else
@@ -634,7 +630,8 @@
 {
   struct graphics2d *gr = NULL;
   cairo_surface_t *surf = NULL;
-  cairo_matrix_t *mat = NULL;
+  cairo_t *cr2 = NULL;
+  cairo_matrix_t mat;
   gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
   g_assert (gr != NULL);
 
@@ -646,38 +643,32 @@
 			 r1, g1, b1, a1, 
 			 r2, g2, b2, a2);
   
-  cairo_save (gr->cr);
-  
   if (cyclic)
     surf = cairo_surface_create_similar (gr->surface, CAIRO_FORMAT_ARGB32, 3, 2);
   else
     surf = cairo_surface_create_similar (gr->surface, CAIRO_FORMAT_ARGB32, 2, 2);      
   g_assert (surf != NULL);
 
-  cairo_set_target_surface (gr->cr, surf);
+  cr2 = cairo_create (surf);
   
-  cairo_identity_matrix (gr->cr);
+  cairo_identity_matrix (cr2);
 
-  cairo_set_rgb_color (gr->cr, r1 / 255.0, g1 / 255.0, b1 / 255.0);
-  cairo_set_alpha (gr->cr, a1 / 255.0);
-  cairo_rectangle (gr->cr, 0, 0, 1, 2);
-  cairo_fill (gr->cr);
+  cairo_set_source_rgba (cr2, r1 / 255.0, g1 / 255.0, b1 / 255.0, a1 / 255.0);
+  cairo_rectangle (cr2, 0, 0, 1, 2);
+  cairo_fill (cr2);
     
-  cairo_set_rgb_color (gr->cr, r2 / 255.0, g2 / 255.0, b2 / 255.0);
-  cairo_set_alpha (gr->cr, a2 / 255.0);
-  cairo_rectangle (gr->cr, 1, 0, 1, 2);
-  cairo_fill (gr->cr);
+  cairo_set_source_rgba (cr2, r2 / 255.0, g2 / 255.0, b2 / 255.0, a2 / 255.0);
+  cairo_rectangle (cr2, 1, 0, 1, 2);
+  cairo_fill (cr2);
 
   if (cyclic)
     {
-      cairo_set_rgb_color (gr->cr, r1 / 255.0, g1 / 255.0, b1 / 255.0);
-      cairo_set_alpha (gr->cr, a1 / 255.0);
-      cairo_rectangle (gr->cr, 2, 0, 1, 2);
-      cairo_fill (gr->cr);
+      cairo_set_source_rgba (cr2, r1 / 255.0, g1 / 255.0, b1 / 255.0, a1 / 255.0);
+      cairo_rectangle (cr2, 2, 0, 1, 2);
+      cairo_fill (cr2);
     }
 
-  mat = cairo_matrix_create ();
-  g_assert (mat != NULL);
+  cairo_matrix_init_identity (&mat);
 
   /* 
      consider the vector [x2 - x1, y2 - y1] = [p,q]
@@ -716,15 +707,16 @@
     double c = (y2 - y1 == 0.) ? 0. : (1. / (y2 - y1));
     double dx = (x1 == 0.) ? 0. : 1. / x1;
     double dy = (y1 == 0.) ? 0. : 1. / y1;
+    cairo_pattern_t *p;
     
-    cairo_matrix_set_affine (mat,
-			     a, 0.,
-			     c, 0.,
-			     dx, dy);
+    cairo_matrix_init (&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);
+    p = cairo_pattern_create_for_surface (surf);
+    cairo_pattern_set_matrix (p, &mat);
+    cairo_pattern_set_filter (p, CAIRO_FILTER_BILINEAR);
   }
 
   /* FIXME: repeating gradients (not to mention hold gradients) don't seem to work. */
@@ -743,8 +735,7 @@
   gr->pattern_surface = surf;  
   gr->pattern = cairo_pattern_create_for_surface(surf);
 
-  cairo_restore (gr->cr);    
-  cairo_set_pattern (gr->cr, gr->pattern);
+  cairo_set_source (gr->cr, gr->pattern);
   gdk_threads_leave();
 }
 
@@ -784,14 +775,14 @@
   memcpy (gr->pattern_pixels, jpixels, h * stride * 4);
   (*env)->ReleaseIntArrayElements (env, jarr, jpixels, 0);
 
-  gr->pattern_surface = cairo_surface_create_for_image (gr->pattern_pixels, 
+  gr->pattern_surface = cairo_image_surface_create_for_data ((unsigned char *)gr->pattern_pixels, 
 							CAIRO_FORMAT_ARGB32, 
 							w, h, stride * 4);
   g_assert (gr->pattern_surface != NULL);
-  cairo_surface_set_repeat (gr->pattern_surface, 1);
+  cairo_pattern_set_extend (gr->pattern, 1);
   gr->pattern = cairo_pattern_create_for_surface (gr->pattern_surface);
   g_assert (gr->pattern != NULL);
-  cairo_set_pattern (gr->cr, gr->pattern);
+  cairo_set_source (gr->cr, gr->pattern);
   gdk_threads_leave();
 }
 
@@ -822,19 +813,22 @@
   begin_drawing_operation (env, gr);
   
  {
-   cairo_matrix_t *mat = NULL;
-   cairo_surface_t *surf = cairo_surface_create_for_image ((char *)native_pixels, 
+   cairo_matrix_t mat;
+   cairo_pattern_t *p;
+   cairo_surface_t *surf = cairo_image_surface_create_for_data ((unsigned char *)native_pixels, 
 							   CAIRO_FORMAT_ARGB32, 
 							   w, h, stride * 4);   
-   mat = cairo_matrix_create ();
-   cairo_matrix_set_affine (mat, 
-			    native_matrix[0], native_matrix[1],
-			    native_matrix[2], native_matrix[3],
-			    native_matrix[4], native_matrix[5]);
-   cairo_surface_set_matrix (surf, mat);
-   cairo_surface_set_filter (surf, cairo_surface_get_filter(gr->surface));
-   cairo_show_surface (gr->cr, surf, w, h);
-   cairo_matrix_destroy (mat);
+   cairo_matrix_init_identity (&mat);
+   cairo_matrix_init (&mat, 
+                      native_matrix[0], native_matrix[1],
+                      native_matrix[2], native_matrix[3],
+                      native_matrix[4], native_matrix[5]);
+
+   p = cairo_pattern_create_for_surface (surf);
+   cairo_pattern_set_matrix (p, &mat);
+   cairo_pattern_set_filter (p, cairo_pattern_get_filter (gr->pattern));
+   cairo_set_source_surface (gr->cr, surf, w, h);
+   cairo_paint (gr->cr);
    cairo_surface_destroy (surf);
  }
   
@@ -906,13 +900,14 @@
 			 native_matrix[4], native_matrix[5]);
 
   {
-    cairo_matrix_t * mat = cairo_matrix_create ();
-    cairo_matrix_set_affine (mat, 
-			     native_matrix[0], native_matrix[1],
-			     native_matrix[2], native_matrix[3],
-			     native_matrix[4], native_matrix[5]);
-    cairo_set_matrix (gr->cr, mat);
-    cairo_matrix_destroy (mat);
+    cairo_matrix_t mat;
+
+    cairo_matrix_init_identity (&mat);
+    cairo_matrix_init (&mat, 
+                       native_matrix[0], native_matrix[1],
+                       native_matrix[2], native_matrix[3],
+                       native_matrix[4], native_matrix[5]);
+    cairo_set_matrix (gr->cr, &mat);
   }
 
   (*env)->ReleaseDoubleArrayElements (env, java_matrix, native_matrix, 0);
@@ -925,7 +920,7 @@
 		  struct peerfont *pfont,
 		  int debug)
 {
-  cairo_font_t *ft;
+  cairo_font_face_t *ft;
   FT_Face face = NULL;
 
   g_assert(cr != NULL);
@@ -936,7 +931,7 @@
       face = pango_ft2_font_get_face (pfont->font);
       g_assert (face != NULL);
       
-      ft = cairo_ft_font_create_for_ft_face (face);
+      ft = cairo_ft_font_face_create_for_ft_face (face, 0);
       g_assert (ft != NULL);
       
       if (debug) printf ("install_font_peer made new cairo font for '%s' at %f\n", 
@@ -944,19 +939,19 @@
 			 (pango_font_description_get_size (pfont->desc) / 
 			  (double)PANGO_SCALE));
     
-      cairo_set_font (cr, ft); 
-      cairo_font_destroy (ft);
-      cairo_scale_font (cr, 
+      cairo_set_font_face (cr, ft); 
+      cairo_font_face_destroy (ft);
+      cairo_set_font_size (cr, 
 			(pango_font_description_get_size (pfont->desc) / 
 			 (double)PANGO_SCALE));
-      ft = cairo_current_font (cr);
+      ft = cairo_get_font_face (cr);
       pfont->graphics_resource = ft;
     }
   else
     {
       if (debug) printf ("install_font_peer reused existing font resource\n");
-      ft = (cairo_font_t *) pfont->graphics_resource;
-      cairo_set_font (cr, ft);       
+      ft = (cairo_font_face_t *) pfont->graphics_resource;
+      cairo_set_font_face (cr, ft);       
     }
 }
 
@@ -974,7 +969,7 @@
   g_assert (pfont != NULL);
   if (pfont->graphics_resource != NULL)
     {
-      cairo_font_destroy ((cairo_font_t *) pfont->graphics_resource);
+      cairo_font_face_destroy ((cairo_font_face_t *) pfont->graphics_resource);
       pfont->graphics_resource = NULL;
     }
   gdk_threads_leave();
@@ -1164,7 +1159,7 @@
       break;
       
     case java_awt_alpha_composite_SRC: 
-      cairo_set_operator (gr->cr, CAIRO_OPERATOR_SRC);
+      cairo_set_operator (gr->cr, CAIRO_OPERATOR_SOURCE);
       break;
       
     case java_awt_alpha_composite_SRC_OVER: 
@@ -1172,7 +1167,7 @@
       break;
 
     case java_awt_alpha_composite_DST_OVER: 
-      cairo_set_operator (gr->cr, CAIRO_OPERATOR_OVER_REVERSE);
+      cairo_set_operator (gr->cr, CAIRO_OPERATOR_DEST_OVER);
       break;
 
     case java_awt_alpha_composite_SRC_IN: 
@@ -1180,7 +1175,7 @@
       break;
 
     case java_awt_alpha_composite_DST_IN: 
-      cairo_set_operator (gr->cr, CAIRO_OPERATOR_IN_REVERSE);
+      cairo_set_operator (gr->cr, CAIRO_OPERATOR_DEST_IN);
       break;
 
     case java_awt_alpha_composite_SRC_OUT: 
@@ -1188,11 +1183,11 @@
       break;
 
     case java_awt_alpha_composite_DST_OUT: 
-      cairo_set_operator (gr->cr, CAIRO_OPERATOR_OUT_REVERSE);
+      cairo_set_operator (gr->cr, CAIRO_OPERATOR_DEST_OUT);
       break;
 
     case java_awt_alpha_composite_DST: 
-      cairo_set_operator (gr->cr, CAIRO_OPERATOR_DST);
+      cairo_set_operator (gr->cr, CAIRO_OPERATOR_DEST);
       break;
 
     case java_awt_alpha_composite_SRC_ATOP: 
@@ -1200,7 +1195,7 @@
       break;
 
     case java_awt_alpha_composite_DST_ATOP: 
-      cairo_set_operator (gr->cr, CAIRO_OPERATOR_ATOP_REVERSE);
+      cairo_set_operator (gr->cr, CAIRO_OPERATOR_DEST_ATOP);
       break;
 
     case java_awt_alpha_composite_XOR: 
@@ -1211,8 +1206,8 @@
 }
 
 JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetRGBColor 
-   (JNIEnv *env, jobject obj, jdouble r, jdouble g, jdouble b)
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetRGBAColor 
+   (JNIEnv *env, jobject obj, jdouble r, jdouble g, jdouble b, jdouble a)
 {
   struct graphics2d *gr = NULL;
 
@@ -1227,33 +1222,17 @@
      draw to a PixBuf, you must exchange the R and B components of your
      color. */
 
-  if (gr->debug) printf ("cairo_set_rgb_color (%f, %f, %f)\n", r, g, b);
+  if (gr->debug) printf ("cairo_set_source_rgb (%f, %f, %f)\n", r, g, b);
 
   if (gr->drawbuf)
-    cairo_set_rgb_color (gr->cr, b, g, r);
+    cairo_set_source_rgba (gr->cr, b, g, r, a);
   else
-    cairo_set_rgb_color (gr->cr, r, g, b);
+    cairo_set_source_rgba (gr->cr, r, g, b, a);
 
   gdk_threads_leave();
 }
 
 JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetAlpha 
-   (JNIEnv *env, jobject obj, jdouble a)
-{
-  struct graphics2d *gr = NULL;
-
-  gdk_threads_enter();
-  if (peer_is_disposed(env, obj)) { gdk_threads_leave(); return; }
-
-  gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
-  g_assert (gr != NULL);
-  if (gr->debug) printf ("cairo_set_alpha %f\n", a);  
-  cairo_set_alpha (gr->cr, a);
-  gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
 Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetFillRule 
    (JNIEnv *env, jobject obj, jint rule)
 {
@@ -1581,7 +1560,7 @@
   if (gr == NULL) { gdk_threads_leave (); return; }
   if (gr->debug) printf ("cairo_clip\n");
   begin_drawing_operation (env, gr);
-  cairo_init_clip (gr->cr);
+  cairo_reset_clip (gr->cr);
   cairo_clip (gr->cr);
   end_drawing_operation (env, gr);
   gdk_threads_leave();
@@ -1602,19 +1581,19 @@
    switch ((enum java_awt_rendering_hints_filter) filter)
      {
      case java_awt_rendering_hints_VALUE_INTERPOLATION_NEAREST_NEIGHBOR:
-       cairo_surface_set_filter (gr->surface, CAIRO_FILTER_NEAREST);
+       cairo_pattern_set_filter (gr->pattern, CAIRO_FILTER_NEAREST);
        break;
      case java_awt_rendering_hints_VALUE_INTERPOLATION_BILINEAR:
-       cairo_surface_set_filter (gr->surface, CAIRO_FILTER_BILINEAR);
+       cairo_pattern_set_filter (gr->pattern, CAIRO_FILTER_BILINEAR);
        break; 
      case java_awt_rendering_hints_VALUE_ALPHA_INTERPOLATION_SPEED:
-       cairo_surface_set_filter (gr->surface, CAIRO_FILTER_FAST);
+       cairo_pattern_set_filter (gr->pattern, CAIRO_FILTER_FAST);
        break;
      case java_awt_rendering_hints_VALUE_ALPHA_INTERPOLATION_DEFAULT:
-       cairo_surface_set_filter (gr->surface, CAIRO_FILTER_NEAREST);
+       cairo_pattern_set_filter (gr->pattern, CAIRO_FILTER_NEAREST);
        break;
      case java_awt_rendering_hints_VALUE_ALPHA_INTERPOLATION_QUALITY:
-       cairo_surface_set_filter (gr->surface, CAIRO_FILTER_BEST);
+       cairo_pattern_set_filter (gr->pattern, CAIRO_FILTER_BEST);
        break;
      }
    gdk_threads_leave();
Index: kaffe/libraries/javalib/Makefile.am
diff -u kaffe/libraries/javalib/Makefile.am:1.362 kaffe/libraries/javalib/Makefile.am:1.363
--- kaffe/libraries/javalib/Makefile.am:1.362	Sat Jun 11 20:23:02 2005
+++ kaffe/libraries/javalib/Makefile.am	Sat Jun 11 22:04:52 2005
@@ -3862,6 +3862,7 @@
 	javax/swing/text/ComponentView.java \
 	javax/swing/text/DefaultCaret.java \
 	javax/swing/text/DefaultEditorKit.java \
+	javax/swing/text/DefaultFormatter.java \
 	javax/swing/text/DefaultHighlighter.java \
 	javax/swing/text/DefaultStyledDocument.java \
 	javax/swing/text/Document.java \
Index: kaffe/libraries/javalib/Makefile.in
diff -u kaffe/libraries/javalib/Makefile.in:1.452 kaffe/libraries/javalib/Makefile.in:1.453
--- kaffe/libraries/javalib/Makefile.in:1.452	Sat Jun 11 20:23:05 2005
+++ kaffe/libraries/javalib/Makefile.in	Sat Jun 11 22:04:53 2005
@@ -4438,6 +4438,7 @@
 	javax/swing/text/ComponentView.java \
 	javax/swing/text/DefaultCaret.java \
 	javax/swing/text/DefaultEditorKit.java \
+	javax/swing/text/DefaultFormatter.java \
 	javax/swing/text/DefaultHighlighter.java \
 	javax/swing/text/DefaultStyledDocument.java \
 	javax/swing/text/Document.java \
Index: kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphics2D.java
diff -u kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphics2D.java:1.19 kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphics2D.java:1.20
--- kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphics2D.java:1.19	Sat Jun 11 20:50:26 2005
+++ kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphics2D.java	Sat Jun 11 22:04:54 2005
@@ -290,8 +290,8 @@
   private native void cairoRestore();
   private native void cairoSetMatrix(double[] m);
   private native void cairoSetOperator(int cairoOperator);
-  private native void cairoSetRGBColor(double red, double green, double blue);
-  private native void cairoSetAlpha(double alpha);
+  private native void cairoSetRGBAColor(double red, double green,
+                                        double blue, double alpha);
   private native void cairoSetFillRule(int cairoFillRule);
   private native void cairoSetLineWidth(double width);
   private native void cairoSetLineCap(int cairoLineCap);
@@ -807,9 +807,8 @@
 
     fg = c;
     paint = c;
-    cairoSetRGBColor(fg.getRed() / 255.0, fg.getGreen() / 255.0,
-                     fg.getBlue() / 255.0);
-    cairoSetAlpha((fg.getAlpha() & 255) / 255.0);
+    cairoSetRGBAColor(fg.getRed() / 255.0, fg.getGreen() / 255.0,
+                      fg.getBlue() / 255.0, fg.getAlpha() / 255.0);
   }
 
   public Color getColor()
@@ -914,9 +913,8 @@
 
   public void clearRect(int x, int y, int width, int height)
   {
-    cairoSetRGBColor(bg.getRed() / 255.0, bg.getGreen() / 255.0,
-                     bg.getBlue() / 255.0);
-    cairoSetAlpha(1.0);
+    cairoSetRGBAColor(bg.getRed() / 255.0, bg.getGreen() / 255.0,
+                      bg.getBlue() / 255.0, 1.0);
     cairoNewPath();
     cairoRectangle(x, y, width, height);
     cairoFill();




More information about the kaffe mailing list