refactor: Address (Windows) compile warnings (#840)

* Windows compile errors and (Qt 5.15 deprecation) warnings

* Usability - Enable/Disable Instance button

Co-authored-by: brindosch <edeltraud70@gmx.de>
This commit is contained in:
LordGrey
2020-06-28 23:05:32 +02:00
committed by GitHub
parent e365a2839d
commit bfb50b8d91
61 changed files with 530 additions and 365 deletions

View File

@@ -8,7 +8,7 @@ ImageResampler::ImageResampler()
, _cropRight(0)
, _cropTop(0)
, _cropBottom(0)
, _videoMode(VIDEO_2D)
, _videoMode(VideoMode::VIDEO_2D)
{
}
@@ -47,10 +47,10 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i
// handle 3D mode
switch (_videoMode)
{
case VIDEO_3DSBS:
case VideoMode::VIDEO_3DSBS:
cropRight = width >> 1;
break;
case VIDEO_3DTAB:
case VideoMode::VIDEO_3DTAB:
cropBottom = width >> 1;
break;
default:
@@ -71,7 +71,7 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i
switch (pixelFormat)
{
case PIXELFORMAT_UYVY:
case PixelFormat::UYVY:
{
int index = lineLength * ySource + (xSource << 1);
uint8_t y = data[index+1];
@@ -80,7 +80,7 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i
yuv2rgb(y, u, v, rgb.red, rgb.green, rgb.blue);
}
break;
case PIXELFORMAT_YUYV:
case PixelFormat::YUYV:
{
int index = lineLength * ySource + (xSource << 1);
uint8_t y = data[index];
@@ -89,7 +89,7 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i
yuv2rgb(y, u, v, rgb.red, rgb.green, rgb.blue);
}
break;
case PIXELFORMAT_BGR16:
case PixelFormat::BGR16:
{
int index = lineLength * ySource + (xSource << 1);
rgb.blue = (data[index] & 0x1f) << 3;
@@ -97,7 +97,7 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i
rgb.red = (data[index+1] & 0xF8);
}
break;
case PIXELFORMAT_BGR24:
case PixelFormat::BGR24:
{
int index = lineLength * ySource + (xSource << 1) + xSource;
rgb.blue = data[index ];
@@ -105,7 +105,7 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i
rgb.red = data[index+2];
}
break;
case PIXELFORMAT_RGB32:
case PixelFormat::RGB32:
{
int index = lineLength * ySource + (xSource << 2);
rgb.red = data[index ];
@@ -113,7 +113,7 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i
rgb.blue = data[index+2];
}
break;
case PIXELFORMAT_BGR32:
case PixelFormat::BGR32:
{
int index = lineLength * ySource + (xSource << 2);
rgb.blue = data[index ];
@@ -122,10 +122,10 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i
}
break;
#ifdef HAVE_JPEG_DECODER
case PIXELFORMAT_MJPEG:
case PixelFormat::MJPEG:
break;
#endif
case PIXELFORMAT_NO_CHANGE:
case PixelFormat::NO_CHANGE:
Error(Logger::getInstance("ImageResampler"), "Invalid pixel format given");
break;
}

View File

@@ -7,18 +7,18 @@ namespace RGBW {
WhiteAlgorithm stringToWhiteAlgorithm(QString str)
{
if (str == "subtract_minimum") return SUBTRACT_MINIMUM;
if (str == "sub_min_warm_adjust") return SUB_MIN_WARM_ADJUST;
if (str == "sub_min_cool_adjust") return SUB_MIN_COOL_ADJUST;
if (str.isEmpty() || str == "white_off") return WHITE_OFF;
return INVALID;
if (str == "subtract_minimum") return WhiteAlgorithm::SUBTRACT_MINIMUM;
if (str == "sub_min_warm_adjust") return WhiteAlgorithm::SUB_MIN_WARM_ADJUST;
if (str == "sub_min_cool_adjust") return WhiteAlgorithm::SUB_MIN_COOL_ADJUST;
if (str.isEmpty() || str == "white_off") return WhiteAlgorithm::WHITE_OFF;
return WhiteAlgorithm::INVALID;
}
void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, const WhiteAlgorithm algorithm)
{
switch (algorithm)
{
case SUBTRACT_MINIMUM:
case WhiteAlgorithm::SUBTRACT_MINIMUM:
{
output->white = qMin(qMin(input.red, input.green), input.blue);
output->red = input.red - output->white;
@@ -27,13 +27,13 @@ void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, const WhiteAlgorithm algori
break;
}
case SUB_MIN_WARM_ADJUST:
case WhiteAlgorithm::SUB_MIN_WARM_ADJUST:
{
// http://forum.garagecube.com/viewtopic.php?t=10178
// warm white
float F1 = 0.274;
float F2 = 0.454;
float F3 = 2.333;
// warm white
float F1 = static_cast<float>(0.274);
float F2 = static_cast<float>(0.454);
float F3 = static_cast<float>(2.333);
output->white = qMin(input.red*F1,qMin(input.green*F2,input.blue*F3));
output->red = input.red - output->white/F1;
@@ -42,13 +42,13 @@ void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, const WhiteAlgorithm algori
break;
}
case SUB_MIN_COOL_ADJUST:
case WhiteAlgorithm::SUB_MIN_COOL_ADJUST:
{
// http://forum.garagecube.com/viewtopic.php?t=10178
// cold white
float F1 = 0.299;
float F2 = 0.587;
float F3 = 0.114;
// cold white
float F1 = static_cast<float>(0.299);
float F2 = static_cast<float>(0.587);
float F3 = static_cast<float>(0.114);
output->white = qMin(input.red*F1,qMin(input.green*F2,input.blue*F3));
output->red = input.red - output->white/F1;
@@ -57,7 +57,7 @@ void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, const WhiteAlgorithm algori
break;
}
case WHITE_OFF:
case WhiteAlgorithm::WHITE_OFF:
{
output->red = input.red;
output->green = input.green;