[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r12258: Initialize some class member
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r12258: Initialize some class members that weren't. Reorder classes to allow more |
Date: |
Fri, 18 Jun 2010 15:42:44 +0200 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 12258 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Fri 2010-06-18 15:42:44 +0200
message:
Initialize some class members that weren't. Reorder classes to allow more
efficient packing. Make more members of DisplayObject private to restrict
fiddling with them.
modified:
libcore/Bitmap.cpp
libcore/Button.cpp
libcore/Button.h
libcore/DisplayObject.cpp
libcore/DisplayObject.h
libcore/MovieClip.cpp
libcore/MovieClip.h
libcore/TextField.cpp
libcore/TextField.h
libcore/Video.cpp
=== modified file 'libcore/Bitmap.cpp'
--- a/libcore/Bitmap.cpp 2010-06-06 10:17:39 +0000
+++ b/libcore/Bitmap.cpp 2010-06-18 12:26:04 +0000
@@ -91,7 +91,7 @@
void
Bitmap::add_invalidated_bounds(InvalidatedRanges& ranges, bool force)
{
- if (!force && !m_invalidated) return;
+ if (!force && !invalidated()) return;
ranges.add(m_old_invalidated_ranges);
=== modified file 'libcore/Button.cpp'
--- a/libcore/Button.cpp 2010-06-17 09:36:43 +0000
+++ b/libcore/Button.cpp 2010-06-18 12:26:04 +0000
@@ -740,7 +740,7 @@
getActiveCharacters(actChars);
std::for_each(actChars.begin(), actChars.end(),
boost::bind(&DisplayObject::add_invalidated_bounds, _1,
- boost::ref(ranges), force||m_invalidated)
+ boost::ref(ranges), force || invalidated())
);
}
=== modified file 'libcore/Button.h'
--- a/libcore/Button.h 2010-06-18 09:32:57 +0000
+++ b/libcore/Button.h 2010-06-18 12:26:04 +0000
@@ -151,16 +151,6 @@
private:
- int _lastMouseFlags, _mouseFlags;
-
- MouseState _mouseState;
-
- const boost::intrusive_ptr<const SWF::DefineButtonTag> _def;
-
- DisplayObjects _stateCharacters;
-
- DisplayObjects _hitCharacters;
-
/// Returns all DisplayObjects that are active based on the current
state.
//
/// The "_visible" property does not matter here.
@@ -194,6 +184,17 @@
/// Return version of the SWF containing the button definition.
virtual int getDefinitionVersion() const;
+
+ int _lastMouseFlags, _mouseFlags;
+
+ MouseState _mouseState;
+
+ const boost::intrusive_ptr<const SWF::DefineButtonTag> _def;
+
+ DisplayObjects _stateCharacters;
+
+ DisplayObjects _hitCharacters;
+
};
=== modified file 'libcore/DisplayObject.cpp'
--- a/libcore/DisplayObject.cpp 2010-06-18 08:44:46 +0000
+++ b/libcore/DisplayObject.cpp 2010-06-18 12:26:04 +0000
@@ -83,25 +83,25 @@
DisplayObject* parent)
:
_parent(parent),
- m_invalidated(true),
- m_child_invalidated(true),
_object(object),
_stage(mr),
- m_depth(0),
_xscale(100),
_yscale(100),
_rotation(0),
+ _depth(0),
_volume(100),
m_ratio(0),
m_clip_depth(noClipDepthValue),
- _unloaded(false),
- _destroyed(false),
_mask(0),
_maskee(0),
_blendMode(BLENDMODE_NORMAL),
_visible(true),
_scriptTransformed(false),
- _dynamicallyCreated(false)
+ _dynamicallyCreated(false),
+ _unloaded(false),
+ _destroyed(false),
+ _invalidated(true),
+ _child_invalidated(true)
{
assert(m_old_invalidated_ranges.isNull());
@@ -216,9 +216,9 @@
// be updated even (or first of all) if the DisplayObject
// moves away from here.
//
- if ( ! m_invalidated )
+ if ( ! _invalidated )
{
- m_invalidated = true;
+ _invalidated = true;
#ifdef DEBUG_SET_INVALIDATED
log_debug("%p set_invalidated() of %s in %s:%d",
@@ -243,7 +243,7 @@
DisplayObject::add_invalidated_bounds(InvalidatedRanges& ranges, bool force)
{
ranges.add(m_old_invalidated_ranges);
- if (visible() && (m_invalidated||force))
+ if (visible() && (_invalidated||force))
{
SWFRect bounds;
bounds.expand_to_transformed_rect(getWorldMatrix(), getBounds());
@@ -254,9 +254,9 @@
void
DisplayObject::set_child_invalidated()
{
- if ( ! m_child_invalidated )
+ if ( ! _child_invalidated )
{
- m_child_invalidated=true;
+ _child_invalidated=true;
if ( _parent ) _parent->set_child_invalidated();
}
}
@@ -645,7 +645,7 @@
if (path.empty()) {
if (&getRoot(*_object).getRootMovie() == this) return "/";
std::stringstream ss;
- ss << "_level" << m_depth-DisplayObject::staticDepthOffset;
+ ss << "_level" << _depth-DisplayObject::staticDepthOffset;
return ss.str();
}
@@ -894,9 +894,9 @@
tr.append_child(it, StringPair(_("Blend mode"), os.str()));
#ifndef NDEBUG
// This probably isn't interesting for non-developers
- tr.append_child(it, StringPair(_("Invalidated"), m_invalidated ? yes :
no));
+ tr.append_child(it, StringPair(_("Invalidated"), _invalidated ? yes : no));
tr.append_child(it, StringPair(_("Child invalidated"),
- m_child_invalidated ? yes : no));
+ _child_invalidated ? yes : no));
#endif
return it;
}
=== modified file 'libcore/DisplayObject.h'
--- a/libcore/DisplayObject.h 2010-06-18 08:44:46 +0000
+++ b/libcore/DisplayObject.h 2010-06-18 12:26:04 +0000
@@ -247,9 +247,9 @@
virtual MovieClip* to_movie() { return 0; }
- int get_depth() const { return m_depth; }
+ int get_depth() const { return _depth; }
- void set_depth(int d) { m_depth = d; }
+ void set_depth(int d) { _depth = d; }
/// Get sound volume for this DisplayObject
int getVolume() const { return _volume; }
@@ -355,7 +355,7 @@
/// Returns the clipping depth (if any) of this DisplayObject.
/// The parameter tells us to use the DisplayObject as a mask for
- /// all the objects contained in the display list from m_depth
+ /// all the objects contained in the display list from _depth
/// to m_clipping_depth inclusive.
///
/// The value returned by get_clip_depth() is only valid when isMaskLayer()
@@ -695,6 +695,16 @@
return 0;
}
+ /// Return whether this DisplayObject has been invalidated or not
+ bool invalidated() const {
+ return _invalidated;
+ }
+
+ /// Return whether this DisplayObject has and invalidated child or not
+ bool childInvalidated() const {
+ return _child_invalidated;
+ }
+
/// @}
/// \brief
@@ -733,7 +743,6 @@
/// not need to redraw itself completely. This function will
/// recursively inform all its parents of the change.
void set_child_invalidated();
-
/// Clear invalidated flag and reset m_old_invalidated_bounds to null.
///
@@ -748,8 +757,8 @@
/// prevent the parent to be informed when this DisplayObject (or a
/// child) is invalidated again (see set_invalidated() recursion).
void clear_invalidated() {
- m_invalidated = false;
- m_child_invalidated = false;
+ _invalidated = false;
+ _child_invalidated = false;
m_old_invalidated_ranges.setNull();
}
@@ -769,7 +778,7 @@
///
/// It is used to determine what area needs to be re-rendered.
/// The coordinates are world coordinates (in TWIPS).
- /// Only instances with m_invalidated flag set are checked unless
+ /// Only instances with _invalidated flag set are checked unless
/// force is set.
///
virtual void add_invalidated_bounds(InvalidatedRanges& ranges, bool force);
@@ -1016,21 +1025,6 @@
as_object* getPathElementSeparator(string_table::key key);
/// \brief
- /// Set when the visual aspect of this particular DisplayObject or movie
- /// has been changed and redrawing is necessary.
- //
- /// This is initialized to true as the initial state for
- /// any DisplayObject is the "invisible" state (it wasn't there)
- /// so it starts in invalidated mode.
- ///
- bool m_invalidated;
-
- /// Just like m_invalidated but set when a child is invalidated instead
- /// of this DisplayObject instance. m_invalidated and m_child_invalidated
- /// can be set at the same time.
- bool m_child_invalidated;
-
- /// \brief
/// Bounds of this DisplayObject instance before first invalidation
/// since last call to clear_invalidated().
///
@@ -1061,15 +1055,20 @@
/// The movie_root to which this DisplayObject belongs.
movie_root& _stage;
- int m_depth;
cxform m_color_transform;
+
SWFMatrix m_matrix;
+
+ Events _event_handlers;
/// Cache values for ActionScript access.
/// NOTE: not all DisplayObjects need this, just the
/// ones which are ActionScript-referenceable
double _xscale, _yscale, _rotation;
+ /// The depth of this DisplayObject.
+ boost::int32_t _depth;
+
/// Volume control associated to this DisplayObject
//
/// This is used by Sound objects
@@ -1082,13 +1081,6 @@
int m_ratio;
int m_clip_depth;
- Events _event_handlers;
-
- /// Set to yes when this instance has been unloaded
- bool _unloaded;
-
- /// This flag should be set to true by a call to destroy()
- bool _destroyed;
/// The DisplayObject masking this instance (if any)
DisplayObject* _mask;
@@ -1114,6 +1106,28 @@
bool _dynamicallyCreated;
+ /// Set to yes when this instance has been unloaded
+ bool _unloaded;
+
+ /// This flag should be set to true by a call to destroy()
+ bool _destroyed;
+
+ /// \brief
+ /// Set when the visual aspect of this particular DisplayObject or movie
+ /// has been changed and redrawing is necessary.
+ //
+ /// This is initialized to true as the initial state for
+ /// any DisplayObject is the "invisible" state (it wasn't there)
+ /// so it starts in invalidated mode.
+ ///
+ bool _invalidated;
+
+ /// Just like _invalidated but set when a child is invalidated instead
+ /// of this DisplayObject instance. _invalidated and _child_invalidated
+ /// can be set at the same time.
+ bool _child_invalidated;
+
+
};
inline bool
=== modified file 'libcore/MovieClip.cpp'
--- a/libcore/MovieClip.cpp 2010-06-17 12:07:20 +0000
+++ b/libcore/MovieClip.cpp 2010-06-18 12:26:04 +0000
@@ -358,12 +358,11 @@
_def(def),
_swf(r),
_playState(PLAYSTATE_PLAY),
+ _environment(getVM(*object)),
_currentFrame(0),
+ m_sound_stream_id(-1),
_hasLooped(false),
_callingFrameActions(false),
- _environment(getVM(*object)),
- m_sound_stream_id(-1),
- _droptarget(),
_lockroot(false)
{
assert(_swf);
@@ -1105,7 +1104,7 @@
void MovieClip::omit_display()
{
- if (m_child_invalidated) _displayList.omit_display();
+ if (childInvalidated()) _displayList.omit_display();
clear_invalidated();
}
@@ -1679,21 +1678,21 @@
return;
}
- if ( ! m_invalidated && ! m_child_invalidated && ! force )
+ if ( ! invalidated() && ! childInvalidated() && ! force )
{
return;
}
// m_child_invalidated does not require our own bounds
- if ( m_invalidated || force )
+ if (invalidated() || force)
{
// Add old invalidated bounds
ranges.add(m_old_invalidated_ranges);
}
- _displayList.add_invalidated_bounds(ranges, force||m_invalidated);
+ _displayList.add_invalidated_bounds(ranges, force || invalidated());
/// Add drawable.
SWFRect bounds;
=== modified file 'libcore/MovieClip.h'
--- a/libcore/MovieClip.h 2010-06-18 09:32:57 +0000
+++ b/libcore/MovieClip.h 2010-06-18 12:26:04 +0000
@@ -873,8 +873,23 @@
PlayState _playState;
+ /// This timeline's variable scope
+ as_environment _environment;
+
+ /// We'll only allocate Textfield variables map if
+ /// we need them (ie: anyone calls set_textfield_variable)
+ ///
+ std::auto_ptr<TextFieldIndex> _text_variables;
+
+ cxform _userCxform;
+
+ std::string _droptarget;
+
// 0-based index to current frame
size_t _currentFrame;
+
+ /// soundid for current playing stream. If no stream set to -1
+ int m_sound_stream_id;
// true if this sprite reached the last frame and restarted
bool _hasLooped;
@@ -882,21 +897,6 @@
// true is we're calling frame actions
bool _callingFrameActions;
- /// This timeline's variable scope
- as_environment _environment;
-
- /// We'll only allocate Textfield variables map if
- /// we need them (ie: anyone calls set_textfield_variable)
- ///
- std::auto_ptr<TextFieldIndex> _text_variables;
-
- /// soundid for current playing stream. If no stream set to -1
- int m_sound_stream_id;
-
- cxform _userCxform;
-
- std::string _droptarget;
-
bool _lockroot;
};
=== modified file 'libcore/TextField.cpp'
--- a/libcore/TextField.cpp 2010-06-09 14:39:48 +0000
+++ b/libcore/TextField.cpp 2010-06-18 12:26:04 +0000
@@ -75,49 +75,50 @@
:
InteractiveObject(object, parent),
_tag(&def),
- _textDefined(def.hasText()),
- _htmlTextDefined(def.hasText()),
- _restrictDefined(false),
- _underlined(false),
- _bullet(false),
_url(""),
_target(""),
_display(),
_tabStops(),
+ _variable_name(def.variableName()),
+ _backgroundColor(255,255,255,255),
+ _borderColor(0,0,0,255),
+ _textColor(def.color()),
+ _alignment(def.alignment()),
+ _font(0),
+ m_cursor(0u),
+ _glyphcount(0u),
+ _scroll(0u),
+ _maxScroll(1u),
+ _hScroll(0u),
+ _maxHScroll(0u),
+ _bottomScroll(0u),
+ _linesindisplay(0u),
+ _maxChars(def.maxChars()),
+ _autoSize(def.autoSize() ? AUTOSIZE_LEFT : AUTOSIZE_NONE),
+ _type(def.readOnly() ? typeDynamic : typeInput),
+ _bounds(def.bounds()),
+ _selection(0, 0),
_leading(def.leading()),
- _alignment(def.alignment()),
_indent(def.indent()),
_blockIndent(0),
_leftMargin(def.leftMargin()),
_rightMargin(def.rightMargin()),
_fontHeight(def.textHeight()),
- _font(0),
+ _textDefined(def.hasText()),
+ _htmlTextDefined(def.hasText()),
+ _restrictDefined(false),
+ _underlined(false),
+ _bullet(false),
m_has_focus(false),
- m_cursor(0u),
- _glyphcount(0u),
- _scroll(0u),
- _maxScroll(1u),
- _hScroll(0u),
- _maxHScroll(0u),
- _bottomScroll(0u),
_multiline(def.multiline()),
_password(def.password()),
- _maxChars(def.maxChars()),
_text_variable_registered(false),
- _variable_name(def.variableName()),
_drawBackground(def.border()),
- _backgroundColor(255,255,255,255),
_drawBorder(def.border()),
- _borderColor(0,0,0,255),
- _textColor(def.color()),
_embedFonts(def.getUseEmbeddedGlyphs()),
_wordWrap(def.wordWrap()),
_html(def.html()),
- _selectable(!def.noSelect()),
- _autoSize(def.autoSize() ? AUTOSIZE_LEFT : AUTOSIZE_NONE),
- _type(def.readOnly() ? typeDynamic : typeInput),
- _bounds(def.bounds()),
- _selection(0, 0)
+ _selectable(!def.noSelect())
{
assert(object);
@@ -146,48 +147,49 @@
const SWFRect& bounds)
:
InteractiveObject(object, parent),
- _textDefined(false),
- _htmlTextDefined(false),
- _restrictDefined(false),
- _underlined(false),
- _bullet(false),
_url(""),
_target(""),
_display(),
_tabStops(),
+ _backgroundColor(255,255,255,255),
+ _borderColor(0, 0, 0, 255),
+ _textColor(0, 0, 0, 255),
+ _alignment(ALIGN_LEFT),
+ _font(0),
+ m_cursor(0u),
+ _glyphcount(0u),
+ _scroll(0u),
+ _maxScroll(1u),
+ _hScroll(0u),
+ _maxHScroll(0u),
+ _bottomScroll(0u),
+ _linesindisplay(0u),
+ _maxChars(0),
+ _autoSize(AUTOSIZE_NONE),
+ _type(typeDynamic),
+ _bounds(bounds),
+ _selection(0, 0),
_leading(0),
- _alignment(ALIGN_LEFT),
_indent(0),
_blockIndent(0),
_leftMargin(0),
_rightMargin(0),
_fontHeight(12 * 20),
- _font(0),
+ _textDefined(false),
+ _htmlTextDefined(false),
+ _restrictDefined(false),
+ _underlined(false),
+ _bullet(false),
m_has_focus(false),
- m_cursor(0u),
- _glyphcount(0u),
- _scroll(0u),
- _maxScroll(1u),
- _hScroll(0u),
- _maxHScroll(0u),
- _bottomScroll(0u),
_multiline(false),
_password(false),
- _maxChars(0),
_text_variable_registered(false),
_drawBackground(false),
- _backgroundColor(255,255,255,255),
_drawBorder(false),
- _borderColor(0, 0, 0, 255),
- _textColor(0, 0, 0, 255),
- _embedFonts(false), // ?
+ _embedFonts(false),
_wordWrap(false),
_html(false),
- _selectable(true),
- _autoSize(AUTOSIZE_NONE),
- _type(typeDynamic),
- _bounds(bounds),
- _selection(0, 0)
+ _selectable(true)
{
// Use the default font (Times New Roman for Windows, Times for Mac
// according to docs. They don't say what it is for Linux.
@@ -376,7 +378,7 @@
TextField::add_invalidated_bounds(InvalidatedRanges& ranges,
bool force)
{
- if (!force && !m_invalidated) return; // no need to redraw
+ if (!force && !invalidated()) return; // no need to redraw
ranges.add(m_old_invalidated_ranges);
=== modified file 'libcore/TextField.h'
--- a/libcore/TextField.h 2010-06-09 14:39:48 +0000
+++ b/libcore/TextField.h 2010-06-18 12:26:04 +0000
@@ -690,6 +690,12 @@
///
VariableRef parseTextVariableRef(const std::string& variableName) const;
+ /// Called in display(), sets the cursor using m_cursor and _textRecords
+ //
+ /// @param renderer
+ /// @param mat
+ void show_cursor(Renderer& renderer, const SWFMatrix& mat);
+
/// The immutable definition of our TextField
//
/// This is NULL for dynamic TextFields.
@@ -707,25 +713,15 @@
//
std::wstring _htmlText;
- /// This flag will be true as soon as the TextField
- /// is assigned a text value. Only way to be false is
- /// when definition has the hasText flag set to false
- /// and no actionscript added text.
- bool _textDefined;
-
- bool _htmlTextDefined;
-
- bool _restrictDefined;
-
/// bounds of dynamic text, as laid out
SWFRect m_text_bounding_box;
typedef std::vector<SWF::TextRecord> TextRecords;
TextRecords _textRecords;
+
std::vector<size_t> _recordStarts;
+
TextRecords _displayRecords;
- bool _underlined;
- bool _bullet;
std::string _url;
std::string _target;
@@ -733,27 +729,24 @@
std::set<wchar_t> _restrictedchars;
TextFormatDisplay _display;
std::vector<int> _tabStops;
+ LineStarts _line_starts;
+
+ /// The text variable name
+ //
+ /// This is stored here, and not just in the definition,
+ /// because it can be changed programmatically, by setting
+ /// 'TextFields.variable'
+ std::string _variable_name;
+
+ rgba _backgroundColor;
+
+ rgba _borderColor;
+
+ rgba _textColor;
- boost::int32_t _numChars;
- boost::int16_t _leading;
-
TextAlignment _alignment;
- boost::uint16_t _indent;
-
- /// Indentation for every line (including the ones created by
- /// effect of a word-wrap.
- boost::uint16_t _blockIndent;
-
- boost::uint16_t _leftMargin;
-
- boost::uint16_t _rightMargin;
-
- boost::uint16_t _fontHeight;
-
boost::intrusive_ptr<const Font> _font;
-
- bool m_has_focus;
size_t m_cursor;
size_t _glyphcount;
size_t _scroll;
@@ -761,24 +754,60 @@
size_t _hScroll;
size_t _maxHScroll;
size_t _bottomScroll;
- /// Called in display(), this sets the cursor using m_cursor and
_textRecords
- //
- /// @param renderer
- /// @param mat
- void show_cursor(Renderer& renderer, const SWFMatrix& mat);
-
- LineStarts _line_starts;
-
size_t _linesindisplay;
+ /// Corresponds to the maxChars property.
+ size_t _maxChars;
+
+ AutoSize _autoSize;
+
+ TypeValue _type;
+
+ /// Area in which the text is drawn.
+ //
+ /// This area encloses all the text, can be automatically
+ /// extended to fit text or hide text overflowing it.
+ /// See the setAutoSize() method to change that.
+ ///
+ SWFRect _bounds;
+
+ /// Represents the selected part of the text. The second element must
+ /// never be less than the first.
+ std::pair<size_t, size_t> _selection;
+
+ boost::int16_t _leading;
+ boost::uint16_t _indent;
+
+ /// Indentation for every line (including the ones created by
+ /// effect of a word-wrap.
+ boost::uint16_t _blockIndent;
+
+ boost::uint16_t _leftMargin;
+
+ boost::uint16_t _rightMargin;
+
+ boost::uint16_t _fontHeight;
+
+ /// This flag will be true as soon as the TextField
+ /// is assigned a text value. Only way to be false is
+ /// when definition has the hasText flag set to false
+ /// and no actionscript added text.
+ bool _textDefined;
+
+ bool _htmlTextDefined;
+
+ bool _restrictDefined;
+ bool _underlined;
+ bool _bullet;
+
+ bool m_has_focus;
+
+
/// Corresponds to the multiline property.
bool _multiline;
/// Corresponds to the password property.
bool _password;
-
- /// Corresponds to the maxChars property.
- size_t _maxChars;
/// The flag keeping status of TextVariable registration
//
@@ -787,23 +816,10 @@
///
bool _text_variable_registered;
- /// The text variable name
- //
- /// This is stored here, and not just in the definition,
- /// because it can be changed programmatically, by setting
- /// 'TextFields.variable'
- std::string _variable_name;
-
bool _drawBackground;
- rgba _backgroundColor;
-
bool _drawBorder;
- rgba _borderColor;
-
- rgba _textColor;
-
bool _embedFonts;
bool _wordWrap;
@@ -811,22 +827,6 @@
bool _html;
bool _selectable;
-
- AutoSize _autoSize;
-
- TypeValue _type;
-
- /// Area in which the text is drawn.
- //
- /// This area encloses all the text, can be automatically
- /// extended to fit text or hide text overflowing it.
- /// See the setAutoSize() method to change that.
- ///
- SWFRect _bounds;
-
- /// Represents the selected part of the text. The second element must
- /// never be less than the first.
- std::pair<size_t, size_t> _selection;
};
=== modified file 'libcore/Video.cpp'
--- a/libcore/Video.cpp 2010-06-06 10:17:39 +0000
+++ b/libcore/Video.cpp 2010-06-18 12:26:04 +0000
@@ -261,7 +261,7 @@
void
Video::add_invalidated_bounds(InvalidatedRanges& ranges, bool force)
{
- if (!force && !m_invalidated) return; // no need to redraw
+ if (!force && !invalidated()) return; // no need to redraw
ranges.add(m_old_invalidated_ranges);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r12258: Initialize some class members that weren't. Reorder classes to allow more,
Benjamin Wolsey <=