diff --git a/src/SFML/Graphics/Texture.cpp b/src/SFML/Graphics/Texture.cpp index f462f2632..378370153 100644 --- a/src/SFML/Graphics/Texture.cpp +++ b/src/SFML/Graphics/Texture.cpp @@ -372,14 +372,14 @@ Image Texture::copyToImage() const // Then we copy the useful pixels from the temporary array to the final one const Uint8* src = &allPixels[0]; Uint8* dst = &pixels[0]; - unsigned int srcPitch = m_actualSize.x * 4; + int srcPitch = static_cast(m_actualSize.x * 4); unsigned int dstPitch = m_size.x * 4; // Handle the case where source pixels are flipped vertically if (m_pixelsFlipped) { - src += srcPitch * (m_size.y - 1); - srcPitch = UINT_MAX - srcPitch + 1; + src += static_cast(srcPitch * static_cast((m_size.y - 1))); + srcPitch = -srcPitch; } for (unsigned int i = 0; i < m_size.y; ++i)