mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +00:00
common initializer: correct the result value.
When memory is not allocated successully, it must return the FailedAllocation as the return value. Previous initializer wrongly returns the value that case, this corrects it.
This commit is contained in:
parent
c2b2aa92c3
commit
efa0035fe6
2 changed files with 3 additions and 3 deletions
|
@ -1272,7 +1272,7 @@ public:
|
||||||
* @param[in] threads The number of additional threads. Zero indicates only the main thread is to be used.
|
* @param[in] threads The number of additional threads. Zero indicates only the main thread is to be used.
|
||||||
*
|
*
|
||||||
* @retval Result::Success When succeed.
|
* @retval Result::Success When succeed.
|
||||||
* @retval Result::InsufficientCondition An internal error possibly with memory allocation.
|
* @retval Result::FailedAllocation An internal error possibly with memory allocation.
|
||||||
* @retval Result::InvalidArguments If unknown engine type chosen.
|
* @retval Result::InvalidArguments If unknown engine type chosen.
|
||||||
* @retval Result::NonSupport In case the engine type is not supported on the system.
|
* @retval Result::NonSupport In case the engine type is not supported on the system.
|
||||||
* @retval Result::Unknown Others.
|
* @retval Result::Unknown Others.
|
||||||
|
|
|
@ -49,12 +49,12 @@ Result Initializer::init(CanvasEngine engine, uint32_t threads) noexcept
|
||||||
|
|
||||||
if (static_cast<uint32_t>(engine) & static_cast<uint32_t>(CanvasEngine::Sw)) {
|
if (static_cast<uint32_t>(engine) & static_cast<uint32_t>(CanvasEngine::Sw)) {
|
||||||
#ifdef THORVG_SW_RASTER_SUPPORT
|
#ifdef THORVG_SW_RASTER_SUPPORT
|
||||||
if (!SwRenderer::init(threads)) return Result::InsufficientCondition;
|
if (!SwRenderer::init(threads)) return Result::FailedAllocation;
|
||||||
nonSupport = false;
|
nonSupport = false;
|
||||||
#endif
|
#endif
|
||||||
} else if (static_cast<uint32_t>(engine) & static_cast<uint32_t>(CanvasEngine::Gl)) {
|
} else if (static_cast<uint32_t>(engine) & static_cast<uint32_t>(CanvasEngine::Gl)) {
|
||||||
#ifdef THORVG_GL_RASTER_SUPPORT
|
#ifdef THORVG_GL_RASTER_SUPPORT
|
||||||
if (!GlRenderer::init(threads)) return Result::InsufficientCondition;
|
if (!GlRenderer::init(threads)) return Result::FailedAllocation;
|
||||||
nonSupport = false;
|
nonSupport = false;
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue