X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=libs%2Fcanvas%2Fcanvas%2Fwave_view.h;h=c98c62c7a3f731e9d637eb2827126cd973d6d165;hb=b31608f64eead818f9f965030ea4cd28e5ccf707;hp=791d0d17dabfda4ccced3548a71fe8843e28131f;hpb=2b9421fd391efcddde0be3397cb66e19b744a155;p=ardour.git diff --git a/libs/canvas/canvas/wave_view.h b/libs/canvas/canvas/wave_view.h index 791d0d17da..c98c62c7a3 100644 --- a/libs/canvas/canvas/wave_view.h +++ b/libs/canvas/canvas/wave_view.h @@ -45,14 +45,33 @@ class WaveViewTest; namespace ArdourCanvas { -class LIBCANVAS_API WaveView : virtual public Item, public Outline, public Fill +class LIBCANVAS_API WaveView : public Item { public: + enum Shape { Normal, - Rectified, + Rectified }; - + + struct CacheEntry { + int channel; + Coord height; + float amplitude; + Color fill_color; + Color outline_color; + framepos_t start; + framepos_t end; + Cairo::RefPtr image; + CacheEntry() : + channel (0), height (0), amplitude(0), fill_color (0), + outline_color (0), start (0), end (0), image (0) {} + CacheEntry(int chan, Coord hght, float amp, Color fcol, Color ocol, + framepos_t strt, framepos_t ed, Cairo::RefPtr img) : + channel (chan), height (hght), amplitude (amp), fill_color (fcol), + outline_color (ocol), start (strt), end (ed), image (img) {} + }; + /* Displays a single channel of waveform data for the given Region. x = 0 in the waveview corresponds to the first waveform datum taken @@ -72,7 +91,8 @@ public: */ - WaveView (Group *, boost::shared_ptr); + WaveView (Canvas *, boost::shared_ptr); + WaveView (Group*, boost::shared_ptr); ~WaveView (); void render (Rect const & area, Cairo::RefPtr) const; @@ -132,7 +152,9 @@ private: friend class ::WaveViewTest; - void invalidate_image (); + static std::map , std::vector > _image_cache; + void consolidate_image_cache () const; + void invalidate_image_cache (); boost::shared_ptr _region; int _channel; @@ -148,18 +170,14 @@ private: bool _logscaled_independent; bool _gradient_depth_independent; double _amplitude_above_axis; + float _region_amplitude; /** The `start' value to use for the region; we can't use the region's * value as the crossfade editor needs to alter it. */ ARDOUR::frameoffset_t _region_start; - - - mutable ARDOUR::framepos_t _sample_start; - mutable ARDOUR::framepos_t _sample_end; - mutable Cairo::RefPtr _image; - PBD::ScopedConnection invalidation_connection; + PBD::ScopedConnectionList invalidation_connection; static double _global_gradient_depth; static bool _global_logscaled; @@ -170,10 +188,12 @@ private: static PBD::Signal0 VisualPropertiesChanged; void handle_visual_property_change (); + void handle_clip_level_change (); + + void get_image (Cairo::RefPtr& image, framepos_t start, framepos_t end, double& image_offset) const; - void ensure_cache (ARDOUR::framepos_t sample_start, ARDOUR::framepos_t sample_end) const; - ArdourCanvas::Coord position (double) const; - void draw_image (ARDOUR::PeakData*, int npeaks) const; + ArdourCanvas::Coord y_extent (double) const; + void draw_image (Cairo::RefPtr&, ARDOUR::PeakData*, int) const; }; }