2002-11-08 00:02:15 -08:00
|
|
|
#include "evas_common.h"
|
|
|
|
#include "evas_private.h"
|
|
|
|
#include "evas_engine.h"
|
|
|
|
#include "evas_engine_api_gl_x11.h"
|
|
|
|
#include "Evas.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
|
|
|
|
|
|
|
static void *evas_engine_gl_x11_info(Evas *e);
|
|
|
|
static void evas_engine_gl_x11_info_free(Evas *e, void *info);
|
|
|
|
static void evas_engine_gl_x11_setup(Evas *e, void *info);
|
2003-09-04 00:40:34 -07:00
|
|
|
static void *evas_engine_gl_x11_output_setup(int w, int h, Display *disp, Drawable draw, Visual *vis, Colormap cmap, int depth);
|
2002-11-08 00:02:15 -08:00
|
|
|
static void evas_engine_gl_x11_output_free(void *data);
|
|
|
|
static void evas_engine_gl_x11_output_resize(void *data, int w, int h);
|
|
|
|
static void evas_engine_gl_x11_output_tile_size_set(void *data, int w, int h);
|
|
|
|
static void evas_engine_gl_x11_output_redraws_rect_add(void *data, int x, int y, int w, int h);
|
|
|
|
static void evas_engine_gl_x11_output_redraws_rect_del(void *data, int x, int y, int w, int h);
|
|
|
|
static void evas_engine_gl_x11_output_redraws_clear(void *data);
|
|
|
|
static void *evas_engine_gl_x11_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 evas_engine_gl_x11_output_redraws_next_update_push(void *data, void *surface, int x, int y, int w, int h);
|
|
|
|
static void evas_engine_gl_x11_output_flush(void *data);
|
|
|
|
static void *evas_engine_gl_x11_context_new(void *data);
|
|
|
|
static void evas_engine_gl_x11_context_free(void *data, void *context);
|
|
|
|
static void evas_engine_gl_x11_context_clip_set(void *data, void *context, int x, int y, int w, int h);
|
|
|
|
static void evas_engine_gl_x11_context_clip_clip(void *data, void *context, int x, int y, int w, int h);
|
|
|
|
static void evas_engine_gl_x11_context_clip_unset(void *data, void *context);
|
|
|
|
static int evas_engine_gl_x11_context_clip_get(void *data, void *context, int *x, int *y, int *w, int *h);
|
|
|
|
static void evas_engine_gl_x11_context_color_set(void *data, void *context, int r, int g, int b, int a);
|
|
|
|
static int evas_engine_gl_x11_context_color_get(void *data, void *context, int *r, int *g, int *b, int *a);
|
|
|
|
static void evas_engine_gl_x11_context_multiplier_set(void *data, void *context, int r, int g, int b, int a);
|
|
|
|
static void evas_engine_gl_x11_context_multiplier_unset(void *data, void *context);
|
|
|
|
static int evas_engine_gl_x11_context_multiplier_get(void *data, void *context, int *r, int *g, int *b, int *a);
|
|
|
|
static void evas_engine_gl_x11_context_cutout_add(void *data, void *context, int x, int y, int w, int h);
|
|
|
|
static void evas_engine_gl_x11_context_cutout_clear(void *data, void *context);
|
|
|
|
static void evas_engine_gl_x11_rectangle_draw(void *data, void *context, void *surface, int x, int y, int w, int h);
|
|
|
|
static void evas_engine_gl_x11_line_draw(void *data, void *context, void *surface, int x1, int y1, int x2, int y2);
|
|
|
|
static void *evas_engine_gl_x11_polygon_point_add(void *data, void *context, void *polygon, int x, int y);
|
|
|
|
static void *evas_engine_gl_x11_polygon_points_clear(void *data, void *context, void *polygon);
|
|
|
|
static void evas_engine_gl_x11_polygon_draw(void *data, void *context, void *surface, void *polygon);
|
|
|
|
static void *evas_engine_gl_x11_gradient_color_add(void *data, void *context, void *gradient, int r, int g, int b, int a, int distance);
|
|
|
|
static void *evas_engine_gl_x11_gradient_colors_clear(void *data, void *context, void *gradient);
|
|
|
|
static void evas_engine_gl_x11_gradient_draw(void *data, void *context, void *surface, void *gradient, int x, int y, int w, int h, double angle);
|
|
|
|
static void *evas_engine_gl_x11_image_load(void *data, char *file, char *key, int *error);
|
|
|
|
static void *evas_engine_gl_x11_image_new_from_data(void *data, int w, int h, DATA32 *image_data);
|
|
|
|
static void *evas_engine_gl_x11_image_new_from_copied_data(void *data, int w, int h, DATA32 *image_data);
|
|
|
|
static void evas_engine_gl_x11_image_free(void *data, void *image);
|
|
|
|
static void evas_engine_gl_x11_image_size_get(void *data, void *image, int *w, int *h);
|
|
|
|
static void *evas_engine_gl_x11_image_size_set(void *data, void *image, int w, int h);
|
|
|
|
static void *evas_engine_gl_x11_image_dirty_region(void *data, void *image, int x, int y, int w, int h);
|
|
|
|
static void *evas_engine_gl_x11_image_data_get(void *data, void *image, int to_write, DATA32 **image_data);
|
|
|
|
static void *evas_engine_gl_x11_image_data_put(void *data, void *image, DATA32 *image_data);
|
|
|
|
static void *evas_engine_gl_x11_image_alpha_set(void *data, void *image, int has_alpha);
|
|
|
|
static int evas_engine_gl_x11_image_alpha_get(void *data, void *image);
|
|
|
|
static void evas_engine_gl_x11_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 *evas_engine_gl_x11_image_comment_get(void *data, void *image, char *key);
|
|
|
|
static char *evas_engine_gl_x11_image_format_get(void *data, void *image);
|
|
|
|
static void evas_engine_gl_x11_image_cache_flush(void *data);
|
|
|
|
static void evas_engine_gl_x11_image_cache_set(void *data, int bytes);
|
|
|
|
static int evas_engine_gl_x11_image_cache_get(void *data);
|
|
|
|
static void *evas_engine_gl_x11_font_load(void *data, char *name, int size);
|
|
|
|
static void evas_engine_gl_x11_font_free(void *data, void *font);
|
|
|
|
static int evas_engine_gl_x11_font_ascent_get(void *data, void *font);
|
|
|
|
static int evas_engine_gl_x11_font_descent_get(void *data, void *font);
|
|
|
|
static int evas_engine_gl_x11_font_max_ascent_get(void *data, void *font);
|
|
|
|
static int evas_engine_gl_x11_font_max_descent_get(void *data, void *font);
|
|
|
|
static void evas_engine_gl_x11_font_string_size_get(void *data, void *font, char *text, int *w, int *h);
|
|
|
|
static int evas_engine_gl_x11_font_inset_get(void *data, void *font, char *text);
|
|
|
|
static int evas_engine_gl_x11_font_h_advance_get(void *data, void *font, char *text);
|
|
|
|
static int evas_engine_gl_x11_font_v_advance_get(void *data, void *font, char *text);
|
|
|
|
static int evas_engine_gl_x11_font_char_coords_get(void *data, void *font, char *text, int pos, int *cx, int *cy, int *cw, int *ch);
|
|
|
|
static int evas_engine_gl_x11_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 evas_engine_gl_x11_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 evas_engine_gl_x11_font_cache_flush(void *data);
|
|
|
|
static void evas_engine_gl_x11_font_cache_set(void *data, int bytes);
|
|
|
|
static int evas_engine_gl_x11_font_cache_get(void *data);
|
|
|
|
|
|
|
|
|
|
|
|
static Visual *evas_engine_gl_x11_best_visual_get(Display *disp, int screen);
|
|
|
|
static Colormap evas_engine_gl_x11_best_colormap_get(Display *disp, int screen);
|
|
|
|
static int evas_engine_gl_x11_best_depth_get(Display *disp, int screen);
|
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
Evas_Func evas_engine_gl_x11_func =
|
|
|
|
{
|
|
|
|
evas_engine_gl_x11_info,
|
|
|
|
evas_engine_gl_x11_info_free,
|
|
|
|
evas_engine_gl_x11_setup,
|
|
|
|
evas_engine_gl_x11_output_free,
|
|
|
|
evas_engine_gl_x11_output_resize,
|
|
|
|
evas_engine_gl_x11_output_tile_size_set,
|
|
|
|
evas_engine_gl_x11_output_redraws_rect_add,
|
|
|
|
evas_engine_gl_x11_output_redraws_rect_del,
|
|
|
|
evas_engine_gl_x11_output_redraws_clear,
|
|
|
|
evas_engine_gl_x11_output_redraws_next_update_get,
|
|
|
|
evas_engine_gl_x11_output_redraws_next_update_push,
|
|
|
|
evas_engine_gl_x11_output_flush,
|
|
|
|
/* draw context virtual methods */
|
|
|
|
evas_engine_gl_x11_context_new,
|
|
|
|
evas_engine_gl_x11_context_free,
|
|
|
|
evas_engine_gl_x11_context_clip_set,
|
|
|
|
evas_engine_gl_x11_context_clip_clip,
|
|
|
|
evas_engine_gl_x11_context_clip_unset,
|
|
|
|
evas_engine_gl_x11_context_clip_get,
|
|
|
|
evas_engine_gl_x11_context_color_set,
|
|
|
|
evas_engine_gl_x11_context_color_get,
|
|
|
|
evas_engine_gl_x11_context_multiplier_set,
|
|
|
|
evas_engine_gl_x11_context_multiplier_unset,
|
|
|
|
evas_engine_gl_x11_context_multiplier_get,
|
|
|
|
evas_engine_gl_x11_context_cutout_add,
|
|
|
|
evas_engine_gl_x11_context_cutout_clear,
|
|
|
|
/* rectangle draw funcs */
|
|
|
|
evas_engine_gl_x11_rectangle_draw,
|
|
|
|
/* line draw funcs */
|
|
|
|
evas_engine_gl_x11_line_draw,
|
|
|
|
/* polygon draw funcs */
|
|
|
|
evas_engine_gl_x11_polygon_point_add,
|
|
|
|
evas_engine_gl_x11_polygon_points_clear,
|
|
|
|
evas_engine_gl_x11_polygon_draw,
|
|
|
|
/* gradient draw funcs */
|
|
|
|
evas_engine_gl_x11_gradient_color_add,
|
|
|
|
evas_engine_gl_x11_gradient_colors_clear,
|
|
|
|
evas_engine_gl_x11_gradient_draw,
|
|
|
|
/* image draw funcs */
|
|
|
|
evas_engine_gl_x11_image_load,
|
|
|
|
evas_engine_gl_x11_image_new_from_data,
|
|
|
|
evas_engine_gl_x11_image_new_from_copied_data,
|
|
|
|
evas_engine_gl_x11_image_free,
|
|
|
|
evas_engine_gl_x11_image_size_get,
|
|
|
|
evas_engine_gl_x11_image_size_set,
|
|
|
|
evas_engine_gl_x11_image_dirty_region,
|
|
|
|
evas_engine_gl_x11_image_data_get,
|
|
|
|
evas_engine_gl_x11_image_data_put,
|
|
|
|
evas_engine_gl_x11_image_alpha_set,
|
|
|
|
evas_engine_gl_x11_image_alpha_get,
|
|
|
|
evas_engine_gl_x11_image_draw,
|
|
|
|
evas_engine_gl_x11_image_comment_get,
|
|
|
|
evas_engine_gl_x11_image_format_get,
|
|
|
|
/* image cache funcs */
|
|
|
|
evas_engine_gl_x11_image_cache_flush,
|
|
|
|
evas_engine_gl_x11_image_cache_set,
|
|
|
|
evas_engine_gl_x11_image_cache_get,
|
|
|
|
/* font draw functions */
|
|
|
|
evas_engine_gl_x11_font_load,
|
|
|
|
evas_engine_gl_x11_font_free,
|
|
|
|
evas_engine_gl_x11_font_ascent_get,
|
|
|
|
evas_engine_gl_x11_font_descent_get,
|
|
|
|
evas_engine_gl_x11_font_max_ascent_get,
|
|
|
|
evas_engine_gl_x11_font_max_descent_get,
|
|
|
|
evas_engine_gl_x11_font_string_size_get,
|
|
|
|
evas_engine_gl_x11_font_inset_get,
|
|
|
|
evas_engine_gl_x11_font_h_advance_get,
|
|
|
|
evas_engine_gl_x11_font_v_advance_get,
|
|
|
|
evas_engine_gl_x11_font_char_coords_get,
|
|
|
|
evas_engine_gl_x11_font_char_at_coords_get,
|
|
|
|
evas_engine_gl_x11_font_draw,
|
|
|
|
/* font cache functions */
|
|
|
|
evas_engine_gl_x11_font_cache_flush,
|
|
|
|
evas_engine_gl_x11_font_cache_set,
|
|
|
|
evas_engine_gl_x11_font_cache_get
|
|
|
|
};
|
|
|
|
|
|
|
|
static void *
|
|
|
|
evas_engine_gl_x11_info(Evas *e)
|
|
|
|
{
|
|
|
|
Evas_Engine_Info_GL_X11 *info;
|
|
|
|
|
|
|
|
info = calloc(1, sizeof(Evas_Engine_Info_GL_X11));
|
|
|
|
if (!info) return NULL;
|
|
|
|
info->magic.magic = rand();
|
|
|
|
info->func.best_visual_get = evas_engine_gl_x11_best_visual_get;
|
|
|
|
info->func.best_colormap_get = evas_engine_gl_x11_best_colormap_get;
|
|
|
|
info->func.best_depth_get = evas_engine_gl_x11_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
|
|
|
|
evas_engine_gl_x11_info_free(Evas *e, void *info)
|
|
|
|
{
|
|
|
|
Evas_Engine_Info_GL_X11 *in;
|
|
|
|
|
|
|
|
in = (Evas_Engine_Info_GL_X11 *)info;
|
|
|
|
free(in);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
evas_engine_gl_x11_setup(Evas *e, void *in)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
Evas_Engine_Info_GL_X11 *info;
|
|
|
|
|
|
|
|
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)
|
2003-09-04 00:40:34 -07:00
|
|
|
e->engine.data.output =
|
|
|
|
evas_engine_gl_x11_output_setup(e->output.w,
|
|
|
|
e->output.h,
|
|
|
|
info->info.display,
|
|
|
|
info->info.drawable,
|
|
|
|
info->info.visual,
|
|
|
|
info->info.colormap,
|
|
|
|
info->info.depth);
|
2002-11-08 00:02:15 -08:00
|
|
|
if (!e->engine.data.output) return;
|
|
|
|
if (!e->engine.data.context)
|
|
|
|
e->engine.data.context =
|
2003-09-04 00:40:34 -07:00
|
|
|
e->engine.func->context_new(e->engine.data.output);
|
2002-11-08 00:02:15 -08:00
|
|
|
re = e->engine.data.output;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_engine_gl_x11_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;
|
2002-11-08 00:02:15 -08:00
|
|
|
|
2003-09-04 00:40:34 -07:00
|
|
|
if (!glXQueryExtension(disp, &eb, &evb)) return NULL;
|
2002-11-08 00:02:15 -08:00
|
|
|
re = calloc(1, sizeof(Render_Engine));
|
2003-09-04 00:40:34 -07:00
|
|
|
|
|
|
|
re->win = evas_engine_gl_x11_window_new(disp, draw,
|
|
|
|
0 /* FIXME: screen 0 assumption */,
|
|
|
|
vis, cmap, depth, w, h);
|
|
|
|
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();
|
2002-11-08 00:02:15 -08: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();
|
2002-11-08 00:02:15 -08:00
|
|
|
|
|
|
|
return re;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
evas_engine_gl_x11_output_free(void *data)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
free(re);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
evas_engine_gl_x11_output_resize(void *data, int w, int h)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_output_tile_size_set(void *data, int w, int h)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
evas_engine_gl_x11_output_redraws_rect_add(void *data, int x, int y, int w, int h)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
/* smple bounding box */
|
|
|
|
if (!re->win->draw.redraw)
|
|
|
|
{
|
|
|
|
re->win->draw.x1 = x;
|
|
|
|
re->win->draw.y1 = y;
|
|
|
|
re->win->draw.x2 = x + w - 1;
|
|
|
|
re->win->draw.y2 = y + h - 1;
|
|
|
|
}
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_output_redraws_rect_del(void *data, int x, int y, int w, int h)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
evas_engine_gl_x11_output_redraws_clear(void *data)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
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 *
|
|
|
|
evas_engine_gl_x11_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, int *cx, int *cy, int *cw, int *ch)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_output_redraws_next_update_push(void *data, void *surface, int x, int y, int w, int h)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_output_flush(void *data)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2003-09-04 00:40:34 -07:00
|
|
|
static int fr = 0;
|
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");
|
|
|
|
evas_engine_gl_x11_window_use(re->win);
|
|
|
|
|
|
|
|
/* SLOW AS ALL HELL! */
|
|
|
|
/*
|
|
|
|
evas_gl_common_swap_rect(re->win->gl_context,
|
|
|
|
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);
|
|
|
|
*/
|
|
|
|
glXSwapBuffers(re->win->disp, re->win->win);
|
|
|
|
glFlush();
|
|
|
|
// glXWaitGL();
|
|
|
|
// XSync(re->win->disp, False);
|
|
|
|
// printf("SYNC! %i\n", fr++);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
|
|
|
evas_engine_gl_x11_context_new(void *data)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_context_free(void *data, void *context)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_context_clip_set(void *data, void *context, int x, int y, int w, int h)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_context_clip_clip(void *data, void *context, int x, int y, int w, int h)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_context_clip_unset(void *data, void *context)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_context_clip_get(void *data, void *context, int *x, int *y, int *w, int *h)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_context_color_set(void *data, void *context, int r, int g, int b, int a)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_context_color_get(void *data, void *context, int *r, int *g, int *b, int *a)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07: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));
|
|
|
|
return 1;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
evas_engine_gl_x11_context_multiplier_set(void *data, void *context, int r, int g, int b, int a)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_context_multiplier_unset(void *data, void *context)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_context_multiplier_get(void *data, void *context, int *r, int *g, int *b, int *a)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07: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));
|
|
|
|
return ((RGBA_Draw_Context *)context)->mul.use;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
evas_engine_gl_x11_context_cutout_add(void *data, void *context, int x, int y, int w, int h)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_context_cutout_clear(void *data, void *context)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_rectangle_draw(void *data, void *context, void *surface, int x, int y, int w, int h)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_engine_gl_x11_window_use(re->win);
|
|
|
|
evas_gl_common_rect_draw(re->win->gl_context, context, x, y, w, h);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
evas_engine_gl_x11_line_draw(void *data, void *context, void *surface, int x1, int y1, int x2, int y2)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
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 *
|
|
|
|
evas_engine_gl_x11_polygon_point_add(void *data, void *context, void *polygon, int x, int y)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
return evas_gl_common_poly_point_add(polygon, x, y);
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
|
|
|
evas_engine_gl_x11_polygon_points_clear(void *data, void *context, void *polygon)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_polygon_draw(void *data, void *context, void *surface, void *polygon)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
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 *
|
|
|
|
evas_engine_gl_x11_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;
|
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 *
|
|
|
|
evas_engine_gl_x11_gradient_colors_clear(void *data, void *context, void *gradient)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
evas_engine_gl_x11_gradient_draw(void *data, void *context, void *surface, void *gradient, int x, int y, int w, int h, double angle)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_engine_gl_x11_window_use(re->win);
|
|
|
|
evas_gl_common_gradient_draw(re->win->gl_context, context, gradient, x, y, w, h, angle);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
|
|
|
evas_engine_gl_x11_image_load(void *data, char *file, char *key, int *error)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
*error = 0;
|
|
|
|
evas_engine_gl_x11_window_use(re->win);
|
|
|
|
return evas_gl_common_image_load(re->win->gl_context, file, key);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
|
|
|
evas_engine_gl_x11_image_new_from_data(void *data, int w, int h, DATA32 *image_data)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_engine_gl_x11_window_use(re->win);
|
|
|
|
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 *
|
|
|
|
evas_engine_gl_x11_image_new_from_copied_data(void *data, int w, int h, DATA32 *image_data)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_engine_gl_x11_window_use(re->win);
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_image_free(void *data, void *image)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_engine_gl_x11_window_use(re->win);
|
|
|
|
evas_gl_common_image_free(image);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
evas_engine_gl_x11_image_size_get(void *data, void *image, int *w, int *h)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
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 *
|
|
|
|
evas_engine_gl_x11_image_size_set(void *data, void *image, int w, int h)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2003-09-04 00:40:34 -07:00
|
|
|
Evas_GL_Image *im, *im_old;
|
2002-11-08 00:02:15 -08:00
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_engine_gl_x11_window_use(re->win);
|
|
|
|
if (!image) return NULL;
|
|
|
|
im_old = image;
|
|
|
|
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 *
|
|
|
|
evas_engine_gl_x11_image_dirty_region(void *data, void *image, int x, int y, int w, int h)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2003-09-04 00:40:34 -07:00
|
|
|
Evas_GL_Image *im;
|
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 *
|
|
|
|
evas_engine_gl_x11_image_data_get(void *data, void *image, int to_write, DATA32 **image_data)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2003-09-04 00:40:34 -07:00
|
|
|
Evas_GL_Image *im;
|
2002-11-08 00:02:15 -08:00
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
im = image;
|
|
|
|
evas_engine_gl_x11_window_use(re->win);
|
|
|
|
evas_common_load_image_data_from_file(im->im);
|
|
|
|
if (to_write)
|
|
|
|
{
|
|
|
|
if (im->references > 1)
|
|
|
|
{
|
|
|
|
Evas_GL_Image *im_new;
|
|
|
|
|
|
|
|
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;
|
|
|
|
im = im_new;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
evas_gl_common_image_dirty(im);
|
|
|
|
}
|
|
|
|
*image_data = im->im->image->data;
|
|
|
|
return im;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
|
|
|
evas_engine_gl_x11_image_data_put(void *data, void *image, DATA32 *image_data)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2003-09-04 00:40:34 -07:00
|
|
|
Evas_GL_Image *im;
|
2002-11-08 00:02:15 -08:00
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
im = image;
|
|
|
|
evas_engine_gl_x11_window_use(re->win);
|
|
|
|
if (image_data != im->im->image->data)
|
|
|
|
{
|
|
|
|
int w, h;
|
|
|
|
|
|
|
|
w = im->im->image->w;
|
|
|
|
h = im->im->image->h;
|
|
|
|
evas_gl_common_image_free(im);
|
|
|
|
return evas_engine_gl_x11_image_new_from_data(data, w, h, image_data);
|
|
|
|
}
|
|
|
|
/* hmmm - but if we wrote... why bother? */
|
|
|
|
/* evas_gl_common_image_dirty(im); */
|
|
|
|
return im;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
|
|
|
evas_engine_gl_x11_image_alpha_set(void *data, void *image, int has_alpha)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2003-09-04 00:40:34 -07:00
|
|
|
Evas_GL_Image *im;
|
2002-11-08 00:02:15 -08:00
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_engine_gl_x11_window_use(re->win);
|
|
|
|
im = image;
|
|
|
|
if (im->references > 1)
|
|
|
|
{
|
|
|
|
Evas_GL_Image *im_new;
|
|
|
|
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_image_alpha_get(void *data, void *image)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2003-09-04 00:40:34 -07:00
|
|
|
Evas_GL_Image *im;
|
2002-11-08 00:02:15 -08:00
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
im = image;
|
|
|
|
evas_engine_gl_x11_window_use(re->win);
|
|
|
|
if (im->im->flags & RGBA_IMAGE_HAS_ALPHA) return 1;
|
|
|
|
return 0;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
evas_engine_gl_x11_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;
|
2003-09-04 00:40:34 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_engine_gl_x11_window_use(re->win);
|
|
|
|
evas_gl_common_image_draw(re->win->gl_context, context, image,
|
|
|
|
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 *
|
|
|
|
evas_engine_gl_x11_image_comment_get(void *data, void *image, char *key)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2003-09-04 00:40:34 -07:00
|
|
|
Evas_GL_Image *im;
|
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 *
|
|
|
|
evas_engine_gl_x11_image_format_get(void *data, void *image)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2003-09-04 00:40:34 -07:00
|
|
|
Evas_GL_Image *im;
|
2002-11-08 00:02:15 -08:00
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2003-09-04 00:40:34 -07:00
|
|
|
im = image;
|
|
|
|
if (im->im->info.format == 1) return "png";
|
|
|
|
return NULL;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
evas_engine_gl_x11_image_cache_flush(void *data)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2003-09-04 00:40:34 -07:00
|
|
|
int tmp_size;
|
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
|
|
|
|
evas_engine_gl_x11_image_cache_set(void *data, int bytes)
|
|
|
|
{
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_image_cache_get(void *data)
|
|
|
|
{
|
|
|
|
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 *
|
|
|
|
evas_engine_gl_x11_font_load(void *data, char *name, int size)
|
|
|
|
{
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
evas_engine_gl_x11_font_free(void *data, void *font)
|
|
|
|
{
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_font_ascent_get(void *data, void *font)
|
|
|
|
{
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
evas_engine_gl_x11_font_descent_get(void *data, void *font)
|
|
|
|
{
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_font_max_ascent_get(void *data, void *font)
|
|
|
|
{
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_font_max_descent_get(void *data, void *font)
|
|
|
|
{
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_font_string_size_get(void *data, void *font, char *text, int *w, int *h)
|
|
|
|
{
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_font_inset_get(void *data, void *font, char *text)
|
|
|
|
{
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_font_h_advance_get(void *data, void *font, char *text)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2003-09-04 00:40:34 -07:00
|
|
|
int h, v;
|
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
|
|
|
|
evas_engine_gl_x11_font_v_advance_get(void *data, void *font, char *text)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2003-09-04 00:40:34 -07:00
|
|
|
int h, v;
|
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_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;
|
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
|
|
|
|
evas_engine_gl_x11_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;
|
2003-09-04 00:40:34 -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
|
|
|
|
evas_engine_gl_x11_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;
|
2003-09-04 00:40:34 -07:00
|
|
|
#define GL_TXT 1
|
|
|
|
|
|
|
|
#ifdef GL_TXT
|
|
|
|
{
|
|
|
|
/* create output surface size ow x oh and scale to w x h */
|
|
|
|
RGBA_Draw_Context *dc;
|
|
|
|
RGBA_Image *im;
|
|
|
|
|
|
|
|
dc = context;
|
|
|
|
im = evas_common_image_create(ow, oh);
|
|
|
|
if (im)
|
|
|
|
{
|
|
|
|
int max_ascent;
|
|
|
|
int i, j;
|
|
|
|
RGBA_Draw_Context *dct;
|
|
|
|
|
|
|
|
im->flags |= RGBA_IMAGE_HAS_ALPHA;
|
|
|
|
j = ow * oh;
|
|
|
|
memset(im->image->data, 0, j * sizeof(DATA32));
|
|
|
|
max_ascent = evas_common_font_max_ascent_get(font);
|
|
|
|
dct = evas_common_draw_context_new();
|
|
|
|
if (dct)
|
|
|
|
{
|
|
|
|
evas_common_draw_context_set_color(dct, 255, 255, 255, 255);
|
|
|
|
evas_common_font_draw(im, dct, font, 0, max_ascent, text);
|
|
|
|
evas_common_cpu_end_opt();
|
|
|
|
evas_common_draw_context_free(dct);
|
|
|
|
}
|
|
|
|
{
|
|
|
|
Evas_GL_Texture *tex;
|
|
|
|
Evas_GL_Context *gc;
|
|
|
|
double tx1, ty1, tx2, ty2;
|
|
|
|
int r, g, b, a;
|
|
|
|
|
|
|
|
gc = re->win->gl_context;
|
|
|
|
tex = evas_gl_common_texture_new(gc, im, 0);
|
|
|
|
evas_gl_common_context_texture_set(gc, tex, 0, w, h);
|
|
|
|
tx1 = 0;
|
|
|
|
ty1 = 0;
|
|
|
|
tx2 = (double)(ow) / (double)(tex->w);
|
|
|
|
ty2 = (double)(oh) / (double)(tex->h);
|
|
|
|
a = (dc->col.col >> 24) & 0xff;
|
|
|
|
r = (dc->col.col >> 16) & 0xff;
|
|
|
|
g = (dc->col.col >> 8 ) & 0xff;
|
|
|
|
b = (dc->col.col ) & 0xff;
|
|
|
|
evas_gl_common_context_color_set(gc, r, g, b, a);
|
|
|
|
evas_gl_common_context_blend_set(gc, 1);
|
|
|
|
if (dc->clip.use)
|
|
|
|
evas_gl_common_context_clip_set(gc, 1,
|
|
|
|
dc->clip.x, dc->clip.y,
|
|
|
|
dc->clip.w, dc->clip.h);
|
|
|
|
else
|
|
|
|
evas_gl_common_context_clip_set(gc, 0,
|
|
|
|
0, 0, 0, 0);
|
|
|
|
evas_gl_common_context_read_buf_set(gc, GL_BACK);
|
|
|
|
evas_gl_common_context_write_buf_set(gc, GL_BACK);
|
|
|
|
|
|
|
|
glBegin(GL_QUADS);
|
|
|
|
glTexCoord2d(tx1, ty1); glVertex2i(x , y - ((max_ascent * h) / oh));
|
|
|
|
glTexCoord2d(tx2, ty1); glVertex2i(x + w, y - ((max_ascent * h) / oh));
|
|
|
|
glTexCoord2d(tx2, ty2); glVertex2i(x + w, y - ((max_ascent * h) / oh) + h);
|
|
|
|
glTexCoord2d(tx1, ty2); glVertex2i(x , y - ((max_ascent * h) / oh) + h);
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
evas_gl_common_texture_free(tex);
|
|
|
|
}
|
|
|
|
evas_common_image_free(im);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
evas_engine_gl_x11_font_cache_flush(void *data)
|
|
|
|
{
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_font_cache_set(void *data, int bytes)
|
|
|
|
{
|
|
|
|
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
|
|
|
|
evas_engine_gl_x11_font_cache_get(void *data)
|
|
|
|
{
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* private engine functions the calling prog can use */
|
|
|
|
|
|
|
|
static Visual *
|
|
|
|
evas_engine_gl_x11_best_visual_get(Display *disp, int screen)
|
|
|
|
{
|
|
|
|
if (!disp) return NULL;
|
2003-09-04 00:40:34 -07:00
|
|
|
if (!_evas_gl_x11_vi)
|
|
|
|
_evas_gl_x11_vi = glXChooseVisual(disp, screen,
|
|
|
|
_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
|
|
|
|
evas_engine_gl_x11_best_colormap_get(Display *disp, int screen)
|
|
|
|
{
|
|
|
|
if (!disp) return 0;
|
2003-09-04 00:40:34 -07:00
|
|
|
if (!_evas_gl_x11_vi)
|
|
|
|
evas_engine_gl_x11_best_visual_get(disp, screen);
|
|
|
|
if (!_evas_gl_x11_vi) return 0;
|
|
|
|
_evas_gl_x11_cmap = XCreateColormap(disp, RootWindow(disp, screen),
|
|
|
|
_evas_gl_x11_vi->visual, 0);
|
|
|
|
return _evas_gl_x11_cmap;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
evas_engine_gl_x11_best_depth_get(Display *disp, int screen)
|
|
|
|
{
|
|
|
|
if (!disp) return 0;
|
2003-09-04 00:40:34 -07:00
|
|
|
if (!_evas_gl_x11_vi)
|
|
|
|
evas_engine_gl_x11_best_visual_get(disp, screen);
|
|
|
|
if (!_evas_gl_x11_vi) return 0;
|
|
|
|
return _evas_gl_x11_vi->depth;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|