* Make RGBA_IMAGE_HAS_ALPHA and RGBA_IMAGE_ALPHA_SPARSE part of

Image_Entry flag structure. This fix a bug with 16 bpp software engine.

        * Change image loader module API to take any Image_Entry. Same goes
        for evas_common_image_premul and evas_common_image_set_alpha_sparse.

        * Use new eet API: eet_data_image_read_to_surface.


SVN revision: 34728
This commit is contained in:
Cedric BAIL 2008-06-03 09:09:39 +00:00
parent 6ec89fc019
commit d102e3db82
46 changed files with 649 additions and 626 deletions

View File

@ -604,6 +604,7 @@ evas_cache_image_copied_data(Evas_Cache_Image *cache, int w, int h, DATA32 *imag
im = _evas_cache_image_entry_new(cache, NULL, 0, NULL, NULL, NULL, NULL);
if (!im) return NULL;
im->space = cspace;
im->flags.alpha = alpha;
_evas_cache_image_entry_surface_alloc(cache, im, w, h);
@ -629,6 +630,7 @@ evas_cache_image_data(Evas_Cache_Image *cache, int w, int h, DATA32 *image_data,
im = _evas_cache_image_entry_new(cache, NULL, 0, NULL, NULL, NULL, NULL);
im->w = w;
im->h = h;
im->flags.alpha = alpha;
if (cache->func.data(im, w, h, image_data, alpha, cspace) != 0)
{
@ -784,7 +786,6 @@ evas_cache_image_colorspace(Image_Entry *im, int cspace)
cache = im->cache;
if (!im) return ;
if (im->space == cspace) return ;
im->space = cspace;
@ -819,3 +820,16 @@ evas_cache_private_set(Evas_Cache_Image *cache, const void *data)
cache->data = data;
}
EAPI DATA32 *
evas_cache_image_pixels(Image_Entry *im)
{
Evas_Cache_Image *cache;
assert(im);
assert(im->cache);
cache = im->cache;
return cache->func.surface_pixels(im);
}

View File

@ -143,7 +143,7 @@ evas_common_gfx_func_composite_pixel_span_get(RGBA_Image *src, RGBA_Image *dst,
RGBA_Gfx_Compositor *comp;
RGBA_Gfx_Func func = NULL;
if (src && (!(src->flags & RGBA_IMAGE_HAS_ALPHA)))
if (src && (!src->cache_entry.flags.alpha))
{
if (op == _EVAS_RENDER_BLEND)
op = _EVAS_RENDER_COPY;
@ -186,7 +186,7 @@ evas_common_gfx_func_composite_pixel_color_span_get(RGBA_Image *src, DATA32 col,
RGBA_Gfx_Compositor *comp;
RGBA_Gfx_Func func = NULL;
if ((src && (!(src->flags & RGBA_IMAGE_HAS_ALPHA))) && ((col & 0xff000000) == 0xff000000))
if ((src && (!src->cache_entry.flags.alpha)) && ((col & 0xff000000) == 0xff000000))
{
if (op == _EVAS_RENDER_BLEND)
op = _EVAS_RENDER_COPY;
@ -231,12 +231,12 @@ evas_common_gfx_func_composite_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *
}
RGBA_Gfx_Pt_Func
evas_common_gfx_func_composite_pixel_pt_get(int src_flags, RGBA_Image *dst, int op)
evas_common_gfx_func_composite_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst, int op)
{
RGBA_Gfx_Compositor *comp;
RGBA_Gfx_Pt_Func func = NULL;
if (!(src_flags & RGBA_IMAGE_HAS_ALPHA))
if (!src_flags.alpha)
{
if (op == _EVAS_RENDER_BLEND)
op = _EVAS_RENDER_COPY;
@ -274,12 +274,12 @@ evas_common_gfx_func_composite_color_pt_get(DATA32 col, RGBA_Image *dst, int op)
}
RGBA_Gfx_Pt_Func
evas_common_gfx_func_composite_pixel_color_pt_get(int src_flags, DATA32 col, RGBA_Image *dst, int op)
evas_common_gfx_func_composite_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst, int op)
{
RGBA_Gfx_Compositor *comp;
RGBA_Gfx_Pt_Func func = NULL;
if ((!(src_flags & RGBA_IMAGE_HAS_ALPHA)) && ((col & 0xff000000) == 0xff000000))
if ((!src_flags.alpha) && ((col & 0xff000000) == 0xff000000))
{
if (op == _EVAS_RENDER_BLEND)
op = _EVAS_RENDER_COPY;
@ -310,7 +310,7 @@ evas_common_gfx_func_composite_mask_color_pt_get(DATA32 col, RGBA_Image *dst, in
}
RGBA_Gfx_Pt_Func
evas_common_gfx_func_composite_pixel_mask_pt_get(int src_flags, RGBA_Image *dst, int op)
evas_common_gfx_func_composite_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst, int op)
{
RGBA_Gfx_Compositor *comp;
RGBA_Gfx_Pt_Func func = NULL;

View File

@ -461,7 +461,7 @@ evas_common_gradient_draw(RGBA_Image *dst, RGBA_Draw_Context *dc,
{
direct_copy = 1; buf_step = dst->cache_entry.w;
if (gr->type.geometer->has_alpha(gr, dc->render_op))
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
}
else if ((dc->render_op == _EVAS_RENDER_BLEND) &&
!gr->type.geometer->has_alpha(gr, dc->render_op))
@ -474,12 +474,9 @@ evas_common_gradient_draw(RGBA_Image *dst, RGBA_Draw_Context *dc,
{
argb_buf = evas_common_image_line_buffer_obtain(w);
if (!argb_buf)
return;
if (gr->type.geometer->has_alpha(gr, dc->render_op))
argb_buf->flags |= RGBA_IMAGE_HAS_ALPHA;
else
argb_buf->flags &= ~RGBA_IMAGE_HAS_ALPHA;
return;
argb_buf->cache_entry.flags.alpha = gr->type.geometer->has_alpha(gr, dc->render_op) ? 1 : 0;
if (gr->type.geometer->has_mask(gr, dc->render_op))
{
alpha_buf = evas_common_image_alpha_line_buffer_obtain(w);

View File

@ -15,10 +15,7 @@ evas_common_rgba_image_from_data(Image_Entry* ie_dst, int w, int h, DATA32 *imag
dst->cache_entry.h = h;
dst->image.data = image_data;
dst->image.no_free = 1;
if (alpha)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
else
dst->flags &= ~RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = alpha ? 1 : 0;
break;
case EVAS_COLORSPACE_YCBCR422P601_PL:
case EVAS_COLORSPACE_YCBCR422P709_PL:
@ -46,10 +43,7 @@ evas_common_rgba_image_from_copied_data(Image_Entry* ie_dst, int w, int h, DATA3
switch (cspace)
{
case EVAS_COLORSPACE_ARGB8888:
if (alpha)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
else
dst->flags &= ~RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = alpha ? 1 : 0;
if (image_data)
memcpy(dst->image.data, image_data, w * h * sizeof(DATA32));
break;

View File

@ -33,7 +33,6 @@ int
evas_common_load_rgba_image_module_from_file(Image_Entry *ie)
{
Evas_Image_Load_Func *evas_image_load_func = NULL;
RGBA_Image *im = (RGBA_Image *) ie;
const char *loader = NULL;
Evas_List *l;
Evas_Module *em;
@ -62,7 +61,7 @@ evas_common_load_rgba_image_module_from_file(Image_Entry *ie)
{
evas_module_use(em);
evas_image_load_func = em->functions;
if (evas_image_load_func->file_head(im, ie->file, ie->key))
if (evas_image_load_func->file_head(ie, ie->file, ie->key))
goto ok;
}
}
@ -75,7 +74,7 @@ evas_common_load_rgba_image_module_from_file(Image_Entry *ie)
if (!evas_module_load(em)) continue;
evas_image_load_func = em->functions;
evas_module_use(em);
if (evas_image_load_func->file_head(im, ie->file, ie->key))
if (evas_image_load_func->file_head(ie, ie->file, ie->key))
{
if (evas_modules != l)
{
@ -88,9 +87,9 @@ evas_common_load_rgba_image_module_from_file(Image_Entry *ie)
return -1;
ok:
im->info.module = (void*) em;
im->info.loader = (void*) evas_image_load_func;
evas_module_ref((Evas_Module*) im->info.module);
ie->info.module = (void*) em;
ie->info.loader = (void*) evas_image_load_func;
evas_module_ref((Evas_Module*) ie->info.module);
return 0;
}
@ -98,18 +97,17 @@ int
evas_common_load_rgba_image_data_from_file(Image_Entry *ie)
{
Evas_Image_Load_Func *evas_image_load_func = NULL;
RGBA_Image *im = (RGBA_Image *) ie;
if (!im->info.module) return -1;
if (!ie->info.module) return -1;
if (ie->flags.loaded) return -1;
evas_image_load_func = im->info.loader;
evas_module_use((Evas_Module*) im->info.module);
if (!evas_image_load_func->file_data(im, ie->file, ie->key))
evas_image_load_func = ie->info.loader;
evas_module_use((Evas_Module*) ie->info.module);
if (!evas_image_load_func->file_data(ie, ie->file, ie->key))
return -1;
evas_module_unref((Evas_Module*) im->info.module);
im->info.module = NULL;
evas_module_unref((Evas_Module*) ie->info.module);
ie->info.module = NULL;
return 0;
}

View File

@ -32,6 +32,7 @@ static void _evas_common_rgba_image_delete(Image_Entry *ie);
static int _evas_common_rgba_image_surface_alloc(Image_Entry *ie, int w, int h);
static void _evas_common_rgba_image_surface_delete(Image_Entry *ie);
static DATA32 *_evas_common_rgba_image_surface_pixels(Image_Entry *ie);
static void _evas_common_rgba_image_unload(Image_Entry *im);
@ -55,6 +56,7 @@ static const Evas_Cache_Image_Func _evas_common_image_func =
_evas_common_rgba_image_delete,
_evas_common_rgba_image_surface_alloc,
_evas_common_rgba_image_surface_delete,
_evas_common_rgba_image_surface_pixels,
evas_common_load_rgba_image_module_from_file,
_evas_common_rgba_image_unload,
_evas_common_rgba_image_dirty_region,
@ -128,7 +130,7 @@ _evas_common_rgba_image_delete(Image_Entry *ie)
RGBA_Image *im = (RGBA_Image *) ie;
evas_common_pipe_free(im);
if (im->info.module) evas_module_unref((Evas_Module *)im->info.module);
if (ie->info.module) evas_module_unref((Evas_Module *)ie->info.module);
/* memset the image to 0x99 because i recently saw a segv where an
* seemed to be used BUT its contents were wrong - it looks like it was
* overwritten by something from efreet - as there was an execute command
@ -238,6 +240,14 @@ _evas_common_rgba_image_ram_usage(Image_Entry *ie)
return 0;
}
static DATA32 *
_evas_common_rgba_image_surface_pixels(Image_Entry *ie)
{
RGBA_Image *im = (RGBA_Image *) ie;
return im->image.data;
}
#if 0
void
evas_common_image_surface_alpha_tiles_calc(RGBA_Surface *is, int tsize)
@ -246,7 +256,7 @@ evas_common_image_surface_alpha_tiles_calc(RGBA_Surface *is, int tsize)
DATA32 *ptr;
if (is->spans) return;
if (!(is->im->flags & RGBA_IMAGE_HAS_ALPHA)) return;
if (!is->im->cache_entry.flags.alpha) return;
/* FIXME: dont handle alpha only images yet */
if ((is->im->flags & RGBA_IMAGE_ALPHA_ONLY)) return;
if (tsize < 0) tsize = 0;
@ -526,16 +536,17 @@ evas_common_image_alpha_line_buffer_release(RGBA_Image *im)
}
EAPI void
evas_common_image_premul(RGBA_Image *im)
evas_common_image_premul(Image_Entry *ie)
{
DATA32 *s, *se;
DATA32 nas = 0;
if (!im || !im->image.data) return;
if (!(im->flags & RGBA_IMAGE_HAS_ALPHA)) return;
if (!ie) return ;
if (!evas_cache_image_pixels(ie)) return ;
if (!ie->flags.alpha) return;
s = im->image.data;
se = s + (im->cache_entry.w * im->cache_entry.h);
s = evas_cache_image_pixels(ie);
se = s + (ie->w * ie->h);
while (s < se)
{
DATA32 a = 1 + (*s >> 24);
@ -546,21 +557,22 @@ evas_common_image_premul(RGBA_Image *im)
if ((a == 1) || (a == 256))
nas++;
}
if ((ALPHA_SPARSE_INV_FRACTION * nas) >= (im->cache_entry.w * im->cache_entry.h))
im->flags |= RGBA_IMAGE_ALPHA_SPARSE;
if ((ALPHA_SPARSE_INV_FRACTION * nas) >= (ie->w * ie->h))
ie->flags.alpha_sparse = 1;
}
EAPI void
evas_common_image_set_alpha_sparse(RGBA_Image *im)
evas_common_image_set_alpha_sparse(Image_Entry *ie)
{
DATA32 *s, *se;
DATA32 nas = 0;
if (!im || !im->image.data) return;
if (!(im->flags & RGBA_IMAGE_HAS_ALPHA)) return;
if (!ie) return;
if (!evas_cache_image_pixels(ie)) return ;
if (!ie->flags.alpha) return;
s = im->image.data;
se = s + (im->cache_entry.w * im->cache_entry.h);
s = evas_cache_image_pixels(ie);
se = s + (ie->w * ie->h);
while (s < se)
{
DATA32 p = *s & 0xff000000;
@ -569,6 +581,6 @@ evas_common_image_set_alpha_sparse(RGBA_Image *im)
nas++;
s++;
}
if ((ALPHA_SPARSE_INV_FRACTION * nas) >= (im->cache_entry.w * im->cache_entry.h))
im->flags |= RGBA_IMAGE_ALPHA_SPARSE;
if ((ALPHA_SPARSE_INV_FRACTION * nas) >= (ie->w * ie->h))
ie->flags.alpha_sparse = 1;
}

View File

@ -12,11 +12,11 @@ static RGBA_Gfx_Func op_add_pixel_color_span_get(RGBA_Image *src, DATA32 col, RG
static RGBA_Gfx_Func op_add_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels);
static RGBA_Gfx_Func op_add_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels);
static RGBA_Gfx_Pt_Func op_add_pixel_pt_get(int src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_add_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_add_color_pt_get(DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_add_pixel_color_pt_get(int src_flags, DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_add_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_add_mask_color_pt_get(DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_add_pixel_mask_pt_get(int src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_add_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
static RGBA_Gfx_Compositor _composite_add = { "add",
op_add_init, op_add_shutdown,
@ -46,11 +46,11 @@ static RGBA_Gfx_Func op_add_rel_pixel_color_span_get(RGBA_Image *src, DATA32 col
static RGBA_Gfx_Func op_add_rel_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels);
static RGBA_Gfx_Func op_add_rel_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels);
static RGBA_Gfx_Pt_Func op_add_rel_pixel_pt_get(int src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_add_rel_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_add_rel_color_pt_get(DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_add_rel_pixel_color_pt_get(int src_flags, DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_add_rel_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_add_rel_mask_color_pt_get(DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_add_rel_pixel_mask_pt_get(int src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_add_rel_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
static RGBA_Gfx_Compositor _composite_add_rel = { "add_rel",
op_add_rel_init, op_add_rel_shutdown,
@ -147,9 +147,9 @@ op_add_pixel_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
{
int s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
if (src && src->cache_entry.flags.alpha)
s = SP;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return add_gfx_span_func_cpu(s, m, c, d);
}
@ -165,7 +165,7 @@ op_add_color_span_get(DATA32 col, RGBA_Image *dst, int pixels)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return add_gfx_span_func_cpu(s, m, c, d);
}
@ -175,7 +175,7 @@ op_add_pixel_color_span_get(RGBA_Image *src, DATA32 col, RGBA_Image *dst, int pi
{
int s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
if (src && src->cache_entry.flags.alpha)
s = SP;
if ((col >> 24) < 255)
c = SC;
@ -183,7 +183,7 @@ op_add_pixel_color_span_get(RGBA_Image *src, DATA32 col, RGBA_Image *dst, int pi
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return add_gfx_span_func_cpu(s, m, c, d);
}
@ -199,7 +199,7 @@ op_add_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return add_gfx_span_func_cpu(s, m, c, d);
}
@ -209,9 +209,9 @@ op_add_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
{
int s = SP_AN, m = SM_AS, c = SC_N, d = DP_AN;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
if (src && src->cache_entry.flags.alpha)
s = SP;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return add_gfx_span_func_cpu(s, m, c, d);
}
@ -238,13 +238,13 @@ add_gfx_pt_func_cpu(int s, int m, int c, int d)
}
static RGBA_Gfx_Pt_Func
op_add_pixel_pt_get(int src_flags, RGBA_Image *dst)
op_add_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
{
int s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
if (src_flags.alpha)
s = SP;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return add_gfx_pt_func_cpu(s, m, c, d);
}
@ -260,17 +260,17 @@ op_add_color_pt_get(DATA32 col, RGBA_Image *dst)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return add_gfx_pt_func_cpu(s, m, c, d);
}
static RGBA_Gfx_Pt_Func
op_add_pixel_color_pt_get(int src_flags, DATA32 col, RGBA_Image *dst)
op_add_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst)
{
int s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
if (src_flags.alpha)
s = SP;
if ((col >> 24) < 255)
c = SC;
@ -278,7 +278,7 @@ op_add_pixel_color_pt_get(int src_flags, DATA32 col, RGBA_Image *dst)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return add_gfx_pt_func_cpu(s, m, c, d);
}
@ -294,19 +294,19 @@ op_add_mask_color_pt_get(DATA32 col, RGBA_Image *dst)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return add_gfx_pt_func_cpu(s, m, c, d);
}
static RGBA_Gfx_Pt_Func
op_add_pixel_mask_pt_get(int src_flags, RGBA_Image *dst)
op_add_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
{
int s = SP_AN, m = SM_AS, c = SC_N, d = DP_AN;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
if (src_flags.alpha)
s = SP;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return add_gfx_pt_func_cpu(s, m, c, d);
}
@ -377,9 +377,9 @@ op_add_rel_pixel_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
{
int s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
if (src && src->cache_entry.flags.alpha)
s = SP;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return add_rel_gfx_span_func_cpu(s, m, c, d);
}
@ -395,7 +395,7 @@ op_add_rel_color_span_get(DATA32 col, RGBA_Image *dst, int pixels)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return add_rel_gfx_span_func_cpu(s, m, c, d);
}
@ -405,7 +405,7 @@ op_add_rel_pixel_color_span_get(RGBA_Image *src, DATA32 col, RGBA_Image *dst, in
{
int s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
if (src && src->cache_entry.flags.alpha)
s = SP;
if ((col >> 24) < 255)
c = SC;
@ -413,7 +413,7 @@ op_add_rel_pixel_color_span_get(RGBA_Image *src, DATA32 col, RGBA_Image *dst, in
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return add_rel_gfx_span_func_cpu(s, m, c, d);
}
@ -429,7 +429,7 @@ op_add_rel_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return add_rel_gfx_span_func_cpu(s, m, c, d);
}
@ -439,9 +439,9 @@ op_add_rel_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
{
int s = SP_AN, m = SM_AS, c = SC_N, d = DP_AN;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
if (src && src->cache_entry.flags.alpha)
s = SP;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return add_rel_gfx_span_func_cpu(s, m, c, d);
}
@ -468,13 +468,13 @@ add_rel_gfx_pt_func_cpu(int s, int m, int c, int d)
}
static RGBA_Gfx_Pt_Func
op_add_rel_pixel_pt_get(int src_flags, RGBA_Image *dst)
op_add_rel_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
{
int s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
if (src_flags.alpha)
s = SP;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return add_rel_gfx_pt_func_cpu(s, m, c, d);
}
@ -490,17 +490,17 @@ op_add_rel_color_pt_get(DATA32 col, RGBA_Image *dst)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return add_rel_gfx_pt_func_cpu(s, m, c, d);
}
static RGBA_Gfx_Pt_Func
op_add_rel_pixel_color_pt_get(int src_flags, DATA32 col, RGBA_Image *dst)
op_add_rel_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst)
{
int s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
if (src_flags.alpha)
s = SP;
if ((col >> 24) < 255)
c = SC;
@ -508,7 +508,7 @@ op_add_rel_pixel_color_pt_get(int src_flags, DATA32 col, RGBA_Image *dst)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return add_rel_gfx_pt_func_cpu(s, m, c, d);
}
@ -524,19 +524,19 @@ op_add_rel_mask_color_pt_get(DATA32 col, RGBA_Image *dst)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return add_rel_gfx_pt_func_cpu(s, m, c, d);
}
static RGBA_Gfx_Pt_Func
op_add_rel_pixel_mask_pt_get(int src_flags, RGBA_Image *dst)
op_add_rel_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
{
int s = SP_AN, m = SM_AS, c = SC_N, d = DP_AN;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
if (src_flags.alpha)
s = SP;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return add_rel_gfx_pt_func_cpu(s, m, c, d);
}

View File

@ -12,11 +12,11 @@ static RGBA_Gfx_Func op_blend_pixel_color_span_get(RGBA_Image *src, DATA32 col,
static RGBA_Gfx_Func op_blend_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels);
static RGBA_Gfx_Func op_blend_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels);
static RGBA_Gfx_Pt_Func op_blend_pixel_pt_get(int src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_blend_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_blend_color_pt_get(DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_blend_pixel_color_pt_get(int src_flags, DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_blend_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_blend_mask_color_pt_get(DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_blend_pixel_mask_pt_get(int src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_blend_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
static RGBA_Gfx_Compositor _composite_blend = { "blend",
op_blend_init, op_blend_shutdown,
@ -47,11 +47,11 @@ static RGBA_Gfx_Func op_blend_rel_pixel_color_span_get(RGBA_Image *src, DATA32 c
static RGBA_Gfx_Func op_blend_rel_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels);
static RGBA_Gfx_Func op_blend_rel_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels);
static RGBA_Gfx_Pt_Func op_blend_rel_pixel_pt_get(int src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_blend_rel_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_blend_rel_color_pt_get(DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_blend_rel_pixel_color_pt_get(int src_flags, DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_blend_rel_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_blend_rel_mask_color_pt_get(DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_blend_rel_pixel_mask_pt_get(int src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_blend_rel_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
static RGBA_Gfx_Compositor _composite_blend_rel = { "blend_rel",
op_blend_rel_init, op_blend_rel_shutdown,
@ -148,13 +148,13 @@ op_blend_pixel_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
{
int s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
if (src && src->cache_entry.flags.alpha)
{
s = SP;
if (src->flags & RGBA_IMAGE_ALPHA_SPARSE)
if (src->cache_entry.flags.alpha_sparse)
s = SP_AS;
}
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return blend_gfx_span_func_cpu(s, m, c, d);
}
@ -170,7 +170,7 @@ op_blend_color_span_get(DATA32 col, RGBA_Image *dst, int pixels)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return blend_gfx_span_func_cpu(s, m, c, d);
}
@ -180,10 +180,10 @@ op_blend_pixel_color_span_get(RGBA_Image *src, DATA32 col, RGBA_Image *dst, int
{
int s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
if (src && src->cache_entry.flags.alpha)
{
s = SP;
if (src->flags & RGBA_IMAGE_ALPHA_SPARSE)
if (src->cache_entry.flags.alpha_sparse)
s = SP_AS;
}
if ((col >> 24) < 255)
@ -192,7 +192,7 @@ op_blend_pixel_color_span_get(RGBA_Image *src, DATA32 col, RGBA_Image *dst, int
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return blend_gfx_span_func_cpu(s, m, c, d);
}
@ -208,7 +208,7 @@ op_blend_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return blend_gfx_span_func_cpu(s, m, c, d);
}
@ -218,13 +218,13 @@ op_blend_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
{
int s = SP_AN, m = SM_AS, c = SC_N, d = DP_AN;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
if (src && src->cache_entry.flags.alpha)
{
s = SP;
if (src->flags & RGBA_IMAGE_ALPHA_SPARSE)
if (src->cache_entry.flags.alpha_sparse)
s = SP_AS;
}
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return blend_gfx_span_func_cpu(s, m, c, d);
}
@ -252,13 +252,13 @@ blend_gfx_pt_func_cpu(int s, int m, int c, int d)
}
static RGBA_Gfx_Pt_Func
op_blend_pixel_pt_get(int src_flags, RGBA_Image *dst)
op_blend_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
{
int s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
if (src_flags.alpha)
s = SP;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return blend_gfx_pt_func_cpu(s, m, c, d);
}
@ -274,17 +274,17 @@ op_blend_color_pt_get(DATA32 col, RGBA_Image *dst)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return blend_gfx_pt_func_cpu(s, m, c, d);
}
static RGBA_Gfx_Pt_Func
op_blend_pixel_color_pt_get(int src_flags, DATA32 col, RGBA_Image *dst)
op_blend_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst)
{
int s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
if (src_flags.alpha)
s = SP;
if ((col >> 24) < 255)
c = SC;
@ -292,7 +292,7 @@ op_blend_pixel_color_pt_get(int src_flags, DATA32 col, RGBA_Image *dst)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return blend_gfx_pt_func_cpu(s, m, c, d);
}
@ -308,19 +308,19 @@ op_blend_mask_color_pt_get(DATA32 col, RGBA_Image *dst)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return blend_gfx_pt_func_cpu(s, m, c, d);
}
static RGBA_Gfx_Pt_Func
op_blend_pixel_mask_pt_get(int src_flags, RGBA_Image *dst)
op_blend_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
{
int s = SP_AN, m = SM_AS, c = SC_N, d = DP_AN;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
if (src_flags.alpha)
s = SP;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return blend_gfx_pt_func_cpu(s, m, c, d);
}
@ -390,13 +390,13 @@ op_blend_rel_pixel_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
{
int s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
if (src && src->cache_entry.flags.alpha)
{
s = SP;
if (src->flags & RGBA_IMAGE_ALPHA_SPARSE)
if (src->cache_entry.flags.alpha_sparse)
s = SP_AS;
}
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return blend_rel_gfx_span_func_cpu(s, m, c, d);
}
@ -412,7 +412,7 @@ op_blend_rel_color_span_get(DATA32 col, RGBA_Image *dst, int pixels)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return blend_rel_gfx_span_func_cpu(s, m, c, d);
}
@ -422,7 +422,7 @@ op_blend_rel_pixel_color_span_get(RGBA_Image *src, DATA32 col, RGBA_Image *dst,
{
int s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
if (src && src->cache_entry.flags.alpha)
s = SP;
if ((col >> 24) < 255)
c = SC;
@ -430,7 +430,7 @@ op_blend_rel_pixel_color_span_get(RGBA_Image *src, DATA32 col, RGBA_Image *dst,
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return blend_rel_gfx_span_func_cpu(s, m, c, d);
}
@ -446,7 +446,7 @@ op_blend_rel_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return blend_rel_gfx_span_func_cpu(s, m, c, d);
}
@ -456,13 +456,13 @@ op_blend_rel_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
{
int s = SP_AN, m = SM_AS, c = SC_N, d = DP_AN;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
if (src && src->cache_entry.flags.alpha)
{
s = SP;
if (src->flags & RGBA_IMAGE_ALPHA_SPARSE)
if (src->cache_entry.flags.alpha_sparse)
s = SP_AS;
}
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return blend_rel_gfx_span_func_cpu(s, m, c, d);
}
@ -489,13 +489,13 @@ blend_rel_gfx_pt_func_cpu(int s, int m, int c, int d)
}
static RGBA_Gfx_Pt_Func
op_blend_rel_pixel_pt_get(int src_flags, RGBA_Image *dst)
op_blend_rel_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
{
int s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
if (src_flags.alpha)
s = SP;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return blend_rel_gfx_pt_func_cpu(s, m, c, d);
}
@ -511,17 +511,17 @@ op_blend_rel_color_pt_get(DATA32 col, RGBA_Image *dst)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return blend_rel_gfx_pt_func_cpu(s, m, c, d);
}
static RGBA_Gfx_Pt_Func
op_blend_rel_pixel_color_pt_get(int src_flags, DATA32 col, RGBA_Image *dst)
op_blend_rel_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst)
{
int s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
if (src_flags.alpha)
s = SP;
if ((col >> 24) < 255)
c = SC;
@ -529,7 +529,7 @@ op_blend_rel_pixel_color_pt_get(int src_flags, DATA32 col, RGBA_Image *dst)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return blend_rel_gfx_pt_func_cpu(s, m, c, d);
}
@ -545,19 +545,19 @@ op_blend_rel_mask_color_pt_get(DATA32 col, RGBA_Image *dst)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return blend_rel_gfx_pt_func_cpu(s, m, c, d);
}
static RGBA_Gfx_Pt_Func
op_blend_rel_pixel_mask_pt_get(int src_flags, RGBA_Image *dst)
op_blend_rel_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
{
int s = SP_AN, m = SM_AS, c = SC_N, d = DP_AN;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
if (src_flags.alpha)
s = SP;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return blend_rel_gfx_pt_func_cpu(s, m, c, d);
}

View File

@ -12,11 +12,11 @@ static RGBA_Gfx_Func op_copy_pixel_color_span_get(RGBA_Image *src, DATA32 col, R
static RGBA_Gfx_Func op_copy_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels);
static RGBA_Gfx_Func op_copy_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels);
static RGBA_Gfx_Pt_Func op_copy_pixel_pt_get(int src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_copy_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_copy_color_pt_get(DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_copy_pixel_color_pt_get(int src_flags, DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_copy_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_copy_mask_color_pt_get(DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_copy_pixel_mask_pt_get(int src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_copy_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
static RGBA_Gfx_Compositor _composite_copy = { "copy",
op_copy_init, op_copy_shutdown,
@ -47,11 +47,11 @@ static RGBA_Gfx_Func op_copy_rel_pixel_color_span_get(RGBA_Image *src, DATA32 co
static RGBA_Gfx_Func op_copy_rel_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels);
static RGBA_Gfx_Func op_copy_rel_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels);
static RGBA_Gfx_Pt_Func op_copy_rel_pixel_pt_get(int src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_copy_rel_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_copy_rel_color_pt_get(DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_copy_rel_pixel_color_pt_get(int src_flags, DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_copy_rel_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_copy_rel_mask_color_pt_get(DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_copy_rel_pixel_mask_pt_get(int src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_copy_rel_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
static RGBA_Gfx_Compositor _composite_copy_rel = { "copy_rel",
op_copy_rel_init, op_copy_rel_shutdown,
@ -149,12 +149,12 @@ op_copy_pixel_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
{
int s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
if (src && src->cache_entry.flags.alpha)
{
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
s = SP;
}
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return copy_gfx_span_func_cpu(s, m, c, d);
}
@ -167,14 +167,14 @@ op_copy_color_span_get(DATA32 col, RGBA_Image *dst, int pixels)
if ((col >> 24) < 255)
{
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
c = SC;
}
if (col == ((col >> 24) * 0x01010101))
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return copy_gfx_span_func_cpu(s, m, c, d);
}
@ -184,23 +184,23 @@ op_copy_pixel_color_span_get(RGBA_Image *src, DATA32 col, RGBA_Image *dst, int p
{
int s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
if (src && src->cache_entry.flags.alpha)
{
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
s = SP;
}
if ((col >> 24) < 255)
{
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
c = SC;
}
if (col == ((col >> 24) * 0x01010101))
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return copy_gfx_span_func_cpu(s, m, c, d);
}
@ -211,7 +211,7 @@ op_copy_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels)
int s = SP_N, m = SM_AS, c = SC_AN, d = DP;
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
if ((col >> 24) < 255)
c = SC;
if (col == ((col >> 24) * 0x01010101))
@ -227,8 +227,8 @@ op_copy_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
int s = SP_AN, m = SM_AS, c = SC_N, d = DP;
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
dst->cache_entry.flags.alpha = 1;
if (src && src->cache_entry.flags.alpha)
s = SP;
return copy_gfx_span_func_cpu(s, m, c, d);
}
@ -255,16 +255,16 @@ copy_gfx_pt_func_cpu(int s, int m, int c, int d)
}
static RGBA_Gfx_Pt_Func
op_copy_pixel_pt_get(int src_flags, RGBA_Image *dst)
op_copy_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
{
int s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
if (src_flags.alpha)
{
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
s = SP;
}
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return copy_gfx_pt_func_cpu(s, m, c, d);
}
@ -277,40 +277,40 @@ op_copy_color_pt_get(DATA32 col, RGBA_Image *dst)
if ((col >> 24) < 255)
{
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
c = SC;
}
if (col == ((col >> 24) * 0x01010101))
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return copy_gfx_pt_func_cpu(s, m, c, d);
}
static RGBA_Gfx_Pt_Func
op_copy_pixel_color_pt_get(int src_flags, DATA32 col, RGBA_Image *dst)
op_copy_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst)
{
int s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
if (src_flags.alpha)
{
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
s = SP;
}
if ((col >> 24) < 255)
{
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
c = SC;
}
if (col == ((col >> 24) * 0x01010101))
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return copy_gfx_pt_func_cpu(s, m, c, d);
}
@ -321,7 +321,7 @@ op_copy_mask_color_pt_get(DATA32 col, RGBA_Image *dst)
int s = SP_N, m = SM_AS, c = SC_AN, d = DP;
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
if ((col >> 24) < 255)
c = SC;
if (col == ((col >> 24) * 0x01010101))
@ -332,13 +332,13 @@ op_copy_mask_color_pt_get(DATA32 col, RGBA_Image *dst)
}
static RGBA_Gfx_Pt_Func
op_copy_pixel_mask_pt_get(int src_flags, RGBA_Image *dst)
op_copy_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
{
int s = SP_AN, m = SM_AS, c = SC_N, d = DP;
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
dst->cache_entry.flags.alpha = 1;
if (src_flags.alpha)
s = SP;
return copy_gfx_pt_func_cpu(s, m, c, d);
}
@ -408,13 +408,13 @@ op_copy_rel_pixel_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
{
int s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
if (src && src->cache_entry.flags.alpha)
{
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
s = SP;
}
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return copy_rel_gfx_span_func_cpu(s, m, c, d);
}
@ -427,14 +427,14 @@ op_copy_rel_color_span_get(DATA32 col, RGBA_Image *dst, int pixels)
if ((col >> 24) < 255)
{
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
c = SC;
}
if (col == ((col >> 24) * 0x01010101))
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return copy_rel_gfx_span_func_cpu(s, m, c, d);
}
@ -444,23 +444,23 @@ op_copy_rel_pixel_color_span_get(RGBA_Image *src, DATA32 col, RGBA_Image *dst, i
{
int s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
if (src && src->cache_entry.flags.alpha)
{
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
s = SP;
}
if ((col >> 24) < 255)
{
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
c = SC;
}
if (col == ((col >> 24) * 0x01010101))
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return copy_rel_gfx_span_func_cpu(s, m, c, d);
}
@ -471,7 +471,7 @@ op_copy_rel_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels)
int s = SP_N, m = SM_AS, c = SC_AN, d = DP;
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
if ((col >> 24) < 255)
c = SC;
if (col == ((col >> 24) * 0x01010101))
@ -487,8 +487,8 @@ op_copy_rel_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
int s = SP_AN, m = SM_AS, c = SC_N, d = DP;
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
dst->cache_entry.flags.alpha = 1;
if (src && src->cache_entry.flags.alpha)
s = SP;
return copy_rel_gfx_span_func_cpu(s, m, c, d);
}
@ -515,17 +515,17 @@ copy_rel_gfx_pt_func_cpu(int s, int m, int c, int d)
}
static RGBA_Gfx_Pt_Func
op_copy_rel_pixel_pt_get(int src_flags, RGBA_Image *dst)
op_copy_rel_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
{
int s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
if (src_flags.alpha)
{
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
s = SP;
}
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return copy_rel_gfx_pt_func_cpu(s, m, c, d);
}
@ -538,40 +538,40 @@ op_copy_rel_color_pt_get(DATA32 col, RGBA_Image *dst)
if ((col >> 24) < 255)
{
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
c = SC;
}
if (col == ((col >> 24) * 0x01010101))
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return copy_rel_gfx_pt_func_cpu(s, m, c, d);
}
static RGBA_Gfx_Pt_Func
op_copy_rel_pixel_color_pt_get(int src_flags, DATA32 col, RGBA_Image *dst)
op_copy_rel_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst)
{
int s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
if (src_flags.alpha)
{
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
s = SP;
}
if ((col >> 24) < 255)
{
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
c = SC;
}
if (col == ((col >> 24) * 0x01010101))
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return copy_rel_gfx_pt_func_cpu(s, m, c, d);
}
@ -582,7 +582,7 @@ op_copy_rel_mask_color_pt_get(DATA32 col, RGBA_Image *dst)
int s = SP_N, m = SM_AS, c = SC_AN, d = DP;
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
if ((col >> 24) < 255)
c = SC;
if (col == ((col >> 24) * 0x01010101))
@ -593,13 +593,13 @@ op_copy_rel_mask_color_pt_get(DATA32 col, RGBA_Image *dst)
}
static RGBA_Gfx_Pt_Func
op_copy_rel_pixel_mask_pt_get(int src_flags, RGBA_Image *dst)
op_copy_rel_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
{
int s = SP_AN, m = SM_AS, c = SC_N, d = DP;
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
dst->cache_entry.flags.alpha = 1;
if (src_flags.alpha)
s = SP;
return copy_rel_gfx_pt_func_cpu(s, m, c, d);
}

View File

@ -12,11 +12,11 @@ static RGBA_Gfx_Func op_mask_pixel_color_span_get(RGBA_Image *src, DATA32 col, R
static RGBA_Gfx_Func op_mask_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels);
static RGBA_Gfx_Func op_mask_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels);
static RGBA_Gfx_Pt_Func op_mask_pixel_pt_get(int src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_mask_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_mask_color_pt_get(DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_mask_pixel_color_pt_get(int src_flags, DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_mask_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_mask_mask_color_pt_get(DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_mask_pixel_mask_pt_get(int src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_mask_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
static RGBA_Gfx_Compositor _composite_mask = { "mask",
op_mask_init, op_mask_shutdown,
@ -114,12 +114,12 @@ op_mask_pixel_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
{
int s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
if (src && src->cache_entry.flags.alpha)
{
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
s = SP;
}
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return mask_gfx_span_func_cpu(s, m, c, d);
}
@ -132,14 +132,14 @@ op_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels)
if ((col >> 24) < 255)
{
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
c = SC;
}
if (col == (col | 0x00ffffff))
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return mask_gfx_span_func_cpu(s, m, c, d);
}
@ -149,23 +149,23 @@ op_mask_pixel_color_span_get(RGBA_Image *src, DATA32 col, RGBA_Image *dst, int p
{
int s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
if (src && src->cache_entry.flags.alpha)
{
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
s = SP;
}
if ((col >> 24) < 255)
{
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
c = SC;
}
if (col == (col | 0x00ffffff))
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return mask_gfx_span_func_cpu(s, m, c, d);
}
@ -176,7 +176,7 @@ op_mask_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels)
int s = SP_N, m = SM_AS, c = SC_AN, d = DP;
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
if ((col >> 24) < 255)
c = SC;
if (col == (col | 0x00ffffff))
@ -192,8 +192,8 @@ op_mask_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
int s = SP_AN, m = SM_AS, c = SC_N, d = DP;
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
dst->cache_entry.flags.alpha = 1;
if (src && src->cache_entry.flags.alpha)
s = SP;
return mask_gfx_span_func_cpu(s, m, c, d);
}
@ -220,16 +220,16 @@ mask_gfx_pt_func_cpu(int s, int m, int c, int d)
}
static RGBA_Gfx_Pt_Func
op_mask_pixel_pt_get(int src_flags, RGBA_Image *dst)
op_mask_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
{
int s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
if (src_flags.alpha)
{
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
s = SP;
}
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return mask_gfx_pt_func_cpu(s, m, c, d);
}
@ -242,40 +242,40 @@ op_mask_color_pt_get(DATA32 col, RGBA_Image *dst)
if ((col >> 24) < 255)
{
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
c = SC;
}
if (col == (col | 0x00ffffff))
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return mask_gfx_pt_func_cpu(s, m, c, d);
}
static RGBA_Gfx_Pt_Func
op_mask_pixel_color_pt_get(int src_flags, DATA32 col, RGBA_Image *dst)
op_mask_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst)
{
int s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
if (src_flags.alpha)
{
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
s = SP;
}
if ((col >> 24) < 255)
{
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
c = SC;
}
if (col == (col | 0x00ffffff))
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return mask_gfx_pt_func_cpu(s, m, c, d);
}
@ -286,7 +286,7 @@ op_mask_mask_color_pt_get(DATA32 col, RGBA_Image *dst)
int s = SP_N, m = SM_AS, c = SC_AN, d = DP;
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
if ((col >> 24) < 255)
c = SC;
if (col == (col | 0x00ffffff))
@ -297,13 +297,13 @@ op_mask_mask_color_pt_get(DATA32 col, RGBA_Image *dst)
}
static RGBA_Gfx_Pt_Func
op_mask_pixel_mask_pt_get(int src_flags, RGBA_Image *dst)
op_mask_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
{
int s = SP_AN, m = SM_AS, c = SC_N, d = DP;
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
dst->cache_entry.flags.alpha = 1;
if (src_flags.alpha)
s = SP;
return mask_gfx_pt_func_cpu(s, m, c, d);
}

View File

@ -12,11 +12,11 @@ static RGBA_Gfx_Func op_mul_pixel_color_span_get(RGBA_Image *src, DATA32 col, RG
static RGBA_Gfx_Func op_mul_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels);
static RGBA_Gfx_Func op_mul_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels);
static RGBA_Gfx_Pt_Func op_mul_pixel_pt_get(int src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_mul_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_mul_color_pt_get(DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_mul_pixel_color_pt_get(int src_flags, DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_mul_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_mul_mask_color_pt_get(DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_mul_pixel_mask_pt_get(int src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_mul_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
static RGBA_Gfx_Compositor _composite_mul = { "mul",
op_mul_init, op_mul_shutdown,
@ -113,12 +113,12 @@ op_mul_pixel_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
{
int s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
if (src && src->cache_entry.flags.alpha)
{
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
s = SP;
}
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return mul_gfx_span_func_cpu(s, m, c, d);
}
@ -131,14 +131,14 @@ op_mul_color_span_get(DATA32 col, RGBA_Image *dst, int pixels)
if ((col >> 24) < 255)
{
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
c = SC;
}
if (col == (col | 0x00ffffff))
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return mul_gfx_span_func_cpu(s, m, c, d);
}
@ -148,23 +148,23 @@ op_mul_pixel_color_span_get(RGBA_Image *src, DATA32 col, RGBA_Image *dst, int pi
{
int s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
if (src && src->cache_entry.flags.alpha)
{
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
s = SP;
}
if ((col >> 24) < 255)
{
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
c = SC;
}
if (col == (col | 0x00ffffff))
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return mul_gfx_span_func_cpu(s, m, c, d);
}
@ -175,7 +175,7 @@ op_mul_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels)
int s = SP_N, m = SM_AS, c = SC_AN, d = DP;
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
if ((col >> 24) < 255)
c = SC;
if (col == (col | 0x00ffffff))
@ -191,8 +191,8 @@ op_mul_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
int s = SP_AN, m = SM_AS, c = SC_N, d = DP;
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
dst->cache_entry.flags.alpha = 1;
if (src && src->cache_entry.flags.alpha)
s = SP;
return mul_gfx_span_func_cpu(s, m, c, d);
}
@ -219,16 +219,16 @@ mul_gfx_pt_func_cpu(int s, int m, int c, int d)
}
static RGBA_Gfx_Pt_Func
op_mul_pixel_pt_get(int src_flags, RGBA_Image *dst)
op_mul_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
{
int s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
if (src_flags.alpha)
{
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
s = SP;
}
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return mul_gfx_pt_func_cpu(s, m, c, d);
}
@ -241,40 +241,40 @@ op_mul_color_pt_get(DATA32 col, RGBA_Image *dst)
if ((col >> 24) < 255)
{
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
c = SC;
}
if (col == (col | 0x00ffffff))
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return mul_gfx_pt_func_cpu(s, m, c, d);
}
static RGBA_Gfx_Pt_Func
op_mul_pixel_color_pt_get(int src_flags, DATA32 col, RGBA_Image *dst)
op_mul_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst)
{
int s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
if (src_flags.alpha)
{
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
s = SP;
}
if ((col >> 24) < 255)
{
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
c = SC;
}
if (col == (col | 0x00ffffff))
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return mul_gfx_pt_func_cpu(s, m, c, d);
}
@ -285,7 +285,7 @@ op_mul_mask_color_pt_get(DATA32 col, RGBA_Image *dst)
int s = SP_N, m = SM_AS, c = SC_AN, d = DP;
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
dst->cache_entry.flags.alpha = 1;
if ((col >> 24) < 255)
c = SC;
if (col == (col | 0x00ffffff))
@ -296,13 +296,13 @@ op_mul_mask_color_pt_get(DATA32 col, RGBA_Image *dst)
}
static RGBA_Gfx_Pt_Func
op_mul_pixel_mask_pt_get(int src_flags, RGBA_Image *dst)
op_mul_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
{
int s = SP_AN, m = SM_AS, c = SC_N, d = DP;
if (dst)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
dst->cache_entry.flags.alpha = 1;
if (src_flags.alpha)
s = SP;
return mul_gfx_pt_func_cpu(s, m, c, d);
}

View File

@ -12,11 +12,11 @@ static RGBA_Gfx_Func op_sub_pixel_color_span_get(RGBA_Image *src, DATA32 col, RG
static RGBA_Gfx_Func op_sub_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels);
static RGBA_Gfx_Func op_sub_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels);
static RGBA_Gfx_Pt_Func op_sub_pixel_pt_get(int src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_sub_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_sub_color_pt_get(DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_sub_pixel_color_pt_get(int src_flags, DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_sub_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_sub_mask_color_pt_get(DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_sub_pixel_mask_pt_get(int src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_sub_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
static RGBA_Gfx_Compositor _composite_sub = { "sub",
op_sub_init, op_sub_shutdown,
@ -46,11 +46,11 @@ static RGBA_Gfx_Func op_sub_rel_pixel_color_span_get(RGBA_Image *src, DATA32 col
static RGBA_Gfx_Func op_sub_rel_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels);
static RGBA_Gfx_Func op_sub_rel_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels);
static RGBA_Gfx_Pt_Func op_sub_rel_pixel_pt_get(int src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_sub_rel_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_sub_rel_color_pt_get(DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_sub_rel_pixel_color_pt_get(int src_flags, DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_sub_rel_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_sub_rel_mask_color_pt_get(DATA32 col, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_sub_rel_pixel_mask_pt_get(int src_flags, RGBA_Image *dst);
static RGBA_Gfx_Pt_Func op_sub_rel_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
static RGBA_Gfx_Compositor _composite_sub_rel = { "sub_rel",
op_sub_rel_init, op_sub_rel_shutdown,
@ -147,9 +147,9 @@ op_sub_pixel_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
{
int s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
if (src && src->cache_entry.flags.alpha)
s = SP;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return sub_gfx_span_func_cpu(s, m, c, d);
}
@ -165,7 +165,7 @@ op_sub_color_span_get(DATA32 col, RGBA_Image *dst, int pixels)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return sub_gfx_span_func_cpu(s, m, c, d);
}
@ -175,7 +175,7 @@ op_sub_pixel_color_span_get(RGBA_Image *src, DATA32 col, RGBA_Image *dst, int pi
{
int s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
if (src && src->cache_entry.flags.alpha)
s = SP;
if ((col >> 24) < 255)
c = SC;
@ -183,7 +183,7 @@ op_sub_pixel_color_span_get(RGBA_Image *src, DATA32 col, RGBA_Image *dst, int pi
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return sub_gfx_span_func_cpu(s, m, c, d);
}
@ -199,7 +199,7 @@ op_sub_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return sub_gfx_span_func_cpu(s, m, c, d);
}
@ -209,9 +209,9 @@ op_sub_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
{
int s = SP_AN, m = SM_AS, c = SC_N, d = DP_AN;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
if (src && src->cache_entry.flags.alpha)
s = SP;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return sub_gfx_span_func_cpu(s, m, c, d);
}
@ -238,13 +238,13 @@ sub_gfx_pt_func_cpu(int s, int m, int c, int d)
}
static RGBA_Gfx_Pt_Func
op_sub_pixel_pt_get(int src_flags, RGBA_Image *dst)
op_sub_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
{
int s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
if (src_flags.alpha)
s = SP;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return sub_gfx_pt_func_cpu(s, m, c, d);
}
@ -260,17 +260,17 @@ op_sub_color_pt_get(DATA32 col, RGBA_Image *dst)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return sub_gfx_pt_func_cpu(s, m, c, d);
}
static RGBA_Gfx_Pt_Func
op_sub_pixel_color_pt_get(int src_flags, DATA32 col, RGBA_Image *dst)
op_sub_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst)
{
int s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
if (src_flags.alpha)
s = SP;
if ((col >> 24) < 255)
c = SC;
@ -278,7 +278,7 @@ op_sub_pixel_color_pt_get(int src_flags, DATA32 col, RGBA_Image *dst)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return sub_gfx_pt_func_cpu(s, m, c, d);
}
@ -294,19 +294,19 @@ op_sub_mask_color_pt_get(DATA32 col, RGBA_Image *dst)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return sub_gfx_pt_func_cpu(s, m, c, d);
}
static RGBA_Gfx_Pt_Func
op_sub_pixel_mask_pt_get(int src_flags, RGBA_Image *dst)
op_sub_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
{
int s = SP_AN, m = SM_AS, c = SC_N, d = DP_AN;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
if (src_flags.alpha)
s = SP;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return sub_gfx_pt_func_cpu(s, m, c, d);
}
@ -377,9 +377,9 @@ op_sub_rel_pixel_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
{
int s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
if (src && src->cache_entry.flags.alpha)
s = SP;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return sub_rel_gfx_span_func_cpu(s, m, c, d);
}
@ -395,7 +395,7 @@ op_sub_rel_color_span_get(DATA32 col, RGBA_Image *dst, int pixels)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return sub_rel_gfx_span_func_cpu(s, m, c, d);
}
@ -405,7 +405,7 @@ op_sub_rel_pixel_color_span_get(RGBA_Image *src, DATA32 col, RGBA_Image *dst, in
{
int s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
if (src && src->cache_entry.flags.alpha)
s = SP;
if ((col >> 24) < 255)
c = SC;
@ -413,7 +413,7 @@ op_sub_rel_pixel_color_span_get(RGBA_Image *src, DATA32 col, RGBA_Image *dst, in
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return sub_rel_gfx_span_func_cpu(s, m, c, d);
}
@ -429,7 +429,7 @@ op_sub_rel_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return sub_rel_gfx_span_func_cpu(s, m, c, d);
}
@ -439,9 +439,9 @@ op_sub_rel_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
{
int s = SP_AN, m = SM_AS, c = SC_N, d = DP_AN;
if (src && (src->flags & RGBA_IMAGE_HAS_ALPHA))
if (src && src->cache_entry.flags.alpha)
s = SP;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return sub_rel_gfx_span_func_cpu(s, m, c, d);
}
@ -468,13 +468,13 @@ sub_rel_gfx_pt_func_cpu(int s, int m, int c, int d)
}
static RGBA_Gfx_Pt_Func
op_sub_rel_pixel_pt_get(int src_flags, RGBA_Image *dst)
op_sub_rel_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
{
int s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
if (src_flags.alpha)
s = SP;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return sub_rel_gfx_pt_func_cpu(s, m, c, d);
}
@ -490,17 +490,17 @@ op_sub_rel_color_pt_get(DATA32 col, RGBA_Image *dst)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return sub_rel_gfx_pt_func_cpu(s, m, c, d);
}
static RGBA_Gfx_Pt_Func
op_sub_rel_pixel_color_pt_get(int src_flags, DATA32 col, RGBA_Image *dst)
op_sub_rel_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst)
{
int s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
if (src_flags.alpha)
s = SP;
if ((col >> 24) < 255)
c = SC;
@ -508,7 +508,7 @@ op_sub_rel_pixel_color_pt_get(int src_flags, DATA32 col, RGBA_Image *dst)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return sub_rel_gfx_pt_func_cpu(s, m, c, d);
}
@ -524,19 +524,19 @@ op_sub_rel_mask_color_pt_get(DATA32 col, RGBA_Image *dst)
c = SC_AA;
if (col == 0xffffffff)
c = SC_N;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return sub_rel_gfx_pt_func_cpu(s, m, c, d);
}
static RGBA_Gfx_Pt_Func
op_sub_rel_pixel_mask_pt_get(int src_flags, RGBA_Image *dst)
op_sub_rel_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
{
int s = SP_AN, m = SM_AS, c = SC_N, d = DP_AN;
if (src_flags & RGBA_IMAGE_HAS_ALPHA)
if (src_flags.alpha)
s = SP;
if (dst && (dst->flags & RGBA_IMAGE_HAS_ALPHA))
if (dst && dst->cache_entry.flags.alpha)
d = DP;
return sub_rel_gfx_pt_func_cpu(s, m, c, d);
}

View File

@ -266,8 +266,8 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
/* scale to dst */
dptr = dst_ptr;
#ifdef DIRECT_SCALE
if ((!(src->flags & RGBA_IMAGE_HAS_ALPHA)) &&
(!(dst->flags & RGBA_IMAGE_HAS_ALPHA)) &&
if ((!src->cache_entry.flags.alpha) &&
(!dst->cache_entry.flags.alpha) &&
(!dc->mul.use))
{
for (y = 0; y < dst_clip_h; y++)

View File

@ -20,7 +20,7 @@
yapp = yapoints + dyy;
pbuf = buf;
if (src->flags & RGBA_IMAGE_HAS_ALPHA)
if (src->cache_entry.flags.alpha)
{
while (dst_clip_h--)
{
@ -101,8 +101,8 @@
else
{
#ifdef DIRECT_SCALE
if ((!(src->flags & RGBA_IMAGE_HAS_ALPHA)) &&
(!(dst->flags & RGBA_IMAGE_HAS_ALPHA)) &&
if ((!src->cache_entry.flags.alpha) &&
(!dst->cache_entry.flags.alpha) &&
(!dc->mul.use))
{
while (dst_clip_h--)

View File

@ -25,7 +25,7 @@
/*#ifndef SCALE_USING_MMX */
/* for now there's no mmx down scaling - so C only */
#if 1
if (src->flags & RGBA_IMAGE_HAS_ALPHA)
if (src->cache_entry.flags.alpha)
{
while (dst_clip_h--)
{
@ -150,8 +150,8 @@
else
{
#ifdef DIRECT_SCALE
if ((!(src->flags & RGBA_IMAGE_HAS_ALPHA)) &&
(!(dst->flags & RGBA_IMAGE_HAS_ALPHA)) &&
if ((!src->cache_entry.flags.alpha) &&
(!dst->cache_entry.flags.alpha) &&
(!dc->mul.use))
{
while (dst_clip_h--)

View File

@ -20,7 +20,7 @@
yapp = yapoints + dyy;
pbuf = buf;
if (src->flags & RGBA_IMAGE_HAS_ALPHA)
if (src->cache_entry.flags.alpha)
{
while (dst_clip_h--)
{
@ -102,8 +102,8 @@
else
{
#ifdef DIRECT_SCALE
if ((!(src->flags & RGBA_IMAGE_HAS_ALPHA)) &&
(!(dst->flags & RGBA_IMAGE_HAS_ALPHA)) &&
if ((!src->cache_entry.flags.alpha) &&
(!dst->cache_entry.flags.alpha) &&
(!dc->mul.use))
{
while (dst_clip_h--)

View File

@ -17,13 +17,13 @@
pdst_end = pdst + (dst_clip_h * dst_w);
if (!dc->mul.use)
{
if ((dc->render_op == _EVAS_RENDER_BLEND) && !(src->flags & RGBA_IMAGE_HAS_ALPHA))
if ((dc->render_op == _EVAS_RENDER_BLEND) && !src->cache_entry.flags.alpha)
{ direct_scale = 1; buf_step = dst->cache_entry.w; }
else if (dc->render_op == _EVAS_RENDER_COPY)
{
direct_scale = 1; buf_step = dst->cache_entry.w;
if (src->flags & RGBA_IMAGE_HAS_ALPHA)
dst->flags |= RGBA_IMAGE_HAS_ALPHA;
if (src->cache_entry.flags.alpha)
dst->cache_entry.flags.alpha = 1;
}
}
if (!direct_scale)

View File

@ -8,6 +8,7 @@ static void _evas_common_soft16_image_delete(Image_Entry *ie);
static int _evas_common_soft16_image_surface_alloc(Image_Entry *ie, int w, int h);
static void _evas_common_soft16_image_surface_delete(Image_Entry *ie);
static DATA32 *_evas_common_soft16_image_surface_pixels(Image_Entry *ie);
static int _evas_common_load_soft16_image_from_file(Image_Entry *ie);
static void _evas_common_soft16_image_unload(Image_Entry *ie);
@ -36,6 +37,7 @@ static const Evas_Cache_Image_Func _evas_common_soft16_image_func =
_evas_common_soft16_image_delete,
_evas_common_soft16_image_surface_alloc,
_evas_common_soft16_image_surface_delete,
_evas_common_soft16_image_surface_pixels,
_evas_common_load_soft16_image_from_file,
_evas_common_soft16_image_unload,
_evas_common_soft16_image_dirty_region,
@ -149,6 +151,14 @@ _evas_common_soft16_image_surface_delete(Image_Entry *ie)
im->flags.free_alpha = 0;
}
static DATA32 *
_evas_common_soft16_image_surface_pixels(Image_Entry *ie)
{
abort();
return NULL;
}
static int
_evas_common_load_soft16_image_from_file(Image_Entry *ie)
{
@ -162,7 +172,7 @@ _evas_common_load_soft16_image_from_file(Image_Entry *ie)
sim->cache_entry.w = sim->source->cache_entry.w;
sim->cache_entry.h = sim->source->cache_entry.h;
sim->flags.have_alpha = !!(im->flags & RGBA_IMAGE_HAS_ALPHA);
sim->flags.have_alpha = im->cache_entry.flags.alpha;
if (sim->stride < 0) sim->stride = _calc_stride(sim->cache_entry.w);
return 0;

View File

@ -51,7 +51,7 @@ EAPI Evas_Bool
evas_imaging_image_alpha_get(const Evas_Imaging_Image *im)
{
if (!im) return 0;
if (im->image->flags & RGBA_IMAGE_HAS_ALPHA) return 1;
if (im->image->cache_entry.flags.alpha) return 1;
return 0;
}

View File

@ -135,6 +135,7 @@ typedef struct _Evas_Object_List Evas_Object_List;
typedef struct _Evas_Hash_El Evas_Hash_El;
typedef struct _Image_Entry Image_Entry;
typedef struct _Image_Entry_Flags Image_Entry_Flags;
typedef struct _Engine_Image_Entry Engine_Image_Entry;
typedef struct _RGBA_Image_Loadopts RGBA_Image_Loadopts;
@ -193,14 +194,14 @@ typedef void (*Gfx_Func_Gradient_Fill)(DATA32 *src, int src_len,
typedef enum _RGBA_Image_Flags
{
RGBA_IMAGE_NOTHING = (0),
RGBA_IMAGE_HAS_ALPHA = (1 << 0),
/* RGBA_IMAGE_HAS_ALPHA = (1 << 0), */
RGBA_IMAGE_IS_DIRTY = (1 << 1),
RGBA_IMAGE_INDEXED = (1 << 2),
RGBA_IMAGE_ALPHA_ONLY = (1 << 3),
RGBA_IMAGE_ALPHA_TILES = (1 << 4),
RGBA_IMAGE_ALPHA_SPARSE = (1 << 5),
RGBA_IMAGE_LOADED = (1 << 6),
RGBA_IMAGE_NEED_DATA = (1 << 7)
/* RGBA_IMAGE_ALPHA_SPARSE = (1 << 5), */
/* RGBA_IMAGE_LOADED = (1 << 6), */
/* RGBA_IMAGE_NEED_DATA = (1 << 7) */
} RGBA_Image_Flags;
typedef enum _Convert_Pal_Mode
@ -267,6 +268,18 @@ struct _RGBA_Image_Loadopts
int w, h; // if > 0 use this
};
struct _Image_Entry_Flags
{
Evas_Bool loaded : 1;
Evas_Bool dirty : 1;
Evas_Bool activ : 1;
Evas_Bool need_data : 1;
Evas_Bool lru_nodata : 1;
Evas_Bool cached : 1;
Evas_Bool alpha : 1;
Evas_Bool alpha_sparse : 1;
};
struct _Image_Entry
{
Evas_Object_List _list_data;
@ -281,16 +294,6 @@ struct _Image_Entry
time_t timestamp;
time_t laststat;
struct
{
Evas_Bool loaded : 1;
Evas_Bool dirty : 1;
Evas_Bool activ : 1;
Evas_Bool need_data : 1;
Evas_Bool lru_nodata : 1;
Evas_Bool cached : 1;
} flags;
int references;
unsigned char scale;
@ -305,6 +308,14 @@ struct _Image_Entry
int w;
int h;
} allocated;
struct
{
void *module;
void *loader;
} info;
Image_Entry_Flags flags;
};
struct _Engine_Image_Entry
@ -432,8 +443,8 @@ struct _RGBA_Image
RGBA_Image_Flags flags;
struct
{
void *module;
void *loader;
/* void *module; */
/* void *loader; */
/* char *real_file; */
char *comment;
// int format;
@ -610,11 +621,11 @@ struct _RGBA_Gfx_Compositor
RGBA_Gfx_Func (*composite_mask_color_span_get)(DATA32 col, RGBA_Image *dst, int pixels);
RGBA_Gfx_Func (*composite_pixel_mask_span_get)(RGBA_Image *src, RGBA_Image *dst, int pixels);
RGBA_Gfx_Pt_Func (*composite_pixel_pt_get)(int src_flags, RGBA_Image *dst);
RGBA_Gfx_Pt_Func (*composite_pixel_pt_get)(Image_Entry_Flags src_flags, RGBA_Image *dst);
RGBA_Gfx_Pt_Func (*composite_color_pt_get)(DATA32 col, RGBA_Image *dst);
RGBA_Gfx_Pt_Func (*composite_pixel_color_pt_get)(int src_flags, DATA32 col, RGBA_Image *dst);
RGBA_Gfx_Pt_Func (*composite_pixel_color_pt_get)(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst);
RGBA_Gfx_Pt_Func (*composite_mask_color_pt_get)(DATA32 col, RGBA_Image *dst);
RGBA_Gfx_Pt_Func (*composite_pixel_mask_pt_get)(int src_flags, RGBA_Image *dst);
RGBA_Gfx_Pt_Func (*composite_pixel_mask_pt_get)(Image_Entry_Flags src_flags, RGBA_Image *dst);
};
#define EVAS_RECT_SPLIT 1
@ -745,8 +756,10 @@ struct _Evas_Cache_Image_Func
Image_Entry *(*alloc)(void);
void (*dealloc)(Image_Entry *im);
/* The cache provide some helpers for surface manipulation. */
int (*surface_alloc)(Image_Entry *im, int w, int h);
void (*surface_delete)(Image_Entry *im);
DATA32 *(*surface_pixels)(Image_Entry *im);
/* The cache is doing the allocation and deallocation, you must just do the rest. */
int (*constructor)(Image_Entry *im);
@ -933,11 +946,11 @@ RGBA_Gfx_Func evas_common_gfx_func_composite_pixel_color_span_get (RGBA_Imag
RGBA_Gfx_Func evas_common_gfx_func_composite_mask_color_span_get (DATA32 col, RGBA_Image *dst, int pixels, int op);
RGBA_Gfx_Func evas_common_gfx_func_composite_pixel_mask_span_get (RGBA_Image *src, RGBA_Image *dst, int pixels, int op);
RGBA_Gfx_Pt_Func evas_common_gfx_func_composite_pixel_pt_get (int src_flags, RGBA_Image *dst, int op);
RGBA_Gfx_Pt_Func evas_common_gfx_func_composite_pixel_pt_get (Image_Entry_Flags src_flags, RGBA_Image *dst, int op);
RGBA_Gfx_Pt_Func evas_common_gfx_func_composite_color_pt_get (DATA32 col, RGBA_Image *dst, int op);
RGBA_Gfx_Pt_Func evas_common_gfx_func_composite_pixel_color_pt_get (int src_flags, DATA32 col, RGBA_Image *dst, int op);
RGBA_Gfx_Pt_Func evas_common_gfx_func_composite_pixel_color_pt_get (Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst, int op);
RGBA_Gfx_Pt_Func evas_common_gfx_func_composite_mask_color_pt_get (DATA32 col, RGBA_Image *dst, int op);
RGBA_Gfx_Pt_Func evas_common_gfx_func_composite_pixel_mask_pt_get (int src_flags, RGBA_Image *dst, int op);
RGBA_Gfx_Pt_Func evas_common_gfx_func_composite_pixel_mask_pt_get (Image_Entry_Flags src_flags, RGBA_Image *dst, int op);
EAPI Gfx_Func_Copy evas_common_draw_func_copy_get (int pixels, int reverse);
@ -1088,8 +1101,8 @@ int evas_common_rgba_image_colorspace_set (Image_Entry* dst, int
EAPI void evas_common_image_colorspace_normalize (RGBA_Image *im);
EAPI void evas_common_image_colorspace_dirty (RGBA_Image *im);
EAPI void evas_common_image_cache_free (void); /*2*/
EAPI void evas_common_image_premul (RGBA_Image *im); /*2*/
EAPI void evas_common_image_set_alpha_sparse (RGBA_Image *im); /*2*/
EAPI void evas_common_image_premul (Image_Entry *ie); /*2*/
EAPI void evas_common_image_set_alpha_sparse (Image_Entry *ie); /*2*/
/* EAPI RGBA_Image *evas_common_image_alpha_create (int w, int h); */
/* EAPI RGBA_Image *evas_common_image_create (int w, int h); */
EAPI RGBA_Image *evas_common_image_new (void);
@ -1299,6 +1312,7 @@ EAPI Image_Entry* evas_cache_image_alone(Image_Entry *im);
EAPI Image_Entry* evas_cache_image_dirty(Image_Entry *im, int x, int y, int w, int h);
EAPI void evas_cache_image_load_data(Image_Entry *im);
EAPI void evas_cache_image_surface_alloc(Image_Entry *im, int w, int h);
EAPI DATA32* evas_cache_image_pixels(Image_Entry *im);
EAPI Image_Entry* evas_cache_image_copied_data(Evas_Cache_Image *cache, int w, int h, DATA32 *image_data, int alpha, int cspace);
EAPI Image_Entry* evas_cache_image_data(Evas_Cache_Image *cache, int w, int h, DATA32 *image_data, int alpha, int cspace);
EAPI void evas_cache_image_colorspace(Image_Entry *im, int cspace);

View File

@ -674,8 +674,8 @@ struct _Evas_Func
struct _Evas_Image_Load_Func
{
int (*file_head) (RGBA_Image *im, const char *file, const char *key);
int (*file_data) (RGBA_Image *im, const char *file, const char *key);
int (*file_head) (Image_Entry *ie, const char *file, const char *key);
int (*file_data) (Image_Entry *ie, const char *file, const char *key);
};
struct _Evas_Image_Save_Func

View File

@ -81,7 +81,7 @@ evas_buffer_outbuf_buf_new_region_for_update(Outbuf *buf, int x, int y, int w, i
if (buf->priv.back_buf)
{
*cx = x; *cy = y; *cw = w; *ch = h;
if (buf->priv.back_buf->flags & RGBA_IMAGE_HAS_ALPHA)
if (buf->priv.back_buf->cache_entry.flags.alpha)
{
int ww = w;
ptr = buf->priv.back_buf->image.data + (y * buf->priv.back_buf->cache_entry.w) + x;
@ -104,7 +104,7 @@ evas_buffer_outbuf_buf_new_region_for_update(Outbuf *buf, int x, int y, int w, i
if (((buf->depth == OUTBUF_DEPTH_ARGB_32BPP_8888_8888)) ||
((buf->depth == OUTBUF_DEPTH_BGRA_32BPP_8888_8888)))
{
im->flags |= RGBA_IMAGE_HAS_ALPHA;
im->cache_entry.flags.alpha = 1;
im = (RGBA_Image *) evas_cache_image_size_set(&im->cache_entry, w, h);
if (im)
{

View File

@ -1065,7 +1065,7 @@ eng_image_alpha_get(void *data, void *image)
if (!image) return 0;
im = image;
if (im->im->flags & RGBA_IMAGE_HAS_ALPHA) return 1;
if (im->im->cache_entry.flags.alpha) return 1;
return 0;
}

View File

@ -217,7 +217,7 @@ evas_fb_outbuf_fb_new_region_for_update(Outbuf *buf, int x, int y, int w, int h,
*cx = 0; *cy = 0; *cw = w; *ch = h;
im = (RGBA_Image *) evas_cache_image_empty(evas_common_image_cache_get());
im->flags |= RGBA_IMAGE_HAS_ALPHA;
im->cache_entry.flags.alpha = 1;
im = (RGBA_Image *) evas_cache_image_size_set(&im->cache_entry, w, h);
/* handle framebuffers with alpha channel */

View File

@ -148,10 +148,7 @@ evas_gl_common_image_new(Evas_GL_Context *gc, int w, int h, int alpha, int cspac
}
im->gc = gc;
im->cs.space = cspace;
if (alpha)
im->im->flags |= RGBA_IMAGE_HAS_ALPHA;
else
im->im->flags &= ~RGBA_IMAGE_HAS_ALPHA;
im->im->cache_entry.flags.alpha = alpha ? 1 : 0;
evas_cache_image_colorspace(&im->im->cache_entry, cspace);
im->im = (RGBA_Image *) evas_cache_image_size_set(&im->im->cache_entry, w, h);
switch (cspace)
@ -311,7 +308,7 @@ evas_gl_common_image_draw(Evas_GL_Context *gc, Evas_GL_Image *im, int sx, int sy
// evas_gl_common_texture_mipmaps_build(im->tex, im->im, smooth);
evas_gl_common_context_color_set(gc, r, g, b, a);
if ((a < 255) || (im->im->flags & RGBA_IMAGE_HAS_ALPHA))
if ((a < 255) || im->im->cache_entry.flags.alpha)
evas_gl_common_context_blend_set(gc, 1);
else evas_gl_common_context_blend_set(gc, 0);
if (dc->clip.use)

View File

@ -47,7 +47,7 @@ evas_gl_common_texture_new(Evas_GL_Context *gc, RGBA_Image *im, int smooth)
gc->change.texture = 1;
tex->references++;
if (im->flags & RGBA_IMAGE_HAS_ALPHA) texfmt = GL_RGBA8;
if (im->cache_entry.flags.alpha) texfmt = GL_RGBA8;
else texfmt = GL_RGB8;
pixfmt = NATIVE_PIX_FORMAT;
@ -94,7 +94,7 @@ evas_gl_common_texture_new(Evas_GL_Context *gc, RGBA_Image *im, int smooth)
im_w = im->cache_entry.w;
im_h = im->cache_entry.h;
if (im->flags & RGBA_IMAGE_HAS_ALPHA) texfmt = GL_RGBA8;
if (im->cache_entry.flags.alpha) texfmt = GL_RGBA8;
else texfmt = GL_RGB8;
pixfmt = NATIVE_PIX_FORMAT;
@ -187,7 +187,7 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im, int smooth)
tex->gc->change.texture = 1;
tex->references++;
if (im->flags & RGBA_IMAGE_HAS_ALPHA) texfmt = GL_RGBA8;
if (im->cache_entry.flags.alpha) texfmt = GL_RGBA8;
else texfmt = GL_RGB8;
pixfmt = NATIVE_PIX_FORMAT;
@ -249,7 +249,7 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im, int smooth)
im_w = im->cache_entry.w;
im_h = im->cache_entry.h;
if (im->flags & RGBA_IMAGE_HAS_ALPHA) texfmt = GL_RGBA8;
if (im->cache_entry.flags.alpha) texfmt = GL_RGBA8;
else texfmt = GL_RGB8;
pixfmt = NATIVE_PIX_FORMAT;
@ -342,7 +342,7 @@ evas_gl_common_texture_mipmaps_build(Evas_GL_Texture *tex, RGBA_Image *im, int s
if (tex) tex->references++;
}
if (im->flags & RGBA_IMAGE_HAS_ALPHA) texfmt = GL_RGBA8;
if (im->cache_entry.flags.alpha) texfmt = GL_RGBA8;
else texfmt = GL_RGB8;
pixfmt = NATIVE_PIX_FORMAT;
@ -377,7 +377,7 @@ evas_gl_common_texture_mipmaps_build(Evas_GL_Texture *tex, RGBA_Image *im, int s
else
#endif
{
if (im->flags & RGBA_IMAGE_HAS_ALPHA)
if (im->cache_entry.flags.alpha)
evas_common_scale_rgba_mipmap_down_2x2_c(im1->image.data,
im2->image.data,
pw, ph);

View File

@ -468,7 +468,7 @@ eng_image_alpha_get(void *data, void *image)
switch (im->cs.space)
{
case EVAS_COLORSPACE_ARGB8888:
if (im->im->flags & RGBA_IMAGE_HAS_ALPHA) return 1;
if (im->im->cache_entry.flags.alpha) return 1;
default:
break;
}
@ -499,8 +499,8 @@ eng_image_alpha_set(void *data, void *image, int has_alpha)
im = image;
/* FIXME: can move to gl_common */
if (im->cs.space != EVAS_COLORSPACE_ARGB8888) return im;
if ((has_alpha) && (im->im->flags & RGBA_IMAGE_HAS_ALPHA)) return image;
else if ((!has_alpha) && (!(im->im->flags & RGBA_IMAGE_HAS_ALPHA))) return image;
if ((has_alpha) && im->im->cache_entry.flags.alpha) return image;
else if ((!has_alpha) && (!im->im->cache_entry.flags.alpha)) return image;
if (im->references > 1)
{
Evas_GL_Image *im_new;
@ -514,10 +514,7 @@ eng_image_alpha_set(void *data, void *image, int has_alpha)
}
else
evas_gl_common_image_dirty(im);
if (has_alpha)
im->im->flags |= RGBA_IMAGE_HAS_ALPHA;
else
im->im->flags &= ~RGBA_IMAGE_HAS_ALPHA;
im->im->cache_entry.flags.alpha = has_alpha ? 1 : 0;
return image;
}

View File

@ -516,7 +516,7 @@ eng_image_alpha_get(void *data, void *image)
switch (im->cs.space)
{
case EVAS_COLORSPACE_ARGB8888:
if (im->im->flags & RGBA_IMAGE_HAS_ALPHA) return 1;
if (im->im->cache_entry.flags.alpha) return 1;
default:
break;
}
@ -547,8 +547,8 @@ eng_image_alpha_set(void *data, void *image, int has_alpha)
im = image;
/* FIXME: can move to gl_common */
if (im->cs.space != EVAS_COLORSPACE_ARGB8888) return im;
if ((has_alpha) && (im->im->flags & RGBA_IMAGE_HAS_ALPHA)) return image;
else if ((!has_alpha) && (!(im->im->flags & RGBA_IMAGE_HAS_ALPHA))) return image;
if ((has_alpha) && (im->im->cache_entry.flags.alpha)) return image;
else if ((!has_alpha) && (!im->im->cache_entry.flags.alpha)) return image;
if (im->references > 1)
{
Evas_GL_Image *im_new;
@ -562,10 +562,7 @@ eng_image_alpha_set(void *data, void *image, int has_alpha)
}
else
evas_gl_common_image_dirty(im);
if (has_alpha)
im->im->flags |= RGBA_IMAGE_HAS_ALPHA;
else
im->im->flags &= ~RGBA_IMAGE_HAS_ALPHA;
im->im->cache_entry.flags.alpha = has_alpha ? 1 : 0;
return image;
}

View File

@ -339,7 +339,7 @@ eng_image_alpha_get(void *data, void *image)
switch (im->cache_entry.space)
{
case EVAS_COLORSPACE_ARGB8888:
if (im->flags & RGBA_IMAGE_HAS_ALPHA) return 1;
if (im->cache_entry.flags.alpha) return 1;
default:
break;
}
@ -365,16 +365,13 @@ eng_image_alpha_set(void *data, void *image, int has_alpha)
im = image;
if (im->cache_entry.space != EVAS_COLORSPACE_ARGB8888)
{
im->flags &= ~RGBA_IMAGE_HAS_ALPHA;
im->cache_entry.flags.alpha = 0;
return im;
}
im = (RGBA_Image *) evas_cache_image_alone(&im->cache_entry);
evas_common_image_colorspace_dirty(im);
if (has_alpha)
im->flags |= RGBA_IMAGE_HAS_ALPHA;
else
im->flags &= ~RGBA_IMAGE_HAS_ALPHA;
im->cache_entry.flags.alpha = has_alpha ? 1 : 0;
return im;
}

View File

@ -336,7 +336,7 @@ evas_engine_sdl_image_alpha_get(void *data, void *image)
switch (eim->cache_entry.src->space)
{
case EVAS_COLORSPACE_ARGB8888:
if (im->flags & RGBA_IMAGE_HAS_ALPHA) return 1;
if (im->cache_entry.flags.alpha) return 1;
default:
break;
}
@ -516,17 +516,14 @@ evas_engine_sdl_image_alpha_set(void *data, void *image, int has_alpha)
if (eim->cache_entry.src->space != EVAS_COLORSPACE_ARGB8888)
{
im->flags &= ~RGBA_IMAGE_HAS_ALPHA;
im->cache_entry.flags.alpha = 0;
return eim;
}
eim = (SDL_Engine_Image_Entry *) evas_cache_engine_image_dirty(&eim->cache_entry, 0, 0, eim->cache_entry.w, eim->cache_entry.h);
/* FIXME: update SDL_Surface flags */
if (has_alpha)
im->flags |= RGBA_IMAGE_HAS_ALPHA;
else
im->flags &= ~RGBA_IMAGE_HAS_ALPHA;
im->cache_entry.flags.alpha = has_alpha ? 1 : 0;
return eim;
}
@ -1007,7 +1004,7 @@ _sdl_image_update_data(Engine_Image_Entry *dst, void* engine_data)
{
im->image.data = sdl->pixels;
im->image.no_free = 1;
im->flags |= RGBA_IMAGE_HAS_ALPHA;
im->cache_entry.flags.alpha = 0;
dst->src->w = sdl->w;
dst->src->h = sdl->h;
}

View File

@ -125,7 +125,7 @@ evas_software_x11_outbuf_free(Outbuf *buf)
im = buf->priv.pending_writes->data;
buf->priv.pending_writes = evas_list_remove_list(buf->priv.pending_writes, buf->priv.pending_writes);
obr = im->extended_info;
evas_cache_image_drop(im);
evas_cache_image_drop(&im->cache_entry);
if (obr->xob) _unfind_xob(obr->xob, 0);
if (obr->mxob) _unfind_xob(obr->mxob, 0);
free(obr);
@ -407,7 +407,7 @@ evas_software_x11_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w,
else
{
im = (RGBA_Image *) evas_cache_image_empty(evas_common_image_cache_get());
im->flags |= alpha ? RGBA_IMAGE_HAS_ALPHA : 0;
im->cache_entry.flags.alpha |= alpha ? 1 : 0;
evas_cache_image_surface_alloc(&im->cache_entry, buf->w, buf->h);
im->extended_info = obr;
if ((buf->rot == 0) || (buf->rot == 180))
@ -497,7 +497,7 @@ evas_software_x11_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w,
else
{
im = (RGBA_Image *) evas_cache_image_empty(evas_common_image_cache_get());
im->flags |= alpha ? RGBA_IMAGE_HAS_ALPHA : 0;
im->cache_entry.flags.alpha |= alpha ? 1 : 0;
evas_cache_image_surface_alloc(&im->cache_entry, w, h);
im->extended_info = obr;
if ((buf->rot == 0) || (buf->rot == 180))
@ -637,7 +637,7 @@ evas_software_x11_outbuf_flush(Outbuf *buf)
evas_list_remove_list(buf->priv.prev_pending_writes,
buf->priv.prev_pending_writes);
obr = im->extended_info;
evas_cache_image_drop(im);
evas_cache_image_drop(&im->cache_entry);
if (obr->xob) _unfind_xob(obr->xob, 0);
if (obr->mxob) _unfind_xob(obr->mxob, 0);
/*
@ -682,7 +682,7 @@ evas_software_x11_outbuf_flush(Outbuf *buf)
im = evas_list_data(buf->priv.pending_writes);
buf->priv.pending_writes = evas_list_remove_list(buf->priv.pending_writes, buf->priv.pending_writes);
obr = im->extended_info;
evas_cache_image_drop(im);
evas_cache_image_drop(&im->cache_entry);
if (obr->xob) _unfind_xob(obr->xob, 0);
if (obr->mxob) _unfind_xob(obr->mxob, 0);
/*
@ -726,7 +726,7 @@ evas_software_x11_outbuf_idle_flush(Outbuf *buf)
evas_list_remove_list(buf->priv.prev_pending_writes,
buf->priv.prev_pending_writes);
obr = im->extended_info;
evas_cache_image_drop(im);
evas_cache_image_drop(&im->cache_entry);
if (obr->xob) _unfind_xob(obr->xob, 0);
if (obr->mxob) _unfind_xob(obr->mxob, 0);
free(obr);

View File

@ -477,7 +477,7 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf,
}
if ((buf->priv.x.mask) || (buf->priv.destination_alpha))
{
im->flags |= RGBA_IMAGE_HAS_ALPHA;
im->cache_entry.flags.alpha = 1;
/* FIXME: faster memset! */
memset(im->image->data, 0, w * h * sizeof(DATA32));
}
@ -577,7 +577,7 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf,
}
if ((buf->priv.x.mask) || (buf->priv.destination_alpha))
{
im->flags |= RGBA_IMAGE_HAS_ALPHA;
im->cache_entry.flags.alpha = 1;
/* FIXME: faster memset! */
memset(im->image.data, 0, w * h * sizeof(DATA32));
}

View File

@ -112,7 +112,7 @@ _xre_image_load(Ximage_Info *xinf, const char *file, const char *key, Evas_Image
if (lo) im->load_opts = *lo;
if (im->im->info.comment) im->comment = evas_stringshare_add(im->im->info.comment);
// if (im->im->info.format == 1) im->format = evas_stringshare_add("png");
if (im->im->flags & RGBA_IMAGE_HAS_ALPHA) im->alpha = 1;
if (im->im->cache_entry.flags.alpha) im->alpha = 1;
_xr_image_hash = evas_hash_direct_add(_xr_image_hash, im->fkey, im);
return im;
}

View File

@ -111,7 +111,7 @@ _xre_image_load(Xcb_Image_Info *xcbinf, const char *file, const char *key, Evas_
if (lo) im->load_opts = *lo;
if (im->im->info.comment) im->comment = (char *)evas_stringshare_add(im->im->info.comment);
/* if (im->im->info.format == 1) im->format = evas_stringshare_add("png"); */
if (im->im->flags & RGBA_IMAGE_HAS_ALPHA) im->alpha = 1;
if (im->im->cache_entry.flags.alpha) im->alpha = 1;
_xr_image_hash = evas_hash_direct_add(_xr_image_hash, im->fkey, im);
return im;
}

View File

@ -8,8 +8,8 @@
#define SWAP32(x) (x) = ((((x) & 0x000000ff ) << 24) | (((x) & 0x0000ff00 ) << 8) | (((x) & 0x00ff0000 ) >> 8) | (((x) & 0xff000000 ) >> 24))
int evas_image_load_file_head_edb(RGBA_Image *im, const char *file, const char *key);
int evas_image_load_file_data_edb(RGBA_Image *im, const char *file, const char *key);
int evas_image_load_file_head_edb(Image_Entry *ie, const char *file, const char *key);
int evas_image_load_file_data_edb(Image_Entry *ie, const char *file, const char *key);
Evas_Image_Load_Func evas_image_load_edb_func =
{
@ -19,7 +19,7 @@ Evas_Image_Load_Func evas_image_load_edb_func =
int
evas_image_load_file_head_edb(RGBA_Image *im, const char *file, const char *key)
evas_image_load_file_head_edb(Image_Entry *ie, const char *file, const char *key)
{
int w, h, alpha, compression, size;
E_DB_File *db;
@ -72,21 +72,22 @@ evas_image_load_file_head_edb(RGBA_Image *im, const char *file, const char *key)
e_db_close(db);
return 0;
}
if (alpha) im->flags |= RGBA_IMAGE_HAS_ALPHA;
im->cache_entry.w = w;
im->cache_entry.h = h;
if (alpha) ie->flags.alpha = 1;
ie->w = w;
ie->h = h;
free(ret);
e_db_close(db);
return 1;
}
int
evas_image_load_file_data_edb(RGBA_Image *im, const char *file, const char *key)
evas_image_load_file_data_edb(Image_Entry *ie, const char *file, const char *key)
{
int w, h, alpha, compression, size;
E_DB_File *db;
DATA32 *ret;
DATA32 *body;
DATA32 *surface;
DATA32 header[8];
if ((!file) || (!key)) return 0;
@ -136,10 +137,11 @@ evas_image_load_file_data_edb(RGBA_Image *im, const char *file, const char *key)
e_db_close(db);
return 0;
}
if (alpha) im->flags |= RGBA_IMAGE_HAS_ALPHA;
if (alpha) ie->flags.alpha = 1;
body = &(ret[8]);
evas_cache_image_surface_alloc(&im->cache_entry, w, h);
if (!im->image.data)
evas_cache_image_surface_alloc(ie, w, h);
surface = evas_cache_image_pixels(ie);
if (!surface)
{
free(ret);
e_db_close(db);
@ -151,11 +153,11 @@ evas_image_load_file_data_edb(RGBA_Image *im, const char *file, const char *key)
{
int x;
memcpy(im->image.data, body, w * h * sizeof(DATA32));
for (x = 0; x < (w * h); x++) SWAP32(im->image.data[x]);
memcpy(surface, body, w * h * sizeof(DATA32));
for (x = 0; x < (w * h); x++) SWAP32(surface[x]);
}
#else
memcpy(im->image.data, body, w * h * sizeof(DATA32));
memcpy(surface, body, w * h * sizeof(DATA32));
#endif
}
else
@ -163,17 +165,17 @@ evas_image_load_file_data_edb(RGBA_Image *im, const char *file, const char *key)
uLongf dlen;
dlen = w * h * sizeof(DATA32);
uncompress((Bytef *)im->image.data, &dlen, (Bytef *)body,
uncompress((Bytef *)surface, &dlen, (Bytef *)body,
(uLongf)(size - 32));
#ifdef WORDS_BIGENDIAN
{
int x;
for (x = 0; x < (w * h); x++) SWAP32(im->image.data[x]);
for (x = 0; x < (w * h); x++) SWAP32(surface[x]);
}
#endif
}
evas_common_image_premul(im);
evas_common_image_premul(ie);
free(ret);
e_db_close(db);
return 1;

View File

@ -8,8 +8,8 @@
#include "evas_private.h"
int evas_image_load_file_head_eet(RGBA_Image *im, const char *file, const char *key);
int evas_image_load_file_data_eet(RGBA_Image *im, const char *file, const char *key);
int evas_image_load_file_head_eet(Image_Entry *ie, const char *file, const char *key);
int evas_image_load_file_data_eet(Image_Entry *ie, const char *file, const char *key);
Evas_Image_Load_Func evas_image_load_eet_func =
{
@ -19,73 +19,63 @@ Evas_Image_Load_Func evas_image_load_eet_func =
int
evas_image_load_file_head_eet(RGBA_Image *im, const char *file, const char *key)
evas_image_load_file_head_eet(Image_Entry *ie, const char *file, const char *key)
{
int alpha, compression, quality, lossy;
unsigned int w, h;
Eet_File *ef;
int ok;
int res = 0;
if ((!file) || (!key)) return 0;
ef = eet_open((char *)file, EET_FILE_MODE_READ);
if (!ef) return 0;
ok = eet_data_image_header_read(ef, (char *)key,
ok = eet_data_image_header_read(ef, key,
&w, &h, &alpha, &compression, &quality, &lossy);
if (!ok)
{
eet_close(ef);
return 0;
}
if ((w < 1) || (h < 1) || (w > 8192) || (h > 8192))
{
eet_close(ef);
return 0;
}
if (alpha) im->flags |= RGBA_IMAGE_HAS_ALPHA;
im->cache_entry.w = w;
im->cache_entry.h = h;
if (!ok) goto on_error;
if (alpha) ie->flags.alpha = 1;
ie->w = w;
ie->h = h;
res = 1;
on_error:
eet_close(ef);
return 1;
return res;
}
int
evas_image_load_file_data_eet(RGBA_Image *im, const char *file, const char *key)
evas_image_load_file_data_eet(Image_Entry *ie, const char *file, const char *key)
{
unsigned int w, h;
int alpha, compression, quality, lossy;
int alpha, compression, quality, lossy, ok;
Eet_File *ef;
DATA32 *body, *p, *end;
DATA32 nas = 0;
int res = 0;
if ((!file) || (!key)) return 0;
if (im->image.data) return 1;
ef = eet_open((char *)file, EET_FILE_MODE_READ);
if (ie->flags.loaded) return 1;
ef = eet_open(file, EET_FILE_MODE_READ);
if (!ef) return 0;
body = eet_data_image_read(ef, (char *)key,
&w, &h, &alpha, &compression, &quality, &lossy);
if (!body)
{
eet_close(ef);
return 0;
}
if ((w < 1) || (h < 1) || (w > 8192) || (h > 8192))
{
free(body);
eet_close(ef);
return 0;
}
if (alpha) im->flags |= RGBA_IMAGE_HAS_ALPHA;
im->cache_entry.w = w;
im->cache_entry.h = h;
im->image.data = body;
im->image.no_free = 0;
ok = eet_data_image_header_read(ef, key,
&w, &h, &alpha, &compression, &quality, &lossy);
if (!ok) goto on_error;
evas_cache_image_surface_alloc(ie, w, h);
ok = eet_data_image_read_to_surface(ef, key, 0, 0,
evas_cache_image_pixels(ie), w, h, w * 4,
&alpha, &compression, &quality, &lossy);
if (!ok) goto on_error;
if (alpha)
{
ie->flags.alpha = 1;
body = evas_cache_image_pixels(ie);
end = body +(w * h);
for (p = body; p < end; p++)
{
DATA32 r, g, b, a;
a = A_VAL(p);
r = R_VAL(p);
g = G_VAL(p);
@ -96,13 +86,16 @@ evas_image_load_file_data_eet(RGBA_Image *im, const char *file, const char *key)
if (b > a) b = a;
*p = ARGB_JOIN(a, r, g, b);
}
if ((ALPHA_SPARSE_INV_FRACTION * nas) >= (im->cache_entry.w * im->cache_entry.h))
im->flags |= RGBA_IMAGE_ALPHA_SPARSE;
if ((ALPHA_SPARSE_INV_FRACTION * nas) >= (ie->w * ie->h))
ie->flags.alpha_sparse = 1;
}
// result is already premultiplied now if u compile with edje
// result is already premultiplied now if u compile with edje
// evas_common_image_premul(im);
res = 1;
on_error:
eet_close(ef);
return 1;
return res;
}
EAPI int

View File

@ -8,8 +8,8 @@
#include <gif_lib.h>
int evas_image_load_file_head_gif(RGBA_Image *im, const char *file, const char *key);
int evas_image_load_file_data_gif(RGBA_Image *im, const char *file, const char *key);
int evas_image_load_file_head_gif(Image_Entry *ie, const char *file, const char *key);
int evas_image_load_file_data_gif(Image_Entry *ie, const char *file, const char *key);
Evas_Image_Load_Func evas_image_load_gif_func =
{
@ -19,7 +19,7 @@ Evas_Image_Load_Func evas_image_load_gif_func =
int
evas_image_load_file_head_gif(RGBA_Image *im, const char *file, const char *key)
evas_image_load_file_head_gif(Image_Entry *ie, const char *file, const char *key)
{
int fd;
GifFileType *gif;
@ -93,16 +93,16 @@ evas_image_load_file_head_gif(RGBA_Image *im, const char *file, const char *key)
}
} while (rec != TERMINATE_RECORD_TYPE);
if (alpha >= 0) im->flags |= RGBA_IMAGE_HAS_ALPHA;
im->cache_entry.w = w;
im->cache_entry.h = h;
if (alpha >= 0) ie->flags.alpha = 1;
ie->w = w;
ie->h = h;
DGifCloseFile(gif);
return 1;
}
int
evas_image_load_file_data_gif(RGBA_Image *im, const char *file, const char *key)
evas_image_load_file_data_gif(Image_Entry *ie, const char *file, const char *key)
{
int intoffset[] = { 0, 4, 2, 1 };
int intjump[] = { 8, 8, 4, 2 };
@ -233,9 +233,9 @@ evas_image_load_file_data_gif(RGBA_Image *im, const char *file, const char *key)
}
} while (rec != TERMINATE_RECORD_TYPE);
if (alpha >= 0) im->flags |= RGBA_IMAGE_HAS_ALPHA;
evas_cache_image_surface_alloc(&im->cache_entry, w, h);
if (!im->image.data)
if (alpha >= 0) ie->flags.alpha = 1;
evas_cache_image_surface_alloc(ie, w, h);
if (!evas_cache_image_pixels(ie))
{
DGifCloseFile(gif);
for (i = 0; i < h; i++)
@ -249,7 +249,7 @@ evas_image_load_file_data_gif(RGBA_Image *im, const char *file, const char *key)
bg = gif->SBackGroundColor;
cmap = (gif->Image.ColorMap ? gif->Image.ColorMap : gif->SColorMap);
ptr = im->image.data;
ptr = evas_cache_image_pixels(ie);
per_inc = 100.0 / (((double)w) * h);
for (i = 0; i < h; i++)
@ -273,7 +273,7 @@ evas_image_load_file_data_gif(RGBA_Image *im, const char *file, const char *key)
per += per_inc;
}
}
evas_common_image_premul(im);
evas_common_image_premul(ie);
DGifCloseFile(gif);
for (i = 0; i < h; i++)
{

View File

@ -17,14 +17,14 @@ static void _JPEGFatalErrorHandler(j_common_ptr cinfo);
static void _JPEGErrorHandler(j_common_ptr cinfo);
static void _JPEGErrorHandler2(j_common_ptr cinfo, int msg_level);
static int evas_image_load_file_head_jpeg_internal(RGBA_Image *im, FILE *f);
static int evas_image_load_file_data_jpeg_internal(RGBA_Image *im, FILE *f);
static int evas_image_load_file_head_jpeg_internal(Image_Entry *ie, FILE *f);
static int evas_image_load_file_data_jpeg_internal(Image_Entry *ie, FILE *f);
#if 0 /* not used at the moment */
static int evas_image_load_file_data_jpeg_alpha_internal(RGBA_Image *im, FILE *f);
static int evas_image_load_file_data_jpeg_alpha_internal(Image_Entry *ie, FILE *f);
#endif
int evas_image_load_file_head_jpeg(RGBA_Image *im, const char *file, const char *key);
int evas_image_load_file_data_jpeg(RGBA_Image *im, const char *file, const char *key);
int evas_image_load_file_head_jpeg(Image_Entry *ie, const char *file, const char *key);
int evas_image_load_file_data_jpeg(Image_Entry *ie, const char *file, const char *key);
Evas_Image_Load_Func evas_image_load_jpeg_func =
{
@ -68,7 +68,7 @@ _JPEGErrorHandler2(j_common_ptr cinfo, int msg_level)
}
static int
evas_image_load_file_head_jpeg_internal(RGBA_Image *im, FILE *f)
evas_image_load_file_head_jpeg_internal(Image_Entry *ie, FILE *f)
{
int w, h, scalew, scaleh;
struct jpeg_decompress_struct cinfo;
@ -101,27 +101,27 @@ evas_image_load_file_head_jpeg_internal(RGBA_Image *im, FILE *f)
jpeg_destroy_decompress(&cinfo);
return 0;
}
if (im->cache_entry.load_opts.scale_down_by > 1)
if (ie->load_opts.scale_down_by > 1)
{
w /= im->cache_entry.load_opts.scale_down_by;
h /= im->cache_entry.load_opts.scale_down_by;
w /= ie->load_opts.scale_down_by;
h /= ie->load_opts.scale_down_by;
}
else if (im->cache_entry.load_opts.dpi > 0.0)
else if (ie->load_opts.dpi > 0.0)
{
w = (w * im->cache_entry.load_opts.dpi) / 90.0;
h = (h * im->cache_entry.load_opts.dpi) / 90.0;
w = (w * ie->load_opts.dpi) / 90.0;
h = (h * ie->load_opts.dpi) / 90.0;
}
else if ((im->cache_entry.load_opts.w > 0) &&
(im->cache_entry.load_opts.h > 0))
else if ((ie->load_opts.w > 0) &&
(ie->load_opts.h > 0))
{
int w2, h2;
w2 = im->cache_entry.load_opts.w;
h2 = (im->cache_entry.load_opts.w * h) / w;
if (h2 > im->cache_entry.load_opts.h)
w2 = ie->load_opts.w;
h2 = (ie->load_opts.w * h) / w;
if (h2 > ie->load_opts.h)
{
h2 = im->cache_entry.load_opts.h;
w2 = (im->cache_entry.load_opts.h * w) / h;
h2 = ie->load_opts.h;
w2 = (ie->load_opts.h * w) / h;
}
w = w2;
h = h2;
@ -134,19 +134,19 @@ evas_image_load_file_head_jpeg_internal(RGBA_Image *im, FILE *f)
scalew = cinfo.output_width / w;
scaleh = cinfo.output_height / h;
im->cache_entry.scale = scalew;
if (scaleh < scalew) im->cache_entry.scale = scaleh;
ie->scale = scalew;
if (scaleh < scalew) ie->scale = scaleh;
if (im->cache_entry.scale > 8) im->cache_entry.scale = 8;
else if (im->cache_entry.scale < 1) im->cache_entry.scale = 1;
if (ie->scale > 8) ie->scale = 8;
else if (ie->scale < 1) ie->scale = 1;
if (im->cache_entry.scale == 3) im->cache_entry.scale = 2;
else if (im->cache_entry.scale == 5) im->cache_entry.scale = 4;
else if (im->cache_entry.scale == 6) im->cache_entry.scale = 4;
else if (im->cache_entry.scale == 7) im->cache_entry.scale = 4;
if (ie->scale == 3) ie->scale = 2;
else if (ie->scale == 5) ie->scale = 4;
else if (ie->scale == 6) ie->scale = 4;
else if (ie->scale == 7) ie->scale = 4;
}
if (im->cache_entry.scale > 1)
if (ie->scale > 1)
{
jpeg_destroy_decompress(&cinfo);
@ -157,13 +157,13 @@ evas_image_load_file_head_jpeg_internal(RGBA_Image *im, FILE *f)
cinfo.do_fancy_upsampling = FALSE;
cinfo.do_block_smoothing = FALSE;
cinfo.scale_num = 1;
cinfo.scale_denom = im->cache_entry.scale;
cinfo.scale_denom = ie->scale;
jpeg_calc_output_dimensions(&(cinfo));
jpeg_start_decompress(&cinfo);
}
im->cache_entry.w = cinfo.output_width;
im->cache_entry.h = cinfo.output_height;
ie->w = cinfo.output_width;
ie->h = cinfo.output_height;
/* end head decoding */
jpeg_destroy_decompress(&cinfo);
@ -171,7 +171,7 @@ evas_image_load_file_head_jpeg_internal(RGBA_Image *im, FILE *f)
}
static int
evas_image_load_file_data_jpeg_internal(RGBA_Image *im, FILE *f)
evas_image_load_file_data_jpeg_internal(Image_Entry *ie, FILE *f)
{
int w, h;
struct jpeg_decompress_struct cinfo;
@ -198,10 +198,10 @@ evas_image_load_file_data_jpeg_internal(RGBA_Image *im, FILE *f)
cinfo.dct_method = JDCT_IFAST;
cinfo.dither_mode = JDITHER_ORDERED;
if (im->cache_entry.scale > 1)
if (ie->scale > 1)
{
cinfo.scale_num = 1;
cinfo.scale_denom = im->cache_entry.scale;
cinfo.scale_denom = ie->scale;
}
/* head decoding */
@ -211,7 +211,7 @@ evas_image_load_file_data_jpeg_internal(RGBA_Image *im, FILE *f)
w = cinfo.output_width;
h = cinfo.output_height;
if ((w != im->cache_entry.w) || (h != im->cache_entry.h))
if ((w != ie->w) || (h != ie->h))
{
jpeg_destroy_decompress(&cinfo);
return 0;
@ -225,13 +225,13 @@ evas_image_load_file_data_jpeg_internal(RGBA_Image *im, FILE *f)
return 0;
}
data = alloca(w * 16 * 3);
evas_cache_image_surface_alloc(&im->cache_entry, w, h);
if (!im->image.data)
evas_cache_image_surface_alloc(ie, w, h);
if (ie->flags.loaded)
{
jpeg_destroy_decompress(&cinfo);
return 0;
}
ptr2 = im->image.data;
ptr2 = evas_cache_image_pixels(ie);
count = 0;
prevy = 0;
if (cinfo.output_components == 3)
@ -286,7 +286,7 @@ evas_image_load_file_data_jpeg_internal(RGBA_Image *im, FILE *f)
#if 0 /* not used at the moment */
static int
evas_image_load_file_data_jpeg_alpha_internal(RGBA_Image *im, FILE *f)
evas_image_load_file_data_jpeg_alpha_internal(Image_Entry *ie, FILE *f)
{
int w, h;
struct jpeg_decompress_struct cinfo;
@ -313,8 +313,8 @@ evas_image_load_file_data_jpeg_alpha_internal(RGBA_Image *im, FILE *f)
jpeg_start_decompress(&cinfo);
/* head decoding */
im->image->w = w = cinfo.output_width;
im->image->h = h = cinfo.output_height;
ie->w = w = cinfo.output_width;
ie->h = h = cinfo.output_height;
/* end head decoding */
/* data decoding */
if (cinfo.rec_outbuf_height > 16)
@ -323,12 +323,12 @@ evas_image_load_file_data_jpeg_alpha_internal(RGBA_Image *im, FILE *f)
return 0;
}
data = alloca(w * 16 * 3);
if (!im->image->data)
if (!ie->flags.loaded)
{
jpeg_destroy_decompress(&cinfo);
return 0;
}
ptr2 = im->image->data;
ptr2 = evas_cache_image_pixels(ie);
count = 0;
prevy = 0;
if (cinfo.output_components == 3)
@ -385,7 +385,7 @@ evas_image_load_file_data_jpeg_alpha_internal(RGBA_Image *im, FILE *f)
#endif
int
evas_image_load_file_head_jpeg(RGBA_Image *im, const char *file, const char *key)
evas_image_load_file_head_jpeg(Image_Entry *ie, const char *file, const char *key)
{
int val;
FILE *f;
@ -393,14 +393,14 @@ evas_image_load_file_head_jpeg(RGBA_Image *im, const char *file, const char *key
if ((!file)) return 0;
f = fopen(file, "rb");
if (!f) return 0;
val = evas_image_load_file_head_jpeg_internal(im, f);
val = evas_image_load_file_head_jpeg_internal(ie, f);
fclose(f);
return val;
key = 0;
}
int
evas_image_load_file_data_jpeg(RGBA_Image *im, const char *file, const char *key)
evas_image_load_file_data_jpeg(Image_Entry *ie, const char *file, const char *key)
{
int val;
FILE *f;
@ -408,7 +408,7 @@ evas_image_load_file_data_jpeg(RGBA_Image *im, const char *file, const char *key
if ((!file)) return 0;
f = fopen(file, "rb");
if (!f) return 0;
val = evas_image_load_file_data_jpeg_internal(im, f);
val = evas_image_load_file_data_jpeg_internal(ie, f);
fclose(f);
return val;
key = 0;

View File

@ -8,9 +8,9 @@
#define FILE_BUFFER_SIZE 1024
#define FILE_BUFFER_UNREAD_SIZE 16
static int evas_image_load_file_head_pmaps(RGBA_Image *im,
static int evas_image_load_file_head_pmaps(Image_Entry *ie,
const char *file, const char *key);
static int evas_image_load_file_data_pmaps(RGBA_Image *im,
static int evas_image_load_file_data_pmaps(Image_Entry *ie,
const char *file, const char *key);
Evas_Image_Load_Func evas_image_load_pmaps_func = {
@ -60,7 +60,7 @@ static size_t pmaps_buffer_raw_update(Pmaps_Buffer *b);
static int pmaps_buffer_comment_skip(Pmaps_Buffer *b);
static int
evas_image_load_file_head_pmaps(RGBA_Image *im, const char *file,
evas_image_load_file_head_pmaps(Image_Entry *ie, const char *file,
const char *key)
{
Pmaps_Buffer b;
@ -80,8 +80,8 @@ evas_image_load_file_head_pmaps(RGBA_Image *im, const char *file,
return 0;
}
im->cache_entry.w = b.w;
im->cache_entry.h = b.h;
ie->w = b.w;
ie->h = b.h;
pmaps_buffer_close(&b);
return 1;
@ -90,7 +90,7 @@ evas_image_load_file_head_pmaps(RGBA_Image *im, const char *file,
}
static int
evas_image_load_file_data_pmaps(RGBA_Image *im, const char *file,
evas_image_load_file_data_pmaps(Image_Entry *ie, const char *file,
const char *key)
{
Pmaps_Buffer b;
@ -114,14 +114,14 @@ evas_image_load_file_data_pmaps(RGBA_Image *im, const char *file,
pixels = b.w * b.h;
evas_cache_image_surface_alloc(&im->cache_entry, b.w, b.h);
if (!im->image.data)
evas_cache_image_surface_alloc(ie, b.w, b.h);
if (!evas_cache_image_pixels(ie))
{
pmaps_buffer_close(&b);
return 0;
}
ptr = im->image.data;
ptr = evas_cache_image_pixels(ie);
if (b.type[1] != '4')
{

View File

@ -12,8 +12,8 @@
#define PNG_BYTES_TO_CHECK 4
int evas_image_load_file_head_png(RGBA_Image *im, const char *file, const char *key);
int evas_image_load_file_data_png(RGBA_Image *im, const char *file, const char *key);
int evas_image_load_file_head_png(Image_Entry *ie, const char *file, const char *key);
int evas_image_load_file_data_png(Image_Entry *ie, const char *file, const char *key);
Evas_Image_Load_Func evas_image_load_png_func =
{
@ -23,7 +23,7 @@ Evas_Image_Load_Func evas_image_load_png_func =
int
evas_image_load_file_head_png(RGBA_Image *im, const char *file, const char *key)
evas_image_load_file_head_png(Image_Entry *ie, const char *file, const char *key)
{
png_uint_32 w32, h32;
FILE *f;
@ -80,12 +80,12 @@ evas_image_load_file_head_png(RGBA_Image *im, const char *file, const char *key)
fclose(f);
return 0;
}
im->cache_entry.w = (int) w32;
im->cache_entry.h = (int) h32;
ie->w = (int) w32;
ie->h = (int) h32;
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) hasa = 1;
if (color_type == PNG_COLOR_TYPE_RGB_ALPHA) hasa = 1;
if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA) hasa = 1;
if (hasa) im->flags |= RGBA_IMAGE_HAS_ALPHA;
if (hasa) ie->flags.alpha = 1;
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) NULL);
fclose(f);
return 1;
@ -93,8 +93,9 @@ evas_image_load_file_head_png(RGBA_Image *im, const char *file, const char *key)
}
int
evas_image_load_file_data_png(RGBA_Image *im, const char *file, const char *key)
evas_image_load_file_data_png(Image_Entry *ie, const char *file, const char *key)
{
unsigned char *surface;
png_uint_32 w32, h32;
int w, h;
FILE *f;
@ -143,14 +144,15 @@ evas_image_load_file_data_png(RGBA_Image *im, const char *file, const char *key)
png_get_IHDR(png_ptr, info_ptr, (png_uint_32 *) (&w32),
(png_uint_32 *) (&h32), &bit_depth, &color_type,
&interlace_type, NULL, NULL);
evas_cache_image_surface_alloc(&im->cache_entry, w32, h32);
if (!im->image.data)
evas_cache_image_surface_alloc(ie, w32, h32);
surface = (unsigned char *) evas_cache_image_pixels(ie);
if (!surface)
{
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) NULL);
fclose(f);
return 0;
}
if ((w32 != im->cache_entry.w) || (h32 != im->cache_entry.h))
if ((w32 != ie->w) || (h32 != ie->h))
{
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) NULL);
fclose(f);
@ -159,7 +161,7 @@ evas_image_load_file_data_png(RGBA_Image *im, const char *file, const char *key)
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) hasa = 1;
if (color_type == PNG_COLOR_TYPE_RGB_ALPHA) hasa = 1;
if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA) hasa = 1;
if (hasa) im->flags |= RGBA_IMAGE_HAS_ALPHA;
if (hasa) ie->flags.alpha = 1;
/* Prep for transformations... ultimately we want ARGB */
/* expand palette -> RGB if necessary */
@ -179,8 +181,8 @@ evas_image_load_file_data_png(RGBA_Image *im, const char *file, const char *key)
/* pack all pixels to byte boundaries */
png_set_packing(png_ptr);
w = im->cache_entry.w;
h = im->cache_entry.h;
w = ie->w;
h = ie->h;
/* we want ARGB */
#ifdef WORDS_BIGENDIAN
png_set_swap_alpha(png_ptr);
@ -192,12 +194,12 @@ evas_image_load_file_data_png(RGBA_Image *im, const char *file, const char *key)
lines = (unsigned char **) alloca(h * sizeof(unsigned char *));
for (i = 0; i < h; i++)
lines[i] = ((unsigned char *)(im->image.data)) + (i * w * sizeof(DATA32));
lines[i] = surface + (i * w * sizeof(DATA32));
png_read_image(png_ptr, lines);
png_read_end(png_ptr, info_ptr);
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) NULL);
fclose(f);
evas_common_image_premul(im);
evas_common_image_premul(ie);
return 1;
key = 0;

View File

@ -4,8 +4,8 @@
#include <librsvg/rsvg.h>
#include <librsvg/rsvg-cairo.h>
int evas_image_load_file_head_svg(RGBA_Image *im, const char *file, const char *key);
int evas_image_load_file_data_svg(RGBA_Image *im, const char *file, const char *key);
int evas_image_load_file_head_svg(Image_Entry *ie, const char *file, const char *key);
int evas_image_load_file_data_svg(Image_Entry *ie, const char *file, const char *key);
Evas_Image_Load_Func evas_image_load_svg_func =
{
@ -36,7 +36,7 @@ svg_loader_unpremul_data(DATA32 *data, unsigned int len)
}
int
evas_image_load_file_head_svg(RGBA_Image *im, const char *file, const char *key)
evas_image_load_file_head_svg(Image_Entry *ie, const char *file, const char *key)
{
char cwd[PATH_MAX], pcwd[PATH_MAX], *p;
@ -93,36 +93,36 @@ evas_image_load_file_head_svg(RGBA_Image *im, const char *file, const char *key)
chdir(pcwd);
return 0;
}
if (im->cache_entry.load_opts.scale_down_by > 1)
if (ie->load_opts.scale_down_by > 1)
{
w /= im->cache_entry.load_opts.scale_down_by;
h /= im->cache_entry.load_opts.scale_down_by;
w /= ie->load_opts.scale_down_by;
h /= ie->load_opts.scale_down_by;
}
else if (im->cache_entry.load_opts.dpi > 0.0)
else if (ie->load_opts.dpi > 0.0)
{
w = (w * im->cache_entry.load_opts.dpi) / 90.0;
h = (h * im->cache_entry.load_opts.dpi) / 90.0;
w = (w * ie->load_opts.dpi) / 90.0;
h = (h * ie->load_opts.dpi) / 90.0;
}
else if ((im->cache_entry.load_opts.w > 0) &&
(im->cache_entry.load_opts.h > 0))
else if ((ie->load_opts.w > 0) &&
(ie->load_opts.h > 0))
{
int w2, h2;
w2 = im->cache_entry.load_opts.w;
h2 = (im->cache_entry.load_opts.w * h) / w;
if (h2 > im->cache_entry.load_opts.h)
w2 = ie->load_opts.w;
h2 = (ie->load_opts.w * h) / w;
if (h2 > ie->load_opts.h)
{
h2 = im->cache_entry.load_opts.h;
w2 = (im->cache_entry.load_opts.h * w) / h;
h2 = ie->load_opts.h;
w2 = (ie->load_opts.h * w) / h;
}
w = w2;
h = h2;
}
if (w < 1) w = 1;
if (h < 1) h = 1;
im->cache_entry.w = w;
im->cache_entry.h = h;
im->flags |= RGBA_IMAGE_HAS_ALPHA;
ie->w = w;
ie->h = h;
ie->flags.alpha = 1;
// rsvg_handle_close(rsvg, NULL);
g_object_unref(rsvg);
// rsvg_handle_free(rsvg);
@ -132,8 +132,9 @@ evas_image_load_file_head_svg(RGBA_Image *im, const char *file, const char *key)
/** FIXME: All evas loaders need to be tightened up **/
int
evas_image_load_file_data_svg(RGBA_Image *im, const char *file, const char *key)
evas_image_load_file_data_svg(Image_Entry *ie, const char *file, const char *key)
{
DATA32 *pixels;
char cwd[PATH_MAX], pcwd[PATH_MAX], *p;
RsvgHandle *rsvg;
RsvgDimensionData dim;
@ -190,36 +191,37 @@ evas_image_load_file_data_svg(RGBA_Image *im, const char *file, const char *key)
chdir(pcwd);
return 0;
}
if (im->cache_entry.load_opts.scale_down_by > 1)
if (ie->load_opts.scale_down_by > 1)
{
w /= im->cache_entry.load_opts.scale_down_by;
h /= im->cache_entry.load_opts.scale_down_by;
w /= ie->load_opts.scale_down_by;
h /= ie->load_opts.scale_down_by;
}
else if (im->cache_entry.load_opts.dpi > 0.0)
else if (ie->load_opts.dpi > 0.0)
{
w = (w * im->cache_entry.load_opts.dpi) / 90.0;
h = (h * im->cache_entry.load_opts.dpi) / 90.0;
w = (w * ie->load_opts.dpi) / 90.0;
h = (h * ie->load_opts.dpi) / 90.0;
}
else if ((im->cache_entry.load_opts.w > 0) &&
(im->cache_entry.load_opts.h > 0))
else if ((ie->load_opts.w > 0) &&
(ie->load_opts.h > 0))
{
int w2, h2;
w2 = im->cache_entry.load_opts.w;
h2 = (im->cache_entry.load_opts.w * h) / w;
if (h2 > im->cache_entry.load_opts.h)
w2 = ie->load_opts.w;
h2 = (ie->load_opts.w * h) / w;
if (h2 > ie->load_opts.h)
{
h2 = im->cache_entry.load_opts.h;
w2 = (im->cache_entry.load_opts.h * w) / h;
h2 = ie->load_opts.h;
w2 = (ie->load_opts.h * w) / h;
}
w = w2;
h = h2;
}
if (w < 1) w = 1;
if (h < 1) h = 1;
im->flags |= RGBA_IMAGE_HAS_ALPHA;
evas_cache_image_surface_alloc(&im->cache_entry, w, h);
if (!im->image.data)
ie->flags.alpha = 1;
evas_cache_image_surface_alloc(ie, w, h);
pixels = evas_cache_image_pixels(ie);
if (!pixels)
{
// rsvg_handle_close(rsvg, NULL);
g_object_unref(rsvg);
@ -228,9 +230,9 @@ evas_image_load_file_data_svg(RGBA_Image *im, const char *file, const char *key)
return 0;
}
memset(im->image.data, 0, w * h * sizeof(DATA32));
memset(pixels, 0, w * h * sizeof(DATA32));
surface = cairo_image_surface_create_for_data((unsigned char *)im->image.data, CAIRO_FORMAT_ARGB32,
surface = cairo_image_surface_create_for_data((unsigned char *)pixels, CAIRO_FORMAT_ARGB32,
w, h, w * sizeof(DATA32));
if (!surface)
{
@ -252,8 +254,8 @@ evas_image_load_file_data_svg(RGBA_Image *im, const char *file, const char *key)
}
cairo_scale(cr,
(double)im->cache_entry.w / dim.em,
(double)im->cache_entry.h / dim.ex);
(double)ie->w / dim.em,
(double)ie->h / dim.ex);
rsvg_handle_render_cairo(rsvg, cr);
cairo_surface_destroy(surface);
/* need to check if this is required... */
@ -262,7 +264,7 @@ evas_image_load_file_data_svg(RGBA_Image *im, const char *file, const char *key)
g_object_unref(rsvg);
// rsvg_handle_free(rsvg);
chdir(pcwd);
evas_common_image_set_alpha_sparse(im);
evas_common_image_set_alpha_sparse(ie);
return 1;
}

View File

@ -5,8 +5,8 @@
#include <tiffio.h>
int evas_image_load_file_head_tiff(RGBA_Image *im, const char *file, const char *key);
int evas_image_load_file_data_tiff(RGBA_Image *im, const char *file, const char *key);
int evas_image_load_file_head_tiff(Image_Entry *ie, const char *file, const char *key);
int evas_image_load_file_data_tiff(Image_Entry *ie, const char *file, const char *key);
Evas_Image_Load_Func evas_image_load_tiff_func =
{
@ -20,7 +20,7 @@ struct TIFFRGBAImage_Extra {
TIFFRGBAImage rgba;
tileContigRoutine put_contig;
tileSeparateRoutine put_separate;
RGBA_Image *image;
Image_Entry *image;
char pper;
uint32 num_pixels;
uint32 py;
@ -69,11 +69,11 @@ raster(TIFFRGBAImage_Extra * img, uint32 * rast,
int image_width, image_height;
uint32 *pixel, pixel_value;
int i, j, dy, rast_offset;
DATA32 *buffer_pixel, *buffer = img->image->image.data;
DATA32 *buffer_pixel, *buffer = evas_cache_image_pixels(img->image);
int alpha_premult;
image_width = img->image->cache_entry.w;
image_height = img->image->cache_entry.h;
image_width = img->image->w;
image_height = img->image->h;
dy = h > y ? -1 : y - h;
@ -110,7 +110,7 @@ raster(TIFFRGBAImage_Extra * img, uint32 * rast,
}
int
evas_image_load_file_head_tiff(RGBA_Image *im, const char *file, const char *key)
evas_image_load_file_head_tiff(Image_Entry *ie, const char *file, const char *key)
{
char txt[1024];
TIFFRGBAImage tiff_image;
@ -164,22 +164,22 @@ evas_image_load_file_head_tiff(RGBA_Image *im, const char *file, const char *key
}
if (tiff_image.alpha != EXTRASAMPLE_UNSPECIFIED)
im->flags |= RGBA_IMAGE_HAS_ALPHA;
ie->flags.alpha = 1;
if ((tiff_image.width < 1) || (tiff_image.height < 1) ||
(tiff_image.width > 8192) || (tiff_image.height > 8192))
{
TIFFClose(tif);
return 0;
}
im->cache_entry.w = tiff_image.width;
im->cache_entry.h = tiff_image.height;
ie->w = tiff_image.width;
ie->h = tiff_image.height;
TIFFClose(tif);
return 1;
}
int
evas_image_load_file_data_tiff(RGBA_Image *im, const char *file, const char *key)
evas_image_load_file_data_tiff(Image_Entry *ie, const char *file, const char *key)
{
char txt[1024];
TIFFRGBAImage_Extra rgba_image;
@ -229,19 +229,19 @@ evas_image_load_file_data_tiff(RGBA_Image *im, const char *file, const char *key
TIFFClose(tif);
return 0;
}
rgba_image.image = im;
rgba_image.image = ie;
if (rgba_image.rgba.alpha != EXTRASAMPLE_UNSPECIFIED)
im->flags |= RGBA_IMAGE_HAS_ALPHA;
if ((rgba_image.rgba.width != im->cache_entry.w) ||
(rgba_image.rgba.height != im->cache_entry.h))
ie->flags.alpha = 1;
if ((rgba_image.rgba.width != ie->w) ||
(rgba_image.rgba.height != ie->h))
{
TIFFClose(tif);
return 0;
}
evas_cache_image_surface_alloc(&im->cache_entry, rgba_image.rgba.width, rgba_image.rgba.height);
if (!im->image.data)
evas_cache_image_surface_alloc(ie, rgba_image.rgba.width, rgba_image.rgba.height);
if (!evas_cache_image_pixels(ie))
{
TIFFRGBAImageEnd((TIFFRGBAImage *) & rgba_image);
TIFFClose(tif);
@ -249,7 +249,7 @@ evas_image_load_file_data_tiff(RGBA_Image *im, const char *file, const char *key
return 0;
}
rgba_image.num_pixels = num_pixels = im->cache_entry.w * im->cache_entry.h;
rgba_image.num_pixels = num_pixels = ie->w * ie->h;
rgba_image.pper = rgba_image.py = 0;
rast = (uint32 *) _TIFFmalloc(sizeof(uint32) * num_pixels);
@ -311,7 +311,7 @@ evas_image_load_file_data_tiff(RGBA_Image *im, const char *file, const char *key
TIFFClose(tif);
evas_common_image_set_alpha_sparse(im);
evas_common_image_set_alpha_sparse(ie);
return 1;
}

View File

@ -1,8 +1,8 @@
#include "evas_common.h"
#include "evas_private.h"
int evas_image_load_file_head_xpm(RGBA_Image *im, const char *file, const char *key);
int evas_image_load_file_data_xpm(RGBA_Image *im, const char *file, const char *key);
int evas_image_load_file_head_xpm(Image_Entry *ie, const char *file, const char *key);
int evas_image_load_file_data_xpm(Image_Entry *ie, const char *file, const char *key);
Evas_Image_Load_Func evas_image_load_xpm_func =
{
@ -96,7 +96,7 @@ xpm_parse_done(void)
/** FIXME: clean this up and make more efficient **/
static int
evas_image_load_file_xpm(RGBA_Image *im, const char *file, const char *key, int load_data)
evas_image_load_file_xpm(Image_Entry *ie, const char *file, const char *key, int load_data)
{
DATA32 *ptr, *end;
FILE *f;
@ -249,8 +249,8 @@ evas_image_load_file_xpm(RGBA_Image *im, const char *file, const char *key, int
return 0;
}
}
im->cache_entry.w = w;
im->cache_entry.h = h;
ie->w = w;
ie->h = h;
j = 0;
context++;
@ -360,12 +360,13 @@ evas_image_load_file_xpm(RGBA_Image *im, const char *file, const char *key, int
context++;
}
if (transp) im->flags |= RGBA_IMAGE_HAS_ALPHA;
if (transp) ie->flags.alpha = 1;
if (load_data)
{
evas_cache_image_surface_alloc(&im->cache_entry, w, h);
if (!im->image.data)
evas_cache_image_surface_alloc(ie, w, h);
ptr = evas_cache_image_pixels(ie);
if (!ptr)
{
free(cmap);
free(line);
@ -373,7 +374,6 @@ evas_image_load_file_xpm(RGBA_Image *im, const char *file, const char *key, int
xpm_parse_done();
return 0;
}
ptr = im->image.data;
end = ptr + (w * h);
pixels = w * h;
}
@ -594,7 +594,7 @@ evas_image_load_file_xpm(RGBA_Image *im, const char *file, const char *key, int
if (!tl) break;
line = tl;
}
if (((ptr) && ((ptr - im->image.data) >= (w * h * sizeof(DATA32)))) ||
if (((ptr) && ((ptr - evas_cache_image_pixels(ie)) >= (w * h * sizeof(DATA32)))) ||
((context > 1) && (count >= pixels)))
break;
}
@ -610,15 +610,15 @@ evas_image_load_file_xpm(RGBA_Image *im, const char *file, const char *key, int
int
evas_image_load_file_head_xpm(RGBA_Image *im, const char *file, const char *key)
evas_image_load_file_head_xpm(Image_Entry *ie, const char *file, const char *key)
{
return evas_image_load_file_xpm(im, file, key, 0);
return evas_image_load_file_xpm(ie, file, key, 0);
}
int
evas_image_load_file_data_xpm(RGBA_Image *im, const char *file, const char *key)
evas_image_load_file_data_xpm(Image_Entry *ie, const char *file, const char *key)
{
return evas_image_load_file_xpm(im, file, key, 1);
return evas_image_load_file_xpm(ie, file, key, 1);
}

View File

@ -28,7 +28,7 @@ evas_image_save_file_eet(RGBA_Image *im, const char *file, const char *key, int
if (!ef) ef = eet_open((char *)file, EET_FILE_MODE_WRITE);
if (!ef) return 0;
if ((quality <= 100) || (compress < 0)) lossy = 1;
if (im->flags & RGBA_IMAGE_HAS_ALPHA) alpha = 1;
if (im->cache_entry.flags.alpha) alpha = 1;
// if (alpha)
// {
// data = malloc(im->image->w * im->image->h * sizeof(DATA32));

View File

@ -62,7 +62,7 @@ save_image_png(RGBA_Image *im, const char *file, int compress, int interlace)
#endif
}
if (im->flags & RGBA_IMAGE_HAS_ALPHA)
if (im->cache_entry.flags.alpha)
{
data = malloc(im->cache_entry.w * im->cache_entry.h * sizeof(DATA32));
if (!data)
@ -110,7 +110,7 @@ save_image_png(RGBA_Image *im, const char *file, int compress, int interlace)
for (y = 0; y < im->cache_entry.h; y++)
{
if (im->flags & RGBA_IMAGE_HAS_ALPHA)
if (im->cache_entry.flags.alpha)
row_ptr = (png_bytep) ptr;
else
{
@ -130,7 +130,7 @@ save_image_png(RGBA_Image *im, const char *file, int compress, int interlace)
png_destroy_write_struct(&png_ptr, (png_infopp) & info_ptr);
png_destroy_info_struct(png_ptr, (png_infopp) & info_ptr);
if (im->flags & RGBA_IMAGE_HAS_ALPHA)
if (im->cache_entry.flags.alpha)
free(data);
fclose(f);
return 1;

View File

@ -25,7 +25,7 @@ save_image_tiff(RGBA_Image *im, const char *file, int compress, int interlace)
if (!im || !im->image.data || !file)
return 0;
has_alpha = im->flags & RGBA_IMAGE_HAS_ALPHA;
has_alpha = im->cache_entry.flags.alpha;
data = im->image.data;
tif = TIFFOpen(file, "w");