mirror of
https://github.com/thorvg/thorvg.git
synced 2025-07-25 07:39:02 +00:00
capi: code refactoring (#58)
* capi: refactoring code. init/term method allows mixing enum values, we don't need to call them separatetly.
This commit is contained in:
parent
7a27ca3613
commit
afa7781e20
1 changed files with 6 additions and 16 deletions
|
@ -52,25 +52,15 @@ struct _Tvg_Gradient
|
|||
/* Engine API */
|
||||
/************************************************************************/
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_engine_init(unsigned engine_method, unsigned threads) {
|
||||
Result ret = Result::Success;
|
||||
|
||||
if (engine_method & TVG_ENGINE_SW) ret = tvg::Initializer::init(tvg::CanvasEngine::Sw, threads);
|
||||
if (ret != Result::Success) return (Tvg_Result) ret;
|
||||
|
||||
if (engine_method & TVG_ENGINE_GL) ret = tvg::Initializer::init(tvg::CanvasEngine::Gl, threads);
|
||||
return (Tvg_Result) ret;
|
||||
TVG_EXPORT Tvg_Result tvg_engine_init(unsigned engine_method, unsigned threads)
|
||||
{
|
||||
return (Tvg_Result) Initializer::init(CanvasEngine(engine_method), threads);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_engine_term(unsigned engine_method) {
|
||||
Result ret = Result::Success;
|
||||
|
||||
if (engine_method & TVG_ENGINE_SW) ret = tvg::Initializer::term(tvg::CanvasEngine::Sw);
|
||||
if (ret != Result::Success) return (Tvg_Result) ret;
|
||||
|
||||
if (engine_method & TVG_ENGINE_GL) ret = tvg::Initializer::term(tvg::CanvasEngine::Gl);
|
||||
return (Tvg_Result) ret;
|
||||
TVG_EXPORT Tvg_Result tvg_engine_term(unsigned engine_method)
|
||||
{
|
||||
return (Tvg_Result) Initializer::term(CanvasEngine(engine_method));
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
|
Loading…
Add table
Reference in a new issue