projects
/
platform
/
core
/
uifw
/
libpui.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
default_backend: implements frame_duration to proceed each frame at a different speed
[platform/core/uifw/libpui.git]
/
backends
/
notification
/
default_ani_normal.c
diff --git
a/backends/notification/default_ani_normal.c
b/backends/notification/default_ani_normal.c
index
6d5b2b3
..
9dc7173
100644
(file)
--- a/
backends/notification/default_ani_normal.c
+++ b/
backends/notification/default_ani_normal.c
@@
-49,7
+49,6
@@
_ani_backend_normal_free_frame(default_frame_info_t *frame)
static default_frame_info_t *
_ani_backend_normal_get_frame(default_ani_info *ani_info)
{
static default_frame_info_t *
_ani_backend_normal_get_frame(default_ani_info *ani_info)
{
-#define SMOOTH_FRAME 15
default_frame_info_t *frame, *key_frame, *key_frame2;
int idx, idx2;
unsigned int r, g, b, r2, g2, b2;
default_frame_info_t *frame, *key_frame, *key_frame2;
int idx, idx2;
unsigned int r, g, b, r2, g2, b2;
@@
-59,7
+58,12
@@
_ani_backend_normal_get_frame(default_ani_info *ani_info)
frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
if (!frame) return NULL;
frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
if (!frame) return NULL;
- idx = ((int)(ani_info->frame_idx / SMOOTH_FRAME)) % ani_info->num_key_frames;
+ if (ani_info->frame_idx == 0)
+ {
+ ani_info->frame_max = (unsigned int)(ani_info->frames[ani_info->key_frame_cur].frame_duration / ani_info->interval);
+ }
+
+ idx = ani_info->key_frame_cur;
idx2 = (idx + 1) % ani_info->num_key_frames;
key_frame = &ani_info->frames[idx];
idx2 = (idx + 1) % ani_info->num_key_frames;
key_frame = &ani_info->frames[idx];
@@
-71,7
+75,7
@@
_ani_backend_normal_get_frame(default_ani_info *ani_info)
free(frame);
return NULL;
}
free(frame);
return NULL;
}
- div = (double)(ani_info->frame_idx
% SMOOTH_FRAME) / (double)SMOOTH_FRAME
;
+ div = (double)(ani_info->frame_idx
) / (double)ani_info->frame_max
;
r = g = b = r2 = g2 = b2 = 0x0;
for (int i = 0; i < key_frame->num_led; i++)
{
r = g = b = r2 = g2 = b2 = 0x0;
for (int i = 0; i < key_frame->num_led; i++)
{
@@
-84,11
+88,12
@@
_ani_backend_normal_get_frame(default_ani_info *ani_info)
frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
}
ani_info->frame_idx++;
frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
}
ani_info->frame_idx++;
- if (ani_info->frame_idx >=
(ani_info->num_key_frames * SMOOTH_FRAME)
)
+ if (ani_info->frame_idx >=
ani_info->frame_max
)
{
{
- if (ani_info->repeat >= 0)
- ani_info->repeat_cur++;
ani_info->frame_idx = 0;
ani_info->frame_idx = 0;
+ ani_info->key_frame_cur = (ani_info->key_frame_cur + 1) % ani_info->num_key_frames;
+ if (ani_info->repeat >= 0 && ani_info->key_frame_cur == 0)
+ ani_info->repeat_cur++;
}
return frame;
}
return frame;
@@
-176,6
+181,10
@@
_ani_normal_start(pui_ani_t *ani, int repeat)
if (repeat == 0) info->repeat = 1;
else info->repeat = repeat;
if (repeat == 0) info->repeat = 1;
else info->repeat = repeat;
+ info->key_frame_cur = 0;
+ info->frame_idx = 0;
+ info->repeat_cur = 0;
+
ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_normal_frame_cb, info->interval / 1000.0);
if (!ret)
{
ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_normal_frame_cb, info->interval / 1000.0);
if (!ret)
{