1
0
Fork 0
forked from wry/wry

render: compute image width/height in single function call

This commit is contained in:
Julian Orth 2024-02-03 23:27:22 +01:00
parent db9c382002
commit 4ba8550da8
7 changed files with 18 additions and 18 deletions

View file

@ -197,8 +197,9 @@ impl Renderer<'_> {
&Color::from_rgba_straight(20, 20, 20, 255),
);
if let Some(tex) = placeholder.textures.get(&self.base.scale) {
let x = x + (pos.width() - tex.texture.width()) / 2;
let y = y + (pos.height() - tex.texture.height()) / 2;
let (tex_width, tex_height) = tex.texture.size();
let x = x + (pos.width() - tex_width) / 2;
let y = y + (pos.height() - tex_height) / 2;
self.base.render_texture(
&tex.texture,
x,