jypark pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=a75fb5763a29b6c89173bf61c0a27ab43d780c1e
commit a75fb5763a29b6c89173bf61c0a27ab43d780c1e Author: Ji-Youn Park <jy0703.p...@samsung.com> Date: Mon Jun 13 18:50:11 2016 +0830 evas_canvas: move evas_output_XXX API from eo to legach. evas canvas will be removed from eo. evas_output_XXX APIs are usually used by widget or e17. I decided not open these kind of APIs to eo. app can use the size of elm win instead of evas output apis. --- src/lib/evas/Evas_Legacy.h | 129 ++++++++++++++ src/lib/evas/canvas/evas_canvas.eo | 120 ------------- src/lib/evas/canvas/evas_main.c | 278 ++++++++++++++++++------------- src/tests/emotion/emotion_test_main-eo.c | 2 +- 4 files changed, 294 insertions(+), 235 deletions(-) diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h index 6d89fe5..173eaea 100644 --- a/src/lib/evas/Evas_Legacy.h +++ b/src/lib/evas/Evas_Legacy.h @@ -5193,4 +5193,133 @@ EAPI Evas_Out *evas_out_add(Evas *e); */ EAPI void evas_output_del(Evas_Out *evo); +/** + * @brief Sets the output framespace size of the render engine of the given + * evas. + * + * The framespace size is used in the Wayland engines to denote space in the + * viewport which is occupied by the window frame. This is mainly used in + * ecore_evas to draw borders. + * + * The units used for @c w and @c h depend on the engine used by the evas. + * + * @param[in] x The left coordinate in output units, usually pixels. + * @param[in] y The top coordinate in output units, usually pixels. + * @param[in] w The width in output units, usually pixels. + * @param[in] h The height in output units, usually pixels. + * + * @since 1.1 + * + * @ingroup Evas_Canvas + */ +EAPI void evas_output_framespace_set(Evas *e, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h); + +/** + * @brief Get the render engine's output framespace coordinates in canvas + * units. + * + * @param[out] x The left coordinate in output units, usually pixels. + * @param[out] y The top coordinate in output units, usually pixels. + * @param[out] w The width in output units, usually pixels. + * @param[out] h The height in output units, usually pixels. + * + * @since 1.1 + * + * @ingroup Evas_Canvas + */ +EAPI void evas_output_framespace_get(const Evas *e, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); + +/** + * @brief Sets the output viewport of the given evas in evas units. + * + * The output viewport is the area of the evas that will be visible to the + * viewer. The viewport will be stretched to fit the output target of the evas + * when rendering is performed. + * + * @note The coordinate values do not have to map 1-to-1 with the output + * target. However, it is generally advised that it is done for ease of use. + * + * @param[in] x The top-left corner x value of the viewport. + * @param[in] y The top-left corner y value of the viewport. + * @param[in] w The width of the viewport. Must be greater than 0. + * @param[in] h The height of the viewport. Must be greater than 0. + * + * @ingroup Evas_Canvas + */ +EAPI void evas_output_viewport_set(Evas *e, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h); + +/** + * @brief Get the render engine's output viewport coordinates in canvas units. + * + * Calling this function writes the current canvas output viewport size and + * location values into the variables pointed to by @c x, @c y, @c w and @c h. + * On success the variables have the output location and size values written + * to them in canvas units. Any of @c x, @c y, @c w or @c h that are @c null + * will not be written to. If @c e is invalid, the results are undefined. + * + * @param[out] x The top-left corner x value of the viewport. + * @param[out] y The top-left corner y value of the viewport. + * @param[out] w The width of the viewport. Must be greater than 0. + * @param[out] h The height of the viewport. Must be greater than 0. + * + * @ingroup Evas_Canvas + */ +EAPI void evas_output_viewport_get(const Evas *e, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); + +/** + * @brief Sets the output engine for the given evas. + * + * Once the output engine for an evas is set, any attempt to change it will be + * ignored. The value for @c render_method can be found using @ref + * evas_render_method_lookup. + * + * @note it is mandatory that one calls @ref evas_init before setting the + * output method. + * + * @param[in] render_method The numeric engine value to use. + * + * @ingroup Evas_Canvas + */ +EAPI void evas_output_method_set(Evas *e, int render_method); + +/** + * @brief Retrieves the number of the output engine used for the given evas. + * + * @return The numeric engine value to use. + * + * @ingroup Evas_Canvas + */ +EAPI int evas_output_method_get(const Evas *e); + +/** + * @brief Sets the output size of the render engine of the given evas. + * + * The evas will render to a rectangle of the given size once this function is + * called. The output size is independent of the viewport size. The viewport + * will be stretched to fill the given rectangle. + * + * The units used for @c w and @c h depend on the engine used by the evas. + * + * @param[in] w The width in output units, usually pixels. + * @param[in] h The height in output units, usually pixels. + * + * @ingroup Evas_Canvas + */ +EAPI void evas_output_size_set(Evas *e, int w, int h); + +/** + * @brief Retrieve the output size of the render engine of the given evas. + * + * The output size is given in whatever the output units are for the engine. + * + * If either @c w or @c h is @c null, then it is ignored. If @c e is invalid, + * the returned results are undefined. + * + * @param[out] w The width in output units, usually pixels. + * @param[out] h The height in output units, usually pixels. + * + * @ingroup Evas_Canvas + */ +EAPI void evas_output_size_get(const Evas *e, int *w, int *h); + #include "canvas/evas_out.eo.legacy.h" diff --git a/src/lib/evas/canvas/evas_canvas.eo b/src/lib/evas/canvas/evas_canvas.eo index 807c52c..71ec998 100644 --- a/src/lib/evas/canvas/evas_canvas.eo +++ b/src/lib/evas/canvas/evas_canvas.eo @@ -7,76 +7,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator, legacy_prefix: evas; data: Evas_Public_Data; methods { - @property output_framespace { - set { - [[Sets the output framespace size of the render engine of the - given evas. - - The framespace size is used in the Wayland engines to denote - space in the viewport which is occupied by the window - frame. This is mainly used in ecore_evas to draw borders. - - The units used for $w and $h depend on the engine used by the - evas. - - @since 1.1 - ]] - } - get { - [[Get the render engine's output framespace coordinates in - canvas units. - - @since 1.1 - ]] - } - values { - x: Evas.Coord; [[The left coordinate in output units, usually pixels.]] - y: Evas.Coord; [[The top coordinate in output units, usually pixels.]] - w: Evas.Coord; [[The width in output units, usually pixels.]] - h: Evas.Coord; [[The height in output units, usually pixels.]] - } - } - @property output_viewport { - set { - [[Sets the output viewport of the given evas in evas units. - - The output viewport is the area of the evas that will be - visible to the viewer. The viewport will be stretched to - fit the output target of the evas when rendering is performed. - - Note: The coordinate values do not have to map 1-to-1 with - the output target. However, it is generally advised that it - is done for ease of use. - ]] - } - get { - [[Get the render engine's output viewport coordinates in - canvas units. - - Calling this function writes the current canvas output - viewport size and location values into the variables pointed - to by $x, $y, $w and $h. On success the variables have the - output location and size values written to them in canvas - units. Any of $x, $y, $w or $h that are $null will not be - written to. If $e is invalid, the results are undefined. - ]] - /* FIXME-doc - Example: - @code - extern Evas *evas; - Evas_Coord x, y, width, height; - - evas_output_viewport_get(evas, &x, &y, &w, &h); - @endcode - */ - } - values { - x: Evas.Coord; [[The top-left corner x value of the viewport.]] - y: Evas.Coord; [[The top-left corner y value of the viewport.]] - w: Evas.Coord; [[The width of the viewport. Must be greater than 0.]] - h: Evas.Coord; [[The height of the viewport. Must be greater than 0.]] - } - } @property image_cache { set { [[Set the image cache. @@ -118,27 +48,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator, flags: Efl.Event.Flags; [[The default flags to use.]] } } - @property output_method { - set { - [[Sets the output engine for the given evas. - - Once the output engine for an evas is set, any attempt to - change it will be ignored. The value for $render_method can - be found using \@ref evas_render_method_lookup. - - Note: it is mandatory that one calls \@ref evas_init before - setting the output method. - ]] - } - get { - [[Retrieves the number of the output engine used for the given - evas. - ]] - } - values { - render_method: int; [[The numeric engine value to use.]] - } - } @property font_cache { set { [[Changes the size of font cache of the given evas.]] @@ -150,35 +59,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator, size: int; [[The size in bytes.]] } } - @property output_size { - set { - [[Sets the output size of the render engine of the given evas. - - The evas will render to a rectangle of the given size once - this function is called. The output size is independent of - the viewport size. The viewport will be stretched to fill - the given rectangle. - - The units used for $w and $h depend on the engine used by the - evas. - ]] - } - get { - [[Retrieve the output size of the render engine of the given - evas. - - The output size is given in whatever the output units are for - the engine. - - If either $w or $h is $null, then it is ignored. If $e is - invalid, the returned results are undefined. - ]] - } - values { - w: int; [[The width in output units, usually pixels.]] - h: int; [[The height in output units, usually pixels.]] - } - } @property data_attach { set { [[Attaches a specific pointer to the evas for fetching later.]] diff --git a/src/lib/evas/canvas/evas_main.c b/src/lib/evas/canvas/evas_main.c index 0a1b6e8..1c0a5ee 100644 --- a/src/lib/evas/canvas/evas_main.c +++ b/src/lib/evas/canvas/evas_main.c @@ -330,40 +330,6 @@ _evas_canvas_eo_base_destructor(Eo *eo_e, Evas_Public_Data *e) eo_destructor(eo_super(eo_e, MY_CLASS)); } -EOLIAN static void -_evas_canvas_output_method_set(Eo *eo_e, Evas_Public_Data *e, int render_method) -{ - Evas_Module *em; - - /* if our engine to set it to is invalid - abort */ - if (render_method == RENDER_METHOD_INVALID) return; - /* if the engine is already set up - abort */ - if (e->output.render_method != RENDER_METHOD_INVALID) return; - /* Request the right engine. */ - em = evas_module_engine_get(render_method); - if (!em) return; - if (em->id_engine != render_method) return; - if (!evas_module_load(em)) return; - - evas_canvas_async_block(e); - /* set the correct render */ - e->output.render_method = render_method; - e->engine.func = (em->functions); - evas_module_use(em); - if (e->engine.module) evas_module_unref(e->engine.module); - e->engine.module = em; - evas_module_ref(em); - /* get the engine info struct */ - if (e->engine.func->info) e->engine.info = e->engine.func->info(eo_e); - return; -} - -EOLIAN static int -_evas_canvas_output_method_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e) -{ - return e->output.render_method; -} - EOLIAN static Evas_Engine_Info* _evas_canvas_engine_info_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e) { @@ -391,86 +357,6 @@ _evas_canvas_engine_info_set(Eo *eo_e, Evas_Public_Data *e, Evas_Engine_Info *in return res; } -EOLIAN static void -_evas_canvas_output_size_set(Eo *eo_e, Evas_Public_Data *e, int w, int h) -{ - if ((w == e->output.w) && (h == e->output.h)) return; - if (w < 1) w = 1; - if (h < 1) h = 1; - - evas_canvas_async_block(e); - e->output.w = w; - e->output.h = h; - e->output.changed = 1; - e->output_validity++; - e->changed = 1; - evas_render_invalidate(eo_e); -} - -EOLIAN static void -_evas_canvas_output_size_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, int *w, int *h) -{ - if (w) *w = e->output.w; - if (h) *h = e->output.h; -} - -EOLIAN static void -_evas_canvas_output_viewport_set(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) -{ - if ((x == e->viewport.x) && (y == e->viewport.y) && - (w == e->viewport.w) && (h == e->viewport.h)) return; - if (w <= 0) return; - if (h <= 0) return; - if ((x != 0) || (y != 0)) - { - ERR("Compat error. viewport x,y != 0,0 not supported"); - x = 0; - y = 0; - } - evas_canvas_async_block(e); - e->viewport.x = x; - e->viewport.y = y; - e->viewport.w = w; - e->viewport.h = h; - e->viewport.changed = 1; - e->output_validity++; - e->changed = 1; - evas_event_callback_call(e->evas, EVAS_CALLBACK_CANVAS_VIEWPORT_RESIZE, NULL); -} - -EOLIAN static void -_evas_canvas_output_viewport_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) -{ - if (x) *x = e->viewport.x; - if (y) *y = e->viewport.y; - if (w) *w = e->viewport.w; - if (h) *h = e->viewport.h; -} - -EOLIAN static void -_evas_canvas_output_framespace_set(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) -{ - if ((x == e->framespace.x) && (y == e->framespace.y) && - (w == e->framespace.w) && (h == e->framespace.h)) return; - evas_canvas_async_block(e); - e->framespace.x = x; - e->framespace.y = y; - e->framespace.w = w; - e->framespace.h = h; - e->framespace.changed = 1; - e->output_validity++; - e->changed = 1; -} - -EOLIAN static void -_evas_canvas_output_framespace_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) -{ - if (x) *x = e->framespace.x; - if (y) *y = e->framespace.y; - if (w) *w = e->framespace.w; - if (h) *h = e->framespace.h; -} - EOLIAN static Evas_Coord _evas_canvas_coord_screen_x_to_world(const Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, int x) { @@ -822,4 +708,168 @@ _evas_canvas_image_data_regenerate(Eina_List *list) } } +/* Legacy deprecated functions */ + +EAPI void +evas_output_framespace_set(Evas *eo_e, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) +{ + MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS); + return; + MAGIC_CHECK_END(); + + Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS); + + if ((x == e->framespace.x) && (y == e->framespace.y) && + (w == e->framespace.w) && (h == e->framespace.h)) return; + evas_canvas_async_block(e); + e->framespace.x = x; + e->framespace.y = y; + e->framespace.w = w; + e->framespace.h = h; + e->framespace.changed = 1; + e->output_validity++; + e->changed = 1; +} + +EAPI void +evas_output_framespace_get(const Evas *eo_e, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) +{ + MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS); + return; + MAGIC_CHECK_END(); + + Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS); + + if (x) *x = e->framespace.x; + if (y) *y = e->framespace.y; + if (w) *w = e->framespace.w; + if (h) *h = e->framespace.h; +} + +EAPI void +evas_output_method_set(Evas *eo_e, int render_method) +{ + MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS); + return; + MAGIC_CHECK_END(); + + Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS); + + Evas_Module *em; + + /* if our engine to set it to is invalid - abort */ + if (render_method == RENDER_METHOD_INVALID) return; + /* if the engine is already set up - abort */ + if (e->output.render_method != RENDER_METHOD_INVALID) return; + /* Request the right engine. */ + em = evas_module_engine_get(render_method); + if (!em) return; + if (em->id_engine != render_method) return; + if (!evas_module_load(em)) return; + + evas_canvas_async_block(e); + /* set the correct render */ + e->output.render_method = render_method; + e->engine.func = (em->functions); + evas_module_use(em); + if (e->engine.module) evas_module_unref(e->engine.module); + e->engine.module = em; + evas_module_ref(em); + /* get the engine info struct */ + if (e->engine.func->info) e->engine.info = e->engine.func->info(eo_e); + return; +} + +EAPI int +evas_output_method_get(const Evas *eo_e) +{ + MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS); + return RENDER_METHOD_INVALID; + MAGIC_CHECK_END(); + + Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS); + + return e->output.render_method; +} + +EAPI void +evas_output_size_set(Evas *eo_e, int w, int h) +{ + MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS); + return; + MAGIC_CHECK_END(); + + Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS); + + if ((w == e->output.w) && (h == e->output.h)) return; + if (w < 1) w = 1; + if (h < 1) h = 1; + + evas_canvas_async_block(e); + e->output.w = w; + e->output.h = h; + e->output.changed = 1; + e->output_validity++; + e->changed = 1; + evas_render_invalidate(eo_e); +} + +EAPI void +evas_output_size_get(const Evas *eo_e, int *w, int *h) +{ + MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS); + return; + MAGIC_CHECK_END(); + + Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS); + + if (w) *w = e->output.w; + if (h) *h = e->output.h; +} + +EAPI void +evas_output_viewport_set(Evas *eo_e, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) +{ + MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS); + return; + MAGIC_CHECK_END(); + + Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS); + + if ((x == e->viewport.x) && (y == e->viewport.y) && + (w == e->viewport.w) && (h == e->viewport.h)) return; + if (w <= 0) return; + if (h <= 0) return; + if ((x != 0) || (y != 0)) + { + ERR("Compat error. viewport x,y != 0,0 not supported"); + x = 0; + y = 0; + } + evas_canvas_async_block(e); + e->viewport.x = x; + e->viewport.y = y; + e->viewport.w = w; + e->viewport.h = h; + e->viewport.changed = 1; + e->output_validity++; + e->changed = 1; + evas_event_callback_call(e->evas, EVAS_CALLBACK_CANVAS_VIEWPORT_RESIZE, NULL); +} + +EAPI void +evas_output_viewport_get(const Evas *eo_e, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) +{ + MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS); + return; + MAGIC_CHECK_END(); + + Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS); + + if (x) *x = e->viewport.x; + if (y) *y = e->viewport.y; + if (w) *w = e->viewport.w; + if (h) *h = e->viewport.h; +} + #include "canvas/evas_canvas.eo.c" diff --git a/src/tests/emotion/emotion_test_main-eo.c b/src/tests/emotion/emotion_test_main-eo.c index 86a0cbb..01ca239 100644 --- a/src/tests/emotion/emotion_test_main-eo.c +++ b/src/tests/emotion/emotion_test_main-eo.c @@ -84,7 +84,7 @@ main_resize(Ecore_Evas *ee) { Evas_Coord w, h; - evas_canvas_output_viewport_get(ecore_evas_get(ee), NULL, NULL, &w, &h); + evas_output_viewport_get(ecore_evas_get(ee), NULL, NULL, &w, &h); bg_resize(w, h); } --