Created
May 14, 2015 18:09
-
-
Save zmike/87776da0fe058a55241c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "ecef.h" | |
| #ifdef HAVE_SERVO | |
| static void | |
| render_image_servo_compositing_initialize(void *d) | |
| { | |
| Browser *b = d; | |
| cef_browser_host_t *host; | |
| assert(evas_gl_make_current(b->gl, NULL, NULL)); | |
| assert(evas_gl_make_current(b->gl, b->gl_surf, b->gl_ctx)); | |
| host = browser_get_host(b->browser); | |
| host->initialize_compositing(host); | |
| assert(evas_gl_make_current(b->gl, NULL, NULL)); | |
| b->gl_init = NULL; | |
| } | |
| static void | |
| render_image_servo_init(Evas_Object *obj) | |
| { | |
| Evas_GL *gl; | |
| Browser *b; | |
| b = evas_object_data_get(obj, "Browser"); | |
| b->gl = gl = elm_glview_evas_gl_get(b->img); | |
| b->gl_cfg = evas_gl_config_new(); | |
| b->gl_cfg->color_format = EVAS_GL_RGBA_8888; | |
| b->gl_surf = evas_gl_surface_create(gl, b->gl_cfg, b->w, b->h); | |
| b->gl_ctx = evas_gl_context_create(gl, evas_gl_current_context_get(gl)); | |
| b->gl_init = ecore_job_add(render_image_servo_compositing_initialize, b); | |
| } | |
| void | |
| render_image_servo_present(cef_render_handler_t *handler, cef_browser_t *browser) | |
| { | |
| Browser *b = browser_get(browser_get_client(browser), browser); | |
| elm_glview_size_set(b->img, b->w, b->h); | |
| elm_glview_changed_set(b->img); | |
| } | |
| void | |
| render_image_servo_paint(Browser *b) | |
| { | |
| evas_gl_make_current(b->gl, NULL, NULL); | |
| if ((b->w != b->pw) || (b->h != b->ph)) | |
| { | |
| evas_gl_surface_destroy(b->gl, b->gl_surf); | |
| b->gl_surf = evas_gl_surface_create(b->gl, b->gl_cfg, b->w, b->h); | |
| } | |
| evas_gl_make_current(b->gl, b->gl_surf, b->gl_ctx); | |
| } | |
| void | |
| render_image_servo_setup(Browser *b, int w, int h) | |
| { | |
| elm_glview_mode_set(b->img, ELM_GLVIEW_ALPHA | ELM_GLVIEW_DEPTH | ELM_GLVIEW_DIRECT); | |
| elm_glview_init_func_set(b->img, render_image_servo_init); | |
| /* force setup of internal render callbacks because glview is a stupid widget */ | |
| elm_glview_render_func_set(b->img, NULL); | |
| elm_glview_size_set(b->img, w, h); | |
| elm_glview_changed_set(b->img); | |
| } | |
| #endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment