From 6ce364f2d23b2fdf00abe2ed17f66cd105c98234 Mon Sep 17 00:00:00 2001 From: lllucius Date: Sat, 4 Oct 2014 22:50:51 +0000 Subject: [PATCH] Get rid of flicker when drawing the peak/rms meter. --- src/widgets/Meter.cpp | 5 +++-- src/widgets/Meter.h | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/widgets/Meter.cpp b/src/widgets/Meter.cpp index 8188452ec..b839b33ed 100644 --- a/src/widgets/Meter.cpp +++ b/src/widgets/Meter.cpp @@ -43,6 +43,7 @@ #include #include +#include #include #include #include @@ -1129,9 +1130,10 @@ void Meter::RepaintBarsNow() if (mLayoutValid) { wxClientDC dc(this); + wxBufferedDC bufDC(&dc, *mBitmap); 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) { // Calculate the peak and rms rectangles - // (+1 and -1 to not overlay the bevel) ht = (int)(meterBar->peak * h + 0.5); r = wxRect(x, y + h - ht, w, ht); ht = (int)(meterBar->rms * h + 0.5); diff --git a/src/widgets/Meter.h b/src/widgets/Meter.h index 33382c60c..28789a7b0 100644 --- a/src/widgets/Meter.h +++ b/src/widgets/Meter.h @@ -25,7 +25,7 @@ #include "Ruler.h" // 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 // (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. int tailPeakCount; float peakPeakHold; - wxBitmap bitmap; }; class MeterUpdateMsg