| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // This is a test application for gl_helper.*, which draws directly to a native | 5 // This is a test application for gl_helper.*, which draws directly to a native |
| 6 // viewport (without using the view manager). | 6 // viewport (without using the view manager). |
| 7 | 7 |
| 8 #include <GLES2/gl2.h> | 8 #include <GLES2/gl2.h> |
| 9 #include <math.h> | 9 #include <math.h> |
| 10 | 10 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 // |mojo::ApplicationDelegate|: | 211 // |mojo::ApplicationDelegate|: |
| 212 void Initialize(mojo::ApplicationImpl* application_impl) override { | 212 void Initialize(mojo::ApplicationImpl* application_impl) override { |
| 213 DCHECK(!application_impl_); | 213 DCHECK(!application_impl_); |
| 214 application_impl_ = application_impl; | 214 application_impl_ = application_impl; |
| 215 | 215 |
| 216 application_impl->ConnectToService("mojo:native_viewport_service", | 216 application_impl->ConnectToService("mojo:native_viewport_service", |
| 217 &native_viewport_); | 217 &native_viewport_); |
| 218 viewport_size_.width = 800; | 218 viewport_size_.width = 800; |
| 219 viewport_size_.height = 600; | 219 viewport_size_.height = 600; |
| 220 native_viewport_->Create( | 220 native_viewport_->Create( |
| 221 viewport_size_.Clone(), | 221 viewport_size_.Clone(), mojo::SurfaceConfiguration::New(), |
| 222 base::Bind(&GlHelperExampleApp::OnViewportMetricsReceived, | 222 base::Bind(&GlHelperExampleApp::OnViewportMetricsReceived, |
| 223 base::Unretained(this))); | 223 base::Unretained(this))); |
| 224 native_viewport_->Show(); | 224 native_viewport_->Show(); |
| 225 | 225 |
| 226 mojo::ContextProviderPtr context_provider; | 226 mojo::ContextProviderPtr context_provider; |
| 227 native_viewport_->GetContextProvider(GetProxy(&context_provider)); | 227 native_viewport_->GetContextProvider(GetProxy(&context_provider)); |
| 228 | 228 |
| 229 mojo::DisplayFactoryPtr display_factory; | 229 mojo::DisplayFactoryPtr display_factory; |
| 230 application_impl_->ConnectToService("mojo:surfaces_service", | 230 application_impl_->ConnectToService("mojo:surfaces_service", |
| 231 &display_factory); | 231 &display_factory); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 }; | 270 }; |
| 271 | 271 |
| 272 const GLuint GlHelperExampleApp::kPositionLocation; | 272 const GLuint GlHelperExampleApp::kPositionLocation; |
| 273 | 273 |
| 274 } // namespace | 274 } // namespace |
| 275 | 275 |
| 276 MojoResult MojoMain(MojoHandle application_request) { | 276 MojoResult MojoMain(MojoHandle application_request) { |
| 277 mojo::ApplicationRunnerChromium runner(new GlHelperExampleApp()); | 277 mojo::ApplicationRunnerChromium runner(new GlHelperExampleApp()); |
| 278 return runner.Run(application_request); | 278 return runner.Run(application_request); |
| 279 } | 279 } |
| OLD | NEW |