mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-09 14:13:43 +00:00
renderer/initializer: Support for initializing SW and GL engines together
Initialize both renderers to allow init(SW | GL);
This commit is contained in:
parent
e3a3acb6b0
commit
fdb2a17504
1 changed files with 15 additions and 8 deletions
|
@ -95,24 +95,27 @@ static bool _buildVersionInfo()
|
||||||
Result Initializer::init(CanvasEngine engine, uint32_t threads) noexcept
|
Result Initializer::init(CanvasEngine engine, uint32_t threads) noexcept
|
||||||
{
|
{
|
||||||
auto nonSupport = true;
|
auto nonSupport = true;
|
||||||
|
if (static_cast<int>(engine) == 0) return Result::InvalidArguments;
|
||||||
|
|
||||||
if (engine & CanvasEngine::Sw) {
|
if (engine & CanvasEngine::Sw) {
|
||||||
#ifdef THORVG_SW_RASTER_SUPPORT
|
#ifdef THORVG_SW_RASTER_SUPPORT
|
||||||
if (!SwRenderer::init(threads)) return Result::FailedAllocation;
|
if (!SwRenderer::init(threads)) return Result::FailedAllocation;
|
||||||
nonSupport = false;
|
nonSupport = false;
|
||||||
#endif
|
#endif
|
||||||
} else if (engine & CanvasEngine::Gl) {
|
}
|
||||||
|
|
||||||
|
if (engine & CanvasEngine::Gl) {
|
||||||
#ifdef THORVG_GL_RASTER_SUPPORT
|
#ifdef THORVG_GL_RASTER_SUPPORT
|
||||||
if (!GlRenderer::init(threads)) return Result::FailedAllocation;
|
if (!GlRenderer::init(threads)) return Result::FailedAllocation;
|
||||||
nonSupport = false;
|
nonSupport = false;
|
||||||
#endif
|
#endif
|
||||||
} else if (engine & CanvasEngine::Wg) {
|
}
|
||||||
|
|
||||||
|
if (engine & CanvasEngine::Wg) {
|
||||||
#ifdef THORVG_WG_RASTER_SUPPORT
|
#ifdef THORVG_WG_RASTER_SUPPORT
|
||||||
if (!WgRenderer::init(threads)) return Result::FailedAllocation;
|
if (!WgRenderer::init(threads)) return Result::FailedAllocation;
|
||||||
nonSupport = false;
|
nonSupport = false;
|
||||||
#endif
|
#endif
|
||||||
} else {
|
|
||||||
return Result::InvalidArguments;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nonSupport) return Result::NonSupport;
|
if (nonSupport) return Result::NonSupport;
|
||||||
|
@ -134,24 +137,27 @@ Result Initializer::term(CanvasEngine engine) noexcept
|
||||||
if (_initCnt == 0) return Result::InsufficientCondition;
|
if (_initCnt == 0) return Result::InsufficientCondition;
|
||||||
|
|
||||||
auto nonSupport = true;
|
auto nonSupport = true;
|
||||||
|
if (static_cast<int>(engine) == 0) return Result::InvalidArguments;
|
||||||
|
|
||||||
if (engine & CanvasEngine::Sw) {
|
if (engine & CanvasEngine::Sw) {
|
||||||
#ifdef THORVG_SW_RASTER_SUPPORT
|
#ifdef THORVG_SW_RASTER_SUPPORT
|
||||||
if (!SwRenderer::term()) return Result::InsufficientCondition;
|
if (!SwRenderer::term()) return Result::InsufficientCondition;
|
||||||
nonSupport = false;
|
nonSupport = false;
|
||||||
#endif
|
#endif
|
||||||
} else if (engine & CanvasEngine::Gl) {
|
}
|
||||||
|
|
||||||
|
if (engine & CanvasEngine::Gl) {
|
||||||
#ifdef THORVG_GL_RASTER_SUPPORT
|
#ifdef THORVG_GL_RASTER_SUPPORT
|
||||||
if (!GlRenderer::term()) return Result::InsufficientCondition;
|
if (!GlRenderer::term()) return Result::InsufficientCondition;
|
||||||
nonSupport = false;
|
nonSupport = false;
|
||||||
#endif
|
#endif
|
||||||
} else if (engine & CanvasEngine::Wg) {
|
}
|
||||||
|
|
||||||
|
if (engine & CanvasEngine::Wg) {
|
||||||
#ifdef THORVG_WG_RASTER_SUPPORT
|
#ifdef THORVG_WG_RASTER_SUPPORT
|
||||||
if (!WgRenderer::term()) return Result::InsufficientCondition;
|
if (!WgRenderer::term()) return Result::InsufficientCondition;
|
||||||
nonSupport = false;
|
nonSupport = false;
|
||||||
#endif
|
#endif
|
||||||
} else {
|
|
||||||
return Result::InvalidArguments;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nonSupport) return Result::NonSupport;
|
if (nonSupport) return Result::NonSupport;
|
||||||
|
@ -170,3 +176,4 @@ uint16_t THORVG_VERSION_NUMBER()
|
||||||
{
|
{
|
||||||
return _version;
|
return _version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue