Chromium Code Reviews| Index: cc/surfaces/display.cc |
| diff --git a/cc/surfaces/display.cc b/cc/surfaces/display.cc |
| index a8ae27a6055f63c6b7f366c38881c4ec49435ae9..1a4ce76f175175dde22d3c21c7bcfe4fc1bab176 100644 |
| --- a/cc/surfaces/display.cc |
| +++ b/cc/surfaces/display.cc |
| @@ -49,15 +49,21 @@ bool Display::Initialize(scoped_ptr<OutputSurface> output_surface) { |
| return output_surface_->BindToClient(this); |
| } |
| -void Display::Resize(SurfaceId id, |
| - const gfx::Size& size, |
| - float device_scale_factor) { |
| +void Display::SetSurfaceId(SurfaceId id, float device_scale_factor) { |
| current_surface_id_ = id; |
| - current_surface_size_ = size; |
| device_scale_factor_ = device_scale_factor; |
| client_->DisplayDamaged(); |
| } |
| +void Display::Resize(const gfx::Size& size) { |
| + if (size == current_surface_size_) |
| + return; |
| + if (renderer_) |
| + renderer_->Finish(); |
|
jamesr
2014/12/02 00:04:17
add a comment here indicating why we need to finis
|
| + current_surface_size_ = size; |
| + client_->DisplayDamaged(); |
| +} |
| + |
| void Display::InitializeRenderer() { |
| if (resource_provider_) |
| return; |
| @@ -112,6 +118,10 @@ bool Display::Draw() { |
| benchmark_instrumentation::IssueDisplayRenderingStatsEvent(); |
| DelegatedFrameData* frame_data = frame->delegated_frame_data.get(); |
| + gfx::Size surface_size; |
| + if (!frame_data->render_pass_list.empty()) |
|
jamesr
2014/12/02 00:04:17
hmm, maybe Aggregate() should return a null frame
|
| + surface_size = frame_data->render_pass_list.back()->output_rect.size(); |
| + |
| gfx::Rect device_viewport_rect = gfx::Rect(current_surface_size_); |
| gfx::Rect device_clip_rect = device_viewport_rect; |
| bool disable_picture_quad_image_filtering = false; |
| @@ -122,7 +132,14 @@ bool Display::Draw() { |
| device_viewport_rect, |
| device_clip_rect, |
| disable_picture_quad_image_filtering); |
| - renderer_->SwapBuffers(frame->metadata); |
| + |
| + if (surface_size == current_surface_size_) { |
| + renderer_->SwapBuffers(frame->metadata); |
| + } else { |
| + DidSwapBuffers(); |
| + DidSwapBuffersComplete(); |
|
piman
2014/12/01 23:42:09
Do we need to respect order wrt surface callbacks
|
| + } |
| + |
| for (SurfaceAggregator::SurfaceIndexMap::iterator it = |
| aggregator_->previous_contained_surfaces().begin(); |
| it != aggregator_->previous_contained_surfaces().end(); |