]> git.mxchange.org Git - flightgear.git/commitdiff
Updated Canvas adaptor getImage API
authorJames Turner <zakalawe@mac.com>
Sat, 26 Mar 2016 20:25:31 +0000 (20:25 +0000)
committerJames Turner <zakalawe@mac.com>
Sat, 26 Mar 2016 20:25:31 +0000 (20:25 +0000)
Return the Image by ref ptr instead of raw pointer.

src/Canvas/FGCanvasSystemAdapter.cxx
src/Canvas/FGCanvasSystemAdapter.hxx

index e95f86efc33f47cdd6b39e2904c26bdd9d2ec5d2..894ca0bdc6b213d312ad196f3da9e0f89644a95f 100644 (file)
@@ -77,7 +77,7 @@ namespace canvas
   }
 
   //----------------------------------------------------------------------------
-  osg::Image* FGCanvasSystemAdapter::getImage(const std::string& path) const
+  osg::ref_ptr<osg::Image> FGCanvasSystemAdapter::getImage(const std::string& path) const
   {
     if( SGPath(path).isAbsolute() )
     {
@@ -91,7 +91,7 @@ namespace canvas
     {
       SGPath tpath = globals->resolve_resource_path(path);
       if( !tpath.isNull() )
-        return osgDB::readImageFile(tpath.c_str());
+        return osgDB::readRefImageFile(tpath.c_str());
 
       SG_LOG(SG_IO, SG_ALERT, "canvas::Image: No such image: '" << path << "'");
     }
index c43f79359d264f4b8db313f439e69513409d31b8..4c1fd6210f366ce01f31037edf6283afc05fd783 100644 (file)
@@ -30,7 +30,7 @@ namespace canvas
       virtual simgear::canvas::FontPtr getFont(const std::string& name) const;
       virtual void addCamera(osg::Camera* camera) const;
       virtual void removeCamera(osg::Camera* camera) const;
-      virtual osg::Image* getImage(const std::string& path) const;
+      virtual osg::ref_ptr<osg::Image> getImage(const std::string& path) const;
       virtual SGSubsystem* getSubsystem(const std::string& name) const;
       virtual simgear::HTTP::Client* getHTTPClient() const;
   };