1 /* 2 * Copyright (c) 2021 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_TEXTURE_NODE_H 16 #define RENDER_SERVICE_CLIENT_CORE_UI_RS_TEXTURE_NODE_H 17 18 #include "ui/rs_canvas_node.h" 19 20 namespace flutter::OHOS { 21 class TextureRegistry; 22 } 23 24 namespace OHOS { 25 namespace Rosen { 26 class RS_EXPORT RSTextureNode : public RSCanvasNode { 27 public: 28 using WeakPtr = std::weak_ptr<RSTextureNode>; 29 using SharedPtr = std::shared_ptr<RSTextureNode>; 30 static inline constexpr RSUINodeType Type = RSUINodeType::TEXTURE_NODE; 31 ~RSTextureNode()32 virtual ~RSTextureNode() {} 33 34 static std::shared_ptr<RSNode> Create(); 35 36 static void SetTextureRegistry(std::shared_ptr<flutter::OHOS::TextureRegistry> registry); 37 void UpdateTexture(int64_t textureId, bool freeze, RectF drawRect); 38 GetType()39 RSUINodeType GetType() const override 40 { 41 return RSUINodeType::TEXTURE_NODE; 42 } 43 44 protected: 45 RSTextureNode(bool isRenderServiceNode); 46 RSTextureNode(const RSTextureNode&) = delete; 47 RSTextureNode(const RSTextureNode&&) = delete; 48 RSTextureNode& operator=(const RSTextureNode&) = delete; 49 RSTextureNode& operator=(const RSTextureNode&&) = delete; 50 }; 51 } // namespace Rosen 52 } // namespace OHOS 53 54 #endif // RENDER_SERVICE_CLIENT_CORE_UI_RS_TEXTURE_NODE_H