• 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 #ifndef RENDER_SERVICE_CLIENT_CORE_UI_RS_HDR_MANAGER_H
17 #define RENDER_SERVICE_CLIENT_CORE_UI_RS_HDR_MANAGER_H
18 
19 #include <functional>
20 #include <mutex>
21 
22 #include "ui/rs_node.h"
23 
24 namespace OHOS {
25 namespace Rosen {
26 
27 using HDRFunc = std::function<void(bool, NodeId)>;
28 class RSHDRManager {
29 public:
30     ~RSHDRManager();
31 
32     static RSHDRManager& Instance();
33     int IncreaseHDRNum();
34     int ReduceHDRNum();
35     void ResetHDRNum();
36     int getHDRNum();
37     void RegisterSetHDRPresent(HDRFunc func, NodeId id);
38     void UnRegisterSetHDRPresent(NodeId id);
39 
40 private:
41     RSHDRManager();
42     HDRFunc setHDRPresent_ = nullptr;
43     int hdrNum_ = 0;
44     std::mutex mutex_;
45     NodeId nodeId_ = INVALID_NODEID;
46 };
47 } // namespace Rosen
48 } // namespace OHOS
49 
50 #endif //RENDER_SERVICE_CLIENT_CORE_UI_RS_HDR_MANAGER_H