viewer: set automatic divider on connection
Probably not a permanent solution, but will aid performance for the time-being.
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef POWER_H
|
||||
#define POWER_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "common/define.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
uint32_t ceil_to_power_of_2(uint32_t v)
|
||||
{
|
||||
v--;
|
||||
v |= v >> 1;
|
||||
v |= v >> 2;
|
||||
v |= v >> 4;
|
||||
v |= v >> 8;
|
||||
v |= v >> 16;
|
||||
v++;
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
uint32_t floor_to_power_of_2(uint32_t x)
|
||||
{
|
||||
x = x | (x >> 1);
|
||||
x = x | (x >> 2);
|
||||
x = x | (x >> 4);
|
||||
x = x | (x >> 8);
|
||||
x = x | (x >> 16);
|
||||
|
||||
return x - (x >> 1);
|
||||
}
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
#endif // POWER_H
|
||||
@@ -77,7 +77,7 @@ void Config::SetDefaults()
|
||||
config_map_["AutoscaleByDefault"] = false;
|
||||
config_map_["Autoscroll"] = AutoScroll::kPage;
|
||||
config_map_["DefaultViewerDivider"] = 2;
|
||||
config_map_["AutoSelectDivider"] = false;
|
||||
config_map_["AutoSelectDivider"] = true;
|
||||
config_map_["SetNameWithMarker"] = false;
|
||||
config_map_["RectifiedWaveforms"] = false;
|
||||
config_map_["DropWithoutSequenceBehavior"] = TimelineWidget::kDWSAsk;
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "audio/audiomanager.h"
|
||||
#include "common/power.h"
|
||||
#include "common/timecodefunctions.h"
|
||||
#include "config/config.h"
|
||||
#include "project/item/sequence/sequence.h"
|
||||
@@ -558,7 +559,7 @@ int ViewerWidget::CalculateDivider()
|
||||
int long_side_of_video = qMax(GetConnectedNode()->video_params().width(), GetConnectedNode()->video_params().height());
|
||||
int long_side_of_widget = qMax(display_widget_->width(), display_widget_->height());
|
||||
|
||||
return qMax(1, long_side_of_video / long_side_of_widget);
|
||||
return ceil_to_power_of_2(qMax(1, long_side_of_video / long_side_of_widget));
|
||||
}
|
||||
|
||||
return divider_;
|
||||
|
||||
Reference in New Issue
Block a user