Only call render_menu once per frame

An actual surface is not needed to estimate font sizes; a 1x1 image
will do, as long as the cairo context has the same options.
This commit is contained in:
M Stoeckl 2024-10-31 10:27:47 -04:00 committed by adnano
parent 260eaba88e
commit 0947765fc9
3 changed files with 16 additions and 3 deletions

5
menu.h
View file

@ -1,6 +1,7 @@
#ifndef WMENU_MENU_H
#define WMENU_MENU_H
#include <cairo/cairo.h>
#include <stdbool.h>
#include <sys/types.h>
#include <xkbcommon/xkbcommon.h>
@ -51,6 +52,10 @@ struct menu {
struct wl_context *context;
// 1x1 surface used estimate text sizes with pango
cairo_surface_t *test_surface;
cairo_t *test_cairo;
int width;
int height;
int line_height;