utc-Dali-Constraints.cpp
utc-Dali-ConstraintSource.cpp
utc-Dali-Context.cpp
+ utc-Dali-Core.cpp
utc-Dali-CustomActor.cpp
utc-Dali-Degree.cpp
utc-Dali-DistanceField.cpp
--- /dev/null
+/*
+ * Copyright (c) 2018 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <iostream>
+#include <sstream>
+#include <cmath> // isfinite
+
+#include <stdlib.h>
+#include <dali/integration-api/core.h>
+#include <dali-test-suite-utils.h>
+
+using namespace Dali;
+
+void utc_dali_core_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_core_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+int UtcDaliCoreGetMaximumUpdateCount(void)
+{
+ TestApplication application;
+ tet_infoline("Testing Dali::GetMaximumUpdateCount");
+
+ DALI_TEST_EQUALS( 2, application.GetCore().GetMaximumUpdateCount(), TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliCoreSetStereoBase(void)
+{
+ TestApplication application;
+ tet_infoline("Testing Dali::GetMaximumUpdateCount");
+
+ application.GetCore().SetViewMode( STEREO_HORIZONTAL );
+ DALI_TEST_EQUALS( application.GetCore().GetViewMode(), STEREO_HORIZONTAL, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ application.GetCore().SetViewMode( STEREO_VERTICAL );
+ DALI_TEST_EQUALS( application.GetCore().GetViewMode(), STEREO_VERTICAL, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ application.GetCore().SetViewMode( MONO );
+ DALI_TEST_EQUALS( application.GetCore().GetViewMode(), MONO, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ END_TEST;
+}
+
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
return Interpolate( Interpolate( a, b, dx), Interpolate( c, d, dx ), dy );
}
-void ScaleField( int width, int height, float* in, int targetWidth, int targetHeight, float* out )
+void ScaleField( int width, int height, float* in, uint32_t targetWidth, uint32_t targetHeight, float* out )
{
- float xScale = static_cast< float >(width) / targetWidth;
- float yScale = static_cast< float >(height) / targetHeight;
+ float xScale = static_cast<float>( width ) / static_cast<float>( targetWidth );
+ float yScale = static_cast<float>( height ) / static_cast<float>( targetHeight );
// for each row in target
- for(int y = 0; y < targetHeight; ++y)
+ for(uint32_t y = 0; y < targetHeight; ++y)
{
- const int sampleY = static_cast< int >( yScale * y );
- const int otherY = std::min( sampleY + 1, height - 1 );
- const float dy = (yScale * y ) - sampleY;
+ const int32_t sampleY = static_cast< int32_t >( yScale * static_cast<float>( y ) );
+ const int32_t otherY = std::min( sampleY + 1, height - 1 );
+ const float dy = (yScale * static_cast<float>( y ) ) - static_cast<float>( sampleY );
// for each column in target
- for (int x = 0; x < targetWidth; ++x)
+ for (uint32_t x = 0; x < targetWidth; ++x)
{
- const int sampleX = static_cast< int >( xScale * x );
- const int otherX = std::min( sampleX + 1, width - 1 );
- const float dx = (xScale * x) - sampleX;
+ const int32_t sampleX = static_cast< int32_t >( xScale * static_cast<float>( x ) );
+ const int32_t otherX = std::min( sampleX + 1, width - 1 );
+ const float dx = (xScale * static_cast<float>( x ) ) - static_cast<float>( sampleX );
float value = Bilinear( in[ sampleY * width + sampleX ],
in[ sampleY * width + otherX ],
}
#define SQUARE(a) ((a) * (a))
-const float MAX_DISTANCE( 1e20 );
+const float MAX_DISTANCE = static_cast<float>( 1e20 );
/**
* Distance transform of 1D function using squared distance
*/
-void DistanceTransform( float *source, float* dest, unsigned int length )
+void DistanceTransform( float *source, float* dest, uint32_t length )
{
- std::vector<int> parabolas(length); // Locations of parabolas in lower envelope
+ std::vector<int32_t> parabolas(length); // Locations of parabolas in lower envelope
std::vector<float> edge(length + 1); // Locations of boundaries between parabolas
- int rightmost(0); // Index of rightmost parabola in lower envelope
+ int32_t rightmost(0); // Index of rightmost parabola in lower envelope
parabolas[0] = 0;
edge[0] = -MAX_DISTANCE;
edge[1] = +MAX_DISTANCE;
- for( unsigned int i = 1; i <= length - 1; i++ )
+ for( uint32_t i = 1; i <= length - 1; i++ )
{
- const float initialDistance( source[i] + SQUARE( i ) );
- int parabola = parabolas[rightmost];
- float newDistance( (initialDistance - (source[parabola] + SQUARE( parabola ))) / (2 * i - 2 * parabola) );
+ const float initialDistance( source[i] + static_cast<float>( i*i ) );
+ int32_t parabola = parabolas[rightmost];
+ float newDistance( (initialDistance - (source[parabola] + static_cast<float>( parabola * parabola ))) / static_cast<float>(2 * i - 2 * parabola) );
while( rightmost > 0 && newDistance <= edge[rightmost] )
{
rightmost--;
parabola = parabolas[rightmost];
- newDistance = (initialDistance - (source[parabola] + SQUARE( parabola ))) / (2 * i - 2 * parabola);
+ newDistance = (initialDistance - (source[parabola] + static_cast<float>( parabola * parabola ))) / static_cast<float>(2 * i - 2 * parabola);
}
rightmost++;
}
rightmost = 0;
- for( unsigned int i = 0; i <= length - 1; ++i )
+ for( uint32_t i = 0; i <= length - 1; ++i )
{
- while( edge[rightmost + 1] < i )
+ while( edge[rightmost + 1] < static_cast<float>( i ) )
{
++rightmost;
}
- dest[i] = SQUARE( static_cast< int >( i ) - parabolas[rightmost] ) + source[parabolas[rightmost]];
+ dest[i] = static_cast<float>( SQUARE( static_cast< int32_t >( i ) - parabolas[rightmost] ) ) + source[parabolas[rightmost]];
}
}
/**
* Distance transform of 2D function using squared distance
*/
-void DistanceTransform( float* data, unsigned int width, unsigned int height, float* sourceBuffer, float* destBuffer )
+void DistanceTransform( float* data, uint32_t width, uint32_t height, float* sourceBuffer, float* destBuffer )
{
// transform along columns
- for( unsigned int x = 0; x < width; ++x )
+ for( uint32_t x = 0; x < width; ++x )
{
- for( unsigned int y = 0; y < height; ++y )
+ for( uint32_t y = 0; y < height; ++y )
{
sourceBuffer[y] = data[ y * width + x ];
}
DistanceTransform( sourceBuffer, destBuffer, height );
- for( unsigned int y = 0; y < height; y++ )
+ for( uint32_t y = 0; y < height; y++ )
{
data[y * width + x] = destBuffer[y];
}
}
// transform along rows
- for( unsigned int y = 0; y < height; ++y )
+ for( uint32_t y = 0; y < height; ++y )
{
- for( unsigned int x = 0; x < width; ++x )
+ for( uint32_t x = 0; x < width; ++x )
{
sourceBuffer[x] = data[ y * width + x ];
}
DistanceTransform( sourceBuffer, destBuffer, width );
- for( unsigned int x = 0; x < width; x++ )
+ for( uint32_t x = 0; x < width; x++ )
{
data[y * width + x] = destBuffer[x];
}
} // namespace
-void GenerateDistanceFieldMap(const unsigned char* const imagePixels, const Size& imageSize,
- unsigned char* const distanceMap, const Size& distanceMapSize,
- const float fieldRadius, const unsigned int fieldBorder, bool highQuality)
+void GenerateDistanceFieldMap(const uint8_t* const imagePixels, const Size& imageSize,
+ uint8_t* const distanceMap, const Size& distanceMapSize,
+ const float fieldRadius, const uint32_t fieldBorder, bool highQuality)
{
GenerateDistanceFieldMap( imagePixels, imageSize, distanceMap, distanceMapSize, fieldBorder, imageSize, highQuality );
}
-void GenerateDistanceFieldMap(const unsigned char* const imagePixels, const Size& imageSize,
- unsigned char* const distanceMap, const Size& distanceMapSize,
- const unsigned int fieldBorder,
- const Vector2& maxSize,
- bool highQuality)
+void GenerateDistanceFieldMap( const uint8_t* const imagePixels, const Size& imageSize,
+ uint8_t* const distanceMap, const Size& distanceMapSize,
+ const uint32_t fieldBorder,
+ const Vector2& maxSize,
+ bool highQuality )
{
// constants to reduce redundant calculations
- const int originalWidth( static_cast<int>(imageSize.width) );
- const int originalHeight( static_cast<int>(imageSize.height) );
- const int paddedWidth( originalWidth + (fieldBorder * 2 ) );
- const int paddedHeight( originalHeight + (fieldBorder * 2 ) );
- const int scaledWidth( static_cast<int>(distanceMapSize.width) );
- const int scaledHeight( static_cast<int>(distanceMapSize.height) );
- const int maxWidth( static_cast<int>(maxSize.width) + (fieldBorder * 2 ));
- const int maxHeight( static_cast<int>(maxSize.height) + (fieldBorder * 2 ) );
-
- const int bufferLength( std::max( maxWidth, std::max(paddedWidth, scaledWidth) ) *
- std::max( maxHeight, std::max(paddedHeight, scaledHeight) ) );
+ const uint32_t originalWidth( static_cast<int32_t>(imageSize.width) );
+ const uint32_t originalHeight( static_cast<int32_t>(imageSize.height) );
+ const uint32_t paddedWidth( originalWidth + (fieldBorder * 2 ) );
+ const uint32_t paddedHeight( originalHeight + (fieldBorder * 2 ) );
+ const uint32_t scaledWidth( static_cast<int32_t>(distanceMapSize.width) );
+ const uint32_t scaledHeight( static_cast<int32_t>(distanceMapSize.height) );
+ const uint32_t maxWidth( static_cast<int32_t>(maxSize.width) + (fieldBorder * 2 ));
+ const uint32_t maxHeight( static_cast<int32_t>(maxSize.height) + (fieldBorder * 2 ) );
+
+ const uint32_t bufferLength( std::max( maxWidth, std::max(paddedWidth, scaledWidth) ) *
+ std::max( maxHeight, std::max(paddedHeight, scaledHeight) ) );
std::vector<float> outsidePixels( bufferLength, 0.0f );
std::vector<float> insidePixels( bufferLength, 0.0f );
float* outside( outsidePixels.data() );
float* inside( insidePixels.data() );
- for( int y = 0; y < paddedHeight; ++y )
+ for( uint32_t y = 0; y < paddedHeight; ++y )
{
- for ( int x = 0; x < paddedWidth; ++x)
+ for ( uint32_t x = 0; x < paddedWidth; ++x)
{
- if( y < static_cast< int >( fieldBorder ) || y >= ( paddedHeight - static_cast< int >( fieldBorder ) ) ||
- x < static_cast< int >( fieldBorder ) || x >= ( paddedWidth - static_cast< int >( fieldBorder ) ) )
+ if( y < static_cast< uint32_t >( fieldBorder ) || y >= ( paddedHeight - static_cast< uint32_t >( fieldBorder ) ) ||
+ x < static_cast< uint32_t >( fieldBorder ) || x >= ( paddedWidth - static_cast< uint32_t >( fieldBorder ) ) )
{
outside[ y * paddedWidth + x ] = MAX_DISTANCE;
inside[ y * paddedWidth + x ] = 0.0f;
}
else
{
- unsigned int pixel( imagePixels[ (y - fieldBorder) * originalWidth + (x - fieldBorder) ] );
- outside[ y * paddedWidth + x ] = (pixel == 0) ? MAX_DISTANCE : SQUARE((255 - pixel) / 255.0f);
- inside[ y * paddedWidth + x ] = (pixel == 255) ? MAX_DISTANCE : SQUARE(pixel / 255.0f);
+ uint32_t pixel( imagePixels[ (y - fieldBorder) * originalWidth + (x - fieldBorder) ] );
+ outside[ y * paddedWidth + x ] = (pixel == 0) ? MAX_DISTANCE : SQUARE( static_cast<float>(255 - pixel) / 255.0f);
+ inside[ y * paddedWidth + x ] = (pixel == 255) ? MAX_DISTANCE : SQUARE( static_cast<float>(pixel) / 255.0f);
}
}
}
if( highQuality )
{
// create temporary buffers for DistanceTransform()
- const int tempBufferLength( std::max(paddedWidth, paddedHeight) );
+ const uint32_t tempBufferLength( std::max(paddedWidth, paddedHeight) );
std::vector<float> tempSourceBuffer( tempBufferLength, 0.0f );
std::vector<float> tempDestBuffer( tempBufferLength, 0.0f );
}
// distmap = outside - inside; % Bipolar distance field
- for( int y = 0; y < paddedHeight; ++y)
+ for( uint32_t y = 0; y < paddedHeight; ++y)
{
- for( int x = 0; x < paddedWidth; ++x )
+ for( uint32_t x = 0; x < paddedWidth; ++x )
{
- const int offset( y * paddedWidth + x );
+ const int32_t offset( y * paddedWidth + x );
float pixel( sqrtf(outside[offset]) - sqrtf(inside[offset]) );
pixel = 128.0f + pixel * 16.0f;
pixel = Clamp( pixel, 0.0f, 255.0f );
ScaleField( paddedWidth, paddedHeight, outside, scaledWidth, scaledHeight, inside );
// convert from floats to integers
- for( int y = 0; y < scaledHeight; ++y )
+ for( uint32_t y = 0; y < scaledHeight; ++y )
{
- for( int x = 0; x < scaledWidth; ++x )
+ for( uint32_t x = 0; x < scaledWidth; ++x )
{
float pixel( inside[ y * scaledWidth + x ] );
- distanceMap[y * scaledWidth + x ] = static_cast< unsigned char >(pixel * 255.0f);
+ distanceMap[y * scaledWidth + x ] = static_cast< uint8_t >(pixel * 255.0f);
}
}
}
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint> // uint8_t, uint32_t
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
* @param[in] maxSize The image is scaled from this size to distanceMapSize
* @param[in] highQuality Set true to generate high quality distance fields
*/
-DALI_CORE_API void GenerateDistanceFieldMap( const unsigned char* const imagePixels, const Vector2& imageSize,
- unsigned char* const distanceMap, const Vector2& distanceMapSize,
- const unsigned int fieldBorder,
- const Vector2& maxSize,
- bool highQuality = true);
+DALI_CORE_API void GenerateDistanceFieldMap( const uint8_t* const imagePixels, const Vector2& imageSize,
+ uint8_t* const distanceMap, const Vector2& distanceMapSize,
+ const uint32_t fieldBorder,
+ const Vector2& maxSize,
+ bool highQuality = true );
} //namespace Dali
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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( stretchPixelsX.Size() > 0 && stretchPixelsY.Size() > 0 )
{
//The NinePatchImage stretch pixels are in the cropped image space, inset by 1 to get it to uncropped image space
- border.x = stretchPixelsX[ 0 ].GetX() + 1;
- border.y = stretchPixelsY[ 0 ].GetX() + 1;
- border.z = GetWidth() - stretchPixelsX[ 0 ].GetY() - 1;
- border.w = GetHeight() - stretchPixelsY[ 0 ].GetY() - 1;
+ border.x = static_cast<float>( stretchPixelsX[ 0 ].GetX() + 1 );
+ border.y = static_cast<float>( stretchPixelsY[ 0 ].GetX() + 1 );
+ border.z = static_cast<float>( GetWidth() - stretchPixelsX[ 0 ].GetY() - 1 );
+ border.w = static_cast<float>( GetHeight() - stretchPixelsY[ 0 ].GetY() - 1 );
}
return border;
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
#define DALI_PIXEL_DATA_DEVEL_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
*
*/
-// INTERNAL INCLUDES
-#include <dali/public-api/images/pixel-data.h>
+// EXTERNAL INCLUDES
+#include <cstdint>
// INTERNAL INCLUDES
+#include <dali/public-api/images/pixel-data.h>
#include <dali/public-api/images/pixel.h>
namespace Dali
*/
struct PixelDataBuffer
{
- unsigned char* buffer;
- unsigned int bufferSize;
+ uint8_t* buffer;
+ uint32_t bufferSize;
PixelData::ReleaseFunction releaseFunction;
- PixelDataBuffer( unsigned char* buffer,
- unsigned int bufferSize,
+ PixelDataBuffer( uint8_t* buffer,
+ uint32_t bufferSize,
PixelData::ReleaseFunction releaseFunction )
: buffer(buffer),
bufferSize(bufferSize),
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
texture = GetImplementation( image ).GetTexture();
}
- GetImplementation( textureSet ).SetTexture( index, texture );
+ GetImplementation( textureSet ).SetTexture( static_cast<uint32_t>( index ), texture );
}
} // namespace Dali
#define DALI_ENUM_HELPER_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
*/
#define DALI_ENUM_TO_STRING_TABLE_BEGIN_WITH_TYPE( type, t ) const type t##_TABLE[] = {
#define DALI_ENUM_TO_STRING_TABLE_BEGIN( t ) DALI_ENUM_TO_STRING_TABLE_BEGIN_WITH_TYPE( Dali::Scripting::StringEnum, t )
-#define DALI_ENUM_TO_STRING_TABLE_END( t ) }; const unsigned int t##_TABLE_COUNT = sizeof( t##_TABLE ) / sizeof( t##_TABLE[0] );
+#define DALI_ENUM_TO_STRING_TABLE_END( t ) }; const uint32_t t##_TABLE_COUNT = static_cast<uint32_t>( sizeof( t##_TABLE ) / sizeof( t##_TABLE[0] ) );
#define DALI_ENUM_TO_STRING( s ) { #s, s },
/**
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
{ "COMPRESSED_RGB8_ETC1", Pixel::COMPRESSED_RGB8_ETC1 },
{ "COMPRESSED_RGB_PVRTC_4BPPV1", Pixel::COMPRESSED_RGB_PVRTC_4BPPV1 },
};
-const unsigned int PIXEL_FORMAT_TABLE_COUNT = sizeof( PIXEL_FORMAT_TABLE ) / sizeof( PIXEL_FORMAT_TABLE[0] );
+const uint32_t PIXEL_FORMAT_TABLE_COUNT = static_cast<uint32_t>( sizeof( PIXEL_FORMAT_TABLE ) / sizeof( PIXEL_FORMAT_TABLE[0] ) );
const StringEnum IMAGE_FITTING_MODE_TABLE[] =
{
{ "FIT_WIDTH", FittingMode::FIT_WIDTH },
{ "FIT_HEIGHT", FittingMode::FIT_HEIGHT },
};
-const unsigned int IMAGE_FITTING_MODE_TABLE_COUNT = sizeof( IMAGE_FITTING_MODE_TABLE ) / sizeof( IMAGE_FITTING_MODE_TABLE[0] );
+const uint32_t IMAGE_FITTING_MODE_TABLE_COUNT = static_cast<uint32_t>( sizeof( IMAGE_FITTING_MODE_TABLE ) / sizeof( IMAGE_FITTING_MODE_TABLE[0] ) );
const StringEnum IMAGE_SAMPLING_MODE_TABLE[] =
{
{ "NO_FILTER", SamplingMode::NO_FILTER },
{ "DONT_CARE", SamplingMode::DONT_CARE },
};
-const unsigned int IMAGE_SAMPLING_MODE_TABLE_COUNT = sizeof( IMAGE_SAMPLING_MODE_TABLE ) / sizeof( IMAGE_SAMPLING_MODE_TABLE[0] );
+const uint32_t IMAGE_SAMPLING_MODE_TABLE_COUNT = static_cast<uint32_t>( sizeof( IMAGE_SAMPLING_MODE_TABLE ) / sizeof( IMAGE_SAMPLING_MODE_TABLE[0] ) );
const char* ImageTypeName[] = { "ResourceImage", "FrameBufferImage", "BufferImage" };
enum ImageType { RESOURCE_IMAGE, FRAME_BUFFER_IMAGE, BUFFER_IMAGE };
-const unsigned int imageTypeCount = sizeof( ImageTypeName ) / sizeof( const char* );
+const uint32_t imageTypeCount = static_cast<uint32_t>( sizeof( ImageTypeName ) / sizeof( const char* ) );
} // unnamed namespace
-bool EnumStringToInteger( const char * const value, const StringEnum* const enumTable, unsigned int tableCount, int& integerEnum )
+bool EnumStringToInteger( const char * const value, const StringEnum* const enumTable, uint32_t tableCount, int& integerEnum )
{
int ret = 0;
while(!done)
{
- size_t size = 0;
+ uint32_t size = 0;
const StringEnum* table = enumTable;
- for ( unsigned int i = 0; i < tableCount; ++i )
+ for ( uint32_t i = 0; i < tableCount; ++i )
{
if( Internal::CompareTokens( pValue, table->string, size ) )
{
return found;
}
-unsigned int FindEnumIndex( const char* value, const StringEnum* table, unsigned int tableCount )
+uint32_t FindEnumIndex( const char* value, const StringEnum* table, uint32_t tableCount )
{
- unsigned int index = 0;
+ uint32_t index = 0;
bool found = false;
- for ( unsigned int i = 0; i < tableCount; ++i, ++index )
+ for ( uint32_t i = 0; i < tableCount; ++i, ++index )
{
- size_t sizeIgnored = 0;
+ uint32_t sizeIgnored = 0;
if( Internal::CompareTokens( value, table->string, sizeIgnored ) )
{
found = true;
{
std::string type;
value->Get( type );
- for( unsigned int i = 0; i < imageTypeCount; ++i )
+ for( uint32_t i = 0; i < imageTypeCount; ++i )
{
if( 0 == type.compare( ImageTypeName[ i ] ) )
{
// Width and height can be set individually. Dali derives the unspecified
// dimension from the aspect ratio of the raw image.
- int width = 0, height = 0;
+ int32_t width = 0, height = 0;
value = map->Find( "width" );
if( value )
// handle floats and integer the same for json script
if( value->GetType() == Property::FLOAT )
{
- width = static_cast<unsigned int>( value->Get<float>() );
+ width = static_cast<uint32_t>( value->Get<float>() );
}
else
{
{
if( value->GetType() == Property::FLOAT )
{
- height = static_cast<int>( value->Get<float>() );
+ height = static_cast<int32_t>( value->Get<float>() );
}
else
{
{
case RESOURCE_IMAGE :
{
- ret = ResourceImage::New( filename, ImageDimensions( attributes.GetSize().x, attributes.GetSize().y ),
+ ret = ResourceImage::New( filename, ImageDimensions( static_cast<uint32_t>( attributes.GetSize().x ), static_cast<uint32_t>( attributes.GetSize().y ) ),
attributes.GetScalingMode(), attributes.GetFilterMode(), attributes.GetOrientationCorrection() );
break;
}
if ( actor )
{
// Now set the properties, or create children
- for ( unsigned int i = 0, mapCount = map.Count(); i < mapCount; ++i )
+ for ( Property::Map::SizeType i = 0, mapCount = map.Count(); i < mapCount; ++i )
{
const KeyValuePair pair( map.GetKeyValue( i ) );
if( pair.first.type == Property::Key::INDEX )
}
// Children
- unsigned int childCount( actor.GetChildCount() );
+ std::size_t childCount( actor.GetChildCount() );
if ( childCount )
{
Property::Array childArray;
- for ( unsigned int child = 0; child < childCount; ++child )
+ for ( uint32_t child = 0; child < childCount; ++child )
{
Property::Map childMap;
CreatePropertyMap( actor.GetChildAt( child ), childMap );
map[ "filename" ] = resourceImage.GetUrl();
}
- int width( image.GetWidth() );
- int height( image.GetHeight() );
+ int32_t width( image.GetWidth() );
+ int32_t height( image.GetHeight() );
if ( width && height )
{
element->timePeriodDuration = 1.0f;
// Now set the properties, or create children
- for( unsigned int i = 0, animationMapCount = map.Count(); i < animationMapCount; ++i )
+ for( Property::Map::SizeType i = 0, animationMapCount = map.Count(); i < animationMapCount; ++i )
{
const KeyValuePair pair( map.GetKeyValue( i ) );
if( pair.first.type == Property::Key::INDEX )
else if( key == "timePeriod" )
{
Property::Map timeMap = value.Get< Property::Map >();
- for( unsigned int i = 0; i < timeMap.Count(); ++i )
+ for( Property::Map::SizeType i = 0; i < timeMap.Count(); ++i )
{
const KeyValuePair timePair( timeMap.GetKeyValue( i ) );
if( timePair.first.type == Property::Key::INDEX )
*/
struct StringEnum
{
- const char* string; ///< The string representation
- const int value; ///< The enumeration value wrapped in int
+ const char* string; ///< The string representation
+ const int32_t value; ///< The enumeration value wrapped in int
};
/**
* @param[in] tableCount Number of items in the array.
* @return The index of the enumeration. If enumeration is not found, logs an error and returns tableCount.
*/
-DALI_CORE_API unsigned int FindEnumIndex( const char* value, const StringEnum* table, unsigned int tableCount );
+DALI_CORE_API uint32_t FindEnumIndex( const char* value, const StringEnum* table, uint32_t tableCount );
/**
* @brief Find the enum as an integer from the table
* @param[out] integerEnum The value of the enum.
* @return true if one or more enums in value.
*/
-DALI_CORE_API bool EnumStringToInteger( const char* const value, const StringEnum* const table, unsigned int tableCount, int& integerEnum );
+DALI_CORE_API bool EnumStringToInteger( const char* const value, const StringEnum* const table, uint32_t tableCount, int& integerEnum );
/**
* @brief Chooses the appropriate enumeration for the provided string from the given table.
* @return True if the value was found from the table
*/
template< typename T >
-bool GetEnumeration( const char* value, const StringEnum* table, unsigned int tableCount, T& result )
+bool GetEnumeration( const char* value, const StringEnum* table, uint32_t tableCount, T& result )
{
bool retVal( false );
if( table )
* @return True if the value was found successfully AND the value has changed. This is to allow the caller to do nothing if there is no change.
*/
template< typename T >
-bool GetEnumerationProperty( const Property::Value& propertyValue, const StringEnum* table, unsigned int tableCount, T& result )
+bool GetEnumerationProperty( const Property::Value& propertyValue, const StringEnum* table, uint32_t tableCount, T& result )
{
int newValue;
bool set = false;
* @return True if the value was found successfully AND the value has changed. This is to allow the caller to do nothing if there is no change.
*/
template< typename T >
-bool GetBitmaskEnumerationProperty( const Property::Value& propertyValue, const Scripting::StringEnum* table, unsigned int tableCount, T& result )
+bool GetBitmaskEnumerationProperty( const Property::Value& propertyValue, const Scripting::StringEnum* table, uint32_t tableCount, T& result )
{
bool returnValue = true;
* @note The caller is NOT responsible for cleaning up the returned pointer as it is statically allocated.
*/
template< typename T >
-const char* GetEnumerationName( T value, const StringEnum* table, unsigned int tableCount )
+const char* GetEnumerationName( T value, const StringEnum* table, uint32_t tableCount )
{
if( table )
{
- for ( unsigned int i = 0; i < tableCount; ++i )
+ for ( uint32_t i = 0; i < tableCount; ++i )
{
if ( value == T(table[ i ].value) )
{
* @note The caller is NOT responsible for cleaning up the returned pointer as it is statically allocated.
*/
template< typename T >
-const char * GetLinearEnumerationName( T value, const StringEnum* table, unsigned int tableCount )
+const char * GetLinearEnumerationName( T value, const StringEnum* table, uint32_t tableCount )
{
if ( table && ( value > 0 || value <= static_cast<int>( tableCount ) ) )
{
class Bitmap;
typedef IntrusivePtr<Bitmap> BitmapPtr;
-typedef unsigned char PixelBuffer; ///< Pixel data buffers are composed of these
+typedef uint8_t PixelBuffer; ///< Pixel data buffers are composed of these
/**
* Bitmap class.
* @param[in] height Image height in pixels
*/
void Initialize(Pixel::Format pixelFormat,
- unsigned int width,
- unsigned int height);
+ uint32_t width,
+ uint32_t height);
public:
* Get the width of the image
* @return The width of the image
*/
- unsigned int GetImageWidth() const
+ uint32_t GetImageWidth() const
{
return mImageWidth;
}
* Get the height of the image
* @return The height of the image
*/
- unsigned int GetImageHeight() const
+ uint32_t GetImageHeight() const
{
return mImageHeight;
}
* @return The buffer size in bytes.
* @sa ReserveBuffer GetBuffer
*/
- virtual size_t GetBufferSize() const = 0;
+ virtual uint32_t GetBufferSize() const = 0;
/**
* Queries if the bitmap has an alpha channel
* @return pixel buffer pointer
*/
virtual PixelBuffer* ReserveBuffer(Pixel::Format pixelFormat,
- unsigned int width,
- unsigned int height,
- unsigned int bufferWidth = 0,
- unsigned int bufferHeight = 0) = 0;
+ uint32_t width,
+ uint32_t height,
+ uint32_t bufferWidth = 0,
+ uint32_t bufferHeight = 0) = 0;
/**
* Assign a pixel buffer. Any previously allocated pixel buffer is deleted.
*/
virtual void AssignBuffer(Pixel::Format pixelFormat,
PixelBuffer* buffer,
- std::size_t bufferSize,
- unsigned int width,
- unsigned int height,
- unsigned int bufferWidth = 0,
- unsigned int bufferHeight = 0) = 0;
+ uint32_t bufferSize,
+ uint32_t width,
+ uint32_t height,
+ uint32_t bufferWidth = 0,
+ uint32_t bufferHeight = 0) = 0;
/**
* Get the width of the buffer (stride)
* @return The width of the buffer in pixels
*/
- virtual unsigned int GetBufferWidth() const = 0;
+ virtual uint32_t GetBufferWidth() const = 0;
/**
* Get the height of the buffer
* @return The height of the buffer in pixels
*/
- virtual unsigned int GetBufferHeight() const = 0;
+ virtual uint32_t GetBufferHeight() const = 0;
/**
* Get the pixel buffer stride.
* @return The buffer stride (in bytes) if this is bitmap of non-compressed
* packed pixels for which a stride is meaningful or 0 otherwise.
*/
- virtual unsigned int GetBufferStride() const = 0;
+ virtual uint32_t GetBufferStride() const = 0;
/**
* Check the bitmap data and test whether it has any transparent pixels.
virtual PixelBuffer* ReserveBufferOfSize( Pixel::Format pixelFormat,
const unsigned width,
const unsigned height,
- const size_t numBytes ) = 0;
+ const uint32_t numBytes ) = 0;
protected:
/**
protected:
- unsigned int mImageWidth; ///< Image width in pixels
- unsigned int mImageHeight; ///< Image height in pixels
+ uint32_t mImageWidth; ///< Image width in pixels
+ uint32_t mImageHeight; ///< Image height in pixels
Pixel::Format mPixelFormat; ///< Pixel format
bool mHasAlphaChannel; ///< Whether the image has an alpha channel
bool mAlphaChannelUsed; ///< Whether the alpha channel is used in case the image owns one.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
mImpl->RecoverFromContextLoss();
}
-void Core::SurfaceResized(unsigned int width, unsigned int height)
+void Core::SurfaceResized(uint32_t width, uint32_t height)
{
mImpl->SurfaceResized(width, height);
}
-void Core::SetTopMargin( unsigned int margin )
+void Core::SetTopMargin( uint32_t margin )
{
mImpl->SetTopMargin(margin);
}
-void Core::SetDpi(unsigned int dpiHorizontal, unsigned int dpiVertical)
+void Core::SetDpi( uint32_t dpiHorizontal, uint32_t dpiVertical)
{
mImpl->SetDpi(dpiHorizontal, dpiVertical);
}
mImpl->ProcessEvents();
}
-unsigned int Core::GetMaximumUpdateCount() const
+uint32_t Core::GetMaximumUpdateCount() const
{
return mImpl->GetMaximumUpdateCount();
}
-void Core::Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds, UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo )
+void Core::Update( float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo )
{
mImpl->Update( elapsedSeconds, lastVSyncTimeMilliseconds, nextVSyncTimeMilliseconds, status, renderToFboEnabled, isRenderingToFbo );
}
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
+
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/common/view-mode.h>
* Query whether the Core has further frames to update & render e.g. when animations are ongoing.
* @return A bitmask of KeepUpdating values
*/
- unsigned int KeepUpdating() { return keepUpdating; }
+ uint32_t KeepUpdating() { return keepUpdating; }
/**
* Query whether the Core requires an Notification event.
public:
- unsigned int keepUpdating; ///< A bitmask of KeepUpdating values
+ uint32_t keepUpdating; ///< A bitmask of KeepUpdating values
bool needsNotification;
bool surfaceRectChanged;
float secondsFromLastFrame;
* @param[in] width The new surface width.
* @param[in] height The new surface height.
*/
- void SurfaceResized(unsigned int width, unsigned int height);
+ void SurfaceResized( uint32_t width, uint32_t height );
/**
* Notify the Core about the top margin size.
* It is mainly useful for indicator in mobile device
* @param[in] margin margin size
*/
- void SetTopMargin( unsigned int margin );
+ void SetTopMargin( uint32_t margin );
// Core setters
* @param[in] dpiHorizontal Horizontal DPI value.
* @param[in] dpiVertical Vertical DPI value.
*/
- void SetDpi(unsigned int dpiHorizontal, unsigned int dpiVertical);
+ void SetDpi( uint32_t dpiHorizontal, uint32_t dpiVertical );
// Core Lifecycle
* the Core::Render() method for frame N has returned.
* @return The maximum update count (>= 1).
*/
- unsigned int GetMaximumUpdateCount() const;
+ uint32_t GetMaximumUpdateCount() const;
/**
* Update the scene for the next frame. This method must be called before each frame is rendered.
* @param[in] isRenderingToFbo Whether this frame is being rendered into the Frame Buffer Object.
*/
void Update( float elapsedSeconds,
- unsigned int lastVSyncTimeMilliseconds,
- unsigned int nextVSyncTimeMilliseconds,
+ uint32_t lastVSyncTimeMilliseconds,
+ uint32_t nextVSyncTimeMilliseconds,
UpdateStatus& status,
bool renderToFboEnabled,
bool isRenderingToFbo );
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
points.push_back(point);
}
-Point& MultiPointEvent::GetPoint( unsigned int point )
+Point& MultiPointEvent::GetPoint( uint32_t point )
{
DALI_ASSERT_ALWAYS(point < points.size() && "MultiPointEvent: Point index out of bounds");
return points[point];
}
-const Point& MultiPointEvent::GetPoint( unsigned int point ) const
+const Point& MultiPointEvent::GetPoint( uint32_t point ) const
{
DALI_ASSERT_ALWAYS(point < points.size() && "MultiPointEvent: Point index out of bounds");
return points[point];
}
-unsigned int MultiPointEvent::GetPointCount() const
+uint32_t MultiPointEvent::GetPointCount() const
{
- return points.size();
+ return static_cast<uint32_t>( points.size() ); // not going to overflow in practice
}
} // namespace Integration
* @brief Retrieves the Point at position point.
* @return The Point at position point.
*/
- Point& GetPoint( unsigned int point );
+ Point& GetPoint( uint32_t point );
/**
* @brief Retrieves a const ref of the Point at position point.
* @return The const ref of the Point at position point.
*/
- const Point& GetPoint( unsigned int point ) const;
+ const Point& GetPoint( uint32_t point ) const;
/**
* @brief The total number of Points in this TouchEvent.
* @return The point count.
*/
- unsigned int GetPointCount() const;
+ uint32_t GetPointCount() const;
};
} // namespace Integration
{
}
-void Point::SetDeviceId( int deviceId )
+void Point::SetDeviceId( int32_t deviceId )
{
mTouchPoint.deviceId = deviceId;
}
*
* @param[in] deviceId The Unique Device ID.
*/
- void SetDeviceId( int deviceId );
+ void SetDeviceId( int32_t deviceId );
/**
* @brief Set the state of the point.
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
namespace Integration
{
-LocklessBuffer::LocklessBuffer( size_t size )
+LocklessBuffer::LocklessBuffer( uint32_t size )
: mState( R0W1 ),
mSize( size )
{
// allocate memory to speed up operation
- mBuffer[0] = new unsigned char[size];
- mBuffer[1] = new unsigned char[size];
+ mBuffer[0] = new uint8_t[size];
+ mBuffer[1] = new uint8_t[size];
memset (mBuffer[0], 0, size );
memset (mBuffer[1], 0, size );
delete[] mBuffer[1];
}
-void LocklessBuffer::Write( const unsigned char *src, size_t size )
+void LocklessBuffer::Write( const uint8_t *src, uint32_t size )
{
DALI_ASSERT_ALWAYS( size <= mSize );
(void)checkState; // Avoid unused variable warning
}
-const unsigned char* LocklessBuffer::Read()
+const uint8_t* LocklessBuffer::Read()
{
// current state (only to avoid multiple memory reads with volatile variable)
BufferState currentState( mState );
return mBuffer[!currentWriteBuf];
}
-unsigned int LocklessBuffer::GetSize() const
+uint32_t LocklessBuffer::GetSize() const
{
return static_cast<unsigned int>(mSize);
}
*/
// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t, uint8_t
// INTERNAL INCLUDES
#include <cstring>
* Constructor.
* @param[in] size The size of buffers in bytes.
*/
- LocklessBuffer( size_t size );
+ LocklessBuffer( uint32_t size );
/**
* Destructor.
* @param[in] src data source
* @param[in] size size of data in bytes
*/
- void Write( const unsigned char *src, size_t size );
+ void Write( const uint8_t *src, uint32_t size );
/**
* Try to swap buffers and read data.
* @note returned value only valid until Read() is called again or object is destroyed
* @return current read buffer contents
*/
- const unsigned char* Read();
+ const uint8_t* Read();
/**
* @return the buffer size in bytes
*/
- unsigned int GetSize() const;
+ uint32_t GetSize() const;
private:
/**
LocklessBuffer& operator=( const LocklessBuffer& ); ///< undefined assignment operator
private:
- unsigned char* mBuffer[2]; ///< bitmap buffers
- BufferState volatile mState; ///< readbuffer number and whether we're currently writing into writebuffer or not
- size_t mSize; ///< size of buffers
+ uint8_t* mBuffer[2]; ///< bitmap buffers
+ BufferState volatile mState; ///< readbuffer number and whether we're currently writing into writebuffer or not
+ uint32_t mSize; ///< size of buffers
};
} // Internal
#define __DALI_INTEGRATION_PLATFORM_ABSTRACTION_H__
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
namespace Integration
{
-typedef unsigned int ResourceId;
+typedef uint32_t ResourceId;
typedef IntrusivePtr<Dali::RefObject> ResourcePointer;
/**
* @param[out] buffer A buffer to receive the file.
* @result true if the file is loaded.
*/
- virtual bool LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const = 0;
+ virtual bool LoadShaderBinaryFile( const std::string& filename, Dali::Vector< uint8_t >& buffer ) const = 0;
/**
* Save a shader binary file to the resource file system.
* @param[in] numbytes Size of the buffer.
* @result true if the file is saved, else false.
*/
- virtual bool SaveShaderBinaryFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const = 0;
+ virtual bool SaveShaderBinaryFile( const std::string& filename, const uint8_t * buffer, uint32_t numBytes ) const = 0;
protected:
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
namespace Profiling
{
-const int ANIMATION_MEMORY_SIZE(
+const std::size_t ANIMATION_MEMORY_SIZE(
sizeof( Internal::Animation ) +
sizeof( Internal::AnimatorConnector<float> ) +
sizeof( Internal::SceneGraph::Animation ) );
-const int CONSTRAINT_MEMORY_SIZE(
+const std::size_t CONSTRAINT_MEMORY_SIZE(
sizeof( Internal::Constraint<float> ) +
sizeof( Internal::SceneGraph::Constraint<float, Internal::PropertyAccessor<float> > ) );
-const int ACTOR_MEMORY_SIZE(
+const std::size_t ACTOR_MEMORY_SIZE(
sizeof( Internal::Actor ) +
sizeof( Internal::SceneGraph::Node ) );
-const int CAMERA_ACTOR_MEMORY_SIZE(
+const std::size_t CAMERA_ACTOR_MEMORY_SIZE(
sizeof( Internal::CameraActor ) +
sizeof( Internal::SceneGraph::Node ) +
sizeof( Internal::SceneGraph::Camera ) );
-const int LAYER_MEMORY_SIZE(
+const std::size_t LAYER_MEMORY_SIZE(
sizeof( Internal::Layer ) +
sizeof( Internal::SceneGraph::Layer ) );
-const int IMAGE_MEMORY_SIZE(
+const std::size_t IMAGE_MEMORY_SIZE(
sizeof( Internal::Image ) +
sizeof( Integration::Bitmap ) );
-const int RENDERER_MEMORY_SIZE(
+const std::size_t RENDERER_MEMORY_SIZE(
sizeof( Internal::Renderer ) +
sizeof( Internal::SceneGraph::Renderer ) +
sizeof( Internal::Render::Renderer ) );
-const int GEOMETRY_MEMORY_SIZE(
+const std::size_t GEOMETRY_MEMORY_SIZE(
sizeof( Internal::Geometry ) +
sizeof( Internal::Render::Geometry) );
-const int PROPERTY_BUFFER_MEMORY_SIZE(
+const std::size_t PROPERTY_BUFFER_MEMORY_SIZE(
sizeof( Internal::PropertyBuffer ) +
sizeof( Internal::Render::PropertyBuffer ) );
-const int TEXTURE_SET_MEMORY_SIZE(
+const std::size_t TEXTURE_SET_MEMORY_SIZE(
sizeof( Internal::TextureSet ) +
sizeof( Internal::SceneGraph::TextureSet ) );
-const int SAMPLER_MEMORY_SIZE(
+const std::size_t SAMPLER_MEMORY_SIZE(
sizeof( Internal::Sampler ) +
sizeof( Internal::Render::Sampler ) );
-const int SHADER_MEMORY_SIZE(
+const std::size_t SHADER_MEMORY_SIZE(
sizeof( Internal::Shader ) +
sizeof( Internal::SceneGraph::Shader ) );
*/
// EXTERNAL INCLUDES
+#include <cstddef>
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
namespace Profiling
{
-DALI_CORE_API extern const int ANIMATION_MEMORY_SIZE; ///< Total size of animation and associated internal objects
-DALI_CORE_API extern const int CONSTRAINT_MEMORY_SIZE; ///< Total size of constraint and associated internal objects
-DALI_CORE_API extern const int ACTOR_MEMORY_SIZE; ///< Total size of actor and associated internal objects
-DALI_CORE_API extern const int CAMERA_ACTOR_MEMORY_SIZE; ///< Total size of camera actor and associated internal objects
-DALI_CORE_API extern const int IMAGE_ACTOR_MEMORY_SIZE; ///< Total size of image actor and associated internal objects
-DALI_CORE_API extern const int LAYER_MEMORY_SIZE; ///< Total size of layer and associated internal objects
-DALI_CORE_API extern const int IMAGE_MEMORY_SIZE; ///< Total size of image and associated internal objects
+DALI_CORE_API extern const std::size_t ANIMATION_MEMORY_SIZE; ///< Total size of animation and associated internal objects
+DALI_CORE_API extern const std::size_t CONSTRAINT_MEMORY_SIZE; ///< Total size of constraint and associated internal objects
+DALI_CORE_API extern const std::size_t ACTOR_MEMORY_SIZE; ///< Total size of actor and associated internal objects
+DALI_CORE_API extern const std::size_t CAMERA_ACTOR_MEMORY_SIZE; ///< Total size of camera actor and associated internal objects
+DALI_CORE_API extern const std::size_t IMAGE_ACTOR_MEMORY_SIZE; ///< Total size of image actor and associated internal objects
+DALI_CORE_API extern const std::size_t LAYER_MEMORY_SIZE; ///< Total size of layer and associated internal objects
+DALI_CORE_API extern const std::size_t IMAGE_MEMORY_SIZE; ///< Total size of image and associated internal objects
-DALI_CORE_API extern const int RENDERER_MEMORY_SIZE; ///< Total size of renderer and associated internal objects
-DALI_CORE_API extern const int GEOMETRY_MEMORY_SIZE; ///< Total size of geometry and associated internal objects
-DALI_CORE_API extern const int PROPERTY_BUFFER_MEMORY_SIZE; ///< Total size of property-0buffer and associated internal objects
-DALI_CORE_API extern const int TEXTURE_SET_MEMORY_SIZE; ///< Total size of TextureSet and associated internal objects
-DALI_CORE_API extern const int SAMPLER_MEMORY_SIZE; ///< Total size of Sampler and associated internal objects
-DALI_CORE_API extern const int SHADER_MEMORY_SIZE; ///< Total size of shader and associated internal objects
+DALI_CORE_API extern const std::size_t RENDERER_MEMORY_SIZE; ///< Total size of renderer and associated internal objects
+DALI_CORE_API extern const std::size_t GEOMETRY_MEMORY_SIZE; ///< Total size of geometry and associated internal objects
+DALI_CORE_API extern const std::size_t PROPERTY_BUFFER_MEMORY_SIZE; ///< Total size of property-0buffer and associated internal objects
+DALI_CORE_API extern const std::size_t TEXTURE_SET_MEMORY_SIZE; ///< Total size of TextureSet and associated internal objects
+DALI_CORE_API extern const std::size_t SAMPLER_MEMORY_SIZE; ///< Total size of Sampler and associated internal objects
+DALI_CORE_API extern const std::size_t SHADER_MEMORY_SIZE; ///< Total size of shader and associated internal objects
} // namespace Profiling
} // namespace Integration
#define __DALI_INTERNAL_BUFFER_INDEX_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint>
+
namespace Dali
{
namespace Internal
{
-typedef unsigned int BufferIndex;
+typedef uint32_t BufferIndex;
} // namespace Internal
namespace
{
// The Update for frame N+1 may be processed whilst frame N is being rendered.
-const unsigned int MAXIMUM_UPDATE_COUNT = 2u;
+const uint32_t MAXIMUM_UPDATE_COUNT = 2u;
#if defined(DEBUG_ENABLED)
Debug::Filter* gCoreFilter = Debug::Filter::New(Debug::Concise, false, "LOG_CORE");
mRenderManager->ContextDestroyed();
}
-void Core::SurfaceResized( unsigned int width, unsigned int height )
+void Core::SurfaceResized( uint32_t width, uint32_t height )
{
- mStage->SurfaceResized( width, height );
+ mStage->SurfaceResized( static_cast<float>( width ), static_cast<float>( height ) );
// The stage-size may be less than surface-size (reduced by top-margin)
Vector2 size = mStage->GetSize();
- mRelayoutController->SetStageSize( size.width, size.height );
+ mRelayoutController->SetStageSize( static_cast<uint32_t>( size.width ), static_cast<uint32_t>( size.height ) ); // values get truncated
}
-void Core::SetTopMargin( unsigned int margin )
+void Core::SetTopMargin( uint32_t margin )
{
mStage->SetTopMargin( margin );
// The stage-size may be less than surface-size (reduced by top-margin)
Vector2 size = mStage->GetSize();
- mRelayoutController->SetStageSize( size.width, size.height );
+ mRelayoutController->SetStageSize( static_cast<uint32_t>( size.width ), static_cast<uint32_t>( size.height ) ); // values get truncated
}
-void Core::SetDpi( unsigned int dpiHorizontal, unsigned int dpiVertical )
+void Core::SetDpi( uint32_t dpiHorizontal, uint32_t dpiVertical )
{
- mStage->SetDpi( Vector2( dpiHorizontal , dpiVertical) );
+ mStage->SetDpi( Vector2( static_cast<float>( dpiHorizontal ), static_cast<float>( dpiVertical ) ) );
}
-void Core::Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds, Integration::UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo )
+void Core::Update( float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, Integration::UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo )
{
// set the time delta so adaptor can easily print FPS with a release build with 0 as
// it is cached by frametime
mProcessingEvent = false;
}
-unsigned int Core::GetMaximumUpdateCount() const
+uint32_t Core::GetMaximumUpdateCount() const
{
return MAXIMUM_UPDATE_COUNT;
}
void RecoverFromContextLoss();
/**
- * @copydoc Dali::Integration::Core::SurfaceResized(unsigned int, unsigned int)
+ * @copydoc Dali::Integration::Core::SurfaceResized(uint32_t, uint32_t)
*/
- void SurfaceResized(unsigned int width, unsigned int height);
+ void SurfaceResized(uint32_t width, uint32_t height);
/**
- * @copydoc Dali::Integration::Core::SetTopMargin( unsigned int margin )
+ * @copydoc Dali::Integration::Core::SetTopMargin( uint32_t margin )
*/
- void SetTopMargin( unsigned int margin );
+ void SetTopMargin( uint32_t margin );
/**
- * @copydoc Dali::Integration::Core::SetDpi(unsigned int, unsigned int)
+ * @copydoc Dali::Integration::Core::SetDpi(uint32_t, uint32_t)
*/
- void SetDpi(unsigned int dpiHorizontal, unsigned int dpiVertical);
+ void SetDpi(uint32_t dpiHorizontal, uint32_t dpiVertical);
/**
- * @copydoc Dali::Integration::Core::SetMinimumFrameTimeInterval(unsigned int)
+ * @copydoc Dali::Integration::Core::SetMinimumFrameTimeInterval(uint32_t)
*/
- void SetMinimumFrameTimeInterval(unsigned int interval);
+ void SetMinimumFrameTimeInterval(uint32_t interval);
/**
* @copydoc Dali::Integration::Core::Update()
*/
- void Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds, Integration::UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo );
+ void Update( float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, Integration::UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo );
/**
* @copydoc Dali::Integration::Core::Render()
/**
* @copydoc Dali::Integration::Core::GetMaximumUpdateCount()
*/
- unsigned int GetMaximumUpdateCount() const;
+ uint32_t GetMaximumUpdateCount() const;
/**
* @copydoc Dali::Integration::Core::GetSystemOverlay()
}
// Placement new the object in block memory
- unsigned char* objectAddress = static_cast< unsigned char* >( mImpl->mCurrentBlock->blockMemory );
+ uint8_t* objectAddress = static_cast< uint8_t* >( mImpl->mCurrentBlock->blockMemory );
objectAddress += mImpl->mCurrentBlockSize * mImpl->mFixedSize;
mImpl->mCurrentBlockSize++;
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
return *this;
}
- unsigned int width : 16; ///< image width in pixels
- unsigned int height : 16; ///< image height in pixels
+ uint16_t width; ///< image width in pixels
+ uint16_t height; ///< image height in pixels
ScalingMode scaling : 3; ///< scaling option, ShrinkToFit is default
FilterMode filtering : 4; ///< filtering option. Box is the default
bool mOrientationCorrection : 1; ///< If true, image pixels are reordered according to orientation metadata on load.
delete impl;
}
-void ImageAttributes::SetSize(unsigned int width, unsigned int height)
+void ImageAttributes::SetSize(uint32_t width, uint32_t height)
{
- impl->width = width;
- impl->height = height;
+ impl->width = static_cast<uint16_t>( width ); // truncated
+ impl->height = static_cast<uint16_t>( height ); // truncated
}
void ImageAttributes::SetSize( const Size& size )
{
- impl->width = size.width;
- impl->height = size.height;
+ impl->width = static_cast<uint16_t>( size.width ); // truncated
+ impl->height = static_cast<uint16_t>( size.height ); // truncated
}
void ImageAttributes::SetScalingMode( ScalingMode scale )
impl->mOrientationCorrection = orientationCorrection;
}
-unsigned int ImageAttributes::GetWidth() const
+uint32_t ImageAttributes::GetWidth() const
{
return impl->width;
}
-unsigned int ImageAttributes::GetHeight() const
+uint32_t ImageAttributes::GetHeight() const
{
return impl->height;
}
return ImageAttributes();
}
-ImageAttributes ImageAttributes::New(unsigned int imageWidth, unsigned int imageHeight)
-{
- ImageAttributes attributes;
- attributes.impl->width = imageWidth;
- attributes.impl->height = imageHeight;
- return attributes;
-}
-
/**
* Less then comparison operator.
* @param [in] a parameter tested
#define __DALI_INTERNAL_IMAGE_ATTRIBUTES_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
static ImageAttributes New();
/**
- * @brief Create an initialised image attributes object.
- *
- * @param [in] width desired width.
- * @param [in] height desired height
- * @return A handle to a newly allocated object
- */
- static ImageAttributes New(unsigned int width, unsigned int height);
-
- /**
* @brief Set the size properties.
*
* By default width and height are set to zero which means the image loaded has the original size.
* @param [in] width desired width.
* @param [in] height desired height
*/
- void SetSize(unsigned int width, unsigned int height);
+ void SetSize( uint32_t width, uint32_t height);
/**
* @brief Set the image dimension properties.
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
{
// Increase capacity by 1.5 when buffer limit reached
-const unsigned int INCREMENT_NUMERATOR = 3u;
-const unsigned int INCREMENT_DENOMINATOR = 2u;
+const uint32_t INCREMENT_NUMERATOR = 3u;
+const uint32_t INCREMENT_DENOMINATOR = 2u;
-const unsigned int MESSAGE_SIZE_FIELD = 1u; // Size required to mark the message size
-const unsigned int MESSAGE_END_FIELD = 1u; // Size required to mark the end of messages
+const uint32_t MESSAGE_SIZE_FIELD = 1u; // Size required to mark the message size
+const uint32_t MESSAGE_END_FIELD = 1u; // Size required to mark the end of messages
-const unsigned int MESSAGE_SIZE_PLUS_END_FIELD = MESSAGE_SIZE_FIELD + MESSAGE_END_FIELD;
+const uint32_t MESSAGE_SIZE_PLUS_END_FIELD = MESSAGE_SIZE_FIELD + MESSAGE_END_FIELD;
-const unsigned int MAX_DIVISION_BY_WORD_REMAINDER = sizeof(Dali::Internal::MessageBuffer::WordType) - 1u; // For word alignment on ARM
-const unsigned int WORD_SIZE = sizeof(Dali::Internal::MessageBuffer::WordType);
+const std::size_t MAX_DIVISION_BY_WORD_REMAINDER = sizeof(Dali::Internal::MessageBuffer::WordType) - 1u; // For word alignment on ARM
+const std::size_t WORD_SIZE = sizeof(Dali::Internal::MessageBuffer::WordType);
} // unnamed namespace
free( mData );
}
-unsigned int* MessageBuffer::ReserveMessageSlot( std::size_t size )
+uint32_t* MessageBuffer::ReserveMessageSlot( std::size_t size )
{
DALI_ASSERT_DEBUG( 0 != size );
// End marker
*mNextSlot = 0;
- return reinterpret_cast<unsigned int*>(slot);
+ return reinterpret_cast<uint32_t*>(slot);
}
std::size_t MessageBuffer::GetCapacity() const
#define __DALI_INTERNAL_MESSAGE_BUFFER_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
*/
// EXTERNAL INCLUDES
-#include <cstddef>
+#include <cstddef> // size_t
+#include <cstdint> // uint32_t
namespace Dali
{
* @param[in] size The message size with respect to the size of type "char".
* @return A pointer to the address allocated for the message, aligned to a word boundary
*/
- unsigned int* ReserveMessageSlot( std::size_t size );
+ uint32_t* ReserveMessageSlot( std::size_t size );
/**
* Query the capacity of the message buffer.
#define __DALI_INTERNAL_SHADER_DATA_H__
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
* Allocate a buffer for the compiled binary bytecode
* @param[in] size The size of the buffer in bytes
*/
- void AllocateBuffer( size_t size )
+ void AllocateBuffer( std::size_t size )
{
mBuffer.Resize( size );
}
* Get the program buffer
* @return reference to the buffer
*/
- size_t GetBufferSize() const
+ std::size_t GetBufferSize() const
{
return mBuffer.Size();
}
* Get the data that the buffer points to
* @return raw pointer to the buffer data
*/
- unsigned char* GetBufferData()
+ uint8_t* GetBufferData()
{
DALI_ASSERT_DEBUG( mBuffer.Size() > 0 );
return &mBuffer[0];
* Get the data that the buffer points to
* @return raw pointer to the buffer data
*/
- Dali::Vector<unsigned char>& GetBuffer()
+ Dali::Vector<uint8_t>& GetBuffer()
{
return mBuffer;
}
private: // Data
- size_t mShaderHash; ///< hash key created with vertex and fragment shader code
- std::string mVertexShader; ///< source code for vertex program
- std::string mFragmentShader; ///< source code for fragment program
- Dali::Shader::Hint::Value mHints; ///< take a hint
- Dali::Vector<unsigned char> mBuffer; ///< buffer containing compiled binary bytecode
+ std::size_t mShaderHash; ///< hash key created with vertex and fragment shader code
+ std::string mVertexShader; ///< source code for vertex program
+ std::string mFragmentShader; ///< source code for fragment program
+ Dali::Shader::Hint::Value mHints; ///< take a hint
+ Dali::Vector<uint8_t> mBuffer; ///< buffer containing compiled binary bytecode
+
};
} // namespace Integration
+++ /dev/null
-#ifndef __DALI_INTERNAL_TEXT_VERTEX_2D_H__
-#define __DALI_INTERNAL_TEXT_VERTEX_2D_H__
-
-/*
- * Copyright (c) 2014 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-/**
- * A 2D vertex with position, texture coordinate
- * and texture coordinate for distance field drop shadow adjustment
- */
-struct TextVertex2D
-{
- float mX;
- float mY;
- float mU;
- float mV;
- float mU1;
- float mV1;
-};
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_TEXT_VERTEX_2D_H__
-
namespace Internal
{
-unsigned int Actor::mActorCounter = 0;
+uint32_t Actor::mActorCounter = 0;
namespace
{
: sizeModeFactor( GetDefaultSizeModeFactor() ), preferredSize( GetDefaultPreferredSize() ), sizeSetPolicy( DEFAULT_SIZE_SCALE_POLICY ), relayoutEnabled( false ), insideRelayout( false )
{
// Set size negotiation defaults
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
resizePolicies[ i ] = ResizePolicy::DEFAULT;
useAssignedSize[ i ] = false;
bool GetAnchorPointConstant( const std::string& value, Vector3& anchor )
{
- for( unsigned int i = 0; i < ANCHOR_CONSTANT_TABLE_COUNT; ++i )
+ for( uint32_t i = 0; i < ANCHOR_CONSTANT_TABLE_COUNT; ++i )
{
- size_t sizeIgnored = 0;
+ uint32_t sizeIgnored = 0;
if( CompareTokens( value.c_str(), ANCHOR_CONSTANT_TABLE[ i ].name, sizeIgnored ) )
{
anchor = ANCHOR_CONSTANT_TABLE[ i ].value;
}
}
-unsigned int Actor::GetId() const
+uint32_t Actor::GetId() const
{
return mId;
}
}
}
-unsigned int Actor::GetChildCount() const
+uint32_t Actor::GetChildCount() const
{
- return ( NULL != mChildren ) ? mChildren->size() : 0;
+ return ( NULL != mChildren ) ? static_cast<uint32_t>( mChildren->size() ) : 0; // only 4,294,967,295 children per actor
}
-ActorPtr Actor::GetChildAt( unsigned int index ) const
+ActorPtr Actor::GetChildAt( uint32_t index ) const
{
DALI_ASSERT_ALWAYS( index < GetChildCount() );
return child;
}
-ActorPtr Actor::FindChildById( const unsigned int id )
+ActorPtr Actor::FindChildById( const uint32_t id )
{
ActorPtr child = 0;
if( id == mId )
return mClippingMode;
}
-unsigned int Actor::GetSortingDepth()
+uint32_t Actor::GetSortingDepth()
{
return mSortedDepth;
}
ResizePolicy::Type originalWidthPolicy = GetResizePolicy(Dimension::WIDTH);
ResizePolicy::Type originalHeightPolicy = GetResizePolicy(Dimension::HEIGHT);
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( dimension & ( 1 << i ) )
{
if ( mRelayoutData )
{
// If more than one dimension is requested, just return the first one found
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( ( dimension & ( 1 << i ) ) )
{
{
EnsureRelayoutData();
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( dimension & ( 1 << i ) )
{
if ( mRelayoutData )
{
// If more than one dimension is requested, just return the first one found
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( ( dimension & ( 1 << i ) ) )
{
{
EnsureRelayoutData();
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( dimension & ( 1 << i ) )
{
{
if ( mRelayoutData )
{
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( ( dimension & ( 1 << i ) ) && mRelayoutData->dimensionDirty[ i ] )
{
return mRelayoutData && mRelayoutData->relayoutEnabled && IsLayoutDirty( dimension );
}
-unsigned int Actor::AddRenderer( Renderer& renderer )
+uint32_t Actor::AddRenderer( Renderer& renderer )
{
if( !mRenderers )
{
mRenderers = new RendererContainer;
}
- unsigned int index = mRenderers->size();
+ uint32_t index = static_cast<uint32_t>( mRenderers->size() ); // 4,294,967,295 renderers per actor
RendererPtr rendererPtr = RendererPtr( &renderer );
mRenderers->push_back( rendererPtr );
AddRendererMessage( GetEventThreadServices(), *mNode, renderer.GetRendererSceneObject() );
return index;
}
-unsigned int Actor::GetRendererCount() const
+uint32_t Actor::GetRendererCount() const
{
- unsigned int rendererCount(0);
+ uint32_t rendererCount(0);
if( mRenderers )
{
- rendererCount = mRenderers->size();
+ rendererCount = static_cast<uint32_t>( mRenderers->size() ); // 4,294,967,295 renderers per actor
}
return rendererCount;
}
-RendererPtr Actor::GetRendererAt( unsigned int index )
+RendererPtr Actor::GetRendererAt( uint32_t index )
{
RendererPtr renderer;
if( index < GetRendererCount() )
}
}
-void Actor::RemoveRenderer( unsigned int index )
+void Actor::RemoveRenderer( uint32_t index )
{
if( index < GetRendererCount() )
{
Vector2 converted( screenX, screenY );
// do a reverse traversal of all lists (as the default onscreen one is typically the last one)
- const int taskCount = taskList.GetTaskCount();
- for( int i = taskCount - 1; i >= 0; --i )
+ uint32_t taskCount = taskList.GetTaskCount();
+ for( uint32_t i = taskCount; i > 0; --i )
{
- Dali::RenderTask task = taskList.GetTask( i );
+ Dali::RenderTask task = taskList.GetTask( i - 1 );
if( ScreenToLocal( Dali::GetImplementation( task ), localX, localY, screenX, screenY ) )
{
// found a task where this conversion was ok so return
bool success = invertedMvp.Invert();
// Convert to GL coordinates
- Vector4 screenPos( screenX - viewport.x, viewport.height - ( screenY - viewport.y ), 0.f, 1.f );
+ Vector4 screenPos( screenX - static_cast<float>( viewport.x ), static_cast<float>( viewport.height ) - screenY - static_cast<float>( viewport.y ), 0.f, 1.f );
Vector4 nearPos;
if( success )
{
- success = Unproject( screenPos, invertedMvp, viewport.width, viewport.height, nearPos );
+ success = Unproject( screenPos, invertedMvp, static_cast<float>( viewport.width ), static_cast<float>( viewport.height ), nearPos );
}
Vector4 farPos;
if( success )
{
screenPos.z = 1.0f;
- success = Unproject( screenPos, invertedMvp, viewport.width, viewport.height, farPos );
+ success = Unproject( screenPos, invertedMvp, static_cast<float>( viewport.width ), static_cast<float>( viewport.height ), farPos );
}
if( success )
}
}
-void Actor::ConnectToStage( unsigned int parentDepth )
+void Actor::ConnectToStage( uint32_t parentDepth )
{
// This container is used instead of walking the Actor hierarchy.
// It protects us when the Actor hierarchy is modified during OnStageConnectionExternal callbacks.
RelayoutRequest();
}
-void Actor::RecursiveConnectToStage( ActorContainer& connectionList, unsigned int depth )
+void Actor::RecursiveConnectToStage( ActorContainer& connectionList, uint32_t depth )
{
DALI_ASSERT_ALWAYS( !OnStage() );
mIsOnStage = true;
- mDepth = depth;
+ mDepth = static_cast< uint16_t >( depth ); // overflow ignored, not expected in practice
ConnectToSceneGraph();
ActorConstIter endIter = mChildren->end();
for( ActorIter iter = mChildren->begin(); iter != endIter; ++iter )
{
- (*iter)->RecursiveConnectToStage( connectionList, depth+1 );
+ (*iter)->RecursiveConnectToStage( connectionList, depth + 1 );
}
}
}
// in a single message
OwnerPointer<SceneGraph::NodeDepths> sceneGraphNodeDepths( new SceneGraph::NodeDepths() );
- int depthIndex = 1;
+ int32_t depthIndex = 1;
DepthTraverseActorTree( sceneGraphNodeDepths, depthIndex );
SetDepthIndicesMessage( GetEventThreadServices().GetUpdateManager(), sceneGraphNodeDepths );
DALI_LOG_TIMER_END(depthTimer, gLogFilter, Debug::Concise, "Depth tree traversal time: ");
}
-void Actor::DepthTraverseActorTree( OwnerPointer<SceneGraph::NodeDepths>& sceneGraphNodeDepths, int& depthIndex )
+void Actor::DepthTraverseActorTree( OwnerPointer<SceneGraph::NodeDepths>& sceneGraphNodeDepths, int32_t& depthIndex )
{
mSortedDepth = depthIndex * DevelLayer::SIBLING_ORDER_MULTIPLIER;
sceneGraphNodeDepths->Add( const_cast<SceneGraph::Node*>( mNode ), mSortedDepth );
}
}
-unsigned int Actor::GetDefaultPropertyCount() const
+uint32_t Actor::GetDefaultPropertyCount() const
{
return DEFAULT_PROPERTY_COUNT;
}
{
indices.Reserve( DEFAULT_PROPERTY_COUNT );
- for( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
+ for( int32_t i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
{
indices.PushBack( i );
}
Property::Index index = Property::INVALID_INDEX;
// Look for name in default properties
- for( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
+ for( int32_t i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
{
const Internal::PropertyDetails* property = &DEFAULT_PROPERTY_DETAILS[ i ];
if( 0 == name.compare( property->name ) )
case Dali::Actor::Property::WIDTH_RESIZE_POLICY:
{
- ResizePolicy::Type type = static_cast< ResizePolicy::Type >( -1 ); // Set to invalid number so it definitely gets set.
+ ResizePolicy::Type type;
if( Scripting::GetEnumerationProperty< ResizePolicy::Type >( property, RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT, type ) )
{
SetResizePolicy( type, Dimension::WIDTH );
case Dali::Actor::Property::HEIGHT_RESIZE_POLICY:
{
- ResizePolicy::Type type = static_cast< ResizePolicy::Type >( -1 ); // Set to invalid number so it definitely gets set.
+ ResizePolicy::Type type;
if( Scripting::GetEnumerationProperty< ResizePolicy::Type >( property, RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT, type ) )
{
SetResizePolicy( type, Dimension::HEIGHT );
bool Actor::RelayoutDependentOnParent( Dimension::Type dimension )
{
// Check if actor is dependent on parent
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( ( dimension & ( 1 << i ) ) )
{
bool Actor::RelayoutDependentOnChildren( Dimension::Type dimension )
{
// Check if actor is dependent on children
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( ( dimension & ( 1 << i ) ) )
{
bool Actor::RelayoutDependentOnDimension( Dimension::Type dimension, Dimension::Type dependentDimension )
{
// Check each possible dimension and see if it is dependent on the input one
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( dimension & ( 1 << i ) )
{
void Actor::SetNegotiatedDimension( float negotiatedDimension, Dimension::Type dimension )
{
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( dimension & ( 1 << i ) )
{
float Actor::GetNegotiatedDimension( Dimension::Type dimension ) const
{
// If more than one dimension is requested, just return the first one found
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( ( dimension & ( 1 << i ) ) )
{
{
EnsureRelayoutData();
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( dimension & ( 1 << i ) )
{
if ( mRelayoutData )
{
// If more than one dimension is requested, just return the first one found
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( ( dimension & ( 1 << i ) ) )
{
{
EnsureRelayoutData();
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( dimension & ( 1 << i ) )
{
{
if ( mRelayoutData )
{
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( ( dimension & ( 1 << i ) ) && mRelayoutData->dimensionNegotiated[ i ] )
{
{
float maxDimensionPoint = 0.0f;
- for( unsigned int i = 0, count = GetChildCount(); i < count; ++i )
+ for( uint32_t i = 0, count = GetChildCount(); i < count; ++i )
{
ActorPtr child = GetChildAt( i );
recursionStack.push_back( ActorDimensionPair( this, dimension ) );
// Dimension dependency check
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
Dimension::Type dimensionToCheck = static_cast< Dimension::Type >( 1 << i );
// Children dependency check
if( RelayoutDependentOnChildren( dimension ) )
{
- for( unsigned int i = 0, count = GetChildCount(); i < count; ++i )
+ for( uint32_t i = 0, count = GetChildCount(); i < count; ++i )
{
ActorPtr child = GetChildAt( i );
// Negotiate all dimensions that require it
ActorDimensionStack recursionStack;
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
const Dimension::Type dimension = static_cast< Dimension::Type >( 1 << i );
SetNegotiatedSize( container );
// Negotiate down to children
- for( unsigned int i = 0, count = GetChildCount(); i < count; ++i )
+ for( uint32_t i = 0, count = GetChildCount(); i < count; ++i )
{
ActorPtr child = GetChildAt( i );
{
if( mRelayoutData )
{
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( dimension & ( 1 << i ) )
{
if ( mRelayoutData )
{
// If more than one dimension is requested, just return the first one found
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( dimension & ( 1 << i ) )
{
{
EnsureRelayoutData();
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( dimension & ( 1 << i ) )
{
{
if ( mRelayoutData )
{
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( dimension & ( 1 << i ) )
{
{
EnsureRelayoutData();
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( dimension & ( 1 << i ) )
{
{
if ( mRelayoutData )
{
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( dimension & ( 1 << i ) )
{
}
}
-void Actor::SetSiblingOrder( unsigned int order )
+void Actor::SetSiblingOrder( uint32_t order )
{
if ( mParent )
{
ActorContainer& siblings = *(mParent->mChildren);
- unsigned int currentOrder = GetSiblingOrder();
+ uint32_t currentOrder = GetSiblingOrder();
if( order != currentOrder )
{
}
}
-unsigned int Actor::GetSiblingOrder() const
+uint32_t Actor::GetSiblingOrder() const
{
- unsigned int order = 0;
+ uint32_t order = 0;
if ( mParent )
{
ActorContainer& siblings = *(mParent->mChildren);
- for( size_t i=0; i<siblings.size(); ++i )
+ for( std::size_t i = 0; i < siblings.size(); ++i )
{
if( siblings[i] == this )
{
- order = i;
+ order = static_cast<uint32_t>( i );
break;
}
}
ActorContainer& siblings = *(mParent->mChildren);
if( siblings.back() != this ) // If not already at end
{
- for( size_t i=0; i<siblings.size(); ++i )
+ for( std::size_t i=0; i<siblings.size(); ++i )
{
if( siblings[i] == this )
{
ActorContainer& siblings = *(mParent->mChildren);
if( siblings.front() != this ) // If not already at beginning
{
- for( size_t i=1; i<siblings.size(); ++i )
+ for( std::size_t i=1; i<siblings.size(); ++i )
{
if( siblings[i] == this )
{
{
if( actor && ( actor->mInheritLayoutDirection || set ) )
{
- if( actor->mLayoutDirection != direction)
+ if( actor->mLayoutDirection != direction )
{
actor->mLayoutDirection = direction;
actor->EmitLayoutDirectionChangedSignal( direction );
/**
* @copydoc Dali::Actor::GetId
*/
- unsigned int GetId() const;
+ uint32_t GetId() const;
// Containment
* Retrieve the number of children held by the actor.
* @return The number of children
*/
- unsigned int GetChildCount() const;
+ uint32_t GetChildCount() const;
/**
* @copydoc Dali::Actor::GetChildAt
*/
- ActorPtr GetChildAt( unsigned int index ) const;
+ ActorPtr GetChildAt( uint32_t index ) const;
/**
* Retrieve a reference to Actor's children.
/**
* @copydoc Dali::Actor::FindChildById
*/
- ActorPtr FindChildById( const unsigned int id );
+ ActorPtr FindChildById( const uint32_t id );
/**
* Retrieve the parent of an Actor.
/**
* @copydoc Dali::Actor::GetHierarchyDepth()
*/
- inline int GetHierarchyDepth() const
+ inline int32_t GetHierarchyDepth() const
{
if( mIsOnStage )
{
- return static_cast<int>(mDepth);
+ return mDepth;
}
return -1;
*
* @return The depth used for hit-testing and renderer sorting
*/
- unsigned int GetSortingDepth();
+ uint32_t GetSortingDepth();
public:
/**
* @copydoc Dali::Actor::AddRenderer()
*/
- unsigned int AddRenderer( Renderer& renderer );
+ uint32_t AddRenderer( Renderer& renderer );
/**
* @copydoc Dali::Actor::GetRendererCount()
*/
- unsigned int GetRendererCount() const;
+ uint32_t GetRendererCount() const;
/**
* @copydoc Dali::Actor::GetRendererAt()
*/
- RendererPtr GetRendererAt( unsigned int index );
+ RendererPtr GetRendererAt( uint32_t index );
/**
* @copydoc Dali::Actor::RemoveRenderer()
/**
* @copydoc Dali::Actor::RemoveRenderer()
*/
- void RemoveRenderer( unsigned int index );
+ void RemoveRenderer( uint32_t index );
public:
* Called on a child during Add() when the parent actor is connected to the Stage.
* @param[in] parentDepth The depth of the parent in the hierarchy.
*/
- void ConnectToStage( unsigned int parentDepth );
+ void ConnectToStage( uint32_t parentDepth );
/**
* Helper for ConnectToStage, to recursively connect a tree of actors.
* @param[in] depth The depth in the hierarchy of the actor
* @param[out] connectionList On return, the list of connected actors which require notification.
*/
- void RecursiveConnectToStage( ActorContainer& connectionList, unsigned int depth );
+ void RecursiveConnectToStage( ActorContainer& connectionList, uint32_t depth );
/**
* Connect the Node associated with this Actor to the scene-graph.
* @param[in] sceneGraphNodeDepths A vector capturing the nodes and their depth index
* @param[in,out] depthIndex The current depth index (traversal index)
*/
- void DepthTraverseActorTree( OwnerPointer<SceneGraph::NodeDepths>& sceneGraphNodeDepths, int& depthIndex );
+ void DepthTraverseActorTree( OwnerPointer<SceneGraph::NodeDepths>& sceneGraphNodeDepths, int32_t& depthIndex );
public:
/**
* @copydoc Dali::Internal::Object::GetDefaultPropertyCount()
*/
- virtual unsigned int GetDefaultPropertyCount() const;
+ virtual uint32_t GetDefaultPropertyCount() const;
/**
* @copydoc Dali::Internal::Object::GetDefaultPropertyIndices()
* @param[in] order The sibling order this Actor should be. It will place
* the actor at this index in it's parent's child array.
*/
- void SetSiblingOrder( unsigned int order);
+ void SetSiblingOrder( uint32_t order);
/**
* Get Sibling order
* @return the order of this actor amongst it's siblings
*/
- unsigned int GetSiblingOrder() const;
+ uint32_t GetSiblingOrder() const;
/**
* Request that the stage rebuilds the actor depth indices.
Vector3 mTargetScale; ///< Event-side storage for scale
std::string mName; ///< Name of the actor
- unsigned int mId; ///< A unique ID to identify the actor starting from 1, and 0 is reserved
-
+ uint32_t mId; ///< A unique ID to identify the actor starting from 1, and 0 is reserved
uint32_t mSortedDepth; ///< The sorted depth index. A combination of tree traversal and sibling order.
- uint16_t mDepth; ///< The depth in the hierarchy of the actor. Only 4096 levels of depth are supported
-
+ int16_t mDepth; ///< The depth in the hierarchy of the actor. Only 32,767 levels of depth are supported
const bool mIsRoot : 1; ///< Flag to identify the root actor
const bool mIsLayer : 1; ///< Flag to identify that this is a layer
private:
static ActorContainer mNullChildren; ///< Empty container (shared by all actors, returned by GetChildren() const)
- static unsigned int mActorCounter; ///< A counter to track the actor instance creation
+ static uint32_t mActorCounter; ///< A counter to track the actor instance creation
};
} // namespace Internal
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
DALI_ASSERT_DEBUG( false );
}
- Vector4 near( screenX - viewport.x, viewport.height - (screenY - viewport.y), 0.f, 1.f );
- if( !Unproject( near, invViewProjection, viewport.width, viewport.height, rayOrigin ) )
+ Vector4 near( screenX - static_cast<float>( viewport.x ),
+ static_cast<float>( viewport.height ) - (screenY - static_cast<float>( viewport.y ) ),
+ 0.f, 1.f );
+ if( !Unproject( near, invViewProjection, static_cast<float>( viewport.width ), static_cast<float>( viewport.height ), rayOrigin ) )
{
DALI_ASSERT_DEBUG( false );
}
rayOrigin.w = 1.0f;
// Transform the touch point from the screen coordinate system to the world coordinates system.
- Vector4 near( screenCoordinates.x - viewport.x, viewport.height - (screenCoordinates.y - viewport.y), 0.f, 1.f );
+ Vector4 near( screenCoordinates.x - static_cast<float>(viewport.x),
+ static_cast<float>( viewport.height ) - (screenCoordinates.y - static_cast<float>( viewport.y ) ),
+ 0.f, 1.f );
const Matrix& inverseViewProjection = mSceneObject->GetInverseViewProjectionMatrix( GetEventThreadServices().GetEventBufferIndex() );
- success = Unproject( near, inverseViewProjection, viewport.width, viewport.height, near );
+ success = Unproject( near, inverseViewProjection, static_cast<float>( viewport.width ), static_cast<float>( viewport.height ), near );
// Compute the ray's director vector.
rayDirection.x = near.x - rayOrigin.x;
if( ( this != &target ) && OnStage() && target.OnStage() )
{
// get parameters depth
- const unsigned int targetDepth = target.GetDepth();
+ const uint32_t targetDepth = target.GetDepth();
if( GetDepth() < targetDepth )
{
MoveAbove( target );
if( ( this != &target ) && OnStage() && target.OnStage() )
{
// get parameters depth
- const unsigned int targetDepth = target.GetDepth();
+ const uint32_t targetDepth = target.GetDepth();
if( GetDepth() > targetDepth )
{
MoveBelow( target );
StagePtr stage = Stage::GetCurrent();
if( stage )
{
- clippingBox.y = stage->GetSize().height - clippingBox.y - clippingBox.height;
+ clippingBox.y = static_cast<int32_t>( stage->GetSize().height ) - clippingBox.y - clippingBox.height;
// layerNode is being used in a separate thread; queue a message to set the value
SetClippingBoxMessage( GetEventThreadServices(), GetSceneLayerOnStage(), clippingBox );
Actor::GetDefaultPropertyIndices( indices ); // Actor class properties
indices.Reserve( indices.Size() + DEFAULT_PROPERTY_COUNT );
- int index = DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX;
- for ( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i, ++index )
+ int32_t index = DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX;
+ for ( int32_t i = 0; i < DEFAULT_PROPERTY_COUNT; ++i, ++index )
{
indices.PushBack( index );
}
Property::Index index = Property::INVALID_INDEX;
// Look for name in current class' default properties
- for( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
+ for( int32_t i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
{
const Internal::PropertyDetails* property = &DEFAULT_PROPERTY_DETAILS[i];
if( 0 == name.compare( property->name ) ) // dont want to convert rhs to string
}
case Dali::Layer::Property::CLIPPING_BOX:
{
- Rect<int> clippingBox( propertyValue.Get<Rect<int> >() );
+ Rect<int32_t> clippingBox( propertyValue.Get<Rect<int32_t> >() );
SetClippingBox( clippingBox.x, clippingBox.y, clippingBox.width, clippingBox.height );
break;
}
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
{
}
-unsigned int LayerList::GetLayerCount() const
+uint32_t LayerList::GetLayerCount() const
{
- return mLayers.size();
+ return static_cast<uint32_t>( mLayers.size() ); // // only 4,294,967,295 layers supported
}
-Layer* LayerList::GetLayer( unsigned int depth ) const
+Layer* LayerList::GetLayer( uint32_t depth ) const
{
DALI_ASSERT_ALWAYS( depth < mLayers.size() );
return mLayers[ depth ];
}
-unsigned int LayerList::GetDepth( const Layer* layer ) const
+uint32_t LayerList::GetDepth( const Layer* layer ) const
{
- for( unsigned int count = 0; count < mLayers.size(); ++count )
+ for( uint32_t count = 0; count < mLayers.size(); ++count )
{
if( layer == mLayers[ count ] )
{
#define __DALI_INTERNAL_LAYER_LIST_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
+
// INTERNAL INCLUDES
#include <dali/public-api/common/vector-wrapper.h>
* Query the number of layers.
* @return The number of layers.
*/
- unsigned int GetLayerCount() const;
+ uint32_t GetLayerCount() const;
/**
* Retrieve the layer at a specified depth.
* @param[in] depth The depth.
* @return The layer found at the given depth.
*/
- Layer* GetLayer( unsigned int depth ) const;
+ Layer* GetLayer( uint32_t depth ) const;
/**
* Gets the depth of a given layer
* @param layer which depth to check
*/
- unsigned int GetDepth( const Layer* layer ) const;
+ uint32_t GetDepth( const Layer* layer ) const;
/**
* Register a layer with the stage.
Property::Value targetValue;
TimePeriod timePeriod;
- unsigned int connectorIndex;
+ std::size_t connectorIndex;
Animation::Type animatorType;
};
Constrainer::~Constrainer()
{
//Remove all the constraints created by the object
- size_t tag = reinterpret_cast<size_t>( this );
+ uint32_t tag = static_cast<uint32_t>( reinterpret_cast<uintptr_t>( this ) ); // taking 32bits of this as tag
const ObjectIter end = mObservedObjects.End();
for( ObjectIter iter = mObservedObjects.Begin(); iter != end; ++iter )
{
void Constrainer::Remove( Dali::Handle& target )
{
- size_t tag = reinterpret_cast<size_t>( this );
+ uint32_t tag = static_cast<uint32_t>( reinterpret_cast<uintptr_t>( this ) ); // taking 32bits of this as tag
Object& object = GetImplementation(target);
const ObjectIter end = mObservedObjects.End();
for( ObjectIter iter = mObservedObjects.Begin(); iter != end; ++iter )
return mRemoveAction;
}
-void ConstraintBase::SetTag(const unsigned int tag)
+void ConstraintBase::SetTag( uint32_t tag )
{
mTag = tag;
}
-unsigned int ConstraintBase::GetTag() const
+uint32_t ConstraintBase::GetTag() const
{
return mTag;
}
/**
* @copydoc Dali::Constraint::SetTag()
*/
- void SetTag(const unsigned int tag);
+ void SetTag( uint32_t tag );
/**
* @copydoc Dali::Constraint::GetTag()
*/
- unsigned int GetTag() const;
+ uint32_t GetTag() const;
private: // Object::Observer methods
ObjectContainer mObservedObjects; // We don't observe the same object twice
Property::Index mTargetPropertyIndex;
RemoveAction mRemoveAction;
- unsigned int mTag;
+ uint32_t mTag;
bool mApplied:1; ///< Whether the constraint has been applied
bool mSourceDestroyed:1; ///< Is set to true if any of our input source objects are destroyed
};
{
Property::Value value;
- unsigned int noOfKeyFrames = mKeyFrames->GetNumberOfKeyFrames();
+ std::size_t noOfKeyFrames = mKeyFrames->GetNumberOfKeyFrames();
if( noOfKeyFrames )
{
mKeyFrames->GetKeyFrameAsValue( noOfKeyFrames - 1, value );
KeyFrameSpec() {}
- virtual unsigned int GetNumberOfKeyFrames() const = 0;
+ virtual std::size_t GetNumberOfKeyFrames() const = 0;
/**
* Get the key frame value as a Property::Value.
* @param[in] index The index of the key frame to fetch
* @param[out] value The value of the given key frame
*/
- virtual void GetKeyFrameAsValue( unsigned int index, Property::Value& value ) = 0;
+ virtual void GetKeyFrameAsValue( std::size_t index, Property::Value& value ) = 0;
protected:
* Get the number of key frames
* @return The size of the progress value vector
*/
- virtual unsigned int GetNumberOfKeyFrames() const
+ virtual std::size_t GetNumberOfKeyFrames() const
{
return mPVs.size();
}
/**
* @copydoc KeyFrameSpec::GetKeyFrameAsValue()
*/
- virtual void GetKeyFrameAsValue( unsigned int index, Property::Value& value )
+ virtual void GetKeyFrameAsValue( std::size_t index, Property::Value& value )
{
value = mPVs[index].mValue;
}
{
indices.Reserve( DEFAULT_PROPERTY_COUNT );
- for ( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
+ for ( Property::Index i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
{
indices.PushBack( i );
}
Property::Index index = Property::INVALID_INDEX;
// Look for name in default properties
- for( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
+ for( Property::Index i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
{
const Internal::PropertyDetails* property = &DEFAULT_PROPERTY_DETAILS[ i ];
if( 0 == strcmp( name.c_str(), property->name ) )
Dali::Constraint constraint = Dali::Constraint::New<float>( target.object, target.propertyIndex, LinearConstraintFunctor( mValue, mProgress, range, wrap ) );
constraint.AddSource( Dali::Source(source.object, source.propertyIndex ) );
- constraint.SetTag( reinterpret_cast<size_t>( this ) );
+ constraint.SetTag( static_cast<uint32_t>( reinterpret_cast<uintptr_t>( this ) ) ); // taking 32bits of this as tag
constraint.SetRemoveAction( Dali::Constraint::Discard );
constraint.Apply();
-
//Start observing the object
Observe( target.object );
}
#define __DALI_INTERNAL_LINEAR_CONSTRAINER_H__
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
void operator()( float& value,
const PropertyInputContainer& inputs)
{
- size_t valueCount( mValue.Size() );
+ uint32_t valueCount = static_cast<uint32_t>( mValue.Size() );
if( valueCount == 0 )
{
//No values.
float t = (( inputWrapped - mRange.x ) / ( mRange.y-mRange.x ));
//Find min and max values and local t between them
- size_t min(0);
- size_t max(0);
+ uint32_t min(0);
+ uint32_t max(0);
float tLocal(0.0f);
if( mProgress.Size() < valueCount )
{
- float step = 1.0f / (valueCount-1.0f);
- float tLocation = t/step;
- if( tLocation < 0)
+ float step = 1.0f / (static_cast<float>( valueCount ) - 1.0f);
+ float tLocation = t / step;
+ if( tLocation < 0 )
{
min = 0;
max = 1;
}
- else if( tLocation >= valueCount-1 )
+ else if( tLocation >= static_cast<float>( valueCount-1 ) )
{
min = max = valueCount-1;
}
else
{
- min = static_cast<size_t>(tLocation);
+ min = static_cast<uint32_t>(tLocation);
max = min+1;
}
- tLocal = (t - min*step) / step;
+ tLocal = (t - static_cast<float>(min)*step) / step;
}
else
{
{
indices.Reserve( DEFAULT_PROPERTY_COUNT );
- for ( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
+ for ( Property::Index i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
{
indices.PushBack( i );
}
Property::Index index = Property::INVALID_INDEX;
// Look for name in default properties
- for( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
+ for( Property::Index i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
{
const Internal::PropertyDetails* property = &DEFAULT_PROPERTY_DETAILS[ i ];
if( 0 == strcmp( name.c_str(), property->name ) ) // dont want to convert rhs to string
Dali::Constraint constraint = Dali::Constraint::New<Vector3>( target.object, target.propertyIndex, PathConstraintFunctor( mPath, range, wrap ) );
constraint.AddSource( Dali::Source(source.object, source.propertyIndex ) );
- constraint.SetTag( reinterpret_cast<size_t>( this ) );
+ constraint.SetTag( static_cast<uint32_t>( reinterpret_cast<uintptr_t>( this ) ) ); // taking 32bits of this as tag
constraint.SetRemoveAction( Dali::Constraint::Discard );
constraint.Apply();
}
Dali::Constraint constraint = Dali::Constraint::New<Quaternion>( target.object, target.propertyIndex, PathConstraintFunctor( mPath, range, mForward, wrap) );
constraint.AddSource( Dali::Source(source.object, source.propertyIndex ) );
- constraint.SetTag( reinterpret_cast<size_t>( this ) );
+ constraint.SetTag( static_cast<uint32_t>( reinterpret_cast<uintptr_t>( this ) ) ); // taking 32bits of this as tag
constraint.SetRemoveAction( Dali::Constraint::Discard );
constraint.Apply();
}
{
indices.Reserve( DEFAULT_PROPERTY_COUNT );
- for ( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
+ for ( Property::Index i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
{
indices.PushBack( i );
}
Property::Index index = Property::INVALID_INDEX;
// Look for name in default properties
- for( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
+ for( Property::Index i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
{
const Internal::PropertyDetails* property = &DEFAULT_PROPERTY_DETAILS[ i ];
if( 0 == strcmp( name.c_str(), property->name ) ) // dont want to convert rhs to string
unsigned int Path::GetNumberOfSegments() const
{
- return (mPoint.Size()>1)?mPoint.Size()-1:0;
+ return static_cast<unsigned int>( (mPoint.Size()>1) ? mPoint.Size()-1 : 0 );
}
void Path::GenerateControlPoints( float curvature )
}
else
{
- segment = t * numSegs;
- float segLength = 1.0f / numSegs;
+ segment = static_cast<unsigned int>( t * static_cast<float>( numSegs ) );
+ float segLength = 1.0f / static_cast<float>( numSegs );
float segStart = static_cast<float>( segment ) * segLength;
- tLocal = (t - segStart) * numSegs;
+ tLocal = (t - segStart) * static_cast<float>( numSegs );
}
}
inline void Interpolate (int& result, int a, int b, float progress)
{
- result = static_cast<int>(a + (b - a) * progress + 0.5f);
+ result = static_cast<int>(static_cast<float>( a ) + static_cast<float>(b - a) * progress + 0.5f);
}
inline void Interpolate (unsigned int& result, unsigned int a, unsigned int b, float progress)
{
- result = static_cast<unsigned int>(a + (b - a) * progress + 0.5f);
+ result = static_cast<unsigned int>( static_cast<float>( a ) + static_cast<float>(b - a) * progress + 0.5f);
}
inline void Interpolate (float& result, float a, float b, float progress)
inline void CubicInterpolate( int& result, int p0, int p1, int p2, int p3, float progress )
{
- float a3 = p3*0.5f - p2*1.5f + p1*1.5f - p0*0.5f;
- float a2 = p0 - p1*2.5f + p2*2.0f - p3*0.5f;
- float a1 = (p2-p0)*0.5f;
+ float a3 = static_cast<float>( p3 ) * 0.5f - static_cast<float>( p2 ) * 1.5f + static_cast<float>( p1 ) * 1.5f - static_cast<float>( p0 ) * 0.5f;
+ float a2 = static_cast<float>( p0 ) - static_cast<float>( p1 ) * 2.5f + static_cast<float>( p2 ) * 2.0f - static_cast<float>( p3 ) * 0.5f;
+ float a1 = static_cast<float>( p2 - p0 ) * 0.5f;
- result = static_cast<int>( a3*progress*progress*progress + a2*progress*progress + a1*progress + p1 + 0.5f );
+ result = static_cast<int>( a3*progress*progress*progress + a2*progress*progress + a1*progress + static_cast<float>( p1 ) + 0.5f );
}
inline void CubicInterpolate( unsigned int& result, unsigned int p0, unsigned int p1, unsigned int p2, unsigned int p3, float progress )
{
- float a3 = p3*0.5f - p2*1.5f + p1*1.5f - p0*0.5f;
- float a2 = p0 - p1*2.5f + p2*2.0f - p3*0.5f;
- float a1 = (p2-p0)*0.5f;
+ float a3 = static_cast<float>( p3 ) * 0.5f - static_cast<float>( p2 ) * 1.5f + static_cast<float>( p1 ) * 1.5f - static_cast<float>( p0 ) * 0.5f;
+ float a2 = static_cast<float>( p0 ) - static_cast<float>( p1 ) * 2.5f + static_cast<float>( p2 ) * 2.0f - static_cast<float>( p3 ) * 0.5f;
+ float a1 = static_cast<float>( p2 - p0 ) * 0.5f;
- result = static_cast<unsigned int>( a3*progress*progress*progress + a2*progress*progress + a1*progress + p1 + 0.5f );
+ result = static_cast<unsigned int>( a3*progress*progress*progress + a2*progress*progress + a1*progress + static_cast<float>( p1 ) + 0.5f );
}
inline void CubicInterpolate( float& result, float p0, float p1, float p2, float p3, float progress )
* @param [in] index The parameter index.
* @param [in] input The interface for receiving a property value.
*/
- void SetInput( unsigned int index, int componentIndex, const PropertyInputImpl& input )
+ void SetInput( std::size_t index, int componentIndex, const PropertyInputImpl& input )
{
if ( index >= mInputs.size() )
{
{
InputIndexerContainer mInputIndices;
PropertyInputContainer mIndices;
- const unsigned int noOfInputs = mInputs.size();
+ const std::size_t noOfInputs = mInputs.size();
mInputIndices.reserve( noOfInputs );
mIndices.Reserve( noOfInputs );
public:
- unsigned int mBufferIndex;
+ BufferIndex mBufferIndex;
const AccessorType* mInput;
};
#define __DALI_INTERNAL_EVENT_THREAD_SERVICES_H__
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
* @param[in] updateScene A flag, when true denotes that the message will cause the scene-graph node tree to require an update.
* @return A pointer to the first char allocated for the message.
*/
- virtual unsigned int* ReserveMessageSlot( std::size_t size, bool updateScene = true ) = 0;
+ virtual uint32_t* ReserveMessageSlot( uint32_t size, bool updateScene = true ) = 0;
/**
* @return the current event-buffer index.
return (capability & SUPPORTED_CAPABILITIES);
}
-unsigned int Object::GetPropertyCount() const
+uint32_t Object::GetPropertyCount() const
{
- unsigned int count = GetDefaultPropertyCount();
+ uint32_t count = GetDefaultPropertyCount();
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Default Properties: %d\n", count );
const TypeInfo* typeInfo( GetTypeInfo() );
if ( typeInfo )
{
- unsigned int manual( typeInfo->GetPropertyCount() );
+ uint32_t manual( typeInfo->GetPropertyCount() );
count += manual;
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Manual Properties: %d\n", manual );
}
- unsigned int custom( mCustomProperties.Count() );
+ uint32_t custom = static_cast<uint32_t>( mCustomProperties.Count() );
count += custom;
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Custom Properties: %d\n", custom );
// queue a message to add the property
InstallCustomPropertyMessage( const_cast<EventThreadServices&>(GetEventThreadServices()), *scenePropertyOwner, newProperty ); // Message takes ownership
- // notify the derived class (optional) method in case it needs to do some more work on the new property
- // note! have to use the local pointer as OwnerPointer now points to NULL as it handed over its ownership
- NotifyScenePropertyInstalled( *property, name, index );
-
return index;
}
else
if( Property::ANIMATABLE == accessMode )
{
- index = RegisterSceneGraphProperty( name, key, PROPERTY_CUSTOM_START_INDEX + mCustomProperties.Count(), propertyValue );
+ index = RegisterSceneGraphProperty( name, key, PROPERTY_CUSTOM_START_INDEX + static_cast<Property::Index>( mCustomProperties.Count() ), propertyValue );
AddUniformMapping( index, name );
}
else
{
// Add entry to the property lookup
- index = PROPERTY_CUSTOM_START_INDEX + mCustomProperties.Count();
+ index = PROPERTY_CUSTOM_START_INDEX + static_cast<Property::Index>( mCustomProperties.Count() );
CustomPropertyMetadata* customProperty = new CustomPropertyMetadata( name, propertyValue, accessMode );
}
}
-void Object::RemoveConstraints( unsigned int tag )
+void Object::RemoveConstraints( uint32_t tag )
{
// guard against constraint sending messages during core destruction
if( mConstraints && Stage::IsInstalled() )
/**
* @copydoc Dali::Handle::GetPropertyCount()
*/
- virtual unsigned int GetPropertyCount() const;
+ virtual uint32_t GetPropertyCount() const;
/**
* @copydoc Dali::Handle::GetPropertyName()
void RemoveConstraints();
/**
- * Remove all constraints from a Object with a matching tag
+ * @copydoc Dali::Handle::RemoveConstraints( uint32_t )
*/
- void RemoveConstraints( unsigned int tag );
+ void RemoveConstraints( uint32_t tag );
/**
* Called by TypeInfo to set the type-info that this object-impl is created by.
/**
* @return the index from which custom properties start
*/
- unsigned int CustomPropertyStartIndex()
+ uint32_t CustomPropertyStartIndex()
{
return PROPERTY_CUSTOM_START_INDEX;
}
* Query how many default properties the derived class supports.
* @return The number of default properties.
*/
- virtual unsigned int GetDefaultPropertyCount() const = 0;
+ virtual uint32_t GetDefaultPropertyCount() const = 0;
/**
* Retrieve all the indices that are associated with the default properties supported by the derived class.
return GetSceneObject();
}
- /**
- * Notify derived class of installation of a new scene-object property.
- * This method is called after the message is to sent to install the property
- * @param [in] newProperty A newly allocated scene-object property. Ownership is obviously not passed.
- * @param [in] name The name allocated to this custom property.
- * @param [in] index The index allocated to this custom property.
- */
- virtual void NotifyScenePropertyInstalled( const SceneGraph::PropertyBase& newProperty, const std::string& name, unsigned int index ) const
- { }
-
private:
- // Not implemented
- Object(const Object& rhs);
-
- // Not implemented
- Object& operator=(const Object& rhs);
+ Object(const Object& rhs) = delete;
+ Object& operator=(const Object& rhs) = delete;
/**
* Enable property notifications in scene graph
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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( !EqualsZero( p.w ) )
{
- float div = 1.0 / p.w;
+ float div = 1.0f / p.w;
windowPos = Vector4( (1 + p.x * div) * viewportWidth / 2 + viewportX,
(1 - p.y * div) * viewportHeight / 2 + viewportY,
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
enum { VALUE = offsetof( TestStructure, data ) };
};
-unsigned int GetPropertyImplementationAlignment( Property::Type& propertyType )
+uint32_t GetPropertyImplementationAlignment( Property::Type& propertyType )
{
- unsigned int alignment = 0u;
+ uint32_t alignment = 0u;
switch( propertyType )
{
return propertyBuffer;
}
-void PropertyBuffer::SetData( const void* data, std::size_t size )
+void PropertyBuffer::SetData( const void* data, uint32_t size )
{
mSize = size; // size is the number of elements
- unsigned int bufferSize = mBufferFormatSize * mSize;
+ uint32_t bufferSize = mBufferFormatSize * mSize;
// create a new DALi vector to store the buffer data
// the heap allocated vector will end up being owned by Render::PropertyBuffer
- OwnerPointer< Vector<char> > bufferCopy = new Dali::Vector<char>();
+ OwnerPointer< Vector<uint8_t> > bufferCopy = new Dali::Vector<uint8_t>();
bufferCopy->Resize( bufferSize );
// copy the data
- const char* source = static_cast<const char*>( data );
- char *destination = &((*bufferCopy)[0]);
+ const uint8_t* source = static_cast<const uint8_t*>( data );
+ uint8_t* destination = &((*bufferCopy)[0]);
std::copy( source, source + bufferSize, destination );
// Ownership of the bufferCopy is passed to the message ( uses an owner pointer )
SceneGraph::SetPropertyBufferData( mEventThreadServices.GetUpdateManager(), *mRenderObject, bufferCopy, mSize );
}
-std::size_t PropertyBuffer::GetSize() const
+uint32_t PropertyBuffer::GetSize() const
{
return mSize;
}
OwnerPointer< Render::PropertyBuffer > transferOwnership( mRenderObject );
SceneGraph::AddPropertyBuffer( mEventThreadServices.GetUpdateManager(), transferOwnership );
- size_t numComponents = formatMap.Count();
+ uint32_t numComponents = static_cast<uint32_t>( formatMap.Count() );
// Create the format
OwnerPointer< Render::PropertyBuffer::Format> format = new Render::PropertyBuffer::Format();
format->components.resize( numComponents );
- unsigned int currentAlignment = 0u;
- unsigned int maxAlignmentRequired = 0u;
+ uint32_t currentAlignment = 0u;
+ uint32_t maxAlignmentRequired = 0u;
- for( size_t i = 0u; i < numComponents; ++i )
+ for( uint32_t i = 0u; i < numComponents; ++i )
{
KeyValuePair component = formatMap.GetKeyValue( i );
{
DALI_ABORT( "Property::Type not supported in PropertyBuffer" );
}
- unsigned int elementSize = GetPropertyImplementationSize( type );
- unsigned int elementAlignment = GetPropertyImplementationAlignment( type );
+ uint32_t elementSize = GetPropertyImplementationSize( type );
+ uint32_t elementAlignment = GetPropertyImplementationAlignment( type );
// check if current alignment is compatible with new member
- if( unsigned int offset = currentAlignment % elementAlignment )
+ if( uint32_t offset = currentAlignment % elementAlignment )
{
// Not compatible, realign
currentAlignment = currentAlignment + elementSize - offset;
// Check the alignment for the maxAlignment required to calculate the size of the format
if( maxAlignmentRequired != 0 )
{
- if( unsigned int offset = currentAlignment % maxAlignmentRequired )
+ if( uint32_t offset = currentAlignment % maxAlignmentRequired )
{
// Not compatible, realign
currentAlignment = currentAlignment + maxAlignmentRequired - offset;
SceneGraph::SetPropertyBufferFormat(mEventThreadServices.GetUpdateManager(), *mRenderObject, format );
}
-unsigned int GetPropertyImplementationSize( Property::Type& propertyType )
+uint32_t GetPropertyImplementationSize( Property::Type& propertyType )
{
- unsigned int size = 0u;
+ uint32_t size = 0u;
switch( propertyType )
{
#define DALI_INTERNAL_PROPERTY_BUFFER_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
/**
* @copydoc PropertBuffer::SetData()
*/
- void SetData( const void* data, std::size_t size );
+ void SetData( const void* data, uint32_t size );
/**
* @copydoc PropertBuffer::GetSize()
*/
- std::size_t GetSize() const;
+ uint32_t GetSize() const;
public: // Default property extensions from Object
private: // data
EventThreadServices& mEventThreadServices; ///<Used to send messages to the render thread via update thread
Render::PropertyBuffer* mRenderObject; ///<Render side object
- unsigned int mBufferFormatSize;
- unsigned int mSize; ///< Number of elements in the buffer
+ uint32_t mBufferFormatSize;
+ uint32_t mSize; ///< Number of elements in the buffer
};
/**
template<> struct PropertyImplementationType< Property::RECTANGLE > { typedef Rect<int> Type; };
template<> struct PropertyImplementationType< Property::ROTATION > { typedef Quaternion Type; };
-unsigned int GetPropertyImplementationSize( Property::Type& propertyType );
+uint32_t GetPropertyImplementationSize( Property::Type& propertyType );
} // namespace Internal
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
namespace Internal
{
-bool CompareTokens( const char * first, const char * second, size_t& size )
+bool CompareTokens( const char * first, const char * second, uint32_t& size )
{
size = 0;
while( ( *first != '\0' ) && ( *second != '\0' ) && ( *first != ',') && ( *second != ',') )
if( ( 'A' <= ca ) && ( ca <= 'Z') )
{
- ca = ca + ( 'a' - 'A' );
+ ca = static_cast<char>( ca + ( 'a' - 'A' ) ); // don't expect overflow
}
if( ( 'A' <= cb ) && ( cb <= 'Z') )
{
- cb = cb + ( 'a' - 'A' );
+ cb = static_cast<char>( cb + ( 'a' - 'A' ) ); // don't expect overflow
}
if( ca != cb )
#define DALI_PROPERTY_HELPER_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint>
+
// INTERNAL INCLUDES
#include <dali/integration-api/bitmap.h>
#include <dali/devel-api/scripting/enum-helper.h>
*/
#define DALI_PROPERTY_TABLE_BEGIN const Internal::PropertyDetails DEFAULT_PROPERTY_DETAILS[] = {
#ifdef DEBUG_ENABLED
-#define DALI_PROPERTY_TABLE_END( startIndex ) }; const int DEFAULT_PROPERTY_COUNT = sizeof( DEFAULT_PROPERTY_DETAILS ) / sizeof( Internal::PropertyDetails ); \
+#define DALI_PROPERTY_TABLE_END( startIndex ) }; const Property::Index DEFAULT_PROPERTY_COUNT = static_cast<Property::Index>( sizeof( DEFAULT_PROPERTY_DETAILS ) / sizeof( Internal::PropertyDetails ) ); \
struct PROPERTY_CHECK \
{ \
PROPERTY_CHECK() \
}; \
static PROPERTY_CHECK PROPERTY_CHECK_INSTANCE;
#else
-#define DALI_PROPERTY_TABLE_END( startIndex ) }; const int DEFAULT_PROPERTY_COUNT = sizeof( DEFAULT_PROPERTY_DETAILS ) / sizeof( Internal::PropertyDetails );
+#define DALI_PROPERTY_TABLE_END( startIndex ) }; const Property::Index DEFAULT_PROPERTY_COUNT = static_cast<Property::Index>( sizeof( DEFAULT_PROPERTY_DETAILS ) / sizeof( Internal::PropertyDetails ) );
#endif
#ifdef DEBUG_ENABLED
#define DALI_PROPERTY( text, type, writable, animatable, constraint, index ) { text, Dali::Property::type, writable, animatable, constraint, index },
*
* @return true if strings are the same
*/
-bool CompareTokens( const char * first, const char * second, size_t& size );
+bool CompareTokens( const char * first, const char * second, uint32_t& size );
/**
void Stage::SurfaceResized( float width, float height )
{
- if( ( fabs( width - mSurfaceSize.width ) > Math::MACHINE_EPSILON_1000 ) || ( fabs( height - mSurfaceSize.height ) > Math::MACHINE_EPSILON_1000 ) )
+ if( ( fabsf( width - mSurfaceSize.width ) > Math::MACHINE_EPSILON_1000 ) || ( fabsf( height - mSurfaceSize.height ) > Math::MACHINE_EPSILON_1000 ) )
{
mSurfaceSize.width = width;
mSurfaceSize.height = height;
// Internally we want to report the actual size of the stage.
mSize.width = width;
- mSize.height = height - mTopMargin;
+ mSize.height = height - static_cast<float>( mTopMargin );
// Calculates the aspect ratio, near and far clipping planes, field of view and camera Z position.
mDefaultCamera->SetPerspectiveProjection( mSurfaceSize );
mSystemOverlay->GetImpl()->SetSize( width, height );
}
- SetDefaultSurfaceRectMessage( mUpdateManager, Rect<int>( 0, 0, width, height ) );
+ SetDefaultSurfaceRectMessage( mUpdateManager, Rect<int32_t>( 0, 0, static_cast<int32_t>( width ), static_cast<int32_t>( height ) ) ); // truncated
// if single render task to screen then set its viewport parameters
if( 1 == mRenderTaskList->GetTaskCount() )
if(!defaultRenderTask.GetTargetFrameBuffer())
{
- defaultRenderTask.SetViewport( Viewport(0, 0, width, height) );
+ defaultRenderTask.SetViewport( Viewport( 0, 0, static_cast<int32_t>( width ), static_cast<int32_t>( height ) ) ); // truncated
}
}
if( mRenderToFbo )
{
- Dali::FrameBuffer frameBuffer = Dali::FrameBuffer::New( width, height, Dali::FrameBuffer::Attachment::NONE );
- Dali::Texture texture = Dali::Texture::New( Dali::TextureType::TEXTURE_2D, Dali::Pixel::RGB888, width, height );
+ Dali::FrameBuffer frameBuffer = Dali::FrameBuffer::New( static_cast<uint32_t>( width ), static_cast<uint32_t>( height ), Dali::FrameBuffer::Attachment::NONE );
+ Dali::Texture texture = Dali::Texture::New( Dali::TextureType::TEXTURE_2D, Dali::Pixel::RGB888, static_cast<uint32_t>( width ), static_cast<uint32_t>( height ) );
frameBuffer.AttachColorTexture( texture );
Dali::RenderTask defaultRenderTask = mRenderTaskList->GetTask( 0u );
return mSize;
}
-void Stage::SetTopMargin( unsigned int margin )
+void Stage::SetTopMargin( uint32_t margin )
{
if (mTopMargin == margin)
{
mTopMargin = margin;
mSize.width = mSurfaceSize.width;
- mSize.height = mSurfaceSize.height - mTopMargin;
+ mSize.height = mSurfaceSize.height - static_cast<float>( mTopMargin );
// Adjust the camera height to allow for top-margin
SetDefaultCameraPosition();
return *mDefaultCamera;
}
-unsigned int Stage::GetLayerCount() const
+uint32_t Stage::GetLayerCount() const
{
return mLayerList->GetLayerCount();
}
-Dali::Layer Stage::GetLayer( unsigned int depth ) const
+Dali::Layer Stage::GetLayer( uint32_t depth ) const
{
return Dali::Layer(mLayerList->GetLayer( depth ));
}
mLeftCamera->SetOrientation( -Dali::ANGLE_90, Vector3::ZAXIS );
mLeftCamera->SetPosition( Vector3( stereoBase, 0.0f, 0.0f ) );
- mLeftRenderTask.SetViewport( Viewport(0, mSize.height * 0.5f, mSize.width, mSize.height * 0.5f) );
+ mLeftRenderTask.SetViewport( Viewport(0, static_cast<int32_t>( mSize.height * 0.5f ), static_cast<int32_t>( mSize.width ), static_cast<int32_t>( mSize.height * 0.5f ) ) ); // truncated
- mRightCamera->SetPerspectiveProjection( mSize, Vector2( 0.0, -stereoBase) );
+ mRightCamera->SetPerspectiveProjection( mSize, Vector2( 0.0, -stereoBase ) );
mRightCamera->SetAspectRatio( aspect );
mRightCamera->SetOrientation( -Dali::ANGLE_90, Vector3::ZAXIS );
mRightCamera->SetPosition( Vector3(-stereoBase, 0.0f, 0.0f ) );
- mRightRenderTask.SetViewport( Viewport(0, 0, mSize.width, mSize.height * 0.5f ) );
+ mRightRenderTask.SetViewport( Viewport(0, 0, static_cast<int32_t>( mSize.width ), static_cast<int32_t>( mSize.height * 0.5f ) ) ); // truncated
break;
}
mLeftCamera->SetFieldOfView( fov );
mLeftCamera->SetOrientation( Dali::ANGLE_0, Vector3::ZAXIS );
mLeftCamera->SetPosition( Vector3( stereoBase, 0.0f, 0.0f ) );
- mLeftRenderTask.SetViewport( Viewport(0, 0, mSize.width * 0.5f, mSize.height ) );
+ mLeftRenderTask.SetViewport( Viewport(0, 0, static_cast<int32_t>( mSize.width * 0.5f ), static_cast<int32_t>( mSize.height ) ) ); // truncated
mRightCamera->SetPerspectiveProjection( Size( mSize.x * 0.5f, mSize.y ), Vector2(-stereoBase,0.0f) );
mRightCamera->SetFieldOfView( fov );
mRightCamera->SetOrientation( Dali::ANGLE_0, Vector3::ZAXIS );
mRightCamera->SetPosition( Vector3( -stereoBase, 0.0f, 0.0f ) );
- mRightRenderTask.SetViewport( Viewport(mSize.width * 0.5f, 0, mSize.width * 0.5f, mSize.height ) );
+ mRightRenderTask.SetViewport( Viewport( static_cast<int32_t>( mSize.width * 0.5f ), 0, static_cast<int32_t>( mSize.width * 0.5f ), static_cast<int32_t>( mSize.height ) ) ); // truncated
break;
}
return mRenderController;
}
-unsigned int* Stage::ReserveMessageSlot( std::size_t size, bool updateScene )
+uint32_t* Stage::ReserveMessageSlot( uint32_t size, bool updateScene )
{
return mUpdateManager.ReserveMessageSlot( size, updateScene );
}
* initial size is zero before it is assigned
* @param[in] margin margin size
*/
- void SetTopMargin( unsigned int margin );
+ void SetTopMargin( uint32_t margin );
/**
* Returns the size of the Stage in pixels as a Vector.
/**
* @copydoc Dali::Stage::GetLayerCount()
*/
- unsigned int GetLayerCount() const;
+ uint32_t GetLayerCount() const;
/**
* @copydoc Dali::Stage::GetLayer()
*/
- Dali::Layer GetLayer( unsigned int depth ) const;
+ Dali::Layer GetLayer( uint32_t depth ) const;
/**
* @copydoc Dali::Stage::GetRootLayer()
/**
* @copydoc EventThreadServices::ReserveMessageSlot
*/
- virtual unsigned int* ReserveMessageSlot( std::size_t size, bool updateScene );
+ virtual uint32_t* ReserveMessageSlot( uint32_t size, bool updateScene );
/**
* @copydoc EventThreadServices::GetEventBufferIndex
ViewMode mViewMode;
float mStereoBase;
- unsigned int mTopMargin;
+ uint32_t mTopMargin;
Vector2 mDpi;
// The object registry
}
}
-size_t TypeInfo::GetPropertyCount() const
+uint32_t TypeInfo::GetPropertyCount() const
{
- size_t count( mRegisteredProperties.size() );
+ uint32_t count = static_cast<uint32_t>( mRegisteredProperties.size() );
Dali::TypeInfo base = TypeRegistry::Get()->GetTypeInfo( mBaseTypeName );
while ( base )
{
const TypeInfo& baseImpl( GetImplementation(base) );
- count += baseImpl.mRegisteredProperties.size();
+ count += static_cast<uint32_t>( baseImpl.mRegisteredProperties.size() );
base = TypeRegistry::Get()->GetTypeInfo( baseImpl.mBaseTypeName );
}
TypeInfo(const std::string& name, const std::string& baseName, Dali::CSharpTypeInfo::CreateFunction creator);
/**
- *
+ * Destructor
*/
- ~TypeInfo();
+ virtual ~TypeInfo();
/**
* @copydoc Dali::TypeInfo::GetName
/**
* @copydoc Dali::TypeInfo::GetPropertyCount
*/
- size_t GetPropertyCount() const;
-
- /**
- * @copydoc Dali::TypeInfo::GetPropertyName
- */
- std::string GetPropertyName(size_t index) const;
+ uint32_t GetPropertyCount() const;
/**
* Adds the property indices to the container specified.
* @param[in] baseIndex The index of the base animatable property
* @param[in] component The index The index of the component.
*/
- void AddAnimatablePropertyComponent( const std::string& name, Property::Index index, Property::Index baseIndex, unsigned int componentIndex );
+ void AddAnimatablePropertyComponent( const std::string& name, Property::Index index, Property::Index baseIndex, uint32_t componentIndex );
/**
* Adds a child property to the type.
* @param[in] index The index of the property.
* @return The component index associated with that property index.
*/
- int GetComponentIndex( Property::Index index ) const;
+ int32_t GetComponentIndex( Property::Index index ) const;
/**
* Checks if there is a setter for the property. If there is then it is writable.
{
}
- RegisteredProperty( Property::Type propType, const std::string& propName, Property::Index basePropertyIndex, int componentIndex )
+ RegisteredProperty( Property::Type propType, const std::string& propName, Property::Index basePropertyIndex, int32_t componentIndex )
: type( propType ),
setFunc( NULL ),
getFunc( NULL ),
};
std::string name;
Property::Index basePropertyIndex;
- int componentIndex;
+ int32_t componentIndex;
};
typedef std::pair<std::string, Dali::TypeInfo::SignalConnectorFunction > ConnectionPair;
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
ShaderFactory::~ShaderFactory()
{
// Let all the cached objects destroy themselves:
- for( int i = 0, cacheSize = mShaderBinaryCache.Size(); i < cacheSize; ++i )
+ for( std::size_t i = 0, cacheSize = mShaderBinaryCache.Size(); i < cacheSize; ++i )
{
if( mShaderBinaryCache[i] )
{
ShaderDataPtr shaderData;
/// Check a cache of previously loaded shaders:
- for( int i = 0, cacheSize = mShaderBinaryCache.Size(); i < cacheSize; ++i )
+ for( std::size_t i = 0, cacheSize = mShaderBinaryCache.Size(); i < cacheSize; ++i )
{
if( mShaderBinaryCache[i]->GetHashValue() == shaderHash )
{
ThreadLocalStorage& tls = ThreadLocalStorage::Get();
Integration::PlatformAbstraction& platformAbstraction = tls.GetPlatformAbstraction();
- const bool saved = platformAbstraction.SaveShaderBinaryFile( binaryShaderFilename, &shaderData->GetBuffer()[0], shaderData->GetBufferSize() );
+ const bool saved = platformAbstraction.SaveShaderBinaryFile( binaryShaderFilename, &shaderData->GetBuffer()[0], static_cast<unsigned int>( shaderData->GetBufferSize() ) ); // don't expect buffer larger than unsigned int
// Save the binary into to memory cache:
MemoryCacheInsert( *shaderData );
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
typedef Integration::TouchEvent DerivedType;
// Reserve some memory inside the message queue
- unsigned int* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) );
+ uint32_t* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) DerivedType( static_cast<const DerivedType&>(event) );
typedef Integration::HoverEvent DerivedType;
// Reserve some memory inside the message queue
- unsigned int* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) );
+ uint32_t* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) DerivedType( static_cast<const DerivedType&>(event) );
typedef Integration::KeyEvent DerivedType;
// Reserve some memory inside the message queue
- unsigned int* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) );
+ uint32_t* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) DerivedType( static_cast<const DerivedType&>(event) );
typedef Integration::WheelEvent DerivedType;
// Reserve some memory inside the message queue
- unsigned int* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) );
+ uint32_t* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) DerivedType( static_cast<const DerivedType&>(event) );
typedef Integration::PinchGestureEvent DerivedType;
// Reserve some memory inside the message queue
- unsigned int* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) );
+ uint32_t* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) DerivedType( static_cast<const DerivedType&>(event) );
typedef Integration::PanGestureEvent DerivedType;
// Reserve some memory inside the message queue
- unsigned int* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) );
+ uint32_t* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) DerivedType( static_cast<const DerivedType&>(event) );
typedef Integration::TapGestureEvent DerivedType;
// Reserve some memory inside the message queue
- unsigned int* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) );
+ uint32_t* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) DerivedType( static_cast<const DerivedType&>(event) );
typedef Integration::LongPressGestureEvent DerivedType;
// Reserve some memory inside the message queue
- unsigned int* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) );
+ uint32_t* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) DerivedType( static_cast<const DerivedType&>(event) );
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
{
}
- Actor *actor; ///< The actor hit (if actor is hit, then this is initialised).
- Vector2 hitPosition; ///< Position of hit (only valid if actor valid).
- float distance; ///< Distance from ray origin to hit actor.
- int depth; ///< Depth index of this actor.
+ Actor *actor; ///< The actor hit (if actor is hit, then this is initialised).
+ Vector2 hitPosition; ///< Position of hit (only valid if actor valid).
+ float distance; ///< Distance from ray origin to hit actor.
+ int32_t depth; ///< Depth index of this actor.
};
/**
HitTestInterface& hitCheck,
bool& overlayHit,
bool layerIs3d,
- unsigned int clippingDepth,
- unsigned int clippingBitPlaneMask )
+ uint32_t clippingDepth,
+ uint32_t clippingBitPlaneMask )
{
HitActor hit;
// we increase the clipping depth if we have hit a clipping actor.
// This is used later to ensure all nested clipped children have hit
// all clipping actors also for them to be counted as hit.
- unsigned int newClippingDepth = clippingDepth;
+ uint32_t newClippingDepth = clippingDepth;
bool clippingActor = actor.GetClippingMode() != ClippingMode::DISABLED;
if( clippingActor )
{
// EG. a depth of 4 (10000 binary) = a mask of 1111 binary.
// This allows us a fast way of comparing all bits are set up to this depth.
// Note: If the current Actor has clipping, that is included in the depth mask too.
- unsigned int clippingDepthMask = ( 1u << newClippingDepth ) - 1u;
+ uint32_t clippingDepthMask = ( 1u << newClippingDepth ) - 1u;
// The two masks must be equal to be a hit, as we are already assuming a hit
// (for non-clipping mode) then they must be not-equal to disqualify the hit.
{
//Get renderer with maximum depth
int rendererMaxDepth(actor.GetRendererAt( 0 ).Get()->GetDepthIndex());
- for( unsigned int i(1); i < actor.GetRendererCount(); ++i )
+ for( uint32_t i(1); i < actor.GetRendererCount(); ++i )
{
int depth = actor.GetRendererAt( i ).Get()->GetDepthIndex();
if( depth > rendererMaxDepth )
if( actor.GetChildCount() > 0 )
{
childHit.distance = std::numeric_limits<float>::max();
- childHit.depth = std::numeric_limits<int>::min();
+ childHit.depth = std::numeric_limits<int32_t>::min();
ActorContainer& children = actor.GetChildrenInternal();
// Hit test ALL children and calculate their distance.
{
ClippingBox box = layer.GetClippingBox();
- if( screenCoordinates.x < box.x ||
- screenCoordinates.x > box.x + box.width ||
- screenCoordinates.y < stageSize.y - (box.y + box.height) ||
- screenCoordinates.y > stageSize.y - box.y)
+ if( screenCoordinates.x < static_cast<float>( box.x )||
+ screenCoordinates.x > static_cast<float>( box.x + box.width )||
+ screenCoordinates.y < stageSize.y - static_cast<float>( box.y + box.height ) ||
+ screenCoordinates.y > stageSize.y - static_cast<float>( box.y ) )
{
// Not touchable if clipping is enabled in the layer and the screen coordinate is outside the clip region.
hittable = false;
{
Viewport viewport;
renderTask.GetViewport( viewport );
- if( screenCoordinates.x < viewport.x ||
- screenCoordinates.x > viewport.x + viewport.width ||
- screenCoordinates.y < viewport.y ||
- screenCoordinates.y > viewport.y + viewport.height )
+ if( screenCoordinates.x < static_cast<float>( viewport.x ) ||
+ screenCoordinates.x > static_cast<float>( viewport.x + viewport.width ) ||
+ screenCoordinates.y < static_cast<float>( viewport.y ) ||
+ screenCoordinates.y > static_cast<float>( viewport.y + viewport.height ) )
{
// The screen coordinate is outside the viewport of render task. The viewport clips all layers.
return false;
Dali::Layer layer( sourceActor->GetLayer() );
if( layer )
{
- const unsigned int sourceActorDepth( layer.GetDepth() );
+ const uint32_t sourceActorDepth( layer.GetDepth() );
CameraActor* cameraActor = renderTask.GetCameraActor();
bool pickingPossible = cameraActor->BuildPickingRay(
bool layerConsumesHit = false;
const Vector2& stageSize = stage.GetSize();
- for( int i = layers.GetLayerCount() - 1; i >= 0 && !( hit.actor ); --i )
+ for( int32_t i = layers.GetLayerCount() - 1; i >= 0 && !( hit.actor ); --i )
{
Layer* layer( layers.GetLayer( i ) );
overlayHit = false;
if( IsActuallyHittable( *layer, screenCoordinates, stageSize, hitCheck ) )
{
// Always hit-test the source actor; otherwise test whether the layer is below the source actor in the hierarchy
- if( sourceActorDepth == static_cast<unsigned int>( i ) )
+ if( sourceActorDepth == static_cast<uint32_t>( i ) )
{
// Recursively hit test the source actor & children, without crossing into other layers.
hit = HitTestWithinLayer( *sourceActor,
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
// Avoid dividing by 0
if ( panEvent.timeDelta > 0 )
{
- pan.velocity.x = pan.displacement.x / panEvent.timeDelta;
- pan.velocity.y = pan.displacement.y / panEvent.timeDelta;
+ pan.velocity.x = pan.displacement.x / static_cast<float>( panEvent.timeDelta );
+ pan.velocity.y = pan.displacement.y / static_cast<float>( panEvent.timeDelta );
- pan.screenVelocity.x = pan.screenDisplacement.x / panEvent.timeDelta;
- pan.screenVelocity.y = pan.screenDisplacement.y / panEvent.timeDelta;
+ pan.screenVelocity.x = pan.screenDisplacement.x / static_cast<float>( panEvent.timeDelta );
+ pan.screenVelocity.y = pan.screenDisplacement.y / static_cast<float>( panEvent.timeDelta );
}
// When the gesture ends, we may incorrectly get a ZERO velocity (as we have lifted our finger without any movement)
actor->ScreenToLocal( renderTaskImpl, currentPosition.x, currentPosition.y, mCurrentPanEvent->currentPosition.x, mCurrentPanEvent->currentPosition.y );
Vector2 displacement( currentPosition - startPosition );
- Radian angle( atan( displacement.y / displacement.x ) );
+ Radian angle( atanf( displacement.y / displacement.x ) );
/////////////////////////////
// | //
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
}
void BitmapCompressed::Initialize( Pixel::Format pixelFormat,
- const unsigned int width,
- const unsigned int height,
- const size_t bufferSize )
+ const uint32_t width,
+ const uint32_t height,
+ const uint32_t bufferSize )
{
Dali::Integration::Bitmap::Initialize( pixelFormat, width, height );
mBufferSize = bufferSize;
}
Dali::Integration::PixelBuffer* BitmapCompressed::ReserveBufferOfSize( Pixel::Format pixelFormat,
- const unsigned int width,
- const unsigned int height,
- const size_t bufferSize )
+ const uint32_t width,
+ const uint32_t height,
+ const uint32_t bufferSize )
{
// Sanity check that a not-outrageous amount of data is being passed in (indicating a client error):
DALI_ASSERT_DEBUG(bufferSize < (1U << 27U) && "That is far too much compressed data."); // 128MB of compressed data == unreasonable.
#define __DALI_INTERNAL_COMPRESSED_BITMAP_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
* @param[in] bufferSize Buffer cpacity in pixels
*/
void Initialize(Pixel::Format pixelFormat,
- unsigned int width,
- unsigned int height,
- const std::size_t bufferSize);
+ uint32_t width,
+ uint32_t height,
+ uint32_t bufferSize);
public:
/**
* (Re-)Allocate pixel buffer for the Bitmap. Any previously allocated pixel buffer
* @return pixel buffer pointer
*/
virtual Dali::Integration::PixelBuffer* ReserveBufferOfSize( Pixel::Format pixelFormat,
- const unsigned width,
- const unsigned height,
- const std::size_t numBytes );
+ const uint32_t width,
+ const uint32_t height,
+ const uint32_t numBytes );
/**
* Get the pixel buffer size in bytes
* @return The buffer size in bytes.
*/
- virtual std::size_t GetBufferSize() const
+ virtual uint32_t GetBufferSize() const
{
return mBufferSize;
}
private:
- std::size_t mBufferSize;
+ uint32_t mBufferSize;
BitmapCompressed(const BitmapCompressed& other); ///< defined private to prevent use
BitmapCompressed& operator = (const BitmapCompressed& other); ///< defined private to prevent use
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
}
// use power of two bufferWidth and bufferHeight for better performance
-Dali::Integration::PixelBuffer* BitmapPackedPixel::ReserveBuffer(Pixel::Format pixelFormat,
- unsigned int width,
- unsigned int height,
- unsigned int bufferWidth,
- unsigned int bufferHeight)
+Dali::Integration::PixelBuffer* BitmapPackedPixel::ReserveBuffer( Pixel::Format pixelFormat,
+ uint32_t width,
+ uint32_t height,
+ uint32_t bufferWidth,
+ uint32_t bufferHeight )
{
// delete existing buffer
DeletePixelBuffer();
Initialize(pixelFormat, width, height, bufferWidth, bufferHeight);
//allocate buffer
- unsigned int bufSize = mBufferWidth * mBufferHeight * mBytesPerPixel;
+ uint32_t bufSize = mBufferWidth * mBufferHeight * mBytesPerPixel;
mData = reinterpret_cast< Dali::Integration::PixelBuffer* >( malloc( bufSize) );
return mData;
}
-void BitmapPackedPixel::AssignBuffer(Pixel::Format pixelFormat,
- Dali::Integration::PixelBuffer* buffer,
- std::size_t bufferSize,
- unsigned int width,
- unsigned int height,
- unsigned int bufferWidth,
- unsigned int bufferHeight)
+void BitmapPackedPixel::AssignBuffer( Pixel::Format pixelFormat,
+ Dali::Integration::PixelBuffer* buffer,
+ uint32_t bufferSize,
+ uint32_t width,
+ uint32_t height,
+ uint32_t bufferWidth,
+ uint32_t bufferHeight)
{
DALI_ASSERT_DEBUG( buffer );
if(HasAlphaChannel())
{
- unsigned char* pixelBuffer=GetBuffer();
+ uint8_t* pixelBuffer=GetBuffer();
if(pixelBuffer != NULL)
{
- unsigned char* row = pixelBuffer;
+ uint8_t* row = pixelBuffer;
- int byte; int bits;
+ int32_t byte; int32_t bits;
Pixel::GetAlphaOffsetAndMask(mPixelFormat, byte, bits);
- int stride = mBufferWidth * mBytesPerPixel;
- int pixelsPerRow = mImageWidth;
+ int32_t stride = mBufferWidth * mBytesPerPixel;
+ int32_t pixelsPerRow = mImageWidth;
- for(size_t j=0; j<mImageHeight; j++)
+ for(uint32_t j=0; j<mImageHeight; j++)
{
- unsigned char* pixels = row;
- for(int i=0; i<pixelsPerRow; i++)
+ uint8_t* pixels = row;
+ for(int32_t i=0; i<pixelsPerRow; i++)
{
if((pixels[byte] & bits) != bits)
{
}
void BitmapPackedPixel::Initialize( Pixel::Format pixelFormat,
- unsigned int width,
- unsigned int height,
- unsigned int bufferWidth,
- unsigned int bufferHeight)
+ uint32_t width,
+ uint32_t height,
+ uint32_t bufferWidth,
+ uint32_t bufferHeight)
{
Dali::Integration::Bitmap::Initialize(pixelFormat, width, height);
mBufferWidth = (bufferWidth != 0) ? bufferWidth : width;
DALI_ASSERT_DEBUG(mBufferWidth >= mImageWidth && mBufferHeight >= mImageHeight);
}
-unsigned int BitmapPackedPixel::GetBufferStride() const
+uint32_t BitmapPackedPixel::GetBufferStride() const
{
return mBufferWidth*mBytesPerPixel;
}
#define __DALI_INTERNAL_BITMAP_H__
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
* @return pixel buffer pointer
*/
virtual Dali::Integration::PixelBuffer* ReserveBuffer(Pixel::Format pixelFormat,
- unsigned int width,
- unsigned int height,
- unsigned int bufferWidth = 0,
- unsigned int bufferHeight = 0);
+ uint32_t width,
+ uint32_t height,
+ uint32_t bufferWidth = 0,
+ uint32_t bufferHeight = 0);
/**
* Assign a pixel buffer. Any previously allocated pixel buffer is deleted.
*/
virtual void AssignBuffer(Pixel::Format pixelFormat,
Dali::Integration::PixelBuffer* buffer,
- std::size_t bufferSize,
- unsigned int width,
- unsigned int height,
- unsigned int bufferWidth = 0,
- unsigned int bufferHeight = 0);
+ uint32_t bufferSize,
+ uint32_t width,
+ uint32_t height,
+ uint32_t bufferWidth = 0,
+ uint32_t bufferHeight = 0);
/**
* Get the width of the buffer (stride)
* Get the pixel buffer size in bytes
* @return The buffer size in bytes.
*/
- // unsigned int GetBufferSize() const
- virtual size_t GetBufferSize() const
+ virtual uint32_t GetBufferSize() const
{
- return static_cast< size_t >( mBufferWidth ) * mBytesPerPixel * mBufferHeight; // need to cast to size_t to avoid possibility of overflow
+ return mBufferWidth * mBytesPerPixel * mBufferHeight;
}
/**
* Get the pixel buffer stride.
* @return The buffer stride (in bytes).
*/
- virtual unsigned int GetBufferStride() const;
+ virtual uint32_t GetBufferStride() const;
/**
* Get the pixel format
protected:
- unsigned int mBufferWidth; ///< Buffer width (stride) in pixels
- unsigned int mBufferHeight; ///< Buffer height in pixels
- unsigned int mBytesPerPixel; ///< Bytes per pixel
+ uint32_t mBufferWidth; ///< Buffer width (stride) in pixels
+ uint32_t mBufferHeight; ///< Buffer height in pixels
+ uint32_t mBytesPerPixel; ///< Bytes per pixel
private:
* @param[in] bufferHeight Buffer height in pixels
*/
void Initialize(Pixel::Format pixelFormat,
- unsigned int width,
- unsigned int height,
- unsigned int bufferWidth,
- unsigned int bufferHeight);
+ uint32_t width,
+ uint32_t height,
+ uint32_t bufferWidth,
+ uint32_t bufferHeight);
BitmapPackedPixel(const BitmapPackedPixel& other); ///< defined private to prevent use
mBufferWidth = area.width ? area.width : mWidth;
uint32_t bufferHeight = area.height ? area.height : mHeight;
- size_t bufferSize = mBytesPerPixel * mBufferWidth * bufferHeight;
- unsigned char* buffer = reinterpret_cast< Dali::Integration::PixelBuffer* >( malloc( bufferSize ) );
+ uint32_t bufferSize = mBytesPerPixel * mBufferWidth * bufferHeight;
+ Dali::Integration::PixelBuffer* buffer = reinterpret_cast< Dali::Integration::PixelBuffer* >( malloc( bufferSize ) );
DALI_ASSERT_DEBUG(buffer != 0);
// Are we uploading from an external or internal buffer ?
image->mTexture = Texture::New( Dali::TextureType::TEXTURE_2D, format, width, height );
//Upload data to the texture
- size_t bufferSize = bitmap->GetBufferSize();
+ uint32_t bufferSize = bitmap->GetBufferSize();
PixelDataPtr pixelData = PixelData::New( bitmap->GetBufferOwnership(), bufferSize, width, height, format,
static_cast< Dali::PixelData::ReleaseFunction >( bitmap->GetReleaseFunction() ) );
image->mTexture->Upload( pixelData );
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
Vector2 Image::GetNaturalSize() const
{
- return Vector2( mWidth, mHeight );
+ return Vector2( static_cast<float>( mWidth ), static_cast<float>( mHeight ) );
}
Image::Image()
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
mHeight = mBitmap->GetImageHeight();
mTexture = Texture::New( Dali::TextureType::TEXTURE_2D, mBitmap->GetPixelFormat(), mWidth, mHeight );
- size_t bufferSize = mBitmap->GetBufferSize();
- unsigned char* buffer = new unsigned char[bufferSize];
+ uint32_t bufferSize = mBitmap->GetBufferSize();
+ uint8_t* buffer = new uint8_t[bufferSize];
memcpy( buffer, mBitmap->GetBuffer(), bufferSize );
PixelDataPtr pixelData = PixelData::New( buffer, bufferSize, mWidth, mHeight, mBitmap->GetPixelFormat(), Dali::PixelData::DELETE_ARRAY );
mTexture->Upload( pixelData );
if( srcProfile )
{
PixelBuffer* destPixels = cropped->GetBuffer();
- unsigned int destStride = cropped->GetBufferStride();
- unsigned int pixelWidth = GetBytesPerPixel(pixelFormat);
+ uint32_t destStride = cropped->GetBufferStride();
+ uint32_t pixelWidth = GetBytesPerPixel(pixelFormat);
PixelBuffer* srcPixels = mBitmap->GetBuffer();
- unsigned int srcStride = srcProfile->GetBufferStride();
+ uint32_t srcStride = srcProfile->GetBufferStride();
- for( unsigned int row=1; row < mHeight-1; ++row )
+ for( uint32_t row=1; row < mHeight-1; ++row )
{
PixelBuffer* src = srcPixels + row*srcStride + pixelWidth;
PixelBuffer* dest = destPixels + (row-1)*destStride;
testValue = 0; // Black == stretch
}
- unsigned int pixelWidth = GetBytesPerPixel( pixelFormat );
+ uint32_t pixelWidth = GetBytesPerPixel( pixelFormat );
const PixelBuffer* srcPixels = mBitmap->GetBuffer();
- unsigned int srcStride = srcProfile->GetBufferStride();
+ uint32_t srcStride = srcProfile->GetBufferStride();
//TOP
const PixelBuffer* top = srcPixels + pixelWidth;
- unsigned int index = 0;
- unsigned int width = mBitmap->GetImageWidth();
- unsigned int height = mBitmap->GetImageHeight();
+ uint32_t index = 0;
+ uint32_t width = mBitmap->GetImageWidth();
+ uint32_t height = mBitmap->GetImageHeight();
for(; index < width - 2; )
{
}
}
-Uint16Pair NinePatchImage::ParseRange( unsigned int& index, unsigned int width, const PixelBuffer* & pixel, unsigned int pixelStride, int testByte, int testBits, int testValue )
+Uint16Pair NinePatchImage::ParseRange( uint32_t& index, uint32_t width, const PixelBuffer* & pixel, uint32_t pixelStride, int testByte, int testBits, int testValue )
{
- unsigned int start = 0xFFFF;
+ uint32_t start = 0xFFFF;
for( ; index < width; ++index, pixel += pixelStride )
{
if( ( pixel[ testByte ] & testBits ) == testValue )
}
}
- unsigned int end = width;
+ uint32_t end = width;
for( ; index < width; ++index, pixel += pixelStride )
{
if( ( pixel[ testByte ] & testBits ) != testValue )
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
// CLASS HEADER
#include <dali/internal/event/images/pixel-data-impl.h>
-// EXTERNAL INCLUDES
-#include <stdlib.h>
-
namespace Dali
{
namespace Internal
{
-PixelData::PixelData( unsigned char* buffer,
- unsigned int bufferSize,
- unsigned int width,
- unsigned int height,
+PixelData::PixelData( uint8_t* buffer,
+ uint32_t bufferSize,
+ uint32_t width,
+ uint32_t height,
Pixel::Format pixelFormat,
Dali::PixelData::ReleaseFunction releaseFunction )
: mBuffer( buffer ),
{
if( mBuffer )
{
- if( mReleaseFunction == Dali::PixelData::FREE)
+ if( mReleaseFunction == Dali::PixelData::FREE )
{
free( mBuffer );
}
}
}
-PixelDataPtr PixelData::New(unsigned char* buffer,
- unsigned int bufferSize,
- unsigned int width,
- unsigned int height,
- Pixel::Format pixelFormat,
- Dali::PixelData::ReleaseFunction releaseFunction)
+PixelDataPtr PixelData::New( uint8_t* buffer,
+ uint32_t bufferSize,
+ uint32_t width,
+ uint32_t height,
+ Pixel::Format pixelFormat,
+ Dali::PixelData::ReleaseFunction releaseFunction )
{
return new PixelData( buffer, bufferSize, width, height, pixelFormat, releaseFunction );
}
-unsigned int PixelData::GetWidth() const
+uint32_t PixelData::GetWidth() const
{
return mWidth;
}
-unsigned int PixelData::GetHeight() const
+uint32_t PixelData::GetHeight() const
{
return mHeight;
}
return mPixelFormat;
}
-unsigned char* PixelData::GetBuffer() const
+uint8_t* PixelData::GetBuffer() const
{
return mBuffer;
}
-unsigned int PixelData::GetBufferSize() const
+uint32_t PixelData::GetBufferSize() const
{
return mBufferSize;
}
#define DALI_INTERNAL_PIXEL_DATA_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
* @param [in] pixelFormat The pixel format
* @param [in] releaseFunction The function used to release the memory.
*/
- static PixelDataPtr New( unsigned char* buffer,
- unsigned int bufferSize,
- unsigned int width,
- unsigned int height,
+ static PixelDataPtr New( uint8_t* buffer,
+ uint32_t bufferSize,
+ uint32_t width,
+ uint32_t height,
Pixel::Format pixelFormat,
Dali::PixelData::ReleaseFunction releaseFunction);
* @param [in] pixelFormat The pixel format
* @param [in] releaseFunction The function used to release the memory.
*/
- PixelData( unsigned char* buffer,
- unsigned int bufferSize,
- unsigned int width,
- unsigned int height,
+ PixelData( uint8_t* buffer,
+ uint32_t bufferSize,
+ uint32_t width,
+ uint32_t height,
Pixel::Format pixelFormat,
Dali::PixelData::ReleaseFunction releaseFunction );
* Get the width of the buffer in pixels.
* @return The width of the buffer in pixels
*/
- unsigned int GetWidth() const;
+ uint32_t GetWidth() const;
/**
* Get the height of the buffer in pixels
* @return The height of the buffer in pixels
*/
- unsigned int GetHeight() const;
+ uint32_t GetHeight() const;
/**
* Get the pixel format
* Get the pixel buffer if it's present.
* @return The buffer if exists, or NULL if there is no pixel buffer.
*/
- unsigned char* GetBuffer() const;
+ uint8_t* GetBuffer() const;
/**
* Get the size of the buffer in bytes
* @return The size of the buffer
*/
- unsigned int GetBufferSize() const;
+ uint32_t GetBufferSize() const;
/**
* Return the buffer pointer and reset the internal buffer to zero.
private:
- unsigned char* mBuffer; ///< The raw pixel data
- unsigned int mBufferSize; ///< Buffer sized in bytes
- unsigned int mWidth; ///< Buffer width in pixels
- unsigned int mHeight; ///< Buffer height in pixels
- Pixel::Format mPixelFormat; ///< Pixel format
+ uint8_t* mBuffer; ///< The raw pixel data
+ uint32_t mBufferSize; ///< Buffer sized in bytes
+ uint32_t mWidth; ///< Buffer width in pixels
+ uint32_t mHeight; ///< Buffer height in pixels
+ Pixel::Format mPixelFormat; ///< Pixel format
Dali::PixelData::ReleaseFunction mReleaseFunction; ///< Function for releasing memory
};
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
mTexture = Texture::New( Dali::TextureType::TEXTURE_2D, format, width, height );
//Upload data to the texture
- size_t bufferSize = bitmap->GetBufferSize();
+ uint32_t bufferSize = bitmap->GetBufferSize();
PixelDataPtr pixelData = PixelData::New( bitmap->GetBufferOwnership(), bufferSize, width, height, format,
static_cast< Dali::PixelData::ReleaseFunction >( bitmap->GetReleaseFunction() ) );
mTexture->Upload( pixelData );
Vector2 ResourceImage::GetNaturalSize() const
{
- return Vector2(mWidth, mHeight);
+ return Vector2( static_cast<float>( mWidth ), static_cast<float>( mHeight ) );
}
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
void RenderTask::SetViewport( const Viewport& viewport )
{
- SetViewportPosition(Vector2(viewport.x, viewport.y));
- SetViewportSize(Vector2(viewport.width, viewport.height));
+ SetViewportPosition( Vector2( static_cast<float>( viewport.x ), static_cast<float>( viewport.y ) ) );
+ SetViewportSize( Vector2( static_cast<float>( viewport.width ), static_cast<float>( viewport.height ) ) );
}
void RenderTask::GetViewport( Viewport& viewPort ) const
{
Vector2 size( stage->GetSize() );
viewPort.x = viewPort.y = 0;
- viewPort.width = size.width;
- viewPort.height = size.height;
+ viewPort.width = static_cast<int32_t>( size.width ); // truncated
+ viewPort.height = static_cast<int32_t>( size.height ); // truncated
}
}
}
{
const Vector2& position = mSceneObject->GetViewportPosition(bufferIndex);
const Vector2& size = mSceneObject->GetViewportSize(bufferIndex);
- viewPort.x = position.x;
- viewPort.y = position.y;
- viewPort.width = size.width;
- viewPort.height = size.height;
+ viewPort.x = static_cast<int32_t>( position.x ); // truncated
+ viewPort.y = static_cast<int32_t>( position.y ); // truncated
+ viewPort.width = static_cast<int32_t>( size.width ); // truncated
+ viewPort.height = static_cast<int32_t>( size.height ); // truncated
}
}
return mCullMode;
}
-void RenderTask::SetRefreshRate( unsigned int refreshRate )
+void RenderTask::SetRefreshRate( uint32_t refreshRate )
{
DALI_LOG_TRACE_METHOD_FMT(gLogRender, "this:%p rate:%d\n", this, refreshRate);
DALI_LOG_INFO(gLogRender, Debug::General, "RenderTask::SetRefreshRate(this:%p, %d)\n", this, refreshRate);
}
}
-unsigned int RenderTask::GetRefreshRate() const
+uint32_t RenderTask::GetRefreshRate() const
{
return mRefreshRate;
}
Viewport viewport;
Vector2 size( stage->GetSize() );
viewport.x = viewport.y = 0;
- viewport.width = size.width;
- viewport.height = size.height;
+ viewport.width = static_cast<int32_t>( size.width ); // truncated
+ viewport.height = static_cast<int32_t>( size.height ); // truncated
float localX, localY;
inside = mMappingConnector.mActor->ScreenToLocal(defaultCamera.GetViewMatrix(), defaultCamera.GetProjectionMatrix(), viewport, localX, localY, screenCoords.x, screenCoords.y);
bool ok = ProjectFull(pos,
cam->GetViewMatrix(),
cam->GetProjectionMatrix(),
- viewport.x,
- viewport.y,
- viewport.width,
- viewport.height,
+ static_cast<float>( viewport.x ), // truncated
+ static_cast<float>( viewport.y ), // truncated
+ static_cast<float>( viewport.width ), // truncated
+ static_cast<float>( viewport.height ), // truncated
viewportPosition);
if(ok)
{
******************************** PROPERTY METHODS **************************
********************************************************************************/
-unsigned int RenderTask::GetDefaultPropertyCount() const
+uint32_t RenderTask::GetDefaultPropertyCount() const
{
return DEFAULT_PROPERTY_COUNT;
}
bool RenderTask::HasFinished()
{
bool finished = false;
- const unsigned int counter = mSceneObject->GetRenderedOnceCounter();
+ const uint32_t counter = mSceneObject->GetRenderedOnceCounter();
if( mRefreshOnceCounter < counter )
{
#define __DALI_INTERNAL_RENDER_TASK_H__
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
/**
* @copydoc Dali::RenderTask::SetRefreshRate()
*/
- void SetRefreshRate( unsigned int refreshRate );
+ void SetRefreshRate( uint32_t refreshRate );
/**
* @copydoc Dali::RenderTask::GetRefreshRate()
*/
- unsigned int GetRefreshRate() const;
+ uint32_t GetRefreshRate() const;
/**
* Check if the render-task is hittable. If render task is offscreen, the screen coordinates may be translated.
/**
* @copydoc Dali::Internal::Object::GetDefaultPropertyCount()
*/
- virtual unsigned int GetDefaultPropertyCount() const;
+ virtual uint32_t GetDefaultPropertyCount() const;
/**
* @copydoc Dali::Internal::Object::GetDefaultPropertyIndices()
Vector2 mViewportPosition; ///< The cached viewport position
Vector2 mViewportSize; ///< The cached viewport size
- unsigned int mRefreshRate; ///< Determines how often the task is processed.
+ uint32_t mRefreshRate; ///< Determines how often the task is processed.
- unsigned int mRefreshOnceCounter;
+ uint32_t mRefreshOnceCounter;
FrameBufferImagePtr mFrameBufferImage; ///< Optional off-screen render target.
FrameBufferPtr mFrameBuffer;
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
}
}
-unsigned int RenderTaskList::GetTaskCount() const
+uint32_t RenderTaskList::GetTaskCount() const
{
- return mTasks.size();
+ return static_cast<uint32_t>( mTasks.size() ); // only 4,294,967,295 render tasks supported
}
-Dali::RenderTask RenderTaskList::GetTask( unsigned int index ) const
+Dali::RenderTask RenderTaskList::GetTask( uint32_t index ) const
{
DALI_ASSERT_ALWAYS( ( index < mTasks.size() ) && "RenderTask index out-of-range" );
/**
* @copydoc Dali::RenderTaskList::GetTaskCount()
*/
- unsigned int GetTaskCount() const;
+ uint32_t GetTaskCount() const;
/**
* @copydoc Dali::RenderTaskList::GetTask()
*/
- Dali::RenderTask GetTask( unsigned int index ) const;
+ Dali::RenderTask GetTask( uint32_t index ) const;
/**
* Retrieve the container of render-tasks.
mVertexBuffers.erase( mVertexBuffers.begin() + index );
}
-void Geometry::SetIndexBuffer( const unsigned short* indices, size_t count )
+void Geometry::SetIndexBuffer( const uint16_t* indices, size_t count )
{
- Dali::Vector<unsigned short> indexData;
+ Dali::Vector<uint16_t> indexData;
if( indices && count )
{
indexData.Resize( count );
/**
* @copydoc Dali::Geometry::SetIndexBuffer()
*/
- void SetIndexBuffer( const unsigned short* indices, size_t count );
+ void SetIndexBuffer( const uint16_t* indices, size_t count );
/**
* @copydoc Dali::Geometry::SetType()
equationAlpha = mBlendingOptions.GetBlendEquationAlpha();
}
-void Renderer::SetIndexedDrawFirstElement( size_t firstElement )
+void Renderer::SetIndexedDrawFirstElement( uint32_t firstElement )
{
if( firstElement != mIndexedDrawFirstElement )
{
}
}
-void Renderer::SetIndexedDrawElementsCount( size_t elementsCount )
+void Renderer::SetIndexedDrawElementsCount( uint32_t elementsCount )
{
if( elementsCount != mIndexedDrawElementCount )
{
return mSceneObject;
}
-unsigned int Renderer::GetDefaultPropertyCount() const
+uint32_t Renderer::GetDefaultPropertyCount() const
{
return RENDERER_IMPL.GetDefaultPropertyCount();
}
}
case Dali::Renderer::Property::BLEND_EQUATION_RGB:
{
- unsigned int bitMask = mSceneObject->GetBlendingOptions();
+ uint32_t bitMask = mSceneObject->GetBlendingOptions();
BlendingOptions blendingOptions;
blendingOptions.SetBitmask( bitMask );
value = static_cast<int>( blendingOptions.GetBlendEquationRgb() );
}
case Dali::Renderer::Property::BLEND_EQUATION_ALPHA:
{
- unsigned int bitMask = mSceneObject->GetBlendingOptions();
+ uint32_t bitMask = mSceneObject->GetBlendingOptions();
BlendingOptions blendingOptions;
blendingOptions.SetBitmask( bitMask );
value = static_cast<int>( blendingOptions.GetBlendEquationAlpha() );
}
case Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB:
{
- unsigned int bitMask = mSceneObject->GetBlendingOptions();
+ uint32_t bitMask = mSceneObject->GetBlendingOptions();
BlendingOptions blendingOptions;
blendingOptions.SetBitmask( bitMask );
value = static_cast<int>( blendingOptions.GetBlendSrcFactorRgb() );
}
case Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB:
{
- unsigned int bitMask = mSceneObject->GetBlendingOptions();
+ uint32_t bitMask = mSceneObject->GetBlendingOptions();
BlendingOptions blendingOptions;
blendingOptions.SetBitmask( bitMask );
value = static_cast<int>( blendingOptions.GetBlendDestFactorRgb() );
}
case Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA:
{
- unsigned int bitMask = mSceneObject->GetBlendingOptions();
+ uint32_t bitMask = mSceneObject->GetBlendingOptions();
BlendingOptions blendingOptions;
blendingOptions.SetBitmask( bitMask );
value = static_cast<int>( blendingOptions.GetBlendSrcFactorAlpha() );
}
case Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA:
{
- unsigned int bitMask = mSceneObject->GetBlendingOptions();
+ uint32_t bitMask = mSceneObject->GetBlendingOptions();
BlendingOptions blendingOptions;
blendingOptions.SetBitmask( bitMask );
value = static_cast<int>( blendingOptions.GetBlendDestFactorAlpha() );
/**
* @copydoc Dali::Renderer::SetIndexedDrawFirstElement
*/
- void SetIndexedDrawFirstElement( size_t firstElement );
+ void SetIndexedDrawFirstElement( uint32_t firstElement );
/**
* @copydoc Dali::Renderer::SetIndexedDrawElementsCount
*/
- void SetIndexedDrawElementsCount( size_t elementsCount );
+ void SetIndexedDrawElementsCount( uint32_t elementsCount );
/**
* @brief Set whether the Pre-multiplied Alpha Blending is required
int mDepthIndex;
- size_t mIndexedDrawFirstElement; ///< Offset of first element to draw from bound index buffer
- size_t mIndexedDrawElementCount; ///< Number of elements to draw
+ uint32_t mIndexedDrawFirstElement; ///< Offset of first element to draw from bound index buffer
+ uint32_t mIndexedDrawElementCount; ///< Number of elements to draw
Render::Renderer::StencilParameters mStencilParameters; ///< Struct containing all stencil related options
BlendingOptions mBlendingOptions; ///< Local copy of blending options bitmask
{ "MODIFIES_GEOMETRY", Dali::Shader::Hint::MODIFIES_GEOMETRY}
};
-const unsigned int ShaderHintsTableSize = sizeof( ShaderHintsTable ) / sizeof( ShaderHintsTable[0] );
+const uint32_t ShaderHintsTableSize = static_cast<uint32_t>( sizeof( ShaderHintsTable ) / sizeof( ShaderHintsTable[0] ) );
BaseHandle Create()
{
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
return textureSet;
}
-void TextureSet::SetTexture( size_t index, TexturePtr texture )
+void TextureSet::SetTexture( uint32_t index, TexturePtr texture )
{
- size_t textureCount( mTextures.size() );
+ uint32_t textureCount = static_cast<uint32_t>( mTextures.size() );
if( index >= textureCount )
{
mTextures.resize(index + 1);
samplerExist = false;
}
- for( size_t i(textureCount); i<=index; ++i )
+ for( uint32_t i(textureCount); i<=index; ++i )
{
mTextures[i] = NULL;
SceneGraph::SetTextureMessage( mEventThreadServices, *mSceneObject, index, renderTexture );
}
-Texture* TextureSet::GetTexture( size_t index ) const
+Texture* TextureSet::GetTexture( uint32_t index ) const
{
Texture* result(0);
if( index < mTextures.size() )
return result;
}
-void TextureSet::SetSampler( size_t index, SamplerPtr sampler )
+void TextureSet::SetSampler( uint32_t index, SamplerPtr sampler )
{
- size_t samplerCount( mSamplers.size() );
+ uint32_t samplerCount = static_cast<uint32_t>( mSamplers.size() );
if( samplerCount < index + 1 )
{
mSamplers.resize( index + 1 );
- for( size_t i(samplerCount); i<=index; ++i )
+ for( uint32_t i = samplerCount; i<=index; ++i )
{
mSamplers[i] = NULL;
}
SceneGraph::SetSamplerMessage( mEventThreadServices, *mSceneObject, index, renderSampler );
}
-Sampler* TextureSet::GetSampler( size_t index ) const
+Sampler* TextureSet::GetSampler( uint32_t index ) const
{
Sampler* result(0);
if( index < mSamplers.size() )
return result;
}
-size_t TextureSet::GetTextureCount() const
+uint32_t TextureSet::GetTextureCount() const
{
- return mTextures.size();
+ return static_cast<uint32_t>( mTextures.size() );
}
const SceneGraph::TextureSet* TextureSet::GetTextureSetSceneObject() const
#define DALI_INTERNAL_TEXTURE_SET_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
/**
* @copydoc Dali::TextureSet::SetTexture()
*/
- void SetTexture( size_t index, TexturePtr texture );
+ void SetTexture( uint32_t index, TexturePtr texture );
/**
* @copydoc Dali::TextureSet::GetTexture()
*/
- Texture* GetTexture( size_t index ) const;
+ Texture* GetTexture( uint32_t index ) const;
/**
* @copydoc Dali::TextureSet::SetSampler()
*/
- void SetSampler( size_t index, SamplerPtr sampler );
+ void SetSampler( uint32_t index, SamplerPtr sampler );
/**
* @copydoc Dali::TextureSet::GetSampler()
*/
- Sampler* GetSampler( size_t index ) const;
+ Sampler* GetSampler( uint32_t index ) const;
/**
* @copydoc Dali::TextureSet::GetTextureCount()
*/
- size_t GetTextureCount() const;
+ uint32_t GetTextureCount() const;
/**
* @brief Get the TextureSet scene object
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
DALI_LOG_INFO( gLogFilter, Debug::Verbose, output.str().c_str() );
++level;
- unsigned int numChildren = actor.GetChildCount();
- for( unsigned int i=0; i<numChildren; ++i )
+ uint32_t numChildren = actor.GetChildCount();
+ for( uint32_t i=0; i<numChildren; ++i )
{
PrintChildren( actor.GetChildAt(i), level );
}
return &ThreadLocalStorage::Get().GetRelayoutController();
}
-void RelayoutController::SetStageSize( unsigned int width, unsigned int height )
+void RelayoutController::SetStageSize( uint32_t width, uint32_t height )
{
- mStageSize.width = width;
- mStageSize.height = height;
+ mStageSize.width = static_cast<float>( width );
+ mStageSize.height = static_cast<float>( height );
}
void RelayoutController::QueueActor( Dali::Actor& actor, RelayoutContainer& actors, Vector2 size )
topOfSubTreeStack.push_back( actor );
// Propagate on all dimensions
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( dimension & ( 1 << i ) )
{
}
// Propagate down to children
- for( unsigned int i = 0; i < actor.GetChildCount(); ++i )
+ for( uint32_t i = 0; i < actor.GetChildCount(); ++i )
{
Dali::Actor child = actor.GetChildAt( i );
// Check for dimension dependecy: width for height/height for width etc
// Check each possible dimension and see if it is dependent on the input one
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
Dimension::Type dimensionToCheck = static_cast< Dimension::Type >( 1 << i );
{
// Store the highest parent reached
bool found = false;
- for( unsigned int i = 0, count = topOfSubTreeStack.size(); i < count; ++i )
+ for( auto&& element : topOfSubTreeStack )
{
- if( topOfSubTreeStack[ i ] == parent )
+ if( element == parent )
{
found = true;
break;
// Check for dimension dependecy: width for height/height for width etc
// Check each possible dimension and see if it is dependent on the input one
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
Dimension::Type dimensionToCheck = static_cast< Dimension::Type >( 1 << i );
}
// Propagate down to children
- for( unsigned int i = 0, childCount = actor.GetChildCount(); i < childCount; ++i )
+ for( uint32_t i = 0, childCount = actor.GetChildCount(); i < childCount; ++i )
{
Dali::Actor child = actor.GetChildAt( i );
Actor& childImpl = GetImplementation( child );
// Only add the rootActor if it is not already recorded
bool found = false;
- for( unsigned int i = 0, count = mDirtyLayoutSubTrees.Size(); i < count; ++i )
+ for( auto&& item : mDirtyLayoutSubTrees )
{
- if( mDirtyLayoutSubTrees[ i ] == actorPtr )
+ if( item == actorPtr )
{
found = true;
break;
#define __DALI_INTERNAL_RELAYOUT_CONTROLLER_IMPL_H__
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint>
+
// INTERNAL INCLUDES
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/object/base-object.h>
* @param width of the stage
* @param height of the stage
*/
- void SetStageSize( unsigned int width, unsigned int height );
+ void SetStageSize( uint32_t width, uint32_t height );
/**
* @brief Request to relayout the given actor and all sub-actors of it.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
}
// Loop through all RenderList in the RenderList, set up any prerequisites to render them, then perform the render.
- for( size_t index( 0u ); index < count; ++index )
+ for( uint32_t index = 0u; index < count; ++index )
{
const RenderItem& item = renderList.GetItem( index );
DALI_PRINT_RENDER_ITEM( item );
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
// OwnerContainer deletes the instructions
}
-void RenderInstructionContainer::ResetAndReserve( BufferIndex bufferIndex, size_t capacityRequired )
+void RenderInstructionContainer::ResetAndReserve( BufferIndex bufferIndex, uint32_t capacityRequired )
{
mIndex[ bufferIndex ] = 0u;
- size_t oldcapacity = mInstructions[ bufferIndex ].Capacity();
+ uint32_t oldcapacity = static_cast<uint32_t>( mInstructions[ bufferIndex ].Capacity() ); // uint32_t is large enough in practice
if( oldcapacity < capacityRequired )
{
mInstructions[ bufferIndex ].Reserve( capacityRequired );
// RenderInstruction holds a lot of data so we keep them and recycle instead of new & delete
}
-size_t RenderInstructionContainer::Count( BufferIndex bufferIndex )
+uint32_t RenderInstructionContainer::Count( BufferIndex bufferIndex )
{
// mIndex contains the number of instructions that have been really prepared and updated
// (from UpdateManager through GetNextInstruction)
return At( bufferIndex, mIndex[ bufferIndex ]++ );
}
-RenderInstruction& RenderInstructionContainer::At( BufferIndex bufferIndex, size_t index )
+RenderInstruction& RenderInstructionContainer::At( BufferIndex bufferIndex, uint32_t index )
{
DALI_ASSERT_DEBUG( index < mInstructions[ bufferIndex ].Count() );
#define __DALI_INTERNAL_SCENE_GRAPH_RENDER_INSTRUCTION_CONTAINER_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
* @param bufferIndex to reset
* @param capacityRequired in the container
*/
- void ResetAndReserve( BufferIndex bufferIndex, size_t capacityRequired );
+ void ResetAndReserve( BufferIndex bufferIndex, uint32_t capacityRequired );
/**
* Return the count of instructions in the container
* @param bufferIndex to use
* @return the count of elements
*/
- size_t Count( BufferIndex bufferIndex );
+ uint32_t Count( BufferIndex bufferIndex );
/**
* Get a reference to the next instruction
* @param bufferIndex to use
* @param index to use
*/
- RenderInstruction& At( BufferIndex bufferIndex, size_t index );
+ RenderInstruction& At( BufferIndex bufferIndex, uint32_t index );
/**
* Discard the current container index
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
// Return the AABB in screen-space pixels (x, y, width, height).
// Note: This is a algebraic simplification of: ( viewport.x - aabb.width ) / 2 - ( ( aabb.width / 2 ) + aabb.x ) per axis.
- Vector4 aabbInScreen( ( viewportWidth / 2 ) - aabb.z, ( viewportHeight / 2 ) - aabb.w, ( viewportWidth / 2 ) - aabb.x, ( viewportHeight / 2 ) - aabb.y );
-
- int x = static_cast< int >( round( aabbInScreen.x ) );
- int y = static_cast< int >( round( aabbInScreen.y ) );
- int z = static_cast< int >( round( aabbInScreen.z ) );
- int w = static_cast< int >( round( aabbInScreen.w ) );
+ Vector4 aabbInScreen( static_cast<float>( viewportWidth ) * 0.5f - aabb.z,
+ static_cast<float>( viewportHeight ) * 0.5f - aabb.w,
+ static_cast<float>( viewportWidth ) * 0.5f - aabb.x,
+ static_cast<float>( viewportHeight ) * 0.5f - aabb.y );
+
+ int x = static_cast< int >( roundf( aabbInScreen.x ) );
+ int y = static_cast< int >( roundf( aabbInScreen.y ) );
+ int z = static_cast< int >( roundf( aabbInScreen.z ) );
+ int w = static_cast< int >( roundf( aabbInScreen.w ) );
return ClippingBox( x, y, z - x, w - y );
}
#define DALI_INTERNAL_SCENE_GRAPH_RENDER_LIST_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint>
+
// INTERNAL INCLUDES
#include <dali/public-api/math/rect.h>
#include <dali/devel-api/common/owner-container.h>
/**
* Get item at a given position in the list
*/
- RenderItem& GetItem( RenderItemContainer::SizeType index ) const
+ RenderItem& GetItem( uint32_t index ) const
{
DALI_ASSERT_DEBUG( index < GetCachedItemCount() );
return *mItems[ index ];
/**
* Get renderer from an item in the list
*/
- const Render::Renderer& GetRenderer( RenderItemContainer::SizeType index ) const
+ const Render::Renderer& GetRenderer( uint32_t index ) const
{
DALI_ASSERT_DEBUG( index < GetCachedItemCount() );
return *mItems[ index ]->mRenderer;
* Because of caching, the actual size may be bit more
* @return The number of items
*/
- RenderItemContainer::SizeType Count() const
+ uint32_t Count() const
{
return mNextFree;
}
/**
* @return the number of items cached by the list
*/
- RenderItemContainer::SizeType GetCachedItemCount() const
+ uint32_t GetCachedItemCount() const
{
- return mItems.Count();
+ return static_cast<uint32_t>( mItems.Count() );
}
/**
*/
void ReuseCachedItems()
{
- mNextFree = mItems.Count();
+ mNextFree = static_cast<uint32_t>( mItems.Count() );
}
/**
const RenderList& operator=( const RenderList& rhs );
RenderItemContainer mItems; ///< Each item is a renderer and matrix pair
- RenderItemContainer::SizeType mNextFree; ///< index for the next free item to use
+ uint32_t mNextFree; ///< index for the next free item to use
ClippingBox* mClippingBox; ///< The clipping box, in window coordinates, when clipping is enabled
Layer* mSourceLayer; ///< The originating layer where the renderers are from
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
Vector4 backgroundColor; ///< The glClear color used at the beginning of each frame.
- unsigned int frameCount; ///< The current frame count
+ uint32_t frameCount; ///< The current frame count
BufferIndex renderBufferIndex; ///< The index of the buffer to read from; this is opposite of the "update" buffer
- Rect<int> defaultSurfaceRect; ///< Rectangle for the default surface we are rendering to
+ Rect<int32_t> defaultSurfaceRect; ///< Rectangle for the default surface we are rendering to
OwnerContainer< Render::Renderer* > rendererContainer; ///< List of owned renderers
OwnerContainer< Render::Sampler* > samplerContainer; ///< List of owned samplers
mImpl->backgroundColor = color;
}
-void RenderManager::SetDefaultSurfaceRect(const Rect<int>& rect)
+void RenderManager::SetDefaultSurfaceRect(const Rect<int32_t>& rect)
{
mImpl->defaultSurfaceRect = rect;
}
texture->GenerateMipmaps( mImpl->context );
}
-void RenderManager::SetFilterMode( Render::Sampler* sampler, unsigned int minFilterMode, unsigned int magFilterMode )
+void RenderManager::SetFilterMode( Render::Sampler* sampler, uint32_t minFilterMode, uint32_t magFilterMode )
{
sampler->mMinificationFilter = static_cast<Dali::FilterMode::Type>(minFilterMode);
sampler->mMagnificationFilter = static_cast<Dali::FilterMode::Type>(magFilterMode );
}
-void RenderManager::SetWrapMode( Render::Sampler* sampler, unsigned int rWrapMode, unsigned int sWrapMode, unsigned int tWrapMode )
+void RenderManager::SetWrapMode( Render::Sampler* sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode )
{
sampler->mRWrapMode = static_cast<Dali::WrapMode::Type>(rWrapMode);
sampler->mSWrapMode = static_cast<Dali::WrapMode::Type>(sWrapMode);
}
}
-void RenderManager::AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, unsigned int mipmapLevel, unsigned int layer )
+void RenderManager::AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer )
{
frameBuffer->AttachColorTexture( mImpl->context, texture, mipmapLevel, layer );
}
propertyBuffer->SetFormat( format.Release() );
}
-void RenderManager::SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector<char> >& data, size_t size )
+void RenderManager::SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector<uint8_t> >& data, uint32_t size )
{
propertyBuffer->SetData( data.Release(), size );
}
-void RenderManager::SetIndexBuffer( Render::Geometry* geometry, Dali::Vector<unsigned short>& indices )
+void RenderManager::SetIndexBuffer( Render::Geometry* geometry, Dali::Vector<uint16_t>& indices )
{
geometry->SetIndexBuffer( indices );
}
}
}
-void RenderManager::SetGeometryType( Render::Geometry* geometry, unsigned int geometryType )
+void RenderManager::SetGeometryType( Render::Geometry* geometry, uint32_t geometryType )
{
geometry->SetType( Render::Geometry::Type(geometryType) );
}
// Process messages queued during previous update
mImpl->renderQueue.ProcessMessages( mImpl->renderBufferIndex );
- const size_t count = mImpl->instructions.Count( mImpl->renderBufferIndex );
+ const uint32_t count = mImpl->instructions.Count( mImpl->renderBufferIndex );
const bool haveInstructions = count > 0u;
// Only render if we have instructions to render, or the last frame was rendered (and therefore a clear is required).
// this ensures we will set view and projection matrix once per program per camera
mImpl->programController.ResetProgramMatrices();
- for( size_t i = 0; i < count; ++i )
+ for( uint32_t i = 0; i < count; ++i )
{
RenderInstruction& instruction = mImpl->instructions.At( mImpl->renderBufferIndex, i );
void RenderManager::DoRender( RenderInstruction& instruction )
{
- Rect<int> viewportRect;
+ Rect<int32_t> viewportRect;
Vector4 clearColor;
if ( instruction.mIsClearColorSet )
if ( instruction.mIsViewportSet )
{
// For glViewport the lower-left corner is (0,0)
- const int y = ( instruction.mFrameBuffer->GetHeight() - instruction.mViewport.height ) - instruction.mViewport.y;
+ const int32_t y = ( instruction.mFrameBuffer->GetHeight() - instruction.mViewport.height ) - instruction.mViewport.y;
viewportRect.Set( instruction.mViewport.x, y, instruction.mViewport.width, instruction.mViewport.height );
}
else
if ( instruction.mIsViewportSet )
{
// For glViewport the lower-left corner is (0,0)
- const int y = ( mImpl->defaultSurfaceRect.height - instruction.mViewport.height ) - instruction.mViewport.y;
+ const int32_t y = ( mImpl->defaultSurfaceRect.height - instruction.mViewport.height ) - instruction.mViewport.y;
viewportRect.Set( instruction.mViewport.x, y, instruction.mViewport.width, instruction.mViewport.height );
}
else
#define __DALI_INTERNAL_SCENE_GRAPH_RENDER_MANAGER_H__
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
* @param[in] minFilterMode Filter mode to use when the texture is minificated
* @param[in] magFilterMode Filter mode to use when the texture is magnified
*/
- void SetFilterMode( Render::Sampler* sampler, unsigned int minFilterMode, unsigned int magFilterMode );
+ void SetFilterMode( Render::Sampler* sampler, uint32_t minFilterMode, uint32_t magFilterMode );
/**
* Set wrapping mode for a sampler
* @param[in] uWrapMode Wrap mode in the x direction
* @param[in] vWrapMode Wrap mode in the y direction
*/
- void SetWrapMode( Render::Sampler* sampler, unsigned int rWrapMode, unsigned int sWrapMode, unsigned int tWrapMode );
+ void SetWrapMode( Render::Sampler* sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode );
/**
* Add a property buffer to the render manager.
* @param[in] data The new data of the buffer
* @param[in] size The new size of the buffer
*/
- void SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector<char> >& data, size_t size );
+ void SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector<uint8_t> >& data, uint32_t size );
/**
* Sets the data for the index buffer of an existing geometry
* @param[in] geometry The geometry
* @param[in] data A vector containing the indices
*/
- void SetIndexBuffer( Render::Geometry* geometry, Dali::Vector<unsigned short>& data );
+ void SetIndexBuffer( Render::Geometry* geometry, Dali::Vector<uint16_t>& data );
/**
* Set the geometry type of an existing render geometry
* @param[in] geometry The render geometry
* @param[in] geometryType The new geometry type
*/
- void SetGeometryType( Render::Geometry* geometry, unsigned int geometryType );
+ void SetGeometryType( Render::Geometry* geometry, uint32_t geometryType );
/**
* Adds a texture to the render manager
* @param[in] mipmapLevel The mipmap of the texture to be attached
* @param[in] layer Indicates which layer of a cube map or array texture to attach. Unused for 2D textures
*/
- void AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, unsigned int mipmapLevel, unsigned int layer );
+ void AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer );
/**
* Adds a render tracker to the RenderManager. RenderManager takes ownership of the
#define __DALI_INTERNAL_SCENE_GRAPH_NODE_DATA_PROVIDER_H__
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
NodeDataProvider() { }
/**
- * @param bufferId to use
+ * @param bufferIndex to use
* @return a reference to the model matrix
*/
- virtual const Matrix& GetModelMatrix( unsigned int bufferId ) const = 0;
+ virtual const Matrix& GetModelMatrix( BufferIndex bufferIndex ) const = 0;
/**
- * @param bufferId to use
+ * @param bufferIndex to use
* @return a reference to the color
*/
- virtual const Vector4& GetRenderColor( unsigned int bufferId ) const = 0;
+ virtual const Vector4& GetRenderColor( BufferIndex bufferIndex ) const = 0;
/**
* @copydoc Dali::Internal::SceneGraph::UniformMapDataProvider::GetUniformMapChanged()
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
}
}
-unsigned int* RenderQueue::ReserveMessageSlot( BufferIndex updateBufferIndex, std::size_t size )
+uint32_t* RenderQueue::ReserveMessageSlot( BufferIndex updateBufferIndex, std::size_t size )
{
MessageBuffer* container = GetCurrentContainer( updateBufferIndex );
#define __DALI_INTERNAL_SCENE_GRAPH_RENDER_QUEUE_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
* @param[in] size The message size with respect to the size of type "char".
* @return A pointer to the first char allocated for the message.
*/
- unsigned int* ReserveMessageSlot( BufferIndex updateBufferIndex, std::size_t size );
+ uint32_t* ReserveMessageSlot( BufferIndex updateBufferIndex, std::size_t size );
/**
* Process the batch of messages, which were queued in the previous update.
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
namespace Render
{
-FrameBuffer::FrameBuffer( unsigned int width, unsigned int height, unsigned int attachments )
+FrameBuffer::FrameBuffer( uint32_t width, uint32_t height, uint32_t attachments )
:mId( 0u ),
mDepthBuffer( attachments & Dali::FrameBuffer::Attachment::DEPTH ),
mStencilBuffer( attachments & Dali::FrameBuffer::Attachment::STENCIL ),
context.BindFramebuffer( GL_FRAMEBUFFER, 0 );
}
-void FrameBuffer::AttachColorTexture( Context& context, Render::Texture* texture, unsigned int mipmapLevel, unsigned int layer )
+void FrameBuffer::AttachColorTexture( Context& context, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer )
{
context.BindFramebuffer( GL_FRAMEBUFFER, mId );
context.BindFramebuffer( GL_FRAMEBUFFER, mId );
}
-unsigned int FrameBuffer::GetWidth() const
+uint32_t FrameBuffer::GetWidth() const
{
return mWidth;
}
-unsigned int FrameBuffer::GetHeight() const
+uint32_t FrameBuffer::GetHeight() const
{
return mHeight;
}
#define DALI_INTERNAL_RENDER_FRAME_BUFFER_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
* @param[in] height The height of the FrameBuffer
* @param[in] attachments The attachments comprising the format of the FrameBuffer (bit-mask)
*/
- FrameBuffer( unsigned int width, unsigned int height, unsigned int attachments );
+ FrameBuffer( uint32_t width, uint32_t height, uint32_t attachments );
/**
* Destructor
* @param[in] mipmapLevel The mipmap of the texture to be attached
* @param[in] layer Indicates which layer of a cube map or array texture to attach. Unused for 2D textures
*/
- void AttachColorTexture( Context& context, Render::Texture* texture, unsigned int mipmapLevel, unsigned int layer );
+ void AttachColorTexture( Context& context, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer );
/**
* @brief Bind the framebuffer
* @brief Get the width of the FrameBuffer
* @return The width of the framebuffer
*/
- unsigned int GetWidth() const;
+ uint32_t GetWidth() const;
/**
* @brief Get the height of the FrameBuffer
* @return The height of the framebuffer
*/
- unsigned int GetHeight() const;
+ uint32_t GetHeight() const;
private:
GLuint mId;
GLuint mDepthBuffer;
GLuint mStencilBuffer;
- unsigned int mWidth;
- unsigned int mHeight;
+ uint32_t mWidth;
+ uint32_t mHeight;
};
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
* limitations under the License.
*/
+// CLASS HEADER
#include <dali/internal/render/renderers/render-geometry.h>
+
+// INTERNAL INCLUDES
#include <dali/internal/common/buffer-index.h>
#include <dali/internal/render/gl-resources/context.h>
#include <dali/internal/render/gl-resources/gpu-buffer.h>
mAttributesChanged = true;
}
-void Geometry::SetIndexBuffer( Dali::Vector<unsigned short>& indices )
+void Geometry::SetIndexBuffer( Dali::Vector<uint16_t>& indices )
{
mIndices.Swap( indices );
mIndicesChanged = true;
void Geometry::RemovePropertyBuffer( const Render::PropertyBuffer* propertyBuffer )
{
- size_t bufferCount = mVertexBuffers.Size();
- for( size_t i(0); i<bufferCount; ++i )
+ const auto&& end = mVertexBuffers.End();
+ for( auto&& iter = mVertexBuffers.Begin(); iter != end; ++iter )
{
- if( propertyBuffer == mVertexBuffers[i] )
+ if( *iter == propertyBuffer )
{
//This will delete the gpu buffer associated to the RenderPropertyBuffer if there is one
- mVertexBuffers.Remove( mVertexBuffers.Begin()+i );
+ mVertexBuffers.Remove( iter );
mAttributesChanged = true;
break;
}
{
attributeLocation.Clear();
- for( size_t i(0); i< mVertexBuffers.Size(); ++i )
+ for( auto&& vertexBuffer : mVertexBuffers )
{
- unsigned int attributeCount = mVertexBuffers[i]->GetAttributeCount();
- for( unsigned int j = 0; j < attributeCount; ++j )
+ const uint32_t attributeCount = vertexBuffer->GetAttributeCount();
+ for( uint32_t j = 0; j < attributeCount; ++j )
{
- const std::string& attributeName = mVertexBuffers[i]->GetAttributeName( j );
- unsigned int index = program.RegisterCustomAttribute( attributeName );
+ const std::string& attributeName = vertexBuffer->GetAttributeName( j );
+ uint32_t index = program.RegisterCustomAttribute( attributeName );
GLint location = program.GetCustomAttributeLocation( index );
if( -1 == location )
Context& context,
BufferIndex bufferIndex,
Vector<GLint>& attributeLocation,
- size_t elementBufferOffset,
- size_t elementBufferCount )
+ uint32_t elementBufferOffset,
+ uint32_t elementBufferCount )
{
if( !mHasBeenUpdated )
{
mIndexBuffer = new GpuBuffer( context );
}
- std::size_t bufferSize = sizeof( unsigned short ) * mIndices.Size();
+ uint32_t bufferSize = static_cast<uint32_t>( sizeof( uint16_t ) * mIndices.Size() );
mIndexBuffer->UpdateDataBuffer( bufferSize, &mIndices[0], GpuBuffer::STATIC_DRAW, GpuBuffer::ELEMENT_ARRAY_BUFFER );
}
mIndicesChanged = false;
}
- size_t count = mVertexBuffers.Count();
- for( unsigned int i = 0; i < count; ++i )
+ for( auto&& buffer : mVertexBuffers )
{
-
- if( !mVertexBuffers[i]->Update( context ) )
+ if( !buffer->Update( context ) )
{
//Vertex buffer is not ready ( Size, data or format has not been specified yet )
return;
}
//Bind buffers to attribute locations
- unsigned int base = 0u;
- size_t vertexBufferCount(mVertexBuffers.Count());
- for( unsigned int i = 0; i < vertexBufferCount; ++i )
+ uint32_t base = 0u;
+ const uint32_t vertexBufferCount = static_cast<uint32_t>( mVertexBuffers.Count() );
+ for( uint32_t i = 0; i < vertexBufferCount; ++i )
{
mVertexBuffers[i]->BindBuffer( GpuBuffer::ARRAY_BUFFER );
base += mVertexBuffers[i]->EnableVertexAttributes( context, attributeLocation, base );
}
- size_t numIndices(0u);
+ uint32_t numIndices(0u);
intptr_t firstIndexOffset(0u);
if( mIndexBuffer )
{
- numIndices = mIndices.Size();
+ numIndices = static_cast<uint32_t>( mIndices.Size() );
if( elementBufferOffset != 0u )
{
- elementBufferOffset = elementBufferOffset >= numIndices ? numIndices - 1 : elementBufferOffset;
+ elementBufferOffset = (elementBufferOffset >= numIndices ) ? numIndices - 1 : elementBufferOffset;
firstIndexOffset = elementBufferOffset * sizeof(GLushort);
numIndices -= elementBufferOffset;
}
{
//Indexed draw call
mIndexBuffer->Bind( GpuBuffer::ELEMENT_ARRAY_BUFFER );
- context.DrawElements(geometryGLType, numIndices, GL_UNSIGNED_SHORT, reinterpret_cast<void*>(firstIndexOffset));
+ // numIndices truncated, no value loss happening in practice
+ context.DrawElements( geometryGLType, static_cast<GLsizei>( numIndices ), GL_UNSIGNED_SHORT, reinterpret_cast<void*>( firstIndexOffset ) );
}
else
{
//Unindex draw call
- unsigned int numVertices(0u);
+ GLsizei numVertices(0u);
if( vertexBufferCount > 0 )
{
- numVertices = mVertexBuffers[0]->GetElementCount();
+ // truncated, no value loss happening in practice
+ numVertices = static_cast<GLsizei>( mVertexBuffers[0]->GetElementCount() );
}
context.DrawArrays( geometryGLType, 0, numVertices );
}
//Disable attributes
- for( unsigned int i = 0; i < attributeLocation.Count(); ++i )
+ for( auto&& attribute : attributeLocation )
{
- if( attributeLocation[i] != -1 )
+ if( attribute != -1 )
{
- context.DisableVertexAttributeArray( attributeLocation[i] );
+ context.DisableVertexAttributeArray( static_cast<GLuint>( attribute ) );
}
}
}
#define DALI_INTERNAL_RENDER_GEOMETRY_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
* limitations under the License.
*/
+// INTERNAL INCLUDES
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/rendering/geometry.h>
#include <dali/devel-api/common/owner-container.h>
* Set the data for the index buffer to be used by the geometry
* @param[in] indices A vector containing the indices
*/
- void SetIndexBuffer( Dali::Vector<unsigned short>& indices );
+ void SetIndexBuffer( Dali::Vector<uint16_t>& indices );
/**
* Removes a PropertyBuffer from the geometry
void OnRenderFinished();
/**
- * Chack if the attributes for the geometry have changed
+ * Check if the attributes for the geometry have changed
* @return True if vertex buffers have been added or removed since last frame, false otherwise
*/
bool AttributesChanged() const
void UploadAndDraw(Context& context,
BufferIndex bufferIndex,
Vector<GLint>& attributeLocation,
- size_t elementBufferOffset,
- size_t elementBufferCount );
+ uint32_t elementBufferOffset,
+ uint32_t elementBufferCount );
private:
// PropertyBuffers
Vector< Render::PropertyBuffer* > mVertexBuffers;
- Dali::Vector< unsigned short> mIndices;
+ Dali::Vector< uint16_t > mIndices;
OwnerPointer< GpuBuffer > mIndexBuffer;
Type mGeometryType;
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
namespace
{
-using namespace Dali;
using Dali::Property;
using Dali::Internal::PropertyImplementationType;
return type;
}
-size_t GetPropertyImplementationGlSize( Property::Type propertyType )
+Dali::GLint GetPropertyImplementationGlSize( Property::Type propertyType )
{
- size_t size = 1u;
+ Dali::GLint size = 1u;
switch( propertyType )
{
mDataChanged = true;
}
-void PropertyBuffer::SetData( Dali::Vector<char>* data, size_t size )
+void PropertyBuffer::SetData( Dali::Vector<uint8_t>* data, uint32_t size )
{
mData = data;
mSize = size;
}
}
-unsigned int PropertyBuffer::EnableVertexAttributes( Context& context, Vector<GLint>& vAttributeLocation, unsigned int locationBase )
+uint32_t PropertyBuffer::EnableVertexAttributes( Context& context, Vector<GLint>& vAttributeLocation, uint32_t locationBase )
{
-
- unsigned int attributeCount = mFormat->components.size();
+ const uint32_t attributeCount = static_cast<uint32_t>( mFormat->components.size() );
GLsizei elementSize = mFormat->size;
- for( unsigned int i = 0; i < attributeCount; ++i )
+ for( uint32_t i = 0; i < attributeCount; ++i )
{
GLint attributeLocation = vAttributeLocation[i+locationBase];
if( attributeLocation != -1 )
context.EnableVertexAttributeArray( attributeLocation );
const GLint attributeSize = mFormat->components[i].size;
- size_t attributeOffset = mFormat->components[i].offset;
+ uint32_t attributeOffset = mFormat->components[i].offset;
const Property::Type attributeType = mFormat->components[i].type;
context.VertexAttribPointer( attributeLocation,
}
return attributeCount;
-
}
} //Render
#define DALI_INTERNAL_RENDER_PROPERTY_BUFFER_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+// INTERNAL INCLUDES
#include <dali/public-api/actors/sampling.h>
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/rendering/sampler.h>
struct Component
{
- std::string name;
- unsigned int offset;
- unsigned int size;
- Property::Type type;
+ std::string name;
+ uint32_t offset;
+ uint32_t size;
+ Property::Type type;
};
/**
struct Format
{
std::vector<Component> components;
- unsigned int size;
+ uint32_t size;
};
/**
* @param[in] data The new data of the PropertyBuffer
* @param[in] size The new size of the buffer
*/
- void SetData( Dali::Vector<char>* data, size_t size );
+ void SetData( Dali::Vector<uint8_t>* data, uint32_t size );
/**
* @brief Set the number of elements
* @param[in] size The number of elements
*/
- void SetSize( unsigned int size );
+ void SetSize( uint32_t size );
/**
* @brief Bind the property buffer
* @param[in] vAttributeLocation Vector containing attributes location for current program
* @param[in] locationBase Index in vAttributeLocation corresponding to the first attribute defined by this buffer
*/
- unsigned int EnableVertexAttributes( Context& context, Vector<GLint>& vAttributeLocation, unsigned int locationBase );
+ uint32_t EnableVertexAttributes( Context& context, Vector<GLint>& vAttributeLocation, uint32_t locationBase );
/**
* Get the number of attributes present in the buffer
* @return The number of attributes stored in this buffer
*/
- inline unsigned int GetAttributeCount() const
+ inline uint32_t GetAttributeCount() const
{
DALI_ASSERT_DEBUG( mFormat && "Format should be set ");
- return mFormat->components.size();
+ return static_cast<uint32_t>( mFormat->components.size() );
}
/**
* @param[in] index The index of the attribute
* @return The name of the attribute
*/
- inline const std::string& GetAttributeName(unsigned int index ) const
+ inline const std::string& GetAttributeName( uint32_t index ) const
{
DALI_ASSERT_DEBUG( mFormat && "Format should be set ");
return mFormat->components[index].name;
* Retrieve the size of the buffer in bytes
* @return The total size of the buffer
*/
- inline std::size_t GetDataSize() const
+ inline uint32_t GetDataSize() const
{
DALI_ASSERT_DEBUG( mFormat && "Format should be set ");
return mFormat->size * mSize;
* Retrieve the size of one element of the buffer
* @return The size of one element
*/
- inline std::size_t GetElementSize() const
+ inline uint32_t GetElementSize() const
{
DALI_ASSERT_DEBUG( mFormat && "Format should be set ");
return mFormat->size;
* Retrieve the number of elements in the buffer
* @return The total number of elements
*/
- inline unsigned int GetElementCount() const
+ inline uint32_t GetElementCount() const
{
return mSize;
}
* Retrieve reference to the data storage vector
* @return Reference to the data storage
*/
- inline const Dali::Vector< char >& GetData() const
+ inline const Dali::Vector< uint8_t >& GetData() const
{
return *mData.Get();
}
private:
OwnerPointer< PropertyBuffer::Format > mFormat; ///< Format of the buffer
- OwnerPointer< Dali::Vector< char > > mData; ///< Data
+ OwnerPointer< Dali::Vector< uint8_t > > mData; ///< Data
OwnerPointer< GpuBuffer > mGpuBuffer; ///< Pointer to the GpuBuffer associated with this RenderPropertyBuffer
- size_t mSize; ///< Number of Elements in the buffer
+ uint32_t mSize; ///< Number of Elements in the buffer
bool mDataChanged; ///< Flag to know if data has changed in a frame
};
Renderer* Renderer::New( SceneGraph::RenderDataProvider* dataProvider,
Render::Geometry* geometry,
- unsigned int blendingBitmask,
+ uint32_t blendingBitmask,
const Vector4& blendColor,
FaceCullingMode::Type faceCullingMode,
bool preMultipliedAlphaEnabled,
Renderer::Renderer( SceneGraph::RenderDataProvider* dataProvider,
Render::Geometry* geometry,
- unsigned int blendingBitmask,
+ uint32_t blendingBitmask,
const Vector4& blendColor,
FaceCullingMode::Type faceCullingMode,
bool preMultipliedAlphaEnabled,
const SceneGraph::CollectedUniformMap& uniformMap = uniformMapDataProvider.GetUniformMap( bufferIndex );
const SceneGraph::CollectedUniformMap& uniformMapNode = node.GetUniformMap( bufferIndex );
- unsigned int maxMaps = uniformMap.Count() + uniformMapNode.Count();
+ uint32_t maxMaps = static_cast<uint32_t>( uniformMap.Count() + uniformMapNode.Count() ); // 4,294,967,295 maps should be enough
mUniformIndexMap.Clear(); // Clear contents, but keep memory if we don't change size
mUniformIndexMap.Resize( maxMaps );
- unsigned int mapIndex(0);
+ uint32_t mapIndex = 0;
for(; mapIndex < uniformMap.Count() ; ++mapIndex )
{
mUniformIndexMap[mapIndex].propertyValue = uniformMap[mapIndex]->propertyPtr;
mUniformIndexMap[mapIndex].uniformIndex = program.RegisterUniform( uniformMap[mapIndex]->uniformName );
}
- for( unsigned int nodeMapIndex = 0; nodeMapIndex < uniformMapNode.Count() ; ++nodeMapIndex )
+ for( uint32_t nodeMapIndex = 0; nodeMapIndex < uniformMapNode.Count() ; ++nodeMapIndex )
{
- unsigned int uniformIndex = program.RegisterUniform( uniformMapNode[nodeMapIndex]->uniformName );
+ uint32_t uniformIndex = program.RegisterUniform( uniformMapNode[nodeMapIndex]->uniformName );
bool found(false);
- for( unsigned int i(0); i<uniformMap.Count(); ++i )
+ for( uint32_t i = 0; i<uniformMap.Count(); ++i )
{
if( mUniformIndexMap[i].uniformIndex == uniformIndex )
{
bool Renderer::BindTextures( Context& context, Program& program )
{
- unsigned int textureUnit = 0;
+ uint32_t textureUnit = 0;
bool result = true;
GLint uniformLocation(-1);
std::vector<Render::Sampler*>& samplers( mRenderDataProvider->GetSamplers() );
std::vector<Render::Texture*>& textures( mRenderDataProvider->GetTextures() );
- for( size_t i(0); i<textures.size() && result; ++i )
+ for( uint32_t i = 0; i < static_cast<uint32_t>( textures.size() ) && result; ++i ) // not expecting more than uint32_t of textures
{
if( textures[i] )
{
mFaceCullingMode = mode;
}
-void Renderer::SetBlendingBitMask( unsigned int bitmask )
+void Renderer::SetBlendingBitMask( uint32_t bitmask )
{
mBlendingOptions.SetBitmask( bitmask );
}
mBlendingOptions.SetBlendColor( color );
}
-void Renderer::SetIndexedDrawFirstElement( size_t firstElement )
+void Renderer::SetIndexedDrawFirstElement( uint32_t firstElement )
{
mIndexedDrawFirstElement = firstElement;
}
-void Renderer::SetIndexedDrawElementsCount( size_t elementsCount )
+void Renderer::SetIndexedDrawElementsCount( uint32_t elementsCount )
{
mIndexedDrawElementsCount = elementsCount;
}
*/
static Renderer* New( SceneGraph::RenderDataProvider* dataProviders,
Render::Geometry* geometry,
- unsigned int blendingBitmask,
+ uint32_t blendingBitmask,
const Vector4& blendColor,
FaceCullingMode::Type faceCullingMode,
bool preMultipliedAlphaEnabled,
*/
Renderer( SceneGraph::RenderDataProvider* dataProviders,
Render::Geometry* geometry,
- unsigned int blendingBitmask,
+ uint32_t blendingBitmask,
const Vector4& blendColor,
FaceCullingMode::Type faceCullingMode,
bool preMultipliedAlphaEnabled,
* Set the bitmask for blending options
* @param[in] bitmask A bitmask of blending options.
*/
- void SetBlendingBitMask( unsigned int bitmask );
+ void SetBlendingBitMask( uint32_t bitmask );
/**
* Set the blend color for blending options
* Set the first element index to draw by the indexed draw
* @param[in] firstElement index of first element to draw
*/
- void SetIndexedDrawFirstElement( size_t firstElement );
+ void SetIndexedDrawFirstElement( uint32_t firstElement );
/**
* Set the number of elements to draw by the indexed draw
* @param[in] elementsCount number of elements to draw
*/
- void SetIndexedDrawElementsCount( size_t elementsCount );
+ void SetIndexedDrawElementsCount( uint32_t elementsCount );
/**
* @brief Set whether the Pre-multiplied Alpha Blending is required
struct UniformIndexMap
{
- unsigned int uniformIndex; ///< The index of the cached location in the Program
+ uint32_t uniformIndex; ///< The index of the cached location in the Program
const PropertyInputImpl* propertyValue;
};
StencilParameters mStencilParameters; ///< Struct containing all stencil related options
BlendingOptions mBlendingOptions; ///< Blending options including blend color, blend func and blend equation
- size_t mIndexedDrawFirstElement; ///< Offset of first element to draw
- size_t mIndexedDrawElementsCount; ///< Number of elements to draw
+ uint32_t mIndexedDrawFirstElement; ///< Offset of first element to draw
+ uint32_t mIndexedDrawElementsCount; ///< Number of elements to draw
DepthFunction::Type mDepthFunction:4; ///< The depth function
FaceCullingMode::Type mFaceCullingMode:3; ///< The mode of face culling
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
mGlInternalFormat( GL_RGB ),
mGlFormat( GL_RGB ),
mPixelDataType( GL_UNSIGNED_BYTE ),
- mWidth( nativeImageInterface->GetWidth() ),
- mHeight( nativeImageInterface->GetHeight() ),
+ mWidth( static_cast<uint16_t >( nativeImageInterface->GetWidth() ) ), // ignoring overflow, not happening in practice
+ mHeight( static_cast<uint16_t >( nativeImageInterface->GetHeight() ) ), // ignoring overflow, not happening in practice
mMaxMipMapLevel( 0 ),
mType( TextureType::TEXTURE_2D ),
mHasAlpha( nativeImageInterface->RequiresBlending() ),
{
if( !mIsCompressed )
{
- for( unsigned int i(0); i<6; ++i )
+ for( uint32_t i(0); i<6; ++i )
{
context.TexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, mGlInternalFormat, mWidth, mHeight, 0, mGlFormat, mPixelDataType, 0 );
}
}
else
{
- for( unsigned int i(0); i<6; ++i )
+ for( uint32_t i(0); i<6; ++i )
{
context.CompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, mGlInternalFormat, mWidth, mHeight, 0, 0, 0 );
}
DALI_ASSERT_ALWAYS( mNativeImage == NULL );
//Get pointer to the data of the PixelData object
- unsigned char* buffer( pixelData->GetBuffer() );
+ uint8_t* buffer( pixelData->GetBuffer() );
//This buffer is only used if manually converting from RGB to RGBA
- unsigned char* tempBuffer(0);
+ uint8_t* tempBuffer(0);
//Retrieves the pixel data element type, the gl format and gl internal format of the data contained in the PixelData object.
GLenum glFormat;
if( convert )
{
- size_t dataSize = static_cast< size_t >( params.width ) * params.height;
- tempBuffer = new unsigned char[dataSize*4u];
- for( size_t i(0u); i<dataSize; i++ )
+ uint32_t dataSize = static_cast< uint32_t >( params.width ) * params.height;
+ tempBuffer = new uint8_t[dataSize*4u];
+ for( uint32_t i = 0u; i < dataSize; ++i )
{
tempBuffer[i*4u] = buffer[i*3u];
tempBuffer[i*4u+1] = buffer[i*3u+1];
}
else
{
- context.CompressedTexImage2D( target, params.mipmap, mGlInternalFormat, params.width, params.height, 0, pixelData->GetBufferSize(), buffer );
+ context.CompressedTexImage2D( target, params.mipmap, mGlInternalFormat, params.width, params.height, 0, static_cast<GLsizei>( pixelData->GetBufferSize() ), buffer );
}
}
else
{
context.CompressedTexSubImage2D( target, params.mipmap,
params.xOffset, params.yOffset, params.width, params.height,
- glFormat, pixelData->GetBufferSize(), buffer );
+ glFormat, static_cast<GLsizei>( pixelData->GetBufferSize() ), buffer );
}
}
delete[] tempBuffer;
}
-bool Texture::Bind( Context& context, unsigned int textureUnit, Render::Sampler* sampler )
+bool Texture::Bind( Context& context, uint32_t textureUnit, Render::Sampler* sampler )
{
if( mNativeImage && mId == 0 )
{
#define DALI_INTERNAL_RENDER_TEXTURE_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
// EXTERNAL INCLUDES
#include <string>
+#include <cstdint> // uint16_t, uint32_t
// INTERNAL INCLUDES
#include <dali/public-api/images/image-operations.h> // Dali::ImageDimensions
* @param[in] sampler The sampler to be used with the texture
* @return true if the bind succeeded, false otherwise
*/
- bool Bind( Context& context, unsigned int textureUnit, Render::Sampler* sampler );
+ bool Bind( Context& context, uint32_t textureUnit, Render::Sampler* sampler );
/**
* Auto generates mipmaps for the texture
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
return mNumberOfProgramBinaryFormats > 0;
}
-unsigned int ProgramController::ProgramBinaryFormat()
+GLenum ProgramController::ProgramBinaryFormat()
{
return mProgramBinaryFormat;
}
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
{
void LogWithLineNumbers( const char * source )
{
- unsigned int lineNumber = 0u;
- const char *prev = source;
- const char *ptr = prev;
+ uint32_t lineNumber = 0u;
+ const char* prev = source;
+ const char* ptr = prev;
while( true )
{
return GetCustomAttributeLocation( type );
}
-unsigned int Program::RegisterCustomAttribute( const std::string& name )
+uint32_t Program::RegisterCustomAttribute( const std::string& name )
{
- unsigned int index = 0;
+ uint32_t index = 0;
// find the value from cache
- for( ;index < mAttributeLocations.size(); ++index )
+ for( ;index < static_cast<uint32_t>( mAttributeLocations.size() ); ++index )
{
if( mAttributeLocations[ index ].first == name )
{
return index;
}
-GLint Program::GetCustomAttributeLocation( unsigned int attributeIndex )
+GLint Program::GetCustomAttributeLocation( uint32_t attributeIndex )
{
// debug check that index is within name cache
DALI_ASSERT_DEBUG( mAttributeLocations.size() > attributeIndex );
}
-unsigned int Program::RegisterUniform( const std::string& name )
+uint32_t Program::RegisterUniform( const std::string& name )
{
- unsigned int index = 0;
+ uint32_t index = 0;
// find the value from cache
- for( ;index < mUniformLocations.size(); ++index )
+ for( ;index < static_cast<uint32_t>( mUniformLocations.size() ); ++index )
{
if( mUniformLocations[ index ].first == name )
{
return index;
}
-GLint Program::GetUniformLocation( unsigned int uniformIndex )
+GLint Program::GetUniformLocation( uint32_t uniformIndex )
{
// debug check that index is within name cache
DALI_ASSERT_DEBUG( mUniformLocations.size() > uniformIndex );
struct LocationPosition
{
GLint uniformLocation; ///< The location of the uniform (used as an identifier)
- int position; ///< the position of the uniform declaration
- LocationPosition( GLint uniformLocation, int position )
+ int32_t position; ///< the position of the uniform declaration
+ LocationPosition( GLint uniformLocation, int32_t position )
: uniformLocation(uniformLocation), position(position)
{
}
mGlAbstraction.GetProgramiv( mProgramId, GL_ACTIVE_UNIFORMS, &numberOfActiveUniforms );
mGlAbstraction.GetProgramiv( mProgramId, GL_ACTIVE_UNIFORM_MAX_LENGTH, &uniformMaxNameLength );
- std::vector<std::string> samplerNames;
- std::vector<char> name(uniformMaxNameLength + 1); // Allow for null terminator
+ std::vector< std::string > samplerNames;
+ std::vector< char > name(uniformMaxNameLength + 1); // Allow for null terminator
std::vector< LocationPosition > samplerUniformLocations;
{
{
bool found( false );
token = strtok_r( NULL, " ;\n", &nextPtr );
- for( size_t i=0; i<samplerUniformLocations.size(); ++i )
+ for( uint32_t i=0; i < static_cast<uint32_t>( samplerUniformLocations.size() ); ++i )
{
if( samplerUniformLocations[i].position == -1 &&
strncmp( token, samplerNames[i].c_str(), samplerNames[i].size() ) == 0 )
free( fragShader );
// Re-order according to declaration order in the fragment source.
- size_t samplerUniformCount = samplerUniformLocations.size();
+ uint32_t samplerUniformCount = static_cast<uint32_t>( samplerUniformLocations.size() );
if( samplerUniformCount > 1 )
{
std::sort( samplerUniformLocations.begin(), samplerUniformLocations.end(), sortByPosition);
}
mSamplerUniformLocations.resize( samplerUniformCount );
- for( size_t i=0; i<samplerUniformCount; ++i )
+ for( uint32_t i=0; i<samplerUniformCount; ++i )
{
mSamplerUniformLocations[i] = samplerUniformLocations[i].uniformLocation;
}
}
-bool Program::GetSamplerUniformLocation( unsigned int index, GLint& location )
+bool Program::GetSamplerUniformLocation( uint32_t index, GLint& location )
{
bool result = false;
if( index < mSamplerUniformLocations.size() )
return result;
}
-size_t Program::GetActiveSamplerCount() const
+uint32_t Program::GetActiveSamplerCount() const
{
- return mSamplerUniformLocations.size();
+ return static_cast<uint32_t>( mSamplerUniformLocations.size() );
}
void Program::SetUniform1i( GLint location, GLint value0 )
{
// reserve space for standard attributes
mAttributeLocations.reserve( ATTRIB_TYPE_LAST );
- for( int i=0; i<ATTRIB_TYPE_LAST; ++i )
+ for( uint32_t i = 0; i < ATTRIB_TYPE_LAST; ++i )
{
RegisterCustomAttribute( gStdAttribs[i] );
}
// reserve space for standard uniforms
mUniformLocations.reserve( UNIFORM_TYPE_LAST );
// reset built in uniform names in cache
- for( int i = 0; i < UNIFORM_TYPE_LAST; ++i )
+ for( uint32_t i = 0; i < UNIFORM_TYPE_LAST; ++i )
{
RegisterUniform( gStdUniforms[ i ] );
}
{
DALI_LOG_INFO(Debug::Filter::gShader, Debug::General, "Program::Load() - Using Compiled Shader, Size = %d\n", mProgramData->GetBufferSize());
- CHECK_GL( mGlAbstraction, mGlAbstraction.ProgramBinary(mProgramId, mCache.ProgramBinaryFormat(), mProgramData->GetBufferData(), mProgramData->GetBufferSize()) );
+ CHECK_GL( mGlAbstraction, mGlAbstraction.ProgramBinary(mProgramId, mCache.ProgramBinaryFormat(), mProgramData->GetBufferData(), static_cast<GLsizei>( mProgramData->GetBufferSize() ) ) ); // truncated
CHECK_GL( mGlAbstraction, mGlAbstraction.ValidateProgram(mProgramId) );
void Program::ResetAttribsUniformCache()
{
// reset attribute locations
- for( unsigned i = 0; i < mAttributeLocations.size() ; ++i )
+ for( uint32_t i = 0; i < mAttributeLocations.size() ; ++i )
{
mAttributeLocations[ i ].second = ATTRIB_UNKNOWN;
}
// reset all gl uniform locations
- for( unsigned int i = 0; i < mUniformLocations.size(); ++i )
+ for( uint32_t i = 0; i < mUniformLocations.size(); ++i )
{
// reset gl program locations and names
mUniformLocations[ i ].second = UNIFORM_NOT_QUERIED;
// reset uniform caches
mSizeUniformCache.x = mSizeUniformCache.y = mSizeUniformCache.z = 0.f;
- for( int i = 0; i < MAX_UNIFORM_CACHE_SIZE; ++i )
+ for( uint32_t i = 0; i < MAX_UNIFORM_CACHE_SIZE; ++i )
{
// GL initializes uniforms to 0
mUniformCacheInt[ i ] = 0;
#define __DALI_INTERNAL_PROGRAM_H__
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
// EXTERNAL INCLUDES
#include <string>
+#include <cstdint> // int32_t, uint32_t
// INTERNAL INCLUDES
#include <dali/public-api/common/vector-wrapper.h>
class ProgramCache;
-/*
+/**
* A program contains a vertex & fragment shader.
*
- * A program will contain vertex attributes and uniform variables.
- *
- * uColor is set to the value specified by Actor::SetColor and is
- * animatable through the property Actor::COLOR
+ * Program caches some of vertex attribute locations and uniform variable values to reduce unnecessary state changes.
*/
class Program
{
* GLES specification states that minimum uniform count for fragment shader
* is 16 and for vertex shader 128. We're caching the 16 common ones for now
*/
- static const int MAX_UNIFORM_CACHE_SIZE = 16;
+ static const int32_t MAX_UNIFORM_CACHE_SIZE = 16;
/**
* Constant for uniform / attribute not found
*/
- static const int NOT_FOUND = -1;
+ static const int32_t NOT_FOUND = -1;
/**
* Vertex attributes
* @param [in] name attribute name
* @return the index of the attribute name in local cache
*/
- unsigned int RegisterCustomAttribute( const std::string& name );
+ uint32_t RegisterCustomAttribute( const std::string& name );
/**
* Gets the location of a pre-registered attribute.
* @param [in] attributeIndex of the attribute in local cache
* @return the index of the attribute in the GL program
*/
- GLint GetCustomAttributeLocation( unsigned int attributeIndex );
+ GLint GetCustomAttributeLocation( uint32_t attributeIndex );
/**
* Register a uniform name in our local cache
* @param [in] name uniform name
* @return the index of the uniform name in local cache
*/
- unsigned int RegisterUniform( const std::string& name );
+ uint32_t RegisterUniform( const std::string& name );
/**
* Gets the location of a pre-registered uniform.
* @param [in] uniformIndex of the uniform in local cache
* @return the index of the uniform in the GL program
*/
- GLint GetUniformLocation( unsigned int uniformIndex );
+ GLint GetUniformLocation( uint32_t uniformIndex );
/**
* Introspect the newly loaded shader to get the active sampler locations
* @param [out] location The location of the requested sampler
* @return true if the active sampler was found
*/
- bool GetSamplerUniformLocation( unsigned int index, GLint& location );
+ bool GetSamplerUniformLocation( uint32_t index, GLint& location );
/**
* Get the number of active samplers present in the shader
* @return The number of active samplers
*/
- size_t GetActiveSamplerCount() const;
+ uint32_t GetActiveSamplerCount() const;
/**
* Sets the uniform value
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
namespace SceneGraph
{
-Animation* Animation::New( float durationSeconds, float speedFactor, const Vector2& playRange, int loopCount, EndAction endAction, EndAction disconnectAction )
+Animation* Animation::New( float durationSeconds, float speedFactor, const Vector2& playRange, int32_t loopCount, EndAction endAction, EndAction disconnectAction )
{
return new ( gAnimationMemoryPool.AllocateRawThreadSafe() ) Animation( durationSeconds, speedFactor, playRange, loopCount, endAction, disconnectAction );
}
-Animation::Animation( float durationSeconds, float speedFactor, const Vector2& playRange, int loopCount, Dali::Animation::EndAction endAction, Dali::Animation::EndAction disconnectAction )
+Animation::Animation( float durationSeconds, float speedFactor, const Vector2& playRange, int32_t loopCount, Dali::Animation::EndAction endAction, Dali::Animation::EndAction disconnectAction )
: mPlayRange( playRange ),
mDurationSeconds( durationSeconds ),
mDelaySeconds( 0.0f ),
}
}
-void Animation::SetLoopCount(int loopCount)
+void Animation::SetLoopCount(int32_t loopCount)
{
mLoopCount = loopCount;
mCurrentLoop = 0;
if (mState == Playing)
{
// Sign value of speed factor. It can optimize many arithmetic comparision
- int signSpeedFactor = ( mSpeedFactor < 0.0f ) ? -1 : 1;
+ float signSpeedFactor = ( mSpeedFactor < 0.0f ) ? -1.f : 1.f;
// If there is delay time before Animation starts, wait the Animation until mDelaySeconds.
if( mDelaySeconds > 0.0f )
#define __DALI_INTERNAL_SCENE_GRAPH_ANIMATION_H__
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
* @param[in] disconnectAction The action to perform when the property owner of an animator is disconnected.
* @return A new Animation
*/
- static Animation* New( float durationSeconds, float speedFactor, const Vector2& playRange, int loopCount, EndAction endAction, EndAction disconnectAction );
+ static Animation* New( float durationSeconds, float speedFactor, const Vector2& playRange, int32_t loopCount, EndAction endAction, EndAction disconnectAction );
/**
* Virtual destructor
* 0 is loop forever, N loop play N times
* @param[in] loopCount The loop count
*/
- void SetLoopCount(int loopCount);
+ void SetLoopCount(int32_t loopCount);
/**
* Query whether the animation will loop.
* Get the loop count
* @return the loop count
*/
- int GetLoopCount() const
+ int32_t GetLoopCount() const
{
return mLoopCount;
}
* Retrive a count of the number of times the animation has been played to completion.
* This can be used to emit "Finised" signals from the public-api
*/
- int GetPlayedCount() const
+ int32_t GetPlayedCount() const
{
return mPlayedCount;
}
/**
* Get the current loop count from zero to GetLoopCount().
*/
- int GetCurrentLoop() const
+ int32_t GetCurrentLoop() const
{
return mCurrentLoop;
}
/**
* Protected constructor. See New()
*/
- Animation( float durationSeconds, float speedFactor, const Vector2& playRange, int loopCount, EndAction endAction, EndAction disconnectAction );
+ Animation( float durationSeconds, float speedFactor, const Vector2& playRange, int32_t loopCount, EndAction endAction, EndAction disconnectAction );
private:
float mSpeedFactor;
float mProgressMarker; // Progress marker to trigger a notification
- int mPlayedCount; // Incremented at end of animation or completion of all loops
+ int32_t mPlayedCount; // Incremented at end of animation or completion of all loops
// Never incremented when looping forever. Event thread tracks to signal end.
- int mLoopCount; // N loop setting
- int mCurrentLoop; // Current loop number
+ int32_t mLoopCount; // N loop setting
+ int32_t mCurrentLoop; // Current loop number
EndAction mEndAction;
EndAction mDisconnectAction;
typedef MessageValue1< Animation, float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &animation, &Animation::SetDuration, durationSeconds );
typedef MessageValue1< Animation, float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &animation, &Animation::SetProgressNotification, progress );
}
-inline void SetLoopingMessage( EventThreadServices& eventThreadServices, const Animation& animation, int loopCount )
+inline void SetLoopingMessage( EventThreadServices& eventThreadServices, const Animation& animation, int32_t loopCount )
{
- typedef MessageValue1< Animation, int > LocalType;
+ typedef MessageValue1< Animation, int32_t > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &animation, &Animation::SetLoopCount, loopCount );
typedef MessageValue1< Animation, Dali::Animation::EndAction > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &animation, &Animation::SetEndAction, action );
typedef MessageValue1< Animation, Dali::Animation::EndAction > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &animation, &Animation::SetDisconnectAction, action );
typedef MessageValue1< Animation, float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &animation, &Animation::SetCurrentProgress, progress );
typedef MessageValue1< Animation, float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &animation, &Animation::SetSpeedFactor, factor );
typedef MessageValue1< Animation, Vector2 > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &animation, &Animation::SetPlayRange, range );
typedef Message< Animation > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &animation, &Animation::Play );
typedef MessageValue1< Animation,float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &animation, &Animation::PlayFrom, progress );
typedef Message< Animation > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &animation, &Animation::Pause );
typedef MessageValue1< Animation, OwnerPointer<AnimatorBase> > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
OwnerPointer<AnimatorBase> parameter( &animator );
typedef MessageValue1< Animation, float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &animation, &Animation::PlayAfter, delaySeconds );
typedef MessageValue1< Animation, bool > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &animation, &Animation::SetLoopingMode, loopingMode );
*/
// INTERNAL INCLUDES
-#include <dali/devel-api/common/owner-container.h>
-#include <dali/internal/event/animation/key-frames-impl.h>
-#include <dali/internal/event/animation/path-impl.h>
-#include <dali/internal/update/nodes/node.h>
-#include <dali/internal/update/common/property-base.h>
#include <dali/public-api/animation/alpha-function.h>
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/animation/time-period.h>
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/math/quaternion.h>
#include <dali/public-api/math/radian.h>
+#include <dali/devel-api/common/owner-container.h>
+#include <dali/internal/event/animation/key-frames-impl.h>
+#include <dali/internal/event/animation/path-impl.h>
+#include <dali/internal/update/nodes/node.h>
+#include <dali/internal/update/common/property-base.h>
#include <dali/internal/update/animation/property-accessor.h>
#include <dali/integration-api/debug.h>
mSpeedFactor = factor;
}
- void SetLoopCount(int loopCount)
+ void SetLoopCount(int32_t loopCount)
{
mLoopCount = loopCount;
}
float upperBound(1.0f);
float currentT(0.5f);
float currentX = EvaluateCubicBezier( controlPoints.x, controlPoints.z, currentT);
- while( fabs( progress - currentX ) > tolerance )
+ while( fabsf( progress - currentX ) > tolerance )
{
if( progress > currentX )
{
float mIntervalDelaySeconds;
float mSpeedFactor;
- int mLoopCount;
+ int32_t mLoopCount;
AlphaFunction mAlphaFunction;
const PropertyType& current = mPropertyAccessor.Get( bufferIndex );
- const PropertyType result = (*mAnimatorFunction)( alpha, current );
+ // need to cast the return value in case property is integer
+ const PropertyType result = static_cast<PropertyType>( (*mAnimatorFunction)( alpha, current ) );
if ( bake )
{
mPropertyAccessor.Bake( bufferIndex, result );
const T& current = mPropertyAccessor.Get( bufferIndex );
- const T result = (*mAnimatorFunction)( alpha, current );
-
+ // need to cast the return value in case property is integer
+ T result = static_cast<T>( (*mAnimatorFunction)( alpha, current ) );
if ( bake )
{
return property;
}
- virtual float operator()(float progress, const int& property)
+ virtual float operator()(float progress, const int32_t& property)
{
- return property;
+ return static_cast<float>( property );
}
- virtual float operator()(float progress, const unsigned int& property)
+ virtual float operator()(float progress, const uint32_t& property)
{
- return property;
+ return static_cast<float>( property );
}
virtual float operator()(float progress, const float& property)
}
using AnimatorFunctionBase::operator();
- float operator()(float alpha, const int& property)
+ float operator()(float alpha, const int32_t& property)
{
- return int(property + mRelative * alpha + 0.5f );
+ return truncf(static_cast<float>( property ) + static_cast<float>( mRelative ) * alpha + 0.5f );
}
- int mRelative;
+ int32_t mRelative;
};
struct AnimateToInteger : public AnimatorFunctionBase
}
using AnimatorFunctionBase::operator();
- float operator()(float alpha, const int& property)
+ float operator()(float alpha, const int32_t& property)
{
- return int(property + ((mTarget - property) * alpha) + 0.5f);
+ return truncf(static_cast<float>( property ) + (static_cast<float>(mTarget - property) * alpha) + 0.5f);
}
- int mTarget;
+ int32_t mTarget;
};
struct AnimateByFloat : public AnimatorFunctionBase
}
using AnimatorFunctionBase::operator();
- float operator()(float progress, const int& property)
+ float operator()(float progress, const int32_t& property)
{
if(mKeyFrames->IsActive(progress))
{
- return mKeyFrames->GetValue(progress, mInterpolation);
+ return static_cast<float>( mKeyFrames->GetValue(progress, mInterpolation) );
}
- return property;
+ return static_cast<float>( property );
}
KeyFrameIntegerPtr mKeyFrames;
{
#ifdef DEBUG_ENABLED
- unsigned int ConstraintBase::mCurrentInstanceCount = 0;
- unsigned int ConstraintBase::mTotalInstanceCount = 0;
+ uint32_t ConstraintBase::mCurrentInstanceCount = 0;
+ uint32_t ConstraintBase::mTotalInstanceCount = 0;
#endif
ConstraintBase::ConstraintBase( PropertyOwnerContainer& ownerSet, RemoveAction removeAction )
#endif
}
-unsigned int ConstraintBase::GetCurrentInstanceCount()
+uint32_t ConstraintBase::GetCurrentInstanceCount()
{
#ifdef DEBUG_ENABLED
return mCurrentInstanceCount;
#endif
}
-unsigned int ConstraintBase::GetTotalInstanceCount()
+uint32_t ConstraintBase::GetTotalInstanceCount()
{
#ifdef DEBUG_ENABLED
return mTotalInstanceCount;
* Helper for internal test cases; only available for debug builds.
* @return The current number of Constraint instances in existence.
*/
- static unsigned int GetCurrentInstanceCount();
+ static uint32_t GetCurrentInstanceCount();
/**
* Helper for internal test cases; only available for debug builds.
* @return The total number of Constraint instances created during the Dali core lifetime.
*/
- static unsigned int GetTotalInstanceCount();
+ static uint32_t GetTotalInstanceCount();
private:
LifecycleObserver* mLifecycleObserver; ///< Resetter observers this object
#ifdef DEBUG_ENABLED
- static unsigned int mCurrentInstanceCount; ///< The current number of Constraint instances in existence.
- static unsigned int mTotalInstanceCount; ///< The total number of Constraint instances created during the Dali core lifetime.
+ static uint32_t mCurrentInstanceCount; ///< The current number of Constraint instances in existence.
+ static uint32_t mTotalInstanceCount; ///< The total number of Constraint instances created during the Dali core lifetime.
#endif
};
typedef MessageValue1< ConstraintBase, Dali::Constraint::RemoveAction > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &constraint, &ConstraintBase::SetRemoveAction, removeAction );
* However if the property was only "Set" (and not "Baked"), then typically the base value and previous value will not match.
* In this case the reset operation is equivalent to a "Bake", and the value is considered "dirty" for an additional frame.
*/
-static const unsigned int CLEAN_FLAG = 0x00; ///< Indicates that the value did not change in this, or the previous frame
-static const unsigned int BAKED_FLAG = 0x01; ///< Indicates that the value was Baked during the previous frame
-static const unsigned int SET_FLAG = 0x02; ///< Indicates that the value was Set during the previous frame
+static const uint32_t CLEAN_FLAG = 0x00; ///< Indicates that the value did not change in this, or the previous frame
+static const uint32_t BAKED_FLAG = 0x01; ///< Indicates that the value was Baked during the previous frame
+static const uint32_t SET_FLAG = 0x02; ///< Indicates that the value was Set during the previous frame
template <class T>
class AnimatableProperty;
protected: // so that ResetToBaseValue can set it directly
- unsigned int mDirtyFlags; ///< Flag whether value changed during previous 2 frames
+ uint32_t mDirtyFlags; ///< Flag whether value changed during previous 2 frames
};
/**
* @copydoc Dali::SceneGraph::AnimatableProperty::Get()
*/
- bool& Get(size_t bufferIndex)
+ bool& Get( BufferIndex bufferIndex )
{
return mValue[bufferIndex];
}
/**
* @copydoc Dali::SceneGraph::AnimatableProperty::Get()
*/
- const bool& Get(size_t bufferIndex) const
+ const bool& Get( BufferIndex bufferIndex ) const
{
return mValue[bufferIndex];
}
* @param[in] bufferIndex The buffer to read.
* @return The property value.
*/
- bool& operator[](size_t bufferIndex)
+ bool& operator[]( BufferIndex bufferIndex )
{
return mValue[bufferIndex];
}
* @param[in] bufferIndex The buffer to read.
* @return The property value.
*/
- const bool& operator[](size_t bufferIndex) const
+ const bool& operator[]( BufferIndex bufferIndex ) const
{
return mValue[bufferIndex];
}
/**
* @copydoc Dali::SceneGraph::AnimatableProperty::Get()
*/
- int& Get(size_t bufferIndex)
+ int& Get( BufferIndex bufferIndex )
{
return mValue[bufferIndex];
}
/**
* @copydoc Dali::SceneGraph::AnimatableProperty::Get()
*/
- const int& Get(size_t bufferIndex) const
+ const int& Get( BufferIndex bufferIndex ) const
{
return mValue[bufferIndex];
}
* @param[in] bufferIndex The buffer to read.
* @return The property value.
*/
- int& operator[](size_t bufferIndex)
+ int& operator[]( BufferIndex bufferIndex )
{
return mValue[bufferIndex];
}
* @param[in] bufferIndex The buffer to read.
* @return The property value.
*/
- const int& operator[](size_t bufferIndex) const
+ const int& operator[]( BufferIndex bufferIndex ) const
{
return mValue[bufferIndex];
}
/**
* @copydoc Dali::SceneGraph::AnimatableProperty::Get()
*/
- float& Get(size_t bufferIndex)
+ float& Get( BufferIndex bufferIndex )
{
return mValue[bufferIndex];
}
/**
* @copydoc Dali::SceneGraph::AnimatableProperty::Get()
*/
- const float& Get(size_t bufferIndex) const
+ const float& Get( BufferIndex bufferIndex ) const
{
return mValue[bufferIndex];
}
* @param[in] bufferIndex The buffer to read.
* @return The property value.
*/
- float& operator[](size_t bufferIndex)
+ float& operator[]( BufferIndex bufferIndex )
{
return mValue[bufferIndex];
}
* @param[in] bufferIndex The buffer to read.
* @return The property value.
*/
- const float& operator[](size_t bufferIndex) const
+ const float& operator[]( BufferIndex bufferIndex ) const
{
return mValue[bufferIndex];
}
/**
* @copydoc Dali::SceneGraph::AnimatableProperty::Get()
*/
- Vector2& Get(size_t bufferIndex)
+ Vector2& Get( BufferIndex bufferIndex )
{
return mValue[bufferIndex];
}
/**
* @copydoc Dali::SceneGraph::AnimatableProperty::Get()
*/
- const Vector2& Get(size_t bufferIndex) const
+ const Vector2& Get( BufferIndex bufferIndex ) const
{
return mValue[bufferIndex];
}
* @param[in] bufferIndex The buffer to read.
* @return The property value.
*/
- Vector2& operator[](size_t bufferIndex)
+ Vector2& operator[]( BufferIndex bufferIndex )
{
return mValue[bufferIndex];
}
* @param[in] bufferIndex The buffer to read.
* @return The property value.
*/
- const Vector2& operator[](size_t bufferIndex) const
+ const Vector2& operator[]( BufferIndex bufferIndex ) const
{
return mValue[bufferIndex];
}
/**
* @copydoc Dali::SceneGraph::AnimatableProperty::Get()
*/
- Vector3& Get(size_t bufferIndex)
+ Vector3& Get( BufferIndex bufferIndex )
{
return mValue[bufferIndex];
}
/**
* @copydoc Dali::SceneGraph::AnimatableProperty::Get()
*/
- const Vector3& Get(size_t bufferIndex) const
+ const Vector3& Get( BufferIndex bufferIndex ) const
{
return mValue[bufferIndex];
}
* @param[in] bufferIndex The buffer to read.
* @return The property value.
*/
- Vector3& operator[](size_t bufferIndex)
+ Vector3& operator[]( BufferIndex bufferIndex )
{
return mValue[bufferIndex];
}
* @param[in] bufferIndex The buffer to read.
* @return The property value.
*/
- const Vector3& operator[](size_t bufferIndex) const
+ const Vector3& operator[]( BufferIndex bufferIndex ) const
{
return mValue[bufferIndex];
}
/**
* @copydoc Dali::SceneGraph::AnimatableProperty::Get()
*/
- Vector4& Get(size_t bufferIndex)
+ Vector4& Get( BufferIndex bufferIndex )
{
return mValue[bufferIndex];
}
/**
* @copydoc Dali::SceneGraph::AnimatableProperty::Get()
*/
- const Vector4& Get(size_t bufferIndex) const
+ const Vector4& Get( BufferIndex bufferIndex ) const
{
return mValue[bufferIndex];
}
* @param[in] bufferIndex The buffer to read.
* @return The property value.
*/
- Vector4& operator[](size_t bufferIndex)
+ Vector4& operator[]( BufferIndex bufferIndex )
{
return mValue[bufferIndex];
}
* @param[in] bufferIndex The buffer to read.
* @return The property value.
*/
- const Vector4& operator[](size_t bufferIndex) const
+ const Vector4& operator[]( BufferIndex bufferIndex ) const
{
return mValue[bufferIndex];
}
/**
* @copydoc Dali::SceneGraph::AnimatableProperty::Get()
*/
- Quaternion& Get(size_t bufferIndex)
+ Quaternion& Get( BufferIndex bufferIndex )
{
return mValue[bufferIndex];
}
/**
* @copydoc Dali::SceneGraph::AnimatableProperty::Get()
*/
- const Quaternion& Get(size_t bufferIndex) const
+ const Quaternion& Get( BufferIndex bufferIndex ) const
{
return mValue[bufferIndex];
}
* @param[in] bufferIndex The buffer to read.
* @return The property value.
*/
- Quaternion& operator[](size_t bufferIndex)
+ Quaternion& operator[]( BufferIndex bufferIndex )
{
return mValue[bufferIndex];
}
* @param[in] bufferIndex The buffer to read.
* @return The property value.
*/
- const Quaternion& operator[](size_t bufferIndex) const
+ const Quaternion& operator[]( BufferIndex bufferIndex ) const
{
return mValue[bufferIndex];
}
/**
* @copydoc Dali::SceneGraph::AnimatableProperty::Get()
*/
- Matrix& Get(size_t bufferIndex)
+ Matrix& Get( BufferIndex bufferIndex )
{
return mValue[bufferIndex];
}
/**
* @copydoc Dali::SceneGraph::AnimatableProperty::Get()
*/
- const Matrix& Get(size_t bufferIndex) const
+ const Matrix& Get( BufferIndex bufferIndex ) const
{
return mValue[bufferIndex];
}
* @param[in] bufferIndex The buffer to read.
* @return The property value.
*/
- Matrix& operator[](size_t bufferIndex)
+ Matrix& operator[]( BufferIndex bufferIndex )
{
return mValue[bufferIndex];
}
* @param[in] bufferIndex The buffer to read.
* @return The property value.
*/
- const Matrix& operator[](size_t bufferIndex) const
+ const Matrix& operator[]( BufferIndex bufferIndex ) const
{
return mValue[bufferIndex];
}
/**
* @copydoc Dali::SceneGraph::AnimatableProperty::Get()
*/
- Matrix3& Get(size_t bufferIndex)
+ Matrix3& Get( BufferIndex bufferIndex )
{
return mValue[bufferIndex];
}
/**
* @copydoc Dali::SceneGraph::AnimatableProperty::Get()
*/
- const Matrix3& Get(size_t bufferIndex) const
+ const Matrix3& Get( BufferIndex bufferIndex ) const
{
return mValue[bufferIndex];
}
* @param[in] bufferIndex The buffer to read.
* @return The property value.
*/
- Matrix3& operator[](size_t bufferIndex)
+ Matrix3& operator[]( BufferIndex bufferIndex )
{
return mValue[bufferIndex];
}
* @param[in] bufferIndex The buffer to read.
* @return The property value.
*/
- const Matrix3& operator[](size_t bufferIndex) const
+ const Matrix3& operator[]( BufferIndex bufferIndex ) const
{
return mValue[bufferIndex];
}
typedef MessageDoubleBuffered1< SceneGraph::AnimatableProperty<T>, T > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &property,
typedef MessageDoubleBuffered1< SceneGraph::AnimatableProperty<T>, const T& > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &property,
typedef MessageDoubleBuffered1< SceneGraph::AnimatableProperty<T>, float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &property,
typedef MessageDoubleBuffered1< SceneGraph::AnimatableProperty<T>, float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &property,
typedef MessageDoubleBuffered1< SceneGraph::AnimatableProperty<T>, float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &property,
typedef MessageDoubleBuffered1< SceneGraph::AnimatableProperty<T>, float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &property,
#define __DALI_INTERNAL_SCENE_GRAPH_DOUBLE_BUFFERED_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
{
}
- inline T& operator[](const size_t i)
+ inline T& operator[](const BufferIndex i)
{
DALI_ASSERT_DEBUG(i < NUM_SCENE_GRAPH_BUFFERS);
return *(&mValue1+i);
}
- inline const T& operator[](const size_t i) const
+ inline const T& operator[](const BufferIndex i) const
{
DALI_ASSERT_DEBUG(i < NUM_SCENE_GRAPH_BUFFERS);
private:
Setter( DoubleBuffered& object,
- size_t i,
+ BufferIndex i,
T* value )
: mObject( object ),
mIndex( i ),
{
}
- DoubleBuffered& mObject; ///< Double-buffered object that will be changed
- const size_t mIndex; ///< Buffer index that will be changed
- T* mValue; ///< Value of the pointer
+ DoubleBuffered& mObject; ///< Double-buffered object that will be changed
+ const BufferIndex mIndex; ///< Buffer index that will be changed
+ T* mValue; ///< Value of the pointer
friend class DoubleBuffered;
};
delete mValue1;
}
- void Set( size_t i, T* value )
+ void Set( BufferIndex i, T* value )
{
T*& current = *(&mValue1 + i);
T*& previous = *(&mValue1 + 1u-i);
current = value;
}
- Setter operator[](size_t i)
+ Setter operator[]( BufferIndex i )
{
return Setter( *this, i, *(&mValue1+i) );
}
- const T* operator[](size_t i) const
+ const T* operator[]( BufferIndex i ) const
{
DALI_ASSERT_DEBUG(i < NUM_SCENE_GRAPH_BUFFERS);
* Auto-age the property: if it was set the previous frame,
* then copy the value into the current frame's buffer.
*/
- void CopyPrevious( size_t i )
+ void CopyPrevious( BufferIndex i )
{
DALI_ASSERT_DEBUG(i < NUM_SCENE_GRAPH_BUFFERS);
#define __DALI_INTERNAL_SCENE_GRAPH_INHERITED_PROPERTY_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
/**
* @copydoc Dali::SceneGraph::PropertyInterface::Get()
*/
- Vector3& Get(size_t bufferIndex)
+ Vector3& Get( BufferIndex bufferIndex )
{
return mValue[bufferIndex];
}
/**
* @copydoc Dali::SceneGraph::PropertyInterface::Get()
*/
- const Vector3& Get(size_t bufferIndex) const
+ const Vector3& Get( BufferIndex bufferIndex ) const
{
return mValue[bufferIndex];
}
* @param[in] bufferIndex The buffer to read.
* @return The property value.
*/
- const Vector3& operator[](size_t bufferIndex) const
+ const Vector3& operator[]( BufferIndex bufferIndex ) const
{
return mValue[bufferIndex];
}
/**
* @copydoc Dali::SceneGraph::PropertyInterface::Get()
*/
- Vector4& Get(size_t bufferIndex)
+ Vector4& Get( BufferIndex bufferIndex )
{
return mValue[bufferIndex];
}
/**
* @copydoc Dali::SceneGraph::PropertyInterface::Get()
*/
- const Vector4& Get(size_t bufferIndex) const
+ const Vector4& Get( BufferIndex bufferIndex ) const
{
return mValue[bufferIndex];
}
* @param[in] bufferIndex The buffer to read.
* @return The property value.
*/
- const Vector4& operator[](size_t bufferIndex) const
+ const Vector4& operator[]( BufferIndex bufferIndex ) const
{
return mValue[bufferIndex];
}
/**
* @copydoc Dali::SceneGraph::PropertyInterface::Get()
*/
- Quaternion& Get(size_t bufferIndex)
+ Quaternion& Get( BufferIndex bufferIndex )
{
return mValue[bufferIndex];
}
/**
* @copydoc Dali::SceneGraph::PropertyInterface::Get()
*/
- const Quaternion& Get(size_t bufferIndex) const
+ const Quaternion& Get( BufferIndex bufferIndex ) const
{
return mValue[bufferIndex];
}
* @param[in] bufferIndex The buffer to read.
* @return The property value.
*/
- const Quaternion& operator[](size_t bufferIndex) const
+ const Quaternion& operator[]( BufferIndex bufferIndex ) const
{
return mValue[bufferIndex];
}
/**
* @copydoc Dali::SceneGraph::PropertyInterface::Get()
*/
- Matrix& Get(size_t bufferIndex)
+ Matrix& Get( BufferIndex bufferIndex )
{
return mValue[bufferIndex];
}
/**
* @copydoc Dali::SceneGraph::PropertyInterface::Get()
*/
- const Matrix& Get(size_t bufferIndex) const
+ const Matrix& Get( BufferIndex bufferIndex ) const
{
return mValue[bufferIndex];
}
* @param[in] bufferIndex The buffer to read.
* @return The property value.
*/
- const Matrix& operator[](size_t bufferIndex) const
+ const Matrix& operator[]( BufferIndex bufferIndex ) const
{
return mValue[bufferIndex];
}
- void SetDirty(size_t bufferIndex)
+ void SetDirty( BufferIndex bufferIndex )
{
mReinheritedFlag = true;
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
bool LessThan::EvalInteger( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
{
- const int arg0 = arg[0];
+ const int32_t arg0 = static_cast<int32_t>( arg[0] );
return (value.GetInteger() < arg0);
}
bool GreaterThan::EvalInteger( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
{
- const int arg0 = arg[0];
+ const int32_t arg0 = static_cast<int32_t>( arg[0] );
return (value.GetInteger() > arg0);
}
bool Inside::EvalInteger( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
{
- const int valueInteger = value.GetInteger();
- return ( (valueInteger > arg[0]) && (valueInteger < arg[1]) );
+ const int32_t valueInteger = value.GetInteger();
+ return ( ( valueInteger > static_cast<int32_t>( arg[0] ) ) && ( valueInteger < static_cast<int32_t>( arg[1] ) ) );
}
bool Inside::EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
bool Outside::EvalInteger( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
{
- const int valueInteger = value.GetInteger();
- return ( (valueInteger < arg[0]) || (valueInteger > arg[1]) );
+ const int32_t valueInteger = value.GetInteger();
+ return ( ( valueInteger < static_cast<int32_t>( arg[0] ) ) || ( valueInteger > static_cast<int32_t>( arg[0] ) ) );
}
bool Outside::EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
namespace
{
-const int ARGINDEX_REF_VALUE = 0;
-const int ARGINDEX_STEP_SIZE = 1;
-const int ARGINDEX_CURRENT_STEP = 2;
+const int32_t ARGINDEX_REF_VALUE = 0;
+const int32_t ARGINDEX_STEP_SIZE = 1;
+const int32_t ARGINDEX_CURRENT_STEP = 2;
} // namespace
{
const float refValue = arg[ARGINDEX_REF_VALUE];
const float step = arg[ARGINDEX_STEP_SIZE];
- const int currentStep = static_cast<int>(arg[ARGINDEX_CURRENT_STEP]);
+ const int32_t currentStep = static_cast<int32_t>(arg[ARGINDEX_CURRENT_STEP]);
const float distance = (propertyValue - refValue);
// step is actual 1.0f / step so can multiply instead of dividing
- const int newStep = static_cast<int>(floorf(distance * step));
+ const int32_t newStep = static_cast<int32_t>(floorf(distance * step));
if( newStep != currentStep )
{
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
namespace
{
-const int ARGINDEX_STEP_INDEX = 0;
-const int ARGINDEX_LIST_SIZE = 1;
-const int ARGINDEX_LIST_START = 2;
+const int32_t ARGINDEX_STEP_INDEX = 0;
+const int32_t ARGINDEX_LIST_SIZE = 1;
+const int32_t ARGINDEX_LIST_START = 2;
}
bool VariableStep::Evaluate( const float propertyValue, PropertyNotification::RawArgumentContainer& arg )
{
- const int currentIndex = arg[ARGINDEX_STEP_INDEX];
- const int numSteps = arg[ARGINDEX_LIST_SIZE];
+ const int32_t currentIndex = static_cast<int32_t>( arg[ARGINDEX_STEP_INDEX] ); // truncated
+ const int32_t numSteps = static_cast<int32_t>( arg[ARGINDEX_LIST_SIZE] ); // truncated
const float first = arg[ARGINDEX_LIST_START];
const float last = arg[ARGINDEX_LIST_START + (numSteps - 1)];
const bool ascending = (last > first) ? true : false;
- int newIndex = currentIndex;
+ int32_t newIndex = currentIndex;
// avoid loop if property currently not within any of the range values
if( ascending )
newIndex = numSteps - 1;
}
}
- int i = 0;
+ int32_t i = 0;
for( i = 0 ; i < numSteps - 1 ; ++i )
{
const float arg1 = arg[ARGINDEX_LIST_START + i];
#define __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_MESSAGES_H__
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
*
*/
-// INTERNAL INCLUDES
+// EXTERNAL INCLUDES
+#include <string>
+// INTERNAL INCLUDES
#include <dali/internal/event/common/event-thread-services.h>
#include <dali/internal/event/common/property-input-impl.h>
#include <dali/internal/update/common/property-owner.h>
#include <dali/internal/update/animation/scene-graph-constraint-base.h>
-#include <string>
namespace Dali
{
typename ParameterType< P >::PassingType value )
{
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( AnimatablePropertyMessage ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( AnimatablePropertyMessage ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) AnimatablePropertyMessage( sceneObject, property, member, value );
float value )
{
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( AnimatablePropertyComponentMessage ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( AnimatablePropertyComponentMessage ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) AnimatablePropertyComponentMessage( sceneObject, property, member, value );
typedef MessageValue1< PropertyOwner, OwnerPointer<PropertyBase> > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &owner, &PropertyOwner::InstallCustomProperty, property );
typedef MessageValue1< PropertyOwner, OwnerPointer<ConstraintBase> > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &owner, &PropertyOwner::ApplyConstraint, constraint );
typedef MessageValue1< PropertyOwner, ConstraintBase* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &owner, &PropertyOwner::RemoveConstraint, &constraint );
typedef MessageValue1< PropertyOwner, OwnerPointer< UniformPropertyMapping > > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &owner, &PropertyOwner::AddUniformMapping, map );
}
typedef MessageValue1< PropertyOwner, std::string > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &owner, &PropertyOwner::RemoveUniformMapping, uniformName );
}
*
*/
-// EXTERNAL INCLUDES
-
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-vector.h>
#include <dali/devel-api/common/owner-container.h>
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
* limitations under the License.
*/
-#include "uniform-map.h"
+// CLASS HEADER
+#include <dali/internal/update/common/uniform-map.h>
namespace Dali
{
return NULL;
}
-unsigned int UniformMap::Count() const
+UniformMap::SizeType UniformMap::Count() const
{
- return mUniformMaps.Count();
+ return static_cast<UniformMap::SizeType>( mUniformMaps.Count() );
}
-const UniformPropertyMapping& UniformMap::operator[]( unsigned int index ) const
+const UniformPropertyMapping& UniformMap::operator[]( UniformMap::SizeType index ) const
{
return *mUniformMaps[index];
}
#define DALI_INTERNAL_SCENE_GRAPH_UNIFORM_MAP_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
* limitations under the License.
*/
+// EXTERNAL INCLUDES
+#include <string>
+#include <cstdint> // uint32_t
+
+// INTERNAL INCLUDES
#include <dali/devel-api/common/hash.h>
#include <dali/devel-api/common/owner-container.h>
-#include <string>
namespace Dali
{
class UniformMap
{
public:
+ using SizeType = uint32_t;
+
class Observer
{
public:
* Get the count of uniforms in the map
* @return The number of uniform mappings
*/
- unsigned int Count() const;
+ SizeType Count() const;
/**
* @pre index must be in the range 0 :: Count()-1
* @param[in] index The index of the element to fetch
* @return reference to the element in the map
*/
- const UniformPropertyMapping& operator[]( unsigned int index ) const;
+ const UniformPropertyMapping& operator[]( SizeType index ) const;
private:
/**
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
typedef MessageValue1< RenderManager, OwnerPointer< Render::Renderer > > DerivedType;
// Reserve some memory inside the render queue
- unsigned int* slot = mRenderQueue.ReserveMessageSlot( mBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mRenderQueue.ReserveMessageSlot( mBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
new (slot) DerivedType( &mRenderManager, &RenderManager::AddRenderer, renderer );
typedef MessageValue1< RenderManager, Render::Renderer* > DerivedType;
// Reserve some memory inside the render queue
- unsigned int* slot = mRenderQueue.ReserveMessageSlot( mBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mRenderQueue.ReserveMessageSlot( mBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
new (slot) DerivedType( &mRenderManager, &RenderManager::RemoveRenderer, &renderer );
typedef MessageValue1< RenderManager, Render::RenderTracker* > DerivedType;
// Reserve some memory inside the render queue
- unsigned int* slot = mRenderQueue.ReserveMessageSlot( mBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mRenderQueue.ReserveMessageSlot( mBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
new (slot) DerivedType( &mRenderManager, &RenderManager::AddRenderTracker, &renderTracker );
typedef MessageValue1< RenderManager, Render::RenderTracker* > DerivedType;
// Reserve some memory inside the render queue
- unsigned int* slot = mRenderQueue.ReserveMessageSlot( mBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mRenderQueue.ReserveMessageSlot( mBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
new (slot) DerivedType( &mRenderManager, &RenderManager::RemoveRenderTracker, &renderTracker );
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
++iter;
continue;
}
- float previousValueWeight = ( static_cast< float >( MAX_GESTURE_AGE ) - (lastVSyncTime - lastTime) ) / static_cast< float >( MAX_GESTURE_AGE );
+ float previousValueWeight = ( static_cast<float>( MAX_GESTURE_AGE ) - static_cast<float>(lastVSyncTime - lastTime) ) / static_cast<float>( MAX_GESTURE_AGE );
float velMag = currentGesture.screen.velocity.Length();
float velDiff = velMag - screenVelocity.Length();
float acceleration = 0.0f;
}
else
{
- newVelMag = velMag + (((acceleration * (1.0f - previousValueWeight)) + (previousAccel * previousValueWeight)) * currentInterpolation);
+ newVelMag = velMag + (((acceleration * (1.0f - previousValueWeight)) + (previousAccel * previousValueWeight)) * static_cast<float>( currentInterpolation ) );
}
float velMod = 1.0f;
if( velMag > Math::MACHINE_EPSILON_1 )
}
gestureOut.screen.velocity = currentGesture.screen.velocity * velMod;
gestureOut.local.velocity = currentGesture.local.velocity * velMod;
- screenDisplacement = gestureOut.screen.displacement + (gestureOut.screen.velocity * interpolationTime);
- localDisplacement = gestureOut.local.displacement + (gestureOut.local.velocity * interpolationTime);
+ screenDisplacement = gestureOut.screen.displacement + (gestureOut.screen.velocity * static_cast<float>( interpolationTime ) );
+ localDisplacement = gestureOut.local.displacement + (gestureOut.local.velocity * static_cast<float>( interpolationTime ) );
screenVelocity = currentGesture.screen.velocity;
localVelocity = currentGesture.local.velocity;
previousAccel = acceleration;
gesture.screen.displacement = gesture.screen.position - lastGesture.screen.position;
gesture.local.displacement = gesture.local.position - lastGesture.local.position;
// Calculate velocity relative to previous update-frame
- float timeDifference( gesture.time - lastGesture.time );
+ float timeDifference = static_cast<float>( gesture.time - lastGesture.time );
gesture.screen.velocity = gesture.screen.displacement / timeDifference;
gesture.local.velocity = gesture.local.displacement / timeDifference;
}
if( info.eventsThisFrame > 1 )
{
- info.frameGesture.screen.position /= info.eventsThisFrame;
- info.frameGesture.local.position /= info.eventsThisFrame;
- info.frameGesture.screen.velocity /= info.eventsThisFrame;
- info.frameGesture.local.velocity /= info.eventsThisFrame;
+ const float eventsThisFrame = static_cast<float>( info.eventsThisFrame );
+ info.frameGesture.screen.position /= eventsThisFrame;
+ info.frameGesture.local.position /= eventsThisFrame;
+ info.frameGesture.screen.velocity /= eventsThisFrame;
+ info.frameGesture.local.velocity /= eventsThisFrame;
info.frameGesture.screen.displacement = info.frameGesture.screen.position - mLastGesture.screen.position;
info.frameGesture.local.displacement = info.frameGesture.local.position - mLastGesture.local.position;
// Ignore tiny velocity fluctuation to avoid unnecessary prediction amount change
if( fabsf( frameInfo.acceleration ) > ACCELERATION_THRESHOLD )
{
- mCurrentPredictionAmount += mPredictionAmountAdjustment * ( frameInfo.acceleration > Math::MACHINE_EPSILON_0 ? 1.0f : -1.0f );
+ mCurrentPredictionAmount += static_cast<unsigned int>( static_cast<float>( mPredictionAmountAdjustment ) * ( frameInfo.acceleration > Math::MACHINE_EPSILON_0 ? 1.0f : -1.0f ) );
if( mCurrentPredictionAmount > mMaxPredictionAmount + mPredictionAmountAdjustment ) // Guard against unsigned int overflow
{
mCurrentPredictionAmount = 0;
// Some events were read this frame.
if( eventsKeptThisFrame > 1 )
{
- float eventDivisor( eventsKeptThisFrame );
+ const float eventDivisor = static_cast<float>( eventsKeptThisFrame );
rateConvertedGesture.screen.position /= eventDivisor;
rateConvertedGesture.local.position /= eventDivisor;
rateConvertedGesture.screen.velocity /= eventDivisor;
else
{
// If we just started, last velocity was 0. So difference of zero to current velocity over time gives acceleration of the first point.
- newAcceleration.local = outPoint.local.velocity / outputTimeGranularity;
- newAcceleration.screen = outPoint.screen.velocity / outputTimeGranularity;
+ newAcceleration.local = outPoint.local.velocity / static_cast<float>( outputTimeGranularity );
+ newAcceleration.screen = outPoint.screen.velocity / static_cast<float>( outputTimeGranularity );
}
pointGenerated = true;
}
else
{
// We are doing integration based prediction.
- float predictionDelta( mCurrentPredictionAmount );
+ float predictionDelta = static_cast<float>( mCurrentPredictionAmount );
predictedPoint.local.position = startPoint.local.position + ( startPoint.local.velocity * predictionDelta ) +
( accelerationToUse.local * ( predictionDelta * predictionDelta * 0.5f ) );
PanInfo targetPoint;
float outputTimeGranularity( GetDivisibleTimeDifference( nextVSyncTime, lastVSyncTime, 1.0f, OUTPUT_TIME_DIFFERENCE ) );
bool pointGenerated = InterpolatePoint( mPanHistory, nextVSyncTime, nextVSyncTime, mInterpolationTimeRange,
- targetPoint, currentAcceleration, outputTimeGranularity, true );
+ targetPoint, currentAcceleration, static_cast<int>( outputTimeGranularity ), true ); // truncated
if( pointGenerated )
{
mLastInitialAcceleration.local = currentAcceleration.local;
interpolatedAcceleration.local = mLastInterpolatedAcceleration.local;
interpolatedAcceleration.screen = mLastInterpolatedAcceleration.screen;
if( !InterpolatePoint( mPanHistory, nextVSyncTime, pastInterpolateTime, mTwoPointPastInterpolateTime,
- outPoint, interpolatedAcceleration, outputTimeGranularity, false ) )
+ outPoint, interpolatedAcceleration, static_cast<int>( outputTimeGranularity ), false ) ) // truncated
{
if( justStarted )
{
// Perform Multi-tap Smoothing.
RelativeVectors blank;
InterpolatePoint( mPredictionHistory, nextVSyncTime, nextVSyncTime, mMultiTapSmoothingRange,
- targetPoint, blank, outputTimeGranularity, true );
+ targetPoint, blank, static_cast<int>( outputTimeGranularity ), true ); // truncated
}
else
{
-
#ifndef FREE_LIST_H_
#define FREE_LIST_H_
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
*
*/
-//INTERNAL INCLUDES
+// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
+
+// INTERNAL INCLUDES
#include <dali/public-api/common/dali-vector.h>
namespace Dali
* @param[in] value The value to add
* @return The index where the value has been added
*/
- unsigned int Add( unsigned int value )
+ uint32_t Add( uint32_t value )
{
- if( mData.Empty() || mFirstFreeIndex == mData.Size() )
+ const uint32_t size = static_cast<uint32_t>( mData.Size() ); // 4,294,967,295 entries is enough
+ if( mData.Empty() || mFirstFreeIndex == size )
{
//Make room for another item
- size_t size = mData.Size();
- mData.PushBack( size+1 );
+ mData.PushBack( size + 1 );
mFirstFreeIndex = size;
}
//Update first free index
- unsigned int index = mFirstFreeIndex;
+ uint32_t index = mFirstFreeIndex;
mFirstFreeIndex = mData[mFirstFreeIndex];
mData[index] = value;
*
* @param[in] index The index of the element to remove
*/
- void Remove( unsigned int index )
+ void Remove( uint32_t index )
{
mData[index] = mFirstFreeIndex;
mFirstFreeIndex = index;
* @param[in] index Index of the element.
* @return Reference to the element for given index.
*/
- unsigned int& operator[]( unsigned int index )
+ uint32_t& operator[]( uint32_t index )
{
return mData[index];
}
* @param[in] index Index of the element.
* @return Reference to the element for given index.
*/
- unsigned int operator[]( unsigned int index ) const
+ uint32_t operator[]( uint32_t index ) const
{
return mData[index];
}
private:
- Dali::Vector<unsigned int> mData; ///< data
- unsigned int mFirstFreeIndex; ///< Index where a new element will be added
+ Dali::Vector< uint32_t > mData; ///< data
+ uint32_t mFirstFreeIndex; ///< Index where a new element will be added
};
}
{
DALI_LOG_INFO( gRenderListLogFilter, Debug::Verbose, "AddRenderersToRenderList()\n");
- unsigned int rendererCount( renderers.Size() );
- for( unsigned int i(0); i < rendererCount; ++i )
+ for( auto&& renderer : renderers )
{
AddRendererToRenderList( updateBufferIndex,
renderList,
- renderers[i],
+ renderer,
viewMatrix,
camera,
isLayer3d,
RenderableContainer& renderables )
{
bool retValue = false;
- size_t renderableCount = renderables.Size();
+ uint32_t renderableCount = static_cast<uint32_t>( renderables.Size() );
// Check that the cached list originates from this layer and that the counts match
if( ( renderList.GetSourceLayer() == &layer )&&
( renderList.GetCachedItemCount() == renderableCount ) )
// Therefore we check a combined sum of all renderer addresses.
size_t checkSumNew = 0;
size_t checkSumOld = 0;
- for( size_t index = 0; index < renderableCount; ++index )
+ for( uint32_t index = 0; index < renderableCount; ++index )
{
const Render::Renderer& renderer = renderables[index].mRenderer->GetRenderer();
- checkSumNew += size_t( &renderer );
- checkSumOld += size_t( &renderList.GetRenderer( index ) );
+ checkSumNew += reinterpret_cast<std::size_t>( &renderer );
+ checkSumOld += reinterpret_cast<std::size_t>( &renderList.GetRenderer( index ) );
}
if( checkSumNew == checkSumOld )
{
inline void RenderInstructionProcessor::SortRenderItems( BufferIndex bufferIndex, RenderList& renderList, Layer& layer, bool respectClippingOrder )
{
- const size_t renderableCount = renderList.Count();
+ const uint32_t renderableCount = static_cast<uint32_t>( renderList.Count() );
// Reserve space if needed.
- const unsigned int oldcapacity = mSortingHelper.size();
+ const uint32_t oldcapacity = static_cast<uint32_t>( mSortingHelper.size() );
if( oldcapacity < renderableCount )
{
mSortingHelper.reserve( renderableCount );
// Using an if and two for-loops rather than if inside for as its better for branch prediction.
if( layer.UsesDefaultSortFunction() )
{
- for( size_t index = 0; index < renderableCount; ++index )
+ for( uint32_t index = 0; index < renderableCount; ++index )
{
RenderItem& item = renderList.GetItem( index );
mSortingHelper[ index ].textureSet = item.mTextureSet;
// The default sorting function should get inlined here.
- mSortingHelper[ index ].zValue = Internal::Layer::ZValue( item.mModelViewMatrix.GetTranslation3() ) - item.mDepthIndex;
+ mSortingHelper[ index ].zValue = Internal::Layer::ZValue( item.mModelViewMatrix.GetTranslation3() ) - static_cast<float>( item.mDepthIndex );
// Keep the renderitem pointer in the helper so we can quickly reorder items after sort.
mSortingHelper[ index ].renderItem = &item;
else
{
const Dali::Layer::SortFunctionType sortFunction = layer.GetSortFunction();
- for( size_t index = 0; index < renderableCount; ++index )
+ for( uint32_t index = 0; index < renderableCount; ++index )
{
RenderItem& item = renderList.GetItem( index );
mSortingHelper[ index ].textureSet = item.mTextureSet;
- mSortingHelper[ index ].zValue = (*sortFunction)( item.mModelViewMatrix.GetTranslation3() ) - item.mDepthIndex;
+ mSortingHelper[ index ].zValue = (*sortFunction)( item.mModelViewMatrix.GetTranslation3() ) - static_cast<float>( item.mDepthIndex );
// Keep the RenderItem pointer in the helper so we can quickly reorder items after sort.
mSortingHelper[ index ].renderItem = &item;
// Reorder / re-populate the RenderItems in the RenderList to correct order based on the sortinghelper.
DALI_LOG_INFO( gRenderListLogFilter, Debug::Verbose, "Sorted Transparent List:\n");
RenderItemContainer::Iterator renderListIter = renderList.GetContainer().Begin();
- for( unsigned int index = 0; index < renderableCount; ++index, ++renderListIter )
+ for( uint32_t index = 0; index < renderableCount; ++index, ++renderListIter )
{
*renderListIter = mSortingHelper[ index ].renderItem;
DALI_LOG_INFO( gRenderListLogFilter, Debug::Verbose, " sortedList[%d] = %p\n", index, mSortingHelper[ index ].renderItem->mRenderer);
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
DALI_ASSERT_DEBUG( NULL != layer );
- const unsigned int count = node.GetRendererCount();
+ const uint32_t count = node.GetRendererCount();
// Update the clipping Id and depth for this node (if clipping is enabled).
const Dali::ClippingMode::Type clippingMode = node.GetClippingMode();
// Set the information in the node.
node.SetClippingInformation( currentClippingId, clippingDepth, scissorDepth );
- for( unsigned int i = 0; i < count; ++i )
+ for( uint32_t i = 0; i < count; ++i )
{
SceneGraph::Renderer* renderer = node.GetRendererAt( i );
continue;
}
- const unsigned int currentNumberOfInstructions = instructions.Count( updateBufferIndex );
+ const uint32_t currentNumberOfInstructions = instructions.Count( updateBufferIndex );
if( renderTask.IsRenderRequired() )
{
- for( size_t i = 0u, layerCount = sortedLayers.size(); i < layerCount; ++i )
+ for( auto&& sortedLayer : sortedLayers )
{
- sortedLayers[i]->ClearRenderables();
+ sortedLayer->ClearRenderables();
}
AddRenderablesForTask( updateBufferIndex,
if( !processOffscreen && isDefaultRenderTask && renderToFboEnabled && !isRenderingToFbo && hasFrameBuffer )
{
// Traverse the instructions of the default render task and mark them to be rendered into the frame buffer.
- for( unsigned int index = currentNumberOfInstructions, count = instructions.Count( updateBufferIndex ); index < count; ++index )
+ const uint32_t count = instructions.Count( updateBufferIndex );
+ for( uint32_t index = currentNumberOfInstructions; index < count; ++index )
{
RenderInstruction& instruction = instructions.At( updateBufferIndex, index );
instruction.mIgnoreRenderToFbo = true;
#define TRANSFORM_MANAGER_PROPERTY_H_
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
/**
* @copydoc Dali::SceneGraph::AnimatableProperty::Get()
*/
- virtual T& Get(size_t bufferIndex) = 0;
+ virtual T& Get( BufferIndex bufferIndex ) = 0;
/**
* @copydoc Dali::SceneGraph::AnimatableProperty::Get()
*/
- virtual const T& Get(size_t bufferIndex) const = 0;
+ virtual const T& Get( BufferIndex bufferIndex ) const = 0;
/**
* @copydoc Dali::PropertyInput::GetVector3()
* Retrieve a component of property
* @param[in] component The component of the property
*/
- virtual const float& GetFloatComponent(unsigned int component)=0;
+ virtual const float& GetFloatComponent(uint32_t component)=0;
/**
* Set the property value. This will only persist for the current frame; the property
* @param[in] value The new value of the component
* @param[in] component The component of the property
*/
- virtual void SetFloatComponent( float value, unsigned int component){}
+ virtual void SetFloatComponent( float value, uint32_t component){}
/**
* @copydoc Dali::AnimatableProperty::Bake()
* @param[in] value The new value of the component
* @param[in] component The component of the property
*/
- virtual void BakeFloatComponent( float value, unsigned int component){}
+ virtual void BakeFloatComponent( float value, uint32_t component){}
/**
* @copydoc Dali::AnimatableProperty::BakeX()
return Dali::PropertyTypes::Get<Vector3>();
}
- Vector3& Get(size_t bufferIndex)
+ Vector3& Get( BufferIndex bufferIndex )
{
return mTxManager->GetVector3PropertyValue( mId, mProperty );
}
- const Vector3& Get(size_t bufferIndex) const
+ const Vector3& Get( BufferIndex bufferIndex ) const
{
return mTxManager->GetVector3PropertyValue( mId, mProperty );
}
return Get(bufferIndex);
}
- const float& GetFloatComponent( unsigned int component )
+ const float& GetFloatComponent( uint32_t component )
{
return mTxManager->GetVector3PropertyComponentValue( mId, mProperty, component );
}
mTxManager->SetVector3PropertyValue( mId, mProperty, value );
}
- void SetComponent(BufferIndex bufferIndex, float value, unsigned int component)
+ void SetComponent(BufferIndex bufferIndex, float value, uint32_t component)
{
mTxManager->SetVector3PropertyComponentValue( mId, mProperty, value, component);
}
- void BakeComponent(BufferIndex bufferIndex, float value, unsigned int component)
+ void BakeComponent(BufferIndex bufferIndex, float value, uint32_t component)
{
mTxManager->BakeVector3PropertyComponentValue( mId, mProperty, value, component);
}
mTxManager->BakeZVector3PropertyValue(mId, mProperty, value );
}
- void SetFloatComponent( float value, unsigned int component)
+ void SetFloatComponent( float value, uint32_t component)
{
mTxManager->SetVector3PropertyComponentValue( mId, mProperty, value, component);
}
- void BakeFloatComponent( float value, unsigned int component )
+ void BakeFloatComponent( float value, uint32_t component )
{
mTxManager->BakeVector3PropertyComponentValue( mId, mProperty, value, component);
}
return Dali::PropertyTypes::Get<Quaternion>();
}
- Quaternion& Get(size_t bufferIndex)
+ Quaternion& Get( BufferIndex bufferIndex )
{
return mTxManager->GetQuaternionPropertyValue( mId );
}
- const Quaternion& Get(size_t bufferIndex) const
+ const Quaternion& Get( BufferIndex bufferIndex ) const
{
return mTxManager->GetQuaternionPropertyValue( mId );
}
- const float& GetFloatComponent( unsigned int component)
+ const float& GetFloatComponent( uint32_t component)
{
return mTxManager->GetQuaternionPropertyValue( mId ).mVector[component];
}
/**
* @copydoc Dali::SceneGraph::PropertyInterface::Get()
*/
- Vector3& Get(size_t bufferIndex)
+ Vector3& Get( BufferIndex bufferIndex )
{
ComputeTransformComponent();
return mValue;
/**
* @copydoc Dali::SceneGraph::PropertyInterface::Get()
*/
- const Vector3& Get(size_t bufferIndex) const
+ const Vector3& Get( BufferIndex bufferIndex ) const
{
ComputeTransformComponent();
return mValue;
* @param[in] bufferIndex The buffer to read.
* @return The property value.
*/
- const Vector3& operator[](size_t bufferIndex) const
+ const Vector3& operator[]( BufferIndex bufferIndex ) const
{
ComputeTransformComponent();
return mValue;
/**
* @copydoc Dali::SceneGraph::PropertyInterface::Get()
*/
- Quaternion& Get(size_t bufferIndex)
+ Quaternion& Get( BufferIndex bufferIndex )
{
ComputeTransformComponent();
return mValue;
/**
* @copydoc Dali::SceneGraph::PropertyInterface::Get()
*/
- const Quaternion& Get(size_t bufferIndex) const
+ const Quaternion& Get( BufferIndex bufferIndex ) const
{
ComputeTransformComponent();
return mValue;
* @param[in] bufferIndex The buffer to read.
* @return The property value.
*/
- const Quaternion& operator[](size_t bufferIndex) const
+ const Quaternion& operator[]( BufferIndex bufferIndex) const
{
ComputeTransformComponent();
return mValue;
/**
* @copydoc Dali::SceneGraph::PropertyInterface::Get()
*/
- Matrix& Get(size_t bufferIndex)
+ Matrix& Get( BufferIndex bufferIndex )
{
DALI_ASSERT_ALWAYS( mTxManager != 0 );
return mTxManager->GetWorldMatrix(mId);
/**
* @copydoc Dali::SceneGraph::PropertyInterface::Get()
*/
- const Matrix& Get(size_t bufferIndex) const
+ const Matrix& Get( BufferIndex bufferIndex ) const
{
- return GetMatrix(bufferIndex);
+ return GetMatrix( bufferIndex );
}
/**
* @param[in] bufferIndex The buffer to read.
* @return The property value.
*/
- const Matrix& operator[](size_t bufferIndex) const
+ const Matrix& operator[]( BufferIndex bufferIndex ) const
{
- return GetMatrix(bufferIndex);
+ return GetMatrix( bufferIndex );
}
void Initialize( TransformManager* transformManager, TransformId id )
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
{
//Move the last element to the gap
mComponentCount--;
- unsigned int index = mIds[id];
+ TransformId index = mIds[id];
mTxComponentAnimatable[index] = mTxComponentAnimatable[mComponentCount];
mTxComponentStatic[index] = mTxComponentStatic[mComponentCount];
mInheritanceMode[index] = mInheritanceMode[mComponentCount];
void TransformManager::SetParent( TransformId id, TransformId parentId )
{
DALI_ASSERT_ALWAYS( id != parentId );
- unsigned int index = mIds[id];
+ TransformId index = mIds[id];
mParent[ index ] = parentId;
mComponentDirty[ index ] = true;
mReorder = true;
void TransformManager::SetInheritPosition( TransformId id, bool inherit )
{
- unsigned int index = mIds[id];
+ TransformId index = mIds[id];
if( inherit )
{
mInheritanceMode[ index ] |= INHERIT_POSITION;
void TransformManager::SetInheritScale( TransformId id, bool inherit )
{
- unsigned int index = mIds[id];
+ TransformId index = mIds[id];
if( inherit )
{
mInheritanceMode[ index ] |= INHERIT_SCALE;
void TransformManager::SetInheritOrientation( TransformId id, bool inherit )
{
- unsigned int index = mIds[id];
+ TransformId index = mIds[id];
if( inherit )
{
mInheritanceMode[ index ] |= INHERIT_ORIENTATION;
{
if( DALI_LIKELY( mInheritanceMode[i] != DONT_INHERIT_TRANSFORM && mParent[i] != INVALID_TRANSFORM_ID ) )
{
- const unsigned int& parentIndex = mIds[mParent[i] ];
+ const TransformId& parentIndex = mIds[mParent[i] ];
if( DALI_LIKELY( mInheritanceMode[i] == INHERIT_ALL ) )
{
if( mComponentDirty[i] || mLocalMatrixDirty[parentIndex])
mOrderedComponents.Resize(mComponentCount);
TransformId parentId;
- for( size_t i(0); i<mComponentCount; ++i )
+ for( TransformId i = 0; i<mComponentCount; ++i )
{
mOrderedComponents[i].id = mComponentId[i];
mOrderedComponents[i].level = 0u;
}
std::stable_sort( mOrderedComponents.Begin(), mOrderedComponents.End());
- unsigned int previousIndex = 0;
- for( size_t newIndex(0); newIndex<mComponentCount-1; ++newIndex )
+ TransformId previousIndex = 0;
+ for( TransformId newIndex = 0; newIndex < mComponentCount-1; ++newIndex )
{
previousIndex = mIds[mOrderedComponents[newIndex].id];
if( previousIndex != newIndex )
{
case TRANSFORM_PROPERTY_POSITION:
{
- unsigned int index( mIds[id] );
+ TransformId index( mIds[id] );
mComponentDirty[ index ] = true;
return mTxComponentAnimatable[ index ].mPosition;
}
case TRANSFORM_PROPERTY_SCALE:
{
- unsigned int index( mIds[id] );
+ TransformId index( mIds[id] );
mComponentDirty[ index ] = true;
return mTxComponentAnimatable[ index ].mScale;
}
case TRANSFORM_PROPERTY_PARENT_ORIGIN:
{
- unsigned int index( mIds[id] );
+ TransformId index( mIds[id] );
mComponentDirty[ index ] = true;
return mTxComponentStatic[ index ].mParentOrigin;
}
case TRANSFORM_PROPERTY_ANCHOR_POINT:
{
- unsigned int index( mIds[id] );
+ TransformId index( mIds[id] );
mComponentDirty[ index ] = true;
return mTxComponentStatic[ index ].mAnchorPoint;
}
case TRANSFORM_PROPERTY_SIZE:
{
- unsigned int index( mIds[id] );
+ TransformId index( mIds[id] );
mComponentDirty[ index ] = true;
return mSize[ index ];
}
void TransformManager::SetVector3PropertyValue( TransformId id, TransformManagerProperty property, const Vector3& value )
{
- unsigned int index( mIds[id] );
+ TransformId index( mIds[id] );
mComponentDirty[ index ] = true;
switch( property )
void TransformManager::SetVector3PropertyComponentValue( TransformId id, TransformManagerProperty property, float value, unsigned int component )
{
- unsigned int index( mIds[id] );
+ TransformId index( mIds[id] );
mComponentDirty[ index ] = true;
switch( property )
void TransformManager::BakeVector3PropertyValue( TransformId id, TransformManagerProperty property, const Vector3& value )
{
- unsigned int index( mIds[id] );
+ TransformId index( mIds[id] );
mComponentDirty[ index ] = true;
switch( property )
void TransformManager::BakeRelativeVector3PropertyValue( TransformId id, TransformManagerProperty property, const Vector3& value )
{
- unsigned int index( mIds[id] );
+ TransformId index( mIds[id] );
mComponentDirty[ index ] = true;
switch( property )
void TransformManager::BakeMultiplyVector3PropertyValue( TransformId id, TransformManagerProperty property, const Vector3& value )
{
- unsigned int index( mIds[id] );
+ TransformId index( mIds[id] );
mComponentDirty[ index ] = true;
switch( property )
void TransformManager::BakeVector3PropertyComponentValue( TransformId id, TransformManagerProperty property, float value, unsigned int component )
{
- unsigned int index( mIds[id] );
+ TransformId index( mIds[id] );
mComponentDirty[ index ] = true;
switch( property )
void TransformManager::BakeXVector3PropertyValue( TransformId id, TransformManagerProperty property, float value )
{
- unsigned int index( mIds[id] );
+ TransformId index( mIds[id] );
mComponentDirty[ index ] = true;
switch( property )
void TransformManager::BakeYVector3PropertyValue( TransformId id, TransformManagerProperty property, float value )
{
- unsigned int index( mIds[id] );
+ TransformId index( mIds[id] );
mComponentDirty[ index ] = true;
switch( property )
void TransformManager::BakeZVector3PropertyValue( TransformId id, TransformManagerProperty property, float value )
{
- unsigned int index( mIds[id] );
+ TransformId index( mIds[id] );
mComponentDirty[ index ] = true;
switch( property )
Quaternion& TransformManager::GetQuaternionPropertyValue( TransformId id )
{
- unsigned int index( mIds[id] );
+ TransformId index( mIds[id] );
mComponentDirty[ index ] = true;
return mTxComponentAnimatable[ index ].mOrientation;
}
void TransformManager::SetQuaternionPropertyValue( TransformId id, const Quaternion& q )
{
- unsigned int index( mIds[id] );
+ TransformId index( mIds[id] );
mTxComponentAnimatable[ index ].mOrientation = q;
mComponentDirty[ index ] = true;
}
void TransformManager::BakeQuaternionPropertyValue( TransformId id, const Quaternion& q )
{
- unsigned int index( mIds[id] );
+ TransformId index( mIds[id] );
mTxComponentAnimatable[ index ].mOrientation = mTxComponentAnimatableBaseValue[index].mOrientation = q;
mComponentDirty[ index ] = true;
}
void TransformManager::BakeRelativeQuaternionPropertyValue( TransformId id, const Quaternion& q )
{
- unsigned int index( mIds[id] );
+ TransformId index( mIds[id] );
mTxComponentAnimatable[ index ].mOrientation = mTxComponentAnimatableBaseValue[index].mOrientation = mTxComponentAnimatable[ index ].mOrientation * q;
mComponentDirty[ index ] = true;
}
void TransformManager::GetWorldMatrixAndSize( TransformId id, Matrix& worldMatrix, Vector3& size ) const
{
- unsigned int index = mIds[id];
+ TransformId index = mIds[id];
worldMatrix = mWorld[index];
size = mSize[index];
}
void TransformManager::SetPositionUsesAnchorPoint( TransformId id, bool value )
{
- unsigned int index( mIds[ id ] );
+ TransformId index( mIds[ id ] );
mComponentDirty[ index ] = true;
mTxComponentStatic[ index ].mPositionUsesAnchorPoint = value;
}
#define DALI_INTERNAL_TRANSFORM_MANAGER_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
TRANSFORM_PROPERTY_COUNT,
};
-typedef unsigned int TransformId;
+typedef uint32_t TransformId; // 4,294,967,295 transforms supported
static const TransformId INVALID_TRANSFORM_ID = -1;
} //SceneGraph
* @param[in] property The property
* param[in] component The component (0,1,2)
*/
- const float& GetVector3PropertyComponentValue(TransformId id, TransformManagerProperty property, unsigned int component ) const;
+ const float& GetVector3PropertyComponentValue( TransformId id, TransformManagerProperty property, uint32_t component ) const;
/**
* Set the value of a Vector3 property
* @param[in] value The new value
* param[in] component The component (0,1,2)
*/
- void SetVector3PropertyComponentValue( TransformId id, TransformManagerProperty property, float value, unsigned int component );
+ void SetVector3PropertyComponentValue( TransformId id, TransformManagerProperty property, float value, uint32_t component );
/**
* Bakes the value of a Vector3 property
* @param[in] property The property
* @param[in] value The new value
*/
- void BakeVector3PropertyComponentValue( TransformId id, TransformManagerProperty property, float value, unsigned int component );
+ void BakeVector3PropertyComponentValue( TransformId id, TransformManagerProperty property, float value, uint32_t component );
/**
* Bakes the value of the x component of Vector3 property
bool operator<(const SOrderItem& item) const {return level < item.level;}
TransformId id;
- unsigned int level;
+ uint32_t level;
};
/**
* @param[in] i Index of a component
* @param[in] j Index of a component
*/
- void SwapComponents( unsigned int i, unsigned int j );
+ void SwapComponents( uint32_t i, uint32_t j );
/**
* Reorders components in hierarchical order so update can iterate sequentially
*/
void ReorderComponents();
- unsigned int mComponentCount; ///< Total number of components
- FreeList mIds; ///< FreeList of Ids
- Vector< TransformComponentAnimatable > mTxComponentAnimatable; ///< Animatable part of the components
- Vector< TransformComponentStatic > mTxComponentStatic; ///< Static part of the components
- Vector< unsigned int > mInheritanceMode; ///< Inheritance mode of the components
- Vector< TransformId > mComponentId; ///< Ids of the components
- Vector< Vector3 > mSize; ///< Size of the components
- Vector< TransformId > mParent; ///< Parent of the components
- Vector< Matrix > mWorld; ///< Local to world transform of the components
- Vector< Matrix > mLocal; ///< Local to parent space transform of the components
- Vector< Vector4 > mBoundingSpheres; ///< Bounding spheres. xyz is the center and w is the radius
- Vector< TransformComponentAnimatable > mTxComponentAnimatableBaseValue; ///< Base values for the animatable part of the components
- Vector< Vector3 > mSizeBase; ///< Base value for the size of the components
- Vector< bool > mComponentDirty; ///< 1u if some of the parts of the component has changed in this frame, 0 otherwise
- Vector< bool > mLocalMatrixDirty; ///< 1u if the local matrix has been updated in this frame, 0 otherwise
- Vector< SOrderItem > mOrderedComponents; ///< Used to reorder components when hierarchy changes
- bool mReorder; ///< Flag to determine if the components have to reordered in the next Update
+ uint32_t mComponentCount; ///< Total number of components
+ FreeList mIds; ///< FreeList of Ids
+ Vector< TransformComponentAnimatable > mTxComponentAnimatable; ///< Animatable part of the components
+ Vector< TransformComponentStatic > mTxComponentStatic; ///< Static part of the components
+ Vector< uint32_t > mInheritanceMode; ///< Inheritance mode of the components
+ Vector< TransformId > mComponentId; ///< Ids of the components
+ Vector< Vector3 > mSize; ///< Size of the components
+ Vector< TransformId > mParent; ///< Parent of the components
+ Vector< Matrix > mWorld; ///< Local to world transform of the components
+ Vector< Matrix > mLocal; ///< Local to parent space transform of the components
+ Vector< Vector4 > mBoundingSpheres; ///< Bounding spheres. xyz is the center and w is the radius
+ Vector< TransformComponentAnimatable > mTxComponentAnimatableBaseValue; ///< Base values for the animatable part of the components
+ Vector< Vector3 > mSizeBase; ///< Base value for the size of the components
+ Vector< bool > mComponentDirty; ///< 1u if some of the parts of the component has changed in this frame, 0 otherwise
+ Vector< bool > mLocalMatrixDirty; ///< 1u if the local matrix has been updated in this frame, 0 otherwise
+ Vector< SOrderItem > mOrderedComponents; ///< Used to reorder components when hierarchy changes
+ bool mReorder; ///< Flag to determine if the components have to reordered in the next Update
};
} //namespace SceneGraph
#if ( defined( DEBUG_ENABLED ) && defined( NODE_TREE_LOGGING ) )
#define SNAPSHOT_NODE_LOGGING \
-const int FRAME_COUNT_TRIGGER = 16;\
+const uint32_t FRAME_COUNT_TRIGGER = 16;\
if( mImpl->frameCounter >= FRAME_COUNT_TRIGGER )\
{\
if ( NULL != mImpl->root )\
float keepRenderingSeconds; ///< Set via Dali::Stage::KeepRendering
NodePropertyFlags nodeDirtyFlags; ///< cumulative node dirty flags from previous frame
- int frameCounter; ///< Frame counter used in debugging to choose which frame to debug and which to ignore.
+ uint32_t frameCounter; ///< Frame counter used in debugging to choose which frame to debug and which to ignore.
DevelStage::Rendering renderingBehavior; ///< Set via DevelStage::SetRenderingBehavior
typedef MessageValue3< Shader, Internal::ShaderDataPtr, ProgramCache*, bool> DerivedType;
// Reserve some memory inside the render queue
- unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
new (slot) DerivedType( shader, &Shader::SetProgram, shaderData, mImpl->renderManager.GetProgramCache(), modifiesGeometry );
}
}
-unsigned int* UpdateManager::ReserveMessageSlot( std::size_t size, bool updateScene )
+uint32_t* UpdateManager::ReserveMessageSlot( uint32_t size, bool updateScene )
{
return mImpl->messageQueue.ReserveMessageSlot( size, updateScene );
}
}
}
-bool UpdateManager::ProcessGestures( BufferIndex bufferIndex, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds )
+bool UpdateManager::ProcessGestures( BufferIndex bufferIndex, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds )
{
bool gestureUpdated( false );
void UpdateManager::UpdateRenderers( BufferIndex bufferIndex )
{
- const unsigned int rendererCount = mImpl->renderers.Count();
- for( unsigned int i = 0; i < rendererCount; ++i )
+ for( auto&& renderer : mImpl->renderers )
{
//Apply constraints
- ConstrainPropertyOwner( *mImpl->renderers[i], bufferIndex );
+ ConstrainPropertyOwner( *renderer, bufferIndex );
- mImpl->renderers[i]->PrepareRender( bufferIndex );
+ renderer->PrepareRender( bufferIndex );
}
}
}
}
-unsigned int UpdateManager::Update( float elapsedSeconds,
- unsigned int lastVSyncTimeMilliseconds,
- unsigned int nextVSyncTimeMilliseconds,
- bool renderToFboEnabled,
- bool isRenderingToFbo )
+uint32_t UpdateManager::Update( float elapsedSeconds,
+ uint32_t lastVSyncTimeMilliseconds,
+ uint32_t nextVSyncTimeMilliseconds,
+ bool renderToFboEnabled,
+ bool isRenderingToFbo )
{
const BufferIndex bufferIndex = mSceneGraphBuffers.GetUpdateBufferIndex();
ConstrainCustomObjects( bufferIndex );
//Clear the lists of renderers from the previous update
- for( size_t i(0); i<mImpl->sortedLayers.size(); ++i )
+ for( auto&& layer : mImpl->sortedLayers )
{
- mImpl->sortedLayers[i]->ClearRenderables();
+ layer->ClearRenderables();
}
- for( size_t i(0); i<mImpl->systemLevelSortedLayers.size(); ++i )
+ for( auto&& layer : mImpl->systemLevelSortedLayers )
{
- mImpl->systemLevelSortedLayers[i]->ClearRenderables();
+ layer->ClearRenderables();
}
//Update node hierarchy, apply constraints and perform sorting / culling.
//reset the update buffer index and make sure there is enough room in the instruction container
if( mImpl->renderersAdded )
{
- mImpl->renderInstructions.ResetAndReserve( bufferIndex,
- mImpl->taskList.GetTasks().Count() + mImpl->systemLevelTaskList.GetTasks().Count() );
+ mImpl->renderInstructions.ResetAndReserve( bufferIndex, mImpl->taskList.GetTaskCount() + mImpl->systemLevelTaskList.GetTaskCount() );
if ( NULL != mImpl->root )
{
mImpl->previousUpdateScene = updateScene;
// Check whether further updates are required
- unsigned int keepUpdating = KeepUpdatingCheck( elapsedSeconds );
+ uint32_t keepUpdating = KeepUpdatingCheck( elapsedSeconds );
// tell the update manager that we're done so the queue can be given to event thread
mImpl->notificationManager.UpdateCompleted();
return keepUpdating;
}
-unsigned int UpdateManager::KeepUpdatingCheck( float elapsedSeconds ) const
+uint32_t UpdateManager::KeepUpdatingCheck( float elapsedSeconds ) const
{
// Update the duration set via Stage::KeepRendering()
if ( mImpl->keepRenderingSeconds > 0.0f )
mImpl->keepRenderingSeconds -= elapsedSeconds;
}
- unsigned int keepUpdatingRequest = KeepUpdating::NOT_REQUESTED;
+ uint32_t keepUpdatingRequest = KeepUpdating::NOT_REQUESTED;
// If the rendering behavior is set to continuously render, then continue to render.
// If Stage::KeepRendering() has been called, then continue until the duration has elapsed.
typedef MessageValue1< RenderManager, Vector4 > DerivedType;
// Reserve some memory inside the render queue
- unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::SetBackgroundColor, color );
}
-void UpdateManager::SetDefaultSurfaceRect( const Rect<int>& rect )
+void UpdateManager::SetDefaultSurfaceRect( const Rect<int32_t>& rect )
{
mImpl->surfaceRectChanged = true;
- typedef MessageValue1< RenderManager, Rect<int> > DerivedType;
+ typedef MessageValue1< RenderManager, Rect<int32_t> > DerivedType;
// Reserve some memory inside the render queue
- unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::SetDefaultSurfaceRect, rect );
typedef MessageValue1< RenderManager, OwnerPointer< Render::Sampler > > DerivedType;
// Reserve some memory inside the render queue
- unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::AddSampler, sampler );
typedef MessageValue1< RenderManager, Render::Sampler* > DerivedType;
// Reserve some memory inside the render queue
- unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::RemoveSampler, sampler );
}
-void UpdateManager::SetFilterMode( Render::Sampler* sampler, unsigned int minFilterMode, unsigned int magFilterMode )
+void UpdateManager::SetFilterMode( Render::Sampler* sampler, uint32_t minFilterMode, uint32_t magFilterMode )
{
- typedef MessageValue3< RenderManager, Render::Sampler*, unsigned int, unsigned int > DerivedType;
+ typedef MessageValue3< RenderManager, Render::Sampler*, uint32_t, uint32_t > DerivedType;
// Reserve some memory inside the render queue
- unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::SetFilterMode, sampler, minFilterMode, magFilterMode );
}
-void UpdateManager::SetWrapMode( Render::Sampler* sampler, unsigned int rWrapMode, unsigned int sWrapMode, unsigned int tWrapMode )
+void UpdateManager::SetWrapMode( Render::Sampler* sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode )
{
- typedef MessageValue4< RenderManager, Render::Sampler*, unsigned int, unsigned int, unsigned int > DerivedType;
+ typedef MessageValue4< RenderManager, Render::Sampler*, uint32_t, uint32_t, uint32_t > DerivedType;
// Reserve some memory inside the render queue
- unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::SetWrapMode, sampler, rWrapMode, sWrapMode, tWrapMode );
typedef MessageValue1< RenderManager, OwnerPointer< Render::PropertyBuffer > > DerivedType;
// Reserve some memory inside the render queue
- unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::AddPropertyBuffer, propertyBuffer );
typedef MessageValue1< RenderManager, Render::PropertyBuffer* > DerivedType;
// Reserve some memory inside the render queue
- unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::RemovePropertyBuffer, propertyBuffer );
typedef MessageValue2< RenderManager, Render::PropertyBuffer*, OwnerPointer< Render::PropertyBuffer::Format > > DerivedType;
// Reserve some memory inside the render queue
- unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::SetPropertyBufferFormat, propertyBuffer, format );
}
-void UpdateManager::SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector<char> >& data, size_t size )
+void UpdateManager::SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector<uint8_t> >& data, uint32_t size )
{
// Message has ownership of format while in transit from update -> render
- typedef MessageValue3< RenderManager, Render::PropertyBuffer*, OwnerPointer< Dali::Vector<char> >, size_t > DerivedType;
+ typedef MessageValue3< RenderManager, Render::PropertyBuffer*, OwnerPointer< Dali::Vector<uint8_t> >, uint32_t > DerivedType;
// Reserve some memory inside the render queue
- unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::SetPropertyBufferData, propertyBuffer, data, size );
typedef MessageValue1< RenderManager, OwnerPointer< Render::Geometry > > DerivedType;
// Reserve some memory inside the render queue
- unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::AddGeometry, geometry );
typedef MessageValue1< RenderManager, Render::Geometry* > DerivedType;
// Reserve some memory inside the render queue
- unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::RemoveGeometry, geometry );
}
-void UpdateManager::SetGeometryType( Render::Geometry* geometry, unsigned int geometryType )
+void UpdateManager::SetGeometryType( Render::Geometry* geometry, uint32_t geometryType )
{
- typedef MessageValue2< RenderManager, Render::Geometry*, unsigned int > DerivedType;
+ typedef MessageValue2< RenderManager, Render::Geometry*, uint32_t > DerivedType;
// Reserve some memory inside the render queue
- unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::SetGeometryType, geometry, geometryType );
}
-void UpdateManager::SetIndexBuffer( Render::Geometry* geometry, Dali::Vector<unsigned short>& indices )
+void UpdateManager::SetIndexBuffer( Render::Geometry* geometry, Dali::Vector<uint16_t>& indices )
{
typedef IndexBufferMessage< RenderManager > DerivedType;
// Reserve some memory inside the render queue
- unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
new (slot) DerivedType( &mImpl->renderManager, geometry, indices );
typedef MessageValue2< RenderManager, Render::Geometry*, Render::PropertyBuffer* > DerivedType;
// Reserve some memory inside the render queue
- unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::RemoveVertexBuffer, geometry, propertyBuffer );
typedef MessageValue2< RenderManager, Render::Geometry*, Render::PropertyBuffer* > DerivedType;
// Reserve some memory inside the render queue
- unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::AttachVertexBuffer, geometry, propertyBuffer );
typedef MessageValue1< RenderManager, OwnerPointer< Render::Texture > > DerivedType;
// Reserve some memory inside the render queue
- unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::AddTexture, texture );
typedef MessageValue1< RenderManager, Render::Texture* > DerivedType;
// Reserve some memory inside the render queue
- unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::RemoveTexture, texture );
typedef MessageValue3< RenderManager, Render::Texture*, PixelDataPtr, Texture::UploadParams > DerivedType;
// Reserve some memory inside the message queue
- unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::UploadTexture, texture, pixelData, params );
typedef MessageValue1< RenderManager, Render::Texture* > DerivedType;
// Reserve some memory inside the render queue
- unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::GenerateMipmaps, texture );
typedef MessageValue1< RenderManager, Render::FrameBuffer* > DerivedType;
// Reserve some memory inside the render queue
- unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::AddFrameBuffer, frameBuffer );
typedef MessageValue1< RenderManager, Render::FrameBuffer* > DerivedType;
// Reserve some memory inside the render queue
- unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::RemoveFrameBuffer, frameBuffer );
}
-void UpdateManager::AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, unsigned int mipmapLevel, unsigned int layer )
+void UpdateManager::AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer )
{
- typedef MessageValue4< RenderManager, Render::FrameBuffer*, Render::Texture*, unsigned int, unsigned int > DerivedType;
+ typedef MessageValue4< RenderManager, Render::FrameBuffer*, Render::Texture*, uint32_t, uint32_t > DerivedType;
// Reserve some memory inside the render queue
- unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+ uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::AttachColorTextureToFrameBuffer, frameBuffer, texture, mipmapLevel, layer );
* @note the default value of updateScene should match that in EventThreadServices::ReserveMessageSlot.
* @return A pointer to the first char allocated for the message.
*/
- unsigned int* ReserveMessageSlot( std::size_t size, bool updateScene = true );
+ uint32_t* ReserveMessageSlot( uint32_t size, bool updateScene = true );
/**
* @return the current event-buffer index.
* @param[in] minFilterMode The filter to use under minification
* @param[in] magFilterMode The filter to use under magnification
*/
- void SetFilterMode( Render::Sampler* sampler, unsigned int minFilterMode, unsigned int magFilterMode );
+ void SetFilterMode( Render::Sampler* sampler, uint32_t minFilterMode, uint32_t magFilterMode );
/**
* Sets the wrap mode for an existing sampler
* @param[in] sWrapMode Wrapping mode in x direction
* @param[in] tWrapMode Wrapping mode in y direction
*/
- void SetWrapMode( Render::Sampler* sampler, unsigned int rWrapMode, unsigned int sWrapMode, unsigned int tWrapMode );
+ void SetWrapMode( Render::Sampler* sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode );
/**
* Add a new property buffer to RenderManager
* @param[in] size The new size of the buffer
* @post Sends a message to RenderManager to set the new data to the property buffer.
*/
- void SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector<char> >& data, size_t size );
+ void SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector<uint8_t> >& data, uint32_t size );
/**
* Adds a geometry to the RenderManager
* @param[in] geometry The geometry
* @param[in] geometryType The type of the geometry
*/
- void SetGeometryType( Render::Geometry* geometry, unsigned int geometryType );
+ void SetGeometryType( Render::Geometry* geometry, uint32_t geometryType );
/**
* Sets the index buffer to be used by a geometry
* @param[in] geometry The geometry
* @param[in] indices A vector containing the indices for the geometry
*/
- void SetIndexBuffer( Render::Geometry* geometry, Dali::Vector<unsigned short>& indices );
+ void SetIndexBuffer( Render::Geometry* geometry, Dali::Vector<uint16_t>& indices );
/**
* Adds a vertex buffer to a geometry
* @param[in] mipmapLevel The mipmap of the texture to be attached
* @param[in] layer Indicates which layer of a cube map or array texture to attach. Unused for 2D textures
*/
- void AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, unsigned int mipmapLevel, unsigned int face );
+ void AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t face );
public:
* @param[in] isRenderingToFbo Whether this frame is being rendered into the Frame Buffer Object.
* @return True if further updates are required e.g. during animations.
*/
- unsigned int Update( float elapsedSeconds,
- unsigned int lastVSyncTimeMilliseconds,
- unsigned int nextVSyncTimeMilliseconds,
- bool renderToFboEnabled,
- bool isRenderingToFbo );
+ uint32_t Update( float elapsedSeconds,
+ uint32_t lastVSyncTimeMilliseconds,
+ uint32_t nextVSyncTimeMilliseconds,
+ bool renderToFboEnabled,
+ bool isRenderingToFbo );
/**
* Set the background color i.e. the glClear color used at the beginning of each frame.
* @param[in] elapsedSeconds The time in seconds since the previous update.
* @return True if the update-thread should keep going.
*/
- unsigned int KeepUpdatingCheck( float elapsedSeconds ) const;
+ uint32_t KeepUpdatingCheck( float elapsedSeconds ) const;
/**
* Helper to reset all Node properties
* @param[in] nextVSyncTime The estimated time of the next VSync in milliseconds.
* @return true, if any properties were updated.
*/
- bool ProcessGestures( BufferIndex bufferIndex, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds );
+ bool ProcessGestures( BufferIndex bufferIndex, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds );
/**
* Perform animation updates
typedef MessageValue2< UpdateManager, OwnerPointer<Layer>, bool > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::InstallRoot, root, systemLevel );
typedef MessageValue1< UpdateManager, OwnerPointer<Node> > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::AddNode, node );
typedef MessageValue2< UpdateManager, Node*, Node* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::ConnectNode, &parent, &child );
typedef MessageValue1< UpdateManager, Node* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::DisconnectNode, &node );
typedef MessageValue1< UpdateManager, Node* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::DestroyNode, &node );
typedef MessageValue1< UpdateManager, OwnerPointer< Camera > > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::AddCamera, camera );
typedef MessageValue1< UpdateManager, const Camera* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::RemoveCamera, camera );
typedef MessageValue1< UpdateManager, OwnerPointer<PropertyOwner> > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::AddObject, object );
typedef MessageValue1< UpdateManager, PropertyOwner* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::RemoveObject, object );
typedef MessageValue1< UpdateManager, OwnerPointer< SceneGraph::Animation > > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::AddAnimation, animation );
typedef MessageValue1< UpdateManager, Animation* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::StopAnimation, &animation );
typedef MessageValue1< UpdateManager, Animation* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::RemoveAnimation, &animation );
typedef MessageValue1< UpdateManager, OwnerPointer< PropertyNotification > > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::AddPropertyNotification, propertyNotification );
typedef MessageValue1< UpdateManager, PropertyNotification* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::RemovePropertyNotification, &propertyNotification );
typedef MessageValue2< UpdateManager, PropertyNotification*, PropertyNotification::NotifyMode > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::PropertyNotificationSetNotify, propertyNotification, notifyMode );
typedef MessageValue1< UpdateManager, OwnerPointer< Shader > > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::AddShader, shader );
typedef MessageValue1< UpdateManager, Shader* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::RemoveShader, &shader );
typedef MessageValue3< UpdateManager, Shader*, Internal::ShaderDataPtr, bool > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::SetShaderProgram, &shader, shaderData, modifiesGeometry );
typedef MessageValue1< UpdateManager, Vector4 > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::SetBackgroundColor, color );
}
-inline void SetDefaultSurfaceRectMessage( UpdateManager& manager, const Rect<int>& rect )
+inline void SetDefaultSurfaceRectMessage( UpdateManager& manager, const Rect<int32_t>& rect )
{
- typedef MessageValue1< UpdateManager, Rect<int> > LocalType;
+ typedef MessageValue1< UpdateManager, Rect<int32_t> > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::SetDefaultSurfaceRect, rect );
typedef MessageValue1< UpdateManager, float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::KeepRendering, durationSeconds );
typedef MessageValue1< UpdateManager, DevelStage::Rendering > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::SetRenderingBehavior, renderingBehavior );
typedef MessageValue2< UpdateManager, std::vector< Layer* >, bool > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::SetLayerDepths, layers, systemLevel );
typedef MessageValue1< UpdateManager, OwnerPointer< Renderer > > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::AddRenderer, object );
}
typedef MessageValue1< UpdateManager, Renderer* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::RemoveRenderer, &object );
}
typedef MessageValue1< UpdateManager, OwnerPointer< TextureSet > > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::AddTextureSet, textureSet );
typedef MessageValue1< UpdateManager, TextureSet* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::RemoveTextureSet, &textureSet );
typedef MessageValue1< UpdateManager, OwnerPointer< Render::Sampler > > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::AddSampler, sampler );
typedef MessageValue1< UpdateManager, Render::Sampler* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::RemoveSampler, &sampler );
}
-inline void SetFilterModeMessage( UpdateManager& manager, Render::Sampler& sampler, unsigned int minFilterMode, unsigned int magFilterMode )
+inline void SetFilterModeMessage( UpdateManager& manager, Render::Sampler& sampler, uint32_t minFilterMode, uint32_t magFilterMode )
{
- typedef MessageValue3< UpdateManager, Render::Sampler*, unsigned int, unsigned int > LocalType;
+ typedef MessageValue3< UpdateManager, Render::Sampler*, uint32_t, uint32_t > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::SetFilterMode, &sampler, minFilterMode, magFilterMode );
}
-inline void SetWrapModeMessage( UpdateManager& manager, Render::Sampler& sampler, unsigned int rWrapMode, unsigned int sWrapMode, unsigned int tWrapMode )
+inline void SetWrapModeMessage( UpdateManager& manager, Render::Sampler& sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode )
{
- typedef MessageValue4< UpdateManager, Render::Sampler*, unsigned int, unsigned int, unsigned int > LocalType;
+ typedef MessageValue4< UpdateManager, Render::Sampler*, uint32_t, uint32_t, uint32_t > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::SetWrapMode, &sampler, rWrapMode, sWrapMode, tWrapMode );
typedef MessageValue1< UpdateManager, OwnerPointer< Render::PropertyBuffer > > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::AddPropertyBuffer, propertyBuffer );
typedef MessageValue1< UpdateManager, Render::PropertyBuffer* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::RemovePropertyBuffer, &propertyBuffer );
typedef MessageValue2< UpdateManager, Render::PropertyBuffer*, OwnerPointer< Render::PropertyBuffer::Format> > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::SetPropertyBufferFormat, &propertyBuffer, format );
}
-inline void SetPropertyBufferData( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, OwnerPointer< Vector<char> >& data, size_t size )
+inline void SetPropertyBufferData( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, OwnerPointer< Vector<uint8_t> >& data, uint32_t size )
{
// Message has ownership of PropertyBuffer data while in transit from event -> update
- typedef MessageValue3< UpdateManager, Render::PropertyBuffer*, OwnerPointer< Vector<char> >, size_t > LocalType;
+ typedef MessageValue3< UpdateManager, Render::PropertyBuffer*, OwnerPointer< Vector<uint8_t> >, uint32_t > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::SetPropertyBufferData, &propertyBuffer, data, size );
typedef MessageValue1< UpdateManager, OwnerPointer< Render::Geometry > > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::AddGeometry, geometry );
typedef MessageValue1< UpdateManager, Render::Geometry* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::RemoveGeometry, &geometry );
typedef MessageValue2< UpdateManager, Render::Geometry*, Render::PropertyBuffer* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::AttachVertexBuffer, &geometry, const_cast<Render::PropertyBuffer*>(&vertexBuffer) );
typedef MessageValue2< UpdateManager, Render::Geometry*, Render::PropertyBuffer* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::RemoveVertexBuffer, &geometry, const_cast<Render::PropertyBuffer*>(&vertexBuffer) );
/**
* Constructor which does a Vector::Swap()
*/
- IndexBufferMessage( T* manager, Render::Geometry* geometry, Dali::Vector<unsigned short>& indices )
+ IndexBufferMessage( T* manager, Render::Geometry* geometry, Dali::Vector<uint16_t>& indices )
: MessageBase(),
mManager( manager ),
mRenderGeometry( geometry )
T* mManager;
Render::Geometry* mRenderGeometry;
- Dali::Vector<unsigned short> mIndices;
+ Dali::Vector<uint16_t> mIndices;
};
-inline void SetIndexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, Dali::Vector<unsigned short>& indices )
+inline void SetIndexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, Dali::Vector<uint16_t>& indices )
{
typedef IndexBufferMessage< UpdateManager > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &geometry, indices );
}
-inline void SetGeometryTypeMessage( UpdateManager& manager, Render::Geometry& geometry, unsigned int geometryType )
+inline void SetGeometryTypeMessage( UpdateManager& manager, Render::Geometry& geometry, uint32_t geometryType )
{
- typedef MessageValue2< UpdateManager, Render::Geometry*, unsigned int > LocalType;
+ typedef MessageValue2< UpdateManager, Render::Geometry*, uint32_t > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::SetGeometryType, &geometry, geometryType );
typedef MessageValue1< UpdateManager, OwnerPointer< Render::Texture > > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::AddTexture, texture );
typedef MessageValue1< UpdateManager, Render::Texture* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::RemoveTexture, &texture );
typedef MessageValue3< UpdateManager, Render::Texture*, PixelDataPtr, Texture::UploadParams > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::UploadTexture, &texture, pixelData, params );
typedef MessageValue1< UpdateManager, Render::Texture* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::GenerateMipmaps, &texture );
typedef MessageValue1< UpdateManager, Render::FrameBuffer* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::AddFrameBuffer, &frameBuffer );
typedef MessageValue1< UpdateManager, Render::FrameBuffer* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::RemoveFrameBuffer, &frameBuffer );
}
-inline void AttachColorTextureToFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, unsigned int mipmapLevel, unsigned int layer )
+inline void AttachColorTextureToFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer )
{
- typedef MessageValue4< UpdateManager, Render::FrameBuffer*, Render::Texture*, unsigned int, unsigned int > LocalType;
+ typedef MessageValue4< UpdateManager, Render::FrameBuffer*, Render::Texture*, uint32_t, uint32_t > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::AttachColorTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel, layer );
typedef MessageValue1< UpdateManager, OwnerPointer< NodeDepths > > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::SetDepthIndices, nodeDepths );
typedef MessageValue1< UpdateManager, OwnerPointer<PropertyResetterBase> > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::AddPropertyResetter, resetter );
typedef MessageValue2< UpdateManager, FrameCallbackInterface*, const Node* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::AddFrameCallback, &frameCallback, &rootNode );
typedef MessageValue1< UpdateManager, FrameCallbackInterface* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &manager, &UpdateManager::RemoveFrameCallback, &frameCallback );
#define __DALI_INTERNAL_SCENE_GRAPH_NODE_MESSAGES_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
typename ParameterType< P >::PassingType value )
{
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( NodePropertyMessage ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( NodePropertyMessage ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) NodePropertyMessage( eventThreadServices.GetUpdateManager(), node, property, member, value );
float value )
{
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( NodePropertyComponentMessage ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( NodePropertyComponentMessage ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) NodePropertyComponentMessage( eventThreadServices.GetUpdateManager(), node, property, member, value );
const P& value )
{
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( NodeTransformPropertyMessage ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( NodeTransformPropertyMessage ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) NodeTransformPropertyMessage( eventThreadServices.GetUpdateManager(), node, property, member, value );
float value )
{
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( NodeTransformComponentMessage ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( NodeTransformComponentMessage ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) NodeTransformComponentMessage( eventThreadServices.GetUpdateManager(), node, property, member, value );
CollectedUniformMap& localMap = mCollectedUniformMap[ bufferIndex ];
localMap.Resize(0);
- for( uint32_t i = 0, count=mUniformMaps.Count(); i<count; ++i )
+ for( UniformMap::SizeType i = 0, count=mUniformMaps.Count(); i<count; ++i )
{
localMap.PushBack( &mUniformMaps[i] );
}
* @brief Get the depth index of the node
* @return Current depth index
*/
- uint32_t GetDepthIndex()
+ uint32_t GetDepthIndex() const
{
return mDepthIndex;
}
namespace SceneGraph
{
-SceneGraph::Layer* Layer::New( unsigned int id )
+SceneGraph::Layer* Layer::New( uint32_t id )
{
// Layers are currently heap allocated, unlike Nodes which are in a memory pool
// However Node::Delete( layer ) will correctly delete a layer / node depending on type
return new Layer( id );
}
-Layer::Layer( unsigned int id )
+Layer::Layer( uint32_t id )
: Node( id ),
mSortFunction( Internal::Layer::ZValue ),
mClippingBox( 0,0,0,0 ),
* @param[in] id The Unique ID of the actor creating the node
* @return A smart-pointer to a newly allocated Node
*/
- static SceneGraph::Layer* New( unsigned int id );
+ static SceneGraph::Layer* New( uint32_t id );
/**
* From Node, to convert a node to a layer.
* @param[in] id The Unique ID of the actor creating the node
* See also Layer::New()
*/
- Layer( unsigned int id );
+ Layer( uint32_t id );
// Undefined
Layer(const Layer&);
typedef MessageValue1< Layer, Dali::Layer::SortFunctionType > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &layer, &Layer::SetSortFunction, function );
typedef MessageValue1< Layer, bool > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &layer, &Layer::SetClipping, enabled );
typedef MessageValue1< Layer, Dali::ClippingBox > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &layer, &Layer::SetClippingBox, clippingbox );
typedef MessageValue1< Layer, Dali::Layer::Behavior > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &layer, &Layer::SetBehavior, behavior );
typedef MessageValue1< Layer, bool > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &layer, &Layer::SetDepthTestDisabled, disable );
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
}
// Called from event thread
-unsigned int* MessageQueue::ReserveMessageSlot( unsigned int requestedSize, bool updateScene )
+uint32_t* MessageQueue::ReserveMessageSlot( std::size_t requestedSize, bool updateScene )
{
DALI_ASSERT_DEBUG( 0 != requestedSize );
#define __DALI_INTERNAL_UPDATE_MESSAGE_QUEUE_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
* @param[in] updateScene If set to true, denotes that the message will cause the scene graph node tree to require an update
* @return A pointer to the first char allocated for the message
*/
- unsigned int* ReserveMessageSlot( unsigned int size, bool updateScene );
+ uint32_t* ReserveMessageSlot( std::size_t size, bool updateScene );
/**
* Flushes the message queue
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
namespace // unnamed namespace
{
-const unsigned int UPDATE_COUNT = 2u; // Update projection or view matrix this many frames after a change
-const unsigned int COPY_PREVIOUS_MATRIX = 1u; // Copy view or projection matrix from previous frame
+const uint32_t UPDATE_COUNT = 2u; // Update projection or view matrix this many frames after a change
+const uint32_t COPY_PREVIOUS_MATRIX = 1u; // Copy view or projection matrix from previous frame
}
namespace Dali
namespace
{
+template< typename T >
+T Sign( T value )
+{
+ return T( T(0) < value ) - T( value < T(0) );
+}
+
void LookAt(Matrix& result, const Vector3& eye, const Vector3& target, const Vector3& up)
{
Vector3 vZ = target - eye;
result.SetInverseTransformComponents(vX, vY, vZ, eye);
}
-
void Frustum(Matrix& result, float left, float right, float bottom, float top, float near, float far, bool invertYAxis)
{
float deltaZ = far - near;
const Dali::Camera::Type Camera::DEFAULT_TYPE( Dali::Camera::FREE_LOOK );
const Dali::Camera::ProjectionMode Camera::DEFAULT_MODE( Dali::Camera::PERSPECTIVE_PROJECTION );
const bool Camera::DEFAULT_INVERT_Y_AXIS( false );
-const float Camera::DEFAULT_FIELD_OF_VIEW( 45.0f*(M_PI/180.0f) );
+const float Camera::DEFAULT_FIELD_OF_VIEW( 45.0f*(Math::PI/180.0f) );
const float Camera::DEFAULT_ASPECT_RATIO( 4.0f/3.0f );
const float Camera::DEFAULT_LEFT_CLIPPING_PLANE(-240.0f);
const float Camera::DEFAULT_RIGHT_CLIPPING_PLANE(240.0f);
}
// if either matrix changed, we need to recalculate the inverse matrix for hit testing to work
- unsigned int viewUpdateCount = UpdateViewMatrix( updateBufferIndex );
- unsigned int projectionUpdateCount = UpdateProjection( updateBufferIndex );
+ uint32_t viewUpdateCount = UpdateViewMatrix( updateBufferIndex );
+ uint32_t projectionUpdateCount = UpdateProjection( updateBufferIndex );
// if model or view matrix changed we need to either recalculate the inverse VP or copy previous
if( viewUpdateCount > COPY_PREVIOUS_MATRIX || projectionUpdateCount > COPY_PREVIOUS_MATRIX )
return 0u != mUpdateViewFlag;
}
-unsigned int Camera::UpdateViewMatrix( BufferIndex updateBufferIndex )
+uint32_t Camera::UpdateViewMatrix( BufferIndex updateBufferIndex )
{
- unsigned int retval( mUpdateViewFlag );
+ uint32_t retval( mUpdateViewFlag );
if( 0u != mUpdateViewFlag )
{
if( COPY_PREVIOUS_MATRIX == mUpdateViewFlag )
if ( normalize )
{
- for ( unsigned int i = 0; i < 6; ++i )
+ for ( uint32_t i = 0; i < 6; ++i )
{
// Normalize planes to ensure correct bounding distance checking
Plane& plane = planes.mPlanes[ i ];
}
else
{
- for ( unsigned int i = 0; i < 6; ++i )
+ for ( uint32_t i = 0; i < 6; ++i )
{
planes.mSign[i] = Vector3( Sign(planes.mPlanes[ i ].mNormal.x), Sign(planes.mPlanes[ i ].mNormal.y), Sign(planes.mPlanes[ i ].mNormal.z) );
}
return true;
}
-unsigned int Camera::UpdateProjection( BufferIndex updateBufferIndex )
+uint32_t Camera::UpdateProjection( BufferIndex updateBufferIndex )
{
- unsigned int retval( mUpdateProjectionFlag );
+ uint32_t retval( mUpdateProjectionFlag );
// Early-exit if no update required
if ( 0u != mUpdateProjectionFlag )
{
#define DALI_INTERNAL_SCENE_GRAPH_CAMERA_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
* @param[in] bufferIndex The current update buffer index.
* @return count how many frames ago the matrix was changed.
*/
- unsigned int UpdateViewMatrix( BufferIndex updateBufferIndex );
+ uint32_t UpdateViewMatrix( BufferIndex updateBufferIndex );
/**
* Recalculates the projection matrix.
* @param[in] bufferIndex The current update buffer index.
* @return count how many frames ago the matrix was changed.
*/
- unsigned int UpdateProjection( BufferIndex updateBufferIndex );
+ uint32_t UpdateProjection( BufferIndex updateBufferIndex );
private:
*/
void UpdateFrustum( BufferIndex updateBufferIndex, bool normalize = true );
- unsigned int mUpdateViewFlag; ///< This is non-zero if the view matrix requires an update
- unsigned int mUpdateProjectionFlag; ///< This is non-zero if the projection matrix requires an update
+ uint32_t mUpdateViewFlag; ///< This is non-zero if the view matrix requires an update
+ uint32_t mUpdateProjectionFlag; ///< This is non-zero if the projection matrix requires an update
const Node* mNode; ///< The node this scene graph camera belongs to
public: // PROPERTIES
typedef MessageValue1< Camera, Dali::Camera::Type > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &camera, &Camera::SetType, parameter );
typedef MessageValue1< Camera, Dali::Camera::ProjectionMode > LocalProjectionMode;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalProjectionMode ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalProjectionMode ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalProjectionMode( &camera, &Camera::SetProjectionMode, parameter );
typedef MessageValue1< Camera, float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &camera, &Camera::SetFieldOfView, parameter );
typedef MessageValue1< Camera, float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &camera, &Camera::SetAspectRatio, parameter );
typedef MessageValue1< Camera, Vector2 > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &camera, &Camera::SetStereoBias, parameter );
typedef MessageValue1< Camera, float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &camera, &Camera::SetLeftClippingPlane, parameter );
typedef MessageValue1< Camera, float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &camera, &Camera::SetRightClippingPlane, parameter );
typedef MessageValue1< Camera, float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &camera, &Camera::SetTopClippingPlane, parameter );
typedef MessageValue1< Camera, float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &camera, &Camera::SetBottomClippingPlane, parameter );
typedef MessageValue1< Camera, float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &camera, &Camera::SetNearClippingPlane, parameter );
typedef MessageValue1< Camera, float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &camera, &Camera::SetFarClippingPlane, parameter );
typedef MessageValue1< Camera, Vector3 > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &camera, &Camera::SetTargetPosition, parameter );
typedef MessageValue1< Camera, bool > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &camera, &Camera::SetInvertYAxis, parameter );
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
}
}
+uint32_t RenderTaskList::GetTaskCount()
+{
+ return static_cast<uint32_t>( mRenderTasks.Count() );
+}
+
RenderTaskList::RenderTaskContainer& RenderTaskList::GetTasks()
{
return mRenderTasks;
#define __DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_LIST_H__
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
void RemoveTask( RenderTask* task );
/**
+ * Retrieve the count of RenderTasks.
+ * @return The count.
+ */
+ uint32_t GetTaskCount();
+
+ /**
* Retrieve the container of RenderTasks.
* @return The container.
*/
typedef MessageValue1< RenderTaskList, OwnerPointer< RenderTask > > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &list, &RenderTaskList::AddTask, task );
typedef MessageValue1< RenderTaskList, RenderTask* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &list, &RenderTaskList::RemoveTask, &task );
return false;
}
- viewport.x = mViewportPosition[bufferIndex].x;
- viewport.y = mViewportPosition[bufferIndex].y;
- viewport.width = mViewportSize[bufferIndex].width;
- viewport.height = mViewportSize[bufferIndex].height;
+ viewport.x = static_cast<int>( mViewportPosition[bufferIndex].x ); // truncated
+ viewport.y = static_cast<int>( mViewportPosition[bufferIndex].y ); // truncated
+ viewport.width = static_cast<int>( mViewportSize[bufferIndex].width ); // truncated
+ viewport.height = static_cast<int>( mViewportSize[bufferIndex].height ); // truncated
return true;
}
return mCullMode;
}
-void RenderTask::SetRefreshRate( unsigned int refreshRate )
+void RenderTask::SetRefreshRate( uint32_t refreshRate )
{
DALI_LOG_TRACE_METHOD_FMT(gRenderTaskLogFilter, "this:%p RefreshRate:%d\n", this, refreshRate);
mFrameCounter = 0u;
}
-unsigned int RenderTask::GetRefreshRate() const
+uint32_t RenderTask::GetRefreshRate() const
{
return mRefreshRate;
}
return notify;
}
-unsigned int RenderTask::GetRenderedOnceCounter() const
+uint32_t RenderTask::GetRenderedOnceCounter() const
{
return mRenderedOnceCounter;
}
* Set the refresh-rate of the RenderTask.
* @param[in] refreshRate The new refresh rate.
*/
- void SetRefreshRate( unsigned int refreshRate );
+ void SetRefreshRate( uint32_t refreshRate );
/**
* Retrieve the refresh-rate of the RenderTask.
* @return The refresh rate.
*/
- unsigned int GetRefreshRate() const;
+ uint32_t GetRefreshRate() const;
/**
* Check if the render task is ready for rendering.
/**
* @return The number of times we have transited from RENDERED_ONCE to RENDERED_ONCE_AND_NOTIFIED state.
*/
- unsigned int GetRenderedOnceCounter() const;
+ uint32_t GetRenderedOnceCounter() const;
/**
* Retrieve the view-matrix; this is double buffered for input handling.
bool mCullMode: 1; ///< Whether renderers should be frustum culled
State mState; ///< Render state.
- unsigned int mRefreshRate; ///< REFRESH_ONCE, REFRESH_ALWAYS or render every N frames
- unsigned int mFrameCounter; ///< counter for rendering every N frames
+ uint32_t mRefreshRate; ///< REFRESH_ONCE, REFRESH_ALWAYS or render every N frames
+ uint32_t mFrameCounter; ///< counter for rendering every N frames
- unsigned int mRenderedOnceCounter; ///< Incremented whenever state changes to RENDERED_ONCE_AND_NOTIFIED
+ uint32_t mRenderedOnceCounter; ///< Incremented whenever state changes to RENDERED_ONCE_AND_NOTIFIED
bool mRequiresSync; ///< Whether sync is needed to track the render
};
typedef MessageValue1< RenderTask, Render::FrameBuffer*> LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &task, &RenderTask::SetFrameBuffer, frameBuffer );
typedef MessageDoubleBuffered1< RenderTask, Vector4 > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &task, &RenderTask::SetClearColor, value );
typedef MessageDoubleBuffered1< RenderTask, Vector4 > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &task, &RenderTask::BakeClearColor, value );
typedef MessageValue1< RenderTask, bool > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &task, &RenderTask::SetClearEnabled, enabled );
typedef MessageValue1< RenderTask, bool > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &task, &RenderTask::SetCullMode, mode );
}
-inline void SetRefreshRateMessage( EventThreadServices& eventThreadServices, RenderTask& task, unsigned int refreshRate )
+inline void SetRefreshRateMessage( EventThreadServices& eventThreadServices, RenderTask& task, uint32_t refreshRate )
{
- typedef MessageValue1< RenderTask, unsigned int > LocalType;
+ typedef MessageValue1< RenderTask, uint32_t > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &task, &RenderTask::SetRefreshRate, refreshRate );
typedef MessageValue1< RenderTask, Node* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &task, &RenderTask::SetSourceNode, node );
Node* node = const_cast< Node* >( constNode );
Camera* camera = const_cast< Camera* >( constCamera );
// Reserve memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &task, &RenderTask::SetCamera, node, camera );
typedef MessageValue1< RenderTask, bool > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &task, &RenderTask::SetExclusive, exclusive );
typedef MessageValue1< RenderTask, bool > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &task, &RenderTask::SetSyncRequired, requiresSync );
typedef MessageDoubleBuffered1< RenderTask, Vector2 > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &task, &RenderTask::BakeViewportPosition, value );
typedef MessageDoubleBuffered1< RenderTask, Vector2 > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &task, &RenderTask::BakeViewportSize, value );
#include <dali/internal/render/shaders/program.h>
#include <dali/internal/render/shaders/scene-graph-shader.h>
+namespace Dali
+{
+namespace Internal
+{
+namespace SceneGraph
+{
namespace // unnamed namespace
{
-const unsigned int UNIFORM_MAP_READY = 0;
-const unsigned int COPY_UNIFORM_MAP = 1;
-const unsigned int REGENERATE_UNIFORM_MAP = 2;
+const uint32_t UNIFORM_MAP_READY = 0;
+const uint32_t COPY_UNIFORM_MAP = 1;
+const uint32_t REGENERATE_UNIFORM_MAP = 2;
//Memory pool used to allocate new renderers. Memory used by this pool will be released when shutting down DALi
-Dali::Internal::MemoryPoolObjectAllocator<Dali::Internal::SceneGraph::Renderer> gRendererMemoryPool;
+MemoryPoolObjectAllocator<Renderer> gRendererMemoryPool;
-void AddMappings( Dali::Internal::SceneGraph::CollectedUniformMap& localMap, const Dali::Internal::SceneGraph::UniformMap& uniformMap )
+void AddMappings( CollectedUniformMap& localMap, const UniformMap& uniformMap )
{
// Iterate thru uniformMap.
// Any maps that aren't in localMap should be added in a single step
- Dali::Internal::SceneGraph::CollectedUniformMap newUniformMappings;
+ CollectedUniformMap newUniformMappings;
- for( unsigned int i=0, count=uniformMap.Count(); i<count; ++i )
+ for( UniformMap::SizeType i = 0, count=uniformMap.Count(); i<count; ++i )
{
- Dali::Internal::SceneGraph::UniformPropertyMapping::Hash nameHash = uniformMap[i].uniformNameHash;
+ UniformPropertyMapping::Hash nameHash = uniformMap[i].uniformNameHash;
bool found = false;
- for( Dali::Internal::SceneGraph::CollectedUniformMap::Iterator iter = localMap.Begin() ; iter != localMap.End() ; ++iter )
+ for( CollectedUniformMap::Iterator iter = localMap.Begin() ; iter != localMap.End() ; ++iter )
{
- const Dali::Internal::SceneGraph::UniformPropertyMapping* map = (*iter);
+ const UniformPropertyMapping* map = (*iter);
if( map->uniformNameHash == nameHash )
{
if( map->uniformName == uniformMap[i].uniformName )
{
localMap.Reserve( localMap.Count() + newUniformMappings.Count() );
- for( Dali::Internal::SceneGraph::CollectedUniformMap::Iterator iter = newUniformMappings.Begin(),
+ for( CollectedUniformMap::Iterator iter = newUniformMappings.Begin(),
end = newUniformMappings.End() ;
iter != end ;
++iter )
{
- const Dali::Internal::SceneGraph::UniformPropertyMapping* map = (*iter);
+ const UniformPropertyMapping* map = (*iter);
localMap.PushBack( map );
}
}
} // Anonymous namespace
-namespace Dali
-{
-namespace Internal
-{
-namespace SceneGraph
-{
-
Renderer* Renderer::New()
{
return new ( gRendererMemoryPool.AllocateRawThreadSafe() ) Renderer();
localMap.Resize( oldMap.Count() );
- unsigned int index=0;
+ uint32_t index=0;
for( CollectedUniformMap::Iterator iter = oldMap.Begin(), end = oldMap.End() ; iter != end ; ++iter, ++index )
{
localMap[index] = *iter;
if( mResendFlag & RESEND_GEOMETRY )
{
typedef MessageValue1< Render::Renderer, Render::Geometry* > DerivedType;
- unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
+ uint32_t* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
new (slot) DerivedType( mRenderer, &Render::Renderer::SetGeometry, mGeometry );
}
if( mResendFlag & RESEND_FACE_CULLING_MODE )
{
typedef MessageValue1< Render::Renderer, FaceCullingMode::Type > DerivedType;
- unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
+ uint32_t* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
new (slot) DerivedType( mRenderer, &Render::Renderer::SetFaceCullingMode, mFaceCullingMode );
}
if( mResendFlag & RESEND_BLEND_BIT_MASK )
{
- typedef MessageValue1< Render::Renderer, unsigned int > DerivedType;
- unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
+ typedef MessageValue1< Render::Renderer, uint32_t > DerivedType;
+ uint32_t* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
new (slot) DerivedType( mRenderer, &Render::Renderer::SetBlendingBitMask, mBlendBitmask );
}
if( mResendFlag & RESEND_BLEND_COLOR )
{
typedef MessageValue1< Render::Renderer, Vector4 > DerivedType;
- unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
+ uint32_t* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
new (slot) DerivedType( mRenderer, &Render::Renderer::SetBlendColor, GetBlendColor() );
}
if( mResendFlag & RESEND_PREMULTIPLIED_ALPHA )
{
typedef MessageValue1< Render::Renderer, bool > DerivedType;
- unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
+ uint32_t* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
new (slot) DerivedType( mRenderer, &Render::Renderer::EnablePreMultipliedAlpha, mPremultipledAlphaEnabled );
}
if( mResendFlag & RESEND_INDEXED_DRAW_FIRST_ELEMENT )
{
- typedef MessageValue1< Render::Renderer, size_t > DerivedType;
- unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
+ typedef MessageValue1< Render::Renderer, uint32_t > DerivedType;
+ uint32_t* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
new (slot) DerivedType( mRenderer, &Render::Renderer::SetIndexedDrawFirstElement, mIndexedDrawFirstElement );
}
if( mResendFlag & RESEND_INDEXED_DRAW_ELEMENTS_COUNT )
{
- typedef MessageValue1< Render::Renderer, size_t > DerivedType;
- unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
+ typedef MessageValue1< Render::Renderer, uint32_t > DerivedType;
+ uint32_t* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
new (slot) DerivedType( mRenderer, &Render::Renderer::SetIndexedDrawElementsCount, mIndexedDrawElementsCount );
}
if( mResendFlag & RESEND_DEPTH_WRITE_MODE )
{
typedef MessageValue1< Render::Renderer, DepthWriteMode::Type > DerivedType;
- unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
+ uint32_t* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
new (slot) DerivedType( mRenderer, &Render::Renderer::SetDepthWriteMode, mDepthWriteMode );
}
if( mResendFlag & RESEND_DEPTH_TEST_MODE )
{
typedef MessageValue1< Render::Renderer, DepthTestMode::Type > DerivedType;
- unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
+ uint32_t* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
new (slot) DerivedType( mRenderer, &Render::Renderer::SetDepthTestMode, mDepthTestMode );
}
if( mResendFlag & RESEND_DEPTH_FUNCTION )
{
typedef MessageValue1< Render::Renderer, DepthFunction::Type > DerivedType;
- unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
+ uint32_t* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
new (slot) DerivedType( mRenderer, &Render::Renderer::SetDepthFunction, mDepthFunction );
}
if( mResendFlag & RESEND_RENDER_MODE )
{
typedef MessageValue1< Render::Renderer, RenderMode::Type > DerivedType;
- unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
+ uint32_t* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
new (slot) DerivedType( mRenderer, &Render::Renderer::SetRenderMode, mStencilParameters.renderMode );
}
if( mResendFlag & RESEND_STENCIL_FUNCTION )
{
typedef MessageValue1< Render::Renderer, StencilFunction::Type > DerivedType;
- unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
+ uint32_t* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
new (slot) DerivedType( mRenderer, &Render::Renderer::SetStencilFunction, mStencilParameters.stencilFunction );
}
if( mResendFlag & RESEND_STENCIL_FUNCTION_MASK )
{
typedef MessageValue1< Render::Renderer, int > DerivedType;
- unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
+ uint32_t* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
new (slot) DerivedType( mRenderer, &Render::Renderer::SetStencilFunctionMask, mStencilParameters.stencilFunctionMask );
}
if( mResendFlag & RESEND_STENCIL_FUNCTION_REFERENCE )
{
typedef MessageValue1< Render::Renderer, int > DerivedType;
- unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
+ uint32_t* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
new (slot) DerivedType( mRenderer, &Render::Renderer::SetStencilFunctionReference, mStencilParameters.stencilFunctionReference );
}
if( mResendFlag & RESEND_STENCIL_MASK )
{
typedef MessageValue1< Render::Renderer, int > DerivedType;
- unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
+ uint32_t* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
new (slot) DerivedType( mRenderer, &Render::Renderer::SetStencilMask, mStencilParameters.stencilMask );
}
if( mResendFlag & RESEND_STENCIL_OPERATION_ON_FAIL )
{
typedef MessageValue1< Render::Renderer, StencilOperation::Type > DerivedType;
- unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
+ uint32_t* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
new (slot) DerivedType( mRenderer, &Render::Renderer::SetStencilOperationOnFail, mStencilParameters.stencilOperationOnFail );
}
if( mResendFlag & RESEND_STENCIL_OPERATION_ON_Z_FAIL )
{
typedef MessageValue1< Render::Renderer, StencilOperation::Type > DerivedType;
- unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
+ uint32_t* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
new (slot) DerivedType( mRenderer, &Render::Renderer::SetStencilOperationOnZFail, mStencilParameters.stencilOperationOnZFail );
}
if( mResendFlag & RESEND_STENCIL_OPERATION_ON_Z_PASS )
{
typedef MessageValue1< Render::Renderer, StencilOperation::Type > DerivedType;
- unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
+ uint32_t* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
new (slot) DerivedType( mRenderer, &Render::Renderer::SetStencilOperationOnZPass, mStencilParameters.stencilOperationOnZPass );
}
return mBlendMode;
}
-void Renderer::SetBlendingOptions( unsigned int options )
+void Renderer::SetBlendingOptions( uint32_t options )
{
if( mBlendBitmask != options)
{
}
}
-unsigned int Renderer::GetBlendingOptions() const
+uint32_t Renderer::GetBlendingOptions() const
{
return mBlendBitmask;
}
return Color::TRANSPARENT;
}
-void Renderer::SetIndexedDrawFirstElement( size_t firstElement )
+void Renderer::SetIndexedDrawFirstElement( uint32_t firstElement )
{
mIndexedDrawFirstElement = firstElement;
mResendFlag |= RESEND_INDEXED_DRAW_FIRST_ELEMENT;
}
-size_t Renderer::GetIndexedDrawFirstElement() const
+uint32_t Renderer::GetIndexedDrawFirstElement() const
{
return mIndexedDrawFirstElement;
}
-void Renderer::SetIndexedDrawElementsCount( size_t elementsCount )
+void Renderer::SetIndexedDrawElementsCount( uint32_t elementsCount )
{
mIndexedDrawElementsCount = elementsCount;
mResendFlag |= RESEND_INDEXED_DRAW_ELEMENTS_COUNT;
}
-size_t Renderer::GetIndexedDrawElementsCount() const
+uint32_t Renderer::GetIndexedDrawElementsCount() const
{
return mIndexedDrawElementsCount;
}
{
if( mTextureSet )
{
- size_t textureCount = mTextureSet->GetTextureCount();
+ uint32_t textureCount = mTextureSet->GetTextureCount();
mRenderDataProvider->mTextures.resize( textureCount );
mRenderDataProvider->mSamplers.resize( textureCount );
- for( unsigned int i(0); i<textureCount; ++i )
+ for( uint32_t i = 0; i<textureCount; ++i )
{
mRenderDataProvider->mTextures[i] = mTextureSet->GetTexture(i);
mRenderDataProvider->mSamplers[i] = mTextureSet->GetTextureSampler(i);
* Set the blending options. This should only be called from the update thread.
* @param[in] options A bitmask of blending options.
*/
- void SetBlendingOptions( unsigned int options );
+ void SetBlendingOptions( uint32_t options );
/**
* Get the blending options
* @return The the blending mode
*/
- unsigned int GetBlendingOptions() const;
+ uint32_t GetBlendingOptions() const;
/**
* Set the blend color for blending operation
* Set the index of first element for indexed draw
* @param[in] firstElement index of first element to draw
*/
- void SetIndexedDrawFirstElement( size_t firstElement );
+ void SetIndexedDrawFirstElement( uint32_t firstElement );
/**
* Get the index of first element for indexed draw
* @return The index of first element for indexed draw
*/
- size_t GetIndexedDrawFirstElement() const;
+ uint32_t GetIndexedDrawFirstElement() const;
/**
* Set the number of elements to draw by indexed draw
* @param[in] elementsCount number of elements to draw
*/
- void SetIndexedDrawElementsCount( size_t elementsCount );
+ void SetIndexedDrawElementsCount( uint32_t elementsCount );
/**
* Get the number of elements to draw by indexed draw
* @return The number of elements to draw by indexed draw
*/
- size_t GetIndexedDrawElementsCount() const;
+ uint32_t GetIndexedDrawElementsCount() const;
/**
* @brief Set whether the Pre-multiplied Alpha Blending is required
Dali::Internal::Render::Renderer::StencilParameters mStencilParameters; ///< Struct containing all stencil related options
- size_t mIndexedDrawFirstElement; ///< first element index to be drawn using indexed draw
- size_t mIndexedDrawElementsCount; ///< number of elements to be drawn using indexed draw
- unsigned int mBlendBitmask; ///< The bitmask of blending options
- unsigned int mRegenerateUniformMap; ///< 2 if the map should be regenerated, 1 if it should be copied.
- unsigned int mResendFlag; ///< Indicate whether data should be resent to the renderer
+ uint32_t mIndexedDrawFirstElement; ///< first element index to be drawn using indexed draw
+ uint32_t mIndexedDrawElementsCount; ///< number of elements to be drawn using indexed draw
+ uint32_t mBlendBitmask; ///< The bitmask of blending options
+ uint32_t mRegenerateUniformMap; ///< 2 if the map should be regenerated, 1 if it should be copied.
+ uint32_t mResendFlag; ///< Indicate whether data should be resent to the renderer
DepthFunction::Type mDepthFunction:4; ///< Local copy of the depth function
FaceCullingMode::Type mFaceCullingMode:3; ///< Local copy of the mode of face culling
typedef MessageValue1< Renderer, TextureSet* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &renderer, &Renderer::SetTextures, const_cast<TextureSet*>(&textureSet) );
typedef MessageValue1< Renderer, Render::Geometry* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &renderer, &Renderer::SetGeometry, const_cast<Render::Geometry*>(&geometry) );
typedef MessageValue1< Renderer, Shader* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &renderer, &Renderer::SetShader, &shader );
typedef MessageValue1< Renderer, int > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &renderer, &Renderer::SetDepthIndex, depthIndex );
typedef MessageValue1< Renderer, FaceCullingMode::Type > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &renderer, &Renderer::SetFaceCullingMode, faceCullingMode );
}
typedef MessageValue1< Renderer, BlendMode::Type > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &renderer, &Renderer::SetBlendMode, blendingMode );
}
-inline void SetBlendingOptionsMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, unsigned int options )
+inline void SetBlendingOptionsMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, uint32_t options )
{
- typedef MessageValue1< Renderer, unsigned int > LocalType;
+ typedef MessageValue1< Renderer, uint32_t > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &renderer, &Renderer::SetBlendingOptions, options );
}
typedef MessageValue1< Renderer, Vector4 > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &renderer, &Renderer::SetBlendColor, blendColor );
}
-inline void SetIndexedDrawFirstElementMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, size_t firstElement )
+inline void SetIndexedDrawFirstElementMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, uint32_t firstElement )
{
- typedef MessageValue1< Renderer, size_t > LocalType;
+ typedef MessageValue1< Renderer, uint32_t > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &renderer, &Renderer::SetIndexedDrawFirstElement, firstElement );
}
-inline void SetIndexedDrawElementsCountMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, size_t elementsCount )
+inline void SetIndexedDrawElementsCountMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, uint32_t elementsCount )
{
- typedef MessageValue1< Renderer, size_t > LocalType;
+ typedef MessageValue1< Renderer, uint32_t > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &renderer, &Renderer::SetIndexedDrawElementsCount, elementsCount );
}
typedef MessageValue1< Renderer, bool > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &renderer, &Renderer::EnablePreMultipliedAlpha, preMultiplied );
}
typedef MessageValue1< Renderer, DepthWriteMode::Type > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &renderer, &Renderer::SetDepthWriteMode, depthWriteMode );
}
typedef MessageValue1< Renderer, DepthTestMode::Type > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &renderer, &Renderer::SetDepthTestMode, depthTestMode );
}
typedef MessageValue1< Renderer, DepthFunction::Type > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &renderer, &Renderer::SetDepthFunction, depthFunction );
}
typedef MessageValue1< Renderer, RenderMode::Type > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &renderer, &Renderer::SetRenderMode, mode );
}
typedef MessageValue1< Renderer, StencilFunction::Type > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &renderer, &Renderer::SetStencilFunction, stencilFunction );
}
typedef MessageValue1< Renderer, int > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &renderer, &Renderer::SetStencilFunctionMask, mask );
}
typedef MessageValue1< Renderer, int > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &renderer, &Renderer::SetStencilFunctionReference, stencilFunctionReference );
}
typedef MessageValue1< Renderer, int > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &renderer, &Renderer::SetStencilMask, stencilMask );
}
typedef MessageValue1< Renderer, StencilOperation::Type > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &renderer, &Renderer::SetStencilOperationOnFail, stencilOperation );
}
typedef MessageValue1< Renderer, StencilOperation::Type > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &renderer, &Renderer::SetStencilOperationOnZFail, stencilOperation );
}
typedef MessageValue1< Renderer, StencilOperation::Type > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &renderer, &Renderer::SetStencilOperationOnZPass, stencilOperation );
}
typedef MessageDoubleBuffered1< Renderer, float > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &renderer, &Renderer::BakeOpacity, opacity );
}
TextureSet::~TextureSet()
{
- size_t rendererCount = mRenderers.Size();
- for( size_t i(0); i<rendererCount; ++i )
+ for( auto&& renderer : mRenderers )
{
- mRenderers[i]->TextureSetDeleted();
+ renderer->TextureSetDeleted();
}
}
gTextureSetMemoryPool.FreeThreadSafe( static_cast<TextureSet*>( ptr ) );
}
-void TextureSet::SetSampler( size_t index, Render::Sampler* sampler )
+void TextureSet::SetSampler( uint32_t index, Render::Sampler* sampler )
{
- size_t samplerCount( mSamplers.Size() );
+ const uint32_t samplerCount = static_cast<uint32_t>( mSamplers.Size() );
if( samplerCount < index + 1 )
{
mSamplers.Resize( index + 1 );
- for( size_t i(samplerCount); i<=index; ++i )
+ for( uint32_t i(samplerCount); i<=index; ++i )
{
mSamplers[i] = NULL;
}
NotifyChangeToRenderers();
}
-void TextureSet::SetTexture( size_t index, Render::Texture* texture )
+void TextureSet::SetTexture( uint32_t index, Render::Texture* texture )
{
- const size_t textureCount( mTextures.Size() );
+ const uint32_t textureCount = static_cast<uint32_t>( mTextures.Size() );
if( textureCount < index + 1 )
{
mTextures.Resize( index + 1 );
samplerExist = false;
}
- for( size_t i(textureCount); i<=index; ++i )
+ for( uint32_t i(textureCount); i<=index; ++i )
{
mTextures[i] = 0;
void TextureSet::AddObserver( Renderer* renderer )
{
- size_t rendererCount( mRenderers.Size() );
- for( size_t i(0); i<rendererCount; ++i )
+ for( auto&& element : mRenderers )
{
- if( mRenderers[i] == renderer )
+ if( element == renderer )
{
//Renderer already in the list
return;
void TextureSet::RemoveObserver( Renderer* renderer )
{
- size_t rendererCount( mRenderers.Size() );
- for( size_t i(0); i<rendererCount; ++i )
+ for( auto&& iter = mRenderers.Begin(), end = mRenderers.End(); iter != end; ++iter )
{
- if( mRenderers[i] == renderer )
+ if( *iter == renderer )
{
- mRenderers.Remove( mRenderers.Begin() + i );
+ mRenderers.Remove( iter );
return;
}
}
void TextureSet::NotifyChangeToRenderers()
{
- size_t rendererCount = mRenderers.Size();
- for( size_t i(0); i<rendererCount; ++i )
+ for( auto&& element : mRenderers )
{
- mRenderers[i]->TextureSetChanged();
+ element->TextureSetChanged();
}
}
#define DALI_INTERNAL_SCENE_GRAPH_TEXTURE_SET_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
static TextureSet* New();
/**
- * Destructor
+ * Destructor. Not virtual as not a base class and not inheriting anything
*/
- virtual ~TextureSet();
+ ~TextureSet();
/**
* Overriden delete operator
* @param[in] index The index of the texture
* @param[in] sampler The sampler to be used by the texture
*/
- void SetSampler( size_t index, Render::Sampler* sampler );
+ void SetSampler( uint32_t index, Render::Sampler* sampler );
/**
* Set the texture at position "index"
* @param[in] index The index of the texture
* @param[in] texture The texture
*/
- void SetTexture( size_t index, Render::Texture* texture );
+ void SetTexture( uint32_t index, Render::Texture* texture );
/**
* Return whether any texture in the texture set has an alpha channel
* @param[in] index The index of the texture in the textures array
* @return the sampler used by the texture
*/
- Render::Sampler* GetTextureSampler( size_t index )
+ Render::Sampler* GetTextureSampler( uint32_t index )
{
return mSamplers[index];
}
* Get the number of Textures in the texture set
* @return The number of Textures
*/
- size_t GetTextureCount()
+ uint32_t GetTextureCount()
{
- return mTextures.Size();
+ return static_cast<uint32_t>( mTextures.Size() );
}
/**
* @param[in] index The index of the texture in the textures array
* @return the pointer to the Texture in that position
*/
- Render::Texture* GetTexture( size_t index )
+ Render::Texture* GetTexture( uint32_t index )
{
return mTextures[index];
}
private: // Data
- Vector< Render::Sampler* > mSamplers; ///< List of samplers used by each texture. Not owned
- Vector< Render::Texture* > mTextures; ///< List of Textures. Not owned
- Vector<Renderer*> mRenderers; ///< List of renderers using the TextureSet
- bool mHasAlpha; ///< if any of the textures has an alpha channel
+ Vector< Render::Sampler* > mSamplers; ///< List of samplers used by each texture. Not owned
+ Vector< Render::Texture* > mTextures; ///< List of Textures. Not owned
+ Vector<Renderer*> mRenderers; ///< List of renderers using the TextureSet
+ bool mHasAlpha; ///< if any of the textures has an alpha channel
};
-inline void SetTextureMessage( EventThreadServices& eventThreadServices, const TextureSet& textureSet, size_t index, Render::Texture* texture )
+inline void SetTextureMessage( EventThreadServices& eventThreadServices, const TextureSet& textureSet, uint32_t index, Render::Texture* texture )
{
- typedef MessageValue2< TextureSet, size_t, Render::Texture* > LocalType;
+ typedef MessageValue2< TextureSet, uint32_t, Render::Texture* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &textureSet, &TextureSet::SetTexture, index, texture );
}
-inline void SetSamplerMessage( EventThreadServices& eventThreadServices, const TextureSet& textureSet, size_t index, Render::Sampler* sampler )
+inline void SetSamplerMessage( EventThreadServices& eventThreadServices, const TextureSet& textureSet, uint32_t index, Render::Sampler* sampler )
{
- typedef MessageValue2< TextureSet, size_t, Render::Sampler* > LocalType;
+ typedef MessageValue2< TextureSet, uint32_t, Render::Sampler* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &textureSet, &TextureSet::SetSampler, index, sampler );
std::swap( mData, vector.mData );
}
-void VectorBase::Erase( char* address, SizeType elementSize )
+void VectorBase::Erase( uint8_t* address, SizeType elementSize )
{
// erase can be called on an unallocated vector
if( mData )
{
- char* startAddress = address + elementSize;
- const char* endAddress = reinterpret_cast< char* >( mData ) + Count() * elementSize;
+ uint8_t* startAddress = address + elementSize;
+ const uint8_t* endAddress = reinterpret_cast< uint8_t* >( mData ) + Count() * elementSize;
SizeType numberOfBytes = endAddress - startAddress;
// addresses overlap so use memmove
memmove( address, startAddress, numberOfBytes );
}
}
-char* VectorBase::Erase( char* first, char* last, SizeType elementSize )
+uint8_t* VectorBase::Erase( uint8_t* first, uint8_t* last, SizeType elementSize )
{
- char* next = NULL;
+ uint8_t* next = NULL;
if( mData )
{
- char* startAddress = last;
- const char* endAddress = reinterpret_cast< char* >( mData ) + Count() * elementSize;
+ uint8_t* startAddress = last;
+ const uint8_t* endAddress = reinterpret_cast< uint8_t* >( mData ) + Count() * elementSize;
SizeType numberOfBytes = endAddress - startAddress;
// addresses overlap so use memmove
memmove( first, startAddress, numberOfBytes );
return next;
}
-void VectorBase::CopyMemory( char* destination, const char* source, size_t numberOfBytes )
+void VectorBase::CopyMemory( uint8_t* destination, const uint8_t* source, size_t numberOfBytes )
{
if( ( ( source < destination ) && ( source + numberOfBytes > destination ) ) ||
( ( destination < source ) && ( destination + numberOfBytes > source ) ) )
* @param[in] elementSize Size to erase
* @pre Last element cannot be erased as there is nothing to move.
*/
- void Erase( char* address, SizeType elementSize );
+ void Erase( uint8_t* address, SizeType elementSize );
/**
* @brief Erases a range of elements.
* @param[in] elementSize Size of one of the elements to be erased
* @return Address pointing to the next element of the last one
*/
- char* Erase( char* first, char* last, SizeType elementSize );
+ uint8_t* Erase( uint8_t* first, uint8_t* last, SizeType elementSize );
/**
* @brief Copies a number of bytes from \e source to \e destination.
* @param[in] source Pointer to the source address
* @param[in] numberOfBytes The number of bytes to be copied
*/
- void CopyMemory( char* destination, const char* source, size_t numberOfBytes );
+ void CopyMemory( uint8_t* destination, const uint8_t* source, size_t numberOfBytes );
private:
* @param[in] address Address to erase from
* @param[in] elementSize Size to erase
*/
- void Erase( char* address, SizeType elementSize )
+ void Erase( uint8_t* address, SizeType elementSize )
{
VectorBase::Erase( address, elementSize );
}
* @param[in] elementSize Size of one of the elements to be erased
* @return Address pointing to the next element of the last one
*/
- char* Erase( char* first, char* last, SizeType elementSize )
+ uint8_t* Erase( uint8_t* first, uint8_t* last, SizeType elementSize )
{
return VectorBase::Erase( first, last, elementSize );
}
* @param[in] to Address to the last element to be inserted
* @param[in] elementSize Size of one of the elements to be inserted
*/
- void Insert( char* at, char* from, char* to, SizeType elementSize )
+ void Insert( uint8_t* at, uint8_t* from, uint8_t* to, SizeType elementSize )
{
const SizeType size = to - from;
const SizeType count = Count();
if( newCount > Capacity() )
{
// Calculate the at offset as the pointer is invalid after the Reserve() call.
- std::size_t offset = at - reinterpret_cast<char*>( mData );
+ std::size_t offset = at - reinterpret_cast<uint8_t*>( mData );
// need more space
Reserve( NextPowerOfTwo( static_cast<uint32_t>( newCount ) ), elementSize ); // reserve enough space to store at least the next power of two elements of the new required size.
// Set the new at pointer.
- at = reinterpret_cast<char*>( mData ) + offset;
+ at = reinterpret_cast<uint8_t*>( mData ) + offset;
}
// set new count first as otherwise the debug assert will hit us
SetCount( newCount );
// Move current items to a new position inside the vector.
CopyMemory( at + size,
at,
- ( reinterpret_cast<char*>( mData ) + count * elementSize ) - at );
+ ( reinterpret_cast<uint8_t*>( mData ) + count * elementSize ) - at );
// Copy the given items.
CopyMemory( at, from, size );
{
DALI_ASSERT_VECTOR( ( at <= End() ) && ( at >= Begin() ) && "Iterator not inside vector" );
const SizeType size = sizeof( ItemType );
- char* address = const_cast<char*>( reinterpret_cast<const char*>( &element ) );
- VectorAlgorithms<BaseType>::Insert( reinterpret_cast< char* >( at ),
+ uint8_t* address = const_cast<uint8_t*>( reinterpret_cast<const uint8_t*>( &element ) );
+ VectorAlgorithms<BaseType>::Insert( reinterpret_cast< uint8_t* >( at ),
address,
address + size,
size );
return;
}
- VectorAlgorithms<BaseType>::Insert( reinterpret_cast< char* >( at ),
- reinterpret_cast< char* >( from ),
- reinterpret_cast< char* >( to ),
+ VectorAlgorithms<BaseType>::Insert( reinterpret_cast< uint8_t* >( at ),
+ reinterpret_cast< uint8_t* >( from ),
+ reinterpret_cast< uint8_t* >( to ),
sizeof( ItemType ) );
}
DALI_ASSERT_VECTOR( (iterator < End()) && (iterator >= Begin()) && "Iterator not inside vector" );
if( iterator < ( End() - 1u ) )
{
- VectorAlgorithms<BaseType>::Erase( reinterpret_cast< char* >( iterator ), sizeof( ItemType ) );
+ VectorAlgorithms<BaseType>::Erase( reinterpret_cast< uint8_t* >( iterator ), sizeof( ItemType ) );
}
else
{
}
else
{
- nextElement = reinterpret_cast<Iterator>( VectorAlgorithms<BaseType>::Erase( reinterpret_cast< char* >( first ),
- reinterpret_cast< char* >( last ),
+ nextElement = reinterpret_cast<Iterator>( VectorAlgorithms<BaseType>::Erase( reinterpret_cast< uint8_t* >( first ),
+ reinterpret_cast< uint8_t* >( last ),
sizeof( ItemType ) ) );
}
private:
- Impl( const Impl& ); ///< Undefined
- Impl& operator=( const Impl& ); ///< Undefined
+ // non-copyable
+ Impl( const Impl& ) = delete;
+ Impl& operator=( const Impl& ) = delete;
+
};
Property::Value::Value()
{
}
-Property::Value::Value( const Rect<int>& rectValue )
+Property::Value::Value( const Rect<int32_t>& rectValue )
: mImpl( new Impl( rectValue ) )
{
}
return converted;
}
-bool Property::Value::Get( int& integerValue ) const
+bool Property::Value::Get( int32_t& integerValue ) const
{
bool converted = false;
if( mImpl )
return converted;
}
-bool Property::Value::Get( Rect<int>& rectValue ) const
+bool Property::Value::Get( Rect<int32_t>& rectValue ) const
{
bool converted = false;
if( mImpl && (mImpl->type == RECTANGLE) ) // type cannot change in mImpl so rect is allocated