| 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/surface_display_output_surface.h" | 5 #include "cc/surfaces/surface_display_output_surface.h" |
| 6 | 6 |
| 7 #include "cc/output/compositor_frame.h" | 7 #include "cc/output/compositor_frame.h" |
| 8 #include "cc/output/compositor_frame_ack.h" | 8 #include "cc/output/compositor_frame_ack.h" |
| 9 #include "cc/surfaces/display.h" | 9 #include "cc/surfaces/display.h" |
| 10 #include "cc/surfaces/onscreen_display_client.h" | 10 #include "cc/surfaces/onscreen_display_client.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 void SurfaceDisplayOutputSurface::ReceivedVSyncParameters( | 40 void SurfaceDisplayOutputSurface::ReceivedVSyncParameters( |
| 41 base::TimeTicks timebase, | 41 base::TimeTicks timebase, |
| 42 base::TimeDelta interval) { | 42 base::TimeDelta interval) { |
| 43 CommitVSyncParameters(timebase, interval); | 43 CommitVSyncParameters(timebase, interval); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void SurfaceDisplayOutputSurface::SwapBuffers(CompositorFrame* frame) { | 46 void SurfaceDisplayOutputSurface::SwapBuffers(CompositorFrame* frame) { |
| 47 gfx::Size frame_size = | 47 gfx::Size frame_size = |
| 48 frame->delegated_frame_data->render_pass_list.back()->output_rect.size(); | 48 frame->delegated_frame_data->render_pass_list.back()->output_rect.size(); |
| 49 if (frame_size != display_size_) { | 49 if (frame_size.IsEmpty() || frame_size != display_size_) { |
| 50 if (!surface_id_.is_null()) { | 50 if (!surface_id_.is_null()) { |
| 51 factory_.Destroy(surface_id_); | 51 factory_.Destroy(surface_id_); |
| 52 } | 52 } |
| 53 surface_id_ = allocator_->GenerateId(); | 53 surface_id_ = allocator_->GenerateId(); |
| 54 factory_.Create(surface_id_); | 54 factory_.Create(surface_id_); |
| 55 display_size_ = frame_size; | 55 display_size_ = frame_size; |
| 56 } | 56 } |
| 57 display_client_->display()->SetSurfaceId(surface_id_, | 57 display_client_->display()->SetSurfaceId(surface_id_, |
| 58 frame->metadata.device_scale_factor); | 58 frame->metadata.device_scale_factor); |
| 59 | 59 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 if (client_) | 92 if (client_) |
| 93 client_->ReclaimResources(&ack); | 93 client_->ReclaimResources(&ack); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void SurfaceDisplayOutputSurface::SwapBuffersComplete(SurfaceDrawStatus drawn) { | 96 void SurfaceDisplayOutputSurface::SwapBuffersComplete(SurfaceDrawStatus drawn) { |
| 97 if (client_ && !display_client_->output_surface_lost()) | 97 if (client_ && !display_client_->output_surface_lost()) |
| 98 client_->DidSwapBuffersComplete(); | 98 client_->DidSwapBuffersComplete(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace cc | 101 } // namespace cc |
| OLD | NEW |