0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 04:42:18 +02:00

UI: Use patterns that avoid std::min/max

New code is cleaner anyway.
This commit is contained in:
jpark37 2021-09-17 22:09:37 -07:00 committed by Jim
parent d4bf7d4c23
commit c93b040d0d
2 changed files with 10 additions and 7 deletions

View File

@ -396,9 +396,9 @@ void OBSPropertiesView::AddFloat(obs_property_t *prop, QFormLayout *layout,
const char *suffix = obs_property_float_suffix(prop);
if (stepVal < 1.0) {
int decimals = (int)(log10(1.0 / stepVal) + 0.99);
constexpr int sane_limit = 8;
decimals = std::min(decimals, sane_limit);
const int decimals =
std::min<int>(log10(1.0 / stepVal) + 0.99, sane_limit);
if (decimals > spin->decimals())
spin->setDecimals(decimals);
}

View File

@ -1,7 +1,6 @@
#include <QGuiApplication>
#include <QMouseEvent>
#include <algorithm>
#include <cmath>
#include <string>
#include <graphics/vec4.h>
@ -1049,10 +1048,14 @@ static bool FindItemsInBox(obs_scene_t *scene, obs_sceneitem_t *item,
vec3 pos3;
vec3 pos3_;
float x1 = std::min(data->startPos.x, data->pos.x);
float x2 = std::max(data->startPos.x, data->pos.x);
float y1 = std::min(data->startPos.y, data->pos.y);
float y2 = std::max(data->startPos.y, data->pos.y);
vec2 pos_min, pos_max;
vec2_min(&pos_min, &data->startPos, &data->pos);
vec2_max(&pos_max, &data->startPos, &data->pos);
const float x1 = pos_min.x;
const float x2 = pos_max.x;
const float y1 = pos_min.y;
const float y2 = pos_max.y;
if (!SceneItemHasVideo(item))
return true;