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_BASE_RENDER_RENDER_RS_HIGH_PERFORMANCE_VISUAL_ENGINE_H 17 #define RENDER_SERVICE_BASE_RENDER_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 Color solidLayerColor_; 36 }; 37 class RSB_EXPORT HveFilter { 38 public: 39 ~HveFilter() = default; 40 HveFilter(const HveFilter&) = delete; 41 HveFilter& operator=(const HveFilter&) = delete; 42 43 static HveFilter& GetHveFilter(); 44 45 void ClearSurfaceNodeInfo(); 46 void PushSurfaceNodeInfo(SurfaceNodeInfo& surfaceNodeInfo); 47 std::vector<SurfaceNodeInfo> GetSurfaceNodeInfo() const; 48 int GetSurfaceNodeSize() const; 49 50 std::shared_ptr<Drawing::Image> SampleLayer(RSPaintFilterCanvas& canvas, const Drawing::RectI& srcRect); 51 private: 52 HveFilter() = default; 53 std::vector<SurfaceNodeInfo> surfaceNodeInfo_; 54 mutable std::mutex hveFilterMtx_; 55 }; 56 } // namespace Rosen 57 } // namespace OHOS 58 #endif // RENDER_SERVICE_BASE_RENDER_RENDER_RS_HIGH_PERFORMANCE_VISUAL_ENGINE_H