mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-08 10:23:27 +00:00
make gdi rendering a little bit faster
This commit is contained in:
@@ -20,6 +20,7 @@ struct _MwLLGDI {
|
||||
HICON icon;
|
||||
|
||||
int grabbed;
|
||||
int force_render;
|
||||
};
|
||||
|
||||
struct _MwLLGDIColor {
|
||||
|
||||
@@ -19,6 +19,8 @@ static LRESULT CALLBACK wndproc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
|
||||
HBITMAP hbmp;
|
||||
HDC dc, hbdc;
|
||||
|
||||
u->ll->gdi.force_render = 0;
|
||||
|
||||
if(u->ll->common.copy_buffer) {
|
||||
GetClientRect(hWnd, &rc);
|
||||
|
||||
@@ -235,6 +237,7 @@ static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) {
|
||||
r->common.copy_buffer = 1;
|
||||
r->common.type = MwLLBackendGDI;
|
||||
|
||||
r->gdi.force_render = 0;
|
||||
r->gdi.grabbed = 0;
|
||||
r->gdi.hWnd = CreateWindow("milsko", "Milsko", parent == NULL ? (WS_OVERLAPPEDWINDOW) : (WS_CHILD | WS_VISIBLE), x == MwDEFAULT ? CW_USEDEFAULT : x, y == MwDEFAULT ? CW_USEDEFAULT : y, width, height, parent == NULL ? NULL : parent->gdi.hWnd, 0, wc.hInstance, NULL);
|
||||
r->gdi.hInstance = wc.hInstance;
|
||||
@@ -515,7 +518,11 @@ static void MwLLSetIconImpl(MwLL handle, MwLLPixmap pixmap) {
|
||||
}
|
||||
|
||||
static void MwLLForceRenderImpl(MwLL handle) {
|
||||
if(!handle->gdi.force_render) {
|
||||
PostMessage(handle->gdi.hWnd, WM_USER, 0, 0);
|
||||
|
||||
handle->gdi.force_render = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void MwLLSetCursorImpl(MwLL handle, MwCursor* image, MwCursor* mask) {
|
||||
|
||||
@@ -773,10 +773,10 @@ static void MwLLSetIconImpl(MwLL handle, MwLLPixmap pixmap) {
|
||||
}
|
||||
|
||||
static void MwLLForceRenderImpl(MwLL handle) {
|
||||
if(!handle->x11.force_render) {
|
||||
XEvent ev;
|
||||
memset(&ev, 0, sizeof(ev));
|
||||
|
||||
if(!handle->x11.force_render) {
|
||||
ev.type = Expose;
|
||||
ev.xexpose.window = handle->x11.window;
|
||||
XSendEvent(handle->x11.display, handle->x11.window, False, ExposureMask, &ev);
|
||||
|
||||
Reference in New Issue
Block a user