Backport improvements from TechPizzaDev fork.
Merged
JI
1y ago+1477+1477+0123456789012345678901234567890123456789-359-359-012345678901234567890123456789
Prerequisites
- I have written a descriptive pull-request title
- I have verified that there are no overlapping pull-requests open
- I have verified that I am following matches the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules :cop:.
- I have provided test coverage for my change (where applicable)
Description
Note: Most of the work here was done by @TechPizzaDev
This PR introduces several improvements and refactorings across the drawing and shapes components of the codebase. The most significant changes include refactoring the ComplexPolygon and EllipsePolygon classes for better performance and maintainability, updating the handling of Bezier and Arc line segments, and making various code quality and style improvements. Below are the most important changes grouped by theme:
Shapes and Geometry Refactoring
- Refactored
ComplexPolygonto lazily compute bounds and internal paths, reducing upfront computation and improving performance. Introduced helper methods for internal path initialization and bounds calculation. - Refactored
EllipsePolygonto inherit fromPolygonand removed redundant internal state. Updated transformation logic to work with the new structure, simplifying the class and aligning it with other shape types. - Added new
PolygonStrokerclass designed to replacePolygonOffsetter
Line Segment Improvements
- Updated
CubicBezierLineSegmentandArcLineSegmentto computeEndPointandFlatten()lazily, improving efficiency and consistency. Added a convenience constructor and a method to retrieve control points for Bezier segments.
Code Quality and Style
- Improved pattern and variable naming for clarity and consistency (e.g.,
opaqueconstant, use of slice syntax). - Removed unused usings and unnecessary project properties, and made minor code cleanups throughout the codebase.
Miscellaneous Fixes
- Fixed a bug in
RichTextGlyphRendererby referencing the correct path list. - Updated the Visual Studio solution file for compatibility with Visual Studio 2022 (v18).