summaryrefslogtreecommitdiffstats
path: root/thirdparty/thorvg/src/renderer/tvgInitializer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/thorvg/src/renderer/tvgInitializer.cpp')
-rw-r--r--thirdparty/thorvg/src/renderer/tvgInitializer.cpp35
1 files changed, 28 insertions, 7 deletions
diff --git a/thirdparty/thorvg/src/renderer/tvgInitializer.cpp b/thirdparty/thorvg/src/renderer/tvgInitializer.cpp
index b7326a9fbc..76d89b40ed 100644
--- a/thirdparty/thorvg/src/renderer/tvgInitializer.cpp
+++ b/thirdparty/thorvg/src/renderer/tvgInitializer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -36,6 +36,10 @@
#include "tvgGlRenderer.h"
#endif
+#ifdef THORVG_WG_RASTER_SUPPORT
+ #include "tvgWgRenderer.h"
+#endif
+
/************************************************************************/
/* Internal Class Implementation */
@@ -91,19 +95,27 @@ static bool _buildVersionInfo()
Result Initializer::init(CanvasEngine engine, uint32_t threads) noexcept
{
auto nonSupport = true;
+ if (static_cast<int>(engine) == 0) return Result::InvalidArguments;
if (engine & CanvasEngine::Sw) {
#ifdef THORVG_SW_RASTER_SUPPORT
if (!SwRenderer::init(threads)) return Result::FailedAllocation;
nonSupport = false;
#endif
- } else if (engine & CanvasEngine::Gl) {
+ }
+
+ if (engine & CanvasEngine::Gl) {
#ifdef THORVG_GL_RASTER_SUPPORT
if (!GlRenderer::init(threads)) return Result::FailedAllocation;
nonSupport = false;
#endif
- } else {
- return Result::InvalidArguments;
+ }
+
+ if (engine & CanvasEngine::Wg) {
+ #ifdef THORVG_WG_RASTER_SUPPORT
+ if (!WgRenderer::init(threads)) return Result::FailedAllocation;
+ nonSupport = false;
+ #endif
}
if (nonSupport) return Result::NonSupport;
@@ -125,19 +137,27 @@ Result Initializer::term(CanvasEngine engine) noexcept
if (_initCnt == 0) return Result::InsufficientCondition;
auto nonSupport = true;
+ if (static_cast<int>(engine) == 0) return Result::InvalidArguments;
if (engine & CanvasEngine::Sw) {
#ifdef THORVG_SW_RASTER_SUPPORT
if (!SwRenderer::term()) return Result::InsufficientCondition;
nonSupport = false;
#endif
- } else if (engine & CanvasEngine::Gl) {
+ }
+
+ if (engine & CanvasEngine::Gl) {
#ifdef THORVG_GL_RASTER_SUPPORT
if (!GlRenderer::term()) return Result::InsufficientCondition;
nonSupport = false;
#endif
- } else {
- return Result::InvalidArguments;
+ }
+
+ if (engine & CanvasEngine::Wg) {
+ #ifdef THORVG_WG_RASTER_SUPPORT
+ if (!WgRenderer::term()) return Result::InsufficientCondition;
+ nonSupport = false;
+ #endif
}
if (nonSupport) return Result::NonSupport;
@@ -156,3 +176,4 @@ uint16_t THORVG_VERSION_NUMBER()
{
return _version;
}
+