Revert "restore pristine agg2.4 agg:span_image_resample_rgba_affine - refs #1227"

This reverts commit 225678eccb.
This commit is contained in:
Dane Springmeyer 2012-05-24 14:11:42 -07:00
parent 225678eccb
commit 28b9729ae7

View file

@ -29,7 +29,7 @@ using namespace agg;
template<class Source>
class span_image_resample_rgba_affine :
public span_image_resample_affine<Source>
public span_image_resample_affine<Source>
{
public:
typedef Source source_type;
@ -71,7 +71,7 @@ public:
(diameter * base_type::m_rx + image_subpixel_mask) >>
image_subpixel_shift;
const int16* weight_array = base_type::filter().weight_array();
const boost::int16_t* weight_array = base_type::filter().weight_array();
do
{
@ -108,7 +108,8 @@ public:
fg[0] += *fg_ptr++ * weight;
fg[1] += *fg_ptr++ * weight;
fg[2] += *fg_ptr++ * weight;
fg[3] += *fg_ptr++ * weight;
fg[3] += *fg_ptr * weight;
total_weight += weight;
x_hr += base_type::m_rx_inv;
if(x_hr >= filter_scale) break;
@ -119,20 +120,30 @@ public:
fg_ptr = (const value_type*)base_type::source().next_y();
}
if (total_weight)
{
fg[3] /= total_weight;
fg[0] /= total_weight;
fg[1] /= total_weight;
fg[2] /= total_weight;
fg[3] /= total_weight;
if(fg[0] < 0) fg[0] = 0;
if(fg[1] < 0) fg[1] = 0;
if(fg[2] < 0) fg[2] = 0;
if(fg[3] < 0) fg[3] = 0;
}
else
{
fg[0] = 0;
fg[1] = 0;
fg[2] = 0;
fg[3] = 0;
}
if(fg[order_type::R] > base_mask) fg[order_type::R] = base_mask;
if(fg[order_type::G] > base_mask) fg[order_type::G] = base_mask;
if(fg[order_type::B] > base_mask) fg[order_type::B] = base_mask;
if(fg[order_type::A] > base_mask) fg[order_type::A] = base_mask;
if(fg[order_type::R] > fg[order_type::A]) fg[order_type::R] = fg[order_type::A];
if(fg[order_type::G] > fg[order_type::A]) fg[order_type::G] = fg[order_type::A];
if(fg[order_type::B] > fg[order_type::A]) fg[order_type::B] = fg[order_type::A];
span->r = (value_type)fg[order_type::R];
span->g = (value_type)fg[order_type::G];