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,15 +48,167 @@ 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;
dst_ptr = (DATA32 *)dst;
CONVERT_LOOP_START_ROT_270();
@ -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
@ -74,106 +227,118 @@ evas_common_convert_rgba_to_32bpp_rgb_8888_rot_270 (DATA32 *src, DATA8 *dst, int
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
# 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;
dst_ptr = (DATA32 *)dst;
CONVERT_LOOP_START_ROT_90();
*dst_ptr = *src_ptr;
CONVERT_LOOP_END_ROT_90();
#else
# 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))
{
/* Rarely (if ever) if ever: so slow path is fine */
DATA32 *src_ptr;
DATA32 *dst_ptr;
int x, y;
/* Rarely (if ever) if ever: so slow path is fine */
DATA32 *src_ptr;
DATA32 *dst_ptr;
int x, y;
dst_ptr = (DATA32 *)dst;
CONVERT_LOOP_START_ROT_90();
dst_ptr = (DATA32 *)dst;
CONVERT_LOOP_START_ROT_90();
*dst_ptr = *src_ptr;
*dst_ptr = *src_ptr;
CONVERT_LOOP_END_ROT_90();
} else {
#define AP "convert_rgba32_rot_90_"
asm volatile (
".fpu neon \n\t"
" mov %[s1], %[src] \n\t"
" add %[s1], %[s1], %[h],lsl #2 \n\t"
" sub %[s1], #8 \n\t"
CONVERT_LOOP_END_ROT_90();
}
else
{
# define AP "convert_rgba32_rot_90_"
asm volatile (
".fpu neon \n\t"
" mov %[s1], %[src] \n\t"
" add %[s1], %[s1], %[h],lsl #2 \n\t"
" sub %[s1], #8 \n\t"
" mov %[s2], %[src] \n\t"
" add %[s2], %[s2], %[h], lsl #3 \n\t"
" add %[s2], %[s2], %[sjmp], lsr #1 \n\t"
" sub %[s2], #8 \n\t"
" mov %[s2], %[src] \n\t"
" add %[s2], %[s2], %[h], lsl #3 \n\t"
" add %[s2], %[s2], %[sjmp], lsr #1 \n\t"
" sub %[s2], #8 \n\t"
" mov %[d1], %[dst] \n\t"
" mov %[d1], %[dst] \n\t"
" add %[d2], %[d1], %[djmp] \n\t"
" add %[d2], %[d2], %[w], lsl #2 \n\t"
" add %[d2], %[d1], %[djmp] \n\t"
" add %[d2], %[d2], %[w], lsl #2 \n\t"
" mov %[sadv], %[h], lsl #3 \n\t"
" add %[sadv], %[sadv], %[sjmp], lsl #1\n\t"
" mov %[sadv], %[h], lsl #3 \n\t"
" add %[sadv], %[sadv], %[sjmp], lsl #1\n\t"
" mov %[y], #0 \n\t"
" mov %[x], #0 \n\t"
AP"loop: \n\t"
" vld1.u32 d0, [%[s1]] \n\t"
" vld1.u32 d1, [%[s2]] \n\t"
" add %[x], #2 \n\t"
" add %[s1], %[sadv] \n\t"
" add %[s2], %[sadv] \n\t"
" vtrn.u32 d0, d1 \n\t"
" cmp %[x], %[w] \n\t"
" vst1.u32 d1, [%[d1]]! \n\t"
" vst1.u32 d0, [%[d2]]! \n\t"
" blt "AP"loop \n\t"
" mov %[y], #0 \n\t"
" mov %[x], #0 \n\t"
AP"loop: \n\t"
" vld1.u32 d0, [%[s1]] \n\t"
" vld1.u32 d1, [%[s2]] \n\t"
" add %[x], #2 \n\t"
" add %[s1], %[sadv] \n\t"
" add %[s2], %[sadv] \n\t"
" vtrn.u32 d0, d1 \n\t"
" cmp %[x], %[w] \n\t"
" vst1.u32 d1, [%[d1]]! \n\t"
" vst1.u32 d0, [%[d2]]! \n\t"
" blt "AP"loop \n\t"
" mov %[x], #0 \n\t"
" add %[d1], %[djmp] \n\t"
" add %[d1], %[d1], %[w], lsl #2 \n\t"
" add %[d2], %[djmp] \n\t"
" add %[d2], %[d2], %[w], lsl #2 \n\t"
" mov %[x], #0 \n\t"
" add %[d1], %[djmp] \n\t"
" add %[d1], %[d1], %[w], lsl #2 \n\t"
" add %[d2], %[djmp] \n\t"
" add %[d2], %[d2], %[w], lsl #2 \n\t"
" mov %[s1], %[src] \n\t"
" add %[s1], %[s1], %[h], lsl #2 \n\t"
" sub %[s1], %[s1], %[y], lsl #2 \n\t"
" sub %[s1], #16 \n\t"
" mov %[s1], %[src] \n\t"
" add %[s1], %[s1], %[h], lsl #2 \n\t"
" sub %[s1], %[s1], %[y], lsl #2 \n\t"
" sub %[s1], #16 \n\t"
" add %[s2], %[s1], %[h], lsl #2 \n\t"
" add %[s2], %[s2], %[sjmp], lsl #2 \n\t"
" add %[s2], %[s1], %[h], lsl #2 \n\t"
" add %[s2], %[s2], %[sjmp], lsl #2 \n\t"
" add %[y], #2 \n\t"
" add %[y], #2 \n\t"
" cmp %[y], %[h] \n\t"
" blt "AP"loop \n\t"
" cmp %[y], %[h] \n\t"
" blt "AP"loop \n\t"
: // Out
: [s1] "r" (1),
[s2] "r" (11),
[d1] "r" (2),
[d2] "r" (12),
[src] "r" (src),
[dst] "r" (dst),
[x] "r" (3),
[y] "r" (4),
[w] "r" (w),
[h] "r" (h),
[sadv] "r" (5),
[sjmp] "r" (src_jump * 4),
[djmp] "r" (dst_jump * 4 * 2)
: "d0", "d1", "memory", "cc"// Clober
: // Out
: [s1] "r" (1),
[s2] "r" (11),
[d1] "r" (2),
[d2] "r" (12),
[src] "r" (src),
[dst] "r" (dst),
[x] "r" (3),
[y] "r" (4),
[w] "r" (w),
[h] "r" (h),
[sadv] "r" (5),
[sjmp] "r" (src_jump * 4),
[djmp] "r" (dst_jump * 4 * 2)
: "d0", "d1", "memory", "cc"// Clober
);
}
#undef AP
#endif
);
}
# undef AP
# endif
# endif
return;
}
#endif
@ -448,7 +613,7 @@ evas_common_convert_rgba_to_32bpp_rgb_666(DATA32 *src, DATA8 *dst, int src_jump,
CONVERT_LOOP_START_ROT_0();
*dst_ptr =
*dst_ptr =
(((R_VAL(src_ptr) << 12) | (B_VAL(src_ptr) >> 2)) & 0x03f03f) |
((G_VAL(src_ptr) << 4) & 0x000fc0);

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
}
@ -179,32 +231,32 @@ evas_common_draw_context_add_cutout(RGBA_Draw_Context *dc, int x, int y, int w,
{
#if 1 // this is a bit faster
int xa1, xa2, xb1, xb2;
xa1 = x;
xa2 = xa1 + w - 1;
xb1 = dc->clip.x;
if (xa2 < xb1) return;
xb2 = xb1 + dc->clip.w - 1;
if (xa1 >= xb2) return;
if (xa2 > xb2) xa2 = xb2;
if (xa2 > xb2) xa2 = xb2;
if (xb1 > xa1) xa1 = xb1;
x = xa1;
w = xa2 - xa1 + 1;
xa1 = y;
xa2 = xa1 + h - 1;
xb1 = dc->clip.y;
if (xa2 < xb1) return;
xb2 = xb1 + dc->clip.h - 1;
xb2 = xb1 + dc->clip.h - 1;
if (xa1 >= xb2) return;
if (xa2 > xb2) xa2 = xb2;
if (xa2 > xb2) xa2 = xb2;
if (xb1 > xa1) xa1 = xb1;
y = xa1;
h = xa2 - xa1 + 1;
#else
#else
RECTS_CLIP_TO_RECT(x, y, w, h,
dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h);
#endif
#endif
if ((w < 1) || (h < 1)) return;
}
evas_common_draw_context_cutouts_add(&dc->cutout, x, y, w, h);
@ -513,7 +565,7 @@ evas_common_draw_context_apply_cutouts(RGBA_Draw_Context *dc)
if (!dc->clip.use) return NULL;
if ((dc->clip.w <= 0) || (dc->clip.h <= 0)) return NULL;
res = evas_common_draw_context_cutouts_new();
evas_common_draw_context_cutouts_add(res, dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h);

View File

@ -22,7 +22,7 @@
static int max_cached_words = WORD_CACHE_NWORDS;
struct prword
struct prword
{
EINA_INLIST;
struct cinfo *cinfo;
@ -34,16 +34,16 @@ struct prword
int baseline;
};
struct cinfo
struct cinfo
{
FT_UInt index;
struct
struct
{
int x, y;
} pos;
int posx;
RGBA_Font_Glyph *fg;
struct
struct
{
int w,h;
int rows;
@ -77,11 +77,11 @@ evas_common_font_draw_init(void)
#ifdef EVAS_FRAME_QUEUING
EAPI void
evas_common_font_draw_finish(void)
{
{
}
#endif
/*
/*
* BiDi handling: We receive the shaped string + other props from text_props,
* we need to reorder it so we'll have the visual string (the way we draw)
* and then for kerning we have to switch the order of the kerning query (as the prev
@ -89,7 +89,7 @@ evas_common_font_draw_finish(void)
*/
static void
evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font *fn __UNUSED__, int x, int y,
const Evas_Text_Props *text_props, RGBA_Gfx_Func func, int ext_x, int ext_y, int ext_w,
const Evas_Text_Props *text_props, RGBA_Gfx_Func func, int ext_x, int ext_y, int ext_w,
int ext_h, int im_w, int im_h __UNUSED__)
{
DATA32 *im;
@ -136,7 +136,7 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font
{
xrun -= x + xrun - ext_x - ext_w;
}
if (x < ext_x)
if (x < ext_x)
{
int excess = ext_x - x;
xstart = excess - 1;
@ -244,10 +244,29 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font
if (j < w) j = w;
h = fg->glyph_out->bitmap.rows;
/*
if ((fg->glyph_out->bitmap.pixel_mode == ft_pixel_mode_grays)
&& (fg->glyph_out->bitmap.num_grays == 256)
)
*/
if ((fg->glyph_out->bitmap.pixel_mode == ft_pixel_mode_grays)
&& (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))
{
@ -255,44 +274,63 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font
{
/* ext glyph draw */
dc->font_ext.func.gl_draw(dc->font_ext.data,
(void *)dst,
dc, fg, chr_x,
y - (chr_y - y));
(void *)dst,
dc, fg, chr_x,
y - (chr_y - y));
}
else
{
if ((fg->glyph_out->bitmap.num_grays == 256) &&
(fg->glyph_out->bitmap.pixel_mode == FT_PIXEL_MODE_GRAY))
(fg->glyph_out->bitmap.pixel_mode == FT_PIXEL_MODE_GRAY))
{
for (i = 0; i < h; i++)
{
int dx, dy;
int in_x, in_w;
in_x = 0;
in_w = 0;
dx = chr_x;
dy = y - (chr_y - i - y);
#ifdef EVAS_SLI
if (((dy) % dc->sli.h) == dc->sli.y)
#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++)
{
if ((dx < (ext_x + ext_w)) &&
(dy >= (ext_y)) &&
(dy < (ext_y + ext_h)))
int dx, dy;
int in_x, in_w;
in_x = 0;
in_w = 0;
dx = chr_x;
dy = y - (chr_y - i - y);
#ifdef EVAS_SLI
if (((dy) % dc->sli.h) == dc->sli.y)
#endif
{
if (dx + w > (ext_x + ext_w))
in_w += (dx + w) - (ext_x + ext_w);
if (dx < ext_x)
if ((dx < (ext_x + ext_w)) &&
(dy >= (ext_y)) &&
(dy < (ext_y + ext_h)))
{
in_w += ext_x - dx;
in_x = ext_x - dx;
dx = ext_x;
}
if (in_w < w)
{
func(NULL, data + (i * j) + in_x, dc->col.col,
im + (dy * im_w) + dx, w - in_w);
if (dx + w > (ext_x + ext_w))
in_w += (dx + w) - (ext_x + ext_w);
if (dx < ext_x)
{
in_w += ext_x - dx;
in_x = ext_x - dx;
dx = ext_x;
}
if (in_w < w)
{
func(NULL, data + (i * j) + in_x, dc->col.col,
im + (dy * im_w) + dx, w - in_w);
}
}
}
}
@ -309,7 +347,7 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font
{
int dx, dy;
int in_x, in_w, end;
in_x = 0;
in_w = 0;
dx = chr_x;
@ -333,8 +371,8 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font
dp++;
}
if ((dx < (ext_x + ext_w)) &&
(dy >= (ext_y)) &&
(dy < (ext_y + ext_h)))
(dy >= (ext_y)) &&
(dy < (ext_y + ext_h)))
{
if (dx + w > (ext_x + ext_w))
in_w += (dx + w) - (ext_x + ext_w);
@ -347,7 +385,7 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font
if (in_w < w)
{
func(NULL, tmpbuf + in_x, dc->col.col,
im + (dy * im_w) + dx, w - in_w);
im + (dy * im_w) + dx, w - in_w);
}
}
}
@ -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;
@ -573,7 +616,7 @@ evas_font_word_prerender(RGBA_Draw_Context *dc, const Evas_Text_Props *text_prop
}
}
}
else
else
{
im = NULL;
}
@ -599,7 +642,7 @@ evas_font_word_prerender(RGBA_Draw_Context *dc, const Evas_Text_Props *text_prop
{
struct prword *last = (struct prword *)(words->last);
if (last)
if (last)
{
if (last->im) free(last->im);
if (last->cinfo) free(last->cinfo);

View File

@ -145,7 +145,7 @@ _evas_common_rgba_image_new(void)
#endif
evas_common_rgba_image_scalecache_init(&im->cache_entry);
return &im->cache_entry;
}
@ -161,7 +161,7 @@ _evas_common_rgba_image_delete(Image_Entry *ie)
LKD(im->cache_entry.ref_fq_del);
eina_condition_free(&(im->cache_entry.cond_fq_del));
# endif
#endif
#endif
evas_common_rgba_image_scalecache_shutdown(&im->cache_entry);
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
@ -173,13 +173,13 @@ _evas_common_rgba_image_delete(Image_Entry *ie)
// memset(im, 0x99, sizeof(im));
#ifdef EVAS_CSERVE
if (ie->data1) evas_cserve_image_free(ie);
#endif
#endif
/*
* FIXME: This doesn't seem to be needed... But I'm not sure why.
* -- nash
{
Filtered_Image *fi;
EINA_LIST_FREE(im->filtered, fi)
{
free(fi->key);
@ -249,8 +249,8 @@ evas_common_rgba_image_unload(Image_Entry *ie)
#endif
return;
}
#endif
#endif
if (im->image.data && !im->image.no_free)
free(im->image.data);
im->image.data = NULL;
@ -266,18 +266,19 @@ void
_evas_common_rgba_image_post_surface(Image_Entry *ie)
{
#ifdef HAVE_PIXMAN
RGBA_Image *im = (RGBA_Image *) ie;
# ifdef PIXMAN_IMAGE
RGBA_Image *im = (RGBA_Image *)ie;
if (im->pixman.im) pixman_image_unref(im->pixman.im);
if (im->cache_entry.flags.alpha)
{
im->pixman.im = pixman_image_create_bits
(
// FIXME: endianess determines this
// FIXME: endianess determines this
PIXMAN_a8r8g8b8,
// PIXMAN_b8g8r8a8,
// PIXMAN_b8g8r8a8,
im->cache_entry.w, im->cache_entry.h,
im->image.data,
im->image.data,
im->cache_entry.w * 4
);
}
@ -285,14 +286,17 @@ _evas_common_rgba_image_post_surface(Image_Entry *ie)
{
im->pixman.im = pixman_image_create_bits
(
// FIXME: endianess determines this
// FIXME: endianess determines this
PIXMAN_x8r8g8b8,
// PIXMAN_b8g8r8x8,
im->cache_entry.w, im->cache_entry.h,
im->image.data,
im->image.data,
im->cache_entry.w * 4
);
}
# else
ie = NULL;
# endif
#else
ie = NULL;
#endif
@ -306,7 +310,7 @@ _evas_common_rgba_image_surface_alloc(Image_Entry *ie, unsigned int w, unsigned
#ifdef EVAS_CSERVE
if (ie->data1) return 0;
#endif
#endif
if (im->image.no_free) return 0;
if (im->flags & RGBA_IMAGE_ALPHA_ONLY)
@ -328,7 +332,7 @@ _evas_common_rgba_image_surface_alloc(Image_Entry *ie, unsigned int w, unsigned
# endif
#endif
_evas_common_rgba_image_post_surface(ie);
return 0;
}
@ -338,12 +342,14 @@ _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
#endif
if (ie->file)
DBG("unload: [%p] %s %s", ie, ie->file, ie->key);
if ((im->cs.data) && (im->image.data))
@ -364,7 +370,7 @@ _evas_common_rgba_image_surface_delete(Image_Entry *ie)
#ifdef EVAS_CSERVE
else if (ie->data1)
evas_cserve_image_free(ie);
#endif
#endif
im->image.data = NULL;
ie->allocated.w = 0;
@ -391,7 +397,7 @@ _evas_common_rgba_image_dirty_region(Image_Entry* ie, unsigned int x __UNUSED__,
#ifdef EVAS_CSERVE
if (ie->data1) evas_cserve_image_free(ie);
#endif
#endif
im->flags |= RGBA_IMAGE_IS_DIRTY;
evas_common_rgba_image_scalecache_dirty(&im->cache_entry);
}
@ -411,13 +417,13 @@ _evas_common_rgba_image_dirty(Image_Entry *ie_dst, const Image_Entry *ie_src)
{
#ifdef EVAS_CSERVE
if (ie_src->data1) evas_cserve_image_free((Image_Entry*) ie_src);
#endif
#endif
return 1;
}
#ifdef EVAS_CSERVE
if (ie_src->data1) evas_cserve_image_free((Image_Entry*) ie_src);
#endif
#endif
evas_common_image_colorspace_normalize(src);
evas_common_image_colorspace_normalize(dst);
/* evas_common_blit_rectangle(src, dst, 0, 0, src->cache_entry.w, src->cache_entry.h, 0, 0); */
@ -431,18 +437,18 @@ _evas_common_rgba_image_ram_usage(Image_Entry *ie)
{
RGBA_Image *im = (RGBA_Image *)ie;
int size = sizeof(struct _RGBA_Image);
if (ie->cache_key) size += strlen(ie->cache_key);
if (ie->file) size += strlen(ie->file);
if (ie->key) size += strlen(ie->key);
if (im->image.data)
{
#ifdef EVAS_CSERVE
if ((!im->image.no_free) || (ie->data1))
#else
if ((!im->image.no_free))
#endif
#endif
size += im->cache_entry.w * im->cache_entry.h * sizeof(DATA32);
}
size += evas_common_rgba_image_scalecache_usage_get(&im->cache_entry);
@ -590,7 +596,7 @@ evas_common_image_colorspace_normalize(RGBA_Image *im)
{
#ifdef EVAS_CSERVE
if (((Image_Entry *)im)->data1) evas_cserve_image_free(&im->cache_entry);
#endif
#endif
if (!im->image.no_free) free(im->image.data);
im->image.data = im->cs.data;
im->cs.no_free = im->image.no_free;

View File

@ -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 EVAS_SLI
if (((y1 + 1 - len) % dc->sli.h) == dc->sli.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,
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
{
pfunc(0, 255, color, p);
}
p += dstw;
}
}
{
while (len--)
{
#ifdef EVAS_SLI
if (((y1 + 1 - len) % dc->sli.h) == dc->sli.y)
#endif
{
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
}
}
@ -564,16 +744,47 @@ _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;
if (y0 > y1)
EXCHANGE_POINTS(x0, y0, x1, y1);
dx = x1 - x0;
dy = y1 - y0;
if ( (dx == 0) || (dy == 0) || (dx == dy) || (dx == -dy) )
#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))
{
_evas_draw_simple_line(dst, dc, x0, y0, x1, y1);
return;
@ -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;
@ -609,9 +821,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 +841,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 +951,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
}
}

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;
@ -279,10 +287,30 @@ evas_common_polygon_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Polygon_Po
if (((span->y) % dc->sli.h) == dc->sli.y)
#endif
{
ptr = dst->image.data + (span->y * (dst->cache_entry.w)) + span->x;
func(NULL, NULL, dc->col.col, ptr, span->w);
}
}
#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,16 +58,34 @@ 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;
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++)
#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))
{
#ifdef EVAS_SLI
if (((yy + y) % dc->sli.h) == dc->sli.y)
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(NULL, NULL, dc->col.col, ptr, w);
}
ptr += dst->cache_entry.w;
{
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++)
{
#ifdef EVAS_SLI
if (((yy + y) % dc->sli.h) == dc->sli.y)
#endif
{
func(NULL, NULL, dc->col.col, ptr, w);
}
ptr += dst->cache_entry.w;
}
}
}

View File

@ -154,7 +154,7 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
dst_clip_w = m_clip_w;
dst_clip_h = m_clip_h;
}
if (dst_clip_x < dst_region_x)
{
dst_clip_w += dst_clip_x - dst_region_x;
@ -258,7 +258,7 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
func = evas_common_gfx_func_composite_pixel_mask_span_get(src, dst, dst_clip_w, dc->render_op);
maskobj = dc->mask.mask;
mask = maskobj->mask.mask;
/*
/*
if (1 || dst_region_w > src_region_w || dst_region_h > src_region_h){
printf("Mask w/h: %d/%d\n",maskobj->cache_entry.w,
maskobj->cache_entry.h);
@ -276,26 +276,47 @@ 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,
(dst_clip_x - dst_region_x) + src_region_x,
(dst_clip_y - dst_region_y) + src_region_y,
(dst_clip_y - dst_region_y) + src_region_y,
0, 0,
dst_clip_x, dst_clip_y,
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;
@ -322,59 +343,59 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
}
else
{
/* fill scale tables */
/* fill scale tables */
for (x = 0; x < dst_clip_w; x++)
lin_ptr[x] = (((x + dst_clip_x - dst_region_x) * src_region_w) / dst_region_w) + src_region_x;
lin_ptr[x] = (((x + dst_clip_x - dst_region_x) * src_region_w) / dst_region_w) + src_region_x;
for (y = 0; y < dst_clip_h; y++)
row_ptr[y] = src_data + (((((y + dst_clip_y - dst_region_y) * src_region_h) / dst_region_h)
+ src_region_y) * src_w);
row_ptr[y] = src_data + (((((y + dst_clip_y - dst_region_y) * src_region_h) / dst_region_h)
+ src_region_y) * src_w);
/* scale to dst */
dptr = dst_ptr;
#ifdef DIRECT_SCALE
if ((!src->cache_entry.flags.alpha) &&
(!dst->cache_entry.flags.alpha) &&
(!dc->mul.use))
(!dst->cache_entry.flags.alpha) &&
(!dc->mul.use))
{
for (y = 0; y < dst_clip_h; y++)
{
#ifdef EVAS_SLI
if (((y + dst_clip_y) % dc->sli.h) == dc->sli.y)
#endif
{
dst_ptr = dptr;
for (x = 0; x < dst_clip_w; x++)
{
ptr = row_ptr[y] + lin_ptr[x];
*dst_ptr = *ptr;
dst_ptr++;
}
}
dptr += dst_w;
}
# ifdef EVAS_SLI
if (((y + dst_clip_y) % dc->sli.h) == dc->sli.y)
# endif
{
dst_ptr = dptr;
for (x = 0; x < dst_clip_w; x++)
{
ptr = row_ptr[y] + lin_ptr[x];
*dst_ptr = *ptr;
dst_ptr++;
}
}
dptr += dst_w;
}
}
else
#endif
{
/* a scanline buffer */
buf = alloca(dst_clip_w * sizeof(DATA32));
for (y = 0; y < dst_clip_h; y++)
{
buf = alloca(dst_clip_w * sizeof(DATA32));
for (y = 0; y < dst_clip_h; y++)
{
#ifdef EVAS_SLI
if (((y + dst_clip_y) % dc->sli.h) == dc->sli.y)
if (((y + dst_clip_y) % dc->sli.h) == dc->sli.y)
#endif
{
dst_ptr = buf;
for (x = 0; x < dst_clip_w; x++)
{
ptr = row_ptr[y] + lin_ptr[x];
*dst_ptr = *ptr;
dst_ptr++;
}
/* * blend here [clip_w *] buf -> dptr * */
func(buf, NULL, dc->mul.col, dptr, dst_clip_w);
}
dptr += dst_w;
}
{
dst_ptr = buf;
for (x = 0; x < dst_clip_w; x++)
{
ptr = row_ptr[y] + lin_ptr[x];
*dst_ptr = *ptr;
dst_ptr++;
}
/* * blend here [clip_w *] buf -> dptr * */
func(buf, NULL, dc->mul.col, dptr, dst_clip_w);
}
dptr += dst_w;
}
}
}
}

View File

@ -1,9 +1,9 @@
#ifndef EVAS_COMMON_H
#define EVAS_COMMON_H
#ifdef HAVE_CONFIG_H
# include "config.h" /* so that EAPI in Evas.h is correctly defined */
#endif
//#ifdef HAVE_CONFIG_H
#include "config.h" /* so that EAPI in Evas.h is correctly defined */
//#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 {
@ -1016,14 +1034,14 @@ struct _Tilebuf
int x, y, w, h;
} prev_add, prev_del;
#ifdef RECTUPDATE
/*
/*
Regionbuf *rb;
*/
#elif defined(EVAS_RECT_SPLIT)
int need_merge;
list_t rects;
#else
/*
/*
struct {
int w, h;
Tilebuf_Tile *tiles;

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;