naughty: Correctly scale large square icons.

Fix #3005
This commit is contained in:
Emmanuel Lepage Vallee 2020-03-07 21:24:22 -05:00
parent a69b6123b8
commit 97e403b4e9
1 changed files with 4 additions and 1 deletions

View File

@ -65,7 +65,10 @@ function icon:draw(_, cr, width, height)
local x, y = 0, 0
if (strategy == "center" and aspect > 1) or strategy == "resize" then
if (strategy == "center" and aspect < 1) or strategy == "resize" then
x = math.floor((width - w*aspect) / 2)
y = math.floor((height - h*aspect) / 2)
elseif strategy == "center" and aspect > 1 then
x = math.floor((width - w) / 2)
y = math.floor((height - h) / 2)
end