Tags: fagu/sauklaue
Tags
Fix antialiasing problems when drawing partial strokes When a line segment is appended to the current stroke, we used to just draw the new line segment on top of the previous picture. Due to antialiasing, this is gives a different result than drawing the entire path at the same time: For example, corners of the path are drawn twice (and therefore twice as dark) with our method. To solve this issue and maintain reasonable efficiency, we keep two pictures for each layer: The first picture (A) contains only the strokes that have been finished. The second picture (B) also contains the stroke that is currently being drawn. When a line segment is added, we reset the contents of (B) inside the bounding box of the line segment to the corresponding contents of (A). We then draw the entire current stroke on (B), clipped to this bounding box.