• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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_PIPELINE_RS_EFFECT_RENDER_NODE_H
16 #define RENDER_SERVICE_CLIENT_CORE_PIPELINE_RS_EFFECT_RENDER_NODE_H
17 
18 #include "common/rs_macros.h"
19 #include "modifier/rs_modifier_type.h"
20 #include "pipeline/rs_render_node.h"
21 
22 namespace OHOS {
23 namespace Rosen {
24 class RSB_EXPORT RSEffectRenderNode : public RSRenderNode {
25 public:
26     using WeakPtr = std::weak_ptr<RSEffectRenderNode>;
27     using SharedPtr = std::shared_ptr<RSEffectRenderNode>;
28     static inline constexpr RSRenderNodeType Type = RSRenderNodeType::EFFECT_NODE;
GetType()29     RSRenderNodeType GetType() const override
30     {
31         return Type;
32     }
33 
34     explicit RSEffectRenderNode(NodeId id, std::weak_ptr<RSContext> context = {});
35     virtual ~RSEffectRenderNode();
36 
37     void ProcessRenderBeforeChildren(RSPaintFilterCanvas& canvas) override;
38     void ProcessRenderAfterChildren(RSPaintFilterCanvas& canvas) override;
39 
40     void Prepare(const std::shared_ptr<RSNodeVisitor>& visitor) override;
41     void Process(const std::shared_ptr<RSNodeVisitor>& visitor) override;
42 #ifndef USE_ROSEN_DRAWING
43     void SetEffectRegion(const std::optional<SkPath>& region);
44 #else
45     void SetEffectRegion(const std::optional<Drawing::Path>& region);
46 #endif
47 
48 protected:
49     RectI GetFilterRect() const override;
50 
51 private:
52 #ifndef USE_ROSEN_DRAWING
53     std::optional<SkPath> effectRegion_ = std::nullopt;
54 #else
55     std::optional<Drawing::Path> effectRegion_ = std::nullopt;
56 #endif
57 };
58 } // namespace Rosen
59 } // namespace OHOS
60 #endif // RENDER_SERVICE_CLIENT_CORE_PIPELINE_RS_EFFECT_RENDER_NODE_H
61