OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "services/ui/ws/frame_generator.h" | 5 #include "services/ui/ws/frame_generator.h" |
6 | 6 |
7 #include "base/containers/adapters.h" | 7 #include "base/containers/adapters.h" |
8 #include "cc/output/compositor_frame.h" | 8 #include "cc/output/compositor_frame.h" |
9 #include "cc/quads/render_pass.h" | 9 #include "cc/quads/render_pass.h" |
10 #include "cc/quads/render_pass_draw_quad.h" | 10 #include "cc/quads/render_pass_draw_quad.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 draw_timer_.Start( | 77 draw_timer_.Start( |
78 FROM_HERE, base::TimeDelta(), | 78 FROM_HERE, base::TimeDelta(), |
79 base::Bind(&FrameGenerator::Draw, weak_factory_.GetWeakPtr())); | 79 base::Bind(&FrameGenerator::Draw, weak_factory_.GetWeakPtr())); |
80 } | 80 } |
81 | 81 |
82 void FrameGenerator::Draw() { | 82 void FrameGenerator::Draw() { |
83 if (!delegate_->GetRootWindow()->visible()) | 83 if (!delegate_->GetRootWindow()->visible()) |
84 return; | 84 return; |
85 | 85 |
86 const ViewportMetrics& metrics = delegate_->GetViewportMetrics(); | 86 const ViewportMetrics& metrics = delegate_->GetViewportMetrics(); |
87 const gfx::Rect output_rect(metrics.bounds.size()); | 87 const gfx::Rect output_rect(metrics.pixel_size); |
88 dirty_rect_.Intersect(output_rect); | 88 dirty_rect_.Intersect(output_rect); |
89 // TODO(fsamuel): We should add a trace for generating a top level frame. | 89 // TODO(fsamuel): We should add a trace for generating a top level frame. |
90 cc::CompositorFrame frame(GenerateCompositorFrame(output_rect)); | 90 cc::CompositorFrame frame(GenerateCompositorFrame(output_rect)); |
91 if (frame.metadata.may_contain_video != may_contain_video_) { | 91 if (frame.metadata.may_contain_video != may_contain_video_) { |
92 may_contain_video_ = frame.metadata.may_contain_video; | 92 may_contain_video_ = frame.metadata.may_contain_video; |
93 // TODO(sad): Schedule notifying observers. | 93 // TODO(sad): Schedule notifying observers. |
94 if (may_contain_video_) { | 94 if (may_contain_video_) { |
95 // TODO(sad): Start a timer to reset the bit if no new frame with video | 95 // TODO(sad): Start a timer to reset the bit if no new frame with video |
96 // is submitted 'soon'. | 96 // is submitted 'soon'. |
97 } | 97 } |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 gfx::Rect() /* opaque_rect */, | 227 gfx::Rect() /* opaque_rect */, |
228 bounds_at_origin /* visible_rect */, true /* needs_blending*/, | 228 bounds_at_origin /* visible_rect */, true /* needs_blending*/, |
229 underlay_surface->id()); | 229 underlay_surface->id()); |
230 DCHECK(!underlay_surface->may_contain_video()); | 230 DCHECK(!underlay_surface->may_contain_video()); |
231 } | 231 } |
232 } | 232 } |
233 | 233 |
234 } // namespace ws | 234 } // namespace ws |
235 | 235 |
236 } // namespace ui | 236 } // namespace ui |
OLD | NEW |