summaryrefslogtreecommitdiff
path: root/thirdparty/thorvg/src/loaders/png
diff options
context:
space:
mode:
authorAnilforextra <anilforextra@gmail.com>2022-01-29 21:16:13 +0545
committerAnilforextra <anilforextra@gmail.com>2022-01-31 23:39:25 +0545
commit3382e0304d87fd0b3c6c4da681a14a7cf68a05ea (patch)
tree9cc777b72182eeae116ac6136fdb5b661c711a41 /thirdparty/thorvg/src/loaders/png
parent9467350f37089eb3f4ef7de683daba28b0c69dec (diff)
ThorVG: Sync with upstream 0.7.1
Changes: https://github.com/Samsung/thorvg/releases/tag/v0.7.1
Diffstat (limited to 'thirdparty/thorvg/src/loaders/png')
-rw-r--r--thirdparty/thorvg/src/loaders/png/tvgPngLoader.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/thirdparty/thorvg/src/loaders/png/tvgPngLoader.cpp b/thirdparty/thorvg/src/loaders/png/tvgPngLoader.cpp
index c6d95be5ba..3cc08e902b 100644
--- a/thirdparty/thorvg/src/loaders/png/tvgPngLoader.cpp
+++ b/thirdparty/thorvg/src/loaders/png/tvgPngLoader.cpp
@@ -72,6 +72,7 @@ PngLoader::PngLoader()
PngLoader::~PngLoader()
{
if (freeData) free(data);
+ free(image);
}
@@ -121,7 +122,7 @@ bool PngLoader::open(const char* data, uint32_t size, bool copy)
clear();
lodepng_state_init(&state);
-
+
unsigned int width, height;
if (lodepng_inspect(&width, &height, &state, (unsigned char*)(data), size) > 0) return false;
@@ -180,10 +181,14 @@ unique_ptr<Surface> PngLoader::bitmap()
void PngLoader::run(unsigned tid)
{
+ if (image) {
+ free(image);
+ image = nullptr;
+ }
auto width = static_cast<unsigned>(w);
auto height = static_cast<unsigned>(h);
lodepng_decode(&image, &width, &height, &state, data, size);
_premultiply((uint32_t*)(image), width, height);
-} \ No newline at end of file
+}