gdi clipping
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good

This commit is contained in:
Nishi 2026-05-07 18:40:14 +09:00
commit ad49a55812
6 changed files with 35 additions and 10 deletions

View file

@ -307,6 +307,8 @@ static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) {
r->gdi.cursor = NULL;
r->gdi.icon = NULL;
r->gdi.clip = NULL;
u->ll = r;
u->min_set = 0;
u->max_set = 0;
@ -340,6 +342,8 @@ static void MwLLDestroyImpl(MwLL handle) {
SetWindowLongPtr(handle->gdi.hWnd, GWLP_USERDATA, (LPARAM)NULL);
DestroyWindow(handle->gdi.hWnd);
if(handle->gdi.clip != NULL) DeleteObject(handle->gdi.clip);
if(handle->gdi.cursor != NULL) DestroyCursor(handle->gdi.cursor);
free(handle);
@ -883,8 +887,22 @@ static void MwLLRaiseImpl(MwLL handle) {
}
static void MwLLClipImpl(MwLL handle, MwRect* rect) {
(void)handle;
(void)rect;
if(rect == NULL){
SelectClipRgn(handle->gdi.hDC, NULL);
if(handle->gdi.clip != NULL){
DeleteObject(handle->gdi.clip);
handle->gdi.clip = NULL;
}
}else{
HRGN clip = CreateRectRgn(rect->x, rect->y, rect->x + rect->width, rect->y + rect->height);
SelectClipRgn(handle->gdi.hDC, clip);
if(handle->gdi.clip != NULL) DeleteObject(handle->gdi.clip);
handle->gdi.clip = clip;
}
}
static int MwLLGDICallInitImpl(void) {

View file

@ -81,7 +81,7 @@ static void draw(MwWidget handle) {
if(render) {
MwPoint p;
if(n == 1 && arrlen(t->names) > 1 && i > 0) {
if(n == 1 && i > 0) {
MwRect r3 = r2;
r3.y = tab_height(handle);
@ -98,7 +98,7 @@ static void draw(MwWidget handle) {
MwLLClip(handle->lowlevel, NULL);
}
if(n == 1 && arrlen(t->names) > 1 && i < (arrlen(t->names) - 1)) {
if(n == 1 && i < (arrlen(t->names) - 1)) {
MwRect r3 = r2;
r3.x += r2.width - MwDefaultBorderWidth(handle);