Description: Fix the type conversion (precision) problem of iccarm compilation error

IssueNo: https://gitee.com/openharmony/graphic_utils/issues/I618VO
Feature or Bugfix: Bugfix
Binary Source: No
Signed-off-by: suwenxiang <suwenxiang@huawei.com>
This commit is contained in:
suwenxiang
2022-11-15 14:33:25 +08:00
parent 21657e16a3
commit d742e04185
4 changed files with 11 additions and 11 deletions
@@ -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);
@@ -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;
}
}
};
+5 -5
View File
@@ -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<T> Matrix4<T>::Shear(const Vector2<T>& shearX, const Vector2<T>& 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<int64_t>(f * 256.0 + ((f < 0) ? -0.5 : 0.5));
return static_cast<int64_t>(f * 256.0f + ((f < 0) ? -0.5f : 0.5f));
}
inline bool FloatEqual(float lhs, float rhs, float precision = 0.00001f)
+1 -1
View File
@@ -156,7 +156,7 @@ public:
if (reciprocal == 0) {
return VERTEX_DIST_EPSILON;
}
return 1.0 / reciprocal;
return 1.0f / reciprocal;
}
/**