X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fdevel-api%2Fimages%2Fdistance-field.cpp;h=63a5150b9c0364e6ce6319cd5dbe48f18b73e630;hb=7cf931b2a8ab40cc1f673bc319e4cae5d801ce40;hp=134f9c404a30d5669f60ccdf975cd9a0fb5126c9;hpb=432923e17cb38a99fc012473ef97fa8c4fc36162;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/devel-api/images/distance-field.cpp b/dali/devel-api/images/distance-field.cpp old mode 100644 new mode 100755 index 134f9c4..63a5150 --- a/dali/devel-api/images/distance-field.cpp +++ b/dali/devel-api/images/distance-field.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -84,8 +84,9 @@ const float MAX_DISTANCE( 1e20 ); */ void DistanceTransform( float *source, float* dest, unsigned int length ) { - int parabolas[length]; // Locations of parabolas in lower envelope - float edge[length + 1]; // Locations of boundaries between parabolas + 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 parabolas[0] = 0; @@ -116,7 +117,7 @@ void DistanceTransform( float *source, float* dest, unsigned int length ) { ++rightmost; } - dest[i] = SQUARE( i - parabolas[rightmost] ) + source[parabolas[rightmost]]; + dest[i] = SQUARE( static_cast< int >( i ) - parabolas[rightmost] ) + source[parabolas[rightmost]]; } } @@ -196,8 +197,8 @@ void GenerateDistanceFieldMap(const unsigned char* const imagePixels, const Size { for ( int x = 0; x < paddedWidth; ++x) { - if( y < (int)fieldBorder || y >= (paddedHeight - (int)fieldBorder) || - x < (int)fieldBorder || x >= (paddedWidth - (int)fieldBorder) ) + if( y < static_cast< int >( fieldBorder ) || y >= ( paddedHeight - static_cast< int >( fieldBorder ) ) || + x < static_cast< int >( fieldBorder ) || x >= ( paddedWidth - static_cast< int >( fieldBorder ) ) ) { outside[ y * paddedWidth + x ] = MAX_DISTANCE; inside[ y * paddedWidth + x ] = 0.0f;