examples: ++threading stability.

Ensure synchronous calls are made after updating the canvases.
This commit is contained in:
Hermet Park 2024-02-23 12:20:43 +09:00
parent 0f83850da6
commit f03cff2353
3 changed files with 11 additions and 3 deletions

View file

@ -26,8 +26,9 @@
/* Drawing Commands */ /* Drawing Commands */
/************************************************************************/ /************************************************************************/
tvg::Shape *pMaskShape = nullptr; static tvg::Shape *pMaskShape = nullptr;
tvg::Shape *pMask = nullptr; static tvg::Shape *pMask = nullptr;
static bool updated = false;
void tvgDrawCmds(tvg::Canvas* canvas) void tvgDrawCmds(tvg::Canvas* canvas)
@ -67,6 +68,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
picture2->composite(std::move(mask), tvg::CompositeMethod::AlphaMask); picture2->composite(std::move(mask), tvg::CompositeMethod::AlphaMask);
if (canvas->push(std::move(picture2)) != tvg::Result::Success) return; if (canvas->push(std::move(picture2)) != tvg::Result::Success) return;
updated = true;
} }
@ -93,6 +96,7 @@ void drawSwView(void* data, Eo* obj)
{ {
if (swCanvas->draw() == tvg::Result::Success) { if (swCanvas->draw() == tvg::Result::Success) {
swCanvas->sync(); swCanvas->sync();
updated = false;
} }
} }
@ -109,6 +113,7 @@ void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
pMask->translate(0 , progress * 300 - 100); pMask->translate(0 , progress * 300 - 100);
canvas->update(); canvas->update();
updated = true;
} }
void transitSwCb(Elm_Transit_Effect *effect, Elm_Transit* transit, double progress) void transitSwCb(Elm_Transit_Effect *effect, Elm_Transit* transit, double progress)
@ -149,6 +154,7 @@ void drawGLview(Evas_Object *obj)
if (glCanvas->draw() == tvg::Result::Success) { if (glCanvas->draw() == tvg::Result::Success) {
glCanvas->sync(); glCanvas->sync();
updated = false;
} }
} }

View file

@ -147,6 +147,7 @@ void drawGLview(Evas_Object *obj)
if (glCanvas->draw() == tvg::Result::Success) { if (glCanvas->draw() == tvg::Result::Success) {
glCanvas->sync(); glCanvas->sync();
updated = false;
} }
} }

View file

@ -25,7 +25,7 @@
/************************************************************************/ /************************************************************************/
/* Drawing Commands */ /* Drawing Commands */
/************************************************************************/ /************************************************************************/
tvg::Shape* pShape = nullptr; static tvg::Shape* pShape = nullptr;
static bool updated = false; static bool updated = false;
void tvgDrawCmds(tvg::Canvas* canvas) void tvgDrawCmds(tvg::Canvas* canvas)
@ -148,6 +148,7 @@ void drawGLview(Evas_Object *obj)
if (glCanvas->draw() == tvg::Result::Success) { if (glCanvas->draw() == tvg::Result::Success) {
glCanvas->sync(); glCanvas->sync();
updated = false;
} }
} }