Audacity 3.2.0
|
Cache containing rasterized bitmaps representing the waveform. More...
#include <WaveBitmapCache.h>
Classes | |
struct | LookupHelper |
Public Member Functions | |
WaveBitmapCache (const WaveClip &waveClip, std::shared_ptr< WaveDataCache > dataCache, ElementFactory elementFactory) | |
~WaveBitmapCache () override | |
WaveBitmapCache & | SetPaintParameters (const WavePaintParameters ¶ms) |
WaveBitmapCache & | SetSelection (const ZoomInfo &zoomInfo, double t0, double t1, bool selected) |
Public Member Functions inherited from GraphicsDataCache< WaveBitmapCacheElement > | |
GraphicsDataCache (const GraphicsDataCache &)=delete | |
GraphicsDataCache (double scaledSampleRate, ElementFactory elementFactory) | |
GraphicsDataCache & | operator= (const GraphicsDataCache &)=delete |
~GraphicsDataCache () override | |
IteratorRange< GraphicsDataCacheIterator< WaveBitmapCacheElement > > | PerformLookup (const ZoomInfo &zoomInfo, double t0, double t1) |
const WaveBitmapCacheElement * | PerformLookup (GraphicsDataCacheKey key) |
void | setInitializer (Initializer initializer) |
Public Member Functions inherited from GraphicsDataCacheBase | |
virtual | ~GraphicsDataCacheBase ()=default |
void | Invalidate () |
Invalidate the cache content. More... | |
double | GetScaledSampleRate () const noexcept |
Returns the sample rate associated with cache. More... | |
void | UpdateViewportWidth (int64_t width) noexcept |
int64_t | GetMaxViewportWidth () const noexcept |
Private Member Functions | |
bool | InitializeElement (const GraphicsDataCacheKey &key, WaveBitmapCacheElement &element) override |
void | CheckCache (const ZoomInfo &, double, double) override |
Private Attributes | |
WavePaintParameters | mPaintParamters |
struct { | |
int64_t FirstPixel { -1 } | |
int64_t LastPixel { -1 } | |
} | mSelection |
std::unique_ptr< LookupHelper > | mLookupHelper |
const Envelope * | mEnvelope { nullptr } |
size_t | mEnvelopeVersion { 0 } |
const WaveClip & | mWaveClip |
Observer::Subscription | mStretchChangedSubscription |
Additional Inherited Members | |
Public Types inherited from GraphicsDataCache< WaveBitmapCacheElement > | |
using | ElementFactory = std::function< std::unique_ptr< WaveBitmapCacheElement >()> |
using | Initializer = std::function< bool(const GraphicsDataCacheKey &Key, WaveBitmapCacheElement &element)> |
Static Public Attributes inherited from GraphicsDataCacheBase | |
static constexpr uint32_t | CacheElementWidth = 256 |
Protected Types inherited from GraphicsDataCacheBase | |
using | Lookup = std::vector< LookupElement > |
Cache lookup is a vector, with items sorted using Key. More... | |
virtual void | CheckCache (const ZoomInfo &, double, double) |
virtual bool | InitializeElement (const GraphicsDataCacheKey &key, WaveBitmapCacheElement &element) |
Protected Member Functions inherited from GraphicsDataCacheBase | |
GraphicsDataCacheBase (double scaledSampleRate) | |
void | SetScaledSampleRate (double scaledSampleRate) |
virtual GraphicsDataCacheElementBase * | CreateElement (const GraphicsDataCacheKey &key)=0 |
Create a new Cache element. Implementation is responsible of the lifetime control. More... | |
virtual void | DisposeElement (GraphicsDataCacheElementBase *element)=0 |
This method is called, when the cache element should be evicted. Implementation may not deallocate the object. More... | |
virtual bool | UpdateElement (const GraphicsDataCacheKey &key, GraphicsDataCacheElementBase &element)=0 |
This method is called on all elements matching the request that are not complete (i. e. IsComplete if false). More... | |
BaseLookupResult | PerformBaseLookup (const ZoomInfo &zoomInfo, double t0, double t1) |
Perform a lookup inside the cache. This method modifies mLookup and invalidates any previous result. More... | |
const GraphicsDataCacheElementBase * | PerformBaseLookup (GraphicsDataCacheKey key) |
Perform a lookup for the given key. This method modifies mLookup and invalidates any previous result. More... | |
Cache containing rasterized bitmaps representing the waveform.
Definition at line 41 of file WaveBitmapCache.h.
WaveBitmapCache::WaveBitmapCache | ( | const WaveClip & | waveClip, |
std::shared_ptr< WaveDataCache > | dataCache, | ||
ElementFactory | elementFactory | ||
) |
Definition at line 329 of file WaveBitmapCache.cpp.
References WaveClip::GetRate(), WaveClip::GetStretchRatio(), mWaveClip, and GraphicsDataCacheBase::SetScaledSampleRate().
|
overridedefault |
|
overrideprivatevirtual |
Reimplemented from GraphicsDataCache< WaveBitmapCacheElement >.
Definition at line 388 of file WaveBitmapCache.cpp.
References Envelope::GetVersion(), GraphicsDataCacheBase::Invalidate(), mEnvelope, and mEnvelopeVersion.
|
overrideprivatevirtual |
Reimplemented from GraphicsDataCache< WaveBitmapCacheElement >.
Definition at line 397 of file WaveBitmapCache.cpp.
References WaveBitmapCacheElement::Allocate(), WaveBitmapCacheElement::AvailableColumns, WavePaintParameters::BlankColor, FrameStatistics::CreateStopwatch(), WavePaintParameters::Height, GraphicsDataCacheElementBase::IsComplete, key, mLookupHelper, mPaintParamters, and FrameStatistics::WaveBitmapCache.
WaveBitmapCache & WaveBitmapCache::SetPaintParameters | ( | const WavePaintParameters & | params | ) |
Definition at line 353 of file WaveBitmapCache.cpp.
References Envelope::GetVersion(), GraphicsDataCacheBase::Invalidate(), mEnvelope, mEnvelopeVersion, mPaintParamters, and params.
WaveBitmapCache & WaveBitmapCache::SetSelection | ( | const ZoomInfo & | zoomInfo, |
double | t0, | ||
double | t1, | ||
bool | selected | ||
) |
Definition at line 367 of file WaveBitmapCache.cpp.
References GraphicsDataCacheBase::Invalidate(), mSelection, and ZoomInfo::TimeToPosition().
int64_t WaveBitmapCache::FirstPixel { -1 } |
Definition at line 64 of file WaveBitmapCache.h.
Referenced by WaveBitmapCache::LookupHelper::PerformLookup().
int64_t WaveBitmapCache::LastPixel { -1 } |
Definition at line 65 of file WaveBitmapCache.h.
Referenced by WaveBitmapCache::LookupHelper::PerformLookup().
|
private |
Definition at line 75 of file WaveBitmapCache.h.
Referenced by CheckCache(), WaveBitmapCache::LookupHelper::PerformLookup(), and SetPaintParameters().
|
private |
Definition at line 76 of file WaveBitmapCache.h.
Referenced by CheckCache(), and SetPaintParameters().
|
private |
Definition at line 73 of file WaveBitmapCache.h.
Referenced by InitializeElement().
|
private |
Definition at line 60 of file WaveBitmapCache.h.
Referenced by InitializeElement(), WaveBitmapCache::LookupHelper::PerformLookup(), and SetPaintParameters().
struct { ... } WaveBitmapCache::mSelection |
Referenced by WaveBitmapCache::LookupHelper::PerformLookup(), and SetSelection().
|
private |
Definition at line 79 of file WaveBitmapCache.h.
|
private |
Definition at line 78 of file WaveBitmapCache.h.
Referenced by WaveBitmapCache().