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 ();
}
{
_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);
}
void
-GLVideoView::paint (wxPaintEvent &)
+GLVideoView::paint ()
{
_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");
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 ();
+}
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;
};