• 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_surface_render_params.h"
17 #include "platform/common/rs_log.h"
18 #include "rs_trace.h"
19 
20 namespace OHOS::Rosen {
RSSurfaceRenderParams(NodeId id)21 RSSurfaceRenderParams::RSSurfaceRenderParams(NodeId id) : RSRenderParams(id) {}
22 
SetOcclusionVisible(bool visible)23 void RSSurfaceRenderParams::SetOcclusionVisible(bool visible)
24 {
25     if (occlusionVisible_ == visible) {
26         return;
27     }
28     occlusionVisible_ = visible;
29     needSync_ = true;
30 }
31 
GetOcclusionVisible() const32 bool RSSurfaceRenderParams::GetOcclusionVisible() const
33 {
34     return occlusionVisible_;
35 }
36 
SetOldDirtyInSurface(const RectI & oldDirtyInSurface)37 void RSSurfaceRenderParams::SetOldDirtyInSurface(const RectI& oldDirtyInSurface)
38 {
39     oldDirtyInSurface_ = oldDirtyInSurface;
40 }
41 
GetOldDirtyInSurface() const42 RectI RSSurfaceRenderParams::GetOldDirtyInSurface() const
43 {
44     return oldDirtyInSurface_;
45 }
46 
SetIsParentScaling(bool isParentScaling)47 void RSSurfaceRenderParams::SetIsParentScaling(bool isParentScaling)
48 {
49     isParentScaling_ = isParentScaling;
50 }
51 
IsParentScaling() const52 bool RSSurfaceRenderParams::IsParentScaling() const
53 {
54     return isParentScaling_;
55 }
56 
SetTransparentRegion(const Occlusion::Region & transparentRegion)57 void RSSurfaceRenderParams::SetTransparentRegion(const Occlusion::Region& transparentRegion)
58 {
59     transparentRegion_ = transparentRegion;
60 }
61 
GetTransparentRegion() const62 const Occlusion::Region& RSSurfaceRenderParams::GetTransparentRegion() const
63 {
64     return transparentRegion_;
65 }
66 
GetVisibleRegion() const67 Occlusion::Region RSSurfaceRenderParams::GetVisibleRegion() const
68 {
69     return visibleRegion_;
70 }
71 
SetVisibleRegion(const Occlusion::Region & visibleRegion)72 void RSSurfaceRenderParams::SetVisibleRegion(const Occlusion::Region& visibleRegion)
73 {
74     visibleRegion_ = visibleRegion;
75     needSync_ = true;
76 }
77 
GetVisibleRegionInVirtual() const78 Occlusion::Region RSSurfaceRenderParams::GetVisibleRegionInVirtual() const
79 {
80     return visibleRegionInVirtual_;
81 }
82 
SetVisibleRegionInVirtual(const Occlusion::Region & visibleRegion)83 void RSSurfaceRenderParams::SetVisibleRegionInVirtual(const Occlusion::Region& visibleRegion)
84 {
85     visibleRegionInVirtual_ = visibleRegion;
86     needSync_ = true;
87 }
88 
SetOccludedByFilterCache(bool val)89 void RSSurfaceRenderParams::SetOccludedByFilterCache(bool val)
90 {
91     if (isOccludedByFilterCache_ == val) {
92         return;
93     }
94     isOccludedByFilterCache_ = val;
95     needSync_ = true;
96 }
97 
GetOccludedByFilterCache() const98 bool RSSurfaceRenderParams::GetOccludedByFilterCache() const
99 {
100     return isOccludedByFilterCache_;
101 }
102 
SetFilterCacheFullyCovered(bool val)103 void RSSurfaceRenderParams::SetFilterCacheFullyCovered(bool val)
104 {
105     isFilterCacheFullyCovered_ = val;
106 }
107 
GetFilterCacheFullyCovered() const108 bool RSSurfaceRenderParams::GetFilterCacheFullyCovered() const
109 {
110     return isFilterCacheFullyCovered_;
111 }
112 
GetAttractionAnimation() const113 bool RSSurfaceRenderParams::GetAttractionAnimation() const
114 {
115     return isAttractionAnimation_;
116 }
117 
GetVisibleFilterChild() const118 const std::vector<NodeId>& RSSurfaceRenderParams::GetVisibleFilterChild() const
119 {
120     return visibleFilterChild_;
121 }
122 
IsTransparent() const123 bool RSSurfaceRenderParams::IsTransparent() const
124 {
125     return isTransparent_;
126 }
127 
CheckValidFilterCacheFullyCoverTarget(bool isFilterCacheValidForOcclusion,const RectI & filterCachedRect,const RectI & targetRect)128 void RSSurfaceRenderParams::CheckValidFilterCacheFullyCoverTarget(
129     bool isFilterCacheValidForOcclusion, const RectI& filterCachedRect, const RectI& targetRect)
130 {
131     if (isFilterCacheFullyCovered_ || !isFilterCacheValidForOcclusion) {
132         return;
133     }
134     // AbsRect may not update here, so use filterCachedRegion to occlude
135     isFilterCacheFullyCovered_ = targetRect.IsInsideOf(filterCachedRect);
136 }
137 
SetLayerInfo(const RSLayerInfo & layerInfo)138 void RSSurfaceRenderParams::SetLayerInfo(const RSLayerInfo& layerInfo)
139 {
140 #ifndef ROSEN_CROSS_PLATFORM
141     layerInfo_ = layerInfo;
142     needSync_ = true;
143     dirtyType_.set(RSRenderParamsDirtyType::LAYER_INFO_DIRTY);
144 #endif
145 }
146 
GetLayerInfo() const147 const RSLayerInfo& RSSurfaceRenderParams::GetLayerInfo() const
148 {
149     return layerInfo_;
150 }
151 
SetHidePrivacyContent(bool needHidePrivacyContent)152 void RSSurfaceRenderParams::SetHidePrivacyContent(bool needHidePrivacyContent)
153 {
154     needHidePrivacyContent_ = needHidePrivacyContent;
155 }
156 
GetHidePrivacyContent() const157 bool RSSurfaceRenderParams::GetHidePrivacyContent() const
158 {
159     return needHidePrivacyContent_;
160 }
161 
SetHardwareEnabled(bool enabled)162 void RSSurfaceRenderParams::SetHardwareEnabled(bool enabled)
163 {
164     if (isHardwareEnabled_ == enabled) {
165         return;
166     }
167     isHardwareEnabled_ = enabled;
168     needSync_ = true;
169 }
170 
GetHardwareEnabled() const171 bool RSSurfaceRenderParams::GetHardwareEnabled() const
172 {
173     return isHardwareEnabled_;
174 }
175 
SetNeedMakeImage(bool enabled)176 void RSSurfaceRenderParams::SetNeedMakeImage(bool enabled)
177 {
178     if (needMakeImage_ == enabled) {
179         return;
180     }
181     needMakeImage_ = enabled;
182     needSync_ = true;
183 }
184 
GetNeedMakeImage() const185 bool RSSurfaceRenderParams::GetNeedMakeImage() const
186 {
187     return needMakeImage_;
188 }
189 
SetHardCursorStatus(bool status)190 void RSSurfaceRenderParams::SetHardCursorStatus(bool status)
191 {
192     if (isHardCursor_ == status) {
193         return;
194     }
195     isHardCursor_ = status;
196     needSync_ = true;
197 }
198 
GetHardCursorStatus() const199 bool RSSurfaceRenderParams::GetHardCursorStatus() const
200 {
201     return isHardCursor_;
202 }
203 
SetPreSubHighPriorityType(bool enabledType)204 void RSSurfaceRenderParams::SetPreSubHighPriorityType(bool enabledType)
205 {
206     if (subHighPriorityType_ == enabledType) {
207         return;
208     }
209     subHighPriorityType_ = enabledType;
210     needSync_ = true;
211 }
212 
GetPreSubHighPriorityType() const213 bool RSSurfaceRenderParams::GetPreSubHighPriorityType() const
214 {
215     return subHighPriorityType_;
216 }
217 
SetLastFrameHardwareEnabled(bool enabled)218 void RSSurfaceRenderParams::SetLastFrameHardwareEnabled(bool enabled)
219 {
220     if (isLastFrameHardwareEnabled_ == enabled) {
221         return;
222     }
223     isLastFrameHardwareEnabled_ = enabled;
224     needSync_ = true;
225 }
SetLayerSourceTuning(int32_t needSourceTuning)226 void RSSurfaceRenderParams::SetLayerSourceTuning(int32_t needSourceTuning)
227 {
228     if (layerSource_ == needSourceTuning) {
229         return;
230     }
231     layerSource_ = needSourceTuning;
232     needSync_ = true;
233 }
234 
GetLayerSourceTuning() const235 int32_t RSSurfaceRenderParams::GetLayerSourceTuning() const
236 {
237     return layerSource_;
238 }
239 
SetTunnelLayerId(const uint64_t & tunnelLayerId)240 void RSSurfaceRenderParams::SetTunnelLayerId(const uint64_t& tunnelLayerId)
241 {
242     if (tunnelLayerId_ == tunnelLayerId) {
243         return;
244     }
245     tunnelLayerId_ = tunnelLayerId;
246     needSync_ = true;
247 }
248 
GetTunnelLayerId() const249 uint64_t RSSurfaceRenderParams::GetTunnelLayerId() const
250 {
251     return tunnelLayerId_;
252 }
253 
GetLastFrameHardwareEnabled() const254 bool RSSurfaceRenderParams::GetLastFrameHardwareEnabled() const
255 {
256     return isLastFrameHardwareEnabled_;
257 }
258 
SetFixRotationByUser(bool flag)259 void RSSurfaceRenderParams::SetFixRotationByUser(bool flag)
260 {
261     if (isFixRotationByUser_ == flag) {
262         return;
263     }
264     isFixRotationByUser_ = flag;
265     needSync_ = true;
266 }
267 
GetFixRotationByUser() const268 bool RSSurfaceRenderParams::GetFixRotationByUser() const
269 {
270     return isFixRotationByUser_;
271 }
272 
SetInFixedRotation(bool flag)273 void RSSurfaceRenderParams::SetInFixedRotation(bool flag)
274 {
275     if (isInFixedRotation_ == flag) {
276         return;
277     }
278     isInFixedRotation_ = flag;
279     needSync_ = true;
280 }
281 
IsInFixedRotation() const282 bool RSSurfaceRenderParams::IsInFixedRotation() const
283 {
284     return isInFixedRotation_;
285 }
286 
287 #ifndef ROSEN_CROSS_PLATFORM
SetBuffer(const sptr<SurfaceBuffer> & buffer,const Rect & damageRect)288 void RSSurfaceRenderParams::SetBuffer(const sptr<SurfaceBuffer>& buffer, const Rect& damageRect)
289 {
290     buffer_ = buffer;
291     damageRect_ = damageRect;
292     needSync_ = true;
293     if (GetParamsType() == RSRenderParamsType::RS_PARAM_OWNED_BY_DRAWABLE) {
294         return;
295     }
296     dirtyType_.set(RSRenderParamsDirtyType::BUFFER_INFO_DIRTY);
297 }
298 
GetBuffer() const299 sptr<SurfaceBuffer> RSSurfaceRenderParams::GetBuffer() const
300 {
301     return buffer_;
302 }
303 
GetBufferDamage() const304 const Rect& RSSurfaceRenderParams::GetBufferDamage() const
305 {
306     return damageRect_;
307 }
308 
SetPreBuffer(const sptr<SurfaceBuffer> & preBuffer)309 void RSSurfaceRenderParams::SetPreBuffer(const sptr<SurfaceBuffer>& preBuffer)
310 {
311     preBuffer_ = preBuffer;
312     needSync_ = true;
313     if (GetParamsType() == RSRenderParamsType::RS_PARAM_OWNED_BY_DRAWABLE) {
314         return;
315     }
316     dirtyType_.set(RSRenderParamsDirtyType::BUFFER_INFO_DIRTY);
317 }
318 
GetPreBuffer()319 sptr<SurfaceBuffer> RSSurfaceRenderParams::GetPreBuffer()
320 {
321     return preBuffer_;
322 }
323 
SetAcquireFence(const sptr<SyncFence> & acquireFence)324 void RSSurfaceRenderParams::SetAcquireFence(const sptr<SyncFence>& acquireFence)
325 {
326     acquireFence_ = acquireFence;
327     needSync_ = true;
328     dirtyType_.set(RSRenderParamsDirtyType::BUFFER_INFO_DIRTY);
329 }
330 
GetAcquireFence() const331 sptr<SyncFence> RSSurfaceRenderParams::GetAcquireFence() const
332 {
333     return acquireFence_;
334 }
335 #endif
336 
GetPreSurfaceCacheContentStatic() const337 bool RSSurfaceRenderParams::GetPreSurfaceCacheContentStatic() const
338 {
339     return preSurfaceCacheContentStatic_;
340 }
341 
SetSurfaceCacheContentStatic(bool contentStatic,bool lastFrameSynced)342 void RSSurfaceRenderParams::SetSurfaceCacheContentStatic(bool contentStatic, bool lastFrameSynced)
343 {
344     // 1. don't sync while contentStatic not change
345     if (surfaceCacheContentStatic_ == contentStatic) {
346         return;
347     }
348     // 2. don't sync while last frame isn't static and skip sync
349     if (!surfaceCacheContentStatic_ && !lastFrameSynced) {
350         return;
351     }
352     preSurfaceCacheContentStatic_ = surfaceCacheContentStatic_;
353     surfaceCacheContentStatic_ = contentStatic;
354     needSync_ = true;
355 }
356 
GetSurfaceCacheContentStatic() const357 bool RSSurfaceRenderParams::GetSurfaceCacheContentStatic() const
358 {
359     return surfaceCacheContentStatic_;
360 }
361 
GetPositionZ() const362 float RSSurfaceRenderParams::GetPositionZ() const
363 {
364     return positionZ_;
365 }
366 
SetSurfaceSubTreeDirty(bool isSubTreeDirty)367 void RSSurfaceRenderParams::SetSurfaceSubTreeDirty(bool isSubTreeDirty)
368 {
369     if (isSubTreeDirty_ == isSubTreeDirty) {
370         return;
371     }
372     isSubTreeDirty_ = isSubTreeDirty;
373     needSync_ = true;
374 }
375 
GetSurfaceSubTreeDirty() const376 bool RSSurfaceRenderParams::GetSurfaceSubTreeDirty() const
377 {
378     return isSubTreeDirty_;
379 }
380 
SetGpuOverDrawBufferOptimizeNode(bool overDrawNode)381 void RSSurfaceRenderParams::SetGpuOverDrawBufferOptimizeNode(bool overDrawNode)
382 {
383     if (isGpuOverDrawBufferOptimizeNode_ == overDrawNode) {
384         return;
385     }
386     isGpuOverDrawBufferOptimizeNode_ = overDrawNode;
387     needSync_ = true;
388 }
389 
IsGpuOverDrawBufferOptimizeNode() const390 bool RSSurfaceRenderParams::IsGpuOverDrawBufferOptimizeNode() const
391 {
392     return isGpuOverDrawBufferOptimizeNode_;
393 }
394 
SetOverDrawBufferNodeCornerRadius(const Vector4f & radius)395 void RSSurfaceRenderParams::SetOverDrawBufferNodeCornerRadius(const Vector4f& radius)
396 {
397     if (overDrawBufferNodeCornerRadius_ == radius) {
398         return;
399     }
400     overDrawBufferNodeCornerRadius_ = radius;
401     needSync_ = true;
402 }
403 
GetOverDrawBufferNodeCornerRadius() const404 const Vector4f& RSSurfaceRenderParams::GetOverDrawBufferNodeCornerRadius() const
405 {
406     return overDrawBufferNodeCornerRadius_;
407 }
408 
SetIsSubSurfaceNode(bool isSubSurfaceNode)409 void RSSurfaceRenderParams::SetIsSubSurfaceNode(bool isSubSurfaceNode)
410 {
411     isSubSurfaceNode_ = isSubSurfaceNode;
412 }
413 
IsSubSurfaceNode() const414 bool RSSurfaceRenderParams::IsSubSurfaceNode() const
415 {
416     return isSubSurfaceNode_;
417 }
418 
SetGlobalPositionEnabled(bool isEnabled)419 void RSSurfaceRenderParams::SetGlobalPositionEnabled(bool isEnabled)
420 {
421     isGlobalPositionEnabled_ = isEnabled;
422 }
423 
GetGlobalPositionEnabled() const424 bool RSSurfaceRenderParams::GetGlobalPositionEnabled() const
425 {
426     return isGlobalPositionEnabled_;
427 }
428 
SetHwcGlobalPositionEnabled(bool isEnabled)429 void RSSurfaceRenderParams::SetHwcGlobalPositionEnabled(bool isEnabled)
430 {
431     isHwcGlobalPositionEnabled_ = isEnabled;
432 }
GetHwcGlobalPositionEnabled() const433 bool RSSurfaceRenderParams::GetHwcGlobalPositionEnabled() const
434 {
435     return isHwcGlobalPositionEnabled_;
436 }
437 
SetHwcCrossNode(bool isCrossNode)438 void RSSurfaceRenderParams::SetHwcCrossNode(bool isCrossNode)
439 {
440     isHwcCrossNode_ = isCrossNode;
441 }
IsHwcCrossNode() const442 bool RSSurfaceRenderParams::IsHwcCrossNode() const
443 {
444     return isHwcCrossNode_;
445 }
446 
SetIsNodeToBeCaptured(bool isNodeToBeCaptured)447 void RSSurfaceRenderParams::SetIsNodeToBeCaptured(bool isNodeToBeCaptured)
448 {
449     isNodeToBeCaptured_ = isNodeToBeCaptured;
450 }
451 
IsNodeToBeCaptured() const452 bool RSSurfaceRenderParams::IsNodeToBeCaptured() const
453 {
454     return isNodeToBeCaptured_;
455 }
456 
SetSkipDraw(bool skip)457 void RSSurfaceRenderParams::SetSkipDraw(bool skip)
458 {
459     isSkipDraw_ = skip;
460 }
461 
GetClonedNodeRenderDrawable()462 DrawableV2::RSRenderNodeDrawableAdapter::WeakPtr RSSurfaceRenderParams::GetClonedNodeRenderDrawable()
463 {
464     return clonedNodeRenderDrawable_;
465 }
466 
IsCloneNode() const467 bool RSSurfaceRenderParams::IsCloneNode() const
468 {
469     return isCloneNode_;
470 }
471 
GetSkipDraw() const472 bool RSSurfaceRenderParams::GetSkipDraw() const
473 {
474     return isSkipDraw_;
475 }
476 
SetLayerTop(bool isTop)477 void RSSurfaceRenderParams::SetLayerTop(bool isTop)
478 {
479     if (isLayerTop_ == isTop) {
480         return;
481     }
482     isLayerTop_ = isTop;
483     needSync_ = true;
484 }
485 
IsLayerTop() const486 bool RSSurfaceRenderParams::IsLayerTop() const
487 {
488     return isLayerTop_;
489 }
490 
SetForceRefresh(bool isForceRefresh)491 void RSSurfaceRenderParams::SetForceRefresh(bool isForceRefresh)
492 {
493     if (isForceRefresh_ == isForceRefresh) {
494         return;
495     }
496     isForceRefresh_ = isForceRefresh;
497     needSync_ = true;
498 }
499 
IsForceRefresh() const500 bool RSSurfaceRenderParams::IsForceRefresh() const
501 {
502     return isForceRefresh_;
503 }
504 
SetWatermarkEnabled(const std::string & name,bool isEnabled)505 void RSSurfaceRenderParams::SetWatermarkEnabled(const std::string& name, bool isEnabled)
506 {
507     watermarkHandles_[name] = isEnabled;
508     needSync_ = true;
509 }
510 
GetWatermarksEnabled() const511 const std::unordered_map<std::string, bool>& RSSurfaceRenderParams::GetWatermarksEnabled() const
512 {
513     return watermarkHandles_;
514 }
515 
IsWatermarkEmpty() const516 bool RSSurfaceRenderParams::IsWatermarkEmpty() const
517 {
518     return watermarkHandles_.empty();
519 }
520 
GetScreenRect() const521 RectI RSSurfaceRenderParams::GetScreenRect() const
522 {
523     return screenRect_;
524 }
525 
RecordScreenRect(RectI rect)526 void RSSurfaceRenderParams::RecordScreenRect(RectI rect)
527 {
528     screenRect_ = rect;
529     needSync_ = true;
530 }
531 
RecordDirtyRegionMatrix(const Drawing::Matrix & matrix)532 void RSSurfaceRenderParams::RecordDirtyRegionMatrix(const Drawing::Matrix& matrix)
533 {
534     dirtyRegionMatrix_ = matrix;
535     needSync_ = true;
536 }
537 
GetDirtyRegionMatrix()538 const Drawing::Matrix& RSSurfaceRenderParams::GetDirtyRegionMatrix()
539 {
540     return dirtyRegionMatrix_;
541 }
542 
OnSync(const std::unique_ptr<RSRenderParams> & target)543 void RSSurfaceRenderParams::OnSync(const std::unique_ptr<RSRenderParams>& target)
544 {
545     auto targetSurfaceParams = static_cast<RSSurfaceRenderParams*>(target.get());
546     if (targetSurfaceParams == nullptr) {
547         RS_LOGE("RSSurfaceRenderParams::OnSync targetSurfaceParams is nullptr");
548         return;
549     }
550 
551     if (dirtyType_.test(RSRenderParamsDirtyType::LAYER_INFO_DIRTY)) {
552         targetSurfaceParams->layerInfo_ = layerInfo_;
553         dirtyType_.reset(RSRenderParamsDirtyType::LAYER_INFO_DIRTY);
554     }
555     targetSurfaceParams->windowInfo_ = windowInfo_;
556 
557 #ifndef ROSEN_CROSS_PLATFORM
558     if (dirtyType_.test(RSRenderParamsDirtyType::BUFFER_INFO_DIRTY)) {
559         targetSurfaceParams->buffer_ = buffer_;
560         targetSurfaceParams->preBuffer_ = preBuffer_;
561         targetSurfaceParams->acquireFence_ = acquireFence_;
562         targetSurfaceParams->damageRect_ = damageRect_;
563         bufferSynced_ = true;
564         dirtyType_.reset(RSRenderParamsDirtyType::BUFFER_INFO_DIRTY);
565     }
566 #endif
567 
568     targetSurfaceParams->rsSurfaceNodeType_ = rsSurfaceNodeType_;
569     targetSurfaceParams->selfDrawingType_ = selfDrawingType_;
570     targetSurfaceParams->ancestorScreenNode_ = ancestorScreenNode_;
571     targetSurfaceParams->ancestorScreenDrawable_ = ancestorScreenDrawable_;
572     targetSurfaceParams->sourceDisplayRenderNodeDrawable_ = sourceDisplayRenderNodeDrawable_;
573     targetSurfaceParams->clonedNodeRenderDrawable_ = clonedNodeRenderDrawable_;
574     targetSurfaceParams->isClonedNodeOnTheTree_ = isClonedNodeOnTheTree_;
575     targetSurfaceParams->isCloneNode_ = isCloneNode_;
576     targetSurfaceParams->clonedSourceNode_ = clonedSourceNode_;
577     targetSurfaceParams->alpha_ = alpha_;
578     targetSurfaceParams->isSpherizeValid_ = isSpherizeValid_;
579     targetSurfaceParams->isAttractionValid_ = isAttractionValid_;
580     targetSurfaceParams->isAttractionAnimation_ = isAttractionAnimation_;
581     targetSurfaceParams->isParentScaling_ = isParentScaling_;
582     targetSurfaceParams->isCrossNode_ = isCrossNode_;
583     targetSurfaceParams->needBilinearInterpolation_ = needBilinearInterpolation_;
584     targetSurfaceParams->backgroundColor_ = backgroundColor_;
585     targetSurfaceParams->rrect_ = rrect_;
586     targetSurfaceParams->occlusionVisible_ = occlusionVisible_;
587     targetSurfaceParams->visibleRegion_ = visibleRegion_;
588     targetSurfaceParams->visibleRegionInVirtual_ = visibleRegionInVirtual_;
589     targetSurfaceParams->oldDirtyInSurface_ = oldDirtyInSurface_;
590     targetSurfaceParams->transparentRegion_ = transparentRegion_;
591     targetSurfaceParams->isHardwareEnabled_ = isHardwareEnabled_;
592     targetSurfaceParams->needMakeImage_ = needMakeImage_;
593     targetSurfaceParams->isHardCursor_ = isHardCursor_;
594     targetSurfaceParams->isLastFrameHardwareEnabled_ = isLastFrameHardwareEnabled_;
595     targetSurfaceParams->stencilVal_ = stencilVal_;
596     targetSurfaceParams->subHighPriorityType_ = subHighPriorityType_;
597     targetSurfaceParams->isFixRotationByUser_ = isFixRotationByUser_;
598     targetSurfaceParams->isInFixedRotation_ = isInFixedRotation_;
599     targetSurfaceParams->uiFirstFlag_ = uiFirstFlag_;
600     targetSurfaceParams->uiFirstParentFlag_ = uiFirstParentFlag_;
601     targetSurfaceParams->uifirstUseStarting_ = uifirstUseStarting_;
602     targetSurfaceParams->childrenDirtyRect_ = childrenDirtyRect_;
603     targetSurfaceParams->isOccludedByFilterCache_ = isOccludedByFilterCache_;
604     targetSurfaceParams->leashPersistentId_ = leashPersistentId_;
605     targetSurfaceParams->drmCornerRadiusInfo_ = drmCornerRadiusInfo_;
606     targetSurfaceParams->isForceDisableClipHoleForDRM_ = isForceDisableClipHoleForDRM_;
607     targetSurfaceParams->animateState_ = animateState_;
608     targetSurfaceParams->isOutOfScreen_ = isOutOfScreen_;
609     targetSurfaceParams->isRotating_ = isRotating_;
610     targetSurfaceParams->specialLayerManager_ = specialLayerManager_;
611     targetSurfaceParams->blackListIds_ = blackListIds_;
612     targetSurfaceParams->privacyContentLayerIds_ = privacyContentLayerIds_;
613     targetSurfaceParams->name_ = name_;
614     targetSurfaceParams->bundleName_ = bundleName_;
615     targetSurfaceParams->surfaceCacheContentStatic_ = surfaceCacheContentStatic_;
616     targetSurfaceParams->positionZ_ = positionZ_;
617     targetSurfaceParams->isSubTreeDirty_ = isSubTreeDirty_;
618     targetSurfaceParams->overDrawBufferNodeCornerRadius_ = overDrawBufferNodeCornerRadius_;
619     targetSurfaceParams->isGpuOverDrawBufferOptimizeNode_ = isGpuOverDrawBufferOptimizeNode_;
620     targetSurfaceParams->isSubSurfaceNode_ = isSubSurfaceNode_;
621     targetSurfaceParams->isGlobalPositionEnabled_ = isGlobalPositionEnabled_;
622     targetSurfaceParams->isNodeToBeCaptured_ = isNodeToBeCaptured_;
623     targetSurfaceParams->isHwcGlobalPositionEnabled_ = isHwcGlobalPositionEnabled_;
624     targetSurfaceParams->isHwcCrossNode_ = isHwcCrossNode_;
625     targetSurfaceParams->dstRect_ = dstRect_;
626     targetSurfaceParams->ancoSrcCrop_ = ancoSrcCrop_;
627     targetSurfaceParams->ancoFlags_ = ancoFlags_;
628     targetSurfaceParams->isSkipDraw_ = isSkipDraw_;
629     targetSurfaceParams->isLayerTop_ = isLayerTop_;
630     targetSurfaceParams->isForceRefresh_ = isForceRefresh_;
631     targetSurfaceParams->needHidePrivacyContent_ = needHidePrivacyContent_;
632     targetSurfaceParams->opaqueRegion_ = opaqueRegion_;
633     targetSurfaceParams->roundedCornerRegion_ = roundedCornerRegion_;
634     targetSurfaceParams->needOffscreen_ = needOffscreen_;
635     targetSurfaceParams->layerSource_ = layerSource_;
636     targetSurfaceParams->tunnelLayerId_ = tunnelLayerId_;
637     targetSurfaceParams->hasHdrPresent_ = hasHdrPresent_;
638     targetSurfaceParams->totalMatrix_ = totalMatrix_;
639     targetSurfaceParams->visibleFilterChild_ = visibleFilterChild_;
640     targetSurfaceParams->isTransparent_ = isTransparent_;
641     targetSurfaceParams->globalAlpha_ = globalAlpha_;
642     targetSurfaceParams->IsUnobscuredUIExtension_ = IsUnobscuredUIExtension_;
643     targetSurfaceParams->hasFingerprint_ = hasFingerprint_;
644     targetSurfaceParams->watermarkHandles_ = watermarkHandles_;
645     targetSurfaceParams->sdrNit_ = sdrNit_;
646     targetSurfaceParams->displayNit_ = displayNit_;
647     targetSurfaceParams->brightnessRatio_ = brightnessRatio_;
648     targetSurfaceParams->layerLinearMatrix_ = layerLinearMatrix_;
649     targetSurfaceParams->hasMetadata_ = hasMetadata_;
650     targetSurfaceParams->watermarkHandles_ = watermarkHandles_;
651     targetSurfaceParams->needCacheSurface_ = needCacheSurface_;
652     targetSurfaceParams->isHwcEnabledBySolidLayer_ = isHwcEnabledBySolidLayer_;
653     targetSurfaceParams->solidLayerColor_ = solidLayerColor_;
654     targetSurfaceParams->hasSubSurfaceNodes_ = hasSubSurfaceNodes_;
655     targetSurfaceParams->allSubSurfaceNodeIds_ = allSubSurfaceNodeIds_;
656     targetSurfaceParams->crossNodeSkipDisplayConversionMatrices_ = crossNodeSkipDisplayConversionMatrices_;
657     targetSurfaceParams->apiCompatibleVersion_ = apiCompatibleVersion_;
658     targetSurfaceParams->isOcclusionCullingOn_ = isOcclusionCullingOn_;
659     targetSurfaceParams->culledNodes_ = std::move(culledNodes_);
660     targetSurfaceParams->culledEntireSubtree_ = std::move(culledEntireSubtree_);
661     targetSurfaceParams->isBufferFlushed_ = isBufferFlushed_;
662     targetSurfaceParams->colorFollow_ = colorFollow_;
663     targetSurfaceParams->screenRect_ = screenRect_;
664     targetSurfaceParams->dirtyRegionMatrix_ = dirtyRegionMatrix_;
665     targetSurfaceParams->uiFirstFrameGravity_ = uiFirstFrameGravity_;
666     targetSurfaceParams->regionToBeMagnified_ = regionToBeMagnified_;
667     targetSurfaceParams->isFrameGravityNewVersionEnabled_ = isFrameGravityNewVersionEnabled_;
668     RSRenderParams::OnSync(target);
669 }
670 
ToString() const671 std::string RSSurfaceRenderParams::ToString() const
672 {
673     std::string ret = RSRenderParams::ToString() + ", RSSurfaceRenderParams: {";
674     ret += RENDER_BASIC_PARAM_TO_STRING(int(rsSurfaceNodeType_));
675     ret += RENDER_BASIC_PARAM_TO_STRING(int(selfDrawingType_));
676     ret += RENDER_BASIC_PARAM_TO_STRING(alpha_);
677     ret += RENDER_BASIC_PARAM_TO_STRING(isSpherizeValid_);
678     ret += RENDER_BASIC_PARAM_TO_STRING(isAttractionValid_);
679     ret += RENDER_BASIC_PARAM_TO_STRING(needBilinearInterpolation_);
680     ret += RENDER_BASIC_PARAM_TO_STRING(backgroundColor_.GetAlpha());
681     ret += RENDER_BASIC_PARAM_TO_STRING(occlusionVisible_);
682     ret += RENDER_BASIC_PARAM_TO_STRING(isOccludedByFilterCache_);
683     ret += "}";
684     return ret;
685 }
686 
IsVisibleDirtyRegionEmpty(const Drawing::Region curSurfaceDrawRegion) const687 bool RSSurfaceRenderParams::IsVisibleDirtyRegionEmpty(const Drawing::Region curSurfaceDrawRegion) const
688 {
689     if (IsMainWindowType()) {
690         return curSurfaceDrawRegion.IsEmpty();
691     }
692     if (IsLeashWindow() && (!IsCrossNode() ||
693         GetCrossNodeOffScreenStatus() == CrossNodeOffScreenRenderDebugType::DISABLED)) {
694         return curSurfaceDrawRegion.IsEmpty();
695     }
696     return false;
697 }
698 
SetOpaqueRegion(const Occlusion::Region & opaqueRegion)699 void RSSurfaceRenderParams::SetOpaqueRegion(const Occlusion::Region& opaqueRegion)
700 {
701     opaqueRegion_ = opaqueRegion;
702 }
703 
GetOpaqueRegion() const704 const Occlusion::Region& RSSurfaceRenderParams::GetOpaqueRegion() const
705 {
706     return opaqueRegion_;
707 }
708 
SetNeedCacheSurface(bool needCacheSurface)709 void RSSurfaceRenderParams::SetNeedCacheSurface(bool needCacheSurface)
710 {
711     if (needCacheSurface_ == needCacheSurface) {
712         return;
713     }
714     needCacheSurface_ = needCacheSurface;
715     needSync_ = true;
716 }
717 
GetNeedCacheSurface() const718 bool RSSurfaceRenderParams::GetNeedCacheSurface() const
719 {
720     return needCacheSurface_;
721 }
722 
SetFrameGravityNewVersionEnabled(bool isEnabled)723 void RSSurfaceRenderParams::SetFrameGravityNewVersionEnabled(bool isEnabled)
724 {
725     isFrameGravityNewVersionEnabled_ = isEnabled;
726 }
727 
GetFrameGravityNewVersionEnabled() const728 bool RSSurfaceRenderParams::GetFrameGravityNewVersionEnabled() const
729 {
730     return isFrameGravityNewVersionEnabled_;
731 }
732 
733 } // namespace OHOS::Rosen
734