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 16 #ifndef RS_NODE_COST_MANAGER_H 17 #define RS_NODE_COST_MANAGER_H 18 19 #include "pipeline/rs_base_render_node.h" 20 #include "pipeline/rs_canvas_render_node.h" 21 #include "pipeline/rs_display_render_node.h" 22 #include "pipeline/rs_uni_render_visitor.h" 23 24 namespace OHOS::Rosen { 25 class RSSurfaceRenderNode; 26 class RS_EXPORT RSNodeCostManager { 27 public: 28 RSNodeCostManager(bool doAnimate, bool opDropped, bool isSecurityDisplay); 29 ~RSNodeCostManager() = default; 30 int32_t GetDirtyNodeCost() const; 31 void CalcNodeCost(RSSurfaceRenderNode& node); 32 private: 33 bool IsSkipProcessing(RSSurfaceRenderNode& node) const; 34 void CalcBaseRenderNodeCost(RSBaseRenderNode& node); 35 void CalcCanvasRenderNodeCost(RSCanvasRenderNode& node); 36 void AddNodeCost(int32_t cost); 37 void CalcSurfaceRenderNodeCost(RSSurfaceRenderNode& node); 38 int32_t dirtyNodeCost_ = 0; 39 bool isOpDropped_ = false; 40 bool isSecurityDisplay_ = false; 41 bool doAnimate_ = false; 42 PartialRenderType partialRenderType_; 43 std::shared_ptr<RSSurfaceRenderNode> costSurfaceNode_; 44 bool isOcclusionEnabled_ = false; 45 }; 46 } 47 #endif // RS_NODE_COST_MANAGER_H