• 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 #ifndef RENDER_SERVICE_BASE_RENDER_RS_EFFECT_LUMINANCE_MANAGER_H
16 #define RENDER_SERVICE_BASE_RENDER_RS_EFFECT_LUMINANCE_MANAGER_H
17 
18 #include <map>
19 
20 #include "common/rs_common_def.h"
21 #include "draw/color.h"
22 #include "effect/rs_render_filter_base.h"
23 #include "effect/rs_render_shader_base.h"
24 
25 namespace OHOS {
26 namespace Rosen {
27 
28 constexpr float EFFECT_MAX_LUMINANCE = 2.0f;
29 
30 class RSB_EXPORT RSEffectLuminanceManager {
31 public:
32     static RSEffectLuminanceManager& GetInstance();
33 
34     virtual ~RSEffectLuminanceManager() = default;
35 
36     void SetDisplayHeadroom(NodeId id, float brightness);
37 
38     float GetDisplayHeadroom(NodeId id) const;
39 
40     static bool GetEnableHdrEffect(std::shared_ptr<RSNGRenderFilterBase> renderFilter);
41 
42     static bool GetEnableHdrEffect(std::shared_ptr<RSNGRenderShaderBase> renderShader);
43 
44 private:
45     RSEffectLuminanceManager() = default;
46 
47     std::map<uint64_t, float> displayHeadroomMap_;
48 };
49 } // Rosen
50 } // OHOS
51 #endif // RENDER_SERVICE_BASE_RENDER_RS_EFFECT_LUMINANCE_MANAGER_H
52