Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1178)

Side by Side Diff: examples/spinning_cube/spinning_cube_app.cc

Issue 1168993002: Update the native_viewport interface to allow specification of the surface configuration, currently… (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Final cleanups Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « apps/moterm/gl_helper_test_app.cc ('k') | examples/surfaces_app/surfaces_app.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stdio.h> 5 #include <stdio.h>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "examples/spinning_cube/gles2_client_impl.h" 10 #include "examples/spinning_cube/gles2_client_impl.h"
(...skipping 23 matching lines...) Expand all
34 34
35 void Initialize(mojo::ApplicationImpl* app) override { 35 void Initialize(mojo::ApplicationImpl* app) override {
36 app->ConnectToService("mojo:native_viewport_service", &viewport_); 36 app->ConnectToService("mojo:native_viewport_service", &viewport_);
37 viewport_.set_error_handler(this); 37 viewport_.set_error_handler(this);
38 38
39 SetEventDispatcher(); 39 SetEventDispatcher();
40 40
41 mojo::SizePtr size(mojo::Size::New()); 41 mojo::SizePtr size(mojo::Size::New());
42 size->width = 800; 42 size->width = 800;
43 size->height = 600; 43 size->height = 600;
44
45 auto requested_configuration = mojo::SurfaceConfiguration::New();
46 requested_configuration->depth_bits = 16;
47
44 viewport_->Create( 48 viewport_->Create(
45 size.Clone(), 49 size.Clone(),
50 requested_configuration.Pass(),
46 base::Bind(&SpinningCubeApp::OnMetricsChanged, base::Unretained(this))); 51 base::Bind(&SpinningCubeApp::OnMetricsChanged, base::Unretained(this)));
47 viewport_->Show(); 52 viewport_->Show();
48 mojo::ContextProviderPtr onscreen_context_provider; 53 mojo::ContextProviderPtr onscreen_context_provider;
49 viewport_->GetContextProvider(GetProxy(&onscreen_context_provider)); 54 viewport_->GetContextProvider(GetProxy(&onscreen_context_provider));
50 55
51 gles2_client_.reset(new GLES2ClientImpl(onscreen_context_provider.Pass())); 56 gles2_client_.reset(new GLES2ClientImpl(onscreen_context_provider.Pass()));
52 gles2_client_->SetSize(*size); 57 gles2_client_->SetSize(*size);
53 } 58 }
54 59
55 void OnMetricsChanged(mojo::ViewportMetricsPtr metrics) { 60 void OnMetricsChanged(mojo::ViewportMetricsPtr metrics) {
(...skipping 28 matching lines...) Expand all
84 89
85 DISALLOW_COPY_AND_ASSIGN(SpinningCubeApp); 90 DISALLOW_COPY_AND_ASSIGN(SpinningCubeApp);
86 }; 91 };
87 92
88 } // namespace examples 93 } // namespace examples
89 94
90 MojoResult MojoMain(MojoHandle application_request) { 95 MojoResult MojoMain(MojoHandle application_request) {
91 mojo::ApplicationRunner runner(new examples::SpinningCubeApp); 96 mojo::ApplicationRunner runner(new examples::SpinningCubeApp);
92 return runner.Run(application_request); 97 return runner.Run(application_request);
93 } 98 }
OLDNEW
« no previous file with comments | « apps/moterm/gl_helper_test_app.cc ('k') | examples/surfaces_app/surfaces_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698