summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@gnugeneration.com>2017-02-03 13:01:00 -0800
committerVito Caputo <vcaputo@gnugeneration.com>2017-02-03 13:01:00 -0800
commitc2e4a7977349f5b4b69cc39829c50512a9503f15 (patch)
treea22ef2320d5f393c3813af6a79e2adc826a29039 /src
parent467137113c8b3d6bcb73ecff8c76f23793f25cb7 (diff)
fb: add fragment bounds checking helper
Simple x,y coordinate check
Diffstat (limited to 'src')
-rw-r--r--src/fb.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/fb.h b/src/fb.h
index 13f6bcd..64f657b 100644
--- a/src/fb.h
+++ b/src/fb.h
@@ -34,4 +34,13 @@ void fb_get_put_pages_count(fb_t *fb, unsigned *count);
fb_t * fb_new(int drm_fd, uint32_t crtc_id, uint32_t *connectors, int n_connectors, drmModeModeInfoPtr mode, int n_pages);
void fb_fragment_divide(fb_fragment_t *fragment, unsigned n_fragments, fb_fragment_t fragments[]);
+static inline int fb_fragment_contains(fb_fragment_t *fragment, int x, int y)
+{
+ if (x < fragment->x || x >= fragment->x + fragment->width ||
+ y < fragment->y || y >= fragment->y + fragment->height)
+ return 0;
+
+ return 1;
+}
+
#endif
© All Rights Reserved