| 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/bindings/lib/remote_ptr.h" | 9 #include "mojo/public/bindings/lib/remote_ptr.h" |
| 10 #include "mojo/public/environment/environment.h" | 10 #include "mojo/public/environment/environment.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 : viewport_(viewport_handle.Pass(), this) { | 50 : viewport_(viewport_handle.Pass(), this) { |
| 51 viewport_->Open(); | 51 viewport_->Open(); |
| 52 | 52 |
| 53 MessagePipe pipe; | 53 MessagePipe pipe; |
| 54 gles2_client_.reset(new GLES2ClientImpl(pipe.handle0.Pass())); | 54 gles2_client_.reset(new GLES2ClientImpl(pipe.handle0.Pass())); |
| 55 viewport_->CreateGLES2Context(pipe.handle1.Pass()); | 55 viewport_->CreateGLES2Context(pipe.handle1.Pass()); |
| 56 } | 56 } |
| 57 | 57 |
| 58 virtual ~NativeViewportClientImpl() {} | 58 virtual ~NativeViewportClientImpl() {} |
| 59 | 59 |
| 60 virtual void OnCreated() MOJO_OVERRIDE { | 60 virtual void OnCreated(uint32_t width, uint32_t height) MOJO_OVERRIDE { |
| 61 gles2_client_->SetSize(gfx::Size(width, height)); |
| 61 } | 62 } |
| 62 | 63 |
| 63 virtual void OnDestroyed() MOJO_OVERRIDE { | 64 virtual void OnDestroyed() MOJO_OVERRIDE { |
| 64 RunLoop::current()->Quit(); | 65 RunLoop::current()->Quit(); |
| 65 } | 66 } |
| 66 | 67 |
| 67 virtual void OnEvent(const Event& event) MOJO_OVERRIDE { | 68 virtual void OnEvent(const Event& event) MOJO_OVERRIDE { |
| 68 if (!event.location().is_null()) { | 69 if (!event.location().is_null()) { |
| 69 gles2_client_->HandleInputEvent(event); | 70 gles2_client_->HandleInputEvent(event); |
| 70 viewport_->AckEvent(event); | 71 viewport_->AckEvent(event); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 87 mojo::Environment env; | 88 mojo::Environment env; |
| 88 mojo::RunLoop loop; | 89 mojo::RunLoop loop; |
| 89 mojo::GLES2Initializer gles2; | 90 mojo::GLES2Initializer gles2; |
| 90 | 91 |
| 91 mojo::examples::SampleApp app( | 92 mojo::examples::SampleApp app( |
| 92 mojo::MakeScopedHandle(mojo::MessagePipeHandle(shell_handle)).Pass()); | 93 mojo::MakeScopedHandle(mojo::MessagePipeHandle(shell_handle)).Pass()); |
| 93 loop.Run(); | 94 loop.Run(); |
| 94 | 95 |
| 95 return MOJO_RESULT_OK; | 96 return MOJO_RESULT_OK; |
| 96 } | 97 } |
| OLD | NEW |