mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
examples: revise the usage.
Remove the canvas buffer clear call when the solid bg is introduced.
This commit is contained in:
parent
71cc7c2e30
commit
27b49dcf45
3 changed files with 11 additions and 6 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue