/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#if defined(DEBUG_ENABLED)
Dali::Integration::Log::Filter* gLogFilter = Dali::Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_FONT_CLIENT_VALUE_TO_INDEX");
#endif
-}
+} // namespace
namespace Dali
{
-
namespace TextAbstraction
{
-
namespace Internal
{
-
-int ValueToIndex( int value, const int* const table, unsigned int maxIndex )
+int ValueToIndex(int value, const int* const table, unsigned int maxIndex)
{
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->FontClient::Plugin::ValueToIndex value(%d)\n", value);
+ DALI_LOG_INFO(gLogFilter, Debug::Verbose, "-->FontClient::Plugin::ValueToIndex value(%d)\n", value);
- if( NULL == table )
+ if(NULL == table)
{
// Return an invalid index if there is no table.
return -1;
}
- if( value <= table[0] )
+ if(value <= table[0])
{
return 0;
}
- if( value >= table[maxIndex] )
+ if(value >= table[maxIndex])
{
return maxIndex;
}
- for( unsigned int index = 0u; index < maxIndex; ++index )
+ for(unsigned int index = 0u; index < maxIndex; ++index)
{
- const int v1 = table[index];
+ const int v1 = table[index];
const unsigned int indexPlus = index + 1u;
- const int v2 = table[indexPlus];
- if( ( v1 < value ) && ( value <= v2 ) )
+ const int v2 = table[indexPlus];
+ if((v1 < value) && (value <= v2))
{
- const int result = ( ( v1 > 0 ) && ( ( value - v1 ) < ( v2 - value ) ) ) ? index : indexPlus;
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "FontClient::Plugin::ValueToIndex result(%d)\n", result );
+ const int result = ((v1 > 0) && ((value - v1) < (v2 - value))) ? index : indexPlus;
+ DALI_LOG_INFO(gLogFilter, Debug::Verbose, "FontClient::Plugin::ValueToIndex result(%d)\n", result);
return result;
}
}
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "FontClient::Plugin::ValueToIndex exit 0 <-- \n");
+ DALI_LOG_INFO(gLogFilter, Debug::Verbose, "FontClient::Plugin::ValueToIndex exit 0 <-- \n");
return 0;
}