gears.wallpaper: Make code more readable

by introducing some extra variables that server as some documentation.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2014-08-24 11:54:12 +02:00
parent 1942986468
commit 0dc6b7f724
1 changed files with 3 additions and 1 deletions

View File

@ -139,7 +139,9 @@ function wallpaper.maximized(surf, s, ignore_aspect, offset)
if offset then if offset then
cr:translate(offset.x, offset.y) cr:translate(offset.x, offset.y)
elseif not ignore_aspect then elseif not ignore_aspect then
cr:translate(((geom.width / aspect_w) - w) / 2, ((geom.height / aspect_h) - h) / 2) local scaled_width = geom.width / aspect_w
local scaled_height = geom.height / aspect_h
cr:translate((scaled_width - w) / 2, (scaled_height - h) / 2)
end end
cr:set_source_surface(surf, 0, 0) cr:set_source_surface(surf, 0, 0)