projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
45b0314
)
Fix update on drag with GL canvas.
author
Carl Hetherington
<cth@carlh.net>
Fri, 10 May 2019 15:37:16 +0000
(16:37 +0100)
committer
Carl Hetherington
<cth@carlh.net>
Fri, 10 May 2019 22:43:55 +0000
(23:43 +0100)
src/wx/film_viewer.cc
patch
|
blob
|
history
src/wx/gl_video_view.cc
patch
|
blob
|
history
src/wx/gl_video_view.h
patch
|
blob
|
history
src/wx/simple_video_view.cc
patch
|
blob
|
history
src/wx/simple_video_view.h
patch
|
blob
|
history
src/wx/video_view.h
patch
|
blob
|
history
diff --git
a/src/wx/film_viewer.cc
b/src/wx/film_viewer.cc
index 00bc06e9b7272e520402a3892a9dff2b153e0f12..cb12a78e2fc797266b973e7d8b65ea2788dc8cd6 100644
(file)
--- a/
src/wx/film_viewer.cc
+++ b/
src/wx/film_viewer.cc
@@
-215,9
+215,8
@@
FilmViewer::recreate_butler ()
void
FilmViewer::refresh_view ()
{
void
FilmViewer::refresh_view ()
{
- _state_timer.set ("refresh-view");
- _video_view->get()->Refresh ();
- _video_view->get()->Update ();
+ _state_timer.set ("update-view");
+ _video_view->update ();
_state_timer.unset ();
}
_state_timer.unset ();
}
diff --git
a/src/wx/gl_video_view.cc
b/src/wx/gl_video_view.cc
index f75d50f9dc8fd9716881458ee6cd8c0440fe66c1..b3f036ded57d30a3949724c447f5e399c7ecf4f0 100644
(file)
--- a/
src/wx/gl_video_view.cc
+++ b/
src/wx/gl_video_view.cc
@@
-41,7
+41,7
@@
GLVideoView::GLVideoView (wxWindow *parent)
{
_canvas = new wxGLCanvas (parent, wxID_ANY, 0, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE);
_context = new wxGLContext (_canvas);
{
_canvas = new wxGLCanvas (parent, wxID_ANY, 0, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE);
_context = new wxGLContext (_canvas);
- _canvas->Bind (wxEVT_PAINT, boost::bind(&GLVideoView::paint, this
, _1
));
+ _canvas->Bind (wxEVT_PAINT, boost::bind(&GLVideoView::paint, this));
_canvas->Bind (wxEVT_SIZE, boost::bind(boost::ref(Sized)));
glGenTextures (1, &_id);
_canvas->Bind (wxEVT_SIZE, boost::bind(boost::ref(Sized)));
glGenTextures (1, &_id);
@@
-65,10
+65,26
@@
check_gl_error (char const * last)
}
void
}
void
-GLVideoView::paint (
wxPaintEvent &
)
+GLVideoView::paint ()
{
_canvas->SetCurrent (*_context);
wxPaintDC dc (_canvas);
{
_canvas->SetCurrent (*_context);
wxPaintDC dc (_canvas);
+ draw ();
+}
+
+void
+GLVideoView::update ()
+{
+ if (!_canvas->IsShownOnScreen()) {
+ return;
+ }
+ wxClientDC dc (_canvas);
+ draw ();
+}
+
+void
+GLVideoView::draw ()
+{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
check_gl_error ("glClear");
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
check_gl_error ("glClear");
diff --git
a/src/wx/gl_video_view.h
b/src/wx/gl_video_view.h
index cdc9fd530ae3045157cdcf003d19421355df145d..54c64e4eae7c80c7ce31e441535a16a10ea0cca5 100644
(file)
--- a/
src/wx/gl_video_view.h
+++ b/
src/wx/gl_video_view.h
@@
-37,9
+37,11
@@
public:
wxWindow* get () const {
return _canvas;
}
wxWindow* get () const {
return _canvas;
}
+ void update ();
private:
private:
- void paint (wxPaintEvent& event);
+ void paint ();
+ void draw ();
wxGLCanvas* _canvas;
wxGLContext* _context;
wxGLCanvas* _canvas;
wxGLContext* _context;
diff --git
a/src/wx/simple_video_view.cc
b/src/wx/simple_video_view.cc
index d0b18d42102bcfa11462796243014bacc8824149..ef0c96ef2589a5baeb849301dc1104ceabfe3c19 100644
(file)
--- a/
src/wx/simple_video_view.cc
+++ b/
src/wx/simple_video_view.cc
@@
-118,3
+118,10
@@
SimpleVideoView::paint ()
dc.DrawRectangle (inter_position.x, inter_position.y + (panel_size.GetHeight() - out_size.height) / 2, inter_size.width, inter_size.height);
}
}
dc.DrawRectangle (inter_position.x, inter_position.y + (panel_size.GetHeight() - out_size.height) / 2, inter_size.width, inter_size.height);
}
}
+
+void
+SimpleVideoView::update ()
+{
+ _panel->Refresh ();
+ _panel->Update ();
+}
diff --git
a/src/wx/simple_video_view.h
b/src/wx/simple_video_view.h
index 8b3ec9f0bda91233857c978b25116c99baf46d20..40924839fad7dc900f97c2b6bbb14a92ec810075 100644
(file)
--- a/
src/wx/simple_video_view.h
+++ b/
src/wx/simple_video_view.h
@@
-36,6
+36,8
@@
public:
return _panel;
}
return _panel;
}
+ void update ();
+
private:
void paint ();
private:
void paint ();
diff --git
a/src/wx/video_view.h
b/src/wx/video_view.h
index 060d982f737c31499fb608f10d3145924a6dcb46..44969ad2d9c63cc49e0541d71afef358bbbd54d3 100644
(file)
--- a/
src/wx/video_view.h
+++ b/
src/wx/video_view.h
@@
-34,6
+34,7
@@
public:
virtual void set_image (boost::shared_ptr<const Image> image) = 0;
virtual wxWindow* get () const = 0;
virtual void set_image (boost::shared_ptr<const Image> image) = 0;
virtual wxWindow* get () const = 0;
+ virtual void update () = 0;
boost::signals2::signal<void()> Sized;
};
boost::signals2::signal<void()> Sized;
};