Skip to content

Synchronous SVG mipmaps #527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 7, 2020

Conversation

adroitwhiz
Copy link
Contributor

@adroitwhiz adroitwhiz commented Nov 21, 2019

This PR depends on scratchfoundation/scratch-svg-renderer#107.

Resolves

Resolves #518

Proposed Changes

This PR builds on @ktbee's excellent work on SVG mipmaps in #431.

When investigating #518, I discovered that once an SVG string is loaded into an SvgRenderer, it can be drawn synchronously at any scale.

The synchronous SVG-drawing method from scratchfoundation/scratch-svg-renderer#107 allows the SVG mipmap logic to be considerably simplified. No callbacks need to be passed around anywhere, much less state needs to be managed and kept track of, and the array of SVGMIPs is now an array of WebGLTextures.

Reason for Changes

This considerably simplifies the state management logic of SVGSkins.

Reducing the complexity of SVGSkins' logic will greatly ease the steps needed to fix #427.

@fsih
Copy link
Contributor

fsih commented Jan 4, 2020

I tested this out locally and it looked good. All tests are passing too.

Copy link
Contributor

@cwillisf cwillisf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! I just have one concern, commented below. What do you think, @adroitwhiz?

Co-Authored-By: Chris Willis-Ford <[email protected]>
@adroitwhiz adroitwhiz requested a review from cwillisf January 7, 2020 15:47
@adroitwhiz
Copy link
Contributor Author

adroitwhiz commented Jan 7, 2020

Also, this is blocked on #534

Copy link
Contributor

@cwillisf cwillisf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rounding of vector bounding box dimensions causes jittering of sprite The call to svg-renderer._draw in SVGSkin.setSVG isn't necessary
3 participants