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 #ifndef RENDER_SERVICE_BASE_PARAMS_RS_LOGICAL_DISPLAY_RENDER_PARAMS_H 17 #define RENDER_SERVICE_BASE_PARAMS_RS_LOGICAL_DISPLAY_RENDER_PARAMS_H 18 19 #include <memory> 20 #include <string> 21 22 #include "common/rs_macros.h" 23 #include "params/rs_render_params.h" 24 #include "params/rs_screen_render_params.h" 25 namespace OHOS::Rosen { 26 class RSB_EXPORT RSLogicalDisplayRenderParams : public RSRenderParams { 27 public: 28 explicit RSLogicalDisplayRenderParams(NodeId nodeId); 29 ~RSLogicalDisplayRenderParams() override = default; 30 31 void OnSync(const std::unique_ptr<RSRenderParams>& target) override; 32 33 std::string ToString() const override; 34 35 void SetScreenRotation(ScreenRotation screenRotation); 36 ScreenRotation GetScreenRotation() const override; 37 ScreenRotation GetNodeRotation() const; 38 void SetRotationChanged(bool changed) override; 39 bool IsRotationChanged() const override; 40 41 void SetScreenId(uint64_t screenId); 42 uint64_t GetScreenId() const; 43 44 void SetNeedOffscreen(bool needOffscreen); 45 bool GetNeedOffscreen() const; 46 47 bool IsMirrorDisplay() const; 48 DrawableV2::RSRenderNodeDrawableAdapter::WeakPtr GetMirrorSourceDrawable() override; 49 bool GetVirtualScreenMuteStatus() const; 50 bool IsSecurityDisplay() const; 51 bool HasCaptureWindow() const; GetCompositeType()52 CompositeType GetCompositeType() const 53 { 54 return compositeType_; 55 } GetSecurityExemption()56 bool GetSecurityExemption() const 57 { 58 return isSecurityExemption_; 59 } 60 SetSecurityExemption(bool isSecurityExemption)61 void SetSecurityExemption(bool isSecurityExemption) 62 { 63 isSecurityExemption_ = isSecurityExemption; 64 } 65 GetTopSurfaceOpaqueRects()66 const std::vector<Occlusion::Rect>& GetTopSurfaceOpaqueRects() const 67 { 68 return topSurfaceOpaqueRects_; 69 } 70 SetTopSurfaceOpaqueRects(const std::vector<Occlusion::Rect> & topSurfaceOpaqueRects)71 void SetTopSurfaceOpaqueRects(const std::vector<Occlusion::Rect>& topSurfaceOpaqueRects) 72 { 73 topSurfaceOpaqueRects_ = topSurfaceOpaqueRects; 74 } 75 SetTopSurfaceOpaqueRects(std::vector<Occlusion::Rect> && topSurfaceOpaqueRects)76 void SetTopSurfaceOpaqueRects(std::vector<Occlusion::Rect>&& topSurfaceOpaqueRects) 77 { 78 topSurfaceOpaqueRects_ = std::move(topSurfaceOpaqueRects); 79 } 80 GetSpecialLayerMgr()81 const RSSpecialLayerManager& GetSpecialLayerMgr() const 82 { 83 return specialLayerManager_; 84 } 85 HasSecLayerInVisibleRect()86 bool HasSecLayerInVisibleRect() const 87 { 88 return hasSecLayerInVisibleRect_; 89 } 90 IsSpecialLayerChanged()91 bool IsSpecialLayerChanged() const 92 { 93 return displaySpecialSurfaceChanged_; 94 } 95 HasSecLayerInVisibleRectChanged()96 bool HasSecLayerInVisibleRectChanged() const 97 { 98 return hasSecLayerInVisibleRectChanged_; 99 } 100 SetAncestorScreenDrawable(const DrawableV2::RSRenderNodeDrawableAdapter::SharedPtr & ancestorScreenDrawable)101 void SetAncestorScreenDrawable(const DrawableV2::RSRenderNodeDrawableAdapter::SharedPtr& ancestorScreenDrawable) 102 { 103 ancestorScreenDrawable_ = ancestorScreenDrawable; 104 } 105 GetAncestorScreenDrawable()106 DrawableV2::RSRenderNodeDrawableAdapter::WeakPtr GetAncestorScreenDrawable() const 107 { 108 return ancestorScreenDrawable_; 109 } 110 GetOffsetX()111 float GetOffsetX() const 112 { 113 return offsetX_; 114 } 115 GetOffsetY()116 float GetOffsetY() const 117 { 118 return offsetY_; 119 } 120 121 private: 122 DrawableV2::RSRenderNodeDrawableAdapter::WeakPtr ancestorScreenDrawable_; 123 std::vector<Occlusion::Rect> topSurfaceOpaqueRects_; 124 bool hasSecLayerInVisibleRect_ = false; 125 RSSpecialLayerManager specialLayerManager_; 126 bool isSecurityExemption_ = false; 127 uint64_t screenId_ = INVALID_SCREEN_ID; 128 bool needOffscreen_ = false; 129 ScreenRotation screenRotation_ = ScreenRotation::ROTATION_0; 130 ScreenRotation nodeRotation_ = ScreenRotation::INVALID_SCREEN_ROTATION; 131 bool isRotationChanged_ = false; 132 133 bool isMirrorDisplay_ = false; 134 DrawableV2::RSRenderNodeDrawableAdapter::WeakPtr mirrorSourceDrawable_; 135 bool virtualScreenMuteStatus_ = false; 136 bool isSecurityDisplay_ = false; 137 bool hasCaptureWindow_ = false; 138 CompositeType compositeType_ = CompositeType::HARDWARE_COMPOSITE; 139 140 bool displaySpecialSurfaceChanged_ = false; 141 bool hasSecLayerInVisibleRectChanged_ = false; 142 143 float offsetX_ = 0.f; 144 float offsetY_ = 0.f; 145 146 friend class RSLogicalDisplayRenderNode; 147 }; 148 } // namespace OHOS::Rosen 149 #endif // RENDER_SERVICE_BASE_PARAMS_RS_LOGICAL_DISPLAY_RENDER_PARAMS_H 150