Browse Source

Timeline: Fix 64-bit bug in interactive region trimming.

tags/non-daw-v1.1.0
Jonathan Moore Liles 15 years ago
parent
commit
9f87bbd020
1 changed files with 7 additions and 4 deletions
  1. +7
    -4
      timeline/src/Sequence_Region.C

+ 7
- 4
timeline/src/Sequence_Region.C View File

@@ -20,6 +20,8 @@
#include "Sequence_Region.H" #include "Sequence_Region.H"
#include "Track.H" #include "Track.H"


#include <stdint.h>



Sequence_Region::Sequence_Region ( ) Sequence_Region::Sequence_Region ( )
@@ -68,13 +70,14 @@ Sequence_Region::set ( Log_Entry &e )
void void
Sequence_Region::trim_left ( nframes_t where ) Sequence_Region::trim_left ( nframes_t where )
{ {
long td = where - _r->start;
int64_t td = (int64_t)where - _r->start;


/* beyond the beginning */
if ( td < 0 && _r->offset < (nframes_t)( 0 - td ) ) if ( td < 0 && _r->offset < (nframes_t)( 0 - td ) )
td = 0 - _r->offset;
td = (int64_t)0 - _r->offset;


if ( td > 0 && (nframes_t)td >= _r->length ) if ( td > 0 && (nframes_t)td >= _r->length )
td = _r->length - timeline->x_to_ts( 1 );
td = (int64_t)_r->length - timeline->x_to_ts( 1 );


_r->trim_left( 0 - td ); _r->trim_left( 0 - td );


@@ -89,7 +92,7 @@ Sequence_Region::trim_left ( nframes_t where )
void void
Sequence_Region::trim_right ( nframes_t where ) Sequence_Region::trim_right ( nframes_t where )
{ {
long td = ( _r->start + _r->length ) - where;
int64_t td = (int64_t)( _r->start + _r->length ) - where;


if ( td >= 0 && _r->length < (nframes_t)td ) if ( td >= 0 && _r->length < (nframes_t)td )
td = _r->length - timeline->x_to_ts( 1 ); td = _r->length - timeline->x_to_ts( 1 );


Loading…
Cancel
Save