[gthumb: 45/129] enhance tool: move data initialization in the thread
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb: 45/129] enhance tool: move data initialization in the thread
- Date: Wed, 27 Apr 2011 20:54:10 +0000 (UTC)
commit c29bf08dfa32473e41858b2bb09a287fc82b644b
Author: Paolo Bacchilega <paobac src gnome org>
Date: Tue Apr 19 13:19:08 2011 +0200
enhance tool: move data initialization in the thread
extensions/file_tools/gth-file-tool-enhance.c | 40 +++++++++++++------------
1 files changed, 21 insertions(+), 19 deletions(-)
---
diff --git a/extensions/file_tools/gth-file-tool-enhance.c b/extensions/file_tools/gth-file-tool-enhance.c
index 2072a8c..590a9d1 100644
--- a/extensions/file_tools/gth-file-tool-enhance.c
+++ b/extensions/file_tools/gth-file-tool-enhance.c
@@ -113,26 +113,7 @@ static void
enhance_before (GthAsyncTask *task,
gpointer user_data)
{
- EnhanceData *enhance_data = user_data;
- int channel;
-
gth_task_progress (GTH_TASK (task), _("White balance correction"), NULL, TRUE, 0.0);
-
- enhance_data->histogram = gth_histogram_new ();
- gth_histogram_calculate_for_image (enhance_data->histogram, enhance_data->source);
-
- enhance_data->levels = g_new0 (Levels, 1);
-
- for (channel = 0; channel < GTH_HISTOGRAM_N_CHANNELS; channel++) {
- enhance_data->levels->gamma[channel] = 1.0;
- enhance_data->levels->low_input[channel] = 0;
- enhance_data->levels->high_input[channel] = 255;
- enhance_data->levels->low_output[channel] = 0;
- enhance_data->levels->high_output[channel] = 255;
- }
-
- for (channel = 1; channel < GTH_HISTOGRAM_N_CHANNELS - 1; channel++)
- levels_channel_auto (enhance_data->levels, enhance_data->histogram, channel);
}
@@ -194,6 +175,7 @@ enhance_exec (GthAsyncTask *task,
gpointer user_data)
{
EnhanceData *enhance_data = user_data;
+ int channel;
cairo_format_t format;
int width;
int height;
@@ -209,6 +191,25 @@ enhance_exec (GthAsyncTask *task,
int x, y;
unsigned char red, green, blue, alpha;
+ /* initialize some extra data */
+
+ enhance_data->histogram = gth_histogram_new ();
+ gth_histogram_calculate_for_image (enhance_data->histogram, enhance_data->source);
+
+ enhance_data->levels = g_new0 (Levels, 1);
+ for (channel = 0; channel < GTH_HISTOGRAM_N_CHANNELS; channel++) {
+ enhance_data->levels->gamma[channel] = 1.0;
+ enhance_data->levels->low_input[channel] = 0;
+ enhance_data->levels->high_input[channel] = 255;
+ enhance_data->levels->low_output[channel] = 0;
+ enhance_data->levels->high_output[channel] = 255;
+ }
+
+ for (channel = 1; channel < GTH_HISTOGRAM_N_CHANNELS - 1; channel++)
+ levels_channel_auto (enhance_data->levels, enhance_data->histogram, channel);
+
+ /* convert the image */
+
format = cairo_image_surface_get_format (enhance_data->source);
width = cairo_image_surface_get_width (enhance_data->source);
height = cairo_image_surface_get_height (enhance_data->source);
@@ -261,6 +262,7 @@ enhance_after (GthAsyncTask *task,
g_object_unref (enhance_data->histogram);
enhance_data->histogram = NULL;
+
g_free (enhance_data->levels);
enhance_data->levels = NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]