I found something, there's a per-pixel divide that can be replaced with a precalculated multiply. I got a little performance boost out of it since I am doing tons of gradients. Here's my version of the class. Note that my sources are based on the second to last release (i.e. the non GPLed one):
template<class ColorT>
struct gradient_linear_color
{
typedef ColorT color_type;
gradient_linear_color() {}
gradient_linear_color(const color_type& c1, const color_type& c2,
unsigned size = 256) :
m_c1(c1), m_c2(c2), m_size(size)
// VFALCO 5/28/09
,m_mult(1/(double(size)-1))
// VFALCO
{}
unsigned size() const { return m_size; }
color_type operator [] (unsigned v) const
{
// VFALCO 5/28/09
//return m_c1.gradient(m_c2, double(v) / double(m_size - 1));
return m_c1.gradient(m_c2, double(v) * m_mult );
// VFALCO
}
void colors(const color_type& c1, const color_type& c2, unsigned size = 256)
{
m_c1 = c1;
m_c2 = c2;
m_size = size;
// VFALCO 5/28/09
m_mult=1/(double(size)-1);
// VFALCO
}
color_type m_c1;
color_type m_c2;
unsigned m_size;
// VFALCO 5/28/09
double m_mult;
// VFALCO
};
------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations
Conference from O'Reilly Media. Velocity features a full day of
expert-led, hands-on workshops and two days of sessions from industry
leaders in dedicated Performance & Operations tracks. Use code vel09scf
and Save an extra 15% before 5/3.
http://p.sf.net/sfu/velocityconf_______________________________________________
Vector-agg-general mailing list
Vector-agg-general@...
https://lists.sourceforge.net/lists/listinfo/vector-agg-general