Repositioning the viewport after zoom events became quite annoying and the
internal zoom of the gtk image viewer handled it correctly already so..

-- 
Frank
diff --git a/ufraw_preview.c b/ufraw_preview.c
index fcf1589..b10a0f8 100644
--- a/ufraw_preview.c
+++ b/ufraw_preview.c
@@ -785,12 +785,19 @@ static void render_init(preview_data *data)
     int height = gdk_pixbuf_get_height(data->PreviewPixbuf);
     ufraw_image_data *image = ufraw_final_image(data->UF, FALSE);
     if (width!=image->width || height!=image->height) {
+       GdkRectangle vp;
+       gtk_image_view_get_viewport(GTK_IMAGE_VIEW(data->PreviewWidget), &vp);
+       double xc = (vp.x + vp.width / 2.0) / width * image->width;
+       double yc = (vp.y + vp.height / 2.0) / height * image->height;
        data->PreviewPixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8,
                                            image->width, image->height);
        /* Clear the pixbuffer to avoid displaying garbage */
        gdk_pixbuf_fill(data->PreviewPixbuf, 0);
        gtk_image_view_set_pixbuf(GTK_IMAGE_VIEW(data->PreviewWidget),
                data->PreviewPixbuf, FALSE);
+       /* restore the viewport */
+       gtk_image_view_set_offset(GTK_IMAGE_VIEW(data->PreviewWidget),
+               xc - vp.width / 2, yc - vp.height / 2, FALSE);
        g_object_unref(data->PreviewPixbuf);
     }
     render_status_text(data);
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
ufraw-devel mailing list
ufraw-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ufraw-devel

Reply via email to