aboutsummaryrefslogtreecommitdiff
path: root/common/cairo.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-09-22 13:56:51 -0500
committerGitHub <noreply@github.com>2018-09-22 13:56:51 -0500
commit082488a81c491faa71ddc2c87fe985ef28f5d69d (patch)
treeee7316a573d5feb5332bb5cef509bd37faf5bcf7 /common/cairo.c
parenteae42606e2f6956013c0f68c090b4c0fbc3bee72 (diff)
parentc495164f6059d8f352afeead86a510365cc802a1 (diff)
Merge pull request #2677 from ggreer/pretty-fonts
Render fonts slightly nicer
Diffstat (limited to 'common/cairo.c')
-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) {
(color >> (0*8) & 0xFF) / 255.0);
}
+cairo_subpixel_order_t to_cairo_subpixel_order(enum wl_output_subpixel subpixel) {
+ switch (subpixel) {
+ case WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB:
+ return CAIRO_SUBPIXEL_ORDER_RGB;
+ case WL_OUTPUT_SUBPIXEL_HORIZONTAL_BGR:
+ return CAIRO_SUBPIXEL_ORDER_BGR;
+ case WL_OUTPUT_SUBPIXEL_VERTICAL_RGB:
+ return CAIRO_SUBPIXEL_ORDER_VRGB;
+ case WL_OUTPUT_SUBPIXEL_VERTICAL_BGR:
+ return CAIRO_SUBPIXEL_ORDER_VBGR;
+ default:
+ return CAIRO_SUBPIXEL_ORDER_DEFAULT;
+ }
+ return CAIRO_SUBPIXEL_ORDER_DEFAULT;
+}
+
cairo_surface_t *cairo_image_surface_scale(cairo_surface_t *image,
int width, int height) {
int image_width = cairo_image_surface_get_width(image);