simply as PLACEHOLDER for a glitz engine. i plan on making it almost

identical to the xrender engine - but xrender and glitz do not map entirely
1:1 api-wise.


SVN revision: 27045
This commit is contained in:
Carsten Haitzler 2006-11-11 06:03:13 +00:00
parent 97ad6ae63e
commit 41b70e1b8a
14 changed files with 897 additions and 51 deletions

View File

@ -137,7 +137,6 @@ AC_SUBST(dlopen_libs)
#######################################
## Check if we should build the software_x11 engine
have_evas_software_x11="no";
ENGINE_SOFTWARE_X11_PRG="";
## Automatic check...
AC_CHECK_HEADER(X11/X.h,
[ have_evas_software_x11="yes" ],
@ -165,7 +164,6 @@ if test "x$have_evas_software_x11" = "xyes"; then
x_dir=${x_dir:-/usr/X11R6}
x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}}
x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11 -lXext"
ENGINE_SOFTWARE_X11_PRG="evas_software_x11_test evas_software_x11_perf_test evas_software_x11_perf_load"
],
[
AC_MSG_RESULT(disabling software X11 engine)
@ -178,8 +176,6 @@ AM_CONDITIONAL(BUILD_ENGINE_SOFTWARE_X11, test "x$have_evas_software_x11" = "xye
#######################################
## Check if we should build the software_xcb engine
have_evas_software_xcb="no";
ENGINE_SOFTWARE_XCB_PRG="";
## Automatic check...
PKG_CHECK_MODULES(
XCB,
@ -210,8 +206,7 @@ if test "x$have_evas_software_xcb" = "xyes"; then
xcb xcb-shm xcb-image xcb-icccm,
[AC_DEFINE(BUILD_ENGINE_SOFTWARE_XCB, 1, [Software XCB Rendering Backend])
xcb_cflags=$XCB_CFLAGS
xcb_libs=$XCB_LIBS
ENGINE_SOFTWARE_XCB_PRG="evas_software_xcb_test evas_software_xcb_perf_test evas_software_xcb_perf_load"],
xcb_libs=$XCB_LIBS],
[AC_MSG_RESULT(disabling software XCB engine)
have_evas_software_xcb="no"])
fi
@ -220,7 +215,6 @@ AM_CONDITIONAL(BUILD_ENGINE_SOFTWARE_XCB, test "x$have_evas_software_xcb" = "xye
#######################################
## Check if we should build the directfb engine
have_evas_directfb="no";
ENGINE_DIRECTFB_PRG="";
## Automatic check...
PKG_CHECK_MODULES(DIRECTFB, directfb >= 0.9.16,
[ have_evas_directfb="yes" ],
@ -246,7 +240,6 @@ if test "x$have_evas_directfb" = "xyes"; then
PKG_CHECK_MODULES(DIRECTFB, directfb >= 0.9.16,
[
AC_DEFINE(BUILD_ENGINE_DIRECTFB, 1, [DirectFB Rendering Backend])
ENGINE_DIRECTFB_PRG="evas_directfb_test evas_directfb_window"
], [
AC_MSG_RESULT(disabling directfb engine)
have_evas_directfb="no"
@ -258,7 +251,6 @@ AM_CONDITIONAL(BUILD_ENGINE_DIRECTFB, test "x$have_evas_directfb" = "xyes")
#######################################
## Check if we should build the fb engine
have_evas_fb="no";
ENGINE_FB_PRG="";
## Automatic check...
AC_CHECK_HEADER(linux/fb.h,
[ have_evas_fb="yes" ],
@ -283,7 +275,6 @@ if test "x$have_evas_fb" = "xyes"; then
[
AM_CONDITIONAL(BUILD_ENGINE_FB, true)
AC_DEFINE(BUILD_ENGINE_FB, 1, [Linux FB Rendering Backend])
ENGINE_FB_PRG="evas_fb_test"
], [
AM_CONDITIONAL(BUILD_ENGINE_FB, false)
AC_MSG_RESULT(disabling fb engine)
@ -298,7 +289,6 @@ fi
#######################################
## Check if we should build the buffer engine
have_evas_buffer="no";
ENGINE_BUFFER_PRG="";
## Automatic check...
have_evas_buffer="yes"
## Manual override
@ -318,7 +308,6 @@ AC_ARG_ENABLE(buffer, AC_HELP_STRING([--enable-buffer],[enable the Buffer render
if test "x$have_evas_buffer" = "xyes"; then
AM_CONDITIONAL(BUILD_ENGINE_BUFFER, true)
AC_DEFINE(BUILD_ENGINE_BUFFER, 1, [Buffer Rendering Backend])
ENGINE_BUFFER_PRG="evas_buffer_test"
else
AM_CONDITIONAL(BUILD_ENGINE_BUFFER, false)
fi
@ -326,7 +315,6 @@ fi
#######################################
## Check if we should build the software_qtopia engine
have_evas_qtopia="no";
ENGINE_SOFTWARE_QTOPIA_PRG="";
## Automatic check...
AC_CHECK_HEADER(qdirectpainter_qws.h,
[ have_evas_qtopia="yes" ],
@ -363,7 +351,6 @@ if test "x$have_evas_qtopia" = "xyes"; then
qt_cflags="-fno-exceptions -fno-rtti -I"$qt_dir"/include"
qt_libs="-L"$qt_dir"/lib -lqte -lqpe"
qt_moc=$qt_dir"/bin/moc"
ENGINE_SOFTWARE_QTOPIA_PRG="evas_software_qtopia_test"
], [
AM_CONDITIONAL(BUILD_ENGINE_SOFTWARE_QTOPIA, false)
AC_MSG_RESULT(disabling qtopia engine)
@ -383,7 +370,6 @@ fi
#######################################
## Check if we should build the gl_x11 engine
have_evas_gl_x11="no";
ENGINE_GL_X11_PRG="";
## Automatic check...
AC_CHECK_HEADER(GL/gl.h,
[
@ -427,7 +413,6 @@ if test "x$have_evas_gl_x11" = "xyes"; then
gl_cflags="-I/usr/include"
gl_libs="-lGL -lGLU -lpthread"
gl_dir=""
ENGINE_GL_X11_PRG="evas_gl_x11_test"
], [
AM_CONDITIONAL(BUILD_ENGINE_GL_X11, false)
AM_CONDITIONAL(BUILD_ENGINE_GL_COMMON, false)
@ -460,7 +445,6 @@ fi
#######################################
## Check if we should build the gl_x11 engine
have_evas_cairo_x11="no";
ENGINE_CAIRO_X11_PRG="";
# Automatic check...
#PKG_CHECK_MODULES(CAIRO, cairo >= 1.0.0,
# [ have_evas_cairo_x11="yes" ],
@ -490,7 +474,6 @@ if test "x$have_evas_cairo_x11" = "xyes"; then
x_dir="/usr/X11R6";
x_cflags="-I"$x_dir"/include"
x_libs="-L"$x_dir"/lib -lX11 -lXext"
ENGINE_CAIRO_X11_PRG="evas_cairo_x11_test"
], [
AM_CONDITIONAL(BUILD_ENGINE_CAIRO_X11, false)
AM_CONDITIONAL(BUILD_ENGINE_CAIRO_COMMON, false)
@ -505,7 +488,6 @@ fi
#######################################
## Check if we should build the xrender_x11 engine
have_evas_xrender_x11="no";
ENGINE_XRENDER_X11_PRG="";
## Automatic check...
AC_CHECK_HEADER(X11/X.h,
[ have_evas_xrender_x11="yes" ],
@ -535,7 +517,6 @@ if test "x$have_evas_xrender_x11" = "xyes"; then
x_dir=${x_dir:-/usr/X11R6}
x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}}
x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11 -lXext -lXrender"
ENGINE_XRENDER_X11_PRG="evas_xrender_x11_test"
],
[
AC_MSG_RESULT(disabling xrender X11 engine)
@ -554,8 +535,6 @@ AM_CONDITIONAL(BUILD_ENGINE_XRENDER_X11, test "x$have_evas_xrender_x11" = "xyes"
#######################################
## Check if we should build the xrender_xcb engine
have_evas_xrender_xcb="no";
ENGINE_XRENDER_XCB_PRG="";
## Automatic check...
PKG_CHECK_MODULES(
XCBRENDER,
@ -586,13 +565,58 @@ if test "x$have_evas_xrender_xcb" = "xyes"; then
xcb xcb-shm xcb-render xcb-image xcb-icccm,
[AC_DEFINE(BUILD_ENGINE_XRENDER_XCB, 1, [Xrender XCB Rendering Backend])
xcbrender_cflags=$XCBRENDER_CFLAGS
xcbrender_libs=$XCBRENDER_LIBS
ENGINE_XRENDER_XCB_PRG="evas_xrender_xcb_test"],
xcbrender_libs=$XCBRENDER_LIBS],
[AC_MSG_RESULT(disabling xrender XCB engine)
have_evas_xrender_xcb="no"])
fi
AM_CONDITIONAL(BUILD_ENGINE_XRENDER_XCB, test "x$have_evas_xrender_xcb" = "xyes")
#######################################
## Check if we should build the glitz_x11 engine
have_evas_glitz_x11="no";
## Automatic check...
AC_CHECK_HEADER(glitz-glx.h,
[ have_evas_glitz_x11="yes" ],
[ have_evas_glitz_x11="no" ]
)
## Manual override
AC_MSG_CHECKING(whether glitz x11 backend is to be built)
AC_ARG_ENABLE(glitz-x11, [ --enable-glitz-x11 enable the Glitz X11 rendering backend], [
if test x"$enableval" = x"yes" ; then
AC_MSG_RESULT(yes)
have_evas_glitz_x11="yes"
else
AC_MSG_RESULT(no)
have_evas_glitz_x11="no"
fi
], [
AC_MSG_RESULT($have_evas_glitz_x11)
]
)
if test "x$have_evas_glitz_x11" = "xyes"; then
AC_PATH_XTRA
AC_CHECK_HEADER(X11/X.h,
[
PKG_CHECK_MODULES(GLITZ, glitz glitz-glx,
[
x_dir=${x_dir:-/usr/X11R6}
x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}}
x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11 -lXext"
AC_DEFINE(BUILD_ENGINE_GLITZ_X11, 1, [Glitz X11 Rendering Backend])
],
[
AC_MSG_RESULT(disabling glitz X11 engine)
have_evas_glitz_x11="no"
]
)
],
[
AC_MSG_RESULT(disabling glitz X11 engine)
have_evas_glitz_x11="no"
]
)
fi
AM_CONDITIONAL(BUILD_ENGINE_GLITZ_X11, test "x$have_evas_glitz_x11" = "xyes")
#####################################################################
## Image loaders
@ -1833,17 +1857,6 @@ if test "x$png_libs" != "x"; then
fi
AC_SUBST(requirements)
AC_SUBST(ENGINE_SOFTWARE_X11_PRG)
AC_SUBST(ENGINE_SOFTWARE_XCB_PRG)
AC_SUBST(ENGINE_DIRECTFB_PRG)
AC_SUBST(ENGINE_FB_PRG)
AC_SUBST(ENGINE_BUFFER_PRG)
AC_SUBST(ENGINE_SOFTWARE_QTOPIA_PRG)
AC_SUBST(ENGINE_GL_X11_PRG)
AC_SUBST(ENGINE_CAIRO_X11_PRG)
AC_SUBST(ENGINE_XRENDER_X11_PRG)
AC_SUBST(ENGINE_XRENDER_XCB_PRG)
AC_SUBST(altivec_cflags)
AC_SUBST(pthread_cflags)
@ -1885,6 +1898,7 @@ src/modules/engines/cairo_common/Makefile
src/modules/engines/cairo_x11/Makefile
src/modules/engines/xrender_x11/Makefile
src/modules/engines/xrender_xcb/Makefile
src/modules/engines/glitz_x11/Makefile
src/modules/loaders/Makefile
src/modules/loaders/edb/Makefile
src/modules/loaders/eet/Makefile
@ -1932,6 +1946,7 @@ echo " OpenGL X11..............: $have_evas_gl_x11"
echo " Cairo X11...............: $have_evas_cairo_x11"
echo " XRender X11.............: $have_evas_xrender_x11"
echo " XRender Xcb.............: $have_evas_xrender_xcb"
echo " Glitz X11...............: $have_evas_glitz_x11"
# FIXME: opengl engine needs to be fixed and tested lots for all drivers
# FIXME: xrender engine to be written
echo

View File

@ -207,3 +207,53 @@ evas_common_cpu_end_opt(void)
{
}
#endif
#ifdef BUILD_PTHREAD
EAPI void
_evas_lk_init(Lk *l)
{
pthread_mutext_init(&(l->mutex), NULL);
l->wlk_id = 0;
// pthread_rwlock_init(&((x)->_reslock.rwl), NULL);
}
EAPI void
_evas_lk_destroy(Lk *l)
{
pthread_mutext_destroy(&(l->mutex), NULL);
// pthread_rwlock_destroy(&((x)->_reslock.rwl));
}
EAPI void
_evas_lk_read_lock(Lk *l)
{
pthread_mutex_lock(&l->mutex);
pthread_mutex_unlock(&l->mutex);
// pthread_rwlock_rdlock(&((x)->_reslock.rwl));
}
EAPI void
_evas_lk_read_unlock(Lk *l)
{
pthread_mutex_lock(&l->mutex);
pthread_mutex_unlock(&l->mutex);
// pthread_rwlock_unlock(&((x)->_reslock.rwl));
}
EAPI void
_evas_lk_write_lock(Lk *l)
{
pthread_mutex_lock(&l->mutex);
// pthread_self();
// pthread_equal();
pthread_mutex_unlock(&l->mutex);
// pthread_rwlock_wrlock(&((x)->_reslock.rwl));
}
EAPI void
_evas_lk_write_unlock(Lk *l)
{
pthread_mutex_lock(&l->mutex);
pthread_mutex_unlock(&l->mutex);
}
#endif

View File

@ -14,26 +14,39 @@
#ifdef BUILD_PTHREAD
# include <pthread.h>
# define RLK struct { pthread_rwlock_t rwl; } _reslock
# define RLK_ADD(x) pthread_rwlock_init (&((x)->_reslock.rwl), NULL)
# define RLK_DEL(x) pthread_rwlock_destroy(&((x)->_reslock.rwl))
# define RLK_RLK(x) pthread_rwlock_rdlock (&((x)->_reslock.rwl))
# define RLK_WLK(x) pthread_rwlock_wrlock (&((x)->_reslock.rwl))
# define RLK_ULK(x) pthread_rwlock_unlock (&((x)->_reslock.rwl))
typedef struct _Lk Lk;
struct _Lk
{
pthread_mutex_t mutex; // lock for read/write to this struct
pthread_t wlk_id; // who has the write lock
int wlk_count; // how many times does the write lock have refs
int rlk_count; // read lock count
// pthread_rwlock_t rwl;
};
# define ELK Lk _lk
# define ELK_ADD(x) _evas_lk_init(&((x)->_lk))
# define ELK_DEL(x) _evas_lk_destroy(&((x)->_lk))
# define ELK_RLK(x) _evas_lk_read_lock(&((x)->_lk))
# define ELK_WLK(x) _evas_lk_read_unlock(&((x)->_lk))
# define ELK_RUL(x) _evas_lk_write_lock(&((x)->_lk))
# define ELK_WUL(x) _evas_lk_write_unlock(&((x)->_lk))
#else
# define RLK
# define RLK_ADD(x)
# define RLK_DEL(x)
# define RLK_RLK(x)
# define RLK_WLK(x)
# define RLK_ULK(x)
# define ELK
# define ELK_ADD(x)
# define ELK_DEL(x)
# define ELK_RLK(x)
# define ELK_WLK(x)
# define ELK_RUL(x)
# define ELK_WUL(x)
#endif
typedef struct _Genlock Genlock;
typedef struct _Glk Glk;
struct _Genlock
struct _Glk
{
RLK;
ELK;
int _dummy;
};

View File

@ -14,4 +14,5 @@ software_win32_gdi \
software_x11 \
software_xcb \
xrender_x11 \
xrender_xcb
xrender_xcb \
glitz_x11

View File

@ -0,0 +1,6 @@
.deps
.libs
Makefile
Makefile.in
*.lo
*.la

View File

@ -0,0 +1,25 @@
#ifndef _EVAS_ENGINE_GLITZ_X11_H
#define _EVAS_ENGINE_GLITZ_X11_H
#include <X11/Xlib.h>
typedef struct _Evas_Engine_Info_Glitz_X11 Evas_Engine_Info_Glitz_X11;
struct _Evas_Engine_Info_Glitz_X11
{
/* PRIVATE - don't mess with this baby or evas will poke its tongue out */
/* at you and make nasty noises */
Evas_Engine_Info magic;
/* engine specific data & parameters it needs to set up */
struct {
Display *display;
Drawable drawable;
Pixmap mask;
Visual *visual;
unsigned char destination_alpha : 1;
} info;
};
#endif

View File

@ -0,0 +1,37 @@
AUTOMAKE_OPTIONS = 1.4 foreign
MAINTAINERCLEANFILES = Makefile.in
INCLUDES = -I. -I$(top_srcdir)/src/lib -I$(top_srcdir)/src/lib/include -I$(top_srcdir)/src/modules/engines @FREETYPE_CFLAGS@ @x_cflags@ @GLITZ_CFLAGS@
if BUILD_ENGINE_GLITZ_X11
pkgdir = $(libdir)/evas/modules/engines/glitz_x11/$(MODULE_ARCH)
pkg_LTLIBRARIES = module.la
module_la_SOURCES = \
evas_engine.h \
evas_engine.c \
evas_engine_ximage.c \
evas_engine_glitz.c \
evas_engine_image.c \
evas_engine_font.c \
evas_engine_gradient.c
module_la_LIBADD = @x_libs@ @GLITZ_LIBS@ $(top_builddir)/src/lib/libevas.la
module_la_LDFLAGS = -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
module_la_DEPENDENCIES = $(top_builddir)/config.h
include_HEADERS = Evas_Engine_Glitz_X11.h
endif
EXTRA_DIST = \
evas_engine.h \
evas_engine.c \
evas_engine_ximage.c \
evas_engine_glitz.c \
evas_engine_image.c \
evas_engine_font.c \
evas_engine_gradient.c \
Evas_Engine_Glitz_X11.h

View File

@ -0,0 +1,661 @@
#include "evas_common.h"
#include "evas_private.h"
#include "evas_engine.h"
#include "Evas_Engine_Glitz_X11.h"
/* function tables - filled in later (func and parent func) */
static Evas_Func func, pfunc;
/* engine struct data */
typedef struct _Render_Engine Render_Engine;
typedef struct _Render_Engine_Update Render_Engine_Update;
struct _Render_Engine_Update
{
int x, y, w, h;
// void *surface;
};
struct _Render_Engine
{
Display *disp;
Visual *vis;
Drawable win;
Pixmap mask;
unsigned char destination_alpha : 1;
Tilebuf *tb;
Tilebuf_Rect *rects;
Evas_Object_List *cur_rect;
int end : 1;
Evas_List *updates;
};
/* prototypes we will use here */
static void *eng_info(Evas *e);
static void eng_info_free(Evas *e, void *info);
static void eng_setup(Evas *e, void *info);
static void eng_output_free(void *data);
static void eng_output_resize(void *data, int w, int h);
static void eng_output_tile_size_set(void *data, int w, int h);
static void eng_output_redraws_rect_add(void *data, int x, int y, int w, int h);
static void eng_output_redraws_rect_del(void *data, int x, int y, int w, int h);
static void eng_output_redraws_clear(void *data);
static void *eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, int *cx, int *cy, int *cw, int *ch);
static void eng_output_redraws_next_update_push(void *data, void *surface, int x, int y, int w, int h);
static void eng_output_flush(void *data);
static void eng_rectangle_draw(void *data, void *context, void *surface, int x, int y, int w, int h);
static void eng_line_draw(void *data, void *context, void *surface, int x1, int y1, int x2, int y2);
static void eng_polygon_draw(void *data, void *context, void *surface, void *polygon);
static void *eng_gradient_new(void *data);
static void eng_gradient_free(void *data, void *gradient);
static void eng_gradient_color_stop_add(void *data, void *gradient, int r, int g, int b, int a, int delta);
static void eng_gradient_alpha_stop_add(void *data, void *gradient, int a, int delta);
static void eng_gradient_color_data_set(void *data, void *gradient, void *map, int len, int has_alpha);
static void eng_gradient_alpha_data_set(void *data, void *gradient, void *alpha_map, int len);
static void eng_gradient_clear(void *data, void *gradient);
static void eng_gradient_fill_set(void *data, void *gradient, int x, int y, int w, int h);
static void eng_gradient_fill_angle_set(void *data, void *gradient, double angle);
static void eng_gradient_fill_spread_set(void *data, void *gradient, int spread);
static void eng_gradient_angle_set(void *data, void *gradient, double angle);
static void eng_gradient_offset_set(void *data, void *gradient, float offset);
static void eng_gradient_direction_set(void *data, void *gradient, int direction);
static void eng_gradient_type_set(void *data, void *gradient, char *name, char *params);
static int eng_gradient_is_opaque(void *data, void *context, void *gradient, int x, int y, int w, int h);
static int eng_gradient_is_visible(void *data, void *context, void *gradient, int x, int y, int w, int h);
static void eng_gradient_render_pre(void *data, void *context, void *gradient);
static void eng_gradient_render_post(void *data, void *gradient);
static void eng_gradient_draw(void *data, void *context, void *surface, void *gradient, int x, int y, int w, int h);
static void *eng_image_load(void *data, const char *file, const char *key, int *error, Evas_Image_Load_Opts *lo);
static void *eng_image_new_from_data(void *data, int w, int h, DATA32 *image_data);
static void *eng_image_new_from_copied_data(void *data, int w, int h, DATA32 *image_data);
static void eng_image_free(void *data, void *image);
static void eng_image_size_get(void *data, void *image, int *w, int *h);
static void *eng_image_size_set(void *data, void *image, int w, int h);
static void *eng_image_dirty_region(void *data, void *image, int x, int y, int w, int h);
static void *eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data);
static void *eng_image_data_put(void *data, void *image, DATA32 *image_data);
static void *eng_image_alpha_set(void *data, void *image, int has_alpha);
static int eng_image_alpha_get(void *data, void *image);
static void *eng_image_border_set(void *data, void *image, int l, int r, int t, int b);
static void eng_image_border_get(void *data, void *image, int *l, int *r, int *t, int *b);
static void eng_image_draw(void *data, void *context, void *surface, void *image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int smooth);
static const char *eng_image_comment_get(void *data, void *image, char *key);
static char *eng_image_format_get(void *data, void *image);
static void eng_image_cache_flush(void *data);
static void eng_image_cache_set(void *data, int bytes);
static int eng_image_cache_get(void *data);
static void eng_font_draw(void *data, void *context, void *surface, void *font, int x, int y, int w, int h, int ow, int oh, const char *text);
/* internal engine routines */
/* engine api this module provides */
static void *
eng_info(Evas *e)
{
Evas_Engine_Info_Glitz_X11 *info;
info = calloc(1, sizeof(Evas_Engine_Info_Glitz_X11));
if (!info) return NULL;
info->magic.magic = rand();
return info;
e = NULL;
}
static void
eng_info_free(Evas *e, void *info)
{
Evas_Engine_Info_Glitz_X11 *in;
in = (Evas_Engine_Info_Glitz_X11 *)info;
free(in);
}
static void
eng_setup(Evas *e, void *in)
{
Render_Engine *re;
Evas_Engine_Info_Glitz_X11 *info;
int resize = 1;
info = (Evas_Engine_Info_Glitz_X11 *)in;
if (!e->engine.data.output)
{
re = calloc(1, sizeof(Render_Engine));
evas_common_cpu_init();
evas_common_blend_init();
evas_common_image_init();
evas_common_convert_init();
evas_common_scale_init();
evas_common_rectangle_init();
evas_common_gradient_init();
evas_common_polygon_init();
evas_common_line_init();
evas_common_font_init();
evas_common_draw_init();
evas_common_tilebuf_init();
re->tb = evas_common_tilebuf_new(e->output.w, e->output.h);
if (re->tb)
evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
e->engine.data.output = re;
resize = 0;
}
re = e->engine.data.output;
if (!re) return;
if (!e->engine.data.context) e->engine.data.context = e->engine.func->context_new(e->engine.data.output);
re->disp = info->info.display;
re->vis = info->info.visual;
re->win = info->info.drawable;
re->mask = info->info.mask;
re->destination_alpha = info->info.destination_alpha;
if (resize)
{
if (re->tb) evas_common_tilebuf_free(re->tb);
if ((e->output.w > 0) && (e->output.h > 0))
re->tb = evas_common_tilebuf_new(e->output.w, e->output.h);
else
re->tb = evas_common_tilebuf_new(1, 1);
if (re->tb)
evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
}
}
static void
eng_output_free(void *data)
{
Render_Engine *re;
re = (Render_Engine *)data;
evas_common_font_shutdown();
evas_common_image_shutdown();
while (re->updates)
{
Render_Engine_Update *reu;
reu = re->updates->data;
re->updates = evas_list_remove_list(re->updates, re->updates);
// surface_free(reu->surface);
free(reu);
}
if (re->tb) evas_common_tilebuf_free(re->tb);
if (re->rects) evas_common_tilebuf_free_render_rects(re->rects);
free(re);
}
static void
eng_output_resize(void *data, int w, int h)
{
Render_Engine *re;
re = (Render_Engine *)data;
evas_common_tilebuf_free(re->tb);
re->tb = evas_common_tilebuf_new(w, h);
if (re->tb) evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
}
static void
eng_output_tile_size_set(void *data, int w, int h)
{
Render_Engine *re;
re = (Render_Engine *)data;
evas_common_tilebuf_set_tile_size(re->tb, w, h);
}
static void
eng_output_redraws_rect_add(void *data, int x, int y, int w, int h)
{
Render_Engine *re;
re = (Render_Engine *)data;
evas_common_tilebuf_add_redraw(re->tb, x, y, w, h);
}
static void
eng_output_redraws_rect_del(void *data, int x, int y, int w, int h)
{
Render_Engine *re;
re = (Render_Engine *)data;
evas_common_tilebuf_del_redraw(re->tb, x, y, w, h);
}
static void
eng_output_redraws_clear(void *data)
{
Render_Engine *re;
re = (Render_Engine *)data;
evas_common_tilebuf_clear(re->tb);
}
static void *
eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, int *cx, int *cy, int *cw, int *ch)
{
Render_Engine *re;
Tilebuf_Rect *rect;
int ux, uy, uw, uh;
re = (Render_Engine *)data;
if (re->end)
{
re->end = 0;
return NULL;
}
if (!re->rects)
{
re->rects = evas_common_tilebuf_get_render_rects(re->tb);
re->cur_rect = (Evas_Object_List *)re->rects;
}
if (!re->cur_rect) return NULL;
rect = (Tilebuf_Rect *)re->cur_rect;
ux = rect->x; uy = rect->y; uw = rect->w; uh = rect->h;
re->cur_rect = re->cur_rect->next;
if (!re->cur_rect)
{
evas_common_tilebuf_free_render_rects(re->rects);
re->rects = NULL;
re->end = 1;
}
*x = ux; *y = uy; *w = uw; *h = uh;
*cx = 0; *cy = 0; *cw = uw; *ch = uh;
return NULL;
if ((re->destination_alpha) || (re->mask))
{
// Xrender_Surface *surface;
//
// surface = _xr_render_surface_new(re->xinf, uw, uh, re->xinf->fmt32, 1);
// _xr_render_surface_solid_rectangle_set(surface, 0, 0, 0, 0, 0, 0, uw, uh);
// return surface;
}
// return _xr_render_surface_new(re->xinf, uw, uh, re->xinf->fmt24, 0);
}
static void
eng_output_redraws_next_update_push(void *data, void *surface, int x, int y, int w, int h)
{
Render_Engine *re;
Render_Engine_Update *reu;
re = (Render_Engine *)data;
reu = malloc(sizeof(Render_Engine_Update));
if (!reu) return;
reu->x = x;
reu->y = y;
reu->w = w;
reu->h = h;
// reu->surface = surface;
re->updates = evas_list_append(re->updates, reu);
}
static void
eng_output_flush(void *data)
{
Render_Engine *re;
re = (Render_Engine *)data;
while (re->updates)
{
Render_Engine_Update *reu;
reu = re->updates->data;
re->updates = evas_list_remove_list(re->updates, re->updates);
// if (re->mask_output)
// {
// Xrender_Surface *tsurf;
//
// _xr_render_surface_copy(reu->surface, re->output, 0, 0,
// reu->x, reu->y, reu->w, reu->h);
// tsurf = _xr_render_surface_new(re->xinf, reu->w, reu->h, re->xinf->fmt1, 1);
// if (tsurf)
// {
// _xr_render_surface_copy(reu->surface, tsurf, 0, 0,
// 0, 0, reu->w, reu->h);
// _xr_render_surface_copy(tsurf, re->mask_output, 0, 0,
// reu->x, reu->y, reu->w, reu->h);
// _xr_render_surface_free(tsurf);
// }
// }
// else
// {
// _xr_render_surface_copy(reu->surface, re->output, 0, 0,
// reu->x, reu->y, reu->w, reu->h);
// }
// _xr_render_surface_free(reu->surface);
free(reu);
}
XSync(re->disp, False);
// _xr_image_info_pool_flush(re->xinf, 0, 0);
}
static void
eng_rectangle_draw(void *data, void *context, void *surface, int x, int y, int w, int h)
{
}
static void
eng_line_draw(void *data, void *context, void *surface, int x1, int y1, int x2, int y2)
{
}
static void
eng_polygon_draw(void *data, void *context, void *surface, void *polygon)
{
}
static void *
eng_gradient_new(void *data)
{
Render_Engine *re = (Render_Engine *)data;
return NULL;
}
static void
eng_gradient_free(void *data, void *gradient)
{
}
static void
eng_gradient_color_stop_add(void *data, void *gradient, int r, int g, int b, int a, int delta)
{
}
static void
eng_gradient_alpha_stop_add(void *data, void *gradient, int a, int delta)
{
}
static void
eng_gradient_color_data_set(void *data, void *gradient, void *map, int len, int has_alpha)
{
}
static void
eng_gradient_alpha_data_set(void *data, void *gradient, void *alpha_map, int len)
{
}
static void
eng_gradient_clear(void *data, void *gradient)
{
}
static void
eng_gradient_fill_set(void *data, void *gradient, int x, int y, int w, int h)
{
}
static void
eng_gradient_fill_angle_set(void *data, void *gradient, double angle)
{
}
static void
eng_gradient_fill_spread_set(void *data, void *gradient, int spread)
{
}
static void
eng_gradient_angle_set(void *data, void *gradient, double angle)
{
}
static void
eng_gradient_offset_set(void *data, void *gradient, float offset)
{
}
static void
eng_gradient_direction_set(void *data, void *gradient, int direction)
{
}
static void
eng_gradient_type_set(void *data, void *gradient, char *name, char *params)
{
}
static int
eng_gradient_is_opaque(void *data, void *context, void *gradient, int x, int y, int w, int h)
{
return 0;
}
static int
eng_gradient_is_visible(void *data, void *context, void *gradient, int x, int y, int w, int h)
{
if (!context || !gradient) return 0;
return 1;
}
static void
eng_gradient_render_pre(void *data, void *context, void *gradient)
{
}
static void
eng_gradient_render_post(void *data, void *gradient)
{
}
static void
eng_gradient_draw(void *data, void *context, void *surface, void *gradient, int x, int y, int w, int h)
{
}
static void *
eng_image_load(void *data, const char *file, const char *key, int *error, Evas_Image_Load_Opts *lo)
{
return NULL;
}
static void *
eng_image_new_from_data(void *data, int w, int h, DATA32 *image_data)
{
return NULL;
}
static void *
eng_image_new_from_copied_data(void *data, int w, int h, DATA32 *image_data)
{
return NULL;
}
static void
eng_image_free(void *data, void *image)
{
}
static void
eng_image_size_get(void *data, void *image, int *w, int *h)
{
}
static void *
eng_image_size_set(void *data, void *image, int w, int h)
{
return image;
}
static void *
eng_image_dirty_region(void *data, void *image, int x, int y, int w, int h)
{
return image;
}
static void *
eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data)
{
return image;
}
static void *
eng_image_data_put(void *data, void *image, DATA32 *image_data)
{
return image;
}
static void *
eng_image_alpha_set(void *data, void *image, int has_alpha)
{
return image;
}
static int
eng_image_alpha_get(void *data, void *image)
{
return 0;
}
static void *
eng_image_border_set(void *data, void *image, int l, int r, int t, int b)
{
return image;
}
static void
eng_image_border_get(void *data, void *image, int *l, int *r, int *t, int *b)
{
}
static void
eng_image_draw(void *data, void *context, void *surface, void *image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int smooth)
{
}
static const char *
eng_image_comment_get(void *data, void *image, char *key)
{
return NULL;
}
static char *
eng_image_format_get(void *data, void *image)
{
return NULL;
}
static void
eng_image_cache_flush(void *data)
{
int tmp_size;
// tmp_size = _xre_image_cache_get();
pfunc.image_cache_flush(data);
// _xre_image_cache_set(0);
// _xre_image_cache_set(tmp_size);
}
static void
eng_image_cache_set(void *data, int bytes)
{
pfunc.image_cache_set(data, bytes);
// _xre_image_cache_set(bytes);
}
static int
eng_image_cache_get(void *data)
{
return pfunc.image_cache_get(data);
}
static void
eng_font_draw(void *data, void *context, void *surface, void *font, int x, int y, int w, int h, int ow, int oh, const char *text)
{
}
/* module advertising code */
EAPI int
module_open(Evas_Module *em)
{
if (!em) return 0;
/* get whatever engine module we inherit from */
if (!_evas_module_engine_inherit(&pfunc, "software_generic")) return 0;
/* store it for later use */
func = pfunc;
/* now to override methods */
#define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
ORD(info);
ORD(info_free);
ORD(setup);
ORD(output_free);
ORD(output_resize);
ORD(output_tile_size_set);
ORD(output_redraws_rect_add);
ORD(output_redraws_rect_del);
ORD(output_redraws_clear);
ORD(output_redraws_next_update_get);
ORD(output_redraws_next_update_push);
ORD(output_flush);
ORD(rectangle_draw);
ORD(line_draw);
ORD(polygon_draw);
ORD(gradient_new);
ORD(gradient_free);
ORD(gradient_color_stop_add);
ORD(gradient_alpha_stop_add);
ORD(gradient_color_data_set);
ORD(gradient_alpha_data_set);
ORD(gradient_clear);
ORD(gradient_fill_set);
ORD(gradient_fill_angle_set);
ORD(gradient_fill_spread_set);
ORD(gradient_angle_set);
ORD(gradient_offset_set);
ORD(gradient_direction_set);
ORD(gradient_type_set);
ORD(gradient_is_opaque);
ORD(gradient_is_visible);
ORD(gradient_render_pre);
ORD(gradient_render_post);
ORD(gradient_draw);
ORD(image_load);
ORD(image_new_from_data);
ORD(image_new_from_copied_data);
ORD(image_free);
ORD(image_size_get);
ORD(image_size_set);
ORD(image_dirty_region);
ORD(image_data_get);
ORD(image_data_put);
ORD(image_alpha_set);
ORD(image_alpha_get);
ORD(image_border_set);
ORD(image_border_get);
ORD(image_draw);
ORD(image_comment_get);
ORD(image_format_get);
ORD(image_cache_flush);
ORD(image_cache_set);
ORD(image_cache_get);
ORD(font_draw);
/* now advertise out own api */
em->functions = (void *)(&func);
return 1;
}
EAPI void
module_close(void)
{
}
EAPI Evas_Module_Api evas_modapi =
{
EVAS_MODULE_API_VERSION,
EVAS_MODULE_TYPE_ENGINE,
"glitz_x11",
"none"
};

View File

@ -0,0 +1,12 @@
#ifndef EVAS_ENGINE_H
#define EVAS_ENGINE_H
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/Xatom.h>
#include <glitz.h>
#include <glitz-glx.h>
#endif

View File

@ -0,0 +1,4 @@
#include "evas_common.h"
#include "evas_private.h"
#include "evas_engine.h"
#include "Evas_Engine_Glitz_X11.h"

View File

@ -0,0 +1,9 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "evas_common.h"
//#include "evas_macros.h"
#include "evas_private.h"
#include "evas_engine.h"
#include "Evas_Engine_Glitz_X11.h"
#include <math.h>

View File

@ -0,0 +1,5 @@
#include "evas_common.h"
#include "evas_private.h"
#include "evas_engine.h"
#include "Evas_Engine_Glitz_X11.h"
#include <math.h>

View File

@ -0,0 +1,4 @@
#include "evas_common.h"
#include "evas_private.h"
#include "evas_engine.h"
#include "Evas_Engine_Glitz_X11.h"

View File

@ -0,0 +1,4 @@
#include "evas_common.h"
#include "evas_private.h"
#include "evas_engine.h"
#include "Evas_Engine_Glitz_X11.h"