Пример #1
0
void Animation::tick(weston_output *output, uint32_t msecs)
{
    if (m_animation.ani.frame_counter <= 1) {
        m_timestamp = msecs;
    }

    uint32_t time = msecs - m_timestamp;
    if (time > m_duration) {
        emit update(m_target);
        stop();
        weston_compositor_schedule_repaint(output->compositor);
        if (Flags::SendDone & m_runFlags) {
            emit done();
        }
        return;
    }

    double f = (double)time / (double)m_duration;
    if (m_curve) {
        f = m_curve->value(f);
    }
    emit update(m_target * f + m_start * (1.f - f));

    weston_compositor_schedule_repaint(output->compositor);
}
Пример #2
0
void Animation::update(struct weston_output *output, uint32_t msecs)
{
    if (m_animation.ani.frame_counter <= 1) {
        m_timestamp = msecs;
    }

    uint32_t time = msecs - m_timestamp;
    if (time > m_duration) {
        (*updateSignal)(m_target);
        stop();
        weston_compositor_schedule_repaint(output->compositor);
        if ((int)Flags::SendDone & (int)m_runFlags) {
            (*doneSignal)();
        }
        return;
    }

    float f = (float)time / (float)m_duration;
    if (m_curve) {
        f = m_curve->value(f);
    }
    (*updateSignal)(m_target * f + m_start * (1.f - f));

    weston_compositor_schedule_repaint(output->compositor);
}
Пример #3
0
void Animation::run(struct weston_output *output, uint32_t duration, Animation::Flags flags)
{
    stop();

    m_duration = duration;
    m_runFlags = flags;
    m_animation.ani.frame_counter = 0;

    wl_list_insert(&output->animation_list, &m_animation.ani.link);
    weston_compositor_schedule_repaint(output->compositor);
}
Пример #4
0
void BaseAnimation::tick(weston_output *output, uint32_t msecs)
{
    if (m_animation.ani.frame_counter <= 1) {
        m_timestamp = msecs;
    }

    uint32_t time = msecs - m_timestamp;
    if (time > m_duration) {
        updateAnim(1.);
        stop();
        weston_compositor_schedule_repaint(output->compositor);
        done();
        return;
    }

    double f = (double)time / (double)m_duration;
    if (m_curve) {
        f = m_curve->value(f);
    }
    updateAnim(f);

    weston_compositor_schedule_repaint(output->compositor);
}
Пример #5
0
void Animation::run(struct weston_output *output, uint32_t duration, Animation::Flags flags)
{
    stop();

    if (!output) {
        (*updateSignal)(m_target);
        if ((int)flags & (int)Flags::SendDone) {
            (*doneSignal)();
        }
        return;
    }

    m_duration = duration;
    m_runFlags = flags;
    m_animation.ani.frame_counter = 0;

    wl_list_insert(&output->animation_list, &m_animation.ani.link);
    weston_compositor_schedule_repaint(output->compositor);

    (*updateSignal)(m_start);
}
Пример #6
0
static void
weston_view_animation_frame(struct weston_animation *base,
			    struct weston_output *output, uint32_t msecs)
{
	struct weston_view_animation *animation =
		container_of(base,
			     struct weston_view_animation, animation);
	struct weston_compositor *compositor =
		animation->view->surface->compositor;

	if (base->frame_counter <= 1)
		animation->spring.timestamp = msecs;

	weston_spring_update(&animation->spring, msecs);

	if (weston_spring_done(&animation->spring)) {
		weston_view_schedule_repaint(animation->view);
		weston_view_animation_destroy(animation);
		return;
	}

	if (animation->frame)
		animation->frame(animation);

	weston_view_geometry_dirty(animation->view);
	weston_view_schedule_repaint(animation->view);

	/* The view's output_mask will be zero if its position is
	 * offscreen. Animations should always run but as they are also
	 * run off the repaint cycle, if there's nothing to repaint
	 * the animation stops running. Therefore if we catch this situation
	 * and schedule a repaint on all outputs it will be avoided.
	 */
	if (animation->view->output_mask == 0)
		weston_compositor_schedule_repaint(compositor);
}
Пример #7
0
static void
weston_surface_animation_frame(struct weston_animation *base,
			       struct weston_output *output, uint32_t msecs)
{
	struct weston_surface_animation *animation =
		container_of(base,
			     struct weston_surface_animation, animation);

	if (base->frame_counter <= 1)
		animation->spring.timestamp = msecs;

	weston_spring_update(&animation->spring, msecs);

	if (weston_spring_done(&animation->spring)) {
		weston_surface_animation_destroy(animation);
		return;
	}

	if (animation->frame)
		animation->frame(animation);

	weston_surface_geometry_dirty(animation->surface);
	weston_compositor_schedule_repaint(animation->surface->compositor);
}