vte r2379 - in trunk: . src



Author: behdad
Date: Mon Mar  9 10:20:54 2009
New Revision: 2379
URL: http://svn.gnome.org/viewvc/vte?rev=2379&view=rev

Log:
2009-03-09  Behdad Esfahbod  <behdad gnome org>

        Bug 574616 â "real" transparency not working from python bindings

        * src/vtepangocairo.c (_vte_pangocairo_destroy),
        (_vte_pangocairo_set_background_image): Better handle failure of 
        creating pixmap.

        * src/vtebg.c (vte_bg_get_pixmap): Get rid of unused mask parameter.



Modified:
   trunk/ChangeLog
   trunk/src/vtebg.c
   trunk/src/vtepangocairo.c

Modified: trunk/src/vtebg.c
==============================================================================
--- trunk/src/vtebg.c	(original)
+++ trunk/src/vtebg.c	Mon Mar  9 10:20:54 2009
@@ -555,7 +555,6 @@
 	gpointer cached;
 	GdkColormap *rcolormap;
 	GdkPixmap *pixmap;
-	GdkBitmap *mask;
 	GdkPixbuf *pixbuf;
 	char *file;
 
@@ -652,7 +651,6 @@
 	}
 
 	pixmap = NULL;
-	mask = NULL;
 	if (GDK_IS_PIXBUF(pixbuf)) {
 		/* If the image is smaller than 256x256 then tile it into a
 		 * pixbuf that is at least this large.  This is done because
@@ -661,11 +659,8 @@
 		pixbuf = _vte_bg_resize_pixbuf(pixbuf, 256, 256);
 		gdk_pixbuf_render_pixmap_and_mask_for_colormap(pixbuf,
 							       colormap,
-							       &pixmap, &mask,
+							       &pixmap, NULL,
 							       0);
-		if (mask != NULL) {
-			g_object_unref(mask);
-		}
 		g_object_unref(pixbuf);
 	}
 

Modified: trunk/src/vtepangocairo.c
==============================================================================
--- trunk/src/vtepangocairo.c	(original)
+++ trunk/src/vtepangocairo.c	Mon Mar  9 10:20:54 2009
@@ -817,6 +817,7 @@
 	}
 
 	g_slice_free (struct _vte_pangocairo_data, draw->impl_data);
+	draw->impl_data = NULL;
 }
 
 static void
@@ -864,43 +865,38 @@
 {
 	struct _vte_pangocairo_data *data = draw->impl_data;
 	GdkPixmap *pixmap;
-
-	if (type == VTE_BG_SOURCE_NONE)
-		return;
-
-	if (data->bg_pattern) {
-		cairo_pattern_destroy (data->bg_pattern);
-		data->bg_pattern = NULL;
-	}
+	cairo_pattern_t *old_pattern;
+	cairo_surface_t *surface;
+	cairo_t *cr;
 
 	pixmap = vte_bg_get_pixmap (vte_bg_get_for_screen (gtk_widget_get_screen (draw->widget)),
 				    type, pixbuf, file,
 				    color, saturation,
 				    _vte_draw_get_colormap(draw, TRUE));
 
-	if (pixmap) {
-
-		/* Ugh... We need to create a dummy cairo_t */
-		cairo_surface_t *surface;
-		cairo_t *cr;
-
-		surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 0, 0);
-		cr = cairo_create (surface);
-
-		gdk_cairo_set_source_pixmap (cr, pixmap, 0, 0);
-		data->bg_pattern = cairo_pattern_reference (cairo_get_source (cr));
+	if (!pixmap)
+		return;
 
-		cairo_destroy (cr);
-		cairo_surface_destroy (surface);
+	if (data->bg_pattern)
+		cairo_pattern_destroy (data->bg_pattern);
 
-		/* Transfer the pixmap ownership to the pattern */
-		cairo_pattern_set_user_data (data->bg_pattern,
-					     (cairo_user_data_key_t *) data,
-					     pixmap,
-					     (cairo_destroy_func_t) g_object_unref);
+	/* Ugh... We need to create a dummy cairo_t */
+	surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 0, 0);
+	cr = cairo_create (surface);
+
+	gdk_cairo_set_source_pixmap (cr, pixmap, 0, 0);
+	data->bg_pattern = cairo_pattern_reference (cairo_get_source (cr));
+
+	cairo_destroy (cr);
+	cairo_surface_destroy (surface);
+
+	/* Transfer the pixmap ownership to the pattern */
+	cairo_pattern_set_user_data (data->bg_pattern,
+				     (cairo_user_data_key_t *) data,
+				     pixmap,
+				     (cairo_destroy_func_t) g_object_unref);
 
-		cairo_pattern_set_extend (data->bg_pattern, CAIRO_EXTEND_REPEAT);
-	}
+	cairo_pattern_set_extend (data->bg_pattern, CAIRO_EXTEND_REPEAT);
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]