mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	wlr_scene: Assert wlr_scene_rect has nonnegative dimensions
This commit is contained in:
		
							parent
							
								
									52dce29e06
								
							
						
					
					
						commit
						52afedadea
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -691,11 +691,13 @@ static void scene_node_update(struct wlr_scene_node *node,
 | 
			
		|||
 | 
			
		||||
struct wlr_scene_rect *wlr_scene_rect_create(struct wlr_scene_tree *parent,
 | 
			
		||||
		int width, int height, const float color[static 4]) {
 | 
			
		||||
	assert(parent);
 | 
			
		||||
	assert(width >= 0 && height >= 0);
 | 
			
		||||
 | 
			
		||||
	struct wlr_scene_rect *scene_rect = calloc(1, sizeof(*scene_rect));
 | 
			
		||||
	if (scene_rect == NULL) {
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
	assert(parent);
 | 
			
		||||
	scene_node_init(&scene_rect->node, WLR_SCENE_NODE_RECT, parent);
 | 
			
		||||
 | 
			
		||||
	scene_rect->width = width;
 | 
			
		||||
| 
						 | 
				
			
			@ -712,6 +714,8 @@ void wlr_scene_rect_set_size(struct wlr_scene_rect *rect, int width, int height)
 | 
			
		|||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	assert(width >= 0 && height >= 0);
 | 
			
		||||
 | 
			
		||||
	rect->width = width;
 | 
			
		||||
	rect->height = height;
 | 
			
		||||
	scene_node_update(&rect->node, NULL);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue