Author: post
Date: 2010-08-19 19:16:50 +0200 (Thu, 19 Aug 2010)
New Revision: 3495

Modified:
   trunk/src/rs-actions.c
   trunk/src/rs-external-editor.c
   trunk/src/rs-external-editor.h
Log:
For "Export to GIMP", use already loaded image and filter chain. Much faster, 
uses far less RAM.
Also fixed DCP profile/WB not being properly applied to Quick Export.
Also doesn't leak everything after exporting the image.

Modified: trunk/src/rs-actions.c
===================================================================
--- trunk/src/rs-actions.c      2010-08-19 17:07:25 UTC (rev 3494)
+++ trunk/src/rs-actions.c      2010-08-19 17:16:50 UTC (rev 3495)
@@ -277,7 +277,7 @@
 {
        if (!RS_IS_PHOTO(rs->photo)) return;
 
-       if (!rs_external_editor_gimp(rs->photo, rs->current_setting))
+       if (!rs_external_editor_gimp(rs->photo, rs->filter_end, 
rs->current_setting))
        {
                GtkWidget *dialog = 
gui_dialog_make_from_text(GTK_STOCK_DIALOG_WARNING, 
                        _("Error exporting"),

Modified: trunk/src/rs-external-editor.c
===================================================================
--- trunk/src/rs-external-editor.c      2010-08-19 17:07:25 UTC (rev 3494)
+++ trunk/src/rs-external-editor.c      2010-08-19 17:16:50 UTC (rev 3495)
@@ -58,7 +58,7 @@
 #endif
 
 gboolean
-rs_external_editor_gimp(RS_PHOTO *photo, guint snapshot)
+rs_external_editor_gimp(RS_PHOTO *photo, RSFilter *prior_to_resample, guint 
snapshot)
 {
 #ifdef WIN32
        return FALSE;
@@ -81,13 +81,7 @@
         g_string_printf(filename, "%s/.rawstudio_%.0f.tif",g_get_tmp_dir(), 
g_random_double()*10000);
 
        /* Setup our filter chain for saving */
-        RSFilter *finput = rs_filter_new("RSInputImage16", NULL);
-        RSFilter *fdemosaic = rs_filter_new("RSDemosaic", finput);
-        RSFilter *flensfun = rs_filter_new("RSLensfun", fdemosaic);
-        RSFilter *ftransform_input = rs_filter_new("RSColorspaceTransform", 
flensfun);
-        RSFilter *frotate = rs_filter_new("RSRotate",ftransform_input) ;
-        RSFilter *fcrop = rs_filter_new("RSCrop", frotate);
-       RSFilter *fresample= rs_filter_new("RSResample", fcrop);
+       RSFilter *fresample= rs_filter_new("RSResample", prior_to_resample);
         RSFilter *fdcp = rs_filter_new("RSDcp", fresample);
         RSFilter *fdenoise= rs_filter_new("RSDenoise", fdcp);
         RSFilter *ftransform_display = rs_filter_new("RSColorspaceTransform", 
fdenoise);
@@ -95,57 +89,22 @@
 
         /* Set input profile */
         RSDcpFile *dcp_profile  = rs_photo_get_dcp_profile(photo);
-        RSIccProfile *icc_profile  = rs_photo_get_icc_profile(photo);
 
         if (dcp_profile != NULL)
         {
-                g_object_set(fdcp, "profile", dcp_profile, NULL);
+                g_object_set(fdcp, "profile", dcp_profile, "use-profile", 
TRUE, NULL);
         }
-        if (icc_profile != NULL)
-        {
-                RSColorSpace *icc_space = 
rs_color_space_icc_new_from_icc(icc_profile);
-                g_object_set(finput, "color-space", icc_space, NULL);
-        }
 
-        /* Look up lens */
-        RSMetadata *meta = rs_photo_get_metadata(photo);
-        RSLensDb *lens_db = rs_lens_db_get_default();
-        RSLens *lens = rs_lens_db_lookup_from_metadata(lens_db, meta);
+        g_object_set(fdcp, "settings", photo->settings[snapshot],NULL);
 
-        /* Apply lens information to RSLensfun */
-        if (lens)
-        {
-                rs_filter_set_recursive(fend,
-                                       "make", meta->make_ascii,
-                                       "model", meta->model_ascii,
-                                       "lens", lens,
-                                       "focal", (gfloat) meta->focallength,
-                                       "aperture", meta->aperture,
-                                       "tca_kr", 
photo->settings[snapshot]->tca_kr,
-                                       "tca_kb", 
photo->settings[snapshot]->tca_kb,
-                                       "vignetting", 
photo->settings[snapshot]->vignetting,
-                                       NULL);
-                g_object_unref(lens);
-        }
-
-        g_object_unref(meta);
-
-        rs_filter_set_recursive(fend,
-                               "image", photo->input_response,
-                               "angle", photo->angle,
-                               "orientation", photo->orientation,
-                               "rectangle", photo->crop,
-                               "filename", photo->filename,
-                               NULL);
-
-        rs_filter_set_recursive(fend,
-                               "settings", photo->settings[snapshot],
-                               NULL);
-
        output = rs_output_new("RSTifffile");
        g_object_set(output, "filename", filename->str, NULL);
         rs_output_execute(output, fend);
        g_object_unref(output);
+       g_object_unref(ftransform_display);
+       g_object_unref(fresample);
+       g_object_unref(fdenoise);
+       g_object_unref(fdcp);
 
        message = dbus_message_new_method_call("org.gimp.GIMP.UI",
                                                 "/org/gimp/GIMP/UI",

Modified: trunk/src/rs-external-editor.h
===================================================================
--- trunk/src/rs-external-editor.h      2010-08-19 17:07:25 UTC (rev 3494)
+++ trunk/src/rs-external-editor.h      2010-08-19 17:16:50 UTC (rev 3495)
@@ -20,6 +20,6 @@
 #ifndef RS_EXTERNAL_EDITOR_H
 #define RS_EXTERNAL_EDITOR_H
 
-extern gboolean rs_external_editor_gimp(RS_PHOTO *photo, guint snapshot);
+extern gboolean rs_external_editor_gimp(RS_PHOTO *photo, RSFilter 
*prior_to_resample, guint snapshot);
 
 #endif /* RS_EXTERNAL_EDITOR_H */


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to