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 16 #ifndef RS_RESOURCE_MANAGER 17 #define RS_RESOURCE_MANAGER 18 19 #include "platform/common/rs_log.h" 20 21 #include "image/image.h" 22 #include "render/rs_pixel_map_util.h" 23 24 #include "draw/surface.h" 25 #include "draw/canvas.h" 26 #include "image/gpu_context.h" 27 #include "image/image.h" 28 29 namespace OHOS::Rosen { 30 31 class RSB_EXPORT RSResourceManager final { 32 public: 33 typedef void (*TextureUpload)(bool, const std::shared_ptr<Drawing::Image>&, 34 const std::shared_ptr<Media::PixelMap>&, uint64_t); 35 36 static RSResourceManager& Instance(); 37 38 void UploadTexture(bool paraUpload, const std::shared_ptr<Drawing::Image>& image, 39 const std::shared_ptr<Media::PixelMap>& pixelMap, uint64_t uniqueId); 40 41 private: 42 friend class RSUploadResourceThread; 43 44 void SetUploadTextureFunction(TextureUpload hook); 45 46 private: 47 RSResourceManager() = default; 48 ~RSResourceManager() = default; 49 RSResourceManager(const RSResourceManager&) = delete; 50 RSResourceManager(const RSResourceManager&&)= delete; 51 RSResourceManager& operator=(const RSResourceManager&) = delete; 52 RSResourceManager& operator=(const RSResourceManager&&) = delete; 53 54 TextureUpload hookFunction_ = nullptr; 55 }; 56 57 } 58 #endif