Flutter Engine
The Flutter Engine
Functions
main_win.cpp File Reference
#include <windows.h>
#include <tchar.h>
#include "include/core/SkTypes.h"
#include "include/private/base/SkMalloc.h"
#include "tools/sk_app/Application.h"
#include "tools/sk_app/win/Window_win.h"
#include "tools/timer/Timer.h"

Go to the source code of this file.

Functions

static char * tchar_to_utf8 (const TCHAR *str)
 
static int main_common (HINSTANCE hInstance, int show, int argc, char **argv)
 
int APIENTRY _tWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
 
int main (int argc, char **argv)
 

Function Documentation

◆ _tWinMain()

int APIENTRY _tWinMain ( HINSTANCE  hInstance,
HINSTANCE  hPrevInstance,
LPTSTR  lpCmdLine,
int  nCmdShow 
)

Definition at line 35 of file main_win.cpp.

36 {
37
38 // convert from lpCmdLine to argc, argv.
39 char* argv[4096];
40 int argc = 0;
41 TCHAR exename[1024], *next;
42 int exenameLen = GetModuleFileName(nullptr, exename, std::size(exename));
43 // we're ignoring the possibility that the exe name exceeds the exename buffer
44 (void)exenameLen;
45 argv[argc++] = tchar_to_utf8(exename);
46 TCHAR* arg = _tcstok_s(lpCmdLine, _T(" "), &next);
47 while (arg != nullptr) {
48 argv[argc++] = tchar_to_utf8(arg);
49 arg = _tcstok_s(nullptr, _T(" "), &next);
50 }
51 int result = main_common(hInstance, nCmdShow, argc, argv);
52 for (int i = 0; i < argc; ++i) {
53 sk_free(argv[i]);
54 }
55 return result;
56}
static float next(float f)
SK_API void sk_free(void *)
GAsyncResult * result
char ** argv
Definition: library.h:9
static char * tchar_to_utf8(const TCHAR *str)
Definition: main_win.cpp:19
static int main_common(HINSTANCE hInstance, int show, int argc, char **argv)
Definition: main_win.cpp:62
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 58 of file main_win.cpp.

58 {
59 return main_common(GetModuleHandle(nullptr), SW_SHOW, argc, argv);
60}

◆ main_common()

static int main_common ( HINSTANCE  hInstance,
int  show,
int  argc,
char **  argv 
)
static

Definition at line 62 of file main_win.cpp.

62 {
63
64 Application* app = Application::Create(argc, argv, (void*)hInstance);
65
66 MSG msg;
67 memset(&msg, 0, sizeof(msg));
68
69 bool idled = false;
70
71 // Main message loop
72 while (WM_QUIT != msg.message) {
73 if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) {
74 TranslateMessage(&msg);
75
76 if (WM_PAINT == msg.message) {
77 // Ensure that call onIdle at least once per WM_PAINT, or mouse events can
78 // overwhelm the message processing loop, and prevent animation from running.
79 if (!idled) {
80 app->onIdle();
81 }
82 idled = false;
83 }
84 DispatchMessage(&msg);
85 } else {
86 app->onIdle();
87 idled = true;
88 }
89 }
90
91 delete app;
92
93 return (int)msg.wParam;
94}
static sk_sp< Effect > Create()
Definition: RefCntTest.cpp:117
struct tagMSG MSG
#define DispatchMessage

◆ tchar_to_utf8()

static char * tchar_to_utf8 ( const TCHAR *  str)
static

Definition at line 19 of file main_win.cpp.

19 {
20#ifdef _UNICODE
21 int size = WideCharToMultiByte(CP_UTF8, 0, str, wcslen(str), nullptr, 0, nullptr, nullptr);
22 char* str8 = (char*)sk_malloc_throw(size + 1);
23 WideCharToMultiByte(CP_UTF8, 0, str, wcslen(str), str8, size, nullptr, nullptr);
24 str8[size] = '\0';
25 return str8;
26#else
27 return _strdup(str);
28#endif
29}
static void * sk_malloc_throw(size_t size)
Definition: SkMalloc.h:67