diff options
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/film_viewer.cc | 13 | ||||
| -rw-r--r-- | src/wx/film_viewer.h | 14 | ||||
| -rw-r--r-- | src/wx/timer_display.cc | 64 | ||||
| -rw-r--r-- | src/wx/timer_display.h | 29 | ||||
| -rw-r--r-- | src/wx/wscript | 1 |
5 files changed, 120 insertions, 1 deletions
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index b99bea6f7..fc871d7f3 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -92,6 +92,8 @@ FilmViewer::FilmViewer (wxWindow* p) , _in_watermark (false) , _background_image (false) #endif + , _state_timer ("viewer") + , _gets (0) { #ifndef __WXOSX__ _panel->SetDoubleBuffered (true); @@ -211,14 +213,17 @@ FilmViewer::recreate_butler () void FilmViewer::refresh_panel () { + _state_timer.set ("refresh-panel"); _panel->Refresh (); _panel->Update (); + _state_timer.unset (); } void FilmViewer::get () { DCPOMATIC_ASSERT (_butler); + ++_gets; do { Butler::Error e; @@ -275,9 +280,12 @@ FilmViewer::display_player_video () * image and convert it (from whatever the user has said it is) to RGB. */ + _state_timer.set ("get image"); _frame = _player_video.first->image (bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), false, true); + _state_timer.set ("ImageChanged"); ImageChanged (_player_video.first); + _state_timer.unset (); _video_position = _player_video.second; _inter_position = _player_video.first->inter_position (); @@ -337,12 +345,15 @@ FilmViewer::maybe_draw_background_image (wxPaintDC &) void FilmViewer::paint_panel () { + _state_timer.set ("paint-panel"); + wxPaintDC dc (_panel); #ifdef DCPOMATIC_VARIANT_SWAROOP if (_background_image) { dc.Clear (); maybe_draw_background_image (dc); + _state_timer.unset (); return; } #endif @@ -402,6 +413,8 @@ FilmViewer::paint_panel () dc.SetBrush (*wxTRANSPARENT_BRUSH); dc.DrawRectangle (_inter_position.x, _inter_position.y + (_panel_size.height - _out_size.height) / 2, _inter_size.width, _inter_size.height); } + + _state_timer.unset (); } void diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h index 972a88a5a..97da5f591 100644 --- a/src/wx/film_viewer.h +++ b/src/wx/film_viewer.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net> + Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -25,6 +25,7 @@ #include "lib/film.h" #include "lib/config.h" #include "lib/player_text.h" +#include "lib/timer.h" #include <RtAudio.h> #include <wx/wx.h> @@ -95,6 +96,14 @@ public: } #endif + StateTimer const & state_timer () const { + return _state_timer; + } + + int gets () const { + return _gets; + } + boost::signals2::signal<void (boost::weak_ptr<PlayerVideo>)> ImageChanged; boost::signals2::signal<void ()> PositionChanged; boost::signals2::signal<void (DCPTime)> Started; @@ -174,5 +183,8 @@ private: bool _background_image; #endif + StateTimer _state_timer; + int _gets; + boost::signals2::scoped_connection _config_changed_connection; }; diff --git a/src/wx/timer_display.cc b/src/wx/timer_display.cc new file mode 100644 index 000000000..7d43a3307 --- /dev/null +++ b/src/wx/timer_display.cc @@ -0,0 +1,64 @@ +/* + Copyright (C) 2019 Carl Hetherington <cth@carlh.net> + + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + DCP-o-matic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. + +*/ + +#include "timer_display.h" +#include "wx_util.h" +#include "lib/timer.h" +#include <dcp/locale_convert.h> +#include <list> + +using std::map; +using std::list; +using std::pair; +using std::make_pair; +using std::string; + +static +bool +comparator (pair<string, StateTimer::Counts> const & a, pair<string, StateTimer::Counts> const & b) +{ + return a.second.total_time > b.second.total_time; +} + +TimerDisplay::TimerDisplay (wxWindow* parent, StateTimer const & timer, int gets) + : TableDialog (parent, std_to_wx(timer.name()), 4, 0, false) +{ + map<string, StateTimer::Counts> counts = timer.counts (); + list<pair<string, StateTimer::Counts> > sorted; + for (map<string, StateTimer::Counts>::const_iterator i = counts.begin(); i != counts.end(); ++i) { + sorted.push_back (make_pair(i->first, i->second)); + } + + sorted.sort (comparator); + + add (wxString("get() calls"), true); + add (std_to_wx(dcp::locale_convert<string>(gets)), false); + add_spacer (); + add_spacer (); + + for (list<pair<string, StateTimer::Counts> >::const_iterator i = sorted.begin(); i != sorted.end(); ++i) { + add (std_to_wx(i->first), true); + add (std_to_wx(dcp::locale_convert<string>(i->second.total_time)), false); + add (std_to_wx(dcp::locale_convert<string>(i->second.number)), false); + add (std_to_wx(dcp::locale_convert<string>(i->second.total_time / i->second.number)), false); + } + + layout (); +} diff --git a/src/wx/timer_display.h b/src/wx/timer_display.h new file mode 100644 index 000000000..5ee72bff5 --- /dev/null +++ b/src/wx/timer_display.h @@ -0,0 +1,29 @@ +/* + Copyright (C) 2019 Carl Hetherington <cth@carlh.net> + + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + DCP-o-matic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. + +*/ + +#include "table_dialog.h" + +class StateTimer; + +class TimerDisplay : public TableDialog +{ +public: + TimerDisplay (wxWindow* parent, StateTimer const & timer, int gets); +}; diff --git a/src/wx/wscript b/src/wx/wscript index 7740b985b..26e5eb4e0 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -122,6 +122,7 @@ sources = """ text_panel.cc text_view.cc time_picker.cc + timer_display.cc timecode.cc timeline.cc timeline_atmos_content_view.cc |
