Skip to content

Fixing CanvasSpriteRenderer to correctly render sprites with rotated and trimmed base textures #8679

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
Sep 29, 2022

Conversation

smlmyck
Copy link
Contributor

@smlmyck smlmyck commented Sep 29, 2022

Description of change

Changes made in #8615 to fix one case of broken canvas rendering ended up breaking canvas rendering in a different way (pixi-spine#460).

The fix I made previously didn't take into account the height/width swap required if a texture was rotated, and the fixes made in v6.5.0 were absolutely fine for this case.

I've prepared another demo site that covers all cases of the canvas rendering: https://vagabond-ambiguous-gerbera.glitch.me/

The previous red/blue atlas I used that had rotation but no trim remains, and a new purple/green atlas that has rotation and trim has been. Both were rendering correctly in v6.4, only one worked fine in 6.5.2 and 6.5.3, but both render correctly again with this fix applied.

I ran into difficulty trying to write a unit test for this, but I could spend more time in the future if that's required.

Closes #8678

Pre-Merge Checklist
  • Tests and/or benchmarks are included
  • Lint process passed (npm run lint)
  • Tests passed (npm run test)

Copy link
Member

@bigtimebuddy bigtimebuddy left a comment

Choose a reason for hiding this comment

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

Thanks for the examples. I'm good with this.

@bigtimebuddy bigtimebuddy added this to the v6.5.5 milestone Sep 29, 2022
@ivanpopelyshev
Copy link
Collaborator

Tried the patch here: https://codesandbox.io/s/white-meadow-boynnd?file=/src/index.js

If you comment patchTextureRotation() height becomes bigger than width, which shouldnt be the case.

@bigtimebuddy bigtimebuddy added the ✅ Ready To Merge Helpful when issues are in the queue waiting to get merged. This means the PR is completed and has t label Sep 29, 2022
@bigtimebuddy bigtimebuddy merged commit 289f2c4 into pixijs:v6.x Sep 29, 2022
@bigtimebuddy
Copy link
Member

Thank you @smlmyck!

@magos1983
Copy link

I have tested it as well, works correctly.

@bigtimebuddy
Copy link
Member

kfyh pushed a commit to kfyh/pixijs-issue-11021 that referenced this pull request Oct 31, 2024
bigtimebuddy pushed a commit that referenced this pull request Jan 8, 2025
* Apply #8679 to 7.x branch

* Fix linter errors

---------

Co-authored-by: Kevin Hew <kevin.hew@roxorgaming.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✅ Ready To Merge Helpful when issues are in the queue waiting to get merged. This means the PR is completed and has t
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants