@@ -140,9 +140,7 @@ namespace bmp {
140140 m_height(std::exchange(other.m_height, 0 )) {
141141 }
142142
143- virtual ~Bitmap () noexcept {
144- m_pixels.clear ();
145- }
143+ virtual ~Bitmap () noexcept = default ;
146144
147145 public: /* Draw Primitives */
148146 /* *
@@ -471,7 +469,8 @@ namespace bmp {
471469 * Vertically flips the bitmap and returns the flipped version
472470 *
473471 */
474- Bitmap flip_v () {
472+ [[nodiscard(" flip_v() is immutable" )]]
473+ Bitmap flip_v () const {
475474 Bitmap finished (m_width, m_height);
476475 for (std::int32_t x = 0 ; x < m_width; ++x) {
477476 for (std::int32_t y = 0 ; y < m_height; ++y) {
@@ -486,7 +485,8 @@ namespace bmp {
486485 * Horizontally flips the bitmap and returns the flipped version
487486 *
488487 */
489- Bitmap flip_h () {
488+ [[nodiscard(" flip_h() is immutable" )]]
489+ Bitmap flip_h () const {
490490 Bitmap finished (m_width, m_height);
491491 for (std::int32_t y = 0 ; y < m_height; ++y) {
492492 for (std::int32_t x = 0 ; x < m_width; ++x) {
@@ -501,7 +501,8 @@ namespace bmp {
501501 * Rotates the bitmap to the right and returns the rotated version
502502 *
503503 */
504- Bitmap rotate_90_left () {
504+ [[nodiscard(" rotate_90_left() is immutable" )]]
505+ Bitmap rotate_90_left () const {
505506 Bitmap finished (m_height, m_width); // Swap dimensions
506507
507508 for (std::int32_t y = 0 ; y < m_height; ++y) {
@@ -519,7 +520,8 @@ namespace bmp {
519520 * Rotates the bitmap to the left and returns the rotated version
520521 *
521522 */
522- Bitmap rotate_90_right () {
523+ [[nodiscard(" rotate_90_right() is immutable" )]]
524+ Bitmap rotate_90_right () const {
523525 Bitmap finished (m_height, m_width); // Swap dimensions
524526 for (std::int32_t y = 0 ; y < m_height; ++y) {
525527 std::int32_t y_offset = y * m_width; // Precompute row start index
@@ -530,6 +532,7 @@ namespace bmp {
530532
531533 return finished;
532534 }
535+
533536 /* *
534537 * Saves Bitmap pixels into a file
535538 * @throws bmp::Exception on error
@@ -648,12 +651,6 @@ namespace bmp {
648651 [[nodiscard]] constexpr std::size_t IX (const std::int32_t x, const std::int32_t y) const noexcept {
649652 return static_cast <std::size_t >(x) + static_cast <std::size_t >(m_width) * static_cast <std::size_t >(y);
650653 }
651- /* *
652- * Converts 2D x,y coords into 1D index, with changed width
653- */
654- [[nodiscard]] constexpr std::size_t IX (const std::int32_t x, const std::int32_t y, const std::int32_t width) const noexcept {
655- return static_cast <std::size_t >(x) + static_cast <std::size_t >(m_width) * static_cast <std::size_t >(y);
656- }
657654 /* *
658655 * Returns true if x,y coords are within boundaries
659656 */
0 commit comments