Use PIXEL_SIZE to move to next pixel in I/O.

This commit is contained in:
Fabien Freling 2014-07-16 20:52:52 +02:00
parent afd89f5238
commit 5f78958584

View file

@ -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;