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

Unified Diff: tools/vulkan/win/main_win.cpp

Issue 1873453002: Some more improvements/fixes to the VulkanViewer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/vulkan/win/Window_win.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/vulkan/win/main_win.cpp
diff --git a/tools/vulkan/win/main_win.cpp b/tools/vulkan/win/main_win.cpp
index 34e522a9525e0ba5579cf8490ec04e1201e81521..883b96df9bf8a3dacbf434461a85f7aa1ddb915f 100644
--- a/tools/vulkan/win/main_win.cpp
+++ b/tools/vulkan/win/main_win.cpp
@@ -9,6 +9,7 @@
#include <tchar.h>
#include "SkTypes.h"
+#include "Timer.h"
#include "Window_win.h"
#include "../Application.h"
@@ -24,6 +25,8 @@ static char* tchar_to_utf8(const TCHAR* str) {
#endif
}
+static double now_ms() { return SkTime::GetNSecs() * 1e-6; }
+
// This file can work with GUI or CONSOLE subsystem types since we define _tWinMain and main().
static int main_common(HINSTANCE hInstance, int show, int argc, char**argv);
@@ -60,6 +63,10 @@ static int main_common(HINSTANCE hInstance, int show, int argc, char**argv) {
Application* app = Application::Create(argc, argv, (void*)hInstance);
MSG msg = { 0 };
+
+ double currentTime = 0.0;
+ double previousTime = 0.0;
+
// Main message loop
while (WM_QUIT != msg.message) {
if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) {
@@ -67,7 +74,9 @@ static int main_common(HINSTANCE hInstance, int show, int argc, char**argv) {
DispatchMessage(&msg);
}
- app->onIdle(0.0f);
+ previousTime = currentTime;
+ currentTime = now_ms();
+ app->onIdle(currentTime - previousTime);
}
delete app;
« no previous file with comments | « tools/vulkan/win/Window_win.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698