Flutter Engine
The Flutter Engine
third_party
skia
tools
sk_app
android
surface_glue_android.h
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
#ifndef surface_glue_android_DEFINED
9
#define surface_glue_android_DEFINED
10
11
#include <pthread.h>
12
13
#include <android/native_window_jni.h>
14
15
#include "
include/core/SkString.h
"
16
17
#include "
tools/sk_app/Application.h
"
18
#include "
tools/sk_app/Window.h
"
19
20
namespace
sk_app
{
21
22
enum
MessageType
{
23
kUndefined
,
24
kSurfaceCreated
,
25
kSurfaceChanged
,
26
kSurfaceDestroyed
,
27
kDestroyApp
,
28
kContentInvalidated
,
29
kKeyPressed
,
30
kTouched
,
31
kUIStateChanged
,
32
};
33
34
struct
Message
{
35
MessageType
fType
=
kUndefined
;
36
ANativeWindow
*
fNativeWindow
=
nullptr
;
37
int
fKeycode
= 0;
38
int
fTouchOwner
,
fTouchState
;
39
float
fTouchX
,
fTouchY
;
40
41
SkString
*
stateName
;
42
SkString
*
stateValue
;
43
44
Message
() {}
45
Message
(
MessageType
t) :
fType
(t) {}
46
};
47
48
struct
SkiaAndroidApp
{
49
Application
*
fApp
;
50
Window
*
fWindow
;
51
jobject
fAndroidApp
;
52
53
SkiaAndroidApp
(JNIEnv*
env
, jobject androidApp);
54
55
void
postMessage
(
const
Message
&
message
)
const
;
56
void
readMessage
(
Message
*
message
)
const
;
57
58
// These must be called in SkiaAndroidApp's own pthread because the JNIEnv is thread sensitive
59
void
setTitle
(
const
char
* title)
const
;
60
void
setUIState
(
const
char
*
state
)
const
;
61
62
private
:
63
pthread_t fThread;
64
ANativeWindow
* fNativeWindow;
65
int
fPipes[2];
// 0 is the read message pipe, 1 is the write message pipe
66
JavaVM* fJavaVM;
67
JNIEnv* fPThreadEnv;
68
jmethodID fSetTitleMethodID, fSetStateMethodID;
69
70
// This must be called in SkiaAndroidApp's own pthread because the JNIEnv is thread sensitive
71
~SkiaAndroidApp
();
72
73
static
int
message_callback(
int
fd,
int
events,
void
*
data
);
74
static
void
* pthread_main(
void
*);
75
};
76
77
}
// namespace sk_app
78
79
#endif
Application.h
SkString.h
Window.h
SkString
Definition:
SkString.h:118
sk_app::Application
Definition:
Application.h:13
sk_app::Window
Definition:
Window.h:40
state
AtkStateType state
Definition:
fl_accessible_node.cc:10
message
Win32Message message
Definition:
keyboard_unittests.cc:139
env
Definition:
__init__.py:1
sk_app
Definition:
surface_glue_android.cpp:31
sk_app::MessageType
MessageType
Definition:
surface_glue_android.h:22
sk_app::kKeyPressed
@ kKeyPressed
Definition:
surface_glue_android.h:29
sk_app::kContentInvalidated
@ kContentInvalidated
Definition:
surface_glue_android.h:28
sk_app::kSurfaceCreated
@ kSurfaceCreated
Definition:
surface_glue_android.h:24
sk_app::kUndefined
@ kUndefined
Definition:
surface_glue_android.h:23
sk_app::kSurfaceDestroyed
@ kSurfaceDestroyed
Definition:
surface_glue_android.h:26
sk_app::kDestroyApp
@ kDestroyApp
Definition:
surface_glue_android.h:27
sk_app::kSurfaceChanged
@ kSurfaceChanged
Definition:
surface_glue_android.h:25
sk_app::kTouched
@ kTouched
Definition:
surface_glue_android.h:30
sk_app::kUIStateChanged
@ kUIStateChanged
Definition:
surface_glue_android.h:31
sk_app::Message
Definition:
surface_glue_android.h:34
sk_app::Message::Message
Message(MessageType t)
Definition:
surface_glue_android.h:45
sk_app::Message::Message
Message()
Definition:
surface_glue_android.h:44
sk_app::Message::fTouchOwner
int fTouchOwner
Definition:
surface_glue_android.h:38
sk_app::Message::stateName
SkString * stateName
Definition:
surface_glue_android.h:41
sk_app::Message::fType
MessageType fType
Definition:
surface_glue_android.h:35
sk_app::Message::fNativeWindow
ANativeWindow * fNativeWindow
Definition:
surface_glue_android.h:36
sk_app::Message::fTouchState
int fTouchState
Definition:
surface_glue_android.h:38
sk_app::Message::fTouchY
float fTouchY
Definition:
surface_glue_android.h:39
sk_app::Message::fKeycode
int fKeycode
Definition:
surface_glue_android.h:37
sk_app::Message::stateValue
SkString * stateValue
Definition:
surface_glue_android.h:42
sk_app::Message::fTouchX
float fTouchX
Definition:
surface_glue_android.h:39
sk_app::SkiaAndroidApp
Definition:
surface_glue_android.h:48
sk_app::SkiaAndroidApp::setUIState
void setUIState(const char *state) const
Definition:
surface_glue_android.cpp:101
sk_app::SkiaAndroidApp::SkiaAndroidApp
SkiaAndroidApp(JNIEnv *env, jobject androidApp)
Definition:
surface_glue_android.cpp:71
sk_app::SkiaAndroidApp::fAndroidApp
jobject fAndroidApp
Definition:
surface_glue_android.h:51
sk_app::SkiaAndroidApp::fWindow
Window * fWindow
Definition:
surface_glue_android.h:50
sk_app::SkiaAndroidApp::setTitle
void setTitle(const char *title) const
Definition:
surface_glue_android.cpp:95
sk_app::SkiaAndroidApp::readMessage
void readMessage(Message *message) const
Definition:
surface_glue_android.cpp:112
sk_app::SkiaAndroidApp::fApp
Application * fApp
Definition:
surface_glue_android.h:49
sk_app::SkiaAndroidApp::postMessage
void postMessage(const Message &message) const
Definition:
surface_glue_android.cpp:107
data
std::shared_ptr< const fml::Mapping > data
Definition:
texture_gles.cc:63
ANativeWindow
struct ANativeWindow ANativeWindow
Definition:
vulkan_native_surface_android.h:12
Generated on Sun Jun 23 2024 21:56:50 for Flutter Engine by
1.9.4