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
00bc06e
..
cb12a78
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
f75d50f
..
b3f036d
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
cdc9fd5
..
54c64e4
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
d0b18d4
..
ef0c96e
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
8b3ec9f
..
4092483
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
060d982
..
44969ad
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;
};