mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-15 04:24:28 +00:00
common engine: manage engine initializing context.
Change-Id: Ida3997fd7cc9ee0916d48290168cdb884e946833
This commit is contained in:
parent
7435b5b414
commit
fb208defed
1 changed files with 15 additions and 7 deletions
|
@ -24,6 +24,8 @@
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/* Internal Class Implementation */
|
/* Internal Class Implementation */
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
static bool initialized = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -32,11 +34,13 @@
|
||||||
|
|
||||||
Result Engine::init() noexcept
|
Result Engine::init() noexcept
|
||||||
{
|
{
|
||||||
//TODO: Initialize Raster engines by configuration.
|
if (initialized) return Result::InsufficientCondition;
|
||||||
|
|
||||||
int ret = 0;
|
//TODO: Initialize Raster engines by configuration.
|
||||||
ret |= SwRenderer::init();
|
SwRenderer::init();
|
||||||
ret |= GlRenderer::init();
|
GlRenderer::init();
|
||||||
|
|
||||||
|
initialized = true;
|
||||||
|
|
||||||
return Result::Success;
|
return Result::Success;
|
||||||
}
|
}
|
||||||
|
@ -44,9 +48,13 @@ Result Engine::init() noexcept
|
||||||
|
|
||||||
Result Engine::term() noexcept
|
Result Engine::term() noexcept
|
||||||
{
|
{
|
||||||
int ret = 0;
|
if (!initialized) return Result::InsufficientCondition;
|
||||||
ret |= SwRenderer::term();
|
|
||||||
ret |= GlRenderer::term();
|
//TODO: Terminate only allowed engines.
|
||||||
|
SwRenderer::term();
|
||||||
|
GlRenderer::term();
|
||||||
|
|
||||||
|
initialized = false;
|
||||||
|
|
||||||
return Result::Success;
|
return Result::Success;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue