Fix loss of clarity with odd-sized centered image
This commit is contained in:
parent
bdeb891378
commit
605859cdd4
@ -100,9 +100,14 @@ void render_background_image(cairo_t *cairo, cairo_surface_t *image,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BACKGROUND_MODE_CENTER:
|
case BACKGROUND_MODE_CENTER:
|
||||||
|
/*
|
||||||
|
* Align the unscaled image to integer pixel boundaries
|
||||||
|
* in order to prevent loss of clarity (this only matters
|
||||||
|
* for odd-sized images).
|
||||||
|
*/
|
||||||
cairo_set_source_surface(cairo, image,
|
cairo_set_source_surface(cairo, image,
|
||||||
(double)buffer_width / 2 - width / 2,
|
(int)((double)buffer_width / 2 - width / 2),
|
||||||
(double)buffer_height / 2 - height / 2);
|
(int)((double)buffer_height / 2 - height / 2));
|
||||||
break;
|
break;
|
||||||
case BACKGROUND_MODE_TILE: {
|
case BACKGROUND_MODE_TILE: {
|
||||||
cairo_pattern_t *pattern = cairo_pattern_create_for_surface(image);
|
cairo_pattern_t *pattern = cairo_pattern_create_for_surface(image);
|
||||||
|
Loading…
Reference in New Issue
Block a user