gap should be gap to next frame not gap from previous frame
Matches usage in the GIF format and makes the concept of gapless clearer.
This commit is contained in:
parent
bb5c5a8e4f
commit
212906cf7d
@ -551,7 +551,7 @@ Key Value Default Description
|
|||||||
``c`` Positive integer ``0`` The 1-based frame number of the frame whose image data serves as the base data
|
``c`` Positive integer ``0`` The 1-based frame number of the frame whose image data serves as the base data
|
||||||
when creating a new frame, by default the base data is black, fully transparent pixels
|
when creating a new frame, by default the base data is black, fully transparent pixels
|
||||||
``r`` Positive integer ``0`` The 1-based frame number of the frame that is being edited. By default, a new frame is created
|
``r`` Positive integer ``0`` The 1-based frame number of the frame that is being edited. By default, a new frame is created
|
||||||
``z`` 32-bit integer ``0`` The gap (in milliseconds) of this frame from the previous one. A value of
|
``z`` 32-bit integer ``0`` The gap (in milliseconds) of this frame from the next one. A value of
|
||||||
zero is ignored. Negative values create a *gapless* frame. If not specified,
|
zero is ignored. Negative values create a *gapless* frame. If not specified,
|
||||||
frames have a default gap of ``40ms``. The root frame defaults to zero gap.
|
frames have a default gap of ``40ms``. The root frame defaults to zero gap.
|
||||||
|
|
||||||
@ -559,7 +559,7 @@ Key Value Default Description
|
|||||||
-----------------------------------------------------------
|
-----------------------------------------------------------
|
||||||
``s`` Positive integer ``0`` ``1`` - start animation, ``>1`` - stop animation
|
``s`` Positive integer ``0`` ``1`` - start animation, ``>1`` - stop animation
|
||||||
``r`` Positive integer ``0`` The 1-based frame number of the frame that is being affected
|
``r`` Positive integer ``0`` The 1-based frame number of the frame that is being affected
|
||||||
``z`` 32-bit integer ``0`` The gap (in milliseconds) of this frame from the previous one. A value of
|
``z`` 32-bit integer ``0`` The gap (in milliseconds) of this frame from the next one. A value of
|
||||||
zero is ignored. Negative values create a *gapless* frame.
|
zero is ignored. Negative values create a *gapless* frame.
|
||||||
``c`` Positive integer ``0`` The 1-based frame number of the frame that should be made the current frame
|
``c`` Positive integer ``0`` The 1-based frame number of the frame that should be made the current frame
|
||||||
|
|
||||||
|
|||||||
@ -1031,19 +1031,21 @@ scan_active_animations(GraphicsManager *self, const monotonic_t now, monotonic_t
|
|||||||
for (size_t i = self->image_count; i-- > 0;) {
|
for (size_t i = self->image_count; i-- > 0;) {
|
||||||
Image *img = self->images + i;
|
Image *img = self->images + i;
|
||||||
if (img->animation_enabled && img->extra_framecnt && img->is_drawn && img->animation_duration) {
|
if (img->animation_enabled && img->extra_framecnt && img->is_drawn && img->animation_duration) {
|
||||||
self->has_images_needing_animation = true;
|
Frame *f = current_frame(img);
|
||||||
Frame *next_frame = img->current_frame_index + 1 < img->extra_framecnt ? img->extra_frames + img->current_frame_index + 1 : &img->root_frame;
|
if (f) {
|
||||||
monotonic_t next_frame_at = img->current_frame_shown_at + ms_to_monotonic_t(next_frame->gap);
|
self->has_images_needing_animation = true;
|
||||||
if (now >= next_frame_at) {
|
monotonic_t next_frame_at = img->current_frame_shown_at + ms_to_monotonic_t(f->gap);
|
||||||
dirtied = true;
|
if (now >= next_frame_at) {
|
||||||
do {
|
dirtied = true;
|
||||||
img->current_frame_index = (img->current_frame_index + 1) % (img->extra_framecnt + 1);
|
do {
|
||||||
} while(!current_frame(img)->gap);
|
img->current_frame_index = (img->current_frame_index + 1) % (img->extra_framecnt + 1);
|
||||||
update_current_frame(self, img, NULL);
|
} while(!current_frame(img)->gap);
|
||||||
next_frame = img->current_frame_index + 1 < img->extra_framecnt ? img->extra_frames + img->current_frame_index + 1 : &img->root_frame;
|
update_current_frame(self, img, NULL);
|
||||||
|
f = current_frame(img);
|
||||||
|
next_frame_at = img->current_frame_shown_at + ms_to_monotonic_t(f->gap);
|
||||||
|
}
|
||||||
|
if (next_frame_at > now && next_frame_at - now < *minimum_gap) *minimum_gap = next_frame_at - now;
|
||||||
}
|
}
|
||||||
next_frame_at = img->current_frame_shown_at + ms_to_monotonic_t(next_frame->gap);
|
|
||||||
if (next_frame_at - now < *minimum_gap) *minimum_gap = next_frame_at - now;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return dirtied;
|
return dirtied;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user