From eb69442a06ea3be6af294c9db0e66e277a529a27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 12 Mar 2021 14:00:42 +0400 Subject: [PATCH] ui: fold qemu_alloc_display in only caller MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A minor code simplification. Signed-off-by: Marc-André Lureau Message-Id: <20210312100108.2706195-2-marcandre.lureau@redhat.com> Signed-off-by: Gerd Hoffmann --- ui/console.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/ui/console.c b/ui/console.c index c2fdf975b6..2de5f4105b 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1386,26 +1386,18 @@ static QemuConsole *new_console(DisplayState *ds, console_type_t console_type, return s; } -static void qemu_alloc_display(DisplaySurface *surface, int width, int height) -{ - qemu_pixman_image_unref(surface->image); - surface->image = NULL; - - surface->format = PIXMAN_x8r8g8b8; - surface->image = pixman_image_create_bits(surface->format, - width, height, - NULL, width * 4); - assert(surface->image != NULL); - - surface->flags = QEMU_ALLOCATED_FLAG; -} - DisplaySurface *qemu_create_displaysurface(int width, int height) { DisplaySurface *surface = g_new0(DisplaySurface, 1); trace_displaysurface_create(surface, width, height); - qemu_alloc_display(surface, width, height); + surface->format = PIXMAN_x8r8g8b8; + surface->image = pixman_image_create_bits(surface->format, + width, height, + NULL, width * 4); + assert(surface->image != NULL); + surface->flags = QEMU_ALLOCATED_FLAG; + return surface; }