Skip to content

Detect the best pixel format for intermediate scaled surfaces.#15574

Open
ccawley2011 wants to merge 2 commits into
libsdl-org:mainfrom
ccawley2011:promote-scale-format
Open

Detect the best pixel format for intermediate scaled surfaces.#15574
ccawley2011 wants to merge 2 commits into
libsdl-org:mainfrom
ccawley2011:promote-scale-format

Conversation

@ccawley2011

Copy link
Copy Markdown
Contributor
  • I confirm that I am the author of this code and release it to the SDL project under the Zlib license. This contribution does not contain code from other sources, including code generated by a Large Language Model ("AI").

This generalises some of the logic from the software renderer so that it can be used elsewhere - this increases the likelihood of using the optimised conversion routines when using a 16-bit BGR format.

Comment thread src/video/SDL_pixels_c.h
default:
break;
}
// Try and find an alpha format with the same layout.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Your code changes here are not equivalent. For example, I don't think SDL_PIXELFORMAT_ABGR1555 is going to add SDL_PIXELFORMAT_XBGR1555, or am I missing something?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was intentional since I'm not sure there's a use case for it - in general, you'd want to always use the screen format (since that can be used with SDL_BlitCopy) unless you need an alpha channel. If needed, I can split that change into a separate commit.

Comment thread src/video/SDL_yuv.c
@slouken

slouken commented May 13, 2026

Copy link
Copy Markdown
Collaborator

This change seems fine in theory, but the changes are risky. I already noted a few issues above. You should re-review your changes after a day or so and this should not be backported to 3.4.x.

@ccawley2011 ccawley2011 force-pushed the promote-scale-format branch from d3297b1 to 73430ae Compare May 13, 2026 22:57
Comment thread src/video/SDL_pixels.c Outdated
Comment thread src/video/SDL_pixels.c Outdated
@ccawley2011 ccawley2011 force-pushed the promote-scale-format branch from 73430ae to de191c8 Compare May 14, 2026 14:04
@ccawley2011 ccawley2011 force-pushed the promote-scale-format branch from de191c8 to 477ed72 Compare May 14, 2026 14:23
@slouken

slouken commented May 14, 2026

Copy link
Copy Markdown
Collaborator

Is this re-reviewed and ready to merge?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants