Repository navigation
Bound shape recording, mip and glyph cache accounting - #33
Merged
Merged
Conversation
- Shape.MaxBytes (default DefaultShapeBytes) bounds each form's edges, strips and bins; recording and the stroker stop at the budget, and FillShape/FillUnion report ErrEdgeBudget. The bound is the shape's, so concurrent first use is deterministic. Fixes #30. - Texture.MipBytes sums the rounded level sizes and the distinct wrap levels instead of W*H/3, saturating on overflow. Fixes #31. - GlyphCache counts mask capacity, not length, and draws a mask larger than MaxBytes without keeping it. Fixes #32.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #30, #31, #32.
#30 Shape geometry budget
Shape.MaxBytes(defaultDefaultShapeBytes, enough forDefaultMaxEdgesedges) bounds each form's edges, strips and row bins. A stroke makes up to two forms, so at most 2×MaxBytes.addPathand the stroker (newStroker.halt, checked between subpaths) stop early.FillShape(fill and stroke) andFillUnionreportErrEdgeBudgetfor a truncated form.MaxEdgesget the same truncated form on concurrent first use.Canvas.Stroke.#31 Texture.MipBytes
W*H/3, saturating on overflow.#32 GlyphCache.MaxBytes
cap(Pix), so reused larger buffers are accounted correctly.MaxBytesis drawn but not cached; it is recycled afterwards.MaxBytesdoc states what is not counted (scratch, map).Tests
New
budget_test.go: MipBytes vs. actual levels (RGBA/gray/alpha/indexed, thin/odd/NPOT), oversized glyph entry, large-to-small buffer reuse, budget reduction, shape fill/stroke/union truncation, concurrent first use.TestGlyphCacheEvictionnow enforces the budget strictly.go test ./...passes, new tests also under-race.