Revert "replace all std::min/std::max with just min/max"
This reverts commit 28d967ccce
.
This commit is contained in:
parent
28d967ccce
commit
1711d8bdaf
|
@ -70,13 +70,13 @@ void Creature::draw(const Point& dest, float scaleFactor, bool animate, LightVie
|
|||
|
||||
if(m_showTimedSquare && animate) {
|
||||
g_painter->setColor(m_timedSquareColor);
|
||||
g_painter->drawBoundingRect(Rect(dest + (animationOffset - getDisplacement() + 2)*scaleFactor, Size(28, 28)*scaleFactor), max((int)(2*scaleFactor), 1));
|
||||
g_painter->drawBoundingRect(Rect(dest + (animationOffset - getDisplacement() + 2)*scaleFactor, Size(28, 28)*scaleFactor), std::max((int)(2*scaleFactor), 1));
|
||||
g_painter->setColor(Color::white);
|
||||
}
|
||||
|
||||
if(m_showStaticSquare && animate) {
|
||||
g_painter->setColor(m_staticSquareColor);
|
||||
g_painter->drawBoundingRect(Rect(dest + (animationOffset - getDisplacement())*scaleFactor, Size(Otc::TILE_PIXELS, Otc::TILE_PIXELS)*scaleFactor), max((int)(2*scaleFactor), 1));
|
||||
g_painter->drawBoundingRect(Rect(dest + (animationOffset - getDisplacement())*scaleFactor, Size(Otc::TILE_PIXELS, Otc::TILE_PIXELS)*scaleFactor), std::max((int)(2*scaleFactor), 1));
|
||||
g_painter->setColor(Color::white);
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ void Creature::draw(const Point& dest, float scaleFactor, bool animate, LightVie
|
|||
|
||||
// local player always have a minimum light in complete darkness
|
||||
if(isLocalPlayer() && (g_map.getLight().intensity < 64 || m_position.z > Otc::SEA_FLOOR)) {
|
||||
light.intensity = max<uint8>(light.intensity, 3);
|
||||
light.intensity = std::max<uint8>(light.intensity, 3);
|
||||
if(light.color == 0 || light.color > 215)
|
||||
light.color = 215;
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ void Creature::internalDrawOutfit(Point dest, float scaleFactor, bool animateWal
|
|||
dest -= datType->getDisplacement() * scaleFactor;
|
||||
datType->draw(dest, scaleFactor, 0, xPattern, 0, 0, animationPhase, lightView);
|
||||
dest += getDisplacement() * scaleFactor;
|
||||
zPattern = min(1, getNumPatternZ() - 1);
|
||||
zPattern = std::min(1, getNumPatternZ() - 1);
|
||||
}
|
||||
|
||||
PointF jumpOffset = m_jumpOffset * scaleFactor;
|
||||
|
@ -171,7 +171,7 @@ void Creature::internalDrawOutfit(Point dest, float scaleFactor, bool animateWal
|
|||
// when creature is an effect we cant render the first and last animation phase,
|
||||
// instead we should loop in the phases between
|
||||
if(m_outfit.getCategory() == ThingCategoryEffect) {
|
||||
animationPhases = max(1, animationPhases-2);
|
||||
animationPhases = std::max(1, animationPhases-2);
|
||||
animateTicks = Otc::INVISIBLE_TICKS_PER_FRAME;
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ void Creature::internalDrawOutfit(Point dest, float scaleFactor, bool animateWal
|
|||
}
|
||||
|
||||
if(m_outfit.getCategory() == ThingCategoryEffect)
|
||||
animationPhase = min(animationPhase+1, animationPhases);
|
||||
animationPhase = std::min(animationPhase+1, animationPhases);
|
||||
|
||||
type->draw(dest - (getDisplacement() * scaleFactor), scaleFactor, 0, 0, 0, 0, animationPhase, lightView);
|
||||
}
|
||||
|
@ -372,7 +372,7 @@ void Creature::updateJump()
|
|||
|
||||
int nextT, i = 1;
|
||||
do {
|
||||
nextT = stdext::round((-b + std::sqrt(max(b*b + 4*a*(roundHeight+diff*i), 0.0)) * diff) / (2*a));
|
||||
nextT = stdext::round((-b + std::sqrt(std::max(b*b + 4*a*(roundHeight+diff*i), 0.0)) * diff) / (2*a));
|
||||
++i;
|
||||
|
||||
if(nextT < halfJumpDuration)
|
||||
|
@ -480,7 +480,7 @@ void Creature::updateWalkAnimation(int totalPixelsWalked)
|
|||
if(!self->m_walking || self->m_walkTimer.ticksElapsed() >= self->getStepDuration(true))
|
||||
self->m_walkAnimationPhase = 0;
|
||||
self->m_walkFinishAnimEvent = nullptr;
|
||||
}, min(footDelay, 200));
|
||||
}, std::min(footDelay, 200));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -553,10 +553,10 @@ void Creature::nextWalkUpdate()
|
|||
void Creature::updateWalk()
|
||||
{
|
||||
float walkTicksPerPixel = getStepDuration(true) / 32;
|
||||
int totalPixelsWalked = min(m_walkTimer.ticksElapsed() / walkTicksPerPixel, 32.0f);
|
||||
int totalPixelsWalked = std::min(m_walkTimer.ticksElapsed() / walkTicksPerPixel, 32.0f);
|
||||
|
||||
// needed for paralyze effect
|
||||
m_walkedPixels = max(m_walkedPixels, totalPixelsWalked);
|
||||
m_walkedPixels = std::max(m_walkedPixels, totalPixelsWalked);
|
||||
|
||||
// update walk animation and offsets
|
||||
updateWalkAnimation(totalPixelsWalked);
|
||||
|
@ -820,7 +820,7 @@ int Creature::getStepDuration(bool ignoreDiagonal, Otc::Direction dir)
|
|||
if(g_game.getFeature(Otc::GameNewSpeedLaw) && hasSpeedFormula()) {
|
||||
int formulatedSpeed = 1;
|
||||
if(speed > -m_speedFormula[Otc::SpeedFormulaB]) {
|
||||
formulatedSpeed = max(1, (int)floor((m_speedFormula[Otc::SpeedFormulaA] * log((speed / 2)
|
||||
formulatedSpeed = std::max(1, (int)floor((m_speedFormula[Otc::SpeedFormulaA] * log((speed / 2)
|
||||
+ m_speedFormula[Otc::SpeedFormulaB]) + m_speedFormula[Otc::SpeedFormulaC]) + 0.5));
|
||||
}
|
||||
interval = std::floor(interval / (double)formulatedSpeed);
|
||||
|
@ -835,7 +835,7 @@ int Creature::getStepDuration(bool ignoreDiagonal, Otc::Direction dir)
|
|||
if(g_game.getProtocolVersion() <= 810)
|
||||
factor = 2;
|
||||
|
||||
interval = max(interval, g_game.getServerBeat());
|
||||
interval = std::max(interval, g_game.getServerBeat());
|
||||
|
||||
if(!ignoreDiagonal && (m_lastStepDirection == Otc::NorthWest || m_lastStepDirection == Otc::NorthEast ||
|
||||
m_lastStepDirection == Otc::SouthWest || m_lastStepDirection == Otc::SouthEast))
|
||||
|
@ -887,7 +887,7 @@ int Creature::getExactSize(int layer, int xPattern, int yPattern, int zPattern,
|
|||
continue;
|
||||
|
||||
for(layer = 0; layer < getLayers(); ++layer)
|
||||
exactSize = max(exactSize, Thing::getExactSize(layer, xPattern, yPattern, zPattern, animationPhase));
|
||||
exactSize = std::max(exactSize, Thing::getExactSize(layer, xPattern, yPattern, zPattern, animationPhase));
|
||||
}
|
||||
|
||||
return exactSize;
|
||||
|
|
|
@ -31,7 +31,7 @@ void Effect::draw(const Point& dest, float scaleFactor, bool animate, LightView
|
|||
|
||||
int animationPhase = 0;
|
||||
if(animate)
|
||||
animationPhase = min((int)(m_animationTimer.ticksElapsed() / m_phaseDuration), getAnimationPhases() - 1);
|
||||
animationPhase = std::min((int)(m_animationTimer.ticksElapsed() / m_phaseDuration), getAnimationPhases() - 1);
|
||||
rawGetThingType()->draw(dest, scaleFactor, 0, 0, 0, 0, animationPhase, lightView);
|
||||
}
|
||||
|
||||
|
|
|
@ -664,7 +664,7 @@ bool Game::dashWalk(Otc::Direction direction)
|
|||
m_localPlayer->stopAutoWalk();
|
||||
}
|
||||
|
||||
if(m_localPlayer->isWalking() && m_dashTimer.ticksElapsed() < max<int>(m_localPlayer->getStepDuration(false, direction) - m_ping, 30))
|
||||
if(m_localPlayer->isWalking() && m_dashTimer.ticksElapsed() < std::max<int>(m_localPlayer->getStepDuration(false, direction) - m_ping, 30))
|
||||
return false;
|
||||
|
||||
Position toPos = m_localPlayer->getPosition().translatedToDirection(direction);
|
||||
|
|
|
@ -287,7 +287,7 @@ public:
|
|||
bool isFollowing() { return !!m_followingCreature; }
|
||||
bool isConnectionOk() { return m_protocolGame && m_protocolGame->getElapsedTicksSinceLastRead() < 5000; }
|
||||
|
||||
int getPing() { return m_ping >= 0 ? max(m_ping, m_pingTimer.elapsed_millis()) : -1; }
|
||||
int getPing() { return m_ping >= 0 ? std::max(m_ping, m_pingTimer.elapsed_millis()) : -1; }
|
||||
ContainerPtr getContainer(int index) { return m_containers[index]; }
|
||||
std::map<int, ContainerPtr> getContainers() { return m_containers; }
|
||||
std::map<int, Vip> getVips() { return m_vips; }
|
||||
|
|
|
@ -50,7 +50,7 @@ TexturePtr LightView::generateLightBubble(float centerFactor)
|
|||
for(int x = 0; x < bubbleDiameter; x++) {
|
||||
for(int y = 0; y < bubbleDiameter; y++) {
|
||||
float radius = std::sqrt((bubbleRadius - x)*(bubbleRadius - x) + (bubbleRadius - y)*(bubbleRadius - y));
|
||||
float intensity = max(min((bubbleRadius-radius)/(float)(bubbleRadius-centerRadius), 1.0f), 0.0f);
|
||||
float intensity = std::max(std::min((bubbleRadius-radius)/(float)(bubbleRadius-centerRadius), 1.0f), 0.0f);
|
||||
|
||||
// light intensity varies inversely with the square of the distance
|
||||
intensity = intensity * intensity;
|
||||
|
@ -78,7 +78,7 @@ void LightView::setGlobalLight(const Light& light)
|
|||
|
||||
void LightView::addLightSource(const Point& center, float scaleFactor, const Light& light)
|
||||
{
|
||||
int intensity = min<int>(light.intensity, MAX_LIGHT_INTENSITY);
|
||||
int intensity = std::min<int>(light.intensity, MAX_LIGHT_INTENSITY);
|
||||
int radius = intensity * Otc::TILE_PIXELS * scaleFactor;
|
||||
|
||||
Color color = Color::from8bit(light.color);
|
||||
|
|
|
@ -58,7 +58,7 @@ LocalPlayer::LocalPlayer()
|
|||
|
||||
void LocalPlayer::lockWalk(int millis)
|
||||
{
|
||||
m_walkLockExpiration = max(m_walkLockExpiration, (ticks_t) g_clock.millis() + millis);
|
||||
m_walkLockExpiration = std::max(m_walkLockExpiration, (ticks_t) g_clock.millis() + millis);
|
||||
}
|
||||
|
||||
bool LocalPlayer::canWalk(Otc::Direction direction)
|
||||
|
@ -263,7 +263,7 @@ void LocalPlayer::updateWalk()
|
|||
{
|
||||
int stepDuration = getStepDuration();
|
||||
float walkTicksPerPixel = getStepDuration(true) / 32.0f;
|
||||
int totalPixelsWalked = min(m_walkTimer.ticksElapsed() / walkTicksPerPixel, 32.0f);
|
||||
int totalPixelsWalked = std::min(m_walkTimer.ticksElapsed() / walkTicksPerPixel, 32.0f);
|
||||
|
||||
// update walk animation and offsets
|
||||
updateWalkAnimation(totalPixelsWalked);
|
||||
|
|
|
@ -138,7 +138,7 @@ void Map::addThing(const ThingPtr& thing, const Position& pos, int stackPos)
|
|||
int y = 12 - 48 * t / (float)Otc::ANIMATED_TEXT_DURATION;
|
||||
offset += Point(0, y);
|
||||
}
|
||||
offset.y = min(offset.y, 12);
|
||||
offset.y = std::min(offset.y, 12);
|
||||
animatedText->setOffset(offset);
|
||||
}
|
||||
m_animatedTexts.push_back(animatedText);
|
||||
|
@ -615,7 +615,7 @@ int Map::getFirstAwareFloor()
|
|||
int Map::getLastAwareFloor()
|
||||
{
|
||||
if(m_centralPosition.z > Otc::SEA_FLOOR)
|
||||
return min(m_centralPosition.z+Otc::AWARE_UNDEGROUND_FLOOR_RANGE, (int)Otc::MAX_Z);
|
||||
return std::min(m_centralPosition.z+Otc::AWARE_UNDEGROUND_FLOOR_RANGE, (int)Otc::MAX_Z);
|
||||
else
|
||||
return Otc::SEA_FLOOR;
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ void MapView::draw(const Rect& rect)
|
|||
ambientLight.color = 215;
|
||||
ambientLight.intensity = 0;
|
||||
}
|
||||
ambientLight.intensity = max<int>(m_minimumAmbientLight*255, ambientLight.intensity);
|
||||
ambientLight.intensity = std::max<int>(m_minimumAmbientLight*255, ambientLight.intensity);
|
||||
m_lightView->setGlobalLight(ambientLight);
|
||||
}
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ void MapView::draw(const Rect& rect)
|
|||
}
|
||||
|
||||
if(m_shaderSwitchDone && m_shader && m_fadeInTime > 0)
|
||||
fadeOpacity = min(m_fadeTimer.timeElapsed() / m_fadeInTime, 1.0f);
|
||||
fadeOpacity = std::min(m_fadeTimer.timeElapsed() / m_fadeInTime, 1.0f);
|
||||
|
||||
Rect srcRect = calcFramebufferSource(rect.size());
|
||||
Point drawOffset = srcRect.topLeft();
|
||||
|
@ -311,7 +311,7 @@ void MapView::updateVisibleTilesCache(int start)
|
|||
// loop through / diagonals beginning at top left and going to top right
|
||||
for(int diagonal = 0; diagonal < numDiagonals && !stop; ++diagonal) {
|
||||
// loop current diagonal tiles
|
||||
int advance = max(diagonal - m_drawDimension.height(), 0);
|
||||
int advance = std::max(diagonal - m_drawDimension.height(), 0);
|
||||
for(int iy = diagonal - advance, ix = advance; iy >= 0 && ix < m_drawDimension.width() && !stop; --iy, ++ix) {
|
||||
// only start really looking tiles in the desired start
|
||||
if(m_updateTilesPos < start) {
|
||||
|
@ -364,10 +364,10 @@ void MapView::updateVisibleTilesCache(int start)
|
|||
};
|
||||
|
||||
for(int i=0;i<4;++i) {
|
||||
int sx = max(lines[i].left(), area.left());
|
||||
int ex = min(lines[i].right(), area.right());
|
||||
int sy = max(lines[i].top(), area.top());
|
||||
int ey = min(lines[i].bottom(), area.bottom());
|
||||
int sx = std::max(lines[i].left(), area.left());
|
||||
int ex = std::min(lines[i].right(), area.right());
|
||||
int sy = std::max(lines[i].top(), area.top());
|
||||
int ey = std::min(lines[i].bottom(), area.bottom());
|
||||
for(int qx=sx;qx<=ex;++qx)
|
||||
for(int qy=sy;qy<=ey;++qy)
|
||||
m_spiral[count++] = Point(qx, qy);
|
||||
|
@ -608,7 +608,7 @@ int MapView::calcFirstVisibleFloor()
|
|||
|
||||
// limits to underground floors while under sea level
|
||||
if(cameraPosition.z > Otc::SEA_FLOOR)
|
||||
firstFloor = max(cameraPosition.z - Otc::AWARE_UNDEGROUND_FLOOR_RANGE, (int)Otc::UNDERGROUND_FLOOR);
|
||||
firstFloor = std::max(cameraPosition.z - Otc::AWARE_UNDEGROUND_FLOOR_RANGE, (int)Otc::UNDERGROUND_FLOOR);
|
||||
|
||||
// loop in 3x3 tiles around the camera
|
||||
for(int ix = -1; ix <= 1 && firstFloor < cameraPosition.z; ++ix) {
|
||||
|
@ -644,7 +644,7 @@ int MapView::calcFirstVisibleFloor()
|
|||
}
|
||||
|
||||
// just ensure the that the floor is in the valid range
|
||||
z = min(max(z, 0), (int)Otc::MAX_Z);
|
||||
z = std::min(std::max(z, 0), (int)Otc::MAX_Z);
|
||||
return z;
|
||||
}
|
||||
|
||||
|
@ -666,10 +666,10 @@ int MapView::calcLastVisibleFloor()
|
|||
}
|
||||
|
||||
if(m_lockedFirstVisibleFloor != -1)
|
||||
z = max(m_lockedFirstVisibleFloor, z);
|
||||
z = std::max(m_lockedFirstVisibleFloor, z);
|
||||
|
||||
// just ensure the that the floor is in the valid range
|
||||
z = min(max(z, 0), (int)Otc::MAX_Z);
|
||||
z = std::min(std::max(z, 0), (int)Otc::MAX_Z);
|
||||
return z;
|
||||
}
|
||||
|
||||
|
|
|
@ -200,7 +200,7 @@ void Minimap::updateTile(const Position& pos, const TilePtr& tile)
|
|||
minimapTile.flags |= MinimapTileNotWalkable;
|
||||
if(!tile->isPathable())
|
||||
minimapTile.flags |= MinimapTileNotPathable;
|
||||
minimapTile.speed = min((int)std::ceil(tile->getGroundSpeed() / 10.0f), 255);
|
||||
minimapTile.speed = std::min((int)std::ceil(tile->getGroundSpeed() / 10.0f), 255);
|
||||
}
|
||||
|
||||
if(minimapTile != MinimapTile()) {
|
||||
|
|
|
@ -1701,7 +1701,7 @@ void ProtocolGame::setMapDescription(const InputMessagePtr& msg, int x, int y, i
|
|||
|
||||
if(z > Otc::SEA_FLOOR) {
|
||||
startz = z - Otc::AWARE_UNDEGROUND_FLOOR_RANGE;
|
||||
endz = min(z + Otc::AWARE_UNDEGROUND_FLOOR_RANGE, (int)Otc::MAX_Z);
|
||||
endz = std::min(z + Otc::AWARE_UNDEGROUND_FLOOR_RANGE, (int)Otc::MAX_Z);
|
||||
zstep = 1;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -78,7 +78,7 @@ bool StaticText::addMessage(const std::string& name, Otc::MessageMode mode, cons
|
|||
m_updateEvent = nullptr;
|
||||
}
|
||||
|
||||
int delay = max<int>(Otc::STATIC_DURATION_PER_CHARACTER * text.length(), Otc::MIN_STATIC_TEXT_DURATION);
|
||||
int delay = std::max<int>(Otc::STATIC_DURATION_PER_CHARACTER * text.length(), Otc::MIN_STATIC_TEXT_DURATION);
|
||||
if(isYell())
|
||||
delay *= 2;
|
||||
|
||||
|
@ -106,7 +106,7 @@ void StaticText::update()
|
|||
|
||||
void StaticText::scheduleUpdate()
|
||||
{
|
||||
int delay = max<int>(m_messages.front().second - g_clock.millis(), 0);
|
||||
int delay = std::max<int>(m_messages.front().second - g_clock.millis(), 0);
|
||||
|
||||
auto self = asStaticText();
|
||||
m_updateEvent = g_dispatcher.scheduleEvent([self]() {
|
||||
|
|
|
@ -129,7 +129,7 @@ void ThingType::unserialize(uint16 clientId, ThingCategory category, const FileS
|
|||
uint8 width = fin->getU8();
|
||||
uint8 height = fin->getU8();
|
||||
m_size = Size(width, height);
|
||||
m_exactSize = (width > 1 || height > 1) ? min((int)fin->getU8(), max(width * 32, height * 32)) : 32;
|
||||
m_exactSize = (width > 1 || height > 1) ? std::min((int)fin->getU8(), std::max(width * 32, height * 32)) : 32;
|
||||
m_layers = fin->getU8();
|
||||
m_numPatternX = fin->getU8();
|
||||
m_numPatternY = fin->getU8();
|
||||
|
@ -280,10 +280,10 @@ const TexturePtr& ThingType::getTexture(int animationPhase)
|
|||
for(int y = framePos.y; y < framePos.y + m_size.height() * Otc::TILE_PIXELS; ++y) {
|
||||
uint8 *p = fullImage->getPixel(x,y);
|
||||
if(p[3] != 0x00) {
|
||||
drawRect.setTop (min(y, (int)drawRect.top()));
|
||||
drawRect.setLeft (min(x, (int)drawRect.left()));
|
||||
drawRect.setBottom(max(y, (int)drawRect.bottom()));
|
||||
drawRect.setRight (max(x, (int)drawRect.right()));
|
||||
drawRect.setTop (std::min(y, (int)drawRect.top()));
|
||||
drawRect.setLeft (std::min(x, (int)drawRect.left()));
|
||||
drawRect.setBottom(std::max(y, (int)drawRect.bottom()));
|
||||
drawRect.setRight (std::max(x, (int)drawRect.right()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -362,5 +362,5 @@ int ThingType::getExactSize(int layer, int xPattern, int yPattern, int zPattern,
|
|||
getTexture(animationPhase); // we must calculate it anyway.
|
||||
int frameIndex = getTextureIndex(layer, xPattern, yPattern, zPattern);
|
||||
Size size = m_texturesFramesOriginRects[animationPhase][frameIndex].size() - m_texturesFramesOffsets[animationPhase][frameIndex].toSize();
|
||||
return max(size.width(), size.height());
|
||||
return std::max(size.width(), size.height());
|
||||
}
|
||||
|
|
|
@ -101,8 +101,8 @@ void Tile::draw(const Point& dest, float scaleFactor, int drawFlags, LightView *
|
|||
thing->draw(dest - m_drawElevation*scaleFactor, scaleFactor, animate, lightView);
|
||||
|
||||
if(thing->isLyingCorpse()) {
|
||||
redrawPreviousTopW = max(thing->getWidth(), redrawPreviousTopW);
|
||||
redrawPreviousTopH = max(thing->getHeight(), redrawPreviousTopH);
|
||||
redrawPreviousTopW = std::max(thing->getWidth(), redrawPreviousTopW);
|
||||
redrawPreviousTopH = std::max(thing->getHeight(), redrawPreviousTopH);
|
||||
}
|
||||
|
||||
m_drawElevation += thing->getElevation();
|
||||
|
|
|
@ -48,11 +48,11 @@ void UIItem::drawSelf(Fw::DrawPane drawPane)
|
|||
Rect drawRect = getPaddingRect();
|
||||
Point dest = drawRect.bottomRight() + Point(1,1);
|
||||
|
||||
int exactSize = max(32, m_item->getExactSize());
|
||||
int exactSize = std::max(32, m_item->getExactSize());
|
||||
if(exactSize == 0)
|
||||
return;
|
||||
|
||||
float scaleFactor = min(drawRect.width() / (float)exactSize, drawRect.height() / (float)exactSize);
|
||||
float scaleFactor = std::min(drawRect.width() / (float)exactSize, drawRect.height() / (float)exactSize);
|
||||
dest += (m_item->getDisplacement() - Point(32,32)) * scaleFactor;
|
||||
|
||||
g_painter->setColor(m_color);
|
||||
|
|
|
@ -77,7 +77,7 @@ void UIMap::movePixels(int x, int y)
|
|||
|
||||
bool UIMap::setZoom(int zoom)
|
||||
{
|
||||
m_zoom = min(max(zoom, m_maxZoomIn), m_maxZoomOut);
|
||||
m_zoom = std::min(std::max(zoom, m_maxZoomIn), m_maxZoomOut);
|
||||
updateVisibleDimension();
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -44,35 +44,35 @@ void UIProgressRect::drawSelf(Fw::DrawPane drawPane)
|
|||
// 0% - 12.5% (12.5)
|
||||
// triangle from top center, to top right (var x)
|
||||
if(m_percent < 12.5) {
|
||||
Point var = Point(max(m_percent - 0.0, 0.0) * (drawRect.right() - drawRect.horizontalCenter()) / 12.5, 0);
|
||||
Point var = Point(std::max(m_percent - 0.0, 0.0) * (drawRect.right() - drawRect.horizontalCenter()) / 12.5, 0);
|
||||
g_painter->drawFilledTriangle(drawRect.center(), drawRect.topRight() + Point(1,0), drawRect.topCenter() + var);
|
||||
}
|
||||
|
||||
// 12.5% - 37.5% (25)
|
||||
// triangle from top right to bottom right (var y)
|
||||
if(m_percent < 37.5) {
|
||||
Point var = Point(0, max(m_percent - 12.5, 0.0) * (drawRect.bottom() - drawRect.top()) / 25.0);
|
||||
Point var = Point(0, std::max(m_percent - 12.5, 0.0) * (drawRect.bottom() - drawRect.top()) / 25.0);
|
||||
g_painter->drawFilledTriangle(drawRect.center(), drawRect.bottomRight() + Point(1,1), drawRect.topRight() + var + Point(1,0));
|
||||
}
|
||||
|
||||
// 37.5% - 62.5% (25)
|
||||
// triangle from bottom right to bottom left (var x)
|
||||
if(m_percent < 62.5) {
|
||||
Point var = Point(max(m_percent - 37.5, 0.0) * (drawRect.right() - drawRect.left()) / 25.0, 0);
|
||||
Point var = Point(std::max(m_percent - 37.5, 0.0) * (drawRect.right() - drawRect.left()) / 25.0, 0);
|
||||
g_painter->drawFilledTriangle(drawRect.center(), drawRect.bottomLeft() + Point(0,1), drawRect.bottomRight() - var + Point(1,1));
|
||||
}
|
||||
|
||||
// 62.5% - 87.5% (25)
|
||||
// triangle from bottom left to top left
|
||||
if(m_percent < 87.5) {
|
||||
Point var = Point(0, max(m_percent - 62.5, 0.0) * (drawRect.bottom() - drawRect.top()) / 25.0);
|
||||
Point var = Point(0, std::max(m_percent - 62.5, 0.0) * (drawRect.bottom() - drawRect.top()) / 25.0);
|
||||
g_painter->drawFilledTriangle(drawRect.center(), drawRect.topLeft(), drawRect.bottomLeft() - var + Point(0,1));
|
||||
}
|
||||
|
||||
// 87.5% - 100% (12.5)
|
||||
// triangle from top left to top center
|
||||
if(m_percent < 100) {
|
||||
Point var = Point(max(m_percent - 87.5, 0.0) * (drawRect.horizontalCenter() - drawRect.left()) / 12.5, 0);
|
||||
Point var = Point(std::max(m_percent - 87.5, 0.0) * (drawRect.horizontalCenter() - drawRect.left()) / 12.5, 0);
|
||||
g_painter->drawFilledTriangle(drawRect.center(), drawRect.topCenter(), drawRect.topLeft() + var);
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ void UIProgressRect::drawSelf(Fw::DrawPane drawPane)
|
|||
|
||||
void UIProgressRect::setPercent(float percent)
|
||||
{
|
||||
m_percent = max(min((double)percent, 100.0), 0.0);
|
||||
m_percent = std::max(std::min((double)percent, 100.0), 0.0);
|
||||
}
|
||||
|
||||
void UIProgressRect::onStyleApply(const std::string& styleName, const OTMLNodePtr& styleNode)
|
||||
|
|
|
@ -89,7 +89,7 @@ bool AdaptativeFrameCounter::update()
|
|||
|
||||
void AdaptativeFrameCounter::setMaxFps(int maxFps)
|
||||
{
|
||||
maxFps = max(min(maxFps, 1000), 0);
|
||||
maxFps = std::max(std::min(maxFps, 1000), 0);
|
||||
|
||||
if(maxFps != 0) {
|
||||
m_bestFrameDelay = 1000000 / maxFps;
|
||||
|
|
|
@ -209,7 +209,7 @@ const std::vector<Point>& BitmapFont::calculateGlyphsPositions(const std::string
|
|||
lineWidths[lines] += m_glyphsSize[glyph].width() ;
|
||||
if((i+1 != textLength && text[i+1] != '\n')) // only add space if letter is not the last or before a \n.
|
||||
lineWidths[lines] += m_glyphSpacing.width();
|
||||
maxLineWidth = max(maxLineWidth, lineWidths[lines]);
|
||||
maxLineWidth = std::max(maxLineWidth, lineWidths[lines]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -149,8 +149,8 @@ Size FrameBuffer::getSize()
|
|||
{
|
||||
if(m_fbo == 0) {
|
||||
// the buffer size is limited by the window size
|
||||
return Size(min(m_texture->getWidth(), g_window.getWidth()),
|
||||
min(m_texture->getHeight(), g_window.getHeight()));
|
||||
return Size(std::min(m_texture->getWidth(), g_window.getWidth()),
|
||||
std::min(m_texture->getHeight(), g_window.getHeight()));
|
||||
}
|
||||
return m_texture->getSize();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue