From daf05e6eb11435a8ed095934ad36dfbd88b06ab2 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Thu, 28 Apr 2016 17:53:19 +0200 Subject: [PATCH] xresources theme: Use a RecordingSurface for wallpaper This theme draws a minimal wallpaper directly. This commit replaces the ImageSurface of the wallpaper with a RecordingSurface. This shouldn't have any visible effect, except for reducing memory usage, because an ImageSurface needs a lot of memory and is only eventually released by the garbage collector. A RecordingSurface instead just records the operations that were done which needs a lot less memory for the simple operations done here. Signed-off-by: Uli Schlachter --- themes/xresources/assets.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/themes/xresources/assets.lua b/themes/xresources/assets.lua index e7a7db722..c83550249 100644 --- a/themes/xresources/assets.lua +++ b/themes/xresources/assets.lua @@ -51,7 +51,8 @@ function theme_assets.wallpaper(bg, fg, alt_fg, s) s = s or screen.primary local height = s.workarea.height local width = s.workarea.width - local img = cairo.ImageSurface(cairo.Format.ARGB32, width, height) + local img = cairo.RecordingSurface(cairo.Content.COLOR, + cairo.Rectangle { x = 0, y = 0, width = width, height = height }) local cr = cairo.Context(img) local letter_size = height/10