Timeline: Fix 64-bit bug in interactive region trimming.
This commit is contained in:
parent
fb8c9414a0
commit
9f87bbd020
|
@ -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…
Reference in New Issue