agg_clipped_alpha_mask.h: Partially revert previous commit.

There wasn't an out-of-bounds access, I read the code wrongly. Keep the code
in sync with the AGG version. What happens is that for x < 0 and xmax < 0,
the code will memset the x < 0 region twice, unless I am still irritated...
This commit is contained in:
Stephan Aßmus 2014-02-04 00:05:54 +01:00
parent 77214b5abc
commit 27a5783afc
1 changed files with 11 additions and 11 deletions

View File

@ -72,27 +72,27 @@ namespace agg
x = 0;
}
int rest = 0;
if(x + count > xmax)
{
rest = x + count - xmax - 1;
int rest = x + count - xmax - 1;
count -= rest;
if(count <= 0)
{
memset(dst, m_outside, num_pix * sizeof(cover_type));
return;
}
memset(covers + count, m_outside, rest * sizeof(cover_type));
}
const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset;
while(count != 0)
do
{
*covers = (cover_type)((cover_full + (*covers) * (*mask))
>> cover_shift);
>> cover_shift);
++covers;
mask += Step;
--count;
}
if(rest > 0)
{
memset(covers, m_outside, rest * sizeof(cover_type));
}
while(--count);
}
private: