summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2026-03-10 23:21:30 +0100
committerCarl Hetherington <cth@carlh.net>2026-03-10 23:21:30 +0100
commit834231bc8e76aea27cc898361e168864301a6450 (patch)
treeed5b97f9f2bc08f4fab7fb8e270bc89f77000ca9 /src
parent88342fb03c20f2e7380a11fd77fef74a4c8b454f (diff)
Fix updating of crop guess rectangle from the auto-crop dialog.
Before the change in the dialog would raise an ImageChanged which would reset the crop again, making it unchangeable.
Diffstat (limited to 'src')
-rw-r--r--src/wx/film_viewer.cc2
-rw-r--r--src/wx/gl_video_view.cc20
-rw-r--r--src/wx/gl_video_view.h2
-rw-r--r--src/wx/simple_video_view.cc7
-rw-r--r--src/wx/simple_video_view.h1
-rw-r--r--src/wx/video_view.h2
6 files changed, 33 insertions, 1 deletions
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index dbda1d7f1..b01498fc8 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -890,7 +890,7 @@ FilmViewer::set_crop_guess(dcpomatic::Rect<float> crop)
{
if (crop != _crop_guess) {
_crop_guess = crop;
- _video_view->update();
+ _video_view->update_crop_guess();
}
}
diff --git a/src/wx/gl_video_view.cc b/src/wx/gl_video_view.cc
index 0e115977d..a04cb3000 100644
--- a/src/wx/gl_video_view.cc
+++ b/src/wx/gl_video_view.cc
@@ -135,6 +135,15 @@ GLVideoView::check_for_butler_errors()
}
+void
+GLVideoView::update_crop_guess()
+{
+ /* Assume at least one update() has happened before now */
+ request(Request::SET_CROP_GUESS_AND_DRAW);
+ rethrow();
+}
+
+
/** Called from the UI thread */
void
GLVideoView::update()
@@ -952,6 +961,12 @@ try
} else if (_pending_request == Request::SET_IMAGE_AND_DRAW) {
_pending_request = Request::NONE;
set_image_and_draw();
+ } else if (_pending_request == Request::SET_CROP_GUESS_AND_DRAW) {
+ _pending_request = Request::NONE;
+ if (auto pv = player_video().first) {
+ set_image(pv);
+ }
+ draw();
}
boost::this_thread::interruption_point();
@@ -980,6 +995,11 @@ GLVideoView::display_next_frame(bool non_blocking)
void
GLVideoView::request(Request request)
{
+ if (_pending_request == Request::SET_IMAGE_AND_DRAW) {
+ /* Don't replace this; it's a superset of other requests */
+ return;
+ }
+
boost::mutex::scoped_lock lm(_playing_mutex);
_pending_request = request;
_thread_work_condition.notify_all();
diff --git a/src/wx/gl_video_view.h b/src/wx/gl_video_view.h
index 830156dd9..35f4aeeda 100644
--- a/src/wx/gl_video_view.h
+++ b/src/wx/gl_video_view.h
@@ -80,6 +80,7 @@ public:
return _canvas;
}
void update() override;
+ void update_crop_guess() override;
void start() override;
void stop() override;
@@ -97,6 +98,7 @@ private:
enum class Request {
NONE,
SET_IMAGE_AND_DRAW,
+ SET_CROP_GUESS_AND_DRAW,
};
void set_image(std::shared_ptr<const PlayerVideo> pv);
diff --git a/src/wx/simple_video_view.cc b/src/wx/simple_video_view.cc
index 2d2cbb3b6..7953e89b0 100644
--- a/src/wx/simple_video_view.cc
+++ b/src/wx/simple_video_view.cc
@@ -214,6 +214,13 @@ SimpleVideoView::display_next_frame(bool non_blocking)
void
+SimpleVideoView::update_crop_guess()
+{
+ refresh_panel();
+}
+
+
+void
SimpleVideoView::update()
{
if (!player_video().first) {
diff --git a/src/wx/simple_video_view.h b/src/wx/simple_video_view.h
index a9d3f4982..36e0e0689 100644
--- a/src/wx/simple_video_view.h
+++ b/src/wx/simple_video_view.h
@@ -44,6 +44,7 @@ public:
}
void update() override;
+ void update_crop_guess() override;
void start() override;
NextFrameResult display_next_frame(bool non_blocking) override;
diff --git a/src/wx/video_view.h b/src/wx/video_view.h
index 6a4c2225e..6de53530a 100644
--- a/src/wx/video_view.h
+++ b/src/wx/video_view.h
@@ -59,6 +59,8 @@ public:
virtual wxWindow* get() const = 0;
/** Re-make and display the image from the current _player_video */
virtual void update() = 0;
+ /** Re-draw after changes to the FilmViewer's crop_guess() */
+ virtual void update_crop_guess() = 0;
/** Called when playback starts */
virtual void start();
/** Called when playback stops */