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

Side by Side Diff: gpu/demos/framework/window.cc

Issue 7529009: Updated demo to use resizable plugin element. This exercises the new PPB_Graphics3D_Dev::Resize()... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698