1
// RemoveObjectTag.cpp: RemoveObject* tag for Gnash.
3
// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
5
// This program is free software; you can redistribute it and/or modify
6
// it under the terms of the GNU General Public License as published by
7
// the Free Software Foundation; either version 3 of the License, or
8
// (at your option) any later version.
10
// This program is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
// GNU General Public License for more details.
15
// You should have received a copy of the GNU General Public License
16
// along with this program; if not, write to the Free Software
17
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
/* $Id: RemoveObjectTag.cpp,v 1.7 2008/01/21 20:56:02 rsavoye Exp $ */
23
#include "gnashconfig.h"
26
#include "RemoveObjectTag.h"
27
#include "sprite_instance.h"
28
#include "swf.h" // for tag_type definition
36
RemoveObjectTag::read(stream* in, tag_type tag)
38
assert(tag == SWF::REMOVEOBJECT || tag == SWF::REMOVEOBJECT2);
40
if (tag == SWF::REMOVEOBJECT)
42
// Older SWF's allow multiple objects at the same depth;
43
// this m_id disambiguates. Later SWF's just use one
45
m_id = in->read_u16();
48
m_depth = in->read_u16()+character::staticDepthOffset;
52
RemoveObjectTag::execute(sprite_instance* m) const
54
m->remove_display_object(m_depth, m_id);
59
RemoveObjectTag::loader(stream* in, tag_type tag, movie_definition* m)
61
assert(tag == SWF::REMOVEOBJECT || tag == SWF::REMOVEOBJECT2);
63
std::auto_ptr<RemoveObjectTag> t ( new RemoveObjectTag );
66
int depth = t->getDepth();
70
log_parse(_(" remove_object_2(%d)"), depth);
73
if ( depth < 0 && depth >= character::staticDepthOffset )
75
m->removeTimelineDepth(depth);
79
log_debug("RemoveObjectTag depth %d is out of static depth zone. Won't unregister its TimelineDepth.", depth);
82
// Ownership transferred to movie_definition
83
m->addControlTag(t.release());
86
} // namespace gnash::SWF
91
// indent-tabs-mode: t