[gthumb: 57/129] fixed visualization of animated gifs
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb: 57/129] fixed visualization of animated gifs
- Date: Wed, 27 Apr 2011 20:55:10 +0000 (UTC)
commit 03f7f419302ff6685e756a6e41cdb21ae04d0c04
Author: Paolo Bacchilega <paobac src gnome org>
Date: Thu Apr 21 23:08:41 2011 +0200
fixed visualization of animated gifs
extensions/file_tools/gth-file-tool-sharpen.c | 6 ++--
extensions/image_viewer/gth-image-viewer-page.c | 8 +----
gthumb/gth-image-viewer.c | 37 +++++++++++++++++++----
gthumb/gth-image-viewer.h | 7 ++++-
4 files changed, 42 insertions(+), 16 deletions(-)
---
diff --git a/extensions/file_tools/gth-file-tool-sharpen.c b/extensions/file_tools/gth-file-tool-sharpen.c
index b1971f5..0024274 100644
--- a/extensions/file_tools/gth-file-tool-sharpen.c
+++ b/extensions/file_tools/gth-file-tool-sharpen.c
@@ -250,13 +250,13 @@ apply_cb (gpointer user_data)
cairo_fill (cr);
cairo_destroy (cr);
- gth_image_viewer_set_image (preview, self->priv->destination, -1, -1);
+ gth_image_viewer_set_surface (preview, self->priv->destination, -1, -1);
cairo_surface_destroy (preview_surface);
sharpen_data_free (sharpen_data);
}
else
- gth_image_viewer_set_image (preview, self->priv->source, -1, -1);
+ gth_image_viewer_set_surface (preview, self->priv->source, -1, -1);
return FALSE;
}
@@ -324,7 +324,7 @@ gth_file_tool_sharpen_get_options (GthFileTool *base)
gth_image_viewer_set_zoom_change (GTH_IMAGE_VIEWER (self->priv->preview), GTH_ZOOM_CHANGE_KEEP_PREV);
gth_image_viewer_set_zoom (GTH_IMAGE_VIEWER (self->priv->preview), 1.0);
gth_image_viewer_enable_zoom_with_keys (GTH_IMAGE_VIEWER (self->priv->preview), FALSE);
- gth_image_viewer_set_image (GTH_IMAGE_VIEWER (self->priv->preview), self->priv->source, -1, -1);
+ gth_image_viewer_set_surface (GTH_IMAGE_VIEWER (self->priv->preview), self->priv->source, -1, -1);
image_navigator = gth_image_navigator_new (GTH_IMAGE_VIEWER (self->priv->preview));
gtk_widget_show_all (image_navigator);
gtk_box_pack_start (GTK_BOX (GET_WIDGET ("preview_hbox")), image_navigator, TRUE, TRUE, 0);
diff --git a/extensions/image_viewer/gth-image-viewer-page.c b/extensions/image_viewer/gth-image-viewer-page.c
index d44d5a7..3b1bf81 100644
--- a/extensions/image_viewer/gth-image-viewer-page.c
+++ b/extensions/image_viewer/gth-image-viewer-page.c
@@ -293,8 +293,6 @@ image_preloader_requested_ready_cb (GthImagePreloader *preloader,
GError *error,
GthImageViewerPage *self)
{
- cairo_surface_t *surface;
-
if (! _g_file_equal (requested->file, self->priv->file_data->file))
return;
@@ -305,12 +303,10 @@ image_preloader_requested_ready_cb (GthImagePreloader *preloader,
gth_viewer_page_focus (GTH_VIEWER_PAGE (self));
- surface = gth_image_get_cairo_surface (image);
gth_image_viewer_set_image (GTH_IMAGE_VIEWER (self->priv->viewer),
- surface,
+ image,
original_width,
original_height);
- cairo_surface_destroy (surface);
if (self->priv->shrink_wrap)
gth_image_viewer_page_shrink_wrap (self, TRUE);
@@ -1143,7 +1139,7 @@ _gth_image_viewer_page_set_image (GthImageViewerPage *self,
int height;
char *size;
- gth_image_viewer_set_image (GTH_IMAGE_VIEWER (self->priv->viewer), image, -1, -1);
+ gth_image_viewer_set_surface (GTH_IMAGE_VIEWER (self->priv->viewer), image, -1, -1);
file_data = gth_browser_get_current_file (GTH_BROWSER (self->priv->browser));
diff --git a/gthumb/gth-image-viewer.c b/gthumb/gth-image-viewer.c
index 50139ac..5f752d6 100644
--- a/gthumb/gth-image-viewer.c
+++ b/gthumb/gth-image-viewer.c
@@ -1680,17 +1680,17 @@ gth_image_viewer_set_pixbuf (GthImageViewer *self,
g_return_if_fail (self != NULL);
image = _cairo_image_surface_create_from_pixbuf (pixbuf);
- gth_image_viewer_set_image (self, image, original_width, original_height);
+ gth_image_viewer_set_surface (self, image, original_width, original_height);
cairo_surface_destroy (image);
}
void
-gth_image_viewer_set_image (GthImageViewer *self,
- cairo_surface_t *image,
- int original_width,
- int original_height)
+gth_image_viewer_set_surface (GthImageViewer *self,
+ cairo_surface_t *surface,
+ int original_width,
+ int original_height)
{
g_return_if_fail (self != NULL);
@@ -1699,7 +1699,7 @@ gth_image_viewer_set_image (GthImageViewer *self,
_g_clear_object (&self->priv->animation);
_g_clear_object (&self->priv->iter);
- self->priv->surface = cairo_surface_reference (image);
+ self->priv->surface = cairo_surface_reference (surface);
self->priv->is_void = (self->priv->surface == NULL);
self->priv->is_animation = FALSE;
_gth_image_viewer_set_original_size (self, original_width, original_height);
@@ -1709,6 +1709,31 @@ gth_image_viewer_set_image (GthImageViewer *self,
void
+gth_image_viewer_set_image (GthImageViewer *viewer,
+ GthImage *image,
+ int original_width,
+ int original_height)
+{
+ if (gth_image_is_animation (image)) {
+ GdkPixbufAnimation *animation;
+
+ animation = gth_image_get_pixbuf_animation (image);
+ gth_image_viewer_set_animation (viewer, animation, original_width, original_height);
+
+ g_object_unref (animation);
+ }
+ else {
+ cairo_surface_t *surface;
+
+ surface = gth_image_get_cairo_surface (image);
+ gth_image_viewer_set_surface (viewer, surface, original_width, original_height);
+
+ cairo_surface_destroy (surface);
+ }
+}
+
+
+void
gth_image_viewer_set_void (GthImageViewer *self)
{
g_return_if_fail (self != NULL);
diff --git a/gthumb/gth-image-viewer.h b/gthumb/gth-image-viewer.h
index 714984a..355178e 100644
--- a/gthumb/gth-image-viewer.h
+++ b/gthumb/gth-image-viewer.h
@@ -24,6 +24,7 @@
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
+#include "gth-image.h"
#include "gth-image-viewer-tool.h"
G_BEGIN_DECLS
@@ -161,8 +162,12 @@ void gth_image_viewer_set_pixbuf (GthImageViewer *vi
GdkPixbuf *pixbuf,
int original_width,
int original_height);
+void gth_image_viewer_set_surface (GthImageViewer *viewer,
+ cairo_surface_t *surface,
+ int original_width,
+ int original_height);
void gth_image_viewer_set_image (GthImageViewer *viewer,
- cairo_surface_t *image,
+ GthImage *image,
int original_width,
int original_height);
void gth_image_viewer_set_better_quality (GthImageViewer *viewer,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]