mirror of
https://gitee.com/openharmony/graphic_graphic_2d
synced 2024-11-23 07:02:25 +00:00
回退 'Pull Request !9988 : RS新增PERSP通用几何属性'
This commit is contained in:
parent
f4e8fc3385
commit
781ded9c5b
@ -33,8 +33,6 @@ public:
|
||||
float scaleY_ { 1.0f };
|
||||
float skewX_ {0.0f};
|
||||
float skewY_ {0.0f};
|
||||
float perspX_ {0.0f};
|
||||
float perspY_ {0.0f};
|
||||
float rotation_ { 0.0f };
|
||||
float rotationX_ { 0.0f };
|
||||
float rotationY_ { 0.0f };
|
||||
@ -150,25 +148,6 @@ public:
|
||||
SetSkewX(x);
|
||||
SetSkewY(y);
|
||||
}
|
||||
void SetPerspX(float x)
|
||||
{
|
||||
if (!trans_) {
|
||||
trans_ = std::make_optional<Transform>();
|
||||
}
|
||||
trans_->perspX_ = x;
|
||||
}
|
||||
void SetPerspY(float y)
|
||||
{
|
||||
if (!trans_) {
|
||||
trans_ = std::make_optional<Transform>();
|
||||
}
|
||||
trans_->perspY_ = y;
|
||||
}
|
||||
void SetPersp(float x, float y)
|
||||
{
|
||||
SetPerspX(x);
|
||||
SetPerspY(y);
|
||||
}
|
||||
void SetRotation(float rotation)
|
||||
{
|
||||
if (!trans_) {
|
||||
@ -276,14 +255,6 @@ public:
|
||||
{
|
||||
return trans_ ? trans_->skewY_ : 0.f;
|
||||
}
|
||||
float GetPerspX() const
|
||||
{
|
||||
return trans_ ? trans_->perspX_ : 0.f;
|
||||
}
|
||||
float GetPerspY() const
|
||||
{
|
||||
return trans_ ? trans_->perspY_ : 0.f;
|
||||
}
|
||||
float GetRotation() const
|
||||
{
|
||||
return trans_ ? trans_->rotation_ : 0.f;
|
||||
|
@ -37,107 +37,106 @@ enum class RSModifierType : int16_t {
|
||||
CAMERA_DISTANCE, // 10
|
||||
SCALE, // 11
|
||||
SKEW, // 12
|
||||
PERSP, // 13
|
||||
TRANSLATE, // 14
|
||||
TRANSLATE_Z, // 15
|
||||
SUBLAYER_TRANSFORM, // 16
|
||||
CORNER_RADIUS, // 17
|
||||
ALPHA, // 18
|
||||
ALPHA_OFFSCREEN, // 19
|
||||
FOREGROUND_COLOR, // 20
|
||||
BACKGROUND_COLOR, // 21
|
||||
BACKGROUND_SHADER, // 22
|
||||
BG_IMAGE, // 23
|
||||
BG_IMAGE_INNER_RECT, // 24
|
||||
BG_IMAGE_WIDTH, // 25
|
||||
BG_IMAGE_HEIGHT, // 26
|
||||
BG_IMAGE_POSITION_X, // 27
|
||||
BG_IMAGE_POSITION_Y, // 28
|
||||
SURFACE_BG_COLOR, // 29
|
||||
BORDER_COLOR, // 30
|
||||
BORDER_WIDTH, // 31
|
||||
BORDER_STYLE, // 32
|
||||
FILTER, // 33
|
||||
BACKGROUND_FILTER, // 34
|
||||
LINEAR_GRADIENT_BLUR_PARA, // 35
|
||||
DYNAMIC_LIGHT_UP_RATE, // 36
|
||||
DYNAMIC_LIGHT_UP_DEGREE, // 37
|
||||
FRAME_GRAVITY, // 38
|
||||
CLIP_RRECT, // 39
|
||||
CLIP_BOUNDS, // 40
|
||||
CLIP_TO_BOUNDS, // 41
|
||||
CLIP_TO_FRAME, // 42
|
||||
VISIBLE, // 43
|
||||
SHADOW_COLOR, // 44
|
||||
SHADOW_OFFSET_X, // 45
|
||||
SHADOW_OFFSET_Y, // 46
|
||||
SHADOW_ALPHA, // 47
|
||||
SHADOW_ELEVATION, // 48
|
||||
SHADOW_RADIUS, // 49
|
||||
SHADOW_PATH, // 50
|
||||
SHADOW_MASK, // 51
|
||||
SHADOW_COLOR_STRATEGY, // 52
|
||||
MASK, // 53
|
||||
SPHERIZE, // 54
|
||||
LIGHT_UP_EFFECT, // 55
|
||||
PIXEL_STRETCH, // 56
|
||||
PIXEL_STRETCH_PERCENT, // 57
|
||||
USE_EFFECT, // 58
|
||||
COLOR_BLEND_MODE, // 59
|
||||
COLOR_BLEND_APPLY_TYPE, // 60
|
||||
SANDBOX, // 61
|
||||
GRAY_SCALE, // 62
|
||||
BRIGHTNESS, // 63
|
||||
CONTRAST, // 64
|
||||
SATURATE, // 65
|
||||
SEPIA, // 66
|
||||
INVERT, // 67
|
||||
AIINVERT, // 68
|
||||
SYSTEMBAREFFECT, // 69
|
||||
HUE_ROTATE, // 70
|
||||
COLOR_BLEND, // 71
|
||||
PARTICLE, // 72
|
||||
SHADOW_IS_FILLED, // 73
|
||||
OUTLINE_COLOR, // 74
|
||||
OUTLINE_WIDTH, // 75
|
||||
OUTLINE_STYLE, // 76
|
||||
OUTLINE_RADIUS, // 77
|
||||
USE_SHADOW_BATCHING, // 78
|
||||
GREY_COEF, // 79
|
||||
LIGHT_INTENSITY, // 80
|
||||
LIGHT_COLOR, // 81
|
||||
LIGHT_POSITION, // 82
|
||||
ILLUMINATED_BORDER_WIDTH, // 83
|
||||
ILLUMINATED_TYPE, // 84
|
||||
BLOOM, // 85
|
||||
PARTICLE_EMITTER_UPDATER, // 86
|
||||
FOREGROUND_EFFECT_RADIUS, // 87
|
||||
DYNAMIC_DIM_DEGREE, // 88
|
||||
BACKGROUND_BLUR_RADIUS, // 89
|
||||
BACKGROUND_BLUR_SATURATION, // 90
|
||||
BACKGROUND_BLUR_BRIGHTNESS, // 91
|
||||
BACKGROUND_BLUR_MASK_COLOR, // 92
|
||||
BACKGROUND_BLUR_COLOR_MODE, // 93
|
||||
BACKGROUND_BLUR_RADIUS_X, // 94
|
||||
BACKGROUND_BLUR_RADIUS_Y, // 95
|
||||
FOREGROUND_BLUR_RADIUS, // 96
|
||||
FOREGROUND_BLUR_SATURATION, // 97
|
||||
FOREGROUND_BLUR_BRIGHTNESS, // 98
|
||||
FOREGROUND_BLUR_MASK_COLOR, // 99
|
||||
FOREGROUND_BLUR_COLOR_MODE, // 100
|
||||
FOREGROUND_BLUR_RADIUS_X, // 101
|
||||
FOREGROUND_BLUR_RADIUS_Y, // 102
|
||||
CUSTOM, // 103
|
||||
EXTENDED, // 104
|
||||
TRANSITION, // 105
|
||||
BACKGROUND_STYLE, // 106
|
||||
CONTENT_STYLE, // 107
|
||||
FOREGROUND_STYLE, // 108
|
||||
OVERLAY_STYLE, // 109
|
||||
NODE_MODIFIER, // 110
|
||||
ENV_FOREGROUND_COLOR, // 111
|
||||
ENV_FOREGROUND_COLOR_STRATEGY, // 112
|
||||
GEOMETRYTRANS, // 113
|
||||
TRANSLATE, // 13
|
||||
TRANSLATE_Z, // 14
|
||||
SUBLAYER_TRANSFORM, // 15
|
||||
CORNER_RADIUS, // 16
|
||||
ALPHA, // 17
|
||||
ALPHA_OFFSCREEN, // 18
|
||||
FOREGROUND_COLOR, // 19
|
||||
BACKGROUND_COLOR, // 20
|
||||
BACKGROUND_SHADER, // 21
|
||||
BG_IMAGE, // 22
|
||||
BG_IMAGE_INNER_RECT, // 23
|
||||
BG_IMAGE_WIDTH, // 24
|
||||
BG_IMAGE_HEIGHT, // 25
|
||||
BG_IMAGE_POSITION_X, // 26
|
||||
BG_IMAGE_POSITION_Y, // 27
|
||||
SURFACE_BG_COLOR, // 28
|
||||
BORDER_COLOR, // 29
|
||||
BORDER_WIDTH, // 30
|
||||
BORDER_STYLE, // 31
|
||||
FILTER, // 32
|
||||
BACKGROUND_FILTER, // 33
|
||||
LINEAR_GRADIENT_BLUR_PARA, // 34
|
||||
DYNAMIC_LIGHT_UP_RATE, // 35
|
||||
DYNAMIC_LIGHT_UP_DEGREE, // 36
|
||||
FRAME_GRAVITY, // 37
|
||||
CLIP_RRECT, // 38
|
||||
CLIP_BOUNDS, // 39
|
||||
CLIP_TO_BOUNDS, // 40
|
||||
CLIP_TO_FRAME, // 41
|
||||
VISIBLE, // 42
|
||||
SHADOW_COLOR, // 43
|
||||
SHADOW_OFFSET_X, // 44
|
||||
SHADOW_OFFSET_Y, // 45
|
||||
SHADOW_ALPHA, // 46
|
||||
SHADOW_ELEVATION, // 47
|
||||
SHADOW_RADIUS, // 48
|
||||
SHADOW_PATH, // 49
|
||||
SHADOW_MASK, // 50
|
||||
SHADOW_COLOR_STRATEGY, // 51
|
||||
MASK, // 52
|
||||
SPHERIZE, // 53
|
||||
LIGHT_UP_EFFECT, // 54
|
||||
PIXEL_STRETCH, // 55
|
||||
PIXEL_STRETCH_PERCENT, // 56
|
||||
USE_EFFECT, // 57
|
||||
COLOR_BLEND_MODE, // 58
|
||||
COLOR_BLEND_APPLY_TYPE, // 59
|
||||
SANDBOX, // 60
|
||||
GRAY_SCALE, // 61
|
||||
BRIGHTNESS, // 62
|
||||
CONTRAST, // 63
|
||||
SATURATE, // 64
|
||||
SEPIA, // 65
|
||||
INVERT, // 66
|
||||
AIINVERT, // 67
|
||||
SYSTEMBAREFFECT, // 68
|
||||
HUE_ROTATE, // 69
|
||||
COLOR_BLEND, // 70
|
||||
PARTICLE, // 71
|
||||
SHADOW_IS_FILLED, // 72
|
||||
OUTLINE_COLOR, // 73
|
||||
OUTLINE_WIDTH, // 74
|
||||
OUTLINE_STYLE, // 75
|
||||
OUTLINE_RADIUS, // 76
|
||||
USE_SHADOW_BATCHING, // 77
|
||||
GREY_COEF, // 78
|
||||
LIGHT_INTENSITY, // 79
|
||||
LIGHT_COLOR, // 80
|
||||
LIGHT_POSITION, // 81
|
||||
ILLUMINATED_BORDER_WIDTH, // 82
|
||||
ILLUMINATED_TYPE, // 83
|
||||
BLOOM, // 84
|
||||
PARTICLE_EMITTER_UPDATER, // 85
|
||||
FOREGROUND_EFFECT_RADIUS, // 86
|
||||
DYNAMIC_DIM_DEGREE, // 87
|
||||
BACKGROUND_BLUR_RADIUS, // 88
|
||||
BACKGROUND_BLUR_SATURATION, // 89
|
||||
BACKGROUND_BLUR_BRIGHTNESS, // 90
|
||||
BACKGROUND_BLUR_MASK_COLOR, // 91
|
||||
BACKGROUND_BLUR_COLOR_MODE, // 92
|
||||
BACKGROUND_BLUR_RADIUS_X, // 93
|
||||
BACKGROUND_BLUR_RADIUS_Y, // 94
|
||||
FOREGROUND_BLUR_RADIUS, // 95
|
||||
FOREGROUND_BLUR_SATURATION, // 96
|
||||
FOREGROUND_BLUR_BRIGHTNESS, // 97
|
||||
FOREGROUND_BLUR_MASK_COLOR, // 98
|
||||
FOREGROUND_BLUR_COLOR_MODE, // 99
|
||||
FOREGROUND_BLUR_RADIUS_X, // 100
|
||||
FOREGROUND_BLUR_RADIUS_Y, // 101
|
||||
CUSTOM, // 102
|
||||
EXTENDED, // 103
|
||||
TRANSITION, // 104
|
||||
BACKGROUND_STYLE, // 105
|
||||
CONTENT_STYLE, // 106
|
||||
FOREGROUND_STYLE, // 107
|
||||
OVERLAY_STYLE, // 108
|
||||
NODE_MODIFIER, // 109
|
||||
ENV_FOREGROUND_COLOR, // 110
|
||||
ENV_FOREGROUND_COLOR_STRATEGY, // 111
|
||||
GEOMETRYTRANS, // 112
|
||||
MAX_RS_MODIFIER_TYPE,
|
||||
};
|
||||
|
||||
|
@ -46,8 +46,6 @@ DECLARE_ANIMATABLE_MODIFIER(Scale, Vector2f, SCALE, Multiply, Geometry, FINE)
|
||||
|
||||
DECLARE_ANIMATABLE_MODIFIER(Skew, Vector2f, SKEW, Add, Geometry, FINE)
|
||||
|
||||
DECLARE_ANIMATABLE_MODIFIER(Persp, Vector2f, PERSP, Add, Geometry, FINE)
|
||||
|
||||
DECLARE_ANIMATABLE_MODIFIER(Translate, Vector2f, TRANSLATE, Add, Geometry, LAYOUT)
|
||||
|
||||
DECLARE_ANIMATABLE_MODIFIER(TranslateZ, float, TRANSLATE_Z, Add, Geometry, LAYOUT)
|
||||
|
@ -141,13 +141,6 @@ public:
|
||||
float GetSkewX() const;
|
||||
float GetSkewY() const;
|
||||
|
||||
void SetPersp(Vector2f persp);
|
||||
void SetPerspX(float perspX);
|
||||
void SetPerspY(float perspY);
|
||||
Vector2f GetPersp() const;
|
||||
float GetPerspX() const;
|
||||
float GetPerspY() const;
|
||||
|
||||
void SetAlpha(float alpha);
|
||||
float GetAlpha() const;
|
||||
void SetAlphaOffscreen(bool alphaOffscreen);
|
||||
|
@ -165,37 +165,6 @@ namespace {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ApplyPerspToMatrix(const Transform& trans, Drawing::Matrix& m, bool preConcat)
|
||||
{
|
||||
if (!ROSEN_EQ(trans.perspX_, 0.f, EPSILON) || !ROSEN_EQ(trans.perspY_, 0.f, EPSILON)) {
|
||||
Drawing::Matrix perspM {};
|
||||
perspM.SetMatrix(1.f, 0.f, 0.f,
|
||||
0.f, 1.f, 0.f,
|
||||
trans.perspX_, trans.perspY_, 1.f);
|
||||
if (preConcat) {
|
||||
m = perspM * m;
|
||||
} else {
|
||||
m = m * perspM;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ApplyPerspToMatrix44(const Transform& trans, Drawing::Matrix44& m44, bool preConcat)
|
||||
{
|
||||
if (!ROSEN_EQ(trans.perspX_, 0.f, EPSILON) || !ROSEN_EQ(trans.perspY_, 0.f, EPSILON)) {
|
||||
Drawing::Matrix44 perspM44 {};
|
||||
perspM44.SetMatrix44RowMajor({1.f, 0.f, 0.f, 0.f,
|
||||
0.f, 1.f, 0.f, 0.f,
|
||||
0.f, 0.f, 1.f, 0.f,
|
||||
trans.perspX_, trans.perspY_, 0.f, 1.f});
|
||||
if (preConcat) {
|
||||
m44 = perspM44 * m44;
|
||||
} else {
|
||||
m44 = m44 * perspM44;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RSObjAbsGeometry::UpdateAbsMatrix2D()
|
||||
@ -203,12 +172,6 @@ void RSObjAbsGeometry::UpdateAbsMatrix2D()
|
||||
if (!trans_) {
|
||||
matrix_.PreTranslate(x_, y_);
|
||||
} else {
|
||||
// Persp
|
||||
if (!ROSEN_EQ(trans_->perspX_, 0.f, EPSILON) || !ROSEN_EQ(trans_->perspY_, 0.f, EPSILON)) {
|
||||
matrix_.PreTranslate(trans_->pivotX_ * width_, trans_->pivotY_ * height_);
|
||||
ApplyPerspToMatrix(trans_.value(), matrix_, false);
|
||||
matrix_.PreTranslate(-trans_->pivotX_ * width_, -trans_->pivotY_ * height_);
|
||||
}
|
||||
// Translate
|
||||
if ((x_ + trans_->translateX_ != 0) || (y_ + trans_->translateY_ != 0)) {
|
||||
matrix_.PreTranslate(x_ + trans_->translateX_, y_ + trans_->translateY_);
|
||||
@ -236,12 +199,9 @@ void RSObjAbsGeometry::UpdateAbsMatrix3D()
|
||||
// If the view has a non-identity quaternion, apply 3D transformations
|
||||
if (!trans_->quaternion_.IsIdentity()) {
|
||||
Drawing::Matrix44 matrix3D;
|
||||
// Pivot
|
||||
matrix3D.Translate(trans_->pivotX_ * width_, trans_->pivotY_ * height_, 0);
|
||||
// Persp
|
||||
ApplyPerspToMatrix44(trans_.value(), matrix3D, false);
|
||||
// Translate
|
||||
matrix3D.PreTranslate(x_ + trans_->translateX_, y_ + trans_->translateY_, z_ + trans_->translateZ_);
|
||||
matrix3D.Translate(trans_->pivotX_ * width_ + x_ + trans_->translateX_,
|
||||
trans_->pivotY_ * height_ + y_ + trans_->translateY_, z_ + trans_->translateZ_);
|
||||
// Rotate
|
||||
float x = trans_->quaternion_[0];
|
||||
float y = trans_->quaternion_[1];
|
||||
@ -298,17 +258,12 @@ void RSObjAbsGeometry::UpdateAbsMatrix3D()
|
||||
if (!ROSEN_EQ(trans_->scaleX_, 1.f) || !ROSEN_EQ(trans_->scaleY_, 1.f)) {
|
||||
matrix3D.PreScale(trans_->scaleX_, trans_->scaleY_);
|
||||
}
|
||||
// Pivot
|
||||
// Translate
|
||||
matrix3D.PreTranslate(-trans_->pivotX_ * width_, -trans_->pivotY_ * height_);
|
||||
|
||||
// Translate
|
||||
matrix3D.PostTranslate(x_ + trans_->translateX_, y_ + trans_->translateY_);
|
||||
// PostPersp
|
||||
ApplyPerspToMatrix(trans_.value(), matrix3D, true);
|
||||
// Pivot
|
||||
matrix3D.PostTranslate(trans_->pivotX_ * width_, trans_->pivotY_ * height_);
|
||||
|
||||
// Concatenate the 3D matrix with the 2D matrix
|
||||
matrix3D.PostTranslate(
|
||||
trans_->pivotX_ * width_ + x_ + trans_->translateX_, trans_->pivotY_ * height_ + y_ + trans_->translateY_);
|
||||
matrix_.PreConcat(matrix3D);
|
||||
}
|
||||
}
|
||||
|
@ -449,7 +449,6 @@ void RSSurfaceRenderNode::SetContextMatrix(const std::optional<Drawing::Matrix>&
|
||||
SetContentDirty();
|
||||
AddDirtyType(RSModifierType::SCALE);
|
||||
AddDirtyType(RSModifierType::SKEW);
|
||||
AddDirtyType(RSModifierType::PERSP);
|
||||
AddDirtyType(RSModifierType::TRANSLATE);
|
||||
if (!sendMsg) {
|
||||
return;
|
||||
|
@ -67,7 +67,6 @@ const std::array<ResetPropertyFunc, static_cast<int>(RSModifierType::CUSTOM)> g_
|
||||
[](RSProperties* prop) { prop->SetCameraDistance(0.f); }, // CAMERA_DISTANCE
|
||||
[](RSProperties* prop) { prop->SetScale(Vector2f(1.f, 1.f)); }, // SCALE
|
||||
[](RSProperties* prop) { prop->SetSkew(Vector2f(0.f, 0.f)); }, // SKEW
|
||||
[](RSProperties* prop) { prop->SetPersp(Vector2f(0.f, 0.f)); }, // PERSP
|
||||
[](RSProperties* prop) { prop->SetTranslate(Vector2f(0.f, 0.f)); }, // TRANSLATE
|
||||
[](RSProperties* prop) { prop->SetTranslateZ(0.f); }, // TRANSLATE_Z
|
||||
[](RSProperties* prop) { prop->SetSublayerTransform({}); }, // SUBLAYER_TRANSFORM
|
||||
@ -637,27 +636,6 @@ void RSProperties::SetSkewY(float skewY)
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
void RSProperties::SetPersp(Vector2f persp)
|
||||
{
|
||||
boundsGeo_->SetPersp(persp.x_, persp.y_);
|
||||
geoDirty_ = true;
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
void RSProperties::SetPerspX(float perspX)
|
||||
{
|
||||
boundsGeo_->SetPerspX(perspX);
|
||||
geoDirty_ = true;
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
void RSProperties::SetPerspY(float perspY)
|
||||
{
|
||||
boundsGeo_->SetPerspY(perspY);
|
||||
geoDirty_ = true;
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
void RSProperties::SetTranslate(Vector2f translate)
|
||||
{
|
||||
boundsGeo_->SetTranslateX(translate[0]);
|
||||
@ -742,21 +720,6 @@ Vector2f RSProperties::GetSkew() const
|
||||
return { boundsGeo_->GetSkewX(), boundsGeo_->GetSkewY() };
|
||||
}
|
||||
|
||||
float RSProperties::GetPerspX() const
|
||||
{
|
||||
return boundsGeo_->GetPerspX();
|
||||
}
|
||||
|
||||
float RSProperties::GetPerspY() const
|
||||
{
|
||||
return boundsGeo_->GetPerspY();
|
||||
}
|
||||
|
||||
Vector2f RSProperties::GetPersp() const
|
||||
{
|
||||
return { boundsGeo_->GetPerspX(), boundsGeo_->GetPerspY() };
|
||||
}
|
||||
|
||||
Vector2f RSProperties::GetTranslate() const
|
||||
{
|
||||
return Vector2f(GetTranslateX(), GetTranslateY());
|
||||
|
@ -72,7 +72,6 @@ static const std::unordered_map<RSModifierType, RSPropertyDrawableSlot> g_proper
|
||||
{ RSModifierType::CAMERA_DISTANCE, RSPropertyDrawableSlot::BOUNDS_MATRIX },
|
||||
{ RSModifierType::SCALE, RSPropertyDrawableSlot::BOUNDS_MATRIX },
|
||||
{ RSModifierType::SKEW, RSPropertyDrawableSlot::BOUNDS_MATRIX },
|
||||
{ RSModifierType::PERSP, RSPropertyDrawableSlot::BOUNDS_MATRIX },
|
||||
{ RSModifierType::TRANSLATE, RSPropertyDrawableSlot::BOUNDS_MATRIX },
|
||||
{ RSModifierType::TRANSLATE_Z, RSPropertyDrawableSlot::BOUNDS_MATRIX },
|
||||
{ RSModifierType::SUBLAYER_TRANSFORM, RSPropertyDrawableSlot::INVALID },
|
||||
|
@ -145,11 +145,6 @@ Vector2f RSModifierExtractor::GetSkew() const
|
||||
GET_PROPERTY_FROM_MODIFIERS(Vector2f, SKEW, Vector2f(0.f, 0.f), +=);
|
||||
}
|
||||
|
||||
Vector2f RSModifierExtractor::GetPersp() const
|
||||
{
|
||||
GET_PROPERTY_FROM_MODIFIERS(Vector2f, PERSP, Vector2f(0.f, 0.f), +=);
|
||||
}
|
||||
|
||||
float RSModifierExtractor::GetAlpha() const
|
||||
{
|
||||
GET_PROPERTY_FROM_MODIFIERS(float, ALPHA, 1.f, *=);
|
||||
|
@ -44,7 +44,6 @@ public:
|
||||
float GetTranslateZ() const;
|
||||
Vector2f GetScale() const;
|
||||
Vector2f GetSkew() const;
|
||||
Vector2f GetPersp() const;
|
||||
|
||||
float GetAlpha() const;
|
||||
bool GetAlphaOffscreen() const;
|
||||
|
@ -155,15 +155,6 @@ protected:
|
||||
std::shared_ptr<RSRenderModifier> CreateRenderModifier() const override;
|
||||
};
|
||||
|
||||
class RSC_EXPORT RSPerspModifier : public RSGeometryModifier {
|
||||
public:
|
||||
explicit RSPerspModifier(const std::shared_ptr<RSPropertyBase>& property);
|
||||
virtual ~RSPerspModifier() = default;
|
||||
protected:
|
||||
RSModifierType GetModifierType() const override;
|
||||
std::shared_ptr<RSRenderModifier> CreateRenderModifier() const override;
|
||||
};
|
||||
|
||||
class RSC_EXPORT RSTranslateModifier : public RSGeometryModifier {
|
||||
public:
|
||||
explicit RSTranslateModifier(const std::shared_ptr<RSPropertyBase>& property);
|
||||
|
@ -128,11 +128,6 @@ std::optional<Vector2f> RSShowingPropertiesFreezer::GetSkew() const
|
||||
return GetPropertyImpl<Vector2f, RSModifierType::SKEW>();
|
||||
}
|
||||
|
||||
std::optional<Vector2f> RSShowingPropertiesFreezer::GetPersp() const
|
||||
{
|
||||
return GetPropertyImpl<Vector2f, RSModifierType::PERSP>();
|
||||
}
|
||||
|
||||
std::optional<float> RSShowingPropertiesFreezer::GetAlpha() const
|
||||
{
|
||||
return GetPropertyImpl<float, RSModifierType::ALPHA>();
|
||||
|
@ -43,7 +43,6 @@ public:
|
||||
std::optional<float> GetTranslateZ() const;
|
||||
std::optional<Vector2f> GetScale() const;
|
||||
std::optional<Vector2f> GetSkew() const;
|
||||
std::optional<Vector2f> GetPersp() const;
|
||||
|
||||
std::optional<float> GetAlpha() const;
|
||||
std::optional<Vector4f> GetCornerRadius() const;
|
||||
|
@ -908,57 +908,6 @@ void RSNode::SetSkewY(float skewY)
|
||||
property->Set(skew);
|
||||
}
|
||||
|
||||
void RSNode::SetPersp(float persp)
|
||||
{
|
||||
SetPersp({ persp, persp });
|
||||
}
|
||||
|
||||
void RSNode::SetPersp(float perspX, float perspY)
|
||||
{
|
||||
SetPersp({ perspX, perspY });
|
||||
}
|
||||
|
||||
void RSNode::SetPersp(const Vector2f& persp)
|
||||
{
|
||||
SetProperty<RSPerspModifier, RSAnimatableProperty<Vector2f>>(RSModifierType::PERSP, persp);
|
||||
}
|
||||
|
||||
void RSNode::SetPerspX(float perspX)
|
||||
{
|
||||
std::unique_lock<std::recursive_mutex> lock(propertyMutex_);
|
||||
auto iter = propertyModifiers_.find(RSModifierType::PERSP);
|
||||
if (iter == propertyModifiers_.end()) {
|
||||
SetPersp(perspX, 0.f);
|
||||
return;
|
||||
}
|
||||
|
||||
auto property = std::static_pointer_cast<RSAnimatableProperty<Vector2f>>(iter->second->GetProperty());
|
||||
if (property == nullptr) {
|
||||
return;
|
||||
}
|
||||
auto persp = property->Get();
|
||||
persp.x_ = perspX;
|
||||
property->Set(persp);
|
||||
}
|
||||
|
||||
void RSNode::SetPerspY(float perspY)
|
||||
{
|
||||
std::unique_lock<std::recursive_mutex> lock(propertyMutex_);
|
||||
auto iter = propertyModifiers_.find(RSModifierType::PERSP);
|
||||
if (iter == propertyModifiers_.end()) {
|
||||
SetPersp(0.f, perspY);
|
||||
return;
|
||||
}
|
||||
|
||||
auto property = std::static_pointer_cast<RSAnimatableProperty<Vector2f>>(iter->second->GetProperty());
|
||||
if (property == nullptr) {
|
||||
return;
|
||||
}
|
||||
auto persp = property->Get();
|
||||
persp.y_ = perspY;
|
||||
property->Set(persp);
|
||||
}
|
||||
|
||||
// Set the foreground color of the control
|
||||
void RSNode::SetEnvForegroundColor(uint32_t colorValue)
|
||||
{
|
||||
|
@ -217,12 +217,6 @@ public:
|
||||
void SetSkewX(float skewX);
|
||||
void SetSkewY(float skewY);
|
||||
|
||||
void SetPersp(float persp);
|
||||
void SetPersp(float perspX, float perspY);
|
||||
void SetPersp(const Vector2f& persp);
|
||||
void SetPerspX(float perspX);
|
||||
void SetPerspY(float perspY);
|
||||
|
||||
void SetAlpha(float alpha);
|
||||
void SetAlphaOffscreen(bool alphaOffscreen);
|
||||
|
||||
|
@ -212,22 +212,6 @@ HWTEST_F(RSShowingPropertiesFreezerTest, GetSkewTest, TestSize.Level1)
|
||||
GTEST_LOG_(INFO) << "RSShowingPropertiesFreezerTest GetSkewTest end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetPerspTest
|
||||
* @tc.desc: Verify the GetPersp
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSShowingPropertiesFreezerTest, GetPerspTest, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "RSShowingPropertiesFreezerTest GetPerspTest start";
|
||||
auto canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPersp(Vector2f(SHOWING_FLOAT_NUM, 0.f));
|
||||
auto result = canvasNode->GetShowingProperties().GetPersp();
|
||||
EXPECT_TRUE(result.has_value());
|
||||
EXPECT_TRUE(result->x_ == SHOWING_FLOAT_NUM);
|
||||
GTEST_LOG_(INFO) << "RSShowingPropertiesFreezerTest GetPerspTest end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetAlphaTest
|
||||
* @tc.desc: Verify the GetAlpha
|
||||
|
@ -144,9 +144,6 @@ void RSPropertiesFuzzTestInner02(RSProperties& properties)
|
||||
float x10 = GetData<float>();
|
||||
float y10 = GetData<float>();
|
||||
Vector2f skew(x10, y10);
|
||||
float x11 = GetData<float>();
|
||||
float y11 = GetData<float>();
|
||||
Vector2f persp(x11, y11);
|
||||
float alpha = GetData<float>();
|
||||
bool alphaOffscreen = GetData<bool>();
|
||||
int16_t red1 = GetData<int16_t>();
|
||||
@ -177,8 +174,7 @@ void RSPropertiesFuzzTestInner02(RSProperties& properties)
|
||||
properties.SetTranslateY(translate);
|
||||
properties.SetTranslateZ(translate);
|
||||
properties.SetScale(scale);
|
||||
properties.SetSkew(skew);
|
||||
properties.SetPersp(persp);
|
||||
properties.SetScale(skew);
|
||||
properties.SetAlpha(alpha);
|
||||
properties.SetAlphaOffscreen(alphaOffscreen);
|
||||
properties.SetForegroundColor(color1);
|
||||
|
@ -20,9 +20,6 @@ using namespace testing;
|
||||
using namespace testing::ext;
|
||||
|
||||
namespace OHOS::Rosen {
|
||||
constexpr static float FLOAT_DATA_INIT = 0.5f;
|
||||
constexpr static float FLOAT_DATA_UPDATE = 1.0f;
|
||||
|
||||
class RSObjAbsGeometryTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase();
|
||||
@ -64,8 +61,6 @@ HWTEST_F(RSObjAbsGeometryTest, UpdateMatrix001, TestSize.Level1)
|
||||
float scaleY = 0.5f;
|
||||
float skewX = 0.5f;
|
||||
float skewY = 0.5f;
|
||||
float perspX = FLOAT_DATA_INIT;
|
||||
float perspY = FLOAT_DATA_INIT;
|
||||
rsObjAbsGeometry.SetRect(x, y, w, h);
|
||||
rsObjAbsGeometry.SetQuaternion(quaternion);
|
||||
rsObjAbsGeometry.SetRotationY(rotationY);
|
||||
@ -86,21 +81,16 @@ HWTEST_F(RSObjAbsGeometryTest, UpdateMatrix001, TestSize.Level1)
|
||||
rsObjAbsGeometry.UpdateMatrix(parent, std::nullopt, std::nullopt);
|
||||
rsObjAbsGeometry.SetSkewY(skewY);
|
||||
rsObjAbsGeometry.UpdateMatrix(parent, std::nullopt, std::nullopt);
|
||||
rsObjAbsGeometry.SetPerspX(perspX);
|
||||
rsObjAbsGeometry.UpdateMatrix(parent, std::nullopt, std::nullopt);
|
||||
rsObjAbsGeometry.SetPerspY(perspY);
|
||||
rsObjAbsGeometry.UpdateMatrix(parent, std::nullopt, std::nullopt);
|
||||
rsObjAbsGeometry.SetQuaternion(quaternion.Flip());
|
||||
rsObjAbsGeometry.UpdateMatrix(parent, std::nullopt, std::nullopt);
|
||||
scaleX = 1.f;
|
||||
scaleY = 1.f;
|
||||
skewX = 0.5f;
|
||||
skewY = 0.5f;
|
||||
perspX = FLOAT_DATA_UPDATE;
|
||||
perspY = FLOAT_DATA_UPDATE;
|
||||
rsObjAbsGeometry.SetScale(scaleX, scaleY);
|
||||
rsObjAbsGeometry.SetScale(scaleX, scaleY);
|
||||
rsObjAbsGeometry.SetSkew(skewX, skewY);
|
||||
rsObjAbsGeometry.SetPersp(perspX, perspY);
|
||||
rsObjAbsGeometry.SetSkew(skewX, skewY);
|
||||
rsObjAbsGeometry.UpdateMatrix(parent, std::nullopt, std::nullopt);
|
||||
rsObjAbsGeometry.SetContextMatrix(contextMatrix);
|
||||
rsObjAbsGeometry.UpdateMatrix(parent, std::nullopt, std::nullopt);
|
||||
|
@ -307,8 +307,6 @@ HWTEST_F(RSPropertiesTest, Dump001, TestSize.Level1)
|
||||
properties.SetScaleY(1.f);
|
||||
properties.SetSkewX(1.f);
|
||||
properties.SetSkewY(1.f);
|
||||
properties.SetPerspX(1.f);
|
||||
properties.SetPerspY(1.f);
|
||||
Color color1;
|
||||
properties.SetForegroundColor(color1);
|
||||
properties.SetBackgroundColor(color1);
|
||||
|
@ -104,7 +104,6 @@ void RSNodeFuzzTestInner01(std::shared_ptr<RSSurfaceNode> surfaceNode)
|
||||
Vector2f translate(GetData<float>(), GetData<float>());
|
||||
Vector2f scale(GetData<float>(), GetData<float>());
|
||||
Vector2f skew(GetData<float>(), GetData<float>());
|
||||
Vector2f persp(GetData<float>(), GetData<float>());
|
||||
|
||||
surfaceNode->SetBounds(bounds);
|
||||
surfaceNode->SetBounds(GetData<float>(), GetData<float>(), GetData<float>(), GetData<float>());
|
||||
@ -150,12 +149,6 @@ void RSNodeFuzzTestInner01(std::shared_ptr<RSSurfaceNode> surfaceNode)
|
||||
surfaceNode->SetSkewX(GetData<float>());
|
||||
surfaceNode->SetSkewY(GetData<float>());
|
||||
|
||||
surfaceNode->SetPersp(GetData<float>());
|
||||
surfaceNode->SetPersp(GetData<float>(), GetData<float>());
|
||||
surfaceNode->SetPersp(persp);
|
||||
surfaceNode->SetPerspX(GetData<float>());
|
||||
surfaceNode->SetPerspY(GetData<float>());
|
||||
|
||||
surfaceNode->SetAlpha(GetData<float>());
|
||||
surfaceNode->SetAlphaOffscreen(GetData<float>());
|
||||
}
|
||||
|
@ -26,8 +26,6 @@ using namespace testing;
|
||||
using namespace testing::ext;
|
||||
|
||||
namespace OHOS::Rosen {
|
||||
constexpr static float FLOAT_DATA_INIT = 0.5f;
|
||||
|
||||
class RSModifierTest : public testing::Test {
|
||||
public:
|
||||
constexpr static float floatData[] = {
|
||||
@ -537,48 +535,6 @@ HWTEST_F(RSModifierTest, SkewModifier002, TestSize.Level1)
|
||||
ASSERT_EQ(node->GetStagingProperties().GetSkew(), value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: PerspModifier001
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSModifierTest, PerspModifier001, TestSize.Level1)
|
||||
{
|
||||
auto value = Vector2f(FLOAT_DATA_INIT, FLOAT_DATA_INIT);
|
||||
auto prop = std::make_shared<RSAnimatableProperty<Vector2f>>(value);
|
||||
auto modifier = std::make_shared<RSPerspModifier>(prop);
|
||||
|
||||
auto node = RSCanvasNode::Create();
|
||||
node->AddModifier(modifier);
|
||||
ASSERT_TRUE(node != nullptr);
|
||||
ASSERT_EQ(node->GetStagingProperties().GetPersp(), value);
|
||||
|
||||
node->RemoveModifier(modifier);
|
||||
auto node1 = RSCanvasNode::Create();
|
||||
ASSERT_EQ(node->GetStagingProperties().GetPersp(), node1->GetStagingProperties().GetPersp());
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: PerspModifier002
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSModifierTest, PerspModifier002, TestSize.Level1)
|
||||
{
|
||||
auto value = Vector2f();
|
||||
auto prop = std::make_shared<RSAnimatableProperty<Vector2f>>(value);
|
||||
auto modifier = std::make_shared<RSPerspModifier>(prop);
|
||||
|
||||
auto node = RSCanvasNode::Create();
|
||||
node->AddModifier(modifier);
|
||||
ASSERT_TRUE(node != nullptr);
|
||||
ASSERT_EQ(node->GetStagingProperties().GetPersp(), value);
|
||||
|
||||
value = Vector2f(FLOAT_DATA_INIT, FLOAT_DATA_INIT);
|
||||
prop->Set(value);
|
||||
ASSERT_EQ(node->GetStagingProperties().GetPersp(), value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: TranslateModifier001
|
||||
* @tc.desc:
|
||||
|
@ -23,12 +23,6 @@ using namespace testing;
|
||||
using namespace testing::ext;
|
||||
|
||||
namespace OHOS::Rosen {
|
||||
constexpr static float FLOAT_DATA_ZERO = 0.0f;
|
||||
constexpr static float FLOAT_DATA_POSITIVE = 485.44f;
|
||||
constexpr static float FLOAT_DATA_NEGATIVE = -34.4f;
|
||||
constexpr static float FLOAT_DATA_MAX = std::numeric_limits<float>::max();
|
||||
constexpr static float FLOAT_DATA_MIN = std::numeric_limits<float>::min();
|
||||
|
||||
class RSCanvasNodeTest : public testing::Test {
|
||||
public:
|
||||
constexpr static float floatData[] = {
|
||||
@ -1256,191 +1250,6 @@ HWTEST_F(RSCanvasNodeTest, SetandGetSkewY005, TestSize.Level1)
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetSkew().y_, floatData[0]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPersp001
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSCanvasNodeTest, SetandGetPersp001, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPersp(FLOAT_DATA_POSITIVE);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().x_, FLOAT_DATA_POSITIVE));
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().y_, FLOAT_DATA_POSITIVE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPersp002
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSCanvasNodeTest, SetandGetPersp002, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPersp(FLOAT_DATA_NEGATIVE);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().x_, FLOAT_DATA_NEGATIVE));
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().y_, FLOAT_DATA_NEGATIVE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPersp003
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSCanvasNodeTest, SetandGetPersp003, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPersp(FLOAT_DATA_MAX);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().x_, FLOAT_DATA_MAX));
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().y_, FLOAT_DATA_MAX));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPersp004
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSCanvasNodeTest, SetandGetPersp004, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPersp(FLOAT_DATA_MAX, FLOAT_DATA_ZERO);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().x_, FLOAT_DATA_MAX));
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().y_, FLOAT_DATA_ZERO));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPersp0005
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSCanvasNodeTest, SetandGetPersp0005, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPersp(FLOAT_DATA_NEGATIVE, FLOAT_DATA_POSITIVE);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().x_, FLOAT_DATA_NEGATIVE));
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().y_, FLOAT_DATA_POSITIVE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPerspX001
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSCanvasNodeTest, SetandGetPerspX001, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPerspX(FLOAT_DATA_POSITIVE);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().x_, FLOAT_DATA_POSITIVE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPerspX002
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSCanvasNodeTest, SetandGetPerspX002, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPerspX(FLOAT_DATA_NEGATIVE);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().x_, FLOAT_DATA_NEGATIVE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPerspX003
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSCanvasNodeTest, SetandGetPerspX003, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPerspX(FLOAT_DATA_MAX);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().x_, FLOAT_DATA_MAX));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPerspX004
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSCanvasNodeTest, SetandGetPerspX004, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPerspX(FLOAT_DATA_MIN);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().x_, FLOAT_DATA_MIN));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPerspX005
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSCanvasNodeTest, SetandGetPerspX005, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPerspX(FLOAT_DATA_ZERO);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().x_, FLOAT_DATA_ZERO));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPerspY001
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSCanvasNodeTest, SetandGetPerspY001, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPerspY(FLOAT_DATA_POSITIVE);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().y_, FLOAT_DATA_POSITIVE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPerspY002
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSCanvasNodeTest, SetandGetPerspY002, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPerspY(FLOAT_DATA_NEGATIVE);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().y_, FLOAT_DATA_NEGATIVE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPerspY003
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSCanvasNodeTest, SetandGetPerspY003, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPerspY(FLOAT_DATA_MAX);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().y_, FLOAT_DATA_MAX));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPerspY004
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSCanvasNodeTest, SetandGetPerspY004, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPerspY(FLOAT_DATA_MIN);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().y_, FLOAT_DATA_MIN));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPerspY005
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSCanvasNodeTest, SetandGetPerspY005, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPerspY(FLOAT_DATA_ZERO);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().y_, FLOAT_DATA_ZERO));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetAlpha001
|
||||
* @tc.desc:
|
||||
|
@ -29,14 +29,6 @@ using namespace testing;
|
||||
using namespace testing::ext;
|
||||
|
||||
namespace OHOS::Rosen {
|
||||
constexpr static float FLOAT_DATA_ZERO = 0.0f;
|
||||
constexpr static float FLOAT_DATA_POSITIVE = 485.44f;
|
||||
constexpr static float FLOAT_DATA_NEGATIVE = -34.4f;
|
||||
constexpr static float FLOAT_DATA_MAX = std::numeric_limits<float>::max();
|
||||
constexpr static float FLOAT_DATA_MIN = std::numeric_limits<float>::min();
|
||||
constexpr static float FLOAT_DATA_INIT = 0.5f;
|
||||
constexpr static float FLOAT_DATA_UPDATE = 1.0f;
|
||||
|
||||
class RSNodeTest : public testing::Test {
|
||||
public:
|
||||
constexpr static float floatData[] = {
|
||||
@ -1308,191 +1300,6 @@ HWTEST_F(RSNodeTest, SetandGetSkewY005, TestSize.Level1)
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetSkew().y_, floatData[0]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPersp001
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSNodeTest, SetandGetPersp001, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPersp(FLOAT_DATA_POSITIVE);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().x_, FLOAT_DATA_POSITIVE));
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().y_, FLOAT_DATA_POSITIVE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPersp002
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSNodeTest, SetandGetPersp002, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPersp(FLOAT_DATA_NEGATIVE);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().x_, FLOAT_DATA_NEGATIVE));
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().y_, FLOAT_DATA_NEGATIVE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPersp003
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSNodeTest, SetandGetPersp003, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPersp(FLOAT_DATA_MAX);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().x_, FLOAT_DATA_MAX));
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().y_, FLOAT_DATA_MAX));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPersp004
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSNodeTest, SetandGetPersp004, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPersp(FLOAT_DATA_MAX, FLOAT_DATA_ZERO);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().x_, FLOAT_DATA_MAX));
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().y_, FLOAT_DATA_ZERO));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPersp0005
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSNodeTest, SetandGetPersp0005, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPersp(FLOAT_DATA_NEGATIVE, FLOAT_DATA_POSITIVE);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().x_, FLOAT_DATA_NEGATIVE));
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().y_, FLOAT_DATA_POSITIVE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPerspX001
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSNodeTest, SetandGetPerspX001, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPerspX(FLOAT_DATA_POSITIVE);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().x_, FLOAT_DATA_POSITIVE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPerspX002
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSNodeTest, SetandGetPerspX002, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPerspX(FLOAT_DATA_NEGATIVE);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().x_, FLOAT_DATA_NEGATIVE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPerspX003
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSNodeTest, SetandGetPerspX003, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPerspX(FLOAT_DATA_MAX);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().x_, FLOAT_DATA_MAX));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPerspX004
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSNodeTest, SetandGetPerspX004, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPerspX(FLOAT_DATA_MIN);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().x_, FLOAT_DATA_MIN));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPerspX005
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSNodeTest, SetandGetPerspX005, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPerspX(FLOAT_DATA_ZERO);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().x_, FLOAT_DATA_ZERO));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPerspY001
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSNodeTest, SetandGetPerspY001, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPerspY(FLOAT_DATA_POSITIVE);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().y_, FLOAT_DATA_POSITIVE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPerspY002
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSNodeTest, SetandGetPerspY002, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPerspY(FLOAT_DATA_NEGATIVE);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().y_, FLOAT_DATA_NEGATIVE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPerspY003
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSNodeTest, SetandGetPerspY003, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPerspY(FLOAT_DATA_MAX);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().y_, FLOAT_DATA_MAX));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPerspY004
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSNodeTest, SetandGetPerspY004, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPerspY(FLOAT_DATA_MIN);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().y_, FLOAT_DATA_MIN));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetPerspY005
|
||||
* @tc.desc:
|
||||
* @tc.type:FUNC
|
||||
*/
|
||||
HWTEST_F(RSNodeTest, SetandGetPerspY005, TestSize.Level1)
|
||||
{
|
||||
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create();
|
||||
canvasNode->SetPerspY(FLOAT_DATA_ZERO);
|
||||
EXPECT_TRUE(ROSEN_EQ(canvasNode->GetStagingProperties().GetPersp().y_, FLOAT_DATA_ZERO));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetandGetAlphaOffscreen001
|
||||
* @tc.desc:
|
||||
@ -3613,11 +3420,8 @@ HWTEST_F(RSNodeTest, SetProperty001, TestSize.Level1)
|
||||
RSModifierType::TRANSLATE_Z, 45.f, 90.f);
|
||||
SetPropertyTest<RSScaleModifier, RSAnimatableProperty<Vector2f>, Vector2f>(
|
||||
RSModifierType::SCALE, Vector2f(0.f, 0.f), Vector2f(1.f, 1.f));
|
||||
SetPropertyTest<RSSkewModifier, RSAnimatableProperty<Vector2f>, Vector2f>(
|
||||
SetPropertyTest<RSScaleModifier, RSAnimatableProperty<Vector2f>, Vector2f>(
|
||||
RSModifierType::SKEW, Vector2f(1.f, 1.f), Vector2f(-1.f, -1.f));
|
||||
SetPropertyTest<RSPerspModifier, RSAnimatableProperty<Vector2f>, Vector2f>(
|
||||
RSModifierType::PERSP, Vector2f(FLOAT_DATA_INIT, FLOAT_DATA_INIT),
|
||||
Vector2f(FLOAT_DATA_UPDATE, FLOAT_DATA_UPDATE));
|
||||
SetPropertyTest<RSForegroundColorModifier, RSAnimatableProperty<Color>, Color>(
|
||||
RSModifierType::FOREGROUND_COLOR, Color(), Color(0xFF00FF00));
|
||||
SetPropertyTest<RSBackgroundColorModifier, RSAnimatableProperty<Color>, Color>(
|
||||
@ -3750,15 +3554,6 @@ HWTEST_F(RSNodeTest, SetModifier002, TestSize.Level1)
|
||||
ASSERT_EQ(node->GetStagingProperties().GetSkew(), value);
|
||||
node->RemoveModifier(modifier);
|
||||
}
|
||||
{
|
||||
auto value = Vector2f(FLOAT_DATA_INIT, FLOAT_DATA_INIT);
|
||||
auto prop = std::make_shared<RSAnimatableProperty<Vector2f>>(value);
|
||||
auto modifier = std::make_shared<RSPerspModifier>(prop);
|
||||
node->AddModifier(modifier);
|
||||
ASSERT_TRUE(node != nullptr);
|
||||
ASSERT_EQ(node->GetStagingProperties().GetPersp(), value);
|
||||
node->RemoveModifier(modifier);
|
||||
}
|
||||
|
||||
auto node1 = std::make_shared<MockRSNode>();
|
||||
node1->DumpNode(0);
|
||||
|
Loading…
Reference in New Issue
Block a user