Codechange: Remove min/max functions in favour of STL variants (#8502)
This commit is contained in:
@@ -74,7 +74,7 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
|
||||
dst = dst_end - bp->skip_left;
|
||||
dst_end = dst + bp->width;
|
||||
|
||||
n = min<uint>(n - d, (uint)bp->width);
|
||||
n = std::min(n - d, (uint)bp->width);
|
||||
goto draw;
|
||||
}
|
||||
dst += n;
|
||||
@@ -89,7 +89,7 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
|
||||
dst_end += bp->width;
|
||||
|
||||
while (dst < dst_end) {
|
||||
n = min<uint>(*src_n++, (uint)(dst_end - dst));
|
||||
n = std::min<uint>(*src_n++, dst_end - dst);
|
||||
|
||||
if (src_px->a == 0) {
|
||||
anim += n;
|
||||
|
@@ -58,7 +58,7 @@ void Blitter_32bppSSE2_Anim::PaletteAnimate(const Palette &palette)
|
||||
if (x < 8 || colour_cmp_result != 0xFFFF ||
|
||||
_mm_movemask_epi8(_mm_cmpeq_epi16(_mm_srli_epi16(data, 8), brightness_cmp)) != 0xFFFF) {
|
||||
/* slow path: < 8 pixels left or unexpected brightnesses */
|
||||
for (int z = min<int>(x, 8); z != 0 ; z--) {
|
||||
for (int z = std::min<int>(x, 8); z != 0 ; z--) {
|
||||
int value = _mm_extract_epi16(data, 0);
|
||||
uint8 colour = GB(value, 0, 8);
|
||||
if (colour >= PALETTE_ANIM_START) {
|
||||
|
@@ -174,9 +174,9 @@ Colour Blitter_32bppBase::ReallyAdjustBrightness(Colour colour, uint8 brightness
|
||||
/* Reduce overbright strength */
|
||||
ob /= 2;
|
||||
return Colour(
|
||||
r >= 255 ? 255 : min(r + ob * (255 - r) / 256, 255),
|
||||
g >= 255 ? 255 : min(g + ob * (255 - g) / 256, 255),
|
||||
b >= 255 ? 255 : min(b + ob * (255 - b) / 256, 255),
|
||||
r >= 255 ? 255 : std::min(r + ob * (255 - r) / 256, 255),
|
||||
g >= 255 ? 255 : std::min(g + ob * (255 - g) / 256, 255),
|
||||
b >= 255 ? 255 : std::min(b + ob * (255 - b) / 256, 255),
|
||||
colour.a);
|
||||
}
|
||||
|
||||
|
@@ -83,7 +83,7 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
|
||||
dst = dst_end - bp->skip_left;
|
||||
dst_end = dst + bp->width;
|
||||
|
||||
n = min<uint>(n - d, (uint)bp->width);
|
||||
n = std::min(n - d, (uint)bp->width);
|
||||
goto draw;
|
||||
}
|
||||
dst += n;
|
||||
@@ -98,7 +98,7 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
|
||||
dst_end += bp->width;
|
||||
|
||||
while (dst < dst_end) {
|
||||
n = min<uint>(*src_n++, (uint)(dst_end - dst));
|
||||
n = std::min<uint>(*src_n++, dst_end - dst);
|
||||
|
||||
if (src_px->a == 0) {
|
||||
dst += n;
|
||||
@@ -324,7 +324,7 @@ Sprite *Blitter_32bppOptimized::Encode(const SpriteLoader::Sprite *sprite, Alloc
|
||||
*dst_n = src->m;
|
||||
if (src->m != 0) {
|
||||
/* Get brightest value */
|
||||
uint8 rgb_max = max(src->r, max(src->g, src->b));
|
||||
uint8 rgb_max = std::max({src->r, src->g, src->b});
|
||||
|
||||
/* Black pixel (8bpp or old 32bpp image), so use default value */
|
||||
if (rgb_max == 0) rgb_max = DEFAULT_BRIGHTNESS;
|
||||
|
@@ -132,7 +132,7 @@ Sprite *Blitter_32bppSimple::Encode(const SpriteLoader::Sprite *sprite, Allocato
|
||||
dst[i].v = 0;
|
||||
} else {
|
||||
/* Get brightest value */
|
||||
uint8 rgb_max = max(src->r, max(src->g, src->b));
|
||||
uint8 rgb_max = std::max({src->r, src->g, src->b});
|
||||
|
||||
/* Black pixel (8bpp or old 32bpp image), so use default value */
|
||||
if (rgb_max == 0) rgb_max = DEFAULT_BRIGHTNESS;
|
||||
|
@@ -80,7 +80,7 @@ Sprite *Blitter_32bppSSE_Base::Encode(const SpriteLoader::Sprite *sprite, Alloca
|
||||
if (src->m >= PALETTE_ANIM_START) has_anim = true;
|
||||
|
||||
/* Get brightest value (or default brightness if it's a black pixel). */
|
||||
const uint8 rgb_max = max(src->r, max(src->g, src->b));
|
||||
const uint8 rgb_max = std::max({src->r, src->g, src->b});
|
||||
dst_mv->v = (rgb_max == 0) ? Blitter_32bppBase::DEFAULT_BRIGHTNESS : rgb_max;
|
||||
|
||||
/* Pre-convert the mapping channel to a RGB value. */
|
||||
|
@@ -80,7 +80,7 @@ void Blitter_8bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Z
|
||||
dst += trans;
|
||||
width -= trans;
|
||||
if (width <= 0 || pixels == 0) continue;
|
||||
pixels = min<uint>(pixels, (uint)width);
|
||||
pixels = std::min<uint>(pixels, width);
|
||||
width -= pixels;
|
||||
|
||||
switch (mode) {
|
||||
|
@@ -45,7 +45,7 @@ void Blitter::DrawLineGeneric(int x, int y, int x2, int y2, int screen_width, in
|
||||
return;
|
||||
}
|
||||
|
||||
int frac_diff = width * max(dx, dy);
|
||||
int frac_diff = width * std::max(dx, dy);
|
||||
if (width > 1) {
|
||||
/* compute frac_diff = width * sqrt(dx*dx + dy*dy)
|
||||
* Start interval:
|
||||
|
Reference in New Issue
Block a user