remove SkScalarMul from public headers
BUG=skia: Review URL: https://codereview.chromium.org/132453008 git-svn-id: http://skia.googlecode.com/svn/trunk@13189 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
e8989578cd
commit
1a5e51f94e
@ -411,13 +411,13 @@ struct SK_API SkPoint {
|
||||
/** Returns the dot product of a and b, treating them as 2D vectors
|
||||
*/
|
||||
static SkScalar DotProduct(const SkPoint& a, const SkPoint& b) {
|
||||
return SkScalarMul(a.fX, b.fX) + SkScalarMul(a.fY, b.fY);
|
||||
return a.fX * b.fX + a.fY * b.fY;
|
||||
}
|
||||
|
||||
/** Returns the cross product of a and b, treating them as 2D vectors
|
||||
*/
|
||||
static SkScalar CrossProduct(const SkPoint& a, const SkPoint& b) {
|
||||
return SkScalarMul(a.fX, b.fY) - SkScalarMul(a.fY, b.fX);
|
||||
return a.fX * b.fY - a.fY * b.fX;
|
||||
}
|
||||
|
||||
SkScalar cross(const SkPoint& vec) const {
|
||||
@ -435,7 +435,7 @@ struct SK_API SkPoint {
|
||||
SkScalar distanceToSqd(const SkPoint& pt) const {
|
||||
SkScalar dx = fX - pt.fX;
|
||||
SkScalar dy = fY - pt.fY;
|
||||
return SkScalarMul(dx, dx) + SkScalarMul(dy, dy);
|
||||
return dx * dx + dy * dy;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -202,7 +202,7 @@ static inline bool SkScalarNearlyEqual(SkScalar x, SkScalar y,
|
||||
*/
|
||||
static inline SkScalar SkScalarInterp(SkScalar A, SkScalar B, SkScalar t) {
|
||||
SkASSERT(t >= 0 && t <= SK_Scalar1);
|
||||
return A + SkScalarMul(B - A, t);
|
||||
return A + (B - A) * t;
|
||||
}
|
||||
|
||||
/** Interpolate along the function described by (keys[length], values[length])
|
||||
|
@ -5,7 +5,6 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SkLightingImageFilter_DEFINED
|
||||
#define SkLightingImageFilter_DEFINED
|
||||
|
||||
@ -18,9 +17,7 @@ public:
|
||||
SkPoint3(SkScalar x, SkScalar y, SkScalar z)
|
||||
: fX(x), fY(y), fZ(z) {}
|
||||
SkScalar dot(const SkPoint3& other) const {
|
||||
return SkScalarMul(fX, other.fX)
|
||||
+ SkScalarMul(fY, other.fY)
|
||||
+ SkScalarMul(fZ, other.fZ);
|
||||
return fX * other.fX + fY * other.fY + fZ * other.fZ;
|
||||
}
|
||||
SkScalar maxComponent() const {
|
||||
return fX > fY ? (fX > fZ ? fX : fZ) : (fY > fZ ? fY : fZ);
|
||||
@ -28,14 +25,12 @@ public:
|
||||
void normalize() {
|
||||
// Small epsilon is added to prevent division by 0.
|
||||
SkScalar scale = SkScalarInvert(SkScalarSqrt(dot(*this)) + SK_ScalarNearlyZero);
|
||||
fX = SkScalarMul(fX, scale);
|
||||
fY = SkScalarMul(fY, scale);
|
||||
fZ = SkScalarMul(fZ, scale);
|
||||
fX = fX * scale;
|
||||
fY = fY * scale;
|
||||
fZ = fZ * scale;
|
||||
}
|
||||
SkPoint3 operator*(SkScalar scalar) const {
|
||||
return SkPoint3(SkScalarMul(fX, scalar),
|
||||
SkScalarMul(fY, scalar),
|
||||
SkScalarMul(fZ, scalar));
|
||||
return SkPoint3(fX * scalar, fY * scalar, fZ * scalar);
|
||||
}
|
||||
SkPoint3 operator-(const SkPoint3& other) const {
|
||||
return SkPoint3(fX - other.fX, fY - other.fY, fZ - other.fZ);
|
||||
|
Loading…
Reference in New Issue
Block a user