remove fun operator overloads
Change-Id: I6ae2d5d1cbe2fc5d9d782aa96900acd5703080e9 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265757 Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
parent
1feceb3b97
commit
9262555222
@ -34,11 +34,11 @@ struct SkV3 {
|
||||
}
|
||||
friend SkV3 operator*(SkScalar s, const SkV3& v) { return v*s; }
|
||||
|
||||
SkScalar operator*(const SkV3& v) const { return Dot(*this, v); }
|
||||
SkV3 operator%(const SkV3& v) const { return Cross(*this, v); }
|
||||
|
||||
SkScalar lengthSquared() const { return Dot(*this, *this); }
|
||||
SkScalar length() const { return SkScalarSqrt(Dot(*this, *this)); }
|
||||
|
||||
SkScalar dot(const SkV3& v) const { return Dot(*this, v); }
|
||||
SkV3 cross(const SkV3& v) const { return Cross(*this, v); }
|
||||
};
|
||||
|
||||
struct SkV4 {
|
||||
|
@ -166,7 +166,7 @@ static SkV3 normalize(SkV3 v) { return v * (1.0f / v.length()); }
|
||||
static SkColorMatrix comput_planar_lighting(SkCanvas* canvas, SkV3 lightDir) {
|
||||
SkM44 l2w = canvas->experimental_getLocalToWorld();
|
||||
auto normal = normalize(l2w * SkV3{0, 0, 1});
|
||||
float dot = -normal * lightDir;
|
||||
float dot = -normal.dot(lightDir);
|
||||
|
||||
SkColorMatrix cm;
|
||||
if (dot < 0) {
|
||||
|
@ -1000,7 +1000,10 @@ DEF_TEST(M44_v3, reporter) {
|
||||
|
||||
REPORTER_ASSERT(reporter, a.lengthSquared() == 1 + 4 + 9);
|
||||
REPORTER_ASSERT(reporter, b.length() == 3);
|
||||
REPORTER_ASSERT(reporter, a * b == 1 + 4 + 6);
|
||||
REPORTER_ASSERT(reporter, a.dot(b) == 1 + 4 + 6);
|
||||
REPORTER_ASSERT(reporter, b.dot(a) == 1 + 4 + 6);
|
||||
REPORTER_ASSERT(reporter, (a.cross(b) == SkV3{-2, 1, 0}));
|
||||
REPORTER_ASSERT(reporter, (b.cross(a) == SkV3{ 2, -1, 0}));
|
||||
|
||||
SkM44 m = {
|
||||
2, 0, 0, 3,
|
||||
|
Loading…
Reference in New Issue
Block a user