Flutter Engine
The Flutter Engine
Public Member Functions | Public Attributes | List of all members
sk_app::SkiaAndroidApp Struct Reference

#include <surface_glue_android.h>

Public Member Functions

 SkiaAndroidApp (JNIEnv *env, jobject androidApp)
 
void postMessage (const Message &message) const
 
void readMessage (Message *message) const
 
void setTitle (const char *title) const
 
void setUIState (const char *state) const
 

Public Attributes

ApplicationfApp
 
WindowfWindow
 
jobject fAndroidApp
 

Detailed Description

Definition at line 48 of file surface_glue_android.h.

Constructor & Destructor Documentation

◆ SkiaAndroidApp()

sk_app::SkiaAndroidApp::SkiaAndroidApp ( JNIEnv *  env,
jobject  androidApp 
)

Definition at line 71 of file surface_glue_android.cpp.

71 {
72 env->GetJavaVM(&fJavaVM);
73 fAndroidApp = env->NewGlobalRef(androidApp);
74 jclass cls = env->GetObjectClass(fAndroidApp);
75 fSetTitleMethodID = env->GetMethodID(cls, "setTitle", "(Ljava/lang/String;)V");
76 fSetStateMethodID = env->GetMethodID(cls, "setState", "(Ljava/lang/String;)V");
77 fNativeWindow = nullptr;
78 pthread_create(&fThread, nullptr, pthread_main, this);
79}
Definition: __init__.py:1

Member Function Documentation

◆ postMessage()

void sk_app::SkiaAndroidApp::postMessage ( const Message message) const

Definition at line 107 of file surface_glue_android.cpp.

107 {
108 SkDEBUGCODE(auto writeSize =) write(fPipes[1], &message, sizeof(message));
109 SkASSERT(writeSize == sizeof(message));
110}
#define SkASSERT(cond)
Definition: SkAssert.h:116
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
Win32Message message
void write(SkWStream *wStream, const T &text)
Definition: skqp.cpp:188

◆ readMessage()

void sk_app::SkiaAndroidApp::readMessage ( Message message) const

Definition at line 112 of file surface_glue_android.cpp.

112 {
113 SkDEBUGCODE(auto readSize =) read(fPipes[0], message, sizeof(Message));
114 SkASSERT(readSize == sizeof(Message));
115}
static bool read(SkStream *stream, void *buffer, size_t amount)

◆ setTitle()

void sk_app::SkiaAndroidApp::setTitle ( const char *  title) const

Definition at line 95 of file surface_glue_android.cpp.

95 {
96 jstring titleString = fPThreadEnv->NewStringUTF(title);
97 fPThreadEnv->CallVoidMethod(fAndroidApp, fSetTitleMethodID, titleString);
98 fPThreadEnv->DeleteLocalRef(titleString);
99}

◆ setUIState()

void sk_app::SkiaAndroidApp::setUIState ( const char *  state) const

Definition at line 101 of file surface_glue_android.cpp.

101 {
102 jstring jstr = fPThreadEnv->NewStringUTF(state);
103 fPThreadEnv->CallVoidMethod(fAndroidApp, fSetStateMethodID, jstr);
104 fPThreadEnv->DeleteLocalRef(jstr);
105}
AtkStateType state

Member Data Documentation

◆ fAndroidApp

jobject sk_app::SkiaAndroidApp::fAndroidApp

Definition at line 51 of file surface_glue_android.h.

◆ fApp

Application* sk_app::SkiaAndroidApp::fApp

Definition at line 49 of file surface_glue_android.h.

◆ fWindow

Window* sk_app::SkiaAndroidApp::fWindow

Definition at line 50 of file surface_glue_android.h.


The documentation for this struct was generated from the following files: