fix crash that could occur when calling pixel_buffer::put with rgb24
This commit is contained in:
parent
1e65dd8d66
commit
2c54714646
@ -238,10 +238,18 @@ namespace nana{ namespace paint
|
|||||||
auto d = rawptr;
|
auto d = rawptr;
|
||||||
const unsigned char* s;
|
const unsigned char* s;
|
||||||
|
|
||||||
|
int src_line_bytes;
|
||||||
|
|
||||||
if (is_negative)
|
if (is_negative)
|
||||||
|
{
|
||||||
s = rawbits;
|
s = rawbits;
|
||||||
|
src_line_bytes = -static_cast<int>(bytes_per_line);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
s = rawbits + bytes_per_line * (height - 1);
|
s = rawbits + bytes_per_line * (height - 1);
|
||||||
|
src_line_bytes = static_cast<int>(bytes_per_line);
|
||||||
|
}
|
||||||
|
|
||||||
for(std::size_t i = 0; i < height; ++i)
|
for(std::size_t i = 0; i < height; ++i)
|
||||||
{
|
{
|
||||||
@ -256,7 +264,7 @@ namespace nana{ namespace paint
|
|||||||
s_p += 3;
|
s_p += 3;
|
||||||
}
|
}
|
||||||
d += pixel_size.width;
|
d += pixel_size.width;
|
||||||
s -= bytes_per_line;
|
s -= src_line_bytes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(16 == bits_per_pixel)
|
else if(16 == bits_per_pixel)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user