mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
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.
This commit is contained in:
parent
4bc1db3fe8
commit
1094b30627
1 changed files with 11 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue