Mofidy codes for Dali Windows backend
[platform/core/uifw/dali-core.git] / dali / devel-api / images / distance-field.cpp
old mode 100644 (file)
new mode 100755 (executable)
index bb4224a..63a5150
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 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<int> parabolas(length);    // Locations of parabolas in lower envelope
+  std::vector<float> edge(length + 1);   // Locations of boundaries between parabolas
+
   int rightmost(0);         // Index of rightmost parabola in lower envelope
 
   parabolas[0] = 0;
@@ -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;