OLD | NEW |
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 "mojo/examples/sample_app/gles2_client_impl.h" | 8 #include "mojo/examples/sample_app/gles2_client_impl.h" |
9 #include "mojo/public/c/system/main.h" | 9 #include "mojo/public/c/system/main.h" |
10 #include "mojo/public/cpp/application/application_connection.h" | 10 #include "mojo/public/cpp/application/application_connection.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 rect->height = 600; | 43 rect->height = 600; |
44 viewport_->Create(rect.Pass()); | 44 viewport_->Create(rect.Pass()); |
45 viewport_->Show(); | 45 viewport_->Show(); |
46 } | 46 } |
47 | 47 |
48 virtual void OnCreated(uint64_t native_viewport_id) MOJO_OVERRIDE { | 48 virtual void OnCreated(uint64_t native_viewport_id) MOJO_OVERRIDE { |
49 mojo::SizePtr size = mojo::Size::New(); | 49 mojo::SizePtr size = mojo::Size::New(); |
50 size->width = 800; | 50 size->width = 800; |
51 size->height = 600; | 51 size->height = 600; |
52 mojo::CommandBufferPtr command_buffer; | 52 mojo::CommandBufferPtr command_buffer; |
| 53 // TODO(jamesr): Output to a surface instead. |
53 gpu_service_->CreateOnscreenGLES2Context( | 54 gpu_service_->CreateOnscreenGLES2Context( |
54 native_viewport_id, size.Pass(), Get(&command_buffer)); | 55 native_viewport_id, size.Pass(), Get(&command_buffer)); |
55 gles2_client_.reset(new GLES2ClientImpl(command_buffer.Pass())); | 56 gles2_client_.reset(new GLES2ClientImpl(command_buffer.Pass())); |
56 } | 57 } |
57 | 58 |
58 virtual void OnDestroyed() MOJO_OVERRIDE { mojo::RunLoop::current()->Quit(); } | 59 virtual void OnDestroyed() MOJO_OVERRIDE { mojo::RunLoop::current()->Quit(); } |
59 | 60 |
60 virtual void OnBoundsChanged(mojo::RectPtr bounds) MOJO_OVERRIDE { | 61 virtual void OnBoundsChanged(mojo::RectPtr bounds) MOJO_OVERRIDE { |
61 assert(bounds); | 62 assert(bounds); |
62 mojo::SizePtr size(mojo::Size::New()); | 63 mojo::SizePtr size(mojo::Size::New()); |
(...skipping 18 matching lines...) Expand all Loading... |
81 | 82 |
82 DISALLOW_COPY_AND_ASSIGN(SampleApp); | 83 DISALLOW_COPY_AND_ASSIGN(SampleApp); |
83 }; | 84 }; |
84 | 85 |
85 } // namespace examples | 86 } // namespace examples |
86 | 87 |
87 MojoResult MojoMain(MojoHandle shell_handle) { | 88 MojoResult MojoMain(MojoHandle shell_handle) { |
88 mojo::ApplicationRunner runner(new examples::SampleApp); | 89 mojo::ApplicationRunner runner(new examples::SampleApp); |
89 return runner.Run(shell_handle); | 90 return runner.Run(shell_handle); |
90 } | 91 } |
OLD | NEW |