mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	render/drm_format_set: add wlr_drm_format_has
This commit is contained in:
		
							parent
							
								
									585a908a01
								
							
						
					
					
						commit
						d78cb808b1
					
				
					 2 changed files with 13 additions and 11 deletions
				
			
		| 
						 | 
				
			
			@ -4,6 +4,7 @@
 | 
			
		|||
#include <wlr/render/drm_format_set.h>
 | 
			
		||||
 | 
			
		||||
struct wlr_drm_format *wlr_drm_format_create(uint32_t format);
 | 
			
		||||
bool wlr_drm_format_has(const struct wlr_drm_format *fmt, uint64_t modifier);
 | 
			
		||||
bool wlr_drm_format_add(struct wlr_drm_format **fmt_ptr, uint64_t modifier);
 | 
			
		||||
struct wlr_drm_format *wlr_drm_format_dup(const struct wlr_drm_format *format);
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -48,13 +48,7 @@ bool wlr_drm_format_set_has(const struct wlr_drm_format_set *set,
 | 
			
		|||
		return true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for (size_t i = 0; i < fmt->len; ++i) {
 | 
			
		||||
		if (fmt->modifiers[i] == modifier) {
 | 
			
		||||
			return true;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return false;
 | 
			
		||||
	return wlr_drm_format_has(fmt, modifier);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool wlr_drm_format_set_add(struct wlr_drm_format_set *set, uint32_t format,
 | 
			
		||||
| 
						 | 
				
			
			@ -106,6 +100,15 @@ struct wlr_drm_format *wlr_drm_format_create(uint32_t format) {
 | 
			
		|||
	return fmt;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool wlr_drm_format_has(const struct wlr_drm_format *fmt, uint64_t modifier) {
 | 
			
		||||
	for (size_t i = 0; i < fmt->len; ++i) {
 | 
			
		||||
		if (fmt->modifiers[i] == modifier) {
 | 
			
		||||
			return true;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool wlr_drm_format_add(struct wlr_drm_format **fmt_ptr, uint64_t modifier) {
 | 
			
		||||
	struct wlr_drm_format *fmt = *fmt_ptr;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -113,11 +116,9 @@ bool wlr_drm_format_add(struct wlr_drm_format **fmt_ptr, uint64_t modifier) {
 | 
			
		|||
		return true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for (size_t i = 0; i < fmt->len; ++i) {
 | 
			
		||||
		if (fmt->modifiers[i] == modifier) {
 | 
			
		||||
	if (wlr_drm_format_has(fmt, modifier)) {
 | 
			
		||||
		return true;
 | 
			
		||||
	}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (fmt->len == fmt->capacity) {
 | 
			
		||||
		size_t capacity = fmt->capacity ? fmt->capacity * 2 : 4;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue