TakeScreenshot: fix screenshot image buffer size. 91/302591/2 accepted/tizen_unified_riscv accepted/tizen/unified/20231220.165130 accepted/tizen/unified/riscv/20231226.211524
authorHosang Kim <hosang12.kim@samsung.com>
Mon, 11 Dec 2023 02:20:27 +0000 (11:20 +0900)
committerHosang Kim <hosang12.kim@samsung.com>
Mon, 11 Dec 2023 03:42:08 +0000 (12:42 +0900)
The reason for multiplying by 4 is that image is a 32-bit RGBA PNG file.
So it is maximum image file size.
Change-Id: I0396310cd104d5e1786c11fd9816a47548858abf

org.tizen.aurum-bootstrap/src/Commands/TakeScreenshotCommand.cc

index 73f84e5..fe12fbb 100644 (file)
@@ -51,7 +51,7 @@ TakeScreenshotCommand::TakeScreenshotCommand(
         std::ifstream ifs(path, std::ifstream::binary);
         ::aurum::RspTakeScreenshot rsp;
         const Size2D<int> screenSize = mDevice->getScreenSize();
-        int size = screenSize.width * screenSize.height;
+        int size = screenSize.width * screenSize.height * 4; //The reason for multiplying by 4 is that image is a 32-bit RGBA PNG file.
         char *buf = new char[size];
 
         while (!ifs.eof()) {