diff --git a/legacy/evas/src/modules/engines/software_16/Makefile.am b/legacy/evas/src/modules/engines/software_16/Makefile.am index f20fe31dc9..8dbb486ae5 100644 --- a/legacy/evas/src/modules/engines/software_16/Makefile.am +++ b/legacy/evas/src/modules/engines/software_16/Makefile.am @@ -13,6 +13,8 @@ module_la_SOURCES = \ evas_engine.c \ evas_soft16.h \ evas_soft16_main.c \ +evas_soft16_image_unscaled.c \ +evas_soft16_image_scaled_sampled.c \ evas_soft16_font.c \ evas_soft16_rectangle.c @@ -26,6 +28,8 @@ EXTRA_DIST = \ evas_engine.c \ evas_soft16.h \ evas_soft16_main.c \ +evas_soft16_image_unscaled.c \ +evas_soft16_image_scaled_sampled.c \ evas_soft16_font.c \ evas_soft16_rectangle.c \ evas_soft16_scanline_fill.c \ diff --git a/legacy/evas/src/modules/engines/software_16/evas_soft16.h b/legacy/evas/src/modules/engines/software_16/evas_soft16.h index 03aec26131..1f9e3c808a 100644 --- a/legacy/evas/src/modules/engines/software_16/evas_soft16.h +++ b/legacy/evas/src/modules/engines/software_16/evas_soft16.h @@ -65,11 +65,14 @@ Soft16_Image *soft16_image_load(const char *file, const char *key, int *error, E void soft16_image_load_data(Soft16_Image *im); void soft16_image_draw(Soft16_Image *src, Soft16_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h, int smooth); +void soft16_image_draw_unscaled(Soft16_Image *src, Soft16_Image *dst, RGBA_Draw_Context *dc, const Evas_Rectangle sr, const Evas_Rectangle dr, const Evas_Rectangle cr); +void soft16_image_draw_scaled_sampled(Soft16_Image *src, Soft16_Image *dst, RGBA_Draw_Context *dc, const Evas_Rectangle sr, const Evas_Rectangle dr, const Evas_Rectangle cr); + + /** * Rectangle (evas_soft16_rectangle.c) */ -void soft16_rectangle_draw(Soft16_Image *dst, RGBA_Draw_Context *dc, - int x, int y, int w, int h); +void soft16_rectangle_draw(Soft16_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h); /** @@ -78,4 +81,5 @@ void soft16_rectangle_draw(Soft16_Image *dst, RGBA_Draw_Context *dc, void *soft16_font_glyph_new(void *data, RGBA_Font_Glyph *fg); void soft16_font_glyph_free(void *ext_dat); void soft16_font_glyph_draw(Soft16_Image *dst, void *data, RGBA_Draw_Context *dc, RGBA_Font_Glyph *fg, int x, int y); + #endif diff --git a/legacy/evas/src/modules/engines/software_16/evas_soft16_image_scaled_sampled.c b/legacy/evas/src/modules/engines/software_16/evas_soft16_image_scaled_sampled.c new file mode 100644 index 0000000000..4bae2f8a96 --- /dev/null +++ b/legacy/evas/src/modules/engines/software_16/evas_soft16_image_scaled_sampled.c @@ -0,0 +1,469 @@ +#include "evas_soft16.h" +#include "evas_soft16_scanline_blend.c" + +static void +_soft16_image_draw_scaled_solid_solid(Soft16_Image *src, + Soft16_Image *dst, + RGBA_Draw_Context *dc, + int dst_offset, int w, int h, + int *offset_x, int *offset_y) +{ + DATA16 *dst_itr; + int y, w_align; + + w_align = w & ~7; + + dst_itr = dst->pixels + dst_offset; + for (y = 0; y < h; y++, dst_itr += dst->stride) + { + DATA16 *d, *s; + int x; + + s = src->pixels + offset_y[y]; + pld(s, 0); + pld(offset_x, 0); + + d = dst_itr; + x = 0; + while (x < w_align) + { + pld(s, 32); + pld(offset_x + x, 32); + + UNROLL8({ + _soft16_pt_blend_solid_solid(d, s[offset_x[x]]); + x++; + d++; + }); + } + + for (; x < w; x++, d++) + _soft16_pt_blend_solid_solid(d, s[offset_x[x]]); + } +} +static void +_soft16_image_draw_scaled_transp_solid(Soft16_Image *src, + Soft16_Image *dst, + RGBA_Draw_Context *dc, + int dst_offset, int w, int h, + int *offset_x, int *offset_y) +{ + DATA16 *dst_itr; + int y, w_align; + + w_align = w & ~7; + + dst_itr = dst->pixels + dst_offset; + for (y = 0; y < h; y++, dst_itr += dst->stride) + { + DATA16 *d, *s; + DATA8 *a; + int x; + + s = src->pixels + offset_y[y]; + a = src->alpha + offset_y[y]; + pld(s, 0); + pld(a, 0); + pld(offset_x, 0); + + d = dst_itr; + x = 0; + while (x < w_align) + { + pld(s, 32); + pld(a, 8); + pld(offset_x + x, 32); + + UNROLL8({ + int off_x = offset_x[x]; + _soft16_pt_blend_transp_solid(d, s[off_x], a[off_x]); + x++; + d++; + }); + } + + for (; x < w; x++, d++) + _soft16_pt_blend_transp_solid(d, s[offset_x[x]], a[offset_x[x]]); + } +} + +static inline void +_soft16_image_draw_scaled_no_mul(Soft16_Image *src, Soft16_Image *dst, + RGBA_Draw_Context *dc, + int dst_offset, int w, int h, + int *offset_x, int *offset_y) +{ + if (src->have_alpha && (!dst->have_alpha)) + _soft16_image_draw_scaled_transp_solid + (src, dst, dc, dst_offset, w, h, offset_x, offset_y); + else if ((!src->have_alpha) && (!dst->have_alpha)) + _soft16_image_draw_scaled_solid_solid + (src, dst, dc, dst_offset, w, h, offset_x, offset_y); + else + fprintf(stderr, + "Unsupported draw of scaled images src->have_alpha=%d, " + "dst->have_alpha=%d, WITHOUT COLOR MUL\n", + src->have_alpha, dst->have_alpha); +} + +static void +_soft16_image_draw_scaled_solid_solid_mul_alpha(Soft16_Image *src, + Soft16_Image *dst, + RGBA_Draw_Context *dc, + int dst_offset, int w, int h, + int *offset_x, int *offset_y) +{ + DATA16 *dst_itr; + int y, w_align, rel_alpha; + + rel_alpha = A_VAL(&dc->mul.col) >> 3; + if ((rel_alpha < 1) || (rel_alpha > 31)) return; + rel_alpha = 31 - rel_alpha; + + w_align = w & ~7; + + dst_itr = dst->pixels + dst_offset; + for (y = 0; y < h; y++, dst_itr += dst->stride) + { + DATA16 *d, *s; + int x; + + s = src->pixels + offset_y[y]; + pld(s, 0); + pld(offset_x, 0); + + d = dst_itr; + x = 0; + while (x < w_align) + { + pld(s, 32); + pld(offset_x + x, 32); + + UNROLL8({ + _soft16_pt_blend_solid_solid_mul_alpha + (d, s[offset_x[x]], rel_alpha); + x++; + d++; + }); + } + + for (; x < w; x++, d++) + _soft16_pt_blend_solid_solid_mul_alpha + (d, s[offset_x[x]], rel_alpha); + } +} + +static void +_soft16_image_draw_scaled_transp_solid_mul_alpha(Soft16_Image *src, + Soft16_Image *dst, + RGBA_Draw_Context *dc, + int dst_offset, int w, int h, + int *offset_x, int *offset_y) +{ + DATA16 *dst_itr; + int y, w_align, rel_alpha; + + rel_alpha = A_VAL(&dc->mul.col) >> 3; + if ((rel_alpha < 1) || (rel_alpha > 31)) return; + rel_alpha = 31 - rel_alpha; + + w_align = w & ~7; + + dst_itr = dst->pixels + dst_offset; + for (y = 0; y < h; y++, dst_itr += dst->stride) + { + DATA16 *d, *s; + DATA8 *a; + int x; + + s = src->pixels + offset_y[y]; + a = src->alpha + offset_y[y]; + pld(s, 0); + pld(a, 0); + pld(offset_x, 0); + + d = dst_itr; + x = 0; + while (x < w_align) + { + pld(s, 32); + pld(a, 8); + pld(offset_x + x, 32); + + UNROLL8({ + int off_x = offset_x[x]; + _soft16_pt_blend_transp_solid_mul_alpha + (d, s[off_x], a[off_x], rel_alpha); + x++; + d++; + }); + } + + for (; x < w; x++, d++) + _soft16_pt_blend_transp_solid_mul_alpha + (d, s[offset_x[x]], a[offset_x[x]], rel_alpha); + } +} + +static inline void +_soft16_image_draw_scaled_mul_alpha(Soft16_Image *src, Soft16_Image *dst, + RGBA_Draw_Context *dc, + int dst_offset, int w, int h, + int *offset_x, int *offset_y) +{ + if (src->have_alpha && (!dst->have_alpha)) + _soft16_image_draw_scaled_transp_solid_mul_alpha + (src, dst, dc, dst_offset, w, h, offset_x, offset_y); + else if ((!src->have_alpha) && (!dst->have_alpha)) + _soft16_image_draw_scaled_solid_solid_mul_alpha + (src, dst, dc, dst_offset, w, h, offset_x, offset_y); + else + fprintf(stderr, + "Unsupported draw of scaled images src->have_alpha=%d, " + "dst->have_alpha=%d, WITH ALPHA MUL %d\n", + src->have_alpha, dst->have_alpha, A_VAL(&dc->mul.col)); +} + +static void +_soft16_image_draw_scaled_solid_solid_mul_color(Soft16_Image *src, + Soft16_Image *dst, + RGBA_Draw_Context *dc, + int dst_offset, int w, int h, + int *offset_x, int *offset_y) +{ + DATA16 *dst_itr; + int y, w_align, rel_alpha, r, g, b; + + rel_alpha = A_VAL(&dc->mul.col) >> 3; + if ((rel_alpha < 1) || (rel_alpha > 31)) return; + + r = R_VAL(&dc->mul.col); + g = G_VAL(&dc->mul.col); + b = B_VAL(&dc->mul.col); + /* we'll divide by 256 to make it faster, try to improve things a bit */ + if (r > 127) r++; + if (g > 127) g++; + if (b > 127) b++; + + w_align = w & ~7; + + dst_itr = dst->pixels + dst_offset; + + if (rel_alpha == 31) + for (y = 0; y < h; y++, dst_itr += dst->stride) + { + DATA16 *d, *s; + int x; + + s = src->pixels + offset_y[y]; + pld(s, 0); + pld(offset_x, 0); + + d = dst_itr; + x = 0; + while (x < w_align) + { + pld(s, 32); + pld(offset_x + x, 32); + + UNROLL8({ + _soft16_pt_blend_solid_solid_mul_color_solid + (d, s[offset_x[x]], r, g, b); + x++; + d++; + }); + } + + for (; x < w; x++, d++) + _soft16_pt_blend_solid_solid_mul_color_solid + (d, s[offset_x[x]], r, g, b); + } + else + for (y = 0; y < h; y++, dst_itr += dst->stride) + { + DATA16 *d, *s; + int x; + + s = src->pixels + offset_y[y]; + pld(s, 0); + pld(offset_x, 0); + + d = dst_itr; + x = 0; + while (x < w_align) + { + pld(s, 32); + pld(offset_x + x, 32); + + UNROLL8({ + _soft16_pt_blend_solid_solid_mul_color_transp + (d, s[offset_x[x]], rel_alpha, r, g, b); + x++; + d++; + }); + } + + for (; x < w; x++, d++) + _soft16_pt_blend_solid_solid_mul_color_transp + (d, s[offset_x[x]], rel_alpha, r, g, b); + } +} + +static void +_soft16_image_draw_scaled_transp_solid_mul_color(Soft16_Image *src, + Soft16_Image *dst, + RGBA_Draw_Context *dc, + int dst_offset, int w, int h, + int *offset_x, int *offset_y) +{ + DATA16 *dst_itr; + int y, w_align, rel_alpha, r, g, b; + + rel_alpha = A_VAL(&dc->mul.col) >> 3; + if ((rel_alpha < 1) || (rel_alpha > 31)) return; + rel_alpha = 31 - rel_alpha; + + r = R_VAL(&dc->mul.col); + g = G_VAL(&dc->mul.col); + b = B_VAL(&dc->mul.col); + /* we'll divide by 256 to make it faster, try to improve things a bit */ + if (r > 127) r++; + if (g > 127) g++; + if (b > 127) b++; + + w_align = w & ~7; + + dst_itr = dst->pixels + dst_offset; + + if (rel_alpha == 0) + for (y = 0; y < h; y++, dst_itr += dst->stride) + { + DATA16 *d, *s; + DATA8 *a; + int x; + + s = src->pixels + offset_y[y]; + a = src->alpha + offset_y[y]; + pld(s, 0); + pld(a, 0); + pld(offset_x, 0); + + d = dst_itr; + x = 0; + while (x < w_align) + { + pld(s, 32); + pld(a, 8); + pld(offset_x + x, 32); + + UNROLL8({ + int off_x = offset_x[x]; + _soft16_pt_blend_transp_solid_mul_color_solid + (d, s[off_x], a[off_x], r, g, b); + x++; + d++; + }); + } + + for (; x < w; x++, d++) + _soft16_pt_blend_transp_solid_mul_color_solid + (d, s[offset_x[x]], a[offset_x[x]], r, g, b); + } + else + { + DATA16 *d, *s; + DATA8 *a; + int x; + + s = src->pixels + offset_y[y]; + a = src->alpha + offset_y[y]; + pld(s, 0); + pld(a, 0); + pld(offset_x, 0); + + d = dst_itr; + x = 0; + while (x < w_align) + { + pld(s, 32); + pld(a, 8); + pld(offset_x + x, 32); + + UNROLL8({ + int off_x = offset_x[x]; + _soft16_pt_blend_transp_solid_mul_color_transp + (d, s[off_x], a[off_x], rel_alpha, r, g, b); + x++; + d++; + }); + } + + for (; x < w; x++, d++) + _soft16_pt_blend_transp_solid_mul_color_transp + (d, s[offset_x[x]], a[offset_x[x]], rel_alpha, r, g, b); + } +} + +static inline void +_soft16_image_draw_scaled_mul_color(Soft16_Image *src, Soft16_Image *dst, + RGBA_Draw_Context *dc, + int dst_offset, int w, int h, + int *offset_x, int *offset_y) +{ + if (src->have_alpha && (!dst->have_alpha)) + _soft16_image_draw_scaled_transp_solid_mul_color + (src, dst, dc, dst_offset, w, h, offset_x, offset_y); + else if ((!src->have_alpha) && (!dst->have_alpha)) + _soft16_image_draw_scaled_solid_solid_mul_color + (src, dst, dc, dst_offset, w, h, offset_x, offset_y); + else + fprintf(stderr, + "Unsupported draw of scaled images src->have_alpha=%d, " + "dst->have_alpha=%d, WITH COLOR MUL 0x%08x\n", + src->have_alpha, dst->have_alpha, dc->mul.col); +} + +static inline void +_soft16_image_draw_scaled_mul(Soft16_Image *src, Soft16_Image *dst, + RGBA_Draw_Context *dc, + int dst_offset, int w, int h, + int *offset_x, int *offset_y) +{ + if ((A_VAL(&dc->mul.col) == R_VAL(&dc->mul.col)) && + (A_VAL(&dc->mul.col) == G_VAL(&dc->mul.col)) && + (A_VAL(&dc->mul.col) == B_VAL(&dc->mul.col))) + _soft16_image_draw_scaled_mul_alpha + (src, dst, dc, dst_offset, w, h, offset_x, offset_y); + else + _soft16_image_draw_scaled_mul_color + (src, dst, dc, dst_offset, w, h, offset_x, offset_y); +} + +void +soft16_image_draw_scaled_sampled(Soft16_Image *src, Soft16_Image *dst, + RGBA_Draw_Context *dc, + const Evas_Rectangle sr, + const Evas_Rectangle dr, + const Evas_Rectangle cr) +{ + int x, y, dst_offset, *offset_x, *offset_y; + + /* pre-calculated scale tables */ + offset_x = alloca(cr.w * sizeof(*offset_x)); + for (x = 0; x < cr.w; x++) + offset_x[x] = (((x + cr.x - dr.x) * sr.w) / dr.w) + sr.x; + + offset_y = alloca(cr.h * sizeof(*offset_y)); + for (y = 0; y < cr.h; y++) + offset_y[y] = (((((y + cr.y - dr.y) * sr.h) / dr.h) + sr.y) + * src->stride); + + dst_offset = cr.x + (cr.y * dst->stride); + + if ((!dc->mul.use) || (dc->mul.col == 0xffffffff)) + _soft16_image_draw_scaled_no_mul + (src, dst, dc, dst_offset, cr.w, cr.h, offset_x, offset_y); + else if (dc->mul.col != 0x00000000) + _soft16_image_draw_scaled_mul + (src, dst, dc, dst_offset, cr.w, cr.h, offset_x, offset_y); +} diff --git a/legacy/evas/src/modules/engines/software_16/evas_soft16_image_unscaled.c b/legacy/evas/src/modules/engines/software_16/evas_soft16_image_unscaled.c new file mode 100644 index 0000000000..eb0471cf35 --- /dev/null +++ b/legacy/evas/src/modules/engines/software_16/evas_soft16_image_unscaled.c @@ -0,0 +1,293 @@ +#include "evas_soft16.h" +#include "evas_soft16_scanline_blend.c" + +static void +_soft16_image_draw_unscaled_solid_solid(Soft16_Image *src, Soft16_Image *dst, + RGBA_Draw_Context *dc, + int src_offset, int dst_offset, + int w, int h) +{ + DATA16 *src_itr, *dst_itr; + int y; + + src_itr = src->pixels + src_offset; + dst_itr = dst->pixels + dst_offset; + + for (y = 0; y < h; y++) + { + _soft16_scanline_blend_solid_solid(src_itr, dst_itr, w); + src_itr += src->stride; + dst_itr += dst->stride; + } +} + +static void +_soft16_image_draw_unscaled_transp_solid(Soft16_Image *src, Soft16_Image *dst, + RGBA_Draw_Context *dc, + int src_offset, int dst_offset, + int w, int h) + +{ + DATA16 *src_itr, *dst_itr; + DATA8 *alpha_itr; + int y; + + src_itr = src->pixels + src_offset; + alpha_itr = src->alpha + src_offset; + dst_itr = dst->pixels + dst_offset; + + for (y = 0; y < h; y++) + { + _soft16_scanline_blend_transp_solid(src_itr, alpha_itr, dst_itr, w); + src_itr += src->stride; + alpha_itr += src->stride; + dst_itr += dst->stride; + } +} + +static inline void +_soft16_image_draw_unscaled_no_mul(Soft16_Image *src, Soft16_Image *dst, + RGBA_Draw_Context *dc, + int src_offset, int dst_offset, + int width, int height) +{ + if (src->have_alpha && (!dst->have_alpha)) + _soft16_image_draw_unscaled_transp_solid(src, dst, dc, + src_offset, dst_offset, + width, height); + else if ((!src->have_alpha) && (!dst->have_alpha)) + _soft16_image_draw_unscaled_solid_solid(src, dst, dc, + src_offset, dst_offset, + width, height); + else + fprintf(stderr, + "Unsupported draw of unscaled images src->have_alpha=%d, " + "dst->have_alpha=%d, WITHOUT COLOR MUL\n", + src->have_alpha, dst->have_alpha); +} + +static void +_soft16_image_draw_unscaled_solid_solid_mul_alpha(Soft16_Image *src, + Soft16_Image *dst, + RGBA_Draw_Context *dc, + int src_offset, + int dst_offset, + int w, int h) +{ + DATA16 *src_itr, *dst_itr; + int y, rel_alpha; + + src_itr = src->pixels + src_offset; + dst_itr = dst->pixels + dst_offset; + + rel_alpha = A_VAL(&dc->mul.col) >> 3; + if ((rel_alpha < 1) || (rel_alpha > 31)) return; + rel_alpha = 31 - rel_alpha; + + for (y = 0; y < h; y++) + { + _soft16_scanline_blend_solid_solid_mul_alpha(src_itr, dst_itr, w, + rel_alpha); + src_itr += src->stride; + dst_itr += dst->stride; + } +} + +static void +_soft16_image_draw_unscaled_transp_solid_mul_alpha(Soft16_Image *src, + Soft16_Image *dst, + RGBA_Draw_Context *dc, + int src_offset, + int dst_offset, + int w, int h) + +{ + DATA16 *src_itr, *dst_itr; + DATA8 *alpha_itr; + int y, rel_alpha; + + src_itr = src->pixels + src_offset; + alpha_itr = src->alpha + src_offset; + dst_itr = dst->pixels + dst_offset; + + rel_alpha = A_VAL(&dc->mul.col) >> 3; + if ((rel_alpha < 1) || (rel_alpha > 31)) return; + rel_alpha = 31 - rel_alpha; + + for (y = 0; y < h; y++) + { + _soft16_scanline_blend_transp_solid_mul_alpha(src_itr, alpha_itr, + dst_itr, w, rel_alpha); + src_itr += src->stride; + alpha_itr += src->stride; + dst_itr += dst->stride; + } +} + +static inline void +_soft16_image_draw_unscaled_mul_alpha(Soft16_Image *src, Soft16_Image *dst, + RGBA_Draw_Context *dc, + int src_offset, int dst_offset, + int width, int height) +{ + if (src->have_alpha && (!dst->have_alpha)) + _soft16_image_draw_unscaled_transp_solid_mul_alpha + (src, dst, dc, src_offset, dst_offset, width, height); + else if ((!src->have_alpha) && (!dst->have_alpha)) + _soft16_image_draw_unscaled_solid_solid_mul_alpha + (src, dst, dc, src_offset, dst_offset, width, height); + else + fprintf(stderr, + "Unsupported draw of unscaled images src->have_alpha=%d, " + "dst->have_alpha=%d, WITH ALPHA MUL %d\n", + src->have_alpha, dst->have_alpha, A_VAL(&dc->mul.col)); +} + +static void +_soft16_image_draw_unscaled_solid_solid_mul_color(Soft16_Image *src, + Soft16_Image *dst, + RGBA_Draw_Context *dc, + int src_offset, + int dst_offset, + int w, int h) +{ + DATA16 *src_itr, *dst_itr; + int y, rel_alpha, r, g, b; + + src_itr = src->pixels + src_offset; + dst_itr = dst->pixels + dst_offset; + + rel_alpha = A_VAL(&dc->mul.col) >> 3; + if ((rel_alpha < 1) || (rel_alpha > 31)) return; + + r = R_VAL(&dc->mul.col); + g = G_VAL(&dc->mul.col); + b = B_VAL(&dc->mul.col); + /* we'll divide by 256 to make it faster, try to improve things a bit */ + if (r > 127) r++; + if (g > 127) g++; + if (b > 127) b++; + + if (rel_alpha == 31) + for (y = 0; y < h; y++) + { + _soft16_scanline_blend_solid_solid_mul_color_solid + (src_itr, dst_itr, w, r, g, b); + src_itr += src->stride; + dst_itr += dst->stride; + } + else + for (y = 0; y < h; y++) + { + _soft16_scanline_blend_solid_solid_mul_color_transp + (src_itr, dst_itr, w, rel_alpha, r, g, b); + src_itr += src->stride; + dst_itr += dst->stride; + } +} + +static void +_soft16_image_draw_unscaled_transp_solid_mul_color(Soft16_Image *src, + Soft16_Image *dst, + RGBA_Draw_Context *dc, + int src_offset, + int dst_offset, + int w, int h) + +{ + DATA16 *src_itr, *dst_itr; + DATA8 *alpha_itr; + int y, rel_alpha, r, g, b; + + src_itr = src->pixels + src_offset; + alpha_itr = src->alpha + src_offset; + dst_itr = dst->pixels + dst_offset; + + rel_alpha = A_VAL(&dc->mul.col) >> 3; + if ((rel_alpha < 1) || (rel_alpha > 31)) return; + rel_alpha = 31 - rel_alpha; + + r = R_VAL(&dc->mul.col); + g = G_VAL(&dc->mul.col); + b = B_VAL(&dc->mul.col); + /* we'll divide by 256 to make it faster, try to improve things a bit */ + if (r > 127) r++; + if (g > 127) g++; + if (b > 127) b++; + + if (rel_alpha == 0) + for (y = 0; y < h; y++) + { + _soft16_scanline_blend_transp_solid_mul_color_solid + (src_itr, alpha_itr, dst_itr, w, r, g, b); + src_itr += src->stride; + alpha_itr += src->stride; + dst_itr += dst->stride; + } + else + for (y = 0; y < h; y++) + { + _soft16_scanline_blend_transp_solid_mul_color_transp + (src_itr, alpha_itr, dst_itr, w, rel_alpha, r, g, b); + src_itr += src->stride; + alpha_itr += src->stride; + dst_itr += dst->stride; + } +} + +static inline void +_soft16_image_draw_unscaled_mul_color(Soft16_Image *src, Soft16_Image *dst, + RGBA_Draw_Context *dc, + int src_offset, int dst_offset, + int width, int height) +{ + if (src->have_alpha && (!dst->have_alpha)) + _soft16_image_draw_unscaled_transp_solid_mul_color + (src, dst, dc, src_offset, dst_offset, width, height); + else if ((!src->have_alpha) && (!dst->have_alpha)) + _soft16_image_draw_unscaled_solid_solid_mul_color + (src, dst, dc, src_offset, dst_offset, width, height); + else + fprintf(stderr, + "Unsupported draw of unscaled images src->have_alpha=%d, " + "dst->have_alpha=%d, WITH COLOR MUL 0x%08x\n", + src->have_alpha, dst->have_alpha, dc->mul.col); +} + +static inline void +_soft16_image_draw_unscaled_mul(Soft16_Image *src, Soft16_Image *dst, + RGBA_Draw_Context *dc, + int src_offset, int dst_offset, + int width, int height) +{ + if ((A_VAL(&dc->mul.col) == R_VAL(&dc->mul.col)) && + (A_VAL(&dc->mul.col) == G_VAL(&dc->mul.col)) && + (A_VAL(&dc->mul.col) == B_VAL(&dc->mul.col))) + _soft16_image_draw_unscaled_mul_alpha(src, dst, dc, src_offset, + dst_offset, width, height); + else + _soft16_image_draw_unscaled_mul_color(src, dst, dc, src_offset, + dst_offset, width, height); +} + +void +soft16_image_draw_unscaled(Soft16_Image *src, Soft16_Image *dst, + RGBA_Draw_Context *dc, + const Evas_Rectangle sr, + const Evas_Rectangle dr, + const Evas_Rectangle cr) +{ + int src_offset_rows, src_offset, dst_offset; + + src_offset_rows = (cr.y - dr.y) + sr.y; + src_offset = (src_offset_rows * src->stride) + (cr.x - dr.x) + sr.x; + + dst_offset = cr.x + (cr.y * dst->stride); + + if ((!dc->mul.use) || (dc->mul.col == 0xffffffff)) + _soft16_image_draw_unscaled_no_mul(src, dst, dc, src_offset, dst_offset, + cr.w, cr.h); + else if (dc->mul.col != 0x00000000) + _soft16_image_draw_unscaled_mul(src, dst, dc, src_offset, dst_offset, + cr.w, cr.h); +} diff --git a/legacy/evas/src/modules/engines/software_16/evas_soft16_main.c b/legacy/evas/src/modules/engines/software_16/evas_soft16_main.c index 2b37531d59..6790102795 100644 --- a/legacy/evas/src/modules/engines/software_16/evas_soft16_main.c +++ b/legacy/evas/src/modules/engines/software_16/evas_soft16_main.c @@ -1,5 +1,4 @@ #include "evas_soft16.h" -#include "evas_soft16_scanline_blend.c" #define IMG_BYTE_SIZE(stride, height, has_alpha) \ ((stride) * (height) * (!(has_alpha) ? 2 : 3)) @@ -396,770 +395,6 @@ _soft16_adjust_areas(Evas_Rectangle *src, return 1; } -/*********************************************************************** - * Unscaled - **********************************************************************/ -static void -_soft16_image_draw_unscaled_solid_solid(Soft16_Image *src, Soft16_Image *dst, - RGBA_Draw_Context *dc, - int src_offset, int dst_offset, - int w, int h) -{ - DATA16 *src_itr, *dst_itr; - int y; - - src_itr = src->pixels + src_offset; - dst_itr = dst->pixels + dst_offset; - - for (y = 0; y < h; y++) - { - _soft16_scanline_blend_solid_solid(src_itr, dst_itr, w); - src_itr += src->stride; - dst_itr += dst->stride; - } -} - -static void -_soft16_image_draw_unscaled_transp_solid(Soft16_Image *src, Soft16_Image *dst, - RGBA_Draw_Context *dc, - int src_offset, int dst_offset, - int w, int h) - -{ - DATA16 *src_itr, *dst_itr; - DATA8 *alpha_itr; - int y; - - src_itr = src->pixels + src_offset; - alpha_itr = src->alpha + src_offset; - dst_itr = dst->pixels + dst_offset; - - for (y = 0; y < h; y++) - { - _soft16_scanline_blend_transp_solid(src_itr, alpha_itr, dst_itr, w); - src_itr += src->stride; - alpha_itr += src->stride; - dst_itr += dst->stride; - } -} - -static inline void -_soft16_image_draw_unscaled_no_mul(Soft16_Image *src, Soft16_Image *dst, - RGBA_Draw_Context *dc, - int src_offset, int dst_offset, - int width, int height) -{ - if (src->have_alpha && (!dst->have_alpha)) - _soft16_image_draw_unscaled_transp_solid(src, dst, dc, - src_offset, dst_offset, - width, height); - else if ((!src->have_alpha) && (!dst->have_alpha)) - _soft16_image_draw_unscaled_solid_solid(src, dst, dc, - src_offset, dst_offset, - width, height); - else - fprintf(stderr, - "Unsupported draw of unscaled images src->have_alpha=%d, " - "dst->have_alpha=%d, WITHOUT COLOR MUL\n", - src->have_alpha, dst->have_alpha); -} - -static void -_soft16_image_draw_unscaled_solid_solid_mul_alpha(Soft16_Image *src, - Soft16_Image *dst, - RGBA_Draw_Context *dc, - int src_offset, - int dst_offset, - int w, int h) -{ - DATA16 *src_itr, *dst_itr; - int y, rel_alpha; - - src_itr = src->pixels + src_offset; - dst_itr = dst->pixels + dst_offset; - - rel_alpha = A_VAL(&dc->mul.col) >> 3; - if ((rel_alpha < 1) || (rel_alpha > 31)) return; - rel_alpha = 31 - rel_alpha; - - for (y = 0; y < h; y++) - { - _soft16_scanline_blend_solid_solid_mul_alpha(src_itr, dst_itr, w, - rel_alpha); - src_itr += src->stride; - dst_itr += dst->stride; - } -} - -static void -_soft16_image_draw_unscaled_transp_solid_mul_alpha(Soft16_Image *src, - Soft16_Image *dst, - RGBA_Draw_Context *dc, - int src_offset, - int dst_offset, - int w, int h) - -{ - DATA16 *src_itr, *dst_itr; - DATA8 *alpha_itr; - int y, rel_alpha; - - src_itr = src->pixels + src_offset; - alpha_itr = src->alpha + src_offset; - dst_itr = dst->pixels + dst_offset; - - rel_alpha = A_VAL(&dc->mul.col) >> 3; - if ((rel_alpha < 1) || (rel_alpha > 31)) return; - rel_alpha = 31 - rel_alpha; - - for (y = 0; y < h; y++) - { - _soft16_scanline_blend_transp_solid_mul_alpha(src_itr, alpha_itr, - dst_itr, w, rel_alpha); - src_itr += src->stride; - alpha_itr += src->stride; - dst_itr += dst->stride; - } -} - -static inline void -_soft16_image_draw_unscaled_mul_alpha(Soft16_Image *src, Soft16_Image *dst, - RGBA_Draw_Context *dc, - int src_offset, int dst_offset, - int width, int height) -{ - if (src->have_alpha && (!dst->have_alpha)) - _soft16_image_draw_unscaled_transp_solid_mul_alpha - (src, dst, dc, src_offset, dst_offset, width, height); - else if ((!src->have_alpha) && (!dst->have_alpha)) - _soft16_image_draw_unscaled_solid_solid_mul_alpha - (src, dst, dc, src_offset, dst_offset, width, height); - else - fprintf(stderr, - "Unsupported draw of unscaled images src->have_alpha=%d, " - "dst->have_alpha=%d, WITH ALPHA MUL %d\n", - src->have_alpha, dst->have_alpha, A_VAL(&dc->mul.col)); -} - -static void -_soft16_image_draw_unscaled_solid_solid_mul_color(Soft16_Image *src, - Soft16_Image *dst, - RGBA_Draw_Context *dc, - int src_offset, - int dst_offset, - int w, int h) -{ - DATA16 *src_itr, *dst_itr; - int y, rel_alpha, r, g, b; - - src_itr = src->pixels + src_offset; - dst_itr = dst->pixels + dst_offset; - - rel_alpha = A_VAL(&dc->mul.col) >> 3; - if ((rel_alpha < 1) || (rel_alpha > 31)) return; - - r = R_VAL(&dc->mul.col); - g = G_VAL(&dc->mul.col); - b = B_VAL(&dc->mul.col); - /* we'll divide by 256 to make it faster, try to improve things a bit */ - if (r > 127) r++; - if (g > 127) g++; - if (b > 127) b++; - - if (rel_alpha == 31) - for (y = 0; y < h; y++) - { - _soft16_scanline_blend_solid_solid_mul_color_solid - (src_itr, dst_itr, w, r, g, b); - src_itr += src->stride; - dst_itr += dst->stride; - } - else - for (y = 0; y < h; y++) - { - _soft16_scanline_blend_solid_solid_mul_color_transp - (src_itr, dst_itr, w, rel_alpha, r, g, b); - src_itr += src->stride; - dst_itr += dst->stride; - } -} - -static void -_soft16_image_draw_unscaled_transp_solid_mul_color(Soft16_Image *src, - Soft16_Image *dst, - RGBA_Draw_Context *dc, - int src_offset, - int dst_offset, - int w, int h) - -{ - DATA16 *src_itr, *dst_itr; - DATA8 *alpha_itr; - int y, rel_alpha, r, g, b; - - src_itr = src->pixels + src_offset; - alpha_itr = src->alpha + src_offset; - dst_itr = dst->pixels + dst_offset; - - rel_alpha = A_VAL(&dc->mul.col) >> 3; - if ((rel_alpha < 1) || (rel_alpha > 31)) return; - rel_alpha = 31 - rel_alpha; - - r = R_VAL(&dc->mul.col); - g = G_VAL(&dc->mul.col); - b = B_VAL(&dc->mul.col); - /* we'll divide by 256 to make it faster, try to improve things a bit */ - if (r > 127) r++; - if (g > 127) g++; - if (b > 127) b++; - - if (rel_alpha == 0) - for (y = 0; y < h; y++) - { - _soft16_scanline_blend_transp_solid_mul_color_solid - (src_itr, alpha_itr, dst_itr, w, r, g, b); - src_itr += src->stride; - alpha_itr += src->stride; - dst_itr += dst->stride; - } - else - for (y = 0; y < h; y++) - { - _soft16_scanline_blend_transp_solid_mul_color_transp - (src_itr, alpha_itr, dst_itr, w, rel_alpha, r, g, b); - src_itr += src->stride; - alpha_itr += src->stride; - dst_itr += dst->stride; - } -} - -static inline void -_soft16_image_draw_unscaled_mul_color(Soft16_Image *src, Soft16_Image *dst, - RGBA_Draw_Context *dc, - int src_offset, int dst_offset, - int width, int height) -{ - if (src->have_alpha && (!dst->have_alpha)) - _soft16_image_draw_unscaled_transp_solid_mul_color - (src, dst, dc, src_offset, dst_offset, width, height); - else if ((!src->have_alpha) && (!dst->have_alpha)) - _soft16_image_draw_unscaled_solid_solid_mul_color - (src, dst, dc, src_offset, dst_offset, width, height); - else - fprintf(stderr, - "Unsupported draw of unscaled images src->have_alpha=%d, " - "dst->have_alpha=%d, WITH COLOR MUL 0x%08x\n", - src->have_alpha, dst->have_alpha, dc->mul.col); -} - -static inline void -_soft16_image_draw_unscaled_mul(Soft16_Image *src, Soft16_Image *dst, - RGBA_Draw_Context *dc, - int src_offset, int dst_offset, - int width, int height) -{ - if ((A_VAL(&dc->mul.col) == R_VAL(&dc->mul.col)) && - (A_VAL(&dc->mul.col) == G_VAL(&dc->mul.col)) && - (A_VAL(&dc->mul.col) == B_VAL(&dc->mul.col))) - _soft16_image_draw_unscaled_mul_alpha(src, dst, dc, src_offset, - dst_offset, width, height); - else - _soft16_image_draw_unscaled_mul_color(src, dst, dc, src_offset, - dst_offset, width, height); -} - -static void -_soft16_image_draw_unscaled(Soft16_Image *src, Soft16_Image *dst, - RGBA_Draw_Context *dc, - const Evas_Rectangle sr, - const Evas_Rectangle dr, - const Evas_Rectangle cr) -{ - int src_offset_rows, src_offset, dst_offset; - - src_offset_rows = (cr.y - dr.y) + sr.y; - src_offset = (src_offset_rows * src->stride) + (cr.x - dr.x) + sr.x; - - dst_offset = cr.x + (cr.y * dst->stride); - - if ((!dc->mul.use) || (dc->mul.col == 0xffffffff)) - _soft16_image_draw_unscaled_no_mul(src, dst, dc, src_offset, dst_offset, - cr.w, cr.h); - else if (dc->mul.col != 0x00000000) - _soft16_image_draw_unscaled_mul(src, dst, dc, src_offset, dst_offset, - cr.w, cr.h); -} - -/*********************************************************************** - * Scaled - ***********************************************************************/ -static void -_soft16_image_draw_scaled_solid_solid(Soft16_Image *src, - Soft16_Image *dst, - RGBA_Draw_Context *dc, - int dst_offset, int w, int h, - int *offset_x, int *offset_y) -{ - DATA16 *dst_itr; - int y, w_align; - - w_align = w & ~7; - - dst_itr = dst->pixels + dst_offset; - for (y = 0; y < h; y++, dst_itr += dst->stride) - { - DATA16 *d, *s; - int x; - - s = src->pixels + offset_y[y]; - pld(s, 0); - pld(offset_x, 0); - - d = dst_itr; - x = 0; - while (x < w_align) - { - pld(s, 32); - pld(offset_x + x, 32); - - UNROLL8({ - _soft16_pt_blend_solid_solid(d, s[offset_x[x]]); - x++; - d++; - }); - } - - for (; x < w; x++, d++) - _soft16_pt_blend_solid_solid(d, s[offset_x[x]]); - } -} -static void -_soft16_image_draw_scaled_transp_solid(Soft16_Image *src, - Soft16_Image *dst, - RGBA_Draw_Context *dc, - int dst_offset, int w, int h, - int *offset_x, int *offset_y) -{ - DATA16 *dst_itr; - int y, w_align; - - w_align = w & ~7; - - dst_itr = dst->pixels + dst_offset; - for (y = 0; y < h; y++, dst_itr += dst->stride) - { - DATA16 *d, *s; - DATA8 *a; - int x; - - s = src->pixels + offset_y[y]; - a = src->alpha + offset_y[y]; - pld(s, 0); - pld(a, 0); - pld(offset_x, 0); - - d = dst_itr; - x = 0; - while (x < w_align) - { - pld(s, 32); - pld(a, 8); - pld(offset_x + x, 32); - - UNROLL8({ - int off_x = offset_x[x]; - _soft16_pt_blend_transp_solid(d, s[off_x], a[off_x]); - x++; - d++; - }); - } - - for (; x < w; x++, d++) - _soft16_pt_blend_transp_solid(d, s[offset_x[x]], a[offset_x[x]]); - } -} - -static inline void -_soft16_image_draw_scaled_no_mul(Soft16_Image *src, Soft16_Image *dst, - RGBA_Draw_Context *dc, - int dst_offset, int w, int h, - int *offset_x, int *offset_y) -{ - if (src->have_alpha && (!dst->have_alpha)) - _soft16_image_draw_scaled_transp_solid - (src, dst, dc, dst_offset, w, h, offset_x, offset_y); - else if ((!src->have_alpha) && (!dst->have_alpha)) - _soft16_image_draw_scaled_solid_solid - (src, dst, dc, dst_offset, w, h, offset_x, offset_y); - else - fprintf(stderr, - "Unsupported draw of scaled images src->have_alpha=%d, " - "dst->have_alpha=%d, WITHOUT COLOR MUL\n", - src->have_alpha, dst->have_alpha); -} - -static void -_soft16_image_draw_scaled_solid_solid_mul_alpha(Soft16_Image *src, - Soft16_Image *dst, - RGBA_Draw_Context *dc, - int dst_offset, int w, int h, - int *offset_x, int *offset_y) -{ - DATA16 *dst_itr; - int y, w_align, rel_alpha; - - rel_alpha = A_VAL(&dc->mul.col) >> 3; - if ((rel_alpha < 1) || (rel_alpha > 31)) return; - rel_alpha = 31 - rel_alpha; - - w_align = w & ~7; - - dst_itr = dst->pixels + dst_offset; - for (y = 0; y < h; y++, dst_itr += dst->stride) - { - DATA16 *d, *s; - int x; - - s = src->pixels + offset_y[y]; - pld(s, 0); - pld(offset_x, 0); - - d = dst_itr; - x = 0; - while (x < w_align) - { - pld(s, 32); - pld(offset_x + x, 32); - - UNROLL8({ - _soft16_pt_blend_solid_solid_mul_alpha - (d, s[offset_x[x]], rel_alpha); - x++; - d++; - }); - } - - for (; x < w; x++, d++) - _soft16_pt_blend_solid_solid_mul_alpha - (d, s[offset_x[x]], rel_alpha); - } -} - -static void -_soft16_image_draw_scaled_transp_solid_mul_alpha(Soft16_Image *src, - Soft16_Image *dst, - RGBA_Draw_Context *dc, - int dst_offset, int w, int h, - int *offset_x, int *offset_y) -{ - DATA16 *dst_itr; - int y, w_align, rel_alpha; - - rel_alpha = A_VAL(&dc->mul.col) >> 3; - if ((rel_alpha < 1) || (rel_alpha > 31)) return; - rel_alpha = 31 - rel_alpha; - - w_align = w & ~7; - - dst_itr = dst->pixels + dst_offset; - for (y = 0; y < h; y++, dst_itr += dst->stride) - { - DATA16 *d, *s; - DATA8 *a; - int x; - - s = src->pixels + offset_y[y]; - a = src->alpha + offset_y[y]; - pld(s, 0); - pld(a, 0); - pld(offset_x, 0); - - d = dst_itr; - x = 0; - while (x < w_align) - { - pld(s, 32); - pld(a, 8); - pld(offset_x + x, 32); - - UNROLL8({ - int off_x = offset_x[x]; - _soft16_pt_blend_transp_solid_mul_alpha - (d, s[off_x], a[off_x], rel_alpha); - x++; - d++; - }); - } - - for (; x < w; x++, d++) - _soft16_pt_blend_transp_solid_mul_alpha - (d, s[offset_x[x]], a[offset_x[x]], rel_alpha); - } -} - -static inline void -_soft16_image_draw_scaled_mul_alpha(Soft16_Image *src, Soft16_Image *dst, - RGBA_Draw_Context *dc, - int dst_offset, int w, int h, - int *offset_x, int *offset_y) -{ - if (src->have_alpha && (!dst->have_alpha)) - _soft16_image_draw_scaled_transp_solid_mul_alpha - (src, dst, dc, dst_offset, w, h, offset_x, offset_y); - else if ((!src->have_alpha) && (!dst->have_alpha)) - _soft16_image_draw_scaled_solid_solid_mul_alpha - (src, dst, dc, dst_offset, w, h, offset_x, offset_y); - else - fprintf(stderr, - "Unsupported draw of scaled images src->have_alpha=%d, " - "dst->have_alpha=%d, WITH ALPHA MUL %d\n", - src->have_alpha, dst->have_alpha, A_VAL(&dc->mul.col)); -} - -static void -_soft16_image_draw_scaled_solid_solid_mul_color(Soft16_Image *src, - Soft16_Image *dst, - RGBA_Draw_Context *dc, - int dst_offset, int w, int h, - int *offset_x, int *offset_y) -{ - DATA16 *dst_itr; - int y, w_align, rel_alpha, r, g, b; - - rel_alpha = A_VAL(&dc->mul.col) >> 3; - if ((rel_alpha < 1) || (rel_alpha > 31)) return; - - r = R_VAL(&dc->mul.col); - g = G_VAL(&dc->mul.col); - b = B_VAL(&dc->mul.col); - /* we'll divide by 256 to make it faster, try to improve things a bit */ - if (r > 127) r++; - if (g > 127) g++; - if (b > 127) b++; - - w_align = w & ~7; - - dst_itr = dst->pixels + dst_offset; - - if (rel_alpha == 31) - for (y = 0; y < h; y++, dst_itr += dst->stride) - { - DATA16 *d, *s; - int x; - - s = src->pixels + offset_y[y]; - pld(s, 0); - pld(offset_x, 0); - - d = dst_itr; - x = 0; - while (x < w_align) - { - pld(s, 32); - pld(offset_x + x, 32); - - UNROLL8({ - _soft16_pt_blend_solid_solid_mul_color_solid - (d, s[offset_x[x]], r, g, b); - x++; - d++; - }); - } - - for (; x < w; x++, d++) - _soft16_pt_blend_solid_solid_mul_color_solid - (d, s[offset_x[x]], r, g, b); - } - else - for (y = 0; y < h; y++, dst_itr += dst->stride) - { - DATA16 *d, *s; - int x; - - s = src->pixels + offset_y[y]; - pld(s, 0); - pld(offset_x, 0); - - d = dst_itr; - x = 0; - while (x < w_align) - { - pld(s, 32); - pld(offset_x + x, 32); - - UNROLL8({ - _soft16_pt_blend_solid_solid_mul_color_transp - (d, s[offset_x[x]], rel_alpha, r, g, b); - x++; - d++; - }); - } - - for (; x < w; x++, d++) - _soft16_pt_blend_solid_solid_mul_color_transp - (d, s[offset_x[x]], rel_alpha, r, g, b); - } -} - -static void -_soft16_image_draw_scaled_transp_solid_mul_color(Soft16_Image *src, - Soft16_Image *dst, - RGBA_Draw_Context *dc, - int dst_offset, int w, int h, - int *offset_x, int *offset_y) -{ - DATA16 *dst_itr; - int y, w_align, rel_alpha, r, g, b; - - rel_alpha = A_VAL(&dc->mul.col) >> 3; - if ((rel_alpha < 1) || (rel_alpha > 31)) return; - rel_alpha = 31 - rel_alpha; - - r = R_VAL(&dc->mul.col); - g = G_VAL(&dc->mul.col); - b = B_VAL(&dc->mul.col); - /* we'll divide by 256 to make it faster, try to improve things a bit */ - if (r > 127) r++; - if (g > 127) g++; - if (b > 127) b++; - - w_align = w & ~7; - - dst_itr = dst->pixels + dst_offset; - - if (rel_alpha == 0) - for (y = 0; y < h; y++, dst_itr += dst->stride) - { - DATA16 *d, *s; - DATA8 *a; - int x; - - s = src->pixels + offset_y[y]; - a = src->alpha + offset_y[y]; - pld(s, 0); - pld(a, 0); - pld(offset_x, 0); - - d = dst_itr; - x = 0; - while (x < w_align) - { - pld(s, 32); - pld(a, 8); - pld(offset_x + x, 32); - - UNROLL8({ - int off_x = offset_x[x]; - _soft16_pt_blend_transp_solid_mul_color_solid - (d, s[off_x], a[off_x], r, g, b); - x++; - d++; - }); - } - - for (; x < w; x++, d++) - _soft16_pt_blend_transp_solid_mul_color_solid - (d, s[offset_x[x]], a[offset_x[x]], r, g, b); - } - else - { - DATA16 *d, *s; - DATA8 *a; - int x; - - s = src->pixels + offset_y[y]; - a = src->alpha + offset_y[y]; - pld(s, 0); - pld(a, 0); - pld(offset_x, 0); - - d = dst_itr; - x = 0; - while (x < w_align) - { - pld(s, 32); - pld(a, 8); - pld(offset_x + x, 32); - - UNROLL8({ - int off_x = offset_x[x]; - _soft16_pt_blend_transp_solid_mul_color_transp - (d, s[off_x], a[off_x], rel_alpha, r, g, b); - x++; - d++; - }); - } - - for (; x < w; x++, d++) - _soft16_pt_blend_transp_solid_mul_color_transp - (d, s[offset_x[x]], a[offset_x[x]], rel_alpha, r, g, b); - } -} - -static inline void -_soft16_image_draw_scaled_mul_color(Soft16_Image *src, Soft16_Image *dst, - RGBA_Draw_Context *dc, - int dst_offset, int w, int h, - int *offset_x, int *offset_y) -{ - if (src->have_alpha && (!dst->have_alpha)) - _soft16_image_draw_scaled_transp_solid_mul_color - (src, dst, dc, dst_offset, w, h, offset_x, offset_y); - else if ((!src->have_alpha) && (!dst->have_alpha)) - _soft16_image_draw_scaled_solid_solid_mul_color - (src, dst, dc, dst_offset, w, h, offset_x, offset_y); - else - fprintf(stderr, - "Unsupported draw of scaled images src->have_alpha=%d, " - "dst->have_alpha=%d, WITH COLOR MUL 0x%08x\n", - src->have_alpha, dst->have_alpha, dc->mul.col); -} - -static inline void -_soft16_image_draw_scaled_mul(Soft16_Image *src, Soft16_Image *dst, - RGBA_Draw_Context *dc, - int dst_offset, int w, int h, - int *offset_x, int *offset_y) -{ - if ((A_VAL(&dc->mul.col) == R_VAL(&dc->mul.col)) && - (A_VAL(&dc->mul.col) == G_VAL(&dc->mul.col)) && - (A_VAL(&dc->mul.col) == B_VAL(&dc->mul.col))) - _soft16_image_draw_scaled_mul_alpha - (src, dst, dc, dst_offset, w, h, offset_x, offset_y); - else - _soft16_image_draw_scaled_mul_color - (src, dst, dc, dst_offset, w, h, offset_x, offset_y); -} - -static void -_soft16_image_draw_scaled(Soft16_Image *src, Soft16_Image *dst, - RGBA_Draw_Context *dc, - const Evas_Rectangle sr, - const Evas_Rectangle dr, - const Evas_Rectangle cr) -{ - int x, y, dst_offset, *offset_x, *offset_y; - - /* pre-calculated scale tables */ - offset_x = alloca(cr.w * sizeof(*offset_x)); - for (x = 0; x < cr.w; x++) - offset_x[x] = (((x + cr.x - dr.x) * sr.w) / dr.w) + sr.x; - - offset_y = alloca(cr.h * sizeof(*offset_y)); - for (y = 0; y < cr.h; y++) - offset_y[y] = (((((y + cr.y - dr.y) * sr.h) / dr.h) + sr.y) - * src->stride); - - dst_offset = cr.x + (cr.y * dst->stride); - - if ((!dc->mul.use) || (dc->mul.col == 0xffffffff)) - _soft16_image_draw_scaled_no_mul - (src, dst, dc, dst_offset, cr.w, cr.h, offset_x, offset_y); - else if (dc->mul.col != 0x00000000) - _soft16_image_draw_scaled_mul - (src, dst, dc, dst_offset, cr.w, cr.h, offset_x, offset_y); -} - static void _soft16_image_draw_sampled_int(Soft16_Image *src, Soft16_Image *dst, RGBA_Draw_Context *dc, @@ -1174,12 +409,12 @@ _soft16_image_draw_sampled_int(Soft16_Image *src, Soft16_Image *dst, _get_clip(dc, dst, &cr); if (!_soft16_adjust_areas(&sr, src->w, src->h, &dr, dst->w, dst->h, &cr)) - return; + return; if ((dr.w == sr.w) && (dr.h == sr.h)) - _soft16_image_draw_unscaled(src, dst, dc, sr, dr, cr); + soft16_image_draw_unscaled(src, dst, dc, sr, dr, cr); else - _soft16_image_draw_scaled(src, dst, dc, sr, dr, cr); + soft16_image_draw_scaled_sampled(src, dst, dc, sr, dr, cr); } void