* long overdue update to AGG 2.4

* removed the useless parts of AGG (which are only needed for the
  interactive examples)
* make sure to jam -a libagg.a to solve any linking issues


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17838 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2006-06-14 14:30:17 +00:00
parent a58450492a
commit e39da397f5
229 changed files with 23117 additions and 18461 deletions
+34 -44
View File
@@ -1,6 +1,6 @@
//----------------------------------------------------------------------------
// Anti-Grain Geometry - Version 2.2
// Copyright (C) 2002-2004 Maxim Shemanarev (http://www.antigrain.com)
// Anti-Grain Geometry - Version 2.4
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
@@ -20,7 +20,7 @@
#ifndef AGG_RENDERING_BUFFER_INCLUDED
#define AGG_RENDERING_BUFFER_INCLUDED
#include "agg_basics.h"
#include "agg_array.h"
namespace agg
{
@@ -39,31 +39,23 @@ namespace agg
x1(x1_), x2(x2_), ptr(ptr_) {}
};
//-------------------------------------------------------------------
~row_ptr_cache()
{
delete [] m_rows;
}
//-------------------------------------------------------------------
row_ptr_cache() :
m_buf(0),
m_rows(0),
m_rows(),
m_width(0),
m_height(0),
m_stride(0),
m_max_height(0)
m_stride(0)
{
}
//--------------------------------------------------------------------
row_ptr_cache(T* buf, unsigned width, unsigned height, int stride) :
m_buf(0),
m_rows(0),
m_rows(),
m_width(0),
m_height(0),
m_stride(0),
m_max_height(0)
m_stride(0)
{
attach(buf, width, height, stride);
}
@@ -75,10 +67,9 @@ namespace agg
m_width = width;
m_height = height;
m_stride = stride;
if(height > m_max_height)
if(height > m_rows.size())
{
delete [] m_rows;
m_rows = new T* [m_max_height = height];
m_rows.resize(height);
}
T* row_ptr = m_buf;
@@ -88,7 +79,7 @@ namespace agg
row_ptr = m_buf - int(height - 1) * stride;
}
T** rows = m_rows;
T** rows = &m_rows[0];
while(height--)
{
@@ -98,37 +89,42 @@ namespace agg
}
//--------------------------------------------------------------------
T* buf() { return m_buf; }
const T* buf() const { return m_buf; }
unsigned width() const { return m_width; }
unsigned height() const { return m_height; }
int stride() const { return m_stride; }
unsigned stride_abs() const
{
return (m_stride < 0) ?
unsigned(-m_stride) :
unsigned(m_stride);
return (m_stride < 0) ? unsigned(-m_stride) : unsigned(m_stride);
}
//--------------------------------------------------------------------
T* row(unsigned y) { return m_rows[y]; }
const T* row(unsigned y) const { return m_rows[y]; }
T const* const* rows() const { return m_rows; }
T* row_ptr(int, int y, unsigned) { return m_rows[y]; }
T* row_ptr(int y) { return m_rows[y]; }
const T* row_ptr(int y) const { return m_rows[y]; }
row_data row (int y) const { return row_data(0, m_width-1, m_rows[y]); }
//--------------------------------------------------------------------
void copy_from(const row_ptr_cache<T>& mtx)
T const* const* rows() const { return &m_rows[0]; }
//--------------------------------------------------------------------
template<class RenBuf>
void copy_from(const RenBuf& src)
{
unsigned h = height();
if(mtx.height() < h) h = mtx.height();
if(src.height() < h) h = src.height();
unsigned l = stride_abs();
if(mtx.stride_abs() < l) l = mtx.stride_abs();
if(src.stride_abs() < l) l = src.stride_abs();
l *= sizeof(T);
unsigned y;
unsigned w = width();
for (y = 0; y < h; y++)
{
memcpy(row(y), mtx.row(y), l);
memcpy(row_ptr(0, y, w), src.row_ptr(y), l);
}
}
@@ -136,32 +132,26 @@ namespace agg
void clear(T value)
{
unsigned y;
unsigned w = width();
unsigned stride = stride_abs();
for(y = 0; y < height(); y++)
{
T* p = row(y);
T* p = row_ptr(0, y, w);
unsigned x;
for(x = 0; x < stride_abs(); x++)
for(x = 0; x < stride; x++)
{
*p++ = value;
}
}
}
private:
//--------------------------------------------------------------------
// Prohibit copying
row_ptr_cache(const row_ptr_cache<T>&);
const row_ptr_cache<T>& operator = (const row_ptr_cache<T>&);
private:
//--------------------------------------------------------------------
T* m_buf; // Pointer to renrdering buffer
T** m_rows; // Pointers to each row of the buffer
unsigned m_width; // Width in pixels
unsigned m_height; // Height in pixels
int m_stride; // Number of bytes per row. Can be < 0
unsigned m_max_height; // The maximal height (currently allocated)
T* m_buf; // Pointer to renrdering buffer
pod_array<T*> m_rows; // Pointers to each row of the buffer
unsigned m_width; // Width in pixels
unsigned m_height; // Height in pixels
int m_stride; // Number of bytes per row. Can be < 0
};