mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Fixed a bug in the image_display widget. If you switched it between
images of a different size while any kind of zoom was in effect it could cause a segmentation fault.
This commit is contained in:
parent
b5511d2cb3
commit
29d6051e59
@ -3228,9 +3228,16 @@ namespace dlib
|
||||
// if the new image has a different size when compared to the previous image
|
||||
// then we should readjust the total rectangle size.
|
||||
if (new_img.nr() != img.nr() || new_img.nc() != img.nc())
|
||||
set_total_rect_size(new_img.nc(), new_img.nr());
|
||||
{
|
||||
if (zoom_in_scale != 1)
|
||||
set_total_rect_size(new_img.nc()*zoom_in_scale, new_img.nr()*zoom_in_scale);
|
||||
else
|
||||
set_total_rect_size(new_img.nc()/zoom_out_scale, new_img.nr()/zoom_out_scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
parent.invalidate_rectangle(rect);
|
||||
}
|
||||
|
||||
assign_image_scaled(img,new_img);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user