• 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 #include "params/rs_effect_render_params.h"
17 #include "platform/common/rs_log.h"
18 
19 namespace OHOS::Rosen {
RSEffectRenderParams(NodeId id)20 RSEffectRenderParams::RSEffectRenderParams(NodeId id) : RSRenderParams(id) {}
21 
OnSync(const std::unique_ptr<RSRenderParams> & target)22 void RSEffectRenderParams::OnSync(const std::unique_ptr<RSRenderParams>& target)
23 {
24     auto targetEffectRenderParam = static_cast<RSEffectRenderParams*>(target.get());
25     if (targetEffectRenderParam == nullptr) {
26         RS_LOGE("targetCanvasDrawingParam::OnSync targetCanvasDrawingParam is null");
27         return;
28     }
29     targetEffectRenderParam->cacheValid_ = cacheValid_;
30     targetEffectRenderParam->hasEffectChildren_ = hasEffectChildren_;
31     targetEffectRenderParam->isDarkColorMode_ = isDarkColorMode_;
32     targetEffectRenderParam->isIntersectWithDRM_ = isIntersectWithDRM_;
33 
34     RSRenderParams::OnSync(target);
35 }
SetCacheValid(bool valid)36 void RSEffectRenderParams::SetCacheValid(bool valid)
37 {
38     if (cacheValid_ == valid) {
39         return;
40     }
41     cacheValid_ = valid;
42     needSync_ = true;
43 }
44 
GetCacheValid() const45 bool RSEffectRenderParams::GetCacheValid() const
46 {
47     return cacheValid_;
48 }
49 
SetHasEffectChildren(bool hasEffectChildren)50 void RSEffectRenderParams::SetHasEffectChildren(bool hasEffectChildren)
51 {
52     if (hasEffectChildren_ == hasEffectChildren) {
53         return;
54     }
55     hasEffectChildren_ = hasEffectChildren;
56     needSync_ = true;
57 }
58 
GetHasEffectChildren() const59 bool RSEffectRenderParams::GetHasEffectChildren() const
60 {
61     return hasEffectChildren_;
62 }
63 
SetEffectIntersectWithDRM(bool intersect)64 void RSEffectRenderParams::SetEffectIntersectWithDRM(bool intersect)
65 {
66     if (isIntersectWithDRM_ == intersect) {
67         return;
68     }
69     isIntersectWithDRM_ = intersect;
70     needSync_ = true;
71 }
72 
GetEffectIntersectWithDRM() const73 bool RSEffectRenderParams::GetEffectIntersectWithDRM() const
74 {
75     return isIntersectWithDRM_;
76 }
77 
SetDarkColorMode(bool isDark)78 void RSEffectRenderParams::SetDarkColorMode(bool isDark)
79 {
80     if (isDarkColorMode_ == isDark) {
81         return;
82     }
83     isDarkColorMode_ = isDark;
84     needSync_ = true;
85 }
86 
GetDarkColorMode() const87 bool RSEffectRenderParams::GetDarkColorMode() const
88 {
89     return isDarkColorMode_;
90 }
91 } // namespace OHOS::Rosen
92