Skip to content
  • David Turner's avatar
    [smooth] Minor speedup to smooth rasterizer · 7f0cb0cb
    David Turner authored
    This speeds up the smooth rasterizer by avoiding a
    conditional branches in the hot path. Namely:
    
    - Define a fixed "null cell" which will be pointed
      to whenever the current cell is outside of the current
      target region. This avoids a "ras.cell != NULL"
      check in the FT_INTEGRATE() macro.
    
    - Also use the null cell as a sentinel at the end of
      all ycells[] linked-lists, by setting its x coordinate
      to INT_MAX. This avoids a 'if (!cell)' check in
      gray_set_cell() as well.
    
    - Slightly change the worker struct fields to perform
      a little less operations during rendering.
    
    Example results (on a 2013 Corei5-3337U CPU)
    
      out/ftbench -p -s10 -t5 -bc /usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf
    
        Before: 5.472 us/op
        After:  5.275 us/op
    
      out/ftbench -p -s60 -t5 -bc /usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf
    
        Before: 17.988 us/op
        After:  17.389 us/op
    7f0cb0cb
To find the state of this project's repository at the time of any of these versions, check out the tags.