Auto merge of #6822 - pcwalton:tick-animations-more-often, r=glennw

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 -->
This commit is contained in:
bors-servo 2015-07-29 08:40:42 -06:00
commit 416931f4be

View file

@ -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 => {
@ -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