diff options
author | David Robillard <d@drobilla.net> | 2025-01-23 17:00:37 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2025-01-23 18:02:52 -0500 |
commit | ef551ed4b85bc29b3eb48775faeadcf41596c40a (patch) | |
tree | 9ce41788cd4c06b9e9e3ce3f6fbfa01cd4931e8b /src/win.c | |
parent | d7a93950b3af397580572adf2e366f3b162104a9 (diff) | |
download | pugl-ef551ed4b85bc29b3eb48775faeadcf41596c40a.tar.gz pugl-ef551ed4b85bc29b3eb48775faeadcf41596c40a.tar.bz2 pugl-ef551ed4b85bc29b3eb48775faeadcf41596c40a.zip |
Replace puglPostRedisplayRect() with puglObscureRegion()
Diffstat (limited to 'src/win.c')
-rw-r--r-- | src/win.c | 20 |
1 files changed, 15 insertions, 5 deletions
@@ -4,6 +4,7 @@ #include "win.h" #include "internal.h" +#include "macros.h" #include "platform.h" #include "pugl/pugl.h" @@ -1216,13 +1217,22 @@ puglObscureView(PuglView* view) } PuglStatus -puglPostRedisplayRect(PuglView* view, const PuglRect rect) +puglObscureRegion(PuglView* const view, + const int x, + const int y, + const unsigned width, + const unsigned height) { - const RECT r = {(long)floor(rect.x), - (long)floor(rect.y), - (long)ceil(rect.x + rect.width), - (long)ceil(rect.y + rect.height)}; + if (!puglIsValidPosition(x, y) || !puglIsValidSize(width, height)) { + return PUGL_BAD_PARAMETER; + } + + const int cx = MAX(0, x); + const int cy = MAX(0, y); + const unsigned cw = MIN(view->lastConfigure.width, width); + const unsigned ch = MIN(view->lastConfigure.height, height); + const RECT r = {cx, cy, cx + (long)cw, cy + (long)ch}; InvalidateRect(view->impl->hwnd, &r, false); return PUGL_SUCCESS; |