summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-01-04 01:10:53 +0100
committerJean-Philippe Andre <jp.andre@samsung.com>2016-01-05 15:43:44 +0900
commitc461c10ff8f09b63a1e0d3c51c7d6e65ff31a8fd (patch)
tree6b58675e4dd7c105f8c14c3ec324d6b75538497a
parentfc40f905eb36786eba7cf34732022bf620b44339 (diff)
evas: add a way to tests 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 a052958637..0a9e0bcaa6 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 @@
3 3
4#include "software/Ector_Software.h" 4#include "software/Ector_Software.h"
5#include "cairo/Ector_Cairo.h" 5#include "cairo/Ector_Cairo.h"
6#include "gl/Ector_GL.h"
6 7
7#if defined HAVE_DLSYM && ! defined _WIN32 8#if defined HAVE_DLSYM && ! defined _WIN32
8# include <dlfcn.h> /* dlopen,dlclose,etc */ 9# include <dlfcn.h> /* dlopen,dlclose,etc */
@@ -2431,7 +2432,8 @@ eng_texture_image_get(void *data EINA_UNUSED, void *texture)
2431 return e3d_texture_get((E3D_Texture *)texture); 2432 return e3d_texture_get((E3D_Texture *)texture);
2432} 2433}
2433 2434
2434static Eina_Bool use_cairo; 2435static Eina_Bool use_cairo = EINA_FALSE;
2436static Eina_Bool use_gl = EINA_FALSE;
2435 2437
2436static Ector_Surface * 2438static Ector_Surface *
2437eng_ector_create(void *data EINA_UNUSED) 2439eng_ector_create(void *data EINA_UNUSED)
@@ -2442,7 +2444,11 @@ eng_ector_create(void *data EINA_UNUSED)
2442 if (ector_backend && !strcasecmp(ector_backend, "default")) 2444 if (ector_backend && !strcasecmp(ector_backend, "default"))
2443 { 2445 {
2444 ector = eo_add(ECTOR_SOFTWARE_SURFACE_CLASS, NULL); 2446 ector = eo_add(ECTOR_SOFTWARE_SURFACE_CLASS, NULL);
2445 use_cairo = EINA_FALSE; 2447 }
2448 else if (ector_backend && !strcasecmp(ector_backend, "experimental"))
2449 {
2450 ector = eo_add(ECTOR_GL_SURFACE_CLASS, NULL);
2451 use_gl = EINA_TRUE;
2446 } 2452 }
2447 else 2453 else
2448 { 2454 {
@@ -2596,35 +2602,44 @@ eng_ector_begin(void *data, void *context EINA_UNUSED, Ector_Surface *ector,
2596 evas_gl_common_context_target_surface_set(gl_context, surface); 2602 evas_gl_common_context_target_surface_set(gl_context, surface);
2597 gl_context->dc = context; 2603 gl_context->dc = context;
2598 2604
2599 w = gl_context->w; h = gl_context->h; 2605 if (use_cairo|| !use_gl)
2600
2601 if (!buffer->gl || buffer->gl->w != w || buffer->gl->h != h)
2602 { 2606 {
2603 int err = EVAS_LOAD_ERROR_NONE; 2607 w = gl_context->w; h = gl_context->h;
2604
2605 if (buffer->gl) evas_gl_common_image_free(buffer->gl);
2606 if (buffer->tofree) free(buffer->software);
2607 buffer->software = NULL;
2608 2608
2609 buffer->gl = evas_gl_common_image_new(gl_context, w, h, 1, EVAS_COLORSPACE_ARGB8888); 2609 if (!buffer->gl || buffer->gl->w != w || buffer->gl->h != h)
2610 if (!buffer->gl)
2611 { 2610 {
2612 ERR("Creation of an image for vector graphics [%i, %i] failed\n", w, h); 2611 int err = EVAS_LOAD_ERROR_NONE;
2613 return ; 2612
2614 } 2613 if (buffer->gl) evas_gl_common_image_free(buffer->gl);
2615 /* evas_gl_common_image_content_hint_set(buffer->gl, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); */ 2614 if (buffer->tofree) free(buffer->software);
2616 buffer->gl = eng_image_data_get(data, buffer->gl, 1, &buffer->software, &err, &buffer->tofree); 2615 buffer->software = NULL;
2617 if (!buffer->gl && err != EVAS_LOAD_ERROR_NONE) 2616
2618 { 2617 buffer->gl = evas_gl_common_image_new(gl_context, w, h, 1, EVAS_COLORSPACE_ARGB8888);
2619 ERR("Mapping of an image for vector graphics [%i, %i] failed with %i\n", w, h, err); 2618 if (!buffer->gl)
2620 return ; 2619 {
2620 ERR("Creation of an image for vector graphics [%i, %i] failed\n", w, h);
2621 return ;
2622 }
2623 /* evas_gl_common_image_content_hint_set(buffer->gl, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); */
2624 buffer->gl = eng_image_data_get(data, buffer->gl, 1, &buffer->software, &err, &buffer->tofree);
2625 if (!buffer->gl && err != EVAS_LOAD_ERROR_NONE)
2626 {
2627 ERR("Mapping of an image for vector graphics [%i, %i] failed with %i\n", w, h, err);
2628 return ;
2629 }
2621 } 2630 }
2631 memset(buffer->software, 0, sizeof (unsigned int) * w * h);
2632 eo_do(ector,
2633 ector_buffer_pixels_set(buffer->software, w, h, 0, EFL_GFX_COLORSPACE_ARGB8888,
2634 EINA_TRUE, 0, 0, 0, 0),
2635 ector_surface_reference_point_set(x, y));
2636 }
2637 else
2638 {
2639 evas_gl_common_context_flush(gl_context);
2640
2641 eo_do(ector, ector_surface_reference_point_set(x, y));
2622 } 2642 }
2623 memset(buffer->software, 0, sizeof (unsigned int) * w * h);
2624 eo_do(ector,
2625 ector_buffer_pixels_set(buffer->software, w, h, 0, EFL_GFX_COLORSPACE_ARGB8888,
2626 EINA_TRUE, 0, 0, 0, 0),
2627 ector_surface_reference_point_set(x, y));
2628} 2643}
2629 2644
2630static void 2645static void
@@ -2638,30 +2653,38 @@ eng_ector_end(void *data, void *context EINA_UNUSED, Ector_Surface *ector,
2638 int w, h; 2653 int w, h;
2639 Eina_Bool mul_use; 2654 Eina_Bool mul_use;
2640 2655
2641 gl_context = re->window_gl_context_get(re->software.ob); 2656 if (use_cairo || !use_gl)
2642 w = gl_context->w; h = gl_context->h; 2657 {
2643 mul_use = gl_context->dc->mul.use; 2658 gl_context = re->window_gl_context_get(re->software.ob);
2659 w = gl_context->w; h = gl_context->h;
2660 mul_use = gl_context->dc->mul.use;
2644 2661
2645 eo_do(ector, ector_buffer_pixels_set(NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0)); 2662 eo_do(ector, ector_buffer_pixels_set(NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0));
2646 eng_image_data_put(data, buffer->gl, buffer->software); 2663 eng_image_data_put(data, buffer->gl, buffer->software);
2647 2664
2648 if (!mul_use) 2665 if (!mul_use)
2649 { 2666 {
2650 // @hack as image_draw uses below fields to do colour multiplication. 2667 // @hack as image_draw uses below fields to do colour multiplication.
2651 gl_context->dc->mul.col = ector_color_multiply(0xffffffff, gl_context->dc->col.col); 2668 gl_context->dc->mul.col = ector_color_multiply(0xffffffff, gl_context->dc->col.col);
2652 gl_context->dc->mul.use = EINA_TRUE; 2669 gl_context->dc->mul.use = EINA_TRUE;
2653 } 2670 }
2654 2671
2655 // We actually just bluntly push the pixel all over the 2672 // We actually just bluntly push the pixel all over the
2656 // destination surface. We don't have the actual information 2673 // destination surface. We don't have the actual information
2657 // of the widget size. This is not a problem. 2674 // of the widget size. This is not a problem.
2658 // Later on, we don't want that information and today when 2675 // Later on, we don't want that information and today when
2659 // using GL backend, you just need to turn on Evas_Map on 2676 // using GL backend, you just need to turn on Evas_Map on
2660 // the Evas_Object_VG. 2677 // the Evas_Object_VG.
2661 evas_gl_common_image_draw(gl_context, buffer->gl, 0, 0, w, h, 0, 0, w, h, 0); 2678 evas_gl_common_image_draw(gl_context, buffer->gl, 0, 0, w, h, 0, 0, w, h, 0);
2662 2679
2663 // restore gl state 2680 // restore gl state
2664 gl_context->dc->mul.use = mul_use; 2681 gl_context->dc->mul.use = mul_use;
2682 }
2683 else if (use_gl)
2684 {
2685 // FIXME: Need to find a cleaner way to do so (maybe have a reset in evas_gl_context)
2686 // Force a full pipe reinitialization for now
2687 }
2665} 2688}
2666 2689
2667static Evas_Func func, pfunc; 2690static Evas_Func func, pfunc;