mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 12:04:29 +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 */
|
||||
/************************************************************************/
|
||||
static bool initialized = false;
|
||||
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
|
@ -32,11 +34,13 @@
|
|||
|
||||
Result Engine::init() noexcept
|
||||
{
|
||||
//TODO: Initialize Raster engines by configuration.
|
||||
if (initialized) return Result::InsufficientCondition;
|
||||
|
||||
int ret = 0;
|
||||
ret |= SwRenderer::init();
|
||||
ret |= GlRenderer::init();
|
||||
//TODO: Initialize Raster engines by configuration.
|
||||
SwRenderer::init();
|
||||
GlRenderer::init();
|
||||
|
||||
initialized = true;
|
||||
|
||||
return Result::Success;
|
||||
}
|
||||
|
@ -44,9 +48,13 @@ Result Engine::init() noexcept
|
|||
|
||||
Result Engine::term() noexcept
|
||||
{
|
||||
int ret = 0;
|
||||
ret |= SwRenderer::term();
|
||||
ret |= GlRenderer::term();
|
||||
if (!initialized) return Result::InsufficientCondition;
|
||||
|
||||
//TODO: Terminate only allowed engines.
|
||||
SwRenderer::term();
|
||||
GlRenderer::term();
|
||||
|
||||
initialized = false;
|
||||
|
||||
return Result::Success;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue