X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fimage-loader%2Fimage-atlas-impl.h;h=94601a25434db578ccd05e131392bf3e7d02f95c;hp=34924d3327f2db07750e955cbe449cea27429233;hb=b694e7e2ae624e206e1548b1a863c554eb9cd4d7;hpb=bd75dc4cad4ce62cc9206abf19280b40825b9726 diff --git a/dali-toolkit/internal/image-loader/image-atlas-impl.h b/dali-toolkit/internal/image-loader/image-atlas-impl.h index 34924d3..94601a2 100644 --- a/dali-toolkit/internal/image-loader/image-atlas-impl.h +++ b/dali-toolkit/internal/image-loader/image-atlas-impl.h @@ -1,8 +1,8 @@ -#ifndef __DALI_TOOLKIT_IMAGE_ATLAS_IMPL_H__ -#define __DALI_TOOLKIT_IMAGE_ATLAS_IMPL_H__ +#ifndef DALI_TOOLKIT_IMAGE_ATLAS_IMPL_H +#define DALI_TOOLKIT_IMAGE_ATLAS_IMPL_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. @@ -22,12 +22,12 @@ #include #include #include -#include +#include // INTERNAL INCLUDES #include -#include #include +#include namespace Dali { @@ -46,6 +46,11 @@ public: typedef Toolkit::ImageAtlas::SizeType SizeType; /** + * @copydoc ImageAtlas::PackToAtlas( const std::vector&, Dali::Vector& ) + */ + static Texture PackToAtlas( const std::vector& pixelData, Dali::Vector& textureRects ); + + /** * Constructor * @param [in] width The atlas width in pixels. * @param [in] height The atlas height in pixels. @@ -80,7 +85,8 @@ public: const std::string& url, ImageDimensions size, FittingMode::Type fittingMode, - bool orientationCorrection); + bool orientationCorrection, + AtlasUploadObserver* atlasUploadObserver ); /** * @copydoc Toolkit::ImageAtlas::Upload( Vector4&, PixelData ) @@ -92,6 +98,11 @@ public: */ void Remove( const Vector4& textureRect ); + /** + * Resets the destroying observer pointer so that we know not to call methods of this object any more. + */ + void ObserverDestroyed( AtlasUploadObserver* observer ); + protected: /** @@ -104,7 +115,7 @@ private: /** * @copydoc PixelDataRequester::ProcessPixels */ - void UploadToAtlas( unsigned int id, PixelData pixelData ); + void UploadToAtlas( uint32_t id, PixelData pixelData ); /** * Upload broken image @@ -121,22 +132,29 @@ private: private: - struct IdRectPair + /** + * Each loading task( identified with an ID ) is associated with a rect region for packing the loaded pixel data into the atlas, + * and an AtlasUploadObserver whose UploadCompleted method should get executed once the sub texture is ready. + */ + struct LoadingTaskInfo { - IdRectPair( unsigned short loadTaskId, - unsigned int packPositionX, - unsigned int packPositionY, - unsigned int width, - unsigned int height ) + LoadingTaskInfo( unsigned short loadTaskId, + unsigned int packPositionX, + unsigned int packPositionY, + unsigned int width, + unsigned int height, + AtlasUploadObserver* observer ) : loadTaskId( loadTaskId ), - packRect( packPositionX, packPositionY, width, height ) + packRect( packPositionX, packPositionY, width, height ), + observer( observer ) {} unsigned short loadTaskId; Rect packRect; + AtlasUploadObserver* observer; }; - OwnerContainer mIdRectContainer; + OwnerContainer mLoadingTaskInfoContainer; Texture mAtlas; AtlasPacker mPacker; @@ -147,6 +165,7 @@ private: float mHeight; Pixel::Format mPixelFormat; + }; } // namespace Internal @@ -173,4 +192,4 @@ inline Internal::ImageAtlas& GetImplementation( Toolkit::ImageAtlas& imageAtlas } // namespace Dali -#endif /* __DALI_TOOLKIT_IMAGE_ATLAS_IMPL_H__ */ +#endif // DALI_TOOLKIT_IMAGE_ATLAS_IMPL_H