Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
tools
sk_app
android
main_android.cpp
Go to the documentation of this file.
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 "
tools/sk_app/Application.h
"
14
#include "
tools/timer/Timer.h
"
15
16
using
sk_app::Application
;
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
"viewer"
,
29
"--skps"
,
30
"/data/local/tmp/skps"
,
31
// TODO: figure out how to use am start with extra params to pass in additional arguments at
32
// runtime
33
// "--atrace",
34
};
35
36
std::unique_ptr<Application> vkApp(Application::Create(std::size(gCmdLine),
37
const_cast<
char
**
>
(gCmdLine),
38
state
));
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,
nullptr
, &events,
49
(
void
**)&
source
)) >= 0) {
50
51
// Process this event.
52
if
(
source
!=
nullptr
) {
53
source
->process(
state
,
source
);
54
}
55
56
// Check if we are exiting.
57
if
(
state
->destroyRequested != 0) {
58
return
;
59
}
60
61
vkApp->onIdle();
62
}
63
}
64
}
65
//END_INCLUDE(all)
Application.h
Timer.h
sk_app::Application
Definition
Application.h:13
source
SkBitmap source
Definition
examples.cpp:28
state
AtkStateType state
Definition
fl_accessible_node.cc:10
android_main
void android_main(struct android_app *state)
Definition
main_android.cpp:23
Generated on Fri Apr 26 2024 06:18:11 for Flutter Engine by
1.9.8