summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-04-08 20:02:58 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-04-08 20:10:06 +0900
commit93dc78216c921d9bc07dc4ac99d291687f4f9679 (patch)
tree2407bde370feae5ef301854331b85a467d45f7cc /src/lib
parent948ea1437908382e15bc53ccb8a38af242da25ea (diff)
downloadefl-93dc78216c921d9bc07dc4ac99d291687f4f9679.tar.gz
Add multiple output api support to evas... just "eo infra stubs" right
now.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/evas/Evas.h210
-rw-r--r--src/lib/evas/canvas/evas_out.c181
-rw-r--r--src/lib/evas/include/evas_private.h2
3 files changed, 393 insertions, 0 deletions
diff --git a/src/lib/evas/Evas.h b/src/lib/evas/Evas.h
index 2548b18126..a56042e285 100644
--- a/src/lib/evas/Evas.h
+++ b/src/lib/evas/Evas.h
@@ -19413,6 +19413,216 @@ enum
*/
#define evas_obj_image_animated_frame_set(frame_index) EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_ANIMATED_FRAME_SET), EO_TYPECHECK(int, frame_index)
+
+
+
+
+
+
+
+
+
+
+
+
+
+#define EVAS_OUT_CLASS evas_out_class_get()
+const Eo_Class *evas_out_class_get(void) EINA_CONST;
+extern EAPI Eo_Op EVAS_OUT_BASE_ID;
+typedef Eo Evas_Out;
+
+enum
+ {
+ EVAS_OUT_SUB_ID_VIEW_SET,
+ EVAS_OUT_SUB_ID_VIEW_GET,
+ EVAS_OUT_SUB_ID_ENGINE_INFO_SET,
+ EVAS_OUT_SUB_ID_ENGINE_INFO_GET,
+ EVAS_OUT_SUB_ID_LAST
+ };
+
+#define EVAS_OUT_ID(sub_id) (EVAS_OUT_BASE_ID + sub_id)
+
+/**
+ * @def evas_out_view_set
+ * @since 1.8
+ *
+ * Sets the viewport region of the canvas that the output displays
+ *
+ * This sets both the viewport region in the canvas that displays on the
+ * given output, but also the viewport size will match the output
+ * resolution 1:1.
+ *
+ * @param[in] x
+ * @param[in] y
+ * @param[in] w
+ * @param[in] h
+ *
+ * @see evas_out_engine_info_set
+ * @see evas_output_viewport_set
+ * @see evas_output_size_set
+ */
+#define evas_out_view_set(x, y, w, h) \
+ EVAS_OUT_ID(EVAS_OUT_SUB_ID_VIEW_SET), \
+EO_TYPECHECK(Evas_Coord, x), \
+EO_TYPECHECK(Evas_Coord, y), \
+EO_TYPECHECK(Evas_Coord, w), \
+EO_TYPECHECK(Evas_Coord, h)
+
+/**
+ * @def evas_out_view_get
+ * @since 1.8
+ *
+ * Gets the viewport region of the canvas that the output displays
+ *
+ * @param[out] x
+ * @param[out] y
+ * @param[out] w
+ * @param[out] h
+ *
+ * @see evas_out_engine_info_get
+ * @see evas_out_view_set
+ * @see evas_output_viewport_get
+ * @see evas_output_size_get
+ */
+#define evas_out_view_get(x, y, w, h) \
+ EVAS_OUT_ID(EVAS_OUT_SUB_ID_VIEW_GET), \
+EO_TYPECHECK(Evas_Coord *, x), \
+EO_TYPECHECK(Evas_Coord *, y), \
+EO_TYPECHECK(Evas_Coord *, w), \
+EO_TYPECHECK(Evas_Coord *, h)
+
+/**
+ * @def evas_out_engine_info_set
+ * @since 1.8
+ *
+ * Sets the engine specific output parameters for a given output.
+ *
+ * @param[in] info The engine parameters
+ * @param[out] ret Return value for success (EINA_TRUE for success)
+ *
+ * @see evas_out_engine_info_get
+ * @see evas_output_viewport_set
+ * @see evas_output_size_set
+ */
+#define evas_out_engine_info_set(info, ret) \
+ EVAS_OUT_ID(EVAS_OUT_SUB_ID_ENGINE_INFO_SET), \
+EO_TYPECHECK(Evas_Engine_Info *, info), \
+EO_TYPECHECK(Eina_Bool *, ret)
+
+/**
+ * @def evas_out_engine_info_get
+ * @since 1.8
+ *
+ * Gets the engine specific output parameters for a given output.
+ *
+ * @param[ret] info The engine parameters return (NULL on failure)
+ *
+ * @see evas_out_engine_info_set
+ * @see evas_output_viewport_get
+ * @see evas_output_size_get
+ */
+#define evas_out_engine_info_get(ret) \
+ EVAS_OUT_ID(EVAS_OUT_SUB_ID_ENGINE_INFO_GET), \
+EO_TYPECHECK(Evas_Engine_Info **, ret)
+
+/**
+ * @since 1.8
+ *
+ * Adds an output to the canvas
+ *
+ * @parem e The canvas to add the output to
+ * @return The output
+ *
+ * @see evas_out_engine_info_set
+ * @see evas_output_viewport_set
+ * @see evas_output_size_set
+ */
+EAPI Evas_Out *evas_out_add(Evas *e);
+
+/**
+ * @since 1.8
+ *
+ * Deletes an output
+ *
+ * @parem evo The output object
+ *
+ * @see evas_out_add
+ */
+EAPI void evas_output_del(Evas_Out *evo);
+
+/**
+ * @since 1.8
+ *
+ * Sets the viewport region of the canvas that the output displays
+ *
+ * This sets both the viewport region in the canvas that displays on the
+ * given output, but also the viewport size will match the output
+ * resolution 1:1.
+ *
+ * @parem evo The output object
+ * @param x The X coordinate of the viewport
+ * @param y The Y coordinate of the viewport
+ * @param w The Width of the viewport
+ * @param h The Height of the viewport
+ *
+ * @see evas_out_engine_info_set
+ * @see evas_output_viewport_set
+ * @see evas_output_size_set
+ */
+EAPI void evas_output_view_set(Evas_Out *evo, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
+
+/**
+ * @since 1.8
+ *
+ * Gets the viewport region of the canvas that the output displays
+ *
+ * @parem evo The output object
+ * @param x Pointer to X return value
+ * @param y Pointer to Y return value
+ * @param w Pointer to Width return value
+ * @param h Pointer to Height return value
+ *
+ * @see evas_out_engine_info_get
+ * @see evas_out_view_set
+ * @see evas_output_viewport_get
+ * @see evas_output_size_get
+ */
+EAPI void evas_output_view_get(const Evas_Out *evo, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
+
+/**
+ * @since 1.8
+ *
+ * Sets the engine specific output parameters for a given output.
+ *
+ * @parem evo The output object
+ * @param info The engine parameters
+ * @return EINA_TRUE for success.
+ *
+ * @see evas_out_engine_info_get
+ * @see evas_output_viewport_set
+ * @see evas_output_size_set
+ */
+EAPI Eina_Bool evas_output_engine_info_set(Evas_Out *evo, Evas_Engine_Info *info);
+
+/**
+ * @since 1.8
+ *
+ * Gets the engine specific output parameters for a given output.
+ *
+ * @param evo The output object
+ * @return info The engine parameters return (NULL on failure)
+ *
+ * @see evas_out_engine_info_set
+ * @see evas_output_viewport_get
+ * @see evas_output_size_get
+ */
+EAPI Evas_Engine_Info *evas_output_engine_info_get(const Evas_Out *evo);
+
+/*
+ * XXX: need output add/del events on evas
+ * XXX: need output name/id, label, data
+ */
+
#ifdef __cplusplus
}
#endif
diff --git a/src/lib/evas/canvas/evas_out.c b/src/lib/evas/canvas/evas_out.c
new file mode 100644
index 0000000000..e764bc3577
--- /dev/null
+++ b/src/lib/evas/canvas/evas_out.c
@@ -0,0 +1,181 @@
+#include "evas_common.h"
+#include "evas_private.h"
+//#include "evas_cs.h"
+#ifdef EVAS_CSERVE2
+#include "evas_cs2_private.h"
+#endif
+
+#include <Eo.h>
+
+EAPI Eo_Op EVAS_OUT_BASE_ID = EO_NOOP;
+#define MY_CLASS EVAS_OUT_CLASS
+typedef struct _Evas_Out_Public_Data Evas_Out_Public_Data;
+struct _Evas_Out_Public_Data
+{
+ int dummy;
+ Evas_Engine_Info *info;
+ Evas_Coord x, y, w, h;
+};
+
+EAPI Evas_Out *
+evas_out_add(Evas *e)
+{
+ MAGIC_CHECK(e, Evas, MAGIC_EVAS);
+ return NULL;
+ MAGIC_CHECK_END();
+ Evas_Object *eo_obj = eo_add(MY_CLASS, e);
+ eo_unref(eo_obj);
+ return eo_obj;
+}
+
+static void
+_constructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)
+{
+ Evas_Out_Public_Data *eo_dat = _pd;
+ Eo *eo_parent = eo_parent_get(eo_obj);
+ Evas_Public_Data *e = eo_data_get(eo_parent, EVAS_CLASS);
+ eo_do_super(eo_obj, MY_CLASS, eo_constructor());
+ if (!e) return;
+ eo_dat->dummy = 7;
+ e->outputs = eina_list_append(e->outputs, eo_obj);
+ // XXX: create eo_dat->info from current engine
+ // XXX: ensure on evas free e->outputs are unreffed
+}
+
+EAPI void
+evas_output_del(Evas_Out *evo)
+{
+ eo_unref(evo);
+}
+
+static void
+_destructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)
+{
+ Evas_Out_Public_Data *eo_dat = _pd;
+ Eo *eo_parent = eo_parent_get(eo_obj);
+ Evas_Public_Data *e = eo_data_get(eo_parent, EVAS_CLASS);
+ // XXX: delete eo_dat->info and tell engine
+ eo_dat->dummy = -7;
+ if (e)
+ {
+ e->outputs = eina_list_remove(e->outputs, eo_obj);
+ }
+ eo_do_super(eo_obj, MY_CLASS, eo_destructor());
+}
+
+EAPI void
+evas_output_view_set(Evas_Out *evo, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
+{
+ eo_do((Eo *)evo, evas_out_view_set(x, y, w, h));
+}
+
+static void
+_output_view_set(Eo *eo_e EINA_UNUSED, void *_pd, va_list *list)
+{
+ Evas_Out_Public_Data *eo_dat = _pd;
+ Evas_Coord x = va_arg(*list, Evas_Coord);
+ Evas_Coord y = va_arg(*list, Evas_Coord);
+ Evas_Coord w = va_arg(*list, Evas_Coord);
+ Evas_Coord h = va_arg(*list, Evas_Coord);
+ eo_dat->x = x;
+ eo_dat->y = y;
+ eo_dat->w = w;
+ eo_dat->h = h;
+ // XXX: tell engine about any output size etc. changes
+ // XXX: tell evas to add damage if viewport loc/size changed
+}
+
+EAPI void
+evas_output_view_get(const Evas_Out *evo, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
+{
+ eo_do((Eo *)evo, evas_out_view_get(x, y, w, h));
+}
+
+static void
+_output_view_get(Eo *eo_e EINA_UNUSED, void *_pd, va_list *list)
+{
+ Evas_Out_Public_Data *eo_dat = _pd;
+ Evas_Coord *x = va_arg(*list, Evas_Coord *);
+ Evas_Coord *y = va_arg(*list, Evas_Coord *);
+ Evas_Coord *w = va_arg(*list, Evas_Coord *);
+ Evas_Coord *h = va_arg(*list, Evas_Coord *);
+ if (x) *x = eo_dat->x;
+ if (y) *y = eo_dat->y;
+ if (w) *w = eo_dat->w;
+ if (h) *h = eo_dat->h;
+}
+
+EAPI Eina_Bool
+evas_output_engine_info_set(Evas_Out *evo, Evas_Engine_Info *info)
+{
+ Eina_Bool ret = EINA_FALSE;
+ eo_do(evo, evas_out_engine_info_set(info, &ret));
+ return ret;
+}
+
+static void
+_output_engine_info_set(Eo *eo_e EINA_UNUSED, void *_pd, va_list *list)
+{
+ Evas_Out_Public_Data *eo_dat = _pd;
+ Evas_Engine_Info *info = va_arg(*list, Evas_Engine_Info *);
+ Eina_Bool *ret = va_arg(*list, Eina_Bool *);
+ if (eo_dat->info != info)
+ {
+ *ret = EINA_FALSE;
+ return;
+ }
+ // XXX: handle setting of engine info here
+ if (ret) *ret = EINA_TRUE;
+}
+
+EAPI Evas_Engine_Info *
+evas_output_engine_info_get(const Evas_Out *evo)
+{
+ Evas_Engine_Info *ret = NULL;
+ eo_do((Eo *)evo, evas_out_engine_info_get(&ret));
+ return ret;
+}
+
+static void
+_output_engine_info_get(Eo *eo_e EINA_UNUSED, void *_pd, va_list *list)
+{
+ Evas_Out_Public_Data *eo_dat = _pd;
+ Evas_Engine_Info **ret = va_arg(*list, Evas_Engine_Info **);
+ if (ret) *ret = eo_dat->info;
+}
+
+static void
+_class_constructor(Eo_Class *klass)
+{
+ const Eo_Op_Func_Description func_desc[] = {
+ EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
+ EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
+ EO_OP_FUNC(EVAS_OUT_ID(EVAS_OUT_SUB_ID_VIEW_SET), _output_view_set),
+ EO_OP_FUNC(EVAS_OUT_ID(EVAS_OUT_SUB_ID_VIEW_GET), _output_view_get),
+ EO_OP_FUNC(EVAS_OUT_ID(EVAS_OUT_SUB_ID_ENGINE_INFO_SET), _output_engine_info_set),
+ EO_OP_FUNC(EVAS_OUT_ID(EVAS_OUT_SUB_ID_ENGINE_INFO_GET), _output_engine_info_get),
+ EO_OP_FUNC_SENTINEL
+ };
+ eo_class_funcs_set(klass, func_desc);
+}
+
+static const Eo_Op_Description op_desc[] = {
+ EO_OP_DESCRIPTION(EVAS_OUT_SUB_ID_VIEW_SET, "Set the canvas viewport region for the output"),
+ EO_OP_DESCRIPTION(EVAS_OUT_SUB_ID_VIEW_GET, "Get the canvas viewport region for the output"),
+ EO_OP_DESCRIPTION(EVAS_OUT_SUB_ID_ENGINE_INFO_SET, "Set engine specific information for rendering to the given output"),
+ EO_OP_DESCRIPTION(EVAS_OUT_SUB_ID_ENGINE_INFO_GET, "Get engine specific information for rendering to the given output"),
+ EO_OP_DESCRIPTION_SENTINEL
+};
+
+static const Eo_Class_Description class_desc = {
+ EO_VERSION,
+ "Evas_Out",
+ EO_CLASS_TYPE_REGULAR,
+ EO_CLASS_DESCRIPTION_OPS(&EVAS_OUT_BASE_ID, op_desc, EVAS_OUT_SUB_ID_LAST),
+ NULL,
+ sizeof(Evas_Out_Public_Data),
+ _class_constructor,
+ NULL
+};
+
+EO_DEFINE_CLASS(evas_out_class_get, &class_desc, EO_BASE_CLASS, NULL);
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index 6e7e65f2a0..76dfecc7e6 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -425,6 +425,8 @@ struct _Evas_Public_Data
Eina_List *touch_points;
Eina_List *devices;
Eina_Array *cur_device;
+
+ Eina_List *outputs;
unsigned char changed : 1;
unsigned char delete_me : 1;