1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Optimize getImageAverageColor

also fixes a bug with non-square handling

before:
  getImageAverageColor [us] _____________________  804x  11.253

after:
  imageAverageColorInline [us] __________________  804x   0.557
This commit is contained in:
sfan5 2024-12-30 22:17:52 +01:00
parent ded8c25e34
commit f37f9a6f0b
5 changed files with 111 additions and 90 deletions

View file

@ -45,9 +45,6 @@ struct ImageSource {
// Insert a source image into the cache without touching the filesystem.
void insertSourceImage(const std::string &name, video::IImage *img, bool prefer_local);
// TODO should probably be moved elsewhere
static video::SColor getImageAverageColor(const video::IImage &image);
private:
// Generate image based on a string like "stone.png" or "[crack:1:0".