[gthumb] pixbuf utils: removed unused code, renamed a function
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] pixbuf utils: removed unused code, renamed a function
- Date: Sun, 19 Aug 2012 08:38:21 +0000 (UTC)
commit f114b3f88ef5d6f6a36d25fb2a3289f9105d32c1
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sun Aug 19 00:28:34 2012 +0200
pixbuf utils: removed unused code, renamed a function
extensions/cairo_io/gth-image-saver-tga.c | 2 +-
gthumb/pixbuf-io.c | 101 -----------------------------
gthumb/pixbuf-io.h | 10 ---
gthumb/pixbuf-utils.c | 15 ++++
gthumb/pixbuf-utils.h | 55 ++++++++--------
5 files changed, 44 insertions(+), 139 deletions(-)
---
diff --git a/extensions/cairo_io/gth-image-saver-tga.c b/extensions/cairo_io/gth-image-saver-tga.c
index 22002e6..8261d15 100644
--- a/extensions/cairo_io/gth-image-saver-tga.c
+++ b/extensions/cairo_io/gth-image-saver-tga.c
@@ -301,7 +301,7 @@ gth_image_saver_tga_save_image (GthImageSaver *base,
cairo_surface_t *surface;
gboolean result;
- pixbuf_type = get_pixbuf_type_from_mime_type (mime_type);
+ pixbuf_type = _gdk_pixbuf_get_type_from_mime_type (mime_type);
option_keys = g_malloc (sizeof (char *) * 2);
option_values = g_malloc (sizeof (char *) * 2);
diff --git a/gthumb/pixbuf-io.c b/gthumb/pixbuf-io.c
index 313e0f0..0af6ef1 100644
--- a/gthumb/pixbuf-io.c
+++ b/gthumb/pixbuf-io.c
@@ -33,27 +33,6 @@
#include "pixbuf-utils.h"
-#define USE_PIXBUF_LOADER 1
-
-
-char *
-get_pixbuf_type_from_mime_type (const char *mime_type)
-{
- if (mime_type == NULL)
- return NULL;
-
- if (g_str_has_prefix (mime_type, "image/x-"))
- return g_strdup (mime_type + strlen ("image/x-"));
- else if (g_str_has_prefix (mime_type, "image/"))
- return g_strdup (mime_type + strlen ("image/"));
- else
- return g_strdup (mime_type);
-}
-
-
-#ifdef USE_PIXBUF_LOADER
-
-
#define LOAD_BUFFER_SIZE (64*1024)
@@ -160,9 +139,6 @@ pixbuf_loader_size_prepared_cb (GdkPixbufLoader *loader,
}
-#endif
-
-
GthImage *
gth_pixbuf_new_from_file (GInputStream *istream,
GthFileData *file_data,
@@ -173,81 +149,6 @@ gth_pixbuf_new_from_file (GInputStream *istream,
GCancellable *cancellable,
GError **error)
{
-#ifndef USE_PIXBUF_LOADER
- GthImage *image;
- GdkPixbuf *pixbuf = NULL;
- char *path;
- gboolean scale_pixbuf;
- int original_w;
- int original_h;
-
- if (file_data == NULL) {
- if (error != NULL)
- *error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_INVALID_FILENAME, "Could not load file");
- return NULL;
- }
-
- if (original_width != NULL)
- *original_width = -1;
-
- if (original_height != NULL)
- *original_height = -1;
-
- path = g_file_get_path (file_data->file);
- if (path == NULL) {
- if (error != NULL)
- *error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_INVALID_FILENAME, "Could not load file");
- return NULL;
- }
-
- scale_pixbuf = FALSE;
- original_w = -1;
- original_h = -1;
-
- if (requested_size > 0) {
- if (gdk_pixbuf_get_file_info (path, &original_w, &original_h) == NULL) {
- original_w = -1;
- original_h = -1;
- }
- if ((original_w > requested_size) || (original_h > requested_size))
- scale_pixbuf = TRUE;
- }
-
- if (scale_pixbuf)
- pixbuf = gdk_pixbuf_new_from_file_at_scale (path,
- requested_size,
- requested_size,
- TRUE,
- error);
- else
- pixbuf = gdk_pixbuf_new_from_file (path, error);
-
- if (pixbuf != NULL) {
- GdkPixbuf *rotated;
-
- rotated = gdk_pixbuf_apply_embedded_orientation (pixbuf);
- if (rotated != NULL) {
- original_w = gdk_pixbuf_get_width (rotated);
- original_h = gdk_pixbuf_get_height (rotated);
- g_object_unref (pixbuf);
- pixbuf = rotated;
- }
- }
-
- if (original_width != NULL)
- *original_width = original_w;
- if (original_height != NULL)
- *original_height = original_h;
-
- image = gth_image_new_for_pixbuf (pixbuf);
-
- _g_object_unref (pixbuf);
- g_free (path);
-
- return image;
-
-#else
-
ScaleData scale_data;
GdkPixbufLoader *pixbuf_loader;
GdkPixbuf *pixbuf;
@@ -303,8 +204,6 @@ gth_pixbuf_new_from_file (GInputStream *istream,
_g_object_unref (pixbuf);
return image;
-
-#endif
}
diff --git a/gthumb/pixbuf-io.h b/gthumb/pixbuf-io.h
index 15eb29d..b0ca8f3 100644
--- a/gthumb/pixbuf-io.h
+++ b/gthumb/pixbuf-io.h
@@ -30,16 +30,6 @@
G_BEGIN_DECLS
-typedef GdkPixbufAnimation* (*PixbufLoader) (GthFileData *file_data,
- int requested_size,
- int *original_width,
- int *original_height,
- gpointer user_data,
- GCancellable *cancellable,
- GError **error);
-
-
-char * get_pixbuf_type_from_mime_type (const char *mime_type);
GthImage * gth_pixbuf_new_from_file (GInputStream *istream,
GthFileData *file,
int requested_size,
diff --git a/gthumb/pixbuf-utils.c b/gthumb/pixbuf-utils.c
index 7ed7975..7809a60 100644
--- a/gthumb/pixbuf-utils.c
+++ b/gthumb/pixbuf-utils.c
@@ -261,6 +261,21 @@ _gdk_pixbuf_colorshift (GdkPixbuf *dest,
}
+char *
+_gdk_pixbuf_get_type_from_mime_type (const char *mime_type)
+{
+ if (mime_type == NULL)
+ return NULL;
+
+ if (g_str_has_prefix (mime_type, "image/x-"))
+ return g_strdup (mime_type + strlen ("image/x-"));
+ else if (g_str_has_prefix (mime_type, "image/"))
+ return g_strdup (mime_type + strlen ("image/"));
+ else
+ return g_strdup (mime_type);
+}
+
+
gboolean
scale_keeping_ratio_min (int *width,
int *height,
diff --git a/gthumb/pixbuf-utils.h b/gthumb/pixbuf-utils.h
index 4241b8c..19240cd 100644
--- a/gthumb/pixbuf-utils.h
+++ b/gthumb/pixbuf-utils.h
@@ -30,33 +30,34 @@
G_BEGIN_DECLS
-GdkPixbuf * _gdk_pixbuf_new_from_cairo_context (cairo_t *cr);
-GdkPixbuf * _gdk_pixbuf_new_from_cairo_surface (cairo_surface_t *surface);
-GdkPixbuf * _gdk_pixbuf_scale_simple_safe (const GdkPixbuf *src,
- int dest_width,
- int dest_height,
- GdkInterpType interp_type);
-GdkPixbuf * _gdk_pixbuf_scale_composite (const GdkPixbuf *src,
- int dest_width,
- int dest_height,
- GdkInterpType interp_type);
-GdkPixbuf * _gdk_pixbuf_transform (GdkPixbuf *src,
- GthTransform transform);
-void _gdk_pixbuf_colorshift (GdkPixbuf *dest,
- GdkPixbuf *src,
- int shift);
-gboolean scale_keeping_ratio_min (int *width,
- int *height,
- int min_width,
- int min_height,
- int max_width,
- int max_height,
- gboolean allow_upscaling);
-gboolean scale_keeping_ratio (int *width,
- int *height,
- int max_width,
- int max_height,
- gboolean allow_upscaling);
+GdkPixbuf * _gdk_pixbuf_new_from_cairo_context (cairo_t *cr);
+GdkPixbuf * _gdk_pixbuf_new_from_cairo_surface (cairo_surface_t *surface);
+GdkPixbuf * _gdk_pixbuf_scale_simple_safe (const GdkPixbuf *src,
+ int dest_width,
+ int dest_height,
+ GdkInterpType interp_type);
+GdkPixbuf * _gdk_pixbuf_scale_composite (const GdkPixbuf *src,
+ int dest_width,
+ int dest_height,
+ GdkInterpType interp_type);
+GdkPixbuf * _gdk_pixbuf_transform (GdkPixbuf *src,
+ GthTransform transform);
+void _gdk_pixbuf_colorshift (GdkPixbuf *dest,
+ GdkPixbuf *src,
+ int shift);
+char * _gdk_pixbuf_get_type_from_mime_type (const char *mime_type);
+gboolean scale_keeping_ratio_min (int *width,
+ int *height,
+ int min_width,
+ int min_height,
+ int max_width,
+ int max_height,
+ gboolean allow_upscaling);
+gboolean scale_keeping_ratio (int *width,
+ int *height,
+ int max_width,
+ int max_height,
+ gboolean allow_upscaling);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]