[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Traverso-commit] traverso/src/sheetcanvas AudioClipView.cpp Audi...
From: |
Nicola Doebelin |
Subject: |
[Traverso-commit] traverso/src/sheetcanvas AudioClipView.cpp Audi... |
Date: |
Sun, 22 Feb 2009 19:48:16 +0000 |
CVSROOT: /sources/traverso
Module name: traverso
Changes by: Nicola Doebelin <n_doebelin> 09/02/22 19:48:15
Modified files:
src/sheetcanvas: AudioClipView.cpp AudioClipView.h
Log message:
* minimize the use of QFontMetrics
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/sheetcanvas/AudioClipView.cpp?cvsroot=traverso&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/traverso/src/sheetcanvas/AudioClipView.h?cvsroot=traverso&r1=1.6&r2=1.7
Patches:
Index: AudioClipView.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/sheetcanvas/AudioClipView.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- AudioClipView.cpp 12 Feb 2009 21:38:00 -0000 1.15
+++ AudioClipView.cpp 22 Feb 2009 19:48:15 -0000 1.16
@@ -232,7 +232,7 @@
}
bool microView = m_sheet->get_hzoom() < 64 ? 1 : 0;
- TimeRef clipstartoffset = m_clip->get_source_start_location();
+ TimeRef clipstarm_lineOffset = m_clip->get_source_start_location();
int channels = m_clip->get_channels();
int peakdatacount = microView ? pixelcount : pixelcount * 2;
float* pixeldata[channels];
@@ -279,7 +279,7 @@
int availpeaks = peak->calculate_peaks(
chan,
&pixeldata[chan],
- TimeRef(xstart * m_sv->timeref_scalefactor) +
clipstartoffset,
+ TimeRef(xstart * m_sv->timeref_scalefactor) +
clipstarm_lineOffset,
peakdatacount,
m_sheet->get_hzoom(),
xscale);
@@ -433,20 +433,17 @@
p->setPen(themer()->get_color("AudioClip:db-grid"));
p->setFont(
themer()->get_font("AudioClip:fontscale:dblines") );
- QFontMetrics fm(p->font());
- int toffset = fm.width(" -6 dB ");
+ p->drawLine(m_lineOffset, -0.45 * scale *
height, xstart+pixelcount, -0.45 * scale * height);
+ p->drawText(0.0, -0.45 * scale * height - 1 +
m_lineVOffset, " 0 dB");
- p->drawLine(toffset, -0.45 * scale * height,
xstart+pixelcount, -0.45 * scale * height);
- p->drawText(0.0, -0.45 * scale * height - 1 +
fm.ascent()/2, " 0 dB");
+ p->drawLine(m_lineOffset, 0.45 * scale * height
+ 1, xstart+pixelcount, 0.45 * scale * height + 1);
+ p->drawText(0.0, 0.45 * scale * height +
m_lineVOffset, " 0 dB");
- p->drawLine(toffset, 0.45 * scale * height + 1,
xstart+pixelcount, 0.45 * scale * height + 1);
- p->drawText(0.0, 0.45 * scale * height +
fm.ascent()/2, " 0 dB");
+ p->drawLine(m_lineOffset, -0.225 * scale *
height, xstart+pixelcount, -0.225 * scale * height);
+ p->drawText(0.0, -0.225 * scale * height - 1 +
m_lineVOffset, " -6 dB");
- p->drawLine(toffset, -0.225 * scale * height,
xstart+pixelcount, -0.225 * scale * height);
- p->drawText(0.0, -0.225 * scale * height - 1 +
fm.ascent()/2, " -6 dB");
-
- p->drawLine(toffset, 0.225 * scale * height +
1, xstart+pixelcount, 0.225 * scale * height + 1);
- p->drawText(0.0, 0.225 * scale * height +
fm.ascent()/2, " -6 dB");
+ p->drawLine(m_lineOffset, 0.225 * scale *
height + 1, xstart+pixelcount, 0.225 * scale * height + 1);
+ p->drawText(0.0, 0.225 * scale * height +
m_lineVOffset, " -6 dB");
}
// Macroview, paint waveform with painterpath
@@ -536,20 +533,17 @@
p->setPen(themer()->get_color("AudioClip:db-grid"));
p->setFont(
themer()->get_font("AudioClip:fontscale:dblines") );
- QFontMetrics fm(p->font());
- int toffset = fm.width(" -6 dB ");
-
- p->drawLine(toffset, -0.45 * scale *
height, xstart+pixelcount, -0.45 * scale * height);
- p->drawText(0.0, -0.45 * scale * height
- 1 + fm.ascent()/2, " 0 dB");
+ p->drawLine(m_lineOffset, -0.45 * scale
* height, xstart+pixelcount, -0.45 * scale * height);
+ p->drawText(0.0, -0.45 * scale * height
- 1 + m_lineVOffset, " 0 dB");
- p->drawLine(toffset, 0.45 * scale *
height + 1, xstart+pixelcount, 0.45 * scale * height + 1);
- p->drawText(0.0, 0.45 * scale * height
+ fm.ascent()/2, " 0 dB");
+ p->drawLine(m_lineOffset, 0.45 * scale
* height + 1, xstart+pixelcount, 0.45 * scale * height + 1);
+ p->drawText(0.0, 0.45 * scale * height
+ m_lineVOffset, " 0 dB");
- p->drawLine(toffset, -0.225 * scale *
height, xstart+pixelcount, -0.225 * scale * height);
- p->drawText(0.0, -0.225 * scale *
height - 1 + fm.ascent()/2, " -6 dB");
+ p->drawLine(m_lineOffset, -0.225 *
scale * height, xstart+pixelcount, -0.225 * scale * height);
+ p->drawText(0.0, -0.225 * scale *
height - 1 + m_lineVOffset, " -6 dB");
- p->drawLine(toffset, 0.225 * scale *
height + 1, xstart+pixelcount, 0.225 * scale * height + 1);
- p->drawText(0.0, 0.225 * scale * height
+ fm.ascent()/2, " -6 dB");
+ p->drawLine(m_lineOffset, 0.225 * scale
* height + 1, xstart+pixelcount, 0.225 * scale * height + 1);
+ p->drawText(0.0, 0.225 * scale * height
+ m_lineVOffset, " -6 dB");
}
} else {
scaleFactor = (float) height * 0.95 *
m_clip->get_gain() / Peak::MAX_DB_VALUE * curveDefaultValue;
@@ -594,14 +588,12 @@
p->setPen(themer()->get_color("AudioClip:db-grid"));
p->setFont(
themer()->get_font("AudioClip:fontscale:dblines") );
- QFontMetrics fm(p->font());
- int toffset = fm.width(" -6 dB ");
- p->drawLine(toffset, -0.95 * scale *
height, xstart+pixelcount, -0.95 * scale * height);
- p->drawText(0.0, -0.95 * scale * height
- 1 + fm.ascent()/2, " 0 dB");
+ p->drawLine(m_lineOffset, -0.95 * scale
* height, xstart+pixelcount, -0.95 * scale * height);
+ p->drawText(0.0, -0.95 * scale * height
- 1 + m_lineVOffset, " 0 dB");
- p->drawLine(toffset, -0.475 * scale *
height, xstart+pixelcount, -0.475 * scale * height);
- p->drawText(0.0, -0.475 * scale *
height - 1 + fm.ascent()/2, " -6 dB");
+ p->drawLine(m_lineOffset, -0.475 *
scale * height, xstart+pixelcount, -0.475 * scale * height);
+ p->drawText(0.0, -0.475 * scale *
height - 1 + m_lineVOffset, " -6 dB");
}
}
@@ -929,6 +921,11 @@
m_paintWithOutline = config().get_property("Themer",
"paintwavewithoutline", true).toBool();
m_drawDbGrid = config().get_property("Themer", "drawdbgrid",
false).toBool();
calculate_bounding_rect();
+
+ QFont dblfont = themer()->get_font("AudioClip:fontscale:dblines");
+ QFontMetrics fm(dblfont);
+ m_lineOffset = fm.width(" -6 dB ");
+ m_lineVOffset = fm.ascent()/2;
}
Index: AudioClipView.h
===================================================================
RCS file: /sources/traverso/traverso/src/sheetcanvas/AudioClipView.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- AudioClipView.h 19 Jan 2009 21:07:19 -0000 1.6
+++ AudioClipView.h 22 Feb 2009 19:48:15 -0000 1.7
@@ -91,6 +91,8 @@
int m_infoAreaHeight;
int m_mimimumheightforinfoarea;
int m_usePolygonPeakDrawing;
+ int m_lineOffset;
+ int m_lineVOffset;
TimeRef m_oldRecordingPos;
// theme data
- [Traverso-commit] traverso/src/sheetcanvas AudioClipView.cpp Audi...,
Nicola Doebelin <=