Skip to content

Commit

Permalink
bugfix: if data actually needed padding for alignment, there was a bi…
Browse files Browse the repository at this point in the history
…g problem ;)
  • Loading branch information
jonsneyers committed Sep 10, 2016
1 parent 7b85f43 commit eb4c294
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/image/image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,11 @@ template <typename pixel_t> class Plane final : public GeneralPlane {
#endif
void set(const int z, const uint32_t r, const uint32_t c, const ColorVal x) override {
// set(r*zoom_rowpixelsize(z),c*zoom_colpixelsize(z),x);
data_vec[(r*zoom_rowpixelsize(z)>>s)*width + (c*zoom_colpixelsize(z)>>s)] = x;
data[(r*zoom_rowpixelsize(z)>>s)*width + (c*zoom_colpixelsize(z)>>s)] = x;
}
ColorVal get(const int z, const uint32_t r, const uint32_t c) const override {
// return get(r*zoom_rowpixelsize(z),c*zoom_colpixelsize(z));
return data_vec[(r*zoom_rowpixelsize(z)>>s)*width + (c*zoom_colpixelsize(z)>>s)];
return data[(r*zoom_rowpixelsize(z)>>s)*width + (c*zoom_colpixelsize(z)>>s)];
}
void normalize_scale() override { s = 0; }

Expand All @@ -341,7 +341,7 @@ template <typename pixel_t> class Plane final : public GeneralPlane {
for (pixel_t& x : data) x = swap(x);
}
#endif
uint32_t result = crc32_fast(&data_vec[0], width*height*sizeof(pixel_t), previous_crc32);
uint32_t result = crc32_fast(&data[0], width*height*sizeof(pixel_t), previous_crc32);
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
// make the buffer big endian again
if (sizeof(pixel_t) == 2) {
Expand Down

0 comments on commit eb4c294

Please sign in to comment.