Make DPSrectfill:::: calculate the alpha pointer when clipped. Fix order=2 in compositing. Whitespace cleanups.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@14389 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
alexm 2002-08-31 18:01:49 +00:00
parent b2b98d7bb4
commit b3f0cba5b0
4 changed files with 36 additions and 22 deletions

View file

@ -1,3 +1,14 @@
2002-08-31 19:54 Alexander Malmberg <alexander@malmberg.org>
* Source/art/path.m (DPSrectfill::::): Calculate alpha pointer
correctly when clipped.
* Source/art/composite.m (-compositeGState:fromRect:toPoint:op:):
Fix detection of horizontal-only overlap (order==2), and handling
it in the general case.
* Source/blit.m: Whitespace cleanups.
2002-08-31 15:52 Alexander Malmberg <alexander@malmberg.org>
* Source/art/image.m: Implement clipping of images using the

View file

@ -395,7 +395,7 @@ static void MPRE(sover_aa) (composite_run_t *c, int num)
{
ALPHA_INC(s, src_alpha)
ALPHA_INC(d, dst_alpha)
continue;
continue;
}
if (sa == 255)
{
@ -433,12 +433,12 @@ static void MPRE(sover_ao) (composite_run_t *c, int num)
for (; num; num--)
{
ALPHA_READ(s, src_alpha, sa)
if (!sa)
{
ALPHA_INC(s, src_alpha)
BLEND_INC(d)
continue;
}
if (!sa)
{
ALPHA_INC(s, src_alpha)
BLEND_INC(d)
continue;
}
if (sa == 255)
{
BLEND_READ(s, sr, sg, sb)

View file

@ -373,7 +373,7 @@ if necessary. Returns new operation, or -1 it it's a noop. */
if (sy == y0)
{ /* TODO: pure horizontal, not handled properly in all
cases */
if ((sx >= x0 && sx <= x0 + x1) || (x0 >= sx && x0 <= x0 + x1))
if ((sx >= x0 && sx <= x0 + x1) || (x0 >= sx && x0 <= sx + x1))
order = 2;
}
}
@ -424,25 +424,21 @@ if necessary. Returns new operation, or -1 it it's a noop. */
if (order == 2)
{
unsigned char tmpbuf[x1 * DI.bytes_per_pixel];
unsigned char tmpbufa[x1];
int y;
composite_run_t c;
c.dst = dst;
c.dsta = dst_alpha;
c.src = src;
c.srca = src_alpha;
for (y = 0; y < y1; y++, c.dst += dbpl, c.src += sbpl)
c.src = tmpbuf;
c.srca = tmpbufa;
for (y = 0; y < y1; y++, c.dst += dbpl, src += sbpl)
{
/* don't need to copy alpha since it is either
separate and won't be written to or part of the
data */
/* TODO: this only holds if there's no destination
alpha, which is no longer true. ignore for now; why
would someone sourceover something on itself? */
/* TODO: this looks broken. where is tmpbuf used? */
memcpy(tmpbuf, src, x1 * DI.bytes_per_pixel);
if (ags->wi->has_alpha)
memcpy(tmpbufa, src_alpha, x1);
blit_func(&c, x1);
c.srca += asbpl;
src_alpha += asbpl;
c.dsta += adbpl;
}
}

View file

@ -912,6 +912,7 @@ static void clip_svp_callback(void *data, int y, int start,
/* optimize axis- and pixel-aligned rectangles */
{
unsigned char *dst = CLIP_DATA;
unsigned char *dsta = wi->alpha + clip_x0 + clip_y0 * wi->sx;
render_run_t ri;
x0 -= clip_x0;
@ -919,7 +920,10 @@ static void clip_svp_callback(void *data, int y, int start,
if (x0 <= 0)
x0 = 0;
else
dst += x0 * DI.bytes_per_pixel;
{
dst += x0 * DI.bytes_per_pixel;
dsta += x0;
}
if (x1 > clip_sx) x1 = clip_sx;
x1 -= x0;
@ -931,7 +935,10 @@ static void clip_svp_callback(void *data, int y, int start,
if (y0 <= 0)
y0 = 0;
else
dst += y0 * wi->bytes_per_line;
{
dst += y0 * wi->bytes_per_line;
dsta += y0 * wi->sx;
}
if (y1 > clip_sy) y1 = clip_sy;
if (y1 <= y0)
@ -944,7 +951,7 @@ static void clip_svp_callback(void *data, int y, int start,
ri.a = fill_color[3];
if (wi->has_alpha)
{
ri.dsta = wi->alpha + x0 + y0 * wi->sx;
ri.dsta = dsta;
if (fill_color[3] == 255)
{