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
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
)
35 swfdec_morph_shape_class_init (SwfdecMorphShapeClass
* g_class
)
37 SwfdecGraphicClass
*graphic_class
= SWFDEC_GRAPHIC_CLASS (g_class
);
39 graphic_class
->movie_type
= SWFDEC_TYPE_MORPH_MOVIE
;
43 swfdec_morph_shape_init (SwfdecMorphShape
* morph
)
49 tag_define_morph_shape (SwfdecSwfDecoder
* s
, guint tag
)
51 SwfdecShapeParser
*parser
;
53 SwfdecBits
*bits
= &s
->b
;
54 SwfdecMorphShape
*morph
;
58 id
= swfdec_bits_get_u16 (bits
);
60 morph
= swfdec_swf_decoder_create_character (s
, id
, SWFDEC_TYPE_MORPH_SHAPE
);
62 return SWFDEC_STATUS_OK
;
64 SWFDEC_INFO ("id=%d", id
);
66 swfdec_bits_get_rect (bits
, &SWFDEC_GRAPHIC (morph
)->extents
);
67 swfdec_bits_get_rect (bits
, &morph
->end_extents
);
68 offset
= swfdec_bits_get_u32 (bits
);
69 swfdec_bits_init_bits (&bits2
, bits
, offset
);
71 parser
= swfdec_shape_parser_new ((SwfdecParseDrawFunc
) swfdec_pattern_parse_morph
,
72 (SwfdecParseDrawFunc
) swfdec_stroke_parse_morph
, s
);
73 swfdec_shape_parser_parse_morph (parser
, &bits2
, bits
);
74 SWFDEC_SHAPE (morph
)->draws
= swfdec_shape_parser_free (parser
);
76 if (swfdec_bits_left (&bits2
)) {
77 SWFDEC_WARNING ("early finish when parsing start shapes: %u bytes",
78 swfdec_bits_left (&bits2
));
81 return SWFDEC_STATUS_OK
;