OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "cc/output/software_renderer.h" | 5 #include "cc/output/software_renderer.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "cc/base/math_util.h" | 8 #include "cc/base/math_util.h" |
9 #include "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
10 #include "cc/output/compositor_frame_ack.h" | 10 #include "cc/output/compositor_frame_ack.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 current_canvas_(NULL) { | 61 current_canvas_(NULL) { |
62 if (resource_provider_) { | 62 if (resource_provider_) { |
63 capabilities_.max_texture_size = resource_provider_->max_texture_size(); | 63 capabilities_.max_texture_size = resource_provider_->max_texture_size(); |
64 capabilities_.best_texture_format = | 64 capabilities_.best_texture_format = |
65 resource_provider_->best_texture_format(); | 65 resource_provider_->best_texture_format(); |
66 } | 66 } |
67 capabilities_.using_set_visibility = true; | 67 capabilities_.using_set_visibility = true; |
68 // The updater can access bitmaps while the SoftwareRenderer is using them. | 68 // The updater can access bitmaps while the SoftwareRenderer is using them. |
69 capabilities_.allow_partial_texture_updates = true; | 69 capabilities_.allow_partial_texture_updates = true; |
70 capabilities_.using_partial_swap = true; | 70 capabilities_.using_partial_swap = true; |
71 if (Settings().compositor_frame_message && client_->HasImplThread()) | 71 if (client_->HasImplThread()) |
72 capabilities_.using_swap_complete_callback = true; | 72 capabilities_.using_swap_complete_callback = true; |
73 compositor_frame_.software_frame_data.reset(new SoftwareFrameData()); | 73 compositor_frame_.software_frame_data.reset(new SoftwareFrameData()); |
74 } | 74 } |
75 | 75 |
76 SoftwareRenderer::~SoftwareRenderer() {} | 76 SoftwareRenderer::~SoftwareRenderer() {} |
77 | 77 |
78 const RendererCapabilities& SoftwareRenderer::Capabilities() const { | 78 const RendererCapabilities& SoftwareRenderer::Capabilities() const { |
79 return capabilities_; | 79 return capabilities_; |
80 } | 80 } |
81 | 81 |
(...skipping 18 matching lines...) Expand all Loading... |
100 root_canvas_ = NULL; | 100 root_canvas_ = NULL; |
101 if (Settings().compositor_frame_message) { | 101 if (Settings().compositor_frame_message) { |
102 compositor_frame_.metadata = client_->MakeCompositorFrameMetadata(); | 102 compositor_frame_.metadata = client_->MakeCompositorFrameMetadata(); |
103 output_device_->EndPaint(compositor_frame_.software_frame_data.get()); | 103 output_device_->EndPaint(compositor_frame_.software_frame_data.get()); |
104 } else { | 104 } else { |
105 output_device_->EndPaint(NULL); | 105 output_device_->EndPaint(NULL); |
106 } | 106 } |
107 } | 107 } |
108 | 108 |
109 void SoftwareRenderer::SwapBuffers(const ui::LatencyInfo& latency_info) { | 109 void SoftwareRenderer::SwapBuffers(const ui::LatencyInfo& latency_info) { |
110 if (Settings().compositor_frame_message) | 110 if (Settings().compositor_frame_message) { |
111 output_surface_->SendFrameToParentCompositor(&compositor_frame_); | 111 output_surface_->SendFrameToParentCompositor(&compositor_frame_); |
| 112 } else { |
| 113 output_surface_->SwapBuffers(latency_info); |
| 114 } |
112 } | 115 } |
113 | 116 |
114 void SoftwareRenderer::ReceiveCompositorFrameAck( | 117 void SoftwareRenderer::ReceiveCompositorFrameAck( |
115 const CompositorFrameAck& ack) { | 118 const CompositorFrameAck& ack) { |
116 output_device_->ReclaimDIB(ack.last_dib_id); | 119 output_device_->ReclaimDIB(ack.last_dib_id); |
117 } | 120 } |
118 | 121 |
119 bool SoftwareRenderer::FlippedFramebuffer() const { | 122 bool SoftwareRenderer::FlippedFramebuffer() const { |
120 return false; | 123 return false; |
121 } | 124 } |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 4 * rect.width()); | 461 4 * rect.width()); |
459 } | 462 } |
460 | 463 |
461 void SoftwareRenderer::SetVisible(bool visible) { | 464 void SoftwareRenderer::SetVisible(bool visible) { |
462 if (visible_ == visible) | 465 if (visible_ == visible) |
463 return; | 466 return; |
464 visible_ = visible; | 467 visible_ = visible; |
465 } | 468 } |
466 | 469 |
467 } // namespace cc | 470 } // namespace cc |
OLD | NEW |