Remove getWarningTexture in favor of getWarningImage

coverity_scan
scrawl 9 years ago
parent f99f403dda
commit 5ee3d1698f

@ -137,7 +137,7 @@ public:
AtmosphereNightUpdater(Resource::ImageManager* textureManager) AtmosphereNightUpdater(Resource::ImageManager* textureManager)
{ {
// we just need a texture, its contents don't really matter // we just need a texture, its contents don't really matter
mTexture = textureManager->getWarningTexture(); mTexture = new osg::Texture2D(textureManager->getWarningImage());
} }
void setFade(const float fade) void setFade(const float fade)

@ -17,7 +17,7 @@ USE_OSGPLUGIN(jpeg)
namespace namespace
{ {
osg::ref_ptr<osg::Texture2D> createWarningTexture() osg::ref_ptr<osg::Image> createWarningImage()
{ {
osg::ref_ptr<osg::Image> warningImage = new osg::Image; osg::ref_ptr<osg::Image> warningImage = new osg::Image;
@ -31,10 +31,7 @@ namespace
data[3*i+1] = (0); data[3*i+1] = (0);
data[3*i+2] = (255); data[3*i+2] = (255);
} }
return warningImage;
osg::ref_ptr<osg::Texture2D> warningTexture = new osg::Texture2D;
warningTexture->setImage(warningImage);
return warningTexture;
} }
} }
@ -44,8 +41,7 @@ namespace Resource
ImageManager::ImageManager(const VFS::Manager *vfs) ImageManager::ImageManager(const VFS::Manager *vfs)
: mVFS(vfs) : mVFS(vfs)
, mWarningTexture(createWarningTexture()) , mWarningImage(createWarningImage())
, mWarningImage(mWarningTexture->getImage())
, mOptions(new osgDB::Options("dds_flip dds_dxt1_detect_rgba")) , mOptions(new osgDB::Options("dds_flip dds_dxt1_detect_rgba"))
{ {
} }
@ -137,9 +133,9 @@ namespace Resource
} }
} }
osg::Texture2D* ImageManager::getWarningTexture() osg::Image *ImageManager::getWarningImage()
{ {
return mWarningTexture.get(); return mWarningImage;
} }
} }

@ -39,7 +39,7 @@ namespace Resource
const VFS::Manager* getVFS() { return mVFS; } const VFS::Manager* getVFS() { return mVFS; }
osg::Texture2D* getWarningTexture(); osg::Image* getWarningImage();
private: private:
const VFS::Manager* mVFS; const VFS::Manager* mVFS;
@ -47,7 +47,6 @@ namespace Resource
// TODO: use ObjectCache // TODO: use ObjectCache
std::map<std::string, osg::ref_ptr<osg::Image> > mImages; std::map<std::string, osg::ref_ptr<osg::Image> > mImages;
osg::ref_ptr<osg::Texture2D> mWarningTexture;
osg::ref_ptr<osg::Image> mWarningImage; osg::ref_ptr<osg::Image> mWarningImage;
osg::ref_ptr<osgDB::Options> mOptions; osg::ref_ptr<osgDB::Options> mOptions;

Loading…
Cancel
Save