From c29fa35840efd1c4f8e7df49403791e2568f5011 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sat, 26 Mar 2016 20:25:31 +0000 Subject: [PATCH] Updated Canvas adaptor getImage API Return the Image by ref ptr instead of raw pointer. --- src/Canvas/FGCanvasSystemAdapter.cxx | 4 ++-- src/Canvas/FGCanvasSystemAdapter.hxx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Canvas/FGCanvasSystemAdapter.cxx b/src/Canvas/FGCanvasSystemAdapter.cxx index e95f86efc..894ca0bdc 100644 --- a/src/Canvas/FGCanvasSystemAdapter.cxx +++ b/src/Canvas/FGCanvasSystemAdapter.cxx @@ -77,7 +77,7 @@ namespace canvas } //---------------------------------------------------------------------------- - osg::Image* FGCanvasSystemAdapter::getImage(const std::string& path) const + osg::ref_ptr 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 << "'"); } diff --git a/src/Canvas/FGCanvasSystemAdapter.hxx b/src/Canvas/FGCanvasSystemAdapter.hxx index c43f79359..4c1fd6210 100644 --- a/src/Canvas/FGCanvasSystemAdapter.hxx +++ b/src/Canvas/FGCanvasSystemAdapter.hxx @@ -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 getImage(const std::string& path) const; virtual SGSubsystem* getSubsystem(const std::string& name) const; virtual simgear::HTTP::Client* getHTTPClient() const; }; -- 2.39.5