Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 3cfcdeb

Browse files
[Impeller] some clang tidies in impeller (#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.
1 parent 30327ea commit 3cfcdeb

File tree

5 files changed

+17
-5
lines changed

5 files changed

+17
-5
lines changed

impeller/geometry/constants.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ namespace impeller {
1010
constexpr float kE = 2.7182818284590452354f;
1111

1212
// log_2 e
13-
constexpr float kLog2_E = 1.4426950408889634074f;
13+
constexpr float kLog2E = 1.4426950408889634074f;
1414

1515
// log_10 e
16-
constexpr float kLog10_E = 0.43429448190325182765f;
16+
constexpr float kLog10E = 0.43429448190325182765f;
1717

1818
// log_e 2
19-
constexpr float klogE_2 = 0.69314718055994530942f;
19+
constexpr float kLogE2 = 0.69314718055994530942f;
2020

2121
// log_e 10
22-
constexpr float klogE_10 = 2.30258509299404568402f;
22+
constexpr float kLogE10 = 2.30258509299404568402f;
2323

2424
// pi
2525
constexpr float kPi = 3.14159265358979323846f;

impeller/geometry/half.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include "impeller/geometry/scalar.h"
1414
#include "impeller/geometry/vector.h"
1515

16+
// NOLINTBEGIN(google-explicit-constructor)
17+
1618
#ifdef FML_OS_WIN
1719
using InternalHalf = uint16_t;
1820
#else
@@ -185,4 +187,6 @@ inline std::ostream& operator<<(std::ostream& out,
185187
return out;
186188
}
187189

190+
// NOLINTEND(google-explicit-constructor)
191+
188192
} // namespace std

impeller/geometry/scalar.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
namespace impeller {
1414

15+
// NOLINTBEGIN(google-explicit-constructor)
16+
1517
using Scalar = float;
1618

1719
template <class T, class = std::enable_if_t<std::is_arithmetic_v<T>>>
@@ -52,4 +54,6 @@ struct Degrees {
5254
};
5355
};
5456

57+
// NOLINTEND(google-explicit-constructor)
58+
5559
} // namespace impeller

impeller/geometry/vector.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
namespace impeller {
1616

17+
// NOLINTBEGIN(google-explicit-constructor)
18+
1719
struct Vector3 {
1820
union {
1921
struct {
@@ -324,4 +326,6 @@ inline std::ostream& operator<<(std::ostream& out, const impeller::Vector4& p) {
324326
return out;
325327
}
326328

329+
// NOLINTEND(google-explicit-constructor)
330+
327331
} // namespace std

impeller/image/compressed_image.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class CompressedImage {
2626
protected:
2727
const std::shared_ptr<const fml::Mapping> source_;
2828

29-
CompressedImage(std::shared_ptr<const fml::Mapping> allocation);
29+
explicit CompressedImage(std::shared_ptr<const fml::Mapping> allocation);
3030
};
3131

3232
} // namespace impeller

0 commit comments

Comments
 (0)