• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "graphics_manager.h"
17 #include "i_engine.h"
18 #include "platform_data.h"
19 #include "3d_widget_adapter_log.h"
20 
21 namespace OHOS::Render3D {
GetPlatformData() const22 PlatformData GraphicsManager::GetPlatformData() const
23 {
24     #define TO_STRING(name) #name
25     #define PLATFORM_PATH_NAME(name) TO_STRING(name)
26     PlatformData data {
27         PLATFORM_PATH_NAME(PLATFORM_CORE_ROOT_PATH),
28         PLATFORM_PATH_NAME(PLATFORM_CORE_PLUGIN_PATH),
29         PLATFORM_PATH_NAME(PLATFORM_APP_ROOT_PATH),
30         PLATFORM_PATH_NAME(PLATFORM_APP_PLUGIN_PATH),
31     };
32     #undef TO_STRING
33     #undef PLATFORM_PATH_NAME
34     WIDGET_LOGD("platformdata %s, %s, %s, %s,", data.coreRootPath_.c_str(),
35         data.corePluginPath_.c_str(), data.appRootPath_.c_str(), data.appPluginPath_.c_str());
36     return data;
37 }
38 
GetPlatformData(const HapInfo & hapInfo) const39 PlatformData GraphicsManager::GetPlatformData(const HapInfo& hapInfo) const
40 {
41     #define TO_STRING(name) #name
42     #define PLATFORM_PATH_NAME(name) TO_STRING(name)
43     PlatformData data {
44         PLATFORM_PATH_NAME(PLATFORM_CORE_ROOT_PATH),
45         PLATFORM_PATH_NAME(PLATFORM_CORE_PLUGIN_PATH),
46         PLATFORM_PATH_NAME(PLATFORM_APP_ROOT_PATH),
47         PLATFORM_PATH_NAME(PLATFORM_APP_PLUGIN_PATH),
48         hapInfo,
49     };
50     #undef TO_STRING
51     #undef PLATFORM_PATH_NAME
52     WIDGET_LOGD("platformdata %{public}s, %{public}s, %{public}s, %{public}s,", data.coreRootPath_.c_str(),
53         data.corePluginPath_.c_str(), data.appRootPath_.c_str(), data.appPluginPath_.c_str());
54 
55     WIDGET_LOGD("HapInfo %{public}s, %{public}s, %{public}s,", data.hapInfo_.hapPath_.c_str(),
56         data.hapInfo_.bundleName_.c_str(), data.hapInfo_.moduleName_.c_str());
57     return data;
58 }
59 
GetInstance()60 GraphicsManager& GraphicsManager::GetInstance()
61 {
62     static GraphicsManager graphicsManager;
63     return graphicsManager;
64 }
65 
~GraphicsManager()66 GraphicsManager::~GraphicsManager()
67 {}
68 } // namespace OHOS::Render3D
69