Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Unified Diff: third_party/WebKit/Source/platform/audio/EqualPowerPanner.cpp

Issue 1530723004: Use clampTo instead of chaining std::max(std::min(...)) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Handling that minimumThumbLength > trackLen. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/audio/EqualPowerPanner.cpp
diff --git a/third_party/WebKit/Source/platform/audio/EqualPowerPanner.cpp b/third_party/WebKit/Source/platform/audio/EqualPowerPanner.cpp
index 707fe28c28e162f44faa7857f6e3ab98f186b1d1..41b150b8670c945876f7818e174e8d03d83a41cf 100644
--- a/third_party/WebKit/Source/platform/audio/EqualPowerPanner.cpp
+++ b/third_party/WebKit/Source/platform/audio/EqualPowerPanner.cpp
@@ -28,10 +28,11 @@
#include "platform/audio/EqualPowerPanner.h"
-#include <algorithm>
#include "platform/audio/AudioBus.h"
#include "platform/audio/AudioUtilities.h"
#include "wtf/MathExtras.h"
+#include <algorithm>
+#include <cmath>
// Use a 50ms smoothing / de-zippering time-constant.
const float SmoothingTimeConstant = 0.050f;
@@ -70,8 +71,7 @@ void EqualPowerPanner::pan(double azimuth, double /*elevation*/, const AudioBus*
return;
// Clamp azimuth to allowed range of -180 -> +180.
- azimuth = std::max(-180.0, azimuth);
- azimuth = std::min(180.0, azimuth);
+ azimuth = clampTo(azimuth, -180.0, 180.0);
// Alias the azimuth ranges behind us to in front of us:
// -90 -> -180 to -90 -> 0 and 90 -> 180 to 90 -> 0

Powered by Google App Engine
This is Rietveld 408576698