summaryrefslogtreecommitdiff
path: root/src/entry.c
diff options
context:
space:
mode:
authorPhil Jones <philj56@gmail.com>2022-06-23 14:48:35 +0100
committerPhil Jones <philj56@gmail.com>2022-06-23 14:48:35 +0100
commit128fa39bb62d1a1c627812f15030bf3ffb82100d (patch)
treee16020dd31faf4a2033ac45a3038981b8c54276c /src/entry.c
parentc57d9a2a65725dce8632bea6e539517f6b5e8f7d (diff)
Remove Cairo scale factor.
The scale factor is now only used to scale font sizes, not all Cairo drawing operations. This makes pixel-sized options correct.
Diffstat (limited to 'src/entry.c')
-rw-r--r--src/entry.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/src/entry.c b/src/entry.c
index b476e36..b3292ce 100644
--- a/src/entry.c
+++ b/src/entry.c
@@ -24,11 +24,10 @@ static void rounded_rectangle(cairo_t *cr, uint32_t width, uint32_t height, uint
cairo_close_path(cr);
}
-void entry_init(struct entry *entry, uint8_t *restrict buffer, uint32_t width, uint32_t height, uint32_t scale)
+void entry_init(struct entry *entry, uint8_t *restrict buffer, uint32_t width, uint32_t height)
{
entry->image.width = width;
entry->image.height = height;
- entry->image.scale = scale;
/*
* Create the cairo surfaces and contexts we'll be using.
@@ -46,7 +45,6 @@ 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;
@@ -59,16 +57,8 @@ 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);
- /*
- * Cairo drawing operations take the scale into account,
- * so we account for that here.
- */
- width /= scale;
- height /= scale;
-
/* Draw the background */
struct color color = entry->background_color;
@@ -124,7 +114,7 @@ void entry_init(struct entry *entry, uint8_t *restrict buffer, uint32_t width, u
cairo_clip(cr);
/* Setup the backend. */
- entry_backend_init(entry, &width, &height, scale);
+ entry_backend_init(entry, &width, &height);
/*
* To avoid performing all this drawing twice, we take a small
@@ -181,10 +171,3 @@ void entry_update(struct entry *entry)
entry->index = !entry->index;
}
-
-void entry_set_scale(struct entry *entry, uint32_t scale)
-{
- entry->image.scale = scale;
- cairo_surface_set_device_scale(entry->cairo[0].surface, scale, scale);
- cairo_surface_set_device_scale(entry->cairo[1].surface, scale, scale);
-}