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 "rs_trace.h" 17 18 #include "params/rs_logical_display_render_params.h" 19 #include "platform/common/rs_log.h" 20 21 namespace OHOS::Rosen { RSLogicalDisplayRenderParams(NodeId nodeId)22RSLogicalDisplayRenderParams::RSLogicalDisplayRenderParams(NodeId nodeId) 23 : RSRenderParams(nodeId) {} 24 OnSync(const std::unique_ptr<RSRenderParams> & target)25void RSLogicalDisplayRenderParams::OnSync(const std::unique_ptr<RSRenderParams>& target) 26 { 27 auto targetLogicalDisplayRenderParam = static_cast<RSLogicalDisplayRenderParams*>(target.get()); 28 if (targetLogicalDisplayRenderParam == nullptr) { 29 RS_LOGE("targetLogicalDisplayRenderParam::OnSync targetLogicalDisplayRenderParam is null"); 30 return; 31 } 32 targetLogicalDisplayRenderParam->topSurfaceOpaqueRects_ = topSurfaceOpaqueRects_; 33 targetLogicalDisplayRenderParam->screenRotation_ = screenRotation_; 34 targetLogicalDisplayRenderParam->screenId_ = screenId_; 35 targetLogicalDisplayRenderParam->needOffscreen_ = needOffscreen_; 36 targetLogicalDisplayRenderParam->nodeRotation_ = nodeRotation_; 37 targetLogicalDisplayRenderParam->compositeType_ = compositeType_; 38 targetLogicalDisplayRenderParam->isRotationChanged_ = isRotationChanged_; 39 targetLogicalDisplayRenderParam->isMirrorDisplay_ = isMirrorDisplay_; 40 targetLogicalDisplayRenderParam->mirrorSourceDrawable_ = mirrorSourceDrawable_; 41 targetLogicalDisplayRenderParam->virtualScreenMuteStatus_ = virtualScreenMuteStatus_; 42 targetLogicalDisplayRenderParam->isSecurityDisplay_ = isSecurityDisplay_; 43 targetLogicalDisplayRenderParam->specialLayerManager_ = specialLayerManager_; 44 targetLogicalDisplayRenderParam->displaySpecialSurfaceChanged_ = displaySpecialSurfaceChanged_; 45 targetLogicalDisplayRenderParam->isSecurityExemption_ = isSecurityExemption_; 46 targetLogicalDisplayRenderParam->hasSecLayerInVisibleRect_ = hasSecLayerInVisibleRect_; 47 targetLogicalDisplayRenderParam->hasSecLayerInVisibleRectChanged_ = hasSecLayerInVisibleRectChanged_; 48 targetLogicalDisplayRenderParam->ancestorScreenDrawable_ = ancestorScreenDrawable_; 49 targetLogicalDisplayRenderParam->hasCaptureWindow_ = hasCaptureWindow_; 50 targetLogicalDisplayRenderParam->offsetX_ = offsetX_; 51 targetLogicalDisplayRenderParam->offsetY_ = offsetY_; 52 53 RSRenderParams::OnSync(target); 54 } 55 ToString() const56std::string RSLogicalDisplayRenderParams::ToString() const 57 { 58 std::string ret = RSRenderParams::ToString() + ", RSLogicalDisplayRenderParams: {"; 59 ret += RENDER_BASIC_PARAM_TO_STRING(static_cast<int>(screenId_)); 60 ret += RENDER_BASIC_PARAM_TO_STRING(static_cast<int>(screenRotation_)); 61 ret += RENDER_BASIC_PARAM_TO_STRING(int(nodeRotation_)); 62 ret += "}"; 63 return ret; 64 } 65 GetScreenRotation() const66ScreenRotation RSLogicalDisplayRenderParams::GetScreenRotation() const 67 { 68 return screenRotation_; 69 } 70 GetNodeRotation() const71ScreenRotation RSLogicalDisplayRenderParams::GetNodeRotation() const 72 { 73 return nodeRotation_; 74 } 75 SetScreenRotation(ScreenRotation screenRotation)76void RSLogicalDisplayRenderParams::SetScreenRotation(ScreenRotation screenRotation) 77 { 78 if (screenRotation_ == screenRotation) { 79 return; 80 } 81 screenRotation_ = screenRotation; 82 needSync_ = true; 83 } 84 GetScreenId() const85uint64_t RSLogicalDisplayRenderParams::GetScreenId() const 86 { 87 return screenId_; 88 } 89 SetScreenId(uint64_t screenId)90void RSLogicalDisplayRenderParams::SetScreenId(uint64_t screenId) 91 { 92 if (screenId_ == screenId) { 93 return; 94 } 95 screenId_ = screenId; 96 needSync_ = true; 97 } 98 SetNeedOffscreen(bool needOffscreen)99void RSLogicalDisplayRenderParams::SetNeedOffscreen(bool needOffscreen) 100 { 101 if (needOffscreen_ == needOffscreen) { 102 return; 103 } 104 needOffscreen_ = needOffscreen; 105 needSync_ = true; 106 } 107 GetNeedOffscreen() const108bool RSLogicalDisplayRenderParams::GetNeedOffscreen() const 109 { 110 return needOffscreen_; 111 } 112 SetRotationChanged(bool changed)113void RSLogicalDisplayRenderParams::SetRotationChanged(bool changed) 114 { 115 if (isRotationChanged_ == changed) { 116 return; 117 } 118 isRotationChanged_ = changed; 119 needSync_ = true; 120 } 121 IsRotationChanged() const122bool RSLogicalDisplayRenderParams::IsRotationChanged() const 123 { 124 return isRotationChanged_; 125 } 126 IsMirrorDisplay() const127bool RSLogicalDisplayRenderParams::IsMirrorDisplay() const 128 { 129 return isMirrorDisplay_; 130 } 131 GetMirrorSourceDrawable()132DrawableV2::RSRenderNodeDrawableAdapter::WeakPtr RSLogicalDisplayRenderParams::GetMirrorSourceDrawable() 133 { 134 return mirrorSourceDrawable_; 135 } 136 GetVirtualScreenMuteStatus() const137bool RSLogicalDisplayRenderParams::GetVirtualScreenMuteStatus() const 138 { 139 return virtualScreenMuteStatus_; 140 } 141 IsSecurityDisplay() const142bool RSLogicalDisplayRenderParams::IsSecurityDisplay() const 143 { 144 return isSecurityDisplay_; 145 } 146 HasCaptureWindow() const147bool RSLogicalDisplayRenderParams::HasCaptureWindow() const 148 { 149 return hasCaptureWindow_; 150 } 151 } // namespace OHOS::Rosen 152