+ max *= half_height;
+ min *= half_height;
+
+ next_pymax = (int) rint ((item->y1 + origin - max) * item->canvas->pixels_per_unit);
+ next_pymin = (int) rint ((item->y1 + origin - min) * item->canvas->pixels_per_unit);
+ }
+
+ /* render */
+ if (pymax == pymin) {
+ PAINT_DOTA(buf, waveview->wave_r, waveview->wave_g, waveview->wave_b, waveview->wave_a, x, pymin);
+ } else {
+ if((prev_pymax < pymax && next_pymax < pymax) ||
+ (prev_pymax == pymax && next_pymax == pymax)) {
+ fill_max = pymax + 1;
+ PAINT_DOTA(buf, waveview->wave_r, waveview->wave_g, waveview->wave_b, waveview->wave_a, x, pymax);
+ }
+ else {
+ fill_max = MAX(prev_pymax, next_pymax);
+ if(pymax == fill_max) {
+ PAINT_DOTA(buf, waveview->wave_r, waveview->wave_g, waveview->wave_b, waveview->wave_a, x, pymax);
+ ++fill_max;
+ }
+ else {
+ PAINT_VERTA(buf, waveview->wave_r, waveview->wave_g, waveview->wave_b, waveview->wave_a, x, pymax, fill_max);
+ }
+ }
+
+ if((prev_pymin > pymin && next_pymin > pymin) ||
+ (prev_pymin == pymin && next_pymin == pymin)) {
+ fill_min = pymin - 1;
+ PAINT_DOTA(buf, waveview->wave_r, waveview->wave_g, waveview->wave_b, waveview->wave_a, x, pymin-1);
+ }
+ else {
+ fill_min = MIN(prev_pymin, next_pymin);
+ if(pymin == fill_min) {
+ PAINT_DOTA(buf, waveview->wave_r, waveview->wave_g, waveview->wave_b, waveview->wave_a, x, pymin);
+ }
+ else {
+ PAINT_VERTA(buf, waveview->wave_r, waveview->wave_g, waveview->wave_b, waveview->wave_a, x, fill_min, pymin);
+ }
+ }
+
+ if(fill_max < fill_min) {
+ PAINT_VERTA(buf, waveview->fill_r, waveview->fill_g, waveview->fill_b, waveview->fill_a, x, fill_max, fill_min);
+ }
+ else if(fill_max == fill_min) {
+ PAINT_DOTA(buf, waveview->fill_r, waveview->fill_g, waveview->fill_b, waveview->fill_a, x, fill_max);
+ }
+ }
+
+ if (clip_max) {
+ PAINT_VERTA(buf, waveview->clip_r, waveview->clip_g, waveview->clip_b, waveview->clip_a, x, pymax, pymax+clip_length);
+ }
+
+ if (clip_min) {
+ PAINT_VERTA(buf, waveview->clip_r, waveview->clip_g, waveview->clip_b, waveview->clip_a, x, pymin-clip_length, pymin);
+ }