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 #ifndef RENDER_SERVICE_CLIENT_CORE_RENDER_RS_MESA_BLUR_SHADER_FILTER_H 16 #define RENDER_SERVICE_CLIENT_CORE_RENDER_RS_MESA_BLUR_SHADER_FILTER_H 17 18 #include "rs_pixel_stretch_params.h" 19 #include "render/rs_drawing_filter.h" 20 #include <mutex> 21 22 namespace OHOS { 23 namespace Rosen { 24 class RSB_EXPORT RSMESABlurShaderFilter : public RSShaderFilter { 25 public: 26 RSMESABlurShaderFilter(int radius); 27 RSMESABlurShaderFilter(int radius, float greyCoefLow, float greyCoefHigh); 28 ~RSMESABlurShaderFilter() override; 29 int GetRadius() const; 30 void CalculateHash(); 31 void SetPixelStretchParams(std::shared_ptr<RSPixelStretchParams>& param); 32 void SetRadius(int radius); 33 std::string GetDetailedDescription() const; GetPixelStretchParams()34 std::shared_ptr<RSPixelStretchParams> GetPixelStretchParams() const 35 { 36 std::lock_guard<std::mutex> lock(pixelStretchParamsMutex_); 37 return pixelStretchParam_; 38 } 39 void GenerateGEVisualEffect(std::shared_ptr<Drawing::GEVisualEffectContainer> visualEffectContainer) override; 40 41 private: 42 int radius_ = 0; 43 float greyCoefLow_ = 0.f; 44 float greyCoefHigh_ = 0.f; 45 mutable std::mutex pixelStretchParamsMutex_; 46 std::shared_ptr<RSPixelStretchParams> pixelStretchParam_ = nullptr; 47 friend class RSMarshallingHelper; 48 }; 49 } // namespace Rosen 50 } // namespace OHOS 51 52 #endif // RENDER_SERVICE_CLIENT_CORE_RENDER_RS_MESA_BLUR_SHADER_FILTER_H 53