qskHasEnvironment moved from QskSetup.cpp to QskFunctions.cpp

This commit is contained in:
Uwe Rathmann 2024-09-24 10:02:48 +02:00
parent 8390aeb4fa
commit 3ecd1e90cc
2 changed files with 17 additions and 15 deletions

View File

@ -233,3 +233,17 @@ float qskConstrainedRadians( float radians )
return radians; return radians;
} }
// do not export;
bool qskHasEnvironment( const char* env )
{
bool ok;
const int value = qEnvironmentVariableIntValue( env, &ok );
if ( ok )
return value != 0;
// All other strings are true, apart from "false"
auto result = qgetenv( env );
return !result.isEmpty() && result != "false";
}

View File

@ -5,31 +5,19 @@
#include "QskSetup.h" #include "QskSetup.h"
extern bool qskHasEnvironment( const char* );
extern void qskUpdateItemFlags(); extern void qskUpdateItemFlags();
namespace namespace
{ {
inline bool hasEnvironment( const char* env )
{
bool ok;
const int value = qEnvironmentVariableIntValue( env, &ok );
if ( ok )
return value != 0;
// All other strings are true, apart from "false"
auto result = qgetenv( env );
return !result.isEmpty() && result != "false";
}
inline const QskItem::UpdateFlags environmentUpdateFlags() inline const QskItem::UpdateFlags environmentUpdateFlags()
{ {
QskItem::UpdateFlags flags; QskItem::UpdateFlags flags;
if ( !hasEnvironment( "QSK_PREFER_FBO_PAINTING" ) ) if ( !qskHasEnvironment( "QSK_PREFER_FBO_PAINTING" ) )
flags |= QskItem::PreferRasterForTextures; flags |= QskItem::PreferRasterForTextures;
if ( hasEnvironment( "QSK_FORCE_BACKGROUND" ) ) if ( qskHasEnvironment( "QSK_FORCE_BACKGROUND" ) )
flags |= QskItem::DebugForceBackground; flags |= QskItem::DebugForceBackground;
return flags; return flags;