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

Side by Side Diff: gpu/demos/app_framework/application.cc

Issue 551011: Changed the signature of Application::Draw to accept elapsed time. It will be... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 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
« no previous file with comments | « gpu/demos/app_framework/application.h ('k') | gpu/demos/hello_triangle/main.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 (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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/app_framework/application.h" 5 #include "gpu/demos/app_framework/application.h"
6 6
7 #include "gpu/command_buffer/client/gles2_implementation.h" 7 #include "gpu/command_buffer/client/gles2_implementation.h"
8 #include "gpu/command_buffer/client/gles2_lib.h" 8 #include "gpu/command_buffer/client/gles2_lib.h"
9 #include "gpu/command_buffer/service/command_buffer_service.h" 9 #include "gpu/command_buffer/service/command_buffer_service.h"
10 #include "gpu/command_buffer/service/gpu_processor.h" 10 #include "gpu/command_buffer/service/gpu_processor.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 if (msg.message == WM_QUIT) done = true; 67 if (msg.message == WM_QUIT) done = true;
68 TranslateMessage(&msg); 68 TranslateMessage(&msg);
69 DispatchMessage(&msg); 69 DispatchMessage(&msg);
70 } 70 }
71 // Message queue is empty and application has not quit yet - keep painting. 71 // Message queue is empty and application has not quit yet - keep painting.
72 if (!done) SendMessage(window_handle_, WM_PAINT, 0, 0); 72 if (!done) SendMessage(window_handle_, WM_PAINT, 0, 0);
73 } 73 }
74 } 74 }
75 75
76 void Application::OnPaint() { 76 void Application::OnPaint() {
77 Draw(); 77 float elapsed_sec = 0.0f;
78 const base::Time current_time = base::Time::Now();
79 if (!last_draw_time_.is_null()) {
80 base::TimeDelta time_delta = current_time - last_draw_time_;
81 elapsed_sec = static_cast<float>(time_delta.InSecondsF());
82 }
83 last_draw_time_ = current_time;
84
85 Draw(elapsed_sec);
78 gles2::GetGLContext()->SwapBuffers(); 86 gles2::GetGLContext()->SwapBuffers();
79 } 87 }
80 88
81 bool Application::InitRenderContext() { 89 bool Application::InitRenderContext() {
82 window_handle_ = CreateNativeWindow(); 90 window_handle_ = CreateNativeWindow();
83 if (window_handle_ == NULL) { 91 if (window_handle_ == NULL) {
84 return false; 92 return false;
85 } 93 }
86 94
87 scoped_ptr<CommandBufferService> command_buffer(new CommandBufferService); 95 scoped_ptr<CommandBufferService> command_buffer(new CommandBufferService);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 160
153 ShowWindow(hwnd, SW_SHOWNORMAL); 161 ShowWindow(hwnd, SW_SHOWNORMAL);
154 // Set this to the GWL_USERDATA so that it is available to WindowProc. 162 // Set this to the GWL_USERDATA so that it is available to WindowProc.
155 SetWindowLongPtr(hwnd, GWL_USERDATA, (LONG_PTR)this); 163 SetWindowLongPtr(hwnd, GWL_USERDATA, (LONG_PTR)this);
156 164
157 return hwnd; 165 return hwnd;
158 } 166 }
159 167
160 } // namespace gpu_demos 168 } // namespace gpu_demos
161 #endif // defined(OS_WIN) 169 #endif // defined(OS_WIN)
OLDNEW
« no previous file with comments | « gpu/demos/app_framework/application.h ('k') | gpu/demos/hello_triangle/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698