aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/IImageLoader.h11
-rw-r--r--source/Irrlicht/CNullDriver.cpp68
2 files changed, 22 insertions, 57 deletions
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<IImage*> loadImages(io::IReadFile* file, E_TEXTURE_TYPE* type) const
- {
- core::array<IImage*> 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<IImage*> CNullDriver::createImagesFromFile(io::IReadFile* file, E_TE
core::array<IImage*> 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;
}
}