2 * Copyright (C) 2006 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.
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
24 #include "swfdec_graphic_movie.h"
25 #include "swfdec_button.h"
26 #include "swfdec_debug.h"
27 #include "swfdec_edittext.h"
28 #include "swfdec_movie.h"
29 #include "swfdec_shape.h"
30 #include "swfdec_sprite.h"
31 #include "swfdec_swf_decoder.h"
32 #include "swfdec_swf_instance.h"
33 #include "swfdec_text.h"
35 G_DEFINE_TYPE (SwfdecGraphicMovie
, swfdec_graphic_movie
, SWFDEC_TYPE_MOVIE
)
38 swfdec_graphic_movie_update_extents (SwfdecMovie
*movie
,
41 swfdec_rect_union (extents
, extents
,
42 &movie
->graphic
->extents
);
46 swfdec_graphic_movie_render (SwfdecMovie
*movie
, cairo_t
*cr
,
47 const SwfdecColorTransform
*trans
, const SwfdecRect
*inval
, gboolean fill
)
49 swfdec_graphic_render (movie
->graphic
, cr
, trans
, inval
, fill
);
53 swfdec_graphic_movie_mouse_in (SwfdecMovie
*movie
, double x
, double y
)
55 return swfdec_graphic_mouse_in (movie
->graphic
, x
, y
);
59 swfdec_graphic_movie_replace (SwfdecMovie
*movie
, SwfdecGraphic
*graphic
)
61 if (SWFDEC_IS_SHAPE (graphic
) ||
62 SWFDEC_IS_TEXT (graphic
)) {
63 /* nothing to do here, please move along */
64 } else if (SWFDEC_IS_SPRITE (graphic
) ||
65 SWFDEC_IS_BUTTON (graphic
) ||
66 SWFDEC_IS_EDIT_TEXT (graphic
)) {
67 SWFDEC_INFO ("can't replace with scriptable objects");
70 SWFDEC_FIXME ("Can we replace with %s objects?", G_OBJECT_TYPE_NAME (graphic
));
73 SWFDEC_LOG ("replacing %u with %u", SWFDEC_CHARACTER (movie
->graphic
)->id
,
74 SWFDEC_CHARACTER (graphic
)->id
);
75 swfdec_movie_invalidate (movie
);
76 g_object_unref (movie
->graphic
);
77 movie
->graphic
= g_object_ref (graphic
);
78 swfdec_movie_queue_update (movie
, SWFDEC_MOVIE_INVALID_EXTENTS
);
82 swfdec_graphic_movie_class_init (SwfdecGraphicMovieClass
* g_class
)
84 SwfdecMovieClass
*movie_class
= SWFDEC_MOVIE_CLASS (g_class
);
86 movie_class
->update_extents
= swfdec_graphic_movie_update_extents
;
87 movie_class
->replace
= swfdec_graphic_movie_replace
;
88 movie_class
->render
= swfdec_graphic_movie_render
;
89 movie_class
->mouse_in
= swfdec_graphic_movie_mouse_in
;
93 swfdec_graphic_movie_init (SwfdecGraphicMovie
* graphic_movie
)