freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] master a791e7c 1/2: Fix clang++ warnings.


From: Werner Lemberg
Subject: [freetype2-demos] master a791e7c 1/2: Fix clang++ warnings.
Date: Thu, 31 Mar 2022 12:24:23 -0400 (EDT)

branch: master
commit a791e7cca82bd1a1c72f08faa2adcd4c36c02a1b
Author: Werner Lemberg <wl@gnu.org>
Commit: Werner Lemberg <wl@gnu.org>

    Fix clang++ warnings.
    
    * src/ftsdf.c (event_font_update, write_header, draw), src/rsvg-port.c
    (rsvg_port_preset_slot): Add or remove casts.
---
 src/ftsdf.c     | 25 +++++++++++++------------
 src/rsvg-port.c |  6 +++---
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/src/ftsdf.c b/src/ftsdf.c
index 914d528..002fa0c 100644
--- a/src/ftsdf.c
+++ b/src/ftsdf.c
@@ -124,7 +124,7 @@
     status.generation_time = ( (float)( end - start ) /
                                (float)CLOCKS_PER_SEC ) * 1000.0f;
 
-    printf( "Generation Time: %.0f ms\n", status.generation_time );
+    printf( "Generation Time: %.0f ms\n", (double)status.generation_time );
 
   Exit:
     return err;
@@ -240,7 +240,7 @@
 
     sprintf( header_string,
              "SDF Generated in: %.0f ms, From: %s",
-             status.generation_time,
+             (double)status.generation_time,
              status.use_bitmap ? "Bitmap" : "Outline" );
     grWriteCellString( display->bitmap, 0, 2 * HEADER_HEIGHT,
                        header_string, display->fore_color );
@@ -257,8 +257,8 @@
       /* Only print these in reconstruction mode. */
       sprintf( header_string,
                "Width: %.2f, Edge: %.2f",
-               status.width,
-               status.edge );
+               (double)status.width,
+               (double)status.edge );
       grWriteCellString( display->bitmap, 0, 4 * HEADER_HEIGHT,
                          header_string, display->fore_color );
     }
@@ -523,25 +523,26 @@
 
     /* Finally loop over all pixels inside the draw region        */
     /* and copy pixels from the sample region to the draw region. */
-    for ( FT_Int  j = (FT_UInt)( draw_region.yMax - 1 ),
-                  y = (FT_UInt)sample_region.yMin;
+    for ( FT_Int  j = draw_region.yMax - 1,
+                  y = sample_region.yMin;
           j >= draw_region.yMin;
           j--, y++ )
     {
-      for ( FT_Int  i = (FT_UInt)draw_region.xMin,
-                    x = (FT_UInt)sample_region.xMin;
+      for ( FT_Int  i = draw_region.xMin,
+                    x = sample_region.xMin;
             i < draw_region.xMax;
             i++, x++ )
       {
-        FT_Int  display_index = j * (FT_UInt)display->bitmap->width + i;
+        FT_Int  display_index = j * display->bitmap->width + i;
         float   min_dist;
 
 
         if ( status.nearest_filtering )
         {
-          FT_Int  bitmap_index = ( y / status.scale ) * bitmap->width +
-                                 x / status.scale;
-          FT_Byte  pixel_value = buffer[bitmap_index];
+          FT_Int   bitmap_index =
+                     ( y / (FT_Int)status.scale ) * (FT_Int)bitmap->width +
+                     x / (FT_Int)status.scale;
+          FT_Byte  pixel_value  = buffer[bitmap_index];
 
 
           /* If nearest filtering then simply take the value of the */
diff --git a/src/rsvg-port.c b/src/rsvg-port.c
index c7e363e..13e52c2 100644
--- a/src/rsvg-port.c
+++ b/src/rsvg-port.c
@@ -252,8 +252,8 @@
     }
 
     /* Scale factors from SVG coordinates to the needed output size. */
-    x_svg_to_out = (float)metrics.x_ppem / dimension_svg.width;
-    y_svg_to_out = (float)metrics.y_ppem / dimension_svg.height;
+    x_svg_to_out = (double)metrics.x_ppem / dimension_svg.width;
+    y_svg_to_out = (double)metrics.y_ppem / dimension_svg.height;
 
     /*
      * Create a cairo recording surface.  This is done for two reasons.
@@ -376,7 +376,7 @@
     slot->metrics.vertBearingY = (FT_Pos)( vertBearingY * 64 );
 
     if ( slot->metrics.vertAdvance == 0 )
-      slot->metrics.vertAdvance = (FT_Pos)( metrics_height * 1.2 * 64 );
+      slot->metrics.vertAdvance = (FT_Pos)( metrics_height * 1.2f * 64 );
 
     /* If a render call is to follow, just destroy the context for the */
     /* recording surface since no more drawing will be done on it.     */



reply via email to

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