forked from enlightenment/efl
Elementary glview: Fixed formatting.
Followed E coding style. Refer http://trac.enlightenment.org/e/wiki/ECoding. I have no idea about struct initialization though. 1. Fixed indentation. 2. Removed unnecessary lines. 3. Etc... SVN revision: 59921
This commit is contained in:
parent
d9bf79c0f7
commit
913fb058ea
|
@ -127,7 +127,6 @@ _glview_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_render_cb(void *obj)
|
_render_cb(void *obj)
|
||||||
{
|
{
|
||||||
|
@ -146,7 +145,7 @@ _render_cb(void *obj)
|
||||||
|
|
||||||
// Depending on the policy return true or false
|
// Depending on the policy return true or false
|
||||||
if (wd->render_policy == ELM_GLVIEW_RENDER_POLICY_ON_DEMAND)
|
if (wd->render_policy == ELM_GLVIEW_RENDER_POLICY_ON_DEMAND)
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
else if (wd->render_policy == ELM_GLVIEW_RENDER_POLICY_ALWAYS)
|
else if (wd->render_policy == ELM_GLVIEW_RENDER_POLICY_ALWAYS)
|
||||||
{
|
{
|
||||||
// Return false so it only runs once
|
// Return false so it only runs once
|
||||||
|
@ -170,30 +169,27 @@ _set_render_policy_callback(Evas_Object *obj)
|
||||||
switch (wd->render_policy)
|
switch (wd->render_policy)
|
||||||
{
|
{
|
||||||
case ELM_GLVIEW_RENDER_POLICY_ON_DEMAND:
|
case ELM_GLVIEW_RENDER_POLICY_ON_DEMAND:
|
||||||
// Delete idle_enterer if it for some reason is around
|
// Delete idle_enterer if it for some reason is around
|
||||||
if (wd->render_idle_enterer)
|
if (wd->render_idle_enterer)
|
||||||
{
|
{
|
||||||
ecore_idle_enterer_del(wd->render_idle_enterer);
|
ecore_idle_enterer_del(wd->render_idle_enterer);
|
||||||
wd->render_idle_enterer = NULL;
|
wd->render_idle_enterer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set pixel getter callback
|
// Set pixel getter callback
|
||||||
evas_object_image_pixels_get_callback_set
|
evas_object_image_pixels_get_callback_set
|
||||||
(wd->glview_image, (Evas_Object_Image_Pixels_Get_Cb)_render_cb, obj);
|
(wd->glview_image, (Evas_Object_Image_Pixels_Get_Cb)_render_cb, obj);
|
||||||
break;
|
break;
|
||||||
case ELM_GLVIEW_RENDER_POLICY_ALWAYS:
|
case ELM_GLVIEW_RENDER_POLICY_ALWAYS:
|
||||||
|
// Unset the pixel getter callback if set already
|
||||||
// Unset the pixel getter callback if set already
|
evas_object_image_pixels_get_callback_set(wd->glview_image, NULL, NULL);
|
||||||
evas_object_image_pixels_get_callback_set(wd->glview_image, NULL, NULL);
|
break;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
ERR("Invalid Render Policy.\n");
|
ERR("Invalid Render Policy.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new glview to the parent
|
* Add a new glview to the parent
|
||||||
*
|
*
|
||||||
|
@ -259,9 +255,7 @@ elm_glview_add(Evas_Object *parent)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -277,7 +271,6 @@ elm_glview_gl_api_get(const Evas_Object *obj)
|
||||||
{
|
{
|
||||||
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
||||||
Widget_Data *wd = elm_widget_data_get(obj);
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
|
|
||||||
if (!wd) return NULL;
|
if (!wd) return NULL;
|
||||||
|
|
||||||
return evas_gl_api_get(wd->evasgl);
|
return evas_gl_api_get(wd->evasgl);
|
||||||
|
@ -305,19 +298,19 @@ elm_glview_mode_set(Evas_Object *obj, Elm_GLView_Mode mode)
|
||||||
|
|
||||||
// Set the configs
|
// Set the configs
|
||||||
if (mode & ELM_GLVIEW_ALPHA)
|
if (mode & ELM_GLVIEW_ALPHA)
|
||||||
cfg.color_format = EVAS_GL_RGBA_8;
|
cfg.color_format = EVAS_GL_RGBA_8;
|
||||||
|
|
||||||
if (mode & ELM_GLVIEW_DEPTH)
|
if (mode & ELM_GLVIEW_DEPTH)
|
||||||
cfg.depth_bits = EVAS_GL_DEPTH_BIT_24;
|
cfg.depth_bits = EVAS_GL_DEPTH_BIT_24;
|
||||||
|
|
||||||
if (mode & ELM_GLVIEW_STENCIL)
|
if (mode & ELM_GLVIEW_STENCIL)
|
||||||
cfg.stencil_bits = EVAS_GL_STENCIL_BIT_8;
|
cfg.stencil_bits = EVAS_GL_STENCIL_BIT_8;
|
||||||
|
|
||||||
// Check for Alpha Channel and enable it
|
// Check for Alpha Channel and enable it
|
||||||
if (mode & ELM_GLVIEW_ALPHA)
|
if (mode & ELM_GLVIEW_ALPHA)
|
||||||
evas_object_image_alpha_set(wd->glview_image, EINA_TRUE);
|
evas_object_image_alpha_set(wd->glview_image, EINA_TRUE);
|
||||||
else
|
else
|
||||||
evas_object_image_alpha_set(wd->glview_image, EINA_FALSE);
|
evas_object_image_alpha_set(wd->glview_image, EINA_FALSE);
|
||||||
|
|
||||||
wd->mode = mode;
|
wd->mode = mode;
|
||||||
wd->config = cfg;
|
wd->config = cfg;
|
||||||
|
@ -352,11 +345,11 @@ elm_glview_scale_policy_set(Evas_Object *obj, Elm_GLView_Resize_Policy policy)
|
||||||
{
|
{
|
||||||
case ELM_GLVIEW_RESIZE_POLICY_RECREATE:
|
case ELM_GLVIEW_RESIZE_POLICY_RECREATE:
|
||||||
case ELM_GLVIEW_RESIZE_POLICY_SCALE:
|
case ELM_GLVIEW_RESIZE_POLICY_SCALE:
|
||||||
wd->scale_policy = policy;
|
wd->scale_policy = policy;
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
default:
|
default:
|
||||||
ERR("Invalid Scale Policy.\n");
|
ERR("Invalid Scale Policy.\n");
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
_glview_update_surface(obj);
|
_glview_update_surface(obj);
|
||||||
elm_glview_changed_set(obj);
|
elm_glview_changed_set(obj);
|
||||||
|
@ -459,11 +452,9 @@ elm_glview_render_func_set(Evas_Object *obj, Elm_GLView_Func func)
|
||||||
if (!wd) return;
|
if (!wd) return;
|
||||||
|
|
||||||
wd->render_func = func;
|
wd->render_func = func;
|
||||||
|
|
||||||
_set_render_policy_callback(obj);
|
_set_render_policy_callback(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifies that there has been changes in the GLView.
|
* Notifies that there has been changes in the GLView.
|
||||||
*
|
*
|
||||||
|
@ -476,18 +467,14 @@ elm_glview_changed_set(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||||
Widget_Data *wd = elm_widget_data_get(obj);
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
|
|
||||||
if (!wd) return;
|
if (!wd) return;
|
||||||
|
|
||||||
evas_object_image_pixels_dirty_set(wd->glview_image, EINA_TRUE);
|
evas_object_image_pixels_dirty_set(wd->glview_image, EINA_TRUE);
|
||||||
|
|
||||||
if (wd->render_policy == ELM_GLVIEW_RENDER_POLICY_ALWAYS)
|
if (wd->render_policy == ELM_GLVIEW_RENDER_POLICY_ALWAYS)
|
||||||
{
|
{
|
||||||
if (!wd->render_idle_enterer)
|
if (!wd->render_idle_enterer)
|
||||||
|
wd->render_idle_enterer = ecore_idle_enterer_before_add((Ecore_Task_Cb)_render_cb, obj);
|
||||||
wd->render_idle_enterer = ecore_idle_enterer_before_add((Ecore_Task_Cb)_render_cb, obj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
|
/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
|
||||||
|
|
Loading…
Reference in New Issue