Atlas: fix the order of allocation and ResourceId query 68/36668/2
authorXiangyin Ma <x1.ma@samsung.com>
Wed, 11 Mar 2015 15:12:08 +0000 (15:12 +0000)
committerXiangyin Ma <x1.ma@samsung.com>
Wed, 11 Mar 2015 15:16:53 +0000 (15:16 +0000)
Change-Id: I81ec538d55beab1b461410593c36bc17e5d3f349

dali/internal/event/images/atlas-impl.cpp

index 9243841..519be32 100644 (file)
@@ -82,25 +82,23 @@ bool Atlas::Upload( const std::string& url,
 {
   bool uploadSuccess( false );
 
-  ResourceId destId = GetResourceId();
+  Integration::BitmapPtr bitmap = LoadBitmap( url );
 
-  if( destId )
+  if( bitmap && Compatible(bitmap->GetPixelFormat(), xOffset + bitmap->GetImageWidth(), yOffset + bitmap->GetImageHeight()) )
   {
-    Integration::BitmapPtr bitmap = LoadBitmap( url );
-
-    if( bitmap && Compatible(bitmap->GetPixelFormat(), xOffset + bitmap->GetImageWidth(), yOffset + bitmap->GetImageHeight()) )
+    AllocateAtlas();
+    ResourceId destId = GetResourceId();
+    if( destId )
     {
-      AllocateAtlas();
       mResourceClient.UploadBitmap( destId, bitmap, xOffset, yOffset  );
+      uploadSuccess = true;
 
       if( mRecoverContext )
       {
         mTiles.PushBack( new Tile(xOffset, yOffset, url) );
       }
-      uploadSuccess = true;
     }
   }
-
   return uploadSuccess;
 }