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
UploadTexture(bool paraUpload,const std::shared_ptr<Drawing::Image> & image,const std::shared_ptr<Media::PixelMap> & pixelMap,uint64_t uniqueId)24 void RSResourceManager::UploadTexture(bool paraUpload, const std::shared_ptr<Drawing::Image>& image,
25 const std::shared_ptr<Media::PixelMap>& pixelMap, uint64_t uniqueId)
26 {
27 if (hookFunction_ != nullptr) {
28 hookFunction_(paraUpload, image, pixelMap, uniqueId);
29 } else {
30 RS_LOGE("hookFunction_ is nullptr");
31 }
32 }
33
SetUploadTextureFunction(TextureUpload hook)34 void RSResourceManager::SetUploadTextureFunction(TextureUpload hook) {
35 if (hook != nullptr) {
36 hookFunction_ = hook;
37 } else {
38 RS_LOGE("SetUploadTextureFunction is nullptr");
39 }
40 }
41 }
42