Fix translationZ matrix computation

bug:14259972

Ensure that translationZ is applied for true3dTransform property
transformations, even if the node doesn't have any other
transformation properties set.

Additionally, use fuzzy compare for translationZ, similar to
rotationX/Y, since they're expenive to leave set in rounding error
cases.

Change-Id: Idafa4423cc7751a8f433237b1f576aa7abb74f6e
diff --git a/libs/hwui/RenderProperties.cpp b/libs/hwui/RenderProperties.cpp
index 58ec32d..a922db8 100644
--- a/libs/hwui/RenderProperties.cpp
+++ b/libs/hwui/RenderProperties.cpp
@@ -26,16 +26,7 @@
 #include <SkPathOps.h>
 
 #include "Matrix.h"
-
-/**
- * Convenience value to check for float values that are close enough to zero to be considered
- * zero.
- */
-#define NONZERO_EPSILON .001f
-
-static inline bool is_zero(float value) {
-    return (value >= -NONZERO_EPSILON) && (value <= NONZERO_EPSILON);
-}
+#include "utils/MathUtils.h"
 
 namespace android {
 namespace uirenderer {
@@ -151,7 +142,7 @@
         }
         SkMatrix* transform = mComputedFields.mTransformMatrix;
         transform->reset();
-        if (is_zero(getRotationX()) && is_zero(getRotationY())) {
+        if (MathUtils::isZero(getRotationX()) && MathUtils::isZero(getRotationY())) {
             transform->setTranslate(getTranslationX(), getTranslationY());
             transform->preRotate(getRotation(), getPivotX(), getPivotY());
             transform->preScale(getScaleX(), getScaleY(), getPivotX(), getPivotY());