• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 "rs_image_manager.h"
17 
18 #ifdef RS_ENABLE_VK
19 #include "rs_vk_image_manager.h"
20 #endif // RS_ENABLE_VK
21 
22 #include "EGL/egl.h"
23 #include "platform/common/rs_system_properties.h"
24 #include "rs_egl_image_manager.h"
25 
26 namespace OHOS {
27 namespace Rosen {
Create(std::shared_ptr<RenderContext> & renderContext)28 std::shared_ptr<RSImageManager> RSImageManager::Create(std::shared_ptr<RenderContext>& renderContext)
29 {
30     std::shared_ptr<RSImageManager> imageManager = nullptr;
31     if (RSSystemProperties::IsUseVulkan()) {
32 #ifdef RS_ENABLE_VK
33         imageManager = std::make_shared<RSVkImageManager>();
34 #endif
35     } else {
36         if (renderContext != nullptr) {
37             imageManager = std::make_shared<RSEglImageManager>(renderContext->GetEGLDisplay());
38         }
39     }
40     return imageManager;
41 }
42 } // namespace Rosen
43 } // namespace OHOS