fix build for --disable-gtk-doc
[swfdec.git] / swfdec / swfdec_cached_image.c
blob2640b5fa50d313a50455d5938c78ca2c3b4ebf01
1 /* Swfdec
2 * Copyright (C) 2008 Benjamin Otte <otte@gnome.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301 USA
20 #ifdef HAVE_CONFIG_H
21 #include "config.h"
22 #endif
24 #include "swfdec_cached_image.h"
25 #include "swfdec_debug.h"
27 G_DEFINE_TYPE (SwfdecCachedImage, swfdec_cached_image, SWFDEC_TYPE_CACHED)
29 static void
30 swfdec_cached_image_dispose (GObject *object)
32 SwfdecCachedImage *image = SWFDEC_CACHED_IMAGE (object);
34 if (image->surface) {
35 cairo_surface_destroy (image->surface);
36 image->surface = NULL;
39 G_OBJECT_CLASS (swfdec_cached_image_parent_class)->dispose (object);
42 static void
43 swfdec_cached_image_class_init (SwfdecCachedImageClass * g_class)
45 GObjectClass *object_class = G_OBJECT_CLASS (g_class);
47 object_class->dispose = swfdec_cached_image_dispose;
50 static void
51 swfdec_cached_image_init (SwfdecCachedImage *cached)
53 swfdec_color_transform_init_identity (&cached->trans);
56 SwfdecCachedImage *
57 swfdec_cached_image_new (cairo_surface_t *surface, gsize size)
59 SwfdecCachedImage *image;
61 g_return_val_if_fail (surface != NULL, NULL);
62 g_return_val_if_fail (size > 0, NULL);
64 size += sizeof (SwfdecCachedImage);
65 image = g_object_new (SWFDEC_TYPE_CACHED_IMAGE, "size", size, NULL);
66 image->surface = cairo_surface_reference (surface);
68 return image;
71 cairo_surface_t *
72 swfdec_cached_image_get_surface (SwfdecCachedImage *image)
74 g_return_val_if_fail (SWFDEC_IS_CACHED_IMAGE (image), NULL);
76 return cairo_surface_reference (image->surface);
79 void
80 swfdec_cached_image_get_color_transform (SwfdecCachedImage *image,
81 SwfdecColorTransform *trans)
83 g_return_if_fail (SWFDEC_IS_CACHED_IMAGE (image));
84 g_return_if_fail (trans != NULL);
86 *trans = image->trans;
89 void
90 swfdec_cached_image_set_color_transform (SwfdecCachedImage *image,
91 const SwfdecColorTransform *trans)
93 g_return_if_fail (SWFDEC_IS_CACHED_IMAGE (image));
94 g_return_if_fail (trans != NULL);
96 image->trans = *trans;