| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 draw_timer_.Start( | 63 draw_timer_.Start( |
| 64 FROM_HERE, base::TimeDelta(), | 64 FROM_HERE, base::TimeDelta(), |
| 65 base::Bind(&FrameGenerator::Draw, weak_factory_.GetWeakPtr())); | 65 base::Bind(&FrameGenerator::Draw, weak_factory_.GetWeakPtr())); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void FrameGenerator::Draw() { | 68 void FrameGenerator::Draw() { |
| 69 if (!delegate_->GetRootWindow()->visible()) | 69 if (!delegate_->GetRootWindow()->visible()) |
| 70 return; | 70 return; |
| 71 | 71 |
| 72 const ViewportMetrics& metrics = delegate_->GetViewportMetrics(); | 72 const ViewportMetrics& metrics = delegate_->GetViewportMetrics(); |
| 73 const gfx::Rect& output_rect = metrics.bounds; | 73 const gfx::Rect output_rect(metrics.bounds.size()); |
| 74 dirty_rect_.Intersect(output_rect); | 74 dirty_rect_.Intersect(output_rect); |
| 75 // TODO(fsamuel): We should add a trace for generating a top level frame. | 75 // TODO(fsamuel): We should add a trace for generating a top level frame. |
| 76 cc::CompositorFrame frame(GenerateCompositorFrame(output_rect)); | 76 cc::CompositorFrame frame(GenerateCompositorFrame(output_rect)); |
| 77 if (frame.metadata.may_contain_video != may_contain_video_) { | 77 if (frame.metadata.may_contain_video != may_contain_video_) { |
| 78 may_contain_video_ = frame.metadata.may_contain_video; | 78 may_contain_video_ = frame.metadata.may_contain_video; |
| 79 // TODO(sad): Schedule notifying observers. | 79 // TODO(sad): Schedule notifying observers. |
| 80 if (may_contain_video_) { | 80 if (may_contain_video_) { |
| 81 // TODO(sad): Start a timer to reset the bit if no new frame with video | 81 // TODO(sad): Start a timer to reset the bit if no new frame with video |
| 82 // is submitted 'soon'. | 82 // is submitted 'soon'. |
| 83 } | 83 } |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 gfx::Rect() /* opaque_rect */, | 212 gfx::Rect() /* opaque_rect */, |
| 213 bounds_at_origin /* visible_rect */, true /* needs_blending*/, | 213 bounds_at_origin /* visible_rect */, true /* needs_blending*/, |
| 214 underlay_surface->id()); | 214 underlay_surface->id()); |
| 215 DCHECK(!underlay_surface->may_contain_video()); | 215 DCHECK(!underlay_surface->may_contain_video()); |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace ws | 219 } // namespace ws |
| 220 | 220 |
| 221 } // namespace ui | 221 } // namespace ui |
| OLD | NEW |