mirror of
https://github.com/minetest/irrlicht.git
synced 2024-12-27 08:27:30 +01:00
Drop IImageLoader::loadImages as only IImageLoader::loadImage is usable
This commit is contained in:
parent
462657960d
commit
fc0440ff89
@ -45,17 +45,6 @@ public:
|
|||||||
/** \param file File handle to check.
|
/** \param file File handle to check.
|
||||||
\return Pointer to newly created image, or 0 upon error. */
|
\return Pointer to newly created image, or 0 upon error. */
|
||||||
virtual IImage* loadImage(io::IReadFile* file) const = 0;
|
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;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1196,59 +1196,35 @@ core::array<IImage*> CNullDriver::createImagesFromFile(io::IReadFile* file, E_TE
|
|||||||
|
|
||||||
core::array<IImage*> imageArray;
|
core::array<IImage*> imageArray;
|
||||||
|
|
||||||
if (file)
|
if (!file)
|
||||||
{
|
return imageArray;
|
||||||
s32 i;
|
|
||||||
|
|
||||||
// try to load file based on file extension
|
// try to load file based on file extension
|
||||||
for (i = SurfaceLoader.size() - 1; i >= 0; --i)
|
for (int i = SurfaceLoader.size() - 1; i >= 0; --i) {
|
||||||
{
|
if (!SurfaceLoader[i]->isALoadableFileExtension(file->getFileName()))
|
||||||
if (SurfaceLoader[i]->isALoadableFileExtension(file->getFileName()))
|
continue;
|
||||||
{
|
|
||||||
// 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); // reset file position which might have changed due to previous loadImage calls
|
||||||
{
|
if (IImage *image = SurfaceLoader[i]->loadImage(file)) {
|
||||||
file->seek(0);
|
|
||||||
IImage* image = SurfaceLoader[i]->loadImage(file);
|
|
||||||
|
|
||||||
if (image)
|
|
||||||
imageArray.push_back(image);
|
imageArray.push_back(image);
|
||||||
}
|
|
||||||
|
|
||||||
if (imageArray.size() > 0)
|
|
||||||
return imageArray;
|
return imageArray;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to load file based on what is in it
|
// try to load file based on what is in it
|
||||||
for (i = SurfaceLoader.size() - 1; i >= 0; --i)
|
for (int i = SurfaceLoader.size() - 1; i >= 0; --i) {
|
||||||
{
|
if (SurfaceLoader[i]->isALoadableFileExtension(file->getFileName()))
|
||||||
// dito
|
continue; // extension was tried above already
|
||||||
file->seek(0);
|
file->seek(0); // dito
|
||||||
if (SurfaceLoader[i]->isALoadableFileFormat(file)
|
if (!SurfaceLoader[i]->isALoadableFileFormat(file))
|
||||||
&& !SurfaceLoader[i]->isALoadableFileExtension(file->getFileName()) // extension was tried above already
|
continue;
|
||||||
)
|
|
||||||
{
|
|
||||||
file->seek(0);
|
|
||||||
imageArray = SurfaceLoader[i]->loadImages(file, type);
|
|
||||||
|
|
||||||
if (imageArray.size() == 0)
|
|
||||||
{
|
|
||||||
file->seek(0);
|
file->seek(0);
|
||||||
IImage* image = SurfaceLoader[i]->loadImage(file);
|
if (IImage *image = SurfaceLoader[i]->loadImage(file)) {
|
||||||
|
|
||||||
if (image)
|
|
||||||
imageArray.push_back(image);
|
imageArray.push_back(image);
|
||||||
}
|
|
||||||
|
|
||||||
if (imageArray.size() > 0)
|
|
||||||
return imageArray;
|
return imageArray;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return imageArray;
|
return imageArray;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user