• 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_CLIENT_CORE_RENDER_RS_HIGH_PERFORMANCE_VISUAL_ENGINE_H
17 #define RENDER_SERVICE_CLIENT_CORE_RENDER_RS_HIGH_PERFORMANCE_VISUAL_ENGINE_H
18 
19 #include "draw/canvas.h"
20 #include "image/image.h"
21 #include <mutex>
22 #include "pipeline/rs_paint_filter_canvas.h"
23 #include "utils/matrix.h"
24 #include "utils/rect.h"
25 #include "platform/common/rs_log.h"
26 
27 namespace OHOS {
28 namespace Rosen {
29 class RSPaintFilterCanvas;
30 struct SurfaceNodeInfo {
31     std::shared_ptr<Drawing::Image> surfaceImage_ = nullptr;
32     Drawing::Matrix matrix_ = {};
33     Drawing::Rect srcRect_;
34     Drawing::Rect dstRect_;
35 };
36 class RSB_EXPORT HveFilter {
37 public:
38     ~HveFilter() = default;
39     HveFilter(const HveFilter&) = delete;
40     HveFilter& operator=(const HveFilter&) = delete;
41 
42     static HveFilter& GetHveFilter();
43 
44     void ClearSurfaceNodeInfo();
45     void PushSurfaceNodeInfo(SurfaceNodeInfo& surfaceNodeInfo);
46     std::vector<SurfaceNodeInfo> GetSurfaceNodeInfo() const;
47     int GetSurfaceNodeSize() const;
48 
49     std::shared_ptr<Drawing::Image> SampleLayer(RSPaintFilterCanvas& canvas, const Drawing::RectI& srcRect);
50 private:
51     HveFilter() = default;
52     std::vector<SurfaceNodeInfo> surfaceNodeInfo_;
53     mutable std::mutex hveFilterMtx_;
54 };
55 } // namespace Rosen
56 } // namespace OHOS
57 #endif // RENDER_SERVICE_CLIENT_CORE_RENDER_RS_HIGH_PERFORMANCE_VISUAL_ENGINE_H