• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_PIPELINE_RS_TEXTURE_RENDER_NODE_H
16 #define RENDER_SERVICE_CLIENT_CORE_PIPELINE_RS_TEXTURE_RENDER_NODE_H
17 
18 #include "pipeline/rs_canvas_render_node.h"
19 
20 namespace flutter::OHOS {
21 class TextureRegistry;
22 }
23 
24 namespace OHOS {
25 namespace Rosen {
26 class RSTextureRenderNode : public RSCanvasRenderNode {
27 public:
28     static inline constexpr RSRenderNodeType Type = RSRenderNodeType::TEXTURE_NODE;
29 
30     static void SetTextureRegistry(std::shared_ptr<flutter::OHOS::TextureRegistry> registry);
31     void UpdateTexture(int64_t textureId, bool freeze, RectF drawRect);
32 
33     explicit RSTextureRenderNode(NodeId id, std::weak_ptr<RSContext> context = {});
34     ~RSTextureRenderNode() override;
35 
36     void ProcessRenderContents(RSPaintFilterCanvas& canvas) override;
37 
GetType()38     RSRenderNodeType GetType() const override
39     {
40         return RSRenderNodeType::TEXTURE_NODE;
41     }
42 
43 private:
44     bool IsDirty() const override;
45     int64_t textureId_ = -1;
46     bool freeze_ = false;
47     RectF drawRect_;
48 };
49 } // namespace Rosen
50 } // namespace OHOS
51 
52 #endif // RENDER_SERVICE_CLIENT_CORE_PIPELINE_RS_TEXTURE_RENDER_NODE_H