On Wed Jul 12 20:26:34 2023 +0000, David Kahurani wrote:
I updated this to use regions but I believe that line thickness(artificially created) may lead to some false positives.... around the edges and corners of the rectangle but it looks to me like these are unlikely to cause any serious issues.
False negatives (lines that do not need to be drawn but are) are acceptable. False positives are not. The user may be slowly scrolling a view, with only the edge being rendered, in which case inaccuracies near the edge would lead to noticeable artifacts.
GDI+ path and region functions are too expensive to be worth using in an optimization like this.
To prevent false positives, I think you would have to: * Calculate a rectangle for graphics bounds with an expansion to account for line width. * Calculate the bounding box of points in each line or bezier segment. * Check for an intersection between the two rectangles.