gears.wallpaper: Create smaller image surface (FS#1087)

When no wallpaper exists yet, instead of creating a black image surface which
covers all the screens, just create a surface for the screen which we need. This
means that way less pixels have to be uploaded to the X11 server, which should
be faster.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2013-02-12 15:15:16 +01:00
parent bf72cf71ea
commit f86a9c896c
1 changed files with 3 additions and 2 deletions

View File

@ -37,8 +37,9 @@ local function prepare_wallpaper(s)
local img = surface(root.wallpaper())
if not img then
-- No wallpaper yet
img = cairo.ImageSurface(cairo.Format.RGB24, root_geom.width, root_geom.height)
-- No wallpaper yet, create an image surface for just the part we need
img = cairo.ImageSurface(cairo.Format.RGB24, geom.width, geom.height)
img:set_device_offset(-geom.x, -geom.y)
end
local cr = cairo.Context(img)