allow text atlas to be exported and replaced to support batching#124
Draft
fisherevans wants to merge 2 commits into
Draft
allow text atlas to be exported and replaced to support batching#124fisherevans wants to merge 2 commits into
fisherevans wants to merge 2 commits into
Conversation
4 tasks
…ctureData
Fix panic message typo ("do no match" -> "do not match"), expand doc
comments to document the frame argument and batch-sharing use case, and
add table-driven tests covering deep-copy semantics for PictureDataCopy
and identity/translated/wrong-size cases for CloneWithPictureData.
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.
Problem
text.NewAtlasrenders a font into a private*pixel.PictureData. Drawing text withpixel.Batchrequires all sprites and glyphs to share the same backing picture, but there was no way to read the atlas image or create an atlas that references a larger shared picture.Changes
Atlas.PictureDataCopy— returns a deep copy of the atlas's pixel data so callers can blit it into a shared atlas image.Atlas.CloneWithPictureData(pic, frame)— returns a newAtlasbacked bypic, with all glyph coordinates translated so they remain correct at their new location (frame) within the shared image.Atlas.picnarrowed frompixel.Pictureto*pixel.PictureData(internal only - the exportedPicture()method signature is unchanged).Usage
Test plan
go build ./...unchanged.go test ./ext/text/...— new tests cover deep-copy semantics forPictureDataCopy, identity and translated placements forCloneWithPictureData, and the wrong-dimensions panic.