[Impeller] some clang tidies in impeller (flutter/engine#48077)

Usage of Scalar/Vector/Half types is desgned around implicit conversions today: we don't specifically convert to the correct generated header types, since that will depend on the target platform. Instead we rely on implicit conversions to handle this - any mistake there would still lead to a compilation error.
This commit is contained in:
Jonah Williams
2023-11-15 10:26:53 -08:00
committed by GitHub
parent 65050f8ffc
commit 9978ca06a8
5 changed files with 17 additions and 5 deletions

View File

@@ -10,16 +10,16 @@ namespace impeller {
constexpr float kE = 2.7182818284590452354f;
// log_2 e
constexpr float kLog2_E = 1.4426950408889634074f;
constexpr float kLog2E = 1.4426950408889634074f;
// log_10 e
constexpr float kLog10_E = 0.43429448190325182765f;
constexpr float kLog10E = 0.43429448190325182765f;
// log_e 2
constexpr float klogE_2 = 0.69314718055994530942f;
constexpr float kLogE2 = 0.69314718055994530942f;
// log_e 10
constexpr float klogE_10 = 2.30258509299404568402f;
constexpr float kLogE10 = 2.30258509299404568402f;
// pi
constexpr float kPi = 3.14159265358979323846f;

View File

@@ -13,6 +13,8 @@
#include "impeller/geometry/scalar.h"
#include "impeller/geometry/vector.h"
// NOLINTBEGIN(google-explicit-constructor)
#ifdef FML_OS_WIN
using InternalHalf = uint16_t;
#else
@@ -185,4 +187,6 @@ inline std::ostream& operator<<(std::ostream& out,
return out;
}
// NOLINTEND(google-explicit-constructor)
} // namespace std

View File

@@ -12,6 +12,8 @@
namespace impeller {
// NOLINTBEGIN(google-explicit-constructor)
using Scalar = float;
template <class T, class = std::enable_if_t<std::is_arithmetic_v<T>>>
@@ -52,4 +54,6 @@ struct Degrees {
};
};
// NOLINTEND(google-explicit-constructor)
} // namespace impeller

View File

@@ -14,6 +14,8 @@
namespace impeller {
// NOLINTBEGIN(google-explicit-constructor)
struct Vector3 {
union {
struct {
@@ -324,4 +326,6 @@ inline std::ostream& operator<<(std::ostream& out, const impeller::Vector4& p) {
return out;
}
// NOLINTEND(google-explicit-constructor)
} // namespace std

View File

@@ -26,7 +26,7 @@ class CompressedImage {
protected:
const std::shared_ptr<const fml::Mapping> source_;
CompressedImage(std::shared_ptr<const fml::Mapping> allocation);
explicit CompressedImage(std::shared_ptr<const fml::Mapping> allocation);
};
} // namespace impeller