Hi all,
there is this nagging bug (#49) with boost::gil which I have a hard time
figuring out.
Please consider the following code:
#define _CRT_SECURE_NO_WARNINGS 1
#include
#include
using namespace boost::gil;
int main()
{
using ref_t = const bit_aligned_pixel_reference, bgr_layout_t, true>;
using ptr_t = bit_aligned_pixel_iterator;
using pixel_t = std::iterator_traits::value_type;
using bgr121_image_t = image;
//////////////////////
// works
//////////////////////
{
bgr121_image_t a(10, 10);
fill_pixels(view(a), pixel_t(0, 0, 1));
auto loc = view(a).xy_at(0, 0);
for (int y = 0; y < view(a).height(); ++y)
{
*loc = pixel_t(1, 0, 0);
++loc.x();
++loc.y();
}
auto v = color_converted_view(view(a));
write_view("a.bmp", v, bmp_tag());
}
//////////////////////
// doesn't work
//////////////////////
{
bgr121_image_t b(10, 10);
fill_pixels(view(b), pixel_t(0, 0, 1));
auto loc = view(b).xy_at(0, view(b).height() - 1);
for (int y = 0; y < view(b).height(); ++y)
{
*loc = pixel_t(1, 0, 0);
++loc.x();
--loc.y();
}
auto v = color_converted_view(view(b));
write_view("b.bmp", v, bmp_tag());
}
}
When running with VS 2017 all is working in Debug but with Release the
second image is incorrect.
The bug should be in the locator code.
Anyone has an idea what is going wrong or what else I should try?
Thanks,
Christian