gdi backend has bugs

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@351 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-10-16 07:38:43 +00:00
parent 6e4f7ff6ef
commit 9b17545880
3 changed files with 19 additions and 7 deletions

View File

@@ -337,8 +337,12 @@ MwLLPixmap MwLLCreatePixmap(MwLL handle, unsigned char* data, int width, int hei
BITMAPINFOHEADER bmih;
RGBQUAD* quad;
int y, x;
int w = (width + (16 - (width % 16))) / 8;
WORD* words = malloc(w * height);
int w = (width + (16 - (width % 16))) / 8;
WORD* words;
if(16 * (width / 16) == width) w -= 2;
words = malloc(w * height);
r->width = width;
r->height = height;
@@ -478,18 +482,22 @@ void MwLLSetCursor(MwLL handle, MwCursor* image, MwCursor* mask) {
}
void MwLLDetach(MwLL handle, MwPoint* point) {
RECT rc, rc2;
RECT rc, rc2;
LPARAM lp = GetWindowLongPtr(handle->hWnd, GWL_STYLE);
lp &= WS_VISIBLE;
GetWindowRect(GetParent(handle->hWnd), &rc);
GetClientRect(handle->hWnd, &rc2);
SetWindowLongPtr(handle->hWnd, GWL_STYLE, (LPARAM)WS_OVERLAPPEDWINDOW);
SetWindowLongPtr(handle->hWnd, GWL_STYLE, (LPARAM)WS_OVERLAPPEDWINDOW | lp);
SetParent(handle->hWnd, NULL);
rc.left += point->x;
rc.top += point->y;
AdjustWindowRect(&rc2, WS_OVERLAPPEDWINDOW, FALSE);
AdjustWindowRect(&rc2, WS_OVERLAPPEDWINDOW | lp, FALSE);
rc2.right -= rc2.left;
rc2.bottom -= rc2.top;

View File

@@ -373,7 +373,7 @@ MwLLPixmap MwLLCreatePixmap(MwLL handle, unsigned char* data, int width, int hei
r->use_render = XRenderQueryExtension(handle->display, &evbase, &erbase) ? 1 : 0;
r->image = XCreateImage(handle->display, DefaultVisual(handle->display, DefaultScreen(handle->display)), r->depth, ZPixmap, 0, di, width, height, 32, width * 4);
r->mask = XCreateImage(handle->display, DefaultVisual(handle->display, DefaultScreen(handle->display)), r->depth, ZPixmap, 0, dm, width, height, 32, width * 4);
r->mask = XCreateImage(handle->display, DefaultVisual(handle->display, DefaultScreen(handle->display)), 1, ZPixmap, 0, dm, width, height, 32, width * 4);
for(y = 0; y < height; y++) {
for(x = 0; x < width; x++) {