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:
@@ -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 ¶ms)
|
||||
|
||||
@@ -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_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user