node: simplify traverser/node globals
This commit is contained in:
+8
-34
@@ -24,6 +24,7 @@
|
||||
#include <QVector2D>
|
||||
|
||||
#include "common/timerange.h"
|
||||
#include "render/videoparams.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
@@ -32,46 +33,19 @@ class NodeGlobals
|
||||
public:
|
||||
NodeGlobals(){}
|
||||
|
||||
NodeGlobals(const QVector2D &resolution, const rational &pixel_aspect, const TimeRange &time) :
|
||||
resolution_(resolution),
|
||||
pixel_aspect_(pixel_aspect),
|
||||
NodeGlobals(const VideoParams &vparam, const TimeRange &time) :
|
||||
video_params_(vparam),
|
||||
time_(time)
|
||||
{
|
||||
resolution_by_par_ = QVector2D(resolution_.x() * pixel_aspect_.toDouble(), resolution_.y());
|
||||
}
|
||||
|
||||
const QVector2D &resolution() const
|
||||
{
|
||||
return resolution_;
|
||||
}
|
||||
|
||||
const QVector2D &resolution_by_par() const
|
||||
{
|
||||
return resolution_by_par_;
|
||||
}
|
||||
|
||||
const rational &pixel_aspect() const
|
||||
{
|
||||
return pixel_aspect_;
|
||||
}
|
||||
|
||||
const TimeRange &time() const
|
||||
{
|
||||
return time_;
|
||||
}
|
||||
|
||||
void set_time(const TimeRange &time)
|
||||
{
|
||||
time_ = time;
|
||||
}
|
||||
QVector2D resolution() const { return video_params_.resolution(); }
|
||||
QVector2D resolution_by_par() const { return video_params_.square_resolution(); }
|
||||
const VideoParams &video_params() const { return video_params_; }
|
||||
const TimeRange &time() const { return time_; }
|
||||
|
||||
private:
|
||||
QVector2D resolution_;
|
||||
|
||||
rational pixel_aspect_;
|
||||
|
||||
QVector2D resolution_by_par_;
|
||||
|
||||
VideoParams video_params_;
|
||||
TimeRange time_;
|
||||
|
||||
};
|
||||
|
||||
@@ -171,7 +171,7 @@ void NodeTraverser::Transform(QTransform *transform, const Node *start, const No
|
||||
|
||||
NodeGlobals NodeTraverser::GenerateGlobals(const VideoParams ¶ms, const TimeRange &time)
|
||||
{
|
||||
return NodeGlobals(QVector2D(params.width(), params.height()), params.pixel_aspect_ratio(), time);
|
||||
return NodeGlobals(params, time);
|
||||
}
|
||||
|
||||
int NodeTraverser::GetChannelCountFromJob(const GenerateJob &job)
|
||||
|
||||
@@ -107,6 +107,16 @@ public:
|
||||
return par_width_;
|
||||
}
|
||||
|
||||
QVector2D resolution() const
|
||||
{
|
||||
return QVector2D(width_, height_);
|
||||
}
|
||||
|
||||
QVector2D square_resolution() const
|
||||
{
|
||||
return QVector2D(par_width_, height_);
|
||||
}
|
||||
|
||||
int height() const
|
||||
{
|
||||
return height_;
|
||||
|
||||
Reference in New Issue
Block a user