2006-04-24 21:00:21 -07:00
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <GL/gl.h>
|
|
|
|
#include <GL/glu.h>
|
|
|
|
#include <GL/glx.h>
|
2002-11-08 00:02:15 -08:00
|
|
|
#include "evas_common.h"
|
|
|
|
#include "evas_private.h"
|
|
|
|
#include "evas_engine.h"
|
|
|
|
#include "Evas_Engine_GL_X11.h"
|
2003-09-04 00:40:34 -07:00
|
|
|
#include "evas_gl_common.h"
|
2002-11-08 00:02:15 -08:00
|
|
|
|
2006-02-27 20:07:49 -08:00
|
|
|
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, Display *disp, Drawable draw, Visual *vis, Colormap cmap, int depth);
|
|
|
|
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);
|
2006-05-02 00:28:49 -07:00
|
|
|
static void eng_context_render_op_set(void *data, void *context, int op);
|
|
|
|
static int eng_context_render_op_get(void *data, void *context);
|
2006-02-27 20:07:49 -08:00
|
|
|
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);
|
2006-05-02 00:28:49 -07:00
|
|
|
static void *eng_gradient_data_set(void *data, void *context, void *gradient, void *map, int len, int has_alpha);
|
|
|
|
static void *eng_gradient_data_unset(void *data, void *context, void *gradient);
|
2006-02-27 20:07:49 -08:00
|
|
|
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);
|
2006-05-02 00:28:49 -07:00
|
|
|
static void eng_gradient_range_offset_set(void *data, void *gradient, float offset);
|
2006-02-27 20:07:49 -08:00
|
|
|
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);
|
2006-05-02 00:28:49 -07:00
|
|
|
static int eng_gradient_alpha_get(void *data, void *gradient, int spread, int op);
|
2006-02-27 20:07:49 -08:00
|
|
|
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 Visual *eng_best_visual_get(Display *disp, int screen);
|
|
|
|
static Colormap eng_best_colormap_get(Display *disp, int screen);
|
|
|
|
static int eng_best_depth_get(Display *disp, int screen);
|
|
|
|
|
|
|
|
static void eng_font_hinting_set(void *data, void *font, int hinting);
|
|
|
|
static int eng_font_hinting_can_hint(void *data, int hinting);
|
2002-11-08 00:02:15 -08:00
|
|
|
|
|
|
|
typedef struct _Render_Engine Render_Engine;
|
|
|
|
|
|
|
|
struct _Render_Engine
|
|
|
|
{
|
2003-09-04 00:40:34 -07:00
|
|
|
Evas_GL_X11_Window *win;
|
|
|
|
int end;
|
2002-11-08 00:02:15 -08:00
|
|
|
};
|
|
|
|
|
2006-02-27 20:07:49 -08:00
|
|
|
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,
|
2002-11-08 00:02:15 -08:00
|
|
|
/* draw context virtual methods */
|
2006-02-27 20:07:49 -08:00
|
|
|
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,
|
2006-05-02 00:28:49 -07:00
|
|
|
eng_context_render_op_set,
|
2006-05-04 04:52:46 -07:00
|
|
|
eng_context_render_op_get,
|
2002-11-08 00:02:15 -08:00
|
|
|
/* rectangle draw funcs */
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_rectangle_draw,
|
2002-11-08 00:02:15 -08:00
|
|
|
/* line draw funcs */
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_line_draw,
|
2002-11-08 00:02:15 -08:00
|
|
|
/* polygon draw funcs */
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_polygon_point_add,
|
|
|
|
eng_polygon_points_clear,
|
|
|
|
eng_polygon_draw,
|
2002-11-08 00:02:15 -08:00
|
|
|
/* gradient draw funcs */
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_gradient_color_add,
|
|
|
|
eng_gradient_colors_clear,
|
2006-05-02 00:28:49 -07:00
|
|
|
eng_gradient_data_set,
|
|
|
|
eng_gradient_data_unset,
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_gradient_free,
|
|
|
|
eng_gradient_fill_set,
|
2006-05-02 00:28:49 -07:00
|
|
|
eng_gradient_range_offset_set,
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_gradient_type_set,
|
|
|
|
eng_gradient_type_params_set,
|
|
|
|
eng_gradient_geometry_init,
|
|
|
|
eng_gradient_alpha_get,
|
|
|
|
eng_gradient_map,
|
|
|
|
eng_gradient_draw,
|
2002-11-08 00:02:15 -08:00
|
|
|
/* image draw funcs */
|
2006-02-27 20:07:49 -08:00
|
|
|
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,
|
2002-11-08 00:02:15 -08:00
|
|
|
/* image cache funcs */
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_image_cache_flush,
|
|
|
|
eng_image_cache_set,
|
|
|
|
eng_image_cache_get,
|
2002-11-08 00:02:15 -08:00
|
|
|
/* font draw functions */
|
2006-02-27 20:07:49 -08:00
|
|
|
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,
|
2002-11-08 00:02:15 -08:00
|
|
|
/* font cache functions */
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_font_cache_flush,
|
|
|
|
eng_font_cache_set,
|
|
|
|
eng_font_cache_get,
|
|
|
|
|
|
|
|
eng_font_hinting_set,
|
|
|
|
eng_font_hinting_can_hint
|
2002-11-08 00:02:15 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
static void *
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_info(Evas *e)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas_Engine_Info_GL_X11 *info;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
info = calloc(1, sizeof(Evas_Engine_Info_GL_X11));
|
|
|
|
if (!info) return NULL;
|
|
|
|
info->magic.magic = rand();
|
2006-02-27 20:07:49 -08:00
|
|
|
info->func.best_visual_get = eng_best_visual_get;
|
|
|
|
info->func.best_colormap_get = eng_best_colormap_get;
|
|
|
|
info->func.best_depth_get = eng_best_depth_get;
|
2003-09-04 00:40:34 -07:00
|
|
|
printf("GL: create info...\n");
|
2002-11-08 00:02:15 -08:00
|
|
|
return info;
|
|
|
|
e = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_info_free(Evas *e, void *info)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas_Engine_Info_GL_X11 *in;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
in = (Evas_Engine_Info_GL_X11 *)info;
|
|
|
|
free(in);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_setup(Evas *e, void *in)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
Evas_Engine_Info_GL_X11 *info;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
info = (Evas_Engine_Info_GL_X11 *)in;
|
2003-09-04 00:40:34 -07:00
|
|
|
printf("GL: setup info...\n");
|
2002-11-08 00:02:15 -08:00
|
|
|
if (!e->engine.data.output)
|
2005-05-21 19:49:50 -07:00
|
|
|
e->engine.data.output =
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_output_setup(e->output.w,
|
2006-03-08 00:02:34 -08:00
|
|
|
e->output.h,
|
|
|
|
info->info.display,
|
|
|
|
info->info.drawable,
|
|
|
|
info->info.visual,
|
|
|
|
info->info.colormap,
|
|
|
|
info->info.depth);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
re = e->engine.data.output;
|
|
|
|
eng_window_free(re->win);
|
|
|
|
re->win = eng_window_new(info->info.display,
|
|
|
|
info->info.drawable,
|
|
|
|
0,/* FIXME: screen 0 assumption */
|
|
|
|
info->info.visual,
|
|
|
|
info->info.colormap,
|
|
|
|
info->info.depth,
|
|
|
|
e->output.w,
|
|
|
|
e->output.h);
|
|
|
|
}
|
2002-11-08 00:02:15 -08:00
|
|
|
if (!e->engine.data.output) return;
|
|
|
|
if (!e->engine.data.context)
|
2005-05-21 19:49:50 -07:00
|
|
|
e->engine.data.context =
|
|
|
|
e->engine.func->context_new(e->engine.data.output);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_output_setup(int w, int h, Display *disp, Drawable draw, Visual *vis, Colormap cmap, int depth)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2003-09-04 00:40:34 -07:00
|
|
|
int eb, evb;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
|
|
|
if (!glXQueryExtension(disp, &eb, &evb)) return NULL;
|
2002-11-08 00:02:15 -08:00
|
|
|
re = calloc(1, sizeof(Render_Engine));
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2006-03-06 18:44:16 -08:00
|
|
|
re->win = eng_window_new(disp, draw,
|
2006-03-08 00:02:34 -08:00
|
|
|
0 /* FIXME: screen 0 assumption */,
|
|
|
|
vis, cmap, depth, w, h);
|
2003-09-04 00:40:34 -07:00
|
|
|
if (!re->win)
|
|
|
|
{
|
|
|
|
free(re);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
printf("GL: gl window setup done.\n");
|
2002-11-13 21:38:10 -08:00
|
|
|
evas_common_cpu_init();
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-13 21:38:10 -08:00
|
|
|
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();
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
return re;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_output_free(void *data)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
|
|
|
free(re);
|
2004-01-12 10:12:41 -08:00
|
|
|
|
|
|
|
evas_common_font_shutdown();
|
2004-01-17 08:27:58 -08:00
|
|
|
evas_common_image_shutdown();
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_output_resize(void *data, int w, int h)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
re->win->w = w;
|
|
|
|
re->win->h = h;
|
|
|
|
evas_gl_common_context_resize(re->win->gl_context, w, h);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_output_tile_size_set(void *data, int w, int h)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_output_redraws_rect_add(void *data, int x, int y, int w, int h)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
/* smple bounding box */
|
|
|
|
if (!re->win->draw.redraw)
|
|
|
|
{
|
2005-05-21 19:49:50 -07:00
|
|
|
#if 0
|
2003-09-04 00:40:34 -07:00
|
|
|
re->win->draw.x1 = x;
|
|
|
|
re->win->draw.y1 = y;
|
|
|
|
re->win->draw.x2 = x + w - 1;
|
|
|
|
re->win->draw.y2 = y + h - 1;
|
2004-06-18 08:56:30 -07:00
|
|
|
#else
|
|
|
|
re->win->draw.x1 = 0;
|
|
|
|
re->win->draw.y1 = 0;
|
|
|
|
re->win->draw.x2 = re->win->w - 1;
|
|
|
|
re->win->draw.y2 = re->win->h - 1;
|
2005-05-21 19:49:50 -07:00
|
|
|
#endif
|
2003-09-04 00:40:34 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (x < re->win->draw.x1) re->win->draw.x1 = x;
|
|
|
|
if (y < re->win->draw.y1) re->win->draw.y1 = y;
|
|
|
|
if ((x + w - 1) > re->win->draw.x2) re->win->draw.x2 = x + w - 1;
|
|
|
|
if ((y + h - 1) > re->win->draw.y2) re->win->draw.y2 = y + h - 1;
|
|
|
|
}
|
|
|
|
re->win->draw.redraw = 1;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_output_redraws_rect_del(void *data, int x, int y, int w, int h)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_output_redraws_clear(void *data)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
re->win->draw.redraw = 0;
|
|
|
|
// printf("GL: finish update cycle!\n");
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, int *cx, int *cy, int *cw, int *ch)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
/* get the upate rect surface - return engine data as dummy */
|
|
|
|
if (!re->win->draw.redraw)
|
|
|
|
{
|
|
|
|
// printf("GL: NO updates!\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
// printf("GL: update....!\n");
|
|
|
|
if (x) *x = re->win->draw.x1;
|
|
|
|
if (y) *y = re->win->draw.y1;
|
|
|
|
if (w) *w = re->win->draw.x2 - re->win->draw.x1 + 1;
|
|
|
|
if (h) *h = re->win->draw.y2 - re->win->draw.y1 + 1;
|
|
|
|
if (cx) *cx = re->win->draw.x1;
|
|
|
|
if (cy) *cy = re->win->draw.y1;
|
|
|
|
if (cw) *cw = re->win->draw.x2 - re->win->draw.x1 + 1;
|
|
|
|
if (ch) *ch = re->win->draw.y2 - re->win->draw.y1 + 1;
|
|
|
|
return re;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_output_redraws_next_update_push(void *data, void *surface, int x, int y, int w, int h)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
/* put back update surface.. in this case just unflag redraw */
|
|
|
|
// printf("GL: update done.\n");
|
|
|
|
re->win->draw.redraw = 0;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_output_flush(void *data)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
// printf("GL: flush your mush!\n");
|
2006-03-06 18:44:16 -08:00
|
|
|
eng_window_use(re->win);
|
2003-09-04 00:40:34 -07:00
|
|
|
|
|
|
|
/* SLOW AS ALL HELL! */
|
2004-06-18 08:56:30 -07:00
|
|
|
#if 0
|
2005-05-21 19:49:50 -07:00
|
|
|
evas_gl_common_swap_rect(re->win->gl_context,
|
2003-09-04 00:40:34 -07:00
|
|
|
re->win->draw.x1, re->win->draw.y1,
|
|
|
|
re->win->draw.x2 - re->win->draw.x1 + 1,
|
|
|
|
re->win->draw.y2 - re->win->draw.y1 + 1);
|
2004-06-18 08:56:30 -07:00
|
|
|
#else
|
2006-05-09 04:40:10 -07:00
|
|
|
#if 0
|
2006-04-16 10:04:36 -07:00
|
|
|
glFlush();
|
|
|
|
{
|
|
|
|
unsigned int rc;
|
|
|
|
|
|
|
|
glXGetVideoSyncSGI(&rc);
|
|
|
|
glXWaitVideoSyncSGI(2, (rc + 1) % 2, &rc);
|
|
|
|
}
|
|
|
|
#endif
|
2005-05-21 19:49:50 -07:00
|
|
|
glXSwapBuffers(re->win->disp, re->win->win);
|
|
|
|
#endif
|
2004-07-19 21:05:14 -07:00
|
|
|
// glFlush();
|
|
|
|
// glXWaitGL();
|
2003-09-04 00:40:34 -07:00
|
|
|
// XSync(re->win->disp, False);
|
|
|
|
// printf("SYNC! %i\n", fr++);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_context_new(void *data)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
return evas_common_draw_context_new();
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_context_free(void *data, void *context)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_common_draw_context_free(context);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_context_clip_set(void *data, void *context, int x, int y, int w, int h)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_common_draw_context_set_clip(context, x, y, w, h);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_context_clip_clip(void *data, void *context, int x, int y, int w, int h)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_common_draw_context_clip_clip(context, x, y, w, h);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_context_clip_unset(void *data, void *context)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_common_draw_context_unset_clip(context);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_context_clip_get(void *data, void *context, int *x, int *y, int *w, int *h)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
*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;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_context_color_set(void *data, void *context, int r, int g, int b, int a)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_common_draw_context_set_color(context, r, g, b, a);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_context_color_get(void *data, void *context, int *r, int *g, int *b, int *a)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2005-03-27 19:58:04 -08:00
|
|
|
*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));
|
2003-09-04 00:40:34 -07:00
|
|
|
return 1;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_context_multiplier_set(void *data, void *context, int r, int g, int b, int a)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_common_draw_context_set_multiplier(context, r, g, b, a);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_context_multiplier_unset(void *data, void *context)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_common_draw_context_unset_multiplier(context);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_context_multiplier_get(void *data, void *context, int *r, int *g, int *b, int *a)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2005-03-27 19:58:04 -08:00
|
|
|
*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));
|
2003-09-04 00:40:34 -07:00
|
|
|
return ((RGBA_Draw_Context *)context)->mul.use;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_context_cutout_add(void *data, void *context, int x, int y, int w, int h)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
/* not used in gl engine */
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_context_cutout_clear(void *data, void *context)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
/* not used in gl engine */
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2005-12-03 01:27:53 -08:00
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_context_anti_alias_set(void *data, void *context, unsigned char aa)
|
2005-12-03 01:27:53 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
evas_common_draw_context_set_anti_alias(context, aa);
|
|
|
|
}
|
|
|
|
|
|
|
|
static unsigned char
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_context_anti_alias_get(void *data, void *context)
|
2005-12-03 01:27:53 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
return ((RGBA_Draw_Context *)context)->anti_alias;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_context_color_interpolation_set(void *data, void *context, int color_space)
|
2005-12-03 01:27:53 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
evas_common_draw_context_set_color_interpolation(context, color_space);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_context_color_interpolation_get(void *data, void *context)
|
2005-12-03 01:27:53 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
return ((RGBA_Draw_Context *)context)->interpolation.color_space;
|
|
|
|
}
|
|
|
|
|
2006-05-02 00:28:49 -07:00
|
|
|
static void
|
|
|
|
eng_context_render_op_set(void *data, void *context, int op)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
evas_common_draw_context_set_render_op(context, op);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
eng_context_render_op_get(void *data, void *context)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
return ((RGBA_Draw_Context *)context)->render_op;
|
|
|
|
}
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_rectangle_draw(void *data, void *context, void *surface, int x, int y, int w, int h)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2006-03-06 18:44:16 -08:00
|
|
|
eng_window_use(re->win);
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_gl_common_rect_draw(re->win->gl_context, context, x, y, w, h);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_line_draw(void *data, void *context, void *surface, int x1, int y1, int x2, int y2)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_gl_common_line_draw(re->win->gl_context, context, x1, y1, x2, y2);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_polygon_point_add(void *data, void *context, void *polygon, int x, int y)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
return evas_gl_common_poly_point_add(polygon, x, y);
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_polygon_points_clear(void *data, void *context, void *polygon)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
return evas_gl_common_poly_points_clear(polygon);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_polygon_draw(void *data, void *context, void *surface, void *polygon)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_gl_common_poly_draw(re->win->gl_context, context, polygon);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_gradient_color_add(void *data, void *context, void *gradient, int r, int g, int b, int a, int distance)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
return evas_gl_common_gradient_color_add(gradient, r, g, b, a, distance);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_gradient_colors_clear(void *data, void *context, void *gradient)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
return evas_gl_common_gradient_colors_clear(gradient);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2006-05-02 00:28:49 -07:00
|
|
|
static void *
|
|
|
|
eng_gradient_data_set(void *data, void *context, void *gradient, void *map, int len, int has_alpha)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
evas_gl_common_gradient_data_set(gradient, map, len, has_alpha);
|
|
|
|
return gradient;
|
|
|
|
context = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
|
|
|
eng_gradient_data_unset(void *data, void *context, void *gradient)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
evas_gl_common_gradient_data_unset(gradient);
|
|
|
|
return gradient;
|
|
|
|
context = NULL;
|
|
|
|
}
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_gradient_free(void *data, void *gradient)
|
2005-12-03 01:27:53 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
evas_gl_common_gradient_free(gradient);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_gradient_fill_set(void *data, void *gradient, int x, int y, int w, int h)
|
2005-12-03 01:27:53 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
evas_gl_common_gradient_fill_set(gradient, x, y, w, h);
|
|
|
|
}
|
|
|
|
|
2006-05-04 04:52:46 -07:00
|
|
|
static void
|
|
|
|
eng_gradient_range_offset_set(void *data, void *gradient, float offset)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
evas_gl_common_gradient_range_offset_set(gradient, offset);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2005-12-03 01:27:53 -08:00
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_gradient_type_set(void *data, void *gradient, char *name)
|
2005-12-03 01:27:53 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
evas_gl_common_gradient_type_set(gradient, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_gradient_type_params_set(void *data, void *gradient, char *params)
|
2005-12-03 01:27:53 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
evas_gl_common_gradient_type_params_set(gradient, params);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_gradient_geometry_init(void *data, void *gradient, int spread)
|
2005-12-03 01:27:53 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
return evas_gl_common_gradient_geometry_init(gradient, spread);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2006-05-02 00:28:49 -07:00
|
|
|
eng_gradient_alpha_get(void *data, void *gradient, int spread, int op)
|
2005-12-03 01:27:53 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2006-05-02 00:28:49 -07:00
|
|
|
return evas_gl_common_gradient_alpha_get(gradient, spread, op);
|
2005-12-03 01:27:53 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_gradient_map(void *data, void *context, void *gradient, int spread)
|
2005-12-03 01:27:53 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
evas_gl_common_gradient_map(context, gradient, spread);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_gradient_draw(void *data, void *context, void *surface, void *gradient, int x, int y, int w, int h, double angle, int spread)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2006-03-06 18:44:16 -08:00
|
|
|
eng_window_use(re->win);
|
2005-12-03 01:27:53 -08:00
|
|
|
evas_gl_common_gradient_draw(re->win->gl_context, context, gradient, x, y, w, h, angle, spread);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_image_load(void *data, char *file, char *key, int *error)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
*error = 0;
|
2006-03-06 18:44:16 -08:00
|
|
|
eng_window_use(re->win);
|
2003-09-04 00:40:34 -07:00
|
|
|
return evas_gl_common_image_load(re->win->gl_context, file, key);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_image_new_from_data(void *data, int w, int h, DATA32 *image_data)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2006-03-06 18:44:16 -08:00
|
|
|
eng_window_use(re->win);
|
2003-09-04 00:40:34 -07:00
|
|
|
return evas_gl_common_image_new_from_data(re->win->gl_context, w, h, image_data);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_image_new_from_copied_data(void *data, int w, int h, DATA32 *image_data)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2006-03-06 18:44:16 -08:00
|
|
|
eng_window_use(re->win);
|
2003-09-04 00:40:34 -07:00
|
|
|
return evas_gl_common_image_new_from_copied_data(re->win->gl_context, w, h, image_data);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_image_free(void *data, void *image)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2006-03-06 18:44:16 -08:00
|
|
|
eng_window_use(re->win);
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_gl_common_image_free(image);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_image_size_get(void *data, void *image, int *w, int *h)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
if (w) *w = ((Evas_GL_Image *)image)->im->image->w;
|
|
|
|
if (h) *h = ((Evas_GL_Image *)image)->im->image->h;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_image_size_set(void *data, void *image, int w, int h)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2003-09-04 00:40:34 -07:00
|
|
|
Evas_GL_Image *im, *im_old;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2006-03-06 18:44:16 -08:00
|
|
|
eng_window_use(re->win);
|
2003-09-04 00:40:34 -07:00
|
|
|
if (!image) return NULL;
|
|
|
|
im_old = image;
|
2003-09-04 22:37:14 -07:00
|
|
|
if ((im_old) && (im_old->im->image->w == w) && (im_old->im->image->h == h))
|
|
|
|
return image;
|
2003-09-04 00:40:34 -07:00
|
|
|
im = evas_gl_common_image_new(re->win->gl_context, w, h);
|
|
|
|
if (im_old)
|
|
|
|
{
|
|
|
|
evas_common_load_image_data_from_file(im_old->im);
|
|
|
|
if (im_old->im->image->data)
|
|
|
|
{
|
|
|
|
evas_common_blit_rectangle(im_old->im, im->im, 0, 0, w, h, 0, 0);
|
|
|
|
evas_common_cpu_end_opt();
|
|
|
|
}
|
|
|
|
evas_gl_common_image_free(im_old);
|
|
|
|
}
|
|
|
|
return im;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_image_dirty_region(void *data, void *image, int x, int y, int w, int h)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_gl_common_image_dirty(image);
|
|
|
|
return image;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2003-09-04 00:40:34 -07:00
|
|
|
Evas_GL_Image *im;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
im = image;
|
2006-03-06 18:44:16 -08:00
|
|
|
eng_window_use(re->win);
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_common_load_image_data_from_file(im->im);
|
|
|
|
if (to_write)
|
|
|
|
{
|
|
|
|
if (im->references > 1)
|
|
|
|
{
|
|
|
|
Evas_GL_Image *im_new;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2003-09-04 00:40:34 -07:00
|
|
|
im_new = evas_gl_common_image_new_from_copied_data(im->gc, im->im->image->w, im->im->image->h, im->im->image->data);
|
2003-09-04 22:37:14 -07:00
|
|
|
if (!im_new)
|
|
|
|
{
|
|
|
|
return im;
|
|
|
|
*image_data = NULL;
|
|
|
|
}
|
2003-09-04 00:40:34 -07:00
|
|
|
im = im_new;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
evas_gl_common_image_dirty(im);
|
|
|
|
}
|
2005-05-21 19:49:50 -07:00
|
|
|
*image_data = im->im->image->data;
|
2003-09-04 00:40:34 -07:00
|
|
|
return im;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_image_data_put(void *data, void *image, DATA32 *image_data)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2003-09-04 00:40:34 -07:00
|
|
|
Evas_GL_Image *im;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
im = image;
|
2006-03-06 18:44:16 -08:00
|
|
|
eng_window_use(re->win);
|
2003-09-04 00:40:34 -07:00
|
|
|
if (image_data != im->im->image->data)
|
|
|
|
{
|
|
|
|
int w, h;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2003-09-04 00:40:34 -07:00
|
|
|
w = im->im->image->w;
|
|
|
|
h = im->im->image->h;
|
|
|
|
evas_gl_common_image_free(im);
|
2006-02-27 20:07:49 -08:00
|
|
|
return eng_image_new_from_data(data, w, h, image_data);
|
2003-09-04 00:40:34 -07:00
|
|
|
}
|
|
|
|
/* hmmm - but if we wrote... why bother? */
|
2003-09-04 22:37:14 -07:00
|
|
|
evas_gl_common_image_dirty(im);
|
2003-09-04 00:40:34 -07:00
|
|
|
return im;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_image_alpha_set(void *data, void *image, int has_alpha)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2003-09-04 00:40:34 -07:00
|
|
|
Evas_GL_Image *im;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2006-03-06 18:44:16 -08:00
|
|
|
eng_window_use(re->win);
|
2003-09-04 00:40:34 -07:00
|
|
|
im = image;
|
2003-09-04 22:37:14 -07:00
|
|
|
if ((has_alpha) && (im->im->flags & RGBA_IMAGE_HAS_ALPHA)) return image;
|
|
|
|
else if ((!has_alpha) && (!(im->im->flags & RGBA_IMAGE_HAS_ALPHA))) return image;
|
2003-09-04 00:40:34 -07:00
|
|
|
if (im->references > 1)
|
|
|
|
{
|
|
|
|
Evas_GL_Image *im_new;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2003-09-04 00:40:34 -07:00
|
|
|
im_new = evas_gl_common_image_new_from_copied_data(im->gc, im->im->image->w, im->im->image->h, im->im->image->data);
|
|
|
|
if (!im_new) return im;
|
|
|
|
evas_gl_common_image_free(im);
|
|
|
|
im = im_new;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
evas_gl_common_image_dirty(im);
|
|
|
|
if (has_alpha)
|
|
|
|
im->im->flags |= RGBA_IMAGE_HAS_ALPHA;
|
|
|
|
else
|
|
|
|
im->im->flags &= ~RGBA_IMAGE_HAS_ALPHA;
|
|
|
|
return image;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_image_alpha_get(void *data, void *image)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2003-09-04 00:40:34 -07:00
|
|
|
Evas_GL_Image *im;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
im = image;
|
2006-03-06 18:44:16 -08:00
|
|
|
eng_window_use(re->win);
|
2003-09-04 00:40:34 -07:00
|
|
|
if (im->im->flags & RGBA_IMAGE_HAS_ALPHA) return 1;
|
|
|
|
return 0;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
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)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2006-03-06 18:44:16 -08:00
|
|
|
eng_window_use(re->win);
|
2005-05-21 19:49:50 -07:00
|
|
|
evas_gl_common_image_draw(re->win->gl_context, context, image,
|
2003-09-04 00:40:34 -07:00
|
|
|
src_x, src_y, src_w, src_h,
|
|
|
|
dst_x, dst_y, dst_w, dst_h,
|
|
|
|
smooth);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_image_comment_get(void *data, void *image, char *key)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2003-09-04 00:40:34 -07:00
|
|
|
Evas_GL_Image *im;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
im = image;
|
|
|
|
return im->im->info.comment;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_image_format_get(void *data, void *image)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2003-09-04 00:40:34 -07:00
|
|
|
Evas_GL_Image *im;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
im = image;
|
2006-01-14 22:21:05 -08:00
|
|
|
// if (im->im->info.format == 1) return "png";
|
2003-09-04 00:40:34 -07:00
|
|
|
return NULL;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_image_cache_flush(void *data)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2003-09-04 00:40:34 -07:00
|
|
|
int tmp_size;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
tmp_size = evas_common_image_get_cache();
|
|
|
|
evas_common_image_set_cache(0);
|
|
|
|
evas_common_image_set_cache(tmp_size);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_image_cache_set(void *data, int bytes)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_common_image_set_cache(bytes);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_image_cache_get(void *data)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
return evas_common_image_get_cache();
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_font_load(void *data, char *name, int size)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
return evas_common_font_load(name, size);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2004-01-22 18:14:45 -08:00
|
|
|
static void *
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_font_memory_load(void *data, char *name, int size, const void *fdata, int fdata_size)
|
2004-01-22 18:14:45 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
return evas_common_font_memory_load(name, size, fdata, fdata_size);
|
|
|
|
}
|
|
|
|
|
2005-03-20 07:57:55 -08:00
|
|
|
static void *
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_font_add(void *data, void *font, char *name, int size)
|
2005-03-20 07:57:55 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2005-03-20 07:57:55 -08:00
|
|
|
re = (Render_Engine *)data;
|
|
|
|
return evas_common_font_add(font, name, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_font_memory_add(void *data, void *font, char *name, int size, const void *fdata, int fdata_size)
|
2005-03-20 07:57:55 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2005-03-20 07:57:55 -08:00
|
|
|
re = (Render_Engine *)data;
|
|
|
|
return evas_common_font_memory_add(font, name, size, fdata, fdata_size);
|
|
|
|
}
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_font_free(void *data, void *font)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_common_font_free(font);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_font_ascent_get(void *data, void *font)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
return evas_common_font_ascent_get(font);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2005-05-21 19:49:50 -07:00
|
|
|
static int
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_font_descent_get(void *data, void *font)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
return evas_common_font_descent_get(font);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_font_max_ascent_get(void *data, void *font)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
return evas_common_font_max_ascent_get(font);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_font_max_descent_get(void *data, void *font)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
return evas_common_font_max_descent_get(font);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_font_string_size_get(void *data, void *font, char *text, int *w, int *h)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_common_font_query_size(font, text, w, h);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_font_inset_get(void *data, void *font, char *text)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
return evas_common_font_query_inset(font, text);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_font_h_advance_get(void *data, void *font, char *text)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2003-09-04 00:40:34 -07:00
|
|
|
int h, v;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_common_font_query_advance(font, text, &h, &v);
|
|
|
|
return h;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_font_v_advance_get(void *data, void *font, char *text)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2003-09-04 00:40:34 -07:00
|
|
|
int h, v;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_common_font_query_advance(font, text, &h, &v);
|
|
|
|
return v;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_font_char_coords_get(void *data, void *font, char *text, int pos, int *cx, int *cy, int *cw, int *ch)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
return evas_common_font_query_char_coords(font, text, pos, cx, cy, cw, ch);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_font_char_at_coords_get(void *data, void *font, char *text, int x, int y, int *cx, int *cy, int *cw, int *ch)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2005-05-21 19:49:50 -07:00
|
|
|
return evas_common_font_query_text_at_pos(font, text, x, y, cx, cy, cw, ch);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
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)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-10 07:33:39 -07:00
|
|
|
/* text renderign takes benchmark from 40 to 27 on gf4-ti4400 */
|
2003-09-04 00:40:34 -07:00
|
|
|
{
|
2003-09-10 07:33:39 -07:00
|
|
|
static RGBA_Image *im = NULL;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2003-09-10 07:33:39 -07:00
|
|
|
if (!im)
|
|
|
|
{
|
|
|
|
im = evas_common_image_new();
|
2005-01-25 23:49:57 -08:00
|
|
|
im->image = evas_common_image_surface_new(im);
|
2003-09-10 07:33:39 -07:00
|
|
|
im->image->no_free = 1;
|
|
|
|
}
|
2003-09-08 22:51:03 -07:00
|
|
|
im->image->w = re->win->w;
|
|
|
|
im->image->h = re->win->h;
|
|
|
|
im->image->data = NULL;
|
|
|
|
evas_common_draw_context_font_ext_set(context,
|
|
|
|
re->win->gl_context,
|
|
|
|
evas_gl_font_texture_new,
|
|
|
|
evas_gl_font_texture_free,
|
|
|
|
evas_gl_font_texture_draw);
|
2003-09-10 07:33:39 -07:00
|
|
|
/* 40 */
|
2003-09-08 22:51:03 -07:00
|
|
|
evas_common_font_draw(im, context, font, x, y, text);
|
2005-05-21 19:49:50 -07:00
|
|
|
evas_common_draw_context_font_ext_set(context,
|
|
|
|
NULL,
|
2003-09-08 22:51:03 -07:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL);
|
2003-09-04 00:40:34 -07:00
|
|
|
}
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_font_cache_flush(void *data)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_common_font_flush();
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_font_cache_set(void *data, int bytes)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_common_font_cache_set(bytes);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_font_cache_get(void *data)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
return evas_common_font_cache_get();
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2006-02-27 20:07:49 -08:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* private engine functions the calling prog can use */
|
|
|
|
|
|
|
|
static Visual *
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_best_visual_get(Display *disp, int screen)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
if (!disp) return NULL;
|
2003-09-04 00:40:34 -07:00
|
|
|
if (!_evas_gl_x11_vi)
|
2005-05-21 19:49:50 -07:00
|
|
|
_evas_gl_x11_vi = glXChooseVisual(disp, screen,
|
2003-09-04 00:40:34 -07:00
|
|
|
_evas_gl_x11_configuration);
|
|
|
|
if (!_evas_gl_x11_vi) return NULL;
|
|
|
|
return _evas_gl_x11_vi->visual;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static Colormap
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_best_colormap_get(Display *disp, int screen)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
if (!disp) return 0;
|
2003-09-04 00:40:34 -07:00
|
|
|
if (!_evas_gl_x11_vi)
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_best_visual_get(disp, screen);
|
2003-09-04 00:40:34 -07:00
|
|
|
if (!_evas_gl_x11_vi) return 0;
|
2005-05-21 19:49:50 -07:00
|
|
|
_evas_gl_x11_cmap = XCreateColormap(disp, RootWindow(disp, screen),
|
2003-09-04 00:40:34 -07:00
|
|
|
_evas_gl_x11_vi->visual, 0);
|
|
|
|
return _evas_gl_x11_cmap;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_best_depth_get(Display *disp, int screen)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
if (!disp) return 0;
|
2003-09-04 00:40:34 -07:00
|
|
|
if (!_evas_gl_x11_vi)
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_best_visual_get(disp, screen);
|
2003-09-04 00:40:34 -07:00
|
|
|
if (!_evas_gl_x11_vi) return 0;
|
|
|
|
return _evas_gl_x11_vi->depth;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
2006-01-14 04:13:38 -08:00
|
|
|
|
|
|
|
int module_open(Evas_Module *em)
|
|
|
|
{
|
|
|
|
if (!em) return 0;
|
2006-02-27 20:07:49 -08:00
|
|
|
em->functions = (void *)(&eng_func);
|
2006-01-14 04:13:38 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void module_close(void)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Evas_Module_Api evas_modapi =
|
|
|
|
{
|
|
|
|
EVAS_MODULE_API_VERSION,
|
|
|
|
EVAS_MODULE_TYPE_ENGINE,
|
|
|
|
"gl_x11",
|
|
|
|
"none"
|
|
|
|
};
|