Move screen height detection inside CImageLoaderSVG::loadImage
This commit is contained in:
parent
1655c243b7
commit
4c4daf9698
@ -45,8 +45,6 @@ public:
|
||||
virtual IImage* loadImage(io::IReadFile* file, bool skip_checking = false) const = 0;
|
||||
virtual core::dimension2du getImageSize(io::IReadFile* file) const { return core::dimension2du(0, 0); }
|
||||
virtual bool supportThreadedLoading() const { return false; }
|
||||
|
||||
virtual void setScreenSize(const core::dimension2d<u32> &screen_size) {};
|
||||
};
|
||||
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "os.h"
|
||||
#include "irrString.h"
|
||||
#include "CNullDriver.h"
|
||||
#include "ge_main.hpp"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
@ -25,12 +26,6 @@ CImageLoaderSVG::CImageLoaderSVG()
|
||||
{
|
||||
}
|
||||
|
||||
//! set the screen size
|
||||
void CImageLoaderSVG::setScreenSize(const core::dimension2d<u32> &screen_size)
|
||||
{
|
||||
ScreenSize = screen_size;
|
||||
}
|
||||
|
||||
//! returns true if the file maybe is able to be loaded by this class
|
||||
//! based on the file extension (e.g. ".tga")
|
||||
bool CImageLoaderSVG::isALoadableFileExtension(const io::path& filename) const
|
||||
@ -109,7 +104,7 @@ IImage* CImageLoaderSVG::loadImage(io::IReadFile* file, bool skip_checking) cons
|
||||
if ( strstr(file->getFileName().c_str(),"gui/icons/") )
|
||||
{
|
||||
// determine scaling based on screen size
|
||||
float screen_height = ScreenSize.Height;
|
||||
float screen_height = (float)GE::getDriver()->getCurrentRenderTargetSize().Height;
|
||||
float desired_icon_size = 0.21*screen_height + 30.0f; // phenomenological
|
||||
scale = desired_icon_size/img->height;
|
||||
}
|
||||
|
@ -38,9 +38,6 @@ public:
|
||||
//! constructor
|
||||
CImageLoaderSVG();
|
||||
|
||||
// set the screen size, used to determine scaling
|
||||
virtual void setScreenSize(const core::dimension2d<u32> &screen_size);
|
||||
|
||||
//! returns true if the file maybe is able to be loaded by this class
|
||||
//! based on the file extension (e.g. ".tga")
|
||||
virtual bool isALoadableFileExtension(const io::path& filename) const;
|
||||
@ -51,9 +48,6 @@ public:
|
||||
//! creates a surface from the file
|
||||
virtual IImage* loadImage(io::IReadFile* file, bool skip_checking = false) const;
|
||||
|
||||
private:
|
||||
core::dimension2d<u32> ScreenSize;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -1303,8 +1303,6 @@ IImage* CNullDriver::createImageFromFile(io::IReadFile* file, video::IImageLoade
|
||||
*loader = SurfaceLoader[i];
|
||||
return 0;
|
||||
}
|
||||
// pass screen size to ImageLoaderSVG. For other formats (BMP,JPG,PNG), setScreenSize() does nothing
|
||||
SurfaceLoader[i]->setScreenSize(getCurrentRenderTargetSize());
|
||||
// reset file position which might have changed due to previous loadImage calls
|
||||
file->seek(0);
|
||||
image = SurfaceLoader[i]->loadImage(file);
|
||||
@ -1325,8 +1323,6 @@ IImage* CNullDriver::createImageFromFile(io::IReadFile* file, video::IImageLoade
|
||||
*loader = SurfaceLoader[i];
|
||||
return 0;
|
||||
}
|
||||
// pass screen size to ImageLoaderSVG. For other formats (BMP,JPG,PNG), setScreenSize() does nothing
|
||||
SurfaceLoader[i]->setScreenSize(getCurrentRenderTargetSize());
|
||||
file->seek(0);
|
||||
image = SurfaceLoader[i]->loadImage(file);
|
||||
if (image)
|
||||
|
Loading…
Reference in New Issue
Block a user