2 * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef _TVG_INITIALIZER_CPP_
18 #define _TVG_INITIALIZER_CPP_
20 #include "tvgCommon.h"
21 #include "tvgSwRenderer.h"
22 #include "tvgGlRenderer.h"
23 #include "tvgLoaderMgr.h"
25 /************************************************************************/
26 /* Internal Class Implementation */
27 /************************************************************************/
29 /************************************************************************/
30 /* External Class Implementation */
31 /************************************************************************/
33 Result Initializer::init(CanvasEngine engine) noexcept
35 if (engine == CanvasEngine::Sw) {
36 if (!SwRenderer::init()) return Result::InsufficientCondition;
37 } else if (engine == CanvasEngine::Gl) {
38 if (!GlRenderer::init()) return Result::InsufficientCondition;
40 return Result::InvalidArguments;
43 if (!LoaderMgr::init()) return Result::Unknown;
45 return Result::Success;
49 Result Initializer::term(CanvasEngine engine) noexcept
51 //TODO: deinitialize modules
53 if (engine == CanvasEngine::Sw) {
54 if (!SwRenderer::term()) return Result::InsufficientCondition;
55 } else if (engine == CanvasEngine::Gl) {
56 if (!GlRenderer::term()) return Result::InsufficientCondition;
58 return Result::InvalidArguments;
61 if (!LoaderMgr::term()) return Result::Unknown;
63 return Result::Success;
66 #endif /* _TVG_INITIALIZER_CPP_ */