OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/surfaces/display.h" | 5 #include "cc/surfaces/display.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 return false; | 86 return false; |
87 | 87 |
88 scoped_ptr<CompositorFrame> frame = | 88 scoped_ptr<CompositorFrame> frame = |
89 aggregator_->Aggregate(current_surface_id_); | 89 aggregator_->Aggregate(current_surface_id_); |
90 if (!frame) | 90 if (!frame) |
91 return false; | 91 return false; |
92 | 92 |
93 TRACE_EVENT0("cc", "Display::Draw"); | 93 TRACE_EVENT0("cc", "Display::Draw"); |
94 DelegatedFrameData* frame_data = frame->delegated_frame_data.get(); | 94 DelegatedFrameData* frame_data = frame->delegated_frame_data.get(); |
95 | 95 |
| 96 // Only reshape when we know we are going to draw. Otherwise, the reshape |
| 97 // can leave the window at the wrong size if we never draw and the proper |
| 98 // viewport size is never set. |
| 99 output_surface_->Reshape(current_surface_size_, 1.f); |
96 float device_scale_factor = 1.0f; | 100 float device_scale_factor = 1.0f; |
97 gfx::Rect device_viewport_rect = gfx::Rect(current_surface_size_); | 101 gfx::Rect device_viewport_rect = gfx::Rect(current_surface_size_); |
98 gfx::Rect device_clip_rect = device_viewport_rect; | 102 gfx::Rect device_clip_rect = device_viewport_rect; |
99 bool disable_picture_quad_image_filtering = false; | 103 bool disable_picture_quad_image_filtering = false; |
100 | 104 |
101 renderer_->DrawFrame(&frame_data->render_pass_list, | 105 renderer_->DrawFrame(&frame_data->render_pass_list, |
102 device_scale_factor, | 106 device_scale_factor, |
103 device_viewport_rect, | 107 device_viewport_rect, |
104 device_clip_rect, | 108 device_clip_rect, |
105 disable_picture_quad_image_filtering); | 109 disable_picture_quad_image_filtering); |
106 CompositorFrameMetadata metadata; | 110 CompositorFrameMetadata metadata; |
107 renderer_->SwapBuffers(metadata); | 111 renderer_->SwapBuffers(metadata); |
108 return true; | 112 return true; |
109 } | 113 } |
110 | 114 |
111 SurfaceId Display::CurrentSurfaceId() { | 115 SurfaceId Display::CurrentSurfaceId() { |
112 return current_surface_id_; | 116 return current_surface_id_; |
113 } | 117 } |
114 | 118 |
115 } // namespace cc | 119 } // namespace cc |
OLD | NEW |