From: numzero Date: Fri, 7 Apr 2023 22:23:20 +0000 (+0300) Subject: Drop IImageLoader::loadImages as only IImageLoader::loadImage is usable X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=fc0440ff8900aeb71af7ce3bc6d44464e0cca727;p=irrlicht.git Drop IImageLoader::loadImages as only IImageLoader::loadImage is usable --- diff --git a/include/IImageLoader.h b/include/IImageLoader.h index 13eef97..61552af 100644 --- a/include/IImageLoader.h +++ b/include/IImageLoader.h @@ -45,17 +45,6 @@ public: /** \param file File handle to check. \return Pointer to newly created image, or 0 upon error. */ virtual IImage* loadImage(io::IReadFile* file) const = 0; - - //! Creates a multiple surfaces from the file eg. whole cube map. - /** \param file File handle to check. - \param type Pointer to E_TEXTURE_TYPE where a recommended type of the texture will be stored. - \return Array of pointers to newly created images. */ - virtual core::array loadImages(io::IReadFile* file, E_TEXTURE_TYPE* type) const - { - core::array image; - - return image; - } }; diff --git a/source/Irrlicht/CNullDriver.cpp b/source/Irrlicht/CNullDriver.cpp index a02431c..d3b7280 100644 --- a/source/Irrlicht/CNullDriver.cpp +++ b/source/Irrlicht/CNullDriver.cpp @@ -1196,57 +1196,33 @@ core::array CNullDriver::createImagesFromFile(io::IReadFile* file, E_TE core::array imageArray; - if (file) - { - s32 i; - - // try to load file based on file extension - for (i = SurfaceLoader.size() - 1; i >= 0; --i) - { - if (SurfaceLoader[i]->isALoadableFileExtension(file->getFileName())) - { - // reset file position which might have changed due to previous loadImage calls - file->seek(0); - imageArray = SurfaceLoader[i]->loadImages(file, type); - - if (imageArray.size() == 0) - { - file->seek(0); - IImage* image = SurfaceLoader[i]->loadImage(file); + if (!file) + return imageArray; - if (image) - imageArray.push_back(image); - } + // try to load file based on file extension + for (int i = SurfaceLoader.size() - 1; i >= 0; --i) { + if (!SurfaceLoader[i]->isALoadableFileExtension(file->getFileName())) + continue; - if (imageArray.size() > 0) - return imageArray; - } + file->seek(0); // reset file position which might have changed due to previous loadImage calls + if (IImage *image = SurfaceLoader[i]->loadImage(file)) { + imageArray.push_back(image); + return imageArray; } + } - // try to load file based on what is in it - for (i = SurfaceLoader.size() - 1; i >= 0; --i) - { - // dito - file->seek(0); - if (SurfaceLoader[i]->isALoadableFileFormat(file) - && !SurfaceLoader[i]->isALoadableFileExtension(file->getFileName()) // extension was tried above already - ) - { - file->seek(0); - imageArray = SurfaceLoader[i]->loadImages(file, type); - - if (imageArray.size() == 0) - { - file->seek(0); - IImage* image = SurfaceLoader[i]->loadImage(file); - - if (image) - imageArray.push_back(image); - } + // try to load file based on what is in it + for (int i = SurfaceLoader.size() - 1; i >= 0; --i) { + if (SurfaceLoader[i]->isALoadableFileExtension(file->getFileName())) + continue; // extension was tried above already + file->seek(0); // dito + if (!SurfaceLoader[i]->isALoadableFileFormat(file)) + continue; - if (imageArray.size() > 0) - return imageArray; - } + file->seek(0); + if (IImage *image = SurfaceLoader[i]->loadImage(file)) { + imageArray.push_back(image); + return imageArray; } }