Browse Source

TGAImporter: adapted to Magnum changes.

pull/34/head
Vladimír Vondruš 14 years ago
parent
commit
1c51409fb4
  1. 7
      src/Plugins/TGAImporter/TGAImporter.cpp
  2. 6
      src/Plugins/TGAImporter/TGAImporter.h

7
src/Plugins/TGAImporter/TGAImporter.cpp

@ -75,15 +75,16 @@ bool TGAImporter::open(std::istream& in) {
Math::Vector2<GLsizei> dimensions(header.width, header.height); Math::Vector2<GLsizei> dimensions(header.width, header.height);
_image = shared_ptr<Image2D>(new Image2D(dimensions, colorFormat, buffer)); _image = new Image2D(dimensions, colorFormat, buffer);
return true; return true;
} }
void TGAImporter::close() { void TGAImporter::close() {
_image = shared_ptr<Image2D>(); delete _image;
_image = nullptr;
} }
shared_ptr<Image2D> TGAImporter::image2D(size_t id) { Image2D* TGAImporter::image2D(size_t id) {
return _image; return _image;
} }

6
src/Plugins/TGAImporter/TGAImporter.h

@ -25,7 +25,7 @@ namespace Magnum { namespace Trade { namespace TGAImporter {
class TGAImporter: public AbstractImporter { class TGAImporter: public AbstractImporter {
public: public:
TGAImporter(Corrade::PluginManager::AbstractPluginManager* manager = 0, const std::string& plugin = ""): AbstractImporter(manager, plugin) {} TGAImporter(Corrade::PluginManager::AbstractPluginManager* manager = 0, const std::string& plugin = ""): AbstractImporter(manager, plugin), _image(nullptr) {}
inline virtual ~TGAImporter() { close(); } inline virtual ~TGAImporter() { close(); }
inline int features() const { return OpenFile|OpenStream; } inline int features() const { return OpenFile|OpenStream; }
@ -35,7 +35,7 @@ class TGAImporter: public AbstractImporter {
void close(); void close();
inline size_t image2DCount() const { return _image ? 1 : 0; } inline size_t image2DCount() const { return _image ? 1 : 0; }
std::shared_ptr<Image2D> image2D(size_t id); Image2D* image2D(size_t id);
#pragma pack(1) #pragma pack(1)
struct Header { struct Header {
@ -55,7 +55,7 @@ class TGAImporter: public AbstractImporter {
#pragma pack(8) #pragma pack(8)
private: private:
std::shared_ptr<Image2D> _image; Image2D* _image;
}; };
}}} }}}

Loading…
Cancel
Save