Skip to content

Native threading support #5

@tinyjin

Description

@tinyjin

Native application could leverage threading feature.

Currently, thorvg.flutter initializes with 0 config, which means this won't thread.

We might need to check to use thread.

explicit TvgLottieAnimation()
{
    errorMsg = NoError;

    // No threading
    if (Initializer::init(CanvasEngine::Sw, 0) != Result::Success)
    {
        errorMsg = "init() fail";
        return;
    }

    canvas = SwCanvas::gen();
    if (!canvas) errorMsg = "Invalid canvas";

    animation = Animation::gen();
    if (!animation) errorMsg = "Invalid animation";
}

We can drive Widget parameters for user so they can decided how many thread they want to enable.
Something like this:

Lottie.network(
  'https://lottie.host/6d7dd6e2-ab92-4e98-826a-2f8430768886/NGnHQ6brWA.json',
  renderConfig: RenderConfig(
    threads: 4
   )
),

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions