OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "gpu/demos/framework/window.h" | 5 #include "gpu/demos/framework/window.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "gpu/command_buffer/client/gles2_implementation.h" | 8 #include "gpu/command_buffer/client/gles2_implementation.h" |
9 #include "gpu/command_buffer/client/gles2_lib.h" | 9 #include "gpu/command_buffer/client/gles2_lib.h" |
10 #include "gpu/command_buffer/service/command_buffer_service.h" | 10 #include "gpu/command_buffer/service/command_buffer_service.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 Window::~Window() { | 34 Window::~Window() { |
35 } | 35 } |
36 | 36 |
37 bool Window::Init(int width, int height) { | 37 bool Window::Init(int width, int height) { |
38 window_handle_ = CreateNativeWindow(demo_->Title(), width, height); | 38 window_handle_ = CreateNativeWindow(demo_->Title(), width, height); |
39 if (window_handle_ == NULL) | 39 if (window_handle_ == NULL) |
40 return false; | 40 return false; |
41 if (!CreateRenderContext(PluginWindow(window_handle_))) | 41 if (!CreateRenderContext(PluginWindow(window_handle_))) |
42 return false; | 42 return false; |
43 | 43 |
44 demo_->InitWindowSize(width, height); | 44 demo_->Resize(width, height); |
45 return demo_->InitGL(); | 45 return demo_->InitGL(); |
46 } | 46 } |
47 | 47 |
48 void Window::OnPaint() { | 48 void Window::OnPaint() { |
49 demo_->Draw(); | 49 demo_->Draw(); |
50 ::gles2::GetGLContext()->SwapBuffers(); | 50 ::gles2::GetGLContext()->SwapBuffers(); |
51 } | 51 } |
52 | 52 |
53 // TODO(apatrick): It looks like all the resources allocated here leak. We | 53 // TODO(apatrick): It looks like all the resources allocated here leak. We |
54 // should fix that if we want to use this Window class for anything beyond this | 54 // should fix that if we want to use this Window class for anything beyond this |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 ::gles2::SetGLContext(new GLES2Implementation(helper, | 89 ::gles2::SetGLContext(new GLES2Implementation(helper, |
90 transfer_buffer.size, | 90 transfer_buffer.size, |
91 transfer_buffer.ptr, | 91 transfer_buffer.ptr, |
92 transfer_buffer_id, | 92 transfer_buffer_id, |
93 false)); | 93 false)); |
94 return command_buffer.release() != NULL; | 94 return command_buffer.release() != NULL; |
95 } | 95 } |
96 | 96 |
97 } // namespace demos | 97 } // namespace demos |
98 } // namespace gpu | 98 } // namespace gpu |
OLD | NEW |