Skip to content
  • Federico Mena Quintero's avatar
    Make RsvgLength carry its own direction for normalization · 5a85e7cf
    Federico Mena Quintero authored
    This is the pattern that was there before:
    
      foo.some_len = _rsvg_css_parse_length (str);   /* at creation time */
    
      ...
    
      double real_len = _rsvg_css_normalize_length (&foo.some_len, ctx, LENGTH_DIR_HORIZONTAL); /* at rendering time */
    
    This led to a few inconsistencies in the way directions got used -
    sometimes cut&paste errors could creep in and a vertical direction
    would be used for a horizontal length, for example.
    
    This change makes the pattern be
    
      foo.some_len = _rsvg_css_parse_length (str, LENGTH_DIR_HORIZONTAL);   /* at creation time */
    
      ...
    
      double real_len = _rsvg_css_normalize_length (&foo.some_len, ctx); /* at rendering time */
    
    I.e. lengths get their direction-to-be-resolved-as at creation time,
    during parse_length(); this gets stored in a new field length.dir.
    Later, normalize_length() knows which direction to use.
    5a85e7cf