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
SetLastFrameHardwareEnabled(bool enabled)184 void RSSurfaceRenderParams::SetLastFrameHardwareEnabled(bool enabled)
185 {
186 if (isLastFrameHardwareEnabled_ == enabled) {
187 return;
188 }
189 isLastFrameHardwareEnabled_ = enabled;
190 needSync_ = true;
191 }
192
SetLayerSourceTuning(int32_t needSourceTuning)193 void RSSurfaceRenderParams::SetLayerSourceTuning(int32_t needSourceTuning)
194 {
195 if (layerSource_ == needSourceTuning) {
196 return;
197 }
198 layerSource_ = needSourceTuning;
199 needSync_ = true;
200 }
201
GetLayerSourceTuning() const202 int32_t RSSurfaceRenderParams::GetLayerSourceTuning() const
203 {
204 return layerSource_;
205 }
206
GetLastFrameHardwareEnabled() const207 bool RSSurfaceRenderParams::GetLastFrameHardwareEnabled() const
208 {
209 return isLastFrameHardwareEnabled_;
210 }
211
SetFixRotationByUser(bool flag)212 void RSSurfaceRenderParams::SetFixRotationByUser(bool flag)
213 {
214 if (isFixRotationByUser_ == flag) {
215 return;
216 }
217 isFixRotationByUser_ = flag;
218 needSync_ = true;
219 }
220
GetFixRotationByUser() const221 bool RSSurfaceRenderParams::GetFixRotationByUser() const
222 {
223 return isFixRotationByUser_;
224 }
225
SetInFixedRotation(bool flag)226 void RSSurfaceRenderParams::SetInFixedRotation(bool flag)
227 {
228 if (isInFixedRotation_ == flag) {
229 return;
230 }
231 isInFixedRotation_ = flag;
232 needSync_ = true;
233 }
234
IsInFixedRotation() const235 bool RSSurfaceRenderParams::IsInFixedRotation() const
236 {
237 return isInFixedRotation_;
238 }
239
240 #ifndef ROSEN_CROSS_PLATFORM
SetBuffer(const sptr<SurfaceBuffer> & buffer,const Rect & damageRect)241 void RSSurfaceRenderParams::SetBuffer(const sptr<SurfaceBuffer>& buffer, const Rect& damageRect)
242 {
243 buffer_ = buffer;
244 damageRect_ = damageRect;
245 needSync_ = true;
246 if (GetParamsType() == RSRenderParamsType::RS_PARAM_OWNED_BY_DRAWABLE) {
247 return;
248 }
249 dirtyType_.set(RSRenderParamsDirtyType::BUFFER_INFO_DIRTY);
250 }
251
GetBuffer() const252 sptr<SurfaceBuffer> RSSurfaceRenderParams::GetBuffer() const
253 {
254 return buffer_;
255 }
256
GetBufferDamage() const257 const Rect& RSSurfaceRenderParams::GetBufferDamage() const
258 {
259 return damageRect_;
260 }
261
SetPreBuffer(const sptr<SurfaceBuffer> & preBuffer)262 void RSSurfaceRenderParams::SetPreBuffer(const sptr<SurfaceBuffer>& preBuffer)
263 {
264 preBuffer_ = preBuffer;
265 needSync_ = true;
266 if (GetParamsType() == RSRenderParamsType::RS_PARAM_OWNED_BY_DRAWABLE) {
267 return;
268 }
269 dirtyType_.set(RSRenderParamsDirtyType::BUFFER_INFO_DIRTY);
270 }
271
GetPreBuffer()272 sptr<SurfaceBuffer> RSSurfaceRenderParams::GetPreBuffer()
273 {
274 return preBuffer_;
275 }
276
SetAcquireFence(const sptr<SyncFence> & acquireFence)277 void RSSurfaceRenderParams::SetAcquireFence(const sptr<SyncFence>& acquireFence)
278 {
279 acquireFence_ = acquireFence;
280 needSync_ = true;
281 dirtyType_.set(RSRenderParamsDirtyType::BUFFER_INFO_DIRTY);
282 }
283
GetAcquireFence() const284 sptr<SyncFence> RSSurfaceRenderParams::GetAcquireFence() const
285 {
286 return acquireFence_;
287 }
288 #endif
289
GetPreSurfaceCacheContentStatic() const290 bool RSSurfaceRenderParams::GetPreSurfaceCacheContentStatic() const
291 {
292 return preSurfaceCacheContentStatic_;
293 }
294
SetSurfaceCacheContentStatic(bool contentStatic,bool lastFrameSynced)295 void RSSurfaceRenderParams::SetSurfaceCacheContentStatic(bool contentStatic, bool lastFrameSynced)
296 {
297 // 1. don't sync while contentStatic not change
298 if (surfaceCacheContentStatic_ == contentStatic) {
299 return;
300 }
301 // 2. don't sync while last frame isn't static and skip sync
302 if (!surfaceCacheContentStatic_ && !lastFrameSynced) {
303 return;
304 }
305 preSurfaceCacheContentStatic_ = surfaceCacheContentStatic_;
306 surfaceCacheContentStatic_ = contentStatic;
307 needSync_ = true;
308 }
309
GetSurfaceCacheContentStatic() const310 bool RSSurfaceRenderParams::GetSurfaceCacheContentStatic() const
311 {
312 return surfaceCacheContentStatic_;
313 }
314
GetPositionZ() const315 float RSSurfaceRenderParams::GetPositionZ() const
316 {
317 return positionZ_;
318 }
319
SetSurfaceSubTreeDirty(bool isSubTreeDirty)320 void RSSurfaceRenderParams::SetSurfaceSubTreeDirty(bool isSubTreeDirty)
321 {
322 if (isSubTreeDirty_ == isSubTreeDirty) {
323 return;
324 }
325 isSubTreeDirty_ = isSubTreeDirty;
326 needSync_ = true;
327 }
328
GetSurfaceSubTreeDirty() const329 bool RSSurfaceRenderParams::GetSurfaceSubTreeDirty() const
330 {
331 return isSubTreeDirty_;
332 }
333
SetGpuOverDrawBufferOptimizeNode(bool overDrawNode)334 void RSSurfaceRenderParams::SetGpuOverDrawBufferOptimizeNode(bool overDrawNode)
335 {
336 if (isGpuOverDrawBufferOptimizeNode_ == overDrawNode) {
337 return;
338 }
339 isGpuOverDrawBufferOptimizeNode_ = overDrawNode;
340 needSync_ = true;
341 }
342
IsGpuOverDrawBufferOptimizeNode() const343 bool RSSurfaceRenderParams::IsGpuOverDrawBufferOptimizeNode() const
344 {
345 return isGpuOverDrawBufferOptimizeNode_;
346 }
347
SetOverDrawBufferNodeCornerRadius(const Vector4f & radius)348 void RSSurfaceRenderParams::SetOverDrawBufferNodeCornerRadius(const Vector4f& radius)
349 {
350 if (overDrawBufferNodeCornerRadius_ == radius) {
351 return;
352 }
353 overDrawBufferNodeCornerRadius_ = radius;
354 needSync_ = true;
355 }
356
GetOverDrawBufferNodeCornerRadius() const357 const Vector4f& RSSurfaceRenderParams::GetOverDrawBufferNodeCornerRadius() const
358 {
359 return overDrawBufferNodeCornerRadius_;
360 }
361
SetIsSubSurfaceNode(bool isSubSurfaceNode)362 void RSSurfaceRenderParams::SetIsSubSurfaceNode(bool isSubSurfaceNode)
363 {
364 isSubSurfaceNode_ = isSubSurfaceNode;
365 }
366
IsSubSurfaceNode() const367 bool RSSurfaceRenderParams::IsSubSurfaceNode() const
368 {
369 return isSubSurfaceNode_;
370 }
371
SetIsNodeToBeCaptured(bool isNodeToBeCaptured)372 void RSSurfaceRenderParams::SetIsNodeToBeCaptured(bool isNodeToBeCaptured)
373 {
374 isNodeToBeCaptured_ = isNodeToBeCaptured;
375 }
376
IsNodeToBeCaptured() const377 bool RSSurfaceRenderParams::IsNodeToBeCaptured() const
378 {
379 return isNodeToBeCaptured_;
380 }
381
SetSkipDraw(bool skip)382 void RSSurfaceRenderParams::SetSkipDraw(bool skip)
383 {
384 isSkipDraw_ = skip;
385 }
386
GetSkipDraw() const387 bool RSSurfaceRenderParams::GetSkipDraw() const
388 {
389 return isSkipDraw_;
390 }
391
SetLayerTop(bool isTop)392 void RSSurfaceRenderParams::SetLayerTop(bool isTop)
393 {
394 if (isLayerTop_ == isTop) {
395 return;
396 }
397 isLayerTop_ = isTop;
398 needSync_ = true;
399 }
400
IsLayerTop() const401 bool RSSurfaceRenderParams::IsLayerTop() const
402 {
403 return isLayerTop_;
404 }
405
OnSync(const std::unique_ptr<RSRenderParams> & target)406 void RSSurfaceRenderParams::OnSync(const std::unique_ptr<RSRenderParams>& target)
407 {
408 auto targetSurfaceParams = static_cast<RSSurfaceRenderParams*>(target.get());
409 if (targetSurfaceParams == nullptr) {
410 RS_LOGE("RSSurfaceRenderParams::OnSync targetSurfaceParams is nullptr");
411 return;
412 }
413
414 if (dirtyType_.test(RSRenderParamsDirtyType::LAYER_INFO_DIRTY)) {
415 targetSurfaceParams->layerInfo_ = layerInfo_;
416 dirtyType_.reset(RSRenderParamsDirtyType::LAYER_INFO_DIRTY);
417 }
418 targetSurfaceParams->windowInfo_ = windowInfo_;
419
420 #ifndef ROSEN_CROSS_PLATFORM
421 if (dirtyType_.test(RSRenderParamsDirtyType::BUFFER_INFO_DIRTY)) {
422 targetSurfaceParams->buffer_ = buffer_;
423 targetSurfaceParams->preBuffer_ = preBuffer_;
424 targetSurfaceParams->acquireFence_ = acquireFence_;
425 targetSurfaceParams->damageRect_ = damageRect_;
426 if (UNLIKELY(isSurfaceCapturePipeline_)) {
427 bufferSynced_ = false;
428 isSurfaceCapturePipeline_ = false;
429 } else {
430 bufferSynced_ = true;
431 }
432 dirtyType_.reset(RSRenderParamsDirtyType::BUFFER_INFO_DIRTY);
433 }
434 #endif
435
436 targetSurfaceParams->rsSurfaceNodeType_ = rsSurfaceNodeType_;
437 targetSurfaceParams->selfDrawingType_ = selfDrawingType_;
438 targetSurfaceParams->ancestorDisplayNode_ = ancestorDisplayNode_;
439 targetSurfaceParams->ancestorDisplayDrawable_ = ancestorDisplayDrawable_;
440 targetSurfaceParams->alpha_ = alpha_;
441 targetSurfaceParams->isSpherizeValid_ = isSpherizeValid_;
442 targetSurfaceParams->isAttractionValid_ = isAttractionValid_;
443 targetSurfaceParams->isParentScaling_ = isParentScaling_;
444 targetSurfaceParams->needBilinearInterpolation_ = needBilinearInterpolation_;
445 targetSurfaceParams->backgroundColor_ = backgroundColor_;
446 targetSurfaceParams->absDrawRect_ = absDrawRect_;
447 targetSurfaceParams->rrect_ = rrect_;
448 targetSurfaceParams->occlusionVisible_ = occlusionVisible_;
449 targetSurfaceParams->visibleRegion_ = visibleRegion_;
450 targetSurfaceParams->visibleRegionInVirtual_ = visibleRegionInVirtual_;
451 targetSurfaceParams->oldDirtyInSurface_ = oldDirtyInSurface_;
452 targetSurfaceParams->transparentRegion_ = transparentRegion_;
453 targetSurfaceParams->isHardwareEnabled_ = isHardwareEnabled_;
454 targetSurfaceParams->needMakeImage_ = needMakeImage_;
455 targetSurfaceParams->isLastFrameHardwareEnabled_ = isLastFrameHardwareEnabled_;
456 targetSurfaceParams->isFixRotationByUser_ = isFixRotationByUser_;
457 targetSurfaceParams->isInFixedRotation_ = isInFixedRotation_;
458 targetSurfaceParams->uiFirstFlag_ = uiFirstFlag_;
459 targetSurfaceParams->uiFirstParentFlag_ = uiFirstParentFlag_;
460 targetSurfaceParams->uifirstUseStarting_ = uifirstUseStarting_;
461 targetSurfaceParams->childrenDirtyRect_ = childrenDirtyRect_;
462 targetSurfaceParams->isOccludedByFilterCache_ = isOccludedByFilterCache_;
463 targetSurfaceParams->isSecurityLayer_ = isSecurityLayer_;
464 targetSurfaceParams->leashPersistentId_ = leashPersistentId_;
465 targetSurfaceParams->isSkipLayer_ = isSkipLayer_;
466 targetSurfaceParams->isSnapshotSkipLayer_ = isSnapshotSkipLayer_;
467 targetSurfaceParams->isProtectedLayer_ = isProtectedLayer_;
468 targetSurfaceParams->drmCornerRadiusInfo_ = drmCornerRadiusInfo_;
469 targetSurfaceParams->animateState_ = animateState_;
470 targetSurfaceParams->skipLayerIds_= skipLayerIds_;
471 targetSurfaceParams->snapshotSkipLayerIds_= snapshotSkipLayerIds_;
472 targetSurfaceParams->securityLayerIds_= securityLayerIds_;
473 targetSurfaceParams->protectedLayerIds_ = protectedLayerIds_;
474 targetSurfaceParams->privacyContentLayerIds_ = privacyContentLayerIds_;
475 targetSurfaceParams->name_ = name_;
476 targetSurfaceParams->surfaceCacheContentStatic_ = surfaceCacheContentStatic_;
477 targetSurfaceParams->bufferCacheSet_ = bufferCacheSet_;
478 targetSurfaceParams->positionZ_ = positionZ_;
479 targetSurfaceParams->isSubTreeDirty_ = isSubTreeDirty_;
480 targetSurfaceParams->overDrawBufferNodeCornerRadius_ = overDrawBufferNodeCornerRadius_;
481 targetSurfaceParams->isGpuOverDrawBufferOptimizeNode_ = isGpuOverDrawBufferOptimizeNode_;
482 targetSurfaceParams->isSubSurfaceNode_ = isSubSurfaceNode_;
483 targetSurfaceParams->isNodeToBeCaptured_ = isNodeToBeCaptured_;
484 targetSurfaceParams->dstRect_ = dstRect_;
485 targetSurfaceParams->isSkipDraw_ = isSkipDraw_;
486 targetSurfaceParams->isLayerTop_ = isLayerTop_;
487 targetSurfaceParams->needHidePrivacyContent_ = needHidePrivacyContent_;
488 targetSurfaceParams->isLeashWindowVisibleRegionEmpty_ = isLeashWindowVisibleRegionEmpty_;
489 targetSurfaceParams->opaqueRegion_ = opaqueRegion_;
490 targetSurfaceParams->needOffscreen_ = needOffscreen_;
491 targetSurfaceParams->totalMatrix_ = totalMatrix_;
492 targetSurfaceParams->visibleFilterChild_ = visibleFilterChild_;
493 targetSurfaceParams->isTransparent_ = isTransparent_;
494 targetSurfaceParams->globalAlpha_ = globalAlpha_;
495 targetSurfaceParams->hasFingerprint_ = hasFingerprint_;
496 targetSurfaceParams->layerSource_ = layerSource_;
497 targetSurfaceParams->sdrNit_ = sdrNit_;
498 targetSurfaceParams->displayNit_ = displayNit_;
499 targetSurfaceParams->brightnessRatio_ = brightnessRatio_;
500 targetSurfaceParams->hasSubSurfaceNodes_ = hasSubSurfaceNodes_;
501 targetSurfaceParams->allSubSurfaceNodeIds_ = std::move(allSubSurfaceNodeIds_);
502 targetSurfaceParams->isHwcEnabledBySolidLayer_ = isHwcEnabledBySolidLayer_;
503 targetSurfaceParams->apiCompatibleVersion_ = apiCompatibleVersion_;
504 targetSurfaceParams->needCacheSurface_ = needCacheSurface_;
505 RSRenderParams::OnSync(target);
506 }
507
ToString() const508 std::string RSSurfaceRenderParams::ToString() const
509 {
510 std::string ret = RSRenderParams::ToString() + ", RSSurfaceRenderParams: {";
511 ret += RENDER_BASIC_PARAM_TO_STRING(int(rsSurfaceNodeType_));
512 ret += RENDER_BASIC_PARAM_TO_STRING(int(selfDrawingType_));
513 ret += RENDER_BASIC_PARAM_TO_STRING(alpha_);
514 ret += RENDER_BASIC_PARAM_TO_STRING(isSpherizeValid_);
515 ret += RENDER_BASIC_PARAM_TO_STRING(isAttractionValid_);
516 ret += RENDER_BASIC_PARAM_TO_STRING(needBilinearInterpolation_);
517 ret += RENDER_BASIC_PARAM_TO_STRING(backgroundColor_.GetAlpha());
518 ret += RENDER_RECT_PARAM_TO_STRING(absDrawRect_);
519 ret += RENDER_BASIC_PARAM_TO_STRING(occlusionVisible_);
520 ret += RENDER_BASIC_PARAM_TO_STRING(isOccludedByFilterCache_);
521 ret += "}";
522 return ret;
523 }
524
IsVisibleDirtyRegionEmpty(const Drawing::Region curSurfaceDrawRegion) const525 bool RSSurfaceRenderParams::IsVisibleDirtyRegionEmpty(const Drawing::Region curSurfaceDrawRegion) const
526 {
527 if (IsMainWindowType()) {
528 return curSurfaceDrawRegion.IsEmpty();
529 }
530 if (IsLeashWindow()) {
531 return GetLeashWindowVisibleRegionEmptyParam();
532 }
533 return false;
534 }
535
SetOpaqueRegion(const Occlusion::Region & opaqueRegion)536 void RSSurfaceRenderParams::SetOpaqueRegion(const Occlusion::Region& opaqueRegion)
537 {
538 opaqueRegion_ = opaqueRegion;
539 }
540
GetOpaqueRegion() const541 const Occlusion::Region& RSSurfaceRenderParams::GetOpaqueRegion() const
542 {
543 return opaqueRegion_;
544 }
545
SetNeedCacheSurface(bool needCacheSurface)546 void RSSurfaceRenderParams::SetNeedCacheSurface(bool needCacheSurface)
547 {
548 if (needCacheSurface_ == needCacheSurface) {
549 return;
550 }
551 needCacheSurface_ = needCacheSurface;
552 needSync_ = true;
553 }
554
GetNeedCacheSurface() const555 bool RSSurfaceRenderParams::GetNeedCacheSurface() const
556 {
557 return needCacheSurface_;
558 }
559
560 } // namespace OHOS::Rosen
561