Skip to content
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

Image: Add static is_format_compressed function. #88763

Merged

Conversation

BlueCube3310
Copy link
Contributor

Adds a new static function to Image for detecting whether a format is compressed, as well as replaces instances of format >= Image::FORMAT_DXT1 and format > Image::FORMAT_RGBE9995 with it across the codebase.

This is done mainly to simplify code, but also for futureproofing in case the Format enum ever gets changed.

@Mickeon
Copy link
Contributor

Mickeon commented Feb 24, 2024

This is somewhat related to #88669 , since that PR heavily expands upon is_compressed and "asks a question" about the format.
Makes you wonder if it would be better to have those as a static methods, or if exposing is_format_compressed to the public API is even desirable. @Calinou

Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

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

I prefer this PR over #88973. #88973 is totally fine, but I think having the static method is a little nicer as it avoids the problem of these checks getting out of sync

core/io/image.cpp Outdated Show resolved Hide resolved
@BlueCube3310 BlueCube3310 marked this pull request as ready for review February 28, 2024 18:43
@akien-mga akien-mga merged commit 28a18cf into godotengine:master May 2, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@BlueCube3310 BlueCube3310 deleted the image-is-compressed-static branch May 2, 2024 14:25
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.

5 participants