X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fimage-loader%2Fatlas-packer.h;h=b356124af5ceba93dab3608f191561abb06d7071;hb=593ab514474062b4d3de55682e63627a79b2eb5a;hp=bab993f3b66b4329594acec6a8ea82cba25b88d2;hpb=3eb60a0aef6b188727b79bdee2e35c575c432a90;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/image-loader/atlas-packer.h b/dali-toolkit/internal/image-loader/atlas-packer.h index bab993f..b356124 100644 --- a/dali-toolkit/internal/image-loader/atlas-packer.h +++ b/dali-toolkit/internal/image-loader/atlas-packer.h @@ -1,8 +1,8 @@ -#ifndef __DALI_TOOLKIT_ATLAS_PACKER_H__ -#define __DALI_TOOLKIT_ATLAS_PACKER_H__ +#ifndef DALI_TOOLKIT_ATLAS_PACKER_H +#define DALI_TOOLKIT_ATLAS_PACKER_H /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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. @@ -18,7 +18,9 @@ */ #include +#include #include +#include namespace Dali { @@ -99,6 +101,14 @@ public: */ unsigned int GetAvailableArea() const; + /** + * Pack a group of blocks with different sizes, calculate the required packing size and the position of each block. + * @param[in] blockSizes The size list of the blocks . + * @param[out] packPositions The packing position of each block. + * @return The required size to accommodate all the blocks. + */ + static Uint16Pair GroupPack( const Dali::Vector& blockSizes, Dali::Vector& packPositions ); + private: /* @@ -146,11 +156,30 @@ private: */ void DeleteNode( Node* node ); + /** + * Pack a block into the atlas. If there is no enough room, grow the partition tree. + * + * @param[in] blockWidth The width of the block to pack. + * @param[in] blockHeight The height of the block to pack. + * @param[out] packPositionX The x coordinate of the position to pack the block. + * @param[out] packPositionY The y coordinate of the position to pack the block. + */ + void GrowPack( SizeType blockWidth, SizeType blockHeight, + SizeType& packPositionX, SizeType& packPositionY ); + + /** + * Add extra node into the partition tree to accommodate the given block. + * + * @param[in] blockWidth The width of the block to pack. + * @param[in] blockHeight The height of the block to pack. + */ + void GrowNode( SizeType blockWidth, SizeType blockHeight ); + // Undefined - AtlasPacker( const AtlasPacker& imageAtlas); + AtlasPacker( const AtlasPacker& atlasPacker); // Undefined - AtlasPacker& operator=( const AtlasPacker& imageAtlas ); + AtlasPacker& operator=( const AtlasPacker& atlasPacker ); private: @@ -166,4 +195,4 @@ private: } // namespace Dali -#endif /* __DALI_TOOLKIT_ATLAS_PACKER_H__ */ +#endif // DALI_TOOLKIT_ATLAS_PACKER_H