freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Git][freetype/freetype-demos][master] Fix compilation errors and (some)


From: Werner Lemberg (@wl)
Subject: [Git][freetype/freetype-demos][master] Fix compilation errors and (some) warnings for clang++.
Date: Sat, 29 May 2021 09:04:54 +0000

Werner Lemberg pushed to branch master at FreeType / FreeType Demo Programs

Commits:

7 changed files:

Changes:

  • ChangeLog
    1
    +2021-05-29  Werner Lemberg  <wl@gnu.org>
    
    2
    +
    
    3
    +	Fix compilation errors and (some) warnings for clang++.
    
    4
    +
    
    5
    +	* graph/gblblit.c (GRGB5[56]5_TO_{RED,GREEN,BLUE}): Add casts.
    
    6
    +	(GDST_STOREP): Use `while {} (0)`.
    
    7
    +	* graph/gblender.h (GBLENDER_LOOKUP, GBLENDER_LOOKUP_[GBR]): Use
    
    8
    +	`while {} (0)`.
    
    9
    +	(GBLENDER_CLOSE, GBLENDER_CHANNEL_CLOSE): Remove final semicolon.
    
    10
    +	* graph/grblit.c (compose_pixel_full): Use `while {} (0)`.
    
    11
    +	(extract5[56]5): Remove final semicolon.
    
    12
    +	(blit_gray8_to_24): Fix typo.
    
    13
    +	* graph/grfont.c (font): Make it static.
    
    14
    +
    
    15
    +	* src/ftcommon.c (FTDemo_Icon): Don't use obfuscating comma
    
    16
    +	operator.
    
    17
    +	* src/ftsdf.c (main): Move definition of `flip_y` before `goto`
    
    18
    +	instructions.
    
    19
    +
    
    1 20
     2021-05-28  Alexei Podtelezhnikov  <apodtele@gmail.com>
    
    2 21
     
    
    3 22
     	[graph/win32] Fix double-dealing of some keystrokes.
    

  • graph/gblblit.c
    ... ... @@ -28,44 +28,60 @@
    28 28
     
    
    29 29
     /* */
    
    30 30
     
    
    31
    -#define  GRGB_TO_RGB565(r,g,b)   ((unsigned short)( (((r) << 8) & 0xF800) |  \
    
    32
    -                                                    (((g) << 3) & 0x07E0) |  \
    
    33
    -                                                    (((b) >> 3) & 0x001F) ) )
    
    34
    -
    
    35
    -#define  GRGB565_TO_RED(p)     ( ((p) >> 8 & 0xF8) | ((p) >> 13 & 0x07) )
    
    36
    -#define  GRGB565_TO_GREEN(p)   ( ((p) >> 3 & 0xFC) | ((p) >>  9 & 0x03) )
    
    37
    -#define  GRGB565_TO_BLUE(p)    ( ((p) << 3 & 0xF8) | ((p) >>  2 & 0x07) )
    
    38
    -
    
    39
    -#define  GRGB565_TO_RGB24(p)   ( ( ((p) << 8) & 0xF80000 ) |             \
    
    40
    -                                 ( ((p) << 3) & 0x0700F8 ) |             \
    
    41
    -                                 ( ((p) << 5) & 0x00FC00 ) |             \
    
    42
    -                                 ( ((p) >> 1) & 0x000300 ) |             \
    
    43
    -                                 ( ((p) >> 2) & 0x000007 ) )
    
    44
    -
    
    45
    -#define  GRGB24_TO_RGB565(p)   ( (unsigned short)( (((p) >> 8) & 0xF800 ) |   \
    
    46
    -                                                   (((p) >> 5) & 0x07E0 ) |   \
    
    47
    -                                                   (((p) >> 3) & 0x001F ) ) )
    
    31
    +#define  GRGB_TO_RGB565(r,g,b)                          \
    
    32
    +           (unsigned short)( ( ( (r) << 8 ) & 0xF800) | \
    
    33
    +                             ( ( (g) << 3 ) & 0x07E0) | \
    
    34
    +                             ( ( (b) >> 3 ) & 0x001F) )
    
    35
    +
    
    36
    +#define  GRGB565_TO_RED(p)                          \
    
    37
    +           (unsigned short)( ( (p) >>  8 & 0xF8 ) | \
    
    38
    +                             ( (p) >> 13 & 0x07 ) )
    
    39
    +#define  GRGB565_TO_GREEN(p)                       \
    
    40
    +           (unsigned short)( ( (p) >> 3 & 0xFC ) | \
    
    41
    +                             ( (p) >> 9 & 0x03 ) )
    
    42
    +#define  GRGB565_TO_BLUE(p)                        \
    
    43
    +           (unsigned short)( ( (p) << 3 & 0xF8 ) | \
    
    44
    +                             ( (p) >> 2 & 0x07 ) )
    
    45
    +
    
    46
    +#define  GRGB565_TO_RGB24(p) ( ( ( (p) << 8 ) & 0xF80000 ) | \
    
    47
    +                               ( ( (p) << 3 ) & 0x0700F8 ) | \
    
    48
    +                               ( ( (p) << 5 ) & 0x00FC00 ) | \
    
    49
    +                               ( ( (p) >> 1 ) & 0x000300 ) | \
    
    50
    +                               ( ( (p) >> 2 ) & 0x000007 ) )
    
    51
    +
    
    52
    +#define  GRGB24_TO_RGB565(p)                             \
    
    53
    +           (unsigned short)( ( ( (p) >> 8 ) & 0xF800 ) | \
    
    54
    +                             ( ( (p) >> 5 ) & 0x07E0 ) | \
    
    55
    +                             ( ( (p) >> 3 ) & 0x001F ) )
    
    48 56
     
    
    49 57
     /* */
    
    50 58
     
    
    51
    -#define  GRGB_TO_RGB555(r,g,b)   ((unsigned short)( (((r) << 7) & 0x7C00) |  \
    
    52
    -                                                    (((g) << 2) & 0x03E0) |  \
    
    53
    -                                                    (((b) >> 3) & 0x001F) ) )
    
    54
    -
    
    55
    -#define  GRGB555_TO_RED(p)     ( ((p) >> 7 & 0xF8) | ((p) >> 12 & 0x07) )
    
    56
    -#define  GRGB555_TO_GREEN(p)   ( ((p) >> 2 & 0xF8) | ((p) >>  7 & 0x07) )
    
    57
    -#define  GRGB555_TO_BLUE(p)    ( ((p) << 3 & 0xF8) | ((p) >>  2 & 0x07) )
    
    58
    -
    
    59
    -#define  GRGB555_TO_RGB24(p)   ( ( ((p) << 9) & 0xF80000 ) |             \
    
    60
    -                                 ( ((p) << 4) & 0x070000 ) |             \
    
    61
    -                                 ( ((p) << 6) & 0x00F800 ) |             \
    
    62
    -                                 ( ((p) << 1) & 0x000700 ) |             \
    
    63
    -                                 ( ((p) << 3) & 0x0000F8 ) |             \
    
    64
    -                                 ( ((p) >> 2) & 0x000007 ) )
    
    65
    -
    
    66
    -#define  GRGB24_TO_RGB555(p)   ( (unsigned short)( (((p) >> 9) & 0x7C00 ) |  \
    
    67
    -                                                   (((p) >> 6) & 0x03E0 ) |  \
    
    68
    -                                                   (((p) >> 3) & 0x001F ) ) )
    
    59
    +#define  GRGB_TO_RGB555(r,g,b)                          \
    
    60
    +           (unsigned short)( ( ( (r) << 7 ) & 0x7C00) | \
    
    61
    +                             ( ( (g) << 2 ) & 0x03E0) | \
    
    62
    +                             ( ( (b) >> 3 ) & 0x001F) )
    
    63
    +
    
    64
    +#define  GRGB555_TO_RED(p)                          \
    
    65
    +           (unsigned short)( ( (p) >>  7 & 0xF8 ) | \
    
    66
    +                             ( (p) >> 12 & 0x07 ) )
    
    67
    +#define  GRGB555_TO_GREEN(p)                       \
    
    68
    +           (unsigned short)( ( (p) >> 2 & 0xF8 ) | \
    
    69
    +                             ( (p) >> 7 & 0x07 ) )
    
    70
    +#define  GRGB555_TO_BLUE(p)                        \
    
    71
    +           (unsigned short)( ( (p) << 3 & 0xF8 ) | \
    
    72
    +                             ( (p) >> 2 & 0x07 ) )
    
    73
    +
    
    74
    +#define  GRGB555_TO_RGB24(p) ( ( ( (p) << 9 ) & 0xF80000 ) | \
    
    75
    +                               ( ( (p) << 4 ) & 0x070000 ) | \
    
    76
    +                               ( ( (p) << 6 ) & 0x00F800 ) | \
    
    77
    +                               ( ( (p) << 1 ) & 0x000700 ) | \
    
    78
    +                               ( ( (p) << 3 ) & 0x0000F8 ) | \
    
    79
    +                               ( ( (p) >> 2 ) & 0x000007 ) )
    
    80
    +
    
    81
    +#define  GRGB24_TO_RGB555(p)                             \
    
    82
    +           (unsigned short)( ( ( (p) >> 9 ) & 0x7C00 ) | \
    
    83
    +                             ( ( (p) >> 6 ) & 0x03E0 ) | \
    
    84
    +                             ( ( (p) >> 3 ) & 0x001F ) )
    
    69 85
     
    
    70 86
     /* */
    
    71 87
     
    
    ... ... @@ -122,11 +138,12 @@
    122 138
         }
    
    123 139
     
    
    124 140
     #define  GDST_STOREP(d,cells,a)                 \
    
    141
    +    do                                          \
    
    125 142
         {                                           \
    
    126 143
           GBlenderPixel  _pix = (cells)[(a)];       \
    
    127 144
                                                     \
    
    128 145
           GDST_STORE3(d,_pix >> 16,_pix >> 8,_pix); \
    
    129
    -    }
    
    146
    +    } while ( 0 )
    
    130 147
     
    
    131 148
     #include "gblany.h"
    
    132 149
     
    
    ... ... @@ -149,11 +166,12 @@
    149 166
         }
    
    150 167
     
    
    151 168
     #define  GDST_STOREP(d,cells,a)                         \
    
    169
    +    do                                                  \
    
    152 170
         {                                                   \
    
    153 171
           GBlenderPixel  _pix = (cells)[(a)];               \
    
    154 172
                                                             \
    
    155 173
           *(unsigned short*)(d) = GRGB24_TO_RGB565(_pix);   \
    
    156
    -    }
    
    174
    +    } while ( 0 )
    
    157 175
     
    
    158 176
     #define  GDST_STOREC(d,r,g,b)   *(unsigned short*)(d) = GRGB_TO_RGB565(r,g,b)
    
    159 177
     
    
    ... ... @@ -177,11 +195,12 @@
    177 195
         }
    
    178 196
     
    
    179 197
     #define  GDST_STOREP(d,cells,a)                         \
    
    198
    +    do                                                  \
    
    180 199
         {                                                   \
    
    181 200
           GBlenderPixel  _pix = (cells)[(a)];               \
    
    182 201
                                                             \
    
    183 202
           *(unsigned short*)(d) = GRGB24_TO_RGB555(_pix);   \
    
    184
    -    }
    
    203
    +    } while ( 0 )
    
    185 204
     
    
    186 205
     #define  GDST_STOREC(d,r,g,b)   *(unsigned short*)(d) = GRGB_TO_RGB555(r,g,b)
    
    187 206
     
    
    ... ... @@ -205,11 +224,12 @@
    205 224
         }
    
    206 225
     
    
    207 226
     #define  GDST_STOREP(d,cells,a)           \
    
    227
    +    do                                    \
    
    208 228
         {                                     \
    
    209 229
           GBlenderPixel  _pix = (cells)[(a)]; \
    
    210 230
                                               \
    
    211 231
           *(d) = GRGB24_TO_GRAY8(_pix);       \
    
    212
    -    }
    
    232
    +    } while ( 0 )
    
    213 233
     
    
    214 234
     #define  GDST_STOREC(d,r,g,b)   *(d) = GRGB_TO_GRAY8(r,g,b)
    
    215 235
     
    

  • graph/gblender.h
    ... ... @@ -161,18 +161,21 @@
    161 161
       GBlenderCell*    _gcells = ( (_fore) == (_gb)->cache_fore ? (_gb)->cache_cells : gblender_lookup( (_gb), _gback, _fore ) );  \
    
    162 162
       GBlenderPixel    _gfore  = (_fore)
    
    163 163
     
    
    164
    -#define  GBLENDER_LOOKUP(gb,back)                        \
    
    165
    -   GBLENDER_STAT_HIT(gb);                                \
    
    166
    -   if ( _gback != (GBlenderPixel)(back) )                \
    
    167
    -   {                                                     \
    
    168
    -     _gback  = (GBlenderPixel)(back);                    \
    
    169
    -     _gcells = gblender_lookup( (gb), _gback, _gfore );  \
    
    170
    -   }
    
    164
    +#define  GBLENDER_LOOKUP(gb,back)                         \
    
    165
    +   GBLENDER_STAT_HIT(gb);                                 \
    
    166
    +   do                                                     \
    
    167
    +   {                                                      \
    
    168
    +     if ( _gback != (GBlenderPixel)(back) )               \
    
    169
    +     {                                                    \
    
    170
    +       _gback  = (GBlenderPixel)(back);                   \
    
    171
    +       _gcells = gblender_lookup( (gb), _gback, _gfore ); \
    
    172
    +     }                                                    \
    
    173
    +   } while ( 0 )
    
    171 174
     
    
    172 175
     #define  GBLENDER_CLOSE(_gb)     \
    
    173 176
       (_gb)->cache_back  = _gback;   \
    
    174 177
       (_gb)->cache_fore  = _gfore;   \
    
    175
    -  (_gb)->cache_cells = _gcells;
    
    178
    +  (_gb)->cache_cells = _gcells
    
    176 179
     
    
    177 180
     
    
    178 181
     
    
    ... ... @@ -197,32 +200,41 @@
    197 200
       (_gb)->cache_g_cells = _ggcells;     \
    
    198 201
       (_gb)->cache_b_back  = _gbback;      \
    
    199 202
       (_gb)->cache_b_fore  = _gbfore;      \
    
    200
    -  (_gb)->cache_b_cells = _gbcells;
    
    201
    -
    
    202
    -
    
    203
    -#define  GBLENDER_LOOKUP_R(gb,back)                                 \
    
    204
    -   GBLENDER_STAT_HIT(gb);                                           \
    
    205
    -   if ( _grback != (back) )                                         \
    
    206
    -   {                                                                \
    
    207
    -     _grback  = (GBlenderPixel)(back);                              \
    
    208
    -     _grcells = gblender_lookup_channel( (gb), _grback, _grfore );  \
    
    209
    -   }
    
    210
    -
    
    211
    -#define  GBLENDER_LOOKUP_G(gb,back)                                 \
    
    212
    -   GBLENDER_STAT_HIT(gb);                                           \
    
    213
    -   if ( _ggback != (back) )                                         \
    
    214
    -   {                                                                \
    
    215
    -     _ggback  = (GBlenderPixel)(back);                              \
    
    216
    -     _ggcells = gblender_lookup_channel( (gb), _ggback, _ggfore );  \
    
    217
    -   }
    
    218
    -
    
    219
    -#define  GBLENDER_LOOKUP_B(gb,back)                                 \
    
    220
    -   GBLENDER_STAT_HIT(gb);                                           \
    
    221
    -   if ( _gbback != (back) )                                         \
    
    222
    -   {                                                                \
    
    223
    -     _gbback  = (GBlenderPixel)(back);                              \
    
    224
    -     _gbcells = gblender_lookup_channel( (gb), _gbback, _gbfore );  \
    
    225
    -   }
    
    203
    +  (_gb)->cache_b_cells = _gbcells
    
    204
    +
    
    205
    +
    
    206
    +#define  GBLENDER_LOOKUP_R(gb,back)                                  \
    
    207
    +   GBLENDER_STAT_HIT(gb);                                            \
    
    208
    +   do                                                                \
    
    209
    +   {                                                                 \
    
    210
    +     if ( _grback != (back) )                                        \
    
    211
    +     {                                                               \
    
    212
    +       _grback  = (GBlenderPixel)(back);                             \
    
    213
    +       _grcells = gblender_lookup_channel( (gb), _grback, _grfore ); \
    
    214
    +     }                                                               \
    
    215
    +   } while ( 0 )
    
    216
    +
    
    217
    +#define  GBLENDER_LOOKUP_G(gb,back)                                  \
    
    218
    +   GBLENDER_STAT_HIT(gb);                                            \
    
    219
    +   do                                                                \
    
    220
    +   {                                                                 \
    
    221
    +     if ( _ggback != (back) )                                        \
    
    222
    +     {                                                               \
    
    223
    +       _ggback  = (GBlenderPixel)(back);                             \
    
    224
    +       _ggcells = gblender_lookup_channel( (gb), _ggback, _ggfore ); \
    
    225
    +     }                                                               \
    
    226
    +   } while ( 0 )
    
    227
    +
    
    228
    +#define  GBLENDER_LOOKUP_B(gb,back)                                  \
    
    229
    +   GBLENDER_STAT_HIT(gb);                                            \
    
    230
    +   do                                                                \
    
    231
    +   {                                                                 \
    
    232
    +     if ( _gbback != (back) )                                        \
    
    233
    +     {                                                               \
    
    234
    +       _gbback  = (GBlenderPixel)(back);                             \
    
    235
    +       _gbcells = gblender_lookup_channel( (gb), _gbback, _gbfore ); \
    
    236
    +     }                                                               \
    
    237
    +   } while ( 0 )
    
    226 238
     
    
    227 239
     
    
    228 240
     #endif /* GBLENDER_H_ */

  • graph/grblit.c
    ... ... @@ -786,20 +786,21 @@
    786 786
     
    
    787 787
     
    
    788 788
     
    
    789
    -#define compose_pixel_full( a, b, n0, n1, n2, max )          \
    
    790
    -  {                                                          \
    
    791
    -    int  d, half = max >> 1;                                 \
    
    792
    -                                                             \
    
    793
    -                                                             \
    
    794
    -    d = (int)b.chroma[0] - a.chroma[0];                      \
    
    795
    -    a.chroma[0] += (unsigned char)((n0*d + half)/max);       \
    
    796
    -                                                             \
    
    797
    -    d = (int)b.chroma[1] - a.chroma[1];                      \
    
    798
    -    a.chroma[1] += (unsigned char)((n1*d + half)/max);       \
    
    799
    -                                                             \
    
    800
    -    d = (int)b.chroma[2] - a.chroma[2];                      \
    
    801
    -    a.chroma[2] += (unsigned char)((n2*d + half)/max);       \
    
    802
    -  }
    
    789
    +#define compose_pixel_full( a, b, n0, n1, n2, max )    \
    
    790
    +  do                                                   \
    
    791
    +  {                                                    \
    
    792
    +    int  d, half = max >> 1;                           \
    
    793
    +                                                       \
    
    794
    +                                                       \
    
    795
    +    d = (int)b.chroma[0] - a.chroma[0];                \
    
    796
    +    a.chroma[0] += (unsigned char)((n0*d + half)/max); \
    
    797
    +                                                       \
    
    798
    +    d = (int)b.chroma[1] - a.chroma[1];                \
    
    799
    +    a.chroma[1] += (unsigned char)((n1*d + half)/max); \
    
    800
    +                                                       \
    
    801
    +    d = (int)b.chroma[2] - a.chroma[2];                \
    
    802
    +    a.chroma[2] += (unsigned char)((n2*d + half)/max); \
    
    803
    +  } while ( 0 )
    
    803 804
     
    
    804 805
     #define compose_pixel( a, b, n, max )  \
    
    805 806
         compose_pixel_full( a, b, n, n, n, max )
    
    ... ... @@ -808,13 +809,13 @@
    808 809
     #define extract555( pixel, color )                           \
    
    809 810
        color.chroma[0] = (unsigned char)((pixel >> 10) & 0x1F);  \
    
    810 811
        color.chroma[1] = (unsigned char)((pixel >>  5) & 0x1F);  \
    
    811
    -   color.chroma[2] = (unsigned char)((pixel      ) & 0x1F);
    
    812
    +   color.chroma[2] = (unsigned char)((pixel      ) & 0x1F)
    
    812 813
     
    
    813 814
     
    
    814 815
     #define extract565( pixel, color )                           \
    
    815 816
        color.chroma[0] = (unsigned char)((pixel >> 11) & 0x1F);  \
    
    816 817
        color.chroma[1] = (unsigned char)((pixel >>  5) & 0x3F);  \
    
    817
    -   color.chroma[2] = (unsigned char)((pixel      ) & 0x1F);
    
    818
    +   color.chroma[2] = (unsigned char)((pixel      ) & 0x1F)
    
    818 819
     
    
    819 820
     
    
    820 821
     #define inject555( color )                          \
    
    ... ... @@ -1133,7 +1134,7 @@
    1133 1134
                 db += ((sb-db)*val) >> 8;
    
    1134 1135
     
    
    1135 1136
                 _write[0] = (unsigned char)dr;
    
    1136
    -            _write[1] = (unsigned char)dg,
    
    1137
    +            _write[1] = (unsigned char)dg;
    
    1137 1138
                 _write[2] = (unsigned char)db;
    
    1138 1139
               }
    
    1139 1140
             }
    

  • graph/grfont.c
    ... ... @@ -268,7 +268,7 @@
    268 268
         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
    
    269 269
       };
    
    270 270
     
    
    271
    -  unsigned char  (*font)[8] = (unsigned char (*)[8])font_8x8;
    
    271
    +  static unsigned char  (*font)[8] = (unsigned char (*)[8])font_8x8;
    
    272 272
     
    
    273 273
     #elif GR_FONT_SIZE == 14
    
    274 274
     
    
    ... ... @@ -534,7 +534,7 @@
    534 534
          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
    
    535 535
       };
    
    536 536
     
    
    537
    -  unsigned char  (*font)[14] = (unsigned char (*)[14])font_8x14;
    
    537
    +  static unsigned char  (*font)[14] = (unsigned char (*)[14])font_8x14;
    
    538 538
     
    
    539 539
     #endif
    
    540 540
     
    

  • src/ftcommon.c
    ... ... @@ -502,12 +502,18 @@
    502 502
           memset( icon.buffer, 0, (size_t)icon.rows * (size_t)icon.pitch );
    
    503 503
     
    
    504 504
           for ( i = 0; i < FT.n_points; i++ )
    
    505
    -        FT.points[i].x *= size, FT.points[i].y *= size;
    
    505
    +      {
    
    506
    +        FT.points[i].x *= size;
    
    507
    +        FT.points[i].y *= size;
    
    508
    +      }
    
    506 509
     
    
    507 510
           FT_Outline_Render( handle->library, &FT, &params );
    
    508 511
     
    
    509 512
           for ( i = 0; i < FT.n_points; i++ )
    
    510
    -        FT.points[i].x /= size, FT.points[i].y /= size;
    
    513
    +      {
    
    514
    +        FT.points[i].x /= size;
    
    515
    +        FT.points[i].y /= size;
    
    516
    +      }
    
    511 517
     
    
    512 518
           picon = &icon;
    
    513 519
         }
    

  • src/ftsdf.c
    ... ... @@ -664,6 +664,10 @@
    664 664
         FT_Error  err       = FT_Err_Ok;
    
    665 665
         char*     exec_name = NULL;
    
    666 666
     
    
    667
    +#ifdef __linux__
    
    668
    +    int  flip_y = 1;
    
    669
    +#endif
    
    670
    +
    
    667 671
     
    
    668 672
         exec_name = ft_basename( argv[0] );
    
    669 673
     
    
    ... ... @@ -687,8 +691,6 @@
    687 691
         }
    
    688 692
     
    
    689 693
     #ifdef __linux__
    
    690
    -    int  flip_y = 1;
    
    691
    -
    
    692 694
         FT_CALL( FT_Property_Set( handle->library, "sdf", "flip_y", &flip_y ) );
    
    693 695
         FT_CALL( FT_Property_Set( handle->library, "bsdf", "flip_y", &flip_y ) );
    
    694 696
     #endif
    


  • reply via email to

    [Prev in Thread] Current Thread [Next in Thread]