render: compute image width/height in single function call
This commit is contained in:
parent
db9c382002
commit
4ba8550da8
7 changed files with 18 additions and 18 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue