From 41c41b538d179544d7d2c16d82f673bfee55fd31 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Tue, 16 May 2023 11:08:38 +0900 Subject: [PATCH] examples: updated SVG samples. increase the canvas to afford more resources. --- src/examples/Common.h | 21 +++++++++++++----- src/examples/MultiCanvas.cpp | 6 ++--- src/examples/Stress.cpp | 6 ++--- src/examples/Svg.cpp | 6 ++--- src/examples/images/LottieFiles_logo.svg | 22 +++++++++++++++++++ src/examples/images/eu.svg | 28 ++++++++++++++++++++++++ src/examples/images/opensearch.svg | 16 -------------- 7 files changed, 74 insertions(+), 31 deletions(-) create mode 100644 src/examples/images/LottieFiles_logo.svg create mode 100644 src/examples/images/eu.svg delete mode 100644 src/examples/images/opensearch.svg diff --git a/src/examples/Common.h b/src/examples/Common.h index 6ce91fe1..8ff61438 100644 --- a/src/examples/Common.h +++ b/src/examples/Common.h @@ -27,8 +27,10 @@ using namespace std; -#define WIDTH 800 -#define HEIGHT 800 +static uint32_t WIDTH = 800; +static uint32_t HEIGHT = 800; +static uint32_t* buffer = nullptr; + /************************************************************************/ /* Common Infrastructure Code */ @@ -39,12 +41,16 @@ void drawSwView(void* data, Eo* obj); void win_del(void *data, Evas_Object *o, void *ev) { - elm_exit(); + free(buffer); + elm_exit(); } -static Eo* createSwView() +static Eo* createSwView(uint32_t w = 800, uint32_t h = 800) { - static uint32_t buffer[WIDTH * HEIGHT]; + WIDTH = w; + HEIGHT = h; + + buffer = static_cast(malloc(w * h * sizeof(uint32_t))); Eo* win = elm_win_util_standard_add(NULL, "ThorVG Test"); evas_object_smart_callback_add(win, "delete,request", win_del, 0); @@ -70,8 +76,11 @@ static Eo* createSwView() void initGLview(Evas_Object *obj); void drawGLview(Evas_Object *obj); -static Eo* createGlView() +static Eo* createGlView(uint32_t w = 800, uint32_t h = 800) { + WIDTH = w; + HEIGHT = h; + elm_config_accel_preference_set("gl"); Eo* win = elm_win_util_standard_add(NULL, "ThorVG Test"); diff --git a/src/examples/MultiCanvas.cpp b/src/examples/MultiCanvas.cpp index a8afbeae..42e6e694 100644 --- a/src/examples/MultiCanvas.cpp +++ b/src/examples/MultiCanvas.cpp @@ -31,9 +31,9 @@ using namespace std; /************************************************************************/ /* Drawing Commands */ /************************************************************************/ -#define WIDTH 800 -#define HEIGHT 800 -#define NUM_PER_LINE 5 +#define WIDTH 1024 +#define HEIGHT 1024 +#define NUM_PER_LINE 7 #define SIZE (WIDTH/NUM_PER_LINE) static size_t counter = 0; diff --git a/src/examples/Stress.cpp b/src/examples/Stress.cpp index 447bfb3d..cc1380bb 100644 --- a/src/examples/Stress.cpp +++ b/src/examples/Stress.cpp @@ -28,7 +28,7 @@ /************************************************************************/ #define NUM_PER_LINE 16 -#define SIZE 50 +#define SIZE 80 static bool rendered = false; static int xCnt = 0; @@ -235,10 +235,10 @@ int main(int argc, char **argv) Elm_Transit *transit = elm_transit_add(); if (tvgEngine == tvg::CanvasEngine::Sw) { - auto view = createSwView(); + auto view = createSwView(1280, 1280); elm_transit_effect_add(transit, transitSwCb, view, nullptr); } else { - auto view = createGlView(); + auto view = createGlView(1280, 1280); elm_transit_effect_add(transit, transitGlCb, view, nullptr); } diff --git a/src/examples/Svg.cpp b/src/examples/Svg.cpp index 6f4b9bed..f160cdc1 100644 --- a/src/examples/Svg.cpp +++ b/src/examples/Svg.cpp @@ -28,7 +28,7 @@ /************************************************************************/ #define NUM_PER_ROW 7 -#define NUM_PER_COL 6 +#define NUM_PER_COL 7 #define SIZE (WIDTH/NUM_PER_ROW) static int counter = 0; @@ -186,9 +186,9 @@ int main(int argc, char **argv) elm_init(argc, argv); if (tvgEngine == tvg::CanvasEngine::Sw) { - createSwView(); + createSwView(1280, 1280); } else { - createGlView(); + createGlView(1280, 1280); } elm_run(); diff --git a/src/examples/images/LottieFiles_logo.svg b/src/examples/images/LottieFiles_logo.svg new file mode 100644 index 00000000..ec06de28 --- /dev/null +++ b/src/examples/images/LottieFiles_logo.svg @@ -0,0 +1,22 @@ + + + + lf_Logo + Created with Sketch. + + + + + + + + \ No newline at end of file diff --git a/src/examples/images/eu.svg b/src/examples/images/eu.svg new file mode 100644 index 00000000..1bb04ecb --- /dev/null +++ b/src/examples/images/eu.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/examples/images/opensearch.svg b/src/examples/images/opensearch.svg deleted file mode 100644 index 2a3083ff..00000000 --- a/src/examples/images/opensearch.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file