draw_rows cleanup
I attach a draft patch, to be reviewed and stress-tested in the early 0-55 days.
For the first part of draw_rows()
, where the background is painted:
- avoid code duplication on
row_data
being nullptr or not by merging the two branches; - don't treat fragments specially, they properly contain their desired background.
For the second part, where the text is drawn:
- reorganize the loop to avoid code duplications;
- by the way, gotos are gone too;
- simply skip fragments rather than the complicated handling they have now (and start rendering one column earlier to count for a CJK possibly crossing the starting border).
I think it's a nice win in code size and readability (the two loops together went down from ~250 to ~150 lines).
But most importantly, BiDi supports requires this cleanup around fragments, since the current crazy +1/-1 dances can't be ported to different logical/visual directions without going insane (and resulting in an unmaintainable nightmare).