From: Sanghee Park <sh15.park@samsung.com>

Subject: Drawing objects by pixman

        * Extend pixman support to allow other operations to use
          pixman when doing software rendering. On x86 this isn't useful
          but on ARMv7 with NEON pixman happens to do better with image
          blending and nearest scale blending.
        * Add tiled rotator for 32bit display as an option.



SVN revision: 66478
This commit is contained in:
Sanghee Park 2011-12-23 11:50:29 +00:00 committed by Carsten Haitzler
parent bd24931df1
commit 550b8417c7
12 changed files with 1072 additions and 286 deletions

View File

@ -584,3 +584,11 @@
* Fix bug in ico loader that causes crashes (eina_file_close
bug and mis-read of uchar into int).
2011-12-23 Sanghee Park
* Extend pixman support to allow other operations to use
pixman when doing software rendering. On x86 this isn't useful
but on ARMv7 with NEON pixman happens to do better with image
blending and nearest scale blending.
* Add tiled rotator for 32bit display as an option.

View File

@ -404,8 +404,8 @@ fi
# Pixman
have_pixman="no"
AC_ARG_ENABLE([pixman],
AC_HELP_STRING([--disable-pixman],
[disable pixman for software rendering. @<:@default=enabled@:>@]),
AC_HELP_STRING([--enable-pixman],
[enable pixman for software rendering. @<:@default=enabled@:>@]),
[
if test "x${enableval}" = "xyes" ; then
want_pixman="yes"
@ -430,6 +430,69 @@ if test "x${want_pixman}" = "xyes" -o "x${want_pixman}" = "xauto" ; then
])
fi
have_pixman_font="no"
AC_ARG_ENABLE(pixman-font,
AC_HELP_STRING([--enable-pixman-font], [Allow pixman to render fonts]),
[
have_pixman_font="yes"
AC_DEFINE(PIXMAN_FONT, 1, [Allow pixman to render fonts])
]
)
have_pixman_rect="no"
AC_ARG_ENABLE(pixman-rect,
AC_HELP_STRING([--enable-pixman-rect], [Allow pixman to render rects]),
[
have_pixman_rect="yes"
AC_DEFINE(PIXMAN_RECT, 1, [Allow pixman to render rects])
]
)
have_pixman_line="no"
AC_ARG_ENABLE(pixman-line,
AC_HELP_STRING([--enable-pixman-line], [Allow pixman to render lines]),
[
have_pixman_line="yes"
AC_DEFINE(PIXMAN_LINE, 1, [Allow pixman to render lines])
]
)
have_pixman_poly="no"
AC_ARG_ENABLE(pixman-poly,
AC_HELP_STRING([--enable-pixman-poly], [Allow pixman to render polys]),
[
have_pixman_poly="yes"
AC_DEFINE(PIXMAN_POLY, 1, [Allow pixman to render polys])
]
)
have_pixman_image="no"
AC_ARG_ENABLE(pixman-image,
AC_HELP_STRING([--enable-pixman-image], [Allow pixman to render images]),
[
have_pixman_image="yes"
AC_DEFINE(PIXMAN_IMAGE, 1, [Allow pixman to render images])
]
)
have_pixman_image_scale_sample="no"
AC_ARG_ENABLE(pixman-image-scale-sample,
AC_HELP_STRING([--enable-pixman-image-scale-sample], [Allow pixman to render sampled scaled images]),
[
have_pixman_image_scale_sample="yes"
AC_DEFINE(PIXMAN_IMAGE_SCALE_SAMPLE, 1, [Allow pixman to render image sampled scaling])
]
)
have_tile_rotate="no"
AC_ARG_ENABLE(tile-rotate,
AC_HELP_STRING([--enable-tile-rotate], [Enable tiled rotate algorithm]),
[
have_tile_rotate="yes"
AC_DEFINE(TILE_ROTATE, 1, [Enable tiled rotate algorithm])
]
)
### Checks for header files
AC_HEADER_STDC
AC_CHECK_HEADERS([unistd.h stdint.h sys/param.h netinet/in.h sys/mman.h])
@ -2023,6 +2086,16 @@ echo
echo " Word Cache..............: $want_word_cache"
echo " Metric Cache............: $want_metric_cache"
echo
echo " Pixman..................: $have_pixman"
echo " Pixman Fonts............: $have_pixman_font"
echo " Pixman Rects............: $have_pixman_rect"
echo " Pixman Lines............: $have_pixman_line"
echo " Pixman Polygons.........: $have_pixman_poly"
echo " Pixman Images...........: $have_pixman_image"
echo " Pixman Image ScaleSample: $have_pixman_image_scale_sample"
echo
echo " Tiled 32BPP rotate......: $have_tile_rotate"
echo
echo "ARGB Software Engine Options:"
echo " Sampling Scaler.........: $scaler_sample"
echo " Smooth Scaler...........: $scaler_smooth"

View File

@ -48,11 +48,163 @@ evas_common_convert_rgba_to_32bpp_rgb_8888_rot_180 (DATA32 *src, DATA8 *dst, int
#endif
#endif
#ifdef TILE_ROTATE
#define FAST_SIMPLE_ROTATE(suffix, pix_type) \
static void \
blt_rotated_90_trivial_##suffix(pix_type *dst, \
int dst_stride, \
const pix_type *src, \
int src_stride, \
int w, \
int h) \
{ \
int x, y; \
for (y = 0; y < h; y++) \
{ \
const pix_type *s = src + (h - y - 1); \
pix_type *d = dst + (dst_stride * y); \
for (x = 0; x < w; x++) \
{ \
*d++ = *s; \
s += src_stride; \
} \
} \
} \
static void \
blt_rotated_270_trivial_##suffix(pix_type *dst, \
int dst_stride, \
const pix_type *src, \
int src_stride, \
int w, \
int h) \
{ \
int x, y; \
for (y = 0; y < h; y++) \
{ \
const pix_type *s = src + (src_stride * (w - 1)) + y; \
pix_type *d = dst + (dst_stride * y); \
for (x = 0; x < w; x++) \
{ \
*d++ = *s; \
s -= src_stride; \
} \
} \
} \
static void \
blt_rotated_90_##suffix(pix_type *dst, \
int dst_stride, \
const pix_type *src, \
int src_stride, \
int w, \
int h) \
{ \
int x, leading_pixels = 0, trailing_pixels = 0; \
const int TILE_SIZE = TILE_CACHE_LINE_SIZE / sizeof(pix_type); \
if ((uintptr_t)dst & (TILE_CACHE_LINE_SIZE - 1)) \
{ \
leading_pixels = TILE_SIZE - \
(((uintptr_t)dst & (TILE_CACHE_LINE_SIZE - 1)) / sizeof(pix_type)); \
if (leading_pixels > w) \
leading_pixels = w; \
blt_rotated_90_trivial_##suffix(dst, \
dst_stride, \
src, \
src_stride, \
leading_pixels, \
h); \
dst += leading_pixels; \
src += leading_pixels * src_stride; \
w -= leading_pixels; \
} \
if ((uintptr_t)(dst + w) & (TILE_CACHE_LINE_SIZE - 1)) \
{ \
trailing_pixels = (((uintptr_t)(dst + w) & \
(TILE_CACHE_LINE_SIZE - 1)) / sizeof(pix_type)); \
if (trailing_pixels > w) \
trailing_pixels = w; \
w -= trailing_pixels; \
} \
for (x = 0; x < w; x += TILE_SIZE) \
{ \
blt_rotated_90_trivial_##suffix(dst + x, \
dst_stride, \
src + (src_stride * x), \
src_stride, \
TILE_SIZE, \
h); \
} \
if (trailing_pixels) \
blt_rotated_90_trivial_##suffix(dst + w, \
dst_stride, \
src + (w * src_stride), \
src_stride, \
trailing_pixels, \
h); \
} \
static void \
blt_rotated_270_##suffix(pix_type *dst, \
int dst_stride, \
const pix_type *src, \
int src_stride, \
int w, \
int h) \
{ \
int x, leading_pixels = 0, trailing_pixels = 0; \
const int TILE_SIZE = TILE_CACHE_LINE_SIZE / sizeof(pix_type); \
if ((uintptr_t)dst & (TILE_CACHE_LINE_SIZE - 1)) \
{ \
leading_pixels = TILE_SIZE - \
(((uintptr_t)dst & (TILE_CACHE_LINE_SIZE - 1)) / sizeof(pix_type)); \
if (leading_pixels > w) \
leading_pixels = w; \
blt_rotated_270_trivial_##suffix(dst, \
dst_stride, \
src + (src_stride * (w - leading_pixels)), \
src_stride, \
leading_pixels, \
h); \
dst += leading_pixels; \
w -= leading_pixels; \
} \
if ((uintptr_t)(dst + w) & (TILE_CACHE_LINE_SIZE - 1)) \
{ \
trailing_pixels = (((uintptr_t)(dst + w) & \
(TILE_CACHE_LINE_SIZE - 1)) / sizeof(pix_type)); \
if (trailing_pixels > w) \
trailing_pixels = w; \
w -= trailing_pixels; \
src += trailing_pixels * src_stride; \
} \
for (x = 0; x < w; x += TILE_SIZE) \
{ \
blt_rotated_270_trivial_##suffix(dst + x, \
dst_stride, \
src + (src_stride * (w - x - TILE_SIZE)), \
src_stride, \
TILE_SIZE, \
h); \
} \
if (trailing_pixels) \
blt_rotated_270_trivial_##suffix(dst + w, \
dst_stride, \
src - (trailing_pixels * src_stride), \
src_stride, \
trailing_pixels, \
h); \
}
FAST_SIMPLE_ROTATE(8888, DATA8)
#endif
#ifdef BUILD_CONVERT_32_RGB_8888
#ifdef BUILD_CONVERT_32_RGB_ROT270
void
evas_common_convert_rgba_to_32bpp_rgb_8888_rot_270 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x __UNUSED__, int dith_y __UNUSED__, DATA8 *pal __UNUSED__)
{
#ifdef TILE_ROTATE
blt_rotated_270_8888((DATA8 *)dst, dst_jump+w, (const DATA8 *)src, src_jump+h, w, h) ;
#else
DATA32 *src_ptr;
DATA32 *dst_ptr;
int x, y;
@ -64,6 +216,7 @@ evas_common_convert_rgba_to_32bpp_rgb_8888_rot_270 (DATA32 *src, DATA8 *dst, int
*dst_ptr = *src_ptr;
CONVERT_LOOP_END_ROT_270();
#endif
return;
}
#endif
@ -75,6 +228,9 @@ void
evas_common_convert_rgba_to_32bpp_rgb_8888_rot_90 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x __UNUSED__, int dith_y __UNUSED__, DATA8 *pal __UNUSED__)
{
# ifndef BUILD_NEON
# ifdef TILE_ROTATE
blt_rotated_90_8888((DATA8 *)dst, dst_jump+w, (const DATA8 *)src, src_jump+h, w, h) ;
# else
DATA32 *src_ptr;
DATA32 *dst_ptr;
int x, y;
@ -85,6 +241,12 @@ evas_common_convert_rgba_to_32bpp_rgb_8888_rot_90 (DATA32 *src, DATA8 *dst, int
*dst_ptr = *src_ptr;
CONVERT_LOOP_END_ROT_90();
# endif
# else
# ifdef TILE_ROTATE
blt_rotated_90_8888((DATA8 *)dst, dst_jump+w, (const DATA8 *)src, src_jump+h, w, h) ;
# else
if ((w & 1) || (h & 1))
{
@ -99,7 +261,9 @@ evas_common_convert_rgba_to_32bpp_rgb_8888_rot_90 (DATA32 *src, DATA8 *dst, int
*dst_ptr = *src_ptr;
CONVERT_LOOP_END_ROT_90();
} else {
}
else
{
# define AP "convert_rgba32_rot_90_"
asm volatile (
".fpu neon \n\t"
@ -173,6 +337,7 @@ evas_common_convert_rgba_to_32bpp_rgb_8888_rot_90 (DATA32 *src, DATA8 *dst, int
);
}
# undef AP
# endif
# endif
return;
}

View File

@ -75,6 +75,14 @@ evas_common_draw_context_free(RGBA_Draw_Context *dc)
{
if (!dc) return;
#ifdef HAVE_PIXMAN
if (dc->col.pixman_color_image)
{
pixman_image_unref(dc->col.pixman_color_image);
dc->col.pixman_color_image = NULL;
}
#endif
evas_common_draw_context_apply_clean_cutouts(&dc->cutout);
free(dc);
}
@ -133,6 +141,20 @@ evas_common_draw_context_set_color(RGBA_Draw_Context *dc, int r, int g, int b, i
G_VAL(&(dc->col.col)) = (DATA8)g;
B_VAL(&(dc->col.col)) = (DATA8)b;
A_VAL(&(dc->col.col)) = (DATA8)a;
#ifdef HAVE_PIXMAN
if (dc && dc->col.pixman_color_image)
pixman_image_unref(dc->col.pixman_color_image);
pixman_color_t pixman_color;
pixman_color.alpha = (dc->col.col & 0xff000000) >> 16;
pixman_color.red = (dc->col.col & 0x00ff0000) >> 8;
pixman_color.green = (dc->col.col & 0x0000ff00);
pixman_color.blue = (dc->col.col & 0x000000ff) << 8;
dc->col.pixman_color_image = pixman_image_create_solid_fill(&pixman_color);
#endif
}
EAPI void
@ -159,12 +181,42 @@ evas_common_draw_context_set_mask(RGBA_Draw_Context *dc, RGBA_Image *mask, int x
dc->mask.y = y;
dc->mask.w = w;
dc->mask.h = h;
#ifdef HAVE_PIXMAN
if (mask->pixman.im)
pixman_image_unref(mask->pixman.im);
if (mask->cache_entry.flags.alpha)
{
mask->pixman.im = pixman_image_create_bits(PIXMAN_a8r8g8b8, w, h,
(uint32_t *)mask->mask.mask,
w * 4);
}
else
{
mask->pixman.im = pixman_image_create_bits(PIXMAN_x8r8g8b8, w, h,
(uint32_t *)mask->mask.mask,
w * 4);
}
#endif
}
EAPI void
evas_common_draw_context_unset_mask(RGBA_Draw_Context *dc)
{
dc->mask.mask = NULL;
#ifdef HAVE_PIXMAN
RGBA_Image *mask;
mask = (RGBA_Image *)dc->mask.mask;
if (mask && mask->pixman.im)
{
pixman_image_unref(mask->pixman.im);
mask->pixman.im = NULL;
}
#endif
}

View File

@ -248,6 +248,25 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font
&& (fg->glyph_out->bitmap.num_grays == 256)
)
*/
#ifdef HAVE_PIXMAN
# ifdef PIXMAN_FONT
int index;
DATA32 *font_alpha_buffer;
pixman_image_t *font_mask_image;
font_alpha_buffer = alloca(w * h * sizeof(DATA32));
for (index = 0; index < (w * h); index++)
font_alpha_buffer[index] = data[index] << 24;
font_mask_image = pixman_image_create_bits(PIXMAN_a8r8g8b8, w, h,
font_alpha_buffer,
w * sizeof(DATA32));
if (!font_mask_image) return;
# endif
#endif
{
if ((j > 0) && (chr_x + w > ext_x))
{
@ -264,6 +283,24 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font
if ((fg->glyph_out->bitmap.num_grays == 256) &&
(fg->glyph_out->bitmap.pixel_mode == FT_PIXEL_MODE_GRAY))
{
#ifdef HAVE_PIXMAN
# ifdef PIXMAN_FONT
if ((dst->pixman.im) &&
(dc->col.pixman_color_image))
pixman_image_composite(PIXMAN_OP_OVER,
dc->col.pixman_color_image,
font_mask_image,
dst->pixman.im,
chr_x,
y - (chr_y - y),
0, 0,
chr_x,
y - (chr_y - y),
w, h);
else
# endif
#endif
{
for (i = 0; i < h; i++)
{
int dx, dy;
@ -298,6 +335,7 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font
}
}
}
}
else
{
DATA8 *tmpbuf = NULL, *dp, *tp, bits;
@ -356,6 +394,11 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font
}
}
}
#ifdef HAVE_PIXMAN
# ifdef PIXMAN_FONT
pixman_image_unref(font_mask_image);
# endif
#endif
}
else
break;

View File

@ -266,6 +266,7 @@ void
_evas_common_rgba_image_post_surface(Image_Entry *ie)
{
#ifdef HAVE_PIXMAN
# ifdef PIXMAN_IMAGE
RGBA_Image *im = (RGBA_Image *)ie;
if (im->pixman.im) pixman_image_unref(im->pixman.im);
@ -296,6 +297,9 @@ _evas_common_rgba_image_post_surface(Image_Entry *ie)
# else
ie = NULL;
# endif
#else
ie = NULL;
#endif
}
static int
@ -338,11 +342,13 @@ _evas_common_rgba_image_surface_delete(Image_Entry *ie)
RGBA_Image *im = (RGBA_Image *) ie;
#ifdef HAVE_PIXMAN
# ifdef PIXMAN_IMAGE
if (im->pixman.im)
{
pixman_image_unref(im->pixman.im);
im->pixman.im = NULL;
}
# endif
#endif
if (ie->file)
DBG("unload: [%p] %s %s", ie, ie->file, ie->key);

View File

@ -109,10 +109,25 @@ _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;
#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);
}
}
/*
these functions use the dc->clip data as bounding
@ -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,11 +195,29 @@ _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;
#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;
}
@ -192,6 +233,22 @@ _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;
#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
@ -203,6 +260,7 @@ _evas_draw_simple_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, i
p += dstw;
}
}
}
return;
}
@ -281,6 +339,14 @@ _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--)
{
@ -288,8 +354,36 @@ _evas_draw_simple_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, i
if (((y1 + 1 - len) % dc->sli.h) == dc->sli.y)
#endif
{
#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))
{
#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;
}
@ -532,6 +681,11 @@ _evas_draw_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1,
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))
{
#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
}
}
@ -564,12 +744,43 @@ _evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x
int dx, dy, rx, by, p0_in, p1_in, dh, a_a = 1;
int delx, dely, xx, yy, dxx, dyy;
int clx, cly, clw, clh;
int dstw;
int dstw, dsth;
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;
@ -590,6 +801,7 @@ _evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x
data = evas_cache_image_pixels(&dst->cache_entry);
dstw = dst->cache_entry.w;
dsth = dst->cache_entry.h;
data += (dstw * cly) + clx;
x0 -= clx;
@ -612,6 +824,11 @@ _evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x
prev_y = y;
p += dh;
py += dely;
#ifdef HAVE_PIXMAN
# ifdef PIXMAN_LINE
pix_y += pix_y_unit;
# endif
#endif
}
if (!p1_in)
{
@ -626,15 +843,80 @@ _evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x
{
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;
}
@ -652,6 +934,11 @@ _evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x
prev_x = x;
px += delx;
p += delx;
#ifdef HAVE_PIXMAN
# ifdef PIXMAN_LINE
pix_x += pix_x_unit;
# endif
#endif
}
if (!p1_in)
{
@ -666,13 +953,78 @@ _evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x
{
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
}
}

View File

@ -133,6 +133,14 @@ evas_common_polygon_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Polygon_Po
int ext_x, ext_y, ext_w, ext_h;
int *sorted_index;
#ifdef HAVE_PIXMAN
# ifdef PIXMAN_POLY
pixman_op_t op = PIXMAN_OP_SRC; // _EVAS_RENDER_COPY
if (dc->render_op == _EVAS_RENDER_BLEND)
op = PIXMAN_OP_OVER;
# endif
#endif
ext_x = 0;
ext_y = 0;
ext_w = dst->cache_entry.w;
@ -277,12 +285,32 @@ evas_common_polygon_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Polygon_Po
#ifdef EVAS_SLI
if (((span->y) % dc->sli.h) == dc->sli.y)
#endif
{
#ifdef HAVE_PIXMAN
# ifdef PIXMAN_POLY
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,
span->x, span->y, 0, 0,
span->x, span->y, span->w, 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,
span->x, span->y, 0, 0,
span->x, span->y, span->w, 1);
else
# endif
#endif
{
ptr = dst->image.data + (span->y * (dst->cache_entry.w)) + span->x;
func(NULL, NULL, dc->col.col, ptr, span->w);
}
}
}
while (spans)
{
span = (RGBA_Span *)spans;

View File

@ -58,6 +58,23 @@ rectangle_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, in
RECTS_CLIP_TO_RECT(x, y, w, h, dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h);
if ((w <= 0) || (h <= 0)) return;
#ifdef HAVE_PIXMAN
# ifdef PIXMAN_RECT
pixman_op_t op = PIXMAN_OP_SRC; // _EVAS_RENDER_COPY
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, w, h);
}
else
# endif
#endif
{
func = evas_common_gfx_func_composite_color_span_get(dc->col.col, dst, w, dc->render_op);
ptr = dst->image.data + (y * dst->cache_entry.w) + x;
for (yy = 0; yy < h; yy++)
@ -71,3 +88,4 @@ rectangle_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, in
ptr += dst->cache_entry.w;
}
}
}

View File

@ -276,16 +276,17 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
if ((dst_region_w == src_region_w) && (dst_region_h == src_region_h))
{
#ifdef HAVE_PIXMAN
if ((1) &&
(src->pixman.im) && (dst->pixman.im) &&
# ifdef PIXMAN_IMAGE_SCALE_SAMPLE
if ((src->pixman.im) && (dst->pixman.im) && (!dc->mask.mask) &&
((!dc->mul.use) ||
((dc->mul.use) && (dc->mul.col == 0xffffffff))) &&
((dc->render_op == _EVAS_RENDER_COPY) ||
(dc->render_op == _EVAS_RENDER_BLEND))
)
(dc->render_op == _EVAS_RENDER_BLEND)))
{
pixman_op_t op = PIXMAN_OP_SRC; // _EVAS_RENDER_COPY
if (dc->render_op == _EVAS_RENDER_BLEND) op = PIXMAN_OP_OVER;
if (dc->render_op == _EVAS_RENDER_BLEND)
op = PIXMAN_OP_OVER;
pixman_image_composite(op,
src->pixman.im, NULL,
dst->pixman.im,
@ -295,7 +296,27 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
dst_clip_x, dst_clip_y,
dst_clip_w, dst_clip_h);
}
else if ((src->pixman.im) && (dst->pixman.im) &&
(dc->mask.mask) && (dc->mask.mask->pixman.im) &&
((dc->render_op == _EVAS_RENDER_COPY) ||
(dc->render_op == _EVAS_RENDER_BLEND)))
{
// In case of pixel and color operation.
pixman_op_t op = PIXMAN_OP_SRC; // _EVAS_RENDER_COPY
if (dc->render_op == _EVAS_RENDER_BLEND)
op = PIXMAN_OP_OVER;
pixman_image_composite(op,
src->pixman.im, dc->mask.mask->pixman.im,
dst->pixman.im,
(dst_clip_x - dst_region_x) + src_region_x,
(dst_clip_y - dst_region_y) + src_region_y,
0, 0,
dst_clip_x, dst_clip_y,
dst_clip_w, dst_clip_h);
}
else
# endif
#endif
{
ptr = src_data + ((dst_clip_y - dst_region_y + src_region_y) * src_w) + (dst_clip_x - dst_region_x) + src_region_x;

View File

@ -1,9 +1,9 @@
#ifndef EVAS_COMMON_H
#define EVAS_COMMON_H
#ifdef HAVE_CONFIG_H
//#ifdef HAVE_CONFIG_H
#include "config.h" /* so that EAPI in Evas.h is correctly defined */
#endif
//#endif
#ifdef HAVE_EVIL
# include <Evil.h>
@ -322,6 +322,21 @@ void *alloca (size_t);
#define pld(addr, off)
#endif /* __ARMEL__ */
// these here are in config.h - just here for documentation
//#ifdef __ARM_ARCH__
// *IF* you enable pixman, this determines which things pixman will do
////#define PIXMAN_FONT 1
////#define PIXMAN_RECT 1
////#define PIXMAN_LINE 1
////#define PIXMAN_POLY 1
//#define PIXMAN_IMAGE 1
//#define PIXMAN_IMAGE_SCALE_SAMPLE 1
//#endif
// not related to pixman but an alternate rotate code
//#define TILE_ROTATE 1
#define TILE_CACHE_LINE_SIZE 64
/*****************************************************************************/
#define UNROLL2(op...) op op
@ -662,6 +677,9 @@ struct _RGBA_Draw_Context
DATA32 col;
} mul;
struct {
#ifdef HAVE_PIXMAN
pixman_image_t *pixman_color_image;
#endif
DATA32 col;
} col;
struct RGBA_Draw_Context_clip {

View File

@ -579,6 +579,8 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
free(obr);
return NULL;
}
im->cache_entry.w = w;
im->cache_entry.h = h;
im->cache_entry.flags.alpha |= alpha ? 1 : 0;
evas_cache_image_surface_alloc(&im->cache_entry, w, h);
im->extended_info = obr;