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 a5f0462..a3b9e86 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 cf9ec63..aff18be 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 cda8fb6..038bf2e 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 457959f..0fdc6c7 100644 (file)
@@ -97,6 +97,7 @@ struct AtlasRenderer::Impl : public ConnectionTracker
   };
 
   Impl()
+  : mDepth( 0 )
   {
     mGlyphManager = AtlasGlyphManager::Get();
     mFontClient = TextAbstraction::FontClient::Get();