mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-04 08:30:51 +00:00
better rendering
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@99 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -17,7 +17,7 @@ struct _MwLL {
|
|||||||
HWND hWnd;
|
HWND hWnd;
|
||||||
HDC hDC;
|
HDC hDC;
|
||||||
void* user;
|
void* user;
|
||||||
int copy_buffer;
|
int copy_buffer;
|
||||||
|
|
||||||
MwLLHandler handler;
|
MwLLHandler handler;
|
||||||
};
|
};
|
||||||
|
|||||||
35
src/gdi.c
35
src/gdi.c
@@ -17,23 +17,29 @@ static LRESULT CALLBACK wndproc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
|
|||||||
HBITMAP hbmp;
|
HBITMAP hbmp;
|
||||||
HDC dc, hbdc;
|
HDC dc, hbdc;
|
||||||
|
|
||||||
GetClientRect(hWnd, &rc);
|
if(u->ll->copy_buffer) {
|
||||||
|
GetClientRect(hWnd, &rc);
|
||||||
|
|
||||||
dc = GetDC(hWnd);
|
dc = GetDC(hWnd);
|
||||||
hbmp = CreateCompatibleBitmap(dc, rc.right - rc.left, rc.bottom - rc.top);
|
hbmp = CreateCompatibleBitmap(dc, rc.right - rc.left, rc.bottom - rc.top);
|
||||||
hbdc = CreateCompatibleDC(dc);
|
hbdc = CreateCompatibleDC(dc);
|
||||||
SelectObject(hbdc, hbmp);
|
SelectObject(hbdc, hbmp);
|
||||||
ReleaseDC(hWnd, dc);
|
ReleaseDC(hWnd, dc);
|
||||||
|
|
||||||
u->ll->hDC = hbdc;
|
u->ll->hDC = hbdc;
|
||||||
MwLLDispatch(u->ll, draw);
|
MwLLDispatch(u->ll, draw);
|
||||||
|
|
||||||
dc = BeginPaint(hWnd, &ps);
|
dc = BeginPaint(hWnd, &ps);
|
||||||
StretchBlt(dc, 0, 0, rc.right - rc.left, rc.bottom - rc.top, hbdc, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SRCCOPY);
|
StretchBlt(dc, 0, 0, rc.right - rc.left, rc.bottom - rc.top, hbdc, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SRCCOPY);
|
||||||
EndPaint(hWnd, &ps);
|
EndPaint(hWnd, &ps);
|
||||||
|
|
||||||
DeleteDC(hbdc);
|
DeleteDC(hbdc);
|
||||||
DeleteObject(hbmp);
|
DeleteObject(hbmp);
|
||||||
|
} else {
|
||||||
|
u->ll->hDC = BeginPaint(hWnd, &ps);
|
||||||
|
MwLLDispatch(u->ll, draw);
|
||||||
|
EndPaint(hWnd, &ps);
|
||||||
|
}
|
||||||
} else if(msg == WM_LBUTTONDOWN) {
|
} else if(msg == WM_LBUTTONDOWN) {
|
||||||
SetCapture(hWnd);
|
SetCapture(hWnd);
|
||||||
MwLLDispatch(u->ll, down);
|
MwLLDispatch(u->ll, down);
|
||||||
@@ -82,7 +88,8 @@ MwLL MwLLCreate(MwLL parent, int x, int y, int width, int height) {
|
|||||||
|
|
||||||
RegisterClassEx(&wc);
|
RegisterClassEx(&wc);
|
||||||
|
|
||||||
r->hWnd = CreateWindow(parent == NULL ? "milsko" : "STATIC", "Milsko", parent == NULL ? (WS_OVERLAPPEDWINDOW) : (WS_CHILD | WS_VISIBLE), x, y, width, height, parent == NULL ? NULL : parent->hWnd, 0, wc.hInstance, NULL);
|
r->copy_buffer = 1;
|
||||||
|
r->hWnd = CreateWindow(parent == NULL ? "milsko" : "STATIC", "Milsko", parent == NULL ? (WS_OVERLAPPEDWINDOW) : (WS_CHILD | WS_VISIBLE), x, y, width, height, parent == NULL ? NULL : parent->hWnd, 0, wc.hInstance, NULL);
|
||||||
|
|
||||||
u->ll = r;
|
u->ll = r;
|
||||||
if(parent == NULL) {
|
if(parent == NULL) {
|
||||||
|
|||||||
Reference in New Issue
Block a user