Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "mojo/cc/output_surface_mojo.h" | |
| 6 | |
| 7 #include "cc/output/compositor_frame.h" | |
| 8 #include "cc/output/output_surface_client.h" | |
| 9 #include "mojo/services/public/cpp/geometry/geometry_type_converters.h" | |
| 10 #include "mojo/services/public/cpp/surfaces/surfaces_type_converters.h" | |
| 11 | |
| 12 namespace mojo { | |
| 13 | |
| 14 OutputSurfaceMojo::OutputSurfaceMojo( | |
| 15 const scoped_refptr<cc::ContextProvider>& context_provider, | |
| 16 SurfacePtr surface, | |
| 17 uint32_t id_namespace) | |
| 18 : cc::OutputSurface(context_provider), | |
| 19 surface_(surface.Pass()), | |
| 20 id_allocator_(id_namespace) { | |
| 21 surface_.set_client(this); | |
| 22 } | |
| 23 | |
| 24 OutputSurfaceMojo::~OutputSurfaceMojo() { | |
| 25 } | |
| 26 | |
| 27 void OutputSurfaceMojo::ReturnResources(Array<ReturnedResourcePtr> resources) { | |
| 28 } | |
| 29 | |
| 30 void OutputSurfaceMojo::SwapBuffers(cc::CompositorFrame* frame) { | |
| 31 gfx::Size frame_size = | |
| 32 frame->delegated_frame_data->render_pass_list.back()->output_rect.size(); | |
| 33 if (frame_size != surface_size_) { | |
| 34 if (!surface_id_.is_null()) { | |
| 35 surface_->DestroySurface(SurfaceId::From(surface_id_)); | |
| 36 } | |
| 37 surface_id_ = id_allocator_.GenerateId(); | |
| 38 surface_->CreateSurface(SurfaceId::From(surface_id_), | |
| 39 Size::From(frame_size)); | |
| 40 surface_size_ = frame_size; | |
| 41 } | |
| 42 | |
| 43 surface_->SubmitFrame(SurfaceId::From(surface_id_), Frame::From(*frame)); | |
| 44 | |
| 45 client_->DidSwapBuffers(); | |
| 46 client_->DidSwapBuffersComplete(); | |
| 47 } | |
| 48 } | |
|
sky
2014/08/22 22:20:09
nit: newline between 47/48 and // namespace mojo
| |
| OLD | NEW |