summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-09-22 13:56:51 -0500
committerLibravatar GitHub <noreply@github.com>2018-09-22 13:56:51 -0500
commit082488a81c491faa71ddc2c87fe985ef28f5d69d (patch)
treeee7316a573d5feb5332bb5cef509bd37faf5bcf7 /common
parentMerge pull request #2660 from RyanDwyer/fix-scratchpad-iteration (diff)
parentswaybar, swaylock, & tree/container: Set cairo font options to render text an... (diff)
downloadsway-082488a81c491faa71ddc2c87fe985ef28f5d69d.tar.gz
sway-082488a81c491faa71ddc2c87fe985ef28f5d69d.tar.zst
sway-082488a81c491faa71ddc2c87fe985ef28f5d69d.zip
Merge pull request #2677 from ggreer/pretty-fonts
Render fonts slightly nicer
Diffstat (limited to 'common')
-rw-r--r--common/cairo.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/common/cairo.c b/common/cairo.c
index c267c77c..e8231484 100644
--- a/common/cairo.c
+++ b/common/cairo.c
@@ -13,6 +13,22 @@ void cairo_set_source_u32(cairo_t *cairo, uint32_t color) {
13 (color >> (0*8) & 0xFF) / 255.0); 13 (color >> (0*8) & 0xFF) / 255.0);
14} 14}
15 15
16cairo_subpixel_order_t to_cairo_subpixel_order(enum wl_output_subpixel subpixel) {
17 switch (subpixel) {
18 case WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB:
19 return CAIRO_SUBPIXEL_ORDER_RGB;
20 case WL_OUTPUT_SUBPIXEL_HORIZONTAL_BGR:
21 return CAIRO_SUBPIXEL_ORDER_BGR;
22 case WL_OUTPUT_SUBPIXEL_VERTICAL_RGB:
23 return CAIRO_SUBPIXEL_ORDER_VRGB;
24 case WL_OUTPUT_SUBPIXEL_VERTICAL_BGR:
25 return CAIRO_SUBPIXEL_ORDER_VBGR;
26 default:
27 return CAIRO_SUBPIXEL_ORDER_DEFAULT;
28 }
29 return CAIRO_SUBPIXEL_ORDER_DEFAULT;
30}
31
16cairo_surface_t *cairo_image_surface_scale(cairo_surface_t *image, 32cairo_surface_t *cairo_image_surface_scale(cairo_surface_t *image,
17 int width, int height) { 33 int width, int height) {
18 int image_width = cairo_image_surface_get_width(image); 34 int image_width = cairo_image_surface_get_width(image);