Revert "restore pristine agg2.4 agg:span_image_resample_rgba_affine - refs #1227"
This reverts commit 225678eccb
.
This commit is contained in:
parent
225678eccb
commit
28b9729ae7
1 changed files with 45 additions and 34 deletions
|
@ -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;
|
||||
|
@ -69,9 +69,9 @@ public:
|
|||
int radius_y = (diameter * base_type::m_ry) >> 1;
|
||||
int len_x_lr =
|
||||
(diameter * base_type::m_rx + image_subpixel_mask) >>
|
||||
image_subpixel_shift;
|
||||
image_subpixel_shift;
|
||||
|
||||
const int16* weight_array = base_type::filter().weight_array();
|
||||
const boost::int16_t* weight_array = base_type::filter().weight_array();
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -84,13 +84,13 @@ public:
|
|||
|
||||
int y_lr = y >> image_subpixel_shift;
|
||||
int y_hr = ((image_subpixel_mask - (y & image_subpixel_mask)) *
|
||||
base_type::m_ry_inv) >>
|
||||
image_subpixel_shift;
|
||||
base_type::m_ry_inv) >>
|
||||
image_subpixel_shift;
|
||||
int total_weight = 0;
|
||||
int x_lr = x >> image_subpixel_shift;
|
||||
int x_hr = ((image_subpixel_mask - (x & image_subpixel_mask)) *
|
||||
base_type::m_rx_inv) >>
|
||||
image_subpixel_shift;
|
||||
base_type::m_rx_inv) >>
|
||||
image_subpixel_shift;
|
||||
|
||||
int x_hr2 = x_hr;
|
||||
const value_type* fg_ptr =
|
||||
|
@ -102,13 +102,14 @@ public:
|
|||
for(;;)
|
||||
{
|
||||
int weight = (weight_y * weight_array[x_hr] +
|
||||
image_filter_scale / 2) >>
|
||||
downscale_shift;
|
||||
image_filter_scale / 2) >>
|
||||
downscale_shift;
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
fg[0] /= total_weight;
|
||||
fg[1] /= total_weight;
|
||||
fg[2] /= total_weight;
|
||||
fg[3] /= total_weight;
|
||||
if (total_weight)
|
||||
{
|
||||
fg[3] /= total_weight;
|
||||
fg[0] /= total_weight;
|
||||
fg[1] /= total_weight;
|
||||
fg[2] /= 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;
|
||||
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];
|
||||
|
|
Loading…
Reference in a new issue