mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-23 11:51:27 +00:00
Reformat to better fit the coding standard.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@14313 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7b908b329b
commit
bb6b4826aa
5 changed files with 1008 additions and 1003 deletions
|
@ -1,3 +1,8 @@
|
|||
2002-08-21 14:52 Alexander Malmberg <alexander@malmberg.org>
|
||||
|
||||
* Source/art/blit.h, Source/art/blit.m, Source/art/ftfont.h,
|
||||
Source/art/ftfont.m: Reformat to fit coding standards better.
|
||||
|
||||
2002-08-21 13:50 Alexander Malmberg <alexander@malmberg.org>
|
||||
|
||||
* Source/art/ARTContext.m: Move common code from _fill and DPSstroke
|
||||
|
|
|
@ -36,27 +36,27 @@ copyright 2002 Alexander Malmberg <alexander@malmberg.org>
|
|||
|
||||
typedef struct render_run_s
|
||||
{
|
||||
unsigned char r,g,b,a,real_a;
|
||||
unsigned char *dst,*dsta;
|
||||
unsigned char r, g, b, a, real_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);
|
||||
/* 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;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char *dst,*dsta;
|
||||
unsigned char *src,*srca;
|
||||
unsigned char *dst, *dsta;
|
||||
unsigned char *src, *srca;
|
||||
} composite_run_t;
|
||||
|
||||
|
||||
typedef struct draw_info_s
|
||||
{
|
||||
int how;
|
||||
int how;
|
||||
#define DI_FALLBACK 0
|
||||
|
||||
/* counting from lsb */
|
||||
|
@ -72,64 +72,65 @@ typedef struct draw_info_s
|
|||
|
||||
#define DI_NUM 9
|
||||
|
||||
int bytes_per_pixel;
|
||||
int drawing_depth;
|
||||
int inline_alpha,inline_alpha_ofs;
|
||||
int bytes_per_pixel;
|
||||
int drawing_depth;
|
||||
int inline_alpha, inline_alpha_ofs;
|
||||
|
||||
|
||||
void (*render_run_alpha)(render_run_t *ri,int num);
|
||||
void (*render_run_opaque)(render_run_t *ri,int num);
|
||||
void (*render_run_alpha_a)(render_run_t *ri,int num);
|
||||
void (*render_run_opaque_a)(render_run_t *ri,int num);
|
||||
void (*render_run_alpha)(render_run_t *ri, int num);
|
||||
void (*render_run_opaque)(render_run_t *ri, int num);
|
||||
void (*render_run_alpha_a)(render_run_t *ri, int num);
|
||||
void (*render_run_opaque_a)(render_run_t *ri, int num);
|
||||
|
||||
void (*render_blit_alpha_opaque)(unsigned char *dst,
|
||||
const unsigned char *src,
|
||||
unsigned char r,unsigned char g,unsigned char b,int num);
|
||||
void (*render_blit_mono_opaque)(unsigned char *dst,
|
||||
const unsigned char *src,int src_ofs,
|
||||
unsigned char r,unsigned char g,unsigned char b,
|
||||
int num);
|
||||
void (*render_blit_alpha_opaque)(unsigned char *dst,
|
||||
const unsigned char *src,
|
||||
unsigned char r, unsigned char g,
|
||||
unsigned char b, int num);
|
||||
void (*render_blit_mono_opaque)(unsigned char *dst,
|
||||
const unsigned char *src, int src_ofs,
|
||||
unsigned char r, unsigned char g,
|
||||
unsigned char b, int num);
|
||||
|
||||
void (*render_blit_alpha)(unsigned char *dst,const unsigned char *src,
|
||||
unsigned char r,unsigned char g,unsigned char b,
|
||||
unsigned char alpha,int num);
|
||||
void (*render_blit_mono)(unsigned char *dst,
|
||||
const unsigned char *src,int src_ofs,
|
||||
unsigned char r,unsigned char g,unsigned char b,
|
||||
unsigned char alpha,int num);
|
||||
void (*render_blit_alpha)(unsigned char *dst, const unsigned char *src,
|
||||
unsigned char r, unsigned char g, unsigned char b,
|
||||
unsigned char alpha, int num);
|
||||
void (*render_blit_mono)(unsigned char *dst,
|
||||
const unsigned char *src, int src_ofs,
|
||||
unsigned char r, unsigned char g, unsigned char b,
|
||||
unsigned char alpha, int num);
|
||||
|
||||
|
||||
void (*composite_sover_aa)(composite_run_t *c,int num);
|
||||
void (*composite_sover_ao)(composite_run_t *c,int num);
|
||||
void (*composite_sover_aa)(composite_run_t *c, int num);
|
||||
void (*composite_sover_ao)(composite_run_t *c, int num);
|
||||
|
||||
void (*composite_sin_aa)(composite_run_t *c,int num);
|
||||
void (*composite_sin_oa)(composite_run_t *c,int num);
|
||||
void (*composite_sin_aa)(composite_run_t *c, int num);
|
||||
void (*composite_sin_oa)(composite_run_t *c, int num);
|
||||
|
||||
void (*composite_sout_aa)(composite_run_t *c,int num);
|
||||
void (*composite_sout_oa)(composite_run_t *c,int num);
|
||||
void (*composite_sout_aa)(composite_run_t *c, int num);
|
||||
void (*composite_sout_oa)(composite_run_t *c, int num);
|
||||
|
||||
void (*composite_satop_aa)(composite_run_t *c,int num);
|
||||
void (*composite_satop_aa)(composite_run_t *c, int num);
|
||||
|
||||
void (*composite_dover_aa)(composite_run_t *c,int num);
|
||||
void (*composite_dover_oa)(composite_run_t *c,int num);
|
||||
void (*composite_dover_aa)(composite_run_t *c, int num);
|
||||
void (*composite_dover_oa)(composite_run_t *c, int num);
|
||||
|
||||
void (*composite_din_aa)(composite_run_t *c,int num);
|
||||
void (*composite_din_aa)(composite_run_t *c, int num);
|
||||
|
||||
void (*composite_dout_aa)(composite_run_t *c,int num);
|
||||
void (*composite_dout_aa)(composite_run_t *c, int num);
|
||||
|
||||
void (*composite_datop_aa)(composite_run_t *c,int num);
|
||||
void (*composite_datop_aa)(composite_run_t *c, int num);
|
||||
|
||||
void (*composite_xor_aa)(composite_run_t *c,int num);
|
||||
void (*composite_xor_aa)(composite_run_t *c, int num);
|
||||
|
||||
void (*composite_plusl_aa)(composite_run_t *c,int num);
|
||||
void (*composite_plusl_oa)(composite_run_t *c,int num);
|
||||
void (*composite_plusl_ao)(composite_run_t *c,int num);
|
||||
void (*composite_plusl_oo)(composite_run_t *c,int num);
|
||||
void (*composite_plusl_aa)(composite_run_t *c, int num);
|
||||
void (*composite_plusl_oa)(composite_run_t *c, int num);
|
||||
void (*composite_plusl_ao)(composite_run_t *c, int num);
|
||||
void (*composite_plusl_oo)(composite_run_t *c, int num);
|
||||
|
||||
void (*composite_plusd_aa)(composite_run_t *c,int num);
|
||||
void (*composite_plusd_oa)(composite_run_t *c,int num);
|
||||
void (*composite_plusd_ao)(composite_run_t *c,int num);
|
||||
void (*composite_plusd_oo)(composite_run_t *c,int num);
|
||||
void (*composite_plusd_aa)(composite_run_t *c, int num);
|
||||
void (*composite_plusd_oa)(composite_run_t *c, int num);
|
||||
void (*composite_plusd_ao)(composite_run_t *c, int num);
|
||||
void (*composite_plusd_oo)(composite_run_t *c, int num);
|
||||
} draw_info_t;
|
||||
|
||||
#define RENDER_RUN_ALPHA (DI.render_run_alpha)
|
||||
|
@ -143,13 +144,13 @@ typedef struct draw_info_s
|
|||
#define RENDER_BLIT_MONO DI.render_blit_mono
|
||||
|
||||
void artcontext_setup_draw_info(draw_info_t *di,
|
||||
unsigned int red_mask,unsigned int green_mask,unsigned int blue_mask,
|
||||
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,
|
||||
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
|
||||
|
|
|
@ -1356,58 +1356,58 @@ ourself.
|
|||
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;
|
||||
render_run_t *ri=data;
|
||||
int x0=ri->x0,x1;
|
||||
int num;
|
||||
int alpha;
|
||||
unsigned char *dst,*dsta;
|
||||
|
||||
alpha=start;
|
||||
alpha=start;
|
||||
|
||||
/* empty line; very common case */
|
||||
if (alpha<0x10000 && !n_steps)
|
||||
/* 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)
|
||||
{
|
||||
ri->dst+=ri->rowstride;
|
||||
ri->dsta+=ri->arowstride;
|
||||
return;
|
||||
if (ri->a==255)
|
||||
ri->run_opaque(ri,num);
|
||||
else
|
||||
ri->run_alpha(ri,num);
|
||||
}
|
||||
ri->dst+=ri->bpp*num;
|
||||
ri->dsta+=num;
|
||||
|
||||
dst=ri->dst+ri->rowstride;
|
||||
dsta=ri->dsta+ri->arowstride;
|
||||
alpha+=steps->delta;
|
||||
x0=x1;
|
||||
}
|
||||
|
||||
for (;n_steps;n_steps--,steps++)
|
||||
{
|
||||
x1=steps->x;
|
||||
num=x1-x0;
|
||||
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->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;
|
||||
ri->dst=dst;
|
||||
ri->dsta=dsta;
|
||||
}
|
||||
|
||||
void artcontext_render_svp(const ArtSVP *svp,int x0,int y0,int x1,int y1,
|
||||
|
@ -1416,35 +1416,35 @@ void artcontext_render_svp(const ArtSVP *svp,int x0,int y0,int x1,int y1,
|
|||
unsigned char *dsta,int arowstride,int has_alpha,
|
||||
draw_info_t *di)
|
||||
{
|
||||
render_run_t ri;
|
||||
render_run_t ri;
|
||||
|
||||
ri.x0=x0;
|
||||
ri.x1=x1;
|
||||
ri.x0=x0;
|
||||
ri.x1=x1;
|
||||
|
||||
ri.r=r;
|
||||
ri.g=g;
|
||||
ri.b=b;
|
||||
ri.real_a=ri.a=a;
|
||||
ri.r=r;
|
||||
ri.g=g;
|
||||
ri.b=b;
|
||||
ri.real_a=ri.a=a;
|
||||
|
||||
ri.bpp=di->bytes_per_pixel;
|
||||
ri.bpp=di->bytes_per_pixel;
|
||||
|
||||
ri.dst=dst;
|
||||
ri.rowstride=rowstride;
|
||||
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;
|
||||
}
|
||||
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);
|
||||
art_svp_render_aa(svp,x0,y0,x1,y1,render_svp_callback,&ri);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1504,84 +1504,84 @@ might eventually need to be fixed */
|
|||
|
||||
static int byte_ofs_of_mask(unsigned int m)
|
||||
{
|
||||
union
|
||||
{
|
||||
unsigned char b[4];
|
||||
unsigned int m;
|
||||
} tmp;
|
||||
union
|
||||
{
|
||||
unsigned char b[4];
|
||||
unsigned int m;
|
||||
} tmp;
|
||||
|
||||
tmp.m=m;
|
||||
if (tmp.b[0]==0xff && !tmp.b[1] && !tmp.b[2] && !tmp.b[3])
|
||||
return 0;
|
||||
else if (tmp.b[1]==0xff && !tmp.b[0] && !tmp.b[2] && !tmp.b[3])
|
||||
return 1;
|
||||
else if (tmp.b[2]==0xff && !tmp.b[0] && !tmp.b[1] && !tmp.b[3])
|
||||
return 2;
|
||||
else if (tmp.b[3]==0xff && !tmp.b[0] && !tmp.b[1] && !tmp.b[2])
|
||||
return 3;
|
||||
else
|
||||
return -1;
|
||||
tmp.m=m;
|
||||
if (tmp.b[0]==0xff && !tmp.b[1] && !tmp.b[2] && !tmp.b[3])
|
||||
return 0;
|
||||
else if (tmp.b[1]==0xff && !tmp.b[0] && !tmp.b[2] && !tmp.b[3])
|
||||
return 1;
|
||||
else if (tmp.b[2]==0xff && !tmp.b[0] && !tmp.b[1] && !tmp.b[3])
|
||||
return 2;
|
||||
else if (tmp.b[3]==0xff && !tmp.b[0] && !tmp.b[1] && !tmp.b[2])
|
||||
return 3;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
void artcontext_setup_draw_info(draw_info_t *di,
|
||||
unsigned int red_mask,unsigned int green_mask,unsigned int blue_mask,
|
||||
int bpp)
|
||||
{
|
||||
int t=DI_FALLBACK;
|
||||
int t=DI_FALLBACK;
|
||||
|
||||
if (bpp==16 && red_mask==0xf800 && green_mask==0x7e0 &&
|
||||
blue_mask==0x1f)
|
||||
if (bpp==16 && red_mask==0xf800 && green_mask==0x7e0 &&
|
||||
blue_mask==0x1f)
|
||||
{
|
||||
t=DI_16_B5_G6_R5;
|
||||
}
|
||||
else if (bpp==16 && red_mask==0x7c00 && green_mask==0x3e0 &&
|
||||
blue_mask==0x1f)
|
||||
{
|
||||
t=DI_16_B5_G5_R5_A1;
|
||||
}
|
||||
else if (bpp==24 || bpp==32)
|
||||
{
|
||||
int r,g,b;
|
||||
|
||||
r=byte_ofs_of_mask(red_mask);
|
||||
g=byte_ofs_of_mask(green_mask);
|
||||
b=byte_ofs_of_mask(blue_mask);
|
||||
|
||||
if (bpp==24)
|
||||
{
|
||||
t=DI_16_B5_G6_R5;
|
||||
if (r==0 && g==1 && b==2)
|
||||
t=DI_24_RGB;
|
||||
else if (r==2 && g==1 && b==0)
|
||||
t=DI_24_BGR;
|
||||
}
|
||||
else if (bpp==16 && red_mask==0x7c00 && green_mask==0x3e0 &&
|
||||
blue_mask==0x1f)
|
||||
else if (bpp==32)
|
||||
{
|
||||
t=DI_16_B5_G5_R5_A1;
|
||||
if (r==0 && g==1 && b==2)
|
||||
t=DI_32_RGBA;
|
||||
else if (r==2 && g==1 && b==0)
|
||||
t=DI_32_BGRA;
|
||||
else if (r==1 && g==2 && b==3)
|
||||
t=DI_32_ARGB;
|
||||
else if (r==3 && g==2 && b==1)
|
||||
t=DI_32_ABGR;
|
||||
}
|
||||
else if (bpp==24 || bpp==32)
|
||||
{
|
||||
int r,g,b;
|
||||
}
|
||||
|
||||
r=byte_ofs_of_mask(red_mask);
|
||||
g=byte_ofs_of_mask(green_mask);
|
||||
b=byte_ofs_of_mask(blue_mask);
|
||||
// t=DI_32_ARGB; /* HACK */
|
||||
|
||||
if (bpp==24)
|
||||
{
|
||||
if (r==0 && g==1 && b==2)
|
||||
t=DI_24_RGB;
|
||||
else if (r==2 && g==1 && b==0)
|
||||
t=DI_24_BGR;
|
||||
}
|
||||
else if (bpp==32)
|
||||
{
|
||||
if (r==0 && g==1 && b==2)
|
||||
t=DI_32_RGBA;
|
||||
else if (r==2 && g==1 && b==0)
|
||||
t=DI_32_BGRA;
|
||||
else if (r==1 && g==2 && b==3)
|
||||
t=DI_32_ARGB;
|
||||
else if (r==3 && g==2 && b==1)
|
||||
t=DI_32_ABGR;
|
||||
}
|
||||
}
|
||||
|
||||
// t=DI_32_ARGB; /* HACK */
|
||||
|
||||
*di=draw_infos[t];
|
||||
if (!di->render_run_alpha)
|
||||
*di=draw_infos[DI_FALLBACK];
|
||||
if (di->how==DI_FALLBACK)
|
||||
{
|
||||
NSLog(@"Unrecognized color masks: %08x:%08x:%08x %i",
|
||||
red_mask,green_mask,blue_mask,bpp);
|
||||
// NSLog(@"Attempting to use fallback code (currently unimplemented). This will be _very_ slow!");
|
||||
NSLog(@"Please report this along with details on your pixel format "
|
||||
@"(ie. the four numbers above). (Or better yet, implement it "
|
||||
@"and send me a patch.)");
|
||||
exit(1);
|
||||
}
|
||||
*di=draw_infos[t];
|
||||
if (!di->render_run_alpha)
|
||||
*di=draw_infos[DI_FALLBACK];
|
||||
if (di->how==DI_FALLBACK)
|
||||
{
|
||||
NSLog(@"Unrecognized color masks: %08x:%08x:%08x %i",
|
||||
red_mask,green_mask,blue_mask,bpp);
|
||||
// NSLog(@"Attempting to use fallback code (currently unimplemented). This will be _very_ slow!");
|
||||
NSLog(@"Please report this along with details on your pixel format "
|
||||
@"(ie. the four numbers above). (Or better yet, implement it "
|
||||
@"and send me a patch.)");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -25,12 +25,15 @@ copyright 2002 Alexander Malmberg <alexander@malmberg.org>
|
|||
|
||||
@protocol FTFontInfo
|
||||
-(void) drawString: (const char *)s
|
||||
at: (int)x:(int)y
|
||||
to: (int)x0:(int)y0:(int)x1:(int)y1:(unsigned char *)buf:(int)bpl
|
||||
color:(unsigned char)r:(unsigned char)g:(unsigned char)b:(unsigned char)alpha
|
||||
at: (int)x : (int)y
|
||||
to: (int)x0 : (int)y0 : (int)x1 : (int)y1
|
||||
: (unsigned char *)buf : (int)bpl
|
||||
color: (unsigned char)r : (unsigned char)g : (unsigned char)b
|
||||
: (unsigned char)alpha
|
||||
transform: (NSAffineTransform *)transform
|
||||
drawinfo: (struct draw_info_s *)di;
|
||||
|
||||
/* TODO: see if this is really necessary */
|
||||
-(void) drawString: (const char *)s
|
||||
at: (int)x:(int)y
|
||||
to: (int)x0:(int)y0:(int)x1:(int)y1:(unsigned char *)buf:(int)bpl
|
||||
|
@ -39,7 +42,7 @@ copyright 2002 Alexander Malmberg <alexander@malmberg.org>
|
|||
deltas: (const float *)delta_data : (int)delta_size : (int)delta_flags;
|
||||
|
||||
-(void) outlineString: (const char *)s
|
||||
at: (float)x:(float)y
|
||||
at: (float)x : (float)y
|
||||
gstate: (void *)func_param;
|
||||
|
||||
+(void) initializeBackend;
|
||||
|
|
1616
Source/art/ftfont.m
1616
Source/art/ftfont.m
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue