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