Created
April 16, 2018 19:09
-
-
Save Elv13/d86bb320c9fc9e14f8a6fbcc0af8e625 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function draw(self, content, cr, width, height) | |
local c = self._private.client[1] | |
local s = surface(c.content) | |
local geo = c:geometry() | |
local scale = math.min(width/geo.width, height/geo.height) | |
local w, h = geo.width*scale, geo.height*scale | |
local dx, dy = (width-w)/2, (height-h)/2 | |
cr:translate(dx, dy) | |
shape.rounded_rect(cr, w, h) | |
cr:clip() | |
cr:scale(scale, scale) | |
cr:set_source_surface(s) | |
cr:paint() | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment