Fix a pile of places where abs() was used on floats
This commit is contained in:
parent
a6b1639320
commit
0f324a22f1
5 changed files with 6 additions and 6 deletions
|
@ -233,7 +233,7 @@ void DialogResample::UpdateButtons() {
|
|||
|
||||
auto source_ar = double(source_x->GetValue()) / source_y->GetValue();
|
||||
auto dest_ar = double(dest_x->GetValue()) / dest_y->GetValue();
|
||||
bool ar_changed = abs(source_ar - dest_ar) / dest_ar > .01;
|
||||
bool ar_changed = std::abs(source_ar - dest_ar) / dest_ar > .01;
|
||||
|
||||
ar_mode->Enable(ar_changed);
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ bool update_video_properties(AssFile *file, const AsyncVideoProvider *new_provid
|
|||
|
||||
auto sar = double(sx) / sy;
|
||||
auto var = double(vx) / vy;
|
||||
bool ar_changed = abs(sar - var) / var > .01;
|
||||
bool ar_changed = std::abs(sar - var) / var > .01;
|
||||
|
||||
switch (OPT_GET("Video/Script Resolution Mismatch")->GetInt()) {
|
||||
case MISMATCH_IGNORE: default:
|
||||
|
|
|
@ -229,7 +229,7 @@ void ResampleResolution(AssFile *ass, ResampleSettings settings) {
|
|||
bool border_horizontally = new_ar > old_ar;
|
||||
// Don't convert aspect ratio if it's very close to correct
|
||||
// (for reference, 848x480 <-> 1280x720 is .006)
|
||||
if (abs(old_ar - new_ar) / new_ar > .01) {
|
||||
if (std::abs(old_ar - new_ar) / new_ar > .01) {
|
||||
switch (settings.ar_mode) {
|
||||
case ResampleARMode::RemoveBorder:
|
||||
border_horizontally = !border_horizontally;
|
||||
|
@ -247,7 +247,7 @@ void ResampleResolution(AssFile *ass, ResampleSettings settings) {
|
|||
double(settings.source_x + settings.margin[LEFT] + settings.margin[RIGHT]) /
|
||||
double(settings.source_y + settings.margin[TOP] + settings.margin[BOTTOM]);
|
||||
|
||||
if (abs(old_ar - new_ar) / new_ar > .01)
|
||||
if (std::abs(old_ar - new_ar) / new_ar > .01)
|
||||
horizontal_stretch = new_ar / old_ar;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ Vector2D Vector2D::Unit() const {
|
|||
}
|
||||
|
||||
Vector2D Vector2D::SingleAxis() const {
|
||||
if (abs(x) < abs(y))
|
||||
if (std::abs(x) < std::abs(y))
|
||||
return Vector2D(0, y);
|
||||
else
|
||||
return Vector2D(x, 0);
|
||||
|
|
|
@ -92,7 +92,7 @@ void VisualToolScale::UpdateHold() {
|
|||
if (shift_down)
|
||||
delta = delta.SingleAxis();
|
||||
if (alt_down) {
|
||||
if (abs(delta.X()) > abs(delta.Y()))
|
||||
if (std::abs(delta.X()) > std::abs(delta.Y()))
|
||||
delta = Vector2D(delta.X(), delta.X() * (initial_scale.Y() / initial_scale.X()));
|
||||
else
|
||||
delta = Vector2D(delta.Y() * (initial_scale.X() / initial_scale.Y()), delta.Y());
|
||||
|
|
Loading…
Reference in a new issue