Merge pull request #3994 from FearlessTobi/replace-clamp-functions

Remove MathUtil::Clamp and replace it with its std:: counterpart
This commit is contained in:
James Rowe 2018-08-02 11:08:07 -06:00 committed by GitHub
commit 14b0435df2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 69 additions and 82 deletions

View file

@ -2,10 +2,10 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <algorithm>
#include <cstring>
#include <QImage>
#include "citra_qt/camera/camera_util.h"
#include "common/math_util.h"
#include "core/frontend/camera/factory.h"
#include "core/frontend/camera/interface.h"
@ -191,9 +191,10 @@ std::vector<u16> Rgb2Yuv(const QImage& source, int width, int height) {
if (write) {
pu = (pu + u) / 2;
pv = (pv + v) / 2;
using MathUtil::Clamp;
*(dest++) = static_cast<u16>(Clamp(py, 0, 0xFF) | (Clamp(pu, 0, 0xFF) << 8));
*(dest++) = static_cast<u16>(Clamp(y, 0, 0xFF) | (Clamp(pv, 0, 0xFF) << 8));
*(dest++) =
static_cast<u16>(std::clamp(py, 0, 0xFF) | (std::clamp(pu, 0, 0xFF) << 8));
*(dest++) =
static_cast<u16>(std::clamp(y, 0, 0xFF) | (std::clamp(pv, 0, 0xFF) << 8));
} else {
py = y;
pu = u;