fix graphic bug
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@85 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
parent
a5200bdb3f
commit
a95e2d0e45
5 changed files with 14 additions and 7 deletions
|
|
@ -17,6 +17,7 @@ struct _MwLL {
|
|||
HWND hWnd;
|
||||
HDC hDC;
|
||||
void* user;
|
||||
int copy_buffer;
|
||||
|
||||
MwLLHandler handler;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ struct _MwLL {
|
|||
Colormap colormap;
|
||||
void* user;
|
||||
Atom wm_delete;
|
||||
int copy_buffer;
|
||||
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
|
|
|
|||
11
src/gdi.c
11
src/gdi.c
|
|
@ -28,9 +28,11 @@ static LRESULT CALLBACK wndproc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
|
|||
u->ll->hDC = hbdc;
|
||||
MwLLDispatch(u->ll, draw);
|
||||
|
||||
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);
|
||||
EndPaint(hWnd, &ps);
|
||||
if(u->ll->copy_buffer) {
|
||||
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);
|
||||
EndPaint(hWnd, &ps);
|
||||
}
|
||||
|
||||
DeleteDC(hbdc);
|
||||
DeleteObject(hbmp);
|
||||
|
|
@ -82,7 +84,8 @@ MwLL MwLLCreate(MwLL parent, int x, int y, int width, int height) {
|
|||
|
||||
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;
|
||||
if(parent == NULL) {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,8 @@ static void create(MwWidget handle) {
|
|||
o->visual = glXChooseVisual(handle->lowlevel->display, DefaultScreen(handle->lowlevel->display), attribs);
|
||||
o->gl = glXCreateContext(handle->lowlevel->display, o->visual, NULL, GL_TRUE);
|
||||
#endif
|
||||
handle->internal = o;
|
||||
handle->internal = o;
|
||||
handle->lowlevel->copy_buffer = 0;
|
||||
|
||||
MwSetDefault(handle);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,8 @@ MwLL MwLLCreate(MwLL parent, int x, int y, int width, int height) {
|
|||
r->display = parent->display;
|
||||
p = parent->window;
|
||||
}
|
||||
r->window = XCreateSimpleWindow(r->display, p, x, y, width, height, 0, 0, WhitePixel(r->display, XDefaultScreen(r->display)));
|
||||
r->window = XCreateSimpleWindow(r->display, p, x, y, width, height, 0, 0, WhitePixel(r->display, XDefaultScreen(r->display)));
|
||||
r->copy_buffer = 1;
|
||||
|
||||
r->width = width;
|
||||
r->height = height;
|
||||
|
|
@ -168,7 +169,7 @@ void MwLLNextEvent(MwLL handle) {
|
|||
MwLLGetXYWH(handle, &x, &y, &w, &h);
|
||||
|
||||
MwLLDispatch(handle, draw);
|
||||
XCopyArea(handle->display, handle->pixmap, handle->window, handle->gc, 0, 0, w, h, 0, 0);
|
||||
if(handle->copy_buffer) XCopyArea(handle->display, handle->pixmap, handle->window, handle->gc, 0, 0, w, h, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue