Move svp rendering code to path.m.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@14379 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
alexm 2002-08-30 13:43:14 +00:00
parent 2ccb84fd46
commit 3a189c047c
4 changed files with 114 additions and 114 deletions

View file

@ -1,3 +1,8 @@
2002-08-30 15:42 Alexander Malmberg <alexander@malmberg.org>
* Source/art/blit.h, Source/art/blit.m, Source/art/path.m: Move
svp rendering code to path.m.
2002-08-30 01:29 Alexander Malmberg <alexander@malmberg.org>
* Source/art/GNUmakefile, Source/art/ARTContext.m, Source/art/path.m:

View file

@ -32,14 +32,8 @@
typedef struct render_run_s
{
unsigned char r, g, b, a, real_a;
unsigned char r, g, b, a;
unsigned char *dst, *dsta;
/* the following fields are only used by the svp rendering helpers */
int x0, x1;
int rowstride, arowstride, bpp;
void (*run_alpha)(struct render_run_s *ri, int num);
void (*run_opaque)(struct render_run_s *ri, int num);
} render_run_t;
@ -147,11 +141,5 @@ void artcontext_setup_draw_info(draw_info_t *di,
unsigned int red_mask, unsigned int green_mask, unsigned int blue_mask,
int bpp);
void artcontext_render_svp(const ArtSVP *svp, int x0, int y0, int x1, int y1,
unsigned char r, unsigned char g, unsigned char b, unsigned char a,
unsigned char *dst, int rowstride,
unsigned char *dsta, int arowstride, int has_alpha,
draw_info_t *di);
#endif

View file

@ -1415,106 +1415,6 @@ ourself.
/* end of pixel formats */
/* rendering helpers */
static void render_svp_callback(void *data, int y, int start,
ArtSVPRenderAAStep *steps, int n_steps)
{
render_run_t *ri = data;
int x0 = ri->x0, x1;
int num;
int alpha;
unsigned char *dst, *dsta;
alpha = start;
/* empty line; very common case */
if (alpha<0x10000 && !n_steps)
{
ri->dst += ri->rowstride;
ri->dsta += ri->arowstride;
return;
}
dst = ri->dst + ri->rowstride;
dsta = ri->dsta + ri->arowstride;
for (; n_steps; n_steps--, steps++)
{
x1 = steps->x;
num = x1 - x0;
ri->a = (alpha * ri->real_a + 0x800000) >> 24;
if (ri->a && num)
{
if (ri->a == 255)
ri->run_opaque(ri, num);
else
ri->run_alpha(ri, num);
}
ri->dst += ri->bpp * num;
ri->dsta += num;
alpha += steps->delta;
x0 = x1;
}
x1 = ri->x1;
num = x1 - x0;
ri->a = (alpha * ri->real_a + 0x800000) >> 24;
if (ri->a && num)
{
if (ri->a == 255)
ri->run_opaque(ri, num);
else
ri->run_alpha(ri, num);
}
ri->dst = dst;
ri->dsta = dsta;
}
void artcontext_render_svp(const ArtSVP *svp, int x0, int y0, int x1, int y1,
unsigned char r, unsigned char g, unsigned char b, unsigned char a,
unsigned char *dst, int rowstride,
unsigned char *dsta, int arowstride, int has_alpha,
draw_info_t *di)
{
render_run_t ri;
ri.x0 = x0;
ri.x1 = x1;
ri.r = r;
ri.g = g;
ri.b = b;
ri.real_a = ri.a = a;
ri.bpp = di->bytes_per_pixel;
ri.dst = dst;
ri.rowstride = rowstride;
if (has_alpha)
{
ri.dsta = dsta;
ri.arowstride = arowstride;
ri.run_alpha = di->render_run_alpha_a;
ri.run_opaque = di->render_run_opaque_a;
}
else
{
ri.run_alpha = di->render_run_alpha;
ri.run_opaque = di->render_run_opaque;
}
art_svp_render_aa(svp, x0, y0, x1, y1, render_svp_callback, &ri);
}
/* end of rendering helpers */
static draw_info_t draw_infos[DI_NUM] = {
#define C(x) \

View file

@ -93,8 +93,115 @@ static void dump_bpath(ArtBpath *vp)
#endif
@implementation ARTGState (path)
/* rendering helpers */
typedef struct
{
render_run_t ri;
unsigned char real_a;
int x0, x1;
int rowstride, arowstride, bpp;
void (*run_alpha)(struct render_run_s *ri, int num);
void (*run_opaque)(struct render_run_s *ri, int num);
} svp_render_info_t;
static void render_svp_callback(void *data, int y, int start,
ArtSVPRenderAAStep *steps, int n_steps)
{
svp_render_info_t *ri = data;
int x0 = ri->x0, x1;
int num;
int alpha;
unsigned char *dst, *dsta;
alpha = start;
/* empty line; very common case */
if (alpha < 0x10000 && !n_steps)
{
ri->ri.dst += ri->rowstride;
ri->ri.dsta += ri->arowstride;
return;
}
dst = ri->ri.dst + ri->rowstride;
dsta = ri->ri.dsta + ri->arowstride;
for (; n_steps; n_steps--, steps++)
{
x1 = steps->x;
num = x1 - x0;
ri->ri.a = (alpha * ri->real_a + 0x800000) >> 24;
if (ri->ri.a && num)
{
if (ri->ri.a == 255)
ri->run_opaque(&ri->ri, num);
else
ri->run_alpha(&ri->ri, num);
}
ri->ri.dst += ri->bpp * num;
ri->ri.dsta += num;
alpha += steps->delta;
x0 = x1;
}
x1 = ri->x1;
num = x1 - x0;
ri->ri.a = (alpha * ri->real_a + 0x800000) >> 24;
if (ri->ri.a && num)
{
if (ri->ri.a == 255)
ri->run_opaque(&ri->ri, num);
else
ri->run_alpha(&ri->ri, num);
}
ri->ri.dst = dst;
ri->ri.dsta = dsta;
}
static void artcontext_render_svp(const ArtSVP *svp, int x0, int y0, int x1, int y1,
unsigned char r, unsigned char g, unsigned char b, unsigned char a,
unsigned char *dst, int rowstride,
unsigned char *dsta, int arowstride, int has_alpha,
draw_info_t *di)
{
svp_render_info_t ri;
ri.x0 = x0;
ri.x1 = x1;
ri.ri.r = r;
ri.ri.g = g;
ri.ri.b = b;
ri.real_a = ri.ri.a = a;
ri.bpp = di->bytes_per_pixel;
ri.ri.dst = dst;
ri.rowstride = rowstride;
if (has_alpha)
{
ri.ri.dsta = dsta;
ri.arowstride = arowstride;
ri.run_alpha = di->render_run_alpha_a;
ri.run_opaque = di->render_run_opaque_a;
}
else
{
ri.run_alpha = di->render_run_alpha;
ri.run_opaque = di->render_run_opaque;
}
art_svp_render_aa(svp, x0, y0, x1, y1, render_svp_callback, &ri);
}
@implementation ARTGState (path)
/* Fills in vp. If the rectangle is axis- (and optionally pixel)-aligned,
also fills in the axis coordinates (x0/y0 is min) and returns 1. Otherwise