Merge "Remove all usage of fmin and fmax" into mnc-dev

This commit is contained in:
Chris Craik
2015-07-08 01:53:56 +00:00
committed by Android (Google) Code Review
7 changed files with 26 additions and 26 deletions

View File

@@ -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()) {

View File

@@ -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;

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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")) {

View File

@@ -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

View File

@@ -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);
}