From e83a47b4c6d5d049d9669380b2360818a4024d2b Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Fri, 19 Nov 2021 16:11:08 +0900 Subject: [PATCH] example stress: adjusted loading count. This example loads all the svgs even if they are out of the screen space. --- src/examples/Stress.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/examples/Stress.cpp b/src/examples/Stress.cpp index b9a3bde2..f258a86e 100644 --- a/src/examples/Stress.cpp +++ b/src/examples/Stress.cpp @@ -31,13 +31,16 @@ #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 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(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)