From f43b3c4de32e049e087b4dec3c81c99307f46c1d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 14 Jun 2014 21:51:25 +0300 Subject: Add another build in fps test, unused. --- src/test/testlauncher.cpp | 49 +++++++++++++++++++++++++++++++++++++++++++++++ src/test/testlauncher.h | 2 ++ 2 files changed, 51 insertions(+) (limited to 'src') diff --git a/src/test/testlauncher.cpp b/src/test/testlauncher.cpp index c1bde0810..22a77eb0e 100644 --- a/src/test/testlauncher.cpp +++ b/src/test/testlauncher.cpp @@ -92,6 +92,8 @@ int TestLauncher::exec() return testDraw(); else if (mTest == "103") return testFps2(); + else if (mTest == "104") + return testFps3(); return -1; } @@ -219,6 +221,53 @@ int TestLauncher::testFps2() return 0; } +int TestLauncher::testFps3() +{ + timeval start; + timeval end; + + Wallpaper::loadWallpapers(); + Wallpaper::getWallpaper(800, 600); + Image *img[2]; + + img[0] = Theme::getImageFromTheme("graphics/sprites/arrow_up.png"); + img[1] = Theme::getImageFromTheme("graphics/sprites/arrow_left.png"); + ImageVertexes *const vert1 = new ImageVertexes; + vert1->image = img[0]; + ImageVertexes *const vert2 = new ImageVertexes; + vert2->image = img[1]; + + for (int f = 0; f < 50; f ++) + { + for (int d = 0; d < 50; d ++) + { + mainGraphics->calcTileVertexes(vert1, img[0], f * 16, d * 12); + mainGraphics->calcTileVertexes(vert1, img[1], f * 16 + 5, d * 12); + } + } + mainGraphics->finalize(vert1); + mainGraphics->finalize(vert2); + + const int cnt = 2000; + + gettimeofday(&start, nullptr); + for (int k = 0; k < cnt; k ++) + { + mainGraphics->drawTileVertexes(vert1); + mainGraphics->drawTileVertexes(vert2); + mainGraphics->updateScreen(); + } + + gettimeofday(&end, nullptr); + const int tFps = calcFps(&start, &end, cnt); + file << mTest << std::endl; + file << tFps << std::endl; + + printf("fps: %u\n", tFps); + sleep(1); + return 0; +} + int TestLauncher::testBatches() { int batches = 512; diff --git a/src/test/testlauncher.h b/src/test/testlauncher.h index bc5d93ea8..4b044d42b 100644 --- a/src/test/testlauncher.h +++ b/src/test/testlauncher.h @@ -58,6 +58,8 @@ class TestLauncher final int testFps2(); + int testFps3(); + int testInternal(); int testDye(); -- cgit v1.2.3-70-g09d2