[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r10713: Reduce size of fill_style fr
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r10713: Reduce size of fill_style from 112 to 80 bytes, w/out changing anything in terms of performance (just drop useless members). |
Date: |
Wed, 18 Mar 2009 14:47:58 +0100 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 10713
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Wed 2009-03-18 14:47:58 +0100
message:
Reduce size of fill_style from 112 to 80 bytes, w/out changing anything in
terms of performance (just drop useless members).
modified:
libcore/fill_style.cpp
libcore/fill_style.h
=== modified file 'libcore/fill_style.cpp'
--- a/libcore/fill_style.cpp 2009-03-13 23:10:05 +0000
+++ b/libcore/fill_style.cpp 2009-03-18 13:47:58 +0000
@@ -51,7 +51,6 @@
:
m_type(SWF::FILL_SOLID),
m_color(), // FF.FF.FF.FF
- _gradientBitmapInfo(0),
_bitmapInfo(0),
m_spread_mode(SWF::GRADIENT_SPREAD_PAD),
m_interpolation(SWF::GRADIENT_INTERPOL_NORMAL)
@@ -110,16 +109,16 @@
input_matrix.read(in);
// shouldn't this be in initializer's list ?
- m_gradient_matrix.set_identity();
+ _matrix.set_identity();
if (m_type == SWF::FILL_LINEAR_GRADIENT)
{
- m_gradient_matrix.set_translation(128, 0);
- m_gradient_matrix.set_scale(1.0/128, 1.0/128);
+ _matrix.set_translation(128, 0);
+ _matrix.set_scale(1.0/128, 1.0/128);
}
else // FILL_RADIAL_GRADIENT or FILL_FOCAL_GRADIENT
{
- m_gradient_matrix.set_translation(32, 32);
- m_gradient_matrix.set_scale(1.0/512, 1.0/512);
+ _matrix.set_translation(32, 32);
+ _matrix.set_scale(1.0/512, 1.0/512);
}
SWFMatrix m = input_matrix;
@@ -127,16 +126,16 @@
if (is_morph)
{
- pOther->m_gradient_matrix = m_gradient_matrix;
+ pOther->_matrix = _matrix;
}
- m_gradient_matrix.concatenate(m);
+ _matrix.concatenate(m);
if (is_morph)
{
input_matrix.read(in);
m = input_matrix;
m.invert();
- pOther->m_gradient_matrix.concatenate(m);
+ pOther->_matrix.concatenate(m);
}
// GRADIENT
@@ -235,10 +234,10 @@
pOther->m_color = pOther->m_gradients[0].m_color;
}
- _gradientBitmapInfo = create_gradient_bitmap();
+ _bitmapInfo = create_gradient_bitmap();
if (is_morph)
{
- pOther->_gradientBitmapInfo = pOther->need_gradient_bitmap();
+ pOther->_bitmapInfo = pOther->need_gradient_bitmap();
}
}
else if (m_type == SWF::FILL_TILED_BITMAP
@@ -280,16 +279,16 @@
// For some reason, it looks like they store the inverse of the
// TWIPS-to-texcoords SWFMatrix.
- m_bitmap_matrix = m.invert();
+ _matrix = m.invert();
if (is_morph)
{
pOther->_bitmapInfo = _bitmapInfo;
m.read(in);
- pOther->m_bitmap_matrix = m.invert();
+ pOther->_matrix = m.invert();
}
IF_VERBOSE_PARSE(
- log_parse("SWFMatrix: %s", m_bitmap_matrix);
+ log_parse("SWFMatrix: %s", _matrix);
);
}
else
@@ -334,14 +333,14 @@
fill_style::getBitmapMatrix() const
{
assert(m_type != SWF::FILL_SOLID);
- return m_bitmap_matrix;
+ return _matrix;
}
const SWFMatrix&
fill_style::getGradientMatrix() const
{
// TODO: Why do we separate bitmap and gradient matrices?
- return m_gradient_matrix;
+ return _matrix;
}
rgba
@@ -493,12 +492,12 @@
fill_style::need_gradient_bitmap() const
{
- if (!_gradientBitmapInfo) {
+ if (!_bitmapInfo) {
fill_style* this_non_const = const_cast<fill_style*>(this);
- this_non_const->_gradientBitmapInfo = create_gradient_bitmap();
+ this_non_const->_bitmapInfo = create_gradient_bitmap();
}
- return _gradientBitmapInfo.get();
+ return _bitmapInfo.get();
}
@@ -521,7 +520,7 @@
// @@ TODO morphed gradients don't come out exactly
// right; they shift around some. Not sure where the
// problem is.
- m_gradient_matrix.set_lerp(a.m_gradient_matrix, b.m_gradient_matrix, t);
+ _matrix.set_lerp(a._matrix, b._matrix, t);
// fill style gradients
assert(m_gradients.size() == a.m_gradients.size());
@@ -536,14 +535,14 @@
m_gradients[j].m_color.set_lerp(a.m_gradients[j].m_color,
b.m_gradients[j].m_color, t);
}
- _gradientBitmapInfo = NULL;
+ _bitmapInfo = NULL;
// fill style bitmap ID
_bitmapInfo = a._bitmapInfo;
assert(_bitmapInfo == b._bitmapInfo);
// fill style bitmap SWFMatrix
- m_bitmap_matrix.set_lerp(a.m_bitmap_matrix, b.m_bitmap_matrix, t);
+ _matrix.set_lerp(a._matrix, b._matrix, t);
}
@@ -563,7 +562,7 @@
:
m_type(SWF::FILL_CLIPPED_BITMAP),
_bitmapInfo(bitmap),
- m_bitmap_matrix(mat)
+ _matrix(mat)
{
}
@@ -580,8 +579,8 @@
{
m_type = SWF::FILL_LINEAR_GRADIENT;
m_gradients = gradients;
- m_gradient_matrix = mat;
- _gradientBitmapInfo = 0;
+ _matrix = mat;
+ _bitmapInfo = 0;
}
void
@@ -590,8 +589,8 @@
{
m_type = SWF::FILL_RADIAL_GRADIENT;
m_gradients = gradients;
- m_gradient_matrix = mat;
- _gradientBitmapInfo = 0;
+ _matrix = mat;
+ _bitmapInfo = 0;
}
@@ -599,7 +598,6 @@
void
fill_style::markReachableResources() const
{
- if ( _gradientBitmapInfo ) _gradientBitmapInfo->setReachable();
if ( _bitmapInfo ) _bitmapInfo->setReachable();
}
#endif // GNASH_USE_GC
=== modified file 'libcore/fill_style.h'
--- a/libcore/fill_style.h 2009-03-13 23:10:05 +0000
+++ b/libcore/fill_style.h 2009-03-18 13:47:58 +0000
@@ -151,7 +151,7 @@
void set_color(rgba new_color) { m_color = new_color; }
/// Get fill type, see SWF::fill_style_type
- int get_type() const { return m_type; }
+ uint8_t get_type() const { return m_type; }
SWF::gradient_spread_mode get_gradient_spread_mode()
{ return m_spread_mode; }
@@ -213,19 +213,25 @@
rgba sample_gradient(boost::uint8_t ratio) const;
friend class morph2_character_def;
-
+
/// Fill type, see SWF::fill_style_type
- int m_type;
+ uint8_t m_type;
+
+ // For BITMAP or GRADIENT types
+ SWFMatrix _matrix;
+
+ // For BITMAP or GRADIENT types
+ boost::intrusive_ptr<BitmapInfo> _bitmapInfo;
+
+ // For SOLID type (and arguably GRADIENT too)
rgba m_color;
- SWFMatrix m_gradient_matrix;
- float m_focal_point; // For focal fill gradients.
+
+ // Only for GRADIENT type
+ float m_focal_point; // For focal fill gradients.
std::vector<gradient_record> m_gradients;
- boost::intrusive_ptr<BitmapInfo> _gradientBitmapInfo;
- boost::intrusive_ptr<BitmapInfo> _bitmapInfo;
- SWFMatrix m_bitmap_matrix;
-
SWF::gradient_spread_mode m_spread_mode;
SWF::gradient_interpolation_mode m_interpolation;
+
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r10713: Reduce size of fill_style from 112 to 80 bytes, w/out changing anything in terms of performance (just drop useless members).,
Sandro Santilli <=