xrender_x11 now partially inherits.
SVN revision: 20909
+++ /dev/null
-#ifndef _EVAS_ENGINE_SOFTWARE_QTOPIA_H
-#define _EVAS_ENGINE_SOFTWARE_QTOPIA_H
-
-#ifdef EVAS_COMMON_H
-#ifdef EVAS_PRIVATE_H
-typedef void QWidget;
-#endif
-#endif
-
-#ifndef EVAS_COMMON_H
-#ifndef EVAS_PRIVATE_H
-#include <qwidget.h>
-#endif
-#endif
-
-typedef struct _Evas_Engine_Info_Software_Qtopia Evas_Engine_Info_Software_Qtopia;
-
-struct _Evas_Engine_Info_Software_Qtopia
-{
- /* PRIVATE - don't mess with this baby or evas will poke its tongue out */
- /* at you and make nasty noises */
- Evas_Engine_Info magic;
-
- struct {
- QWidget *target;
- int rotation;
- } info;
-};
-#endif
-
-
+++ /dev/null
-#ifndef _EVAS_ENGINE_SOFTWARE_WIN32_GDI_H
-#define _EVAS_ENGINE_SOFTWARE_WIN32_GDI_H
-
-typedef struct _Evas_Engine_Info_Software_Win32_GDI Evas_Engine_Info_Software_Win32_GDI;
-
-struct _Evas_Engine_Info_Software_Win32_GDI
-{
- /* 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 {
- HWND hwnd;
-/*
- Colormap colormap;
-*/
-
- int depth;
- int rotation;
-
- } info;
- /* engine specific function calls to query stuff about the destination */
- /* engine (what visual & colormap & depth to use, performance info etc. */
-};
-#endif
-
-
+++ /dev/null
-#ifndef _EVAS_ENGINE_SOFTWARE_XCB_H
-#define _EVAS_ENGINE_SOFTWARE_XCB_H
-
-#include <X11/XCB/xcb.h>
-
-typedef struct _Evas_Engine_Info_Software_Xcb Evas_Engine_Info_Software_Xcb;
-
-struct _Evas_Engine_Info_Software_Xcb
-{
- /* 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 {
- XCBConnection *conn;
- XCBDRAWABLE drawable;
- XCBDRAWABLE mask;
- XCBVISUALTYPE *visual;
- XCBCOLORMAP colormap;
- int depth;
- int rotation;
-
- int alloc_grayscale : 1;
- int debug : 1;
- int shape_dither : 1;
-
- int alloc_colors_max;
- } info;
- /* engine specific function calls to query stuff about the destination */
- /* engine (what visual & colormap & depth to use, performance info etc. */
- struct {
- XCBVISUALTYPE * (*best_visual_get) (XCBConnection *conn, int screen);
- XCBCOLORMAP (*best_colormap_get) (XCBConnection *conn, int screen);
- int (*best_depth_get) (XCBConnection *conn, int screen);
-
- Evas_Performance *(*performance_test) (Evas *e,
- XCBConnection *conn,
- XCBVISUALTYPE *vis,
- XCBCOLORMAP cmap,
- XCBDRAWABLE draw,
- int depth);
- void (*performance_free) (Evas_Performance *perf);
- char * (*performance_data_get) (Evas_Performance *perf);
- char * (*performance_key_get) (Evas_Performance *perf);
- Evas_Performance *(*performance_new) (Evas *e,
- XCBConnection *conn,
- XCBVISUALTYPE *vis,
- XCBCOLORMAP cmap,
- XCBDRAWABLE draw,
- int depth);
- void (*performance_build) (Evas_Performance *perf,
- const char *data);
- void (*performance_device_store) (Evas_Performance *perf);
- } func;
-};
-
-#endif /* _EVAS_ENGINE_SOFTWARE_XCB_H */
+++ /dev/null
-#ifndef _EVAS_ENGINE_XRENDER_X11_H
-#define _EVAS_ENGINE_XRENDER_X11_H
-
-#include <X11/Xlib.h>
-
-typedef struct _Evas_Engine_Info_XRender_X11 Evas_Engine_Info_XRender_X11;
-
-struct _Evas_Engine_Info_XRender_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
-
-
# self-contained.
EXTRA_DIST = \
-Evas_Engine_Software_Xcb.h \
Evas_Engine_DirectFB.h \
-Evas_Engine_Software_Win32_GDI.h \
-Evas_Engine_Software_Qtopia.h \
Evas_Engine_GL_X11.h \
Evas_Engine_Cairo_X11.h \
-Evas_Engine_XRender_X11.h
-
-if BUILD_ENGINE_SOFTWARE_XCB
-ENGINE_SOFTWARE_XCB_INC = Evas_Engine_Software_Xcb.h
-else
-ENGINE_SOFTWARE_XCB_INC =
-endif
if BUILD_ENGINE_DIRECTFB
ENGINE_DIRECTFB_INC = Evas_Engine_DirectFB.h
ENGINE_DIRECTFB_INC =
endif
-if BUILD_ENGINE_SOFTWARE_QTOPIA
-ENGINE_SOFTWARE_QTOPIA_INC = Evas_Engine_Software_Qtopia.h
-else
-ENGINE_SOFTWARE_QTOPIA_INC =
-endif
-
if BUILD_ENGINE_GL_X11
ENGINE_GL_X11_INC = Evas_Engine_GL_X11.h
else
ENGINE_CAIRO_X11_INC =
endif
-if BUILD_ENGINE_XRENDER_X11
-ENGINE_XRENDER_X11_INC = Evas_Engine_XRender_X11.h
-else
-ENGINE_XRENDER_X11_INC =
-endif
-
include_HEADERS = \
-$(ENGINE_SOFTWARE_XCB_INC) \
$(ENGINE_DIRECTFB_INC) \
-$(ENGINE_SOFTWARE_QTOPIA_INC) \
$(ENGINE_GL_X11_INC) \
-$(ENGINE_CAIRO_X11_INC) \
-$(ENGINE_XRENDER_X11_INC)
+$(ENGINE_CAIRO_X11_INC)
#include "evas_engine.h"
#include "Evas_Engine_Buffer.h"
+/* function tables - filled in later (func and parent func) */
+static Evas_Func func, pfunc;
+
/* engine struct data */
typedef struct _Render_Engine Render_Engine;
}
/* module advertising code */
-static Evas_Func func, pfunc;
-
int
module_open(Evas_Module *em)
{
#include "evas_engine.h"
#include "Evas_Engine_FB.h"
+/* function tables - filled in later (func and parent func) */
+static Evas_Func func, pfunc;
+
/* engine struct data */
typedef struct _Render_Engine Render_Engine;
}
/* module advertising code */
-static Evas_Func func, pfunc;
-
int
module_open(Evas_Module *em)
{
*****
*/
-static Evas_Func eng_func =
+static Evas_Func func =
{
NULL,
NULL,
module_open(Evas_Module *em)
{
if (!em) return 0;
- em->functions = (void *)(&eng_func);
+ em->functions = (void *)(&func);
return 1;
}
--- /dev/null
+#ifndef _EVAS_ENGINE_SOFTWARE_QTOPIA_H
+#define _EVAS_ENGINE_SOFTWARE_QTOPIA_H
+
+#ifdef EVAS_COMMON_H
+#ifdef EVAS_PRIVATE_H
+typedef void QWidget;
+#endif
+#endif
+
+#ifndef EVAS_COMMON_H
+#ifndef EVAS_PRIVATE_H
+#include <qwidget.h>
+#endif
+#endif
+
+typedef struct _Evas_Engine_Info_Software_Qtopia Evas_Engine_Info_Software_Qtopia;
+
+struct _Evas_Engine_Info_Software_Qtopia
+{
+ /* PRIVATE - don't mess with this baby or evas will poke its tongue out */
+ /* at you and make nasty noises */
+ Evas_Engine_Info magic;
+
+ struct {
+ QWidget *target;
+ int rotation;
+ } info;
+};
+#endif
+
+
-## Process this file with automake to produce Makefile.in
-
AUTOMAKE_OPTIONS = 1.4 foreign
-# A list of all the files in the current directory which can be regenerated
MAINTAINERCLEANFILES = Makefile.in
-INCLUDES = -I. \
- -I$(top_srcdir)/src/lib \
- -I$(top_srcdir)/src/lib/include \
- -I$(top_srcdir)/src/modules/engines \
- @FREETYPE_CFLAGS@ @qt_cflags@
+INCLUDES = -I. -I$(top_srcdir)/src/lib -I$(top_srcdir)/src/lib/include -I$(top_srcdir)/src/modules/engines @FREETYPE_CFLAGS@ @qt_cflags@
-CXXFLAGS = $(CFLAGS) -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -DNO_DEBUG
+CXXFLAGS = $(CFLAGS) -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -DNO_DEBUG
if BUILD_ENGINE_SOFTWARE_QTOPIA
-pkgdir = $(libdir)/evas/modules/engines/software_qtopia/$(MODULE_ARCH)
-
-pkg_LTLIBRARIES = module.la
+pkgdir = $(libdir)/evas/modules/engines/software_qtopia/$(MODULE_ARCH)
-module_la_SOURCES = \
+pkg_LTLIBRARIES = module.la
+module_la_SOURCES = \
evas_engine.h \
evas_engine.c \
evas_outbuf.c \
evas_qt_main.cpp
-module_la_LIBADD = @qt_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_LIBADD = @qt_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
-module_la_DEPENDENCIES = \
-$(top_builddir)/config.h
+include_HEADERS = Evas_Engine_Software_Qtopia.h
endif
evas_engine.h \
evas_engine.c \
evas_outbuf.c \
-evas_qt_main.cpp
+evas_qt_main.cpp \
+Evas_Engine_Software_Qtopia.h
-5~#include "evas_common.h"
+#include "evas_common.h"
#include "evas_private.h"
#include "evas_engine.h"
#include "evas_engine_api_software_qtopia.h"
#include "Evas_Engine_Software_Qtopia.h"
-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_setup(int w, int h, int rot, QWidget *target);
-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_context_new(void *data);
-static void eng_context_free(void *data, void *context);
-static void eng_context_clip_set(void *data, void *context, int x, int y, int w, int h);
-static void eng_context_clip_clip(void *data, void *context, int x, int y, int w, int h);
-static void eng_context_clip_unset(void *data, void *context);
-static int eng_context_clip_get(void *data, void *context, int *x, int *y, int *w, int *h);
-static void eng_context_color_set(void *data, void *context, int r, int g, int b, int a);
-static int eng_context_color_get(void *data, void *context, int *r, int *g, int *b, int *a);
-static void eng_context_multiplier_set(void *data, void *context, int r, int g, int b, int a);
-static void eng_context_multiplier_unset(void *data, void *context);
-static int eng_context_multiplier_get(void *data, void *context, int *r, int *g, int *b, int *a);
-static void eng_context_cutout_add(void *data, void *context, int x, int y, int w, int h);
-static void eng_context_cutout_clear(void *data, void *context);
-static void eng_context_anti_alias_set(void *data, void *context, unsigned char aa);
-static unsigned char eng_context_anti_alias_get(void *data, void *context);
-static void eng_context_color_interpolation_set(void *data, void *context, int color_space);
-static int eng_context_color_interpolation_get(void *data, void *context);
-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_point_add(void *data, void *context, void *polygon, int x, int y);
-static void *eng_polygon_points_clear(void *data, void *context, void *polygon);
-static void eng_polygon_draw(void *data, void *context, void *surface, void *polygon);
-static void *eng_gradient_color_add(void *data, void *context, void *gradient, int r, int g, int b, int a, int distance);
-static void *eng_gradient_colors_clear(void *data, void *context, void *gradient);
-static void eng_gradient_free(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_type_set(void *data, void *gradient, char *name);
-static void eng_gradient_type_params_set(void *data, void *gradient, char *params);
-static void *eng_gradient_geometry_init(void *data, void *gradient, int spread);
-static int eng_gradient_alpha_get(void *data, void *gradient, int spread);
-static void eng_gradient_map(void *data, void *context, void *gradient, int spread);
-static void eng_gradient_draw(void *data, void *context, void *surface, void *gradient, int x, int y, int w, int h, double angle, int spread);
-static void *eng_image_load(void *data, char *file, char *key, int *error);
-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_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 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_load(void *data, char *name, int size);
-static void *eng_font_memory_load(void *data, char *name, int size, const void *fdata, int fdata_size);
-static void *eng_font_add(void *data, void *font, char *name, int size);
-static void *eng_font_memory_add(void *data, void *font, char *name, int size, const void *fdata, int fdata_size);
-static void eng_font_free(void *data, void *font);
-static int eng_font_ascent_get(void *data, void *font);
-static int eng_font_descent_get(void *data, void *font);
-static int eng_font_max_ascent_get(void *data, void *font);
-static int eng_font_max_descent_get(void *data, void *font);
-static void eng_font_string_size_get(void *data, void *font, char *text, int *w, int *h);
-static int eng_font_inset_get(void *data, void *font, char *text);
-static int eng_font_h_advance_get(void *data, void *font, char *text);
-static int eng_font_v_advance_get(void *data, void *font, char *text);
-static int eng_font_char_coords_get(void *data, void *font, char *text, int pos, int *cx, int *cy, int *cw, int *ch);
-static int eng_font_char_at_coords_get(void *data, void *font, char *text, int x, int y, int *cx, int *cy, int *cw, int *ch);
-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, char *text);
-static void eng_font_cache_flush(void *data);
-static void eng_font_cache_set(void *data, int bytes);
-static int eng_font_cache_get(void *data);
-
-static void eng_font_hinting_set(void *data, void *font, int hinting);
-static int eng_font_hinting_can_hint(void *data, int hinting);
+/* function tables - filled in later (func and parent func) */
+static Evas_Func func, pfunc;
+/* engine struct data */
typedef struct _Render_Engine Render_Engine;
struct _Render_Engine
int end : 1;
};
-static Evas_Func eng_func =
-{
- eng_info,
- eng_info_free,
- eng_setup,
- eng_output_free,
- eng_output_resize,
- eng_output_tile_size_set,
- eng_output_redraws_rect_add,
- eng_output_redraws_rect_del,
- eng_output_redraws_clear,
- eng_output_redraws_next_update_get,
- eng_output_redraws_next_update_push,
- eng_output_flush,
- /* draw context virtual methods */
- eng_context_new,
- eng_context_free,
- eng_context_clip_set,
- eng_context_clip_clip,
- eng_context_clip_unset,
- eng_context_clip_get,
- eng_context_color_set,
- eng_context_color_get,
- eng_context_multiplier_set,
- eng_context_multiplier_unset,
- eng_context_multiplier_get,
- eng_context_cutout_add,
- eng_context_cutout_clear,
- eng_context_anti_alias_set,
- eng_context_anti_alias_get,
- eng_context_color_interpolation_set,
- eng_context_color_interpolation_get,
- /* rectangle draw funcs */
- eng_rectangle_draw,
- /* line draw funcs */
- eng_line_draw,
- /* polygon draw funcs */
- eng_polygon_point_add,
- eng_polygon_points_clear,
- eng_polygon_draw,
- /* gradient draw funcs */
- eng_gradient_color_add,
- eng_gradient_colors_clear,
- eng_gradient_free,
- eng_gradient_fill_set,
- eng_gradient_type_set,
- eng_gradient_type_params_set,
- eng_gradient_geometry_init,
- eng_gradient_alpha_get,
- eng_gradient_map,
- eng_gradient_draw,
- /* image draw funcs */
- eng_image_load,
- eng_image_new_from_data,
- eng_image_new_from_copied_data,
- eng_image_free,
- eng_image_size_get,
- eng_image_size_set,
- eng_image_dirty_region,
- eng_image_data_get,
- eng_image_data_put,
- eng_image_alpha_set,
- eng_image_alpha_get,
- eng_image_draw,
- eng_image_comment_get,
- eng_image_format_get,
- /* image cache funcs */
- eng_image_cache_flush,
- eng_image_cache_set,
- eng_image_cache_get,
- /* font draw functions */
- eng_font_load,
- eng_font_memory_load,
- eng_font_add,
- eng_font_memory_add,
- eng_font_free,
- eng_font_ascent_get,
- eng_font_descent_get,
- eng_font_max_ascent_get,
- eng_font_max_descent_get,
- eng_font_string_size_get,
- eng_font_inset_get,
- eng_font_h_advance_get,
- eng_font_v_advance_get,
- eng_font_char_coords_get,
- eng_font_char_at_coords_get,
- eng_font_draw,
- /* font cache functions */
- eng_font_cache_flush,
- eng_font_cache_set,
- eng_font_cache_get,
-
- eng_font_hinting_set,
- eng_font_hinting_can_hint
-};
-
-static void *
-eng_info(Evas *e)
-{
- Evas_Engine_Info_Software_Qtopia *info;
-
- info = calloc(1, sizeof(Evas_Engine_Info_Software_Qtopia));
- if (!info) return NULL;
- info->magic.magic = rand();
- return info;
- e = NULL;
-}
-
-static void
-eng_info_free(Evas *e, void *info)
-{
- Evas_Engine_Info_Software_Qtopia *in;
-
- in = (Evas_Engine_Info_Software_Qtopia *)info;
- free(in);
-}
-
-static void
-eng_setup(Evas *e, void *in)
-{
- Render_Engine *re;
- Evas_Engine_Info_Software_Qtopia *info;
-
- info = (Evas_Engine_Info_Software_Qtopia *)in;
- if (!e->engine.data.output)
- e->engine.data.output =
- eng_output_setup(e->output.w,
- e->output.h,
- info->info.rotation,
- info->info.target);
- if (!e->engine.data.output) return;
- if (!e->engine.data.context)
- e->engine.data.context =
- e->engine.func->context_new(e->engine.data.output);
+/* prototypes we will use here */
+static void *_output_setup(int w, int h, int rot, QWidget *target);
- re = e->engine.data.output;
-}
+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);
+/* internal engine routines */
static void *
-eng_output_setup(int w, int h, int rot, QWidget *target)
+_output_setup(int w, int h, int rot, QWidget *target)
{
Render_Engine *re;
return re;
}
+/* engine api this module provides */
+static void *
+eng_info(Evas *e)
+{
+ Evas_Engine_Info_Software_Qtopia *info;
+
+ info = calloc(1, sizeof(Evas_Engine_Info_Software_Qtopia));
+ if (!info) return NULL;
+ info->magic.magic = rand();
+ return info;
+ e = NULL;
+}
+
+static void
+eng_info_free(Evas *e, void *info)
+{
+ Evas_Engine_Info_Software_Qtopia *in;
+
+ in = (Evas_Engine_Info_Software_Qtopia *)info;
+ free(in);
+}
+
+static void
+eng_setup(Evas *e, void *in)
+{
+ Render_Engine *re;
+ Evas_Engine_Info_Software_Qtopia *info;
+
+ info = (Evas_Engine_Info_Software_Qtopia *)in;
+ if (!e->engine.data.output)
+ e->engine.data.output =
+ _output_setup(e->output.w,
+ e->output.h,
+ info->info.rotation,
+ info->info.target);
+ if (!e->engine.data.output) return;
+ if (!e->engine.data.context)
+ e->engine.data.context =
+ e->engine.func->context_new(e->engine.data.output);
+
+ re = e->engine.data.output;
+}
+
static void
eng_output_free(void *data)
{
re = (Render_Engine *)data;
evas_qtopia_outbuf_software_qtopia_reconfigure(re->ob, w, h,
- evas_qtopia_outbuf_software_qtopia_get_rot(re->ob),
- OUTBUF_DEPTH_INHERIT);
+ evas_qtopia_outbuf_software_qtopia_get_rot(re->ob),
+ OUTBUF_DEPTH_INHERIT);
evas_qtopia_outbuf_software_qtopia_set_have_backbuf(re->ob, 0);
evas_common_tilebuf_free(re->tb);
re->tb = evas_common_tilebuf_new(w, h);
re = (Render_Engine *)data;
}
-static void *
-eng_context_new(void *data)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_draw_context_new();
-}
-
-static void
-eng_context_free(void *data, void *context)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_free(context);
-}
-
-static void
-eng_context_clip_set(void *data, void *context, int x, int y, int w, int h)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_set_clip(context, x, y, w, h);
-}
-
-static void
-eng_context_clip_clip(void *data, void *context, int x, int y, int w, int h)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_clip_clip(context, x, y, w, h);
-}
-
-static void
-eng_context_clip_unset(void *data, void *context)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_unset_clip(context);
-}
-
-static int
-eng_context_clip_get(void *data, void *context, int *x, int *y, int *w, int *h)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- *x = ((RGBA_Draw_Context *)context)->clip.x;
- *y = ((RGBA_Draw_Context *)context)->clip.y;
- *w = ((RGBA_Draw_Context *)context)->clip.w;
- *h = ((RGBA_Draw_Context *)context)->clip.h;
- return ((RGBA_Draw_Context *)context)->clip.use;
-}
-
-static void
-eng_context_color_set(void *data, void *context, int r, int g, int b, int a)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_set_color(context, r, g, b, a);
-}
-
-static int
-eng_context_color_get(void *data, void *context, int *r, int *g, int *b, int *a)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- *r = (int)(R_VAL(&((RGBA_Draw_Context *)context)->col.col));
- *g = (int)(G_VAL(&((RGBA_Draw_Context *)context)->col.col));
- *b = (int)(B_VAL(&((RGBA_Draw_Context *)context)->col.col));
- *a = (int)(A_VAL(&((RGBA_Draw_Context *)context)->col.col));
- return 1;
-}
-
-static void
-eng_context_multiplier_set(void *data, void *context, int r, int g, int b, int a)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_set_multiplier(context, r, g, b, a);
-}
-
-static void
-eng_context_multiplier_unset(void *data, void *context)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_unset_multiplier(context);
-}
-
-static int
-eng_context_multiplier_get(void *data, void *context, int *r, int *g, int *b, int *a)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- *r = (int)(R_VAL(&((RGBA_Draw_Context *)context)->mul.col));
- *g = (int)(G_VAL(&((RGBA_Draw_Context *)context)->mul.col));
- *b = (int)(B_VAL(&((RGBA_Draw_Context *)context)->mul.col));
- *a = (int)(A_VAL(&((RGBA_Draw_Context *)context)->mul.col));
- return ((RGBA_Draw_Context *)context)->mul.use;
-}
-
-static void
-eng_context_cutout_add(void *data, void *context, int x, int y, int w, int h)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_add_cutout(context, x, y, w, h);
-}
-
-static void
-eng_context_cutout_clear(void *data, void *context)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_clear_cutouts(context);
-}
-
-static void
-eng_context_anti_alias_set(void *data, void *context, unsigned char aa)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_set_anti_alias(context, aa);
-}
-
-static unsigned char
-eng_context_anti_alias_get(void *data, void *context)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return ((RGBA_Draw_Context *)context)->anti_alias;
-}
-
-static void
-eng_context_color_interpolation_set(void *data, void *context, int color_space)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_set_color_interpolation(context, color_space);
-}
-
-static int
-eng_context_color_interpolation_get(void *data, void *context)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return ((RGBA_Draw_Context *)context)->interpolation.color_space;
-}
-
-
-
-
-
-
-static void
-eng_rectangle_draw(void *data, void *context, void *surface, int x, int y, int w, int h)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_rectangle_draw(surface, context, x, y, w, h);
- evas_common_cpu_end_opt();
-}
-
-static void
-eng_line_draw(void *data, void *context, void *surface, int x1, int y1, int x2, int y2)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_line_draw(surface, context, x1, y1, x2, y2);
- evas_common_cpu_end_opt();
-}
-
-static void *
-eng_polygon_point_add(void *data, void *context, void *polygon, int x, int y)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_polygon_point_add(polygon, x, y);
- context = NULL;
-}
-
-static void *
-eng_polygon_points_clear(void *data, void *context, void *polygon)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_polygon_points_clear(polygon);
- context = NULL;
-}
-
-static void
-eng_polygon_draw(void *data, void *context, void *surface, void *polygon)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_polygon_draw(surface, context, polygon);
- evas_common_cpu_end_opt();
-}
-
-static void *
-eng_gradient_color_add(void *data, void *context, void *gradient, int r, int g, int b, int a, int distance)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- if (!gradient)
- gradient = evas_common_gradient_new();
- evas_common_gradient_color_add(gradient, r, g, b, a, distance);
- return gradient;
- context = NULL;
-}
-
-static void *
-eng_gradient_colors_clear(void *data, void *context, void *gradient)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_gradient_colors_clear(gradient);
- return gradient;
- context = NULL;
-}
-
-static void
-eng_gradient_free(void *data, void *gradient)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_gradient_free(gradient);
-}
-
-static void
-eng_gradient_fill_set(void *data, void *gradient, int x, int y, int w, int h)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_gradient_fill_set(gradient, x, y, w, h);
-}
-
-static void
-eng_gradient_type_set(void *data, void *gradient, char *name)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_gradient_type_set(gradient, name);
-}
-
-static void
-eng_gradient_type_params_set(void *data, void *gradient, char *params)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_gradient_type_params_set(gradient, params);
-}
-
-static void *
-eng_gradient_geometry_init(void *data, void *gradient, int spread)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- gradient = evas_common_gradient_geometry_init(gradient, spread);
- return gradient;
-}
-
-static int
-eng_gradient_alpha_get(void *data, void *gradient, int spread)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_gradient_has_alpha(gradient, spread);
-}
-
-static void
-eng_gradient_map(void *data, void *context, void *gradient, int spread)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_gradient_map(context, gradient, spread);
- evas_common_cpu_end_opt();
-}
-
-static void
-eng_gradient_draw(void *data, void *context, void *surface, void *gradient, int x, int y, int w, int h, double angle, int spread)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_gradient_draw(surface, context, x, y, w, h, gradient, angle, spread);
- evas_common_cpu_end_opt();
-}
-
-static void *
-eng_image_load(void *data, char *file, char *key, int *error)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- *error = 0;
- return evas_common_load_image_from_file(file, key);
-}
-
-static void *
-eng_image_new_from_data(void *data, int w, int h, DATA32 *image_data)
-{
- Render_Engine *re;
- RGBA_Image *im;
-
- re = (Render_Engine *)data;
- im = evas_common_image_new();
- im->image = evas_common_image_surface_new(im);
- if (!im->image)
- {
- evas_common_image_free(im);
- return NULL;
- }
- im->image->w = w;
- im->image->h = h;
- im->image->data = image_data;
- im->image->no_free = 1;
- return im;
-}
-
-static void *
-eng_image_new_from_copied_data(void *data, int w, int h, DATA32 *image_data)
-{
- Render_Engine *re;
- RGBA_Image *im;
-
- re = (Render_Engine *)data;
- im = evas_common_image_create(w, h);
- if (!im) return NULL;
- if (image_data)
- memcpy(im->image->data, image_data, w * h * sizeof(DATA32));
- return im;
-}
-
-static void
-eng_image_free(void *data, void *image)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_image_unref(image);
-}
-
-static void
-eng_image_size_get(void *data, void *image, int *w, int *h)
-{
- Render_Engine *re;
- RGBA_Image *im;
-
- re = (Render_Engine *)data;
- im = image;
- if (w) *w = im->image->w;
- if (h) *h = im->image->h;
-}
-
-static void *
-eng_image_size_set(void *data, void *image, int w, int h)
-{
- Render_Engine *re;
- RGBA_Image *im, *im_old;
-
- re = (Render_Engine *)data;
- im_old = image;
- im = evas_common_image_create(w, h);
- if (!im) return im_old;
- if (im_old)
- {
- evas_common_load_image_data_from_file(im_old);
- if (im_old->image->data)
- {
- evas_common_blit_rectangle(im_old, im, 0, 0, w, h, 0, 0);
- evas_common_cpu_end_opt();
- }
- evas_common_image_unref(im_old);
- }
- return im;
-}
-
-static void *
-eng_image_dirty_region(void *data, void *image, int x, int y, int w, int h)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_image_dirty(image);
- return image;
- x = 0;
- y = 0;
- w = 0;
- h = 0;
-}
-
-static void *
-eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data)
-{
- Render_Engine *re;
- RGBA_Image *im;
-
- re = (Render_Engine *)data;
- im = image;
- evas_common_load_image_data_from_file(im);
- if (to_write)
- {
- if (im->references > 1)
- {
- RGBA_Image *im_new;
-
- im_new = evas_common_image_create(im->image->w, im->image->h);
- if (!im_new) return im;
- evas_common_blit_rectangle(im, im_new, 0, 0, im->image->w, im->image->h, 0, 0);
- evas_common_cpu_end_opt();
- evas_common_image_unref(im);
- im = im_new;
- }
- else
- evas_common_image_dirty(im);
- }
- *image_data = im->image->data;
- return im;
-}
-
-static void *
-eng_image_data_put(void *data, void *image, DATA32 *image_data)
-{
- Render_Engine *re;
- RGBA_Image *im;
-
- re = (Render_Engine *)data;
- im = image;
- if (image_data != im->image->data)
- {
- int w, h;
-
- w = im->image->w;
- h = im->image->h;
- evas_common_image_unref(im);
- return eng_image_new_from_data(data, w, h, image_data);
- }
- /* hmmm - but if we wrote... why bother? */
-/* evas_common_image_dirty(im); */
- return im;
-}
-
-static void *
-eng_image_alpha_set(void *data, void *image, int has_alpha)
-{
- Render_Engine *re;
- RGBA_Image *im;
-
- re = (Render_Engine *)data;
- im = image;
- if (im->references > 1)
- {
- RGBA_Image *im_new;
-
- im_new = evas_common_image_create(im->image->w, im->image->h);
- if (!im_new) return im;
- evas_common_load_image_data_from_file(im);
- evas_common_blit_rectangle(im, im_new, 0, 0, im->image->w, im->image->h, 0, 0);
- evas_common_cpu_end_opt();
- evas_common_image_unref(im);
- im = im_new;
- }
- else
- evas_common_image_dirty(im);
- if (has_alpha)
- im->flags |= RGBA_IMAGE_HAS_ALPHA;
- else
- im->flags &= ~RGBA_IMAGE_HAS_ALPHA;
- return im;
-}
-
-
-static int
-eng_image_alpha_get(void *data, void *image)
-{
- Render_Engine *re;
- RGBA_Image *im;
-
- re = (Render_Engine *)data;
- im = image;
- if (im->flags & RGBA_IMAGE_HAS_ALPHA) return 1;
- return 0;
-}
-
-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)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_load_image_data_from_file(image);
- if (smooth)
- evas_common_scale_rgba_in_to_out_clip_smooth(image, surface, context,
- src_x, src_y, src_w, src_h,
- dst_x, dst_y, dst_w, dst_h);
- else
- evas_common_scale_rgba_in_to_out_clip_sample(image, surface, context,
- src_x, src_y, src_w, src_h,
- dst_x, dst_y, dst_w, dst_h);
- evas_common_cpu_end_opt();
-}
-
-static char *
-eng_image_comment_get(void *data, void *image, char *key)
-{
- Render_Engine *re;
- RGBA_Image *im;
-
- re = (Render_Engine *)data;
- im = image;
- return im->info.comment;
- key = 0;
-}
-
-static char *
-eng_image_format_get(void *data, void *image)
-{
- Render_Engine *re;
- RGBA_Image *im;
-
- re = (Render_Engine *)data;
- im = image;
-// if (im->info.format == 1) return "png";
- return NULL;
-}
-
-static void
-eng_image_cache_flush(void *data)
-{
- Render_Engine *re;
- int tmp_size;
-
- re = (Render_Engine *)data;
- tmp_size = evas_common_image_get_cache();
- evas_common_image_set_cache(0);
- evas_common_image_set_cache(tmp_size);
-}
-
-static void
-eng_image_cache_set(void *data, int bytes)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_image_set_cache(bytes);
-}
-
-static int
-eng_image_cache_get(void *data)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_image_get_cache();
-}
-
-static void *
-eng_font_load(void *data, char *name, int size)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_load(name, size);
-}
-
-static void *
-eng_font_memory_load(void *data, char *name, int size, const void *fdata, int fdata_size)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_memory_load(name, size, fdata, fdata_size);
-}
-
-static void *
-eng_font_add(void *data, void *font, char *name, int size)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_add(font, name, size);
-}
-
-static void *
-eng_font_memory_add(void *data, void *font, char *name, int size, const void *fdata, int fdata_size)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_memory_add(font, name, size, fdata, fdata_size);
-}
-
-static void
-eng_font_free(void *data, void *font)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_font_free(font);
-}
-
-static int
-eng_font_ascent_get(void *data, void *font)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_ascent_get(font);
-}
-
-static int
-eng_font_descent_get(void *data, void *font)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_descent_get(font);
-}
-
-static int
-eng_font_max_ascent_get(void *data, void *font)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_max_ascent_get(font);
-}
-
-static int
-eng_font_max_descent_get(void *data, void *font)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_max_descent_get(font);
-}
-
-static void
-eng_font_string_size_get(void *data, void *font, char *text, int *w, int *h)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_font_query_size(font, text, w, h);
-}
-
-static int
-eng_font_inset_get(void *data, void *font, char *text)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_query_inset(font, text);
-}
-
-static int
-eng_font_h_advance_get(void *data, void *font, char *text)
-{
- Render_Engine *re;
- int h, v;
-
- re = (Render_Engine *)data;
- evas_common_font_query_advance(font, text, &h, &v);
- return h;
-}
-
-static int
-eng_font_v_advance_get(void *data, void *font, char *text)
-{
- Render_Engine *re;
- int h, v;
-
- re = (Render_Engine *)data;
- evas_common_font_query_advance(font, text, &h, &v);
- return v;
-}
-
-static int
-eng_font_char_coords_get(void *data, void *font, char *text, int pos, int *cx, int *cy, int *cw, int *ch)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_query_char_coords(font, text, pos, cx, cy, cw, ch);
-}
-
-static int
-eng_font_char_at_coords_get(void *data, void *font, char *text, int x, int y, int *cx, int *cy, int *cw, int *ch)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_query_text_at_pos(font, text, x, y, cx, cy, cw, ch);
-}
-
-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, char *text)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- if ((w == ow) && (h == oh))
- evas_common_font_draw(surface, context, font, x, y, text);
- else
- {
- /* create output surface size ow x oh and scale to w x h */
- RGBA_Draw_Context *dc, *dc_in;
-
- dc_in = context;
- dc = evas_common_draw_context_new();
- if (dc)
- {
- RGBA_Image *im;
- int inset;
-
- dc->col.col = dc_in->col.col;
- inset = evas_common_font_query_inset( font, text);
- im = evas_common_image_create(ow+inset, oh);
- if (im)
- {
- int max_ascent;
- int i, j;
-
- im->flags |= RGBA_IMAGE_HAS_ALPHA;
- j = (ow+inset) * oh;
- memset(im->image->data, 0, j * sizeof(DATA32));
-
- max_ascent = evas_common_font_max_ascent_get(font);
-
- evas_common_font_draw(im, dc, font, 0, max_ascent, text);
- evas_common_cpu_end_opt();
- evas_common_scale_rgba_in_to_out_clip_smooth(im, surface, context,
- inset, 0, ow, oh,
- x + ((inset * w) / ow), y - ((max_ascent * h) / oh),
- w, h);
- evas_common_image_free(im);
- }
- evas_common_draw_context_free(dc);
- }
- }
- evas_common_cpu_end_opt();
-}
-
-static void
-eng_font_cache_flush(void *data)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_font_flush();
-}
-
-static void
-eng_font_cache_set(void *data, int bytes)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_font_cache_set(bytes);
-}
-
-static int
-eng_font_cache_get(void *data)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_cache_get();
-}
-
-static void
-eng_font_hinting_set(void *data, void *font, int hinting)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_font_hinting_set(font, hinting);
-}
-
-static int
-eng_font_hinting_can_hint(void *data, int hinting)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_hinting_available(hinting);
-}
-
+/* module advertising code */
int
module_open(Evas_Module *em)
{
if (!em) return 0;
- em->functions = (void *)(&eng_func);
+ /* 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);
+ /* now advertise out own api */
+ em->functions = (void *)(&func);
return 1;
}
void
module_close(void)
{
-
}
Evas_Module_Api evas_modapi =
--- /dev/null
+#ifndef _EVAS_ENGINE_SOFTWARE_WIN32_GDI_H
+#define _EVAS_ENGINE_SOFTWARE_WIN32_GDI_H
+
+typedef struct _Evas_Engine_Info_Software_Win32_GDI Evas_Engine_Info_Software_Win32_GDI;
+
+struct _Evas_Engine_Info_Software_Win32_GDI
+{
+ /* 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 {
+ HWND hwnd;
+/*
+ Colormap colormap;
+*/
+
+ int depth;
+ int rotation;
+
+ } info;
+ /* engine specific function calls to query stuff about the destination */
+ /* engine (what visual & colormap & depth to use, performance info etc. */
+};
+#endif
+
+
evas_engine.c \
evas_outbuf.c \
evas_win32_buffer.c \
-evas_win32_main.c
+evas_win32_main.c \
+Evas_Engine_Software_Win32_GDI.h
#include "evas_engine.h"
#include "Evas_Engine_Software_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;
/* module advertising code */
-static Evas_Func func, pfunc;
-
int
module_open(Evas_Module *em)
{
--- /dev/null
+#ifndef _EVAS_ENGINE_SOFTWARE_XCB_H
+#define _EVAS_ENGINE_SOFTWARE_XCB_H
+
+#include <X11/XCB/xcb.h>
+
+typedef struct _Evas_Engine_Info_Software_Xcb Evas_Engine_Info_Software_Xcb;
+
+struct _Evas_Engine_Info_Software_Xcb
+{
+ /* 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 {
+ XCBConnection *conn;
+ XCBDRAWABLE drawable;
+ XCBDRAWABLE mask;
+ XCBVISUALTYPE *visual;
+ XCBCOLORMAP colormap;
+ int depth;
+ int rotation;
+
+ int alloc_grayscale : 1;
+ int debug : 1;
+ int shape_dither : 1;
+
+ int alloc_colors_max;
+ } info;
+ /* engine specific function calls to query stuff about the destination */
+ /* engine (what visual & colormap & depth to use, performance info etc. */
+ struct {
+ XCBVISUALTYPE * (*best_visual_get) (XCBConnection *conn, int screen);
+ XCBCOLORMAP (*best_colormap_get) (XCBConnection *conn, int screen);
+ int (*best_depth_get) (XCBConnection *conn, int screen);
+
+ Evas_Performance *(*performance_test) (Evas *e,
+ XCBConnection *conn,
+ XCBVISUALTYPE *vis,
+ XCBCOLORMAP cmap,
+ XCBDRAWABLE draw,
+ int depth);
+ void (*performance_free) (Evas_Performance *perf);
+ char * (*performance_data_get) (Evas_Performance *perf);
+ char * (*performance_key_get) (Evas_Performance *perf);
+ Evas_Performance *(*performance_new) (Evas *e,
+ XCBConnection *conn,
+ XCBVISUALTYPE *vis,
+ XCBCOLORMAP cmap,
+ XCBDRAWABLE draw,
+ int depth);
+ void (*performance_build) (Evas_Performance *perf,
+ const char *data);
+ void (*performance_device_store) (Evas_Performance *perf);
+ } func;
+};
+
+#endif /* _EVAS_ENGINE_SOFTWARE_XCB_H */
-## Process this file with automake to produce Makefile.in
-
AUTOMAKE_OPTIONS = 1.4 foreign
-# A list of all the files in the current directory which can be regenerated
MAINTAINERCLEANFILES = Makefile.in
-INCLUDES = -I. \
- -I$(top_srcdir)/src/lib \
- -I$(top_srcdir)/src/lib/include \
- -I$(top_srcdir)/src/modules/engines \
- @FREETYPE_CFLAGS@ @xcb_cflags@
+INCLUDES = -I. -I$(top_srcdir)/src/lib -I$(top_srcdir)/src/lib/include -I$(top_srcdir)/src/modules/engines @FREETYPE_CFLAGS@ @xcb_cflags@
if BUILD_ENGINE_SOFTWARE_XCB
-pkgdir = $(libdir)/evas/modules/engines/software_xcb/$(MODULE_ARCH)
-
-pkg_LTLIBRARIES = module.la
+pkgdir = $(libdir)/evas/modules/engines/software_xcb/$(MODULE_ARCH)
-module_la_SOURCES = \
+pkg_LTLIBRARIES = module.la
+module_la_SOURCES = \
evas_engine.h \
evas_engine.c \
evas_outbuf.c \
evas_xcb_color.c \
evas_xcb_main.c
-module_la_LIBADD = @xcb_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_LIBADD = @xcb_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
-module_la_DEPENDENCIES = \
-$(top_builddir)/config.h
+include_HEADERS = Evas_Engine_Software_Xcb.h
endif
evas_outbuf.c \
evas_xcb_buffer.c \
evas_xcb_color.c \
-evas_xcb_main.c
+evas_xcb_main.c \
+Evas_Engine_Software_Xcb.h
\ No newline at end of file
#include "evas_engine_api_software_xcb.h"
#include "Evas_Engine_Software_Xcb.h"
+/* function tables - filled in later (func and parent func) */
+static Evas_Func func, pfunc;
+
+/* engine struct data */
+typedef struct _Render_Engine Render_Engine;
+
+struct _Render_Engine
+{
+ Tilebuf *tb;
+ Outbuf *ob;
+ Tilebuf_Rect *rects;
+ Evas_Object_List *cur_rect;
+ int end : 1;
+};
+
+/* prototypes we will use here */
+static void *_output_setup(int w, int h, int rot, XCBConnection *conn, XCBDRAWABLE draw, XCBVISUALTYPE *vis, XCBCOLORMAP cmap, int depth, int debug, int grayscale, int max_colors, XCBDRAWABLE mask, int shape_dither);
+static XCBVISUALTYPE *_best_visual_get(XCBConnection *conn, int screen);
+static XCBCOLORMAP _best_colormap_get(XCBConnection *conn, int screen);
+static int _best_depth_get(XCBConnection *conn, int screen);
+static Evas_Performance *_output_perf_new(Evas *e, XCBConnection *conn, XCBVISUALTYPE *vis, XCBCOLORMAP cmap, XCBDRAWABLE draw, int depth);
+static Evas_Performance *_output_perf_test(Evas *e, XCBConnection *conn, XCBVISUALTYPE *vis, XCBCOLORMAP cmap, XCBDRAWABLE draw, int depth);
+static char *_output_perf_data(Evas_Performance *perf);
+static char *_output_perf_key(Evas_Performance *perf);
+static void _output_perf_free(Evas_Performance *perf);
+static void _output_perf_build(Evas_Performance *perf, const char *data);
+static void _output_perf_device_store(Evas_Performance *perf);
+
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_setup(int w, int h, int rot, XCBConnection *conn, XCBDRAWABLE draw, XCBVISUALTYPE *vis, XCBCOLORMAP cmap, int depth, int debug, int grayscale, int max_colors, XCBDRAWABLE mask, int shape_dither);
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_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_context_new(void *data);
-static void eng_context_free(void *data, void *context);
-static void eng_context_clip_set(void *data, void *context, int x, int y, int w, int h);
-static void eng_context_clip_clip(void *data, void *context, int x, int y, int w, int h);
-static void eng_context_clip_unset(void *data, void *context);
-static int eng_context_clip_get(void *data, void *context, int *x, int *y, int *w, int *h);
-static void eng_context_color_set(void *data, void *context, int r, int g, int b, int a);
-static int eng_context_color_get(void *data, void *context, int *r, int *g, int *b, int *a);
-static void eng_context_multiplier_set(void *data, void *context, int r, int g, int b, int a);
-static void eng_context_multiplier_unset(void *data, void *context);
-static int eng_context_multiplier_get(void *data, void *context, int *r, int *g, int *b, int *a);
-static void eng_context_cutout_add(void *data, void *context, int x, int y, int w, int h);
-static void eng_context_cutout_clear(void *data, void *context);
-static void eng_context_anti_alias_set(void *data, void *context, unsigned char aa);
-static unsigned char eng_context_anti_alias_get(void *data, void *context);
-static void eng_context_color_interpolation_set(void *data, void *context, int color_space);
-static int eng_context_color_interpolation_get(void *data, void *context);
-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_point_add(void *data, void *context, void *polygon, int x, int y);
-static void *eng_polygon_points_clear(void *data, void *context, void *polygon);
-static void eng_polygon_draw(void *data, void *context, void *surface, void *polygon);
-static void *eng_gradient_color_add(void *data, void *context, void *gradient, int r, int g, int b, int a, int distance);
-static void *eng_gradient_colors_clear(void *data, void *context, void *gradient);
-static void eng_gradient_free(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_type_set(void *data, void *gradient, char *name);
-static void eng_gradient_type_params_set(void *data, void *gradient, char *params);
-static void *eng_gradient_geometry_init(void *data, void *gradient, int spread);
-static int eng_gradient_alpha_get(void *data, void *gradient, int spread);
-static void eng_gradient_map(void *data, void *context, void *gradient, int spread);
-static void eng_gradient_draw(void *data, void *context, void *surface, void *gradient, int x, int y, int w, int h, double angle, int spread);
-static void *eng_image_load(void *data, char *file, char *key, int *error);
-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_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 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_load(void *data, char *name, int size);
-static void *eng_font_memory_load(void *data, char *name, int size, const void *fdata, int fdata_size);
-static void *eng_font_add(void *data, void *font, char *name, int size);
-static void *eng_font_memory_add(void *data, void *font, char *name, int size, const void *fdata, int fdata_size);
-static void eng_font_free(void *data, void *font);
-static int eng_font_ascent_get(void *data, void *font);
-static int eng_font_descent_get(void *data, void *font);
-static int eng_font_max_ascent_get(void *data, void *font);
-static int eng_font_max_descent_get(void *data, void *font);
-static void eng_font_string_size_get(void *data, void *font, char *text, int *w, int *h);
-static int eng_font_inset_get(void *data, void *font, char *text);
-static int eng_font_h_advance_get(void *data, void *font, char *text);
-static int eng_font_v_advance_get(void *data, void *font, char *text);
-static int eng_font_char_coords_get(void *data, void *font, char *text, int pos, int *cx, int *cy, int *cw, int *ch);
-static int eng_font_char_at_coords_get(void *data, void *font, char *text, int x, int y, int *cx, int *cy, int *cw, int *ch);
-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, char *text);
-static void eng_font_cache_flush(void *data);
-static void eng_font_cache_set(void *data, int bytes);
-static int eng_font_cache_get(void *data);
-static void eng_font_hinting_set(void *data, void *font, int hinting);
-static int eng_font_hinting_can_hint(void *data, int hinting);
+static void *
+_output_setup(int w,
+ int h,
+ int rot,
+ XCBConnection *conn,
+ XCBDRAWABLE draw,
+ XCBVISUALTYPE *vis,
+ XCBCOLORMAP cmap,
+ int depth,
+ int debug,
+ int grayscale,
+ int max_colors,
+ XCBDRAWABLE mask,
+ int shape_dither)
+{
+ Render_Engine *re;
+ Outbuf_Perf *perf;
-static XCBVISUALTYPE *eng_best_visual_get(XCBConnection *conn, int screen);
-static XCBCOLORMAP eng_best_colormap_get(XCBConnection *conn, int screen);
-static int eng_best_depth_get(XCBConnection *conn, int screen);
-static Evas_Performance *eng_output_perf_new(Evas *e, XCBConnection *conn, XCBVISUALTYPE *vis, XCBCOLORMAP cmap, XCBDRAWABLE draw, int depth);
-static Evas_Performance *eng_output_perf_test(Evas *e, XCBConnection *conn, XCBVISUALTYPE *vis, XCBCOLORMAP cmap, XCBDRAWABLE draw, int depth);
-static char *eng_output_perf_data(Evas_Performance *perf);
-static char *eng_output_perf_key(Evas_Performance *perf);
-static void eng_output_perf_free(Evas_Performance *perf);
-static void eng_output_perf_build(Evas_Performance *perf, const char *data);
-static void eng_output_perf_device_store(Evas_Performance *perf);
+ re = calloc(1, sizeof(Render_Engine));
+ /* if we haven't initialized - init (automatic abort if already done) */
+ evas_common_cpu_init();
-typedef struct _Render_Engine Render_Engine;
+ 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();
-struct _Render_Engine
+ evas_software_xcb_x_init();
+ evas_software_xcb_x_color_init();
+ evas_software_xcb_outbuf_init();
+
+ /* get any stored performance metrics from device (xserver) */
+ perf = evas_software_xcb_outbuf_perf_restore_x(conn, draw, vis, cmap, depth);
+ re->ob = evas_software_xcb_outbuf_setup_x(w, h, rot,
+ OUTBUF_DEPTH_INHERIT,
+ conn,
+ draw,
+ vis,
+ cmap,
+ depth,
+ perf,
+ grayscale,
+ max_colors,
+ mask, shape_dither);
+ if (!re->ob)
+ {
+ evas_software_xcb_outbuf_perf_free(perf);
+ free(re);
+ return NULL;
+ }
+ evas_software_xcb_outbuf_debug_set(re->ob, debug);
+ re->tb = evas_common_tilebuf_new(w, h);
+ if (!re->tb)
+ {
+ evas_software_xcb_outbuf_free(re->ob);
+ free(re);
+ return NULL;
+ }
+ /* in preliminary tests 16x16 gave highest framerates */
+ evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
+ return re;
+}
+
+static XCBSCREEN *
+_screen_get(XCBConnection *conn, int screen)
{
- Tilebuf *tb;
- Outbuf *ob;
- Tilebuf_Rect *rects;
- Evas_Object_List *cur_rect;
- int end : 1;
-};
+ XCBSCREENIter i;
+ int cur;
+
+ if (!conn) return NULL;
-static Evas_Func eng_func =
+ i = XCBConnSetupSuccessRepRootsIter(XCBGetSetup(conn));
+ if (screen > i.rem - 1) return NULL; /* screen must be between 0 and i.rem - 1 */
+ for (cur = 0; cur <= screen; XCBSCREENNext(&i), ++cur);
+
+ return i.data;
+}
+
+static XCBVISUALTYPE *
+_best_visual_get(XCBConnection *conn, int screen)
{
- eng_info,
- eng_info_free,
- eng_setup,
- eng_output_free,
- eng_output_resize,
- eng_output_tile_size_set,
- eng_output_redraws_rect_add,
- eng_output_redraws_rect_del,
- eng_output_redraws_clear,
- eng_output_redraws_next_update_get,
- eng_output_redraws_next_update_push,
- eng_output_flush,
- /* draw context virtual methods */
- eng_context_new,
- eng_context_free,
- eng_context_clip_set,
- eng_context_clip_clip,
- eng_context_clip_unset,
- eng_context_clip_get,
- eng_context_color_set,
- eng_context_color_get,
- eng_context_multiplier_set,
- eng_context_multiplier_unset,
- eng_context_multiplier_get,
- eng_context_cutout_add,
- eng_context_cutout_clear,
- eng_context_anti_alias_set,
- eng_context_anti_alias_get,
- eng_context_color_interpolation_set,
- eng_context_color_interpolation_get,
- /* rectangle draw funcs */
- eng_rectangle_draw,
- /* line draw funcs */
- eng_line_draw,
- /* polygon draw funcs */
- eng_polygon_point_add,
- eng_polygon_points_clear,
- eng_polygon_draw,
- /* gradient draw funcs */
- eng_gradient_color_add,
- eng_gradient_colors_clear,
- eng_gradient_free,
- eng_gradient_fill_set,
- eng_gradient_type_set,
- eng_gradient_type_params_set,
- eng_gradient_geometry_init,
- eng_gradient_alpha_get,
- eng_gradient_map,
- eng_gradient_draw,
- /* image draw funcs */
- eng_image_load,
- eng_image_new_from_data,
- eng_image_new_from_copied_data,
- eng_image_free,
- eng_image_size_get,
- eng_image_size_set,
- eng_image_dirty_region,
- eng_image_data_get,
- eng_image_data_put,
- eng_image_alpha_set,
- eng_image_alpha_get,
- eng_image_draw,
- eng_image_comment_get,
- eng_image_format_get,
- /* image cache funcs */
- eng_image_cache_flush,
- eng_image_cache_set,
- eng_image_cache_get,
- /* font draw functions */
- eng_font_load,
- eng_font_memory_load,
- eng_font_add,
- eng_font_memory_add,
- eng_font_free,
- eng_font_ascent_get,
- eng_font_descent_get,
- eng_font_max_ascent_get,
- eng_font_max_descent_get,
- eng_font_string_size_get,
- eng_font_inset_get,
- eng_font_h_advance_get,
- eng_font_v_advance_get,
- eng_font_char_coords_get,
- eng_font_char_at_coords_get,
- eng_font_draw,
- /* font cache functions */
- eng_font_cache_flush,
- eng_font_cache_set,
- eng_font_cache_get,
-
- eng_font_hinting_set,
- eng_font_hinting_can_hint
-};
+ XCBSCREEN *scr;
+ XCBDEPTH *d;
+ XCBVISUALTYPEIter iter;
+ int cur;
+
+ if (!conn) return NULL;
+ scr = _screen_get(conn, screen);
+ if (!scr) return NULL;
+ d = XCBSCREENAllowedDepthsIter(scr).data;
+ if (!d) return NULL;
+
+ iter = XCBDEPTHVisualsIter(d);
+ for (cur = 0 ; cur < iter.rem ; XCBVISUALTYPENext(&iter), ++cur)
+ if (scr->root_visual.id == iter.data->visual_id.id)
+ return iter.data;
+
+ return NULL;
+}
+
+static XCBCOLORMAP
+_best_colormap_get(XCBConnection *conn, int screen)
+{
+ XCBSCREEN *scr;
+ XCBCOLORMAP c;
+
+ c.xid = 0;
+ if (!conn) return c;
+ scr = _screen_get(conn, screen);
+ if (!scr) return c;
+
+ return scr->default_colormap;
+}
+
+static int
+_best_depth_get(XCBConnection *conn, int screen)
+{
+ XCBSCREEN *scr;
+
+ if (!conn) return 0;
+ scr = _screen_get(conn, screen);
+ if (!scr) return 0;
+
+ return scr->root_depth;
+}
+
+static Evas_Performance *
+_output_perf_new(Evas *e, XCBConnection *conn, XCBVISUALTYPE *vis, XCBCOLORMAP cmap, XCBDRAWABLE draw, int depth)
+{
+ return evas_software_xcb_outbuf_perf_new_x(conn, draw, vis, cmap, depth);
+ e = NULL;
+}
+
+static Evas_Performance *
+_output_perf_test(Evas *e, XCBConnection *conn, XCBVISUALTYPE *vis, XCBCOLORMAP cmap, XCBDRAWABLE draw, int depth)
+{
+ return evas_software_xcb_outbuf_perf_x(conn, draw, vis, cmap, depth);
+ e = NULL;
+}
+
+static char *
+_output_perf_data(Evas_Performance *perf)
+{
+ return evas_software_xcb_outbuf_perf_serialize_x(perf);
+}
+
+static char *
+_output_perf_key(Evas_Performance *perf)
+{
+ return evas_software_xcb_outbuf_perf_serialize_info_x(perf);
+}
+
+static void
+_output_perf_free(Evas_Performance *perf)
+{
+ evas_software_xcb_outbuf_perf_free(perf);
+}
+
+static void
+_output_perf_build(Evas_Performance *perf, const char *data)
+{
+ evas_software_xcb_outbuf_perf_deserialize_x(perf, data);
+}
+
+static void
+_output_perf_device_store(Evas_Performance *perf)
+{
+ evas_software_xcb_outbuf_perf_store_x(perf);
+}
+/* engine api this module provides */
static void *
eng_info(Evas *e)
{
info = (Evas_Engine_Info_Software_Xcb *)in;
if (!e->engine.data.output)
e->engine.data.output =
- eng_output_setup(e->output.w,
- e->output.h,
- info->info.rotation,
- info->info.conn,
- info->info.drawable,
- info->info.visual,
- info->info.colormap,
- info->info.depth,
- info->info.debug,
- info->info.alloc_grayscale,
- info->info.alloc_colors_max,
- info->info.mask,
- info->info.shape_dither);
+ _output_setup(e->output.w,
+ e->output.h,
+ info->info.rotation,
+ info->info.conn,
+ info->info.drawable,
+ info->info.visual,
+ info->info.colormap,
+ info->info.depth,
+ info->info.debug,
+ info->info.alloc_grayscale,
+ info->info.alloc_colors_max,
+ info->info.mask,
+ info->info.shape_dither);
if (!e->engine.data.output) return;
if (!e->engine.data.context)
e->engine.data.context =
evas_software_xcb_outbuf_rotation_set(re->ob, info->info.rotation);
}
-static void *
-eng_output_setup(int w,
- int h,
- int rot,
- XCBConnection *conn,
- XCBDRAWABLE draw,
- XCBVISUALTYPE *vis,
- XCBCOLORMAP cmap,
- int depth,
- int debug,
- int grayscale,
- int max_colors,
- XCBDRAWABLE mask,
- int shape_dither)
-{
- Render_Engine *re;
- Outbuf_Perf *perf;
-
- re = calloc(1, sizeof(Render_Engine));
- /* if we haven't initialized - init (automatic abort if already done) */
- 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();
-
- evas_software_xcb_x_init();
- evas_software_xcb_x_color_init();
- evas_software_xcb_outbuf_init();
-
- /* get any stored performance metrics from device (xserver) */
- perf = evas_software_xcb_outbuf_perf_restore_x(conn, draw, vis, cmap, depth);
- re->ob = evas_software_xcb_outbuf_setup_x(w, h, rot,
- OUTBUF_DEPTH_INHERIT,
- conn,
- draw,
- vis,
- cmap,
- depth,
- perf,
- grayscale,
- max_colors,
- mask, shape_dither);
- if (!re->ob)
- {
- evas_software_xcb_outbuf_perf_free(perf);
- free(re);
- return NULL;
- }
- evas_software_xcb_outbuf_debug_set(re->ob, debug);
- re->tb = evas_common_tilebuf_new(w, h);
- if (!re->tb)
- {
- evas_software_xcb_outbuf_free(re->ob);
- free(re);
- return NULL;
- }
- /* in preliminary tests 16x16 gave highest framerates */
- evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
- return re;
-}
-
static void
eng_output_free(void *data)
{
re = (Render_Engine *)data;
evas_software_xcb_outbuf_reconfigure(re->ob, w, h,
evas_software_xcb_outbuf_get_rot(re->ob),
- OUTBUF_DEPTH_INHERIT);
+ OUTBUF_DEPTH_INHERIT);
evas_common_tilebuf_free(re->tb);
re->tb = evas_common_tilebuf_new(w, h);
if (re->tb)
evas_software_xcb_outbuf_flush(re->ob);
}
-static void *
-eng_context_new(void *data)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_draw_context_new();
-}
-
-static void
-eng_context_free(void *data, void *context)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_free(context);
-}
-
-static void
-eng_context_clip_set(void *data, void *context, int x, int y, int w, int h)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_set_clip(context, x, y, w, h);
-}
-
-static void
-eng_context_clip_clip(void *data, void *context, int x, int y, int w, int h)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_clip_clip(context, x, y, w, h);
-}
-
-static void
-eng_context_clip_unset(void *data, void *context)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_unset_clip(context);
-}
-
-static int
-eng_context_clip_get(void *data, void *context, int *x, int *y, int *w, int *h)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- *x = ((RGBA_Draw_Context *)context)->clip.x;
- *y = ((RGBA_Draw_Context *)context)->clip.y;
- *w = ((RGBA_Draw_Context *)context)->clip.w;
- *h = ((RGBA_Draw_Context *)context)->clip.h;
- return ((RGBA_Draw_Context *)context)->clip.use;
-}
-
-static void
-eng_context_color_set(void *data, void *context, int r, int g, int b, int a)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_set_color(context, r, g, b, a);
-}
-
-static int
-eng_context_color_get(void *data, void *context, int *r, int *g, int *b, int *a)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- *r = (int)(R_VAL(&((RGBA_Draw_Context *)context)->col.col));
- *g = (int)(G_VAL(&((RGBA_Draw_Context *)context)->col.col));
- *b = (int)(B_VAL(&((RGBA_Draw_Context *)context)->col.col));
- *a = (int)(A_VAL(&((RGBA_Draw_Context *)context)->col.col));
- return 1;
-}
-
-static void
-eng_context_multiplier_set(void *data, void *context, int r, int g, int b, int a)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_set_multiplier(context, r, g, b, a);
-}
-
-static void
-eng_context_multiplier_unset(void *data, void *context)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_unset_multiplier(context);
-}
-
-static int
-eng_context_multiplier_get(void *data, void *context, int *r, int *g, int *b, int *a)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- *r = (int)(R_VAL(&((RGBA_Draw_Context *)context)->mul.col));
- *g = (int)(G_VAL(&((RGBA_Draw_Context *)context)->mul.col));
- *b = (int)(B_VAL(&((RGBA_Draw_Context *)context)->mul.col));
- *a = (int)(A_VAL(&((RGBA_Draw_Context *)context)->mul.col));
- return ((RGBA_Draw_Context *)context)->mul.use;
-}
-
-static void
-eng_context_cutout_add(void *data, void *context, int x, int y, int w, int h)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_add_cutout(context, x, y, w, h);
-}
-
-static void
-eng_context_cutout_clear(void *data, void *context)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_clear_cutouts(context);
-}
-
-static void
-eng_context_anti_alias_set(void *data, void *context, unsigned char aa)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_set_anti_alias(context, aa);
-}
-
-static unsigned char
-eng_context_anti_alias_get(void *data, void *context)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return ((RGBA_Draw_Context *)context)->anti_alias;
-}
-
-static void
-eng_context_color_interpolation_set(void *data, void *context, int color_space)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_set_color_interpolation(context, color_space);
-}
-
-static int
-eng_context_color_interpolation_get(void *data, void *context)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return ((RGBA_Draw_Context *)context)->interpolation.color_space;
-}
-
-
-
-
-
-
-static void
-eng_rectangle_draw(void *data, void *context, void *surface, int x, int y, int w, int h)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
-#ifdef IMGONLY
- return;
-#endif
- evas_common_rectangle_draw(surface, context, x, y, w, h);
- evas_common_cpu_end_opt();
-}
-
-static void
-eng_line_draw(void *data, void *context, void *surface, int x1, int y1, int x2, int y2)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
-#ifdef IMGONLY
- return;
-#endif
- evas_common_line_draw(surface, context, x1, y1, x2, y2);
- evas_common_cpu_end_opt();
-}
-
-static void *
-eng_polygon_point_add(void *data, void *context, void *polygon, int x, int y)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_polygon_point_add(polygon, x, y);
- context = NULL;
-}
-
-static void *
-eng_polygon_points_clear(void *data, void *context, void *polygon)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_polygon_points_clear(polygon);
- context = NULL;
-}
-
-static void
-eng_polygon_draw(void *data, void *context, void *surface, void *polygon)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
-#ifdef IMGONLY
- return;
-#endif
- evas_common_polygon_draw(surface, context, polygon);
- evas_common_cpu_end_opt();
-}
-
-static void *
-eng_gradient_color_add(void *data, void *context, void *gradient, int r, int g, int b, int a, int distance)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- if (!gradient)
- gradient = evas_common_gradient_new();
- evas_common_gradient_color_add(gradient, r, g, b, a, distance);
- return gradient;
- context = NULL;
-}
-
-static void *
-eng_gradient_colors_clear(void *data, void *context, void *gradient)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_gradient_colors_clear(gradient);
- return gradient;
- context = NULL;
-}
-
-static void
-eng_gradient_free(void *data, void *gradient)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_gradient_free(gradient);
-}
-
-static void
-eng_gradient_fill_set(void *data, void *gradient, int x, int y, int w, int h)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_gradient_fill_set(gradient, x, y, w, h);
-}
-
-static void
-eng_gradient_type_set(void *data, void *gradient, char *name)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_gradient_type_set(gradient, name);
-}
-
-static void
-eng_gradient_type_params_set(void *data, void *gradient, char *params)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_gradient_type_params_set(gradient, params);
-}
-
-static void *
-eng_gradient_geometry_init(void *data, void *gradient, int spread)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- gradient = evas_common_gradient_geometry_init(gradient, spread);
- return gradient;
-}
-
-static int
-eng_gradient_alpha_get(void *data, void *gradient, int spread)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_gradient_has_alpha(gradient, spread);
-}
-
-static void
-eng_gradient_map(void *data, void *context, void *gradient, int spread)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_gradient_map(context, gradient, spread);
- evas_common_cpu_end_opt();
-}
-
-static void
-eng_gradient_draw(void *data, void *context, void *surface, void *gradient, int x, int y, int w, int h, double angle, int spread)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
-#ifdef IMGONLY
- return;
-#endif
- evas_common_gradient_draw(surface, context, x, y, w, h, gradient, angle, spread);
- evas_common_cpu_end_opt();
-}
-
-static void *
-eng_image_load(void *data, char *file, char *key, int *error)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- *error = 0;
- return evas_common_load_image_from_file(file, key);
-}
-
-static void *
-eng_image_new_from_data(void *data, int w, int h, DATA32 *image_data)
-{
- Render_Engine *re;
- RGBA_Image *im;
-
- re = (Render_Engine *)data;
- im = evas_common_image_new();
- im->image = evas_common_image_surface_new(im);
- if (!im->image)
- {
- evas_common_image_free(im);
- return NULL;
- }
- im->image->w = w;
- im->image->h = h;
- im->image->data = image_data;
- im->image->no_free = 1;
- return im;
-}
-
-static void *
-eng_image_new_from_copied_data(void *data, int w, int h, DATA32 *image_data)
-{
- Render_Engine *re;
- RGBA_Image *im;
-
- re = (Render_Engine *)data;
- im = evas_common_image_create(w, h);
- if (!im) return NULL;
- if (image_data)
- memcpy(im->image->data, image_data, w * h * sizeof(DATA32));
- return im;
-}
-
-static void
-eng_image_free(void *data, void *image)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_image_unref(image);
-}
-
-static void
-eng_image_size_get(void *data, void *image, int *w, int *h)
-{
- Render_Engine *re;
- RGBA_Image *im;
-
- re = (Render_Engine *)data;
- im = image;
- if (w) *w = im->image->w;
- if (h) *h = im->image->h;
-}
-
-static void *
-eng_image_size_set(void *data, void *image, int w, int h)
-{
- Render_Engine *re;
- RGBA_Image *im, *im_old;
-
- re = (Render_Engine *)data;
- im_old = image;
- im = evas_common_image_create(w, h);
- if (!im) return im_old;
- if (im_old)
- {
- evas_common_load_image_data_from_file(im_old);
- if (im_old->image->data)
- {
- evas_common_blit_rectangle(im_old, im, 0, 0, w, h, 0, 0);
- evas_common_cpu_end_opt();
- }
- evas_common_image_unref(im_old);
- }
- return im;
-}
-
-static void *
-eng_image_dirty_region(void *data, void *image, int x, int y, int w, int h)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_image_dirty(image);
- return image;
- x = 0;
- y = 0;
- w = 0;
- h = 0;
-}
-
-static void *
-eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data)
-{
- Render_Engine *re;
- RGBA_Image *im;
-
- re = (Render_Engine *)data;
- im = image;
- evas_common_load_image_data_from_file(im);
- if (to_write)
- {
- if (im->references > 1)
- {
- RGBA_Image *im_new;
-
- im_new = evas_common_image_create(im->image->w, im->image->h);
- if (!im_new) return im;
- evas_common_blit_rectangle(im, im_new, 0, 0, im->image->w, im->image->h, 0, 0);
- evas_common_cpu_end_opt();
- evas_common_image_unref(im);
- im = im_new;
- }
- else
- evas_common_image_dirty(im);
- }
- *image_data = im->image->data;
- return im;
-}
-
-static void *
-eng_image_data_put(void *data, void *image, DATA32 *image_data)
-{
- Render_Engine *re;
- RGBA_Image *im;
-
- re = (Render_Engine *)data;
- im = image;
- if (image_data != im->image->data)
- {
- int w, h;
-
- w = im->image->w;
- h = im->image->h;
- evas_common_image_unref(im);
- return eng_image_new_from_data(data, w, h, image_data);
- }
- /* hmmm - but if we wrote... why bother? */
-/* evas_common_image_dirty(im); */
- return im;
-}
-
-static void *
-eng_image_alpha_set(void *data, void *image, int has_alpha)
-{
- Render_Engine *re;
- RGBA_Image *im;
-
- re = (Render_Engine *)data;
- im = image;
- if (im->references > 1)
- {
- RGBA_Image *im_new;
-
- im_new = evas_common_image_create(im->image->w, im->image->h);
- if (!im_new) return im;
- evas_common_load_image_data_from_file(im);
- evas_common_blit_rectangle(im, im_new, 0, 0, im->image->w, im->image->h, 0, 0);
- evas_common_cpu_end_opt();
- evas_common_image_unref(im);
- im = im_new;
- }
- else
- evas_common_image_dirty(im);
- if (has_alpha)
- im->flags |= RGBA_IMAGE_HAS_ALPHA;
- else
- im->flags &= ~RGBA_IMAGE_HAS_ALPHA;
- return im;
-}
-
-
-static int
-eng_image_alpha_get(void *data, void *image)
-{
- Render_Engine *re;
- RGBA_Image *im;
-
- re = (Render_Engine *)data;
- im = image;
- if (im->flags & RGBA_IMAGE_HAS_ALPHA) return 1;
- return 0;
-}
-
-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)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_load_image_data_from_file(image);
- if (smooth)
- evas_common_scale_rgba_in_to_out_clip_smooth(image, surface, context,
- src_x, src_y, src_w, src_h,
- dst_x, dst_y, dst_w, dst_h);
- else
- evas_common_scale_rgba_in_to_out_clip_sample(image, surface, context,
- src_x, src_y, src_w, src_h,
- dst_x, dst_y, dst_w, dst_h);
- evas_common_cpu_end_opt();
-}
-
-static char *
-eng_image_comment_get(void *data, void *image, char *key)
-{
- Render_Engine *re;
- RGBA_Image *im;
-
- re = (Render_Engine *)data;
- im = image;
- return im->info.comment;
- key = 0;
-}
-
-static char *
-eng_image_format_get(void *data, void *image)
-{
- Render_Engine *re;
- RGBA_Image *im;
-
- re = (Render_Engine *)data;
- im = image;
-// if (im->info.format == 1) return "png";
- return NULL;
-}
-
-static void
-eng_image_cache_flush(void *data)
-{
- Render_Engine *re;
- int tmp_size;
-
- re = (Render_Engine *)data;
- tmp_size = evas_common_image_get_cache();
- evas_common_image_set_cache(0);
- evas_common_image_set_cache(tmp_size);
-}
-
-static void
-eng_image_cache_set(void *data, int bytes)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_image_set_cache(bytes);
-}
-
-static int
-eng_image_cache_get(void *data)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_image_get_cache();
-}
-
-static void *
-eng_font_load(void *data, char *name, int size)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_load(name, size);
-}
-
-static void *
-eng_font_memory_load(void *data, char *name, int size, const void *fdata, int fdata_size)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_memory_load(name, size, fdata, fdata_size);
-}
-
-static void *
-eng_font_add(void *data, void *font, char *name, int size)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_add(font, name, size);
-}
-
-static void *
-eng_font_memory_add(void *data, void *font, char *name, int size, const void *fdata, int fdata_size)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_memory_add(font, name, size, fdata, fdata_size);
-}
-
-static void
-eng_font_free(void *data, void *font)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_font_free(font);
-}
-
-static int
-eng_font_ascent_get(void *data, void *font)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_ascent_get(font);
-}
-
-static int
-eng_font_descent_get(void *data, void *font)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_descent_get(font);
-}
-
-static int
-eng_font_max_ascent_get(void *data, void *font)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_max_ascent_get(font);
-}
-
-static int
-eng_font_max_descent_get(void *data, void *font)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_max_descent_get(font);
-}
-
-static void
-eng_font_string_size_get(void *data, void *font, char *text, int *w, int *h)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_font_query_size(font, text, w, h);
-}
-
-static int
-eng_font_inset_get(void *data, void *font, char *text)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_query_inset(font, text);
-}
-
-static int
-eng_font_h_advance_get(void *data, void *font, char *text)
-{
- Render_Engine *re;
- int h, v;
-
- re = (Render_Engine *)data;
- evas_common_font_query_advance(font, text, &h, &v);
- return h;
-}
-
-static int
-eng_font_v_advance_get(void *data, void *font, char *text)
-{
- Render_Engine *re;
- int h, v;
-
- re = (Render_Engine *)data;
- evas_common_font_query_advance(font, text, &h, &v);
- return v;
-}
-
-static int
-eng_font_char_coords_get(void *data, void *font, char *text, int pos, int *cx, int *cy, int *cw, int *ch)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_query_char_coords(font, text, pos, cx, cy, cw, ch);
-}
-
-static int
-eng_font_char_at_coords_get(void *data, void *font, char *text, int x, int y, int *cx, int *cy, int *cw, int *ch)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_query_text_at_pos(font, text, x, y, cx, cy, cw, ch);
-}
-
-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, char *text)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
-#ifdef IMGONLY
- return;
-#endif
- if ((w == ow) && (h == oh))
- evas_common_font_draw(surface, context, font, x, y, text);
- else
- {
- /* create output surface size ow x oh and scale to w x h */
- RGBA_Draw_Context *dc, *dc_in;
-
- dc_in = context;
- dc = evas_common_draw_context_new();
- if (dc)
- {
- RGBA_Image *im;
- int inset;
-
- dc->col.col = dc_in->col.col;
- inset = evas_common_font_query_inset( font, text);
- im = evas_common_image_create(ow+inset, oh);
- if (im)
- {
- int max_ascent;
- int j;
-
- im->flags |= RGBA_IMAGE_HAS_ALPHA;
- j = (ow+inset) * oh;
- memset(im->image->data, 0, j * sizeof(DATA32));
-
- max_ascent = evas_common_font_max_ascent_get(font);
-
- evas_common_font_draw(im, dc, font, 0, max_ascent, text);
- evas_common_cpu_end_opt();
- evas_common_scale_rgba_in_to_out_clip_smooth(im, surface, context,
- inset, 0, ow, oh,
- x + ((inset * w) / ow), y - ((max_ascent * h) / oh),
- w, h);
- evas_common_image_free(im);
- }
- evas_common_draw_context_free(dc);
- }
- }
- evas_common_cpu_end_opt();
-}
-
-static void
-eng_font_cache_flush(void *data)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_font_flush();
-}
-
-static void
-eng_font_cache_set(void *data, int bytes)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_font_cache_set(bytes);
-}
-
-static int
-eng_font_cache_get(void *data)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_cache_get();
-}
-
-static void
-eng_font_hinting_set(void *data, void *font, int hinting)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_font_hinting_set(font, hinting);
-}
-
-static int
-eng_font_hinting_can_hint(void *data, int hinting)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_hinting_available(hinting);
-}
-
-
-
-
-
-
-
-
-
-/* private engine functions the calling prog can use */
-
-/* Convenient function for getting the best visual, colormap and depth */
-static XCBSCREEN *
-eng_screen_get(XCBConnection *conn, int screen)
-{
- XCBSCREENIter i;
- int cur;
-
- if (!conn) return NULL;
-
- i = XCBConnSetupSuccessRepRootsIter(XCBGetSetup(conn));
- if (screen > i.rem - 1) return NULL; /* screen must be between 0 and i.rem - 1 */
- for (cur = 0; cur <= screen; XCBSCREENNext(&i), ++cur) {}
-
- return i.data;
-}
-
-static XCBVISUALTYPE *
-eng_best_visual_get(XCBConnection *conn, int screen)
-{
- XCBSCREEN *scr;
- XCBDEPTH *d;
- XCBVISUALTYPEIter iter;
- int cur;
-
- if (!conn) return NULL;
- scr = eng_screen_get(conn, screen);
- if (!scr) return NULL;
- d = XCBSCREENAllowedDepthsIter(scr).data;
- if (!d) return NULL;
-
- iter = XCBDEPTHVisualsIter(d);
- for (cur = 0 ; cur < iter.rem ; XCBVISUALTYPENext(&iter), ++cur)
- if (scr->root_visual.id == iter.data->visual_id.id)
- return iter.data;
-
- return NULL;
-}
-
-static XCBCOLORMAP
-eng_best_colormap_get(XCBConnection *conn, int screen)
-{
- XCBSCREEN *scr;
- XCBCOLORMAP c;
-
- c.xid = 0;
- if (!conn) return c;
- scr = eng_screen_get(conn, screen);
- if (!scr) return c;
-
- return scr->default_colormap;
-}
-
-static int
-eng_best_depth_get(XCBConnection *conn, int screen)
-{
- XCBSCREEN *scr;
-
- if (!conn) return 0;
- scr = eng_screen_get(conn, screen);
- if (!scr) return 0;
-
- return scr->root_depth;
-}
-
-static Evas_Performance *
-eng_output_perf_new(Evas *e, XCBConnection *conn, XCBVISUALTYPE *vis, XCBCOLORMAP cmap, XCBDRAWABLE draw, int depth)
-{
- return evas_software_xcb_outbuf_perf_new_x(conn, draw, vis, cmap, depth);
- e = NULL;
-}
-
-static Evas_Performance *
-eng_output_perf_test(Evas *e, XCBConnection *conn, XCBVISUALTYPE *vis, XCBCOLORMAP cmap, XCBDRAWABLE draw, int depth)
-{
- return evas_software_xcb_outbuf_perf_x(conn, draw, vis, cmap, depth);
- e = NULL;
-}
-
-static char *
-eng_output_perf_data(Evas_Performance *perf)
-{
- return evas_software_xcb_outbuf_perf_serialize_x(perf);
-}
-
-static char *
-eng_output_perf_key(Evas_Performance *perf)
-{
- return evas_software_xcb_outbuf_perf_serialize_info_x(perf);
-}
-
-static void
-eng_output_perf_free(Evas_Performance *perf)
-{
- evas_software_xcb_outbuf_perf_free(perf);
-}
-
-static void
-eng_output_perf_build(Evas_Performance *perf, const char *data)
-{
- evas_software_xcb_outbuf_perf_deserialize_x(perf, data);
-}
-
-static void
-eng_output_perf_device_store(Evas_Performance *perf)
-{
- evas_software_xcb_outbuf_perf_store_x(perf);
-}
-
-int module_open(Evas_Module *em)
+/* module advertising code */
+int
+module_open(Evas_Module *em)
{
if (!em) return 0;
- em->functions = (void *)(&eng_func);
+ /* 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);
+ /* now advertise out own api */
+ em->functions = (void *)(&func);
return 1;
}
-void module_close(void)
+void
+module_close(void)
{
-
}
Evas_Module_Api evas_modapi =
--- /dev/null
+#ifndef _EVAS_ENGINE_XRENDER_X11_H
+#define _EVAS_ENGINE_XRENDER_X11_H
+
+#include <X11/Xlib.h>
+
+typedef struct _Evas_Engine_Info_XRender_X11 Evas_Engine_Info_XRender_X11;
+
+struct _Evas_Engine_Info_XRender_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
+
+
-## Process this file with automake to produce Makefile.in
-
AUTOMAKE_OPTIONS = 1.4 foreign
-# A list of all the files in the current directory which can be regenerated
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@
+INCLUDES = -I. -I$(top_srcdir)/src/lib -I$(top_srcdir)/src/lib/include -I$(top_srcdir)/src/modules/engines @FREETYPE_CFLAGS@ @x_cflags@
if BUILD_ENGINE_XRENDER_X11
-pkgdir = $(libdir)/evas/modules/engines/xrender_x11/$(MODULE_ARCH)
-
-pkg_LTLIBRARIES = module.la
+pkgdir = $(libdir)/evas/modules/engines/xrender_x11/$(MODULE_ARCH)
-module_la_SOURCES = \
+pkg_LTLIBRARIES = module.la
+module_la_SOURCES = \
evas_engine.h \
evas_engine.c \
evas_engine_ximage.c \
evas_engine_font.c \
evas_engine_gradient.c
-module_la_LIBADD = @x_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_LIBADD = @x_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
-module_la_DEPENDENCIES = \
-$(top_builddir)/config.h
+include_HEADERS = Evas_Engine_XRender_X11.h
endif
evas_engine_xrender.c \
evas_engine_image.c \
evas_engine_font.c \
-evas_engine_gradient.c
+evas_engine_gradient.c \
+Evas_Engine_Buffer.h
#include "evas_engine.h"
#include "Evas_Engine_XRender_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;
+ Xrender_Surface *surface;
+};
+
+struct _Render_Engine
+{
+ Display *disp;
+ Visual *vis;
+ Drawable win;
+ Pixmap mask;
+ unsigned char destination_alpha : 1;
+
+ Ximage_Info *xinf;
+ Xrender_Surface *output;
+ Xrender_Surface *mask_output;
+
+ 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_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_context_new(void *data);
-static void eng_context_free(void *data, void *context);
-static void eng_context_clip_set(void *data, void *context, int x, int y, int w, int h);
-static void eng_context_clip_clip(void *data, void *context, int x, int y, int w, int h);
-static void eng_context_clip_unset(void *data, void *context);
-static int eng_context_clip_get(void *data, void *context, int *x, int *y, int *w, int *h);
-static void eng_context_color_set(void *data, void *context, int r, int g, int b, int a);
-static int eng_context_color_get(void *data, void *context, int *r, int *g, int *b, int *a);
-static void eng_context_multiplier_set(void *data, void *context, int r, int g, int b, int a);
-static void eng_context_multiplier_unset(void *data, void *context);
-static int eng_context_multiplier_get(void *data, void *context, int *r, int *g, int *b, int *a);
-static void eng_context_cutout_add(void *data, void *context, int x, int y, int w, int h);
-static void eng_context_cutout_clear(void *data, void *context);
-static void eng_context_anti_alias_set(void *data, void *context, unsigned char aa);
-static unsigned char eng_context_anti_alias_get(void *data, void *context);
-static void eng_context_color_interpolation_set(void *data, void *context, int color_space);
-static int eng_context_color_interpolation_get(void *data, void *context);
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_point_add(void *data, void *context, void *polygon, int x, int y);
-static void *eng_polygon_points_clear(void *data, void *context, void *polygon);
static void eng_polygon_draw(void *data, void *context, void *surface, void *polygon);
static void *eng_gradient_color_add(void *data, void *context, void *gradient, int r, int g, int b, int a, int distance);
static void *eng_gradient_colors_clear(void *data, void *context, void *gradient);
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_load(void *data, char *name, int size);
-static void *eng_font_memory_load(void *data, char *name, int size, const void *fdata, int fdata_size);
-static void *eng_font_add(void *data, void *font, char *name, int size);
-static void *eng_font_memory_add(void *data, void *font, char *name, int size, const void *fdata, int fdata_size);
-static void eng_font_free(void *data, void *font);
-static int eng_font_ascent_get(void *data, void *font);
-static int eng_font_descent_get(void *data, void *font);
-static int eng_font_max_ascent_get(void *data, void *font);
-static int eng_font_max_descent_get(void *data, void *font);
-static void eng_font_string_size_get(void *data, void *font, char *text, int *w, int *h);
-static int eng_font_inset_get(void *data, void *font, char *text);
-static int eng_font_h_advance_get(void *data, void *font, char *text);
-static int eng_font_v_advance_get(void *data, void *font, char *text);
-static int eng_font_char_coords_get(void *data, void *font, char *text, int pos, int *cx, int *cy, int *cw, int *ch);
-static int eng_font_char_at_coords_get(void *data, void *font, char *text, int x, int y, int *cx, int *cy, int *cw, int *ch);
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, char *text);
-static void eng_font_cache_flush(void *data);
-static void eng_font_cache_set(void *data, int bytes);
-static int eng_font_cache_get(void *data);
-static void eng_font_hinting_set(void *data, void *font, int hinting);
-static int eng_font_hinting_can_hint(void *data, int hinting);
-
-typedef struct _Render_Engine Render_Engine;
-typedef struct _Render_Engine_Update Render_Engine_Update;
-
-struct _Render_Engine_Update
-{
- int x, y, w, h;
- Xrender_Surface *surface;
-};
-
-struct _Render_Engine
-{
- Display *disp;
- Visual *vis;
- Drawable win;
- Pixmap mask;
- unsigned char destination_alpha : 1;
-
- Ximage_Info *xinf;
- Xrender_Surface *output;
- Xrender_Surface *mask_output;
-
- Tilebuf *tb;
- Tilebuf_Rect *rects;
- Evas_Object_List *cur_rect;
- int end : 1;
-
- Evas_List *updates;
-};
-
-static Evas_Func eng_func =
-{
- eng_info,
- eng_info_free,
- eng_setup,
- eng_output_free,
- eng_output_resize,
- eng_output_tile_size_set,
- eng_output_redraws_rect_add,
- eng_output_redraws_rect_del,
- eng_output_redraws_clear,
- eng_output_redraws_next_update_get,
- eng_output_redraws_next_update_push,
- eng_output_flush,
- /* draw context virtual methods */
- eng_context_new,
- eng_context_free,
- eng_context_clip_set,
- eng_context_clip_clip,
- eng_context_clip_unset,
- eng_context_clip_get,
- eng_context_color_set,
- eng_context_color_get,
- eng_context_multiplier_set,
- eng_context_multiplier_unset,
- eng_context_multiplier_get,
- eng_context_cutout_add,
- eng_context_cutout_clear,
- eng_context_anti_alias_set,
- eng_context_anti_alias_get,
- eng_context_color_interpolation_set,
- eng_context_color_interpolation_get,
- /* rectangle draw funcs */
- eng_rectangle_draw,
- /* line draw funcs */
- eng_line_draw,
- /* polygon draw funcs */
- eng_polygon_point_add,
- eng_polygon_points_clear,
- eng_polygon_draw,
- /* gradient draw funcs */
- eng_gradient_color_add,
- eng_gradient_colors_clear,
- eng_gradient_free,
- eng_gradient_fill_set,
- eng_gradient_type_set,
- eng_gradient_type_params_set,
- eng_gradient_geometry_init,
- eng_gradient_alpha_get,
- eng_gradient_map,
- eng_gradient_draw,
- /* image draw funcs */
- eng_image_load,
- eng_image_new_from_data,
- eng_image_new_from_copied_data,
- eng_image_free,
- eng_image_size_get,
- eng_image_size_set,
- eng_image_dirty_region,
- eng_image_data_get,
- eng_image_data_put,
- eng_image_alpha_set,
- eng_image_alpha_get,
- eng_image_draw,
- eng_image_comment_get,
- eng_image_format_get,
- /* image cache funcs */
- eng_image_cache_flush,
- eng_image_cache_set,
- eng_image_cache_get,
- /* font draw functions */
- eng_font_load,
- eng_font_memory_load,
- eng_font_add,
- eng_font_memory_add,
- eng_font_free,
- eng_font_ascent_get,
- eng_font_descent_get,
- eng_font_max_ascent_get,
- eng_font_max_descent_get,
- eng_font_string_size_get,
- eng_font_inset_get,
- eng_font_h_advance_get,
- eng_font_v_advance_get,
- eng_font_char_coords_get,
- eng_font_char_at_coords_get,
- eng_font_draw,
- /* font cache functions */
- eng_font_cache_flush,
- eng_font_cache_set,
- eng_font_cache_get,
-
- eng_font_hinting_set,
- eng_font_hinting_can_hint
-};
+/* internal engine routines */
+/* engine api this module provides */
static void *
eng_info(Evas *e)
{
_xr_image_info_pool_flush(re->xinf, 0, 0);
}
-static void *
-eng_context_new(void *data)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_draw_context_new();
-}
-
-static void
-eng_context_free(void *data, void *context)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_free(context);
-}
-
-static void
-eng_context_clip_set(void *data, void *context, int x, int y, int w, int h)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_set_clip(context, x, y, w, h);
-}
-
-static void
-eng_context_clip_clip(void *data, void *context, int x, int y, int w, int h)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_clip_clip(context, x, y, w, h);
-}
-
-static void
-eng_context_clip_unset(void *data, void *context)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_unset_clip(context);
-}
-
-static int
-eng_context_clip_get(void *data, void *context, int *x, int *y, int *w, int *h)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- *x = ((RGBA_Draw_Context *)context)->clip.x;
- *y = ((RGBA_Draw_Context *)context)->clip.y;
- *w = ((RGBA_Draw_Context *)context)->clip.w;
- *h = ((RGBA_Draw_Context *)context)->clip.h;
- return ((RGBA_Draw_Context *)context)->clip.use;
-}
-
-static void
-eng_context_color_set(void *data, void *context, int r, int g, int b, int a)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_set_color(context, r, g, b, a);
-}
-
-static int
-eng_context_color_get(void *data, void *context, int *r, int *g, int *b, int *a)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- *r = (int)(R_VAL(&((RGBA_Draw_Context *)context)->col.col));
- *g = (int)(G_VAL(&((RGBA_Draw_Context *)context)->col.col));
- *b = (int)(B_VAL(&((RGBA_Draw_Context *)context)->col.col));
- *a = (int)(A_VAL(&((RGBA_Draw_Context *)context)->col.col));
- return 1;
-}
-
-static void
-eng_context_multiplier_set(void *data, void *context, int r, int g, int b, int a)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_set_multiplier(context, r, g, b, a);
-}
-
-static void
-eng_context_multiplier_unset(void *data, void *context)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_unset_multiplier(context);
-}
-
-static int
-eng_context_multiplier_get(void *data, void *context, int *r, int *g, int *b, int *a)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- *r = (int)(R_VAL(&((RGBA_Draw_Context *)context)->mul.col));
- *g = (int)(G_VAL(&((RGBA_Draw_Context *)context)->mul.col));
- *b = (int)(B_VAL(&((RGBA_Draw_Context *)context)->mul.col));
- *a = (int)(A_VAL(&((RGBA_Draw_Context *)context)->mul.col));
- return ((RGBA_Draw_Context *)context)->mul.use;
-}
-
-static void
-eng_context_cutout_add(void *data, void *context, int x, int y, int w, int h)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_add_cutout(context, x, y, w, h);
-}
-
-static void
-eng_context_cutout_clear(void *data, void *context)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_clear_cutouts(context);
-}
-
-static void
-eng_context_anti_alias_set(void *data, void *context, unsigned char aa)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_set_anti_alias(context, aa);
-}
-
-static unsigned char
-eng_context_anti_alias_get(void *data, void *context)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return ((RGBA_Draw_Context *)context)->anti_alias;
-}
-
-static void
-eng_context_color_interpolation_set(void *data, void *context, int color_space)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_draw_context_set_color_interpolation(context, color_space);
-}
-
-static int
-eng_context_color_interpolation_get(void *data, void *context)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return ((RGBA_Draw_Context *)context)->interpolation.color_space;
-}
-
-
-
-
-
static void
eng_rectangle_draw(void *data, void *context, void *surface, int x, int y, int w, int h)
{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
_xr_render_surface_rectangle_draw((Xrender_Surface *)surface,
(RGBA_Draw_Context *)context,
x, y, w, h);
static void
eng_line_draw(void *data, void *context, void *surface, int x1, int y1, int x2, int y2)
{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
_xr_render_surface_line_draw((Xrender_Surface *)surface, (RGBA_Draw_Context *)context, x1, y1, x2, y2);
}
-static void *
-eng_polygon_point_add(void *data, void *context, void *polygon, int x, int y)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_polygon_point_add(polygon, x, y);
-}
-
-static void *
-eng_polygon_points_clear(void *data, void *context, void *polygon)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_polygon_points_clear(polygon);
-}
-
static void
eng_polygon_draw(void *data, void *context, void *surface, void *polygon)
{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
_xre_poly_draw((Xrender_Surface *)surface, (RGBA_Draw_Context *)context, (RGBA_Polygon_Point *)polygon);
}
static void *
eng_gradient_colors_clear(void *data, void *context, void *gradient)
{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
return _xre_gradient_colors_clear((XR_Gradient *)gradient);
}
static void
eng_gradient_free(void *data, void *gradient)
{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
_xre_gradient_free((XR_Gradient *)gradient);
}
static void
eng_gradient_fill_set(void *data, void *gradient, int x, int y, int w, int h)
{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
_xre_gradient_fill_set((XR_Gradient *)gradient, x, y, w, h);
}
static void
eng_gradient_type_set(void *data, void *gradient, char *name)
{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
_xre_gradient_type_set((XR_Gradient *)gradient, name);
}
static void
eng_gradient_type_params_set(void *data, void *gradient, char *params)
{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
_xre_gradient_type_params_set((XR_Gradient *)gradient, params);
}
static void *
eng_gradient_geometry_init(void *data, void *gradient, int spread)
{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
return _xre_gradient_geometry_init((XR_Gradient *)gradient, spread);
}
static int
eng_gradient_alpha_get(void *data, void *gradient, int spread)
{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
return _xre_gradient_alpha_get((XR_Gradient *)gradient, spread);
}
static void
eng_gradient_map(void *data, void *context, void *gradient, int spread)
{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
_xre_gradient_map((RGBA_Draw_Context *)context, (XR_Gradient *)gradient, spread);
}
static void
eng_gradient_draw(void *data, void *context, void *surface, void *gradient, int x, int y, int w, int h, double angle, int spread)
{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
_xre_gradient_draw((Xrender_Surface *)surface,
(RGBA_Draw_Context *)context,
(XR_Gradient *)gradient, x, y, w, h, angle, spread);
static void
eng_image_free(void *data, void *image)
{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
if (!image) return;
_xre_image_free((XR_Image *)image);
}
static void
eng_image_size_get(void *data, void *image, int *w, int *h)
{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
if (!image) return;
if (w) *w = ((XR_Image *)image)->w;
if (h) *h = ((XR_Image *)image)->h;
static void *
eng_image_size_set(void *data, void *image, int w, int h)
{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
if (!image) return image;
if ((w <= 0) || (h <= 0))
{
static void *
eng_image_dirty_region(void *data, void *image, int x, int y, int w, int h)
{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
if (!image) return image;
_xre_image_dirty((XR_Image *)image);
_xre_image_region_dirty((XR_Image *)image, x, y, w, h);
static void *
eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data)
{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
if (!image) return image;
if (to_write)
{
static void *
eng_image_data_put(void *data, void *image, DATA32 *image_data)
{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
if (!image) return image;
if (_xre_image_data_get((XR_Image *)image) != image_data)
{
static void *
eng_image_alpha_set(void *data, void *image, int has_alpha)
{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
if (!image) return image;
if (((((XR_Image *)image)->alpha) && (has_alpha)) ||
((!((XR_Image *)image)->alpha) && (!has_alpha)))
static int
eng_image_alpha_get(void *data, void *image)
{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
if (!image) return 0;
return _xre_image_alpha_get((XR_Image *)image);
}
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)
{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
if ((!image) || (!surface)) return;
_xre_image_surface_gen((XR_Image *)image);
if (((XR_Image *)image)->surface)
static char *
eng_image_comment_get(void *data, void *image, char *key)
{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
if (!image) return NULL;
return ((XR_Image *)image)->comment;
}
static char *
eng_image_format_get(void *data, void *image)
{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
if (!image) return NULL;
return ((XR_Image *)image)->format;
}
static void
eng_image_cache_flush(void *data)
{
- Render_Engine *re;
int tmp_size;
-
- re = (Render_Engine *)data;
- tmp_size = evas_common_image_get_cache();
- evas_common_image_set_cache(0);
- evas_common_image_set_cache(tmp_size);
+
+ 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)
{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_image_set_cache(bytes);
+ pfunc.image_cache_set(data, bytes);
_xre_image_cache_set(bytes);
}
static int
eng_image_cache_get(void *data)
{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_image_get_cache();
-}
-
-static void *
-eng_font_load(void *data, char *name, int size)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_load(name, size);
-}
-
-static void *
-eng_font_memory_load(void *data, char *name, int size, const void *fdata, int fdata_size)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_memory_load(name, size, fdata, fdata_size);
-}
-
-static void *
-eng_font_add(void *data, void *font, char *name, int size)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_add(font, name, size);
-}
-
-static void *
-eng_font_memory_add(void *data, void *font, char *name, int size, const void *fdata, int fdata_size)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_memory_add(font, name, size, fdata, fdata_size);
-}
-
-static void
-eng_font_free(void *data, void *font)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_font_free(font);
-}
-
-static int
-eng_font_ascent_get(void *data, void *font)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_ascent_get(font);
-}
-
-static int
-eng_font_descent_get(void *data, void *font)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_descent_get(font);
-}
-
-static int
-eng_font_max_ascent_get(void *data, void *font)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_max_ascent_get(font);
-}
-
-static int
-eng_font_max_descent_get(void *data, void *font)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_max_descent_get(font);
-}
-
-static void
-eng_font_string_size_get(void *data, void *font, char *text, int *w, int *h)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_font_query_size(font, text, w, h);
-}
-
-static int
-eng_font_inset_get(void *data, void *font, char *text)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_query_inset(font, text);
-}
-
-static int
-eng_font_h_advance_get(void *data, void *font, char *text)
-{
- Render_Engine *re;
- int h, v;
-
- re = (Render_Engine *)data;
- evas_common_font_query_advance(font, text, &h, &v);
- return h;
-}
-
-static int
-eng_font_v_advance_get(void *data, void *font, char *text)
-{
- Render_Engine *re;
- int h, v;
-
- re = (Render_Engine *)data;
- evas_common_font_query_advance(font, text, &h, &v);
- return v;
-}
-
-static int
-eng_font_char_coords_get(void *data, void *font, char *text, int pos, int *cx, int *cy, int *cw, int *ch)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_query_char_coords(font, text, pos, cx, cy, cw, ch);
-}
-
-static int
-eng_font_char_at_coords_get(void *data, void *font, char *text, int x, int y, int *cx, int *cy, int *cw, int *ch)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_query_text_at_pos(font, text, x, y, cx, cy, cw, ch);
+ return pfunc.image_cache_get(data);
}
static void
}
}
-static void
-eng_font_cache_flush(void *data)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_font_flush();
-}
-
-static void
-eng_font_cache_set(void *data, int bytes)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_font_cache_set(bytes);
-}
-
-static int
-eng_font_cache_get(void *data)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_font_cache_get();
-}
-
-static void
-eng_font_hinting_set(void *data, void *font, int hinting)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- evas_common_font_hinting_set(font, hinting);
-}
-
-static int
-eng_font_hinting_can_hint(void *data, int hinting)
-{
- Render_Engine *re;
-
- re = (Render_Engine *)data;
- return evas_common_hinting_available(hinting);
-}
-
-int module_open(Evas_Module *em)
+/* module advertising code */
+int
+module_open(Evas_Module *em)
{
if (!em) return 0;
- em->functions = (void *)(&eng_func);
+ /* 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_color_add);
+ ORD(gradient_colors_clear);
+ ORD(gradient_free);
+ ORD(gradient_fill_set);
+ ORD(gradient_type_set);
+ ORD(gradient_type_params_set);
+ ORD(gradient_geometry_init);
+ ORD(gradient_alpha_get);
+ ORD(gradient_map);
+ 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_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;
}
-void module_close(void)
+void
+module_close(void)
{
-
}
Evas_Module_Api evas_modapi =