mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 14:21:04 +08:00
Enable clang-tidy bugprone-misplaced-widening-cast
check
This commit is contained in:
parent
5580720ae0
commit
9f88867d90
@ -15,7 +15,6 @@ Checks: >
|
|||||||
-bugprone-exception-escape,
|
-bugprone-exception-escape,
|
||||||
-bugprone-implicit-widening-of-multiplication-result,
|
-bugprone-implicit-widening-of-multiplication-result,
|
||||||
-bugprone-integer-division,
|
-bugprone-integer-division,
|
||||||
-bugprone-misplaced-widening-cast,
|
|
||||||
-bugprone-narrowing-conversions,
|
-bugprone-narrowing-conversions,
|
||||||
-bugprone-signed-char-misuse,
|
-bugprone-signed-char-misuse,
|
||||||
-bugprone-string-integer-assignment,
|
-bugprone-string-integer-assignment,
|
||||||
|
@ -541,7 +541,7 @@ void Image::flipVertically()
|
|||||||
{
|
{
|
||||||
if (!m_pixels.empty())
|
if (!m_pixels.empty())
|
||||||
{
|
{
|
||||||
const auto rowSize = static_cast<std::vector<std::uint8_t>::iterator::difference_type>(m_size.x * 4);
|
const auto rowSize = static_cast<std::vector<std::uint8_t>::iterator::difference_type>(m_size.x) * 4;
|
||||||
|
|
||||||
auto top = m_pixels.begin();
|
auto top = m_pixels.begin();
|
||||||
auto bottom = m_pixels.end() - rowSize;
|
auto bottom = m_pixels.end() - rowSize;
|
||||||
|
@ -412,10 +412,10 @@ Image Texture::copyToImage() const
|
|||||||
if (m_pixelsFlipped)
|
if (m_pixelsFlipped)
|
||||||
{
|
{
|
||||||
// Flip the texture vertically
|
// Flip the texture vertically
|
||||||
const auto stride = static_cast<std::ptrdiff_t>(m_size.x * 4);
|
const auto stride = static_cast<std::ptrdiff_t>(m_size.x) * 4;
|
||||||
auto currentRowIterator = pixels.begin();
|
auto currentRowIterator = pixels.begin();
|
||||||
auto nextRowIterator = pixels.begin() + stride;
|
auto nextRowIterator = pixels.begin() + stride;
|
||||||
auto reverseRowIterator = pixels.begin() + (stride * static_cast<std::ptrdiff_t>(m_size.y - 1));
|
auto reverseRowIterator = pixels.begin() + (stride * (static_cast<std::ptrdiff_t>(m_size.y) - 1));
|
||||||
for (unsigned int i = 0; i < m_size.y / 2; ++i)
|
for (unsigned int i = 0; i < m_size.y / 2; ++i)
|
||||||
{
|
{
|
||||||
std::swap_ranges(currentRowIterator, nextRowIterator, reverseRowIterator);
|
std::swap_ranges(currentRowIterator, nextRowIterator, reverseRowIterator);
|
||||||
|
@ -317,7 +317,7 @@ void pushEvent(const sf::Event& event)
|
|||||||
TouchSlot& atSlot(int idx)
|
TouchSlot& atSlot(int idx)
|
||||||
{
|
{
|
||||||
if (idx >= static_cast<int>(touchSlots.size()))
|
if (idx >= static_cast<int>(touchSlots.size()))
|
||||||
touchSlots.resize(static_cast<std::size_t>(idx + 1));
|
touchSlots.resize(static_cast<std::size_t>(idx) + 1);
|
||||||
return touchSlots.at(static_cast<std::size_t>(idx));
|
return touchSlots.at(static_cast<std::size_t>(idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user