freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype-demos][master] * src/ftgrid.c (event_grid_zoom)


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype-demos][master] * src/ftgrid.c (event_grid_zoom): Limit relative zooming.
Date: Sun, 15 Dec 2024 02:22:48 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType Demo Programs

Commits:

  • 03047ba3
    by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-12-14T21:20:05-05:00
     * src/ftgrid.c (event_grid_zoom): Limit relative zooming.
    

1 changed file:

Changes:

  • src/ftgrid.c
    ... ... @@ -1074,16 +1074,21 @@
    1074 1074
       {
    
    1075 1075
         int  frc, exp;
    
    1076 1076
     
    
    1077
    -    /* The floating scale is reversibly adjusted after decomposing it into */
    
    1078
    -    /* fraction and exponent. Direct bit manipulation is less portable.    */
    
    1077
    +
    
    1078
    +    if ( ( step > 0 && status.scale > 8.0f * status.scale_0 ) ||
    
    1079
    +         ( step < 0 && status.scale * 8.0f < status.scale_0 ) )
    
    1080
    +      return;
    
    1081
    +
    
    1082
    +    /* The floating scale is reversibly adjusted after decomposing it */
    
    1083
    +    /* into fraction and exponent, meanwhile truncating the fraction. */
    
    1084
    +    /* Direct bit manipulation in floats is less portable.            */
    
    1079 1085
         frc = (int)( 8.0f * frexpf( status.scale, &exp ) );
    
    1080 1086
     
    
    1081 1087
         frc += step;
    
    1082 1088
         exp += ( frc >> 2 ) - 1;
    
    1083 1089
         frc  = ( frc  & 3 ) | 4;
    
    1084 1090
     
    
    1085
    -    if ( -8 < exp && exp <= 8 )
    
    1086
    -      status.scale = ldexpf( 0.125f * frc, exp );
    
    1091
    +    status.scale = ldexpf( 0.125f * frc, exp );
    
    1087 1092
       }
    
    1088 1093
     
    
    1089 1094
     
    


  • reply via email to

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