Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Riakiotakis <kalast@gmail.com>2015-10-14 12:15:03 +0300
committerAntony Riakiotakis <kalast@gmail.com>2015-10-14 12:15:03 +0300
commit6562e4ebe9ddf8e3d08a394fd52f5d6adce0b8fd (patch)
tree3679e85b7a7b5f05402c578478a0cef4e1b08dd8 /source/blender/editors
parent904db487a7b14c31282fe0284612159a836657cd (diff)
Fix T46189, draw style for waveforms occludes sequence strip text.
Used old (2.49 era) filled style for drawing here, with white color and alpha blending. Also changed drawing to do linear interpolation between samples instead of ugly square wave in high zoom. This could be improved upon, with real waveform drawing in higher zoom levels, but I'll leave this for later since it may need some hacking on audaspace level.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 114e8d657d8..642c55df13f 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -198,7 +198,7 @@ static void drawseqwave(const bContext *C, SpaceSeq *sseq, Scene *scene, Sequenc
float yscale = (y2 - y1) / 2;
float samplestep;
float startsample, endsample;
- float value;
+ float value1, value2;
bSound *sound = seq->sound;
SoundWaveform *waveform;
@@ -238,35 +238,37 @@ static void drawseqwave(const bContext *C, SpaceSeq *sseq, Scene *scene, Sequenc
if (length > floor((waveform->length - startsample) / samplestep))
length = floor((waveform->length - startsample) / samplestep);
- glBegin(GL_LINE_STRIP);
+ glColor4f(1.0f, 1.0f, 1.0f, 0.5);
+ glEnable(GL_BLEND);
+ glBegin(GL_TRIANGLE_STRIP);
for (i = 0; i < length; i++) {
- pos = startsample + i * samplestep;
-
- value = waveform->data[pos * 3];
-
- for (j = pos + 1; (j < waveform->length) && (j < pos + samplestep); j++) {
- if (value > waveform->data[j * 3])
- value = waveform->data[j * 3];
- }
-
- glVertex2f(x1 + i * stepsize, ymid + value * yscale);
- }
- glEnd();
+ float sampleoffset = startsample + i * samplestep;
+ pos = sampleoffset;
- glBegin(GL_LINE_STRIP);
- for (i = 0; i < length; i++) {
- pos = startsample + i * samplestep;
+ value1 = waveform->data[pos * 3];
+ value2 = waveform->data[pos * 3 + 1];
- value = waveform->data[pos * 3 + 1];
+ if (samplestep >= 2.0f) {
+ for (j = pos + 1; (j < waveform->length) && (j < pos + samplestep); j++) {
+ if (value1 > waveform->data[j * 3])
+ value1 = waveform->data[j * 3];
- for (j = pos + 1; (j < waveform->length) && (j < pos + samplestep); j++) {
- if (value < waveform->data[j * 3 + 1])
- value = waveform->data[j * 3 + 1];
+ if (value2 < waveform->data[j * 3 + 1])
+ value2 = waveform->data[j * 3 + 1];
+ }
+ }
+ else {
+ float f = sampleoffset - pos;
+ value1 = (1.0f - f) * value1 + f * waveform->data[pos * 3 + 3];
+ value2 = (1.0f - f) * value2 + f * waveform->data[pos * 3 + 4];
}
- glVertex2f(x1 + i * stepsize, ymid + value * yscale);
+ /* max(value, -1) ensures that no sound gets drawn as a line */
+ glVertex2f(x1 + i * stepsize, ymid + value1 * yscale);
+ glVertex2f(x1 + i * stepsize, ymid + value2 * yscale);
}
glEnd();
+ glDisable(GL_BLEND);
}
}