diff --git a/interfaces/kits/gfx_utils/diagram/common/paint.h b/interfaces/kits/gfx_utils/diagram/common/paint.h index 8119ae8..1af0a64 100644 --- a/interfaces/kits/gfx_utils/diagram/common/paint.h +++ b/interfaces/kits/gfx_utils/diagram/common/paint.h @@ -811,7 +811,7 @@ public: { this->scaleRadioX_ *= scaleX; this->scaleRadioY_ *= scaleX; - if (rotateAngle_ > 0.0 || rotateAngle_ < 0) { + if (rotateAngle_ > 0.0f || rotateAngle_ < 0) { transfrom_.Rotate(-rotateAngle_ * PI / BOXER); transfrom_.Scale(scaleX, scaleY); transfrom_.Rotate(rotateAngle_ * PI / BOXER); diff --git a/interfaces/kits/gfx_utils/diagram/spancolorfill/fill_gradient_lut.h b/interfaces/kits/gfx_utils/diagram/spancolorfill/fill_gradient_lut.h index 6bb3649..090551e 100644 --- a/interfaces/kits/gfx_utils/diagram/spancolorfill/fill_gradient_lut.h +++ b/interfaces/kits/gfx_utils/diagram/spancolorfill/fill_gradient_lut.h @@ -145,11 +145,11 @@ private: ColorPoint(float offsetValue, const Rgba8T& colorValue) : offset(offsetValue), color(colorValue) { - if (offset < 0.0) { - offset = 0.0; + if (offset < 0.0f) { + offset = 0.0f; } - if (offset > 1.0) { - offset = 1.0; + if (offset > 1.0f) { + offset = 1.0f; } } }; diff --git a/interfaces/kits/gfx_utils/graphic_math.h b/interfaces/kits/gfx_utils/graphic_math.h index c4a707b..a4e9fea 100644 --- a/interfaces/kits/gfx_utils/graphic_math.h +++ b/interfaces/kits/gfx_utils/graphic_math.h @@ -57,9 +57,9 @@ namespace OHOS { */ #define MATH_MINUS(a, b) ((a) < (b) ? ((b) - (a)) : ((a) - (b))) -#define MATH_ROUND(x) ((x) > 0 ? (int16_t)((x) + 0.5) : (int16_t)((x) - 0.5)) +#define MATH_ROUND(x) ((x) > 0 ? (int16_t)((x) + 0.5f) : (int16_t)((x) - 0.5f)) -#define MATH_ROUND32(x) ((x) > 0 ? (int32_t)((x) + 0.5) : (int32_t)((x) - 0.5)) +#define MATH_ROUND32(x) ((x) > 0 ? (int32_t)((x) + 0.5f) : (int32_t)((x) - 0.5f)) #define MATH_UROUND MATH_ROUND32 @@ -945,16 +945,16 @@ Matrix4 Matrix4::Shear(const Vector2& shearX, const Vector2& shearY, inline int64_t FloatToInt64(float f) { - if (f > 127.0) { // 127.0: 2^7 + if (f > 127.0f) { // 127.0: 2^7 return 0x7FFF; } - if (f < -127.0) { // 127.0: 2^7 + if (f < -127.0f) { // 127.0: 2^7 return -0x7FFF; } // 256.0: 2^8 left move 8 bit. 0.5: round up - return static_cast(f * 256.0 + ((f < 0) ? -0.5 : 0.5)); + return static_cast(f * 256.0f + ((f < 0) ? -0.5f : 0.5f)); } inline bool FloatEqual(float lhs, float rhs, float precision = 0.00001f) diff --git a/interfaces/kits/gfx_utils/trans_affine.h b/interfaces/kits/gfx_utils/trans_affine.h index fd20b60..281629a 100644 --- a/interfaces/kits/gfx_utils/trans_affine.h +++ b/interfaces/kits/gfx_utils/trans_affine.h @@ -156,7 +156,7 @@ public: if (reciprocal == 0) { return VERTEX_DIST_EPSILON; } - return 1.0 / reciprocal; + return 1.0f / reciprocal; } /**