| 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 "services/native_viewport/viewport_surface.h" | 5 #include "services/native_viewport/viewport_surface.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "mojo/converters/geometry/geometry_type_converters.h" | 8 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 9 #include "mojo/converters/surfaces/surfaces_type_converters.h" | 9 #include "mojo/converters/surfaces/surfaces_type_converters.h" |
| 10 #include "mojo/services/surfaces/public/cpp/surfaces_utils.h" | 10 #include "mojo/services/surfaces/public/cpp/surfaces_utils.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 if (widget_id_) | 50 if (widget_id_) |
| 51 BindSurfaceToNativeViewport(); | 51 BindSurfaceToNativeViewport(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void ViewportSurface::SetChildId(cc::SurfaceId child_id) { | 54 void ViewportSurface::SetChildId(cc::SurfaceId child_id) { |
| 55 child_id_ = child_id; | 55 child_id_ = child_id; |
| 56 SubmitFrame(); | 56 SubmitFrame(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void ViewportSurface::BindSurfaceToNativeViewport() { | 59 void ViewportSurface::BindSurfaceToNativeViewport() { |
| 60 /* |
| 60 mojo::ViewportParameterListenerPtr listener; | 61 mojo::ViewportParameterListenerPtr listener; |
| 61 auto listener_request = GetProxy(&listener); | 62 auto listener_request = GetProxy(&listener); |
| 62 mojo::CommandBufferPtr command_buffer; | 63 mojo::CommandBufferPtr command_buffer; |
| 63 gpu_service_->CreateOnscreenGLES2Context(widget_id_, Size::From(size_), | 64 gpu_service_->CreateOnscreenGLES2Context(widget_id_, Size::From(size_), |
| 64 GetProxy(&command_buffer), | 65 GetProxy(&command_buffer), |
| 65 listener.Pass()); | 66 listener.Pass()); |
| 66 | 67 |
| 67 gles2_bound_surface_created_ = true; | 68 gles2_bound_surface_created_ = true; |
| 68 surface_->CreateGLES2BoundSurface(command_buffer.Pass(), | 69 surface_->CreateGLES2BoundSurface(command_buffer.Pass(), |
| 69 kGLES2BoundSurfaceLocalId, | 70 kGLES2BoundSurfaceLocalId, |
| 70 Size::From(size_), listener_request.Pass()); | 71 Size::From(size_), listener_request.Pass()); |
| 71 | 72 |
| 72 SubmitFrame(); | 73 SubmitFrame(); |
| 74 */ |
| 73 } | 75 } |
| 74 | 76 |
| 75 void ViewportSurface::SubmitFrame() { | 77 void ViewportSurface::SubmitFrame() { |
| 76 if (child_id_.is_null() || !gles2_bound_surface_created_) | 78 if (child_id_.is_null() || !gles2_bound_surface_created_) |
| 77 return; | 79 return; |
| 78 | 80 |
| 79 auto surface_quad_state = mojo::SurfaceQuadState::New(); | 81 auto surface_quad_state = mojo::SurfaceQuadState::New(); |
| 80 surface_quad_state->surface = SurfaceId::From(child_id_); | 82 surface_quad_state->surface = SurfaceId::From(child_id_); |
| 81 | 83 |
| 82 gfx::Rect bounds(size_); | 84 gfx::Rect bounds(size_); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 97 *mojo::Size::From(size_))); | 99 *mojo::Size::From(size_))); |
| 98 | 100 |
| 99 auto frame = mojo::Frame::New(); | 101 auto frame = mojo::Frame::New(); |
| 100 frame->passes.push_back(pass.Pass()); | 102 frame->passes.push_back(pass.Pass()); |
| 101 frame->resources.resize(0u); | 103 frame->resources.resize(0u); |
| 102 surface_->SubmitFrame(kGLES2BoundSurfaceLocalId, frame.Pass(), | 104 surface_->SubmitFrame(kGLES2BoundSurfaceLocalId, frame.Pass(), |
| 103 mojo::Closure()); | 105 mojo::Closure()); |
| 104 } | 106 } |
| 105 | 107 |
| 106 } // namespace native_viewport | 108 } // namespace native_viewport |
| OLD | NEW |