Audacity 3.2.0
WaveBitmapCache.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*!********************************************************************
3
4 Audacity: A Digital Audio Editor
5
6 WaveBitmapCache.h
7
8 Dmitry Vedenko
9
10**********************************************************************/
11#pragma once
12
13#include <memory>
14
15#include "GraphicsDataCache.h"
16#include "Observer.h"
18
19class wxBitmap;
20class wxImage;
21class WaveDataCache;
22class Envelope;
23class WaveClip;
24
26class WAVE_TRACK_PAINT_API WaveBitmapCacheElement :
28{
29public:
31
32 virtual uint8_t* Allocate(size_t width, size_t height) = 0;
33
34 virtual size_t Width() const = 0;
35 virtual size_t Height() const = 0;
36
37 size_t AvailableColumns { 0 };
38};
39
41class WAVE_TRACK_PAINT_API WaveBitmapCache final :
42 public GraphicsDataCache<WaveBitmapCacheElement>
43{
44public:
45 WaveBitmapCache(const WaveClip& waveClip, std::shared_ptr<WaveDataCache> dataCache,
46 ElementFactory elementFactory);
47 ~WaveBitmapCache() override;
48
49 WaveBitmapCache& SetPaintParameters(const WavePaintParameters& params);
50 WaveBitmapCache& SetSelection(const ZoomInfo& zoomInfo, double t0, double t1, bool selected);
51
52private:
53 bool InitializeElement(
54 const GraphicsDataCacheKey& key, WaveBitmapCacheElement& element) override;
55
56 void CheckCache(const ZoomInfo&, double, double) override;
57
58 struct LookupHelper;
59
61
62 struct
63 {
64 int64_t FirstPixel { -1 };
65 int64_t LastPixel { -1 };
66
67 bool IsValid() const noexcept
68 {
69 return FirstPixel < LastPixel;
70 }
71 } mSelection;
72
73 std::unique_ptr<LookupHelper> mLookupHelper;
74
75 const Envelope* mEnvelope { nullptr };
76 size_t mEnvelopeVersion { 0 };
77
80};
wxImage(22, 22)
EffectDistortionSettings params
Definition: Distortion.cpp:77
static const AudacityProject::AttachedObjects::RegisteredFactory key
Piecewise linear or piecewise exponential function from double to double.
Definition: Envelope.h:72
A move-only handle representing a connection to a Publisher.
Definition: Observer.h:70
An element, that contains a rasterized bitmap matching the WaveDataCacheElement.
virtual size_t Height() const =0
~WaveBitmapCacheElement() override
virtual uint8_t * Allocate(size_t width, size_t height)=0
virtual size_t Width() const =0
Cache containing rasterized bitmaps representing the waveform.
WavePaintParameters mPaintParamters
Observer::Subscription mStretchChangedSubscription
std::unique_ptr< LookupHelper > mLookupHelper
~WaveBitmapCache() override
const WaveClip & mWaveClip
This allows multiple clips to be a part of one WaveTrack.
Definition: WaveClip.h:238
Cache that contains the waveform data.
Definition: WaveDataCache.h:94
A base class for the for cache elements.
A key into the graphics data cache.
Parameters for the waveform painting.