summaryrefslogtreecommitdiff
path: root/src/entry.c
diff options
context:
space:
mode:
authorPhil Jones <philj56@gmail.com>2022-06-07 13:47:35 +0100
committerPhil Jones <philj56@gmail.com>2022-06-07 15:31:49 +0100
commit51bbf779ba2c9d5954e2c9470a8eae7c1ddd38a5 (patch)
treef2b52f0211f9052fefa64e23c6a0d81305391589 /src/entry.c
parent7562d7b539d8013376de2cff494231ba307f4ee1 (diff)
Switch from using (E)GL to wl_shm.
eglInitialize() is slow (~50-100ms), and uses a fair amount of memory (~100 MB). For such a small, simple program that just wants to launch as quickly as possible, wl_shm performs better.
Diffstat (limited to 'src/entry.c')
-rw-r--r--src/entry.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/entry.c b/src/entry.c
index 644fe39..845df0a 100644
--- a/src/entry.c
+++ b/src/entry.c
@@ -1,4 +1,3 @@
-#include <arpa/inet.h>
#include <cairo/cairo.h>
#include <glib.h>
#include <pango/pangocairo.h>
@@ -17,14 +16,6 @@ void entry_init(struct entry *entry, uint32_t width, uint32_t height, uint32_t s
height /= scale;
/*
- * Cairo uses native 32 bit integers for pixels, so if this processor
- * is little endian we have to tell OpenGL to swizzle the texture.
- */
- if (htonl(0xFFu) != 0xFFu) {
- entry->image.swizzle = true;
- }
-
- /*
* Create the cairo surface and context we'll be using.
*/
cairo_surface_t *surface = cairo_image_surface_create(
@@ -90,8 +81,10 @@ void entry_init(struct entry *entry, uint32_t width, uint32_t height, uint32_t s
cairo_clip(cr);
/* Setup Pango. */
+ log_debug("Creating Pango context.\n");
PangoContext *context = pango_cairo_create_context(cr);
+ log_debug("Creating Pango font description.\n");
PangoFontDescription *font_description =
pango_font_description_from_string(entry->font_name);
pango_font_description_set_size(
@@ -101,10 +94,13 @@ void entry_init(struct entry *entry, uint32_t width, uint32_t height, uint32_t s
pango_font_description_free(font_description);
entry->pango.prompt_layout = pango_layout_new(context);
+ log_debug("Setting Pango text.\n");
pango_layout_set_text(entry->pango.prompt_layout, "run: ", -1);
int prompt_width;
int prompt_height;
+ log_debug("Get Pango pixel size.\n");
pango_layout_get_pixel_size(entry->pango.prompt_layout, &prompt_width, &prompt_height);
+ log_debug("First Pango draw.\n");
pango_cairo_update_layout(cr, entry->pango.prompt_layout);
/* Draw the prompt now, as this only needs to be done once */
@@ -118,6 +114,7 @@ void entry_init(struct entry *entry, uint32_t width, uint32_t height, uint32_t s
cairo_rectangle(cr, 0, 0, width, height);
cairo_clip(cr);
+ log_debug("Creating Pango layout.\n");
entry->pango.entry_layout = pango_layout_new(context);
pango_layout_set_text(entry->pango.entry_layout, "", -1);