From f86a9c896cddc215704ddfe3779ad03545e71e72 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Tue, 12 Feb 2013 15:15:16 +0100 Subject: [PATCH] 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 --- lib/gears/wallpaper.lua.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/gears/wallpaper.lua.in b/lib/gears/wallpaper.lua.in index 3a58f0dff..9039ee9c6 100644 --- a/lib/gears/wallpaper.lua.in +++ b/lib/gears/wallpaper.lua.in @@ -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)