-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
GLES2 & GLES3 Fixes ninepatch margins for high resolution textures. #32170
Conversation
a8b3bdf
to
1a6f08c
Compare
… patch texture resolution.. Scaled ninepatch margins in screen space to be relative of the ninepatch size when the patch size is smaller than the patch texture resolution.
1a6f08c
to
6ee84f5
Compare
@puthre Can you upload the texture you used to test this? I don't have any assets I can use to test this PR, but I would like to test before approving. Thanks in advance. :) |
@clayjohn Sure, here you are. |
I can confirm this fixes the issue in GLES2. We need to make the behaviour match in GLES3 before merging though. |
In GLES3 within |
The main problem for me was that the gles3 version seemed to have some other problems as it was behaving differently and not in a good way from gles2 (before this patch). I'll try to find the time to look at it in more depth. |
That would be great! Let me know if you need any help. :) |
… patch texture resolution Scaled ninepatch margins in screen space to be relative of the ninepatch size when the patch size is smaller than the patch texture resolution.
@clayjohn I think I got it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks!
Thanks! |
this needs to either be reverted or have a flag to enable it because it compleatly breaks compatibility and isn't how 9 slices should work. what should happen is if you shrink your 9 slice smaller then the texture it should start clipping the middle and if its less then the middle it should start clipping the edges NOT mess with them |
I had the same problem, but they ignored my existence ... |
this is going to make graphical gui's a pain in the ass to build. |
@puthre Can you weigh in here? @Shadowblitz16 Please don't resort to personal attacks. When reviewing PR's we rely on contributors to identify best practices in areas that we are less familiar. Sometimes fixing one workflow breaks another. This can happen when the contributor only turns their mind to fixing a particular (broken) workflow and forgets about another (equally valid) worlkflow. Saying "people don't have common sense when picking what issues should and shouldn't be added" is plain rude and does not help anyone. Since you clearly know better than everyone else, please suggest how we can fix the problem you are experiencing rather than attacking the people involved. |
@clayjohn
apologies if I upset someone |
I wrote a demo of the NinePatchTexture plug-in. You can compare the zoom effect and the picture quality. Maybe you will laugh out after reading ... |
@clayjohn I think neither the previous behavior nor the current one are ideal: |
In Jiugong's standard algorithm: But I think NinePatchRect's current algorithm has lost its practical significance. Come Here Please. |
Yes, I am in favor of this solution, adding an option to the properties panel to restore the previous logic. |
I ran into this problem again today. why would someone want to shrink pixels in the first place? a pixel is a pixel if you want to scale it down make smaller pixel art or scale down the window surface. I think this change should be completely removed the logic doesn't even make sense on why this was implemented in the first place if this has to do with textures scale not being related to window canvas scale then that should be fixed |
GLES2 Fixes for ninepatch margins when canvas patch size is smaller than the patch texture resolution.
Scaled ninepatch margins in canvas space to be relative of the ninepatch size and not bound to the texture resolution when the patch size is smaller than the patch texture.
In this moment if you create a ninepatch with a large texture and try to render it in a smaller canvas it will be distorted (you will only see huge edges) because the texture patch margins that you set in the ninepatchrect configuration are also used in absolute value in canvas coordinates to create the patches. This pull requests fixes this by scaling these margins to be relative to the ninepatchrect size when the patch is small relative to the patch texture.
This is particularly important when you need to have higher resolution ninepatch textures for higher resolution devices but have a relatively small canvas size.
Note: This only fixes GLES2, GLES3 seems to be processed in a shader but doesn't work for me, it appears distored even with lower resolution textures.