Commit 5cc5c116 authored by Davis King's avatar Davis King

Changed the image_window so it doesn't try to adjust the size or position

when set_image() is called with an image the same size as the one currently
being displayed.
parent 43f983f3
...@@ -3599,6 +3599,12 @@ namespace dlib ...@@ -3599,6 +3599,12 @@ namespace dlib
auto_mutex M(wm); auto_mutex M(wm);
gui_img.set_image(img); gui_img.set_image(img);
// Only ever mess with the size of the window if the user is giving us an image
// that is a different size. Otherwise we assume that they will have already
// sized the window to whatever they feel is reasonable for an image of the
// current size.
if (previous_image_size != get_rect(img))
{
const rectangle r = gui_img.get_image_display_rect(); const rectangle r = gui_img.get_image_display_rect();
if (image_rect != r) if (image_rect != r)
{ {
...@@ -3610,6 +3616,8 @@ namespace dlib ...@@ -3610,6 +3616,8 @@ namespace dlib
image_rect = r; image_rect = r;
} }
previous_image_size = get_rect(img);
}
} }
void add_overlay ( void add_overlay (
...@@ -3765,6 +3773,7 @@ namespace dlib ...@@ -3765,6 +3773,7 @@ namespace dlib
image_display gui_img; image_display gui_img;
rectangle image_rect; rectangle image_rect;
rectangle previous_image_size;
bool window_has_closed; bool window_has_closed;
bool have_last_click; bool have_last_click;
point last_clicked_point; point last_clicked_point;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment