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 "rs_trace.h"
18
19 namespace OHOS::Rosen {
RSSurfaceRenderParams(NodeId id)20 RSSurfaceRenderParams::RSSurfaceRenderParams(NodeId id) : RSRenderParams(id) {}
21
SetOcclusionVisible(bool visible)22 void RSSurfaceRenderParams::SetOcclusionVisible(bool visible)
23 {
24 if (occlusionVisible_ == visible) {
25 return;
26 }
27 occlusionVisible_ = visible;
28 needSync_ = true;
29 }
30
GetOcclusionVisible() const31 bool RSSurfaceRenderParams::GetOcclusionVisible() const
32 {
33 return occlusionVisible_;
34 }
35
SetOldDirtyInSurface(const RectI & oldDirtyInSurface)36 void RSSurfaceRenderParams::SetOldDirtyInSurface(const RectI& oldDirtyInSurface)
37 {
38 oldDirtyInSurface_ = oldDirtyInSurface;
39 }
40
GetOldDirtyInSurface() const41 RectI RSSurfaceRenderParams::GetOldDirtyInSurface() const
42 {
43 return oldDirtyInSurface_;
44 }
45
SetIsParentScaling(bool isParentScaling)46 void RSSurfaceRenderParams::SetIsParentScaling(bool isParentScaling)
47 {
48 isParentScaling_ = isParentScaling;
49 }
50
IsParentScaling() const51 bool RSSurfaceRenderParams::IsParentScaling() const
52 {
53 return isParentScaling_;
54 }
55
SetTransparentRegion(const Occlusion::Region & transparentRegion)56 void RSSurfaceRenderParams::SetTransparentRegion(const Occlusion::Region& transparentRegion)
57 {
58 transparentRegion_ = transparentRegion;
59 }
60
GetTransparentRegion() const61 const Occlusion::Region& RSSurfaceRenderParams::GetTransparentRegion() const
62 {
63 return transparentRegion_;
64 }
65
GetVisibleRegion() const66 Occlusion::Region RSSurfaceRenderParams::GetVisibleRegion() const
67 {
68 return visibleRegion_;
69 }
70
SetVisibleRegion(const Occlusion::Region & visibleRegion)71 void RSSurfaceRenderParams::SetVisibleRegion(const Occlusion::Region& visibleRegion)
72 {
73 visibleRegion_ = visibleRegion;
74 needSync_ = true;
75 }
76
GetVisibleRegionInVirtual() const77 Occlusion::Region RSSurfaceRenderParams::GetVisibleRegionInVirtual() const
78 {
79 return visibleRegionInVirtual_;
80 }
81
SetVisibleRegionInVirtual(const Occlusion::Region & visibleRegion)82 void RSSurfaceRenderParams::SetVisibleRegionInVirtual(const Occlusion::Region& visibleRegion)
83 {
84 visibleRegionInVirtual_ = visibleRegion;
85 needSync_ = true;
86 }
87
SetOccludedByFilterCache(bool val)88 void RSSurfaceRenderParams::SetOccludedByFilterCache(bool val)
89 {
90 if (isOccludedByFilterCache_ == val) {
91 return;
92 }
93 isOccludedByFilterCache_ = val;
94 needSync_ = true;
95 }
96
GetOccludedByFilterCache() const97 bool RSSurfaceRenderParams::GetOccludedByFilterCache() const
98 {
99 return isOccludedByFilterCache_;
100 }
101
SetFilterCacheFullyCovered(bool val)102 void RSSurfaceRenderParams::SetFilterCacheFullyCovered(bool val)
103 {
104 isFilterCacheFullyCovered_ = val;
105 }
106
GetFilterCacheFullyCovered() const107 bool RSSurfaceRenderParams::GetFilterCacheFullyCovered() const
108 {
109 return isFilterCacheFullyCovered_;
110 }
111
GetVisibleFilterChild() const112 const std::vector<NodeId>& RSSurfaceRenderParams::GetVisibleFilterChild() const
113 {
114 return visibleFilterChild_;
115 }
116
IsTransparent() const117 bool RSSurfaceRenderParams::IsTransparent() const
118 {
119 return isTransparent_;
120 }
121
CheckValidFilterCacheFullyCoverTarget(bool isFilterCacheValidForOcclusion,const RectI & filterCachedRect,const RectI & targetRect)122 void RSSurfaceRenderParams::CheckValidFilterCacheFullyCoverTarget(
123 bool isFilterCacheValidForOcclusion, const RectI& filterCachedRect, const RectI& targetRect)
124 {
125 if (isFilterCacheFullyCovered_ || !isFilterCacheValidForOcclusion) {
126 return;
127 }
128 // AbsRect may not update here, so use filterCachedRegion to occlude
129 isFilterCacheFullyCovered_ = targetRect.IsInsideOf(filterCachedRect);
130 }
131
SetLayerInfo(const RSLayerInfo & layerInfo)132 void RSSurfaceRenderParams::SetLayerInfo(const RSLayerInfo& layerInfo)
133 {
134 #ifndef ROSEN_CROSS_PLATFORM
135 layerInfo_ = layerInfo;
136 needSync_ = true;
137 dirtyType_.set(RSRenderParamsDirtyType::LAYER_INFO_DIRTY);
138 #endif
139 }
140
GetLayerInfo() const141 const RSLayerInfo& RSSurfaceRenderParams::GetLayerInfo() const
142 {
143 return layerInfo_;
144 }
145
SetHidePrivacyContent(bool needHidePrivacyContent)146 void RSSurfaceRenderParams::SetHidePrivacyContent(bool needHidePrivacyContent)
147 {
148 needHidePrivacyContent_ = needHidePrivacyContent;
149 }
150
GetHidePrivacyContent() const151 bool RSSurfaceRenderParams::GetHidePrivacyContent() const
152 {
153 return needHidePrivacyContent_;
154 }
155
SetHardwareEnabled(bool enabled)156 void RSSurfaceRenderParams::SetHardwareEnabled(bool enabled)
157 {
158 if (isHardwareEnabled_ == enabled) {
159 return;
160 }
161 isHardwareEnabled_ = enabled;
162 needSync_ = true;
163 }
164
GetHardwareEnabled() const165 bool RSSurfaceRenderParams::GetHardwareEnabled() const
166 {
167 return isHardwareEnabled_;
168 }
169
SetNeedMakeImage(bool enabled)170 void RSSurfaceRenderParams::SetNeedMakeImage(bool enabled)
171 {
172 if (needMakeImage_ == enabled) {
173 return;
174 }
175 needMakeImage_ = enabled;
176 needSync_ = true;
177 }
178
GetNeedMakeImage() const179 bool RSSurfaceRenderParams::GetNeedMakeImage() const
180 {
181 return needMakeImage_;
182 }
183
SetHardCursorStatus(bool status)184 void RSSurfaceRenderParams::SetHardCursorStatus(bool status)
185 {
186 if (isHardCursor_ == status) {
187 return;
188 }
189 isHardCursor_ = status;
190 needSync_ = true;
191 }
192
GetHardCursorStatus() const193 bool RSSurfaceRenderParams::GetHardCursorStatus() const
194 {
195 return isHardCursor_;
196 }
197
SetPreSubHighPriorityType(bool enabledType)198 void RSSurfaceRenderParams::SetPreSubHighPriorityType(bool enabledType)
199 {
200 if (subHighPriorityType_ == enabledType) {
201 return;
202 }
203 subHighPriorityType_ = enabledType;
204 needSync_ = true;
205 }
206
GetPreSubHighPriorityType() const207 bool RSSurfaceRenderParams::GetPreSubHighPriorityType() const
208 {
209 return subHighPriorityType_;
210 }
211
SetLastFrameHardwareEnabled(bool enabled)212 void RSSurfaceRenderParams::SetLastFrameHardwareEnabled(bool enabled)
213 {
214 if (isLastFrameHardwareEnabled_ == enabled) {
215 return;
216 }
217 isLastFrameHardwareEnabled_ = enabled;
218 needSync_ = true;
219 }
SetLayerSourceTuning(int32_t needSourceTuning)220 void RSSurfaceRenderParams::SetLayerSourceTuning(int32_t needSourceTuning)
221 {
222 if (layerSource_ == needSourceTuning) {
223 return;
224 }
225 layerSource_ = needSourceTuning;
226 needSync_ = true;
227 }
228
GetLayerSourceTuning() const229 int32_t RSSurfaceRenderParams::GetLayerSourceTuning() const
230 {
231 return layerSource_;
232 }
233
GetLastFrameHardwareEnabled() const234 bool RSSurfaceRenderParams::GetLastFrameHardwareEnabled() const
235 {
236 return isLastFrameHardwareEnabled_;
237 }
238
SetFixRotationByUser(bool flag)239 void RSSurfaceRenderParams::SetFixRotationByUser(bool flag)
240 {
241 if (isFixRotationByUser_ == flag) {
242 return;
243 }
244 isFixRotationByUser_ = flag;
245 needSync_ = true;
246 }
247
GetFixRotationByUser() const248 bool RSSurfaceRenderParams::GetFixRotationByUser() const
249 {
250 return isFixRotationByUser_;
251 }
252
SetInFixedRotation(bool flag)253 void RSSurfaceRenderParams::SetInFixedRotation(bool flag)
254 {
255 if (isInFixedRotation_ == flag) {
256 return;
257 }
258 isInFixedRotation_ = flag;
259 needSync_ = true;
260 }
261
IsInFixedRotation() const262 bool RSSurfaceRenderParams::IsInFixedRotation() const
263 {
264 return isInFixedRotation_;
265 }
266
267 #ifndef ROSEN_CROSS_PLATFORM
SetBuffer(const sptr<SurfaceBuffer> & buffer,const Rect & damageRect)268 void RSSurfaceRenderParams::SetBuffer(const sptr<SurfaceBuffer>& buffer, const Rect& damageRect)
269 {
270 buffer_ = buffer;
271 damageRect_ = damageRect;
272 needSync_ = true;
273 if (GetParamsType() == RSRenderParamsType::RS_PARAM_OWNED_BY_DRAWABLE) {
274 return;
275 }
276 dirtyType_.set(RSRenderParamsDirtyType::BUFFER_INFO_DIRTY);
277 }
278
GetBuffer() const279 sptr<SurfaceBuffer> RSSurfaceRenderParams::GetBuffer() const
280 {
281 return buffer_;
282 }
283
GetBufferDamage() const284 const Rect& RSSurfaceRenderParams::GetBufferDamage() const
285 {
286 return damageRect_;
287 }
288
SetPreBuffer(const sptr<SurfaceBuffer> & preBuffer)289 void RSSurfaceRenderParams::SetPreBuffer(const sptr<SurfaceBuffer>& preBuffer)
290 {
291 preBuffer_ = preBuffer;
292 needSync_ = true;
293 if (GetParamsType() == RSRenderParamsType::RS_PARAM_OWNED_BY_DRAWABLE) {
294 return;
295 }
296 dirtyType_.set(RSRenderParamsDirtyType::BUFFER_INFO_DIRTY);
297 }
298
GetPreBuffer()299 sptr<SurfaceBuffer> RSSurfaceRenderParams::GetPreBuffer()
300 {
301 return preBuffer_;
302 }
303
SetAcquireFence(const sptr<SyncFence> & acquireFence)304 void RSSurfaceRenderParams::SetAcquireFence(const sptr<SyncFence>& acquireFence)
305 {
306 acquireFence_ = acquireFence;
307 needSync_ = true;
308 dirtyType_.set(RSRenderParamsDirtyType::BUFFER_INFO_DIRTY);
309 }
310
GetAcquireFence() const311 sptr<SyncFence> RSSurfaceRenderParams::GetAcquireFence() const
312 {
313 return acquireFence_;
314 }
315 #endif
316
GetPreSurfaceCacheContentStatic() const317 bool RSSurfaceRenderParams::GetPreSurfaceCacheContentStatic() const
318 {
319 return preSurfaceCacheContentStatic_;
320 }
321
SetSurfaceCacheContentStatic(bool contentStatic,bool lastFrameSynced)322 void RSSurfaceRenderParams::SetSurfaceCacheContentStatic(bool contentStatic, bool lastFrameSynced)
323 {
324 // 1. don't sync while contentStatic not change
325 if (surfaceCacheContentStatic_ == contentStatic) {
326 return;
327 }
328 // 2. don't sync while last frame isn't static and skip sync
329 if (!surfaceCacheContentStatic_ && !lastFrameSynced) {
330 return;
331 }
332 preSurfaceCacheContentStatic_ = surfaceCacheContentStatic_;
333 surfaceCacheContentStatic_ = contentStatic;
334 needSync_ = true;
335 }
336
GetSurfaceCacheContentStatic() const337 bool RSSurfaceRenderParams::GetSurfaceCacheContentStatic() const
338 {
339 return surfaceCacheContentStatic_;
340 }
341
GetPositionZ() const342 float RSSurfaceRenderParams::GetPositionZ() const
343 {
344 return positionZ_;
345 }
346
SetSurfaceSubTreeDirty(bool isSubTreeDirty)347 void RSSurfaceRenderParams::SetSurfaceSubTreeDirty(bool isSubTreeDirty)
348 {
349 if (isSubTreeDirty_ == isSubTreeDirty) {
350 return;
351 }
352 isSubTreeDirty_ = isSubTreeDirty;
353 needSync_ = true;
354 }
355
GetSurfaceSubTreeDirty() const356 bool RSSurfaceRenderParams::GetSurfaceSubTreeDirty() const
357 {
358 return isSubTreeDirty_;
359 }
360
SetGpuOverDrawBufferOptimizeNode(bool overDrawNode)361 void RSSurfaceRenderParams::SetGpuOverDrawBufferOptimizeNode(bool overDrawNode)
362 {
363 if (isGpuOverDrawBufferOptimizeNode_ == overDrawNode) {
364 return;
365 }
366 isGpuOverDrawBufferOptimizeNode_ = overDrawNode;
367 needSync_ = true;
368 }
369
IsGpuOverDrawBufferOptimizeNode() const370 bool RSSurfaceRenderParams::IsGpuOverDrawBufferOptimizeNode() const
371 {
372 return isGpuOverDrawBufferOptimizeNode_;
373 }
374
SetOverDrawBufferNodeCornerRadius(const Vector4f & radius)375 void RSSurfaceRenderParams::SetOverDrawBufferNodeCornerRadius(const Vector4f& radius)
376 {
377 if (overDrawBufferNodeCornerRadius_ == radius) {
378 return;
379 }
380 overDrawBufferNodeCornerRadius_ = radius;
381 needSync_ = true;
382 }
383
GetOverDrawBufferNodeCornerRadius() const384 const Vector4f& RSSurfaceRenderParams::GetOverDrawBufferNodeCornerRadius() const
385 {
386 return overDrawBufferNodeCornerRadius_;
387 }
388
SetIsSubSurfaceNode(bool isSubSurfaceNode)389 void RSSurfaceRenderParams::SetIsSubSurfaceNode(bool isSubSurfaceNode)
390 {
391 isSubSurfaceNode_ = isSubSurfaceNode;
392 }
393
IsSubSurfaceNode() const394 bool RSSurfaceRenderParams::IsSubSurfaceNode() const
395 {
396 return isSubSurfaceNode_;
397 }
398
SetGlobalPositionEnabled(bool isEnabled)399 void RSSurfaceRenderParams::SetGlobalPositionEnabled(bool isEnabled)
400 {
401 isGlobalPositionEnabled_ = isEnabled;
402 }
403
GetGlobalPositionEnabled() const404 bool RSSurfaceRenderParams::GetGlobalPositionEnabled() const
405 {
406 return isGlobalPositionEnabled_;
407 }
408
SetIsNodeToBeCaptured(bool isNodeToBeCaptured)409 void RSSurfaceRenderParams::SetIsNodeToBeCaptured(bool isNodeToBeCaptured)
410 {
411 isNodeToBeCaptured_ = isNodeToBeCaptured;
412 }
413
IsNodeToBeCaptured() const414 bool RSSurfaceRenderParams::IsNodeToBeCaptured() const
415 {
416 return isNodeToBeCaptured_;
417 }
418
SetSkipDraw(bool skip)419 void RSSurfaceRenderParams::SetSkipDraw(bool skip)
420 {
421 isSkipDraw_ = skip;
422 }
423
GetClonedNodeRenderDrawable()424 DrawableV2::RSRenderNodeDrawableAdapter::WeakPtr RSSurfaceRenderParams::GetClonedNodeRenderDrawable()
425 {
426 return clonedNodeRenderDrawable_;
427 }
428
IsCloneNode() const429 bool RSSurfaceRenderParams::IsCloneNode() const
430 {
431 return isCloneNode_;
432 }
433
GetSkipDraw() const434 bool RSSurfaceRenderParams::GetSkipDraw() const
435 {
436 return isSkipDraw_;
437 }
438
SetLayerTop(bool isTop)439 void RSSurfaceRenderParams::SetLayerTop(bool isTop)
440 {
441 if (isLayerTop_ == isTop) {
442 return;
443 }
444 isLayerTop_ = isTop;
445 needSync_ = true;
446 }
447
IsLayerTop() const448 bool RSSurfaceRenderParams::IsLayerTop() const
449 {
450 return isLayerTop_;
451 }
452
SetWatermarkEnabled(const std::string & name,bool isEnabled)453 void RSSurfaceRenderParams::SetWatermarkEnabled(const std::string& name, bool isEnabled)
454 {
455 watermarkHandles_[name] = isEnabled;
456 needSync_ = true;
457 }
458
GetWatermarksEnabled() const459 const std::unordered_map<std::string, bool>& RSSurfaceRenderParams::GetWatermarksEnabled() const
460 {
461 return watermarkHandles_;
462 }
463
IsWatermarkEmpty() const464 bool RSSurfaceRenderParams::IsWatermarkEmpty() const
465 {
466 return watermarkHandles_.empty();
467 }
468
OnSync(const std::unique_ptr<RSRenderParams> & target)469 void RSSurfaceRenderParams::OnSync(const std::unique_ptr<RSRenderParams>& target)
470 {
471 auto targetSurfaceParams = static_cast<RSSurfaceRenderParams*>(target.get());
472 if (targetSurfaceParams == nullptr) {
473 RS_LOGE("RSSurfaceRenderParams::OnSync targetSurfaceParams is nullptr");
474 return;
475 }
476
477 if (dirtyType_.test(RSRenderParamsDirtyType::LAYER_INFO_DIRTY)) {
478 targetSurfaceParams->layerInfo_ = layerInfo_;
479 dirtyType_.reset(RSRenderParamsDirtyType::LAYER_INFO_DIRTY);
480 }
481
482 #ifndef ROSEN_CROSS_PLATFORM
483 if (dirtyType_.test(RSRenderParamsDirtyType::BUFFER_INFO_DIRTY)) {
484 targetSurfaceParams->buffer_ = buffer_;
485 targetSurfaceParams->preBuffer_ = preBuffer_;
486 targetSurfaceParams->acquireFence_ = acquireFence_;
487 targetSurfaceParams->damageRect_ = damageRect_;
488 if (UNLIKELY(isSurfaceCapturePipeline_)) {
489 bufferSynced_ = false;
490 isSurfaceCapturePipeline_ = false;
491 } else {
492 bufferSynced_ = true;
493 }
494 dirtyType_.reset(RSRenderParamsDirtyType::BUFFER_INFO_DIRTY);
495 }
496 #endif
497
498 targetSurfaceParams->isMainWindowType_ = isMainWindowType_;
499 targetSurfaceParams->isLeashWindow_ = isLeashWindow_;
500 targetSurfaceParams->isAppWindow_ = isAppWindow_;
501 targetSurfaceParams->rsSurfaceNodeType_ = rsSurfaceNodeType_;
502 targetSurfaceParams->selfDrawingType_ = selfDrawingType_;
503 targetSurfaceParams->ancestorDisplayNode_ = ancestorDisplayNode_;
504 targetSurfaceParams->ancestorDisplayDrawable_ = ancestorDisplayDrawable_;
505 targetSurfaceParams->sourceDisplayRenderNodeDrawable_ = sourceDisplayRenderNodeDrawable_;
506 targetSurfaceParams->clonedNodeRenderDrawable_ = clonedNodeRenderDrawable_;
507 targetSurfaceParams->isClonedNodeOnTheTree_ = isClonedNodeOnTheTree_;
508 targetSurfaceParams->isCloneNode_ = isCloneNode_;
509 targetSurfaceParams->clonedSourceNode_ = clonedSourceNode_;
510 targetSurfaceParams->alpha_ = alpha_;
511 targetSurfaceParams->isSpherizeValid_ = isSpherizeValid_;
512 targetSurfaceParams->isAttractionValid_ = isAttractionValid_;
513 targetSurfaceParams->isParentScaling_ = isParentScaling_;
514 targetSurfaceParams->isCrossNode_ = isCrossNode_;
515 targetSurfaceParams->needBilinearInterpolation_ = needBilinearInterpolation_;
516 targetSurfaceParams->backgroundColor_ = backgroundColor_;
517 targetSurfaceParams->absDrawRect_ = absDrawRect_;
518 targetSurfaceParams->rrect_ = rrect_;
519 targetSurfaceParams->occlusionVisible_ = occlusionVisible_;
520 targetSurfaceParams->visibleRegion_ = visibleRegion_;
521 targetSurfaceParams->visibleRegionInVirtual_ = visibleRegionInVirtual_;
522 targetSurfaceParams->oldDirtyInSurface_ = oldDirtyInSurface_;
523 targetSurfaceParams->transparentRegion_ = transparentRegion_;
524 targetSurfaceParams->isHardwareEnabled_ = isHardwareEnabled_;
525 targetSurfaceParams->needMakeImage_ = needMakeImage_;
526 targetSurfaceParams->isHardCursor_ = isHardCursor_;
527 targetSurfaceParams->isLastFrameHardwareEnabled_ = isLastFrameHardwareEnabled_;
528 targetSurfaceParams->stencilVal_ = stencilVal_;
529 targetSurfaceParams->subHighPriorityType_ = subHighPriorityType_;
530 targetSurfaceParams->isFixRotationByUser_ = isFixRotationByUser_;
531 targetSurfaceParams->isInFixedRotation_ = isInFixedRotation_;
532 targetSurfaceParams->uiFirstFlag_ = uiFirstFlag_;
533 targetSurfaceParams->uiFirstParentFlag_ = uiFirstParentFlag_;
534 targetSurfaceParams->uifirstUseStarting_ = uifirstUseStarting_;
535 targetSurfaceParams->childrenDirtyRect_ = childrenDirtyRect_;
536 targetSurfaceParams->isOccludedByFilterCache_ = isOccludedByFilterCache_;
537 targetSurfaceParams->leashPersistentId_ = leashPersistentId_;
538 targetSurfaceParams->drmCornerRadiusInfo_ = drmCornerRadiusInfo_;
539 targetSurfaceParams->isForceDisableClipHoleForDRM_ = isForceDisableClipHoleForDRM_;
540 targetSurfaceParams->animateState_ = animateState_;
541 targetSurfaceParams->isOutOfScreen_ = isOutOfScreen_;
542 targetSurfaceParams->isRotating_ = isRotating_;
543 targetSurfaceParams->specialLayerManager_ = specialLayerManager_;
544 targetSurfaceParams->privacyContentLayerIds_ = privacyContentLayerIds_;
545 targetSurfaceParams->name_ = name_;
546 targetSurfaceParams->surfaceCacheContentStatic_ = surfaceCacheContentStatic_;
547 targetSurfaceParams->positionZ_ = positionZ_;
548 targetSurfaceParams->isSubTreeDirty_ = isSubTreeDirty_;
549 targetSurfaceParams->overDrawBufferNodeCornerRadius_ = overDrawBufferNodeCornerRadius_;
550 targetSurfaceParams->isGpuOverDrawBufferOptimizeNode_ = isGpuOverDrawBufferOptimizeNode_;
551 targetSurfaceParams->isSubSurfaceNode_ = isSubSurfaceNode_;
552 targetSurfaceParams->isGlobalPositionEnabled_ = isGlobalPositionEnabled_;
553 targetSurfaceParams->isNodeToBeCaptured_ = isNodeToBeCaptured_;
554 targetSurfaceParams->dstRect_ = dstRect_;
555 targetSurfaceParams->isSkipDraw_ = isSkipDraw_;
556 targetSurfaceParams->isLayerTop_ = isLayerTop_;
557 targetSurfaceParams->needHidePrivacyContent_ = needHidePrivacyContent_;
558 targetSurfaceParams->isLeashWindowVisibleRegionEmpty_ = isLeashWindowVisibleRegionEmpty_;
559 targetSurfaceParams->opaqueRegion_ = opaqueRegion_;
560 targetSurfaceParams->roundedCornerRegion_ = roundedCornerRegion_;
561 targetSurfaceParams->needOffscreen_ = needOffscreen_;
562 targetSurfaceParams->layerSource_ = layerSource_;
563 targetSurfaceParams->hasHdrPresent_ = hasHdrPresent_;
564 targetSurfaceParams->totalMatrix_ = totalMatrix_;
565 targetSurfaceParams->visibleFilterChild_ = visibleFilterChild_;
566 targetSurfaceParams->isTransparent_ = isTransparent_;
567 targetSurfaceParams->globalAlpha_ = globalAlpha_;
568 targetSurfaceParams->IsUnobscuredUIExtension_ = IsUnobscuredUIExtension_;
569 targetSurfaceParams->hasFingerprint_ = hasFingerprint_;
570 targetSurfaceParams->watermarkHandles_ = watermarkHandles_;
571 targetSurfaceParams->sdrNit_ = sdrNit_;
572 targetSurfaceParams->displayNit_ = displayNit_;
573 targetSurfaceParams->brightnessRatio_ = brightnessRatio_;
574 targetSurfaceParams->layerLinearMatrix_ = layerLinearMatrix_;
575 targetSurfaceParams->hasMetadata_ = hasMetadata_;
576 targetSurfaceParams->watermarkHandles_ = watermarkHandles_;
577 targetSurfaceParams->needCacheSurface_ = needCacheSurface_;
578 targetSurfaceParams->isHwcEnabledBySolidLayer_ = isHwcEnabledBySolidLayer_;
579 targetSurfaceParams->hasSubSurfaceNodes_ = hasSubSurfaceNodes_;
580 targetSurfaceParams->allSubSurfaceNodeIds_ = std::move(allSubSurfaceNodeIds_);
581 targetSurfaceParams->crossNodeSkipDisplayConversionMatrices_ = crossNodeSkipDisplayConversionMatrices_;
582 targetSurfaceParams->apiCompatibleVersion_ = apiCompatibleVersion_;
583 targetSurfaceParams->isBufferFlushed_ = isBufferFlushed_;
584 RSRenderParams::OnSync(target);
585 }
586
ToString() const587 std::string RSSurfaceRenderParams::ToString() const
588 {
589 std::string ret = RSRenderParams::ToString() + ", RSSurfaceRenderParams: {";
590 ret += RENDER_BASIC_PARAM_TO_STRING(int(rsSurfaceNodeType_));
591 ret += RENDER_BASIC_PARAM_TO_STRING(int(selfDrawingType_));
592 ret += RENDER_BASIC_PARAM_TO_STRING(alpha_);
593 ret += RENDER_BASIC_PARAM_TO_STRING(isSpherizeValid_);
594 ret += RENDER_BASIC_PARAM_TO_STRING(isAttractionValid_);
595 ret += RENDER_BASIC_PARAM_TO_STRING(needBilinearInterpolation_);
596 ret += RENDER_BASIC_PARAM_TO_STRING(backgroundColor_.GetAlpha());
597 ret += RENDER_RECT_PARAM_TO_STRING(absDrawRect_);
598 ret += RENDER_BASIC_PARAM_TO_STRING(occlusionVisible_);
599 ret += RENDER_BASIC_PARAM_TO_STRING(isOccludedByFilterCache_);
600 ret += "}";
601 return ret;
602 }
603
IsVisibleDirtyRegionEmpty(const Drawing::Region curSurfaceDrawRegion) const604 bool RSSurfaceRenderParams::IsVisibleDirtyRegionEmpty(const Drawing::Region curSurfaceDrawRegion) const
605 {
606 if (IsMainWindowType()) {
607 return curSurfaceDrawRegion.IsEmpty();
608 }
609 if (IsLeashWindow() && (!IsCrossNode() ||
610 GetCrossNodeOffScreenStatus() == CrossNodeOffScreenRenderDebugType::DISABLED)) {
611 return GetLeashWindowVisibleRegionEmptyParam();
612 }
613 return false;
614 }
615
SetOpaqueRegion(const Occlusion::Region & opaqueRegion)616 void RSSurfaceRenderParams::SetOpaqueRegion(const Occlusion::Region& opaqueRegion)
617 {
618 opaqueRegion_ = opaqueRegion;
619 }
620
GetOpaqueRegion() const621 const Occlusion::Region& RSSurfaceRenderParams::GetOpaqueRegion() const
622 {
623 return opaqueRegion_;
624 }
625
SetNeedCacheSurface(bool needCacheSurface)626 void RSSurfaceRenderParams::SetNeedCacheSurface(bool needCacheSurface)
627 {
628 if (needCacheSurface_ == needCacheSurface) {
629 return;
630 }
631 needCacheSurface_ = needCacheSurface;
632 needSync_ = true;
633 }
634
GetNeedCacheSurface() const635 bool RSSurfaceRenderParams::GetNeedCacheSurface() const
636 {
637 return needCacheSurface_;
638 }
639
640 } // namespace OHOS::Rosen
641