[gthumb] image rotation: read the orientation even when not using jpegtran
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] image rotation: read the orientation even when not using jpegtran
- Date: Sun, 28 Oct 2012 08:29:54 +0000 (UTC)
commit c81f689a5ccec461045b4f2ca0ba0ec70fbf96c6
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sun Oct 28 09:28:46 2012 +0100
image rotation: read the orientation even when not using jpegtran
extensions/image_rotation/rotation-utils.c | 23 ++++++++++++-----------
1 files changed, 12 insertions(+), 11 deletions(-)
---
diff --git a/extensions/image_rotation/rotation-utils.c b/extensions/image_rotation/rotation-utils.c
index 208d5c0..6f390e5 100644
--- a/extensions/image_rotation/rotation-utils.c
+++ b/extensions/image_rotation/rotation-utils.c
@@ -266,6 +266,8 @@ file_buffer_ready_cb (void **buffer,
gpointer user_data)
{
TransformatioData *tdata = user_data;
+ GthMetadata *metadata;
+ GthTransform orientation;
if (error != NULL) {
tdata->ready_func (error, tdata->user_data);
@@ -273,23 +275,22 @@ file_buffer_ready_cb (void **buffer,
return;
}
+ orientation = GTH_TRANSFORM_NONE;
+ metadata = (GthMetadata *) g_file_info_get_attribute_object (tdata->file_data->info, "Embedded::Image::Orientation");
+ if ((metadata != NULL) && (gth_metadata_get_raw (metadata) != NULL))
+ orientation = strtol (gth_metadata_get_raw (metadata), (char **) NULL, 10);
+ orientation = get_next_transformation (orientation, tdata->transform);
+
#ifdef HAVE_LIBJPEG
if (g_content_type_equals (gth_file_data_get_mime_type (tdata->file_data), "image/jpeg")) {
- GthMetadata *metadata;
- GthTransform current_orientation;
- void *out_buffer;
- gsize out_buffer_size;
-
- current_orientation = 1;
- metadata = (GthMetadata *) g_file_info_get_attribute_object (tdata->file_data->info, "Embedded::Image::Orientation");
- if ((metadata != NULL) && (gth_metadata_get_raw (metadata) != NULL))
- current_orientation = strtol (gth_metadata_get_raw (metadata), (char **) NULL, 10);
+ void *out_buffer;
+ gsize out_buffer_size;
if (! jpegtran (*buffer,
count,
&out_buffer,
&out_buffer_size,
- get_next_transformation (current_orientation, tdata->transform),
+ orientation,
tdata->mcu_action,
&error))
{
@@ -324,7 +325,7 @@ file_buffer_ready_cb (void **buffer,
}
surface = gth_image_get_cairo_surface (image);
- transformed = _cairo_image_surface_transform (surface, tdata->transform);
+ transformed = _cairo_image_surface_transform (surface, orientation);
gth_image_set_cairo_surface (image, transformed);
gth_image_save_to_file (image,
gth_file_data_get_mime_type (tdata->file_data),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]