2 #include "lottieview.h"
9 * To check the frame rate with rendermode off run
10 * ECORE_EVAS_FPS_DEBUG=1 ./lottieviewTest --disable-render
12 * To check the frame rate with render backend
13 * ECORE_EVAS_FPS_DEBUG=1 ./lottieviewTest
20 LottieViewTest(EvasApp *app, bool renderMode) {
22 mRenderMode = renderMode;
25 void show(int numberOfImage) {
26 auto resource = EvasApp::jsonFiles(std::string(DEMO_DIR));
28 if (resource.empty()) return;
30 int count = numberOfImage;
31 int colums = (int) ceil(sqrt(count));
33 int vw = (mApp->width() - (2 * offset * colums))/colums;
37 int resourceSize = resource.size();
38 for (int i = 0 ; i < numberOfImage; i++) {
39 int index = i % resourceSize;
40 std::unique_ptr<LottieView> view(new LottieView(mApp->evas(), mRenderMode));
41 view->setFilePath(resource[index].c_str());
42 view->setPos(posx, posy);
43 view->setSize(vw, vh);
47 //view->setRepeatMode(LottieView::RepeatMode::Reverse);
50 if ((mApp->width() - posx) < vw) {
52 posy = posy + vh + offset;
54 mViews.push_back(std::move(view));
59 //auto clock = std::chrono::high_resolution_clock::now();
60 for (auto &i : mViews) {
63 //double d = std::chrono::duration<double, std::milli>(std::chrono::high_resolution_clock::now()-clock).count();
64 //printf("total time taken = %f\n", d);
69 bool mRenderMode = false;
70 std::vector<std::unique_ptr<LottieView>> mViews;
74 onExitCb(void *data, void *extra)
76 LottieViewTest *view = (LottieViewTest *)data;
81 onRenderPreCb(void *data, void *extra)
83 LottieViewTest *view = (LottieViewTest *)data;
88 main(int argc, char **argv)
90 EvasApp *app = new EvasApp(800, 800);
93 bool renderMode = true;
95 if (!strcmp(argv[1],"--disable-render"))
98 LottieViewTest *view = new LottieViewTest(app, renderMode);
101 app->addExitCb(onExitCb, view);
102 app->addRenderPreCb(onRenderPreCb, view);