783 lines
15 KiB
C
783 lines
15 KiB
C
|
#include "evas_common.h"
|
||
|
|
||
|
void
|
||
|
draw_init(void)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
RGBA_Draw_Context *
|
||
|
draw_context_new(void)
|
||
|
{
|
||
|
RGBA_Draw_Context *dc;
|
||
|
|
||
|
dc = calloc(1, sizeof(RGBA_Draw_Context));
|
||
|
return dc;
|
||
|
}
|
||
|
|
||
|
void
|
||
|
draw_context_free(RGBA_Draw_Context *dc)
|
||
|
{
|
||
|
free(dc);
|
||
|
}
|
||
|
|
||
|
void
|
||
|
draw_context_clip_clip(RGBA_Draw_Context *dc, int x, int y, int w, int h)
|
||
|
{
|
||
|
if (dc->clip.use)
|
||
|
{
|
||
|
RECTS_CLIP_TO_RECT(dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h,
|
||
|
x, y, w, h);
|
||
|
}
|
||
|
else
|
||
|
draw_context_set_clip(dc, x, y, w, h);
|
||
|
}
|
||
|
|
||
|
void
|
||
|
draw_context_set_clip(RGBA_Draw_Context *dc, int x, int y, int w, int h)
|
||
|
{
|
||
|
dc->clip.use = 1;
|
||
|
dc->clip.x = x;
|
||
|
dc->clip.y = y;
|
||
|
dc->clip.w = w;
|
||
|
dc->clip.h = h;
|
||
|
}
|
||
|
|
||
|
void
|
||
|
draw_context_unset_clip(RGBA_Draw_Context *dc)
|
||
|
{
|
||
|
dc->clip.use = 0;
|
||
|
}
|
||
|
|
||
|
void
|
||
|
draw_context_set_color(RGBA_Draw_Context *dc, int r, int g, int b, int a)
|
||
|
{
|
||
|
R_VAL(&(dc->col.col)) = (DATA8)r;
|
||
|
G_VAL(&(dc->col.col)) = (DATA8)g;
|
||
|
B_VAL(&(dc->col.col)) = (DATA8)b;
|
||
|
A_VAL(&(dc->col.col)) = (DATA8)a;
|
||
|
}
|
||
|
|
||
|
void
|
||
|
draw_context_set_multiplier(RGBA_Draw_Context *dc, int r, int g, int b, int a)
|
||
|
{
|
||
|
dc->mul.use = 1;
|
||
|
dc->mod.use = 0;
|
||
|
R_VAL(&(dc->mul.col)) = (DATA8)r;
|
||
|
G_VAL(&(dc->mul.col)) = (DATA8)g;
|
||
|
B_VAL(&(dc->mul.col)) = (DATA8)b;
|
||
|
A_VAL(&(dc->mul.col)) = (DATA8)a;
|
||
|
}
|
||
|
|
||
|
void
|
||
|
draw_context_unset_multiplier(RGBA_Draw_Context *dc)
|
||
|
{
|
||
|
dc->mul.use = 0;
|
||
|
}
|
||
|
|
||
|
void
|
||
|
draw_context_set_modifiers(RGBA_Draw_Context *dc, DATA8 *rmod, DATA8 *gmod, DATA8 *bmod, DATA8 *amod)
|
||
|
{
|
||
|
int i;
|
||
|
|
||
|
dc->mod.use = 1;
|
||
|
dc->mul.use = 0;
|
||
|
if (rmod) memcpy(dc->mod.r, rmod, sizeof(DATA8) * 256);
|
||
|
else
|
||
|
{
|
||
|
for (i = 0; i < 256; i++) dc->mod.r[i] = (DATA8)i;
|
||
|
}
|
||
|
if (gmod) memcpy(dc->mod.g, gmod, sizeof(DATA8) * 256);
|
||
|
else
|
||
|
{
|
||
|
for (i = 0; i < 256; i++) dc->mod.g[i] = (DATA8)i;
|
||
|
}
|
||
|
if (bmod) memcpy(dc->mod.b, bmod, sizeof(DATA8) * 256);
|
||
|
else
|
||
|
{
|
||
|
for (i = 0; i < 256; i++) dc->mod.b[i] = (DATA8)i;
|
||
|
}
|
||
|
if (amod) memcpy(dc->mod.a, amod, sizeof(DATA8) * 256);
|
||
|
else
|
||
|
{
|
||
|
for (i = 0; i < 256; i++) dc->mod.a[i] = (DATA8)i;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void
|
||
|
draw_context_ununset_modifiers(RGBA_Draw_Context *dc)
|
||
|
{
|
||
|
dc->mod.use = 0;
|
||
|
}
|
||
|
|
||
|
void
|
||
|
draw_context_add_cutout(RGBA_Draw_Context *dc, int x, int y, int w, int h)
|
||
|
{
|
||
|
Cutout_Rect *r;
|
||
|
|
||
|
r = calloc(1, sizeof(Cutout_Rect));
|
||
|
r->x = x;
|
||
|
r->y = y;
|
||
|
r->w = w;
|
||
|
r->h = h;
|
||
|
dc->cutout.rects = evas_object_list_append(dc->cutout.rects, r);
|
||
|
}
|
||
|
|
||
|
void
|
||
|
draw_context_clear_cutouts(RGBA_Draw_Context *dc)
|
||
|
{
|
||
|
draw_context_apply_free_cutouts(dc->cutout.rects);
|
||
|
dc->cutout.rects = NULL;
|
||
|
}
|
||
|
|
||
|
Cutout_Rect *
|
||
|
draw_context_apply_cutouts(RGBA_Draw_Context *dc)
|
||
|
{
|
||
|
Cutout_Rect *r, *rects;
|
||
|
Evas_Object_List *l;
|
||
|
|
||
|
if (!dc->clip.use) return NULL;
|
||
|
if ((dc->clip.w <= 0) || (dc->clip.h <= 0)) return NULL;
|
||
|
r = calloc(1, sizeof(Cutout_Rect));
|
||
|
r->x = dc->clip.x;
|
||
|
r->y = dc->clip.y;
|
||
|
r->w = dc->clip.w;
|
||
|
r->h = dc->clip.h;
|
||
|
rects = r;
|
||
|
for (l = (Evas_Object_List *)dc->cutout.rects; l; l = l->next)
|
||
|
{
|
||
|
r = (Cutout_Rect *)l;
|
||
|
rects = draw_context_cutouts_split(rects, r);
|
||
|
}
|
||
|
return rects;
|
||
|
}
|
||
|
|
||
|
void
|
||
|
draw_context_apply_free_cutouts(Cutout_Rect *rects)
|
||
|
{
|
||
|
while (rects)
|
||
|
{
|
||
|
Cutout_Rect *r;
|
||
|
|
||
|
r = rects;
|
||
|
rects = evas_object_list_remove(rects, rects);
|
||
|
free(r);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Cutout_Rect *
|
||
|
draw_context_cutouts_split(Cutout_Rect *in, Cutout_Rect *split)
|
||
|
{
|
||
|
/* multiple rect in, multiple out */
|
||
|
Cutout_Rect *out;
|
||
|
Evas_Object_List *l;
|
||
|
|
||
|
out = NULL;
|
||
|
for (l = (Evas_Object_List *)in; l; l = l->next)
|
||
|
{
|
||
|
Cutout_Rect *r;
|
||
|
|
||
|
r = (Cutout_Rect *)l;
|
||
|
r = draw_context_cutout_split(r, split);
|
||
|
while (r)
|
||
|
{
|
||
|
Cutout_Rect *r2;
|
||
|
|
||
|
r2 = r;
|
||
|
r = evas_object_list_remove(r, r);
|
||
|
out = evas_object_list_append(out, r2);
|
||
|
}
|
||
|
}
|
||
|
draw_context_apply_free_cutouts(in);
|
||
|
return out;
|
||
|
}
|
||
|
|
||
|
Cutout_Rect *
|
||
|
draw_context_cutout_split(Cutout_Rect *in, Cutout_Rect *split)
|
||
|
{
|
||
|
/* 1 input rect, multiple out */
|
||
|
Cutout_Rect *out;
|
||
|
Cutout_Rect *r;
|
||
|
|
||
|
/* this is to save me a LOT of typing */
|
||
|
#define INX1 (in->x)
|
||
|
#define INX2 (in->x + in->w)
|
||
|
#define SPX1 (split->x)
|
||
|
#define SPX2 (split->x + split->w)
|
||
|
#define INY1 (in->y)
|
||
|
#define INY2 (in->y + in->h)
|
||
|
#define SPY1 (split->y)
|
||
|
#define SPY2 (split->y + split->h)
|
||
|
#define X1_IN (in->x < split->x)
|
||
|
#define X2_IN ((in->x + in->w) > (split->x + split->w))
|
||
|
#define Y1_IN (in->y < split->y)
|
||
|
#define Y2_IN ((in->y + in->h) > (split->y + split->h))
|
||
|
#define R_NEW(_r, _x, _y, _w, _h) {(_r) = calloc(1, sizeof(Cutout_Rect)); (_r)->x = (_x); (_r)->y = (_y); (_r)->w = (_w); (_r)->h = (_h);}
|
||
|
out = NULL;
|
||
|
if (!RECTS_INTERSECT(in->x, in->y, in->w, in->h,
|
||
|
split->x, split->y, split->w, split->h))
|
||
|
{
|
||
|
R_NEW(r, in->x, in->y, in->w, in->h);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
return out;
|
||
|
}
|
||
|
|
||
|
/* S = split (ie cut out rect) */
|
||
|
/* +--+ = in (rect to be cut) */
|
||
|
|
||
|
/*
|
||
|
* +---+
|
||
|
* | |
|
||
|
* | S |
|
||
|
* | |
|
||
|
* +---+
|
||
|
*
|
||
|
*/
|
||
|
if (X1_IN && X2_IN && Y1_IN && Y2_IN)
|
||
|
{
|
||
|
R_NEW(r, in->x, in->y, in->w, SPY1 - in->y);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
R_NEW(r, in->x, SPY1, SPX1 - in->x, SPY2 - SPY1);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
R_NEW(r, SPX2, SPY1, INX2 - SPX2, SPY2 - SPY1);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
R_NEW(r, in->x, SPY2, in->w, INY2 - SPY2);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
return out;
|
||
|
}
|
||
|
/* SSSSSSS
|
||
|
* S+---+S
|
||
|
* S|SSS|S
|
||
|
* S|SSS|S
|
||
|
* S|SSS|S
|
||
|
* S+---+S
|
||
|
* SSSSSSS
|
||
|
*/
|
||
|
if (!X1_IN && !X2_IN && !Y1_IN && !Y2_IN)
|
||
|
{
|
||
|
return NULL;
|
||
|
}
|
||
|
/* SSS
|
||
|
* S+---+
|
||
|
* S|S |
|
||
|
* S|S |
|
||
|
* S|S |
|
||
|
* S+---+
|
||
|
* SSS
|
||
|
*/
|
||
|
if (!X1_IN && X2_IN && !Y1_IN && !Y2_IN)
|
||
|
{
|
||
|
R_NEW(r, SPX2, in->y, INX2 - SPX2, in->h);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
return out;
|
||
|
}
|
||
|
/* S
|
||
|
* +---+
|
||
|
* | S |
|
||
|
* | S |
|
||
|
* | S |
|
||
|
* +---+
|
||
|
* S
|
||
|
*/
|
||
|
if (X1_IN && X2_IN && !Y1_IN && !Y2_IN)
|
||
|
{
|
||
|
R_NEW(r, in->x, in->y, SPX1 - in->x, in->h);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
R_NEW(r, SPX2, in->y, INX2 - SPX2, in->h);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
return out;
|
||
|
}
|
||
|
/* SSS
|
||
|
* +---+S
|
||
|
* | S|S
|
||
|
* | S|S
|
||
|
* | S|S
|
||
|
* +---+S
|
||
|
* SSS
|
||
|
*/
|
||
|
if (X1_IN && !X2_IN && !Y1_IN && !Y2_IN)
|
||
|
{
|
||
|
R_NEW(r, in->x, in->y, SPX1 - in->x, in->h);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
return out;
|
||
|
}
|
||
|
/* SSSSSSS
|
||
|
* S+---+S
|
||
|
* S|SSS|S
|
||
|
* | |
|
||
|
* | |
|
||
|
* +---+
|
||
|
*
|
||
|
*/
|
||
|
if (!X1_IN && !X2_IN && !Y1_IN && Y2_IN)
|
||
|
{
|
||
|
R_NEW(r, in->x, SPY2, in->w, INY2 - SPY2);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
return out;
|
||
|
}
|
||
|
/*
|
||
|
* +---+
|
||
|
* | |
|
||
|
* S|SSS|S
|
||
|
* | |
|
||
|
* +---+
|
||
|
*
|
||
|
*/
|
||
|
if (!X1_IN && !X2_IN && Y1_IN && Y2_IN)
|
||
|
{
|
||
|
R_NEW(r, in->x, in->y, in->w, SPY1 - in->y);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
R_NEW(r, in->x, SPY2, in->w, INY2 - SPY2);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
return out;
|
||
|
}
|
||
|
/*
|
||
|
* +---+
|
||
|
* | |
|
||
|
* | |
|
||
|
* S|SSS|S
|
||
|
* S+---+S
|
||
|
* SSSSSSS
|
||
|
*/
|
||
|
if (!X1_IN && !X2_IN && Y1_IN && !Y2_IN)
|
||
|
{
|
||
|
R_NEW(r, in->x, in->y, in->w, SPY1 - in->y);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
return out;
|
||
|
}
|
||
|
/* SSS
|
||
|
* S+---+
|
||
|
* S|S |
|
||
|
* | |
|
||
|
* | |
|
||
|
* +---+
|
||
|
*
|
||
|
*/
|
||
|
if (!X1_IN && X2_IN && !Y1_IN && Y2_IN)
|
||
|
{
|
||
|
R_NEW(r, SPX2, in->y, INX2 - SPX2, SPY2 - in->y);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
R_NEW(r, in->x, SPY2, in->w, INY2 - SPY2);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
return out;
|
||
|
}
|
||
|
/* S
|
||
|
* +---+
|
||
|
* | S |
|
||
|
* | |
|
||
|
* | |
|
||
|
* +---+
|
||
|
*
|
||
|
*/
|
||
|
if (X1_IN && X2_IN && !Y1_IN && Y2_IN)
|
||
|
{
|
||
|
R_NEW(r, in->x, in->y, SPX1 - in->x, SPY2 - in->y);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
R_NEW(r, SPX2, in->y, INX2 - SPX2, SPY2 - in->y);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
R_NEW(r, in->x, SPY2, in->w, INY2 - SPY2);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
return out;
|
||
|
}
|
||
|
/* SSS
|
||
|
* +---+S
|
||
|
* | S|S
|
||
|
* | |
|
||
|
* | |
|
||
|
* +---+
|
||
|
*
|
||
|
*/
|
||
|
if (X1_IN && !X2_IN && !Y1_IN && Y2_IN)
|
||
|
{
|
||
|
R_NEW(r, in->x, in->y, SPX1 - in->x, SPY2 - in->y);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
R_NEW(r, in->x, SPY2, in->w, INY2 - SPY2);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
return out;
|
||
|
}
|
||
|
/*
|
||
|
* +---+
|
||
|
* | |
|
||
|
* S|S |
|
||
|
* | |
|
||
|
* +---+
|
||
|
*
|
||
|
*/
|
||
|
if (!X1_IN && X2_IN && Y1_IN && Y2_IN)
|
||
|
{
|
||
|
R_NEW(r, in->x, in->y, in->w, SPY1 - in->y);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
R_NEW(r, SPX2, SPY1, INX2 - SPX2, SPY2 - SPY1);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
R_NEW(r, in->x, SPY2, in->w, INY2 - SPY2);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
return out;
|
||
|
}
|
||
|
/*
|
||
|
* +---+
|
||
|
* | |
|
||
|
* | S|S
|
||
|
* | |
|
||
|
* +---+
|
||
|
*
|
||
|
*/
|
||
|
if (X1_IN && !X2_IN && Y1_IN && Y2_IN)
|
||
|
{
|
||
|
R_NEW(r, in->x, in->y, in->w, SPY1 - in->y);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
R_NEW(r, in->x, SPY1, SPX1 - in->x, SPY2 - SPY1);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
R_NEW(r, in->x, SPY2, in->w, INY2 - SPY2);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
return out;
|
||
|
}
|
||
|
/*
|
||
|
* +---+
|
||
|
* | |
|
||
|
* | |
|
||
|
* S|S |
|
||
|
* S+---+
|
||
|
* SSS
|
||
|
*/
|
||
|
if (!X1_IN && X2_IN && Y1_IN && !Y2_IN)
|
||
|
{
|
||
|
R_NEW(r, in->x, in->y, in->w, SPY1 - in->y);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
R_NEW(r, SPX2, SPY1, INX2 - SPX2, INY2 - SPY1);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
return out;
|
||
|
}
|
||
|
/*
|
||
|
* +---+
|
||
|
* | |
|
||
|
* | |
|
||
|
* | S |
|
||
|
* +---+
|
||
|
* S
|
||
|
*/
|
||
|
if (X1_IN && X2_IN && Y1_IN && !Y2_IN)
|
||
|
{
|
||
|
R_NEW(r, in->x, in->y, in->w, SPY1 - in->y);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
R_NEW(r, in->x, SPY1, SPX1 - in->x, INY2 - SPY1);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
R_NEW(r, SPX2, SPY1, INX2 - SPX2, INY2 - SPY1);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
return out;
|
||
|
}
|
||
|
/*
|
||
|
* +---+
|
||
|
* | |
|
||
|
* | |
|
||
|
* | S|S
|
||
|
* +---+S
|
||
|
* SSS
|
||
|
*/
|
||
|
if (X1_IN && !X2_IN && Y1_IN && !Y2_IN)
|
||
|
{
|
||
|
R_NEW(r, in->x, in->y, in->w, SPY1 - in->y);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
R_NEW(r, in->x, SPY1, SPX1 - in->x, INY2 - SPY1);
|
||
|
out = evas_object_list_append(out, r);
|
||
|
return out;
|
||
|
}
|
||
|
return NULL;
|
||
|
}
|
||
|
|
||
|
Gfx_Func_Blend_Src_Dst
|
||
|
draw_func_blend_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
|
||
|
{
|
||
|
#ifdef BUILD_MMX
|
||
|
int mmx, sse, sse2;
|
||
|
|
||
|
cpu_can_do(&mmx, &sse, &sse2);
|
||
|
#endif
|
||
|
if (src->flags & RGBA_IMAGE_HAS_ALPHA)
|
||
|
{
|
||
|
if (dst->flags & RGBA_IMAGE_HAS_ALPHA)
|
||
|
{
|
||
|
return blend_pixels_rgba_to_rgba_c;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
#ifdef BUILD_MMX
|
||
|
# ifdef BUILD_C
|
||
|
if (mmx)
|
||
|
# endif
|
||
|
return blend_pixels_rgba_to_rgb_mmx;
|
||
|
# ifdef BUILD_C
|
||
|
else
|
||
|
# endif
|
||
|
#endif
|
||
|
#ifdef BUILD_C
|
||
|
return blend_pixels_rgba_to_rgb_c;
|
||
|
#endif
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (dst->flags & RGBA_IMAGE_HAS_ALPHA)
|
||
|
{
|
||
|
return copy_pixels_rgb_to_rgba_c;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
#ifdef BUILD_SSE
|
||
|
if ((sse) && (pixels > 256 * 256))
|
||
|
return copy_pixels_rgba_to_rgba_sse;
|
||
|
# ifdef BUILD_MMX
|
||
|
else
|
||
|
# endif
|
||
|
#endif
|
||
|
#ifdef BUILD_MMX
|
||
|
# ifdef BUILD_C
|
||
|
if (mmx)
|
||
|
# endif
|
||
|
return copy_pixels_rgba_to_rgba_mmx;
|
||
|
# ifdef BUILD_C
|
||
|
else
|
||
|
# endif
|
||
|
#endif
|
||
|
#ifdef BUILD_C
|
||
|
return copy_pixels_rgba_to_rgba_c;
|
||
|
#endif
|
||
|
}
|
||
|
}
|
||
|
return blend_pixels_rgba_to_rgba_c;
|
||
|
pixels = 0;
|
||
|
}
|
||
|
|
||
|
Gfx_Func_Blend_Color_Dst
|
||
|
draw_func_blend_color_get(DATA32 src, RGBA_Image *dst, int pixels)
|
||
|
{
|
||
|
#ifdef BUILD_MMX
|
||
|
int mmx, sse, sse2;
|
||
|
|
||
|
cpu_can_do(&mmx, &sse, &sse2);
|
||
|
#endif
|
||
|
if (A_VAL(&src) != 0xff)
|
||
|
{
|
||
|
if (dst->flags & RGBA_IMAGE_HAS_ALPHA)
|
||
|
{
|
||
|
return blend_color_rgba_to_rgba_c;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
#ifdef BUILD_MMX
|
||
|
if (mmx)
|
||
|
return blend_color_rgba_to_rgb_mmx;
|
||
|
#endif
|
||
|
#ifdef BUILD_C
|
||
|
# ifdef BUILD_MMX
|
||
|
else
|
||
|
# endif
|
||
|
return blend_color_rgba_to_rgb_c;
|
||
|
#endif
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (dst->flags & RGBA_IMAGE_HAS_ALPHA)
|
||
|
{
|
||
|
return copy_color_rgb_to_rgba_c;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
#ifdef BUILD_SSE
|
||
|
if ((sse) && (pixels > 256 * 256))
|
||
|
return copy_color_rgba_to_rgba_sse;
|
||
|
#endif
|
||
|
#ifdef BUILD_MMX
|
||
|
# ifdef BUILD_SSE
|
||
|
else
|
||
|
# endif
|
||
|
if (mmx)
|
||
|
return copy_color_rgba_to_rgba_mmx;
|
||
|
#endif
|
||
|
#ifdef BUILD_C
|
||
|
# ifdef BUILD_MMX
|
||
|
else
|
||
|
# endif
|
||
|
return copy_color_rgba_to_rgba_c;
|
||
|
#endif
|
||
|
}
|
||
|
}
|
||
|
return blend_color_rgba_to_rgba_c;
|
||
|
pixels = 0;
|
||
|
}
|
||
|
|
||
|
Gfx_Func_Blend_Src_Cmod_Dst
|
||
|
draw_func_blend_cmod_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
|
||
|
{
|
||
|
#ifdef BUILD_MMX
|
||
|
int mmx, sse, sse2;
|
||
|
|
||
|
cpu_can_do(&mmx, &sse, &sse2);
|
||
|
#endif
|
||
|
if (src->flags & RGBA_IMAGE_HAS_ALPHA)
|
||
|
{
|
||
|
if (dst->flags & RGBA_IMAGE_HAS_ALPHA)
|
||
|
{
|
||
|
return blend_pixels_cmod_rgba_to_rgba_c;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return blend_pixels_cmod_rgba_to_rgb_c;
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (dst->flags & RGBA_IMAGE_HAS_ALPHA)
|
||
|
{
|
||
|
return copy_pixels_cmod_rgb_to_rgba_c;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return copy_pixels_cmod_rgba_to_rgba_c;
|
||
|
}
|
||
|
}
|
||
|
return blend_pixels_cmod_rgba_to_rgba_c;
|
||
|
pixels = 0;
|
||
|
}
|
||
|
|
||
|
Gfx_Func_Blend_Src_Mul_Dst
|
||
|
draw_func_blend_mul_get(RGBA_Image *src, DATA32 col, RGBA_Image *dst, int pixels)
|
||
|
{
|
||
|
#ifdef BUILD_MMX
|
||
|
int mmx, sse, sse2;
|
||
|
|
||
|
cpu_can_do(&mmx, &sse, &sse2);
|
||
|
#endif
|
||
|
if (src->flags & RGBA_IMAGE_HAS_ALPHA)
|
||
|
{
|
||
|
if (dst->flags & RGBA_IMAGE_HAS_ALPHA)
|
||
|
{
|
||
|
return blend_pixels_mul_color_rgba_to_rgba_c;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
#ifdef BUILD_MMX
|
||
|
if (mmx)
|
||
|
return blend_pixels_mul_color_rgba_to_rgb_mmx;
|
||
|
#endif
|
||
|
#ifdef BUILD_C
|
||
|
# ifdef BUILD_MMX
|
||
|
else
|
||
|
# endif
|
||
|
return blend_pixels_mul_color_rgba_to_rgb_c;
|
||
|
#endif
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (dst->flags & RGBA_IMAGE_HAS_ALPHA)
|
||
|
{
|
||
|
return blend_pixels_mul_color_rgba_to_rgba_c;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
#ifdef BUILD_MMX
|
||
|
if (mmx)
|
||
|
return blend_pixels_mul_color_rgba_to_rgb_mmx;
|
||
|
#endif
|
||
|
#ifdef BUILD_C
|
||
|
# ifdef BUILD_MMX
|
||
|
else
|
||
|
# endif
|
||
|
return blend_pixels_mul_color_rgba_to_rgb_c;
|
||
|
#endif
|
||
|
}
|
||
|
}
|
||
|
return blend_pixels_mul_color_rgba_to_rgba_c;
|
||
|
col = 0;
|
||
|
pixels = 0;
|
||
|
}
|
||
|
|
||
|
Gfx_Func_Blend_Src_Alpha_Mul_Dst
|
||
|
draw_func_blend_alpha_get(RGBA_Image *dst)
|
||
|
{
|
||
|
#ifdef BUILD_MMX
|
||
|
int mmx, sse, sse2;
|
||
|
|
||
|
cpu_can_do(&mmx, &sse, &sse2);
|
||
|
#endif
|
||
|
if (dst->flags & RGBA_IMAGE_HAS_ALPHA)
|
||
|
{
|
||
|
return blend_alpha_color_rgba_to_rgba_c;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
#ifdef BUILD_MMX
|
||
|
if (mmx)
|
||
|
return blend_alpha_color_rgba_to_rgb_mmx;
|
||
|
#endif
|
||
|
#ifdef BUILD_C
|
||
|
# ifdef BUILD_MMX
|
||
|
else
|
||
|
# endif
|
||
|
return blend_alpha_color_rgba_to_rgb_c;
|
||
|
#endif
|
||
|
}
|
||
|
#ifdef BUILD_C
|
||
|
return blend_alpha_color_rgba_to_rgba_c;
|
||
|
#else
|
||
|
return NULL;
|
||
|
#endif
|
||
|
}
|
||
|
|
||
|
Gfx_Func_Blend_Src_Dst
|
||
|
draw_func_copy_get(int pixels, int reverse)
|
||
|
{
|
||
|
#ifdef BUILD_MMX
|
||
|
int mmx, sse, sse2;
|
||
|
|
||
|
cpu_can_do(&mmx, &sse, &sse2);
|
||
|
#endif
|
||
|
if (reverse)
|
||
|
{
|
||
|
#ifdef BUILD_SSE
|
||
|
if ((sse) && (pixels > 256 * 256))
|
||
|
return copy_pixels_rev_rgba_to_rgba_sse;
|
||
|
#endif
|
||
|
#ifdef BUILD_MMX
|
||
|
# ifdef BUILD_SSE
|
||
|
else
|
||
|
# endif
|
||
|
if (mmx)
|
||
|
return copy_pixels_rev_rgba_to_rgba_mmx;
|
||
|
#endif
|
||
|
#ifdef BUILD_C
|
||
|
# ifdef BUILD_MMX
|
||
|
else
|
||
|
# endif
|
||
|
return copy_pixels_rev_rgba_to_rgba_c;
|
||
|
#endif
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
#ifdef BUILD_SSE
|
||
|
if ((sse) && (pixels > 256 * 256))
|
||
|
return copy_pixels_rgba_to_rgba_sse;
|
||
|
#endif
|
||
|
#ifdef BUILD_MMX
|
||
|
# ifdef BUILD_SSE
|
||
|
else
|
||
|
# endif
|
||
|
if (mmx)
|
||
|
return copy_pixels_rgba_to_rgba_mmx;
|
||
|
#endif
|
||
|
#ifdef BUILD_C
|
||
|
# ifdef BUILD_MMX
|
||
|
else
|
||
|
# endif
|
||
|
return copy_pixels_rgba_to_rgba_c;
|
||
|
#endif
|
||
|
}
|
||
|
#ifdef BUILD_C
|
||
|
return copy_pixels_rgba_to_rgba_c;
|
||
|
#else
|
||
|
return NULL;
|
||
|
#endif
|
||
|
pixels = 0;
|
||
|
}
|
||
|
|