summaryrefslogtreecommitdiff
path: root/libs/hwui/Vector.h
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2014-07-24 13:38:28 -0700
committerJohn Reck <jreck@google.com>2014-07-24 14:28:08 -0700
commit1aa5d2d7068147ff781cfe911a93f01593a68c79 (patch)
tree63d8676a5a062deb3a95caee0c5a39ce19471df2 /libs/hwui/Vector.h
parent71d34ec5bed6fe723cf5f85c1ffb64e0d9380967 (diff)
Fix ALL compile warnings
All warnings/errors fixed for GCC & Clang Change-Id: I2ece3a136a5ae97a9acc3069537ed986238b5fd3
Diffstat (limited to 'libs/hwui/Vector.h')
-rw-r--r--libs/hwui/Vector.h34
1 files changed, 7 insertions, 27 deletions
diff --git a/libs/hwui/Vector.h b/libs/hwui/Vector.h
index c61cb6183807..2a9f01ca06aa 100644
--- a/libs/hwui/Vector.h
+++ b/libs/hwui/Vector.h
@@ -24,18 +24,11 @@ namespace uirenderer {
// Classes
///////////////////////////////////////////////////////////////////////////////
+// MUST BE A POD - this means no ctor or dtor!
struct Vector2 {
float x;
float y;
- Vector2() :
- x(0.0f), y(0.0f) {
- }
-
- Vector2(float px, float py) :
- x(px), y(py) {
- }
-
float lengthSquared() const {
return x * x + y * y;
}
@@ -75,19 +68,19 @@ struct Vector2 {
}
Vector2 operator+(const Vector2& v) const {
- return Vector2(x + v.x, y + v.y);
+ return (Vector2){x + v.x, y + v.y};
}
Vector2 operator-(const Vector2& v) const {
- return Vector2(x - v.x, y - v.y);
+ return (Vector2){x - v.x, y - v.y};
}
Vector2 operator/(float s) const {
- return Vector2(x / s, y / s);
+ return (Vector2){x / s, y / s};
}
Vector2 operator*(float s) const {
- return Vector2(x * s, y * s);
+ return (Vector2){x * s, y * s};
}
void normalize() {
@@ -97,7 +90,7 @@ struct Vector2 {
}
Vector2 copyNormalized() const {
- Vector2 v(x, y);
+ Vector2 v = {x, y};
v.normalize();
return v;
}
@@ -111,31 +104,18 @@ struct Vector2 {
}
}; // class Vector2
+// MUST BE A POD - this means no ctor or dtor!
class Vector3 {
public:
float x;
float y;
float z;
- Vector3() :
- x(0.0f), y(0.0f), z(0.0f) {
- }
-
- Vector3(float px, float py, float pz) :
- x(px), y(py), z(pz) {
- }
-
void dump() {
ALOGD("Vector3[%.2f, %.2f, %.2f]", x, y, z);
}
};
-///////////////////////////////////////////////////////////////////////////////
-// Types
-///////////////////////////////////////////////////////////////////////////////
-
-typedef Vector2 vec2;
-
}; // namespace uirenderer
}; // namespace android