1 /* 2 * Copyright (c) 2021-2023 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 #ifndef RENDER_SERVICE_CLIENT_CORE_UI_RS_DISPLAY_NODE_H 16 #define RENDER_SERVICE_CLIENT_CORE_UI_RS_DISPLAY_NODE_H 17 18 #include "ui/rs_node.h" 19 #include "screen_manager/screen_types.h" 20 21 namespace OHOS { 22 namespace Rosen { 23 24 class RSC_EXPORT RSDisplayNode : public RSNode { 25 public: 26 using WeakPtr = std::weak_ptr<RSDisplayNode>; 27 using SharedPtr = std::shared_ptr<RSDisplayNode>; 28 static inline constexpr RSUINodeType Type = RSUINodeType::DISPLAY_NODE; GetType()29 RSUINodeType GetType() const override 30 { 31 return Type; 32 } 33 34 ~RSDisplayNode() override; 35 36 void ClearChildren() override; 37 38 static SharedPtr Create(const RSDisplayNodeConfig& displayNodeConfig); 39 void AddDisplayNodeToTree(); 40 void RemoveDisplayNodeFromTree(); 41 42 bool Marshalling(Parcel& parcel) const; 43 static SharedPtr Unmarshalling(Parcel& parcel); 44 45 void SetScreenId(uint64_t screenId); 46 47 void SetDisplayOffset(int32_t offsetX, int32_t offsetY); 48 49 void SetSecurityDisplay(bool isSecurityDisplay); 50 51 void SetScreenRotation(const uint32_t& rotation); 52 53 void SetDisplayNodeMirrorConfig(const RSDisplayNodeConfig& displayNodeConfig); 54 55 bool GetSecurityDisplay() const; 56 57 bool IsMirrorDisplay() const; 58 59 void SetBootAnimation(bool isBootAnimation); 60 bool GetBootAnimation() const; 61 62 void SetScbNodePid(const std::vector<int32_t>& oldPids, int32_t currentPid); 63 64 protected: 65 explicit RSDisplayNode(const RSDisplayNodeConfig& config); 66 RSDisplayNode(const RSDisplayNodeConfig& config, NodeId id); 67 RSDisplayNode(const RSDisplayNode&) = delete; 68 RSDisplayNode(const RSDisplayNode&&) = delete; 69 RSDisplayNode& operator=(const RSDisplayNode&) = delete; 70 RSDisplayNode& operator=(const RSDisplayNode&&) = delete; 71 void OnBoundsSizeChanged() const override; 72 73 private: 74 bool CreateNode(const RSDisplayNodeConfig& displayNodeConfig, NodeId nodeId); 75 uint64_t screenId_; 76 int32_t offsetX_; 77 int32_t offsetY_; 78 bool isSecurityDisplay_ = false; 79 bool isMirroredDisplay_ = false; 80 bool isBootAnimation_ = false; 81 }; 82 } // namespace Rosen 83 } // namespace OHOS 84 85 #endif // RENDER_SERVICE_CLIENT_CORE_UI_RS_DISPLAY_NODE_H 86