From 5f789585844ce035f6eb78cf1dd7642e63ba69b9 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Wed, 16 Jul 2014 20:52:52 +0200 Subject: [PATCH] Use PIXEL_SIZE to move to next pixel in I/O. --- rotation.cpp | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/rotation.cpp b/rotation.cpp index b86bad7..8c97fc1 100644 --- a/rotation.cpp +++ b/rotation.cpp @@ -195,10 +195,11 @@ struct Image { pvalue_t* pixel = buffer; for (unsigned int i = 0; i < nb_pixels; ++i) { - *(pixel++) = istr.get(); - *(pixel++) = istr.get(); - *(pixel++) = istr.get(); - *(pixel++) = 0; // padding + pixel[0] = istr.get(); + pixel[1] = istr.get(); + pixel[2] = istr.get(); + + pixel += PIXEL_SIZE; } return true; @@ -210,10 +211,11 @@ struct Image { pvalue_t* pixel = buffer; for (unsigned int i = 0; i < nb_pixels; ++i) { - ostr << (char) *(pixel++); - ostr << (char) *(pixel++); - ostr << (char) *(pixel++); - pixel++; // padding + ostr << (char) pixel[0]; + ostr << (char) pixel[1]; + ostr << (char) pixel[2]; + + pixel += PIXEL_SIZE; } return true; @@ -402,10 +404,11 @@ struct TiledImage : public Image { for (unsigned int i = 0; i < width; ++i) { pvalue_t* tile = this->access_pixel(i, j); - *(tile++) = istr.get(); - *(tile++) = istr.get(); - *(tile++) = istr.get(); - *(tile++) = 0; // padding + tile[0] = istr.get(); + tile[1] = istr.get(); + tile[2] = istr.get(); + + tile += PIXEL_SIZE; } this->fill_overlap(); @@ -419,10 +422,11 @@ struct TiledImage : public Image { for (unsigned int i = 0; i < width; ++i) { pvalue_t const* tile = this->access_pixel(i, j); - ostr << (char) *(tile++); - ostr << (char) *(tile++); - ostr << (char) *(tile++); - tile++; // padding + ostr << (char) tile[0]; + ostr << (char) tile[1]; + ostr << (char) tile[2]; + + tile += PIXEL_SIZE; } return true;