[gthumb] resize image: clear the metadata after resizing
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] resize image: clear the metadata after resizing
- Date: Sat, 9 Nov 2013 20:00:47 +0000 (UTC)
commit ef163c3041b2fcac269dffc12366083e1cad511f
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sun Oct 6 18:11:13 2013 +0200
resize image: clear the metadata after resizing
extensions/file_tools/gth-file-tool-resize.c | 1 +
gthumb/cairo-utils.c | 27 +++++++++++++++++++++----
gthumb/cairo-utils.h | 1 +
3 files changed, 24 insertions(+), 5 deletions(-)
---
diff --git a/extensions/file_tools/gth-file-tool-resize.c b/extensions/file_tools/gth-file-tool-resize.c
index 72e1d52..fb55cc3 100644
--- a/extensions/file_tools/gth-file-tool-resize.c
+++ b/extensions/file_tools/gth-file-tool-resize.c
@@ -183,6 +183,7 @@ resize_task_exec (GthAsyncTask *task,
self->priv->new_height,
(self->priv->high_quality ? SCALE_FILTER_BEST :
SCALE_FILTER_FAST),
task);
+ _cairo_image_surface_clear_metadata (destination);
gth_image_task_set_destination_surface (GTH_IMAGE_TASK (task), destination);
cairo_surface_destroy (destination);
diff --git a/gthumb/cairo-utils.c b/gthumb/cairo-utils.c
index 807d659..ae27f36 100644
--- a/gthumb/cairo-utils.c
+++ b/gthumb/cairo-utils.c
@@ -120,6 +120,17 @@ _cairo_image_surface_flush_and_get_data (cairo_surface_t *surface)
}
+static void
+_cairo_surface_metadata_init (cairo_surface_metadata_t *metadata)
+{
+ metadata->has_alpha = FALSE;
+ metadata->original_width = 0;
+ metadata->original_height = 0;
+ metadata->thumbnail.image_width = 0;
+ metadata->thumbnail.image_height = 0;
+}
+
+
cairo_surface_metadata_t *
_cairo_image_surface_get_metadata (cairo_surface_t *surface)
{
@@ -128,11 +139,7 @@ _cairo_image_surface_get_metadata (cairo_surface_t *surface)
metadata = cairo_surface_get_user_data (surface, &surface_metadata_key);
if (metadata == NULL) {
metadata = g_new0 (cairo_surface_metadata_t, 1);
- metadata->has_alpha = FALSE;
- metadata->original_width = 0;
- metadata->original_height = 0;
- metadata->thumbnail.image_width = 0;
- metadata->thumbnail.image_height = 0;
+ _cairo_surface_metadata_init (metadata);
cairo_surface_set_user_data (surface, &surface_metadata_key, metadata, surface_metadata_free);
}
@@ -159,6 +166,16 @@ _cairo_image_surface_copy_metadata (cairo_surface_t *src,
}
+void
+_cairo_image_surface_clear_metadata (cairo_surface_t *surface)
+{
+ cairo_surface_metadata_t *metadata;
+
+ metadata = _cairo_image_surface_get_metadata (surface);
+ _cairo_surface_metadata_init (metadata);
+}
+
+
gboolean
_cairo_image_surface_get_has_alpha (cairo_surface_t *surface)
{
diff --git a/gthumb/cairo-utils.h b/gthumb/cairo-utils.h
index 521f310..84ca643 100644
--- a/gthumb/cairo-utils.h
+++ b/gthumb/cairo-utils.h
@@ -169,6 +169,7 @@ cairo_surface_metadata_t *
_cairo_image_surface_get_metadata (cairo_surface_t *surface);
void _cairo_image_surface_copy_metadata (cairo_surface_t *src,
cairo_surface_t *dest);
+void _cairo_image_surface_clear_metadata (cairo_surface_t *surface);
gboolean _cairo_image_surface_get_has_alpha (cairo_surface_t *surface);
gboolean _cairo_image_surface_get_original_size (cairo_surface_t *surface,
int *original_width,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]