example stress: adjusted loading count.
authorHermet Park <chuneon.park@samsung.com>
Fri, 19 Nov 2021 07:11:08 +0000 (16:11 +0900)
committerJunsuChoi <jsuya.choi@samsung.com>
Fri, 19 Nov 2021 08:34:34 +0000 (17:34 +0900)
This example loads all the svgs even if they are out of the screen space.

src/examples/Stress.cpp

index b9a3bde297a4d7e14d783aad3009d554266e85bc..f258a86ebccf77ac96b74b45af08355da759a46d 100644 (file)
 #define SIZE 50
 
 static bool rendered = false;
-static int count = 0;
+static int xCnt = 0;
+static int yCnt = 0;
 static int frame = 0;
 static std::vector<tvg::Picture*> pictures;
 static double t1, t2, t3, t4;
 
 void svgDirCallback(const char* name, const char* path, void* data)
 {
+    if (yCnt > NUM_PER_LINE) return;        //Load maximum to NUM_PER_LINE
+
     //ignore if not svgs.
     const char *ext = name + strlen(name) - 3;
     if (strcmp(ext, "svg")) return;
@@ -50,19 +53,21 @@ void svgDirCallback(const char* name, const char* path, void* data)
     if (picture->load(buf) != tvg::Result::Success) return;
 
     picture->size(SIZE, SIZE);
-    picture->translate((count % NUM_PER_LINE) * SIZE, SIZE * (count / NUM_PER_LINE));
-    ++count;
+    picture->translate((xCnt % NUM_PER_LINE) * SIZE, SIZE * (xCnt / NUM_PER_LINE));
+    ++xCnt;
 
     //Duplicates
     for (int i = 0; i < NUM_PER_LINE - 1; i++) {
         tvg::Picture* dup = static_cast<tvg::Picture*>(picture->duplicate());
-        dup->translate((count % NUM_PER_LINE) * SIZE, SIZE * (count / NUM_PER_LINE));
+        dup->translate((xCnt % NUM_PER_LINE) * SIZE, SIZE * (xCnt / NUM_PER_LINE));
         pictures.push_back(dup);
-        ++count;
+        ++xCnt;
     }
 
     cout << "SVG: " << buf << endl;
     pictures.push_back(picture.release());
+
+    ++yCnt;
 }
 
 void tvgDrawCmds(tvg::Canvas* canvas)