Skip to content

Commit

Permalink
Windows Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Lord-Grey committed May 31, 2024
1 parent 1eed23f commit 088baa1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/utils/KelvinToRgb.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ static ColorRgb getRgbFromTemperature(int temperature)
}

return {
static_cast<uint8_t>(qBound(0, red, UINT8_MAX)),
static_cast<uint8_t>(qBound(0, green, UINT8_MAX)),
static_cast<uint8_t>(qBound(0, blue, UINT8_MAX)),
static_cast<uint8_t>(qBound(0, red, static_cast<int>(UINT8_MAX))),
static_cast<uint8_t>(qBound(0, green, static_cast<int>(UINT8_MAX))),
static_cast<uint8_t>(qBound(0, blue, static_cast<int>(UINT8_MAX))),
};
}

Expand Down
23 changes: 23 additions & 0 deletions include/utils/global_defines.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,31 @@
#pragma once

#include <cstdint>
#include <limits>

#include <QList>

#define QSTRING_CSTR(str) str.toUtf8().constData()
typedef QList< int > QIntList;

// Undefine the max macro if it's defined (Windows-specific)
#ifdef max
#undef max
#endif

// Define your constexpr variable
constexpr uint32_t UINT8_MAX_SQUARED = static_cast<uint32_t>(std::numeric_limits<unsigned char>::max()) * static_cast<uint32_t>(std::numeric_limits<unsigned char>::max());

// Restore the max macro only if it was previously defined (Windows-specific)
#ifdef _MSC_VER
#define NOMINMAX // Prevent Windows.h from defining min and max macros
#endif

// Restore the max macro if needed (Windows-specific)
#ifdef _MSC_VER
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#endif


0 comments on commit 088baa1

Please sign in to comment.