Skip to content

Commit

Permalink
Auto merge of #6822 - pcwalton:tick-animations-more-often, r=glennw
Browse files Browse the repository at this point in the history
compositing: Tick animations right away when content enables animations.

Otherwise, we have to wait for the next vsync. This was capping the
framerate of the particles demo at 30 FPS in most cases.

r? @glennw

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6822)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Jul 29, 2015
2 parents e74a13c + 1094b30 commit 416931f
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions components/compositing/compositor.rs
Expand Up @@ -530,7 +530,12 @@ impl<Window: WindowMethods> IOCompositor<Window> {
self.composite_if_necessary(CompositingReason::Animation);
}
AnimationState::AnimationCallbacksPresent => {
self.get_or_create_pipeline_details(pipeline_id).animation_callbacks_running = true;
if self.get_or_create_pipeline_details(pipeline_id).animation_callbacks_running {
return
}
self.get_or_create_pipeline_details(pipeline_id).animation_callbacks_running =
true;
self.tick_animations_for_pipeline(pipeline_id);
self.composite_if_necessary(CompositingReason::Animation);
}
AnimationState::NoAnimationsPresent => {
Expand Down Expand Up @@ -1072,13 +1077,15 @@ impl<Window: WindowMethods> IOCompositor<Window> {
for (pipeline_id, pipeline_details) in self.pipeline_details.iter() {
if pipeline_details.animations_running ||
pipeline_details.animation_callbacks_running {

self.constellation_chan.0.send(ConstellationMsg::TickAnimation(*pipeline_id))
.unwrap();
self.tick_animations_for_pipeline(*pipeline_id)
}
}
}

fn tick_animations_for_pipeline(&self, pipeline_id: PipelineId) {
self.constellation_chan.0.send(ConstellationMsg::TickAnimation(pipeline_id)).unwrap()
}

fn constrain_viewport(&mut self, pipeline_id: PipelineId, constraints: ViewportConstraints) {
let is_root = self.root_pipeline.as_ref().map_or(false, |root_pipeline| {
root_pipeline.id == pipeline_id
Expand Down

0 comments on commit 416931f

Please sign in to comment.