summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2015-07-08 01:53:56 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-07-08 01:53:57 +0000
commit127b478ac61eed99894998b38bca82b79b8e56b1 (patch)
tree9c8d52d07e2692ba3bb6ab1fb814ec66cbb3fcff /libs
parent5544cb421c38d2f0a966a69d112ca7685aa716f7 (diff)
parente6a15ee3d0c78eb3f2551d73a7d238c3d8d2f075 (diff)
downloadframeworks_base-127b478ac61eed99894998b38bca82b79b8e56b1.zip
frameworks_base-127b478ac61eed99894998b38bca82b79b8e56b1.tar.gz
frameworks_base-127b478ac61eed99894998b38bca82b79b8e56b1.tar.bz2
Merge "Remove all usage of fmin and fmax" into mnc-dev
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/FontRenderer.cpp16
-rw-r--r--libs/hwui/OpenGLRenderer.cpp10
-rw-r--r--libs/hwui/Patch.cpp4
-rw-r--r--libs/hwui/PathCache.cpp6
-rw-r--r--libs/hwui/Properties.cpp10
-rw-r--r--libs/hwui/TessellationCache.cpp4
-rw-r--r--libs/hwui/font/CacheTexture.cpp2
7 files changed, 26 insertions, 26 deletions
diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp
index 9664f58..35051b7 100644
--- a/libs/hwui/FontRenderer.cpp
+++ b/libs/hwui/FontRenderer.cpp
@@ -521,10 +521,10 @@ void FontRenderer::appendMeshQuad(float x1, float y1, float u1, float v1,
appendMeshQuadNoClip(x1, y1, u1, v1, x2, y2, u2, v2, x3, y3, u3, v3, x4, y4, u4, v4, texture);
if (mBounds) {
- mBounds->left = fmin(mBounds->left, x1);
- mBounds->top = fmin(mBounds->top, y3);
- mBounds->right = fmax(mBounds->right, x3);
- mBounds->bottom = fmax(mBounds->bottom, y1);
+ mBounds->left = std::min(mBounds->left, x1);
+ mBounds->top = std::min(mBounds->top, y3);
+ mBounds->right = std::max(mBounds->right, x3);
+ mBounds->bottom = std::max(mBounds->bottom, y1);
}
if (mCurrentCacheTexture->endOfMesh()) {
@@ -539,10 +539,10 @@ void FontRenderer::appendRotatedMeshQuad(float x1, float y1, float u1, float v1,
appendMeshQuadNoClip(x1, y1, u1, v1, x2, y2, u2, v2, x3, y3, u3, v3, x4, y4, u4, v4, texture);
if (mBounds) {
- mBounds->left = fmin(mBounds->left, fmin(x1, fmin(x2, fmin(x3, x4))));
- mBounds->top = fmin(mBounds->top, fmin(y1, fmin(y2, fmin(y3, y4))));
- mBounds->right = fmax(mBounds->right, fmax(x1, fmax(x2, fmax(x3, x4))));
- mBounds->bottom = fmax(mBounds->bottom, fmax(y1, fmax(y2, fmax(y3, y4))));
+ mBounds->left = std::min(mBounds->left, std::min(x1, std::min(x2, std::min(x3, x4))));
+ mBounds->top = std::min(mBounds->top, std::min(y1, std::min(y2, std::min(y3, y4))));
+ mBounds->right = std::max(mBounds->right, std::max(x1, std::max(x2, std::max(x3, x4))));
+ mBounds->bottom = std::max(mBounds->bottom, std::max(y1, std::max(y2, std::max(y3, y4))));
}
if (mCurrentCacheTexture->endOfMesh()) {
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 87ed84f..ed2a4db 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -1670,10 +1670,10 @@ void OpenGLRenderer::drawBitmap(const SkBitmap* bitmap, Rect src, Rect dst, cons
if (!texture) return;
const AutoTexture autoCleanup(texture);
- Rect uv(fmax(0.0f, src.left / texture->width),
- fmax(0.0f, src.top / texture->height),
- fmin(1.0f, src.right / texture->width),
- fmin(1.0f, src.bottom / texture->height));
+ Rect uv(std::max(0.0f, src.left / texture->width),
+ std::max(0.0f, src.top / texture->height),
+ std::min(1.0f, src.right / texture->width),
+ std::min(1.0f, src.bottom / texture->height));
const int textureFillFlags = (bitmap->colorType() == kAlpha_8_SkColorType)
? TextureFillFlags::IsAlphaMaskTexture : TextureFillFlags::None;
@@ -2450,7 +2450,7 @@ void OpenGLRenderer::drawTextDecorations(float underlineWidth, float x, float y,
if (CC_LIKELY(underlineWidth > 0.0f)) {
const float textSize = paintCopy.getTextSize();
- const float strokeWidth = fmax(textSize * kStdUnderline_Thickness, 1.0f);
+ const float strokeWidth = std::max(textSize * kStdUnderline_Thickness, 1.0f);
const float left = x;
float top = 0.0f;
diff --git a/libs/hwui/Patch.cpp b/libs/hwui/Patch.cpp
index f4dd943..6a7dfb3 100644
--- a/libs/hwui/Patch.cpp
+++ b/libs/hwui/Patch.cpp
@@ -119,7 +119,7 @@ Patch::Patch(const float bitmapWidth, const float bitmapHeight,
}
float vOffset = y1 == y2 ? 0.0f : 0.5 - (0.5 * segment / (y2 - y1));
- float v2 = fmax(0.0f, stepY - vOffset) / bitmapHeight;
+ float v2 = std::max(0.0f, stepY - vOffset) / bitmapHeight;
v1 += vOffset / bitmapHeight;
if (stepY > 0.0f) {
@@ -167,7 +167,7 @@ void Patch::generateRow(const int32_t* xDivs, uint32_t xCount, TextureVertex*& v
}
float uOffset = x1 == x2 ? 0.0f : 0.5 - (0.5 * segment / (x2 - x1));
- float u2 = fmax(0.0f, stepX - uOffset) / bitmapWidth;
+ float u2 = std::max(0.0f, stepX - uOffset) / bitmapWidth;
u1 += uOffset / bitmapWidth;
if (stepX > 0.0f) {
diff --git a/libs/hwui/PathCache.cpp b/libs/hwui/PathCache.cpp
index e466604..3af640f 100644
--- a/libs/hwui/PathCache.cpp
+++ b/libs/hwui/PathCache.cpp
@@ -91,13 +91,13 @@ void PathCache::computePathBounds(const SkPath* path, const SkPaint* paint,
void PathCache::computeBounds(const SkRect& bounds, const SkPaint* paint,
float& left, float& top, float& offset, uint32_t& width, uint32_t& height) {
- const float pathWidth = fmax(bounds.width(), 1.0f);
- const float pathHeight = fmax(bounds.height(), 1.0f);
+ const float pathWidth = std::max(bounds.width(), 1.0f);
+ const float pathHeight = std::max(bounds.height(), 1.0f);
left = bounds.fLeft;
top = bounds.fTop;
- offset = (int) floorf(fmax(paint->getStrokeWidth(), 1.0f) * 1.5f + 0.5f);
+ offset = (int) floorf(std::max(paint->getStrokeWidth(), 1.0f) * 1.5f + 0.5f);
width = uint32_t(pathWidth + offset * 2.0 + 0.5);
height = uint32_t(pathHeight + offset * 2.0 + 0.5);
diff --git a/libs/hwui/Properties.cpp b/libs/hwui/Properties.cpp
index 7dbe3b7..2e63793 100644
--- a/libs/hwui/Properties.cpp
+++ b/libs/hwui/Properties.cpp
@@ -17,7 +17,7 @@
#include "Debug.h"
-#include <cmath>
+#include <algorithm>
#include <cutils/log.h>
namespace android {
@@ -117,19 +117,19 @@ void Properties::overrideProperty(const char* name, const char* value) {
ALOGD("profile bars %s", sDisableProfileBars ? "disabled" : "enabled");
return;
} else if (!strcmp(name, "ambientRatio")) {
- overrideAmbientRatio = fmin(fmax(atof(value), 0.0), 10.0);
+ overrideAmbientRatio = std::min(std::max(atof(value), 0.0), 10.0);
ALOGD("ambientRatio = %.2f", overrideAmbientRatio);
return;
} else if (!strcmp(name, "lightRadius")) {
- overrideLightRadius = fmin(fmax(atof(value), 0.0), 3000.0);
+ overrideLightRadius = std::min(std::max(atof(value), 0.0), 3000.0);
ALOGD("lightRadius = %.2f", overrideLightRadius);
return;
} else if (!strcmp(name, "lightPosY")) {
- overrideLightPosY = fmin(fmax(atof(value), 0.0), 3000.0);
+ overrideLightPosY = std::min(std::max(atof(value), 0.0), 3000.0);
ALOGD("lightPos Y = %.2f", overrideLightPosY);
return;
} else if (!strcmp(name, "lightPosZ")) {
- overrideLightPosZ = fmin(fmax(atof(value), 0.0), 3000.0);
+ overrideLightPosZ = std::min(std::max(atof(value), 0.0), 3000.0);
ALOGD("lightPos Z = %.2f", overrideLightPosZ);
return;
} else if (!strcmp(name, "ambientShadowStrength")) {
diff --git a/libs/hwui/TessellationCache.cpp b/libs/hwui/TessellationCache.cpp
index 9df1f0d..17cb3a7 100644
--- a/libs/hwui/TessellationCache.cpp
+++ b/libs/hwui/TessellationCache.cpp
@@ -244,8 +244,8 @@ static void tessellateShadows(
const Vertex& point2d = casterVertices2d[i];
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);
+ minZ = std::min(minZ, casterPolygon[i].z);
+ maxZ = std::max(maxZ, casterPolygon[i].z);
}
// map the centroid of the caster into 3d
diff --git a/libs/hwui/font/CacheTexture.cpp b/libs/hwui/font/CacheTexture.cpp
index 845cf30..d2685da 100644
--- a/libs/hwui/font/CacheTexture.cpp
+++ b/libs/hwui/font/CacheTexture.cpp
@@ -314,7 +314,7 @@ bool CacheTexture::fitBitmap(const SkGlyph& glyph, uint32_t* retOriginX, uint32_
#endif
}
- if (cacheBlock->mHeight < fmin(glyphH, glyphW)) {
+ if (cacheBlock->mHeight < std::min(glyphH, glyphW)) {
// If remaining space in this block is too small to be useful, remove it
mCacheBlocks = CacheBlock::removeBlock(mCacheBlocks, cacheBlock);
}