examples: revise the usage.

Remove the canvas buffer clear call
when the solid bg is introduced.
This commit is contained in:
Hermet Park 2024-01-17 17:26:29 +09:00 committed by Hermet Park
parent 71cc7c2e30
commit 27b49dcf45
3 changed files with 11 additions and 6 deletions

View file

@ -28,15 +28,16 @@
static unique_ptr<tvg::Animation> animation;
static Elm_Transit *transit;
static bool updated = false;
void tvgUpdateCmds(tvg::Canvas* canvas, tvg::Animation* animation, float progress)
{
if (!canvas) return;
canvas->clear(false);
if (updated || !canvas) return;
//Update animation frame only when it's changed
if (animation->frame(animation->totalFrame() * progress) == tvg::Result::Success) {
canvas->update();
updated = true;
}
}
@ -101,8 +102,12 @@ void tvgSwTest(uint32_t* buffer)
void drawSwView(void* data, Eo* obj)
{
//It's not necessary to clear buffer since it has a solid background
//swCanvas->clear(false);
if (swCanvas->draw() == tvg::Result::Success) {
swCanvas->sync();
updated = false;
}
}

View file

@ -61,9 +61,8 @@ void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
{
if (!canvas) return;
/* Update shape directly.
You can update necessary properties of this shape. */
canvas->clear(false);
//It's not necessary to clear canvas since it has a solid background and retaining the paints.
//canvas->clear(false);
//Reset Shape
if (pShape->reset() == tvg::Result::Success) {

View file

@ -142,7 +142,8 @@ void tvgSwTest(uint32_t* buffer)
void drawSwView(void* data, Eo* obj)
{
swCanvas->clear(false);
//It's not necessary to clear buffer since it has a solid background
//swCanvas->clear(false);
//canvas update
auto before = ecore_time_get();