mirror of
				https://github.com/cookiengineer/audacity
				synced 2025-10-31 22:23:54 +01:00 
			
		
		
		
	Get rid of flicker when drawing the peak/rms meter.
This commit is contained in:
		| @@ -43,6 +43,7 @@ | |||||||
|  |  | ||||||
| #include <wx/defs.h> | #include <wx/defs.h> | ||||||
| #include <wx/dialog.h> | #include <wx/dialog.h> | ||||||
|  | #include <wx/dcbuffer.h> | ||||||
| #include <wx/dcmemory.h> | #include <wx/dcmemory.h> | ||||||
| #include <wx/image.h> | #include <wx/image.h> | ||||||
| #include <wx/intl.h> | #include <wx/intl.h> | ||||||
| @@ -1129,9 +1130,10 @@ void Meter::RepaintBarsNow() | |||||||
|    if (mLayoutValid) |    if (mLayoutValid) | ||||||
|    { |    { | ||||||
|       wxClientDC dc(this); |       wxClientDC dc(this); | ||||||
|  |       wxBufferedDC bufDC(&dc, *mBitmap); | ||||||
|       for (int i = 0; i < mNumBars; i++) |       for (int i = 0; i < mNumBars; i++) | ||||||
|       { |       { | ||||||
|          DrawMeterBar(dc, &mBar[i]); |          DrawMeterBar(bufDC, &mBar[i]); | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
| } | } | ||||||
| @@ -1213,7 +1215,6 @@ void Meter::DrawMeterBar(wxDC &dc, MeterBar *meterBar) | |||||||
|       if (meterBar->vert) |       if (meterBar->vert) | ||||||
|       { |       { | ||||||
|          // Calculate the peak and rms rectangles |          // Calculate the peak and rms rectangles | ||||||
|          // (+1 and -1 to not overlay the bevel) |  | ||||||
|          ht = (int)(meterBar->peak * h + 0.5); |          ht = (int)(meterBar->peak * h + 0.5); | ||||||
|          r = wxRect(x, y + h - ht, w, ht); |          r = wxRect(x, y + h - ht, w, ht); | ||||||
|          ht = (int)(meterBar->rms * h + 0.5); |          ht = (int)(meterBar->rms * h + 0.5); | ||||||
|   | |||||||
| @@ -25,7 +25,7 @@ | |||||||
| #include "Ruler.h" | #include "Ruler.h" | ||||||
|  |  | ||||||
| // Event used to notify all meters of preference changes | // Event used to notify all meters of preference changes | ||||||
| DECLARE_EVENT_TYPE(EVT_METER_PREFERENCES_CHANGED, -1); | DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, EVT_METER_PREFERENCES_CHANGED, -1); | ||||||
|  |  | ||||||
| // Increase this when we add support for multichannel meters | // Increase this when we add support for multichannel meters | ||||||
| // (most of the code is already there) | // (most of the code is already there) | ||||||
| @@ -43,7 +43,6 @@ struct MeterBar { | |||||||
|    bool   isclipping; //ANSWER-ME: What's the diff between these bools?! "clipping" vs "isclipping" is not clear. |    bool   isclipping; //ANSWER-ME: What's the diff between these bools?! "clipping" vs "isclipping" is not clear. | ||||||
|    int    tailPeakCount; |    int    tailPeakCount; | ||||||
|    float  peakPeakHold; |    float  peakPeakHold; | ||||||
|    wxBitmap bitmap; |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| class MeterUpdateMsg | class MeterUpdateMsg | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user