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