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_BASE_CORE_PIPELINE_RS_RENDER_CONTENT_H
16 #define RENDER_SERVICE_BASE_CORE_PIPELINE_RS_RENDER_CONTENT_H
17 
18 #include "common/rs_macros.h"
19 #include "memory/rs_dfx_string.h"
20 #include "modifier/rs_render_modifier.h"
21 #include "property/rs_properties.h"
22 #include "property/rs_property_drawable.h"
23 
24 namespace OHOS {
25 namespace Rosen {
26 
27 class RSB_EXPORT RSRenderContent : public std::enable_shared_from_this<RSRenderContent> {
28 public:
29     RSRenderContent();
30     ~RSRenderContent() = default;
31 
32     RSRenderContent(const RSRenderContent&) = delete;
33     RSRenderContent(const RSRenderContent&&) = delete;
34     RSRenderContent& operator=(const RSRenderContent&) = delete;
35     RSRenderContent& operator=(const RSRenderContent&&) = delete;
36 
37     RSProperties& GetMutableRenderProperties();
38     const RSProperties& GetRenderProperties() const;
39     using DrawCmdContainer = std::map<RSModifierType, std::list<std::shared_ptr<RSRenderModifier>>>;
40     RSRenderNodeType GetType() const;
41 
42     void DrawPropertyDrawable(RSPropertyDrawableSlot slot, RSPaintFilterCanvas& canvas) const;
43     void DrawPropertyDrawableRange(
44         RSPropertyDrawableSlot begin, RSPropertyDrawableSlot end, RSPaintFilterCanvas& canvas) const;
45 
46 private:
47     RSProperties renderProperties_;
48     RSPropertyDrawable::DrawableVec propertyDrawablesVec_;
49     DrawCmdContainer drawCmdModifiers_;
50     RSRenderNodeType type_ = RSRenderNodeType::UNKNOW;
51 
52     friend class RSRenderNode;
53     friend class RSModifierDrawable;
54 #ifdef RS_PROFILER_ENABLED
55     friend class RSProfiler;
56 #endif
57 };
58 } // namespace Rosen
59 } // namespace OHOS
60 
61 #endif // RENDER_SERVICE_BASE_CORE_PIPELINE_RS_RENDER_CONTENT_H