diff --git a/src/ege_graph.h b/src/ege_graph.h index 44d11c08..c003378d 100644 --- a/src/ege_graph.h +++ b/src/ege_graph.h @@ -30,4 +30,7 @@ int waitdealmessage(_graph_setting* pg); float EGE_PRIVATE_GetFPS(int add); // 获取帧数 void setmode(int gdriver, int gmode); + +// GDI+ 初始化 +void gdipluinit(); } diff --git a/src/graphics.cpp b/src/graphics.cpp index 0432df9c..2e33b768 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -713,8 +713,7 @@ inline void init_img_page(struct _graph_setting* pg) { if (!pg->has_init) { #ifdef EGE_GDIPLUS - Gdiplus::GdiplusStartupInput gdiplusStartupInput; - Gdiplus::GdiplusStartup(&pg->g_gdiplusToken, &gdiplusStartupInput, NULL); + gdipluinit(); #endif } } @@ -1015,4 +1014,12 @@ long getGraphicsVer() return EGE_VERSION_NUMBER; } +void gdipluinit() +{ + if (graph_setting.g_gdiplusToken == 0) { + Gdiplus::GdiplusStartupInput gdiplusStartupInput; + Gdiplus::GdiplusStartup(&graph_setting.g_gdiplusToken, &gdiplusStartupInput, NULL); + } +} + } // namespace ege diff --git a/src/image.cpp b/src/image.cpp index 65a0400a..13698f4c 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -61,6 +61,7 @@ void IMAGE::construct(int width, int height) refDC = ::GetDC(graph_setting.hwnd); } + gdipluinit(); reset(); initimage(refDC, width, height); setdefaultattribute();