2009-10-09 05:10:27 -07:00
|
|
|
#include "evas_engine.h"
|
|
|
|
|
2010-01-21 00:44:11 -08:00
|
|
|
#include <dlfcn.h> /* dlopen,dlclose,etc */
|
|
|
|
|
2009-10-09 05:10:27 -07:00
|
|
|
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
|
2010-01-21 00:44:11 -08:00
|
|
|
// EGL / GLES
|
2009-10-09 05:10:27 -07:00
|
|
|
# if defined(GLES_VARIETY_S3C6410)
|
|
|
|
# elif defined(GLES_VARIETY_SGX)
|
|
|
|
# endif
|
2010-01-21 00:44:11 -08:00
|
|
|
#else
|
2009-10-09 05:10:27 -07:00
|
|
|
// GLX
|
2010-01-21 00:44:11 -08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
|
2010-01-21 01:42:26 -08:00
|
|
|
void (*glsym_eglBindTexImage) (EGLDisplay a, EGLSurface b, int c) = NULL;
|
|
|
|
void (*glsym_eglReleaseTexImage) (EGLDisplay a, EGLSurface b, int c) = NULL;
|
2010-01-21 00:44:11 -08:00
|
|
|
#else
|
|
|
|
typedef void (*_eng_fn) (void);
|
|
|
|
|
|
|
|
_eng_fn (*glsym_glXGetProcAddress) (const char *a) = NULL;
|
|
|
|
void (*glsym_glXBindTexImage) (Display *a, GLXDrawable b, int c, int *d) = NULL;
|
|
|
|
void (*glsym_glXReleaseTexImage) (Display *a, GLXDrawable b, int c) = NULL;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static void
|
|
|
|
_sym_init(void)
|
|
|
|
{
|
|
|
|
static int done = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if (done) return;
|
|
|
|
|
|
|
|
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
|
2010-01-21 01:42:26 -08:00
|
|
|
#define FINDSYM(dst, sym) if (!dst) dst = dlsym(RTLD_DEFAULT, sym)
|
|
|
|
FINDSYM(glsym_eglBindTexImage, "eglBindTexImage");
|
|
|
|
FINDSYM(glsym_eglBindTexImage, "eglBindTexImageEXT");
|
|
|
|
FINDSYM(glsym_eglBindTexImage, "eglBindTexImageARB");
|
|
|
|
|
|
|
|
FINDSYM(glsym_eglReleaseTexImage, "eglReleaseTexImage");
|
|
|
|
FINDSYM(glsym_eglReleaseTexImage, "eglReleaseTexImageEXT");
|
|
|
|
FINDSYM(glsym_eglReleaseTexImage, "eglReleaseTexImageARB");
|
2008-04-11 17:32:30 -07:00
|
|
|
#else
|
2010-01-21 01:42:26 -08:00
|
|
|
#define FINDSYM(dst, sym) \
|
|
|
|
if ((!dst) && (glsym_glXGetProcAddress)) dst = glsym_glXGetProcAddress(sym); \
|
|
|
|
if (!dst) dst = dlsym(RTLD_DEFAULT, sym)
|
|
|
|
|
2010-01-21 00:44:11 -08:00
|
|
|
FINDSYM(glsym_glXGetProcAddress, "glXGetProcAddress");
|
|
|
|
FINDSYM(glsym_glXGetProcAddress, "glXGetProcAddressEXT");
|
|
|
|
FINDSYM(glsym_glXGetProcAddress, "glXGetProcAddressARB");
|
|
|
|
|
|
|
|
FINDSYM(glsym_glXBindTexImage, "glXBindTexImage");
|
|
|
|
FINDSYM(glsym_glXBindTexImage, "glXBindTexImageEXT");
|
|
|
|
FINDSYM(glsym_glXBindTexImage, "glXBindTexImageARB");
|
|
|
|
|
|
|
|
FINDSYM(glsym_glXReleaseTexImage, "glXReleaseTexImage");
|
|
|
|
FINDSYM(glsym_glXReleaseTexImage, "glXReleaseTexImageEXT");
|
|
|
|
FINDSYM(glsym_glXReleaseTexImage, "glXReleaseTexImageARB");
|
|
|
|
|
|
|
|
printf("glXGetProcAddress: %p\n"
|
|
|
|
"glXBindTexImage: %p\n"
|
|
|
|
"glXReleaseTexImage: %p\n",
|
|
|
|
glsym_glXGetProcAddress,
|
|
|
|
glsym_glXBindTexImage, glsym_glXReleaseTexImage);
|
2008-04-11 17:32:30 -07:00
|
|
|
#endif
|
2010-01-21 00:44:11 -08:00
|
|
|
}
|
2008-04-11 17:32:30 -07:00
|
|
|
|
2009-10-22 08:22:22 -07:00
|
|
|
int _evas_engine_GL_X11_log_dom = -1;
|
2006-12-09 00:52:08 -08:00
|
|
|
/* function tables - filled in later (func and parent func) */
|
|
|
|
static Evas_Func func, pfunc;
|
2006-02-27 20:07:49 -08:00
|
|
|
|
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;
|
2010-01-07 23:10:53 -08:00
|
|
|
|
|
|
|
XrmDatabase xrdb; // xres - dpi
|
|
|
|
struct { // xres - dpi
|
|
|
|
int dpi; // xres - dpi
|
|
|
|
} xr; // xres - dpi
|
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;
|
2010-01-21 00:44:11 -08:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
info = calloc(1, sizeof(Evas_Engine_Info_GL_X11));
|
|
|
|
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;
|
2002-11-08 00:02:15 -08:00
|
|
|
return info;
|
|
|
|
e = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_info_free(Evas *e __UNUSED__, void *info)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas_Engine_Info_GL_X11 *in;
|
2009-11-13 00:28:47 -08:00
|
|
|
// dont free! why bother? its not worth it
|
|
|
|
// eina_log_domain_unregister(_evas_engine_GL_X11_log_dom);
|
2002-11-08 00:02:15 -08:00
|
|
|
in = (Evas_Engine_Info_GL_X11 *)info;
|
|
|
|
free(in);
|
|
|
|
}
|
|
|
|
|
2009-03-24 02:05:32 -07:00
|
|
|
static int
|
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;
|
|
|
|
if (!e->engine.data.output)
|
2006-12-09 00:52:08 -08:00
|
|
|
{
|
2009-10-09 05:10:27 -07:00
|
|
|
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
|
|
|
|
#else
|
2010-01-21 21:55:46 -08:00
|
|
|
int eb, evb;
|
|
|
|
|
2009-03-24 02:05:32 -07:00
|
|
|
if (!glXQueryExtension(info->info.display, &eb, &evb)) return 0;
|
2009-10-09 05:10:27 -07:00
|
|
|
#endif
|
2006-12-09 00:52:08 -08:00
|
|
|
re = calloc(1, sizeof(Render_Engine));
|
2009-03-24 02:05:32 -07:00
|
|
|
if (!re) return 0;
|
2006-12-09 00:52:08 -08:00
|
|
|
e->engine.data.output = re;
|
|
|
|
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);
|
|
|
|
if (!re->win)
|
|
|
|
{
|
|
|
|
free(re);
|
|
|
|
e->engine.data.output = NULL;
|
2009-03-24 02:05:32 -07:00
|
|
|
return 0;
|
2006-12-09 00:52:08 -08:00
|
|
|
}
|
2010-01-07 23:10:53 -08:00
|
|
|
|
|
|
|
{
|
|
|
|
int status;
|
|
|
|
char *type = NULL;
|
|
|
|
XrmValue val;
|
|
|
|
|
|
|
|
re->xr.dpi = 75000; // dpy * 1000
|
|
|
|
re->xrdb = XrmGetDatabase(info->info.display);
|
|
|
|
status = XrmGetResource(re->xrdb, "Xft.dpi", "Xft.Dpi", &type, &val);
|
|
|
|
if ((status) && (type))
|
|
|
|
{
|
|
|
|
if (!strcmp(type, "String"))
|
|
|
|
{
|
|
|
|
const char *str, *dp;
|
|
|
|
|
|
|
|
str = val.addr;
|
|
|
|
dp = strchr(str, '.');
|
|
|
|
if (!dp) dp = strchr(str, ',');
|
|
|
|
|
|
|
|
if (dp)
|
|
|
|
{
|
|
|
|
int subdpi, len, i;
|
|
|
|
char *buf;
|
|
|
|
|
|
|
|
buf = alloca(dp - str + 1);
|
|
|
|
strncpy(buf, str, dp - str);
|
|
|
|
buf[dp - str] = 0;
|
|
|
|
len = strlen(dp + 1);
|
|
|
|
subdpi = atoi(dp + 1);
|
|
|
|
|
|
|
|
if (len < 3)
|
|
|
|
{
|
|
|
|
for (i = len; i < 3; i++) subdpi *= 10;
|
|
|
|
}
|
|
|
|
else if (len > 3)
|
|
|
|
{
|
|
|
|
for (i = len; i > 3; i--) subdpi /= 10;
|
|
|
|
}
|
|
|
|
re->xr.dpi = atoi(buf) * 1000;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
re->xr.dpi = atoi(str) * 1000;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
evas_common_font_dpi_set(re->xr.dpi / 1000);
|
|
|
|
}
|
|
|
|
|
2006-12-09 00:52:08 -08:00
|
|
|
evas_common_cpu_init();
|
2010-01-07 23:10:53 -08:00
|
|
|
|
2006-12-09 00:52:08 -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();
|
|
|
|
}
|
2006-03-08 00:02:34 -08:00
|
|
|
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);
|
2009-10-13 02:40:39 -07:00
|
|
|
|
2006-03-08 00:02:34 -08:00
|
|
|
}
|
2009-03-24 02:05:32 -07:00
|
|
|
if (!e->engine.data.output) return 0;
|
2002-11-08 00:02:15 -08:00
|
|
|
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);
|
2009-10-13 02:40:39 -07:00
|
|
|
eng_window_use(re->win);
|
|
|
|
|
2010-01-21 00:44:11 -08:00
|
|
|
_sym_init();
|
|
|
|
|
2009-03-24 02:05:32 -07:00
|
|
|
return 1;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
2010-01-07 23:48:18 -08:00
|
|
|
|
2010-01-07 23:51:30 -08:00
|
|
|
// if (re->xrdb) XrmDestroyDatabase(re->xrdb);
|
2010-01-07 23:48:18 -08:00
|
|
|
|
2006-09-30 03:18:37 -07:00
|
|
|
eng_window_free(re->win);
|
2002-11-08 00:02:15 -08:00
|
|
|
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;
|
2009-10-13 02:40:39 -07:00
|
|
|
eng_window_use(re->win);
|
2003-09-04 00:40:34 -07:00
|
|
|
evas_gl_common_context_resize(re->win->gl_context, w, h);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_output_tile_size_set(void *data, int w __UNUSED__, int h __UNUSED__)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2009-10-12 08:22:38 -07:00
|
|
|
// Render_Engine *re;
|
|
|
|
//
|
|
|
|
// re = (Render_Engine *)data;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
2006-12-28 19:32:46 -08:00
|
|
|
evas_gl_common_context_resize(re->win->gl_context, re->win->w, re->win->h);
|
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
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_output_redraws_rect_del(void *data, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2009-10-12 08:22:38 -07:00
|
|
|
// Render_Engine *re;
|
|
|
|
//
|
|
|
|
// re = (Render_Engine *)data;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
2009-10-22 08:22:22 -07:00
|
|
|
// INF("GL: finish update cycle!");
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2007-03-03 08:05:15 -08:00
|
|
|
/* at least the nvidia drivers are so abysmal that copying from the backbuffer
|
|
|
|
* to the front using glCopyPixels() that you literally can WATCH it draw the
|
|
|
|
* pixels slowly across the screen with a window update taking multiple
|
|
|
|
* seconds - so workaround by doing a full buffer render as frankly GL isn't
|
|
|
|
* up to doing anything that isn't done by quake (etc.)
|
|
|
|
*/
|
|
|
|
#define SLOW_GL_COPY_RECT 1
|
|
|
|
/* vsync games - not for now though */
|
|
|
|
//#define VSYNC_TO_SCREEN 1
|
|
|
|
|
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;
|
2009-10-14 20:25:22 -07:00
|
|
|
evas_gl_common_context_flush(re->win->gl_context);
|
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");
|
2007-03-03 08:05:15 -08:00
|
|
|
#ifdef SLOW_GL_COPY_RECT
|
2009-02-21 00:19:58 -08:00
|
|
|
/* if any update - just return the whole canvas - works with swap
|
2007-03-03 08:05:15 -08:00
|
|
|
* buffers then */
|
|
|
|
if (x) *x = 0;
|
|
|
|
if (y) *y = 0;
|
|
|
|
if (w) *w = re->win->w;
|
|
|
|
if (h) *h = re->win->h;
|
|
|
|
if (cx) *cx = 0;
|
|
|
|
if (cy) *cy = 0;
|
|
|
|
if (cw) *cw = re->win->w;
|
|
|
|
if (ch) *ch = re->win->h;
|
|
|
|
#else
|
|
|
|
/* 1 update - INCREDIBLY SLOW if combined with swap_rect in flush. a gl
|
|
|
|
* problem where there just is no hardware path for somethnig that
|
|
|
|
* obviously SHOULD be there */
|
|
|
|
/* only 1 update to minimise gl context games and rendering multiple update
|
|
|
|
* regions as evas does with other engines
|
|
|
|
*/
|
2003-09-04 00:40:34 -07:00
|
|
|
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;
|
2009-02-21 00:19:58 -08:00
|
|
|
#endif
|
2009-10-09 05:10:27 -07:00
|
|
|
// clear buffer. only needed for dest alpha
|
|
|
|
// glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
|
|
|
// glClear(GL_COLOR_BUFFER_BIT);
|
|
|
|
//x// printf("frame -> new\n");
|
2009-11-12 23:22:31 -08:00
|
|
|
return re->win->gl_context->def_surface;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_output_redraws_next_update_push(void *data, void *surface __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
|
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 */
|
|
|
|
re->win->draw.redraw = 0;
|
2007-03-04 09:06:13 -08:00
|
|
|
re->win->draw.drew = 1;
|
2009-10-09 05:10:27 -07:00
|
|
|
evas_gl_common_context_flush(re->win->gl_context);
|
|
|
|
//x// printf("frame -> push\n");
|
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;
|
2007-03-04 09:06:13 -08:00
|
|
|
if (!re->win->draw.drew) return;
|
2009-10-09 05:10:27 -07:00
|
|
|
//x// printf("frame -> flush\n");
|
2007-03-04 09:06:13 -08:00
|
|
|
re->win->draw.drew = 0;
|
2006-03-06 18:44:16 -08:00
|
|
|
eng_window_use(re->win);
|
2003-09-04 00:40:34 -07:00
|
|
|
|
2009-10-13 02:40:39 -07:00
|
|
|
// glFlush();
|
2009-10-09 05:10:27 -07:00
|
|
|
# if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
|
|
|
|
eglSwapBuffers(re->win->egl_disp, re->win->egl_surface[0]);
|
|
|
|
#else
|
|
|
|
# ifdef VSYNC_TO_SCREEN
|
2010-01-21 00:44:11 -08:00
|
|
|
// {
|
|
|
|
// unsigned int rc;
|
|
|
|
//
|
|
|
|
// glXGetVideoSyncSGI(&rc);
|
|
|
|
// glXWaitVideoSyncSGI(2, (rc + 1) % 2, &rc);
|
|
|
|
// }
|
2009-10-09 05:10:27 -07:00
|
|
|
# endif
|
|
|
|
# ifdef SLOW_GL_COPY_RECT
|
2005-05-21 19:49:50 -07:00
|
|
|
glXSwapBuffers(re->win->disp, re->win->win);
|
2009-10-09 05:10:27 -07:00
|
|
|
# else
|
2010-01-21 00:44:11 -08:00
|
|
|
// /* 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);
|
2009-10-09 05:10:27 -07:00
|
|
|
# endif
|
2004-07-19 21:05:14 -07:00
|
|
|
// glFlush();
|
|
|
|
// glXWaitGL();
|
2003-09-04 00:40:34 -07:00
|
|
|
// XSync(re->win->disp, False);
|
2009-10-09 05:10:27 -07:00
|
|
|
#endif
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2007-06-16 19:56:59 -07:00
|
|
|
static void
|
|
|
|
eng_output_idle_flush(void *data)
|
|
|
|
{
|
2009-10-12 08:22:38 -07:00
|
|
|
// Render_Engine *re;
|
|
|
|
//
|
|
|
|
// re = (Render_Engine *)data;
|
2007-06-16 19:56:59 -07:00
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2009-10-12 08:22:38 -07:00
|
|
|
// Render_Engine *re;
|
|
|
|
//
|
|
|
|
// re = (Render_Engine *)data;
|
|
|
|
// re->win->gl_context->dc = context;
|
2009-02-20 19:13:49 -08:00
|
|
|
evas_common_draw_context_add_cutout(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_cutout_clear(void *data, void *context)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2009-10-12 08:22:38 -07:00
|
|
|
// Render_Engine *re;
|
|
|
|
//
|
|
|
|
// re = (Render_Engine *)data;
|
|
|
|
// re->win->gl_context->dc = context;
|
2009-02-20 19:13:49 -08:00
|
|
|
evas_common_draw_context_clear_cutouts(context);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-11-12 23:22:31 -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);
|
2009-11-12 23:22:31 -08:00
|
|
|
evas_gl_common_context_target_surface_set(re->win->gl_context, surface);
|
2006-09-30 03:18:37 -07:00
|
|
|
re->win->gl_context->dc = context;
|
|
|
|
evas_gl_common_rect_draw(re->win->gl_context, x, y, w, h);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-11-12 23:22:31 -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;
|
2009-10-09 05:10:27 -07:00
|
|
|
eng_window_use(re->win);
|
2009-11-12 23:22:31 -08:00
|
|
|
evas_gl_common_context_target_surface_set(re->win->gl_context, surface);
|
2006-09-30 03:18:37 -07:00
|
|
|
re->win->gl_context->dc = context;
|
2009-12-30 03:35:40 -08:00
|
|
|
evas_gl_common_line_draw(re->win->gl_context, x1, y1, x2, y2);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_polygon_point_add(void *data, void *context __UNUSED__, 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;
|
2009-12-26 16:40:25 -08:00
|
|
|
return evas_gl_common_poly_point_add(polygon, x, y);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_polygon_points_clear(void *data, void *context __UNUSED__, 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;
|
2009-12-26 16:40:25 -08:00
|
|
|
return evas_gl_common_poly_points_clear(polygon);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-11-12 23:22:31 -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;
|
2009-10-09 05:10:27 -07:00
|
|
|
eng_window_use(re->win);
|
2009-11-12 23:22:31 -08:00
|
|
|
evas_gl_common_context_target_surface_set(re->win->gl_context, surface);
|
2006-09-30 03:18:37 -07:00
|
|
|
re->win->gl_context->dc = context;
|
2009-12-26 16:40:25 -08:00
|
|
|
evas_gl_common_poly_draw(re->win->gl_context, polygon);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2008-08-25 22:45:04 -07:00
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient2_color_np_stop_insert(void *data __UNUSED__, void *gradient __UNUSED__, int r __UNUSED__, int g __UNUSED__, int b __UNUSED__, int a __UNUSED__, float pos __UNUSED__)
|
2008-08-25 22:45:04 -07:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
evas_common_gradient2_color_np_stop_insert(gradient, r, g, b, a, pos);
|
2008-08-25 22:45:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient2_clear(void *data __UNUSED__, void *gradient __UNUSED__)
|
2008-08-25 22:45:04 -07:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
evas_common_gradient2_clear(gradient);
|
2008-08-25 22:45:04 -07:00
|
|
|
}
|
|
|
|
|
2008-11-04 01:19:35 -08:00
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient2_fill_transform_set(void *data __UNUSED__, void *gradient __UNUSED__, void *transform __UNUSED__)
|
2008-11-04 01:19:35 -08:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
evas_common_gradient2_fill_transform_set(gradient, transform);
|
2008-11-04 01:19:35 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-12-30 03:35:40 -08:00
|
|
|
eng_gradient2_fill_spread_set(void *data __UNUSED__, void *gradient __UNUSED__, int spread __UNUSED__)
|
2008-11-04 01:19:35 -08:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
evas_common_gradient2_fill_spread_set(gradient, spread);
|
2008-11-04 01:19:35 -08:00
|
|
|
}
|
|
|
|
|
2008-08-25 22:45:04 -07:00
|
|
|
static void *
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient2_linear_new(void *data __UNUSED__)
|
2008-08-25 22:45:04 -07:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
return evas_common_gradient2_linear_new();
|
2008-08-25 22:45:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient2_linear_free(void *data __UNUSED__, void *linear_gradient __UNUSED__)
|
2008-08-25 22:45:04 -07:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
evas_common_gradient2_free(linear_gradient);
|
2008-08-25 22:45:04 -07:00
|
|
|
}
|
|
|
|
|
2008-11-04 01:19:35 -08:00
|
|
|
static void
|
2009-12-21 07:52:12 -08:00
|
|
|
eng_gradient2_linear_fill_set(void *data __UNUSED__, void *linear_gradient __UNUSED__, float x0 __UNUSED__, float y0 __UNUSED__, float x1 __UNUSED__, float y1 __UNUSED__)
|
2008-11-04 01:19:35 -08:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
evas_common_gradient2_linear_fill_set(linear_gradient, x0, y0, x1, y1);
|
2008-11-04 01:19:35 -08:00
|
|
|
}
|
|
|
|
|
2008-08-25 22:45:04 -07:00
|
|
|
static int
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient2_linear_is_opaque(void *data __UNUSED__, void *context __UNUSED__, void *linear_gradient __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
|
2008-08-25 22:45:04 -07:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
|
|
|
|
RGBA_Gradient2 *gr = (RGBA_Gradient2 *)linear_gradient;
|
|
|
|
|
|
|
|
if (!dc || !gr || !gr->type.geometer) return 0;
|
|
|
|
return !(gr->type.geometer->has_alpha(gr, dc->render_op) |
|
|
|
|
gr->type.geometer->has_mask(gr, dc->render_op));
|
2008-08-25 22:45:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient2_linear_is_visible(void *data __UNUSED__, void *context __UNUSED__, void *linear_gradient __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
|
2008-08-25 22:45:04 -07:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
|
|
|
|
|
|
|
|
if (!dc || !linear_gradient) return 0;
|
2008-08-25 22:45:04 -07:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient2_linear_render_pre(void *data __UNUSED__, void *context __UNUSED__, void *linear_gradient __UNUSED__)
|
2008-08-25 22:45:04 -07:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
|
|
|
|
RGBA_Gradient2 *gr = (RGBA_Gradient2 *)linear_gradient;
|
|
|
|
int len;
|
|
|
|
|
|
|
|
if (!dc || !gr || !gr->type.geometer) return;
|
|
|
|
gr->type.geometer->geom_update(gr);
|
|
|
|
len = gr->type.geometer->get_map_len(gr);
|
|
|
|
evas_common_gradient2_map(dc, gr, len);
|
2008-08-25 22:45:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient2_linear_render_post(void *data __UNUSED__, void *linear_gradient __UNUSED__)
|
2008-08-25 22:45:04 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient2_linear_draw(void *data __UNUSED__, void *context __UNUSED__, void *surface __UNUSED__, void *linear_gradient __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
|
2008-08-25 22:45:04 -07:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
eng_window_use(re->win);
|
|
|
|
re->win->gl_context->dc = context;
|
|
|
|
{
|
|
|
|
Evas_GL_Image *gim;
|
|
|
|
RGBA_Image *im;
|
|
|
|
RGBA_Draw_Context *dc = context;
|
|
|
|
int op = dc->render_op, cuse = dc->clip.use;
|
|
|
|
|
|
|
|
im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
|
|
|
|
im = (RGBA_Image *)evas_cache_image_size_set(&im->cache_entry, w, h);
|
|
|
|
|
|
|
|
dc->render_op = _EVAS_RENDER_FILL;
|
|
|
|
dc->clip.use = 0;
|
|
|
|
|
|
|
|
// draw to buf, copy to tex, draw tex
|
|
|
|
evas_common_gradient2_draw(im, dc, 0, 0, w, h, linear_gradient);
|
|
|
|
|
|
|
|
gim = evas_gl_common_image_new_from_data(re->win->gl_context, w, h,
|
|
|
|
im->image.data, 1,
|
|
|
|
EVAS_COLORSPACE_ARGB8888);
|
|
|
|
dc->render_op = op;
|
|
|
|
dc->clip.use = cuse;
|
|
|
|
evas_gl_common_image_draw(re->win->gl_context, gim, 0, 0, w, h, x, y, w, h, 0);
|
|
|
|
evas_cache_image_drop(&im->cache_entry);
|
|
|
|
evas_gl_common_image_free(gim);
|
|
|
|
}
|
2008-08-25 22:45:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient2_radial_new(void *data __UNUSED__)
|
2008-08-25 22:45:04 -07:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
return evas_common_gradient2_radial_new();
|
2008-08-25 22:45:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient2_radial_free(void *data __UNUSED__, void *radial_gradient __UNUSED__)
|
2008-08-25 22:45:04 -07:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
evas_common_gradient2_free(radial_gradient);
|
2008-08-25 22:45:04 -07:00
|
|
|
}
|
|
|
|
|
2008-11-04 01:19:35 -08:00
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient2_radial_fill_set(void *data __UNUSED__, void *radial_gradient __UNUSED__, float cx __UNUSED__, float cy __UNUSED__, float rx __UNUSED__, float ry __UNUSED__)
|
2008-11-04 01:19:35 -08:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
evas_common_gradient2_radial_fill_set(radial_gradient, cx, cy, rx, ry);
|
2008-11-04 01:19:35 -08:00
|
|
|
}
|
|
|
|
|
2008-08-25 22:45:04 -07:00
|
|
|
static int
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient2_radial_is_opaque(void *data __UNUSED__, void *context __UNUSED__, void *radial_gradient __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
|
2008-08-25 22:45:04 -07:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
|
|
|
|
RGBA_Gradient2 *gr = (RGBA_Gradient2 *)radial_gradient;
|
|
|
|
|
|
|
|
if (!dc || !gr || !gr->type.geometer) return 0;
|
|
|
|
return !(gr->type.geometer->has_alpha(gr, dc->render_op) |
|
|
|
|
gr->type.geometer->has_mask(gr, dc->render_op));
|
2008-08-25 22:45:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient2_radial_is_visible(void *data __UNUSED__, void *context __UNUSED__, void *radial_gradient __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
|
2008-08-25 22:45:04 -07:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
|
|
|
|
|
|
|
|
if (!dc || !radial_gradient) return 0;
|
2008-08-25 22:45:04 -07:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient2_radial_render_pre(void *data __UNUSED__, void *context __UNUSED__, void *radial_gradient __UNUSED__)
|
2008-08-25 22:45:04 -07:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
|
|
|
|
RGBA_Gradient2 *gr = (RGBA_Gradient2 *)radial_gradient;
|
|
|
|
int len;
|
|
|
|
|
|
|
|
if (!dc || !gr || !gr->type.geometer) return;
|
|
|
|
gr->type.geometer->geom_update(gr);
|
|
|
|
len = gr->type.geometer->get_map_len(gr);
|
|
|
|
evas_common_gradient2_map(dc, gr, len);
|
2008-08-25 22:45:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient2_radial_render_post(void *data __UNUSED__, void *radial_gradient __UNUSED__)
|
2008-08-25 22:45:04 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient2_radial_draw(void *data __UNUSED__, void *context __UNUSED__, void *surface __UNUSED__, void *radial_gradient __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
|
2008-08-25 22:45:04 -07:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
eng_window_use(re->win);
|
|
|
|
re->win->gl_context->dc = context;
|
|
|
|
{
|
|
|
|
Evas_GL_Image *gim;
|
|
|
|
RGBA_Image *im;
|
|
|
|
RGBA_Draw_Context *dc = context;
|
|
|
|
int op = dc->render_op, cuse = dc->clip.use;
|
|
|
|
|
|
|
|
im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
|
|
|
|
im = (RGBA_Image *)evas_cache_image_size_set(&im->cache_entry, w, h);
|
|
|
|
|
|
|
|
dc->render_op = _EVAS_RENDER_FILL;
|
|
|
|
dc->clip.use = 0;
|
|
|
|
|
|
|
|
// draw to buf, copy to tex, draw tex
|
|
|
|
evas_common_gradient2_draw(im, dc, 0, 0, w, h, radial_gradient);
|
|
|
|
|
|
|
|
gim = evas_gl_common_image_new_from_data(re->win->gl_context, w, h,
|
|
|
|
im->image.data, 1,
|
|
|
|
EVAS_COLORSPACE_ARGB8888);
|
|
|
|
dc->render_op = op;
|
|
|
|
dc->clip.use = cuse;
|
|
|
|
evas_gl_common_image_draw(re->win->gl_context, gim, 0, 0, w, h, x, y, w, h, 0);
|
|
|
|
evas_cache_image_drop(&im->cache_entry);
|
|
|
|
evas_gl_common_image_free(gim);
|
|
|
|
}
|
2008-08-25 22:45:04 -07:00
|
|
|
}
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
static void *
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient_new(void *data __UNUSED__)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
return evas_common_gradient_new();
|
2006-09-30 03:18:37 -07:00
|
|
|
}
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2006-09-30 03:18:37 -07:00
|
|
|
static void
|
2009-12-30 03:35:40 -08:00
|
|
|
eng_gradient_free(void *data __UNUSED__, void *gradient)
|
2006-09-30 03:18:37 -07:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
evas_common_gradient_free(gradient);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2006-09-30 03:18:37 -07:00
|
|
|
static void
|
2009-12-30 03:35:40 -08:00
|
|
|
eng_gradient_color_stop_add(void *data __UNUSED__, void *gradient, int r, int g, int b, int a, int delta)
|
2006-05-02 00:28:49 -07:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
evas_common_gradient_color_stop_add(gradient, r, g, b, a, delta);
|
2006-09-30 03:18:37 -07:00
|
|
|
}
|
2006-05-02 00:28:49 -07:00
|
|
|
|
2006-09-30 03:18:37 -07:00
|
|
|
static void
|
2009-12-30 03:35:40 -08:00
|
|
|
eng_gradient_alpha_stop_add(void *data __UNUSED__, void *gradient, int a, int delta)
|
2006-09-30 03:18:37 -07:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
evas_common_gradient_alpha_stop_add(gradient, a, delta);
|
2006-05-02 00:28:49 -07:00
|
|
|
}
|
|
|
|
|
2006-09-30 03:18:37 -07:00
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient_color_data_set(void *data __UNUSED__, void *gradient, void *map, int len, int has_alpha)
|
2006-05-02 00:28:49 -07:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
evas_common_gradient_color_data_set(gradient, map, len, has_alpha);
|
2006-09-30 03:18:37 -07:00
|
|
|
}
|
2006-05-02 00:28:49 -07:00
|
|
|
|
2006-09-30 03:18:37 -07:00
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient_alpha_data_set(void *data __UNUSED__, void *gradient, void *alpha_map, int len)
|
2006-09-30 03:18:37 -07:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
evas_common_gradient_alpha_data_set(gradient, alpha_map, len);
|
2006-05-02 00:28:49 -07:00
|
|
|
}
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
static void
|
2009-12-30 03:35:40 -08:00
|
|
|
eng_gradient_clear(void *data __UNUSED__, void *gradient)
|
2005-12-03 01:27:53 -08:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
evas_common_gradient_clear(gradient);
|
2005-12-03 01:27:53 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient_fill_set(void *data __UNUSED__, void *gradient, int x, int y, int w, int h)
|
2005-12-03 01:27:53 -08:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
evas_common_gradient_fill_set(gradient, x, y, w, h);
|
2005-12-03 01:27:53 -08:00
|
|
|
}
|
|
|
|
|
2006-05-04 04:52:46 -07:00
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient_fill_angle_set(void *data __UNUSED__, void *gradient, double angle)
|
2006-05-04 04:52:46 -07:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
evas_common_gradient_fill_angle_set(gradient, angle);
|
2006-09-30 03:18:37 -07:00
|
|
|
}
|
2006-05-04 04:52:46 -07:00
|
|
|
|
2006-09-30 03:18:37 -07:00
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient_fill_spread_set(void *data __UNUSED__, void *gradient, int spread)
|
2006-09-30 03:18:37 -07:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
evas_common_gradient_fill_spread_set(gradient, spread);
|
2006-05-04 04:52:46 -07:00
|
|
|
}
|
|
|
|
|
2005-12-03 01:27:53 -08:00
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient_angle_set(void *data __UNUSED__, void *gradient, double angle)
|
2005-12-03 01:27:53 -08:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
evas_common_gradient_map_angle_set(gradient, angle);
|
2006-09-30 03:18:37 -07:00
|
|
|
}
|
2005-12-03 01:27:53 -08:00
|
|
|
|
2006-09-30 03:18:37 -07:00
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient_offset_set(void *data __UNUSED__, void *gradient, float offset)
|
2006-09-30 03:18:37 -07:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
evas_common_gradient_map_offset_set(gradient, offset);
|
2005-12-03 01:27:53 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient_direction_set(void *data __UNUSED__, void *gradient, int direction)
|
2005-12-03 01:27:53 -08:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
evas_common_gradient_map_direction_set(gradient, direction);
|
2006-09-30 03:18:37 -07:00
|
|
|
}
|
2005-12-03 01:27:53 -08:00
|
|
|
|
2006-09-30 03:18:37 -07:00
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient_type_set(void *data __UNUSED__, void *gradient, char *name, char *params)
|
2006-09-30 03:18:37 -07:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
evas_common_gradient_type_set(gradient, name, params);
|
2005-12-03 01:27:53 -08:00
|
|
|
}
|
|
|
|
|
2006-09-30 03:18:37 -07:00
|
|
|
static int
|
|
|
|
eng_gradient_is_opaque(void *data, void *context, void *gradient, int x, int y, int w, int h)
|
2005-12-03 01:27:53 -08:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
|
|
|
|
RGBA_Gradient *gr = (RGBA_Gradient *)gradient;
|
|
|
|
|
|
|
|
if (!dc || !gr || !gr->type.geometer) return 0;
|
|
|
|
return !(gr->type.geometer->has_alpha(gr, dc->render_op) |
|
|
|
|
gr->type.geometer->has_mask(gr, dc->render_op));
|
2005-12-03 01:27:53 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2006-09-30 03:18:37 -07:00
|
|
|
eng_gradient_is_visible(void *data, void *context, void *gradient, int x, int y, int w, int h)
|
2005-12-03 01:27:53 -08:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
|
|
|
|
|
|
|
|
if (!dc || !gradient) return 0;
|
|
|
|
return 1;
|
2005-12-03 01:27:53 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-09-30 03:18:37 -07:00
|
|
|
eng_gradient_render_pre(void *data, void *context, void *gradient)
|
2005-12-03 01:27:53 -08:00
|
|
|
{
|
2009-12-30 03:35:40 -08:00
|
|
|
RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
|
|
|
|
RGBA_Gradient *gr = (RGBA_Gradient *)gradient;
|
|
|
|
int len;
|
|
|
|
|
|
|
|
if (!dc || !gr || !gr->type.geometer) return;
|
|
|
|
gr->type.geometer->geom_set(gr);
|
|
|
|
len = gr->type.geometer->get_map_len(gr);
|
|
|
|
evas_common_gradient_map(dc, gr, len);
|
2006-09-30 03:18:37 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient_render_post(void *data __UNUSED__, void *gradient)
|
2006-09-30 03:18:37 -07:00
|
|
|
{
|
2005-12-03 01:27:53 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_gradient_draw(void *data, void *context, void *surface __UNUSED__, void *gradient, 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);
|
2006-09-30 03:18:37 -07:00
|
|
|
re->win->gl_context->dc = context;
|
2009-12-30 03:35:40 -08:00
|
|
|
{
|
|
|
|
Evas_GL_Image *gim;
|
|
|
|
RGBA_Image *im;
|
|
|
|
RGBA_Draw_Context *dc = context;
|
|
|
|
int op = dc->render_op, cuse = dc->clip.use;
|
|
|
|
|
|
|
|
im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
|
|
|
|
im = (RGBA_Image *)evas_cache_image_size_set(&im->cache_entry, w, h);
|
|
|
|
|
|
|
|
dc->render_op = _EVAS_RENDER_FILL;
|
|
|
|
dc->clip.use = 0;
|
|
|
|
|
|
|
|
// draw to buf, copy to tex, draw tex
|
|
|
|
evas_common_gradient_draw(im, dc, 0, 0, w, h, gradient);
|
|
|
|
|
|
|
|
gim = evas_gl_common_image_new_from_data(re->win->gl_context, w, h,
|
|
|
|
im->image.data, 1,
|
|
|
|
EVAS_COLORSPACE_ARGB8888);
|
|
|
|
dc->render_op = op;
|
|
|
|
dc->clip.use = cuse;
|
|
|
|
evas_gl_common_image_draw(re->win->gl_context, gim, 0, 0, w, h, x, y, w, h, 0);
|
|
|
|
evas_cache_image_drop(&im->cache_entry);
|
|
|
|
evas_gl_common_image_free(gim);
|
|
|
|
}
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2006-12-17 07:48:52 -08:00
|
|
|
static int
|
|
|
|
eng_image_alpha_get(void *data, void *image)
|
|
|
|
{
|
2009-10-12 08:22:38 -07:00
|
|
|
// Render_Engine *re;
|
2006-12-17 07:48:52 -08:00
|
|
|
Evas_GL_Image *im;
|
|
|
|
|
2009-10-12 08:22:38 -07:00
|
|
|
// re = (Render_Engine *)data;
|
2006-12-17 08:46:30 -08:00
|
|
|
if (!image) return 1;
|
2006-12-17 07:48:52 -08:00
|
|
|
im = image;
|
2010-01-21 04:43:53 -08:00
|
|
|
return im->alpha;
|
2006-12-17 07:48:52 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
eng_image_colorspace_get(void *data, void *image)
|
|
|
|
{
|
2009-10-12 08:22:38 -07:00
|
|
|
// Render_Engine *re;
|
2006-12-17 07:48:52 -08:00
|
|
|
Evas_GL_Image *im;
|
2009-02-21 00:19:58 -08:00
|
|
|
|
2009-10-12 08:22:38 -07:00
|
|
|
// re = (Render_Engine *)data;
|
2006-12-17 08:46:30 -08:00
|
|
|
if (!image) return EVAS_COLORSPACE_ARGB8888;
|
2006-12-17 07:48:52 -08:00
|
|
|
im = image;
|
|
|
|
return im->cs.space;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
|
|
|
eng_image_alpha_set(void *data, void *image, int has_alpha)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
Evas_GL_Image *im;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2006-12-19 06:12:40 -08:00
|
|
|
if (!image) return NULL;
|
2006-12-17 07:48:52 -08:00
|
|
|
im = image;
|
2010-01-21 01:42:26 -08:00
|
|
|
if (im->native.data)
|
|
|
|
{
|
|
|
|
im->alpha = has_alpha;
|
|
|
|
return image;
|
|
|
|
}
|
2010-01-21 04:43:53 -08:00
|
|
|
eng_window_use(re->win);
|
2006-12-17 07:48:52 -08:00
|
|
|
/* FIXME: can move to gl_common */
|
|
|
|
if (im->cs.space != EVAS_COLORSPACE_ARGB8888) return im;
|
2008-06-03 02:09:39 -07:00
|
|
|
if ((has_alpha) && (im->im->cache_entry.flags.alpha)) return image;
|
|
|
|
else if ((!has_alpha) && (!im->im->cache_entry.flags.alpha)) return image;
|
2006-12-17 07:48:52 -08:00
|
|
|
if (im->references > 1)
|
2009-10-09 05:10:27 -07:00
|
|
|
{
|
|
|
|
Evas_GL_Image *im_new;
|
|
|
|
|
|
|
|
im_new = evas_gl_common_image_new_from_copied_data(im->gc, im->im->cache_entry.w, im->im->cache_entry.h, im->im->image.data,
|
|
|
|
eng_image_alpha_get(data, image),
|
|
|
|
eng_image_colorspace_get(data, image));
|
|
|
|
if (!im_new) return im;
|
|
|
|
evas_gl_common_image_free(im);
|
|
|
|
im = im_new;
|
2006-12-17 07:48:52 -08:00
|
|
|
}
|
|
|
|
else
|
2009-12-19 22:23:13 -08:00
|
|
|
evas_gl_common_image_dirty(im, 0, 0, 0, 0);
|
2008-06-03 02:09:39 -07:00
|
|
|
im->im->cache_entry.flags.alpha = has_alpha ? 1 : 0;
|
2006-12-17 07:48:52 -08:00
|
|
|
return image;
|
|
|
|
}
|
|
|
|
|
2008-11-04 01:19:35 -08:00
|
|
|
static void *
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_image_border_set(void *data, void *image, int l __UNUSED__, int r __UNUSED__, int t __UNUSED__, int b __UNUSED__)
|
2008-11-04 01:19:35 -08:00
|
|
|
{
|
2009-10-12 08:22:38 -07:00
|
|
|
// Render_Engine *re;
|
|
|
|
//
|
|
|
|
// re = (Render_Engine *)data;
|
2008-11-04 01:19:35 -08:00
|
|
|
return image;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_image_border_get(void *data, void *image __UNUSED__, int *l __UNUSED__, int *r __UNUSED__, int *t __UNUSED__, int *b __UNUSED__)
|
2008-11-04 01:19:35 -08:00
|
|
|
{
|
2009-10-12 08:22:38 -07:00
|
|
|
// Render_Engine *re;
|
|
|
|
//
|
|
|
|
// re = (Render_Engine *)data;
|
2008-11-04 01:19:35 -08:00
|
|
|
}
|
|
|
|
|
2006-12-17 07:48:52 -08:00
|
|
|
static char *
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_image_comment_get(void *data, void *image, char *key __UNUSED__)
|
2006-12-17 07:48:52 -08:00
|
|
|
{
|
2009-10-12 08:22:38 -07:00
|
|
|
// Render_Engine *re;
|
2006-12-17 07:48:52 -08:00
|
|
|
Evas_GL_Image *im;
|
|
|
|
|
2009-10-12 08:22:38 -07:00
|
|
|
// re = (Render_Engine *)data;
|
2006-12-19 06:12:40 -08:00
|
|
|
if (!image) return NULL;
|
2006-12-17 07:48:52 -08:00
|
|
|
im = image;
|
2010-01-21 04:43:53 -08:00
|
|
|
if (!im->im) return NULL;
|
2006-12-17 07:48:52 -08:00
|
|
|
return im->im->info.comment;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
|
|
|
eng_image_format_get(void *data, void *image)
|
|
|
|
{
|
2009-10-12 08:22:38 -07:00
|
|
|
// Render_Engine *re;
|
2006-12-17 07:48:52 -08:00
|
|
|
Evas_GL_Image *im;
|
|
|
|
|
2009-10-12 08:22:38 -07:00
|
|
|
// re = (Render_Engine *)data;
|
2006-12-17 07:48:52 -08:00
|
|
|
im = image;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
eng_image_colorspace_set(void *data, void *image, int cspace)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
Evas_GL_Image *im;
|
2009-02-21 00:19:58 -08:00
|
|
|
|
2006-12-17 07:48:52 -08:00
|
|
|
re = (Render_Engine *)data;
|
2006-12-19 06:12:40 -08:00
|
|
|
if (!image) return;
|
2006-12-17 07:48:52 -08:00
|
|
|
im = image;
|
2010-01-21 01:42:26 -08:00
|
|
|
if (im->native.data) return;
|
2006-12-17 07:48:52 -08:00
|
|
|
/* FIXME: can move to gl_common */
|
|
|
|
if (im->cs.space == cspace) return;
|
2009-10-09 05:10:27 -07:00
|
|
|
eng_window_use(re->win);
|
2008-04-11 17:32:30 -07:00
|
|
|
evas_cache_image_colorspace(&im->im->cache_entry, cspace);
|
2006-12-17 07:48:52 -08:00
|
|
|
switch (cspace)
|
|
|
|
{
|
|
|
|
case EVAS_COLORSPACE_ARGB8888:
|
|
|
|
if (im->cs.data)
|
|
|
|
{
|
|
|
|
if (!im->cs.no_free) free(im->cs.data);
|
|
|
|
im->cs.data = NULL;
|
|
|
|
im->cs.no_free = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EVAS_COLORSPACE_YCBCR422P601_PL:
|
|
|
|
case EVAS_COLORSPACE_YCBCR422P709_PL:
|
2009-10-09 05:10:27 -07:00
|
|
|
if (im->tex) evas_gl_common_texture_free(im->tex);
|
|
|
|
im->tex = NULL;
|
2006-12-17 07:48:52 -08:00
|
|
|
if (im->cs.data)
|
|
|
|
{
|
|
|
|
if (!im->cs.no_free) free(im->cs.data);
|
|
|
|
}
|
2008-04-11 17:32:30 -07:00
|
|
|
im->cs.data = calloc(1, im->im->cache_entry.h * sizeof(unsigned char *) * 2);
|
2006-12-17 07:48:52 -08:00
|
|
|
im->cs.no_free = 0;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
abort();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
im->cs.space = cspace;
|
|
|
|
}
|
|
|
|
|
2010-01-21 00:44:11 -08:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
//
|
|
|
|
typedef struct _Native Native;
|
|
|
|
|
|
|
|
struct _Native
|
|
|
|
{
|
|
|
|
Evas_Native_Surface ns;
|
|
|
|
Pixmap pixmap;
|
|
|
|
Visual *visual;
|
|
|
|
|
|
|
|
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
|
2010-01-21 01:42:26 -08:00
|
|
|
EGLSurface egl_surface;
|
2010-01-21 00:44:11 -08:00
|
|
|
#else
|
|
|
|
# ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT
|
|
|
|
GLXFBConfig fbc;
|
|
|
|
GLXPixmap glx_pixmap;
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
_native_bind_cb(void *data, void *image)
|
|
|
|
{
|
|
|
|
Render_Engine *re = data;
|
|
|
|
Evas_GL_Image *im = image;
|
|
|
|
Native *n = im->native.data;
|
|
|
|
|
|
|
|
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
|
2010-01-21 01:42:26 -08:00
|
|
|
if (glsym_eglBindTexImage)
|
|
|
|
{
|
|
|
|
glsym_eglBindTexImage(re->win->egl_disp, n->egl_surface, EGL_SINGLE_BUFFER);
|
|
|
|
}
|
2010-01-21 00:44:11 -08:00
|
|
|
#else
|
|
|
|
# ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT
|
|
|
|
if (glsym_glXBindTexImage)
|
|
|
|
{
|
|
|
|
const int pixmap_att[] =
|
|
|
|
{
|
|
|
|
GLX_TEXTURE_TARGET_EXT,
|
|
|
|
GLX_TEXTURE_2D_EXT,
|
|
|
|
GLX_TEXTURE_FORMAT_EXT,
|
|
|
|
GLX_TEXTURE_FORMAT_RGBA_EXT,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
n->glx_pixmap = glXCreatePixmap(re->win->disp, n->fbc,
|
|
|
|
n->pixmap, pixmap_att);
|
|
|
|
glsym_glXBindTexImage(re->win->disp, n->glx_pixmap,
|
|
|
|
GLX_FRONT_LEFT_EXT, NULL);
|
|
|
|
}
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_native_unbind_cb(void *data, void *image)
|
|
|
|
{
|
|
|
|
Render_Engine *re = data;
|
|
|
|
Evas_GL_Image *im = image;
|
|
|
|
Native *n = im->native.data;
|
|
|
|
|
|
|
|
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
|
2010-01-21 01:42:26 -08:00
|
|
|
if (glsym_eglReleaseTexImage)
|
|
|
|
{
|
|
|
|
glsym_eglReleaseTexImage(re->win->egl_disp, n->egl_surface, EGL_SINGLE_BUFFER);
|
|
|
|
}
|
2010-01-21 00:44:11 -08:00
|
|
|
#else
|
|
|
|
# ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT
|
|
|
|
if (glsym_glXReleaseTexImage)
|
|
|
|
{
|
|
|
|
glsym_glXReleaseTexImage(re->win->disp, n->glx_pixmap,
|
|
|
|
GLX_FRONT_LEFT_EXT);
|
|
|
|
glXDestroyPixmap(re->win->disp, n->glx_pixmap);
|
|
|
|
n->glx_pixmap = 0;
|
|
|
|
}
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2006-12-17 07:48:52 -08:00
|
|
|
static void
|
2010-01-21 00:44:11 -08:00
|
|
|
_native_free_cb(void *data, void *image)
|
2006-12-17 07:48:52 -08:00
|
|
|
{
|
2010-01-21 00:44:11 -08:00
|
|
|
Render_Engine *re = data;
|
|
|
|
Evas_GL_Image *im = image;
|
|
|
|
Native *n = im->native.data;
|
|
|
|
|
|
|
|
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
|
2010-01-21 01:42:26 -08:00
|
|
|
if (n->egl_surface)
|
2010-01-21 00:44:11 -08:00
|
|
|
{
|
2010-01-21 01:42:26 -08:00
|
|
|
eglDestroySurface(re->win->egl_disp, n->egl_surface);
|
|
|
|
n->egl_surface = 0;
|
2010-01-21 00:44:11 -08:00
|
|
|
}
|
|
|
|
#else
|
|
|
|
# ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT
|
|
|
|
if (n->glx_pixmap)
|
|
|
|
{
|
|
|
|
glsym_glXReleaseTexImage(re->win->disp, n->glx_pixmap,
|
|
|
|
GLX_FRONT_LEFT_EXT);
|
|
|
|
glXDestroyPixmap(re->win->disp, n->glx_pixmap);
|
|
|
|
n->glx_pixmap = 0;
|
|
|
|
}
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
im->native.data = NULL;
|
|
|
|
im->native.func.data = NULL;
|
|
|
|
im->native.func.bind = NULL;
|
|
|
|
im->native.func.unbind = NULL;
|
|
|
|
im->native.func.free = NULL;
|
|
|
|
free(n);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
eng_image_native_set(void *data, void *image, void *native)
|
|
|
|
{
|
|
|
|
Render_Engine *re = (Render_Engine *)data;
|
|
|
|
Evas_Native_Surface *ns = native;
|
|
|
|
Evas_GL_Image *im = image;
|
|
|
|
Visual *vis = NULL;
|
|
|
|
Pixmap pm = 0;
|
|
|
|
|
|
|
|
if (ns)
|
|
|
|
{
|
|
|
|
vis = ns->data.x11.visual;
|
|
|
|
pm = ns->data.x11.pixmap;
|
|
|
|
if (im->native.data)
|
|
|
|
{
|
|
|
|
Evas_Native_Surface *n = im->native.data;
|
|
|
|
if ((n->data.x11.visual == vis) && (n->data.x11.pixmap == pm))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((!ns) && (!im->native.data)) return;
|
|
|
|
if (!im) return;
|
|
|
|
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
|
2010-01-21 01:42:26 -08:00
|
|
|
if (im->native.data)
|
2010-01-21 00:44:11 -08:00
|
|
|
{
|
2010-01-21 01:42:26 -08:00
|
|
|
if (im->native.func.free)
|
|
|
|
im->native.func.free(im->native.func.data, im);
|
|
|
|
evas_gl_common_image_native_disable(im);
|
|
|
|
}
|
|
|
|
if (native)
|
|
|
|
{
|
|
|
|
Native *n;
|
|
|
|
|
|
|
|
n = calloc(1, sizeof(Native));
|
|
|
|
if (n)
|
|
|
|
{
|
|
|
|
EGLConfig egl_config;
|
|
|
|
int config_attrs[20];
|
|
|
|
int num_config, i;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
config_attrs[i++] = EGL_RED_SIZE;
|
|
|
|
config_attrs[i++] = 8;
|
|
|
|
config_attrs[i++] = EGL_GREEN_SIZE;
|
|
|
|
config_attrs[i++] = 8;
|
|
|
|
config_attrs[i++] = EGL_BLUE_SIZE;
|
|
|
|
config_attrs[i++] = 8;
|
|
|
|
config_attrs[i++] = EGL_ALPHA_SIZE;
|
|
|
|
config_attrs[i++] = 8;
|
|
|
|
config_attrs[i++] = EGL_DEPTH_SIZE;
|
|
|
|
config_attrs[i++] = 32;
|
|
|
|
config_attrs[i++] = EGL_RENDERABLE_TYPE;
|
|
|
|
config_attrs[i++] = EGL_OPENGL_ES2_BIT;
|
|
|
|
config_attrs[i++] = EGL_SURFACE_TYPE;
|
|
|
|
config_attrs[i++] = EGL_PIXMAP_BIT;
|
|
|
|
config_attrs[i++] = EGL_NONE;
|
|
|
|
|
|
|
|
eglChooseConfig(re->win->egl_disp, config_attrs,
|
|
|
|
&egl_config, 1, &num_config);
|
|
|
|
n->egl_surface = eglCreatePixmapSurface(re->win->egl_disp,
|
2010-01-21 21:55:46 -08:00
|
|
|
egl_config, pm,
|
2010-01-21 01:42:26 -08:00
|
|
|
NULL);
|
|
|
|
evas_gl_common_image_native_enable(im);
|
|
|
|
n->pixmap = pm;
|
|
|
|
n->visual = vis;
|
|
|
|
im->native.yinvert = 1;
|
|
|
|
im->native.data = n;
|
|
|
|
im->native.func.data = re;
|
|
|
|
im->native.func.bind = _native_bind_cb;
|
|
|
|
im->native.func.unbind = _native_unbind_cb;
|
|
|
|
im->native.func.free = _native_free_cb;
|
|
|
|
}
|
|
|
|
}
|
2010-01-21 00:44:11 -08:00
|
|
|
#else
|
|
|
|
# ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT
|
|
|
|
if (im->native.data)
|
|
|
|
{
|
|
|
|
if (im->native.func.free)
|
|
|
|
im->native.func.free(im->native.func.data, im);
|
|
|
|
evas_gl_common_image_native_disable(im);
|
|
|
|
}
|
|
|
|
if (native)
|
|
|
|
{
|
|
|
|
VisualID vid;
|
|
|
|
GLXFBConfig *fbc;
|
|
|
|
int i, num;
|
|
|
|
int yinvert = 0;
|
|
|
|
|
|
|
|
vid = XVisualIDFromVisual(vis);
|
|
|
|
fbc = glXGetFBConfigs(re->win->disp,
|
|
|
|
0 /* FIXME: screen 0 assumption */,
|
|
|
|
&num);
|
|
|
|
if (fbc)
|
|
|
|
{
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
{
|
|
|
|
XVisualInfo *vi;
|
|
|
|
int val;
|
|
|
|
|
|
|
|
vi = glXGetVisualFromFBConfig(re->win->disp, fbc[i]);
|
|
|
|
if ((!vi) || (vi->visualid != vid))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
glXGetFBConfigAttrib(re->win->disp, fbc[i],
|
|
|
|
GLX_DRAWABLE_TYPE, &val);
|
|
|
|
if (!(val & GLX_PIXMAP_BIT)) continue;
|
|
|
|
|
|
|
|
glXGetFBConfigAttrib(re->win->disp, fbc[i],
|
|
|
|
GLX_BIND_TO_TEXTURE_TARGETS_EXT, &val);
|
|
|
|
if (!(val & GLX_TEXTURE_2D_BIT_EXT)) continue;
|
|
|
|
|
|
|
|
glXGetFBConfigAttrib(re->win->disp, fbc[i],
|
|
|
|
GLX_BIND_TO_TEXTURE_RGBA_EXT, &val);
|
|
|
|
if (!val)
|
|
|
|
{
|
|
|
|
glXGetFBConfigAttrib(re->win->disp, fbc[i],
|
|
|
|
GLX_BIND_TO_TEXTURE_RGB_EXT, &val);
|
|
|
|
if (!val) continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
glXGetFBConfigAttrib(re->win->disp, fbc[i],
|
|
|
|
GLX_Y_INVERTED_EXT, &val);
|
|
|
|
if (val) yinvert = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (i == num)
|
|
|
|
{
|
|
|
|
printf(" err \n");
|
|
|
|
// error
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Native *n;
|
|
|
|
|
|
|
|
n = calloc(1, sizeof(Native));
|
|
|
|
if (n)
|
|
|
|
{
|
|
|
|
evas_gl_common_image_native_enable(im);
|
|
|
|
memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface));
|
|
|
|
n->pixmap = pm;
|
|
|
|
n->visual = vis;
|
|
|
|
memcpy(&(n->fbc), fbc, sizeof(GLXFBConfig));
|
|
|
|
n->fbc = *fbc;
|
|
|
|
im->native.yinvert = yinvert;
|
|
|
|
im->native.data = n;
|
|
|
|
im->native.func.data = re;
|
|
|
|
im->native.func.bind = _native_bind_cb;
|
|
|
|
im->native.func.unbind = _native_unbind_cb;
|
|
|
|
im->native.func.free = _native_free_cb;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
# endif
|
|
|
|
#endif
|
2006-12-17 07:48:52 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2010-01-21 00:44:11 -08:00
|
|
|
eng_image_native_get(void *data, void *image)
|
2006-12-17 07:48:52 -08:00
|
|
|
{
|
2010-01-21 00:44:11 -08:00
|
|
|
Render_Engine *re = (Render_Engine *)data;
|
|
|
|
Evas_GL_Image *im = image;
|
|
|
|
Native *n;
|
|
|
|
if (!im) return NULL;
|
|
|
|
n = im->native.data;
|
|
|
|
if (!n) return NULL;
|
|
|
|
return &(n->ns);
|
2006-12-17 07:48:52 -08:00
|
|
|
}
|
|
|
|
|
2010-01-21 00:44:11 -08:00
|
|
|
//
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
static void *
|
2007-03-04 08:19:32 -08:00
|
|
|
eng_image_load(void *data, const char *file, const char *key, int *error, Evas_Image_Load_Opts *lo)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2009-12-22 15:11:57 -08:00
|
|
|
*error = EVAS_LOAD_ERROR_NONE;
|
2006-03-06 18:44:16 -08:00
|
|
|
eng_window_use(re->win);
|
2009-12-22 15:11:57 -08:00
|
|
|
return evas_gl_common_image_load(re->win->gl_context, file, key, lo, error);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2006-12-17 07:48:52 -08:00
|
|
|
eng_image_new_from_data(void *data, int w, int h, DATA32 *image_data, int alpha, int cspace)
|
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);
|
2006-12-17 07:48:52 -08:00
|
|
|
return evas_gl_common_image_new_from_data(re->win->gl_context, w, h, image_data, alpha, cspace);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2006-12-17 07:48:52 -08:00
|
|
|
eng_image_new_from_copied_data(void *data, int w, int h, DATA32 *image_data, int alpha, int cspace)
|
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);
|
2006-12-17 07:48:52 -08:00
|
|
|
return evas_gl_common_image_new_from_copied_data(re->win->gl_context, w, h, image_data, alpha, cspace);
|
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-12-19 06:12:40 -08:00
|
|
|
if (!image) return;
|
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
|
|
|
{
|
2009-10-12 08:22:38 -07:00
|
|
|
// Render_Engine *re;
|
|
|
|
//
|
|
|
|
// re = (Render_Engine *)data;
|
2006-12-19 06:12:40 -08:00
|
|
|
if (!image)
|
|
|
|
{
|
|
|
|
*w = 0;
|
|
|
|
*h = 0;
|
|
|
|
return;
|
|
|
|
}
|
2010-01-21 01:42:26 -08:00
|
|
|
if (w) *w = ((Evas_GL_Image *)image)->w;
|
|
|
|
if (h) *h = ((Evas_GL_Image *)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;
|
2010-01-21 01:42:26 -08:00
|
|
|
Evas_GL_Image *im = image;
|
|
|
|
Evas_GL_Image *im_old;
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2010-01-21 01:42:26 -08:00
|
|
|
if (!im) return NULL;
|
|
|
|
if (im->native.data)
|
|
|
|
{
|
|
|
|
im->w = w;
|
|
|
|
im->h = h;
|
|
|
|
return image;
|
|
|
|
}
|
2006-12-19 06:12:40 -08:00
|
|
|
eng_window_use(re->win);
|
2003-09-04 00:40:34 -07:00
|
|
|
im_old = image;
|
2007-06-02 08:30:59 -07:00
|
|
|
if ((eng_image_colorspace_get(data, image) == EVAS_COLORSPACE_YCBCR422P601_PL) ||
|
|
|
|
(eng_image_colorspace_get(data, image) == EVAS_COLORSPACE_YCBCR422P709_PL))
|
|
|
|
w &= ~0x1;
|
2008-04-11 17:32:30 -07:00
|
|
|
if ((im_old) && (im_old->im->cache_entry.w == w) && (im_old->im->cache_entry.h == h))
|
2003-09-04 22:37:14 -07:00
|
|
|
return image;
|
2003-09-04 00:40:34 -07:00
|
|
|
if (im_old)
|
|
|
|
{
|
2009-10-09 05:10:27 -07:00
|
|
|
im = evas_gl_common_image_new(re->win->gl_context, w, h,
|
|
|
|
eng_image_alpha_get(data, image),
|
|
|
|
eng_image_colorspace_get(data, image));
|
2009-02-21 00:19:58 -08:00
|
|
|
/*
|
2003-09-04 00:40:34 -07:00
|
|
|
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();
|
|
|
|
}
|
2006-12-17 07:48:52 -08:00
|
|
|
*/
|
2009-10-09 05:10:27 -07:00
|
|
|
evas_gl_common_image_free(im_old);
|
2003-09-04 00:40:34 -07:00
|
|
|
}
|
2006-12-17 07:48:52 -08:00
|
|
|
else
|
|
|
|
im = evas_gl_common_image_new(re->win->gl_context, w, h, 1, EVAS_COLORSPACE_ARGB8888);
|
2003-09-04 00:40:34 -07:00
|
|
|
return im;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2009-12-19 22:23:13 -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;
|
2010-01-21 01:42:26 -08:00
|
|
|
Evas_GL_Image *im = image;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2006-12-19 06:12:40 -08:00
|
|
|
if (!image) return NULL;
|
2010-01-21 01:42:26 -08:00
|
|
|
if (im->native.data) return image;
|
2010-01-21 04:43:53 -08:00
|
|
|
eng_window_use(re->win);
|
2009-12-19 22:23:13 -08:00
|
|
|
evas_gl_common_image_dirty(image, x, y, w, h);
|
2003-09-04 00:40:34 -07:00
|
|
|
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;
|
2006-12-19 06:12:40 -08:00
|
|
|
if (!image)
|
|
|
|
{
|
|
|
|
*image_data = NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
2003-09-04 00:40:34 -07:00
|
|
|
im = image;
|
2010-01-21 01:42:26 -08:00
|
|
|
if (im->native.data)
|
|
|
|
{
|
|
|
|
*image_data = NULL;
|
|
|
|
return im;
|
|
|
|
}
|
2006-03-06 18:44:16 -08:00
|
|
|
eng_window_use(re->win);
|
2008-04-11 17:32:30 -07:00
|
|
|
evas_cache_image_load_data(&im->im->cache_entry);
|
2006-12-17 07:48:52 -08:00
|
|
|
switch (im->cs.space)
|
2003-09-04 00:40:34 -07:00
|
|
|
{
|
2006-12-17 07:48:52 -08:00
|
|
|
case EVAS_COLORSPACE_ARGB8888:
|
|
|
|
if (to_write)
|
2003-09-04 00:40:34 -07:00
|
|
|
{
|
2006-12-17 07:48:52 -08:00
|
|
|
if (im->references > 1)
|
2003-09-04 22:37:14 -07:00
|
|
|
{
|
2006-12-17 07:48:52 -08:00
|
|
|
Evas_GL_Image *im_new;
|
2009-02-21 00:19:58 -08:00
|
|
|
|
2009-10-09 05:10:27 -07:00
|
|
|
im_new = evas_gl_common_image_new_from_copied_data(im->gc, im->im->cache_entry.w, im->im->cache_entry.h, im->im->image.data,
|
|
|
|
eng_image_alpha_get(data, image),
|
|
|
|
eng_image_colorspace_get(data, image));
|
|
|
|
if (!im_new)
|
|
|
|
{
|
|
|
|
*image_data = NULL;
|
|
|
|
return im;
|
|
|
|
}
|
|
|
|
evas_gl_common_image_free(im);
|
|
|
|
im = im_new;
|
2003-09-04 22:37:14 -07:00
|
|
|
}
|
2009-10-09 05:10:27 -07:00
|
|
|
else
|
2009-12-19 22:23:13 -08:00
|
|
|
evas_gl_common_image_dirty(im, 0, 0, 0, 0);
|
2003-09-04 00:40:34 -07:00
|
|
|
}
|
2008-04-11 17:32:30 -07:00
|
|
|
*image_data = im->im->image.data;
|
2006-12-17 07:48:52 -08:00
|
|
|
break;
|
|
|
|
case EVAS_COLORSPACE_YCBCR422P601_PL:
|
|
|
|
case EVAS_COLORSPACE_YCBCR422P709_PL:
|
|
|
|
*image_data = im->cs.data;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
abort();
|
|
|
|
break;
|
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;
|
2006-12-17 08:46:30 -08:00
|
|
|
Evas_GL_Image *im, *im2;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2006-12-19 06:12:40 -08:00
|
|
|
if (!image) return NULL;
|
2003-09-04 00:40:34 -07:00
|
|
|
im = image;
|
2010-01-21 01:42:26 -08:00
|
|
|
if (im->native.data) return image;
|
2006-03-06 18:44:16 -08:00
|
|
|
eng_window_use(re->win);
|
2006-12-17 07:48:52 -08:00
|
|
|
switch (im->cs.space)
|
2003-09-04 00:40:34 -07:00
|
|
|
{
|
2006-12-17 07:48:52 -08:00
|
|
|
case EVAS_COLORSPACE_ARGB8888:
|
2008-04-11 17:32:30 -07:00
|
|
|
if (image_data != im->im->image.data)
|
2006-12-17 07:48:52 -08:00
|
|
|
{
|
|
|
|
int w, h;
|
2009-02-21 00:19:58 -08:00
|
|
|
|
2008-04-11 17:32:30 -07:00
|
|
|
w = im->im->cache_entry.w;
|
|
|
|
h = im->im->cache_entry.h;
|
2006-12-17 08:46:30 -08:00
|
|
|
im2 = eng_image_new_from_data(data, w, h, image_data,
|
|
|
|
eng_image_alpha_get(data, image),
|
|
|
|
eng_image_colorspace_get(data, image));
|
2009-10-09 05:10:27 -07:00
|
|
|
if (!im2) return im;
|
|
|
|
evas_gl_common_image_free(im);
|
|
|
|
im = im2;
|
2006-12-17 07:48:52 -08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EVAS_COLORSPACE_YCBCR422P601_PL:
|
|
|
|
case EVAS_COLORSPACE_YCBCR422P709_PL:
|
|
|
|
if (image_data != im->cs.data)
|
|
|
|
{
|
|
|
|
if (im->cs.data)
|
|
|
|
{
|
|
|
|
if (!im->cs.no_free) free(im->cs.data);
|
|
|
|
}
|
|
|
|
im->cs.data = image_data;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
abort();
|
|
|
|
break;
|
2003-09-04 00:40:34 -07:00
|
|
|
}
|
|
|
|
/* hmmm - but if we wrote... why bother? */
|
2009-12-19 22:23:13 -08:00
|
|
|
evas_gl_common_image_dirty(im, 0, 0, 0, 0);
|
2003-09-04 00:40:34 -07:00
|
|
|
return im;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2008-09-16 07:52:57 -07:00
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_image_data_preload_request(void *data __UNUSED__, void *image, const void *target)
|
2008-09-16 07:52:57 -07:00
|
|
|
{
|
|
|
|
Evas_GL_Image *gim = image;
|
|
|
|
RGBA_Image *im;
|
|
|
|
|
2010-01-21 01:42:26 -08:00
|
|
|
if (!gim) return;
|
|
|
|
if (gim->native.data) return;
|
|
|
|
im = (RGBA_Image *)gim->im;
|
|
|
|
if (!im) return;
|
2008-09-16 07:52:57 -07:00
|
|
|
evas_cache_image_preload_data(&im->cache_entry, target);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_image_data_preload_cancel(void *data __UNUSED__, void *image, const void *target)
|
2008-09-16 07:52:57 -07:00
|
|
|
{
|
|
|
|
Evas_GL_Image *gim = image;
|
|
|
|
RGBA_Image *im;
|
|
|
|
|
2010-01-21 01:42:26 -08:00
|
|
|
if (!gim) return;
|
|
|
|
if (gim->native.data) return;
|
|
|
|
im = (RGBA_Image *)gim->im;
|
|
|
|
if (!im) return;
|
2009-01-20 06:56:37 -08:00
|
|
|
evas_cache_image_preload_cancel(&im->cache_entry, target);
|
2008-09-16 07:52:57 -07:00
|
|
|
}
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
static void
|
2009-11-12 23:22:31 -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-12-19 06:12:40 -08:00
|
|
|
if (!image) return;
|
2006-03-06 18:44:16 -08:00
|
|
|
eng_window_use(re->win);
|
2009-11-12 23:22:31 -08:00
|
|
|
evas_gl_common_context_target_surface_set(re->win->gl_context, surface);
|
2006-09-30 03:18:37 -07:00
|
|
|
re->win->gl_context->dc = context;
|
|
|
|
evas_gl_common_image_draw(re->win->gl_context, image,
|
2009-10-09 05:10:27 -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
|
|
|
}
|
|
|
|
|
2009-05-07 06:29:56 -07:00
|
|
|
static void
|
|
|
|
eng_image_scale_hint_set(void *data __UNUSED__, void *image, int hint)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-11-06 03:32:23 -08:00
|
|
|
static void
|
|
|
|
eng_image_map4_draw(void *data __UNUSED__, void *context, void *surface, void *image, RGBA_Map_Point *p, int smooth, int level)
|
|
|
|
{
|
2009-11-11 03:39:25 -08:00
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2009-11-12 23:22:31 -08:00
|
|
|
eng_window_use(re->win);
|
|
|
|
evas_gl_common_context_target_surface_set(re->win->gl_context, surface);
|
|
|
|
re->win->gl_context->dc = context;
|
2009-11-11 03:39:25 -08:00
|
|
|
evas_gl_common_image_map4_draw(re->win->gl_context, image, p, smooth, level);
|
2009-11-06 03:32:23 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
|
|
|
eng_image_map_surface_new(void *data __UNUSED__, int w, int h, int alpha)
|
|
|
|
{
|
2009-11-12 23:22:31 -08:00
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
return evas_gl_common_image_surface_new(re->win->gl_context, w, h, alpha);
|
2009-11-06 03:32:23 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
eng_image_map_surface_free(void *data __UNUSED__, void *surface)
|
|
|
|
{
|
2009-11-12 23:22:31 -08:00
|
|
|
evas_gl_common_image_free(surface);
|
2009-11-06 03:32:23 -08:00
|
|
|
}
|
|
|
|
|
2009-05-07 06:29:56 -07:00
|
|
|
static int
|
|
|
|
eng_image_scale_hint_get(void *data __UNUSED__, void *image)
|
|
|
|
{
|
|
|
|
return EVAS_IMAGE_SCALE_HINT_NONE;
|
|
|
|
}
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
static void
|
2009-11-12 23:22:31 -08:00
|
|
|
eng_font_draw(void *data, void *context, void *surface, void *font, int x, int y, int w __UNUSED__, int h __UNUSED__, int ow __UNUSED__, int oh __UNUSED__, const char *text)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2009-10-09 05:10:27 -07:00
|
|
|
eng_window_use(re->win);
|
2009-11-12 23:22:31 -08:00
|
|
|
evas_gl_common_context_target_surface_set(re->win->gl_context, surface);
|
|
|
|
re->win->gl_context->dc = context;
|
2003-09-04 00:40:34 -07:00
|
|
|
{
|
2009-10-09 05:10:27 -07:00
|
|
|
// FIXME: put im into context so we can free it
|
2003-09-10 07:33:39 -07:00
|
|
|
static RGBA_Image *im = NULL;
|
2009-10-09 05:10:27 -07:00
|
|
|
|
|
|
|
if (!im)
|
|
|
|
im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
|
|
|
|
im->cache_entry.w = re->win->w;
|
|
|
|
im->cache_entry.h = re->win->h;
|
|
|
|
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-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
|
|
|
}
|
|
|
|
|
2009-08-14 10:11:08 -07:00
|
|
|
static Eina_Bool
|
|
|
|
eng_canvas_alpha_get(void *data __UNUSED__, void *info __UNUSED__)
|
|
|
|
{
|
2009-10-09 05:10:27 -07:00
|
|
|
// FIXME: support ARGB gl targets!!!
|
2009-08-14 10:11:08 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2009-06-16 06:01:36 -07:00
|
|
|
static int
|
2006-09-06 00:28:46 -07:00
|
|
|
module_open(Evas_Module *em)
|
2006-01-14 04:13:38 -08:00
|
|
|
{
|
|
|
|
if (!em) return 0;
|
2006-12-09 00:52:08 -08:00
|
|
|
/* get whatever engine module we inherit from */
|
|
|
|
if (!_evas_module_engine_inherit(&pfunc, "software_generic")) return 0;
|
2009-11-13 00:28:47 -08:00
|
|
|
if (_evas_engine_GL_X11_log_dom < 0)
|
|
|
|
_evas_engine_GL_X11_log_dom = eina_log_domain_register("EvasEngineGLX11", EVAS_DEFAULT_LOG_COLOR);
|
|
|
|
if (_evas_engine_GL_X11_log_dom < 0)
|
2009-10-22 08:22:22 -07:00
|
|
|
{
|
2009-11-13 00:28:47 -08:00
|
|
|
EINA_LOG_ERR("Impossible to create a log domain for GL X11 engine.\n");
|
|
|
|
return 0;
|
2009-10-22 08:22:22 -07:00
|
|
|
}
|
2006-12-09 00:52:08 -08:00
|
|
|
/* store it for later use */
|
|
|
|
func = pfunc;
|
|
|
|
/* now to override methods */
|
|
|
|
#define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
|
|
|
|
ORD(info);
|
|
|
|
ORD(info_free);
|
|
|
|
ORD(setup);
|
2009-08-14 10:11:08 -07:00
|
|
|
ORD(canvas_alpha_get);
|
2006-12-09 00:52:08 -08:00
|
|
|
ORD(output_free);
|
|
|
|
ORD(output_resize);
|
|
|
|
ORD(output_tile_size_set);
|
|
|
|
ORD(output_redraws_rect_add);
|
|
|
|
ORD(output_redraws_rect_del);
|
|
|
|
ORD(output_redraws_clear);
|
|
|
|
ORD(output_redraws_next_update_get);
|
|
|
|
ORD(output_redraws_next_update_push);
|
|
|
|
ORD(context_cutout_add);
|
|
|
|
ORD(context_cutout_clear);
|
|
|
|
ORD(output_flush);
|
2007-06-16 19:56:59 -07:00
|
|
|
ORD(output_idle_flush);
|
2006-12-09 00:52:08 -08:00
|
|
|
ORD(rectangle_draw);
|
|
|
|
ORD(line_draw);
|
|
|
|
ORD(polygon_point_add);
|
|
|
|
ORD(polygon_points_clear);
|
|
|
|
ORD(polygon_draw);
|
2008-08-25 22:45:04 -07:00
|
|
|
|
|
|
|
ORD(gradient2_color_np_stop_insert);
|
|
|
|
ORD(gradient2_clear);
|
2008-11-04 01:19:35 -08:00
|
|
|
ORD(gradient2_fill_transform_set);
|
|
|
|
ORD(gradient2_fill_spread_set);
|
2008-08-25 22:45:04 -07:00
|
|
|
ORD(gradient2_linear_new);
|
|
|
|
ORD(gradient2_linear_free);
|
2008-11-04 01:19:35 -08:00
|
|
|
ORD(gradient2_linear_fill_set);
|
2008-08-25 22:45:04 -07:00
|
|
|
ORD(gradient2_linear_is_opaque);
|
|
|
|
ORD(gradient2_linear_is_visible);
|
|
|
|
ORD(gradient2_linear_render_pre);
|
|
|
|
ORD(gradient2_linear_render_post);
|
|
|
|
ORD(gradient2_linear_draw);
|
|
|
|
ORD(gradient2_radial_new);
|
|
|
|
ORD(gradient2_radial_free);
|
2008-11-04 01:19:35 -08:00
|
|
|
ORD(gradient2_radial_fill_set);
|
2008-08-25 22:45:04 -07:00
|
|
|
ORD(gradient2_radial_is_opaque);
|
|
|
|
ORD(gradient2_radial_is_visible);
|
|
|
|
ORD(gradient2_radial_render_pre);
|
|
|
|
ORD(gradient2_radial_render_post);
|
|
|
|
ORD(gradient2_radial_draw);
|
|
|
|
|
2006-12-09 00:52:08 -08:00
|
|
|
ORD(gradient_new);
|
|
|
|
ORD(gradient_free);
|
|
|
|
ORD(gradient_color_stop_add);
|
|
|
|
ORD(gradient_alpha_stop_add);
|
|
|
|
ORD(gradient_color_data_set);
|
|
|
|
ORD(gradient_alpha_data_set);
|
|
|
|
ORD(gradient_clear);
|
|
|
|
ORD(gradient_fill_set);
|
|
|
|
ORD(gradient_fill_angle_set);
|
|
|
|
ORD(gradient_fill_spread_set);
|
|
|
|
ORD(gradient_angle_set);
|
|
|
|
ORD(gradient_offset_set);
|
|
|
|
ORD(gradient_direction_set);
|
|
|
|
ORD(gradient_type_set);
|
|
|
|
ORD(gradient_is_opaque);
|
|
|
|
ORD(gradient_is_visible);
|
|
|
|
ORD(gradient_render_pre);
|
|
|
|
ORD(gradient_render_post);
|
|
|
|
ORD(gradient_draw);
|
|
|
|
ORD(image_load);
|
|
|
|
ORD(image_new_from_data);
|
|
|
|
ORD(image_new_from_copied_data);
|
|
|
|
ORD(image_free);
|
|
|
|
ORD(image_size_get);
|
|
|
|
ORD(image_size_set);
|
|
|
|
ORD(image_dirty_region);
|
|
|
|
ORD(image_data_get);
|
|
|
|
ORD(image_data_put);
|
2008-09-16 07:52:57 -07:00
|
|
|
ORD(image_data_preload_request);
|
|
|
|
ORD(image_data_preload_cancel);
|
2006-12-09 00:52:08 -08:00
|
|
|
ORD(image_alpha_set);
|
|
|
|
ORD(image_alpha_get);
|
2008-11-04 01:19:35 -08:00
|
|
|
ORD(image_border_set);
|
|
|
|
ORD(image_border_get);
|
2006-12-09 00:52:08 -08:00
|
|
|
ORD(image_draw);
|
|
|
|
ORD(image_comment_get);
|
|
|
|
ORD(image_format_get);
|
|
|
|
ORD(image_colorspace_set);
|
|
|
|
ORD(image_colorspace_get);
|
|
|
|
ORD(image_native_set);
|
|
|
|
ORD(image_native_get);
|
|
|
|
ORD(font_draw);
|
2009-05-07 06:29:56 -07:00
|
|
|
|
|
|
|
ORD(image_scale_hint_set);
|
|
|
|
ORD(image_scale_hint_get);
|
|
|
|
|
2009-11-06 03:32:23 -08:00
|
|
|
ORD(image_map4_draw);
|
|
|
|
ORD(image_map_surface_new);
|
|
|
|
ORD(image_map_surface_free);
|
2009-10-28 01:59:01 -07:00
|
|
|
|
2006-12-09 00:52:08 -08:00
|
|
|
/* now advertise out own api */
|
|
|
|
em->functions = (void *)(&func);
|
2006-01-14 04:13:38 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2009-06-16 06:01:36 -07:00
|
|
|
static void
|
|
|
|
module_close(Evas_Module *em)
|
2006-01-14 04:13:38 -08:00
|
|
|
{
|
2009-10-22 08:22:22 -07:00
|
|
|
eina_log_domain_unregister(_evas_engine_GL_X11_log_dom);
|
2006-01-14 04:13:38 -08:00
|
|
|
}
|
|
|
|
|
2009-06-16 06:01:36 -07:00
|
|
|
static Evas_Module_Api evas_modapi =
|
2006-01-14 04:13:38 -08:00
|
|
|
{
|
|
|
|
EVAS_MODULE_API_VERSION,
|
2009-06-16 06:01:36 -07:00
|
|
|
"gl_x11",
|
|
|
|
"none",
|
|
|
|
{
|
|
|
|
module_open,
|
|
|
|
module_close
|
|
|
|
}
|
2006-01-14 04:13:38 -08:00
|
|
|
};
|
2009-06-16 06:01:36 -07:00
|
|
|
|
|
|
|
EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_ENGINE, engine, gl_x11);
|
|
|
|
|
|
|
|
#ifndef EVAS_STATIC_BUILD_GL_X11
|
|
|
|
EVAS_EINA_MODULE_DEFINE(engine, gl_x11);
|
|
|
|
#endif
|