viewer: don't update if gizmos haven't actually changed

Minor optimization that prevents unnecessary repaints of the viewer viewport.
This commit is contained in:
itsmattkc
2020-05-13 18:26:21 +10:00
parent ce78c168e6
commit 992321a9a5
2 changed files with 18 additions and 4 deletions
+8 -4
View File
@@ -97,16 +97,20 @@ const ViewerSafeMarginInfo &ViewerDisplayWidget::GetSafeMargin() const
void ViewerDisplayWidget::SetSafeMargins(const ViewerSafeMarginInfo &safe_margin)
{
safe_margin_ = safe_margin;
if (safe_margin_ != safe_margin) {
safe_margin_ = safe_margin;
update();
update();
}
}
void ViewerDisplayWidget::SetGizmos(Node *node)
{
gizmos_ = node;
if (gizmos_ != node) {
gizmos_ = node;
update();
update();
}
}
void ViewerDisplayWidget::SetVideoParams(const VideoRenderingParams &params)
+10
View File
@@ -21,6 +21,8 @@
#ifndef VIEWERSAFEMARGININFO_H
#define VIEWERSAFEMARGININFO_H
#include <QtMath>
#include "common/define.h"
OLIVE_NAMESPACE_ENTER
@@ -53,6 +55,14 @@ public:
return ratio_;
}
bool operator==(const ViewerSafeMarginInfo& rhs) const {
return (enabled_ == rhs.enabled_ && qFuzzyCompare(ratio_, rhs.ratio_));
}
bool operator!=(const ViewerSafeMarginInfo& rhs) const {
return (enabled_ != rhs.enabled_ || !qFuzzyCompare(ratio_, rhs.ratio_));
}
private:
bool enabled_;