mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
test: revise async(stress) test code.
Change-Id: I2005f12cc9552b4a98101ba53f48b04c9a6c5732
This commit is contained in:
parent
4156de72f1
commit
28485d4b9c
3 changed files with 16 additions and 25 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -20,4 +20,4 @@ testRadialGradient
|
||||||
testGradientTransform
|
testGradientTransform
|
||||||
testSvg
|
testSvg
|
||||||
testGlShape
|
testGlShape
|
||||||
testStress
|
testAsync
|
||||||
|
|
|
@ -18,4 +18,4 @@ all:
|
||||||
gcc -o testGradientTransform testGradientTransform.cpp -g -lstdc++ `pkg-config --cflags --libs elementary tizenvg`
|
gcc -o testGradientTransform testGradientTransform.cpp -g -lstdc++ `pkg-config --cflags --libs elementary tizenvg`
|
||||||
gcc -o testSvg testSvg.cpp -g -lstdc++ `pkg-config --cflags --libs elementary tizenvg`
|
gcc -o testSvg testSvg.cpp -g -lstdc++ `pkg-config --cflags --libs elementary tizenvg`
|
||||||
gcc -o testGlShape testGlShape.cpp -g -lstdc++ `pkg-config --cflags --libs elementary tizenvg`
|
gcc -o testGlShape testGlShape.cpp -g -lstdc++ `pkg-config --cflags --libs elementary tizenvg`
|
||||||
gcc -o testStress testStress.cpp -g -lstdc++ `pkg-config --cflags --libs elementary tizenvg`
|
gcc -o testAsync testAsync.cpp -g -lstdc++ `pkg-config --cflags --libs elementary tizenvg`
|
||||||
|
|
|
@ -26,12 +26,11 @@ Eina_Bool anim_cb(void *data)
|
||||||
//Explicitly clear all retained paint nodes.
|
//Explicitly clear all retained paint nodes.
|
||||||
if (canvas->clear() != tvg::Result::Success)
|
if (canvas->clear() != tvg::Result::Success)
|
||||||
{
|
{
|
||||||
//Probably, you missed sync() call before.
|
//Logically wrong! Probably, you missed to call sync() before.
|
||||||
return ECORE_CALLBACK_RENEW;
|
return ECORE_CALLBACK_RENEW;
|
||||||
}
|
}
|
||||||
|
|
||||||
t1 = t;
|
t1 = t;
|
||||||
|
|
||||||
t2 = ecore_time_get();
|
t2 = ecore_time_get();
|
||||||
|
|
||||||
for (int i = 0; i < COUNT; i++) {
|
for (int i = 0; i < COUNT; i++) {
|
||||||
|
@ -44,34 +43,25 @@ Eina_Bool anim_cb(void *data)
|
||||||
|
|
||||||
shape->appendRect(x, y, w, h, rand() % 400);
|
shape->appendRect(x, y, w, h, rand() % 400);
|
||||||
|
|
||||||
if (rand() % 2) {
|
//LinearGradient
|
||||||
//LinearGradient
|
auto fill = tvg::LinearGradient::gen();
|
||||||
auto fill = tvg::LinearGradient::gen();
|
fill->linear(x, y, x + w, y + h);
|
||||||
fill->linear(x, y, x + w, y + h);
|
|
||||||
|
|
||||||
//Gradient Color Stops
|
//Gradient Color Stops
|
||||||
tvg::Fill::ColorStop colorStops[3];
|
tvg::Fill::ColorStop colorStops[3];
|
||||||
colorStops[0] = {0, uint8_t(rand() % 255), uint8_t(rand() % 255), uint8_t(rand() % 255), 255};
|
colorStops[0] = {0, uint8_t(rand() % 255), uint8_t(rand() % 255), uint8_t(rand() % 255), 255};
|
||||||
colorStops[1] = {1, uint8_t(rand() % 255), uint8_t(rand() % 255), uint8_t(rand() % 255), 255};
|
colorStops[1] = {1, uint8_t(rand() % 255), uint8_t(rand() % 255), uint8_t(rand() % 255), 255};
|
||||||
colorStops[2] = {2, uint8_t(rand() % 255), uint8_t(rand() % 255), uint8_t(rand() % 255), 255};
|
colorStops[2] = {2, uint8_t(rand() % 255), uint8_t(rand() % 255), uint8_t(rand() % 255), 255};
|
||||||
|
|
||||||
|
fill->colorStops(colorStops, 3);
|
||||||
|
shape->fill(move(fill));
|
||||||
|
|
||||||
fill->colorStops(colorStops, 3);
|
|
||||||
shape->fill(move(fill));
|
|
||||||
} else {
|
|
||||||
shape->fill(uint8_t(rand() % 255), uint8_t(rand() % 255), uint8_t(rand() % 255), 255);
|
|
||||||
}
|
|
||||||
#if 0
|
|
||||||
if (rand() % 2) {
|
|
||||||
shape->stroke(float(rand() % 10));
|
|
||||||
shape->stroke(uint8_t(rand() % 255), uint8_t(rand() % 255), uint8_t(rand() % 255), 255);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
canvas->push(move(shape));
|
canvas->push(move(shape));
|
||||||
}
|
}
|
||||||
|
|
||||||
t3 = ecore_time_get();
|
t3 = ecore_time_get();
|
||||||
|
|
||||||
//Draw Next frames
|
//Drawing task can be performed asynchronously.
|
||||||
canvas->draw();
|
canvas->draw();
|
||||||
|
|
||||||
//Update Efl Canvas
|
//Update Efl Canvas
|
||||||
|
@ -84,6 +74,7 @@ Eina_Bool anim_cb(void *data)
|
||||||
|
|
||||||
void render_cb(void* data, Eo* obj)
|
void render_cb(void* data, Eo* obj)
|
||||||
{
|
{
|
||||||
|
//Make it guarantee finishing drawing task.
|
||||||
canvas->sync();
|
canvas->sync();
|
||||||
|
|
||||||
t4 = ecore_time_get();
|
t4 = ecore_time_get();
|
Loading…
Add table
Reference in a new issue