Use PIXEL_SIZE to move to next pixel in I/O.
This commit is contained in:
parent
afd89f5238
commit
5f78958584
36
rotation.cpp
36
rotation.cpp
|
@ -195,10 +195,11 @@ struct Image {
|
||||||
pvalue_t* pixel = buffer;
|
pvalue_t* pixel = buffer;
|
||||||
for (unsigned int i = 0; i < nb_pixels; ++i)
|
for (unsigned int i = 0; i < nb_pixels; ++i)
|
||||||
{
|
{
|
||||||
*(pixel++) = istr.get();
|
pixel[0] = istr.get();
|
||||||
*(pixel++) = istr.get();
|
pixel[1] = istr.get();
|
||||||
*(pixel++) = istr.get();
|
pixel[2] = istr.get();
|
||||||
*(pixel++) = 0; // padding
|
|
||||||
|
pixel += PIXEL_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -210,10 +211,11 @@ struct Image {
|
||||||
pvalue_t* pixel = buffer;
|
pvalue_t* pixel = buffer;
|
||||||
for (unsigned int i = 0; i < nb_pixels; ++i)
|
for (unsigned int i = 0; i < nb_pixels; ++i)
|
||||||
{
|
{
|
||||||
ostr << (char) *(pixel++);
|
ostr << (char) pixel[0];
|
||||||
ostr << (char) *(pixel++);
|
ostr << (char) pixel[1];
|
||||||
ostr << (char) *(pixel++);
|
ostr << (char) pixel[2];
|
||||||
pixel++; // padding
|
|
||||||
|
pixel += PIXEL_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -402,10 +404,11 @@ struct TiledImage : public Image {
|
||||||
for (unsigned int i = 0; i < width; ++i)
|
for (unsigned int i = 0; i < width; ++i)
|
||||||
{
|
{
|
||||||
pvalue_t* tile = this->access_pixel(i, j);
|
pvalue_t* tile = this->access_pixel(i, j);
|
||||||
*(tile++) = istr.get();
|
tile[0] = istr.get();
|
||||||
*(tile++) = istr.get();
|
tile[1] = istr.get();
|
||||||
*(tile++) = istr.get();
|
tile[2] = istr.get();
|
||||||
*(tile++) = 0; // padding
|
|
||||||
|
tile += PIXEL_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->fill_overlap();
|
this->fill_overlap();
|
||||||
|
@ -419,10 +422,11 @@ struct TiledImage : public Image {
|
||||||
for (unsigned int i = 0; i < width; ++i)
|
for (unsigned int i = 0; i < width; ++i)
|
||||||
{
|
{
|
||||||
pvalue_t const* tile = this->access_pixel(i, j);
|
pvalue_t const* tile = this->access_pixel(i, j);
|
||||||
ostr << (char) *(tile++);
|
ostr << (char) tile[0];
|
||||||
ostr << (char) *(tile++);
|
ostr << (char) tile[1];
|
||||||
ostr << (char) *(tile++);
|
ostr << (char) tile[2];
|
||||||
tile++; // padding
|
|
||||||
|
tile += PIXEL_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue