[maemo-commits] [maemo-commits] r16031 - in projects/haf/branches/hildon-thumbnail/daemonize: . daemon daemon/plugins
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Fri Sep 5 13:34:16 EEST 2008
- Previous message: [maemo-commits] r16030 - projects/haf/branches/hildon-fm/fremantle/hildon-fm
- Next message: [maemo-commits] r16032 - in projects/haf/branches/hildon-thumbnail/daemonize: . daemon daemon/plugins
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: pvanhoof Date: 2008-09-05 13:34:14 +0300 (Fri, 05 Sep 2008) New Revision: 16031 Added: projects/haf/branches/hildon-thumbnail/daemonize/daemon/plugins/pixbuf-io-loader.c Removed: projects/haf/branches/hildon-thumbnail/daemonize/daemon/pixbuf-io-loader.c Modified: projects/haf/branches/hildon-thumbnail/daemonize/ChangeLog projects/haf/branches/hildon-thumbnail/daemonize/daemon/ projects/haf/branches/hildon-thumbnail/daemonize/daemon/Makefile.am projects/haf/branches/hildon-thumbnail/daemonize/daemon/plugins/Makefile.am projects/haf/branches/hildon-thumbnail/daemonize/daemon/plugins/gdkpixbuf-plugin.c projects/haf/branches/hildon-thumbnail/daemonize/daemon/utils.h Log: 2008-09-05 Philip Van Hoof <philip at codeminded.be> daemon/plugins/gdkpixbuf-plugin.c daemon/plugins/pixbuf-io-loader.c daemon/plugins/Makefile.am daemon/utils.h daemon/pixbuf-io-loader.c daemon/Makefile.am: Moving things around Modified: projects/haf/branches/hildon-thumbnail/daemonize/ChangeLog =================================================================== --- projects/haf/branches/hildon-thumbnail/daemonize/ChangeLog 2008-09-05 10:31:00 UTC (rev 16030) +++ projects/haf/branches/hildon-thumbnail/daemonize/ChangeLog 2008-09-05 10:34:14 UTC (rev 16031) @@ -1,5 +1,14 @@ 2008-09-05 Philip Van Hoof <philip at codeminded.be> + daemon/plugins/gdkpixbuf-plugin.c + daemon/plugins/pixbuf-io-loader.c + daemon/plugins/Makefile.am + daemon/utils.h + daemon/pixbuf-io-loader.c + daemon/Makefile.am: Moving things around + +2008-09-05 Philip Van Hoof <philip at codeminded.be> + * daemon/hildon-thumbnail-daemon.c * daemon/hildon-thumbnail-plugin.h * daemon/plugin-runner.c Property changes on: projects/haf/branches/hildon-thumbnail/daemonize/daemon ___________________________________________________________________ Name: svn:ignore - hildon-thumbnailer-run-plugin-as-standalone Makefile.in hildon-thumbnailerd .libs .deps org.freedesktop.thumbnailer.service Makefile *-glue.h *-marshal.c *-marshal.h + hildon-thumbnailer-plugin-runner Makefile.in hildon-thumbnailerd .libs .deps org.freedesktop.thumbnailer.service Makefile *-glue.h *-marshal.c *-marshal.h Modified: projects/haf/branches/hildon-thumbnail/daemonize/daemon/Makefile.am =================================================================== --- projects/haf/branches/hildon-thumbnail/daemonize/daemon/Makefile.am 2008-09-05 10:31:00 UTC (rev 16030) +++ projects/haf/branches/hildon-thumbnail/daemonize/daemon/Makefile.am 2008-09-05 10:34:14 UTC (rev 16031) @@ -5,14 +5,13 @@ $(GLIB_CFLAGS) \ $(GMODULE_CFLAGS) \ $(GIO_CFLAGS) \ - $(GDK_PIXBUF_CFLAGS) \ $(DBUS_CFLAGS) \ -DPLUGINS_DIR=\""$(libdir)/hildon-thumbnailer/plugins"\" noinst_LTLIBRARIES = libshared.la -libshared_la_SOURCES = md5.c md5.h utils.h utils.c pixbuf-io-loader.c +libshared_la_SOURCES = md5.c md5.h utils.h utils.c libexec_PROGRAMS = hildon-thumbnailerd hildon-thumbnailer-plugin-runner Deleted: projects/haf/branches/hildon-thumbnail/daemonize/daemon/pixbuf-io-loader.c =================================================================== --- projects/haf/branches/hildon-thumbnail/daemonize/daemon/pixbuf-io-loader.c 2008-09-05 10:31:00 UTC (rev 16030) +++ projects/haf/branches/hildon-thumbnail/daemonize/daemon/pixbuf-io-loader.c 2008-09-05 10:34:14 UTC (rev 16031) @@ -1,195 +0,0 @@ - -/* -*- mode: C; c-file-style: "linux" -*- */ -/* GdkPixbuf library - Main loading interface. - * - * Copyright (C) 1999 The Free Software Foundation - * - * Authors: Miguel de Icaza <miguel at gnu.org> - * Federico Mena-Quintero <federico at gimp.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#include <gio/gio.h> -#include <gdk-pixbuf/gdk-pixbuf.h> - -#ifndef gdk_pixbuf_new_from_stream_at_scale - -#define LOAD_BUFFER_SIZE 65536 - -static GdkPixbuf * -load_from_stream (GdkPixbufLoader *loader, - GInputStream *stream, - GCancellable *cancellable, - GError **error) -{ - GdkPixbuf *pixbuf; - gssize n_read; - guchar buffer[LOAD_BUFFER_SIZE]; - gboolean res; - - res = TRUE; - while (1) { - n_read = g_input_stream_read (stream, - buffer, - sizeof (buffer), - cancellable, - error); - if (n_read < 0) { - res = FALSE; - error = NULL; /* Ignore further errors */ - break; - } - - if (n_read == 0) - break; - - if (!gdk_pixbuf_loader_write (loader, - buffer, - n_read, - error)) { - res = FALSE; - error = NULL; - break; - } - } - - if (!gdk_pixbuf_loader_close (loader, error)) { - res = FALSE; - error = NULL; - } - - pixbuf = NULL; - if (res) { - pixbuf = gdk_pixbuf_loader_get_pixbuf (loader); - if (pixbuf) - g_object_ref (pixbuf); - } - - return pixbuf; -} - -typedef struct { - gint width; - gint height; - gboolean preserve_aspect_ratio; -} AtScaleData; - -static void -at_scale_size_prepared_cb (GdkPixbufLoader *loader, - int width, - int height, - gpointer data) -{ - AtScaleData *info = data; - - g_return_if_fail (width > 0 && height > 0); - - if (info->preserve_aspect_ratio && - (info->width > 0 || info->height > 0)) { - if (info->width < 0) - { - width = width * (double)info->height/(double)height; - height = info->height; - } - else if (info->height < 0) - { - height = height * (double)info->width/(double)width; - width = info->width; - } - else if ((double)height * (double)info->width > - (double)width * (double)info->height) { - width = 0.5 + (double)width * (double)info->height / (double)height; - height = info->height; - } else { - height = 0.5 + (double)height * (double)info->width / (double)width; - width = info->width; - } - } else { - if (info->width > 0) - width = info->width; - if (info->height > 0) - height = info->height; - } - - width = MAX (width, 1); - height = MAX (height, 1); - - gdk_pixbuf_loader_set_size (loader, width, height); -} - -/** - * gdk_pixbuf_new_from_stream_at_scale: - * @stream: a #GInputStream to load the pixbuf from - * @width: The width the image should have or -1 to not constrain the width - * @height: The height the image should have or -1 to not constrain the height - * @preserve_aspect_ratio: %TRUE to preserve the image's aspect ratio - * @cancellable: optional #GCancellable object, %NULL to ignore - * @error: Return location for an error - * - * Creates a new pixbuf by loading an image from an input stream. - * - * The file format is detected automatically. If %NULL is returned, then - * @error will be set. The @cancellable can be used to abort the operation - * from another thread. If the operation was cancelled, the error - * %GIO_ERROR_CANCELLED will be returned. Other possible errors are in - * the #GDK_PIXBUF_ERROR and %G_IO_ERROR domains. - * - * The image will be scaled to fit in the requested size, optionally - * preserving the image's aspect ratio. When preserving the aspect ratio, - * a @width of -1 will cause the image to be scaled to the exact given - * height, and a @height of -1 will cause the image to be scaled to the - * exact given width. When not preserving aspect ratio, a @width or - * @height of -1 means to not scale the image at all in that dimension. - * - * The stream is not closed. - * - * Return value: A newly-created pixbuf, or %NULL if any of several error - * conditions occurred: the file could not be opened, the image format is - * not supported, there was not enough memory to allocate the image buffer, - * the stream contained invalid data, or the operation was cancelled. - * - * Since: 2.14 - */ -GdkPixbuf * -gdk_pixbuf_new_from_stream_at_scale (GInputStream *stream, - gint width, - gint height, - gboolean preserve_aspect_ratio, - GCancellable *cancellable, - GError **error) -{ - GdkPixbufLoader *loader; - GdkPixbuf *pixbuf; - AtScaleData info; - - loader = gdk_pixbuf_loader_new (); - - info.width = width; - info.height = height; - info.preserve_aspect_ratio = preserve_aspect_ratio; - - g_signal_connect (loader, "size-prepared", - G_CALLBACK (at_scale_size_prepared_cb), &info); - - pixbuf = load_from_stream (loader, stream, cancellable, error); - g_object_unref (loader); - - return pixbuf; -} - -#endif Modified: projects/haf/branches/hildon-thumbnail/daemonize/daemon/plugins/Makefile.am =================================================================== --- projects/haf/branches/hildon-thumbnail/daemonize/daemon/plugins/Makefile.am 2008-09-05 10:31:00 UTC (rev 16030) +++ projects/haf/branches/hildon-thumbnail/daemonize/daemon/plugins/Makefile.am 2008-09-05 10:34:14 UTC (rev 16031) @@ -10,7 +10,7 @@ plugins_LTLIBRARIES = libhildon-thumbnailer-gdkpixbuf.la -libhildon_thumbnailer_gdkpixbuf_la_SOURCES = gdkpixbuf-plugin.c gdkpixbuf-plugin.h +libhildon_thumbnailer_gdkpixbuf_la_SOURCES = gdkpixbuf-plugin.c gdkpixbuf-plugin.h pixbuf-io-loader.c libhildon_thumbnailer_gdkpixbuf_la_LDFLAGS = $(plugin_flags) libhildon_thumbnailer_gdkpixbuf_la_LIBADD = \ $(PGK_LIBS) \ Modified: projects/haf/branches/hildon-thumbnail/daemonize/daemon/plugins/gdkpixbuf-plugin.c =================================================================== --- projects/haf/branches/hildon-thumbnail/daemonize/daemon/plugins/gdkpixbuf-plugin.c 2008-09-05 10:31:00 UTC (rev 16030) +++ projects/haf/branches/hildon-thumbnail/daemonize/daemon/plugins/gdkpixbuf-plugin.c 2008-09-05 10:34:14 UTC (rev 16031) @@ -42,6 +42,14 @@ #include "gdkpixbuf-plugin.h" #include "hildon-thumbnail-plugin.h" +#ifndef gdk_pixbuf_new_from_stream_at_scale +/* It's implemented in pixbuf-io-loader.c in this case */ + +GdkPixbuf* gdk_pixbuf_new_from_stream_at_scale (GInputStream *stream, gint width, + gint height, gboolean preserve_aspect_ratio, + GCancellable *cancellable, GError **error); +#endif + static gchar **supported = NULL; const gchar** Copied: projects/haf/branches/hildon-thumbnail/daemonize/daemon/plugins/pixbuf-io-loader.c (from rev 16021, projects/haf/branches/hildon-thumbnail/daemonize/daemon/pixbuf-io-loader.c) Property changes on: projects/haf/branches/hildon-thumbnail/daemonize/daemon/plugins/pixbuf-io-loader.c ___________________________________________________________________ Name: svn:mergeinfo + Modified: projects/haf/branches/hildon-thumbnail/daemonize/daemon/utils.h =================================================================== --- projects/haf/branches/hildon-thumbnail/daemonize/daemon/utils.h 2008-09-05 10:31:00 UTC (rev 16030) +++ projects/haf/branches/hildon-thumbnail/daemonize/daemon/utils.h 2008-09-05 10:34:14 UTC (rev 16031) @@ -26,7 +26,6 @@ */ #include <glib.h> -#include <gdk-pixbuf/gdk-pixbuf.h> #include <gio/gio.h> void hildon_thumbnail_util_get_thumb_paths (const gchar *uri, gchar **large, gchar **normal, GError **error); @@ -35,12 +34,4 @@ gint g_sprintf (gchar *string, gchar const *format, ...); #endif - -#ifndef gdk_pixbuf_new_from_stream_at_scale - -GdkPixbuf* gdk_pixbuf_new_from_stream_at_scale (GInputStream *stream, gint width, - gint height, gboolean preserve_aspect_ratio, - GCancellable *cancellable, GError **error); #endif - -#endif
- Previous message: [maemo-commits] r16030 - projects/haf/branches/hildon-fm/fremantle/hildon-fm
- Next message: [maemo-commits] r16032 - in projects/haf/branches/hildon-thumbnail/daemonize: . daemon daemon/plugins
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]