Loading libs/hwui/DisplayListOp.h +7 −5 Original line number Diff line number Diff line Loading @@ -29,6 +29,8 @@ #include "utils/LinearAllocator.h" #include "utils/PaintUtils.h" #include <algorithm> #include <SkColor.h> #include <SkPath.h> #include <SkPathOps.h> Loading Loading @@ -184,7 +186,7 @@ public: // TODO: it would be nice if this could take scale into account, but scale isn't stable // since higher levels of the view hierarchy can change scale out from underneath it. return fmaxf(mPaint->getStrokeWidth(), 1) * 0.5f; return std::max(mPaint->getStrokeWidth(), 1.0f) * 0.5f; } protected: Loading Loading @@ -235,10 +237,10 @@ public: DrawBoundedOp(const float* points, int count, const SkPaint* paint) : DrawOp(paint), mLocalBounds(points[0], points[1], points[0], points[1]) { for (int i = 2; i < count; i += 2) { mLocalBounds.left = fminf(mLocalBounds.left, points[i]); mLocalBounds.right = fmaxf(mLocalBounds.right, points[i]); mLocalBounds.top = fminf(mLocalBounds.top, points[i + 1]); mLocalBounds.bottom = fmaxf(mLocalBounds.bottom, points[i + 1]); mLocalBounds.left = std::min(mLocalBounds.left, points[i]); mLocalBounds.right = std::max(mLocalBounds.right, points[i]); mLocalBounds.top = std::min(mLocalBounds.top, points[i + 1]); mLocalBounds.bottom = std::max(mLocalBounds.bottom, points[i + 1]); } } Loading libs/hwui/OpenGLRenderer.cpp +10 −10 Original line number Diff line number Diff line Loading @@ -1626,10 +1626,10 @@ void OpenGLRenderer::drawBitmapMesh(const SkBitmap* bitmap, int meshWidth, int m ColorTextureVertex::set(vertex++, vertices[bx], vertices[by], u1, v1, colors[bx / 2]); ColorTextureVertex::set(vertex++, vertices[cx], vertices[cy], u2, v1, colors[cx / 2]); left = fminf(left, fminf(vertices[ax], fminf(vertices[bx], vertices[cx]))); top = fminf(top, fminf(vertices[ay], fminf(vertices[by], vertices[cy]))); right = fmaxf(right, fmaxf(vertices[ax], fmaxf(vertices[bx], vertices[cx]))); bottom = fmaxf(bottom, fmaxf(vertices[ay], fmaxf(vertices[by], vertices[cy]))); left = std::min(left, std::min(vertices[ax], std::min(vertices[bx], vertices[cx]))); top = std::min(top, std::min(vertices[ay], std::min(vertices[by], vertices[cy]))); right = std::max(right, std::max(vertices[ax], std::max(vertices[bx], vertices[cx]))); bottom = std::max(bottom, std::max(vertices[ay], std::max(vertices[by], vertices[cy]))); } } Loading Loading @@ -2127,8 +2127,8 @@ bool OpenGLRenderer::findBestFontTransform(const mat4& transform, SkMatrix* outM float sx, sy; transform.decomposeScale(sx, sy); outMatrix->setScale( roundf(fmaxf(1.0f, sx)), roundf(fmaxf(1.0f, sy))); roundf(std::max(1.0f, sx)), roundf(std::max(1.0f, sy))); return true; } Loading Loading @@ -2551,10 +2551,10 @@ void OpenGLRenderer::drawColorRects(const float* rects, int count, const SkPaint Vertex::set(vertex++, l, b); Vertex::set(vertex++, r, b); left = fminf(left, l); top = fminf(top, t); right = fmaxf(right, r); bottom = fmaxf(bottom, b); left = std::min(left, l); top = std::min(top, t); right = std::max(right, r); bottom = std::max(bottom, b); } if (clip && quickRejectSetupScissor(left, top, right, bottom)) { Loading libs/hwui/Patch.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -81,9 +81,9 @@ Patch::Patch(const float bitmapWidth, const float bitmapHeight, } const float xStretchTex = stretchSize; const float fixed = bitmapWidth - stretchSize; const float xStretch = fmaxf(width - fixed, 0.0f); const float xStretch = std::max(width - fixed, 0.0f); stretchX = xStretch / xStretchTex; rescaleX = fixed == 0.0f ? 0.0f : fminf(fmaxf(width, 0.0f) / fixed, 1.0f); rescaleX = fixed == 0.0f ? 0.0f : std::min(std::max(width, 0.0f) / fixed, 1.0f); } if (yStretchCount > 0) { Loading @@ -93,9 +93,9 @@ Patch::Patch(const float bitmapWidth, const float bitmapHeight, } const float yStretchTex = stretchSize; const float fixed = bitmapHeight - stretchSize; const float yStretch = fmaxf(height - fixed, 0.0f); const float yStretch = std::max(height - fixed, 0.0f); stretchY = yStretch / yStretchTex; rescaleY = fixed == 0.0f ? 0.0f : fminf(fmaxf(height, 0.0f) / fixed, 1.0f); rescaleY = fixed == 0.0f ? 0.0f : std::min(std::max(height, 0.0f) / fixed, 1.0f); } uint32_t quadCount = 0; Loading libs/hwui/Rect.h +17 −16 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #define ANDROID_HWUI_RECT_H #include <cmath> #include <algorithm> #include <SkRect.h> #include <utils/Log.h> Loading Loading @@ -246,17 +247,17 @@ public: } void expandToCoverVertex(float x, float y) { left = fminf(left, x); top = fminf(top, y); right = fmaxf(right, x); bottom = fmaxf(bottom, y); left = std::min(left, x); top = std::min(top, y); right = std::max(right, x); bottom = std::max(bottom, y); } void expandToCoverRect(float otherLeft, float otherTop, float otherRight, float otherBottom) { left = fminf(left, otherLeft); top = fminf(top, otherTop); right = fmaxf(right, otherRight); bottom = fmaxf(bottom, otherBottom); left = std::min(left, otherLeft); top = std::min(top, otherTop); right = std::max(right, otherRight); bottom = std::max(bottom, otherBottom); } SkRect toSkRect() const { Loading @@ -273,18 +274,18 @@ public: private: void intersectWith(Rect& tmp) const { tmp.left = fmaxf(left, tmp.left); tmp.top = fmaxf(top, tmp.top); tmp.right = fminf(right, tmp.right); tmp.bottom = fminf(bottom, tmp.bottom); tmp.left = std::max(left, tmp.left); tmp.top = std::max(top, tmp.top); tmp.right = std::min(right, tmp.right); tmp.bottom = std::min(bottom, tmp.bottom); } Rect intersectWith(float l, float t, float r, float b) const { Rect tmp; tmp.left = fmaxf(left, l); tmp.top = fmaxf(top, t); tmp.right = fminf(right, r); tmp.bottom = fminf(bottom, b); tmp.left = std::max(left, l); tmp.top = std::max(top, t); tmp.right = std::min(right, r); tmp.bottom = std::min(bottom, b); return tmp; } Loading libs/hwui/TextureCache.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -93,7 +93,7 @@ void TextureCache::setMaxSize(uint32_t maxSize) { } void TextureCache::setFlushRate(float flushRate) { mFlushRate = fmaxf(0.0f, fminf(1.0f, flushRate)); mFlushRate = std::max(0.0f, std::min(1.0f, flushRate)); } /////////////////////////////////////////////////////////////////////////////// Loading Loading
libs/hwui/DisplayListOp.h +7 −5 Original line number Diff line number Diff line Loading @@ -29,6 +29,8 @@ #include "utils/LinearAllocator.h" #include "utils/PaintUtils.h" #include <algorithm> #include <SkColor.h> #include <SkPath.h> #include <SkPathOps.h> Loading Loading @@ -184,7 +186,7 @@ public: // TODO: it would be nice if this could take scale into account, but scale isn't stable // since higher levels of the view hierarchy can change scale out from underneath it. return fmaxf(mPaint->getStrokeWidth(), 1) * 0.5f; return std::max(mPaint->getStrokeWidth(), 1.0f) * 0.5f; } protected: Loading Loading @@ -235,10 +237,10 @@ public: DrawBoundedOp(const float* points, int count, const SkPaint* paint) : DrawOp(paint), mLocalBounds(points[0], points[1], points[0], points[1]) { for (int i = 2; i < count; i += 2) { mLocalBounds.left = fminf(mLocalBounds.left, points[i]); mLocalBounds.right = fmaxf(mLocalBounds.right, points[i]); mLocalBounds.top = fminf(mLocalBounds.top, points[i + 1]); mLocalBounds.bottom = fmaxf(mLocalBounds.bottom, points[i + 1]); mLocalBounds.left = std::min(mLocalBounds.left, points[i]); mLocalBounds.right = std::max(mLocalBounds.right, points[i]); mLocalBounds.top = std::min(mLocalBounds.top, points[i + 1]); mLocalBounds.bottom = std::max(mLocalBounds.bottom, points[i + 1]); } } Loading
libs/hwui/OpenGLRenderer.cpp +10 −10 Original line number Diff line number Diff line Loading @@ -1626,10 +1626,10 @@ void OpenGLRenderer::drawBitmapMesh(const SkBitmap* bitmap, int meshWidth, int m ColorTextureVertex::set(vertex++, vertices[bx], vertices[by], u1, v1, colors[bx / 2]); ColorTextureVertex::set(vertex++, vertices[cx], vertices[cy], u2, v1, colors[cx / 2]); left = fminf(left, fminf(vertices[ax], fminf(vertices[bx], vertices[cx]))); top = fminf(top, fminf(vertices[ay], fminf(vertices[by], vertices[cy]))); right = fmaxf(right, fmaxf(vertices[ax], fmaxf(vertices[bx], vertices[cx]))); bottom = fmaxf(bottom, fmaxf(vertices[ay], fmaxf(vertices[by], vertices[cy]))); left = std::min(left, std::min(vertices[ax], std::min(vertices[bx], vertices[cx]))); top = std::min(top, std::min(vertices[ay], std::min(vertices[by], vertices[cy]))); right = std::max(right, std::max(vertices[ax], std::max(vertices[bx], vertices[cx]))); bottom = std::max(bottom, std::max(vertices[ay], std::max(vertices[by], vertices[cy]))); } } Loading Loading @@ -2127,8 +2127,8 @@ bool OpenGLRenderer::findBestFontTransform(const mat4& transform, SkMatrix* outM float sx, sy; transform.decomposeScale(sx, sy); outMatrix->setScale( roundf(fmaxf(1.0f, sx)), roundf(fmaxf(1.0f, sy))); roundf(std::max(1.0f, sx)), roundf(std::max(1.0f, sy))); return true; } Loading Loading @@ -2551,10 +2551,10 @@ void OpenGLRenderer::drawColorRects(const float* rects, int count, const SkPaint Vertex::set(vertex++, l, b); Vertex::set(vertex++, r, b); left = fminf(left, l); top = fminf(top, t); right = fmaxf(right, r); bottom = fmaxf(bottom, b); left = std::min(left, l); top = std::min(top, t); right = std::max(right, r); bottom = std::max(bottom, b); } if (clip && quickRejectSetupScissor(left, top, right, bottom)) { Loading
libs/hwui/Patch.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -81,9 +81,9 @@ Patch::Patch(const float bitmapWidth, const float bitmapHeight, } const float xStretchTex = stretchSize; const float fixed = bitmapWidth - stretchSize; const float xStretch = fmaxf(width - fixed, 0.0f); const float xStretch = std::max(width - fixed, 0.0f); stretchX = xStretch / xStretchTex; rescaleX = fixed == 0.0f ? 0.0f : fminf(fmaxf(width, 0.0f) / fixed, 1.0f); rescaleX = fixed == 0.0f ? 0.0f : std::min(std::max(width, 0.0f) / fixed, 1.0f); } if (yStretchCount > 0) { Loading @@ -93,9 +93,9 @@ Patch::Patch(const float bitmapWidth, const float bitmapHeight, } const float yStretchTex = stretchSize; const float fixed = bitmapHeight - stretchSize; const float yStretch = fmaxf(height - fixed, 0.0f); const float yStretch = std::max(height - fixed, 0.0f); stretchY = yStretch / yStretchTex; rescaleY = fixed == 0.0f ? 0.0f : fminf(fmaxf(height, 0.0f) / fixed, 1.0f); rescaleY = fixed == 0.0f ? 0.0f : std::min(std::max(height, 0.0f) / fixed, 1.0f); } uint32_t quadCount = 0; Loading
libs/hwui/Rect.h +17 −16 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #define ANDROID_HWUI_RECT_H #include <cmath> #include <algorithm> #include <SkRect.h> #include <utils/Log.h> Loading Loading @@ -246,17 +247,17 @@ public: } void expandToCoverVertex(float x, float y) { left = fminf(left, x); top = fminf(top, y); right = fmaxf(right, x); bottom = fmaxf(bottom, y); left = std::min(left, x); top = std::min(top, y); right = std::max(right, x); bottom = std::max(bottom, y); } void expandToCoverRect(float otherLeft, float otherTop, float otherRight, float otherBottom) { left = fminf(left, otherLeft); top = fminf(top, otherTop); right = fmaxf(right, otherRight); bottom = fmaxf(bottom, otherBottom); left = std::min(left, otherLeft); top = std::min(top, otherTop); right = std::max(right, otherRight); bottom = std::max(bottom, otherBottom); } SkRect toSkRect() const { Loading @@ -273,18 +274,18 @@ public: private: void intersectWith(Rect& tmp) const { tmp.left = fmaxf(left, tmp.left); tmp.top = fmaxf(top, tmp.top); tmp.right = fminf(right, tmp.right); tmp.bottom = fminf(bottom, tmp.bottom); tmp.left = std::max(left, tmp.left); tmp.top = std::max(top, tmp.top); tmp.right = std::min(right, tmp.right); tmp.bottom = std::min(bottom, tmp.bottom); } Rect intersectWith(float l, float t, float r, float b) const { Rect tmp; tmp.left = fmaxf(left, l); tmp.top = fmaxf(top, t); tmp.right = fminf(right, r); tmp.bottom = fminf(bottom, b); tmp.left = std::max(left, l); tmp.top = std::max(top, t); tmp.right = std::min(right, r); tmp.bottom = std::min(bottom, b); return tmp; } Loading
libs/hwui/TextureCache.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -93,7 +93,7 @@ void TextureCache::setMaxSize(uint32_t maxSize) { } void TextureCache::setFlushRate(float flushRate) { mFlushRate = fmaxf(0.0f, fminf(1.0f, flushRate)); mFlushRate = std::max(0.0f, std::min(1.0f, flushRate)); } /////////////////////////////////////////////////////////////////////////////// Loading