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

Side by Side Diff: tools/vulkan/android/main_android.cpp

Issue 1945103003: Rename VulkanViewer to Viewer, take 2. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix android path Created 4 years, 7 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
« no previous file with comments | « tools/vulkan/android/Window_android.cpp ('k') | tools/vulkan/viewer/GMSlide.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include <jni.h>
9 #include <errno.h>
10
11 #include <android_native_app_glue.h>
12
13 #include "../Application.h"
14 #include "Timer.h"
15
16 static double now_ms() { return SkTime::GetNSecs() * 1e-6; }
17
18 /**
19 * This is the main entry point of a native application that is using
20 * android_native_app_glue. It runs in its own thread, with its own
21 * event loop for receiving input events and doing other things.
22 */
23 void android_main(struct android_app* state) {
24 // Make sure glue isn't stripped.
25 app_dummy();
26
27 static const char* gCmdLine[] = {
28 "vulkanviewer",
29 "--skps",
30 "/data/local/tmp/skp",
31 };
32
33 std::unique_ptr<Application> vkApp(Application::Create(SK_ARRAY_COUNT(gCmdLi ne),
34 const_cast<char**>(gC mdLine),
35 state));
36
37 double currentTime = 0.0;
38 double previousTime = 0.0;
39
40 // loop waiting for stuff to do.
41 while (1) {
42 // Read all pending events.
43 int ident;
44 int events;
45 struct android_poll_source* source;
46
47 // block forever waiting for events.
48 while ((ident=ALooper_pollAll(-1, NULL, &events,
49 (void**)&source)) >= 0) {
50
51 // Process this event.
52 if (source != NULL) {
53 source->process(state, source);
54 }
55
56 // Check if we are exiting.
57 if (state->destroyRequested != 0) {
58 return;
59 }
60
61 previousTime = currentTime;
62 currentTime = now_ms();
63 vkApp->onIdle(currentTime - previousTime);
64 }
65 }
66 }
67 //END_INCLUDE(all)
OLDNEW
« no previous file with comments | « tools/vulkan/android/Window_android.cpp ('k') | tools/vulkan/viewer/GMSlide.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698