Sync to AGG tree to support stippi's Painter classes

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10693 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm
2005-01-12 11:05:58 +00:00
parent 75d0f2ba9b
commit abd0030237
52 changed files with 2979 additions and 287 deletions
+27 -20
View File
@@ -45,10 +45,12 @@ namespace agg
x(((x_ << 1) & ~1) | (flag & 1)),
y(((y_ << 1) & ~1) | (flag >> 1)) {}
unsigned vertex(double* x_, double* y_, double dx=0, double dy=0) const
unsigned vertex(double* x_, double* y_,
double dx=0, double dy=0,
double scale=1.0) const
{
*x_ = dx + (double(x >> 1) / coord_mult);
*y_ = dy + (double(y >> 1) / coord_mult);
*x_ = dx + (double(x >> 1) / coord_mult) * scale;
*y_ = dy + (double(y >> 1) / coord_mult) * scale;
switch(((y & 1) << 1) | (x & 1))
{
case cmd_move_to: return path_cmd_move_to;
@@ -171,7 +173,7 @@ namespace agg
rect_d bounds(1e100, 1e100, -1e100, -1e100);
if(m_storage.size() == 0)
{
bounds.x1 = bounds.x1 = bounds.x2 = bounds.y2 = 0.0;
bounds.x1 = bounds.y1 = bounds.x2 = bounds.y2 = 0.0;
}
else
{
@@ -212,7 +214,8 @@ namespace agg
m_ptr(0),
m_dx(0.0),
m_dy(0.0),
m_closed(true)
m_scale(1.0),
m_vertices(0)
{}
//--------------------------------------------------------------------
@@ -223,26 +226,28 @@ namespace agg
m_ptr(data),
m_dx(dx),
m_dy(dy),
m_closed(true)
m_vertices(0)
{}
//--------------------------------------------------------------------
void init(const int8u* data, unsigned size, double dx, double dy)
void init(const int8u* data, unsigned size,
double dx, double dy, double scale=1.0)
{
m_data = data;
m_end = data + size;
m_ptr = data;
m_dx = dx;
m_dy = dy;
m_closed = true;
m_data = data;
m_end = data + size;
m_ptr = data;
m_dx = dx;
m_dy = dy;
m_scale = scale;
m_vertices = 0;
}
//--------------------------------------------------------------------
void rewind(unsigned)
{
m_ptr = m_data;
m_closed = true;
m_ptr = m_data;
m_vertices = 0;
}
//--------------------------------------------------------------------
@@ -254,6 +259,7 @@ namespace agg
*y = 0;
return path_cmd_stop;
}
if(m_ptr == m_end)
{
*x = 0;
@@ -264,15 +270,15 @@ namespace agg
vertex_integer_type v;
memcpy(&v, m_ptr, sizeof(vertex_integer_type));
unsigned cmd = v.vertex(x, y, m_dx, m_dy);
if(is_move_to(cmd) && !m_closed)
unsigned cmd = v.vertex(x, y, m_dx, m_dy, m_scale);
if(is_move_to(cmd) && m_vertices > 2)
{
*x = 0;
*y = 0;
m_closed = true;
m_vertices = 0;
return path_cmd_end_poly | path_flags_close;
}
m_closed = false;
++m_vertices;
m_ptr += sizeof(vertex_integer_type);
return cmd;
}
@@ -283,7 +289,8 @@ namespace agg
const int8u* m_ptr;
double m_dx;
double m_dy;
bool m_closed;
double m_scale;
unsigned m_vertices;
};
}