image: Fix image centering creates blur
Ensure to only move by physical pixel values
This commit is contained in:
parent
fc553d108c
commit
74d148572f
1 changed files with 6 additions and 3 deletions
|
|
@ -453,10 +453,13 @@ mod imp {
|
||||||
|
|
||||||
// vertical centering in widget when no scrolling
|
// vertical centering in widget when no scrolling
|
||||||
let x = f64::max((widget_width - widget.image_displayed_width()) / 2.0, 0.);
|
let x = f64::max((widget_width - widget.image_displayed_width()) / 2.0, 0.);
|
||||||
snapshot.translate(&graphene::Point::new(x as f32, 0.));
|
|
||||||
|
|
||||||
let y = f64::max((widget_height - widget.image_displayed_height()) / 2.0, 0.);
|
let y = f64::max((widget_height - widget.image_displayed_height()) / 2.0, 0.);
|
||||||
snapshot.translate(&graphene::Point::new(0., y as f32));
|
// round to pixel values to not have a half pixel offset to physical pixels
|
||||||
|
// the offset would leading to a blury output
|
||||||
|
snapshot.translate(&graphene::Point::new(
|
||||||
|
widget.round(x) as f32,
|
||||||
|
widget.round(y) as f32,
|
||||||
|
));
|
||||||
|
|
||||||
// apply the transformations from properties
|
// apply the transformations from properties
|
||||||
snapshot.rotate(widget.rotation() as f32);
|
snapshot.rotate(widget.rotation() as f32);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue