diff --git a/include/Mw/LowLevel.h b/include/Mw/LowLevel.h index 30d7f31..9766d05 100644 --- a/include/Mw/LowLevel.h +++ b/include/Mw/LowLevel.h @@ -190,6 +190,8 @@ MWDECL void (*MwLLDestroy)(MwLL handle); MWDECL void (*MwLLPolygon)(MwLL handle, MwPoint* points, int points_count, MwLLColor color); MWDECL void (*MwLLLine)(MwLL handle, MwPoint* points, MwLLColor color); +MWDECL void (*MwLLBeginDraw)(MwLL handle); +MWDECL void (*MwLLEndDraw)(MwLL handle); MWDECL MwLLColor (*MwLLAllocColor)(MwLL handle, int r, int g, int b); MWDECL void (*MwLLColorUpdate)(MwLL handle, MwLLColor c, int r, int g, int b); diff --git a/src/backend/call.c b/src/backend/call.c index 2ce5ed2..e2ce934 100644 --- a/src/backend/call.c +++ b/src/backend/call.c @@ -8,8 +8,10 @@ MwLLCreate = MwLLCreateImpl; \ MwLLDestroy = MwLLDestroyImpl; \ \ - MwLLPolygon = MwLLPolygonImpl; \ - MwLLLine = MwLLLineImpl; \ + MwLLPolygon = MwLLPolygonImpl; \ + MwLLLine = MwLLLineImpl; \ + MwLLBeginDraw = MwLLBeginDrawImpl; \ + MwLLEndDraw = MwLLEndDrawImpl; \ \ MwLLAllocColor = MwLLAllocColorImpl; \ MwLLColorUpdate = MwLLColorUpdateImpl; \ diff --git a/src/backend/cocoa.m b/src/backend/cocoa.m index 738ab10..725642d 100644 --- a/src/backend/cocoa.m +++ b/src/backend/cocoa.m @@ -1001,6 +1001,14 @@ static void MwLLDestroyImpl(MwLL handle) { free(handle); } +static void MwLLBeginDrawImpl(MwLL handle) { + (void)handle; +} + +static void MwLLEndDrawImpl(MwLL handle) { + (void)handle; +} + static void MwLLPolygonImpl(MwLL handle, MwPoint* points, int points_count, MwLLColor color) { MilskoCocoa* h = handle->cocoa.real; diff --git a/src/backend/gdi.c b/src/backend/gdi.c index 3c286a8..4601b79 100644 --- a/src/backend/gdi.c +++ b/src/backend/gdi.c @@ -310,6 +310,14 @@ static void MwLLDestroyImpl(MwLL handle) { free(handle); } +static void MwLLBeginDrawImpl(MwLL handle) { + (void)handle; +} + +static void MwLLEndDrawImpl(MwLL handle) { + (void)handle; +} + static void MwLLPolygonImpl(MwLL handle, MwPoint* points, int points_count, MwLLColor color) { POINT* p = malloc(sizeof(*p) * points_count); HPEN pen = CreatePen(PS_NULL, 0, RGB(0, 0, 0)); diff --git a/src/backend/wayland.c b/src/backend/wayland.c index 117a328..be4bc14 100644 --- a/src/backend/wayland.c +++ b/src/backend/wayland.c @@ -1531,6 +1531,14 @@ refresh: MwLLDispatch(handle, draw, NULL); } +static void MwLLBeginDrawImpl(MwLL handle) { + (void)handle; +} + +static void MwLLEndDrawImpl(MwLL handle) { + update_buffer(&handle->wayland.framebuffer); +} + static void MwLLPolygonImpl(MwLL handle, MwPoint* points, int points_count, MwLLColor color) { int i; cairo_set_source_rgb(handle->wayland.cairo, color->common.red / 255.0, color->common.green / 255.0, color->common.blue / 255.0); diff --git a/src/backend/x11.c b/src/backend/x11.c index 6124cee..f7c6fe4 100644 --- a/src/backend/x11.c +++ b/src/backend/x11.c @@ -261,8 +261,15 @@ static void MwLLDestroyImpl(MwLL handle) { free(handle); } -static void -MwLLPolygonImpl(MwLL handle, MwPoint* points, int points_count, MwLLColor color) { +static void MwLLBeginDrawImpl(MwLL handle) { + (void)handle; +} + +static void MwLLEndDrawImpl(MwLL handle) { + (void)handle; +} + +static void MwLLPolygonImpl(MwLL handle, MwPoint* points, int points_count, MwLLColor color) { int i; XPoint* p = malloc(sizeof(*p) * points_count); diff --git a/src/core.c b/src/core.c index a8178c7..f17fdbf 100644 --- a/src/core.c +++ b/src/core.c @@ -6,11 +6,14 @@ static void lldrawhandler(MwLL handle, void* data) { MwWidget h = (MwWidget)handle->common.user; (void)data; + MwLLBeginDraw(handle); h->bgcolor = NULL; MwDispatch(h, draw); if(h->draw_inject != NULL) h->draw_inject(h); MwDispatchUserHandler(h, MwNdrawHandler, NULL); + + MwLLEndDraw(handle); } static void lluphandler(MwLL handle, void* data) { diff --git a/src/lowlevel.c b/src/lowlevel.c index eeabaa3..8f8a4d9 100644 --- a/src/lowlevel.c +++ b/src/lowlevel.c @@ -6,6 +6,9 @@ void (*MwLLDestroy)(MwLL handle) = NULL; void (*MwLLPolygon)(MwLL handle, MwPoint* points, int points_count, MwLLColor color) = NULL; void (*MwLLLine)(MwLL handle, MwPoint* points, MwLLColor color) = NULL; +void (*MwLLBeginDraw)(MwLL handle) = NULL; +void (*MwLLEndDraw)(MwLL handle) = NULL; + MwLLColor (*MwLLAllocColor)(MwLL handle, int r, int g, int b) = NULL; void (*MwLLColorUpdate)(MwLL handle, MwLLColor c, int r, int g, int b) = NULL; void (*MwLLFreeColor)(MwLLColor color) = NULL;