static void win_resize_cb(void *data, Evas *e , Evas_Object *obj , void *event_info) { appdata_s *ad = data; if(ad->evas_gl_surface) { cairo_surface_destroy(ad->surface); cairo_destroy(ad->cairo); cairo_device_destroy(ad->cairo_device); evas_gl_surface_destroy(ad->evas_gl, ad->evas_gl_surface); ad->evas_gl_surface = NULL; } evas_object_geometry_get(obj, NULL, NULL, &ad->width, &ad->height); evas_object_image_size_set(ad->img, ad->width, ad->height); evas_object_resize(ad->img, ad->width, ad->height); evas_object_show(ad->img); if(!ad->evas_gl_surface) { Evas_Native_Surface ns; ad->evas_gl_surface = evas_gl_surface_create(ad->evas_gl, ad->evas_gl_config, ad->width, ad->height); evas_gl_native_surface_get(ad->evas_gl, ad->evas_gl_surface, &ns); evas_object_image_native_surface_set(ad->img, &ns); evas_object_image_pixels_dirty_set (ad->img, EINA_TRUE); ad->cairo_device = (cairo_device_t *)cairo_evas_gl_device_create (ad->evas_gl, ad->evas_gl_context); cairo_gl_device_set_thread_aware(ad->cairo_device, 0); ad->surface = (cairo_surface_t *)cairo_gl_surface_create_for_evas_gl(ad->cairo_device, ad->evas_gl_surface, ad->evas_gl_config, ad->width, ad->height); ad->cairo = cairo_create (ad->surface); } }
GraphicsContext3DPrivate::~GraphicsContext3DPrivate() { if (!m_evasGL) return; if (m_evasGLSurface) evas_gl_surface_destroy(m_evasGL, m_evasGLSurface); if (m_evasGLContext) evas_gl_context_destroy(m_evasGL, m_evasGLContext); evas_gl_free(m_evasGL); }
static void win_delete_request_cb(void *data, Evas_Object *obj, void *event_info) { appdata_s *ad = data; cairo_surface_destroy(ad->surface); cairo_destroy(ad->cairo); cairo_device_destroy(ad->cairo_device); evas_gl_surface_destroy(ad->evas_gl, ad->evas_gl_surface); evas_gl_context_destroy(ad->evas_gl, ad->evas_gl_context); evas_gl_config_free(ad->evas_gl_config); evas_gl_free(ad->evas_gl); ui_app_exit(); }
EAPI void evas_gl_free(Evas_GL *evas_gl) { MAGIC_CHECK(evas_gl, Evas_GL, MAGIC_EVAS_GL); return; MAGIC_CHECK_END(); // Delete undeleted surfaces while (evas_gl->surfaces) evas_gl_surface_destroy(evas_gl, evas_gl->surfaces->data); // Delete undeleted contexts while (evas_gl->contexts) evas_gl_context_destroy(evas_gl, evas_gl->contexts->data); evas_gl->magic = 0; free(evas_gl); }