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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 cc::CompositorFrame frame(GenerateCompositorFrame()); | 76 cc::CompositorFrame frame(GenerateCompositorFrame()); |
77 frame_pending_ = true; | 77 frame_pending_ = true; |
78 if (display_compositor_) { | 78 if (display_compositor_) { |
79 display_compositor_->SubmitCompositorFrame( | 79 display_compositor_->SubmitCompositorFrame( |
80 std::move(frame), | 80 std::move(frame), |
81 base::Bind(&FrameGenerator::DidDraw, weak_factory_.GetWeakPtr())); | 81 base::Bind(&FrameGenerator::DidDraw, weak_factory_.GetWeakPtr())); |
82 } | 82 } |
83 dirty_rect_ = gfx::Rect(); | 83 dirty_rect_ = gfx::Rect(); |
84 } | 84 } |
85 | 85 |
86 void FrameGenerator::DidDraw(cc::SurfaceDrawStatus status) { | 86 void FrameGenerator::DidDraw() { |
87 frame_pending_ = false; | 87 frame_pending_ = false; |
88 delegate_->OnCompositorFrameDrawn(); | 88 delegate_->OnCompositorFrameDrawn(); |
89 if (!dirty_rect_.IsEmpty()) | 89 if (!dirty_rect_.IsEmpty()) |
90 WantToDraw(); | 90 WantToDraw(); |
91 } | 91 } |
92 | 92 |
93 cc::CompositorFrame FrameGenerator::GenerateCompositorFrame() { | 93 cc::CompositorFrame FrameGenerator::GenerateCompositorFrame() { |
94 const ViewportMetrics& metrics = delegate_->GetViewportMetrics(); | 94 const ViewportMetrics& metrics = delegate_->GetViewportMetrics(); |
95 std::unique_ptr<cc::RenderPass> render_pass = cc::RenderPass::Create(); | 95 std::unique_ptr<cc::RenderPass> render_pass = cc::RenderPass::Create(); |
96 gfx::Rect output_rect(metrics.size_in_pixels); | 96 gfx::Rect output_rect(metrics.size_in_pixels); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 quad->SetAll(sqs, bounds_at_origin /* rect */, | 200 quad->SetAll(sqs, bounds_at_origin /* rect */, |
201 gfx::Rect() /* opaque_rect */, | 201 gfx::Rect() /* opaque_rect */, |
202 bounds_at_origin /* visible_rect */, true /* needs_blending*/, | 202 bounds_at_origin /* visible_rect */, true /* needs_blending*/, |
203 underlay_surface->id()); | 203 underlay_surface->id()); |
204 } | 204 } |
205 } | 205 } |
206 | 206 |
207 } // namespace ws | 207 } // namespace ws |
208 | 208 |
209 } // namespace ui | 209 } // namespace ui |
OLD | NEW |