mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
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:
commit
416931f4be
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