mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-02-18 22:05:48 -05:00
drm_format_set: Add wlr_drm_format_set_remove
wlr_drm_format_set_remove lets you remove a modifier from the specified format, useful for filtering implicit modifiers.
This commit is contained in:
parent
014023c14f
commit
70d3635985
2 changed files with 20 additions and 0 deletions
|
|
@ -86,6 +86,23 @@ bool wlr_drm_format_set_add(struct wlr_drm_format_set *set, uint32_t format,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool wlr_drm_format_set_remove(struct wlr_drm_format_set *set, uint32_t format,
|
||||
uint64_t modifier) {
|
||||
struct wlr_drm_format *fmt = format_set_get(set, format);
|
||||
if (fmt == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (size_t idx = 0; idx < fmt->len; idx++) {
|
||||
if (fmt->modifiers[idx] == modifier) {
|
||||
memmove(&fmt->modifiers[idx], &fmt->modifiers[idx+1], fmt->len - idx - 1);
|
||||
fmt->len--;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void wlr_drm_format_init(struct wlr_drm_format *fmt, uint32_t format) {
|
||||
*fmt = (struct wlr_drm_format){
|
||||
.format = format,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue