[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/shape.h server/parser/mo...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/shape.h server/parser/mo... |
Date: |
Wed, 14 Feb 2007 13:50:30 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/02/14 13:50:30
Modified files:
. : ChangeLog
server : shape.h
server/parser : morph2_character_def.cpp
shape_character_def.cpp
Log message:
* server/shape.h: add more public functions for
manipulation.
* server/parser/morph2_character_def.cpp: try to
avoid direct access to shape private wonnabes;
simplified code, hopefully more readable now.
* server/parser/shape_character_def.cpp: try
to avoid direct access to shape pritave wonnabes.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2359&r2=1.2360
http://cvs.savannah.gnu.org/viewcvs/gnash/server/shape.h?cvsroot=gnash&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/morph2_character_def.cpp?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/shape_character_def.cpp?cvsroot=gnash&r1=1.10&r2=1.11
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2359
retrieving revision 1.2360
diff -u -b -r1.2359 -r1.2360
--- ChangeLog 14 Feb 2007 12:48:18 -0000 1.2359
+++ ChangeLog 14 Feb 2007 13:50:30 -0000 1.2360
@@ -1,5 +1,15 @@
2007-02-14 Sandro Santilli <address@hidden>
+ * server/shape.h: add more public functions for
+ manipulation.
+ * server/parser/morph2_character_def.cpp: try to
+ avoid direct access to shape private wonnabes;
+ simplified code, hopefully more readable now.
+ * server/parser/shape_character_def.cpp: try
+ to avoid direct access to shape pritave wonnabes.
+
+2007-02-14 Sandro Santilli <address@hidden>
+
* server/shape.{cpp,h}: added primitives for
drawing API: drawLineTo, drawCurveTo.
Method names track Ming interface.
Index: server/shape.h
===================================================================
RCS file: /sources/gnash/gnash/server/shape.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- server/shape.h 14 Feb 2007 13:10:11 -0000 1.17
+++ server/shape.h 14 Feb 2007 13:50:30 -0000 1.18
@@ -5,7 +5,7 @@
// Quadratic bezier outline shapes, the basis for most SWF rendering.
-/* $Id: shape.h,v 1.17 2007/02/14 13:10:11 strk Exp $ */
+/* $Id: shape.h,v 1.18 2007/02/14 13:50:30 strk Exp $ */
#ifndef GNASH_SHAPE_H
#define GNASH_SHAPE_H
@@ -135,45 +135,100 @@
///
void drawCurveTo(float cx, float cy, float ax, float ay);
+ /// Remove all edges and reset style infomation
+ void clear()
+ {
+ m_edges.resize(0);
+ m_fill0 = m_fill1 = m_line = 0;
+ }
+
/// @} Primitives for the Drawing API
/// Set the fill to use on the left side
//
/// @param f
- /// The fill index. When this path is
- /// added to a shape_character_def, the
- /// fill will reference the vector of
- /// fill_style defined for that shape
+ /// The fill index (1-based).
+ /// When this path is added to a shape_character_def,
+ /// the index (decremented by 1) will reference an element
+ /// in the fill_style vector defined for that shape.
+ /// If zero, no fill will be active.
///
- void setLeftFill(int f)
+ void setLeftFill(unsigned f)
{
m_fill0 = f;
}
+ unsigned getLeftFill() const
+ {
+ return m_fill0;
+ }
+
/// Set the fill to use on the left side
//
/// @param f
- /// The fill index. When this path is
- /// added to a shape_character_def, the
- /// fill will reference the vector of
- /// fill_style defined for that shape
+ /// The fill index (1-based).
+ /// When this path is added to a shape_character_def,
+ /// the index (decremented by 1) will reference an element
+ /// in the fill_style vector defined for that shape.
+ /// If zero, no fill will be active.
///
- void setRightFill(int f)
+ void setRightFill(unsigned f)
{
m_fill1 = f;
}
+ unsigned getRightFill() const
+ {
+ return m_fill1;
+ }
+
+ /// Set the line style to use for this path
+ //
+ /// @param f
+ /// The line_style index (1-based).
+ /// When this path is added to a shape_character_def,
+ /// the index (decremented by 1) will reference an element
+ /// in the line_style vector defined for that shape.
+ /// If zero, no fill will be active.
+ ///
+ void setLineStyle(unsigned i)
+ {
+ m_line = i;
+ }
+
+ unsigned getLineStyle() const
+ {
+ return m_line;
+ }
+
+ /// Return the number of edges in this path
+ size_t size() const
+ {
+ return m_edges.size();
+ }
+
+ /// Return a reference to the Nth edge
+ edge& operator[] (size_t n)
+ {
+ return m_edges[n];
+ }
+
+ /// Return a const reference to the Nth edge
+ const edge& operator[] (size_t n) const
+ {
+ return m_edges[n];
+ }
//private:
/// Left fill style index (1-based)
- int m_fill0;
+ unsigned m_fill0;
/// Right fill style index (1-based)
- int m_fill1;
+ unsigned m_fill1;
/// Line style index (1-based)
- int m_line;
+ unsigned m_line;
/// Path/shape origin
float m_ax, m_ay;
Index: server/parser/morph2_character_def.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/morph2_character_def.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/parser/morph2_character_def.cpp 7 Oct 2006 15:08:26 -0000
1.3
+++ server/parser/morph2_character_def.cpp 14 Feb 2007 13:50:30 -0000
1.4
@@ -68,33 +68,36 @@
{
path& p = m_paths[i];
const path& p1 = m_shape1->get_paths()[i];
+ const path& p2 = m_shape2->get_paths()[n];
- p.m_fill0 = p1.m_fill0;
- p.m_fill1 = p1.m_fill1;
+ float new_ax = flerp(p1.m_ax, p2.m_ax, ratio);
+ float new_ay = flerp(p1.m_ay, p2.m_ay, ratio);
+
+ p.reset ( new_ax, new_ay, p1.getLeftFill(),
p2.getRightFill(), p1.getLineStyle() );
// @@ hack.
- if (p.m_fill0 == 0 && p.m_fill1 == 0)
+ if (p.getLeftFill() == 0 && p.getRightFill() == 0)
{
- if (m_shape1->get_fill_styles().size() > 0)
p.m_fill0 = 1;
+ if (m_shape1->get_fill_styles().size() > 0)
p.setLeftFill(1);
}
- p.m_line = p1.m_line;
-
- p.m_ax = flerp(p1.m_ax, m_shape2->get_paths()[n].m_ax,
ratio);
- p.m_ay = flerp(p1.m_ay, m_shape2->get_paths()[n].m_ay,
ratio);
// edges;
- int len = p1.m_edges.size();
+ size_t len = p1.size();
p.m_edges.resize(len);
- for (unsigned int j=0; j < p.m_edges.size(); j++)
+ for (size_t j=0; j < p.size(); j++)
{
- p.m_edges[j].m_cx = flerp(p1.m_edges[j].m_cx,
m_shape2->get_paths()[n].m_edges[k].m_cx, ratio);
- p.m_edges[j].m_cy = flerp(p1.m_edges[j].m_cy,
m_shape2->get_paths()[n].m_edges[k].m_cy, ratio);
- p.m_edges[j].m_ax = flerp(p1.m_edges[j].m_ax,
m_shape2->get_paths()[n].m_edges[k].m_ax, ratio);
- p.m_edges[j].m_ay = flerp(p1.m_edges[j].m_ay,
m_shape2->get_paths()[n].m_edges[k].m_ay, ratio);
+ edge& e = p[j];
+ const edge& e1 = p1[j];
+ const edge& e2 = p2[k];
+
+ e.m_cx = flerp(e1.m_cx, e2.m_cx, ratio);
+ e.m_cy = flerp(e1.m_cy, e2.m_cy, ratio);
+ e.m_ax = flerp(e1.m_ax, e2.m_ax, ratio);
+ e.m_ay = flerp(e1.m_ay, e2.m_ay, ratio);
k++;
- if (m_shape2->get_paths()[n].m_edges.size() <=
k)
+ if (p2.size() <= k)
{
k=0; n++;
}
Index: server/parser/shape_character_def.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/shape_character_def.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- server/parser/shape_character_def.cpp 7 Feb 2007 08:43:33 -0000
1.10
+++ server/parser/shape_character_def.cpp 14 Feb 2007 13:50:30 -0000
1.11
@@ -6,7 +6,7 @@
// Quadratic bezier outline shapes, the basis for most SWF rendering.
-/* $Id: shape_character_def.cpp,v 1.10 2007/02/07 08:43:33 strk Exp $ */
+/* $Id: shape_character_def.cpp,v 1.11 2007/02/14 13:50:30 strk Exp $ */
#include "shape_character_def.h"
@@ -233,11 +233,11 @@
if (style > 0) {
style += fill_base;
}
- current_path.m_fill0 = style;
+ current_path.setLeftFill(style);
IF_VERBOSE_PARSE
(
if (SHAPE_LOG) {
- log_parse(" shape_character read: fill0 = %d",
current_path.m_fill0);
+ log_parse(" shape_character read: fill0 (left) = %d",
current_path.getLeftFill());
}
);
@@ -254,10 +254,10 @@
if (style > 0) {
style += fill_base;
}
- current_path.m_fill1 = style;
+ current_path.setRightFill(style); // getRightFill() = style;
IF_VERBOSE_PARSE (
if (SHAPE_LOG) {
- log_parse(" shape_character read: fill1 = %d",
current_path.m_fill1);
+ log_parse(" shape_character read: fill1 (right) = %d",
current_path.getRightFill());
}
);
}
@@ -273,11 +273,11 @@
if (style > 0) {
style += line_base;
}
- current_path.m_line = style;
+ current_path.setLineStyle(style);
IF_VERBOSE_PARSE (
if (SHAPE_LOG)
{
- log_parse(" shape_character_read: line = %d",
current_path.m_line);
+ log_parse(" shape_character_read: line = %d",
current_path.getLineStyle());
}
);
}
@@ -294,13 +294,9 @@
// Store the current path if any.
if (! current_path.is_empty()) {
m_paths.push_back(current_path);
- current_path.m_edges.resize(0);
-
- // Clear styles.
- current_path.m_fill0 = -1;
- current_path.m_fill1 = -1;
- current_path.m_line = -1;
+ current_path.clear();
}
+
// Tack on an empty path signalling a new shape.
// @@ need better understanding of whether this is correct??!?!!
// @@ i.e., we should just start a whole new shape here, right?
@@ -459,7 +455,7 @@
// if (i > 0) break;//xxxxxxxx
const path& p = paths[i];
- if (p.m_fill0 == 0 && p.m_fill1 == 0) {
+ if (p.getLeftFill() == 0 && p.getRightFill() == 0) {
continue;
}
@@ -467,8 +463,8 @@
// Color the line according to which side has
// fills.
- if (p.m_fill0 == 0) glColor4f(1, 0, 0, 0.5);
- else if (p.m_fill1 == 0) glColor4f(0, 1, 0, 0.5);
+ if (p.getLeftFill() == 0) glColor4f(1, 0, 0, 0.5);
+ else if (p.getRightFill() == 0) glColor4f(0, 1, 0, 0.5);
else glColor4f(0, 0, 1, 0.5);
// Offset according to which loop we are.
@@ -506,7 +502,7 @@
right = point(-dir.m_y, dir.m_x); // perpendicular
const float ARROW_MAG = 60.f; // TWIPS?
- if (p.m_fill0 != 0)
+ if (p.getLeftFill() != 0)
{
glColor4f(0, 1, 0, 0.5);
glVertex2f(p0.m_x,
@@ -516,9 +512,9 @@
show_fill_number(point(p0.m_x - right.m_x * ARROW_MAG *
4,
p0.m_y - right.m_y * ARROW_MAG *
4),
- p.m_fill0);
+ p.getLeftFill());
}
- if (p.m_fill1 != 0)
+ if (p.getRightFill() != 0)
{
glColor4f(1, 0, 0, 0.5);
glVertex2f(p0.m_x,
@@ -528,7 +524,7 @@
show_fill_number(point(p0.m_x + right.m_x * ARROW_MAG *
4,
p0.m_y + right.m_y * ARROW_MAG *
4),
- p.m_fill1);
+ p.getRightFill());
}
}}
glEnd();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog server/shape.h server/parser/mo...,
Sandro Santilli <=