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 "mojo/gpu/gl_context.h" | 5 #include "mojo/gpu/gl_context.h" |
6 | 6 |
7 #include "mojo/public/cpp/application/connect.h" | 7 #include "mojo/public/cpp/application/connect.h" |
8 #include "mojo/public/interfaces/application/application_connector.mojom.h" | 8 #include "mojo/public/interfaces/application/application_connector.mojom.h" |
9 #include "mojo/services/gpu/interfaces/gpu.mojom.h" | 9 #include "mojo/services/gpu/interfaces/gpu.mojom.h" |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 } | 22 } |
23 | 23 |
24 GLContext::~GLContext() { | 24 GLContext::~GLContext() { |
25 MGLDestroyContext(mgl_context_); | 25 MGLDestroyContext(mgl_context_); |
26 } | 26 } |
27 | 27 |
28 scoped_refptr<GLContext> GLContext::CreateOffscreen( | 28 scoped_refptr<GLContext> GLContext::CreateOffscreen( |
29 ApplicationConnector* connector) { | 29 ApplicationConnector* connector) { |
30 ServiceProviderPtr native_viewport; | 30 ServiceProviderPtr native_viewport; |
31 connector->ConnectToApplication("mojo:native_viewport_service", | 31 connector->ConnectToApplication("mojo:native_viewport_service", |
32 GetProxy(&native_viewport), nullptr); | 32 GetProxy(&native_viewport)); |
33 GpuPtr gpu_service; | 33 GpuPtr gpu_service; |
34 ConnectToService(native_viewport.get(), GetProxy(&gpu_service)); | 34 ConnectToService(native_viewport.get(), GetProxy(&gpu_service)); |
35 InterfaceHandle<CommandBuffer> command_buffer; | 35 InterfaceHandle<CommandBuffer> command_buffer; |
36 gpu_service->CreateOffscreenGLES2Context(GetProxy(&command_buffer)); | 36 gpu_service->CreateOffscreenGLES2Context(GetProxy(&command_buffer)); |
37 return new GLContext(command_buffer.Pass()); | 37 return new GLContext(command_buffer.Pass()); |
38 } | 38 } |
39 | 39 |
40 scoped_refptr<GLContext> GLContext::CreateFromCommandBuffer( | 40 scoped_refptr<GLContext> GLContext::CreateFromCommandBuffer( |
41 InterfaceHandle<CommandBuffer> command_buffer) { | 41 InterfaceHandle<CommandBuffer> command_buffer) { |
42 return new GLContext(command_buffer.Pass()); | 42 return new GLContext(command_buffer.Pass()); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 GLContext::Scope::~Scope() { | 78 GLContext::Scope::~Scope() { |
79 DCHECK(gl_context_->IsCurrent()); | 79 DCHECK(gl_context_->IsCurrent()); |
80 | 80 |
81 MGLMakeCurrent(prior_mgl_context_); | 81 MGLMakeCurrent(prior_mgl_context_); |
82 } | 82 } |
83 | 83 |
84 GLContext::Observer::~Observer() {} | 84 GLContext::Observer::~Observer() {} |
85 | 85 |
86 } // namespace mojo | 86 } // namespace mojo |
OLD | NEW |