summaryrefslogtreecommitdiff
path: root/src/entry_backend
diff options
context:
space:
mode:
authorPhil Jones <philj56@gmail.com>2022-06-25 14:03:27 +0100
committerPhil Jones <philj56@gmail.com>2022-06-25 14:03:27 +0100
commita6c20eb3713fc5e4b2c8f4075762b899bf9c1857 (patch)
tree3917d4528964fc8a24a518cc0401efe1e2e47508 /src/entry_backend
parenteacb7c80619dd0c2d8bf601215374f64779373b6 (diff)
Don't double-draw background colour on first draw.
This improves start-up performance for large windows.
Diffstat (limited to 'src/entry_backend')
-rw-r--r--src/entry_backend/harfbuzz.c8
-rw-r--r--src/entry_backend/pango.c9
2 files changed, 15 insertions, 2 deletions
diff --git a/src/entry_backend/harfbuzz.c b/src/entry_backend/harfbuzz.c
index ed15e82..f0a04e0 100644
--- a/src/entry_backend/harfbuzz.c
+++ b/src/entry_backend/harfbuzz.c
@@ -196,6 +196,10 @@ void entry_backend_harfbuzz_update(struct entry *entry)
hb_buffer_t *buffer = entry->harfbuzz.hb_buffer;
uint32_t width;
+ cairo_save(cr);
+ struct color color = entry->foreground_color;
+ cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a);
+
/* Render the entry text */
hb_buffer_clear_contents(buffer);
setup_hb_buffer(buffer);
@@ -221,7 +225,7 @@ void entry_backend_harfbuzz_update(struct entry *entry)
hb_shape(entry->harfbuzz.hb_font, buffer, NULL, 0);
if (i == entry->selection) {
cairo_save(cr);
- struct color color = entry->selection_color;
+ color = entry->selection_color;
cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a);
}
width = render_hb_buffer(cr, buffer);
@@ -229,4 +233,6 @@ void entry_backend_harfbuzz_update(struct entry *entry)
cairo_restore(cr);
}
}
+
+ cairo_restore(cr);
}
diff --git a/src/entry_backend/pango.c b/src/entry_backend/pango.c
index cc2a361..6c2399a 100644
--- a/src/entry_backend/pango.c
+++ b/src/entry_backend/pango.c
@@ -59,6 +59,11 @@ void entry_backend_pango_update(struct entry *entry)
cairo_t *cr = entry->cairo[entry->index].cr;
PangoLayout *layout = entry->pango.layout;
+ cairo_save(cr);
+ struct color color = entry->foreground_color;
+ cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a);
+
+
pango_layout_set_text(layout, entry->input_mb, -1);
pango_cairo_update_layout(cr, layout);
pango_cairo_show_layout(cr, layout);
@@ -84,7 +89,7 @@ void entry_backend_pango_update(struct entry *entry)
pango_cairo_update_layout(cr, layout);
if (i == entry->selection) {
cairo_save(cr);
- struct color color = entry->selection_color;
+ color = entry->selection_color;
cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a);
}
pango_cairo_show_layout(cr, layout);
@@ -93,4 +98,6 @@ void entry_backend_pango_update(struct entry *entry)
}
pango_layout_get_size(layout, &width, &height);
}
+
+ cairo_restore(cr);
}