diff options
Diffstat (limited to 'tools/depends/native/TexturePacker/src/decoder/GIFDecoder.cpp')
-rw-r--r-- | tools/depends/native/TexturePacker/src/decoder/GIFDecoder.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/tools/depends/native/TexturePacker/src/decoder/GIFDecoder.cpp b/tools/depends/native/TexturePacker/src/decoder/GIFDecoder.cpp index 7e5179b0cc..d7c5e2ac55 100644 --- a/tools/depends/native/TexturePacker/src/decoder/GIFDecoder.cpp +++ b/tools/depends/native/TexturePacker/src/decoder/GIFDecoder.cpp @@ -31,6 +31,8 @@ bool GIFDecoder::CanDecode(const std::string &filename) bool GIFDecoder::LoadFile(const std::string &filename, DecodedFrames &frames) { int n = 0; + bool result = false; + GifHelper *gifImage = new GifHelper(); if (gifImage->LoadGif(filename.c_str())) { @@ -53,28 +55,20 @@ bool GIFDecoder::LoadFile(const std::string &filename, DecodedFrames &frames) frame.rgbaImage.bbp = 32; frame.rgbaImage.pitch = pitch; frame.delay = extractedFrames[i]->m_delay; + frame.decoder = this; frames.frameList.push_back(frame); } } - frames.user = gifImage; - return true; - } - else - { - delete gifImage; - return false; + result = true; } + delete gifImage; + return result; } -void GIFDecoder::FreeDecodedFrames(DecodedFrames &frames) +void GIFDecoder::FreeDecodedFrame(DecodedFrame &frame) { - for (unsigned int i = 0; i < frames.frameList.size(); i++) - { - delete [] frames.frameList[i].rgbaImage.pixels; - } - delete (GifHelper *)frames.user; - frames.clear(); + delete [] frame.rgbaImage.pixels; } void GIFDecoder::FillSupportedExtensions() |