/*
- * Geeqie
- * (C) 2004 John Ellis
- * Copyright (C) 2008 The Geeqie Team
+ * Copyright (C) 2004 John Ellis
+ * Copyright (C) 2008 - 2016 The Geeqie Team
*
* Author: John Ellis
*
- * This software is released under the GNU General Public License (GNU GPL).
- * Please read the included file COPYING for more information.
- * This software comes with no warranty of any kind, use at your own risk!
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
#include "main.h"
#include "thumb.h"
#include "cache.h"
-#include "debug.h"
#include "image-load.h"
-#include "filelist.h"
+#include "filedata.h"
#include "pixbuf_util.h"
#include "thumb_standard.h"
#include "ui_fileops.h"
+#include "exif.h"
+#include "metadata.h"
#include <utime.h>
static void thumb_loader_error_cb(ImageLoader *il, gpointer data);
-static void thumb_loader_setup(ThumbLoader *tl, gchar *path);
+static void thumb_loader_setup(ThumbLoader *tl, FileData *fd);
-static gint normalize_thumb(gint *width, gint *height, gint max_w, gint max_h);
static GdkPixbuf *get_xv_thumbnail(gchar *thumb_filename, gint max_w, gint max_h);
*-----------------------------------------------------------------------------
*/
-static gint thumb_loader_save_to_cache(ThumbLoader *tl)
+/* Save thumbnail to disk
+ * or just mark failed thumbnail with 0 byte file (mark_failure = TRUE) */
+static gboolean thumb_loader_save_thumbnail(ThumbLoader *tl, gboolean mark_failure)
{
gchar *cache_dir;
- gint success = FALSE;
+ gboolean success = FALSE;
mode_t mode = 0755;
- if (!tl || !tl->pixbuf) return FALSE;
+ if (!tl || !tl->fd) return FALSE;
+ if (!mark_failure && !tl->fd->thumb_pixbuf) return FALSE;
- cache_dir = cache_get_location(CACHE_TYPE_THUMB, tl->path, FALSE, &mode);
+ cache_dir = cache_get_location(CACHE_TYPE_THUMB, tl->fd->path, FALSE, &mode);
- if (cache_ensure_dir_exists(cache_dir, mode))
+ if (recursive_mkdir_if_not_exists(cache_dir, mode))
{
gchar *cache_path;
gchar *pathl;
+ gchar *name = g_strconcat(filename_from_path(tl->fd->path), GQ_CACHE_EXT_THUMB, NULL);
- cache_path = g_strconcat(cache_dir, "/", filename_from_path(tl->path),
- GQ_CACHE_EXT_THUMB, NULL);
-
- DEBUG_1("Saving thumb: %s", cache_path);
+ cache_path = g_build_filename(cache_dir, name, NULL);
+ g_free(name);
pathl = path_from_utf8(cache_path);
- success = pixbuf_to_file_as_png(tl->pixbuf, pathl);
- if (success)
+
+ if (mark_failure)
{
- struct utimbuf ut;
- /* set thumb time to that of source file */
+ FILE *f = fopen(pathl, "w"); ;
- ut.actime = ut.modtime = filetime(tl->path);
- if (ut.modtime > 0)
+ DEBUG_1("Marking thumb failure: %s", cache_path);
+ if (f)
{
- utime(pathl, &ut);
+ fclose(f);
+ success = TRUE;
}
}
else
{
- DEBUG_1("Saving failed: %s", pathl);
+ DEBUG_1("Saving thumb: %s", cache_path);
+ success = pixbuf_to_file_as_png(tl->fd->thumb_pixbuf, pathl);
}
- g_free(pathl);
- g_free(cache_path);
- }
-
- g_free(cache_dir);
-
- return success;
-}
-
-static gint thumb_loader_mark_failure(ThumbLoader *tl)
-{
- gchar *cache_dir;
- gint success = FALSE;
- mode_t mode = 0755;
-
- if (!tl) return FALSE;
-
- cache_dir = cache_get_location(CACHE_TYPE_THUMB, tl->path, FALSE, &mode);
-
- if (cache_ensure_dir_exists(cache_dir, mode))
- {
- gchar *cache_path;
- gchar *pathl;
- FILE *f;
-
- cache_path = g_strconcat(cache_dir, "/", filename_from_path(tl->path),
- GQ_CACHE_EXT_THUMB, NULL);
-
- DEBUG_1("marking thumb failure: %s", cache_path);
-
- pathl = path_from_utf8(cache_path);
- f = fopen(pathl, "w");
- if (f)
+ if (success)
{
struct utimbuf ut;
+ /* set thumb time to that of source file */
- fclose(f);
-
- ut.actime = ut.modtime = filetime(tl->path);
+ ut.actime = ut.modtime = filetime(tl->fd->path);
if (ut.modtime > 0)
{
utime(pathl, &ut);
}
-
- success = TRUE;
+ }
+ else
+ {
+ DEBUG_1("Saving failed: %s", pathl);
}
g_free(pathl);
}
g_free(cache_dir);
+
return success;
}
if (tl->func_progress) tl->func_progress(tl, tl->data);
}
+static void thumb_loader_set_fallback(ThumbLoader *tl)
+{
+ if (tl->fd->thumb_pixbuf) g_object_unref(tl->fd->thumb_pixbuf);
+ tl->fd->thumb_pixbuf = pixbuf_fallback(tl->fd, tl->max_w, tl->max_h);
+}
+
static void thumb_loader_done_cb(ImageLoader *il, gpointer data)
{
ThumbLoader *tl = data;
GdkPixbuf *pixbuf;
gint pw, ph;
gint save;
+ GdkPixbuf *rotated = NULL;
- DEBUG_1("thumb done: %s", tl->path);
+ DEBUG_1("thumb done: %s", tl->fd->path);
pixbuf = image_loader_get_pixbuf(tl->il);
if (!pixbuf)
{
- DEBUG_1("...but no pixbuf: %s", tl->path);
+ DEBUG_1("...but no pixbuf: %s", tl->fd->path);
thumb_loader_error_cb(tl->il, tl);
return;
}
+
+ if (!tl->cache_hit && options->image.exif_rotate_enable)
+ {
+ if (!tl->fd->exif_orientation)
+ {
+ tl->fd->exif_orientation = metadata_read_int(tl->fd, ORIENTATION_KEY, EXIF_ORIENTATION_TOP_LEFT);
+ }
+
+ if (tl->fd->exif_orientation != EXIF_ORIENTATION_TOP_LEFT)
+ {
+ rotated = pixbuf_apply_orientation(pixbuf, tl->fd->exif_orientation);
+ pixbuf = rotated;
+ }
+ }
+
pw = gdk_pixbuf_get_width(pixbuf);
ph = gdk_pixbuf_get_height(pixbuf);
if (tl->cache_hit && pw != tl->max_w && ph != tl->max_h)
{
/* requested thumbnail size may have changed, load original */
- DEBUG_1("thumbnail size mismatch, regenerating: %s", tl->path);
+ DEBUG_1("thumbnail size mismatch, regenerating: %s", tl->fd->path);
tl->cache_hit = FALSE;
- thumb_loader_setup(tl, tl->path);
+ thumb_loader_setup(tl, tl->fd);
+
+ g_signal_connect(G_OBJECT(tl->il), "done", (GCallback)thumb_loader_done_cb, tl);
- if (!image_loader_start(tl->il, thumb_loader_done_cb, tl))
+ if (!image_loader_start(tl->il))
{
image_loader_free(tl->il);
tl->il = NULL;
- DEBUG_1("regeneration failure: %s", tl->path);
+ DEBUG_1("regeneration failure: %s", tl->fd->path);
thumb_loader_error_cb(tl->il, tl);
}
return;
{
gint w, h;
- if (((double)tl->max_w / pw) < ((double)tl->max_h / ph))
+ if (((gdouble)tl->max_w / pw) < ((gdouble)tl->max_h / ph))
{
w = tl->max_w;
- h = (double)w / pw * ph;
+ h = (gdouble)w / pw * ph;
if (h < 1) h = 1;
}
else
{
h = tl->max_h;
- w = (double)h / ph * pw;
+ w = (gdouble)h / ph * pw;
if (w < 1) w = 1;
}
- tl->pixbuf = gdk_pixbuf_scale_simple(pixbuf, w, h, (GdkInterpType)options->thumbnails.quality);
+ if (tl->fd)
+ {
+ if (tl->fd->thumb_pixbuf) g_object_unref(tl->fd->thumb_pixbuf);
+ tl->fd->thumb_pixbuf = gdk_pixbuf_scale_simple(pixbuf, w, h, (GdkInterpType)options->thumbnails.quality);
+ }
save = TRUE;
}
else
{
- tl->pixbuf = pixbuf;
- gdk_pixbuf_ref(tl->pixbuf);
- save = il->shrunk;
+ if (tl->fd)
+ {
+ if (tl->fd->thumb_pixbuf) g_object_unref(tl->fd->thumb_pixbuf);
+ tl->fd->thumb_pixbuf = pixbuf;
+
+ g_object_ref(tl->fd->thumb_pixbuf);
+ }
+ save = image_loader_get_shrunk(il);
}
+ if (rotated) g_object_unref(rotated);
+
/* save it ? */
if (tl->cache_enable && save)
{
- thumb_loader_save_to_cache(tl);
+ thumb_loader_save_thumbnail(tl, FALSE);
}
if (tl->func_done) tl->func_done(tl, tl->data);
return;
}
- DEBUG_1("thumb error: %s", tl->path);
+ DEBUG_1("thumb error: %s", tl->fd->path);
image_loader_free(tl->il);
tl->il = NULL;
+ thumb_loader_set_fallback(tl);
+
if (tl->func_error) tl->func_error(tl, tl->data);
}
-static gint thumb_loader_done_delay_cb(gpointer data)
+static gboolean thumb_loader_done_delay_cb(gpointer data)
{
ThumbLoader *tl = data;
- tl->idle_done_id = -1;
+ tl->idle_done_id = 0;
if (tl->func_done) tl->func_done(tl, tl->data);
static void thumb_loader_delay_done(ThumbLoader *tl)
{
- if (tl->idle_done_id == -1) tl->idle_done_id = g_idle_add(thumb_loader_done_delay_cb, tl);
+ if (!tl->idle_done_id) tl->idle_done_id = g_idle_add(thumb_loader_done_delay_cb, tl);
}
-static void thumb_loader_setup(ThumbLoader *tl, gchar *path)
+static void thumb_loader_setup(ThumbLoader *tl, FileData *fd)
{
image_loader_free(tl->il);
- tl->il = image_loader_new(file_data_new_simple(path));
+ tl->il = image_loader_new(fd);
+ image_loader_set_priority(tl->il, G_PRIORITY_LOW);
- if (options->thumbnails.fast)
- {
- /* this will speed up jpegs by up to 3x in some cases */
- image_loader_set_requested_size(tl->il, tl->max_w, tl->max_h);
- }
+ /* this will speed up jpegs by up to 3x in some cases */
+ image_loader_set_requested_size(tl->il, tl->max_w, tl->max_h);
- image_loader_set_error_func(tl->il, thumb_loader_error_cb, tl);
- if (tl->func_progress) image_loader_set_percent_func(tl->il, thumb_loader_percent_cb, tl);
+ g_signal_connect(G_OBJECT(tl->il), "error", (GCallback)thumb_loader_error_cb, tl);
+ if (tl->func_progress) g_signal_connect(G_OBJECT(tl->il), "percent", (GCallback)thumb_loader_percent_cb, tl);
}
void thumb_loader_set_callbacks(ThumbLoader *tl,
tl->data = data;
}
-void thumb_loader_set_cache(ThumbLoader *tl, gint enable_cache, gint local, gint retry_failed)
+void thumb_loader_set_cache(ThumbLoader *tl, gboolean enable_cache, gboolean local, gboolean retry_failed)
{
if (!tl) return;
}
tl->cache_enable = enable_cache;
-#if 0
- tl->cache_local = local;
- tl->cache_retry = retry_failed;
-#endif
}
-gint thumb_loader_start(ThumbLoader *tl, const gchar *path)
+gboolean thumb_loader_start(ThumbLoader *tl, FileData *fd)
{
gchar *cache_path = NULL;
if (tl->standard_loader)
{
- return thumb_loader_std_start((ThumbLoaderStd *)tl, path);
+ return thumb_loader_std_start((ThumbLoaderStd *)tl, fd);
}
- if (!tl->path && !path) return FALSE;
+ if (!tl->fd && !fd) return FALSE;
- if (!tl->path) tl->path = g_strdup(path);
+ if (!tl->fd) tl->fd = file_data_ref(fd);
+
+ if (tl->fd->format_class != FORMAT_CLASS_IMAGE && tl->fd->format_class != FORMAT_CLASS_RAWIMAGE && tl->fd->format_class != FORMAT_CLASS_VIDEO)
+ {
+ thumb_loader_set_fallback(tl);
+ return FALSE;
+ }
if (tl->cache_enable)
{
- cache_path = cache_find_location(CACHE_TYPE_THUMB, tl->path);
+ cache_path = cache_find_location(CACHE_TYPE_THUMB, tl->fd->path);
if (cache_path)
{
- if (cache_time_valid(cache_path, tl->path))
+ if (cache_time_valid(cache_path, tl->fd->path))
{
- DEBUG_1("Found in cache:%s", tl->path);
+ DEBUG_1("Found in cache:%s", tl->fd->path);
if (filesize(cache_path) == 0)
{
DEBUG_1("Broken image mark found:%s", cache_path);
g_free(cache_path);
+ thumb_loader_set_fallback(tl);
return FALSE;
}
if (!cache_path && options->thumbnails.use_xvpics)
{
- tl->pixbuf = get_xv_thumbnail(tl->path, tl->max_w, tl->max_h);
- if (tl->pixbuf)
+ if (tl->fd->thumb_pixbuf) g_object_unref(tl->fd->thumb_pixbuf);
+ tl->fd->thumb_pixbuf = get_xv_thumbnail(tl->fd->path, tl->max_w, tl->max_h);
+ if (tl->fd->thumb_pixbuf)
{
thumb_loader_delay_done(tl);
return TRUE;
if (cache_path)
{
- thumb_loader_setup(tl, cache_path);
+ FileData *fd = file_data_new_no_grouping(cache_path);
+ thumb_loader_setup(tl, fd);
+ file_data_unref(fd);
g_free(cache_path);
tl->cache_hit = TRUE;
}
else
{
- thumb_loader_setup(tl, tl->path);
+ thumb_loader_setup(tl, tl->fd);
}
- if (!image_loader_start(tl->il, thumb_loader_done_cb, tl))
+ g_signal_connect(G_OBJECT(tl->il), "done", (GCallback)thumb_loader_done_cb, tl);
+ if (!image_loader_start(tl->il))
{
/* try from original if cache attempt */
if (tl->cache_hit)
{
tl->cache_hit = FALSE;
- print_term(_("Thumbnail image in cache failed to load, trying to recreate.\n"));
+ log_printf("%s", _("Thumbnail image in cache failed to load, trying to recreate.\n"));
- thumb_loader_setup(tl, tl->path);
- if (image_loader_start(tl->il, thumb_loader_done_cb, tl)) return TRUE;
+ thumb_loader_setup(tl, tl->fd);
+ g_signal_connect(G_OBJECT(tl->il), "done", (GCallback)thumb_loader_done_cb, tl);
+ if (image_loader_start(tl->il)) return TRUE;
}
/* mark failed thumbnail in cache with 0 byte file */
if (tl->cache_enable)
{
- thumb_loader_mark_failure(tl);
+ thumb_loader_save_thumbnail(tl, TRUE);
}
image_loader_free(tl->il);
tl->il = NULL;
+ thumb_loader_set_fallback(tl);
return FALSE;
}
return TRUE;
}
-#if 0
-gint thumb_loader_to_pixmap(ThumbLoader *tl, GdkPixmap **pixmap, GdkBitmap **mask)
-{
- if (!tl || !tl->pixbuf) return -1;
-
- gdk_pixbuf_render_pixmap_and_mask(tl->pixbuf, pixmap, mask, 128);
-
- return thumb_loader_get_space(tl);
-}
-#endif
-
-GdkPixbuf *thumb_loader_get_pixbuf(ThumbLoader *tl, gint with_fallback)
+GdkPixbuf *thumb_loader_get_pixbuf(ThumbLoader *tl)
{
GdkPixbuf *pixbuf;
if (tl && tl->standard_loader)
{
- return thumb_loader_std_get_pixbuf((ThumbLoaderStd *)tl, with_fallback);
+ return thumb_loader_std_get_pixbuf((ThumbLoaderStd *)tl);
}
- if (tl && tl->pixbuf)
+ if (tl && tl->fd && tl->fd->thumb_pixbuf)
{
- pixbuf = tl->pixbuf;
+ pixbuf = tl->fd->thumb_pixbuf;
g_object_ref(pixbuf);
}
- else if (with_fallback)
- {
- gint w, h;
-
- pixbuf = pixbuf_inline(PIXBUF_INLINE_BROKEN);
- w = gdk_pixbuf_get_width(pixbuf);
- h = gdk_pixbuf_get_height(pixbuf);
- if ((w > tl->max_w || h > tl->max_h) &&
- normalize_thumb(&w, &h, tl->max_w, tl->max_h))
- {
- GdkPixbuf *tmp;
-
- tmp = pixbuf;
- pixbuf = gdk_pixbuf_scale_simple(tmp, w, h, GDK_INTERP_NEAREST);
- gdk_pixbuf_unref(tmp);
- }
- }
else
{
- pixbuf = NULL;
+ pixbuf = pixbuf_fallback(NULL, tl->max_w, tl->max_h);
}
return pixbuf;
}
-#if 0
-gint thumb_loader_get_space(ThumbLoader *tl)
-{
- if (!tl) return 0;
-
- if (tl->pixbuf) return (tl->max_w - gdk_pixbuf_get_width(tl->pixbuf));
-
- return tl->max_w;
-}
-#endif
-
ThumbLoader *thumb_loader_new(gint width, gint height)
{
ThumbLoader *tl;
- if (options->thumbnails.spec_standard)
+ /* non-std thumb loader is more effective for configurations with disabled caching
+ because it loads the thumbnails at the required size. loader_std loads
+ the thumbnails at the sizes appropriate for standard cache (typically 256x256 pixels)
+ and then performs one additional scaling */
+ if (options->thumbnails.spec_standard && options->thumbnails.enable_caching)
{
return (ThumbLoader *)thumb_loader_std_new(width, height);
}
tl = g_new0(ThumbLoader, 1);
- tl->standard_loader = FALSE;
- tl->path = NULL;
+
tl->cache_enable = options->thumbnails.enable_caching;
- tl->cache_hit = FALSE;
tl->percent_done = 0.0;
tl->max_w = width;
tl->max_h = height;
- tl->il = NULL;
-
- tl->idle_done_id = -1;
-
return tl;
}
return;
}
- if (tl->pixbuf) gdk_pixbuf_unref(tl->pixbuf);
image_loader_free(tl->il);
- g_free(tl->path);
+ file_data_unref(tl->fd);
- if (tl->idle_done_id != -1) g_source_remove(tl->idle_done_id);
+ if (tl->idle_done_id) g_source_remove(tl->idle_done_id);
g_free(tl);
}
-#if 0
-gint thumb_from_xpm_d(const char **data, gint max_w, gint max_h, GdkPixmap **pixmap, GdkBitmap **mask)
+/* release thumb_pixbuf on file change - this forces reload. */
+void thumb_notify_cb(FileData *fd, NotifyType type, gpointer data)
{
- GdkPixbuf *pixbuf;
- gint w, h;
-
- pixbuf = gdk_pixbuf_new_from_xpm_data(data);
- w = gdk_pixbuf_get_width(pixbuf);
- h = gdk_pixbuf_get_height(pixbuf);
-
- if ((w > max_w || h > max_h) &&
- normalize_thumb(&w, &h, max_w, max_h))
+ if ((type & (NOTIFY_REREAD | NOTIFY_CHANGE)) && fd->thumb_pixbuf)
{
- /* scale */
- GdkPixbuf *tmp;
-
- tmp = pixbuf;
- pixbuf = gdk_pixbuf_scale_simple(tmp, w, h, GDK_INTERP_NEAREST);
- gdk_pixbuf_unref(tmp);
+ DEBUG_1("Notify thumb: %s %04x", fd->path, type);
+ g_object_unref(fd->thumb_pixbuf);
+ fd->thumb_pixbuf = NULL;
}
-
- gdk_pixbuf_render_pixmap_and_mask(pixbuf, pixmap, mask, 128);
- gdk_pixbuf_unref(pixbuf);
-
- return w;
}
-#endif
+
/*
*-----------------------------------------------------------------------------
{
FILE *file;
gchar buffer[XV_BUFFER];
- guchar *data;
- gint width, height, depth;
+ guchar *data = NULL;
file = fopen(filename, "rt");
- if(!file) return NULL;
+ if (!file) return NULL;
- fgets(buffer, XV_BUFFER, file);
- if(strncmp(buffer, "P7 332", 6) != 0)
+ if (fgets(buffer, XV_BUFFER, file) != NULL
+ && strncmp(buffer, "P7 332", 6) == 0)
{
- fclose(file);
- return NULL;
- }
+ gint width, height, depth;
- while(fgets(buffer, XV_BUFFER, file) && buffer[0] == '#') /* do_nothing() */;
+ while (fgets(buffer, XV_BUFFER, file) && buffer[0] == '#') /* do_nothing() */;
- if(sscanf(buffer, "%d %d %d", &width, &height, &depth) != 3)
- {
- fclose(file);
- return NULL;
- }
+ if (sscanf(buffer, "%d %d %d", &width, &height, &depth) == 3)
+ {
+ gsize size = width * height;
- data = g_new(guchar, width * height);
- fread(data, 1, width * height, file);
+ data = g_new(guchar, size);
+ if (data && fread(data, 1, size, file) == size)
+ {
+ *widthp = width;
+ *heightp = height;
+ }
+ }
+ }
fclose(file);
- *widthp = width;
- *heightp = height;
return data;
}
#undef XV_BUFFER
-static gint normalize_thumb(gint *width, gint *height, gint max_w, gint max_h)
-{
- gdouble scale;
- gint new_w, new_h;
-
- scale = MIN((gdouble) max_w / *width, (gdouble) max_h / *height);
- new_w = *width * scale;
- new_h = *height * scale;
-
- if (new_w != *width || new_h != *height)
- {
- *width = new_w;
- *height = new_h;
- return TRUE;
- }
-
- return FALSE;
-}
-
static void free_rgb_buffer(guchar *pixels, gpointer data)
{
g_free(pixels);
{
gint width, height;
gchar *thumb_name;
- gchar *tmp_string;
- gchar *last_slash;
+ gchar *path;
+ gchar *directory;
+ gchar *name;
guchar *packed_data;
- tmp_string = path_from_utf8(thumb_filename);
- last_slash = strrchr(tmp_string, '/');
- if(!last_slash) return NULL;
- *last_slash++ = '\0';
+ path = path_from_utf8(thumb_filename);
+ directory = g_path_get_dirname(path);
+ name = g_path_get_basename(path);
+
+ thumb_name = g_build_filename(directory, ".xvpics", name, NULL);
+
+ g_free(name);
+ g_free(directory);
+ g_free(path);
- thumb_name = g_strconcat(tmp_string, "/.xvpics/", last_slash, NULL);
packed_data = load_xv_thumbnail(thumb_name, &width, &height);
- g_free(tmp_string);
g_free(thumb_name);
- if(packed_data)
+ if (packed_data)
{
guchar *rgb_data;
GdkPixbuf *pixbuf;
gint i;
rgb_data = g_new(guchar, width * height * 3);
- for(i = 0; i < width * height; i++)
+ for (i = 0; i < width * height; i++)
{
rgb_data[i * 3 + 0] = (packed_data[i] >> 5) * 36;
rgb_data[i * 3 + 1] = ((packed_data[i] & 28) >> 2) * 36;
pixbuf = gdk_pixbuf_new_from_data(rgb_data, GDK_COLORSPACE_RGB, FALSE, 8,
width, height, 3 * width, free_rgb_buffer, NULL);
- if (normalize_thumb(&width, &height, max_w, max_h))
+ if (pixbuf_scale_aspect(width, height, max_w, max_h, &width, &height))
{
/* scale */
GdkPixbuf *tmp;
tmp = pixbuf;
pixbuf = gdk_pixbuf_scale_simple(tmp, width, height, GDK_INTERP_NEAREST);
- gdk_pixbuf_unref(tmp);
+ g_object_unref(tmp);
}
return pixbuf;
return NULL;
}
+/* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */