freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] * src/truetype/ttgxvar.c (ft_var_apply_


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] * src/truetype/ttgxvar.c (ft_var_apply_tuple): Reduce checks.
Date: Fri, 24 May 2024 17:38:26 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

  • b6dbbd96
    by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-24T17:38:14+00:00
    * src/truetype/ttgxvar.c (ft_var_apply_tuple): Reduce checks.

1 changed file:

Changes:

  • src/truetype/ttgxvar.c
    ... ... @@ -1913,60 +1913,55 @@
    1913 1913
     
    
    1914 1914
         for ( i = 0; i < blend->num_axis; i++ )
    
    1915 1915
         {
    
    1916
    -      FT_TRACE6(( "    axis %d coordinate %.5f:\n",
    
    1917
    -                  i, (double)blend->normalizedcoords[i] / 65536 ));
    
    1916
    +      FT_Fixed  ncv = blend->normalizedcoords[i];
    
    1917
    +
    
    1918
    +
    
    1919
    +      FT_TRACE6(( "    axis %d coordinate %.5f:\n", i, (double)ncv / 65536 ));
    
    1918 1920
     
    
    1919 1921
           /* It's not clear why (for intermediate tuples) we don't need     */
    
    1920 1922
           /* to check against start/end -- the documentation says we don't. */
    
    1921 1923
           /* Similarly, it's unclear why we don't need to scale along the   */
    
    1922 1924
           /* axis.                                                          */
    
    1923 1925
     
    
    1924
    -      if ( tuple_coords[i] == 0 )
    
    1925
    -      {
    
    1926
    -        FT_TRACE6(( "      tuple coordinate is zero, ignore\n" ));
    
    1927
    -        continue;
    
    1928
    -      }
    
    1929
    -
    
    1930
    -      if ( blend->normalizedcoords[i] == 0 )
    
    1931
    -      {
    
    1932
    -        FT_TRACE6(( "      axis coordinate is zero, stop\n" ));
    
    1933
    -        apply = 0;
    
    1934
    -        break;
    
    1935
    -      }
    
    1936
    -
    
    1937
    -      if ( blend->normalizedcoords[i] == tuple_coords[i] )
    
    1938
    -      {
    
    1926
    +      if ( tuple_coords[i] == ncv )
    
    1927
    +      { 
    
    1939 1928
             FT_TRACE6(( "      tuple coordinate %.5f fits perfectly\n",
    
    1940 1929
                         (double)tuple_coords[i] / 65536 ));
    
    1941 1930
             /* `apply' does not change */
    
    1942 1931
             continue;
    
    1943 1932
           }
    
    1944 1933
     
    
    1934
    +      if ( tuple_coords[i] == 0 )
    
    1935
    +      { 
    
    1936
    +        FT_TRACE6(( "      tuple coordinate is zero, ignore\n" ));
    
    1937
    +        continue;
    
    1938
    +      }
    
    1939
    +
    
    1945 1940
           if ( !( tupleIndex & GX_TI_INTERMEDIATE_TUPLE ) )
    
    1946
    -      {
    
    1941
    +      { 
    
    1947 1942
             /* not an intermediate tuple */
    
    1948
    -
    
    1949
    -        if ( blend->normalizedcoords[i] < FT_MIN( 0, tuple_coords[i] ) ||
    
    1950
    -             blend->normalizedcoords[i] > FT_MAX( 0, tuple_coords[i] ) )
    
    1943
    +        
    
    1944
    +        if ( ( tuple_coords[i] > ncv && ncv > 0 ) ||
    
    1945
    +             ( tuple_coords[i] < ncv && ncv < 0 ) )
    
    1946
    +        { 
    
    1947
    +          FT_TRACE6(( "      tuple coordinate %.5f fits\n",
    
    1948
    +                      (double)tuple_coords[i] / 65536 ));
    
    1949
    +          apply = FT_MulDiv( apply, ncv, tuple_coords[i] );
    
    1950
    +        }
    
    1951
    +        else
    
    1951 1952
             {
    
    1952 1953
               FT_TRACE6(( "      tuple coordinate %.5f is exceeded, stop\n",
    
    1953 1954
                           (double)tuple_coords[i] / 65536 ));
    
    1954 1955
               apply = 0;
    
    1955 1956
               break;
    
    1956 1957
             }
    
    1957
    -
    
    1958
    -        FT_TRACE6(( "      tuple coordinate %.5f fits\n",
    
    1959
    -                    (double)tuple_coords[i] / 65536 ));
    
    1960
    -        apply = FT_MulDiv( apply,
    
    1961
    -                           blend->normalizedcoords[i],
    
    1962
    -                           tuple_coords[i] );
    
    1963 1958
           }
    
    1964 1959
           else
    
    1965 1960
           {
    
    1966 1961
             /* intermediate tuple */
    
    1967 1962
     
    
    1968
    -        if ( blend->normalizedcoords[i] <= im_start_coords[i] ||
    
    1969
    -             blend->normalizedcoords[i] >= im_end_coords[i]   )
    
    1963
    +        if ( ncv <= im_start_coords[i] ||
    
    1964
    +             ncv >= im_end_coords[i]   )
    
    1970 1965
             {
    
    1971 1966
               FT_TRACE6(( "      intermediate tuple range ]%.5f;%.5f[ is exceeded,"
    
    1972 1967
                           " stop\n",
    
    ... ... @@ -1979,13 +1974,13 @@
    1979 1974
             FT_TRACE6(( "      intermediate tuple range ]%.5f;%.5f[ fits\n",
    
    1980 1975
                         (double)im_start_coords[i] / 65536,
    
    1981 1976
                         (double)im_end_coords[i] / 65536 ));
    
    1982
    -        if ( blend->normalizedcoords[i] < tuple_coords[i] )
    
    1977
    +        if ( ncv < tuple_coords[i] )
    
    1983 1978
               apply = FT_MulDiv( apply,
    
    1984
    -                             blend->normalizedcoords[i] - im_start_coords[i],
    
    1979
    +                             ncv - im_start_coords[i],
    
    1985 1980
                                  tuple_coords[i] - im_start_coords[i] );
    
    1986
    -        else
    
    1981
    +        else /* ncv > tuple_coords[i] */
    
    1987 1982
               apply = FT_MulDiv( apply,
    
    1988
    -                             im_end_coords[i] - blend->normalizedcoords[i],
    
    1983
    +                             im_end_coords[i] - ncv,
    
    1989 1984
                                  im_end_coords[i] - tuple_coords[i] );
    
    1990 1985
           }
    
    1991 1986
         }
    


  • reply via email to

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