* 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:
@@ -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.
|
||||
@@ -30,13 +30,10 @@ namespace agg
|
||||
public:
|
||||
typedef Interpolator interpolator_type;
|
||||
typedef ColorT color_type;
|
||||
typedef typename color_type::alpha_type alpha_type;
|
||||
typedef typename color_type::value_type alpha_type;
|
||||
|
||||
enum
|
||||
enum downscale_shift_e
|
||||
{
|
||||
base_shift = 8,
|
||||
base_size = 1 << base_shift,
|
||||
base_mask = base_size - 1,
|
||||
downscale_shift = interpolator_type::subpixel_shift - gradient_subpixel_shift
|
||||
};
|
||||
|
||||
@@ -47,31 +44,34 @@ namespace agg
|
||||
//--------------------------------------------------------------------
|
||||
span_gradient_alpha(interpolator_type& inter,
|
||||
const GradientF& gradient_function,
|
||||
AlphaF alpha_function,
|
||||
const AlphaF& alpha_function,
|
||||
double d1, double d2) :
|
||||
m_interpolator(&inter),
|
||||
m_gradient_function(&gradient_function),
|
||||
m_alpha_function(alpha_function),
|
||||
m_d1(int(d1 * gradient_subpixel_size)),
|
||||
m_d2(int(d2 * gradient_subpixel_size))
|
||||
m_alpha_function(&alpha_function),
|
||||
m_d1(iround(d1 * gradient_subpixel_scale)),
|
||||
m_d2(iround(d2 * gradient_subpixel_scale))
|
||||
{}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
interpolator_type& interpolator() { return *m_interpolator; }
|
||||
const GradientF& gradient_function() const { return *m_gradient_function; }
|
||||
const AlphaF alpha_function() const { return m_alpha_function; }
|
||||
double d1() const { return double(m_d1) / gradient_subpixel_size; }
|
||||
double d2() const { return double(m_d2) / gradient_subpixel_size; }
|
||||
const AlphaF& alpha_function() const { return *m_alpha_function; }
|
||||
double d1() const { return double(m_d1) / gradient_subpixel_scale; }
|
||||
double d2() const { return double(m_d2) / gradient_subpixel_scale; }
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void interpolator(interpolator_type& i) { m_interpolator = &i; }
|
||||
void gradient_function(const GradientF& gf) { m_gradient_function = &gf; }
|
||||
void alpha_function(AlphaF af) { m_alpha_function = af; }
|
||||
void d1(double v) { m_d1 = int(v * gradient_subpixel_size); }
|
||||
void d2(double v) { m_d2 = int(v * gradient_subpixel_size); }
|
||||
void alpha_function(const AlphaF& af) { m_alpha_function = ⁡ }
|
||||
void d1(double v) { m_d1 = iround(v * gradient_subpixel_scale); }
|
||||
void d2(double v) { m_d2 = iround(v * gradient_subpixel_scale); }
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void convert(color_type* span, int x, int y, unsigned len)
|
||||
void prepare() {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void generate(color_type* span, int x, int y, unsigned len)
|
||||
{
|
||||
int dd = m_d2 - m_d1;
|
||||
if(dd < 1) dd = 1;
|
||||
@@ -80,11 +80,11 @@ namespace agg
|
||||
{
|
||||
m_interpolator->coordinates(&x, &y);
|
||||
int d = m_gradient_function->calculate(x >> downscale_shift,
|
||||
y >> downscale_shift, dd);
|
||||
d = ((d - m_d1) << base_shift) / dd;
|
||||
y >> downscale_shift, m_d2);
|
||||
d = ((d - m_d1) * (int)m_alpha_function->size()) / dd;
|
||||
if(d < 0) d = 0;
|
||||
if(d > base_mask) d = base_mask;
|
||||
span->a = m_alpha_function[d];
|
||||
if(d >= (int)m_alpha_function->size()) d = m_alpha_function->size() - 1;
|
||||
span->a = (*m_alpha_function)[d];
|
||||
++span;
|
||||
++(*m_interpolator);
|
||||
}
|
||||
@@ -94,7 +94,7 @@ namespace agg
|
||||
private:
|
||||
interpolator_type* m_interpolator;
|
||||
const GradientF* m_gradient_function;
|
||||
AlphaF m_alpha_function;
|
||||
const AlphaF* m_alpha_function;
|
||||
int m_d1;
|
||||
int m_d2;
|
||||
};
|
||||
@@ -103,7 +103,7 @@ namespace agg
|
||||
//=======================================================gradient_alpha_x
|
||||
template<class ColorT> struct gradient_alpha_x
|
||||
{
|
||||
typedef typename ColorT::alpha_type alpha_type;
|
||||
typedef typename ColorT::value_type alpha_type;
|
||||
alpha_type operator [] (alpha_type x) const { return x; }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user