Browse Source

Fix MSVC warnings in engine\render\*

pull/6795/head
obligaron 2 years ago committed by Anders Jenbo
parent
commit
95940a4c7e
  1. 2
      Source/engine/render/clx_render.cpp
  2. 4
      Source/engine/render/scrollrt.cpp
  3. 6
      Source/engine/render/text_render.cpp

2
Source/engine/render/clx_render.cpp

@ -441,7 +441,7 @@ const uint8_t *RenderClxOutlineRowClipped( // NOLINT(readability-function-cognit
return SkipRestOfLineWithOverrun(src, static_cast<int_fast16_t>(srcWidth), skipSize);
}
}
skipSize = GetSkipSize(remainingWidth, srcWidth);
skipSize = GetSkipSize(remainingWidth, static_cast<int_fast16_t>(srcWidth));
return src;
}

4
Source/engine/render/scrollrt.cpp

@ -1123,8 +1123,8 @@ void DrawView(const Surface &out, Point startPosition)
int steps = std::abs(dx) > std::abs(dy) ? std::abs(dx) : std::abs(dy);
float ix = dx / (float)steps;
float iy = dy / (float)steps;
float sx = from.x;
float sy = from.y;
float sx = static_cast<float>(from.x);
float sy = static_cast<float>(from.y);
for (int i = 0; i <= steps; i++, sx += ix, sy += iy)
out.SetPixel({ (int)sx, (int)sy }, col);

6
Source/engine/render/text_render.cpp

@ -469,7 +469,7 @@ uint32_t DoDrawString(const Surface &out, std::string_view text, Rectangle rect,
characterPosition.x += width + opts.spacing;
}
maybeDrawCursor();
return remaining.data() - text.data();
return static_cast<uint32_t>(remaining.data() - text.data());
}
} // namespace
@ -699,7 +699,7 @@ uint32_t DrawString(const Surface &out, std::string_view text, const Rectangle &
opts.lineHeight = GetLineHeight(text, size);
if (HasAnyOf(opts.flags, UiFlags::VerticalCenter)) {
const int textHeight = (c_count(text, '\n') + 1) * opts.lineHeight;
const int textHeight = static_cast<int>((c_count(text, '\n') + 1) * opts.lineHeight);
characterPosition.y += std::max(0, (rect.size.height - textHeight) / 2);
}
@ -750,7 +750,7 @@ void DrawStringWithColors(const Surface &out, std::string_view fmt, DrawStringFo
opts.lineHeight = GetLineHeight(fmt, args, argsLen, size);
if (HasAnyOf(opts.flags, UiFlags::VerticalCenter)) {
int textHeight = (CountNewlines(fmt, args, argsLen) + 1) * opts.lineHeight;
const int textHeight = static_cast<int>((CountNewlines(fmt, args, argsLen) + 1) * opts.lineHeight);
characterPosition.y += std::max(0, (rect.size.height - textHeight) / 2);
}

Loading…
Cancel
Save