mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	buffer: introduce wlr_readonly_data_buffer
This commit is contained in:
		
							parent
							
								
									ea585dba0f
								
							
						
					
					
						commit
						7ec66a9990
					
				
					 2 changed files with 105 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -25,6 +25,34 @@ struct wlr_shm_client_buffer {
 | 
			
		|||
struct wlr_shm_client_buffer *shm_client_buffer_create(
 | 
			
		||||
	struct wl_resource *resource);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * A read-only buffer that holds a data pointer.
 | 
			
		||||
 *
 | 
			
		||||
 * This is suitable for passing raw pixel data to a function that accepts a
 | 
			
		||||
 * wlr_buffer.
 | 
			
		||||
 */
 | 
			
		||||
struct wlr_readonly_data_buffer {
 | 
			
		||||
	struct wlr_buffer base;
 | 
			
		||||
 | 
			
		||||
	const void *data;
 | 
			
		||||
	uint32_t format;
 | 
			
		||||
	size_t stride;
 | 
			
		||||
 | 
			
		||||
	void *saved_data;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Wraps a read-only data pointer into a wlr_buffer. The data pointer may be
 | 
			
		||||
 * accessed until readonly_data_buffer_drop() is called.
 | 
			
		||||
 */
 | 
			
		||||
struct wlr_readonly_data_buffer *readonly_data_buffer_create(uint32_t format,
 | 
			
		||||
		size_t stride, uint32_t width, uint32_t height, const void *data);
 | 
			
		||||
/**
 | 
			
		||||
 * Drops ownership of the buffer (see wlr_buffer_drop() for more details) and
 | 
			
		||||
 * perform a copy of the data pointer if a consumer still has the buffer locked.
 | 
			
		||||
 */
 | 
			
		||||
bool readonly_data_buffer_drop(struct wlr_readonly_data_buffer *buffer);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Buffer capabilities.
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue