Commit: 6562e4ebe9ddf8e3d08a394fd52f5d6adce0b8fd
Author: Antony Riakiotakis
Date:   Wed Oct 14 12:15:03 2015 +0300
Branches: master
https://developer.blender.org/rB6562e4ebe9ddf8e3d08a394fd52f5d6adce0b8fd

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.

===================================================================

M       source/blender/editors/space_sequencer/sequencer_draw.c

===================================================================

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index 114e8d6..642c55d 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);
        }
 }

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to