From 825a3d837a33f226c879cd02ad15c3fba57e8b2c Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Mon, 23 Jan 2012 23:30:42 +1000 Subject: Update the EFL to what I'm actually using, coz I'm using some stuff not yet released. --- .../evas/src/lib/engines/common/evas_line_main.c | 475 ++++++++++++++++++--- 1 file changed, 413 insertions(+), 62 deletions(-) (limited to 'libraries/evas/src/lib/engines/common/evas_line_main.c') diff --git a/libraries/evas/src/lib/engines/common/evas_line_main.c b/libraries/evas/src/lib/engines/common/evas_line_main.c index 04401cb..aacf805 100644 --- a/libraries/evas/src/lib/engines/common/evas_line_main.c +++ b/libraries/evas/src/lib/engines/common/evas_line_main.c @@ -109,9 +109,24 @@ _evas_draw_point(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y) return; if ((dc->clip.use) && (!IN_RECT(x, y, dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h))) return; - pfunc = evas_common_gfx_func_composite_color_pt_get(dc->col.col, dst, dc->render_op); - if (pfunc) - pfunc(0, 255, dc->col.col, dst->image.data + (dst->cache_entry.w * y) + x); +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_LINE + pixman_op_t op = PIXMAN_OP_SRC; + + if (dc->render_op == _EVAS_RENDER_BLEND) + op = PIXMAN_OP_OVER; + + if ((dst->pixman.im) && (dc->col.pixman_color_image)) + pixman_image_composite(op, dc->col.pixman_color_image, NULL, + dst->pixman.im, x, y, 0, 0, x, y, 1, 1); + else +# endif +#endif + { + pfunc = evas_common_gfx_func_composite_color_pt_get(dc->col.col, dst, dc->render_op); + if (pfunc) + pfunc(0, 255, dc->col.col, dst->image.data + (dst->cache_entry.w * y) + x); + } } /* @@ -130,6 +145,14 @@ _evas_draw_simple_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, i RGBA_Gfx_Pt_Func pfunc; RGBA_Gfx_Func sfunc; +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_LINE + pixman_op_t op = PIXMAN_OP_SRC; // _EVAS_RENDER_COPY + if (dc->render_op == _EVAS_RENDER_BLEND) + op = PIXMAN_OP_OVER; +# endif +#endif + dstw = dst->cache_entry.w; color = dc->col.col; @@ -172,12 +195,30 @@ _evas_draw_simple_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, i len = x1 - x0 + 1; p = dst->image.data + (dstw * y0) + x0; - sfunc = evas_common_gfx_func_composite_color_span_get(color, dst, len, dc->render_op); - if (sfunc) - sfunc(NULL, NULL, color, p, len); - } - } - return; +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_LINE + if ((dst->pixman.im) && (dc->col.pixman_color_image) && + (!dc->mask.mask)) + pixman_image_composite(op, dc->col.pixman_color_image, + NULL, dst->pixman.im, + x0, y0, 0, 0, x0, y0, len, 1); + else if ((dst->pixman.im) && (dc->col.pixman_color_image) && + (dc->mask.mask)) + pixman_image_composite(op, dc->col.pixman_color_image, + dc->mask.mask->pixman.im, + dst->pixman.im, + x0, y0, 0, 0, x0, y0, len, 1); + else +# endif +#endif + { + sfunc = evas_common_gfx_func_composite_color_span_get(color, dst, len, dc->render_op); + if (sfunc) + sfunc(NULL, NULL, color, p, len); + } + } + } + return; } pfunc = evas_common_gfx_func_composite_color_pt_get(color, dst, dc->render_op); @@ -192,17 +233,34 @@ _evas_draw_simple_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, i len = y1 - y0 + 1; p = dst->image.data + (dstw * y0) + x0; - while (len--) - { +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_LINE + if ((dst->pixman.im) && (dc->col.pixman_color_image) && + (!dc->mask.mask)) + pixman_image_composite(op, dc->col.pixman_color_image, + NULL, dst->pixman.im, + x0, y0, 0, 0, x0, y0, 1, len); + else if ((dst->pixman.im) && (dc->col.pixman_color_image) && + (dc->mask.mask)) + pixman_image_composite(op, dc->col.pixman_color_image, + dc->mask.mask->pixman.im, dst->pixman.im, + x0, y0, 0, 0, x0, y0, 1, len); + else +# endif +#endif + { + while (len--) + { #ifdef EVAS_SLI - if (((y1 + 1 - len) % dc->sli.h) == dc->sli.y) + if (((y1 + 1 - len) % dc->sli.h) == dc->sli.y) #endif - { - pfunc(0, 255, color, p); - } - p += dstw; - } - } + { + pfunc(0, 255, color, p); + } + p += dstw; + } + } + } return; } @@ -281,16 +339,52 @@ _evas_draw_simple_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, i if (dx > 0) dstw--; else dstw++; } - +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_LINE + int pixman_x_position = x0; + int pixman_y_position = y0; + int x_unit = dstw - dst->cache_entry.w; +# endif +#endif + + while (len--) { #ifdef EVAS_SLI if (((y1 + 1 - len) % dc->sli.h) == dc->sli.y) #endif { - pfunc(0, 255, color, p); - } - p += dstw; +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_LINE + if ((dst->pixman.im) && (dc->col.pixman_color_image) && + (!dc->mask.mask)) + pixman_image_composite(op, dc->col.pixman_color_image, + NULL, dst->pixman.im, + pixman_x_position, + pixman_y_position, + 0, 0, pixman_x_position, + pixman_y_position, 1, 1); + else if ((dst->pixman.im) && (dc->col.pixman_color_image) && + (dc->mask.mask)) + pixman_image_composite(op, dc->col.pixman_color_image, + dc->mask.mask->pixman.im, + dst->pixman.im, + pixman_x_position, + pixman_y_position, 0, 0, + pixman_x_position, + pixman_y_position, 1, 1); + else +# endif +#endif + pfunc(0, 255, color, p); + } +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_LINE + pixman_x_position += x_unit; + pixman_y_position += 1; +# endif +#endif + p += dstw; } } } @@ -456,6 +550,31 @@ _evas_draw_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1, dx = x1 - x0; dy = y1 - y0; +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_LINE + int pix_x; + int pix_y; + int pix_x_unit; + int pix_y_unit; + + pixman_op_t op = PIXMAN_OP_SRC; // _EVAS_RENDER_COPY + if (dc->render_op == _EVAS_RENDER_BLEND) + op = PIXMAN_OP_OVER; + pix_x = x0; + pix_y = y0; + + if (dx < 0) + pix_x_unit = -1; + else + pix_x_unit = 1; + + if (dy < 0) + pix_y_unit = -1; + else + pix_y_unit = 1; +# endif +#endif + if ( (dx == 0) || (dy == 0) || (dx == dy) || (dx == -dy) ) { _evas_draw_simple_line(dst, dc, x0, y0, x1, y1); @@ -494,6 +613,11 @@ _evas_draw_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1, prev_y = y; p += dh; py += dely; +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_LINE + pix_y += pix_y_unit; +# endif +#endif } if (!p1_in) { @@ -509,12 +633,37 @@ _evas_draw_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1, #endif { if (IN_RANGE(px, py, clw, clh)) - pfunc(0, 255, color, p); - } - next_x: - yy += dyy; - px++; - p++; + { +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_LINE + if ((dst->pixman.im) && (dc->col.pixman_color_image) && + (!dc->mask.mask)) + pixman_image_composite(op, dc->col.pixman_color_image, + NULL, dst->pixman.im, + pix_x, pix_y, 0, 0, + pix_x, pix_y, 1, 1); + else if ((dst->pixman.im) && (dc->col.pixman_color_image) && + (dc->mask.mask)) + pixman_image_composite(op, dc->col.pixman_color_image, + dc->mask.mask->pixman.im, + dst->pixman.im, + pix_x, pix_y, 0, 0, + pix_x, pix_y, 1, 1); + else +# endif +#endif + pfunc(0, 255, color, p); + } + } +next_x: + yy += dyy; + px++; + p++; +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_LINE + pix_x += pix_x_unit; +# endif +#endif } return; } @@ -529,9 +678,14 @@ _evas_draw_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1, x += ((xx - (x << 16)) >> 15); if (prev_x != x) { - prev_x = x; - px += delx; - p += delx; + prev_x = x; + px += delx; + p += delx; +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_LINE + pix_x += pix_x_unit; +# endif +#endif } if (!p1_in) { @@ -547,12 +701,38 @@ _evas_draw_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1, #endif { if (IN_RANGE(px, py, clw, clh)) - pfunc(0, 255, color, p); - } - next_y: + { +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_LINE + if ((dst->pixman.im) && (dc->col.pixman_color_image) && + (!dc->mask.mask)) + pixman_image_composite(op, dc->col.pixman_color_image, + NULL, dst->pixman.im, + pix_x, pix_y, 0, 0, + pix_x, pix_y, 1, 1); + else if ((dst->pixman.im) && (dc->col.pixman_color_image) && + (dc->mask.mask)) + pixman_image_composite(op, dc->col.pixman_color_image, + dc->mask.mask->pixman.im, + dst->pixman.im, + pix_x, pix_y, 0, 0, + pix_x, pix_y, 1, 1); + else +# endif +#endif + pfunc(0, 255, color, p); + } + } +next_y: xx += dxx; py++; p += dstw; +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_LINE + pix_y += pix_y_unit; +# endif +#endif + } } @@ -568,12 +748,43 @@ _evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x DATA32 *p, *data, color; RGBA_Gfx_Pt_Func pfunc; + dx = x1 - x0; + dy = y1 - y0; + +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_LINE + int pix_x; + int pix_y; + int pix_x_unit; + int pix_y_unit; + + pixman_image_t *aa_mask_image; + int alpha_data_buffer; + + pixman_op_t op = PIXMAN_OP_SRC; // _EVAS_RENDER_COPY + if (dc->render_op == _EVAS_RENDER_BLEND) + op = PIXMAN_OP_OVER; + pix_x = x0; + pix_y = y0; + + if (dx < 0) + pix_x_unit = -1; + else + pix_x_unit = 1; + + if (dy < 0) + pix_y_unit = -1; + else + pix_y_unit = 1; +# endif +#endif if (y0 > y1) EXCHANGE_POINTS(x0, y0, x1, y1); + dx = x1 - x0; dy = y1 - y0; - if ( (dx == 0) || (dy == 0) || (dx == dy) || (dx == -dy) ) + if ((dx == 0) || (dy == 0) || (dx == dy) || (dx == -dy)) { _evas_draw_simple_line(dst, dc, x0, y0, x1, y1); return; @@ -609,9 +820,14 @@ _evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x y = (yy >> 16); if (prev_y != y) { - prev_y = y; - p += dh; - py += dely; + prev_y = y; + p += dh; + py += dely; +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_LINE + pix_y += pix_y_unit; +# endif +#endif } if (!p1_in) { @@ -624,39 +840,109 @@ _evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x } if (px < clw) { - aa = ((yy - (y << 16)) >> 8); - if ((py) < clh) - pfunc(0, 255 - aa, color, p); - if ((py + 1) < clh) - pfunc(0, aa, color, p + dstw); - } - - next_x: - yy += dyy; - px++; - p++; + aa = ((yy - (y << 16)) >> 8); + if ((py) < clh) + { +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_LINE + alpha_data_buffer = 255 - aa; + aa_mask_image = pixman_image_create_bits(PIXMAN_a8, 1, 1, + (uint32_t *)&alpha_data_buffer, 4); + + if ((dst->pixman.im) && (dc->col.pixman_color_image ) && + (!dc->mask.mask)) + pixman_image_composite(PIXMAN_OP_OVER, + dc->col.pixman_color_image, + aa_mask_image, dst->pixman.im, + pix_x, pix_y, 0, 0, + pix_x, pix_y, 1, 1); + else if ((dst->pixman.im) && (dc->col.pixman_color_image) && + (dc->mask.mask) ) + pixman_image_composite(op, dc->col.pixman_color_image, + dc->mask.mask->pixman.im, + dst->pixman.im, + pix_x, pix_y, 0, 0, + pix_x, pix_y, 1, 1); + else +# endif +#endif + pfunc(0, 255 - aa, color, p); +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_LINE + pixman_image_unref(aa_mask_image); +# endif +#endif + } + if ((py + 1) < clh) + { +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_LINE + alpha_data_buffer = aa; + aa_mask_image = pixman_image_create_bits(PIXMAN_a8, 1, 1, + (uint32_t *)&alpha_data_buffer, 4); + + if ((dst->pixman.im) && (dc->col.pixman_color_image) && + (!dc->mask.mask)) + pixman_image_composite(PIXMAN_OP_OVER, + dc->col.pixman_color_image, + aa_mask_image, dst->pixman.im, + pix_x, pix_y + 1, 0, 0, + pix_x, pix_y + 1, 1, 1); + else if ((dst->pixman.im) && (dc->col.pixman_color_image) && + (dc->mask.mask)) + pixman_image_composite(op, dc->col.pixman_color_image, + dc->mask.mask->pixman.im, + dst->pixman.im, + pix_x, pix_y + 1, 0, 0, + pix_x, pix_y + 1, 1, 1); + else +# endif +#endif + pfunc(0, aa, color, p + dstw); +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_LINE + pixman_image_unref(aa_mask_image); +# endif +#endif + } + } + +next_x: + yy += dyy; + px++; + p++; +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_LINE + pix_x += pix_x_unit; +# endif +#endif } return; } - + /* steep: y-parametric */ SETUP_LINE_STEEP; while (py < by) { DATA8 aa; - + x = (xx >> 16); if (prev_x != x) { - prev_x = x; - px += delx; - p += delx; + prev_x = x; + px += delx; + p += delx; +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_LINE + pix_x += pix_x_unit; +# endif +#endif } if (!p1_in) { - if ((px < 0) && (delx < 0)) return; - if ((px > rx) && (delx > 0)) return; + if ((px < 0) && (delx < 0)) return; + if ((px > rx) && (delx > 0)) return; } if (!p0_in) { @@ -664,15 +950,80 @@ _evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x } if (py < clh) { - aa = ((xx - (x << 16)) >> 8); - if ((px) < clw) - pfunc(0, 255 - aa, color, p); - if ((px + 1) < clw) - pfunc(0, aa, color, p + 1); - } + aa = ((xx - (x << 16)) >> 8); + if ((px) < clw) + { +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_LINE + alpha_data_buffer = 255 - aa; + aa_mask_image = pixman_image_create_bits(PIXMAN_a8, 1, 1, (uint32_t *)&alpha_data_buffer, 4); + + if ((dst->pixman.im) && (dc->col.pixman_color_image) && + (!dc->mask.mask)) + pixman_image_composite(PIXMAN_OP_OVER, + dc->col.pixman_color_image, + aa_mask_image, dst->pixman.im, + pix_x, pix_y, 0, 0, + pix_x, pix_y, 1, 1); + else if ((dst->pixman.im) && (dc->col.pixman_color_image) && + (dc->mask.mask)) + pixman_image_composite(op, dc->col.pixman_color_image, + dc->mask.mask->pixman.im, + dst->pixman.im, + pix_x, pix_y, 0, 0, + pix_x, pix_y, 1, 1); + else +# endif +#endif + pfunc(0, 255 - aa, color, p); +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_LINE + pixman_image_unref(aa_mask_image); +# endif +#endif + + } + if ((px + 1) < clw) + { +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_LINE + alpha_data_buffer = aa; + aa_mask_image = pixman_image_create_bits(PIXMAN_a8, 1, 1, + (uint32_t *)&alpha_data_buffer, 4); + + if ((dst->pixman.im) && (dc->col.pixman_color_image) && + (!dc->mask.mask)) + pixman_image_composite(PIXMAN_OP_OVER, + dc->col.pixman_color_image, + aa_mask_image, dst->pixman.im, + pix_x + 1, pix_y, 0, 0, + pix_x + 1, pix_y, 1, 1); + else if ((dst->pixman.im) && (dc->col.pixman_color_image) && + (dc->mask.mask)) + pixman_image_composite(op, dc->col.pixman_color_image, + dc->mask.mask->pixman.im, + dst->pixman.im, + pix_x + 1, pix_y, 0, 0, + pix_x + 1, pix_y, 1, 1); + else +# endif +#endif + pfunc(0, aa, color, p + 1); +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_LINE + pixman_image_unref(aa_mask_image); +# endif +#endif + } + } next_y: xx += dxx; py++; p += dstw; +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_LINE + pix_y += pix_y_unit; +# endif +#endif } } -- cgit v1.1