Fix Klocwork issues. 61/42961/3
authorVictor Cebollada <v.cebollada@samsung.com>
Tue, 23 Jun 2015 14:37:52 +0000 (15:37 +0100)
committerVíctor Cebollada <v.cebollada@samsung.com>
Mon, 6 Jul 2015 10:41:22 +0000 (03:41 -0700)
Change-Id: I36d4d1df2d384410e26b7d8c588389d2da20765f
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
dali-toolkit/internal/atlas-manager/atlas-manager-impl.cpp
dali-toolkit/internal/text/bidirectional-support.cpp
dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager.h
dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp

index a5f0462bad2c5e686ae73538fd309e32bd3d4269..a3b9e863977f8e2850fc4a1431a2ca2e2447bc4c 100644 (file)
@@ -511,8 +511,10 @@ void AtlasManager::OptimizeMesh( const Toolkit::AtlasManager::Mesh2D& in,
     Toolkit::AtlasManager::Vertex2D v = in.mVertices[ in.mIndices[ i ] ];
     for ( SizeType j = 0; j < out.mVertices.Size(); ++j )
     {
-      if ( v.mPosition.x == out.mVertices[ j ].mPosition.x && v.mPosition.y == out.mVertices[ j ].mPosition.y &&
-           v.mTexCoords.x == out.mVertices[ j ].mTexCoords.x && v.mTexCoords.y == out.mVertices[ j ].mTexCoords.y )
+      if ( ( fabsf( v.mPosition.x - out.mVertices[ j ].mPosition.x ) < Math::MACHINE_EPSILON_1000 ) &&
+           ( fabsf( v.mPosition.y - out.mVertices[ j ].mPosition.y ) < Math::MACHINE_EPSILON_1000 ) &&
+           ( fabsf( v.mTexCoords.x - out.mVertices[ j ].mTexCoords.x ) < Math::MACHINE_EPSILON_1000 ) &&
+           ( fabsf( v.mTexCoords.y - out.mVertices[ j ].mTexCoords.y ) < Math::MACHINE_EPSILON_1000 ) )
       {
         // Yes, so store this down as the vertex to use
         out.mIndices.PushBack( j );
index cf9ec63a6c76882b7dfb71cea40097c0a62e877c..aff18be4bc7b00754c5144d13dbbbf9ea5beec3b 100644 (file)
@@ -215,11 +215,14 @@ void ReorderLines( const Vector<BidirectionalParagraphInfoRun>& bidirectionalInf
       // The memory is freed after the visual to logical to visual conversion tables are built in the logical model.
       lineInfoRun.visualToLogicalMap = reinterpret_cast<CharacterIndex*>( malloc( line.characterRun.numberOfCharacters * sizeof( CharacterIndex ) ) );
 
-      // Reorders the line.
-      bidirectionalSupport.Reorder( paragraphInfo.bidirectionalInfoIndex,
-                                    line.characterRun.characterIndex - paragraphInfo.characterRun.characterIndex,
-                                    line.characterRun.numberOfCharacters,
-                                    lineInfoRun.visualToLogicalMap );
+      if( NULL != lineInfoRun.visualToLogicalMap )
+      {
+        // Reorders the line.
+        bidirectionalSupport.Reorder( paragraphInfo.bidirectionalInfoIndex,
+                                      line.characterRun.characterIndex - paragraphInfo.characterRun.characterIndex,
+                                      line.characterRun.numberOfCharacters,
+                                      lineInfoRun.visualToLogicalMap );
+      }
 
       // Push the run into the vector.
       lineInfoRuns.PushBack( lineInfoRun );
index cda8fb661d8d56780d2dace59e2995c3a4f35849..038bf2e58eb8626222de85fa523fd8dbd203c7cc 100644 (file)
@@ -43,6 +43,13 @@ public:
    */
   struct Metrics
   {
+    Metrics()
+    : mGlyphCount( 0u )
+    {}
+
+    ~Metrics()
+    {}
+
     uint32_t mGlyphCount;                   // number of glyphs being managed
     AtlasManager::Metrics mAtlasMetrics;    // metrics from the Atlas Manager
   };
index 457959fea9aa2a65de585183be4b2223a1eb8d69..0fdc6c71fff97c925b1281dcb6e07957cdb6fd00 100644 (file)
@@ -97,6 +97,7 @@ struct AtlasRenderer::Impl : public ConnectionTracker
   };
 
   Impl()
+  : mDepth( 0 )
   {
     mGlyphManager = AtlasGlyphManager::Get();
     mFontClient = TextAbstraction::FontClient::Get();