• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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_CORE_PIPELINE_RS_UNI_RENDER_UTIL_H
17 #define RENDER_SERVICE_CORE_PIPELINE_RS_UNI_RENDER_UTIL_H
18 
19 #include "surface.h"
20 #include "sync_fence.h"
21 #include "pipeline/rs_base_render_util.h"
22 #include "pipeline/rs_display_render_node.h"
23 #include "pipeline/rs_surface_render_node.h"
24 #include "pipeline/rs_paint_filter_canvas.h"
25 #include "common/rs_obj_abs_geometry.h"
26 
27 namespace OHOS {
28 namespace Rosen {
29 class RSUniRenderUtil {
30 public:
31     static void UpdateRenderNodeDstRect(RSRenderNode& node, const SkMatrix& matrix);
32 
33     // merge history dirty region of current display node and its child surfacenode(app windows)
34     // for mirror display, call this function twice will introduce additional dirtyhistory in dirtymanager
35     static void MergeDirtyHistory(std::shared_ptr<RSDisplayRenderNode>& node, int32_t bufferAge);
36 
37     /* we want to set visible dirty region of each surfacenode into DamageRegionKHR interface, hence
38      * occlusion is calculated.
39      * make sure this function is called after merge dirty history
40      */
41     static Occlusion::Region MergeVisibleDirtyRegion(std::shared_ptr<RSDisplayRenderNode>& node);
42     static BufferDrawParam CreateBufferDrawParam(const RSSurfaceRenderNode& node, bool forceCPU);
43     static BufferDrawParam CreateBufferDrawParam(const RSDisplayRenderNode& node, bool forceCPU);
44     static void DrawCachedSurface(RSSurfaceRenderNode& node, RSPaintFilterCanvas& canvas, sk_sp<SkSurface> surface);
45     static void DrawCachedImage(RSSurfaceRenderNode& node, RSPaintFilterCanvas& canvas, sk_sp<SkImage> image);
46 
47     static bool ReleaseBuffer(RSSurfaceHandler& surfaceHandler);
48 };
49 }
50 }
51 #endif // RENDER_SERVICE_CORE_PIPELINE_RS_UNI_RENDER_UTIL_H
52