Author: abrander
Date: 2009-10-14 14:46:08 +0200 (Wed, 14 Oct 2009)
New Revision: 2714

Modified:
   trunk/src/application.c
   trunk/src/rs-batch.c
   trunk/src/rs-save-dialog.c
Log:
Ported some obvious places to rs_filter_set_recursive().

Modified: trunk/src/application.c
===================================================================
--- trunk/src/application.c     2009-10-14 12:39:07 UTC (rev 2713)
+++ trunk/src/application.c     2009-10-14 12:46:08 UTC (rev 2714)
@@ -79,7 +79,7 @@
                /* Apply lens information to RSLensfun */
                if (lens)
                {
-                       g_object_set(rs->filter_lensfun,
+                       rs_filter_set_recursive(rs->filter_end,
                                "make", meta->make_ascii,
                                "model", meta->model_ascii,
                                "lens", lens,
@@ -88,18 +88,17 @@
                                NULL);
                        g_object_unref(lens);
                }
-               g_object_set(rs->filter_input,
+
+               g_object_unref(meta);
+
+               rs_filter_set_recursive(rs->filter_end,
                        "image", rs->photo->input,
                        "filename", rs->photo->filename,
+                       "rectangle", rs_photo_get_crop(photo),
+                       "angle", rs_photo_get_angle(photo),
+                       "orientation", rs->photo->orientation,
                        NULL);
 
-               g_object_unref(meta);
-
-               /* Update crop and rotate filters */
-               g_object_set(rs->filter_crop, "rectangle", 
rs_photo_get_crop(photo), NULL);
-               g_object_set(rs->filter_rotate, "angle", 
rs_photo_get_angle(photo), "orientation", rs->photo->orientation, NULL);
-               g_object_set(rs->filter_rotate, "angle", 
rs_photo_get_angle(photo), NULL);
-
                g_signal_connect(G_OBJECT(rs->photo), "spatial-changed", 
G_CALLBACK(photo_spatial_changed), rs);
        }
 }
@@ -110,9 +109,11 @@
        if (photo == rs->photo)
        {
                /* Update crop and rotate filters */
-               g_object_set(rs->filter_crop, "rectangle", 
rs_photo_get_crop(photo), NULL);
-               g_object_set(rs->filter_rotate, "angle", 
rs_photo_get_angle(photo), "orientation", rs->photo->orientation, NULL);
-               g_object_set(rs->filter_rotate, "angle", 
rs_photo_get_angle(photo), NULL);
+               rs_filter_set_recursive(rs->filter_end,
+                       "rectangle", rs_photo_get_crop(photo),
+                       "angle", rs_photo_get_angle(photo),
+                       "orientation", rs->photo->orientation,
+                       NULL);
        }
 
 }
@@ -136,14 +137,17 @@
        RSFilter *fbasic_render = rs_filter_new("RSBasicRender", fdenoise);
        RSFilter *fend = fbasic_render;
 
-       g_object_set(finput, "image", photo->input, "filename", 
photo->filename, NULL);
-       g_object_set(frotate, "angle", photo->angle, "orientation", 
photo->orientation, NULL);
-       g_object_set(fcrop, "rectangle", photo->crop, NULL);
+       rs_filter_set_recursive(fend,
+               "image", photo->input,
+               "filename", photo->filename,
+               "angle", photo->angle,
+               "orientation", photo->orientation,
+               "rectangle", photo->crop,
+               "settings", photo->settings[snapshot],
+               NULL);
        actual_scale = ((gdouble) width / (gdouble) 
rs_filter_get_width(finput));
        if (0 < width && 0 < height) /* We only wan't to set width and height 
if they are not -1 */
-               g_object_set(fresample, "width", width, "height", height, NULL);
-       g_object_set(fbasic_render, "settings", photo->settings[snapshot], 
NULL);
-       g_object_set(fdenoise, "settings", photo->settings[snapshot], NULL);
+               rs_filter_set_recursive(fend, "width", width, "height", height, 
NULL);
 
        /* Set input ICC profile */
        profile_filename = rs_conf_get_cms_profile(CMS_PROFILE_INPUT);

Modified: trunk/src/rs-batch.c
===================================================================
--- trunk/src/rs-batch.c        2009-10-14 12:39:07 UTC (rev 2713)
+++ trunk/src/rs-batch.c        2009-10-14 12:46:08 UTC (rev 2714)
@@ -511,16 +511,19 @@
                        g_string_append(filename, 
rs_output_get_extension(queue->output));
                        parsed_filename = filename_parse(filename->str, 
filename_in, setting_id);
 
-                       g_object_set(finput, "image", photo->input, "filename", 
photo->filename, NULL);
-                       g_object_set(frotate, "angle", photo->angle, 
"orientation", photo->orientation, NULL);
-                       g_object_set(fcrop, "rectangle", photo->crop, NULL);
-                       g_object_set(fbasic_render, "settings", 
photo->settings[setting_id], NULL);
+                       rs_filter_set_recursive(fend,
+                               "image", photo->input,
+                               "filename", photo->filename,
+                               "settings", photo->settings[setting_id],
+                               "angle", photo->angle,
+                               "orientation", photo->orientation,
+                               "rectangle", photo->crop,
+                               "settings", photo->settings[setting_id],
+                               "bounding-box", TRUE,
+                               "width", 250,
+                               "height", 250,
+                               NULL);
 
-                       width = rs_filter_get_width(fcrop);
-                       height = rs_filter_get_height(fcrop);
-                       rs_constrain_to_bounding_box(250, 250, &width, &height);
-                       g_object_set(fresample, "width", width, "height", 
height, NULL);
-
                        /* Render preview image */
                        filter_response = rs_filter_get_image8(fend, NULL);
                        pixbuf = rs_filter_response_get_image8(filter_response);
@@ -563,8 +566,10 @@
                                        
rs_constrain_to_bounding_box(queue->width, queue->height, &width, &height);
                                        break;
                        }
-                       g_object_set(fresample, "width", width, "height", 
height, NULL);
-                       g_object_set(fdenoise, "settings", 
photo->settings[setting_id], NULL);
+                       g_object_set(fend,
+                               "width", width,
+                               "height", height,
+                               NULL);
 
                        /* Save the image */
                        g_object_set(queue->output, "filename", 
parsed_filename, NULL);

Modified: trunk/src/rs-save-dialog.c
===================================================================
--- trunk/src/rs-save-dialog.c  2009-10-14 12:39:07 UTC (rev 2713)
+++ trunk/src/rs-save-dialog.c  2009-10-14 12:46:08 UTC (rev 2714)
@@ -153,6 +153,7 @@
        dialog->filter_resample = rs_filter_new("RSResample", 
dialog->filter_crop);
        dialog->filter_denoise = rs_filter_new("RSDenoise", 
dialog->filter_resample);
        dialog->filter_basic_render = rs_filter_new("RSBasicRender", 
dialog->filter_denoise);
+       dialog->filter_end = dialog->filter_basic_render;
 
        RSIccProfile *profile;
        gchar *filename;
@@ -197,12 +198,14 @@
        g_assert(RS_IS_PHOTO(photo));
 
        /* This should be enough to calculate "original" size */
-       g_object_set(dialog->filter_input, "image", photo->input, NULL);
-       g_object_set(dialog->filter_rotate, "angle", photo->angle, 
"orientation", photo->orientation, NULL);
-       g_object_set(dialog->filter_crop, "rectangle", photo->crop, NULL);
+       rs_filter_set_recursive(dialog->filter_end, 
+               "image", photo->input,
+               "angle", photo->angle,
+               "orientation", photo->orientation,
+               "rectangle", photo->crop,
+               "filename", photo->filename,
+               NULL);
 
-       g_object_set(dialog->filter_input, "filename", photo->filename, NULL);
-
        if (dialog->photo)
                g_object_unref(dialog->photo);
        dialog->photo = g_object_ref(photo);
@@ -247,9 +250,11 @@
 
        actual_scale = ((gdouble) dialog->save_width / (gdouble) 
rs_filter_get_width(dialog->filter_crop));
 
-       g_object_set(dialog->filter_resample, "width", dialog->save_width, 
"height", dialog->save_height, NULL);
-       g_object_set(dialog->filter_basic_render, "settings", 
dialog->photo->settings[dialog->snapshot], NULL);
-       g_object_set(dialog->filter_denoise, "settings", 
dialog->photo->settings[dialog->snapshot], NULL);
+       rs_filter_set_recursive(dialog->filter_end,
+               "width", dialog->save_width,
+               "height", dialog->save_height,
+               "settings", dialog->photo->settings[dialog->snapshot],
+               NULL);
 
        g_object_set(dialog->output, "filename", 
gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog->chooser)), NULL);
        rs_output_execute(dialog->output, dialog->filter_basic_render);


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

Reply via email to