Update AUTHORS and boiler plates
[platform/core/uifw/libpui.git] / src / PUI_backend.c
1 /*
2  * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining
5  * a copy of this software and associated documentation files (the
6  * "Software"), to deal in the Software without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sublicense, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the
13  * next paragraph) shall be included in all copies or substantial
14  * portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23  * SOFTWARE.
24  */
25
26 #include "PUI_internal.h"
27 #include "PUI_backend.h"
28
29 pui_ani_control_buffer *
30 pui_backend_ani_get_buffer(pui_ani_t *ani)
31 {
32         pui_ani_control_buffer *buffer = NULL;
33
34         buffer = pui_ani_get_buffer(ani->ani_h);
35
36         if (!buffer)
37                 return NULL;
38
39         return buffer;
40 }
41
42 pui_int_error
43 pui_backend_ani_set_buffer(pui_ani_t *ani, pui_ani_control_buffer *buffer)
44 {
45         pui_int_error err = PUI_INT_ERROR_NONE;
46
47         if (!buffer)
48                 return PUI_INT_ERROR_INVALID_BUFFER;
49
50         err = pui_ani_set_buffer(ani->ani_h, buffer);
51
52         return err;
53 }
54
55 pui_int_error
56 pui_backend_ani_update(pui_ani_t *ani)
57 {
58         pui_int_error err = PUI_INT_ERROR_NONE;
59
60         err = pui_ani_update(ani->ani_h);
61
62         return err;
63 }
64
65 pui_ani_status
66 pui_backend_ani_status_get(pui_ani_t *ani)
67 {
68         return pui_ani_status_get(ani);
69 }
70
71 pui_bool
72 pui_backend_ani_add_frame_cb(pui_ani_t *ani, pui_bool (*frame_cb)(void *data, int serial), double frame_interval)
73 {
74         return pui_ani_add_frame_cb(ani, frame_cb, frame_interval);
75 }
76
77 void
78 pui_backend_ani_remove_frame_cb(pui_ani_t *ani)
79 {
80         pui_ani_remove_frame_cb(ani);
81 }
82
83 void
84 pui_backend_ani_status_update(pui_ani_t *ani, pui_ani_status status)
85 {
86         pui_ani_status_update(ani, status);
87 }
88
89 pui_backend_ani_func *
90 pui_backend_ani_alloc_ani_func(void)
91 {
92         pui_backend_ani_func *ani_func = NULL;
93
94         ani_func = (pui_backend_ani_func *)calloc(1, sizeof(pui_backend_ani_func));
95
96         if (!ani_func)
97         {
98                 pui_err("Failed to allocate memory !\n");
99                 return NULL;
100         }
101
102         return ani_func;
103 }
104
105 void
106 pui_backend_ani_free_ani_func(pui_backend_ani_func *ani_func)
107 {
108         if (!ani_func)
109         {
110                 pui_err("Invalid ani backend_func pointer !\n");
111                 return;
112         }
113
114         free(ani_func);
115 }
116
117 pui_backend_ani_data *
118 pui_backend_ani_get_ani_data(pui_ani_t *ani)
119 {
120         return pui_ani_get_ani_data(ani);
121 }
122