Browse Source

Add conditional compile option to disable timeline doublebuffering.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
546a0bde01
2 changed files with 52 additions and 22 deletions
  1. +32
    -14
      Timeline.C
  2. +20
    -8
      Timeline.H

+ 32
- 14
Timeline.C View File

@@ -328,6 +328,10 @@ Timeline::draw_clip ( void * v, int X, int Y, int W, int H )
}


static unsigned char *rect_image;



void
Timeline::draw ( void )
{
@@ -338,6 +342,19 @@ Timeline::draw ( void )
W = tracks->w() - Fl::box_dw( tracks->child( 0 )->box() ) - 1;
H = tracks->h();



/* if ( damage() & FL_DAMAGE_USER1 ) */
/* { */

/* /\* save the rectangle so we can draw it (darkened) in the overlay *\/ */
/* Rectangle &r = _selection; */
/* make_current(); */
/* rect_image = fl_read_image( NULL, r.x, r.y, r.w, r.h, 0 ); */

/* return; */
/* } */

if ( (damage() & FL_DAMAGE_ALL)
||
damage() & FL_DAMAGE_EXPOSE )
@@ -358,7 +375,7 @@ Timeline::draw ( void )
redraw_overlay();


Rectangle &r = _selection;
/* Rectangle &r = _selection; */

/* unsigned char *data = fl_read_image( NULL, r.x, r.y, r.w, r.h, 0 ); */

@@ -371,18 +388,18 @@ Timeline::draw ( void )
/* delete[] data; */


if ( r.w && r.h )
{
const unsigned char data[] = { 0, 127, 0, 96,
0, 96, 0, 127 };
Fl_RGB_Image bi( data, 2, 2, 2 );
/* if ( r.w && r.h ) */
/* { */
/* const unsigned char data[] = { 0, 127, 0, 96, */
/* 0, 96, 0, 127 }; */
/* Fl_RGB_Image bi( data, 2, 2, 2 ); */

Fl_Image *bi2 = bi.copy( r.w, r.h );
/* Fl_Image *bi2 = bi.copy( r.w, r.h ); */

bi2->draw( r.x, r.y );
/* bi2->draw( r.x, r.y ); */

delete bi2;
}
/* delete bi2; */
/* } */

return;
}
@@ -468,13 +485,16 @@ Timeline::draw_overlay ( void )

/* unsigned char *data = fl_read_image( NULL, r.x, r.y, r.w, r.h, 0 ); */

/* Fl_RGB_Image bi( data, r.w, r.h, 3 ); */


/* Fl_RGB_Image bi( rect_image, r.w, r.h, 3 ); */

/* bi.color_average( FL_BLACK, 0.50f ); */

/* bi.draw( r.x, r.y ); */

/* delete[] data; */
/* delete[] rect_image; */
/* rect_image = NULL; */

fl_pop_clip();

@@ -554,8 +574,6 @@ Timeline::handle ( int m )

_selection.w = abs( ox );
_selection.h = abs( oy );

redraw();
break;
}
case FL_RELEASE:


+ 20
- 8
Timeline.H View File

@@ -23,33 +23,43 @@
#include <FL/Fl_Pack.H>
#include <FL/Fl_Scrollbar.H>
#include <FL/Fl_Widget.H>
#include <Fl/Fl_Overlay_Window.H>
#include <FL/fl_draw.H>

#include "Scalebar.H"

#include "Audio_File.H" // just for nframes_t
#include <math.h>

#include <math.h>
#include <assert.h>

#include <FL/fl_draw.H>

class Timeline;
extern Timeline *timeline;

#include "Track.H"
// #include "Tempo_Track.H"

class Tempo_Track;
class Time_Track;

// #include "Tempo_Point.H"
// #include "Region.H"

#include <list>
using std::list;


// disables double-buffering to make unnecessary redrawing more apparent
// #define DEBUG_TIMELINE_DRAWING

#ifndef DEBUG_TIMELINE_DRAWING

#include <Fl/Fl_Overlay_Window.H>

#else

#include <FL/Fl_Single_Window.H>
#define Fl_Overlay_Window Fl_Single_Window
#define redraw_overlay()
#endif



struct Rectangle
{
int x;
@@ -61,6 +71,8 @@ struct Rectangle
Rectangle ( int X, int Y, int W, int H ) : x( X ), y( Y ), w( W ), h( H ) {}
};



class Timeline : public Fl_Overlay_Window
{
static void draw_clip ( void * v, int X, int Y, int W, int H );


Loading…
Cancel
Save