summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-01-04 01:10:53 +0100
committerCedric BAIL <cedric@osg.samsung.com>2016-01-04 01:12:19 +0100
commit9eb6a8c340ebf6c527b4dfda9f43b0f2dea576f7 (patch)
treed6df5a48444febf3e417c8092bb9107a952b2a1f
parentaa94b79be1f7d6f1deb441f89ffa2cb756bdc317 (diff)
downloadefl-devs/cedric/ector_gl.tar.gz
evas: add a way to tests Ector_GL.devs/cedric/ector_gl
This is completely not supported/working/useful yet. Please do not complain about it ruinning your life.
-rw-r--r--src/modules/evas/engines/gl_generic/evas_engine.c115
1 files changed, 69 insertions, 46 deletions
diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c
index 15b91429c7..0ea6c5bdfd 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -3,6 +3,7 @@
#include "software/Ector_Software.h"
#include "cairo/Ector_Cairo.h"
+#include "gl/Ector_GL.h"
#if defined HAVE_DLSYM && ! defined _WIN32
# include <dlfcn.h> /* dlopen,dlclose,etc */
@@ -2429,7 +2430,8 @@ eng_texture_image_get(void *data EINA_UNUSED, void *texture)
return e3d_texture_get((E3D_Texture *)texture);
}
-static Eina_Bool use_cairo;
+static Eina_Bool use_cairo = EINA_FALSE;
+static Eina_Bool use_gl = EINA_FALSE;
static Ector_Surface *
eng_ector_create(void *data EINA_UNUSED)
@@ -2440,7 +2442,11 @@ eng_ector_create(void *data EINA_UNUSED)
if (ector_backend && !strcasecmp(ector_backend, "default"))
{
ector = eo_add(ECTOR_SOFTWARE_SURFACE_CLASS, NULL);
- use_cairo = EINA_FALSE;
+ }
+ else if (ector_backend && !strcasecmp(ector_backend, "experimental"))
+ {
+ ector = eo_add(ECTOR_GL_SURFACE_CLASS, NULL);
+ use_gl = EINA_TRUE;
}
else
{
@@ -2594,35 +2600,44 @@ eng_ector_begin(void *data, void *context EINA_UNUSED, Ector_Surface *ector,
evas_gl_common_context_target_surface_set(gl_context, surface);
gl_context->dc = context;
- w = gl_context->w; h = gl_context->h;
-
- if (!buffer->gl || buffer->gl->w != w || buffer->gl->h != h)
+ if (use_cairo|| !use_gl)
{
- int err = EVAS_LOAD_ERROR_NONE;
-
- if (buffer->gl) evas_gl_common_image_free(buffer->gl);
- if (buffer->tofree) free(buffer->software);
- buffer->software = NULL;
+ w = gl_context->w; h = gl_context->h;
- buffer->gl = evas_gl_common_image_new(gl_context, w, h, 1, EVAS_COLORSPACE_ARGB8888);
- if (!buffer->gl)
+ if (!buffer->gl || buffer->gl->w != w || buffer->gl->h != h)
{
- ERR("Creation of an image for vector graphics [%i, %i] failed\n", w, h);
- return ;
- }
- /* evas_gl_common_image_content_hint_set(buffer->gl, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); */
- buffer->gl = eng_image_data_get(data, buffer->gl, 1, &buffer->software, &err, &buffer->tofree);
- if (!buffer->gl && err != EVAS_LOAD_ERROR_NONE)
- {
- ERR("Mapping of an image for vector graphics [%i, %i] failed with %i\n", w, h, err);
- return ;
+ int err = EVAS_LOAD_ERROR_NONE;
+
+ if (buffer->gl) evas_gl_common_image_free(buffer->gl);
+ if (buffer->tofree) free(buffer->software);
+ buffer->software = NULL;
+
+ buffer->gl = evas_gl_common_image_new(gl_context, w, h, 1, EVAS_COLORSPACE_ARGB8888);
+ if (!buffer->gl)
+ {
+ ERR("Creation of an image for vector graphics [%i, %i] failed\n", w, h);
+ return ;
+ }
+ /* evas_gl_common_image_content_hint_set(buffer->gl, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); */
+ buffer->gl = eng_image_data_get(data, buffer->gl, 1, &buffer->software, &err, &buffer->tofree);
+ if (!buffer->gl && err != EVAS_LOAD_ERROR_NONE)
+ {
+ ERR("Mapping of an image for vector graphics [%i, %i] failed with %i\n", w, h, err);
+ return ;
+ }
}
+ memset(buffer->software, 0, sizeof (unsigned int) * w * h);
+ eo_do(ector,
+ ector_buffer_pixels_set(buffer->software, w, h, 0, EFL_GFX_COLORSPACE_ARGB8888,
+ EINA_TRUE, 0, 0, 0, 0),
+ ector_surface_reference_point_set(x, y));
+ }
+ else
+ {
+ evas_gl_common_context_flush(gl_context);
+
+ eo_do(ector, ector_surface_reference_point_set(x, y));
}
- memset(buffer->software, 0, sizeof (unsigned int) * w * h);
- eo_do(ector,
- ector_buffer_pixels_set(buffer->software, w, h, 0, EFL_GFX_COLORSPACE_ARGB8888,
- EINA_TRUE, 0, 0, 0, 0),
- ector_surface_reference_point_set(x, y));
}
static void
@@ -2636,30 +2651,38 @@ eng_ector_end(void *data, void *context EINA_UNUSED, Ector_Surface *ector,
int w, h;
Eina_Bool mul_use;
- gl_context = re->window_gl_context_get(re->software.ob);
- w = gl_context->w; h = gl_context->h;
- mul_use = gl_context->dc->mul.use;
+ if (use_cairo || !use_gl)
+ {
+ gl_context = re->window_gl_context_get(re->software.ob);
+ w = gl_context->w; h = gl_context->h;
+ mul_use = gl_context->dc->mul.use;
- eo_do(ector, ector_buffer_pixels_set(NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0));
- eng_image_data_put(data, buffer->gl, buffer->software);
+ eo_do(ector, ector_buffer_pixels_set(NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+ eng_image_data_put(data, buffer->gl, buffer->software);
- if (!mul_use)
- {
- // @hack as image_draw uses below fields to do colour multiplication.
- gl_context->dc->mul.col = ector_color_multiply(0xffffffff, gl_context->dc->col.col);
- gl_context->dc->mul.use = EINA_TRUE;
- }
+ if (!mul_use)
+ {
+ // @hack as image_draw uses below fields to do colour multiplication.
+ gl_context->dc->mul.col = ector_color_multiply(0xffffffff, gl_context->dc->col.col);
+ gl_context->dc->mul.use = EINA_TRUE;
+ }
- // We actually just bluntly push the pixel all over the
- // destination surface. We don't have the actual information
- // of the widget size. This is not a problem.
- // Later on, we don't want that information and today when
- // using GL backend, you just need to turn on Evas_Map on
- // the Evas_Object_VG.
- evas_gl_common_image_draw(gl_context, buffer->gl, 0, 0, w, h, 0, 0, w, h, 0);
+ // We actually just bluntly push the pixel all over the
+ // destination surface. We don't have the actual information
+ // of the widget size. This is not a problem.
+ // Later on, we don't want that information and today when
+ // using GL backend, you just need to turn on Evas_Map on
+ // the Evas_Object_VG.
+ evas_gl_common_image_draw(gl_context, buffer->gl, 0, 0, w, h, 0, 0, w, h, 0);
- // restore gl state
- gl_context->dc->mul.use = mul_use;
+ // restore gl state
+ gl_context->dc->mul.use = mul_use;
+ }
+ else if (use_gl)
+ {
+ // FIXME: Need to find a cleaner way to do so (maybe have a reset in evas_gl_context)
+ // Force a full pipe reinitialization for now
+ }
}
static Evas_Func func, pfunc;