summaryrefslogtreecommitdiff
path: root/src/entry.c
diff options
context:
space:
mode:
authorPhil Jones <philj56@gmail.com>2022-12-26 17:12:31 +0000
committerPhil Jones <philj56@gmail.com>2023-02-28 23:47:21 +0000
commit5dc06ce1f99e8ea25386bf3823b995be5f1cac53 (patch)
treec09b54cb29168a701cae0eeeff041278b384fc93 /src/entry.c
parent6fa119926ad7cc6142cd876dc5b8d24fd99ce181 (diff)
Convert to using Cairo scale.
Instead of scaling various theme parameters ourselves, just set the scale in Cairo. This shouldn't result in any visible changes, but lays the ground work for fractional scaling support.
Diffstat (limited to 'src/entry.c')
-rw-r--r--src/entry.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/entry.c b/src/entry.c
index 6a55741..4ad825a 100644
--- a/src/entry.c
+++ b/src/entry.c
@@ -64,6 +64,7 @@ void entry_init(struct entry *entry, uint8_t *restrict buffer, uint32_t width, u
height,
width * sizeof(uint32_t)
);
+ cairo_surface_set_device_scale(surface, scale, scale);
cairo_t *cr = cairo_create(surface);
entry->cairo[0].surface = surface;
@@ -76,8 +77,12 @@ void entry_init(struct entry *entry, uint8_t *restrict buffer, uint32_t width, u
height,
width * sizeof(uint32_t)
);
+ cairo_surface_set_device_scale(entry->cairo[1].surface, scale, scale);
entry->cairo[1].cr = cairo_create(entry->cairo[1].surface);
+ /* If we're scaling with Cairo, remember to account for that here. */
+ width /= scale;
+ height /= scale;
log_debug("Drawing window.\n");
/* Draw the background */
@@ -197,17 +202,6 @@ void entry_init(struct entry *entry, uint8_t *restrict buffer, uint32_t width, u
}
/*
- * TODO:
- * This is a dirty hack. The proper thing to do is probably just to
- * stop scaling everything manually, set cairo_scale and have done
- * with. The reason that isn't how things are currently done is due to
- * historic scaling behaviour of tofi.
- */
- if (!entry->cursor_theme.thickness_specified) {
- entry->cursor_theme.thickness *= scale;
- }
-
- /*
* Perform an initial render of the text.
* This is done here rather than by calling entry_update to avoid the
* unnecessary cairo_paint() of the background for the first frame,