? autom4te.cache
? depcomp
? eog.desktop.in
? install-sh
? missing
? mkinstalldirs
? omf.make
? scalable.patch
? scalable_too.patch
? stamp-h1
? xmldocs.make
? libeog/test-eog-job
? libeog/test-image-load
? po/.intltool-merge-cache
? po/stamp-it
Index: libeog/eog-image-private.h
===================================================================
RCS file: /cvs/gnome/eog/libeog/eog-image-private.h,v
retrieving revision 1.16
diff -u -r1.16 eog-image-private.h
--- libeog/eog-image-private.h	4 Mar 2006 01:50:51 -0000	1.16
+++ libeog/eog-image-private.h	31 May 2006 23:20:03 -0000
@@ -29,6 +29,9 @@
 	GnomeVFSFileSize bytes;
 	char *file_type;
 
+	gboolean scalable;
+	guchar *source_data; /* holds raw image data for scalable images */
+
 	guchar  *exif_chunk; /* holds EXIF raw data */
 	guint    exif_chunk_len;
 	guchar  *iptc_chunk; /* holds IPTC raw data */
Index: libeog/eog-image.c
===================================================================
RCS file: /cvs/gnome/eog/libeog/eog-image.c,v
retrieving revision 1.67
diff -u -r1.67 eog-image.c
--- libeog/eog-image.c	4 Mar 2006 01:50:51 -0000	1.67
+++ libeog/eog-image.c	31 May 2006 23:20:04 -0000
@@ -101,6 +101,11 @@
 		g_free (priv->file_type);
 		priv->file_type = NULL;
 	}
+
+	if (priv->source_data) {
+		g_free (priv->source_data);
+		priv->source_data = NULL;
+	}
 	
 	if (priv->error_message) {
 		g_free (priv->error_message);
@@ -254,6 +259,7 @@
 
 	priv->uri = NULL;
 	priv->image = NULL;
+	priv->source_data = NULL;
 	priv->thumbnail = NULL;
 	priv->width = priv->height = -1;
 	priv->modified = FALSE;
@@ -708,6 +714,7 @@
 	GdkPixbufLoader *loader;
 	GnomeVFSHandle *handle;
 	guchar *buffer;
+	guchar *source_data;
 	GnomeVFSFileSize bytes_read;
 	GnomeVFSFileSize bytes_read_total;
 	GnomeVFSResult result;
@@ -744,6 +751,7 @@
 	}
 	
 	buffer = g_new0 (guchar, READ_BUFFER_SIZE);
+	source_data = g_new0 (guchar, priv->bytes);
 	loader = gdk_pixbuf_loader_new ();
 	failed = FALSE;
 	bytes_read_total = 0;
@@ -768,6 +776,7 @@
 			break;
 		}
 
+		memcpy (source_data + bytes_read_total, buffer, bytes_read);
 		bytes_read_total += bytes_read;
 
 		if (job != NULL) {
@@ -838,6 +847,14 @@
 		format = gdk_pixbuf_loader_get_format (loader);
 		if (format != NULL) {
 			priv->file_type = gdk_pixbuf_format_get_name (format);
+			priv->scalable = gdk_pixbuf_format_is_scalable (format);
+
+			/* for scalable images, retain the raw data for use in zooming */
+			if (priv->scalable) {
+				priv->source_data = source_data;
+			} else {
+				g_free (source_data);
+			}
 		}
 #ifdef HAVE_LCMS
 		if (md_reader != NULL) {
@@ -1002,6 +1019,14 @@
 	return FALSE;
 }
 
+gboolean
+eog_image_is_scalable (EogImage *img)
+{
+	g_return_val_if_fail (EOG_IS_IMAGE (img), FALSE);
+	
+	return img->priv->scalable;
+}
+
 GdkPixbuf* 
 eog_image_get_pixbuf (EogImage *img)
 {
@@ -1779,6 +1804,14 @@
 	g_return_val_if_fail (EOG_IS_IMAGE (img), 0);
 	
 	return img->priv->bytes;
+}
+
+guchar*
+eog_image_get_source_data (EogImage *img)
+{
+	g_return_val_if_fail (EOG_IS_IMAGE (img), 0);
+	
+	return img->priv->source_data;
 }
 
 void
Index: libeog/eog-image.h
===================================================================
RCS file: /cvs/gnome/eog/libeog/eog-image.h,v
retrieving revision 1.27
diff -u -r1.27 eog-image.h
--- libeog/eog-image.h	4 Mar 2006 01:50:51 -0000	1.27
+++ libeog/eog-image.h	31 May 2006 23:20:04 -0000
@@ -107,10 +107,12 @@
 
 /* query API */
 gboolean            eog_image_is_animation                    (EogImage *img);
+gboolean            eog_image_is_scalable                     (EogImage *img);
 GdkPixbuf*          eog_image_get_pixbuf                      (EogImage *img);
 GdkPixbuf*          eog_image_get_pixbuf_thumbnail            (EogImage *img);
 void                eog_image_get_size                        (EogImage *img, int *width, int *height);
 GnomeVFSFileSize    eog_image_get_bytes                       (EogImage *img);
+guchar*             eog_image_get_source_data                 (EogImage *img);
 gboolean            eog_image_is_modified                     (EogImage *img);
 void                eog_image_modified                        (EogImage *img);
 gchar*              eog_image_get_caption                     (EogImage *img);
@@ -119,6 +121,7 @@
 GnomeVFSURI*        eog_image_get_uri                         (EogImage *img);
 gchar*              eog_image_get_uri_for_display             (EogImage *img);
 gboolean            eog_image_has_metadata                    (EogImage *img);
+
 
 #ifdef HAVE_LCMS
 cmsHPROFILE eog_image_get_profile (EogImage *img);
Index: libeog/eog-scroll-view.c
===================================================================
RCS file: /cvs/gnome/eog/libeog/eog-scroll-view.c,v
retrieving revision 1.30
diff -u -r1.30 eog-scroll-view.c
--- libeog/eog-scroll-view.c	26 Mar 2006 23:58:18 -0000	1.30
+++ libeog/eog-scroll-view.c	31 May 2006 23:20:04 -0000
@@ -72,6 +72,7 @@
 	EogImage *image;
 	guint image_changed_id;
 	GdkPixbuf *pixbuf;
+	GdkPixbuf *scaled_pixbuf;
 
 	/* zoom mode, either ZOOM_MODE_FIT or ZOOM_MODE_FREE */
 	ZoomMode zoom_mode;
@@ -125,7 +126,7 @@
 
 /*===================================
     widget size changing handler &
-        util functions
+	util functions
   ---------------------------------*/
 
 /* Disconnects from the EogImage and removes references to it */
@@ -150,6 +151,11 @@
 		g_object_unref (priv->pixbuf);
 		priv->pixbuf = NULL;
 	}
+
+	if (priv->scaled_pixbuf != NULL) {
+		g_object_unref (priv->scaled_pixbuf);
+		priv->scaled_pixbuf = NULL;
+	}
 }
 
 /* Computes the size in pixels of the scaled image */
@@ -454,6 +460,32 @@
 	}
 }
 
+static void
+rerender_vector_image(EogScrollView *view)
+{
+	EogScrollViewPrivate *priv;
+	int scaled_width, scaled_height;
+	GdkPixbufLoader *loader;
+	GError *error;
+
+	priv = view->priv;
+
+	compute_scaled_size (view, priv->zoom, &scaled_width, &scaled_height);
+	loader = gdk_pixbuf_loader_new ();
+	error = NULL;
+
+	gdk_pixbuf_loader_set_size (loader, scaled_width, scaled_height);
+	gdk_pixbuf_loader_write (loader, eog_image_get_source_data (priv->image), eog_image_get_bytes (priv->image), &error);
+	gdk_pixbuf_loader_close (loader, &error);
+
+	if (priv->scaled_pixbuf != NULL) {
+		g_object_unref (priv->scaled_pixbuf);
+	}
+
+	priv->scaled_pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
+	g_object_ref (priv->scaled_pixbuf);
+}
+
 /* Paints a rectangle of the dirty region */
 static void
 paint_rectangle (EogScrollView *view, ArtIRect *rect, GdkInterpType interp_type)
@@ -467,6 +499,7 @@
 	int check_size;
 	guint32 check_1 = 0;
 	guint32 check_2 = 0;
+	gboolean is_image_scalable;
 
 	priv = view->priv;
 
@@ -637,18 +670,26 @@
 	check_size = CHECK_MEDIUM;
 
 	/* Draw! */
-	gdk_pixbuf_composite_color (priv->pixbuf,
+	/* if the image is scalable, make sure a cached zoomed copy exists */
+	is_image_scalable = eog_image_is_scalable (priv->image);
+	if (is_image_scalable && priv->scaled_pixbuf == NULL) {
+		rerender_vector_image (view);
+	}
+
+	gdk_pixbuf_composite_color (is_image_scalable ? priv->scaled_pixbuf : priv->pixbuf,
 				    tmp,
 				    0, 0,
 				    d.x1 - d.x0, d.y1 - d.y0,
 				    -(d.x0 - xofs), -(d.y0 - yofs),
-				    priv->zoom, priv->zoom,
+				    is_image_scalable ? 1 : priv->zoom,
+				    is_image_scalable ? 1 : priv->zoom,
 				    is_unity_zoom (view) ? GDK_INTERP_NEAREST : interp_type,
 				    255,
 				    d.x0 - xofs, d.y0 - yofs,
 				    check_size,
 				    check_1, check_2);
 
+
 	gdk_draw_rgb_image_dithalign (GTK_WIDGET (priv->display)->window,
 				      GTK_WIDGET (priv->display)->style->black_gc,
 				      d.x0, d.y0,
@@ -657,7 +698,6 @@
 				      gdk_pixbuf_get_pixels (tmp),
 				      gdk_pixbuf_get_rowstride (tmp),
 				      d.x0 - xofs, d.y0 - yofs);
-
 	g_object_unref (tmp);
 }
 
@@ -995,6 +1035,7 @@
 	update_scrollbar_values (view);
 
 	/* repaint the whole image */
+	priv->scaled_pixbuf = NULL;
 	gtk_widget_queue_draw (GTK_WIDGET (priv->display));
 
 	g_signal_emit (view, view_signals [SIGNAL_ZOOM_CHANGED], 0, priv->zoom);
@@ -1031,11 +1072,7 @@
 	else if (new_zoom < MIN_ZOOM_FACTOR)
 		new_zoom = MIN_ZOOM_FACTOR;
 
-	priv->zoom = new_zoom;
-	priv->xofs = 0;
-	priv->yofs = 0;
-
-	g_signal_emit (view, view_signals [SIGNAL_ZOOM_CHANGED], 0, priv->zoom);
+	set_zoom (view, new_zoom, FALSE, 0, 0);
 }
 
 /*===================================
@@ -1527,6 +1564,11 @@
 		priv->pixbuf = 0;
 	}
 
+	if (priv->scaled_pixbuf != 0) {
+		g_object_unref (priv->scaled_pixbuf);
+		priv->scaled_pixbuf = 0;
+	}
+
 	if (GTK_WIDGET_DRAWABLE (priv->display)) {
 		gdk_window_clear (GTK_WIDGET (priv->display)->window);
 	}
@@ -1544,6 +1586,11 @@
 		priv->pixbuf = NULL;
 	}
 
+	if (priv->scaled_pixbuf != NULL) {
+		g_object_unref (priv->scaled_pixbuf);
+		priv->scaled_pixbuf = NULL;
+	}
+
 	if (GTK_WIDGET_DRAWABLE (priv->display)) {
 		gdk_window_clear (GTK_WIDGET (priv->display)->window);
 	}
@@ -1561,6 +1608,11 @@
 		priv->pixbuf = NULL;
 	}
 
+	if (priv->scaled_pixbuf != NULL) {
+	    g_object_unref (priv->scaled_pixbuf);
+	    priv->scaled_pixbuf = NULL;
+	}
+
 	priv->pixbuf = eog_image_get_pixbuf (img);
 	g_object_ref (priv->pixbuf);
 
@@ -1870,6 +1922,7 @@
 	priv->interp_type = GDK_INTERP_BILINEAR;
 	priv->image = NULL;
 	priv->pixbuf = NULL;
+	priv->scaled_pixbuf = NULL;
 	priv->progressive_state = PROGRESSIVE_NONE;
 	priv->transp_style = TRANSP_BACKGROUND;
 	priv->transp_color = 0;
