Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native threading support #5

Open
tinyjin opened this issue Oct 9, 2024 · 1 comment
Open

Native threading support #5

tinyjin opened this issue Oct 9, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@tinyjin
Copy link
Member

tinyjin commented Oct 9, 2024

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
   )
),
@tinyjin tinyjin added the enhancement New feature or request label Oct 9, 2024
@hermet
Copy link
Member

hermet commented Oct 9, 2024

@tinyjin Suggest the default thread as 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants