• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 #include "render/rs_resource_manager.h"
16 
17 namespace OHOS::Rosen {
Instance()18 RSResourceManager& RSResourceManager::Instance()
19 {
20     static RSResourceManager sInstance;
21     return sInstance;
22 }
23 
24 #ifndef USE_ROSEN_DRAWING
UploadTexture(bool paraUpload,const sk_sp<SkImage> & image,const std::shared_ptr<Media::PixelMap> & pixelMap,uint64_t uniqueId)25 void RSResourceManager::UploadTexture(bool paraUpload, const sk_sp<SkImage>& image,
26     const std::shared_ptr<Media::PixelMap>& pixelMap, uint64_t uniqueId)
27 {
28 #else
29 void RSResourceManager::UploadTexture(bool paraUpload, const std::shared_ptr<Drawing::Image>& image,
30     const std::shared_ptr<Media::PixelMap>& pixelMap, uint64_t uniqueId)
31 {
32 #endif
33     if (hookFunction_ != nullptr) {
34         hookFunction_(paraUpload, image, pixelMap, uniqueId);
35     } else {
36         RS_LOGE("hookFunction_ is nullptr");
37     }
38 }
39 
40 void RSResourceManager::SetUploadTextureFunction(TextureUpload hook) {
41     if (hook != nullptr) {
42         hookFunction_ = hook;
43     } else {
44         RS_LOGE("SetUploadTextureFunction is nullptr");
45     }
46 }
47 }
48