diff options
author | John Reck <jreck@google.com> | 2014-07-24 13:38:28 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2014-07-24 14:28:08 -0700 |
commit | 1aa5d2d7068147ff781cfe911a93f01593a68c79 (patch) | |
tree | 63d8676a5a062deb3a95caee0c5a39ce19471df2 /libs | |
parent | 71d34ec5bed6fe723cf5f85c1ffb64e0d9380967 (diff) | |
download | frameworks_base-1aa5d2d7068147ff781cfe911a93f01593a68c79.zip frameworks_base-1aa5d2d7068147ff781cfe911a93f01593a68c79.tar.gz frameworks_base-1aa5d2d7068147ff781cfe911a93f01593a68c79.tar.bz2 |
Fix ALL compile warnings
All warnings/errors fixed for GCC & Clang
Change-Id: I2ece3a136a5ae97a9acc3069537ed986238b5fd3
Diffstat (limited to 'libs')
-rw-r--r-- | libs/hwui/AmbientShadow.cpp | 4 | ||||
-rw-r--r-- | libs/hwui/LayerRenderer.h | 2 | ||||
-rwxr-xr-x | libs/hwui/OpenGLRenderer.cpp | 2 | ||||
-rw-r--r-- | libs/hwui/PathTessellator.cpp | 97 | ||||
-rw-r--r-- | libs/hwui/RenderNode.cpp | 3 | ||||
-rw-r--r-- | libs/hwui/ShadowTessellator.cpp | 17 | ||||
-rw-r--r-- | libs/hwui/SpotShadow.cpp | 6 | ||||
-rw-r--r-- | libs/hwui/TessellationCache.cpp | 6 | ||||
-rw-r--r-- | libs/hwui/Vector.h | 34 | ||||
-rw-r--r-- | libs/hwui/Vertex.h | 2 | ||||
-rw-r--r-- | libs/hwui/utils/MathUtils.h | 8 |
11 files changed, 77 insertions, 104 deletions
diff --git a/libs/hwui/AmbientShadow.cpp b/libs/hwui/AmbientShadow.cpp index 75cbfa1..181230a 100644 --- a/libs/hwui/AmbientShadow.cpp +++ b/libs/hwui/AmbientShadow.cpp @@ -97,9 +97,9 @@ void AmbientShadow::createAmbientShadow(bool isCasterOpaque, // calculate the normal N, which should be perpendicular to the edge of the // polygon (represented by the neighbor intersection points) . // Shadow's vertices will be generated as : P + N * scale. - const Vector2 centroid2d = Vector2(centroid3d.x, centroid3d.y); + const Vector2 centroid2d = {centroid3d.x, centroid3d.y}; for (int rayIndex = 0; rayIndex < rays; rayIndex++) { - Vector2 normal(1.0f, 0.0f); + Vector2 normal = {1.0f, 0.0f}; calculateNormal(rays, rayIndex, dir.array(), rayDist, normal); // The vertex should be start from rayDist[i] then scale the diff --git a/libs/hwui/LayerRenderer.h b/libs/hwui/LayerRenderer.h index 9202e49..bf7828c 100644 --- a/libs/hwui/LayerRenderer.h +++ b/libs/hwui/LayerRenderer.h @@ -49,7 +49,7 @@ public: LayerRenderer(RenderState& renderState, Layer* layer); virtual ~LayerRenderer(); - virtual void onViewportInitialized(int width, int height) { /* do nothing */ } + virtual void onViewportInitialized() { /* do nothing */ } virtual status_t prepareDirty(float left, float top, float right, float bottom, bool opaque); virtual status_t clear(float left, float top, float right, float bottom, bool opaque); virtual void finish(); diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 4f81066..64df6c8 100755 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -138,7 +138,7 @@ OpenGLRenderer::OpenGLRenderer(RenderState& renderState) , mRenderState(renderState) , mScissorOptimizationDisabled(false) , mCountOverdraw(false) - , mLightCenter(FLT_MIN, FLT_MIN, FLT_MIN) + , mLightCenter((Vector3){FLT_MIN, FLT_MIN, FLT_MIN}) , mLightRadius(FLT_MIN) , mAmbientShadowAlpha(0) , mSpotShadowAlpha(0) { diff --git a/libs/hwui/PathTessellator.cpp b/libs/hwui/PathTessellator.cpp index 804ec41..209341c 100644 --- a/libs/hwui/PathTessellator.cpp +++ b/libs/hwui/PathTessellator.cpp @@ -90,7 +90,7 @@ void PathTessellator::extractTessellationScales(const Matrix4& transform, * * NOTE: assumes angles between normals 90 degrees or less */ -inline static vec2 totalOffsetFromNormals(const vec2& normalA, const vec2& normalB) { +inline static Vector2 totalOffsetFromNormals(const Vector2& normalA, const Vector2& normalB) { return (normalA + normalB) / (1 + fabs(normalA.dot(normalB))); } @@ -129,7 +129,7 @@ public: float halfStrokeWidth; float maxAlpha; - inline void scaleOffsetForStrokeWidth(vec2& offset) const { + inline void scaleOffsetForStrokeWidth(Vector2& offset) const { if (halfStrokeWidth == 0.0f) { // hairline - compensate for scale offset.x *= 0.5f * inverseScaleX; @@ -143,9 +143,8 @@ public: * NOTE: the input will not always be a normal, especially for sharp edges - it should be the * result of totalOffsetFromNormals (see documentation there) */ - inline vec2 deriveAAOffset(const vec2& offset) const { - return vec2(offset.x * 0.5f * inverseScaleX, - offset.y * 0.5f * inverseScaleY); + inline Vector2 deriveAAOffset(const Vector2& offset) const { + return (Vector2){offset.x * 0.5f * inverseScaleX, offset.y * 0.5f * inverseScaleY}; } /** @@ -208,16 +207,14 @@ void getStrokeVerticesFromPerimeter(const PaintInfo& paintInfo, const Vector<Ver int currentIndex = 0; const Vertex* last = &(perimeter[perimeter.size() - 1]); const Vertex* current = &(perimeter[0]); - vec2 lastNormal(current->y - last->y, - last->x - current->x); + Vector2 lastNormal = {current->y - last->y, last->x - current->x}; lastNormal.normalize(); for (unsigned int i = 0; i < perimeter.size(); i++) { const Vertex* next = &(perimeter[i + 1 >= perimeter.size() ? 0 : i + 1]); - vec2 nextNormal(next->y - current->y, - current->x - next->x); + Vector2 nextNormal = {next->y - current->y, current->x - next->x}; nextNormal.normalize(); - vec2 totalOffset = totalOffsetFromNormals(lastNormal, nextNormal); + Vector2 totalOffset = totalOffsetFromNormals(lastNormal, nextNormal); paintInfo.scaleOffsetForStrokeWidth(totalOffset); Vertex::set(&buffer[currentIndex++], @@ -241,13 +238,14 @@ void getStrokeVerticesFromPerimeter(const PaintInfo& paintInfo, const Vector<Ver } static inline void storeBeginEnd(const PaintInfo& paintInfo, const Vertex& center, - const vec2& normal, Vertex* buffer, int& currentIndex, bool begin) { - vec2 strokeOffset = normal; + const Vector2& normal, Vertex* buffer, int& currentIndex, bool begin) { + Vector2 strokeOffset = normal; paintInfo.scaleOffsetForStrokeWidth(strokeOffset); - vec2 referencePoint(center.x, center.y); + Vector2 referencePoint = {center.x, center.y}; if (paintInfo.cap == SkPaint::kSquare_Cap) { - referencePoint += vec2(-strokeOffset.y, strokeOffset.x) * (begin ? -1 : 1); + Vector2 rotated = {-strokeOffset.y, strokeOffset.x}; + referencePoint += rotated * (begin ? -1 : 1); } Vertex::set(&buffer[currentIndex++], referencePoint + strokeOffset); @@ -288,14 +286,14 @@ void getStrokeVerticesFromUnclosedVertices(const PaintInfo& paintInfo, } beginTheta += dTheta; - vec2 beginRadialOffset(cos(beginTheta), sin(beginTheta)); + Vector2 beginRadialOffset = {cos(beginTheta), sin(beginTheta)}; paintInfo.scaleOffsetForStrokeWidth(beginRadialOffset); Vertex::set(&buffer[capOffset], vertices[0].x + beginRadialOffset.x, vertices[0].y + beginRadialOffset.y); endTheta += dTheta; - vec2 endRadialOffset(cos(endTheta), sin(endTheta)); + Vector2 endRadialOffset = {cos(endTheta), sin(endTheta)}; paintInfo.scaleOffsetForStrokeWidth(endRadialOffset); Vertex::set(&buffer[allocSize - 1 - capOffset], vertices[lastIndex].x + endRadialOffset.x, @@ -306,22 +304,20 @@ void getStrokeVerticesFromUnclosedVertices(const PaintInfo& paintInfo, int currentIndex = extra; const Vertex* last = &(vertices[0]); const Vertex* current = &(vertices[1]); - vec2 lastNormal(current->y - last->y, - last->x - current->x); + Vector2 lastNormal = {current->y - last->y, last->x - current->x}; lastNormal.normalize(); storeBeginEnd(paintInfo, vertices[0], lastNormal, buffer, currentIndex, true); for (unsigned int i = 1; i < vertices.size() - 1; i++) { const Vertex* next = &(vertices[i + 1]); - vec2 nextNormal(next->y - current->y, - current->x - next->x); + Vector2 nextNormal = {next->y - current->y, current->x - next->x}; nextNormal.normalize(); - vec2 strokeOffset = totalOffsetFromNormals(lastNormal, nextNormal); + Vector2 strokeOffset = totalOffsetFromNormals(lastNormal, nextNormal); paintInfo.scaleOffsetForStrokeWidth(strokeOffset); - vec2 center(current->x, current->y); + Vector2 center = {current->x, current->y}; Vertex::set(&buffer[currentIndex++], center + strokeOffset); Vertex::set(&buffer[currentIndex++], center - strokeOffset); @@ -353,18 +349,16 @@ void getFillVerticesFromPerimeterAA(const PaintInfo& paintInfo, const Vector<Ver int currentIndex = 0; const Vertex* last = &(perimeter[perimeter.size() - 1]); const Vertex* current = &(perimeter[0]); - vec2 lastNormal(current->y - last->y, - last->x - current->x); + Vector2 lastNormal = {current->y - last->y, last->x - current->x}; lastNormal.normalize(); for (unsigned int i = 0; i < perimeter.size(); i++) { const Vertex* next = &(perimeter[i + 1 >= perimeter.size() ? 0 : i + 1]); - vec2 nextNormal(next->y - current->y, - current->x - next->x); + Vector2 nextNormal = {next->y - current->y, current->x - next->x}; nextNormal.normalize(); // AA point offset from original point is that point's normal, such that each side is offset // by .5 pixels - vec2 totalOffset = paintInfo.deriveAAOffset(totalOffsetFromNormals(lastNormal, nextNormal)); + Vector2 totalOffset = paintInfo.deriveAAOffset(totalOffsetFromNormals(lastNormal, nextNormal)); AlphaVertex::set(&buffer[currentIndex++], current->x + totalOffset.x, @@ -407,7 +401,7 @@ void getFillVerticesFromPerimeterAA(const PaintInfo& paintInfo, const Vector<Ver * getStrokeVerticesFromUnclosedVerticesAA() below. */ inline static void storeCapAA(const PaintInfo& paintInfo, const Vector<Vertex>& vertices, - AlphaVertex* buffer, bool isFirst, vec2 normal, int offset) { + AlphaVertex* buffer, bool isFirst, Vector2 normal, int offset) { const int extra = paintInfo.capExtraDivisions(); const int extraOffset = (extra + 1) / 2; const int capIndex = isFirst @@ -416,27 +410,28 @@ inline static void storeCapAA(const PaintInfo& paintInfo, const Vector<Vertex>& if (isFirst) normal *= -1; // TODO: this normal should be scaled by radialScale if extra != 0, see totalOffsetFromNormals() - vec2 AAOffset = paintInfo.deriveAAOffset(normal); + Vector2 AAOffset = paintInfo.deriveAAOffset(normal); - vec2 strokeOffset = normal; + Vector2 strokeOffset = normal; paintInfo.scaleOffsetForStrokeWidth(strokeOffset); - vec2 outerOffset = strokeOffset + AAOffset; - vec2 innerOffset = strokeOffset - AAOffset; + Vector2 outerOffset = strokeOffset + AAOffset; + Vector2 innerOffset = strokeOffset - AAOffset; - vec2 capAAOffset; + Vector2 capAAOffset = {0, 0}; if (paintInfo.cap != SkPaint::kRound_Cap) { // if the cap is square or butt, the inside primary cap vertices will be inset in two // directions - both normal to the stroke, and parallel to it. - capAAOffset = vec2(-AAOffset.y, AAOffset.x); + capAAOffset = (Vector2){-AAOffset.y, AAOffset.x}; } // determine referencePoint, the center point for the 4 primary cap vertices const Vertex* point = isFirst ? vertices.begin() : (vertices.end() - 1); - vec2 referencePoint(point->x, point->y); + Vector2 referencePoint = {point->x, point->y}; if (paintInfo.cap == SkPaint::kSquare_Cap) { // To account for square cap, move the primary cap vertices (that create the AA edge) by the // stroke offset vector (rotated to be parallel to the stroke) - referencePoint += vec2(-strokeOffset.y, strokeOffset.x); + Vector2 rotated = {-strokeOffset.y, strokeOffset.x}; + referencePoint += rotated; } AlphaVertex::set(&buffer[capIndex + 0], @@ -469,7 +464,7 @@ inline static void storeCapAA(const PaintInfo& paintInfo, const Vector<Vertex>& for (int i = 0; i < extra; i++) { theta += dTheta; - vec2 radialOffset(cos(theta), sin(theta)); + Vector2 radialOffset = {cos(theta), sin(theta)}; // scale to compensate for pinching at sharp angles, see totalOffsetFromNormals() radialOffset *= radialScale; @@ -592,8 +587,7 @@ void getStrokeVerticesFromUnclosedVerticesAA(const PaintInfo& paintInfo, const Vertex* last = &(vertices[0]); const Vertex* current = &(vertices[1]); - vec2 lastNormal(current->y - last->y, - last->x - current->x); + Vector2 lastNormal = {current->y - last->y, last->x - current->x}; lastNormal.normalize(); // TODO: use normal from bezier traversal for cap, instead of from vertices @@ -601,16 +595,15 @@ void getStrokeVerticesFromUnclosedVerticesAA(const PaintInfo& paintInfo, for (unsigned int i = 1; i < vertices.size() - 1; i++) { const Vertex* next = &(vertices[i + 1]); - vec2 nextNormal(next->y - current->y, - current->x - next->x); + Vector2 nextNormal = {next->y - current->y, current->x - next->x}; nextNormal.normalize(); - vec2 totalOffset = totalOffsetFromNormals(lastNormal, nextNormal); - vec2 AAOffset = paintInfo.deriveAAOffset(totalOffset); + Vector2 totalOffset = totalOffsetFromNormals(lastNormal, nextNormal); + Vector2 AAOffset = paintInfo.deriveAAOffset(totalOffset); - vec2 innerOffset = totalOffset; + Vector2 innerOffset = totalOffset; paintInfo.scaleOffsetForStrokeWidth(innerOffset); - vec2 outerOffset = innerOffset + AAOffset; + Vector2 outerOffset = innerOffset + AAOffset; innerOffset -= AAOffset; AlphaVertex::set(&buffer[currentAAOuterIndex++], @@ -662,21 +655,19 @@ void getStrokeVerticesFromPerimeterAA(const PaintInfo& paintInfo, const Vector<V const Vertex* last = &(perimeter[perimeter.size() - 1]); const Vertex* current = &(perimeter[0]); - vec2 lastNormal(current->y - last->y, - last->x - current->x); + Vector2 lastNormal = {current->y - last->y, last->x - current->x}; lastNormal.normalize(); for (unsigned int i = 0; i < perimeter.size(); i++) { const Vertex* next = &(perimeter[i + 1 >= perimeter.size() ? 0 : i + 1]); - vec2 nextNormal(next->y - current->y, - current->x - next->x); + Vector2 nextNormal = {next->y - current->y, current->x - next->x}; nextNormal.normalize(); - vec2 totalOffset = totalOffsetFromNormals(lastNormal, nextNormal); - vec2 AAOffset = paintInfo.deriveAAOffset(totalOffset); + Vector2 totalOffset = totalOffsetFromNormals(lastNormal, nextNormal); + Vector2 AAOffset = paintInfo.deriveAAOffset(totalOffset); - vec2 innerOffset = totalOffset; + Vector2 innerOffset = totalOffset; paintInfo.scaleOffsetForStrokeWidth(innerOffset); - vec2 outerOffset = innerOffset + AAOffset; + Vector2 outerOffset = innerOffset + AAOffset; innerOffset -= AAOffset; AlphaVertex::set(&buffer[currentAAOuterIndex++], diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp index 3eb779f..b77b36f 100644 --- a/libs/hwui/RenderNode.cpp +++ b/libs/hwui/RenderNode.cpp @@ -836,7 +836,8 @@ void RenderNode::issueOperations(OpenGLRenderer& renderer, T& handler) { DisplayListLogBuffer& logBuffer = DisplayListLogBuffer::getInstance(); const int saveCountOffset = renderer.getSaveCount() - 1; const int projectionReceiveIndex = mDisplayListData->projectionReceiveIndex; - for (unsigned int i = 0; i < mDisplayListData->displayListOps.size(); i++) { + const int size = static_cast<int>(mDisplayListData->displayListOps.size()); + for (int i = 0; i < size; i++) { DisplayListOp *op = mDisplayListData->displayListOps[i]; #if DEBUG_DISPLAY_LIST diff --git a/libs/hwui/ShadowTessellator.cpp b/libs/hwui/ShadowTessellator.cpp index bcfda99..e71439d 100644 --- a/libs/hwui/ShadowTessellator.cpp +++ b/libs/hwui/ShadowTessellator.cpp @@ -172,7 +172,8 @@ Vector2 ShadowTessellator::centroid2d(const Vector2* poly, int polyLength) { Vector2 centroid = poly[0]; if (area != 0) { - centroid = Vector2(sumx / (3 * area), sumy / (3 * area)); + centroid = (Vector2){static_cast<float>(sumx / (3 * area)), + static_cast<float>(sumy / (3 * area))}; } else { ALOGW("Area is 0 while computing centroid!"); } @@ -212,19 +213,19 @@ bool ShadowTessellator::isClockwisePath(const SkPath& path) { while (SkPath::kDone_Verb != (v = iter.next(pts))) { switch (v) { case SkPath::kMove_Verb: - arrayForDirection.add(Vector2(pts[0].x(), pts[0].y())); + arrayForDirection.add((Vector2){pts[0].x(), pts[0].y()}); break; case SkPath::kLine_Verb: - arrayForDirection.add(Vector2(pts[1].x(), pts[1].y())); + arrayForDirection.add((Vector2){pts[1].x(), pts[1].y()}); break; case SkPath::kQuad_Verb: - arrayForDirection.add(Vector2(pts[1].x(), pts[1].y())); - arrayForDirection.add(Vector2(pts[2].x(), pts[2].y())); + arrayForDirection.add((Vector2){pts[1].x(), pts[1].y()}); + arrayForDirection.add((Vector2){pts[2].x(), pts[2].y()}); break; case SkPath::kCubic_Verb: - arrayForDirection.add(Vector2(pts[1].x(), pts[1].y())); - arrayForDirection.add(Vector2(pts[2].x(), pts[2].y())); - arrayForDirection.add(Vector2(pts[3].x(), pts[3].y())); + arrayForDirection.add((Vector2){pts[1].x(), pts[1].y()}); + arrayForDirection.add((Vector2){pts[2].x(), pts[2].y()}); + arrayForDirection.add((Vector2){pts[3].x(), pts[3].y()}); break; default: break; diff --git a/libs/hwui/SpotShadow.cpp b/libs/hwui/SpotShadow.cpp index 8a5e722..8c3077b 100644 --- a/libs/hwui/SpotShadow.cpp +++ b/libs/hwui/SpotShadow.cpp @@ -218,7 +218,7 @@ int SpotShadow::intersection(const Vector2* poly1, int poly1Length, // Since neither polygon fully contain the other one, we need to add all the // intersection points. - Vector2 intersection; + Vector2 intersection = {0, 0}; for (int i = 0; i < poly2Length; i++) { for (int j = 0; j < poly1Length; j++) { int poly2LineStart = i; @@ -250,7 +250,7 @@ int SpotShadow::intersection(const Vector2* poly1, int poly1Length, } // Sort the result polygon around the center. - Vector2 center(0.0f, 0.0f); + Vector2 center = {0.0f, 0.0f}; for (int i = 0; i < count; i++) { center += poly[i]; } @@ -557,7 +557,7 @@ void SpotShadow::computeSpotShadow(bool isCasterOpaque, const Vector3* lightPoly float x = lightPoly[j].x - ratioZ * (lightPoly[j].x - poly[i].x); float y = lightPoly[j].y - ratioZ * (lightPoly[j].y - poly[i].y); - Vector2 newPoint = Vector2(x, y); + Vector2 newPoint = {x, y}; shadowRegion[k] = newPoint; outline[m] = newPoint; diff --git a/libs/hwui/TessellationCache.cpp b/libs/hwui/TessellationCache.cpp index 343f1aa..c5fc21f 100644 --- a/libs/hwui/TessellationCache.cpp +++ b/libs/hwui/TessellationCache.cpp @@ -125,7 +125,7 @@ public: } }; -struct TessellationCache::Buffer { +class TessellationCache::Buffer { public: Buffer(const sp<Task<VertexBuffer*> >& task) : mTask(task) @@ -236,7 +236,7 @@ static void tessellateShadows( float maxZ = -FLT_MAX; for (int i = 0; i < casterVertexCount; i++) { const Vertex& point2d = casterVertices2d[i]; - casterPolygon[i] = Vector3(point2d.x, point2d.y, 0); + casterPolygon[i] = (Vector3){point2d.x, point2d.y, 0}; mapPointFakeZ(casterPolygon[i], casterTransformXY, casterTransformZ); minZ = fmin(minZ, casterPolygon[i].z); maxZ = fmax(maxZ, casterPolygon[i].z); @@ -246,7 +246,7 @@ static void tessellateShadows( Vector2 centroid = ShadowTessellator::centroid2d( reinterpret_cast<const Vector2*>(casterVertices2d.array()), casterVertexCount); - Vector3 centroid3d(centroid.x, centroid.y, 0); + Vector3 centroid3d = {centroid.x, centroid.y, 0}; mapPointFakeZ(centroid3d, casterTransformXY, casterTransformZ); // if the caster intersects the z=0 plane, lift it in Z so it doesn't diff --git a/libs/hwui/Vector.h b/libs/hwui/Vector.h index c61cb61..2a9f01c 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 diff --git a/libs/hwui/Vertex.h b/libs/hwui/Vertex.h index 5d7a199..4ff0b18 100644 --- a/libs/hwui/Vertex.h +++ b/libs/hwui/Vertex.h @@ -43,7 +43,7 @@ struct Vertex { vertex[0].y = y; } - static inline void set(Vertex* vertex, vec2 val) { + static inline void set(Vertex* vertex, Vector2 val) { set(vertex, val.x, val.y); } diff --git a/libs/hwui/utils/MathUtils.h b/libs/hwui/utils/MathUtils.h index 65f1663..2dfe9c6 100644 --- a/libs/hwui/utils/MathUtils.h +++ b/libs/hwui/utils/MathUtils.h @@ -19,19 +19,19 @@ namespace android { namespace uirenderer { +#define NON_ZERO_EPSILON (0.001f) + class MathUtils { -private: - static const float gNonZeroEpsilon = 0.001f; public: /** * Check for floats that are close enough to zero. */ inline static bool isZero(float value) { - return (value >= -gNonZeroEpsilon) && (value <= gNonZeroEpsilon); + return (value >= -NON_ZERO_EPSILON) && (value <= NON_ZERO_EPSILON); } inline static bool isPositive(float value) { - return value >= gNonZeroEpsilon; + return value >= NON_ZERO_EPSILON; } inline static bool areEqual(float valueA, float valueB) { |