diff options
author | Chris Craik <ccraik@google.com> | 2015-06-30 17:56:13 -0700 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2015-06-30 17:58:21 -0700 |
commit | df72b63928cc1492b72ba9a4e99d5e714f93ccc6 (patch) | |
tree | 38b94479dabc9aea2dfcde3a64348c51bc39cecf /libs/hwui/OpenGLRenderer.cpp | |
parent | 82b3f67711246ad5beaf7702ce16e9d433406d1e (diff) | |
download | frameworks_base-df72b63928cc1492b72ba9a4e99d5e714f93ccc6.zip frameworks_base-df72b63928cc1492b72ba9a4e99d5e714f93ccc6.tar.gz frameworks_base-df72b63928cc1492b72ba9a4e99d5e714f93ccc6.tar.bz2 |
Switch from fminf/fmaxf to std::min/max
bug:22208220
Shows considerable improvement in performance, especially in tight
loops.
Change-Id: I4bcf6584a3c145bfc55e73c9c73dcf6199290b3c
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 3d48fa6..87ed84f 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -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]))); } } @@ -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; } @@ -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)) { |