diff options
author | Federico Mena Quintero <federico@helixcode.com> | 2000-01-02 03:59:22 +0000 |
---|---|---|
committer | Arturo Espinosa <unammx@src.gnome.org> | 2000-01-02 03:59:22 +0000 |
commit | 6e3522ab2c44c90da28d1064a2f56c3a7184f749 (patch) | |
tree | d240b6f7fd3baf8229fb1d9202b09fccb43786e2 /gdk-pixbuf/gdk-pixbuf.c | |
parent | 605c562ffb42dd00f5d67bca8776953ea6dde78d (diff) | |
download | gtk+-6e3522ab2c44c90da28d1064a2f56c3a7184f749.tar.gz |
Added reference counting to animations. A web browser may want to share a
2000-01-01 Federico Mena Quintero <federico@helixcode.com>
* gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference
counting to animations. A web browser may want to share a single
copy of an animated GIF if it appears multiple times in a web
page, for example.
* gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the
animation functions here.
(gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL
animation if the loader does not support multiframe loading and
the single-frame load returned NULL. Check that the filename is
not NULL. Updated inline documentation.
(gdk_pixbuf_animation_ref): New function.
(gdk_pixbuf_animation_unref): New function.
Removed gdk_pixbuf_animation_destroy() in favor of reference
counting.
* gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file):
Prettified. Made ref_count assertion more paranoid. Check that
the filename is not NULL.
(gdk_pixbuf_get_module): Use guchar * and guint for buffer and
size, respectively.
(gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to
const char **.
* gdk-pixbuf/io-gif.c (image_load_animation): Create the animation
with a reference count of 1.
* gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added
gdk-pixbuf-animation.c.
* doc/tmpl/animation.sgml: Populated. It is still missing a
description of the overlay modes.
* doc/gdk-pixbuf-sections.txt: Added the animation section. Moved
the canvas item section to the end, as it will be moved later to
gnome-libs.
* doc/gdk-pixbuf.sgml: Added the animation section.
* doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
Diffstat (limited to 'gdk-pixbuf/gdk-pixbuf.c')
-rw-r--r-- | gdk-pixbuf/gdk-pixbuf.c | 45 |
1 files changed, 8 insertions, 37 deletions
diff --git a/gdk-pixbuf/gdk-pixbuf.c b/gdk-pixbuf/gdk-pixbuf.c index eea251050e..329de797c2 100644 --- a/gdk-pixbuf/gdk-pixbuf.c +++ b/gdk-pixbuf/gdk-pixbuf.c @@ -167,11 +167,10 @@ gdk_pixbuf_new (ArtPixFormat format, gboolean has_alpha, int bits_per_sample, ArtPixFormat gdk_pixbuf_get_format (GdkPixbuf *pixbuf) { - /* Unfortunately, there's nothing else to return */ g_return_val_if_fail (pixbuf != NULL, ART_PIX_RGB); g_assert (pixbuf->art_pixbuf != NULL); - return (pixbuf->art_pixbuf->format); + return pixbuf->art_pixbuf->format; } /** @@ -188,7 +187,7 @@ gdk_pixbuf_get_n_channels (GdkPixbuf *pixbuf) g_return_val_if_fail (pixbuf != NULL, -1); g_assert (pixbuf->art_pixbuf != NULL); - return (pixbuf->art_pixbuf->n_channels); + return pixbuf->art_pixbuf->n_channels; } /** @@ -205,7 +204,7 @@ gdk_pixbuf_get_has_alpha (GdkPixbuf *pixbuf) g_return_val_if_fail (pixbuf != NULL, -1); g_assert (pixbuf->art_pixbuf != NULL); - return (pixbuf->art_pixbuf->has_alpha); + return pixbuf->art_pixbuf->has_alpha; } /** @@ -222,7 +221,7 @@ gdk_pixbuf_get_bits_per_sample (GdkPixbuf *pixbuf) g_return_val_if_fail (pixbuf != NULL, -1); g_assert (pixbuf->art_pixbuf != NULL); - return (pixbuf->art_pixbuf->bits_per_sample); + return pixbuf->art_pixbuf->bits_per_sample; } /** @@ -239,7 +238,7 @@ gdk_pixbuf_get_pixels (GdkPixbuf *pixbuf) g_return_val_if_fail (pixbuf != NULL, NULL); g_assert (pixbuf->art_pixbuf != NULL); - return (pixbuf->art_pixbuf->pixels); + return pixbuf->art_pixbuf->pixels; } /** @@ -256,7 +255,7 @@ gdk_pixbuf_get_width (GdkPixbuf *pixbuf) g_return_val_if_fail (pixbuf != NULL, -1); g_assert (pixbuf->art_pixbuf != NULL); - return (pixbuf->art_pixbuf->width); + return pixbuf->art_pixbuf->width; } /** @@ -273,7 +272,7 @@ gdk_pixbuf_get_height (GdkPixbuf *pixbuf) g_return_val_if_fail (pixbuf != NULL, -1); g_assert (pixbuf->art_pixbuf != NULL); - return (pixbuf->art_pixbuf->height); + return pixbuf->art_pixbuf->height; } /** @@ -290,33 +289,5 @@ gdk_pixbuf_get_rowstride (GdkPixbuf *pixbuf) g_return_val_if_fail (pixbuf != NULL, -1); g_assert (pixbuf->art_pixbuf != NULL); - return (pixbuf->art_pixbuf->rowstride); + return pixbuf->art_pixbuf->rowstride; } - -/** - * gdk_pixbuf_animation_destroy: - * @animation: An animation. - * @free_frames: Keep the frames. - * - * Destroys the animation. If @free_frames is set, then the actual image data - * will be free'd as well. - * - **/ -void -gdk_pixbuf_animation_destroy (GdkPixbufAnimation *animation, - gboolean free_frames) -{ - GList *ptr; - - g_return_if_fail (animation != NULL); - - for (ptr = animation->frames; ptr; ptr = g_list_next (ptr)) { - if (free_frames) - gdk_pixbuf_unref (((GdkPixbufFrame *)ptr->data)->pixbuf); - g_free (ptr->data); - } - g_list_free (animation->frames); - - g_free (animation); -} - |