diff options
author | Mattias Andrée <maandree@kth.se> | 2023-01-08 22:19:02 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2023-01-08 22:19:02 +0100 |
commit | 603142e23528061e7ba5bdbcb466e676237745a8 (patch) | |
tree | cbcff6a1032d056e1e7b87846fdcc96248b932a7 /libfonts_calculate_subpixel_order.c | |
parent | Partially implement libfonts_get_default_font, libfonts_get_{default,output}_rendering_settings (diff) | |
download | libfonts-603142e23528061e7ba5bdbcb466e676237745a8.tar.gz libfonts-603142e23528061e7ba5bdbcb466e676237745a8.tar.bz2 libfonts-603142e23528061e7ba5bdbcb466e676237745a8.tar.xz |
Fix warnings
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libfonts_calculate_subpixel_order.c')
-rw-r--r-- | libfonts_calculate_subpixel_order.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/libfonts_calculate_subpixel_order.c b/libfonts_calculate_subpixel_order.c index 81a58f6..5727fc9 100644 --- a/libfonts_calculate_subpixel_order.c +++ b/libfonts_calculate_subpixel_order.c @@ -19,15 +19,11 @@ libfonts_calculate_subpixel_order(enum libfonts_subpixel_order unrotated, const double x[4], y[4], xmin, ymin, xmax, ymax, t1, t2; int trans, i, j; - switch (unrotated) { - case LIBFONTS_SUBPIXEL_ORDER_UNKNOWN: - case LIBFONTS_SUBPIXEL_ORDER_NONRGB: - case LIBFONTS_SUBPIXEL_ORDER_NONLINEAR: - case LIBFONTS_SUBPIXEL_ORDER_OTHER: + if (unrotated == LIBFONTS_SUBPIXEL_ORDER_UNKNOWN || + unrotated == LIBFONTS_SUBPIXEL_ORDER_NONRGB || + unrotated == LIBFONTS_SUBPIXEL_ORDER_NONLINEAR || + unrotated == LIBFONTS_SUBPIXEL_ORDER_OTHER) return unrotated; - default: - break; - } for (i = 0; i < 3; i++) for (j = 0; j < 3; j++) @@ -108,7 +104,7 @@ known: if (unrotated <= LIBFONTS_SUBPIXEL_ORDER_G_R_B) return unrotated ^ 1; else - return 7 - (unrotated & 7) + (unrotated & ~7); + return 7 - (unrotated & 7) + (unrotated & (enum libfonts_subpixel_order)~7U); case FLOPPED: if (unrotated <= LIBFONTS_SUBPIXEL_ORDER_G_R_B) @@ -126,7 +122,7 @@ known: return unrotated; default: - return ((unrotated + trans) & 3) + (unrotated & ~3); + return (enum libfonts_subpixel_order)((((int)unrotated + trans) & 3) + ((int)unrotated & ~3)); } } @@ -250,9 +246,9 @@ test(int xtrans, int ytrans, int zscale, int xscale, int yscale) {-xscale, 0, ytrans}, { 0, 0, zscale}}}; struct libfonts_transformation nonlinear_matrix = {.m = { - {+xscale, +yscale / 2., xtrans}, - { 0, +yscale, ytrans}, - { 0, 0, zscale}}}; + {+xscale, +yscale / (double)2, xtrans}, + { 0, +yscale, ytrans}, + { 0, 0, zscale}}}; struct libfonts_transformation unknown_matrix = {.m = { {0, 0, 0}, {0, 0, 0}, |