-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Clean up Image #98084
base: master
Are you sure you want to change the base?
Clean up Image #98084
Conversation
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 otherwise, I thin this is a worthwhile change even though noisy
core/io/image.cpp
Outdated
@@ -85,17 +85,60 @@ const char *Image::format_names[Image::FORMAT_MAX] = { | |||
"ASTC_8x8_HDR", | |||
}; | |||
|
|||
/* External saver function pointers. */ |
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.
/* External saver function pointers. */ | |
// External saver function pointers. |
Prefer single line comments
core/io/image.cpp
Outdated
SaveWebPBufferFunc Image::save_webp_buffer_func = nullptr; | ||
|
||
/* External loader function pointers. */ |
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.
/* External loader function pointers. */ | |
// External loader function pointers. |
core/io/image.cpp
Outdated
ScalableImageMemLoadFunc Image::_svg_scalable_mem_loader_func = nullptr; | ||
ImageMemLoadFunc Image::_ktx_mem_loader_func = nullptr; | ||
|
||
/* External VRAM compression function pointers. */ |
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.
/* External VRAM compression function pointers. */ | |
// External VRAM compression function pointers. |
core/io/image.cpp
Outdated
Error (*Image::_image_compress_bptc_rd_func)(Image *, Image::UsedChannels) = nullptr; | ||
Error (*Image::_image_compress_bc_rd_func)(Image *, Image::UsedChannels) = nullptr; | ||
|
||
/* External VRAM decompression function pointers. */ |
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.
/* External VRAM decompression function pointers. */ | |
// External VRAM decompression function pointers. |
core/io/image.cpp
Outdated
void (*Image::_image_decompress_etc2)(Image *) = nullptr; | ||
void (*Image::_image_decompress_astc)(Image *) = nullptr; | ||
|
||
/* External packer function pointers. */ |
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.
/* External packer function pointers. */ | |
// External packer function pointers. |
core/io/image.h
Outdated
@@ -153,6 +203,8 @@ class Image : public Resource { | |||
static ScalableImageMemLoadFunc _svg_scalable_mem_loader_func; | |||
static ImageMemLoadFunc _ktx_mem_loader_func; | |||
|
|||
/* External VRAM compression function pointers. */ |
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.
/* External VRAM compression function pointers. */ | |
// External VRAM compression function pointers. |
core/io/image.h
Outdated
@@ -162,24 +214,26 @@ class Image : public Resource { | |||
static Error (*_image_compress_bptc_rd_func)(Image *, UsedChannels p_channels); | |||
static Error (*_image_compress_bc_rd_func)(Image *, UsedChannels p_channels); | |||
|
|||
/* External VRAM decompression function pointers. */ |
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.
/* External VRAM decompression function pointers. */ | |
// External VRAM decompression function pointers. |
core/io/image.h
Outdated
static void (*_image_decompress_bc)(Image *); | ||
static void (*_image_decompress_bptc)(Image *); | ||
static void (*_image_decompress_etc1)(Image *); | ||
static void (*_image_decompress_etc2)(Image *); | ||
static void (*_image_decompress_astc)(Image *); | ||
|
||
/* External packer function pointers. */ |
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.
/* External packer function pointers. */ | |
// External packer function pointers. |
core/io/image.h
Outdated
Image(int p_width, int p_height, bool p_use_mipmaps, Format p_format); // Create an empty image of a specific size and format. | ||
Image(int p_width, int p_height, bool p_mipmaps, Format p_format, const Vector<uint8_t> &p_data); // Import an image of a specific size and format from a byte vector. | ||
Image(const uint8_t *p_mem_png_jpg, int p_len = -1); // Import either a png or jpg from a pointer. | ||
Image(const char **p_xpm); // Import a XPM image. |
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.
Image(const char **p_xpm); // Import a XPM image. | |
Image(const char **p_xpm); // Import an XPM image. |
core/io/image.h
Outdated
void _copy_internals_from(const Image &p_image); | ||
|
||
_FORCE_INLINE_ Color _get_color_at_ofs(const uint8_t *ptr, uint32_t ofs) const; | ||
_FORCE_INLINE_ void _set_color_at_ofs(uint8_t *ptr, uint32_t ofs, const Color &p_color); | ||
|
||
_FORCE_INLINE_ void _get_mipmap_offset_and_size(int p_mipmap, int64_t &r_offset, int &r_width, int &r_height) const; //get where the mipmap begins in data |
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.
_FORCE_INLINE_ void _get_mipmap_offset_and_size(int p_mipmap, int64_t &r_offset, int &r_width, int &r_height) const; //get where the mipmap begins in data | |
_FORCE_INLINE_ void _get_mipmap_offset_and_size(int p_mipmap, int64_t &r_offset, int &r_width, int &r_height) const; // Get where the mipmap begins in data. |
Missed one
6cb4cf8
to
c296e2f
Compare
c296e2f
to
4f9e101
Compare
This PR attempts to clean up the Image class by doing the following: