mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	renderer: Sanity check texture source bounds
This commit is contained in:
		
							parent
							
								
									aee31edaad
								
							
						
					
					
						commit
						664ec59095
					
				
					 1 changed files with 9 additions and 0 deletions
				
			
		| 
						 | 
					@ -26,6 +26,15 @@ bool wlr_render_pass_submit(struct wlr_render_pass *render_pass) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_render_pass_add_texture(struct wlr_render_pass *render_pass,
 | 
					void wlr_render_pass_add_texture(struct wlr_render_pass *render_pass,
 | 
				
			||||||
		const struct wlr_render_texture_options *options) {
 | 
							const struct wlr_render_texture_options *options) {
 | 
				
			||||||
 | 
						// make sure the texture source box does not try and sample outside of the
 | 
				
			||||||
 | 
						// texture
 | 
				
			||||||
 | 
						if (!wlr_fbox_empty(&options->src_box)) {
 | 
				
			||||||
 | 
							const struct wlr_fbox *box = &options->src_box;
 | 
				
			||||||
 | 
							assert(box->x >= 0 && box->y >= 0 &&
 | 
				
			||||||
 | 
								box->x + box->width <= options->texture->width &&
 | 
				
			||||||
 | 
								box->y + box->height <= options->texture->height);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	render_pass->impl->add_texture(render_pass, options);
 | 
						render_pass->impl->add_texture(render_pass, options);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue