[Goodies-commits] r2468 - ristretto/trunk/src

Stephan Arts stephan at xfce.org
Mon Jan 29 10:19:31 CET 2007


Author: stephan
Date: 2007-01-29 09:19:31 +0000 (Mon, 29 Jan 2007)
New Revision: 2468

Modified:
   ristretto/trunk/src/picture_viewer.c
Log:
fixed image placing and realization-bug

Modified: ristretto/trunk/src/picture_viewer.c
===================================================================
--- ristretto/trunk/src/picture_viewer.c	2007-01-29 07:41:10 UTC (rev 2467)
+++ ristretto/trunk/src/picture_viewer.c	2007-01-29 09:19:31 UTC (rev 2468)
@@ -86,7 +86,7 @@
 	viewer->dst_pixbuf = NULL;
 	gtk_widget_set_redraw_on_allocate(GTK_WIDGET(viewer), TRUE);
 
-	viewer->scale = 12;
+	viewer->scale = 0.2;
 
 	//viewer->src_pixbuf = gdk_pixbuf_new_from_file("test.svg", NULL);
 	viewer->src_pixbuf = gdk_pixbuf_new_from_file("test.png", NULL);
@@ -253,18 +253,21 @@
 {
 	GdkPixbuf *pixbuf = RSTTO_PICTURE_VIEWER(widget)->dst_pixbuf;
 	/* required for transparent pixbufs... add double buffering to fix flickering*/
-	gdk_window_clear(widget->window);
-	gdk_draw_pixbuf(GDK_DRAWABLE(widget->window), 
-	                NULL, 
-									pixbuf,
-									0,
-									0,
-									(widget->allocation.width-gdk_pixbuf_get_width(pixbuf))<0?0:(widget->allocation.width-gdk_pixbuf_get_width(pixbuf))/2,
-									(widget->allocation.height-gdk_pixbuf_get_width(pixbuf))<0?0:(widget->allocation.width-gdk_pixbuf_get_width(pixbuf))/2,
-									gdk_pixbuf_get_width(pixbuf),
-									gdk_pixbuf_get_height(pixbuf),
-									GDK_RGB_DITHER_NONE,
-									0,0);
+	if(GTK_WIDGET_REALIZED(widget))
+	{
+		gdk_window_clear(widget->window);
+		gdk_draw_pixbuf(GDK_DRAWABLE(widget->window), 
+										NULL, 
+										pixbuf,
+										0,
+										0,
+										(widget->allocation.width-gdk_pixbuf_get_width(pixbuf))<0?0:(widget->allocation.width-gdk_pixbuf_get_width(pixbuf))/2,
+										(widget->allocation.height-gdk_pixbuf_get_height(pixbuf))<0?0:(widget->allocation.height-gdk_pixbuf_get_height(pixbuf))/2,
+										gdk_pixbuf_get_width(pixbuf),
+										gdk_pixbuf_get_height(pixbuf),
+										GDK_RGB_DITHER_NONE,
+										0,0);
+	}
 }
 
 static void




More information about the Goodies-commits mailing list