MCPcopy Create free account
hub / github.com/SFML/SFML / flipVertically

Method flipVertically

src/SFML/Graphics/Image.cpp:741–758  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

739
740////////////////////////////////////////////////////////////
741void Image::flipVertically()
742{
743 if (!m_pixels.empty())
744 {
745 const auto rowSize = static_cast<std::vector<std::uint8_t>::iterator::difference_type>(m_size.x * 4);
746
747 auto top = m_pixels.begin();
748 auto bottom = m_pixels.end() - rowSize;
749
750 for (std::size_t y = 0; y < m_size.y / 2; ++y)
751 {
752 std::swap_ranges(top, top + rowSize, bottom);
753
754 top += rowSize;
755 bottom -= rowSize;
756 }
757 }
758}
759
760} // namespace sf

Callers 1

Image.test.cppFile · 0.80

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected