diff options
author | David Robillard <d@drobilla.net> | 2023-05-12 11:44:21 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-05-12 11:59:17 -0400 |
commit | ad8ecdfbb77f831f501667556ad93144f00f8db6 (patch) | |
tree | 83ca97c780bc6b26a4292ba19487a69a4f890be3 | |
parent | 1e755094587c00feb7f9a6c7a03d1219a5c09e8a (diff) | |
download | pugl-ad8ecdfbb77f831f501667556ad93144f00f8db6.tar.gz pugl-ad8ecdfbb77f831f501667556ad93144f00f8db6.tar.bz2 pugl-ad8ecdfbb77f831f501667556ad93144f00f8db6.zip |
Windows: Share common drawing context code
-rw-r--r-- | src/win_cairo.c | 6 | ||||
-rw-r--r-- | src/win_gl.c | 11 |
2 files changed, 5 insertions, 12 deletions
diff --git a/src/win_cairo.c b/src/win_cairo.c index 10e06e6..0aab254 100644 --- a/src/win_cairo.c +++ b/src/win_cairo.c @@ -108,7 +108,7 @@ puglWinCairoEnter(PuglView* view, const PuglExposeEvent* expose) if (expose && !(st = puglWinCairoCreateDrawContext(view)) && !(st = puglWinCairoOpen(view))) { - BeginPaint(view->impl->hwnd, &view->impl->paint); + st = puglWinEnter(view, expose); } return st; @@ -134,11 +134,9 @@ puglWinCairoLeave(PuglView* view, const PuglExposeEvent* expose) puglWinCairoClose(view); puglWinCairoDestroyDrawContext(view); - - EndPaint(view->impl->hwnd, &view->impl->paint); } - return PUGL_SUCCESS; + return puglWinLeave(view, expose); } static void* diff --git a/src/win_gl.c b/src/win_gl.c index 293dd9b..f707fc6 100644 --- a/src/win_gl.c +++ b/src/win_gl.c @@ -261,25 +261,20 @@ puglWinGlEnter(PuglView* view, const PuglExposeEvent* expose) return PUGL_FAILURE; } + const PuglStatus st = puglWinEnter(view, expose); wglMakeCurrent(view->impl->hdc, surface->hglrc); - - if (expose) { - BeginPaint(view->impl->hwnd, &view->impl->paint); - } - - return PUGL_SUCCESS; + return st; } static PuglStatus puglWinGlLeave(PuglView* view, const PuglExposeEvent* expose) { if (expose) { - EndPaint(view->impl->hwnd, &view->impl->paint); SwapBuffers(view->impl->hdc); } wglMakeCurrent(NULL, NULL); - return PUGL_SUCCESS; + return puglWinLeave(view, expose); } PuglGlFunc |