• 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 
16 #include "params/rs_rcd_render_params.h"
17 #include "platform/common/rs_log.h"
18 
19 namespace OHOS::Rosen {
RSRcdRenderParams(NodeId id)20 RSRcdRenderParams::RSRcdRenderParams(NodeId id) : RSRenderParams(id) {}
21 
OnSync(const std::unique_ptr<RSRenderParams> & target)22 void RSRcdRenderParams::OnSync(const std::unique_ptr<RSRenderParams>& target)
23 {
24     auto targetRcdRenderParam = static_cast<RSRcdRenderParams*>(target.get());
25     if (targetRcdRenderParam == nullptr) {
26         RS_LOGE("targetRcdRenderParam::OnSync targetRcdRenderParam is null");
27         return;
28     }
29     targetRcdRenderParam->pathBin_ = pathBin_;
30     targetRcdRenderParam->bufferSize_ = bufferSize_;
31     targetRcdRenderParam->cldWidth_ = cldWidth_;
32     targetRcdRenderParam->cldHeight_ = cldHeight_;
33     targetRcdRenderParam->srcRect_ = srcRect_;
34     targetRcdRenderParam->dstRect_ = dstRect_;
35     targetRcdRenderParam->rcdBitmap_ = rcdBitmap_;
36     targetRcdRenderParam->rcdEnabled_ = rcdEnabled_;
37     targetRcdRenderParam->resourceChanged_ = resourceChanged_;
38 
39     RSRenderParams::OnSync(target);
40 }
41 
SetPathBin(std::string pathBin)42 void RSRcdRenderParams::SetPathBin(std::string pathBin)
43 {
44     if (pathBin_ == pathBin) {
45         return;
46     }
47     pathBin_ = pathBin;
48     needSync_ = true;
49 }
50 
GetPathBin() const51 std::string RSRcdRenderParams::GetPathBin() const
52 {
53     return pathBin_;
54 }
55 
SetBufferSize(int bufferSize)56 void RSRcdRenderParams::SetBufferSize(int bufferSize)
57 {
58     if (bufferSize_ == bufferSize) {
59         return;
60     }
61     bufferSize_ = bufferSize;
62     needSync_ = true;
63 }
64 
GetBufferSize() const65 int RSRcdRenderParams::GetBufferSize() const
66 {
67     return bufferSize_;
68 }
69 
SetCldWidth(int cldWidth)70 void RSRcdRenderParams::SetCldWidth(int cldWidth)
71 {
72     if (cldWidth_ == cldWidth) {
73         return;
74     }
75     cldWidth_ = cldWidth;
76     needSync_ = true;
77 }
78 
GetCldWidth() const79 int RSRcdRenderParams::GetCldWidth() const
80 {
81     return cldWidth_;
82 }
83 
SetCldHeight(int cldWidth)84 void RSRcdRenderParams::SetCldHeight(int cldWidth)
85 {
86     if (cldHeight_ == cldWidth) {
87         return;
88     }
89     cldHeight_ = cldWidth;
90     needSync_ = true;
91 }
92 
GetCldHeight() const93 int RSRcdRenderParams::GetCldHeight() const
94 {
95     return cldHeight_;
96 }
97 
SetSrcRect(RectI srcRect)98 void RSRcdRenderParams::SetSrcRect(RectI srcRect)
99 {
100     if (srcRect_ == srcRect) {
101         return;
102     }
103     srcRect_ = srcRect;
104     needSync_ = true;
105 }
106 
GetSrcRect() const107 RectI RSRcdRenderParams::GetSrcRect() const
108 {
109     return srcRect_;
110 }
111 
SetDstRect(RectI dstRect)112 void RSRcdRenderParams::SetDstRect(RectI dstRect)
113 {
114     if (dstRect_ == dstRect) {
115         return;
116     }
117     dstRect_ = dstRect;
118     needSync_ = true;
119 }
120 
GetDstRect() const121 RectI RSRcdRenderParams::GetDstRect() const
122 {
123     return dstRect_;
124 }
125 
SetRcdBitmap(std::shared_ptr<Drawing::Bitmap> rcdBitmap)126 void RSRcdRenderParams::SetRcdBitmap(std::shared_ptr<Drawing::Bitmap> rcdBitmap)
127 {
128     if (rcdBitmap_ == rcdBitmap) {
129         return;
130     }
131     rcdBitmap_ = rcdBitmap;
132     needSync_ = true;
133 }
134 
GetRcdBitmap() const135 std::shared_ptr<Drawing::Bitmap> RSRcdRenderParams::GetRcdBitmap() const
136 {
137     return rcdBitmap_;
138 }
139 
SetRcdEnabled(bool rcdEnabled)140 void RSRcdRenderParams::SetRcdEnabled(bool rcdEnabled)
141 {
142     if (rcdEnabled_ == rcdEnabled) {
143         return;
144     }
145     rcdEnabled_ = rcdEnabled;
146     needSync_ = true;
147 }
148 
GetRcdEnabled() const149 bool RSRcdRenderParams::GetRcdEnabled() const
150 {
151     return rcdEnabled_;
152 }
153 
SetResourceChanged(bool resourceChanged)154 void RSRcdRenderParams::SetResourceChanged(bool resourceChanged)
155 {
156     if (resourceChanged_ == resourceChanged) {
157         return;
158     }
159     resourceChanged_ = resourceChanged;
160     needSync_ = true;
161 }
162 
GetResourceChanged() const163 bool RSRcdRenderParams::GetResourceChanged() const
164 {
165     return resourceChanged_;
166 }
167 } // namespace OHOS::Rosen
168