began work setting several timings to use rational rather than long/double

This commit is contained in:
itsmattkc
2019-06-16 15:13:53 -07:00
parent 0acee942f4
commit 771572f65b
63 changed files with 448 additions and 397 deletions
+5 -3
View File
@@ -117,7 +117,7 @@ OldEffectNodePtr RichTextEffect::Create(Clip *c)
return std::make_shared<RichTextEffect>(c);
}
void RichTextEffect::redraw(double timecode)
void RichTextEffect::redraw(const rational &timecode)
{
QPainter p(&img);
p.setRenderHint(QPainter::Antialiasing);
@@ -144,7 +144,7 @@ void RichTextEffect::redraw(double timecode)
if (auto_scroll_dir != SCROLL_OFF) {
double clip_length_secs = double(parent_clip->length()) / parent_clip->media_frame_rate();
scroll_progress = (timecode - double(parent_clip->clip_in()) / parent_clip->media_frame_rate()) / clip_length_secs;
scroll_progress = (timecode.ToDouble() - double(parent_clip->clip_in()) / parent_clip->media_frame_rate()) / clip_length_secs;
}
if (auto_scroll_dir == SCROLL_OFF || auto_scroll_dir == SCROLL_LEFT || auto_scroll_dir == SCROLL_RIGHT) {
@@ -221,5 +221,7 @@ void RichTextEffect::redraw(double timecode)
bool RichTextEffect::AlwaysUpdate()
{
return autoscroll->GetValueAt(Now()).toInt() != SCROLL_OFF;
// FIXME
//return autoscroll->GetValueAt(Now()).toInt() != SCROLL_OFF;
return false;
}
+1 -1
View File
@@ -36,7 +36,7 @@ public:
virtual olive::TrackType subtype() override;
virtual OldEffectNodePtr Create(Clip *c) override;
virtual void redraw(double timecode) override;
virtual void redraw(const rational& timecode) override;
protected:
virtual bool AlwaysUpdate() override;
+1 -1
View File
@@ -104,7 +104,7 @@ OldEffectNodePtr SolidEffect::Create(Clip *c)
return std::make_shared<SolidEffect>(c);
}
void SolidEffect::redraw(double timecode) {
void SolidEffect::redraw(const rational &timecode) {
int w = img.width();
int h = img.height();
int alpha = qRound(opacity_field->GetDoubleAt(timecode)*2.55);
+1 -1
View File
@@ -44,7 +44,7 @@ public:
virtual olive::TrackType subtype() override;
virtual OldEffectNodePtr Create(Clip *c) override;
virtual void redraw(double timecode) override;
virtual void redraw(const rational& timecode) override;
void SetType(SolidType type);
private slots:
+1 -1
View File
@@ -156,7 +156,7 @@ OldEffectNodePtr TextEffect::Create(Clip *c)
return std::make_shared<TextEffect>(c);
}
void TextEffect::redraw(double timecode) {
void TextEffect::redraw(const rational &timecode) {
if (size_val->GetDoubleAt(timecode) <= 0) {
return;
}
+1 -1
View File
@@ -39,7 +39,7 @@ public:
virtual olive::TrackType subtype() override;
virtual OldEffectNodePtr Create(Clip *c) override;
virtual void redraw(double timecode) override;
virtual void redraw(const rational& timecode) override;
private slots:
void outline_enable(bool);
void shadow_enable(bool);
+7 -7
View File
@@ -110,18 +110,18 @@ OldEffectNodePtr TimecodeEffect::Create(Clip *c)
}
void TimecodeEffect::redraw(double timecode) {
void TimecodeEffect::redraw(const rational &timecode) {
Sequence* sequence = parent_clip->track()->sequence();
if (tc_select->GetValueAt(timecode).toBool()) {
display_timecode = prepend_text->GetStringAt(timecode) + frame_to_timecode(sequence->playhead,
olive::config.timecode_view,
sequence->frame_rate());
display_timecode = prepend_text->GetStringAt(timecode) + TimeToSMPTE(sequence->playhead,
olive::config.timecode_view,
sequence->frame_rate());
} else {
double media_rate = parent_clip->media_frame_rate();
display_timecode = prepend_text->GetStringAt(timecode) + frame_to_timecode(qRound(timecode * media_rate),
olive::config.timecode_view,
media_rate);
display_timecode = prepend_text->GetStringAt(timecode) + TimeToSMPTE(timecode,
olive::config.timecode_view,
media_rate);
}
img.fill(Qt::transparent);
+1 -1
View File
@@ -39,7 +39,7 @@ public:
virtual olive::TrackType subtype() override;
virtual OldEffectNodePtr Create(Clip *c) override;
virtual void redraw(double timecode) override;
virtual void redraw(const rational &timecode) override;
DoubleInput* scale_val;
ColorInput* color_val;
ColorInput* color_bg_val;