Repository navigation
Render glyphs with nonzero IntersectionRule - #36
Conversation
| int startY = operation.Location.Y; | ||
| int startX = operation.Location.X; | ||
| int offsetSpan = 0; | ||
|
|
There was a problem hiding this comment.
This fixes the issue where it fails when you try and render a glyph off image.
|
|
||
| [Theory] | ||
| [WithSolidFilledImages(200, 200, "White", PixelTypes.Rgba32)] | ||
| public void OpenSansJWithNoneZeroShouldntExtendPastGlyphe<TPixel>(TestImageProvider<TPixel> provider) |
There was a problem hiding this comment.
This is tracking a regression the switch to nonzero caused
| Span<PointF> subBuffer = buffer.Slice(totalAdded); | ||
| int added = this.paths[i].FindIntersections(start, end, subBuffer, intersectionRule); | ||
| totalAdded += added; | ||
| lock (this.paths) |
There was a problem hiding this comment.
Why do you need the lock here?
There was a problem hiding this comment.
because I expect this methods to be call in parallel and I only want the flattening and instantiation of the InternalPaths are relatively expensive operations.
I did however miss the 2nd null check to make sure I didn't actually run the code a 2nd time.
There was a problem hiding this comment.
Maybe this should be moved to a separate method?
There was a problem hiding this comment.
FindIntersections() is a method on the IPath interface and only ComplexPolygons have this sort of initialization as its trying to efficiently composite the simplifed forms off all its child paths (which themselves can be ComplexPolygons)... not sure its worth adding all the complexity at this stage that change can probably be added when we review the API shapes.
There was a problem hiding this comment.
I tend to agree. Get it working now so we have a reference to optimize and refactor against.
JimBobSquarePants
left a comment
There was a problem hiding this comment.
Let's definitely look to remove that lock. But good enough for now.
Prerequisites
Description
Ensure we render glyphs using nonzero rule to prevent holes when using certain fonts.
Also fixed a side issue when starting trying to render a glyph completely to the left/above the image.
Fixes #35