Loading libs/hwui/AmbientShadow.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -52,14 +52,14 @@ // If this is set to negative value, then all the edge will be tessellated. #define ALPHA_THRESHOLD (0.1f / 255.0f) #include <math.h> #include <utils/Log.h> #include "AmbientShadow.h" #include "ShadowTessellator.h" #include "Vertex.h" #include "VertexBuffer.h" #include "utils/MathUtils.h" #include <algorithm> #include <utils/Log.h> namespace android { namespace uirenderer { Loading @@ -78,7 +78,7 @@ inline Vector2 getNormalFromVertices(const Vector3* vertices, int current, int n // The input z value will be converted to be non-negative inside. // The output must be ranged from 0 to 1. inline float getAlphaFromFactoredZ(float factoredZ) { return 1.0 / (1 + MathUtils::max(factoredZ, 0.0f)); return 1.0 / (1 + std::max(factoredZ, 0.0f)); } // The shader is using gaussian function e^-(1-x)*(1-x)*4, therefore, we transform Loading libs/hwui/FontRenderer.cpp +6 −8 Original line number Diff line number Diff line Loading @@ -26,14 +26,12 @@ #include "Rect.h" #include "renderstate/RenderState.h" #include "utils/Blur.h" #include "utils/MathUtils.h" #include "utils/Timing.h" #include <algorithm> #include <cutils/properties.h> #include <SkGlyph.h> #include <SkUtils.h> #include <cutils/properties.h> #include <utils/Log.h> #ifdef ANDROID_ENABLE_RENDERSCRIPT Loading Loading @@ -118,10 +116,10 @@ FontRenderer::FontRenderer() uint32_t maxTextureSize = (uint32_t) Caches::getInstance().maxTextureSize; mSmallCacheWidth = MathUtils::min(mSmallCacheWidth, maxTextureSize); mSmallCacheHeight = MathUtils::min(mSmallCacheHeight, maxTextureSize); mLargeCacheWidth = MathUtils::min(mLargeCacheWidth, maxTextureSize); mLargeCacheHeight = MathUtils::min(mLargeCacheHeight, maxTextureSize); mSmallCacheWidth = std::min(mSmallCacheWidth, maxTextureSize); mSmallCacheHeight = std::min(mSmallCacheHeight, maxTextureSize); mLargeCacheWidth = std::min(mLargeCacheWidth, maxTextureSize); mLargeCacheHeight = std::min(mLargeCacheHeight, maxTextureSize); if (sLogFontRendererCreate) { INIT_LOGD(" Text cache sizes, in pixels: %i x %i, %i x %i, %i x %i, %i x %i", Loading libs/hwui/Interpolator.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -16,11 +16,11 @@ #include "Interpolator.h" #include <cmath> #include <cutils/log.h> #include "utils/MathUtils.h" #include <algorithm> #include <cutils/log.h> namespace android { namespace uirenderer { Loading Loading @@ -106,7 +106,7 @@ float LUTInterpolator::interpolate(float input) { weight = modff(lutpos, &ipart); int i1 = (int) ipart; int i2 = MathUtils::min(i1 + 1, (int) mSize - 1); int i2 = std::min(i1 + 1, (int) mSize - 1); LOG_ALWAYS_FATAL_IF(i1 < 0 || i2 < 0, "negatives in interpolation!" " i1=%d, i2=%d, input=%f, lutpos=%f, size=%zu, values=%p, ipart=%f, weight=%f", Loading libs/hwui/Patch.cpp +8 −8 Original line number Diff line number Diff line Loading @@ -14,16 +14,16 @@ * limitations under the License. */ #include <cmath> #include <utils/Log.h> #include "Patch.h" #include "Caches.h" #include "Patch.h" #include "Properties.h" #include "UvMapper.h" #include "utils/MathUtils.h" #include <algorithm> #include <utils/Log.h> namespace android { namespace uirenderer { Loading Loading @@ -189,10 +189,10 @@ void Patch::generateQuad(TextureVertex*& vertex, float x1, float y1, float x2, f const uint32_t oldQuadCount = quadCount; quadCount++; x1 = MathUtils::max(x1, 0.0f); x2 = MathUtils::max(x2, 0.0f); y1 = MathUtils::max(y1, 0.0f); y2 = MathUtils::max(y2, 0.0f); x1 = std::max(x1, 0.0f); x2 = std::max(x2, 0.0f); y1 = std::max(y1, 0.0f); y2 = std::max(y2, 0.0f); // Skip degenerate and transparent (empty) quads if ((mColors[oldQuadCount] == 0) || x1 >= x2 || y1 >= y2) { Loading libs/hwui/PathTessellator.cpp +10 −7 Original line number Diff line number Diff line Loading @@ -32,6 +32,15 @@ #define DEBUG_DUMP_BUFFER() #endif #include "PathTessellator.h" #include "Matrix.h" #include "Vector.h" #include "Vertex.h" #include "utils/MathUtils.h" #include <algorithm> #include <SkPath.h> #include <SkPaint.h> #include <SkPoint.h> Loading @@ -44,12 +53,6 @@ #include <utils/Log.h> #include <utils/Trace.h> #include "PathTessellator.h" #include "Matrix.h" #include "Vector.h" #include "Vertex.h" #include "utils/MathUtils.h" namespace android { namespace uirenderer { Loading Loading @@ -152,7 +155,7 @@ public: // always use 2 points for hairline if (halfStrokeWidth == 0.0f) return 2; float threshold = MathUtils::min(inverseScaleX, inverseScaleY) * ROUND_CAP_THRESH; float threshold = std::min(inverseScaleX, inverseScaleY) * ROUND_CAP_THRESH; return MathUtils::divisionsNeededToApproximateArc(halfStrokeWidth, PI, threshold); } return 0; Loading Loading
libs/hwui/AmbientShadow.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -52,14 +52,14 @@ // If this is set to negative value, then all the edge will be tessellated. #define ALPHA_THRESHOLD (0.1f / 255.0f) #include <math.h> #include <utils/Log.h> #include "AmbientShadow.h" #include "ShadowTessellator.h" #include "Vertex.h" #include "VertexBuffer.h" #include "utils/MathUtils.h" #include <algorithm> #include <utils/Log.h> namespace android { namespace uirenderer { Loading @@ -78,7 +78,7 @@ inline Vector2 getNormalFromVertices(const Vector3* vertices, int current, int n // The input z value will be converted to be non-negative inside. // The output must be ranged from 0 to 1. inline float getAlphaFromFactoredZ(float factoredZ) { return 1.0 / (1 + MathUtils::max(factoredZ, 0.0f)); return 1.0 / (1 + std::max(factoredZ, 0.0f)); } // The shader is using gaussian function e^-(1-x)*(1-x)*4, therefore, we transform Loading
libs/hwui/FontRenderer.cpp +6 −8 Original line number Diff line number Diff line Loading @@ -26,14 +26,12 @@ #include "Rect.h" #include "renderstate/RenderState.h" #include "utils/Blur.h" #include "utils/MathUtils.h" #include "utils/Timing.h" #include <algorithm> #include <cutils/properties.h> #include <SkGlyph.h> #include <SkUtils.h> #include <cutils/properties.h> #include <utils/Log.h> #ifdef ANDROID_ENABLE_RENDERSCRIPT Loading Loading @@ -118,10 +116,10 @@ FontRenderer::FontRenderer() uint32_t maxTextureSize = (uint32_t) Caches::getInstance().maxTextureSize; mSmallCacheWidth = MathUtils::min(mSmallCacheWidth, maxTextureSize); mSmallCacheHeight = MathUtils::min(mSmallCacheHeight, maxTextureSize); mLargeCacheWidth = MathUtils::min(mLargeCacheWidth, maxTextureSize); mLargeCacheHeight = MathUtils::min(mLargeCacheHeight, maxTextureSize); mSmallCacheWidth = std::min(mSmallCacheWidth, maxTextureSize); mSmallCacheHeight = std::min(mSmallCacheHeight, maxTextureSize); mLargeCacheWidth = std::min(mLargeCacheWidth, maxTextureSize); mLargeCacheHeight = std::min(mLargeCacheHeight, maxTextureSize); if (sLogFontRendererCreate) { INIT_LOGD(" Text cache sizes, in pixels: %i x %i, %i x %i, %i x %i, %i x %i", Loading
libs/hwui/Interpolator.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -16,11 +16,11 @@ #include "Interpolator.h" #include <cmath> #include <cutils/log.h> #include "utils/MathUtils.h" #include <algorithm> #include <cutils/log.h> namespace android { namespace uirenderer { Loading Loading @@ -106,7 +106,7 @@ float LUTInterpolator::interpolate(float input) { weight = modff(lutpos, &ipart); int i1 = (int) ipart; int i2 = MathUtils::min(i1 + 1, (int) mSize - 1); int i2 = std::min(i1 + 1, (int) mSize - 1); LOG_ALWAYS_FATAL_IF(i1 < 0 || i2 < 0, "negatives in interpolation!" " i1=%d, i2=%d, input=%f, lutpos=%f, size=%zu, values=%p, ipart=%f, weight=%f", Loading
libs/hwui/Patch.cpp +8 −8 Original line number Diff line number Diff line Loading @@ -14,16 +14,16 @@ * limitations under the License. */ #include <cmath> #include <utils/Log.h> #include "Patch.h" #include "Caches.h" #include "Patch.h" #include "Properties.h" #include "UvMapper.h" #include "utils/MathUtils.h" #include <algorithm> #include <utils/Log.h> namespace android { namespace uirenderer { Loading Loading @@ -189,10 +189,10 @@ void Patch::generateQuad(TextureVertex*& vertex, float x1, float y1, float x2, f const uint32_t oldQuadCount = quadCount; quadCount++; x1 = MathUtils::max(x1, 0.0f); x2 = MathUtils::max(x2, 0.0f); y1 = MathUtils::max(y1, 0.0f); y2 = MathUtils::max(y2, 0.0f); x1 = std::max(x1, 0.0f); x2 = std::max(x2, 0.0f); y1 = std::max(y1, 0.0f); y2 = std::max(y2, 0.0f); // Skip degenerate and transparent (empty) quads if ((mColors[oldQuadCount] == 0) || x1 >= x2 || y1 >= y2) { Loading
libs/hwui/PathTessellator.cpp +10 −7 Original line number Diff line number Diff line Loading @@ -32,6 +32,15 @@ #define DEBUG_DUMP_BUFFER() #endif #include "PathTessellator.h" #include "Matrix.h" #include "Vector.h" #include "Vertex.h" #include "utils/MathUtils.h" #include <algorithm> #include <SkPath.h> #include <SkPaint.h> #include <SkPoint.h> Loading @@ -44,12 +53,6 @@ #include <utils/Log.h> #include <utils/Trace.h> #include "PathTessellator.h" #include "Matrix.h" #include "Vector.h" #include "Vertex.h" #include "utils/MathUtils.h" namespace android { namespace uirenderer { Loading Loading @@ -152,7 +155,7 @@ public: // always use 2 points for hairline if (halfStrokeWidth == 0.0f) return 2; float threshold = MathUtils::min(inverseScaleX, inverseScaleY) * ROUND_CAP_THRESH; float threshold = std::min(inverseScaleX, inverseScaleY) * ROUND_CAP_THRESH; return MathUtils::divisionsNeededToApproximateArc(halfStrokeWidth, PI, threshold); } return 0; Loading