[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r9775: Add compile-time define to sw
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r9775: Add compile-time define to switch cached matrix parameters off |
Date: |
Thu, 18 Sep 2008 08:52:19 +0200 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 9775
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Thu 2008-09-18 08:52:19 +0200
message:
Add compile-time define to switch cached matrix parameters off
modified:
libcore/character.cpp
------------------------------------------------------------
revno: 9768.1.1
committer: Sandro Santilli <address@hidden>
branch nick: mybranch
timestamp: Thu 2008-09-18 08:49:30 +0200
message:
Add USE_MATRIX_CACHES macro to switch between cached parameters and not.
Defined by default, but can be useful for testing.
modified:
libcore/character.cpp
=== modified file 'libcore/character.cpp'
--- a/libcore/character.cpp 2008-09-17 15:30:44 +0000
+++ b/libcore/character.cpp 2008-09-18 06:49:30 +0000
@@ -41,6 +41,9 @@
#undef set_invalidated
+/// Undefine this to not use caches for matrix parameters
+#define USE_MATRIX_CACHES
+
namespace gnash
{
@@ -295,7 +298,11 @@
as_value rv;
if ( fn.nargs == 0 ) // getter
{
+#ifdef USE_MATRIX_CACHES
return as_value(ptr->_xscale);
+#else
+ return as_value(ptr->m_matrix.get_x_scale()*100);
+#endif
}
else // setter
{
@@ -326,7 +333,11 @@
as_value rv;
if ( fn.nargs == 0 ) // getter
{
+#ifdef USE_MATRIX_CACHES
return ptr->_yscale;
+#else
+ return ptr->m_matrix.get_y_scale() * 100;
+#endif
}
else // setter
{
@@ -535,7 +546,11 @@
as_value rv;
if ( fn.nargs == 0 ) // getter
{
+#ifdef USE_MATRIX_CACHES
return ptr->_rotation;
+#else
+ return ptr->m_matrix.get_rotation() * 180 / PI;
+#endif
}
else // setter
{
@@ -609,9 +624,11 @@
character::copyMatrix(const character& c)
{
m_matrix = c.m_matrix;
+#ifdef USE_MATRIX_CACHES
_xscale = c._xscale;
_yscale = c._yscale;
_rotation = c._rotation;
+#endif
}
void
@@ -623,12 +640,14 @@
set_invalidated(__FILE__, __LINE__);
m_matrix = m;
+#ifdef USE_MATRIX_CACHES
if ( updateCache ) // don't update caches if matrix wasn't
updated too
{
_xscale = m_matrix.get_x_scale() * 100.0;
_yscale = m_matrix.get_y_scale() * 100.0;
_rotation = m_matrix.get_rotation() * 180.0 / PI;
}
+#endif
}
}
@@ -760,6 +779,7 @@
void
character::set_x_scale(double scale_percent)
{
+#ifdef USE_MATRIX_CACHES
_xscale = scale_percent;
// As per misc-ming.all/matrix_test.{c,swf}
@@ -774,6 +794,12 @@
//m.set_scale_rotation(xscale, yscale, rotation);
m.set_x_scale(xscale);
set_matrix(m); // we updated the cache ourselves
+#else
+ double xscale = scale_percent / 100.0;
+ matrix m = get_matrix();
+ m.set_x_scale(xscale);
+ set_matrix(m); // we updated the cache ourselves
+#endif
transformedByScript();
}
@@ -789,6 +815,8 @@
rot += 360.0;
//log_debug("_rotation: %d", rot);
+
+#ifdef USE_MATRIX_CACHES
_rotation = rot;
double xscale = _xscale / 100.0;
@@ -798,6 +826,12 @@
matrix m = get_matrix();
m.set_scale_rotation(xscale, yscale, rotation);
set_matrix(m); // we updated the cache ourselves
+#else
+ double rotation = rot * PI / 180.0;
+ matrix m = get_matrix();
+ m.set_rotation(rotation);
+ set_matrix(m); // we updated the cache ourselves
+#endif
transformedByScript();
}
@@ -805,6 +839,7 @@
void
character::set_y_scale(double scale_percent)
{
+#ifdef USE_MATRIX_CACHES
_yscale = scale_percent;
double xscale = _xscale / 100.0;
@@ -814,6 +849,11 @@
matrix m = get_matrix();
m.set_scale_rotation(xscale, yscale, rotation);
set_matrix(m); // we updated the cache ourselves
+#else
+ matrix m = get_matrix();
+ m_matrix.set_y_scale(scale_percent / 100.0);
+ set_matrix(m); // we updated the cache ourselves
+#endif
transformedByScript();
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r9775: Add compile-time define to switch cached matrix parameters off,
Sandro Santilli <=