common picture: fix invalid size returns from raw image.
authorHermet Park <chuneon.park@samsung.com>
Sat, 3 Jul 2021 07:09:56 +0000 (16:09 +0900)
committerJunsuChoi <jsuya.choi@samsung.com>
Wed, 7 Jul 2021 02:57:02 +0000 (11:57 +0900)
picture/raw should update the size if the raw image
with size values are entered.

src/lib/tvgPictureImpl.h
src/loaders/raw/tvgRawLoader.cpp
test/testPicture.cpp

index b4e65f0..82d1718 100644 (file)
@@ -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;
     }
 
index 47968d1..2acfc3b 100644 (file)
@@ -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;
index a4eb2b3..c4281f3 100644 (file)
@@ -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);