From cd0ce6e412df8961b1a5e28b496369fa49fd72d7 Mon Sep 17 00:00:00 2001 From: Kimmo Hoikka Date: Fri, 5 Oct 2018 18:15:40 +0100 Subject: [PATCH] Making DALi core internals typesafe using guaranteed types; uint8_t, uint32_t unsigned char -> uint8_t unsigned short -> uint16_t unsigned int -> uint32_t int -> int32_t Change-Id: I0e161bf56c220fda4f5dfc5dc7cde8d2aa2c584c --- automated-tests/src/dali/CMakeLists.txt | 1 + automated-tests/src/dali/utc-Dali-Core.cpp | 72 +++++++++ dali/devel-api/images/distance-field.cpp | 128 ++++++++-------- dali/devel-api/images/distance-field.h | 12 +- dali/devel-api/images/nine-patch-image.cpp | 10 +- dali/devel-api/images/pixel-data-devel.cpp | 2 +- dali/devel-api/images/pixel-data-devel.h | 15 +- dali/devel-api/images/texture-set-image.cpp | 4 +- dali/devel-api/scripting/enum-helper.h | 4 +- dali/devel-api/scripting/scripting.cpp | 48 +++--- dali/devel-api/scripting/scripting.h | 20 +-- dali/integration-api/bitmap.h | 42 +++--- dali/integration-api/core.cpp | 12 +- dali/integration-api/core.h | 19 ++- .../events/multi-point-event-integ.cpp | 10 +- .../events/multi-point-event-integ.h | 6 +- dali/integration-api/events/point.cpp | 2 +- dali/integration-api/events/point.h | 2 +- dali/integration-api/lockless-buffer.cpp | 14 +- dali/integration-api/lockless-buffer.h | 15 +- dali/integration-api/platform-abstraction.h | 8 +- dali/integration-api/profiling.cpp | 26 ++-- dali/integration-api/profiling.h | 27 ++-- dali/internal/common/buffer-index.h | 7 +- dali/internal/common/core-impl.cpp | 20 +-- dali/internal/common/core-impl.h | 20 +-- dali/internal/common/fixed-size-memory-pool.cpp | 2 +- dali/internal/common/image-attributes.cpp | 28 ++-- dali/internal/common/image-attributes.h | 13 +- dali/internal/common/message-buffer.cpp | 20 +-- dali/internal/common/message-buffer.h | 7 +- dali/internal/common/shader-data.h | 21 +-- dali/internal/common/text-vertex-2d.h | 46 ------ dali/internal/event/actors/actor-impl.cpp | 138 +++++++++--------- dali/internal/event/actors/actor-impl.h | 42 +++--- dali/internal/event/actors/camera-actor-impl.cpp | 14 +- dali/internal/event/actors/layer-impl.cpp | 14 +- dali/internal/event/actors/layer-list.cpp | 12 +- dali/internal/event/actors/layer-list.h | 11 +- dali/internal/event/animation/animation-impl.h | 2 +- dali/internal/event/animation/constrainer.cpp | 4 +- dali/internal/event/animation/constraint-base.cpp | 4 +- dali/internal/event/animation/constraint-base.h | 6 +- dali/internal/event/animation/key-frames-impl.cpp | 2 +- dali/internal/event/animation/key-frames-impl.h | 8 +- .../event/animation/linear-constrainer-impl.cpp | 7 +- .../event/animation/linear-constrainer-impl.h | 20 +-- .../event/animation/path-constrainer-impl.cpp | 8 +- dali/internal/event/animation/path-impl.cpp | 12 +- dali/internal/event/animation/progress-value.h | 20 +-- .../internal/event/animation/property-constraint.h | 4 +- .../event/animation/property-input-indexer.h | 2 +- dali/internal/event/common/event-thread-services.h | 4 +- dali/internal/event/common/object-impl.cpp | 18 +-- dali/internal/event/common/object-impl.h | 27 +--- dali/internal/event/common/projection.cpp | 4 +- .../internal/event/common/property-buffer-impl.cpp | 38 ++--- dali/internal/event/common/property-buffer-impl.h | 12 +- dali/internal/event/common/property-helper.cpp | 8 +- dali/internal/event/common/property-helper.h | 11 +- dali/internal/event/common/stage-impl.cpp | 32 ++-- dali/internal/event/common/stage-impl.h | 10 +- dali/internal/event/common/type-info-impl.cpp | 6 +- dali/internal/event/common/type-info-impl.h | 19 +-- dali/internal/event/effects/shader-factory.cpp | 8 +- dali/internal/event/events/event-processor.cpp | 18 +-- .../event/events/hit-test-algorithm-impl.cpp | 44 +++--- .../event/events/pan-gesture-processor.cpp | 12 +- dali/internal/event/images/bitmap-compressed.cpp | 14 +- dali/internal/event/images/bitmap-compressed.h | 18 +-- dali/internal/event/images/bitmap-packed-pixel.cpp | 54 +++---- dali/internal/event/images/bitmap-packed-pixel.h | 41 +++--- dali/internal/event/images/buffer-image-impl.cpp | 4 +- .../event/images/encoded-buffer-image-impl.cpp | 2 +- dali/internal/event/images/image-impl.cpp | 4 +- .../event/images/nine-patch-image-impl.cpp | 30 ++-- dali/internal/event/images/pixel-data-impl.cpp | 35 ++--- dali/internal/event/images/pixel-data-impl.h | 36 ++--- dali/internal/event/images/resource-image-impl.cpp | 6 +- .../event/render-tasks/render-task-impl.cpp | 38 ++--- .../internal/event/render-tasks/render-task-impl.h | 12 +- .../event/render-tasks/render-task-list-impl.cpp | 8 +- .../event/render-tasks/render-task-list-impl.h | 4 +- dali/internal/event/rendering/geometry-impl.cpp | 4 +- dali/internal/event/rendering/geometry-impl.h | 2 +- dali/internal/event/rendering/renderer-impl.cpp | 18 +-- dali/internal/event/rendering/renderer-impl.h | 8 +- dali/internal/event/rendering/shader-impl.cpp | 2 +- dali/internal/event/rendering/texture-set-impl.cpp | 22 +-- dali/internal/event/rendering/texture-set-impl.h | 12 +- .../size-negotiation/relayout-controller-impl.cpp | 30 ++-- .../size-negotiation/relayout-controller-impl.h | 7 +- dali/internal/render/common/render-algorithms.cpp | 4 +- .../render/common/render-instruction-container.cpp | 10 +- .../render/common/render-instruction-container.h | 8 +- dali/internal/render/common/render-item.cpp | 17 ++- dali/internal/render/common/render-list.h | 19 ++- dali/internal/render/common/render-manager.cpp | 30 ++-- dali/internal/render/common/render-manager.h | 14 +- .../render/data-providers/node-data-provider.h | 10 +- dali/internal/render/queue/render-queue.cpp | 4 +- dali/internal/render/queue/render-queue.h | 4 +- .../render/renderers/render-frame-buffer.cpp | 10 +- .../render/renderers/render-frame-buffer.h | 14 +- dali/internal/render/renderers/render-geometry.cpp | 63 ++++---- dali/internal/render/renderers/render-geometry.h | 13 +- .../render/renderers/render-property-buffer.cpp | 19 +-- .../render/renderers/render-property-buffer.h | 38 ++--- dali/internal/render/renderers/render-renderer.cpp | 24 +-- dali/internal/render/renderers/render-renderer.h | 16 +- dali/internal/render/renderers/render-texture.cpp | 26 ++-- dali/internal/render/renderers/render-texture.h | 5 +- .../internal/render/shaders/program-controller.cpp | 4 +- dali/internal/render/shaders/program.cpp | 56 +++---- dali/internal/render/shaders/program.h | 26 ++-- .../update/animation/scene-graph-animation.cpp | 10 +- .../update/animation/scene-graph-animation.h | 52 +++---- .../update/animation/scene-graph-animator.h | 49 ++++--- .../animation/scene-graph-constraint-base.cpp | 8 +- .../update/animation/scene-graph-constraint-base.h | 10 +- dali/internal/update/common/animatable-property.h | 92 ++++++------ dali/internal/update/common/double-buffered.h | 22 +-- dali/internal/update/common/inherited-property.h | 28 ++-- .../update/common/property-condition-functions.cpp | 14 +- .../common/property-condition-step-functions.cpp | 12 +- .../property-condition-variable-step-functions.cpp | 16 +- .../update/common/property-owner-messages.h | 21 +-- dali/internal/update/common/property-owner.h | 2 - dali/internal/update/common/uniform-map.cpp | 11 +- dali/internal/update/common/uniform-map.h | 14 +- .../controllers/render-message-dispatcher.cpp | 10 +- .../update/gestures/scene-graph-pan-gesture.cpp | 37 ++--- dali/internal/update/manager/free-list.h | 28 ++-- .../manager/render-instruction-processor.cpp | 27 ++-- .../update/manager/render-task-processor.cpp | 15 +- .../update/manager/transform-manager-property.h | 54 +++---- dali/internal/update/manager/transform-manager.cpp | 60 ++++---- dali/internal/update/manager/transform-manager.h | 48 +++--- dali/internal/update/manager/update-manager.cpp | 116 ++++++++------- dali/internal/update/manager/update-manager.h | 162 ++++++++++----------- dali/internal/update/nodes/node-messages.h | 10 +- dali/internal/update/nodes/node.cpp | 2 +- dali/internal/update/nodes/node.h | 2 +- dali/internal/update/nodes/scene-graph-layer.cpp | 4 +- dali/internal/update/nodes/scene-graph-layer.h | 14 +- .../internal/update/queue/update-message-queue.cpp | 4 +- dali/internal/update/queue/update-message-queue.h | 4 +- .../update/render-tasks/scene-graph-camera.cpp | 31 ++-- .../update/render-tasks/scene-graph-camera.h | 36 ++--- .../render-tasks/scene-graph-render-task-list.cpp | 7 +- .../render-tasks/scene-graph-render-task-list.h | 12 +- .../render-tasks/scene-graph-render-task.cpp | 14 +- .../update/render-tasks/scene-graph-render-task.h | 40 ++--- .../update/rendering/scene-graph-renderer.cpp | 97 ++++++------ .../update/rendering/scene-graph-renderer.h | 80 +++++----- .../update/rendering/scene-graph-texture-set.cpp | 34 ++--- .../update/rendering/scene-graph-texture-set.h | 38 ++--- dali/public-api/common/dali-vector.cpp | 16 +- dali/public-api/common/dali-vector.h | 34 ++--- dali/public-api/object/property-value.cpp | 12 +- 160 files changed, 1787 insertions(+), 1751 deletions(-) create mode 100644 automated-tests/src/dali/utc-Dali-Core.cpp delete mode 100644 dali/internal/common/text-vertex-2d.h diff --git a/automated-tests/src/dali/CMakeLists.txt b/automated-tests/src/dali/CMakeLists.txt index 2c8e72e..288073d 100644 --- a/automated-tests/src/dali/CMakeLists.txt +++ b/automated-tests/src/dali/CMakeLists.txt @@ -23,6 +23,7 @@ SET(TC_SOURCES 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 diff --git a/automated-tests/src/dali/utc-Dali-Core.cpp b/automated-tests/src/dali/utc-Dali-Core.cpp new file mode 100644 index 0000000..7a5eff9 --- /dev/null +++ b/automated-tests/src/dali/utc-Dali-Core.cpp @@ -0,0 +1,72 @@ +/* + * 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 +#include +#include // isfinite + +#include +#include +#include + +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; +} + diff --git a/dali/devel-api/images/distance-field.cpp b/dali/devel-api/images/distance-field.cpp index 63a5150..7c2a524 100755 --- a/dali/devel-api/images/distance-field.cpp +++ b/dali/devel-api/images/distance-field.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -46,24 +46,24 @@ float Bilinear( float a, float b, float c, float d, float dx, float dy ) 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( width ) / static_cast( targetWidth ); + float yScale = static_cast( height ) / static_cast( 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( y ) ); + const int32_t otherY = std::min( sampleY + 1, height - 1 ); + const float dy = (yScale * static_cast( y ) ) - static_cast( 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( x ) ); + const int32_t otherX = std::min( sampleX + 1, width - 1 ); + const float dx = (xScale * static_cast( x ) ) - static_cast( sampleX ); float value = Bilinear( in[ sampleY * width + sampleX ], in[ sampleY * width + otherX ], @@ -77,31 +77,31 @@ void ScaleField( int width, int height, float* in, int targetWidth, int targetHe } #define SQUARE(a) ((a) * (a)) -const float MAX_DISTANCE( 1e20 ); +const float MAX_DISTANCE = static_cast( 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 parabolas(length); // Locations of parabolas in lower envelope + std::vector parabolas(length); // Locations of parabolas in lower envelope std::vector 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( i*i ) ); + int32_t parabola = parabolas[rightmost]; + float newDistance( (initialDistance - (source[parabola] + static_cast( parabola * parabola ))) / static_cast(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( parabola * parabola ))) / static_cast(2 * i - 2 * parabola); } rightmost++; @@ -111,48 +111,48 @@ void DistanceTransform( float *source, float* dest, unsigned int length ) } 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( i ) ) { ++rightmost; } - dest[i] = SQUARE( static_cast< int >( i ) - parabolas[rightmost] ) + source[parabolas[rightmost]]; + dest[i] = static_cast( 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]; } @@ -161,31 +161,31 @@ void DistanceTransform( float* data, unsigned int width, unsigned int height, fl } // 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(imageSize.width) ); - const int originalHeight( static_cast(imageSize.height) ); - const int paddedWidth( originalWidth + (fieldBorder * 2 ) ); - const int paddedHeight( originalHeight + (fieldBorder * 2 ) ); - const int scaledWidth( static_cast(distanceMapSize.width) ); - const int scaledHeight( static_cast(distanceMapSize.height) ); - const int maxWidth( static_cast(maxSize.width) + (fieldBorder * 2 )); - const int maxHeight( static_cast(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(imageSize.width) ); + const uint32_t originalHeight( static_cast(imageSize.height) ); + const uint32_t paddedWidth( originalWidth + (fieldBorder * 2 ) ); + const uint32_t paddedHeight( originalHeight + (fieldBorder * 2 ) ); + const uint32_t scaledWidth( static_cast(distanceMapSize.width) ); + const uint32_t scaledHeight( static_cast(distanceMapSize.height) ); + const uint32_t maxWidth( static_cast(maxSize.width) + (fieldBorder * 2 )); + const uint32_t maxHeight( static_cast(maxSize.height) + (fieldBorder * 2 ) ); + + const uint32_t bufferLength( std::max( maxWidth, std::max(paddedWidth, scaledWidth) ) * + std::max( maxHeight, std::max(paddedHeight, scaledHeight) ) ); std::vector outsidePixels( bufferLength, 0.0f ); std::vector insidePixels( bufferLength, 0.0f ); @@ -193,21 +193,21 @@ void GenerateDistanceFieldMap(const unsigned char* const imagePixels, const Size 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(255 - pixel) / 255.0f); + inside[ y * paddedWidth + x ] = (pixel == 255) ? MAX_DISTANCE : SQUARE( static_cast(pixel) / 255.0f); } } } @@ -216,7 +216,7 @@ void GenerateDistanceFieldMap(const unsigned char* const imagePixels, const Size if( highQuality ) { // create temporary buffers for DistanceTransform() - const int tempBufferLength( std::max(paddedWidth, paddedHeight) ); + const uint32_t tempBufferLength( std::max(paddedWidth, paddedHeight) ); std::vector tempSourceBuffer( tempBufferLength, 0.0f ); std::vector tempDestBuffer( tempBufferLength, 0.0f ); @@ -228,11 +228,11 @@ void GenerateDistanceFieldMap(const unsigned char* const imagePixels, const Size } // 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 ); @@ -244,12 +244,12 @@ void GenerateDistanceFieldMap(const unsigned char* const imagePixels, const Size 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); } } } diff --git a/dali/devel-api/images/distance-field.h b/dali/devel-api/images/distance-field.h index 51ca056..3b802eb 100644 --- a/dali/devel-api/images/distance-field.h +++ b/dali/devel-api/images/distance-field.h @@ -18,6 +18,8 @@ * */ +// EXTERNAL INCLUDES +#include // uint8_t, uint32_t // INTERNAL INCLUDES #include @@ -39,11 +41,11 @@ struct Vector2; * @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 diff --git a/dali/devel-api/images/nine-patch-image.cpp b/dali/devel-api/images/nine-patch-image.cpp index 551c25d..dd7dbc5 100644 --- a/dali/devel-api/images/nine-patch-image.cpp +++ b/dali/devel-api/images/nine-patch-image.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -72,10 +72,10 @@ Vector4 NinePatchImage::GetStretchBorders() 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( stretchPixelsX[ 0 ].GetX() + 1 ); + border.y = static_cast( stretchPixelsY[ 0 ].GetX() + 1 ); + border.z = static_cast( GetWidth() - stretchPixelsX[ 0 ].GetY() - 1 ); + border.w = static_cast( GetHeight() - stretchPixelsY[ 0 ].GetY() - 1 ); } return border; diff --git a/dali/devel-api/images/pixel-data-devel.cpp b/dali/devel-api/images/pixel-data-devel.cpp index 41dafa3..eb0ac1f 100644 --- a/dali/devel-api/images/pixel-data-devel.cpp +++ b/dali/devel-api/images/pixel-data-devel.cpp @@ -1,5 +1,5 @@ /* - * 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. diff --git a/dali/devel-api/images/pixel-data-devel.h b/dali/devel-api/images/pixel-data-devel.h index 506efb7..8400a97 100644 --- a/dali/devel-api/images/pixel-data-devel.h +++ b/dali/devel-api/images/pixel-data-devel.h @@ -2,7 +2,7 @@ #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. @@ -18,10 +18,11 @@ * */ -// INTERNAL INCLUDES -#include +// EXTERNAL INCLUDES +#include // INTERNAL INCLUDES +#include #include namespace Dali @@ -39,12 +40,12 @@ namespace DevelPixelData */ 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), diff --git a/dali/devel-api/images/texture-set-image.cpp b/dali/devel-api/images/texture-set-image.cpp index 84411ce..af67132 100644 --- a/dali/devel-api/images/texture-set-image.cpp +++ b/dali/devel-api/images/texture-set-image.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -33,7 +33,7 @@ void TextureSetImage( TextureSet textureSet, size_t index, Image image ) texture = GetImplementation( image ).GetTexture(); } - GetImplementation( textureSet ).SetTexture( index, texture ); + GetImplementation( textureSet ).SetTexture( static_cast( index ), texture ); } } // namespace Dali diff --git a/dali/devel-api/scripting/enum-helper.h b/dali/devel-api/scripting/enum-helper.h index 89beaa4..13327d3 100644 --- a/dali/devel-api/scripting/enum-helper.h +++ b/dali/devel-api/scripting/enum-helper.h @@ -2,7 +2,7 @@ #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. @@ -44,7 +44,7 @@ namespace Dali */ #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( sizeof( t##_TABLE ) / sizeof( t##_TABLE[0] ) ); #define DALI_ENUM_TO_STRING( s ) { #s, s }, /** diff --git a/dali/devel-api/scripting/scripting.cpp b/dali/devel-api/scripting/scripting.cpp index 30bc996..ed63372 100644 --- a/dali/devel-api/scripting/scripting.cpp +++ b/dali/devel-api/scripting/scripting.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -67,7 +67,7 @@ const StringEnum PIXEL_FORMAT_TABLE[] = { "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( sizeof( PIXEL_FORMAT_TABLE ) / sizeof( PIXEL_FORMAT_TABLE[0] ) ); const StringEnum IMAGE_FITTING_MODE_TABLE[] = { @@ -76,7 +76,7 @@ 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( sizeof( IMAGE_FITTING_MODE_TABLE ) / sizeof( IMAGE_FITTING_MODE_TABLE[0] ) ); const StringEnum IMAGE_SAMPLING_MODE_TABLE[] = { @@ -88,15 +88,15 @@ 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( 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( 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; @@ -109,11 +109,11 @@ bool EnumStringToInteger( const char * const value, const StringEnum* const enum 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 ) ) { @@ -148,13 +148,13 @@ bool EnumStringToInteger( const char * const value, const StringEnum* const enum 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; @@ -187,7 +187,7 @@ Image NewImage( const Property::Value& property ) { 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 ] ) ) { @@ -215,7 +215,7 @@ Image NewImage( const Property::Value& property ) // 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 ) @@ -223,7 +223,7 @@ Image NewImage( const Property::Value& property ) // handle floats and integer the same for json script if( value->GetType() == Property::FLOAT ) { - width = static_cast( value->Get() ); + width = static_cast( value->Get() ); } else { @@ -235,7 +235,7 @@ Image NewImage( const Property::Value& property ) { if( value->GetType() == Property::FLOAT ) { - height = static_cast( value->Get() ); + height = static_cast( value->Get() ); } else { @@ -288,7 +288,7 @@ Image NewImage( const Property::Value& property ) { case RESOURCE_IMAGE : { - ret = ResourceImage::New( filename, ImageDimensions( attributes.GetSize().x, attributes.GetSize().y ), + ret = ResourceImage::New( filename, ImageDimensions( static_cast( attributes.GetSize().x ), static_cast( attributes.GetSize().y ) ), attributes.GetScalingMode(), attributes.GetFilterMode(), attributes.GetOrientationCorrection() ); break; } @@ -340,7 +340,7 @@ Actor NewActor( const Property::Map& map ) 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 ) @@ -398,11 +398,11 @@ void CreatePropertyMap( Actor actor, Property::Map& map ) } // 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 ); @@ -441,8 +441,8 @@ void CreatePropertyMap( Image image, Property::Map& map ) 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 ) { @@ -461,7 +461,7 @@ void NewAnimation( const Property::Map& map, Dali::AnimationData& outputAnimatio 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 ) @@ -544,7 +544,7 @@ void NewAnimation( const Property::Map& map, Dali::AnimationData& outputAnimatio 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 ) diff --git a/dali/devel-api/scripting/scripting.h b/dali/devel-api/scripting/scripting.h index e7c51ba..01cf485 100644 --- a/dali/devel-api/scripting/scripting.h +++ b/dali/devel-api/scripting/scripting.h @@ -43,8 +43,8 @@ namespace Scripting */ 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 }; /** @@ -55,7 +55,7 @@ struct StringEnum * @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 @@ -68,7 +68,7 @@ DALI_CORE_API unsigned int FindEnumIndex( const char* value, const StringEnum* t * @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. @@ -81,7 +81,7 @@ DALI_CORE_API bool EnumStringToInteger( const char* const value, const StringEnu * @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 ) @@ -108,7 +108,7 @@ bool GetEnumeration( const char* value, const StringEnum* table, unsigned int ta * @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; @@ -156,7 +156,7 @@ bool GetEnumerationProperty( const Property::Value& propertyValue, const StringE * @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; @@ -215,11 +215,11 @@ bool GetBitmaskEnumerationProperty( const Property::Value& propertyValue, const * @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) ) { @@ -243,7 +243,7 @@ const char* GetEnumerationName( T value, const StringEnum* table, unsigned int t * @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( tableCount ) ) ) { diff --git a/dali/integration-api/bitmap.h b/dali/integration-api/bitmap.h index 3c60065..3058689 100644 --- a/dali/integration-api/bitmap.h +++ b/dali/integration-api/bitmap.h @@ -43,7 +43,7 @@ DALI_CORE_API void ConvertToGlFormat(Pixel::Format pixelformat, unsigned& pixelD class Bitmap; typedef IntrusivePtr 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. @@ -68,8 +68,8 @@ protected: * @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: @@ -113,7 +113,7 @@ public: * Get the width of the image * @return The width of the image */ - unsigned int GetImageWidth() const + uint32_t GetImageWidth() const { return mImageWidth; } @@ -122,7 +122,7 @@ public: * Get the height of the image * @return The height of the image */ - unsigned int GetImageHeight() const + uint32_t GetImageHeight() const { return mImageHeight; } @@ -159,7 +159,7 @@ public: * @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 @@ -211,10 +211,10 @@ public: * @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. @@ -238,29 +238,29 @@ public: */ 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. @@ -310,7 +310,7 @@ public: virtual PixelBuffer* ReserveBufferOfSize( Pixel::Format pixelFormat, const unsigned width, const unsigned height, - const size_t numBytes ) = 0; + const uint32_t numBytes ) = 0; protected: /** @@ -353,8 +353,8 @@ 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. diff --git a/dali/integration-api/core.cpp b/dali/integration-api/core.cpp index 8d34ae3..4f2e5d2 100644 --- a/dali/integration-api/core.cpp +++ b/dali/integration-api/core.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -79,17 +79,17 @@ void Core::RecoverFromContextLoss() 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); } @@ -109,12 +109,12 @@ void Core::ProcessEvents() 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 ); } diff --git a/dali/integration-api/core.h b/dali/integration-api/core.h index 4220e50..84ae5e6 100644 --- a/dali/integration-api/core.h +++ b/dali/integration-api/core.h @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include // uint32_t + // INTERNAL INCLUDES #include #include @@ -86,7 +89,7 @@ public: * 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. @@ -110,7 +113,7 @@ public: public: - unsigned int keepUpdating; ///< A bitmask of KeepUpdating values + uint32_t keepUpdating; ///< A bitmask of KeepUpdating values bool needsNotification; bool surfaceRectChanged; float secondsFromLastFrame; @@ -304,7 +307,7 @@ public: * @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. @@ -313,7 +316,7 @@ public: * 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 @@ -325,7 +328,7 @@ public: * @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 @@ -357,7 +360,7 @@ public: * 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. @@ -375,8 +378,8 @@ public: * @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 ); diff --git a/dali/integration-api/events/multi-point-event-integ.cpp b/dali/integration-api/events/multi-point-event-integ.cpp index 780a04f..099bb3e 100644 --- a/dali/integration-api/events/multi-point-event-integ.cpp +++ b/dali/integration-api/events/multi-point-event-integ.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -48,21 +48,21 @@ void MultiPointEvent::AddPoint( const Point& point ) 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( points.size() ); // not going to overflow in practice } } // namespace Integration diff --git a/dali/integration-api/events/multi-point-event-integ.h b/dali/integration-api/events/multi-point-event-integ.h index 364c541..7dec1be 100644 --- a/dali/integration-api/events/multi-point-event-integ.h +++ b/dali/integration-api/events/multi-point-event-integ.h @@ -87,19 +87,19 @@ public: * @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 diff --git a/dali/integration-api/events/point.cpp b/dali/integration-api/events/point.cpp index 7b52bc3..2349f02 100755 --- a/dali/integration-api/events/point.cpp +++ b/dali/integration-api/events/point.cpp @@ -53,7 +53,7 @@ Point::~Point() { } -void Point::SetDeviceId( int deviceId ) +void Point::SetDeviceId( int32_t deviceId ) { mTouchPoint.deviceId = deviceId; } diff --git a/dali/integration-api/events/point.h b/dali/integration-api/events/point.h index 9b33ed3..543e86e 100755 --- a/dali/integration-api/events/point.h +++ b/dali/integration-api/events/point.h @@ -60,7 +60,7 @@ struct DALI_CORE_API Point * * @param[in] deviceId The Unique Device ID. */ - void SetDeviceId( int deviceId ); + void SetDeviceId( int32_t deviceId ); /** * @brief Set the state of the point. diff --git a/dali/integration-api/lockless-buffer.cpp b/dali/integration-api/lockless-buffer.cpp index b704dbc..dd2217d 100644 --- a/dali/integration-api/lockless-buffer.cpp +++ b/dali/integration-api/lockless-buffer.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -27,13 +27,13 @@ namespace Dali 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 ); @@ -45,7 +45,7 @@ LocklessBuffer::~LocklessBuffer() 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 ); @@ -66,7 +66,7 @@ void LocklessBuffer::Write( const unsigned char *src, size_t size ) (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 ); @@ -90,7 +90,7 @@ const unsigned char* LocklessBuffer::Read() return mBuffer[!currentWriteBuf]; } -unsigned int LocklessBuffer::GetSize() const +uint32_t LocklessBuffer::GetSize() const { return static_cast(mSize); } diff --git a/dali/integration-api/lockless-buffer.h b/dali/integration-api/lockless-buffer.h index 8c0530d..163eac7 100644 --- a/dali/integration-api/lockless-buffer.h +++ b/dali/integration-api/lockless-buffer.h @@ -19,6 +19,7 @@ */ // EXTERNAL INCLUDES +#include // uint32_t, uint8_t // INTERNAL INCLUDES #include @@ -52,7 +53,7 @@ public: * Constructor. * @param[in] size The size of buffers in bytes. */ - LocklessBuffer( size_t size ); + LocklessBuffer( uint32_t size ); /** * Destructor. @@ -64,19 +65,19 @@ public: * @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: /** @@ -101,9 +102,9 @@ 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 diff --git a/dali/integration-api/platform-abstraction.h b/dali/integration-api/platform-abstraction.h index 7a41087..79161fb 100644 --- a/dali/integration-api/platform-abstraction.h +++ b/dali/integration-api/platform-abstraction.h @@ -2,7 +2,7 @@ #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. @@ -30,7 +30,7 @@ namespace Dali namespace Integration { -typedef unsigned int ResourceId; +typedef uint32_t ResourceId; typedef IntrusivePtr ResourcePointer; /** @@ -116,7 +116,7 @@ public: * @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. @@ -125,7 +125,7 @@ public: * @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: diff --git a/dali/integration-api/profiling.cpp b/dali/integration-api/profiling.cpp index 8c1c74f..04d11d5 100644 --- a/dali/integration-api/profiling.cpp +++ b/dali/integration-api/profiling.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -80,43 +80,43 @@ void EnableProfiling( ProfilingType type ) namespace Profiling { -const int ANIMATION_MEMORY_SIZE( +const std::size_t ANIMATION_MEMORY_SIZE( sizeof( Internal::Animation ) + sizeof( Internal::AnimatorConnector ) + sizeof( Internal::SceneGraph::Animation ) ); -const int CONSTRAINT_MEMORY_SIZE( +const std::size_t CONSTRAINT_MEMORY_SIZE( sizeof( Internal::Constraint ) + sizeof( Internal::SceneGraph::Constraint > ) ); -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 ) ); diff --git a/dali/integration-api/profiling.h b/dali/integration-api/profiling.h index 21896fa..aec615c 100644 --- a/dali/integration-api/profiling.h +++ b/dali/integration-api/profiling.h @@ -19,6 +19,7 @@ */ // EXTERNAL INCLUDES +#include // INTERNAL INCLUDES #include @@ -48,20 +49,20 @@ DALI_CORE_API void EnableProfiling( ProfilingType type ); 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 diff --git a/dali/internal/common/buffer-index.h b/dali/internal/common/buffer-index.h index f5dee67..2c6fca0 100644 --- a/dali/internal/common/buffer-index.h +++ b/dali/internal/common/buffer-index.h @@ -2,7 +2,7 @@ #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. @@ -18,13 +18,16 @@ * */ +// EXTERNAL INCLUDES +#include + namespace Dali { namespace Internal { -typedef unsigned int BufferIndex; +typedef uint32_t BufferIndex; } // namespace Internal diff --git a/dali/internal/common/core-impl.cpp b/dali/internal/common/core-impl.cpp index 5d4ef67..12dbec6 100644 --- a/dali/internal/common/core-impl.cpp +++ b/dali/internal/common/core-impl.cpp @@ -56,7 +56,7 @@ using Dali::Internal::SceneGraph::RenderQueue; 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"); @@ -187,30 +187,30 @@ void Core::ContextDestroyed() 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( width ), static_cast( 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( size.width ), static_cast( 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( size.width ), static_cast( 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( dpiHorizontal ), static_cast( 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 @@ -304,7 +304,7 @@ void Core::ProcessEvents() mProcessingEvent = false; } -unsigned int Core::GetMaximumUpdateCount() const +uint32_t Core::GetMaximumUpdateCount() const { return MAXIMUM_UPDATE_COUNT; } diff --git a/dali/internal/common/core-impl.h b/dali/internal/common/core-impl.h index d4d19e2..49d62ea 100644 --- a/dali/internal/common/core-impl.h +++ b/dali/internal/common/core-impl.h @@ -113,29 +113,29 @@ public: 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() @@ -160,7 +160,7 @@ public: /** * @copydoc Dali::Integration::Core::GetMaximumUpdateCount() */ - unsigned int GetMaximumUpdateCount() const; + uint32_t GetMaximumUpdateCount() const; /** * @copydoc Dali::Integration::Core::GetSystemOverlay() diff --git a/dali/internal/common/fixed-size-memory-pool.cpp b/dali/internal/common/fixed-size-memory-pool.cpp index 774d20c..5da3ad0 100644 --- a/dali/internal/common/fixed-size-memory-pool.cpp +++ b/dali/internal/common/fixed-size-memory-pool.cpp @@ -196,7 +196,7 @@ void* FixedSizeMemoryPool::Allocate() } // 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++; diff --git a/dali/internal/common/image-attributes.cpp b/dali/internal/common/image-attributes.cpp index b13b530..9adf588 100755 --- a/dali/internal/common/image-attributes.cpp +++ b/dali/internal/common/image-attributes.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -67,8 +67,8 @@ struct ImageAttributes::ImageAttributesImpl 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. @@ -97,16 +97,16 @@ ImageAttributes::~ImageAttributes() 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( width ); // truncated + impl->height = static_cast( height ); // truncated } void ImageAttributes::SetSize( const Size& size ) { - impl->width = size.width; - impl->height = size.height; + impl->width = static_cast( size.width ); // truncated + impl->height = static_cast( size.height ); // truncated } void ImageAttributes::SetScalingMode( ScalingMode scale ) @@ -133,12 +133,12 @@ void ImageAttributes::Reset( ImageDimensions dimensions, ScalingMode scaling, Fi 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; } @@ -168,14 +168,6 @@ ImageAttributes ImageAttributes::New() 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 diff --git a/dali/internal/common/image-attributes.h b/dali/internal/common/image-attributes.h index a0803cb..94a2343 100644 --- a/dali/internal/common/image-attributes.h +++ b/dali/internal/common/image-attributes.h @@ -2,7 +2,7 @@ #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. @@ -128,15 +128,6 @@ public: 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. @@ -146,7 +137,7 @@ public: * @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. diff --git a/dali/internal/common/message-buffer.cpp b/dali/internal/common/message-buffer.cpp index 9e89789..2933619 100644 --- a/dali/internal/common/message-buffer.cpp +++ b/dali/internal/common/message-buffer.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -29,16 +29,16 @@ namespace // unnamed namespace { // 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 @@ -62,7 +62,7 @@ MessageBuffer::~MessageBuffer() free( mData ); } -unsigned int* MessageBuffer::ReserveMessageSlot( std::size_t size ) +uint32_t* MessageBuffer::ReserveMessageSlot( std::size_t size ) { DALI_ASSERT_DEBUG( 0 != size ); @@ -97,7 +97,7 @@ unsigned int* MessageBuffer::ReserveMessageSlot( std::size_t size ) // End marker *mNextSlot = 0; - return reinterpret_cast(slot); + return reinterpret_cast(slot); } std::size_t MessageBuffer::GetCapacity() const diff --git a/dali/internal/common/message-buffer.h b/dali/internal/common/message-buffer.h index 8e1a17a..eabeb78 100644 --- a/dali/internal/common/message-buffer.h +++ b/dali/internal/common/message-buffer.h @@ -2,7 +2,7 @@ #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. @@ -19,7 +19,8 @@ */ // EXTERNAL INCLUDES -#include +#include // size_t +#include // uint32_t namespace Dali { @@ -53,7 +54,7 @@ public: * @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. diff --git a/dali/internal/common/shader-data.h b/dali/internal/common/shader-data.h index 4b06816..2b486e9 100644 --- a/dali/internal/common/shader-data.h +++ b/dali/internal/common/shader-data.h @@ -2,7 +2,7 @@ #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. @@ -123,7 +123,7 @@ public: // API * 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 ); } @@ -132,7 +132,7 @@ public: // API * Get the program buffer * @return reference to the buffer */ - size_t GetBufferSize() const + std::size_t GetBufferSize() const { return mBuffer.Size(); } @@ -141,7 +141,7 @@ public: // API * 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]; @@ -151,7 +151,7 @@ public: // API * Get the data that the buffer points to * @return raw pointer to the buffer data */ - Dali::Vector& GetBuffer() + Dali::Vector& GetBuffer() { return mBuffer; } @@ -163,11 +163,12 @@ private: // Not implemented 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 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 mBuffer; ///< buffer containing compiled binary bytecode + }; } // namespace Integration diff --git a/dali/internal/common/text-vertex-2d.h b/dali/internal/common/text-vertex-2d.h deleted file mode 100644 index 54d5242..0000000 --- a/dali/internal/common/text-vertex-2d.h +++ /dev/null @@ -1,46 +0,0 @@ -#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__ - diff --git a/dali/internal/event/actors/actor-impl.cpp b/dali/internal/event/actors/actor-impl.cpp index 0e3cf2e..9f4356d 100644 --- a/dali/internal/event/actors/actor-impl.cpp +++ b/dali/internal/event/actors/actor-impl.cpp @@ -68,7 +68,7 @@ namespace Dali namespace Internal { -unsigned int Actor::mActorCounter = 0; +uint32_t Actor::mActorCounter = 0; namespace { @@ -103,7 +103,7 @@ struct Actor::RelayoutData : 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; @@ -324,9 +324,9 @@ DALI_ENUM_TO_STRING_TABLE_END( LAYOUT_DIRECTION ) 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; @@ -432,7 +432,7 @@ void Actor::SetName( const std::string& name ) } } -unsigned int Actor::GetId() const +uint32_t Actor::GetId() const { return mId; } @@ -571,12 +571,12 @@ void Actor::Unparent() } } -unsigned int Actor::GetChildCount() const +uint32_t Actor::GetChildCount() const { - return ( NULL != mChildren ) ? mChildren->size() : 0; + return ( NULL != mChildren ) ? static_cast( 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() ); @@ -606,7 +606,7 @@ ActorPtr Actor::FindChildByName( const std::string& actorName ) return child; } -ActorPtr Actor::FindChildById( const unsigned int id ) +ActorPtr Actor::FindChildById( const uint32_t id ) { ActorPtr child = 0; if( id == mId ) @@ -1092,7 +1092,7 @@ ClippingMode::Type Actor::GetClippingMode() const return mClippingMode; } -unsigned int Actor::GetSortingDepth() +uint32_t Actor::GetSortingDepth() { return mSortedDepth; } @@ -1367,7 +1367,7 @@ void Actor::SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimensio 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 ) ) { @@ -1438,7 +1438,7 @@ ResizePolicy::Type Actor::GetResizePolicy( Dimension::Type dimension ) const 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 ) ) ) { @@ -1478,7 +1478,7 @@ void Actor::SetDimensionDependency( Dimension::Type dimension, Dimension::Type d { 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 ) ) { @@ -1492,7 +1492,7 @@ Dimension::Type Actor::GetDimensionDependency( Dimension::Type dimension ) const 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 ) ) ) { @@ -1529,7 +1529,7 @@ void Actor::SetLayoutDirty( bool dirty, Dimension::Type dimension ) { 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 ) ) { @@ -1542,7 +1542,7 @@ bool Actor::IsLayoutDirty( Dimension::Type dimension ) const { 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 ] ) { @@ -1564,32 +1564,32 @@ bool Actor::RelayoutRequired( Dimension::Type dimension ) const 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( 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( 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() ) @@ -1617,7 +1617,7 @@ void Actor::RemoveRenderer( Renderer& renderer ) } } -void Actor::RemoveRenderer( unsigned int index ) +void Actor::RemoveRenderer( uint32_t index ) { if( index < GetRendererCount() ) { @@ -1659,10 +1659,10 @@ bool Actor::ScreenToLocal( float& localX, float& localY, float screenX, float sc 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 @@ -1714,19 +1714,19 @@ bool Actor::ScreenToLocal( const Matrix& viewMatrix, const Matrix& projectionMat 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( viewport.x ), static_cast( viewport.height ) - screenY - static_cast( 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( viewport.width ), static_cast( 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( viewport.width ), static_cast( viewport.height ), farPos ); } if( success ) @@ -2260,7 +2260,7 @@ Actor::~Actor() } } -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. @@ -2285,12 +2285,12 @@ void Actor::ConnectToStage( unsigned int parentDepth ) 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(); @@ -2306,7 +2306,7 @@ void Actor::RecursiveConnectToStage( ActorContainer& connectionList, unsigned in ActorConstIter endIter = mChildren->end(); for( ActorIter iter = mChildren->begin(); iter != endIter; ++iter ) { - (*iter)->RecursiveConnectToStage( connectionList, depth+1 ); + (*iter)->RecursiveConnectToStage( connectionList, depth + 1 ); } } } @@ -2468,14 +2468,14 @@ void Actor::RebuildDepthTree() // in a single message OwnerPointer 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& sceneGraphNodeDepths, int& depthIndex ) +void Actor::DepthTraverseActorTree( OwnerPointer& sceneGraphNodeDepths, int32_t& depthIndex ) { mSortedDepth = depthIndex * DevelLayer::SIBLING_ORDER_MULTIPLIER; sceneGraphNodeDepths->Add( const_cast( mNode ), mSortedDepth ); @@ -2492,7 +2492,7 @@ void Actor::DepthTraverseActorTree( OwnerPointer& sceneG } } -unsigned int Actor::GetDefaultPropertyCount() const +uint32_t Actor::GetDefaultPropertyCount() const { return DEFAULT_PROPERTY_COUNT; } @@ -2501,7 +2501,7 @@ void Actor::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const { 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 ); } @@ -2522,7 +2522,7 @@ Property::Index Actor::GetDefaultPropertyIndex( const std::string& name ) const 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 ) ) @@ -2849,7 +2849,7 @@ void Actor::SetDefaultProperty( Property::Index index, const Property::Value& pr 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 ); @@ -2859,7 +2859,7 @@ void Actor::SetDefaultProperty( Property::Index index, const Property::Value& pr 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 ); @@ -4447,7 +4447,7 @@ void Actor::EnsureRelayoutData() 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 ) ) ) { @@ -4465,7 +4465,7 @@ bool Actor::RelayoutDependentOnParent( Dimension::Type dimension ) 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 ) ) ) { @@ -4497,7 +4497,7 @@ bool Actor::RelayoutDependentOnChildrenBase( Dimension::Type dimension ) 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 ) ) { @@ -4510,7 +4510,7 @@ bool Actor::RelayoutDependentOnDimension( Dimension::Type dimension, Dimension:: 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 ) ) { @@ -4522,7 +4522,7 @@ void Actor::SetNegotiatedDimension( float negotiatedDimension, Dimension::Type d 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 ) ) ) { @@ -4537,7 +4537,7 @@ void Actor::SetPadding( const Vector2& padding, Dimension::Type dimension ) { 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 ) ) { @@ -4551,7 +4551,7 @@ Vector2 Actor::GetPadding( Dimension::Type dimension ) const 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 ) ) ) { @@ -4567,7 +4567,7 @@ void Actor::SetLayoutNegotiated( bool negotiated, Dimension::Type dimension ) { 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 ) ) { @@ -4580,7 +4580,7 @@ bool Actor::IsLayoutNegotiated( Dimension::Type dimension ) const { 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 ] ) { @@ -4700,7 +4700,7 @@ float Actor::NegotiateFromChildren( Dimension::Type dimension ) { 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 ); @@ -4815,7 +4815,7 @@ void Actor::NegotiateDimension( Dimension::Type dimension, const Vector2& alloca 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 ); @@ -4835,7 +4835,7 @@ void Actor::NegotiateDimension( Dimension::Type dimension, const Vector2& alloca // 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 ); @@ -4875,7 +4875,7 @@ void Actor::NegotiateDimensions( const Vector2& allocatedSize ) // 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 ); @@ -5006,7 +5006,7 @@ void Actor::NegotiateSize( const Vector2& allocatedSize, RelayoutContainer& cont 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 ); @@ -5037,7 +5037,7 @@ void Actor::SetUseAssignedSize( bool use, Dimension::Type dimension ) { 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 ) ) { @@ -5052,7 +5052,7 @@ bool Actor::GetUseAssignedSize( Dimension::Type dimension ) const 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 ) ) { @@ -5115,7 +5115,7 @@ void Actor::SetMinimumSize( float size, Dimension::Type dimension ) { 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 ) ) { @@ -5130,7 +5130,7 @@ float Actor::GetMinimumSize( Dimension::Type dimension ) const { 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 ) ) { @@ -5146,7 +5146,7 @@ void Actor::SetMaximumSize( float size, Dimension::Type dimension ) { 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 ) ) { @@ -5161,7 +5161,7 @@ float Actor::GetMaximumSize( Dimension::Type dimension ) const { 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 ) ) { @@ -5195,12 +5195,12 @@ void Actor::SetVisibleInternal( bool visible, SendMessage::Type sendMessage ) } } -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 ) { @@ -5227,18 +5227,18 @@ void Actor::SetSiblingOrder( unsigned int order ) } } -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( i ); break; } } @@ -5266,7 +5266,7 @@ void Actor::Raise() ActorContainer& siblings = *(mParent->mChildren); if( siblings.back() != this ) // If not already at end { - for( size_t i=0; imChildren); if( siblings.front() != this ) // If not already at beginning { - for( size_t i=1; imInheritLayoutDirection || set ) ) { - if( actor->mLayoutDirection != direction) + if( actor->mLayoutDirection != direction ) { actor->mLayoutDirection = direction; actor->EmitLayoutDirectionChangedSignal( direction ); diff --git a/dali/internal/event/actors/actor-impl.h b/dali/internal/event/actors/actor-impl.h index 672fc63..a64bf73 100755 --- a/dali/internal/event/actors/actor-impl.h +++ b/dali/internal/event/actors/actor-impl.h @@ -136,7 +136,7 @@ public: /** * @copydoc Dali::Actor::GetId */ - unsigned int GetId() const; + uint32_t GetId() const; // Containment @@ -205,12 +205,12 @@ public: * 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. @@ -231,7 +231,7 @@ public: /** * @copydoc Dali::Actor::FindChildById */ - ActorPtr FindChildById( const unsigned int id ); + ActorPtr FindChildById( const uint32_t id ); /** * Retrieve the parent of an Actor. @@ -750,11 +750,11 @@ public: /** * @copydoc Dali::Actor::GetHierarchyDepth() */ - inline int GetHierarchyDepth() const + inline int32_t GetHierarchyDepth() const { if( mIsOnStage ) { - return static_cast(mDepth); + return mDepth; } return -1; @@ -765,7 +765,7 @@ public: * * @return The depth used for hit-testing and renderer sorting */ - unsigned int GetSortingDepth(); + uint32_t GetSortingDepth(); public: @@ -1226,17 +1226,17 @@ 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() @@ -1246,7 +1246,7 @@ public: /** * @copydoc Dali::Actor::RemoveRenderer() */ - void RemoveRenderer( unsigned int index ); + void RemoveRenderer( uint32_t index ); public: @@ -1560,7 +1560,7 @@ protected: * 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. @@ -1568,7 +1568,7 @@ protected: * @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. @@ -1622,7 +1622,7 @@ protected: * @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& sceneGraphNodeDepths, int& depthIndex ); + void DepthTraverseActorTree( OwnerPointer& sceneGraphNodeDepths, int32_t& depthIndex ); public: @@ -1631,7 +1631,7 @@ public: /** * @copydoc Dali::Internal::Object::GetDefaultPropertyCount() */ - virtual unsigned int GetDefaultPropertyCount() const; + virtual uint32_t GetDefaultPropertyCount() const; /** * @copydoc Dali::Internal::Object::GetDefaultPropertyIndices() @@ -1926,13 +1926,13 @@ private: * @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. @@ -2008,11 +2008,9 @@ protected: 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 @@ -2040,7 +2038,7 @@ protected: 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 diff --git a/dali/internal/event/actors/camera-actor-impl.cpp b/dali/internal/event/actors/camera-actor-impl.cpp index c8f5d75..4530783 100644 --- a/dali/internal/event/actors/camera-actor-impl.cpp +++ b/dali/internal/event/actors/camera-actor-impl.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -112,8 +112,10 @@ void BuildOrthoPickingRay( const Matrix& viewMatrix, 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( viewport.x ), + static_cast( viewport.height ) - (screenY - static_cast( viewport.y ) ), + 0.f, 1.f ); + if( !Unproject( near, invViewProjection, static_cast( viewport.width ), static_cast( viewport.height ), rayOrigin ) ) { DALI_ASSERT_DEBUG( false ); } @@ -455,9 +457,11 @@ bool CameraActor::BuildPickingRay( const Vector2& screenCoordinates, 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(viewport.x), + static_cast( viewport.height ) - (screenCoordinates.y - static_cast( 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( viewport.width ), static_cast( viewport.height ), near ); // Compute the ray's director vector. rayDirection.x = near.x - rayOrigin.x; diff --git a/dali/internal/event/actors/layer-impl.cpp b/dali/internal/event/actors/layer-impl.cpp index 5e51230..69e15b2 100644 --- a/dali/internal/event/actors/layer-impl.cpp +++ b/dali/internal/event/actors/layer-impl.cpp @@ -163,7 +163,7 @@ void Layer::RaiseAbove( const Internal::Layer& 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 ) { MoveAbove( target ); @@ -177,7 +177,7 @@ void Layer::LowerBelow( const Internal::Layer& 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 ); @@ -256,7 +256,7 @@ void Layer::SetClippingBox(int x, int y, int width, int height) StagePtr stage = Stage::GetCurrent(); if( stage ) { - clippingBox.y = stage->GetSize().height - clippingBox.y - clippingBox.height; + clippingBox.y = static_cast( 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 ); @@ -363,8 +363,8 @@ void Layer::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const 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 ); } @@ -439,7 +439,7 @@ Property::Index Layer::GetDefaultPropertyIndex(const std::string& name) const 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 @@ -474,7 +474,7 @@ void Layer::SetDefaultProperty( Property::Index index, const Property::Value& pr } case Dali::Layer::Property::CLIPPING_BOX: { - Rect clippingBox( propertyValue.Get >() ); + Rect clippingBox( propertyValue.Get >() ); SetClippingBox( clippingBox.x, clippingBox.y, clippingBox.width, clippingBox.height ); break; } diff --git a/dali/internal/event/actors/layer-list.cpp b/dali/internal/event/actors/layer-list.cpp index 82be760..37482d2 100644 --- a/dali/internal/event/actors/layer-list.cpp +++ b/dali/internal/event/actors/layer-list.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -69,21 +69,21 @@ LayerList::~LayerList() { } -unsigned int LayerList::GetLayerCount() const +uint32_t LayerList::GetLayerCount() const { - return mLayers.size(); + return static_cast( 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 ] ) { diff --git a/dali/internal/event/actors/layer-list.h b/dali/internal/event/actors/layer-list.h index 22b5bfc..3f5dea2 100644 --- a/dali/internal/event/actors/layer-list.h +++ b/dali/internal/event/actors/layer-list.h @@ -2,7 +2,7 @@ #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. @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include // uint32_t + // INTERNAL INCLUDES #include @@ -60,7 +63,7 @@ public: * 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. @@ -68,13 +71,13 @@ public: * @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. diff --git a/dali/internal/event/animation/animation-impl.h b/dali/internal/event/animation/animation-impl.h index ad61dba..eb4d377 100644 --- a/dali/internal/event/animation/animation-impl.h +++ b/dali/internal/event/animation/animation-impl.h @@ -497,7 +497,7 @@ private: Property::Value targetValue; TimePeriod timePeriod; - unsigned int connectorIndex; + std::size_t connectorIndex; Animation::Type animatorType; }; diff --git a/dali/internal/event/animation/constrainer.cpp b/dali/internal/event/animation/constrainer.cpp index 7e4f6a2..ee9a341 100644 --- a/dali/internal/event/animation/constrainer.cpp +++ b/dali/internal/event/animation/constrainer.cpp @@ -36,7 +36,7 @@ Constrainer::Constrainer() Constrainer::~Constrainer() { //Remove all the constraints created by the object - size_t tag = reinterpret_cast( this ); + uint32_t tag = static_cast( reinterpret_cast( this ) ); // taking 32bits of this as tag const ObjectIter end = mObservedObjects.End(); for( ObjectIter iter = mObservedObjects.Begin(); iter != end; ++iter ) { @@ -64,7 +64,7 @@ void Constrainer::ObjectDestroyed( Object& object ) void Constrainer::Remove( Dali::Handle& target ) { - size_t tag = reinterpret_cast( this ); + uint32_t tag = static_cast( reinterpret_cast( this ) ); // taking 32bits of this as tag Object& object = GetImplementation(target); const ObjectIter end = mObservedObjects.End(); for( ObjectIter iter = mObservedObjects.Begin(); iter != end; ++iter ) diff --git a/dali/internal/event/animation/constraint-base.cpp b/dali/internal/event/animation/constraint-base.cpp index c702014..5eee38d 100644 --- a/dali/internal/event/animation/constraint-base.cpp +++ b/dali/internal/event/animation/constraint-base.cpp @@ -146,12 +146,12 @@ ConstraintBase::RemoveAction ConstraintBase::GetRemoveAction() const 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; } diff --git a/dali/internal/event/animation/constraint-base.h b/dali/internal/event/animation/constraint-base.h index 5b006ed..8195aa1 100644 --- a/dali/internal/event/animation/constraint-base.h +++ b/dali/internal/event/animation/constraint-base.h @@ -127,12 +127,12 @@ public: /** * @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 @@ -206,7 +206,7 @@ protected: 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 }; diff --git a/dali/internal/event/animation/key-frames-impl.cpp b/dali/internal/event/animation/key-frames-impl.cpp index a111c17..5a885d8 100644 --- a/dali/internal/event/animation/key-frames-impl.cpp +++ b/dali/internal/event/animation/key-frames-impl.cpp @@ -164,7 +164,7 @@ Property::Value KeyFrames::GetLastKeyFrameValue() const { Property::Value value; - unsigned int noOfKeyFrames = mKeyFrames->GetNumberOfKeyFrames(); + std::size_t noOfKeyFrames = mKeyFrames->GetNumberOfKeyFrames(); if( noOfKeyFrames ) { mKeyFrames->GetKeyFrameAsValue( noOfKeyFrames - 1, value ); diff --git a/dali/internal/event/animation/key-frames-impl.h b/dali/internal/event/animation/key-frames-impl.h index 7146a2a..051d419 100644 --- a/dali/internal/event/animation/key-frames-impl.h +++ b/dali/internal/event/animation/key-frames-impl.h @@ -119,14 +119,14 @@ public: 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: @@ -220,7 +220,7 @@ public: * 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(); } @@ -241,7 +241,7 @@ public: /** * @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; } diff --git a/dali/internal/event/animation/linear-constrainer-impl.cpp b/dali/internal/event/animation/linear-constrainer-impl.cpp index 41f6248..8d17414 100644 --- a/dali/internal/event/animation/linear-constrainer-impl.cpp +++ b/dali/internal/event/animation/linear-constrainer-impl.cpp @@ -68,7 +68,7 @@ void LinearConstrainer::GetDefaultPropertyIndices( Property::IndexContainer& ind { 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 ); } @@ -90,7 +90,7 @@ Property::Index LinearConstrainer::GetDefaultPropertyIndex(const std::string& na 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 ) ) @@ -218,11 +218,10 @@ void LinearConstrainer::Apply( Property target, Property source, const Vector2& Dali::Constraint constraint = Dali::Constraint::New( target.object, target.propertyIndex, LinearConstraintFunctor( mValue, mProgress, range, wrap ) ); constraint.AddSource( Dali::Source(source.object, source.propertyIndex ) ); - constraint.SetTag( reinterpret_cast( this ) ); + constraint.SetTag( static_cast( reinterpret_cast( this ) ) ); // taking 32bits of this as tag constraint.SetRemoveAction( Dali::Constraint::Discard ); constraint.Apply(); - //Start observing the object Observe( target.object ); } diff --git a/dali/internal/event/animation/linear-constrainer-impl.h b/dali/internal/event/animation/linear-constrainer-impl.h index 22cec38..87b284a 100644 --- a/dali/internal/event/animation/linear-constrainer-impl.h +++ b/dali/internal/event/animation/linear-constrainer-impl.h @@ -2,7 +2,7 @@ #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. @@ -64,7 +64,7 @@ struct LinearConstraintFunctor void operator()( float& value, const PropertyInputContainer& inputs) { - size_t valueCount( mValue.Size() ); + uint32_t valueCount = static_cast( mValue.Size() ); if( valueCount == 0 ) { //No values. @@ -84,29 +84,29 @@ struct LinearConstraintFunctor 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( valueCount ) - 1.0f); + float tLocation = t / step; + if( tLocation < 0 ) { min = 0; max = 1; } - else if( tLocation >= valueCount-1 ) + else if( tLocation >= static_cast( valueCount-1 ) ) { min = max = valueCount-1; } else { - min = static_cast(tLocation); + min = static_cast(tLocation); max = min+1; } - tLocal = (t - min*step) / step; + tLocal = (t - static_cast(min)*step) / step; } else { diff --git a/dali/internal/event/animation/path-constrainer-impl.cpp b/dali/internal/event/animation/path-constrainer-impl.cpp index b2d5497..88004cf 100644 --- a/dali/internal/event/animation/path-constrainer-impl.cpp +++ b/dali/internal/event/animation/path-constrainer-impl.cpp @@ -69,7 +69,7 @@ void PathConstrainer::GetDefaultPropertyIndices( Property::IndexContainer& indic { 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 ); } @@ -91,7 +91,7 @@ Property::Index PathConstrainer::GetDefaultPropertyIndex(const std::string& name 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 @@ -241,7 +241,7 @@ void PathConstrainer::Apply( Property target, Property source, const Vector2& ra Dali::Constraint constraint = Dali::Constraint::New( target.object, target.propertyIndex, PathConstraintFunctor( mPath, range, wrap ) ); constraint.AddSource( Dali::Source(source.object, source.propertyIndex ) ); - constraint.SetTag( reinterpret_cast( this ) ); + constraint.SetTag( static_cast( reinterpret_cast( this ) ) ); // taking 32bits of this as tag constraint.SetRemoveAction( Dali::Constraint::Discard ); constraint.Apply(); } @@ -251,7 +251,7 @@ void PathConstrainer::Apply( Property target, Property source, const Vector2& ra Dali::Constraint constraint = Dali::Constraint::New( target.object, target.propertyIndex, PathConstraintFunctor( mPath, range, mForward, wrap) ); constraint.AddSource( Dali::Source(source.object, source.propertyIndex ) ); - constraint.SetTag( reinterpret_cast( this ) ); + constraint.SetTag( static_cast( reinterpret_cast( this ) ) ); // taking 32bits of this as tag constraint.SetRemoveAction( Dali::Constraint::Discard ); constraint.Apply(); } diff --git a/dali/internal/event/animation/path-impl.cpp b/dali/internal/event/animation/path-impl.cpp index 865c4fa..9722198 100644 --- a/dali/internal/event/animation/path-impl.cpp +++ b/dali/internal/event/animation/path-impl.cpp @@ -108,7 +108,7 @@ void Path::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const { 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 ); } @@ -130,7 +130,7 @@ Property::Index Path::GetDefaultPropertyIndex(const std::string& name) const 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 @@ -267,7 +267,7 @@ void Path::AddControlPoint(const Vector3& point ) unsigned int Path::GetNumberOfSegments() const { - return (mPoint.Size()>1)?mPoint.Size()-1:0; + return static_cast( (mPoint.Size()>1) ? mPoint.Size()-1 : 0 ); } void Path::GenerateControlPoints( float curvature ) @@ -346,10 +346,10 @@ void Path::FindSegmentAndProgress( float t, unsigned int& segment, float& tLocal } else { - segment = t * numSegs; - float segLength = 1.0f / numSegs; + segment = static_cast( t * static_cast( numSegs ) ); + float segLength = 1.0f / static_cast( numSegs ); float segStart = static_cast( segment ) * segLength; - tLocal = (t - segStart) * numSegs; + tLocal = (t - segStart) * static_cast( numSegs ); } } diff --git a/dali/internal/event/animation/progress-value.h b/dali/internal/event/animation/progress-value.h index 6907985..1cbe730 100644 --- a/dali/internal/event/animation/progress-value.h +++ b/dali/internal/event/animation/progress-value.h @@ -84,12 +84,12 @@ inline void Interpolate (bool& result, bool a, bool b, float progress) inline void Interpolate (int& result, int a, int b, float progress) { - result = static_cast(a + (b - a) * progress + 0.5f); + result = static_cast(static_cast( a ) + static_cast(b - a) * progress + 0.5f); } inline void Interpolate (unsigned int& result, unsigned int a, unsigned int b, float progress) { - result = static_cast(a + (b - a) * progress + 0.5f); + result = static_cast( static_cast( a ) + static_cast(b - a) * progress + 0.5f); } inline void Interpolate (float& result, float a, float b, float progress) @@ -121,20 +121,20 @@ inline void Interpolate (Vector4& result, const Vector4& a, const Vector4& b, fl 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( p3 ) * 0.5f - static_cast( p2 ) * 1.5f + static_cast( p1 ) * 1.5f - static_cast( p0 ) * 0.5f; + float a2 = static_cast( p0 ) - static_cast( p1 ) * 2.5f + static_cast( p2 ) * 2.0f - static_cast( p3 ) * 0.5f; + float a1 = static_cast( p2 - p0 ) * 0.5f; - result = static_cast( a3*progress*progress*progress + a2*progress*progress + a1*progress + p1 + 0.5f ); + result = static_cast( a3*progress*progress*progress + a2*progress*progress + a1*progress + static_cast( 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( p3 ) * 0.5f - static_cast( p2 ) * 1.5f + static_cast( p1 ) * 1.5f - static_cast( p0 ) * 0.5f; + float a2 = static_cast( p0 ) - static_cast( p1 ) * 2.5f + static_cast( p2 ) * 2.0f - static_cast( p3 ) * 0.5f; + float a1 = static_cast( p2 - p0 ) * 0.5f; - result = static_cast( a3*progress*progress*progress + a2*progress*progress + a1*progress + p1 + 0.5f ); + result = static_cast( a3*progress*progress*progress + a2*progress*progress + a1*progress + static_cast( p1 ) + 0.5f ); } inline void CubicInterpolate( float& result, float p0, float p1, float p2, float p3, float progress ) diff --git a/dali/internal/event/animation/property-constraint.h b/dali/internal/event/animation/property-constraint.h index 196c229..20cba76 100644 --- a/dali/internal/event/animation/property-constraint.h +++ b/dali/internal/event/animation/property-constraint.h @@ -98,7 +98,7 @@ public: * @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() ) { @@ -180,7 +180,7 @@ public: { InputIndexerContainer mInputIndices; PropertyInputContainer mIndices; - const unsigned int noOfInputs = mInputs.size(); + const std::size_t noOfInputs = mInputs.size(); mInputIndices.reserve( noOfInputs ); mIndices.Reserve( noOfInputs ); diff --git a/dali/internal/event/animation/property-input-indexer.h b/dali/internal/event/animation/property-input-indexer.h index 94a03e6..e5626af 100644 --- a/dali/internal/event/animation/property-input-indexer.h +++ b/dali/internal/event/animation/property-input-indexer.h @@ -159,7 +159,7 @@ public: public: - unsigned int mBufferIndex; + BufferIndex mBufferIndex; const AccessorType* mInput; }; diff --git a/dali/internal/event/common/event-thread-services.h b/dali/internal/event/common/event-thread-services.h index c21c835..8089950 100644 --- a/dali/internal/event/common/event-thread-services.h +++ b/dali/internal/event/common/event-thread-services.h @@ -2,7 +2,7 @@ #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. @@ -93,7 +93,7 @@ public: * @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. diff --git a/dali/internal/event/common/object-impl.cpp b/dali/internal/event/common/object-impl.cpp index 1663e61..38ba17b 100644 --- a/dali/internal/event/common/object-impl.cpp +++ b/dali/internal/event/common/object-impl.cpp @@ -135,22 +135,22 @@ bool Object::Supports( Capability capability ) const 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( mCustomProperties.Count() ); count += custom; DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Custom Properties: %d\n", custom ); @@ -779,10 +779,6 @@ Property::Index Object::RegisterSceneGraphProperty(const std::string& name, Prop // queue a message to add the property InstallCustomPropertyMessage( const_cast(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 @@ -830,13 +826,13 @@ Property::Index Object::RegisterProperty( const std::string& name, Property::Ind 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( 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( mCustomProperties.Count() ); CustomPropertyMetadata* customProperty = new CustomPropertyMetadata( name, propertyValue, accessMode ); @@ -1417,7 +1413,7 @@ void Object::RemoveConstraints() } } -void Object::RemoveConstraints( unsigned int tag ) +void Object::RemoveConstraints( uint32_t tag ) { // guard against constraint sending messages during core destruction if( mConstraints && Stage::IsInstalled() ) diff --git a/dali/internal/event/common/object-impl.h b/dali/internal/event/common/object-impl.h index 7658482..195197b 100644 --- a/dali/internal/event/common/object-impl.h +++ b/dali/internal/event/common/object-impl.h @@ -139,7 +139,7 @@ public: /** * @copydoc Dali::Handle::GetPropertyCount() */ - virtual unsigned int GetPropertyCount() const; + virtual uint32_t GetPropertyCount() const; /** * @copydoc Dali::Handle::GetPropertyName() @@ -294,9 +294,9 @@ public: 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. @@ -307,7 +307,7 @@ public: /** * @return the index from which custom properties start */ - unsigned int CustomPropertyStartIndex() + uint32_t CustomPropertyStartIndex() { return PROPERTY_CUSTOM_START_INDEX; } @@ -432,7 +432,7 @@ private: // Default property extensions for derived classes * 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. @@ -527,23 +527,10 @@ private: // Default property extensions for derived classes 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 diff --git a/dali/internal/event/common/projection.cpp b/dali/internal/event/common/projection.cpp index b7b3d23..ffdd632 100644 --- a/dali/internal/event/common/projection.cpp +++ b/dali/internal/event/common/projection.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -133,7 +133,7 @@ bool ProjectFull( const Vector4& position, 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, diff --git a/dali/internal/event/common/property-buffer-impl.cpp b/dali/internal/event/common/property-buffer-impl.cpp index 0718c4b..ecd9a69 100644 --- a/dali/internal/event/common/property-buffer-impl.cpp +++ b/dali/internal/event/common/property-buffer-impl.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -50,9 +50,9 @@ struct PropertyImplementationTypeAlignment 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 ) { @@ -131,27 +131,27 @@ PropertyBufferPtr PropertyBuffer::New( Dali::Property::Map& format ) 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 > bufferCopy = new Dali::Vector(); + OwnerPointer< Vector > bufferCopy = new Dali::Vector(); bufferCopy->Resize( bufferSize ); // copy the data - const char* source = static_cast( data ); - char *destination = &((*bufferCopy)[0]); + const uint8_t* source = static_cast( 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; } @@ -183,16 +183,16 @@ void PropertyBuffer::Initialize( Dali::Property::Map& formatMap ) OwnerPointer< Render::PropertyBuffer > transferOwnership( mRenderObject ); SceneGraph::AddPropertyBuffer( mEventThreadServices.GetUpdateManager(), transferOwnership ); - size_t numComponents = formatMap.Count(); + uint32_t numComponents = static_cast( 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 ); @@ -214,11 +214,11 @@ void PropertyBuffer::Initialize( Dali::Property::Map& formatMap ) { 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; @@ -243,7 +243,7 @@ void PropertyBuffer::Initialize( Dali::Property::Map& formatMap ) // 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; @@ -258,9 +258,9 @@ void PropertyBuffer::Initialize( Dali::Property::Map& formatMap ) 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 ) { diff --git a/dali/internal/event/common/property-buffer-impl.h b/dali/internal/event/common/property-buffer-impl.h index aeac543..2f57eaf 100644 --- a/dali/internal/event/common/property-buffer-impl.h +++ b/dali/internal/event/common/property-buffer-impl.h @@ -2,7 +2,7 @@ #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. @@ -50,12 +50,12 @@ public: /** * @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 @@ -90,8 +90,8 @@ private: // unimplemented methods private: // data EventThreadServices& mEventThreadServices; /// struct PropertyImplementationType< Property::MATRIX > { typedef Matri template<> struct PropertyImplementationType< Property::RECTANGLE > { typedef Rect Type; }; template<> struct PropertyImplementationType< Property::ROTATION > { typedef Quaternion Type; }; -unsigned int GetPropertyImplementationSize( Property::Type& propertyType ); +uint32_t GetPropertyImplementationSize( Property::Type& propertyType ); } // namespace Internal diff --git a/dali/internal/event/common/property-helper.cpp b/dali/internal/event/common/property-helper.cpp index 4a39ab4..21d9110 100644 --- a/dali/internal/event/common/property-helper.cpp +++ b/dali/internal/event/common/property-helper.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -24,7 +24,7 @@ namespace Dali 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 != ',') ) @@ -43,12 +43,12 @@ bool CompareTokens( const char * first, const char * second, size_t& size ) if( ( 'A' <= ca ) && ( ca <= 'Z') ) { - ca = ca + ( 'a' - 'A' ); + ca = static_cast( ca + ( 'a' - 'A' ) ); // don't expect overflow } if( ( 'A' <= cb ) && ( cb <= 'Z') ) { - cb = cb + ( 'a' - 'A' ); + cb = static_cast( cb + ( 'a' - 'A' ) ); // don't expect overflow } if( ca != cb ) diff --git a/dali/internal/event/common/property-helper.h b/dali/internal/event/common/property-helper.h index e66a524..4157452 100644 --- a/dali/internal/event/common/property-helper.h +++ b/dali/internal/event/common/property-helper.h @@ -2,7 +2,7 @@ #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. @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include + // INTERNAL INCLUDES #include #include @@ -50,7 +53,7 @@ struct PropertyDetails */ #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( sizeof( DEFAULT_PROPERTY_DETAILS ) / sizeof( Internal::PropertyDetails ) ); \ struct PROPERTY_CHECK \ { \ PROPERTY_CHECK() \ @@ -68,7 +71,7 @@ struct PropertyDetails }; \ 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( 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 }, @@ -88,7 +91,7 @@ struct PropertyDetails * * @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 ); /** diff --git a/dali/internal/event/common/stage-impl.cpp b/dali/internal/event/common/stage-impl.cpp index bc4ed02..99a6683 100644 --- a/dali/internal/event/common/stage-impl.cpp +++ b/dali/internal/event/common/stage-impl.cpp @@ -202,14 +202,14 @@ void Stage::Remove( Actor& actor ) 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( mTopMargin ); // Calculates the aspect ratio, near and far clipping planes, field of view and camera Z position. mDefaultCamera->SetPerspectiveProjection( mSurfaceSize ); @@ -227,7 +227,7 @@ void Stage::SurfaceResized( float width, float height ) mSystemOverlay->GetImpl()->SetSize( width, height ); } - SetDefaultSurfaceRectMessage( mUpdateManager, Rect( 0, 0, width, height ) ); + SetDefaultSurfaceRectMessage( mUpdateManager, Rect( 0, 0, static_cast( width ), static_cast( height ) ) ); // truncated // if single render task to screen then set its viewport parameters if( 1 == mRenderTaskList->GetTaskCount() ) @@ -236,14 +236,14 @@ void Stage::SurfaceResized( float width, float height ) if(!defaultRenderTask.GetTargetFrameBuffer()) { - defaultRenderTask.SetViewport( Viewport(0, 0, width, height) ); + defaultRenderTask.SetViewport( Viewport( 0, 0, static_cast( width ), static_cast( 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( width ), static_cast( height ), Dali::FrameBuffer::Attachment::NONE ); + Dali::Texture texture = Dali::Texture::New( Dali::TextureType::TEXTURE_2D, Dali::Pixel::RGB888, static_cast( width ), static_cast( height ) ); frameBuffer.AttachColorTexture( texture ); Dali::RenderTask defaultRenderTask = mRenderTaskList->GetTask( 0u ); @@ -257,7 +257,7 @@ Vector2 Stage::GetSize() const return mSize; } -void Stage::SetTopMargin( unsigned int margin ) +void Stage::SetTopMargin( uint32_t margin ) { if (mTopMargin == margin) { @@ -266,7 +266,7 @@ void Stage::SetTopMargin( unsigned int margin ) mTopMargin = margin; mSize.width = mSurfaceSize.width; - mSize.height = mSurfaceSize.height - mTopMargin; + mSize.height = mSurfaceSize.height - static_cast( mTopMargin ); // Adjust the camera height to allow for top-margin SetDefaultCameraPosition(); @@ -304,12 +304,12 @@ CameraActor& Stage::GetDefaultCameraActor() 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 )); } @@ -418,13 +418,13 @@ void Stage::SetViewMode( ViewMode viewMode ) 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( mSize.height * 0.5f ), static_cast( mSize.width ), static_cast( 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( mSize.width ), static_cast( mSize.height * 0.5f ) ) ); // truncated break; } @@ -440,13 +440,13 @@ void Stage::SetViewMode( ViewMode viewMode ) 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( mSize.width * 0.5f ), static_cast( 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( mSize.width * 0.5f ), 0, static_cast( mSize.width * 0.5f ), static_cast( mSize.height ) ) ); // truncated break; } @@ -779,7 +779,7 @@ Integration::RenderController& Stage::GetRenderController() 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 ); } diff --git a/dali/internal/event/common/stage-impl.h b/dali/internal/event/common/stage-impl.h index f64343c..a6aa52e 100644 --- a/dali/internal/event/common/stage-impl.h +++ b/dali/internal/event/common/stage-impl.h @@ -156,7 +156,7 @@ public: * 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. @@ -198,12 +198,12 @@ public: /** * @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() @@ -456,7 +456,7 @@ public: // Implementation of EventThreadServices /** * @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 @@ -530,7 +530,7 @@ private: ViewMode mViewMode; float mStereoBase; - unsigned int mTopMargin; + uint32_t mTopMargin; Vector2 mDpi; // The object registry diff --git a/dali/internal/event/common/type-info-impl.cpp b/dali/internal/event/common/type-info-impl.cpp index 2b41f54..cb69d1f 100644 --- a/dali/internal/event/common/type-info-impl.cpp +++ b/dali/internal/event/common/type-info-impl.cpp @@ -534,15 +534,15 @@ void TypeInfo::AddChildProperty( const std::string& name, Property::Index index, } } -size_t TypeInfo::GetPropertyCount() const +uint32_t TypeInfo::GetPropertyCount() const { - size_t count( mRegisteredProperties.size() ); + uint32_t count = static_cast( mRegisteredProperties.size() ); Dali::TypeInfo base = TypeRegistry::Get()->GetTypeInfo( mBaseTypeName ); while ( base ) { const TypeInfo& baseImpl( GetImplementation(base) ); - count += baseImpl.mRegisteredProperties.size(); + count += static_cast( baseImpl.mRegisteredProperties.size() ); base = TypeRegistry::Get()->GetTypeInfo( baseImpl.mBaseTypeName ); } diff --git a/dali/internal/event/common/type-info-impl.h b/dali/internal/event/common/type-info-impl.h index 3587ede..d3fcfda 100644 --- a/dali/internal/event/common/type-info-impl.h +++ b/dali/internal/event/common/type-info-impl.h @@ -60,9 +60,9 @@ public: TypeInfo(const std::string& name, const std::string& baseName, Dali::CSharpTypeInfo::CreateFunction creator); /** - * + * Destructor */ - ~TypeInfo(); + virtual ~TypeInfo(); /** * @copydoc Dali::TypeInfo::GetName @@ -107,12 +107,7 @@ public: /** * @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. @@ -181,7 +176,7 @@ public: * @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. @@ -230,7 +225,7 @@ public: * @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. @@ -326,7 +321,7 @@ private: { } - 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 ), @@ -371,7 +366,7 @@ private: }; std::string name; Property::Index basePropertyIndex; - int componentIndex; + int32_t componentIndex; }; typedef std::pair ConnectionPair; diff --git a/dali/internal/event/effects/shader-factory.cpp b/dali/internal/event/effects/shader-factory.cpp index ae4e5d7..13fda26 100644 --- a/dali/internal/event/effects/shader-factory.cpp +++ b/dali/internal/event/effects/shader-factory.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -67,7 +67,7 @@ ShaderFactory::ShaderFactory() 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] ) { @@ -86,7 +86,7 @@ ShaderDataPtr ShaderFactory::Load( const std::string& vertexSource, const std::s 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 ) { @@ -132,7 +132,7 @@ void ShaderFactory::SaveBinary( Internal::ShaderDataPtr shaderData ) 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( shaderData->GetBufferSize() ) ); // don't expect buffer larger than unsigned int // Save the binary into to memory cache: MemoryCacheInsert( *shaderData ); diff --git a/dali/internal/event/events/event-processor.cpp b/dali/internal/event/events/event-processor.cpp index 560b48a..9a4874c 100644 --- a/dali/internal/event/events/event-processor.cpp +++ b/dali/internal/event/events/event-processor.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -93,7 +93,7 @@ void EventProcessor::QueueEvent( const Event& event ) 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(event) ); @@ -106,7 +106,7 @@ void EventProcessor::QueueEvent( const Event& 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(event) ); @@ -119,7 +119,7 @@ void EventProcessor::QueueEvent( const Event& 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(event) ); @@ -132,7 +132,7 @@ void EventProcessor::QueueEvent( const Event& 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(event) ); @@ -158,7 +158,7 @@ void EventProcessor::QueueGestureEvent(const Integration::GestureEvent& 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(event) ); @@ -171,7 +171,7 @@ void EventProcessor::QueueGestureEvent(const Integration::GestureEvent& 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(event) ); @@ -184,7 +184,7 @@ void EventProcessor::QueueGestureEvent(const Integration::GestureEvent& 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(event) ); @@ -197,7 +197,7 @@ void EventProcessor::QueueGestureEvent(const Integration::GestureEvent& 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(event) ); diff --git a/dali/internal/event/events/hit-test-algorithm-impl.cpp b/dali/internal/event/events/hit-test-algorithm-impl.cpp index 56027a0..6c8c8af 100644 --- a/dali/internal/event/events/hit-test-algorithm-impl.cpp +++ b/dali/internal/event/events/hit-test-algorithm-impl.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -56,10 +56,10 @@ struct HitActor { } - 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. }; /** @@ -162,8 +162,8 @@ HitActor HitTestWithinLayer( Actor& actor, HitTestInterface& hitCheck, bool& overlayHit, bool layerIs3d, - unsigned int clippingDepth, - unsigned int clippingBitPlaneMask ) + uint32_t clippingDepth, + uint32_t clippingBitPlaneMask ) { HitActor hit; @@ -176,7 +176,7 @@ HitActor HitTestWithinLayer( Actor& actor, // 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 ) { @@ -234,7 +234,7 @@ HitActor HitTestWithinLayer( Actor& actor, // 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. @@ -255,7 +255,7 @@ HitActor HitTestWithinLayer( Actor& actor, { //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 ) @@ -277,7 +277,7 @@ HitActor HitTestWithinLayer( Actor& actor, if( actor.GetChildCount() > 0 ) { childHit.distance = std::numeric_limits::max(); - childHit.depth = std::numeric_limits::min(); + childHit.depth = std::numeric_limits::min(); ActorContainer& children = actor.GetChildrenInternal(); // Hit test ALL children and calculate their distance. @@ -362,10 +362,10 @@ inline bool IsActuallyHittable( Layer& layer, const Vector2& screenCoordinates, { 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( box.x )|| + screenCoordinates.x > static_cast( box.x + box.width )|| + screenCoordinates.y < stageSize.y - static_cast( box.y + box.height ) || + screenCoordinates.y > stageSize.y - static_cast( box.y ) ) { // Not touchable if clipping is enabled in the layer and the screen coordinate is outside the clip region. hittable = false; @@ -416,10 +416,10 @@ bool HitTestRenderTask( const Vector< RenderTaskList::Exclusive >& exclusives, { 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( viewport.x ) || + screenCoordinates.x > static_cast( viewport.x + viewport.width ) || + screenCoordinates.y < static_cast( viewport.y ) || + screenCoordinates.y > static_cast( viewport.y + viewport.height ) ) { // The screen coordinate is outside the viewport of render task. The viewport clips all layers. return false; @@ -435,7 +435,7 @@ bool HitTestRenderTask( const Vector< RenderTaskList::Exclusive >& exclusives, 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( @@ -454,7 +454,7 @@ bool HitTestRenderTask( const Vector< RenderTaskList::Exclusive >& exclusives, 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; @@ -463,7 +463,7 @@ bool HitTestRenderTask( const Vector< RenderTaskList::Exclusive >& exclusives, 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( i ) ) + if( sourceActorDepth == static_cast( i ) ) { // Recursively hit test the source actor & children, without crossing into other layers. hit = HitTestWithinLayer( *sourceActor, diff --git a/dali/internal/event/events/pan-gesture-processor.cpp b/dali/internal/event/events/pan-gesture-processor.cpp index 5d9081c..1762821 100644 --- a/dali/internal/event/events/pan-gesture-processor.cpp +++ b/dali/internal/event/events/pan-gesture-processor.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -472,11 +472,11 @@ void PanGestureProcessor::EmitPanSignal( Actor* actor, // 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( panEvent.timeDelta ); + pan.velocity.y = pan.displacement.y / static_cast( 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( panEvent.timeDelta ); + pan.screenVelocity.y = pan.screenDisplacement.y / static_cast( panEvent.timeDelta ); } // When the gesture ends, we may incorrectly get a ZERO velocity (as we have lifted our finger without any movement) @@ -537,7 +537,7 @@ bool PanGestureProcessor::CheckGestureDetector( GestureDetector* detector, Actor 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 ) ); ///////////////////////////// // | // diff --git a/dali/internal/event/images/bitmap-compressed.cpp b/dali/internal/event/images/bitmap-compressed.cpp index 65a01bc..3e057b1 100644 --- a/dali/internal/event/images/bitmap-compressed.cpp +++ b/dali/internal/event/images/bitmap-compressed.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -44,9 +44,9 @@ BitmapCompressed::~BitmapCompressed() } 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; @@ -54,9 +54,9 @@ void BitmapCompressed::Initialize( Pixel::Format pixelFormat, } 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. diff --git a/dali/internal/event/images/bitmap-compressed.h b/dali/internal/event/images/bitmap-compressed.h index 874e976..2ee839a 100644 --- a/dali/internal/event/images/bitmap-compressed.h +++ b/dali/internal/event/images/bitmap-compressed.h @@ -2,7 +2,7 @@ #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. @@ -58,9 +58,9 @@ private: * @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 @@ -75,15 +75,15 @@ public: * @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; } @@ -102,7 +102,7 @@ protected: 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 diff --git a/dali/internal/event/images/bitmap-packed-pixel.cpp b/dali/internal/event/images/bitmap-packed-pixel.cpp index 2bc220d..07536b1 100644 --- a/dali/internal/event/images/bitmap-packed-pixel.cpp +++ b/dali/internal/event/images/bitmap-packed-pixel.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -43,11 +43,11 @@ BitmapPackedPixel::BitmapPackedPixel( ResourcePolicy::Discardable discardable, D } // 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(); @@ -55,20 +55,20 @@ Dali::Integration::PixelBuffer* BitmapPackedPixel::ReserveBuffer(Pixel::Format p 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 ); @@ -91,21 +91,21 @@ void BitmapPackedPixel::TestForTransparency() 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= mImageWidth && mBufferHeight >= mImageHeight); } -unsigned int BitmapPackedPixel::GetBufferStride() const +uint32_t BitmapPackedPixel::GetBufferStride() const { return mBufferWidth*mBytesPerPixel; } diff --git a/dali/internal/event/images/bitmap-packed-pixel.h b/dali/internal/event/images/bitmap-packed-pixel.h index 9a72759..85fb666 100644 --- a/dali/internal/event/images/bitmap-packed-pixel.h +++ b/dali/internal/event/images/bitmap-packed-pixel.h @@ -2,7 +2,7 @@ #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. @@ -65,10 +65,10 @@ public: * @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. @@ -85,11 +85,11 @@ public: */ 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) @@ -113,10 +113,9 @@ public: * 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; } /** @@ -128,7 +127,7 @@ public: * 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 @@ -154,9 +153,9 @@ protected: 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: @@ -169,10 +168,10 @@ 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 diff --git a/dali/internal/event/images/buffer-image-impl.cpp b/dali/internal/event/images/buffer-image-impl.cpp index 7879f06..68c0027 100644 --- a/dali/internal/event/images/buffer-image-impl.cpp +++ b/dali/internal/event/images/buffer-image-impl.cpp @@ -139,8 +139,8 @@ void BufferImage::UploadArea( const RectArea& area ) 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 ? diff --git a/dali/internal/event/images/encoded-buffer-image-impl.cpp b/dali/internal/event/images/encoded-buffer-image-impl.cpp index 6666656..d6d5de0 100644 --- a/dali/internal/event/images/encoded-buffer-image-impl.cpp +++ b/dali/internal/event/images/encoded-buffer-image-impl.cpp @@ -86,7 +86,7 @@ EncodedBufferImagePtr EncodedBufferImage::New( const uint8_t * const encodedImag 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 ); diff --git a/dali/internal/event/images/image-impl.cpp b/dali/internal/event/images/image-impl.cpp index 9d5e275..8357fcf 100644 --- a/dali/internal/event/images/image-impl.cpp +++ b/dali/internal/event/images/image-impl.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -81,7 +81,7 @@ unsigned int Image::GetHeight() const Vector2 Image::GetNaturalSize() const { - return Vector2( mWidth, mHeight ); + return Vector2( static_cast( mWidth ), static_cast( mHeight ) ); } Image::Image() diff --git a/dali/internal/event/images/nine-patch-image-impl.cpp b/dali/internal/event/images/nine-patch-image-impl.cpp index b43d818..7662edc 100644 --- a/dali/internal/event/images/nine-patch-image-impl.cpp +++ b/dali/internal/event/images/nine-patch-image-impl.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -199,8 +199,8 @@ NinePatchImage::NinePatchImage( const std::string& filename ) 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 ); @@ -269,13 +269,13 @@ Internal::BufferImagePtr NinePatchImage::CreateCroppedBufferImage() 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; @@ -325,15 +325,15 @@ void NinePatchImage::ParseBorders() 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; ) { @@ -394,9 +394,9 @@ void NinePatchImage::ParseBorders() } } -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 ) @@ -408,7 +408,7 @@ Uint16Pair NinePatchImage::ParseRange( unsigned int& index, unsigned int width, } } - unsigned int end = width; + uint32_t end = width; for( ; index < width; ++index, pixel += pixelStride ) { if( ( pixel[ testByte ] & testBits ) != testValue ) diff --git a/dali/internal/event/images/pixel-data-impl.cpp b/dali/internal/event/images/pixel-data-impl.cpp index fbc76d4..544e0d6 100644 --- a/dali/internal/event/images/pixel-data-impl.cpp +++ b/dali/internal/event/images/pixel-data-impl.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -18,19 +18,16 @@ // CLASS HEADER #include -// EXTERNAL INCLUDES -#include - 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 ), @@ -46,7 +43,7 @@ PixelData::~PixelData() { if( mBuffer ) { - if( mReleaseFunction == Dali::PixelData::FREE) + if( mReleaseFunction == Dali::PixelData::FREE ) { free( mBuffer ); } @@ -57,22 +54,22 @@ PixelData::~PixelData() } } -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; } @@ -82,12 +79,12 @@ Pixel::Format PixelData::GetPixelFormat() const 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; } diff --git a/dali/internal/event/images/pixel-data-impl.h b/dali/internal/event/images/pixel-data-impl.h index 8967c96..01d6249 100644 --- a/dali/internal/event/images/pixel-data-impl.h +++ b/dali/internal/event/images/pixel-data-impl.h @@ -2,7 +2,7 @@ #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. @@ -46,10 +46,10 @@ public: * @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); @@ -63,10 +63,10 @@ public: * @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 ); @@ -85,13 +85,13 @@ public: * 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 @@ -103,13 +103,13 @@ public: * 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. @@ -131,11 +131,11 @@ private: 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 }; diff --git a/dali/internal/event/images/resource-image-impl.cpp b/dali/internal/event/images/resource-image-impl.cpp index dc116cc..0b0417f 100644 --- a/dali/internal/event/images/resource-image-impl.cpp +++ b/dali/internal/event/images/resource-image-impl.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -159,7 +159,7 @@ void ResourceImage::Reload() 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 ); @@ -201,7 +201,7 @@ unsigned int ResourceImage::GetHeight() const Vector2 ResourceImage::GetNaturalSize() const { - return Vector2(mWidth, mHeight); + return Vector2( static_cast( mWidth ), static_cast( mHeight ) ); } diff --git a/dali/internal/event/render-tasks/render-task-impl.cpp b/dali/internal/event/render-tasks/render-task-impl.cpp index 8da4425..d907b8f 100644 --- a/dali/internal/event/render-tasks/render-task-impl.cpp +++ b/dali/internal/event/render-tasks/render-task-impl.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -227,8 +227,8 @@ Vector2 RenderTask::GetCurrentViewportSize() const void RenderTask::SetViewport( const Viewport& viewport ) { - SetViewportPosition(Vector2(viewport.x, viewport.y)); - SetViewportSize(Vector2(viewport.width, viewport.height)); + SetViewportPosition( Vector2( static_cast( viewport.x ), static_cast( viewport.y ) ) ); + SetViewportSize( Vector2( static_cast( viewport.width ), static_cast( viewport.height ) ) ); } void RenderTask::GetViewport( Viewport& viewPort ) const @@ -250,8 +250,8 @@ 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( size.width ); // truncated + viewPort.height = static_cast( size.height ); // truncated } } } @@ -259,10 +259,10 @@ void RenderTask::GetViewport( Viewport& viewPort ) const { 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( position.x ); // truncated + viewPort.y = static_cast( position.y ); // truncated + viewPort.width = static_cast( size.width ); // truncated + viewPort.height = static_cast( size.height ); // truncated } } @@ -342,7 +342,7 @@ bool RenderTask::GetCullMode() const 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); @@ -358,7 +358,7 @@ void RenderTask::SetRefreshRate( unsigned int refreshRate ) } } -unsigned int RenderTask::GetRefreshRate() const +uint32_t RenderTask::GetRefreshRate() const { return mRefreshRate; } @@ -407,8 +407,8 @@ bool RenderTask::TranslateCoordinates( Vector2& screenCoords ) const Viewport viewport; Vector2 size( stage->GetSize() ); viewport.x = viewport.y = 0; - viewport.width = size.width; - viewport.height = size.height; + viewport.width = static_cast( size.width ); // truncated + viewport.height = static_cast( size.height ); // truncated float localX, localY; inside = mMappingConnector.mActor->ScreenToLocal(defaultCamera.GetViewMatrix(), defaultCamera.GetProjectionMatrix(), viewport, localX, localY, screenCoords.x, screenCoords.y); @@ -456,10 +456,10 @@ bool RenderTask::WorldToViewport(const Vector3 &position, float& viewportX, floa bool ok = ProjectFull(pos, cam->GetViewMatrix(), cam->GetProjectionMatrix(), - viewport.x, - viewport.y, - viewport.width, - viewport.height, + static_cast( viewport.x ), // truncated + static_cast( viewport.y ), // truncated + static_cast( viewport.width ), // truncated + static_cast( viewport.height ), // truncated viewportPosition); if(ok) { @@ -511,7 +511,7 @@ void RenderTask::DiscardSceneObject() ******************************** PROPERTY METHODS ************************** ********************************************************************************/ -unsigned int RenderTask::GetDefaultPropertyCount() const +uint32_t RenderTask::GetDefaultPropertyCount() const { return DEFAULT_PROPERTY_COUNT; } @@ -820,7 +820,7 @@ const PropertyInputImpl* RenderTask::GetSceneObjectInputProperty( Property::Inde bool RenderTask::HasFinished() { bool finished = false; - const unsigned int counter = mSceneObject->GetRenderedOnceCounter(); + const uint32_t counter = mSceneObject->GetRenderedOnceCounter(); if( mRefreshOnceCounter < counter ) { diff --git a/dali/internal/event/render-tasks/render-task-impl.h b/dali/internal/event/render-tasks/render-task-impl.h index 1639b35..0038088 100644 --- a/dali/internal/event/render-tasks/render-task-impl.h +++ b/dali/internal/event/render-tasks/render-task-impl.h @@ -2,7 +2,7 @@ #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. @@ -208,12 +208,12 @@ public: /** * @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. @@ -270,7 +270,7 @@ public: // Implementation of Object /** * @copydoc Dali::Internal::Object::GetDefaultPropertyCount() */ - virtual unsigned int GetDefaultPropertyCount() const; + virtual uint32_t GetDefaultPropertyCount() const; /** * @copydoc Dali::Internal::Object::GetDefaultPropertyIndices() @@ -470,9 +470,9 @@ private: 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; diff --git a/dali/internal/event/render-tasks/render-task-list-impl.cpp b/dali/internal/event/render-tasks/render-task-list-impl.cpp index 61a9803..e20c147 100644 --- a/dali/internal/event/render-tasks/render-task-list-impl.cpp +++ b/dali/internal/event/render-tasks/render-task-list-impl.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -108,12 +108,12 @@ void RenderTaskList::RemoveTask( Dali::RenderTask task ) } } -unsigned int RenderTaskList::GetTaskCount() const +uint32_t RenderTaskList::GetTaskCount() const { - return mTasks.size(); + return static_cast( 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" ); diff --git a/dali/internal/event/render-tasks/render-task-list-impl.h b/dali/internal/event/render-tasks/render-task-list-impl.h index 3216793..1cd8c03 100644 --- a/dali/internal/event/render-tasks/render-task-list-impl.h +++ b/dali/internal/event/render-tasks/render-task-list-impl.h @@ -79,12 +79,12 @@ public: /** * @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. diff --git a/dali/internal/event/rendering/geometry-impl.cpp b/dali/internal/event/rendering/geometry-impl.cpp index 45c0a37..ef8131f 100644 --- a/dali/internal/event/rendering/geometry-impl.cpp +++ b/dali/internal/event/rendering/geometry-impl.cpp @@ -56,9 +56,9 @@ void Geometry::RemoveVertexBuffer( std::size_t index ) 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 indexData; + Dali::Vector indexData; if( indices && count ) { indexData.Resize( count ); diff --git a/dali/internal/event/rendering/geometry-impl.h b/dali/internal/event/rendering/geometry-impl.h index 8a1f90a..d3e7b07 100644 --- a/dali/internal/event/rendering/geometry-impl.h +++ b/dali/internal/event/rendering/geometry-impl.h @@ -75,7 +75,7 @@ public: /** * @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() diff --git a/dali/internal/event/rendering/renderer-impl.cpp b/dali/internal/event/rendering/renderer-impl.cpp index 3e77d16..624a91a 100644 --- a/dali/internal/event/rendering/renderer-impl.cpp +++ b/dali/internal/event/rendering/renderer-impl.cpp @@ -291,7 +291,7 @@ void Renderer::GetBlendEquation( BlendEquation::Type& equationRgb, equationAlpha = mBlendingOptions.GetBlendEquationAlpha(); } -void Renderer::SetIndexedDrawFirstElement( size_t firstElement ) +void Renderer::SetIndexedDrawFirstElement( uint32_t firstElement ) { if( firstElement != mIndexedDrawFirstElement ) { @@ -300,7 +300,7 @@ void Renderer::SetIndexedDrawFirstElement( size_t firstElement ) } } -void Renderer::SetIndexedDrawElementsCount( size_t elementsCount ) +void Renderer::SetIndexedDrawElementsCount( uint32_t elementsCount ) { if( elementsCount != mIndexedDrawElementCount ) { @@ -337,7 +337,7 @@ SceneGraph::Renderer* Renderer::GetRendererSceneObject() return mSceneObject; } -unsigned int Renderer::GetDefaultPropertyCount() const +uint32_t Renderer::GetDefaultPropertyCount() const { return RENDERER_IMPL.GetDefaultPropertyCount(); } @@ -1005,7 +1005,7 @@ bool Renderer::GetCurrentPropertyValue( Property::Index index, Property::Value& } 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( blendingOptions.GetBlendEquationRgb() ); @@ -1013,7 +1013,7 @@ bool Renderer::GetCurrentPropertyValue( Property::Index index, Property::Value& } 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( blendingOptions.GetBlendEquationAlpha() ); @@ -1021,7 +1021,7 @@ bool Renderer::GetCurrentPropertyValue( Property::Index index, Property::Value& } 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( blendingOptions.GetBlendSrcFactorRgb() ); @@ -1029,7 +1029,7 @@ bool Renderer::GetCurrentPropertyValue( Property::Index index, Property::Value& } 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( blendingOptions.GetBlendDestFactorRgb() ); @@ -1037,7 +1037,7 @@ bool Renderer::GetCurrentPropertyValue( Property::Index index, Property::Value& } 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( blendingOptions.GetBlendSrcFactorAlpha() ); @@ -1045,7 +1045,7 @@ bool Renderer::GetCurrentPropertyValue( Property::Index index, Property::Value& } 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( blendingOptions.GetBlendDestFactorAlpha() ); diff --git a/dali/internal/event/rendering/renderer-impl.h b/dali/internal/event/rendering/renderer-impl.h index 1c83686..8323595 100755 --- a/dali/internal/event/rendering/renderer-impl.h +++ b/dali/internal/event/rendering/renderer-impl.h @@ -139,12 +139,12 @@ public: /** * @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 @@ -317,8 +317,8 @@ private: // data 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 diff --git a/dali/internal/event/rendering/shader-impl.cpp b/dali/internal/event/rendering/shader-impl.cpp index c9da228..88b5483 100644 --- a/dali/internal/event/rendering/shader-impl.cpp +++ b/dali/internal/event/rendering/shader-impl.cpp @@ -50,7 +50,7 @@ Dali::Scripting::StringEnum ShaderHintsTable[] = { "MODIFIES_GEOMETRY", Dali::Shader::Hint::MODIFIES_GEOMETRY} }; -const unsigned int ShaderHintsTableSize = sizeof( ShaderHintsTable ) / sizeof( ShaderHintsTable[0] ); +const uint32_t ShaderHintsTableSize = static_cast( sizeof( ShaderHintsTable ) / sizeof( ShaderHintsTable[0] ) ); BaseHandle Create() { diff --git a/dali/internal/event/rendering/texture-set-impl.cpp b/dali/internal/event/rendering/texture-set-impl.cpp index f85cad5..b4d4793 100644 --- a/dali/internal/event/rendering/texture-set-impl.cpp +++ b/dali/internal/event/rendering/texture-set-impl.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -36,9 +36,9 @@ TextureSetPtr TextureSet::New() 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( mTextures.size() ); if( index >= textureCount ) { mTextures.resize(index + 1); @@ -50,7 +50,7 @@ void TextureSet::SetTexture( size_t index, TexturePtr texture ) samplerExist = false; } - for( size_t i(textureCount); i<=index; ++i ) + for( uint32_t i(textureCount); i<=index; ++i ) { mTextures[i] = NULL; @@ -72,7 +72,7 @@ void TextureSet::SetTexture( size_t index, TexturePtr texture ) 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() ) @@ -87,13 +87,13 @@ Texture* TextureSet::GetTexture( size_t index ) const 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( 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; } @@ -110,7 +110,7 @@ void TextureSet::SetSampler( size_t index, SamplerPtr sampler ) 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() ) @@ -125,9 +125,9 @@ Sampler* TextureSet::GetSampler( size_t index ) const return result; } -size_t TextureSet::GetTextureCount() const +uint32_t TextureSet::GetTextureCount() const { - return mTextures.size(); + return static_cast( mTextures.size() ); } const SceneGraph::TextureSet* TextureSet::GetTextureSetSceneObject() const diff --git a/dali/internal/event/rendering/texture-set-impl.h b/dali/internal/event/rendering/texture-set-impl.h index eb692b9..148286f 100644 --- a/dali/internal/event/rendering/texture-set-impl.h +++ b/dali/internal/event/rendering/texture-set-impl.h @@ -2,7 +2,7 @@ #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. @@ -59,27 +59,27 @@ public: /** * @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 diff --git a/dali/internal/event/size-negotiation/relayout-controller-impl.cpp b/dali/internal/event/size-negotiation/relayout-controller-impl.cpp index 4e468f4..3d064a9 100644 --- a/dali/internal/event/size-negotiation/relayout-controller-impl.cpp +++ b/dali/internal/event/size-negotiation/relayout-controller-impl.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -76,8 +76,8 @@ void PrintChildren( Dali::Actor actor, int level ) DALI_LOG_INFO( gLogFilter, Debug::Verbose, output.str().c_str() ); ++level; - unsigned int numChildren = actor.GetChildCount(); - for( unsigned int i=0; i( width ); + mStageSize.height = static_cast( height ); } void RelayoutController::QueueActor( Dali::Actor& actor, RelayoutContainer& actors, Vector2 size ) @@ -159,7 +159,7 @@ void RelayoutController::RequestRelayout( Dali::Actor& actor, Dimension::Type di 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 ) ) { @@ -253,7 +253,7 @@ void RelayoutController::RequestRelayoutTree( Dali::Actor& actor ) } // 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 ); @@ -273,7 +273,7 @@ void RelayoutController::PropagateAll( Dali::Actor& actor, Dimension::Type dimen // 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 ); @@ -293,9 +293,9 @@ void RelayoutController::PropagateAll( Dali::Actor& actor, Dimension::Type dimen { // 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; @@ -347,7 +347,7 @@ void RelayoutController::PropagateFlags( Dali::Actor& actor, Dimension::Type dim // 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 ); @@ -370,7 +370,7 @@ void RelayoutController::PropagateFlags( Dali::Actor& actor, Dimension::Type dim } // 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 ); @@ -389,9 +389,9 @@ void RelayoutController::AddRequest( Dali::Actor& actor ) // 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; diff --git a/dali/internal/event/size-negotiation/relayout-controller-impl.h b/dali/internal/event/size-negotiation/relayout-controller-impl.h index d8e7bfa..543ae66 100644 --- a/dali/internal/event/size-negotiation/relayout-controller-impl.h +++ b/dali/internal/event/size-negotiation/relayout-controller-impl.h @@ -2,7 +2,7 @@ #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. @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include + // INTERNAL INCLUDES #include #include @@ -69,7 +72,7 @@ public: * @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. diff --git a/dali/internal/render/common/render-algorithms.cpp b/dali/internal/render/common/render-algorithms.cpp index ec47b65..1d80991 100644 --- a/dali/internal/render/common/render-algorithms.cpp +++ b/dali/internal/render/common/render-algorithms.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -424,7 +424,7 @@ inline void RenderAlgorithms::ProcessRenderList( const RenderList& renderList, } // 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 ); diff --git a/dali/internal/render/common/render-instruction-container.cpp b/dali/internal/render/common/render-instruction-container.cpp index 9b16af8..da899a9 100644 --- a/dali/internal/render/common/render-instruction-container.cpp +++ b/dali/internal/render/common/render-instruction-container.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -42,10 +42,10 @@ RenderInstructionContainer::~RenderInstructionContainer() // 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( mInstructions[ bufferIndex ].Capacity() ); // uint32_t is large enough in practice if( oldcapacity < capacityRequired ) { mInstructions[ bufferIndex ].Reserve( capacityRequired ); @@ -60,7 +60,7 @@ void RenderInstructionContainer::ResetAndReserve( BufferIndex bufferIndex, size_ // 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) @@ -73,7 +73,7 @@ RenderInstruction& RenderInstructionContainer::GetNextInstruction( BufferIndex b 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() ); diff --git a/dali/internal/render/common/render-instruction-container.h b/dali/internal/render/common/render-instruction-container.h index 9181243..ec632ed 100644 --- a/dali/internal/render/common/render-instruction-container.h +++ b/dali/internal/render/common/render-instruction-container.h @@ -2,7 +2,7 @@ #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. @@ -54,14 +54,14 @@ public: * @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 @@ -74,7 +74,7 @@ public: * @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 diff --git a/dali/internal/render/common/render-item.cpp b/dali/internal/render/common/render-item.cpp index 011e154..d47f808 100644 --- a/dali/internal/render/common/render-item.cpp +++ b/dali/internal/render/common/render-item.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -103,12 +103,15 @@ ClippingBox RenderItem::CalculateViewportSpaceAABB( const int viewportWidth, con // 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( viewportWidth ) * 0.5f - aabb.z, + static_cast( viewportHeight ) * 0.5f - aabb.w, + static_cast( viewportWidth ) * 0.5f - aabb.x, + static_cast( 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 ); } diff --git a/dali/internal/render/common/render-list.h b/dali/internal/render/common/render-list.h index 1aef561..41af19f 100644 --- a/dali/internal/render/common/render-list.h +++ b/dali/internal/render/common/render-list.h @@ -2,7 +2,7 @@ #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. @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include + // INTERNAL INCLUDES #include #include @@ -122,7 +125,7 @@ public: /** * 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 ]; @@ -131,7 +134,7 @@ public: /** * 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; @@ -142,7 +145,7 @@ public: * 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; } @@ -150,9 +153,9 @@ public: /** * @return the number of items cached by the list */ - RenderItemContainer::SizeType GetCachedItemCount() const + uint32_t GetCachedItemCount() const { - return mItems.Count(); + return static_cast( mItems.Count() ); } /** @@ -160,7 +163,7 @@ public: */ void ReuseCachedItems() { - mNextFree = mItems.Count(); + mNextFree = static_cast( mItems.Count() ); } /** @@ -264,7 +267,7 @@ private: 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 diff --git a/dali/internal/render/common/render-manager.cpp b/dali/internal/render/common/render-manager.cpp index baa2560..e9e13e8 100644 --- a/dali/internal/render/common/render-manager.cpp +++ b/dali/internal/render/common/render-manager.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -113,10 +113,10 @@ struct RenderManager::Impl 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 defaultSurfaceRect; ///< Rectangle for the default surface we are rendering to + Rect 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 @@ -212,7 +212,7 @@ void RenderManager::SetBackgroundColor( const Vector4& color ) mImpl->backgroundColor = color; } -void RenderManager::SetDefaultSurfaceRect(const Rect& rect) +void RenderManager::SetDefaultSurfaceRect(const Rect& rect) { mImpl->defaultSurfaceRect = rect; } @@ -272,13 +272,13 @@ void RenderManager::GenerateMipmaps( Render::Texture* texture ) 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(minFilterMode); sampler->mMagnificationFilter = static_cast(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(rWrapMode); sampler->mSWrapMode = static_cast(sWrapMode); @@ -307,7 +307,7 @@ void RenderManager::RemoveFrameBuffer( Render::FrameBuffer* frameBuffer ) } } -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 ); } @@ -327,12 +327,12 @@ void RenderManager::SetPropertyBufferFormat( Render::PropertyBuffer* propertyBuf propertyBuffer->SetFormat( format.Release() ); } -void RenderManager::SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector >& data, size_t size ) +void RenderManager::SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector >& data, uint32_t size ) { propertyBuffer->SetData( data.Release(), size ); } -void RenderManager::SetIndexBuffer( Render::Geometry* geometry, Dali::Vector& indices ) +void RenderManager::SetIndexBuffer( Render::Geometry* geometry, Dali::Vector& indices ) { geometry->SetIndexBuffer( indices ); } @@ -377,7 +377,7 @@ void RenderManager::RemoveVertexBuffer( Render::Geometry* geometry, Render::Prop } } -void RenderManager::SetGeometryType( Render::Geometry* geometry, unsigned int geometryType ) +void RenderManager::SetGeometryType( Render::Geometry* geometry, uint32_t geometryType ) { geometry->SetType( Render::Geometry::Type(geometryType) ); } @@ -410,7 +410,7 @@ void RenderManager::Render( Integration::RenderStatus& status, bool forceClear ) // 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). @@ -462,7 +462,7 @@ void RenderManager::Render( Integration::RenderStatus& status, bool forceClear ) // 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 ); @@ -496,7 +496,7 @@ void RenderManager::Render( Integration::RenderStatus& status, bool forceClear ) void RenderManager::DoRender( RenderInstruction& instruction ) { - Rect viewportRect; + Rect viewportRect; Vector4 clearColor; if ( instruction.mIsClearColorSet ) @@ -514,7 +514,7 @@ void RenderManager::DoRender( RenderInstruction& instruction ) 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 @@ -531,7 +531,7 @@ void RenderManager::DoRender( RenderInstruction& instruction ) 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 diff --git a/dali/internal/render/common/render-manager.h b/dali/internal/render/common/render-manager.h index 9191a27..b2b41d9 100644 --- a/dali/internal/render/common/render-manager.h +++ b/dali/internal/render/common/render-manager.h @@ -2,7 +2,7 @@ #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. @@ -170,7 +170,7 @@ public: * @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 @@ -178,7 +178,7 @@ public: * @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. @@ -236,21 +236,21 @@ public: * @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 >& data, size_t size ); + void SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector >& 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& data ); + void SetIndexBuffer( Render::Geometry* geometry, Dali::Vector& 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 @@ -297,7 +297,7 @@ public: * @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 diff --git a/dali/internal/render/data-providers/node-data-provider.h b/dali/internal/render/data-providers/node-data-provider.h index 0a40075..3a4f27a 100644 --- a/dali/internal/render/data-providers/node-data-provider.h +++ b/dali/internal/render/data-providers/node-data-provider.h @@ -2,7 +2,7 @@ #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. @@ -43,16 +43,16 @@ public: 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() diff --git a/dali/internal/render/queue/render-queue.cpp b/dali/internal/render/queue/render-queue.cpp index 0eda995..6d371f6 100644 --- a/dali/internal/render/queue/render-queue.cpp +++ b/dali/internal/render/queue/render-queue.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -75,7 +75,7 @@ RenderQueue::~RenderQueue() } } -unsigned int* RenderQueue::ReserveMessageSlot( BufferIndex updateBufferIndex, std::size_t size ) +uint32_t* RenderQueue::ReserveMessageSlot( BufferIndex updateBufferIndex, std::size_t size ) { MessageBuffer* container = GetCurrentContainer( updateBufferIndex ); diff --git a/dali/internal/render/queue/render-queue.h b/dali/internal/render/queue/render-queue.h index 246f67f..40fd234 100644 --- a/dali/internal/render/queue/render-queue.h +++ b/dali/internal/render/queue/render-queue.h @@ -2,7 +2,7 @@ #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. @@ -58,7 +58,7 @@ public: * @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. diff --git a/dali/internal/render/renderers/render-frame-buffer.cpp b/dali/internal/render/renderers/render-frame-buffer.cpp index 238a8cf..a9d351c 100644 --- a/dali/internal/render/renderers/render-frame-buffer.cpp +++ b/dali/internal/render/renderers/render-frame-buffer.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -27,7 +27,7 @@ namespace Internal 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 ), @@ -78,7 +78,7 @@ void FrameBuffer::Initialize(Context& context) 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 ); @@ -108,12 +108,12 @@ void FrameBuffer::Bind( Context& context ) 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; } diff --git a/dali/internal/render/renderers/render-frame-buffer.h b/dali/internal/render/renderers/render-frame-buffer.h index 942e5b3..3cf7110 100644 --- a/dali/internal/render/renderers/render-frame-buffer.h +++ b/dali/internal/render/renderers/render-frame-buffer.h @@ -2,7 +2,7 @@ #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. @@ -41,7 +41,7 @@ public: * @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 @@ -72,7 +72,7 @@ public: * @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 @@ -84,21 +84,21 @@ public: * @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; }; diff --git a/dali/internal/render/renderers/render-geometry.cpp b/dali/internal/render/renderers/render-geometry.cpp index 182dd27..afc96ba 100644 --- a/dali/internal/render/renderers/render-geometry.cpp +++ b/dali/internal/render/renderers/render-geometry.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -14,7 +14,10 @@ * limitations under the License. */ +// CLASS HEADER #include + +// INTERNAL INCLUDES #include #include #include @@ -56,7 +59,7 @@ void Geometry::AddPropertyBuffer( Render::PropertyBuffer* propertyBuffer ) mAttributesChanged = true; } -void Geometry::SetIndexBuffer( Dali::Vector& indices ) +void Geometry::SetIndexBuffer( Dali::Vector& indices ) { mIndices.Swap( indices ); mIndicesChanged = true; @@ -64,13 +67,13 @@ void Geometry::SetIndexBuffer( Dali::Vector& indices ) void Geometry::RemovePropertyBuffer( const Render::PropertyBuffer* propertyBuffer ) { - size_t bufferCount = mVertexBuffers.Size(); - for( size_t i(0); i& attributeLocation { 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 ) @@ -110,8 +113,8 @@ void Geometry::UploadAndDraw( Context& context, BufferIndex bufferIndex, Vector& attributeLocation, - size_t elementBufferOffset, - size_t elementBufferCount ) + uint32_t elementBufferOffset, + uint32_t elementBufferCount ) { if( !mHasBeenUpdated ) { @@ -129,18 +132,16 @@ void Geometry::UploadAndDraw( mIndexBuffer = new GpuBuffer( context ); } - std::size_t bufferSize = sizeof( unsigned short ) * mIndices.Size(); + uint32_t bufferSize = static_cast( 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; @@ -151,23 +152,23 @@ void Geometry::UploadAndDraw( } //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( 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( mIndices.Size() ); if( elementBufferOffset != 0u ) { - elementBufferOffset = elementBufferOffset >= numIndices ? numIndices - 1 : elementBufferOffset; + elementBufferOffset = (elementBufferOffset >= numIndices ) ? numIndices - 1 : elementBufferOffset; firstIndexOffset = elementBufferOffset * sizeof(GLushort); numIndices -= elementBufferOffset; } @@ -223,26 +224,28 @@ void Geometry::UploadAndDraw( { //Indexed draw call mIndexBuffer->Bind( GpuBuffer::ELEMENT_ARRAY_BUFFER ); - context.DrawElements(geometryGLType, numIndices, GL_UNSIGNED_SHORT, reinterpret_cast(firstIndexOffset)); + // numIndices truncated, no value loss happening in practice + context.DrawElements( geometryGLType, static_cast( numIndices ), GL_UNSIGNED_SHORT, reinterpret_cast( 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( 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( attribute ) ); } } } diff --git a/dali/internal/render/renderers/render-geometry.h b/dali/internal/render/renderers/render-geometry.h index 7a34462..4e12e1c 100644 --- a/dali/internal/render/renderers/render-geometry.h +++ b/dali/internal/render/renderers/render-geometry.h @@ -2,7 +2,7 @@ #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. @@ -17,6 +17,7 @@ * limitations under the License. */ +// INTERNAL INCLUDES #include #include #include @@ -75,7 +76,7 @@ public: * 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& indices ); + void SetIndexBuffer( Dali::Vector& indices ); /** * Removes a PropertyBuffer from the geometry @@ -97,7 +98,7 @@ public: 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 @@ -126,15 +127,15 @@ public: void UploadAndDraw(Context& context, BufferIndex bufferIndex, Vector& 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; diff --git a/dali/internal/render/renderers/render-property-buffer.cpp b/dali/internal/render/renderers/render-property-buffer.cpp index 26d86c1..5197837 100644 --- a/dali/internal/render/renderers/render-property-buffer.cpp +++ b/dali/internal/render/renderers/render-property-buffer.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -21,7 +21,6 @@ namespace { -using namespace Dali; using Dali::Property; using Dali::Internal::PropertyImplementationType; @@ -67,9 +66,9 @@ Dali::GLenum GetPropertyImplementationGlType( Property::Type propertyType ) return type; } -size_t GetPropertyImplementationGlSize( Property::Type propertyType ) +Dali::GLint GetPropertyImplementationGlSize( Property::Type propertyType ) { - size_t size = 1u; + Dali::GLint size = 1u; switch( propertyType ) { @@ -136,7 +135,7 @@ void PropertyBuffer::SetFormat( PropertyBuffer::Format* format ) mDataChanged = true; } -void PropertyBuffer::SetData( Dali::Vector* data, size_t size ) +void PropertyBuffer::SetData( Dali::Vector* data, uint32_t size ) { mData = data; mSize = size; @@ -178,14 +177,13 @@ void PropertyBuffer::BindBuffer(GpuBuffer::Target target) } } -unsigned int PropertyBuffer::EnableVertexAttributes( Context& context, Vector& vAttributeLocation, unsigned int locationBase ) +uint32_t PropertyBuffer::EnableVertexAttributes( Context& context, Vector& vAttributeLocation, uint32_t locationBase ) { - - unsigned int attributeCount = mFormat->components.size(); + const uint32_t attributeCount = static_cast( 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 ) @@ -193,7 +191,7 @@ unsigned int PropertyBuffer::EnableVertexAttributes( Context& context, Vectorcomponents[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, @@ -206,7 +204,6 @@ unsigned int PropertyBuffer::EnableVertexAttributes( Context& context, Vector #include #include @@ -36,10 +38,10 @@ public: 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; }; /** @@ -48,7 +50,7 @@ public: struct Format { std::vector components; - unsigned int size; + uint32_t size; }; /** @@ -77,13 +79,13 @@ public: * @param[in] data The new data of the PropertyBuffer * @param[in] size The new size of the buffer */ - void SetData( Dali::Vector* data, size_t size ); + void SetData( Dali::Vector* 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 @@ -104,16 +106,16 @@ public: * @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& vAttributeLocation, unsigned int locationBase ); + uint32_t EnableVertexAttributes( Context& context, Vector& 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( mFormat->components.size() ); } /** @@ -121,7 +123,7 @@ public: * @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; @@ -131,7 +133,7 @@ public: * 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; @@ -141,7 +143,7 @@ public: * 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; @@ -151,7 +153,7 @@ public: * 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; } @@ -160,7 +162,7 @@ public: * 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(); } @@ -184,10 +186,10 @@ public: 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 }; diff --git a/dali/internal/render/renderers/render-renderer.cpp b/dali/internal/render/renderers/render-renderer.cpp index ca9724e..4beee2e 100644 --- a/dali/internal/render/renderers/render-renderer.cpp +++ b/dali/internal/render/renderers/render-renderer.cpp @@ -107,7 +107,7 @@ namespace Render Renderer* Renderer::New( SceneGraph::RenderDataProvider* dataProvider, Render::Geometry* geometry, - unsigned int blendingBitmask, + uint32_t blendingBitmask, const Vector4& blendColor, FaceCullingMode::Type faceCullingMode, bool preMultipliedAlphaEnabled, @@ -123,7 +123,7 @@ Renderer* Renderer::New( SceneGraph::RenderDataProvider* dataProvider, Renderer::Renderer( SceneGraph::RenderDataProvider* dataProvider, Render::Geometry* geometry, - unsigned int blendingBitmask, + uint32_t blendingBitmask, const Vector4& blendColor, FaceCullingMode::Type faceCullingMode, bool preMultipliedAlphaEnabled, @@ -221,22 +221,22 @@ void Renderer::SetUniforms( BufferIndex bufferIndex, const SceneGraph::NodeDataP 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( 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& samplers( mRenderDataProvider->GetSamplers() ); std::vector& textures( mRenderDataProvider->GetTextures() ); - for( size_t i(0); i( textures.size() ) && result; ++i ) // not expecting more than uint32_t of textures { if( textures[i] ) { @@ -371,7 +371,7 @@ void Renderer::SetFaceCullingMode( FaceCullingMode::Type mode ) mFaceCullingMode = mode; } -void Renderer::SetBlendingBitMask( unsigned int bitmask ) +void Renderer::SetBlendingBitMask( uint32_t bitmask ) { mBlendingOptions.SetBitmask( bitmask ); } @@ -381,12 +381,12 @@ void Renderer::SetBlendColor( const Vector4& color ) 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; } diff --git a/dali/internal/render/renderers/render-renderer.h b/dali/internal/render/renderers/render-renderer.h index 55bac57..1f8d99e 100755 --- a/dali/internal/render/renderers/render-renderer.h +++ b/dali/internal/render/renderers/render-renderer.h @@ -114,7 +114,7 @@ public: */ static Renderer* New( SceneGraph::RenderDataProvider* dataProviders, Render::Geometry* geometry, - unsigned int blendingBitmask, + uint32_t blendingBitmask, const Vector4& blendColor, FaceCullingMode::Type faceCullingMode, bool preMultipliedAlphaEnabled, @@ -138,7 +138,7 @@ public: */ Renderer( SceneGraph::RenderDataProvider* dataProviders, Render::Geometry* geometry, - unsigned int blendingBitmask, + uint32_t blendingBitmask, const Vector4& blendColor, FaceCullingMode::Type faceCullingMode, bool preMultipliedAlphaEnabled, @@ -175,7 +175,7 @@ public: * 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 @@ -187,13 +187,13 @@ public: * 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 @@ -414,7 +414,7 @@ private: 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; }; @@ -426,8 +426,8 @@ private: 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 diff --git a/dali/internal/render/renderers/render-texture.cpp b/dali/internal/render/renderers/render-texture.cpp index 7cb2f8e..99fca0d 100644 --- a/dali/internal/render/renderers/render-texture.cpp +++ b/dali/internal/render/renderers/render-texture.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -653,8 +653,8 @@ Texture::Texture( NativeImageInterfacePtr nativeImageInterface ) mGlInternalFormat( GL_RGB ), mGlFormat( GL_RGB ), mPixelDataType( GL_UNSIGNED_BYTE ), - mWidth( nativeImageInterface->GetWidth() ), - mHeight( nativeImageInterface->GetHeight() ), + mWidth( static_cast( nativeImageInterface->GetWidth() ) ), // ignoring overflow, not happening in practice + mHeight( static_cast( nativeImageInterface->GetHeight() ) ), // ignoring overflow, not happening in practice mMaxMipMapLevel( 0 ), mType( TextureType::TEXTURE_2D ), mHasAlpha( nativeImageInterface->RequiresBlending() ), @@ -742,14 +742,14 @@ void Texture::Initialize(Context& context) { 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 ); } @@ -764,10 +764,10 @@ void Texture::Upload( Context& context, PixelDataPtr pixelData, const Internal:: 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; @@ -792,9 +792,9 @@ void Texture::Upload( Context& context, PixelDataPtr pixelData, const Internal:: 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( 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]; @@ -826,7 +826,7 @@ void Texture::Upload( Context& context, PixelDataPtr pixelData, const Internal:: } 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( pixelData->GetBufferSize() ), buffer ); } } else @@ -842,7 +842,7 @@ void Texture::Upload( Context& context, PixelDataPtr pixelData, const Internal:: { context.CompressedTexSubImage2D( target, params.mipmap, params.xOffset, params.yOffset, params.width, params.height, - glFormat, pixelData->GetBufferSize(), buffer ); + glFormat, static_cast( pixelData->GetBufferSize() ), buffer ); } } @@ -851,7 +851,7 @@ void Texture::Upload( Context& context, PixelDataPtr pixelData, const Internal:: 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 ) { diff --git a/dali/internal/render/renderers/render-texture.h b/dali/internal/render/renderers/render-texture.h index 771fca0..86f32f1 100755 --- a/dali/internal/render/renderers/render-texture.h +++ b/dali/internal/render/renderers/render-texture.h @@ -2,7 +2,7 @@ #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. @@ -19,6 +19,7 @@ // EXTERNAL INCLUDES #include +#include // uint16_t, uint32_t // INTERNAL INCLUDES #include // Dali::ImageDimensions @@ -95,7 +96,7 @@ public: * @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 diff --git a/dali/internal/render/shaders/program-controller.cpp b/dali/internal/render/shaders/program-controller.cpp index 85230ba..cde611d 100644 --- a/dali/internal/render/shaders/program-controller.cpp +++ b/dali/internal/render/shaders/program-controller.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -134,7 +134,7 @@ bool ProgramController::IsBinarySupported() return mNumberOfProgramBinaryFormats > 0; } -unsigned int ProgramController::ProgramBinaryFormat() +GLenum ProgramController::ProgramBinaryFormat() { return mProgramBinaryFormat; } diff --git a/dali/internal/render/shaders/program.cpp b/dali/internal/render/shaders/program.cpp index 530b629..ec8ebe1 100755 --- a/dali/internal/render/shaders/program.cpp +++ b/dali/internal/render/shaders/program.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -37,9 +37,9 @@ namespace { 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 ) { @@ -144,11 +144,11 @@ GLint Program::GetAttribLocation( AttribType type ) 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( mAttributeLocations.size() ); ++index ) { if( mAttributeLocations[ index ].first == name ) { @@ -161,7 +161,7 @@ unsigned int Program::RegisterCustomAttribute( const std::string& 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 ); @@ -181,11 +181,11 @@ GLint Program::GetCustomAttributeLocation( unsigned int 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( mUniformLocations.size() ); ++index ) { if( mUniformLocations[ index ].first == name ) { @@ -198,7 +198,7 @@ unsigned int Program::RegisterUniform( const std::string& 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 ); @@ -226,8 +226,8 @@ namespace 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) { } @@ -247,8 +247,8 @@ void Program::GetActiveSamplerUniforms() mGlAbstraction.GetProgramiv( mProgramId, GL_ACTIVE_UNIFORMS, &numberOfActiveUniforms ); mGlAbstraction.GetProgramiv( mProgramId, GL_ACTIVE_UNIFORM_MAX_LENGTH, &uniformMaxNameLength ); - std::vector samplerNames; - std::vector 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; { @@ -283,7 +283,7 @@ void Program::GetActiveSamplerUniforms() { bool found( false ); token = strtok_r( NULL, " ;\n", &nextPtr ); - for( size_t i=0; i( samplerUniformLocations.size() ); ++i ) { if( samplerUniformLocations[i].position == -1 && strncmp( token, samplerNames[i].c_str(), samplerNames[i].size() ) == 0 ) @@ -307,20 +307,20 @@ void Program::GetActiveSamplerUniforms() free( fragShader ); // Re-order according to declaration order in the fragment source. - size_t samplerUniformCount = samplerUniformLocations.size(); + uint32_t samplerUniformCount = static_cast( samplerUniformLocations.size() ); if( samplerUniformCount > 1 ) { std::sort( samplerUniformLocations.begin(), samplerUniformLocations.end(), sortByPosition); } mSamplerUniformLocations.resize( samplerUniformCount ); - for( size_t i=0; i( mSamplerUniformLocations.size() ); } void Program::SetUniform1i( GLint location, GLint value0 ) @@ -598,7 +598,7 @@ Program::Program( ProgramCache& cache, Internal::ShaderDataPtr shaderData, bool { // reserve space for standard attributes mAttributeLocations.reserve( ATTRIB_TYPE_LAST ); - for( int i=0; iGetBufferSize()); - CHECK_GL( mGlAbstraction, mGlAbstraction.ProgramBinary(mProgramId, mCache.ProgramBinaryFormat(), mProgramData->GetBufferData(), mProgramData->GetBufferSize()) ); + CHECK_GL( mGlAbstraction, mGlAbstraction.ProgramBinary(mProgramId, mCache.ProgramBinaryFormat(), mProgramData->GetBufferData(), static_cast( mProgramData->GetBufferSize() ) ) ); // truncated CHECK_GL( mGlAbstraction, mGlAbstraction.ValidateProgram(mProgramId) ); @@ -821,13 +821,13 @@ void Program::FreeShaders() 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; @@ -838,7 +838,7 @@ void Program::ResetAttribsUniformCache() // 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; diff --git a/dali/internal/render/shaders/program.h b/dali/internal/render/shaders/program.h index 0d5f416..ce0cb11 100644 --- a/dali/internal/render/shaders/program.h +++ b/dali/internal/render/shaders/program.h @@ -2,7 +2,7 @@ #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. @@ -20,6 +20,7 @@ // EXTERNAL INCLUDES #include +#include // int32_t, uint32_t // INTERNAL INCLUDES #include @@ -43,13 +44,10 @@ namespace Internal 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 { @@ -60,12 +58,12 @@ public: * 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 @@ -132,21 +130,21 @@ public: * @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. @@ -154,7 +152,7 @@ public: * @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 @@ -167,13 +165,13 @@ public: * @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 diff --git a/dali/internal/update/animation/scene-graph-animation.cpp b/dali/internal/update/animation/scene-graph-animation.cpp index 73317ae..e9dd7b3 100644 --- a/dali/internal/update/animation/scene-graph-animation.cpp +++ b/dali/internal/update/animation/scene-graph-animation.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -59,12 +59,12 @@ namespace Internal 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 ), @@ -105,7 +105,7 @@ void Animation::SetProgressNotification( float progress ) } } -void Animation::SetLoopCount(int loopCount) +void Animation::SetLoopCount(int32_t loopCount) { mLoopCount = loopCount; mCurrentLoop = 0; @@ -316,7 +316,7 @@ void Animation::Update(BufferIndex bufferIndex, float elapsedSeconds, bool& loop 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 ) diff --git a/dali/internal/update/animation/scene-graph-animation.h b/dali/internal/update/animation/scene-graph-animation.h index a30a347..c2b0278 100644 --- a/dali/internal/update/animation/scene-graph-animation.h +++ b/dali/internal/update/animation/scene-graph-animation.h @@ -2,7 +2,7 @@ #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. @@ -71,7 +71,7 @@ public: * @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 @@ -143,7 +143,7 @@ public: * 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. @@ -158,7 +158,7 @@ public: * Get the loop count * @return the loop count */ - int GetLoopCount() const + int32_t GetLoopCount() const { return mLoopCount; } @@ -252,7 +252,7 @@ public: * 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; } @@ -260,7 +260,7 @@ public: /** * Get the current loop count from zero to GetLoopCount(). */ - int GetCurrentLoop() const + int32_t GetCurrentLoop() const { return mCurrentLoop; } @@ -308,7 +308,7 @@ protected: /** * 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: @@ -353,10 +353,10 @@ protected: 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; @@ -382,7 +382,7 @@ inline void SetDurationMessage( EventThreadServices& eventThreadServices, const 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 ); @@ -393,19 +393,19 @@ inline void SetProgressNotificationMessage( EventThreadServices& eventThreadServ 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 ); @@ -416,7 +416,7 @@ inline void SetEndActionMessage( EventThreadServices& eventThreadServices, const 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 ); @@ -427,7 +427,7 @@ inline void SetDisconnectActionMessage( EventThreadServices& eventThreadServices 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 ); @@ -438,7 +438,7 @@ inline void SetCurrentProgressMessage( EventThreadServices& eventThreadServices, 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 ); @@ -449,7 +449,7 @@ inline void SetSpeedFactorMessage( EventThreadServices& eventThreadServices, con 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 ); @@ -460,7 +460,7 @@ inline void SetPlayRangeMessage( EventThreadServices& eventThreadServices, const 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 ); @@ -471,7 +471,7 @@ inline void PlayAnimationMessage( EventThreadServices& eventThreadServices, cons 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 ); @@ -482,7 +482,7 @@ inline void PlayAnimationFromMessage( EventThreadServices& eventThreadServices, 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 ); @@ -493,7 +493,7 @@ inline void PauseAnimationMessage( EventThreadServices& eventThreadServices, con 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 ); @@ -504,7 +504,7 @@ inline void AddAnimatorMessage( EventThreadServices& eventThreadServices, const typedef MessageValue1< Animation, OwnerPointer > 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 parameter( &animator ); @@ -516,7 +516,7 @@ inline void PlayAfterMessage( EventThreadServices& eventThreadServices, const An 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 ); @@ -527,7 +527,7 @@ inline void SetLoopingModeMessage( EventThreadServices& eventThreadServices, con 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 ); diff --git a/dali/internal/update/animation/scene-graph-animator.h b/dali/internal/update/animation/scene-graph-animator.h index b8da716..36caa07 100644 --- a/dali/internal/update/animation/scene-graph-animator.h +++ b/dali/internal/update/animation/scene-graph-animator.h @@ -19,11 +19,6 @@ */ // INTERNAL INCLUDES -#include -#include -#include -#include -#include #include #include #include @@ -31,6 +26,11 @@ #include #include #include +#include +#include +#include +#include +#include #include #include @@ -153,7 +153,7 @@ public: mSpeedFactor = factor; } - void SetLoopCount(int loopCount) + void SetLoopCount(int32_t loopCount) { mLoopCount = loopCount; } @@ -329,7 +329,7 @@ public: 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 ) { @@ -442,7 +442,7 @@ protected: float mIntervalDelaySeconds; float mSpeedFactor; - int mLoopCount; + int32_t mLoopCount; AlphaFunction mAlphaFunction; @@ -558,7 +558,8 @@ public: 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( (*mAnimatorFunction)( alpha, current ) ); if ( bake ) { mPropertyAccessor.Bake( bufferIndex, result ); @@ -717,8 +718,8 @@ public: 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( (*mAnimatorFunction)( alpha, current ) ); if ( bake ) { @@ -796,14 +797,14 @@ struct AnimatorFunctionBase return property; } - virtual float operator()(float progress, const int& property) + virtual float operator()(float progress, const int32_t& property) { - return property; + return static_cast( property ); } - virtual float operator()(float progress, const unsigned int& property) + virtual float operator()(float progress, const uint32_t& property) { - return property; + return static_cast( property ); } virtual float operator()(float progress, const float& property) @@ -842,12 +843,12 @@ struct AnimateByInteger : public AnimatorFunctionBase } 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( property ) + static_cast( mRelative ) * alpha + 0.5f ); } - int mRelative; + int32_t mRelative; }; struct AnimateToInteger : public AnimatorFunctionBase @@ -858,12 +859,12 @@ 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( property ) + (static_cast(mTarget - property) * alpha) + 0.5f); } - int mTarget; + int32_t mTarget; }; struct AnimateByFloat : public AnimatorFunctionBase @@ -1134,13 +1135,13 @@ struct KeyFrameIntegerFunctor : 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( mKeyFrames->GetValue(progress, mInterpolation) ); } - return property; + return static_cast( property ); } KeyFrameIntegerPtr mKeyFrames; diff --git a/dali/internal/update/animation/scene-graph-constraint-base.cpp b/dali/internal/update/animation/scene-graph-constraint-base.cpp index 7c39de9..2805e88 100644 --- a/dali/internal/update/animation/scene-graph-constraint-base.cpp +++ b/dali/internal/update/animation/scene-graph-constraint-base.cpp @@ -28,8 +28,8 @@ namespace SceneGraph { #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 ) @@ -62,7 +62,7 @@ ConstraintBase::~ConstraintBase() #endif } -unsigned int ConstraintBase::GetCurrentInstanceCount() +uint32_t ConstraintBase::GetCurrentInstanceCount() { #ifdef DEBUG_ENABLED return mCurrentInstanceCount; @@ -71,7 +71,7 @@ unsigned int ConstraintBase::GetCurrentInstanceCount() #endif } -unsigned int ConstraintBase::GetTotalInstanceCount() +uint32_t ConstraintBase::GetTotalInstanceCount() { #ifdef DEBUG_ENABLED return mTotalInstanceCount; diff --git a/dali/internal/update/animation/scene-graph-constraint-base.h b/dali/internal/update/animation/scene-graph-constraint-base.h index c816bcc..4f360e3 100644 --- a/dali/internal/update/animation/scene-graph-constraint-base.h +++ b/dali/internal/update/animation/scene-graph-constraint-base.h @@ -138,13 +138,13 @@ public: * 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: @@ -242,8 +242,8 @@ 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 }; @@ -254,7 +254,7 @@ inline void SetRemoveActionMessage( EventThreadServices& eventThreadServices, c 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 ); diff --git a/dali/internal/update/common/animatable-property.h b/dali/internal/update/common/animatable-property.h index f82ed88..94730ad 100644 --- a/dali/internal/update/common/animatable-property.h +++ b/dali/internal/update/common/animatable-property.h @@ -52,9 +52,9 @@ namespace SceneGraph * 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 AnimatableProperty; @@ -118,7 +118,7 @@ public: // From PropertyBase 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 }; @@ -214,7 +214,7 @@ public: /** * @copydoc Dali::SceneGraph::AnimatableProperty::Get() */ - bool& Get(size_t bufferIndex) + bool& Get( BufferIndex bufferIndex ) { return mValue[bufferIndex]; } @@ -222,7 +222,7 @@ public: /** * @copydoc Dali::SceneGraph::AnimatableProperty::Get() */ - const bool& Get(size_t bufferIndex) const + const bool& Get( BufferIndex bufferIndex ) const { return mValue[bufferIndex]; } @@ -232,7 +232,7 @@ public: * @param[in] bufferIndex The buffer to read. * @return The property value. */ - bool& operator[](size_t bufferIndex) + bool& operator[]( BufferIndex bufferIndex ) { return mValue[bufferIndex]; } @@ -242,7 +242,7 @@ public: * @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]; } @@ -378,7 +378,7 @@ public: /** * @copydoc Dali::SceneGraph::AnimatableProperty::Get() */ - int& Get(size_t bufferIndex) + int& Get( BufferIndex bufferIndex ) { return mValue[bufferIndex]; } @@ -386,7 +386,7 @@ public: /** * @copydoc Dali::SceneGraph::AnimatableProperty::Get() */ - const int& Get(size_t bufferIndex) const + const int& Get( BufferIndex bufferIndex ) const { return mValue[bufferIndex]; } @@ -396,7 +396,7 @@ public: * @param[in] bufferIndex The buffer to read. * @return The property value. */ - int& operator[](size_t bufferIndex) + int& operator[]( BufferIndex bufferIndex ) { return mValue[bufferIndex]; } @@ -406,7 +406,7 @@ public: * @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]; } @@ -559,7 +559,7 @@ public: /** * @copydoc Dali::SceneGraph::AnimatableProperty::Get() */ - float& Get(size_t bufferIndex) + float& Get( BufferIndex bufferIndex ) { return mValue[bufferIndex]; } @@ -567,7 +567,7 @@ public: /** * @copydoc Dali::SceneGraph::AnimatableProperty::Get() */ - const float& Get(size_t bufferIndex) const + const float& Get( BufferIndex bufferIndex ) const { return mValue[bufferIndex]; } @@ -577,7 +577,7 @@ public: * @param[in] bufferIndex The buffer to read. * @return The property value. */ - float& operator[](size_t bufferIndex) + float& operator[]( BufferIndex bufferIndex ) { return mValue[bufferIndex]; } @@ -587,7 +587,7 @@ public: * @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]; } @@ -791,7 +791,7 @@ public: /** * @copydoc Dali::SceneGraph::AnimatableProperty::Get() */ - Vector2& Get(size_t bufferIndex) + Vector2& Get( BufferIndex bufferIndex ) { return mValue[bufferIndex]; } @@ -799,7 +799,7 @@ public: /** * @copydoc Dali::SceneGraph::AnimatableProperty::Get() */ - const Vector2& Get(size_t bufferIndex) const + const Vector2& Get( BufferIndex bufferIndex ) const { return mValue[bufferIndex]; } @@ -809,7 +809,7 @@ public: * @param[in] bufferIndex The buffer to read. * @return The property value. */ - Vector2& operator[](size_t bufferIndex) + Vector2& operator[]( BufferIndex bufferIndex ) { return mValue[bufferIndex]; } @@ -819,7 +819,7 @@ public: * @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]; } @@ -1088,7 +1088,7 @@ public: /** * @copydoc Dali::SceneGraph::AnimatableProperty::Get() */ - Vector3& Get(size_t bufferIndex) + Vector3& Get( BufferIndex bufferIndex ) { return mValue[bufferIndex]; } @@ -1096,7 +1096,7 @@ public: /** * @copydoc Dali::SceneGraph::AnimatableProperty::Get() */ - const Vector3& Get(size_t bufferIndex) const + const Vector3& Get( BufferIndex bufferIndex ) const { return mValue[bufferIndex]; } @@ -1106,7 +1106,7 @@ public: * @param[in] bufferIndex The buffer to read. * @return The property value. */ - Vector3& operator[](size_t bufferIndex) + Vector3& operator[]( BufferIndex bufferIndex ) { return mValue[bufferIndex]; } @@ -1116,7 +1116,7 @@ public: * @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]; } @@ -1439,7 +1439,7 @@ public: /** * @copydoc Dali::SceneGraph::AnimatableProperty::Get() */ - Vector4& Get(size_t bufferIndex) + Vector4& Get( BufferIndex bufferIndex ) { return mValue[bufferIndex]; } @@ -1447,7 +1447,7 @@ public: /** * @copydoc Dali::SceneGraph::AnimatableProperty::Get() */ - const Vector4& Get(size_t bufferIndex) const + const Vector4& Get( BufferIndex bufferIndex ) const { return mValue[bufferIndex]; } @@ -1457,7 +1457,7 @@ public: * @param[in] bufferIndex The buffer to read. * @return The property value. */ - Vector4& operator[](size_t bufferIndex) + Vector4& operator[]( BufferIndex bufferIndex ) { return mValue[bufferIndex]; } @@ -1467,7 +1467,7 @@ public: * @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]; } @@ -1724,7 +1724,7 @@ public: /** * @copydoc Dali::SceneGraph::AnimatableProperty::Get() */ - Quaternion& Get(size_t bufferIndex) + Quaternion& Get( BufferIndex bufferIndex ) { return mValue[bufferIndex]; } @@ -1732,7 +1732,7 @@ public: /** * @copydoc Dali::SceneGraph::AnimatableProperty::Get() */ - const Quaternion& Get(size_t bufferIndex) const + const Quaternion& Get( BufferIndex bufferIndex ) const { return mValue[bufferIndex]; } @@ -1742,7 +1742,7 @@ public: * @param[in] bufferIndex The buffer to read. * @return The property value. */ - Quaternion& operator[](size_t bufferIndex) + Quaternion& operator[]( BufferIndex bufferIndex ) { return mValue[bufferIndex]; } @@ -1752,7 +1752,7 @@ public: * @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]; } @@ -1885,7 +1885,7 @@ public: /** * @copydoc Dali::SceneGraph::AnimatableProperty::Get() */ - Matrix& Get(size_t bufferIndex) + Matrix& Get( BufferIndex bufferIndex ) { return mValue[bufferIndex]; } @@ -1893,7 +1893,7 @@ public: /** * @copydoc Dali::SceneGraph::AnimatableProperty::Get() */ - const Matrix& Get(size_t bufferIndex) const + const Matrix& Get( BufferIndex bufferIndex ) const { return mValue[bufferIndex]; } @@ -1903,7 +1903,7 @@ public: * @param[in] bufferIndex The buffer to read. * @return The property value. */ - Matrix& operator[](size_t bufferIndex) + Matrix& operator[]( BufferIndex bufferIndex ) { return mValue[bufferIndex]; } @@ -1913,7 +1913,7 @@ public: * @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]; } @@ -2046,7 +2046,7 @@ public: /** * @copydoc Dali::SceneGraph::AnimatableProperty::Get() */ - Matrix3& Get(size_t bufferIndex) + Matrix3& Get( BufferIndex bufferIndex ) { return mValue[bufferIndex]; } @@ -2054,7 +2054,7 @@ public: /** * @copydoc Dali::SceneGraph::AnimatableProperty::Get() */ - const Matrix3& Get(size_t bufferIndex) const + const Matrix3& Get( BufferIndex bufferIndex ) const { return mValue[bufferIndex]; } @@ -2064,7 +2064,7 @@ public: * @param[in] bufferIndex The buffer to read. * @return The property value. */ - Matrix3& operator[](size_t bufferIndex) + Matrix3& operator[]( BufferIndex bufferIndex ) { return mValue[bufferIndex]; } @@ -2074,7 +2074,7 @@ public: * @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]; } @@ -2137,7 +2137,7 @@ void BakeMessage( EventThreadServices& eventThreadServices, typedef MessageDoubleBuffered1< SceneGraph::AnimatableProperty, 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, @@ -2153,7 +2153,7 @@ void BakeRelativeMessage( EventThreadServices& eventThreadServices, typedef MessageDoubleBuffered1< SceneGraph::AnimatableProperty, 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, @@ -2169,7 +2169,7 @@ void SetXComponentMessage( EventThreadServices& eventThreadServices, typedef MessageDoubleBuffered1< SceneGraph::AnimatableProperty, 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, @@ -2185,7 +2185,7 @@ void SetYComponentMessage( EventThreadServices& eventThreadServices, typedef MessageDoubleBuffered1< SceneGraph::AnimatableProperty, 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, @@ -2201,7 +2201,7 @@ void SetZComponentMessage( EventThreadServices& eventThreadServices, typedef MessageDoubleBuffered1< SceneGraph::AnimatableProperty, 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, @@ -2217,7 +2217,7 @@ void SetWComponentMessage( EventThreadServices& eventThreadServices, typedef MessageDoubleBuffered1< SceneGraph::AnimatableProperty, 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, diff --git a/dali/internal/update/common/double-buffered.h b/dali/internal/update/common/double-buffered.h index 412e49c..79c1642 100644 --- a/dali/internal/update/common/double-buffered.h +++ b/dali/internal/update/common/double-buffered.h @@ -2,7 +2,7 @@ #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. @@ -56,14 +56,14 @@ public: { } - 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); @@ -118,7 +118,7 @@ public: private: Setter( DoubleBuffered& object, - size_t i, + BufferIndex i, T* value ) : mObject( object ), mIndex( i ), @@ -133,9 +133,9 @@ public: { } - 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; }; @@ -161,7 +161,7 @@ public: delete mValue1; } - void Set( size_t i, T* value ) + void Set( BufferIndex i, T* value ) { T*& current = *(&mValue1 + i); T*& previous = *(&mValue1 + 1u-i); @@ -173,12 +173,12 @@ public: 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); @@ -189,7 +189,7 @@ public: * 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); diff --git a/dali/internal/update/common/inherited-property.h b/dali/internal/update/common/inherited-property.h index 0c6cc8f..eaea49a 100644 --- a/dali/internal/update/common/inherited-property.h +++ b/dali/internal/update/common/inherited-property.h @@ -2,7 +2,7 @@ #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. @@ -159,7 +159,7 @@ public: /** * @copydoc Dali::SceneGraph::PropertyInterface::Get() */ - Vector3& Get(size_t bufferIndex) + Vector3& Get( BufferIndex bufferIndex ) { return mValue[bufferIndex]; } @@ -167,7 +167,7 @@ public: /** * @copydoc Dali::SceneGraph::PropertyInterface::Get() */ - const Vector3& Get(size_t bufferIndex) const + const Vector3& Get( BufferIndex bufferIndex ) const { return mValue[bufferIndex]; } @@ -177,7 +177,7 @@ public: * @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]; } @@ -330,7 +330,7 @@ public: /** * @copydoc Dali::SceneGraph::PropertyInterface::Get() */ - Vector4& Get(size_t bufferIndex) + Vector4& Get( BufferIndex bufferIndex ) { return mValue[bufferIndex]; } @@ -338,7 +338,7 @@ public: /** * @copydoc Dali::SceneGraph::PropertyInterface::Get() */ - const Vector4& Get(size_t bufferIndex) const + const Vector4& Get( BufferIndex bufferIndex ) const { return mValue[bufferIndex]; } @@ -348,7 +348,7 @@ public: * @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]; } @@ -479,7 +479,7 @@ public: /** * @copydoc Dali::SceneGraph::PropertyInterface::Get() */ - Quaternion& Get(size_t bufferIndex) + Quaternion& Get( BufferIndex bufferIndex ) { return mValue[bufferIndex]; } @@ -487,7 +487,7 @@ public: /** * @copydoc Dali::SceneGraph::PropertyInterface::Get() */ - const Quaternion& Get(size_t bufferIndex) const + const Quaternion& Get( BufferIndex bufferIndex ) const { return mValue[bufferIndex]; } @@ -497,7 +497,7 @@ public: * @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]; } @@ -629,7 +629,7 @@ public: /** * @copydoc Dali::SceneGraph::PropertyInterface::Get() */ - Matrix& Get(size_t bufferIndex) + Matrix& Get( BufferIndex bufferIndex ) { return mValue[bufferIndex]; } @@ -637,7 +637,7 @@ public: /** * @copydoc Dali::SceneGraph::PropertyInterface::Get() */ - const Matrix& Get(size_t bufferIndex) const + const Matrix& Get( BufferIndex bufferIndex ) const { return mValue[bufferIndex]; } @@ -647,12 +647,12 @@ public: * @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; diff --git a/dali/internal/update/common/property-condition-functions.cpp b/dali/internal/update/common/property-condition-functions.cpp index 9422c88..006b817 100644 --- a/dali/internal/update/common/property-condition-functions.cpp +++ b/dali/internal/update/common/property-condition-functions.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -87,7 +87,7 @@ bool LessThan::EvalBoolean( const Dali::PropertyInput& value, PropertyNotificati bool LessThan::EvalInteger( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg ) { - const int arg0 = arg[0]; + const int32_t arg0 = static_cast( arg[0] ); return (value.GetInteger() < arg0); } @@ -176,7 +176,7 @@ bool GreaterThan::EvalBoolean( const Dali::PropertyInput& value, PropertyNotific bool GreaterThan::EvalInteger( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg ) { - const int arg0 = arg[0]; + const int32_t arg0 = static_cast( arg[0] ); return (value.GetInteger() > arg0); } @@ -265,8 +265,8 @@ bool Inside::EvalBoolean( const Dali::PropertyInput& value, PropertyNotification 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( arg[0] ) ) && ( valueInteger < static_cast( arg[1] ) ) ); } bool Inside::EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg ) @@ -354,8 +354,8 @@ bool Outside::EvalBoolean( const Dali::PropertyInput& value, PropertyNotificatio 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( arg[0] ) ) || ( valueInteger > static_cast( arg[0] ) ) ); } bool Outside::EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg ) diff --git a/dali/internal/update/common/property-condition-step-functions.cpp b/dali/internal/update/common/property-condition-step-functions.cpp index a32981d..e305d42 100644 --- a/dali/internal/update/common/property-condition-step-functions.cpp +++ b/dali/internal/update/common/property-condition-step-functions.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -34,9 +34,9 @@ namespace SceneGraph 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 @@ -85,10 +85,10 @@ bool Step::Evaluate( const float propertyValue, PropertyNotification::RawArgumen { const float refValue = arg[ARGINDEX_REF_VALUE]; const float step = arg[ARGINDEX_STEP_SIZE]; - const int currentStep = static_cast(arg[ARGINDEX_CURRENT_STEP]); + const int32_t currentStep = static_cast(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(floorf(distance * step)); + const int32_t newStep = static_cast(floorf(distance * step)); if( newStep != currentStep ) { diff --git a/dali/internal/update/common/property-condition-variable-step-functions.cpp b/dali/internal/update/common/property-condition-variable-step-functions.cpp index 60fca7b..583a4c1 100644 --- a/dali/internal/update/common/property-condition-variable-step-functions.cpp +++ b/dali/internal/update/common/property-condition-variable-step-functions.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -34,9 +34,9 @@ namespace SceneGraph 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; } @@ -83,12 +83,12 @@ ConditionFunction VariableStep::GetFunction( Property::Type valueType ) 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( arg[ARGINDEX_STEP_INDEX] ); // truncated + const int32_t numSteps = static_cast( 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 ) @@ -114,7 +114,7 @@ bool VariableStep::Evaluate( const float propertyValue, PropertyNotification::Ra 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]; diff --git a/dali/internal/update/common/property-owner-messages.h b/dali/internal/update/common/property-owner-messages.h index 3a14bc4..c2dafca 100644 --- a/dali/internal/update/common/property-owner-messages.h +++ b/dali/internal/update/common/property-owner-messages.h @@ -2,7 +2,7 @@ #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. @@ -18,13 +18,14 @@ * */ -// INTERNAL INCLUDES +// EXTERNAL INCLUDES +#include +// INTERNAL INCLUDES #include #include #include #include -#include namespace Dali { @@ -89,7 +90,7 @@ public: 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 ); @@ -168,7 +169,7 @@ public: 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 ); @@ -227,7 +228,7 @@ inline void InstallCustomPropertyMessage( EventThreadServices& eventThreadServic typedef MessageValue1< PropertyOwner, OwnerPointer > 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 ); @@ -238,7 +239,7 @@ inline void ApplyConstraintMessage( EventThreadServices& eventThreadServices, co typedef MessageValue1< PropertyOwner, OwnerPointer > 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 ); @@ -252,7 +253,7 @@ inline void RemoveConstraintMessage( EventThreadServices& eventThreadServices, c 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 ); @@ -263,7 +264,7 @@ inline void AddUniformMapMessage( EventThreadServices& eventThreadServices, cons 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 ); } @@ -273,7 +274,7 @@ inline void RemoveUniformMapMessage( EventThreadServices& eventThreadServices, c 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 ); } diff --git a/dali/internal/update/common/property-owner.h b/dali/internal/update/common/property-owner.h index ec5a862..e5ab8bf 100644 --- a/dali/internal/update/common/property-owner.h +++ b/dali/internal/update/common/property-owner.h @@ -18,8 +18,6 @@ * */ -// EXTERNAL INCLUDES - // INTERNAL INCLUDES #include #include diff --git a/dali/internal/update/common/uniform-map.cpp b/dali/internal/update/common/uniform-map.cpp index 9d4fa6f..72af02a 100644 --- a/dali/internal/update/common/uniform-map.cpp +++ b/dali/internal/update/common/uniform-map.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -14,7 +14,8 @@ * limitations under the License. */ -#include "uniform-map.h" +// CLASS HEADER +#include namespace Dali { @@ -150,12 +151,12 @@ const PropertyInputImpl* UniformMap::Find( const std::string& uniformName ) return NULL; } -unsigned int UniformMap::Count() const +UniformMap::SizeType UniformMap::Count() const { - return mUniformMaps.Count(); + return static_cast( mUniformMaps.Count() ); } -const UniformPropertyMapping& UniformMap::operator[]( unsigned int index ) const +const UniformPropertyMapping& UniformMap::operator[]( UniformMap::SizeType index ) const { return *mUniformMaps[index]; } diff --git a/dali/internal/update/common/uniform-map.h b/dali/internal/update/common/uniform-map.h index 9b5bb4c..00de878 100644 --- a/dali/internal/update/common/uniform-map.h +++ b/dali/internal/update/common/uniform-map.h @@ -2,7 +2,7 @@ #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. @@ -17,9 +17,13 @@ * limitations under the License. */ +// EXTERNAL INCLUDES +#include +#include // uint32_t + +// INTERNAL INCLUDES #include #include -#include namespace Dali { @@ -71,6 +75,8 @@ public: class UniformMap { public: + using SizeType = uint32_t; + class Observer { public: @@ -129,14 +135,14 @@ 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: /** diff --git a/dali/internal/update/controllers/render-message-dispatcher.cpp b/dali/internal/update/controllers/render-message-dispatcher.cpp index 4b5040d..eec8875 100644 --- a/dali/internal/update/controllers/render-message-dispatcher.cpp +++ b/dali/internal/update/controllers/render-message-dispatcher.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -50,7 +50,7 @@ void RenderMessageDispatcher::AddRenderer( OwnerPointer< Render::Renderer >& ren 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 ); @@ -61,7 +61,7 @@ void RenderMessageDispatcher::RemoveRenderer( Render::Renderer& 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 ); @@ -72,7 +72,7 @@ void RenderMessageDispatcher::AddRenderTracker( Render::RenderTracker& renderTra 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 ); @@ -83,7 +83,7 @@ void RenderMessageDispatcher::RemoveRenderTracker( Render::RenderTracker& render 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 ); diff --git a/dali/internal/update/gestures/scene-graph-pan-gesture.cpp b/dali/internal/update/gestures/scene-graph-pan-gesture.cpp index e576f86..4941465 100644 --- a/dali/internal/update/gestures/scene-graph-pan-gesture.cpp +++ b/dali/internal/update/gestures/scene-graph-pan-gesture.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -164,7 +164,7 @@ void PanGesture::PredictionMode1(int eventsThisFrame, PanInfo& gestureOut, PanIn ++iter; continue; } - float previousValueWeight = ( static_cast< float >( MAX_GESTURE_AGE ) - (lastVSyncTime - lastTime) ) / static_cast< float >( MAX_GESTURE_AGE ); + float previousValueWeight = ( static_cast( MAX_GESTURE_AGE ) - static_cast(lastVSyncTime - lastTime) ) / static_cast( MAX_GESTURE_AGE ); float velMag = currentGesture.screen.velocity.Length(); float velDiff = velMag - screenVelocity.Length(); float acceleration = 0.0f; @@ -188,7 +188,7 @@ void PanGesture::PredictionMode1(int eventsThisFrame, PanInfo& gestureOut, PanIn } else { - newVelMag = velMag + (((acceleration * (1.0f - previousValueWeight)) + (previousAccel * previousValueWeight)) * currentInterpolation); + newVelMag = velMag + (((acceleration * (1.0f - previousValueWeight)) + (previousAccel * previousValueWeight)) * static_cast( currentInterpolation ) ); } float velMod = 1.0f; if( velMag > Math::MACHINE_EPSILON_1 ) @@ -197,8 +197,8 @@ void PanGesture::PredictionMode1(int eventsThisFrame, PanInfo& gestureOut, PanIn } 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( interpolationTime ) ); + localDisplacement = gestureOut.local.displacement + (gestureOut.local.velocity * static_cast( interpolationTime ) ); screenVelocity = currentGesture.screen.velocity; localVelocity = currentGesture.local.velocity; previousAccel = acceleration; @@ -222,7 +222,7 @@ void PanGesture::BlendPoints( PanInfo& gesture, PanInfo& lastGesture, float blen 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( gesture.time - lastGesture.time ); gesture.screen.velocity = gesture.screen.displacement / timeDifference; gesture.local.velocity = gesture.local.displacement / timeDifference; } @@ -332,10 +332,11 @@ bool PanGesture::ReadAndResampleGestures( FrameGestureInfo& info, unsigned int c 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( 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; @@ -430,7 +431,7 @@ bool PanGesture::UpdateProperties( unsigned int lastVSyncTime, unsigned int next // 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( static_cast( mPredictionAmountAdjustment ) * ( frameInfo.acceleration > Math::MACHINE_EPSILON_0 ? 1.0f : -1.0f ) ); if( mCurrentPredictionAmount > mMaxPredictionAmount + mPredictionAmountAdjustment ) // Guard against unsigned int overflow { mCurrentPredictionAmount = 0; @@ -810,7 +811,7 @@ bool PanGesture::InputRateConversion( PanInfo& rateConvertedGesture, unsigned in // Some events were read this frame. if( eventsKeptThisFrame > 1 ) { - float eventDivisor( eventsKeptThisFrame ); + const float eventDivisor = static_cast( eventsKeptThisFrame ); rateConvertedGesture.screen.position /= eventDivisor; rateConvertedGesture.local.position /= eventDivisor; rateConvertedGesture.screen.velocity /= eventDivisor; @@ -983,8 +984,8 @@ bool PanGesture::InterpolatePoint( PanInfoHistory& history, unsigned int current 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( outputTimeGranularity ); + newAcceleration.screen = outPoint.screen.velocity / static_cast( outputTimeGranularity ); } pointGenerated = true; } @@ -1037,7 +1038,7 @@ void PanGesture::PredictionMode2( PanInfo& startPoint, RelativeVectors& accelera else { // We are doing integration based prediction. - float predictionDelta( mCurrentPredictionAmount ); + float predictionDelta = static_cast( mCurrentPredictionAmount ); predictedPoint.local.position = startPoint.local.position + ( startPoint.local.velocity * predictionDelta ) + ( accelerationToUse.local * ( predictionDelta * predictionDelta * 0.5f ) ); @@ -1137,7 +1138,7 @@ bool PanGesture::NewAlgorithm( unsigned int lastVSyncTime, unsigned int nextVSyn 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( outputTimeGranularity ), true ); // truncated if( pointGenerated ) { mLastInitialAcceleration.local = currentAcceleration.local; @@ -1178,7 +1179,7 @@ bool PanGesture::NewAlgorithm( unsigned int lastVSyncTime, unsigned int nextVSyn interpolatedAcceleration.local = mLastInterpolatedAcceleration.local; interpolatedAcceleration.screen = mLastInterpolatedAcceleration.screen; if( !InterpolatePoint( mPanHistory, nextVSyncTime, pastInterpolateTime, mTwoPointPastInterpolateTime, - outPoint, interpolatedAcceleration, outputTimeGranularity, false ) ) + outPoint, interpolatedAcceleration, static_cast( outputTimeGranularity ), false ) ) // truncated { if( justStarted ) { @@ -1232,7 +1233,7 @@ bool PanGesture::NewAlgorithm( unsigned int lastVSyncTime, unsigned int nextVSyn // Perform Multi-tap Smoothing. RelativeVectors blank; InterpolatePoint( mPredictionHistory, nextVSyncTime, nextVSyncTime, mMultiTapSmoothingRange, - targetPoint, blank, outputTimeGranularity, true ); + targetPoint, blank, static_cast( outputTimeGranularity ), true ); // truncated } else { diff --git a/dali/internal/update/manager/free-list.h b/dali/internal/update/manager/free-list.h index f195955..2072912 100644 --- a/dali/internal/update/manager/free-list.h +++ b/dali/internal/update/manager/free-list.h @@ -1,9 +1,8 @@ - #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. @@ -19,7 +18,10 @@ * */ -//INTERNAL INCLUDES +// EXTERNAL INCLUDES +#include // uint32_t + +// INTERNAL INCLUDES #include namespace Dali @@ -58,18 +60,18 @@ struct FreeList * @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( 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; @@ -82,7 +84,7 @@ struct FreeList * * @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; @@ -94,7 +96,7 @@ struct FreeList * @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]; } @@ -105,14 +107,14 @@ struct FreeList * @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 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 }; } diff --git a/dali/internal/update/manager/render-instruction-processor.cpp b/dali/internal/update/manager/render-instruction-processor.cpp index bdcbf46..d1c332c 100644 --- a/dali/internal/update/manager/render-instruction-processor.cpp +++ b/dali/internal/update/manager/render-instruction-processor.cpp @@ -232,12 +232,11 @@ inline void AddRenderersToRenderList( BufferIndex updateBufferIndex, { 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, @@ -258,7 +257,7 @@ inline bool TryReuseCachedRenderers( Layer& layer, RenderableContainer& renderables ) { bool retValue = false; - size_t renderableCount = renderables.Size(); + uint32_t renderableCount = static_cast( renderables.Size() ); // Check that the cached list originates from this layer and that the counts match if( ( renderList.GetSourceLayer() == &layer )&& ( renderList.GetCachedItemCount() == renderableCount ) ) @@ -268,11 +267,11 @@ inline bool TryReuseCachedRenderers( Layer& layer, // 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( &renderer ); + checkSumOld += reinterpret_cast( &renderList.GetRenderer( index ) ); } if( checkSumNew == checkSumOld ) { @@ -318,9 +317,9 @@ RenderInstructionProcessor::~RenderInstructionProcessor() inline void RenderInstructionProcessor::SortRenderItems( BufferIndex bufferIndex, RenderList& renderList, Layer& layer, bool respectClippingOrder ) { - const size_t renderableCount = renderList.Count(); + const uint32_t renderableCount = static_cast( renderList.Count() ); // Reserve space if needed. - const unsigned int oldcapacity = mSortingHelper.size(); + const uint32_t oldcapacity = static_cast( mSortingHelper.size() ); if( oldcapacity < renderableCount ) { mSortingHelper.reserve( renderableCount ); @@ -339,7 +338,7 @@ inline void RenderInstructionProcessor::SortRenderItems( BufferIndex bufferIndex // 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 ); @@ -352,7 +351,7 @@ inline void RenderInstructionProcessor::SortRenderItems( BufferIndex bufferIndex 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( item.mDepthIndex ); // Keep the renderitem pointer in the helper so we can quickly reorder items after sort. mSortingHelper[ index ].renderItem = &item; @@ -361,7 +360,7 @@ inline void RenderInstructionProcessor::SortRenderItems( BufferIndex bufferIndex 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 ); @@ -371,7 +370,7 @@ inline void RenderInstructionProcessor::SortRenderItems( BufferIndex bufferIndex mSortingHelper[ index ].textureSet = item.mTextureSet; - mSortingHelper[ index ].zValue = (*sortFunction)( item.mModelViewMatrix.GetTranslation3() ) - item.mDepthIndex; + mSortingHelper[ index ].zValue = (*sortFunction)( item.mModelViewMatrix.GetTranslation3() ) - static_cast( item.mDepthIndex ); // Keep the RenderItem pointer in the helper so we can quickly reorder items after sort. mSortingHelper[ index ].renderItem = &item; @@ -389,7 +388,7 @@ inline void RenderInstructionProcessor::SortRenderItems( BufferIndex bufferIndex // 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); diff --git a/dali/internal/update/manager/render-task-processor.cpp b/dali/internal/update/manager/render-task-processor.cpp index 31422ca..938cd7d 100644 --- a/dali/internal/update/manager/render-task-processor.cpp +++ b/dali/internal/update/manager/render-task-processor.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -137,7 +137,7 @@ void AddRenderablesForTask( BufferIndex updateBufferIndex, 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(); @@ -164,7 +164,7 @@ void AddRenderablesForTask( BufferIndex updateBufferIndex, // 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 ); @@ -252,13 +252,13 @@ void ProcessTasks( BufferIndex updateBufferIndex, 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, @@ -282,7 +282,8 @@ void ProcessTasks( BufferIndex 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; diff --git a/dali/internal/update/manager/transform-manager-property.h b/dali/internal/update/manager/transform-manager-property.h index f64d65e..800a65a 100644 --- a/dali/internal/update/manager/transform-manager-property.h +++ b/dali/internal/update/manager/transform-manager-property.h @@ -2,7 +2,7 @@ #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. @@ -47,12 +47,12 @@ struct TransformManagerPropertyHandler : public AnimatablePropertyBase /** * @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() @@ -63,7 +63,7 @@ struct TransformManagerPropertyHandler : public AnimatablePropertyBase * 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 @@ -78,7 +78,7 @@ struct TransformManagerPropertyHandler : public AnimatablePropertyBase * @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() @@ -90,7 +90,7 @@ struct TransformManagerPropertyHandler : public AnimatablePropertyBase * @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() @@ -163,12 +163,12 @@ struct TransformManagerPropertyVector3 : public TransformManagerPropertyHandler< return Dali::PropertyTypes::Get(); } - 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 ); } @@ -178,7 +178,7 @@ struct TransformManagerPropertyVector3 : public TransformManagerPropertyHandler< return Get(bufferIndex); } - const float& GetFloatComponent( unsigned int component ) + const float& GetFloatComponent( uint32_t component ) { return mTxManager->GetVector3PropertyComponentValue( mId, mProperty, component ); } @@ -188,12 +188,12 @@ struct TransformManagerPropertyVector3 : public TransformManagerPropertyHandler< 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); } @@ -218,12 +218,12 @@ struct TransformManagerPropertyVector3 : public TransformManagerPropertyHandler< 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); } @@ -254,17 +254,17 @@ public: return Dali::PropertyTypes::Get(); } - 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]; } @@ -392,7 +392,7 @@ public: /** * @copydoc Dali::SceneGraph::PropertyInterface::Get() */ - Vector3& Get(size_t bufferIndex) + Vector3& Get( BufferIndex bufferIndex ) { ComputeTransformComponent(); return mValue; @@ -401,7 +401,7 @@ public: /** * @copydoc Dali::SceneGraph::PropertyInterface::Get() */ - const Vector3& Get(size_t bufferIndex) const + const Vector3& Get( BufferIndex bufferIndex ) const { ComputeTransformComponent(); return mValue; @@ -412,7 +412,7 @@ public: * @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; @@ -545,7 +545,7 @@ public: /** * @copydoc Dali::SceneGraph::PropertyInterface::Get() */ - Quaternion& Get(size_t bufferIndex) + Quaternion& Get( BufferIndex bufferIndex ) { ComputeTransformComponent(); return mValue; @@ -554,7 +554,7 @@ public: /** * @copydoc Dali::SceneGraph::PropertyInterface::Get() */ - const Quaternion& Get(size_t bufferIndex) const + const Quaternion& Get( BufferIndex bufferIndex ) const { ComputeTransformComponent(); return mValue; @@ -565,7 +565,7 @@ public: * @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; @@ -690,7 +690,7 @@ public: /** * @copydoc Dali::SceneGraph::PropertyInterface::Get() */ - Matrix& Get(size_t bufferIndex) + Matrix& Get( BufferIndex bufferIndex ) { DALI_ASSERT_ALWAYS( mTxManager != 0 ); return mTxManager->GetWorldMatrix(mId); @@ -699,9 +699,9 @@ public: /** * @copydoc Dali::SceneGraph::PropertyInterface::Get() */ - const Matrix& Get(size_t bufferIndex) const + const Matrix& Get( BufferIndex bufferIndex ) const { - return GetMatrix(bufferIndex); + return GetMatrix( bufferIndex ); } /** @@ -709,9 +709,9 @@ public: * @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 ) diff --git a/dali/internal/update/manager/transform-manager.cpp b/dali/internal/update/manager/transform-manager.cpp index b8626c7..c2cc4bb 100644 --- a/dali/internal/update/manager/transform-manager.cpp +++ b/dali/internal/update/manager/transform-manager.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -133,7 +133,7 @@ void TransformManager::RemoveTransform(TransformId id) { //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]; @@ -158,7 +158,7 @@ void TransformManager::RemoveTransform(TransformId id) 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; @@ -176,7 +176,7 @@ Matrix& TransformManager::GetWorldMatrix( TransformId id ) void TransformManager::SetInheritPosition( TransformId id, bool inherit ) { - unsigned int index = mIds[id]; + TransformId index = mIds[id]; if( inherit ) { mInheritanceMode[ index ] |= INHERIT_POSITION; @@ -191,7 +191,7 @@ void TransformManager::SetInheritPosition( TransformId id, bool inherit ) void TransformManager::SetInheritScale( TransformId id, bool inherit ) { - unsigned int index = mIds[id]; + TransformId index = mIds[id]; if( inherit ) { mInheritanceMode[ index ] |= INHERIT_SCALE; @@ -206,7 +206,7 @@ void TransformManager::SetInheritScale( TransformId id, bool inherit ) void TransformManager::SetInheritOrientation( TransformId id, bool inherit ) { - unsigned int index = mIds[id]; + TransformId index = mIds[id]; if( inherit ) { mInheritanceMode[ index ] |= INHERIT_ORIENTATION; @@ -248,7 +248,7 @@ void TransformManager::Update() { 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]) @@ -350,7 +350,7 @@ void TransformManager::ReorderComponents() mOrderedComponents.Resize(mComponentCount); TransformId parentId; - for( size_t i(0); i 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 diff --git a/dali/internal/update/manager/update-manager.cpp b/dali/internal/update/manager/update-manager.cpp index ff35064..7574d32 100644 --- a/dali/internal/update/manager/update-manager.cpp +++ b/dali/internal/update/manager/update-manager.cpp @@ -67,7 +67,7 @@ #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 )\ @@ -318,7 +318,7 @@ struct UpdateManager::Impl 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 @@ -556,7 +556,7 @@ void UpdateManager::SetShaderProgram( Shader* shader, 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 ); @@ -625,7 +625,7 @@ RenderTaskList* UpdateManager::GetRenderTaskList( bool systemLevel ) } } -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 ); } @@ -671,7 +671,7 @@ void UpdateManager::ResetProperties( BufferIndex bufferIndex ) } } -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 ); @@ -800,13 +800,12 @@ void UpdateManager::ForwardCompiledShadersToEventThread() 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 ); } } @@ -833,11 +832,11 @@ void UpdateManager::UpdateNodes( BufferIndex 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(); @@ -883,14 +882,14 @@ unsigned int UpdateManager::Update( float elapsedSeconds, ConstrainCustomObjects( bufferIndex ); //Clear the lists of renderers from the previous update - for( size_t i(0); isortedLayers.size(); ++i ) + for( auto&& layer : mImpl->sortedLayers ) { - mImpl->sortedLayers[i]->ClearRenderables(); + layer->ClearRenderables(); } - for( size_t i(0); isystemLevelSortedLayers.size(); ++i ) + for( auto&& layer : mImpl->systemLevelSortedLayers ) { - mImpl->systemLevelSortedLayers[i]->ClearRenderables(); + layer->ClearRenderables(); } //Update node hierarchy, apply constraints and perform sorting / culling. @@ -926,8 +925,7 @@ unsigned int UpdateManager::Update( float elapsedSeconds, //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 ) { @@ -986,7 +984,7 @@ unsigned int UpdateManager::Update( float elapsedSeconds, 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(); @@ -997,7 +995,7 @@ unsigned int UpdateManager::Update( float elapsedSeconds, 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 ) @@ -1005,7 +1003,7 @@ unsigned int UpdateManager::KeepUpdatingCheck( float elapsedSeconds ) const 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. @@ -1039,20 +1037,20 @@ void UpdateManager::SetBackgroundColor( const Vector4& color ) 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& rect ) +void UpdateManager::SetDefaultSurfaceRect( const Rect& rect ) { mImpl->surfaceRectChanged = true; - typedef MessageValue1< RenderManager, Rect > DerivedType; + typedef MessageValue1< RenderManager, Rect > 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 ); @@ -1120,7 +1118,7 @@ void UpdateManager::AddSampler( OwnerPointer< Render::Sampler >& sampler ) 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 ); @@ -1131,29 +1129,29 @@ void UpdateManager::RemoveSampler( Render::Sampler* 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 ); @@ -1165,7 +1163,7 @@ void UpdateManager::AddPropertyBuffer( OwnerPointer< Render::PropertyBuffer >& p 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 ); @@ -1176,7 +1174,7 @@ void UpdateManager::RemovePropertyBuffer( Render::PropertyBuffer* 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 ); @@ -1188,19 +1186,19 @@ void UpdateManager::SetPropertyBufferFormat( Render::PropertyBuffer* propertyBuf 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 >& data, size_t size ) +void UpdateManager::SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector >& data, uint32_t size ) { // Message has ownership of format while in transit from update -> render - typedef MessageValue3< RenderManager, Render::PropertyBuffer*, OwnerPointer< Dali::Vector >, size_t > DerivedType; + typedef MessageValue3< RenderManager, Render::PropertyBuffer*, OwnerPointer< Dali::Vector >, 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 ); @@ -1212,7 +1210,7 @@ void UpdateManager::AddGeometry( OwnerPointer< Render::Geometry >& geometry ) 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 ); @@ -1223,29 +1221,29 @@ void UpdateManager::RemoveGeometry( Render::Geometry* 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& indices ) +void UpdateManager::SetIndexBuffer( Render::Geometry* geometry, Dali::Vector& 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 ); @@ -1256,7 +1254,7 @@ void UpdateManager::RemoveVertexBuffer( Render::Geometry* geometry, Render::Prop 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 ); @@ -1267,7 +1265,7 @@ void UpdateManager::AttachVertexBuffer( Render::Geometry* geometry, Render::Prop 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 ); @@ -1279,7 +1277,7 @@ void UpdateManager::AddTexture( OwnerPointer< Render::Texture >& texture ) 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 ); @@ -1290,7 +1288,7 @@ void UpdateManager::RemoveTexture( Render::Texture* 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 ); @@ -1301,7 +1299,7 @@ void UpdateManager::UploadTexture( Render::Texture* texture, PixelDataPtr pixelD 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 ); @@ -1312,7 +1310,7 @@ void UpdateManager::GenerateMipmaps( Render::Texture* 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::GenerateMipmaps, texture ); @@ -1323,7 +1321,7 @@ void UpdateManager::AddFrameBuffer( Render::FrameBuffer* 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::AddFrameBuffer, frameBuffer ); @@ -1334,18 +1332,18 @@ void UpdateManager::RemoveFrameBuffer( Render::FrameBuffer* 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 ); diff --git a/dali/internal/update/manager/update-manager.h b/dali/internal/update/manager/update-manager.h index d87d280..401eb8b 100644 --- a/dali/internal/update/manager/update-manager.h +++ b/dali/internal/update/manager/update-manager.h @@ -371,7 +371,7 @@ public: * @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. @@ -417,7 +417,7 @@ public: * @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 @@ -426,7 +426,7 @@ public: * @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 @@ -458,7 +458,7 @@ public: * @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 >& data, size_t size ); + void SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector >& data, uint32_t size ); /** * Adds a geometry to the RenderManager @@ -480,14 +480,14 @@ public: * @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& indices ); + void SetIndexBuffer( Render::Geometry* geometry, Dali::Vector& indices ); /** * Adds a vertex buffer to a geometry @@ -552,7 +552,7 @@ public: * @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: @@ -565,11 +565,11 @@ 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. @@ -638,7 +638,7 @@ private: * @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 @@ -653,7 +653,7 @@ private: * @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 @@ -721,7 +721,7 @@ inline void InstallRootMessage( UpdateManager& manager, OwnerPointer& roo typedef MessageValue2< UpdateManager, OwnerPointer, 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 ); @@ -733,7 +733,7 @@ inline void AddNodeMessage( UpdateManager& manager, OwnerPointer& node ) typedef MessageValue1< UpdateManager, OwnerPointer > 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 ); @@ -748,7 +748,7 @@ inline void ConnectNodeMessage( UpdateManager& manager, const Node& constParent, 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 ); @@ -762,7 +762,7 @@ inline void DisconnectNodeMessage( UpdateManager& manager, const Node& constNode 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 ); @@ -776,7 +776,7 @@ inline void DestroyNodeMessage( UpdateManager& manager, const Node& constNode ) 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 ); @@ -788,7 +788,7 @@ inline void AddCameraMessage( UpdateManager& manager, OwnerPointer< Camera >& ca 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 ); @@ -799,7 +799,7 @@ inline void RemoveCameraMessage( UpdateManager& manager, const Camera* 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 ); @@ -811,7 +811,7 @@ inline void AddObjectMessage( UpdateManager& manager, OwnerPointer > 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 ); @@ -822,7 +822,7 @@ inline void RemoveObjectMessage( UpdateManager& manager, PropertyOwner* 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 ); @@ -833,7 +833,7 @@ inline void AddAnimationMessage( UpdateManager& manager, OwnerPointer< SceneGrap 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 ); @@ -847,7 +847,7 @@ inline void StopAnimationMessage( UpdateManager& manager, const Animation& const 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 ); @@ -861,7 +861,7 @@ inline void RemoveAnimationMessage( UpdateManager& manager, const Animation& con 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 ); @@ -873,7 +873,7 @@ inline void AddPropertyNotificationMessage( UpdateManager& manager, OwnerPointer 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 ); @@ -887,7 +887,7 @@ inline void RemovePropertyNotificationMessage( UpdateManager& manager, const Pro 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 ); @@ -903,7 +903,7 @@ inline void PropertyNotificationSetNotifyModeMessage( UpdateManager& manager, 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 ); @@ -915,7 +915,7 @@ inline void AddShaderMessage( UpdateManager& manager, OwnerPointer< Shader >& sh 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 ); @@ -927,7 +927,7 @@ inline void RemoveShaderMessage( UpdateManager& manager, Shader& 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 ); @@ -941,7 +941,7 @@ inline void SetShaderProgramMessage( UpdateManager& manager, 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 ); @@ -952,18 +952,18 @@ inline void SetBackgroundColorMessage( UpdateManager& manager, const Vector4& co 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& rect ) +inline void SetDefaultSurfaceRectMessage( UpdateManager& manager, const Rect& rect ) { - typedef MessageValue1< UpdateManager, Rect > LocalType; + typedef MessageValue1< UpdateManager, Rect > 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 ); @@ -974,7 +974,7 @@ inline void KeepRenderingMessage( UpdateManager& manager, float durationSeconds 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 ); @@ -985,7 +985,7 @@ inline void SetRenderingBehaviorMessage( UpdateManager& manager, DevelStage::Ren 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 ); @@ -1002,7 +1002,7 @@ inline void SetLayerDepthsMessage( UpdateManager& manager, const std::vector< La 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 ); @@ -1013,7 +1013,7 @@ inline void AddRendererMessage( UpdateManager& manager, OwnerPointer< Renderer > 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 ); } @@ -1023,7 +1023,7 @@ inline void RemoveRendererMessage( UpdateManager& manager, Renderer& 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 ); } @@ -1034,7 +1034,7 @@ inline void AddTextureSetMessage( UpdateManager& manager, OwnerPointer< TextureS 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 ); @@ -1046,7 +1046,7 @@ inline void RemoveTextureSetMessage( UpdateManager& manager, TextureSet& texture 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 ); @@ -1058,7 +1058,7 @@ inline void AddSamplerMessage( UpdateManager& manager, OwnerPointer< Render::Sam 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 ); @@ -1069,29 +1069,29 @@ inline void RemoveSamplerMessage( UpdateManager& manager, Render::Sampler& sampl 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 ); @@ -1103,7 +1103,7 @@ inline void AddPropertyBuffer( UpdateManager& manager, OwnerPointer< Render::Pro 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 ); @@ -1114,7 +1114,7 @@ inline void RemovePropertyBuffer( UpdateManager& manager, Render::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 ); @@ -1126,19 +1126,19 @@ inline void SetPropertyBufferFormat( UpdateManager& manager, Render::PropertyBuf 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 >& data, size_t size ) +inline void SetPropertyBufferData( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, OwnerPointer< Vector >& data, uint32_t size ) { // Message has ownership of PropertyBuffer data while in transit from event -> update - typedef MessageValue3< UpdateManager, Render::PropertyBuffer*, OwnerPointer< Vector >, size_t > LocalType; + typedef MessageValue3< UpdateManager, Render::PropertyBuffer*, OwnerPointer< Vector >, 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 ); @@ -1150,7 +1150,7 @@ inline void AddGeometry( UpdateManager& manager, OwnerPointer< Render::Geometry 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 ); @@ -1161,7 +1161,7 @@ inline void RemoveGeometry( UpdateManager& manager, Render::Geometry& 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 ); @@ -1172,7 +1172,7 @@ inline void AttachVertexBufferMessage( UpdateManager& manager, Render::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(&vertexBuffer) ); @@ -1183,7 +1183,7 @@ inline void RemoveVertexBufferMessage( UpdateManager& manager, Render::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::RemoveVertexBuffer, &geometry, const_cast(&vertexBuffer) ); @@ -1198,7 +1198,7 @@ public: /** * Constructor which does a Vector::Swap() */ - IndexBufferMessage( T* manager, Render::Geometry* geometry, Dali::Vector& indices ) + IndexBufferMessage( T* manager, Render::Geometry* geometry, Dali::Vector& indices ) : MessageBase(), mManager( manager ), mRenderGeometry( geometry ) @@ -1226,26 +1226,26 @@ private: T* mManager; Render::Geometry* mRenderGeometry; - Dali::Vector mIndices; + Dali::Vector mIndices; }; -inline void SetIndexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, Dali::Vector& indices ) +inline void SetIndexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, Dali::Vector& 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 ); @@ -1257,7 +1257,7 @@ inline void AddTexture( UpdateManager& manager, OwnerPointer< Render::Texture >& 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 ); @@ -1268,7 +1268,7 @@ inline void RemoveTexture( UpdateManager& manager, Render::Texture& 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 ); @@ -1279,7 +1279,7 @@ inline void UploadTextureMessage( UpdateManager& manager, Render::Texture& textu 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 ); @@ -1290,7 +1290,7 @@ inline void GenerateMipmapsMessage( UpdateManager& manager, Render::Texture& tex 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 ); @@ -1302,7 +1302,7 @@ inline void AddFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBu 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 ); @@ -1313,18 +1313,18 @@ inline void RemoveFrameBuffer( UpdateManager& manager, Render::FrameBuffer& fram 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 ); @@ -1335,7 +1335,7 @@ inline void SetDepthIndicesMessage( UpdateManager& manager, OwnerPointer< NodeDe 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 ); @@ -1346,7 +1346,7 @@ inline void AddResetterMessage( UpdateManager& manager, OwnerPointer > 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 ); @@ -1357,7 +1357,7 @@ inline void AddFrameCallbackMessage( UpdateManager& manager, FrameCallbackInterf 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 ); @@ -1368,7 +1368,7 @@ inline void RemoveFrameCallbackMessage( UpdateManager& manager, FrameCallbackInt 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 ); diff --git a/dali/internal/update/nodes/node-messages.h b/dali/internal/update/nodes/node-messages.h index af3cf6d..df7e628 100644 --- a/dali/internal/update/nodes/node-messages.h +++ b/dali/internal/update/nodes/node-messages.h @@ -2,7 +2,7 @@ #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. @@ -87,7 +87,7 @@ public: 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 ); @@ -168,7 +168,7 @@ public: 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 ); @@ -247,7 +247,7 @@ public: 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 ); @@ -326,7 +326,7 @@ public: 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 ); diff --git a/dali/internal/update/nodes/node.cpp b/dali/internal/update/nodes/node.cpp index eaef08e..f5259db 100755 --- a/dali/internal/update/nodes/node.cpp +++ b/dali/internal/update/nodes/node.cpp @@ -190,7 +190,7 @@ void Node::PrepareRender( BufferIndex bufferIndex ) CollectedUniformMap& localMap = mCollectedUniformMap[ bufferIndex ]; localMap.Resize(0); - for( uint32_t i = 0, count=mUniformMaps.Count(); i 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 ); @@ -273,7 +273,7 @@ inline void SetClippingMessage( EventThreadServices& eventThreadServices, const 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 ); @@ -289,7 +289,7 @@ inline void SetClippingBoxMessage( EventThreadServices& eventThreadServices, con 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 ); @@ -307,7 +307,7 @@ inline void SetBehaviorMessage( EventThreadServices& eventThreadServices, 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 ); @@ -326,7 +326,7 @@ inline void SetDepthTestDisabledMessage( EventThreadServices& eventThreadService 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 ); diff --git a/dali/internal/update/queue/update-message-queue.cpp b/dali/internal/update/queue/update-message-queue.cpp index 330234d..4c4221f 100644 --- a/dali/internal/update/queue/update-message-queue.cpp +++ b/dali/internal/update/queue/update-message-queue.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -153,7 +153,7 @@ void MessageQueue::EventProcessingStarted() } // 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 ); diff --git a/dali/internal/update/queue/update-message-queue.h b/dali/internal/update/queue/update-message-queue.h index e03d3f2..a8729f4 100644 --- a/dali/internal/update/queue/update-message-queue.h +++ b/dali/internal/update/queue/update-message-queue.h @@ -2,7 +2,7 @@ #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. @@ -74,7 +74,7 @@ public: * @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 diff --git a/dali/internal/update/render-tasks/scene-graph-camera.cpp b/dali/internal/update/render-tasks/scene-graph-camera.cpp index ad2df4b..d59ec48 100644 --- a/dali/internal/update/render-tasks/scene-graph-camera.cpp +++ b/dali/internal/update/render-tasks/scene-graph-camera.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -29,8 +29,8 @@ 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 @@ -45,6 +45,12 @@ namespace SceneGraph 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; @@ -59,7 +65,6 @@ void LookAt(Matrix& result, const Vector3& eye, const Vector3& target, const Vec 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; @@ -139,7 +144,7 @@ void Orthographic(Matrix& result, float left, float right, float bottom, float t 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); @@ -307,8 +312,8 @@ void Camera::Update( BufferIndex updateBufferIndex ) } // 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 ) @@ -334,9 +339,9 @@ bool Camera::ViewMatrixUpdated() 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 ) @@ -424,7 +429,7 @@ void Camera::UpdateFrustum( BufferIndex updateBufferIndex, bool normalize ) 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 ]; @@ -437,7 +442,7 @@ void Camera::UpdateFrustum( BufferIndex updateBufferIndex, bool normalize ) } 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) ); } @@ -473,9 +478,9 @@ bool Camera::CheckAABBInFrustum( BufferIndex bufferIndex, const Vector3& origin, 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 ) { diff --git a/dali/internal/update/render-tasks/scene-graph-camera.h b/dali/internal/update/render-tasks/scene-graph-camera.h index 44b7518..2cea7f6 100644 --- a/dali/internal/update/render-tasks/scene-graph-camera.h +++ b/dali/internal/update/render-tasks/scene-graph-camera.h @@ -2,7 +2,7 @@ #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. @@ -251,14 +251,14 @@ private: * @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: @@ -270,8 +270,8 @@ 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 @@ -305,7 +305,7 @@ inline void SetTypeMessage( EventThreadServices& eventThreadServices, const Came 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 ); @@ -316,7 +316,7 @@ inline void SetProjectionModeMessage( EventThreadServices& eventThreadServices, 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 ); @@ -327,7 +327,7 @@ inline void SetFieldOfViewMessage( EventThreadServices& eventThreadServices, con 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 ); @@ -338,7 +338,7 @@ inline void SetAspectRatioMessage( EventThreadServices& eventThreadServices, con 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 ); @@ -349,7 +349,7 @@ inline void SetStereoBiasMessage( EventThreadServices& eventThreadServices, cons 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 ); @@ -360,7 +360,7 @@ inline void SetLeftClippingPlaneMessage( EventThreadServices& eventThreadService 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 ); @@ -371,7 +371,7 @@ inline void SetRightClippingPlaneMessage( EventThreadServices& eventThreadServic 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 ); @@ -382,7 +382,7 @@ inline void SetTopClippingPlaneMessage( EventThreadServices& eventThreadServices 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 ); @@ -393,7 +393,7 @@ inline void SetBottomClippingPlaneMessage( EventThreadServices& eventThreadServi 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 ); @@ -404,7 +404,7 @@ inline void SetNearClippingPlaneMessage( EventThreadServices& eventThreadService 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 ); @@ -415,7 +415,7 @@ inline void SetFarClippingPlaneMessage( EventThreadServices& eventThreadServices 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 ); @@ -426,7 +426,7 @@ inline void SetTargetPositionMessage( EventThreadServices& eventThreadServices, 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 ); @@ -437,7 +437,7 @@ inline void SetInvertYAxisMessage( EventThreadServices& eventThreadServices, con 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 ); diff --git a/dali/internal/update/render-tasks/scene-graph-render-task-list.cpp b/dali/internal/update/render-tasks/scene-graph-render-task-list.cpp index 93fec3c..893eb6e 100644 --- a/dali/internal/update/render-tasks/scene-graph-render-task-list.cpp +++ b/dali/internal/update/render-tasks/scene-graph-render-task-list.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -64,6 +64,11 @@ void RenderTaskList::RemoveTask( RenderTask* task ) } } +uint32_t RenderTaskList::GetTaskCount() +{ + return static_cast( mRenderTasks.Count() ); +} + RenderTaskList::RenderTaskContainer& RenderTaskList::GetTasks() { return mRenderTasks; diff --git a/dali/internal/update/render-tasks/scene-graph-render-task-list.h b/dali/internal/update/render-tasks/scene-graph-render-task-list.h index 6f1c320..ce8301f 100644 --- a/dali/internal/update/render-tasks/scene-graph-render-task-list.h +++ b/dali/internal/update/render-tasks/scene-graph-render-task-list.h @@ -2,7 +2,7 @@ #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. @@ -69,6 +69,12 @@ public: void RemoveTask( RenderTask* task ); /** + * Retrieve the count of RenderTasks. + * @return The count. + */ + uint32_t GetTaskCount(); + + /** * Retrieve the container of RenderTasks. * @return The container. */ @@ -115,7 +121,7 @@ inline void AddTaskMessage( EventThreadServices& eventThreadServices, RenderTask 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 ); @@ -129,7 +135,7 @@ inline void RemoveTaskMessage( EventThreadServices& eventThreadServices, RenderT 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 ); diff --git a/dali/internal/update/render-tasks/scene-graph-render-task.cpp b/dali/internal/update/render-tasks/scene-graph-render-task.cpp index d4305b9..dfc59ac 100644 --- a/dali/internal/update/render-tasks/scene-graph-render-task.cpp +++ b/dali/internal/update/render-tasks/scene-graph-render-task.cpp @@ -128,10 +128,10 @@ bool RenderTask::QueryViewport( BufferIndex bufferIndex, Viewport& viewport ) co 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( mViewportPosition[bufferIndex].x ); // truncated + viewport.y = static_cast( mViewportPosition[bufferIndex].y ); // truncated + viewport.width = static_cast( mViewportSize[bufferIndex].width ); // truncated + viewport.height = static_cast( mViewportSize[bufferIndex].height ); // truncated return true; } @@ -171,7 +171,7 @@ bool RenderTask::GetCullMode() const 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); @@ -191,7 +191,7 @@ void RenderTask::SetRefreshRate( unsigned int refreshRate ) mFrameCounter = 0u; } -unsigned int RenderTask::GetRefreshRate() const +uint32_t RenderTask::GetRefreshRate() const { return mRefreshRate; } @@ -336,7 +336,7 @@ bool RenderTask::HasRendered() return notify; } -unsigned int RenderTask::GetRenderedOnceCounter() const +uint32_t RenderTask::GetRenderedOnceCounter() const { return mRenderedOnceCounter; } diff --git a/dali/internal/update/render-tasks/scene-graph-render-task.h b/dali/internal/update/render-tasks/scene-graph-render-task.h index b66077e..b8fc825 100644 --- a/dali/internal/update/render-tasks/scene-graph-render-task.h +++ b/dali/internal/update/render-tasks/scene-graph-render-task.h @@ -232,13 +232,13 @@ public: * 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. @@ -277,7 +277,7 @@ public: /** * @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. @@ -360,10 +360,10 @@ private: 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 }; @@ -374,7 +374,7 @@ inline void SetFrameBufferMessage( EventThreadServices& eventThreadServices, Ren 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 ); @@ -385,7 +385,7 @@ inline void SetClearColorMessage( EventThreadServices& eventThreadServices, Rend 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 ); @@ -396,7 +396,7 @@ inline void BakeClearColorMessage( EventThreadServices& eventThreadServices, con 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 ); @@ -407,7 +407,7 @@ inline void SetClearEnabledMessage( EventThreadServices& eventThreadServices, Re 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 ); @@ -418,18 +418,18 @@ inline void SetCullModeMessage( EventThreadServices& eventThreadServices, Render 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 ); @@ -443,7 +443,7 @@ inline void SetSourceNodeMessage( EventThreadServices& eventThreadServices, Rend 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 ); @@ -456,7 +456,7 @@ inline void SetCameraMessage( EventThreadServices& eventThreadServices, RenderTa 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 ); @@ -467,7 +467,7 @@ inline void SetExclusiveMessage( EventThreadServices& eventThreadServices, Rende 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 ); @@ -478,7 +478,7 @@ inline void SetSyncRequiredMessage(EventThreadServices& eventThreadServices, Ren 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 ); @@ -489,7 +489,7 @@ inline void BakeViewportPositionMessage( EventThreadServices& eventThreadService 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 ); @@ -500,7 +500,7 @@ inline void BakeViewportSizeMessage( EventThreadServices& eventThreadServices, c 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 ); diff --git a/dali/internal/update/rendering/scene-graph-renderer.cpp b/dali/internal/update/rendering/scene-graph-renderer.cpp index 0d0f7fb..9b9d8d7 100644 --- a/dali/internal/update/rendering/scene-graph-renderer.cpp +++ b/dali/internal/update/rendering/scene-graph-renderer.cpp @@ -30,30 +30,36 @@ #include #include +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 gRendererMemoryPool; +MemoryPoolObjectAllocator 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(); iuniformNameHash == nameHash ) { if( map->uniformName == uniformMap[i].uniformName ) @@ -74,12 +80,12 @@ void AddMappings( Dali::Internal::SceneGraph::CollectedUniformMap& localMap, con { 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 ); } } @@ -111,13 +117,6 @@ enum Flags } // Anonymous namespace -namespace Dali -{ -namespace Internal -{ -namespace SceneGraph -{ - Renderer* Renderer::New() { return new ( gRendererMemoryPool.AllocateRawThreadSafe() ) Renderer(); @@ -202,7 +201,7 @@ void Renderer::PrepareRender( BufferIndex updateBufferIndex ) 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; @@ -218,126 +217,126 @@ void Renderer::PrepareRender( BufferIndex updateBufferIndex ) 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 ); } @@ -418,7 +417,7 @@ BlendMode::Type Renderer::GetBlendMode() const return mBlendMode; } -void Renderer::SetBlendingOptions( unsigned int options ) +void Renderer::SetBlendingOptions( uint32_t options ) { if( mBlendBitmask != options) { @@ -427,7 +426,7 @@ void Renderer::SetBlendingOptions( unsigned int options ) } } -unsigned int Renderer::GetBlendingOptions() const +uint32_t Renderer::GetBlendingOptions() const { return mBlendBitmask; } @@ -462,24 +461,24 @@ Vector4 Renderer::GetBlendColor() const 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; } @@ -626,10 +625,10 @@ void Renderer::UpdateTextureSet() { 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); imTextures[i] = mTextureSet->GetTexture(i); mRenderDataProvider->mSamplers[i] = mTextureSet->GetTextureSampler(i); diff --git a/dali/internal/update/rendering/scene-graph-renderer.h b/dali/internal/update/rendering/scene-graph-renderer.h index 5865014..1449f73 100755 --- a/dali/internal/update/rendering/scene-graph-renderer.h +++ b/dali/internal/update/rendering/scene-graph-renderer.h @@ -162,13 +162,13 @@ public: * 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 @@ -186,25 +186,25 @@ public: * 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 @@ -445,11 +445,11 @@ private: 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 @@ -474,7 +474,7 @@ inline void SetTexturesMessage( EventThreadServices& eventThreadServices, const 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) ); @@ -485,7 +485,7 @@ inline void SetGeometryMessage( EventThreadServices& eventThreadServices, const 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(&geometry) ); @@ -496,7 +496,7 @@ inline void SetShaderMessage( EventThreadServices& eventThreadServices, const Re 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 ); @@ -507,7 +507,7 @@ inline void SetDepthIndexMessage( EventThreadServices& eventThreadServices, cons 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 ); @@ -518,7 +518,7 @@ inline void SetFaceCullingModeMessage( EventThreadServices& eventThreadServices, 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 ); } @@ -528,17 +528,17 @@ inline void SetBlendModeMessage( EventThreadServices& eventThreadServices, const 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 ); } @@ -548,27 +548,27 @@ inline void SetBlendColorMessage( EventThreadServices& eventThreadServices, cons 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 ); } @@ -578,7 +578,7 @@ inline void SetEnablePreMultipliedAlphaMessage( EventThreadServices& eventThread 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 ); } @@ -588,7 +588,7 @@ inline void SetDepthWriteModeMessage( EventThreadServices& eventThreadServices, 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 ); } @@ -598,7 +598,7 @@ inline void SetDepthTestModeMessage( EventThreadServices& eventThreadServices, c 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 ); } @@ -608,7 +608,7 @@ inline void SetDepthFunctionMessage( EventThreadServices& eventThreadServices, c 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 ); } @@ -618,7 +618,7 @@ inline void SetRenderModeMessage( EventThreadServices& eventThreadServices, cons 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 ); } @@ -628,7 +628,7 @@ inline void SetStencilFunctionMessage( EventThreadServices& eventThreadServices, 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 ); } @@ -638,7 +638,7 @@ inline void SetStencilFunctionMaskMessage( EventThreadServices& eventThreadServi 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 ); } @@ -648,7 +648,7 @@ inline void SetStencilFunctionReferenceMessage( EventThreadServices& eventThread 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 ); } @@ -658,7 +658,7 @@ inline void SetStencilMaskMessage( EventThreadServices& eventThreadServices, con 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 ); } @@ -668,7 +668,7 @@ inline void SetStencilOperationOnFailMessage( EventThreadServices& eventThreadSe 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 ); } @@ -678,7 +678,7 @@ inline void SetStencilOperationOnZFailMessage( EventThreadServices& eventThreadS 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 ); } @@ -688,7 +688,7 @@ inline void SetStencilOperationOnZPassMessage( EventThreadServices& eventThreadS 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 ); } @@ -698,7 +698,7 @@ inline void BakeOpacityMessage( EventThreadServices& eventThreadServices, const 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 ); } diff --git a/dali/internal/update/rendering/scene-graph-texture-set.cpp b/dali/internal/update/rendering/scene-graph-texture-set.cpp index a5e7df8..3600892 100644 --- a/dali/internal/update/rendering/scene-graph-texture-set.cpp +++ b/dali/internal/update/rendering/scene-graph-texture-set.cpp @@ -51,10 +51,9 @@ TextureSet::TextureSet() TextureSet::~TextureSet() { - size_t rendererCount = mRenderers.Size(); - for( size_t i(0); iTextureSetDeleted(); + renderer->TextureSetDeleted(); } } @@ -63,13 +62,13 @@ void TextureSet::operator delete( void* ptr ) gTextureSetMemoryPool.FreeThreadSafe( static_cast( 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( 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; } @@ -79,9 +78,9 @@ void TextureSet::SetSampler( size_t index, Render::Sampler* sampler ) 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( mTextures.Size() ); if( textureCount < index + 1 ) { mTextures.Resize( index + 1 ); @@ -93,7 +92,7 @@ void TextureSet::SetTexture( size_t index, Render::Texture* texture ) samplerExist = false; } - for( size_t i(textureCount); i<=index; ++i ) + for( uint32_t i(textureCount); i<=index; ++i ) { mTextures[i] = 0; @@ -120,10 +119,9 @@ bool TextureSet::HasAlpha() const void TextureSet::AddObserver( Renderer* renderer ) { - size_t rendererCount( mRenderers.Size() ); - for( size_t i(0); iTextureSetChanged(); + element->TextureSetChanged(); } } diff --git a/dali/internal/update/rendering/scene-graph-texture-set.h b/dali/internal/update/rendering/scene-graph-texture-set.h index fdb52a5..c850b3c 100644 --- a/dali/internal/update/rendering/scene-graph-texture-set.h +++ b/dali/internal/update/rendering/scene-graph-texture-set.h @@ -2,7 +2,7 @@ #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. @@ -47,9 +47,9 @@ public: static TextureSet* New(); /** - * Destructor + * Destructor. Not virtual as not a base class and not inheriting anything */ - virtual ~TextureSet(); + ~TextureSet(); /** * Overriden delete operator @@ -62,14 +62,14 @@ public: * @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 @@ -97,7 +97,7 @@ public: * @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]; } @@ -106,9 +106,9 @@ public: * 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( mTextures.Size() ); } /** @@ -116,7 +116,7 @@ public: * @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]; } @@ -136,29 +136,29 @@ private: 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 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 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 ); diff --git a/dali/public-api/common/dali-vector.cpp b/dali/public-api/common/dali-vector.cpp index 31fad54..bb6014f 100644 --- a/dali/public-api/common/dali-vector.cpp +++ b/dali/public-api/common/dali-vector.cpp @@ -115,13 +115,13 @@ void VectorBase::Swap( VectorBase& vector ) 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 ); @@ -129,14 +129,14 @@ void VectorBase::Erase( char* address, SizeType elementSize ) } } -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 ); @@ -148,7 +148,7 @@ char* VectorBase::Erase( char* first, char* last, SizeType elementSize ) 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 ) ) ) diff --git a/dali/public-api/common/dali-vector.h b/dali/public-api/common/dali-vector.h index 2b7b786..be556ac 100755 --- a/dali/public-api/common/dali-vector.h +++ b/dali/public-api/common/dali-vector.h @@ -182,7 +182,7 @@ protected: // for Derived classes * @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. @@ -194,7 +194,7 @@ protected: // for Derived classes * @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. @@ -206,7 +206,7 @@ protected: // for Derived classes * @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: @@ -321,7 +321,7 @@ protected: // API for deriving classes * @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 ); } @@ -335,7 +335,7 @@ protected: // API for deriving classes * @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 ); } @@ -349,7 +349,7 @@ protected: // API for deriving classes * @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(); @@ -358,13 +358,13 @@ protected: // API for deriving classes if( newCount > Capacity() ) { // Calculate the at offset as the pointer is invalid after the Reserve() call. - std::size_t offset = at - reinterpret_cast( mData ); + std::size_t offset = at - reinterpret_cast( mData ); // need more space Reserve( NextPowerOfTwo( static_cast( 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( mData ) + offset; + at = reinterpret_cast( mData ) + offset; } // set new count first as otherwise the debug assert will hit us SetCount( newCount ); @@ -372,7 +372,7 @@ protected: // API for deriving classes // Move current items to a new position inside the vector. CopyMemory( at + size, at, - ( reinterpret_cast( mData ) + count * elementSize ) - at ); + ( reinterpret_cast( mData ) + count * elementSize ) - at ); // Copy the given items. CopyMemory( at, from, size ); @@ -585,8 +585,8 @@ public: // API { DALI_ASSERT_VECTOR( ( at <= End() ) && ( at >= Begin() ) && "Iterator not inside vector" ); const SizeType size = sizeof( ItemType ); - char* address = const_cast( reinterpret_cast( &element ) ); - VectorAlgorithms::Insert( reinterpret_cast< char* >( at ), + uint8_t* address = const_cast( reinterpret_cast( &element ) ); + VectorAlgorithms::Insert( reinterpret_cast< uint8_t* >( at ), address, address + size, size ); @@ -621,9 +621,9 @@ public: // API return; } - VectorAlgorithms::Insert( reinterpret_cast< char* >( at ), - reinterpret_cast< char* >( from ), - reinterpret_cast< char* >( to ), + VectorAlgorithms::Insert( reinterpret_cast< uint8_t* >( at ), + reinterpret_cast< uint8_t* >( from ), + reinterpret_cast< uint8_t* >( to ), sizeof( ItemType ) ); } @@ -694,7 +694,7 @@ public: // API DALI_ASSERT_VECTOR( (iterator < End()) && (iterator >= Begin()) && "Iterator not inside vector" ); if( iterator < ( End() - 1u ) ) { - VectorAlgorithms::Erase( reinterpret_cast< char* >( iterator ), sizeof( ItemType ) ); + VectorAlgorithms::Erase( reinterpret_cast< uint8_t* >( iterator ), sizeof( ItemType ) ); } else { @@ -735,8 +735,8 @@ public: // API } else { - nextElement = reinterpret_cast( VectorAlgorithms::Erase( reinterpret_cast< char* >( first ), - reinterpret_cast< char* >( last ), + nextElement = reinterpret_cast( VectorAlgorithms::Erase( reinterpret_cast< uint8_t* >( first ), + reinterpret_cast< uint8_t* >( last ), sizeof( ItemType ) ) ); } diff --git a/dali/public-api/object/property-value.cpp b/dali/public-api/object/property-value.cpp index e02e8ce..cd7ae5a 100644 --- a/dali/public-api/object/property-value.cpp +++ b/dali/public-api/object/property-value.cpp @@ -238,8 +238,10 @@ public: // Data private: - Impl( const Impl& ); ///< Undefined - Impl& operator=( const Impl& ); ///< Undefined + // non-copyable + Impl( const Impl& ) = delete; + Impl& operator=( const Impl& ) = delete; + }; Property::Value::Value() @@ -287,7 +289,7 @@ Property::Value::Value( const Matrix& matrixValue ) { } -Property::Value::Value( const Rect& rectValue ) +Property::Value::Value( const Rect& rectValue ) : mImpl( new Impl( rectValue ) ) { } @@ -651,7 +653,7 @@ bool Property::Value::Get( float& floatValue ) const return converted; } -bool Property::Value::Get( int& integerValue ) const +bool Property::Value::Get( int32_t& integerValue ) const { bool converted = false; if( mImpl ) @@ -751,7 +753,7 @@ bool Property::Value::Get( Matrix& matrixValue ) const return converted; } -bool Property::Value::Get( Rect& rectValue ) const +bool Property::Value::Get( Rect& rectValue ) const { bool converted = false; if( mImpl && (mImpl->type == RECTANGLE) ) // type cannot change in mImpl so rect is allocated -- 2.7.4