diff --git a/src/lib/tvgPictureImpl.h b/src/lib/tvgPictureImpl.h index b4e65f0e..82d17180 100644 --- a/src/lib/tvgPictureImpl.h +++ b/src/lib/tvgPictureImpl.h @@ -195,6 +195,8 @@ struct Picture::Impl if (loader) loader->close(); loader = LoaderMgr::loader(data, w, h, copy); if (!loader) return Result::NonSupport; + this->w = loader->w; + this->h = loader->h; return Result::Success; } diff --git a/src/loaders/raw/tvgRawLoader.cpp b/src/loaders/raw/tvgRawLoader.cpp index 47968d1c..2acfc3b5 100644 --- a/src/loaders/raw/tvgRawLoader.cpp +++ b/src/loaders/raw/tvgRawLoader.cpp @@ -45,10 +45,10 @@ bool RawLoader::open(const uint32_t* data, uint32_t w, uint32_t h, bool copy) { if (!data || w == 0 || h == 0) return false; - vw = w; - vh = h; - + this->w = vw = w; + this->h = vh = h; this->copy = copy; + if (copy) { content = (uint32_t*)malloc(sizeof(uint32_t) * vw * vh); if (!content) return false; diff --git a/test/testPicture.cpp b/test/testPicture.cpp index a4eb2b3e..c4281f3f 100644 --- a/test/testPicture.cpp +++ b/test/testPicture.cpp @@ -63,7 +63,7 @@ TEST_CASE("Load SVG Data", "[tvgPicture]") REQUIRE(h == Approx(1000).epsilon(0.0000001)); } -TEST_CASE("Load Raw Data", "[tvgPicture]") +TEST_CASE("Load RAW Data", "[tvgPicture]") { auto picture = Picture::gen(); REQUIRE(picture);