X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fimage-loader%2Fatlas-packer.cpp;h=4becddfea838c14f6fdcffa13c2e00afc36ea782;hb=593ab514474062b4d3de55682e63627a79b2eb5a;hp=4212188d16063ec3648b46fd17d70446de27d745;hpb=34c7e90e1a2542994e329fe19875701cfe52c66e;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/image-loader/atlas-packer.cpp b/dali-toolkit/internal/image-loader/atlas-packer.cpp index 4212188..4becddf 100644 --- a/dali-toolkit/internal/image-loader/atlas-packer.cpp +++ b/dali-toolkit/internal/image-loader/atlas-packer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -19,7 +19,7 @@ #include "atlas-packer.h" // EXTERNAL HEADER -#include // For abs() +#include // For abs() #include namespace Dali @@ -36,7 +36,7 @@ namespace bool ApproximatelyEqual( uint32_t a, uint32_t b ) { - return abs( a-b ) <= 1; + return std::abs( static_cast( a - b ) ) <= 1; } uint16_t MaxDimension( const Uint16Pair& dimensions ) @@ -258,12 +258,11 @@ void AtlasPacker::GrowPack( SizeType blockWidth, SizeType blockHeight, firstFit = InsertNode( mRoot->child[1], blockWidth, blockHeight ); } - if( firstFit != NULL ) - { - firstFit->occupied = true; - packPositionX = firstFit->rectArea.x; - packPositionY = firstFit->rectArea.y; - } + DALI_ASSERT_ALWAYS( firstFit != NULL && "It should never happen!") + + firstFit->occupied = true; + packPositionX = firstFit->rectArea.x; + packPositionY = firstFit->rectArea.y; } void AtlasPacker::GrowNode( SizeType blockWidth, SizeType blockHeight ) @@ -275,7 +274,7 @@ void AtlasPacker::GrowNode( SizeType blockWidth, SizeType blockHeight ) bool shouldGrowRight = canGrowRight && mRoot->rectArea.height >= mRoot->rectArea.width+blockWidth; bool shouldGrowDown = canGrowDown && mRoot->rectArea.width >= mRoot->rectArea.height+blockHeight; - if( canGrowRight && canGrowRight ) + if( canGrowRight && canGrowDown ) { shouldGrowRight = mRoot->rectArea.width+blockWidth <= mRoot->rectArea.height+blockHeight; shouldGrowDown = !shouldGrowRight;