• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 
16 #ifndef RENDER_SERVICE_DRAWABLE_RS_EFFECT_RENDER_NODE_DRAWABLE_H
17 #define RENDER_SERVICE_DRAWABLE_RS_EFFECT_RENDER_NODE_DRAWABLE_H
18 
19 #include "drawable/rs_render_node_drawable.h"
20 #include "params/rs_effect_render_params.h"
21 
22 namespace OHOS::Rosen {
23 class RSEffectRenderNode;
24 
25 namespace DrawableV2 {
26 class RSEffectRenderNodeDrawable : public RSRenderNodeDrawable {
27 public:
28     ~RSEffectRenderNodeDrawable() override = default;
29 
30     static RSRenderNodeDrawable::Ptr OnGenerate(std::shared_ptr<const RSRenderNode> node);
31     void OnDraw(Drawing::Canvas& canvas) override;
32     void OnCapture(Drawing::Canvas& canvas) override;
33 
34 private:
35     explicit RSEffectRenderNodeDrawable(std::shared_ptr<const RSRenderNode>&& node);
36     using Registrar = RenderNodeDrawableRegistrar<RSRenderNodeType::EFFECT_NODE, OnGenerate>;
37     static Registrar instance_;
38     bool GenerateEffectDataOnDemand(RSEffectRenderParams* effectParams,
39         Drawing::Canvas& canvas, const Drawing::Rect& bounds, RSPaintFilterCanvas* paintFilterCanvas);
40 };
41 } // namespace DrawableV2
42 } // namespace OHOS::Rosen
43 #endif // RENDER_SERVICE_DRAWABLE_RS_EFFECT_RENDER_NODE_DRAWABLE_H
44