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 
32     RSRenderParams::OnSync(target);
33 }
SetCacheValid(bool valid)34 void RSEffectRenderParams::SetCacheValid(bool valid)
35 {
36     if (cacheValid_ == valid) {
37         return;
38     }
39     cacheValid_ = valid;
40     needSync_ = true;
41 }
42 
GetCacheValid() const43 bool RSEffectRenderParams::GetCacheValid() const
44 {
45     return cacheValid_;
46 }
47 
SetHasEffectChildren(bool hasEffectChildren)48 void RSEffectRenderParams::SetHasEffectChildren(bool hasEffectChildren)
49 {
50     if (hasEffectChildren_ == hasEffectChildren) {
51         return;
52     }
53     hasEffectChildren_ = hasEffectChildren;
54     needSync_ = true;
55 }
56 
GetHasEffectChildren() const57 bool RSEffectRenderParams::GetHasEffectChildren() const
58 {
59     return hasEffectChildren_;
60 }
61 
62 } // namespace OHOS::Rosen
63