bump libtool version
[swfdec.git] / libswfdec / swfdec_morphshape.c
blob5252804baaa3921733fd022e3c193b1d677cda22
1 /* Swfdec
2 * Copyright (C) 2003-2006 David Schleef <ds@schleef.org>
3 * 2005-2006 Eric Anholt <eric@anholt.net>
4 * 2006-2007 Benjamin Otte <otte@gnome.org>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301 USA
22 #ifdef HAVE_CONFIG_H
23 #include "config.h"
24 #endif
26 #include "swfdec_morphshape.h"
27 #include "swfdec_debug.h"
28 #include "swfdec_image.h"
29 #include "swfdec_morph_movie.h"
30 #include "swfdec_shape_parser.h"
32 G_DEFINE_TYPE (SwfdecMorphShape, swfdec_morph_shape, SWFDEC_TYPE_SHAPE)
34 static SwfdecMovie *
35 swfdec_graphic_create_movie (SwfdecGraphic *graphic, gsize *size)
37 SwfdecMorphShape *morph = SWFDEC_MORPH_SHAPE (graphic);
38 SwfdecMorphMovie *movie = g_object_new (SWFDEC_TYPE_MORPH_MOVIE, NULL);
40 movie->morph = morph;
41 g_object_ref (morph);
43 *size = sizeof (SwfdecMorphMovie);
45 return SWFDEC_MOVIE (movie);
48 static void
49 swfdec_morph_shape_class_init (SwfdecMorphShapeClass * g_class)
51 SwfdecGraphicClass *graphic_class = SWFDEC_GRAPHIC_CLASS (g_class);
53 graphic_class->create_movie = swfdec_graphic_create_movie;
56 static void
57 swfdec_morph_shape_init (SwfdecMorphShape * morph)
62 int
63 tag_define_morph_shape (SwfdecSwfDecoder * s, guint tag)
65 SwfdecShapeParser *parser;
66 SwfdecBits bits2;
67 SwfdecBits *bits = &s->b;
68 SwfdecMorphShape *morph;
69 guint offset;
70 int id;
72 id = swfdec_bits_get_u16 (bits);
74 morph = swfdec_swf_decoder_create_character (s, id, SWFDEC_TYPE_MORPH_SHAPE);
75 if (!morph)
76 return SWFDEC_STATUS_OK;
78 SWFDEC_INFO ("id=%d", id);
80 swfdec_bits_get_rect (bits, &SWFDEC_GRAPHIC (morph)->extents);
81 swfdec_bits_get_rect (bits, &morph->end_extents);
82 offset = swfdec_bits_get_u32 (bits);
83 swfdec_bits_init_bits (&bits2, bits, offset);
85 parser = swfdec_shape_parser_new ((SwfdecParseDrawFunc) swfdec_pattern_parse_morph,
86 (SwfdecParseDrawFunc) swfdec_stroke_parse_morph, s);
87 swfdec_shape_parser_parse_morph (parser, &bits2, bits);
88 SWFDEC_SHAPE (morph)->draws = swfdec_shape_parser_free (parser);
90 if (swfdec_bits_left (&bits2)) {
91 SWFDEC_WARNING ("early finish when parsing start shapes: %u bytes",
92 swfdec_bits_left (&bits2));
95 return SWFDEC_STATUS_OK;