-
-
Notifications
You must be signed in to change notification settings - Fork 165
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
Set default convert format when Window.get_surface()
is called
#2575
Conversation
WIndow.get_surface()
is calledWindow.get_surface()
is called
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.
LGTM 👍
Hey @yunline, can you rebase this against main? It will make it easy to test with a full Window.flip() example, and it'll fix the circleci change. I see you didn't respond to my long rambling paragraph feedback, I'd like to try and add that as a commit to this branch myself, and then if it looks good to you we can move forward. "Window will be published next release" shouldn't go in the error message! That was information for you, not for the user :) |
Oops, I'll fix it soon. |
I'm worried that if we use a reference to a pixelformat struct from a surface, the pixelformat might be deallocated later by SDL. This makes the code more complex but it ensures that the module always has a handle on a real and not-deallocated pixelformat.
@yunline I added a new commit to this branch, which makes the code more but also safer. I was worried about what would happen if the SDL_PixelFormat struct we hold was deallocated by SDL, making it allocate a SDL_PixelFormat specifically to hold on to will prevent that from happening. Please let me know if this looks okay to you |
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 good to me.
Test code (should not raise exception):
If
convert()
is called but no convert format have been set, it should raise:After the Window API published, it should raise: