mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Fix damage tracking on HiDPI
This commit is contained in:
		
							parent
							
								
									90614f3a63
								
							
						
					
					
						commit
						44fcc06efd
					
				
					 1 changed files with 13 additions and 10 deletions
				
			
		| 
						 | 
					@ -191,17 +191,14 @@ static void scissor_output(struct wlr_output *wlr_output,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void render_texture(struct wlr_output *wlr_output,
 | 
					static void render_texture(struct wlr_output *wlr_output,
 | 
				
			||||||
		pixman_region32_t *output_damage, struct wlr_texture *texture,
 | 
							pixman_region32_t *output_damage, struct wlr_texture *texture,
 | 
				
			||||||
		const struct wlr_box *_box, const float matrix[static 9], float alpha) {
 | 
							const struct wlr_box *box, const float matrix[static 9], float alpha) {
 | 
				
			||||||
	struct wlr_renderer *renderer =
 | 
						struct wlr_renderer *renderer =
 | 
				
			||||||
		wlr_backend_get_renderer(wlr_output->backend);
 | 
							wlr_backend_get_renderer(wlr_output->backend);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_box box = *_box;
 | 
					 | 
				
			||||||
	scale_box(&box, wlr_output->scale);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	pixman_region32_t damage;
 | 
						pixman_region32_t damage;
 | 
				
			||||||
	pixman_region32_init(&damage);
 | 
						pixman_region32_init(&damage);
 | 
				
			||||||
	pixman_region32_union_rect(&damage, &damage, box.x, box.y,
 | 
						pixman_region32_union_rect(&damage, &damage, box->x, box->y,
 | 
				
			||||||
		box.width, box.height);
 | 
							box->width, box->height);
 | 
				
			||||||
	pixman_region32_intersect(&damage, &damage, output_damage);
 | 
						pixman_region32_intersect(&damage, &damage, output_damage);
 | 
				
			||||||
	bool damaged = pixman_region32_not_empty(&damage);
 | 
						bool damaged = pixman_region32_not_empty(&damage);
 | 
				
			||||||
	if (!damaged) {
 | 
						if (!damaged) {
 | 
				
			||||||
| 
						 | 
					@ -238,6 +235,8 @@ static void render_surface_iterator(struct wlr_surface *surface, int sx, int sy,
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						scale_box(&box, wlr_output->scale);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	float matrix[9];
 | 
						float matrix[9];
 | 
				
			||||||
	enum wl_output_transform transform =
 | 
						enum wl_output_transform transform =
 | 
				
			||||||
		wlr_output_transform_invert(surface->current->transform);
 | 
							wlr_output_transform_invert(surface->current->transform);
 | 
				
			||||||
| 
						 | 
					@ -384,7 +383,11 @@ static void render_container_simple_border_normal(struct sway_output *output,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Title text
 | 
						// Title text
 | 
				
			||||||
	if (title_texture) {
 | 
						if (title_texture) {
 | 
				
			||||||
		struct wlr_box texture_box = { .x = box.x, .y = box.y };
 | 
							float output_scale = output->wlr_output->scale;
 | 
				
			||||||
 | 
							struct wlr_box texture_box = {
 | 
				
			||||||
 | 
								.x = box.x * output_scale,
 | 
				
			||||||
 | 
								.y = box.y * output_scale,
 | 
				
			||||||
 | 
							};
 | 
				
			||||||
		wlr_texture_get_size(title_texture,
 | 
							wlr_texture_get_size(title_texture,
 | 
				
			||||||
			&texture_box.width, &texture_box.height);
 | 
								&texture_box.width, &texture_box.height);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -392,8 +395,8 @@ static void render_container_simple_border_normal(struct sway_output *output,
 | 
				
			||||||
		wlr_matrix_project_box(matrix, &texture_box, WL_OUTPUT_TRANSFORM_NORMAL,
 | 
							wlr_matrix_project_box(matrix, &texture_box, WL_OUTPUT_TRANSFORM_NORMAL,
 | 
				
			||||||
			0.0, output->wlr_output->transform_matrix);
 | 
								0.0, output->wlr_output->transform_matrix);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		render_texture(output->wlr_output, output_damage, title_texture, &box,
 | 
							render_texture(output->wlr_output, output_damage, title_texture,
 | 
				
			||||||
			matrix, 1.0);
 | 
								&texture_box, matrix, 1.0);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -566,7 +569,7 @@ static void render_output(struct sway_output *output, struct timespec *when,
 | 
				
			||||||
		goto renderer_end;
 | 
							goto renderer_end;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	//wlr_renderer_clear(renderer, (float[]){1, 1, 0, 0});
 | 
						//wlr_renderer_clear(renderer, (float[]){1, 1, 0, 1});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct sway_container *workspace = output_get_active_workspace(output);
 | 
						struct sway_container *workspace = output_get_active_workspace(output);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue