misc factor, add filter hash

Signed-off-by: Zhang Peng <zhangpeng280@huawei.com>
Change-Id: Ibbc8e27fa1490d935d20b71f0acb854260e5d7a0
This commit is contained in:
Zhang Peng 2023-06-27 16:55:37 +08:00
parent ca469a5ec0
commit 7b4b33547e
No known key found for this signature in database
GPG Key ID: 735EEEEEEEEEEEEE
14 changed files with 111 additions and 76 deletions

View File

@ -49,7 +49,7 @@ public:
void Resume();
void SetFraction(float fraction);
void SetReversed(bool isReversed);
virtual bool Marshalling(Parcel& parcel) const override;
bool Marshalling(Parcel& parcel) const override;
bool Animate(int64_t time);
bool IsStarted() const;

View File

@ -64,11 +64,10 @@ public:
}
std::pair<bool, bool> Animate(int64_t timestamp) override;
// PrepareCanvasRenderNode in UniRender
bool Update(
RSDirtyRegionManager& dirtyManager, const RSProperties* parent, bool parentDirty, RectI clipRect);
// Other situation
bool Update(RSDirtyRegionManager& dirtyManager, const RSProperties* parent, bool parentDirty);
// clipRect has value in UniRender when calling PrepareCanvasRenderNode, else it is nullopt
bool Update(RSDirtyRegionManager& dirtyManager, const RSProperties* parent, bool parentDirty,
std::optional<RectI> clipRect = std::nullopt);
#ifndef USE_ROSEN_DRAWING
virtual std::optional<SkRect> GetContextClipRegion() const { return std::nullopt; }
#else
@ -432,12 +431,7 @@ private:
void FallbackAnimationsToRoot();
void FilterModifiersByPid(pid_t pid);
// clipRect only used in UniRener when calling PrepareCanvasRenderNode
// PrepareCanvasRenderNode in UniRender: needClip = true and clipRect is meaningful
// Other situation: needClip = false and clipRect is meaningless
bool Update(RSDirtyRegionManager& dirtyManager,
const RSProperties* parent, bool parentDirty, bool needClip, RectI clipRect);
void UpdateDirtyRegion(RSDirtyRegionManager& dirtyManager, bool geoDirty, bool needClip, RectI clipRect);
void UpdateDirtyRegion(RSDirtyRegionManager& dirtyManager, bool geoDirty, std::optional<RectI> clipRect);
bool isDirtyRegionUpdated_ = false;
bool isLastVisible_ = false;

View File

@ -155,15 +155,15 @@ public:
Vector4<Color> GetBorderColor() const;
Vector4f GetBorderWidth() const;
Vector4<uint32_t> GetBorderStyle() const;
std::shared_ptr<RSBorder> GetBorder() const;
const std::shared_ptr<RSBorder>& GetBorder() const;
// filter properties
void SetBackgroundFilter(std::shared_ptr<RSFilter> backgroundFilter);
void SetLinearGradientBlurPara(std::shared_ptr<RSLinearGradientBlurPara> para);
void SetFilter(std::shared_ptr<RSFilter> filter);
std::shared_ptr<RSFilter> GetBackgroundFilter() const;
std::shared_ptr<RSLinearGradientBlurPara> GetLinearGradientBlurPara() const;
std::shared_ptr<RSFilter> GetFilter() const;
const std::shared_ptr<RSFilter>& GetBackgroundFilter() const;
const std::shared_ptr<RSLinearGradientBlurPara>& GetLinearGradientBlurPara() const;
const std::shared_ptr<RSFilter>& GetFilter() const;
bool NeedFilter() const;
// shadow properties

View File

@ -27,12 +27,14 @@ class RSB_EXPORT RSBlurFilter : public RSDrawingFilter {
#endif
public:
RSBlurFilter(float blurRadiusX, float blurRadiusY);
RSBlurFilter(const RSBlurFilter&) = delete;
RSBlurFilter operator=(const RSBlurFilter&) = delete;
~RSBlurFilter() override;
float GetBlurRadiusX();
float GetBlurRadiusY();
bool IsValid() const override;
#ifndef USE_ROSEN_DRAWING
std::shared_ptr<RSSkiaFilter> Compose(const std::shared_ptr<RSSkiaFilter>& inner) override;
std::shared_ptr<RSSkiaFilter> Compose(const std::shared_ptr<RSSkiaFilter>& inner) const override;
#else
std::shared_ptr<RSDrawingFilter> Compose(const std::shared_ptr<RSDrawingFilter>& inner) override;
#endif

View File

@ -32,6 +32,8 @@ enum BLUR_COLOR_MODE : int {
class RSB_EXPORT RSFilter : public std::enable_shared_from_this<RSFilter> {
public:
virtual ~RSFilter();
RSFilter(const RSFilter&) = delete;
RSFilter operator=(const RSFilter&) = delete;
virtual std::string GetDescription();
static std::shared_ptr<RSFilter> CreateBlurFilter(float blurRadiusX, float blurRadiusY);
static std::shared_ptr<RSFilter> CreateMaterialFilter(
@ -42,7 +44,7 @@ public:
NONE = 0,
BLUR,
MATERIAL,
LIGHTUPEFFECT,
LIGHT_UP_EFFECT,
};
FilterType GetFilterType() const
{
@ -64,8 +66,14 @@ public:
return true;
}
uint32_t Hash() const
{
return hash_;
}
protected:
FilterType type_;
uint32_t hash_ = 0;
RSFilter();
virtual std::shared_ptr<RSFilter> Add(const std::shared_ptr<RSFilter>& rhs) { return nullptr; }
virtual std::shared_ptr<RSFilter> Sub(const std::shared_ptr<RSFilter>& rhs) { return nullptr; }

View File

@ -29,10 +29,12 @@ class RSB_EXPORT RSLightUpEffectFilter : public RSDrawingFilter {
#endif
public:
RSLightUpEffectFilter(float lightUpDegree);
RSLightUpEffectFilter(const RSLightUpEffectFilter&) = delete;
RSLightUpEffectFilter operator=(const RSLightUpEffectFilter&) = delete;
~RSLightUpEffectFilter() override;
float GetLightUpDegree();
#ifndef USE_ROSEN_DRAWING
std::shared_ptr<RSSkiaFilter> Compose(const std::shared_ptr<RSSkiaFilter>& inner) override;
std::shared_ptr<RSSkiaFilter> Compose(const std::shared_ptr<RSSkiaFilter>& inner) const override;
#else
std::shared_ptr<RSDrawingFilter> Compose(const std::shared_ptr<RSDrawingFilter>& inner) override;
#endif

View File

@ -66,8 +66,10 @@ class RSB_EXPORT RSMaterialFilter : public RSDrawingFilter {
public:
RSMaterialFilter(int style, float dipScale, BLUR_COLOR_MODE mode, float ratio);
RSMaterialFilter(MaterialParam materialParam, BLUR_COLOR_MODE mode);
RSMaterialFilter(const RSMaterialFilter&) = delete;
RSMaterialFilter operator=(const RSMaterialFilter&) = delete;
~RSMaterialFilter() override;
std::shared_ptr<RSFilter> TransformFilter(float fraction);
std::shared_ptr<RSFilter> TransformFilter(float fraction) const;
bool IsValid() const override;
#ifndef USE_ROSEN_DRAWING
void PreProcess(sk_sp<SkImage> image) override;
@ -76,7 +78,7 @@ public:
#endif
void PostProcess(RSPaintFilterCanvas& canvas) override;
#ifndef USE_ROSEN_DRAWING
std::shared_ptr<RSSkiaFilter> Compose(const std::shared_ptr<RSSkiaFilter>& inner) override;
std::shared_ptr<RSSkiaFilter> Compose(const std::shared_ptr<RSSkiaFilter>& inner) const override;
#else
std::shared_ptr<RSDrawingFilter> Compose(const std::shared_ptr<RSDrawingFilter>& inner) override;
#endif

View File

@ -35,10 +35,11 @@ class RSPaintFilterCanvas;
class RSSkiaFilter : public RSFilter {
public:
RSSkiaFilter(sk_sp<SkImageFilter> imagefilter);
RSSkiaFilter(const RSSkiaFilter&) = delete;
~RSSkiaFilter() override;
SkPaint GetPaint() const;
sk_sp<SkImageFilter> GetImageFilter() const;
virtual std::shared_ptr<RSSkiaFilter> Compose(const std::shared_ptr<RSSkiaFilter>& inner) = 0;
virtual std::shared_ptr<RSSkiaFilter> Compose(const std::shared_ptr<RSSkiaFilter>& inner) const = 0;
virtual void PreProcess(sk_sp<SkImage> image) {};
virtual void PostProcess(RSPaintFilterCanvas& canvas) {};

View File

@ -84,19 +84,7 @@ std::pair<bool, bool> RSRenderNode::Animate(int64_t timestamp)
}
bool RSRenderNode::Update(
RSDirtyRegionManager& dirtyManager, const RSProperties* parent, bool parentDirty, RectI clipRect)
{
return Update(dirtyManager, parent, parentDirty, true, clipRect);
}
bool RSRenderNode::Update(RSDirtyRegionManager& dirtyManager, const RSProperties* parent, bool parentDirty)
{
RectI clipRect{0, 0, 0, 0};
return Update(dirtyManager, parent, parentDirty, false, clipRect);
}
bool RSRenderNode::Update(
RSDirtyRegionManager& dirtyManager, const RSProperties* parent, bool parentDirty, bool needClip, RectI clipRect)
RSDirtyRegionManager& dirtyManager, const RSProperties* parent, bool parentDirty, std::optional<RectI> clipRect)
{
// no need to update invisible nodes
if (!ShouldPaint() && !isLastVisible_) {
@ -124,7 +112,7 @@ bool RSRenderNode::Update(
}
}
isDirtyRegionUpdated_ = false;
UpdateDirtyRegion(dirtyManager, dirty, needClip, clipRect);
UpdateDirtyRegion(dirtyManager, dirty, clipRect);
isLastVisible_ = ShouldPaint();
renderProperties_.ResetDirty();
return dirty;
@ -141,7 +129,7 @@ const RSProperties& RSRenderNode::GetRenderProperties() const
}
void RSRenderNode::UpdateDirtyRegion(
RSDirtyRegionManager& dirtyManager, bool geoDirty, bool needClip, RectI clipRect)
RSDirtyRegionManager& dirtyManager, bool geoDirty, std::optional<RectI> clipRect)
{
if (!IsDirty() && !geoDirty) {
return;
@ -175,8 +163,8 @@ void RSRenderNode::UpdateDirtyRegion(
dirtyRect = dirtyRect.JoinRect(stretchDirtyRect);
}
if (needClip) {
dirtyRect = dirtyRect.IntersectRect(clipRect);
if (clipRect.has_value()) {
dirtyRect = dirtyRect.IntersectRect(*clipRect);
}
oldDirty_ = dirtyRect;
oldDirtyInSurface_ = oldDirty_.IntersectRect(dirtyManager.GetSurfaceRect());
@ -194,7 +182,7 @@ void RSRenderNode::UpdateDirtyRegion(
dirtyManager.UpdateDirtyRegionInfoForDfx(
GetId(), GetType(), DirtyRegionType::SHADOW_RECT, shadowRect);
dirtyManager.UpdateDirtyRegionInfoForDfx(
GetId(), GetType(), DirtyRegionType::PREPARE_CLIP_RECT, clipRect);
GetId(), GetType(), DirtyRegionType::PREPARE_CLIP_RECT, clipRect.value_or(RectI()));
}
}
}

View File

@ -111,7 +111,7 @@ RSProperties::RSProperties()
frameGeo_ = std::make_shared<RSObjGeometry>();
}
RSProperties::~RSProperties() {}
RSProperties::~RSProperties() = default;
void RSProperties::ResetProperty(RSModifierType type)
{
@ -765,7 +765,7 @@ Vector4<uint32_t> RSProperties::GetBorderStyle() const
return border_ ? border_->GetStyleFour() : Vector4<uint32_t>(static_cast<uint32_t>(BorderStyle::NONE));
}
std::shared_ptr<RSBorder> RSProperties::GetBorder() const
const std::shared_ptr<RSBorder>& RSProperties::GetBorder() const
{
return border_;
}
@ -790,17 +790,17 @@ void RSProperties::SetFilter(std::shared_ptr<RSFilter> filter)
contentDirty_ = true;
}
std::shared_ptr<RSFilter> RSProperties::GetBackgroundFilter() const
const std::shared_ptr<RSFilter>& RSProperties::GetBackgroundFilter() const
{
return backgroundFilter_;
}
std::shared_ptr<RSLinearGradientBlurPara> RSProperties::GetLinearGradientBlurPara() const
const std::shared_ptr<RSLinearGradientBlurPara>& RSProperties::GetLinearGradientBlurPara() const
{
return linearGradientBlurPara_;
}
std::shared_ptr<RSFilter> RSProperties::GetFilter() const
const std::shared_ptr<RSFilter>& RSProperties::GetFilter() const
{
return filter_;
}

View File

@ -13,9 +13,12 @@
* limitations under the License.
*/
#include "common/rs_common_def.h"
#include "render/rs_blur_filter.h"
#include "src/core/SkOpts.h"
#include "common/rs_common_def.h"
#ifndef USE_ROSEN_DRAWING
#if defined(NEW_SKIA)
#include "include/core/SkTileMode.h"
@ -24,6 +27,7 @@
#include "include/effects/SkBlurImageFilter.h"
#endif
#endif
namespace OHOS {
namespace Rosen {
#ifndef USE_ROSEN_DRAWING
@ -33,6 +37,10 @@ RSBlurFilter::RSBlurFilter(float blurRadiusX, float blurRadiusY): RSSkiaFilter(S
blurRadiusY_(blurRadiusY)
{
type_ = FilterType::BLUR;
hash_ = SkOpts::hash(&type_, sizeof(type_), 0);
hash_ = SkOpts::hash(&blurRadiusX, sizeof(blurRadiusX), hash_);
hash_ = SkOpts::hash(&blurRadiusY, sizeof(blurRadiusY), hash_);
}
#else
RSBlurFilter::RSBlurFilter(float blurRadiusX, float blurRadiusY): RSSkiaFilter(SkBlurImageFilter::Make(blurRadiusX,
@ -40,6 +48,10 @@ RSBlurFilter::RSBlurFilter(float blurRadiusX, float blurRadiusY): RSSkiaFilter(S
blurRadiusY_(blurRadiusY)
{
type_ = FilterType::BLUR;
hash_ = SkOpts::hash(&type_, sizeof(type_), 0);
hash_ = SkOpts::hash(&blurRadiusX, sizeof(blurRadiusX), hash_);
hash_ = SkOpts::hash(&blurRadiusY, sizeof(blurRadiusY), hash_);
}
#endif
#else
@ -49,10 +61,14 @@ RSBlurFilter::RSBlurFilter(float blurRadiusX, float blurRadiusY) : RSDrawingFilt
blurRadiusY_(blurRadiusY)
{
type_ = FilterType::BLUR;
hash_ = SkOpts::hash(&type_, sizeof(type_), 0);
hash_ = SkOpts::hash(&blurRadiusX, sizeof(blurRadiusX), hash_);
hash_ = SkOpts::hash(&blurRadiusY, sizeof(blurRadiusY), hash_);
}
#endif
RSBlurFilter::~RSBlurFilter() {}
RSBlurFilter::~RSBlurFilter() = default;
float RSBlurFilter::GetBlurRadiusX()
{
@ -79,18 +95,20 @@ bool RSBlurFilter::IsValid() const
}
#ifndef USE_ROSEN_DRAWING
std::shared_ptr<RSSkiaFilter> RSBlurFilter::Compose(const std::shared_ptr<RSSkiaFilter>& inner)
std::shared_ptr<RSSkiaFilter> RSBlurFilter::Compose(const std::shared_ptr<RSSkiaFilter>& other) const
#else
std::shared_ptr<RSDrawingFilter> RSBlurFilter::Compose(const std::shared_ptr<RSDrawingFilter>& inner)
std::shared_ptr<RSDrawingFilter> RSBlurFilter::Compose(const std::shared_ptr<RSDrawingFilter>& other) const
#endif
{
std::shared_ptr<RSBlurFilter> blur = std::make_shared<RSBlurFilter>(blurRadiusX_, blurRadiusY_);
std::shared_ptr<RSBlurFilter> result = std::make_shared<RSBlurFilter>(blurRadiusX_, blurRadiusY_);
#ifndef USE_ROSEN_DRAWING
blur->imageFilter_ = SkImageFilters::Compose(imageFilter_, inner->GetImageFilter());
result->imageFilter_ = SkImageFilters::Compose(imageFilter_, other->GetImageFilter());
#else
blur->imageFilter_ = Drawing::ImageFilter::CreateComposeImageFilter(imageFilter_, inner->GetImageFilter());
result->imageFilter_ = Drawing::ImageFilter::CreateComposeImageFilter(imageFilter_, other->GetImageFilter());
#endif
return blur;
auto otherHash = other->Hash();
result->hash_ = SkOpts::hash(&otherHash, sizeof(otherHash), hash_);
return result;
}
std::shared_ptr<RSFilter> RSBlurFilter::Add(const std::shared_ptr<RSFilter>& rhs)

View File

@ -13,6 +13,8 @@
* limitations under the License.
*/
#include "render/rs_light_up_effect_filter.h"
#include "src/core/SkOpts.h"
#ifdef USE_ROSEN_DRAWING
#include "effect/color_matrix.h"
#endif
@ -27,7 +29,10 @@ RSLightUpEffectFilter::RSLightUpEffectFilter(float lightUpDegree)
#endif
lightUpDegree_(lightUpDegree)
{
type_ = FilterType::LIGHTUPEFFECT;
type_ = FilterType::LIGHT_UP_EFFECT;
hash_ = SkOpts::hash(&type_, sizeof(type_), 0);
hash_ = SkOpts::hash(&lightUpDegree_, sizeof(lightUpDegree_), hash_);
}
RSLightUpEffectFilter::~RSLightUpEffectFilter() = default;
@ -75,23 +80,25 @@ std::string RSLightUpEffectFilter::GetDescription()
}
#ifndef USE_ROSEN_DRAWING
std::shared_ptr<RSSkiaFilter> RSLightUpEffectFilter::Compose(const std::shared_ptr<RSSkiaFilter>& inner)
std::shared_ptr<RSSkiaFilter> RSLightUpEffectFilter::Compose(const std::shared_ptr<RSSkiaFilter>& other) const
#else
std::shared_ptr<RSDrawingFilter> RSLightUpEffectFilter::Compose(const std::shared_ptr<RSDrawingFilter>& inner)
std::shared_ptr<RSDrawingFilter> RSLightUpEffectFilter::Compose(const std::shared_ptr<RSDrawingFilter>& other) const
#endif
{
std::shared_ptr<RSLightUpEffectFilter> lightUp = std::make_shared<RSLightUpEffectFilter>(lightUpDegree_);
std::shared_ptr<RSLightUpEffectFilter> result = std::make_shared<RSLightUpEffectFilter>(lightUpDegree_);
#ifndef USE_ROSEN_DRAWING
lightUp->imageFilter_ = SkImageFilters::Compose(imageFilter_, inner->GetImageFilter());
result->imageFilter_ = SkImageFilters::Compose(imageFilter_, other->GetImageFilter());
#else
lightUp->imageFilter_ = Drawing::ImageFilter::CreateComposeImageFilter(imageFilter_, inner->GetImageFilter());
result->imageFilter_ = Drawing::ImageFilter::CreateComposeImageFilter(imageFilter_, other->GetImageFilter());
#endif
return lightUp;
auto otherHash = other->Hash();
result->hash_ = SkOpts::hash(&otherHash, sizeof(otherHash), hash_);
return result;
}
std::shared_ptr<RSFilter> RSLightUpEffectFilter::Add(const std::shared_ptr<RSFilter>& rhs)
{
if ((rhs == nullptr) || (rhs->GetFilterType() != FilterType::LIGHTUPEFFECT)) {
if ((rhs == nullptr) || (rhs->GetFilterType() != FilterType::LIGHT_UP_EFFECT)) {
return shared_from_this();
}
auto lightUpFilter = std::static_pointer_cast<RSLightUpEffectFilter>(rhs);
@ -100,7 +107,7 @@ std::shared_ptr<RSFilter> RSLightUpEffectFilter::Add(const std::shared_ptr<RSFil
std::shared_ptr<RSFilter> RSLightUpEffectFilter::Sub(const std::shared_ptr<RSFilter>& rhs)
{
if ((rhs == nullptr) || (rhs->GetFilterType() != FilterType::LIGHTUPEFFECT)) {
if ((rhs == nullptr) || (rhs->GetFilterType() != FilterType::LIGHT_UP_EFFECT)) {
return shared_from_this();
}
auto lightUpFilter = std::static_pointer_cast<RSLightUpEffectFilter>(rhs);

View File

@ -16,6 +16,12 @@
#include <unordered_map>
#include "src/core/SkOpts.h"
#include "common/rs_common_def.h"
#include "pipeline/rs_paint_filter_canvas.h"
#include "property/rs_properties_painter.h"
#if defined(NEW_SKIA)
#include "include/effects/SkImageFilters.h"
#include "include/core/SkTileMode.h"
@ -23,10 +29,6 @@
#include "include/effects/SkBlurImageFilter.h"
#endif
#include "common/rs_common_def.h"
#include "pipeline/rs_paint_filter_canvas.h"
#include "property/rs_properties_painter.h"
namespace OHOS {
namespace Rosen {
namespace {
@ -61,6 +63,11 @@ RSMaterialFilter::RSMaterialFilter(int style, float dipScale, BLUR_COLOR_MODE mo
{
imageFilter_ = RSMaterialFilter::CreateMaterialStyle(static_cast<MATERIAL_BLUR_STYLE>(style), dipScale, ratio);
type_ = FilterType::MATERIAL;
hash_ = SkOpts::hash(&type_, sizeof(type_), 0);
hash_ = SkOpts::hash(&style, sizeof(style), hash_);
hash_ = SkOpts::hash(&colorMode_, sizeof(colorMode_), hash_);
hash_ = SkOpts::hash(&ratio, sizeof(ratio), hash_);
}
RSMaterialFilter::RSMaterialFilter(MaterialParam materialParam, BLUR_COLOR_MODE mode)
@ -74,6 +81,10 @@ RSMaterialFilter::RSMaterialFilter(MaterialParam materialParam, BLUR_COLOR_MODE
imageFilter_ = RSMaterialFilter::CreateMaterialFilter(
materialParam.radius, materialParam.saturation, materialParam.brightness);
type_ = FilterType::MATERIAL;
hash_ = SkOpts::hash(&type_, sizeof(type_), 0);
hash_ = SkOpts::hash(&materialParam, sizeof(materialParam), hash_);
hash_ = SkOpts::hash(&colorMode_, sizeof(colorMode_), hash_);
}
RSMaterialFilter::~RSMaterialFilter() = default;
@ -94,22 +105,24 @@ std::string RSMaterialFilter::GetDescription()
}
#ifndef USE_ROSEN_DRAWING
std::shared_ptr<RSSkiaFilter> RSMaterialFilter::Compose(const std::shared_ptr<RSSkiaFilter>& inner)
std::shared_ptr<RSSkiaFilter> RSMaterialFilter::Compose(const std::shared_ptr<RSSkiaFilter>& other) const
#else
std::shared_ptr<RSDrawingFilter> RSMaterialFilter::Compose(const std::shared_ptr<RSDrawingFilter>& inner)
std::shared_ptr<RSDrawingFilter> RSMaterialFilter::Compose(const std::shared_ptr<RSDrawingFilter>& inner) const
#endif
{
if (inner == nullptr) {
if (other == nullptr) {
return nullptr;
}
MaterialParam materialParam = {radius_, saturation_, brightness_, maskColor_};
std::shared_ptr<RSMaterialFilter> material = std::make_shared<RSMaterialFilter>(materialParam, colorMode_);
std::shared_ptr<RSMaterialFilter> result = std::make_shared<RSMaterialFilter>(materialParam, colorMode_);
#ifndef USE_ROSEN_DRAWING
material->imageFilter_ = SkImageFilters::Compose(imageFilter_, inner->GetImageFilter());
result->imageFilter_ = SkImageFilters::Compose(imageFilter_, other->GetImageFilter());
#else
material->imageFilter_ = Drawing::ImageFilter::CreateComposeImageFilter(imageFilter_, inner->GetImageFilter());
result->imageFilter_ = Drawing::ImageFilter::CreateComposeImageFilter(imageFilter_, other->GetImageFilter());
#endif
return material;
auto otherHash = other->Hash();
result->hash_ = SkOpts::hash(&otherHash, sizeof(otherHash), hash_);
return result;
}
#ifndef USE_ROSEN_DRAWING
@ -218,7 +231,7 @@ void RSMaterialFilter::PostProcess(RSPaintFilterCanvas& canvas)
#endif
}
std::shared_ptr<RSFilter> RSMaterialFilter::TransformFilter(float fraction)
std::shared_ptr<RSFilter> RSMaterialFilter::TransformFilter(float fraction) const
{
MaterialParam materialParam;
materialParam.radius = radius_ * fraction;

View File

@ -51,8 +51,8 @@ HWTEST_F(RSMaterialFilterTest, CreateMaterialStyle001, TestSize.Level1)
EXPECT_EQ(rsMaterialFilter.GetImageFilter(), nullptr);
style = MATERIAL_BLUR_STYLE::STYLE_CARD_DARK;
rsMaterialFilter = RSMaterialFilter(style, dipScale, mode, ratio);
EXPECT_NE(rsMaterialFilter.GetImageFilter(), nullptr);
auto rsMaterialFilter2 = RSMaterialFilter(style, dipScale, mode, ratio);
EXPECT_NE(rsMaterialFilter2.GetImageFilter(), nullptr);
}
/**