From: seungho Date: Tue, 28 Dec 2021 08:29:02 +0000 (+0900) Subject: [Tizen] Add DesiredWidth/Height for animated image loading X-Git-Tag: accepted/tizen/6.5/unified/20220104.122940^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;ds=sidebyside;h=7132f42c675d329b3f8ae31a92ee5250c7c7258d;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git [Tizen] Add DesiredWidth/Height for animated image loading Change-Id: I83c7ea9afadc2afb8033f0e90f8c435b31907a1c Signed-off-by: seungho --- diff --git a/dali/devel-api/adaptor-framework/animated-image-loading.cpp b/dali/devel-api/adaptor-framework/animated-image-loading.cpp index 8f6a118..0f97ef1 100644 --- a/dali/devel-api/adaptor-framework/animated-image-loading.cpp +++ b/dali/devel-api/adaptor-framework/animated-image-loading.cpp @@ -66,9 +66,12 @@ bool AnimatedImageLoading::LoadNextNFrames(uint32_t frameStartIndex, int count, return GetImplementation(*this).LoadNextNFrames(frameStartIndex, count, pixelData); } -Dali::Devel::PixelBuffer AnimatedImageLoading::LoadFrame(uint32_t frameIndex) +Dali::Devel::PixelBuffer AnimatedImageLoading::LoadFrame(uint32_t frameIndex, + ImageDimensions size, + FittingMode::Type fittingMode, + Dali::SamplingMode::Type samplingMode) { - return GetImplementation(*this).LoadFrame(frameIndex); + return GetImplementation(*this).LoadFrame(frameIndex, size, fittingMode, samplingMode); } ImageDimensions AnimatedImageLoading::GetImageSize() const diff --git a/dali/devel-api/adaptor-framework/animated-image-loading.h b/dali/devel-api/adaptor-framework/animated-image-loading.h index 92d825c..d57c446 100644 --- a/dali/devel-api/adaptor-framework/animated-image-loading.h +++ b/dali/devel-api/adaptor-framework/animated-image-loading.h @@ -22,6 +22,7 @@ #include #include #include +#include // INTERNAL INCLUDES #include @@ -116,10 +117,16 @@ public: * * @note This function will load the entire animated image into memory if not already loaded. * @param[in] frameIndex The frame index to load. + * @param[in] size The width and height to fit the loaded image to. + * @param[in] fittingMode The FittingMode of the resource to load + * @param[in] samplingMode The SamplingMode of the resource to load + * * @return Dali::Devel::PixelBuffer The loaded PixelBuffer. If loading is fail, return empty handle. */ - - Dali::Devel::PixelBuffer LoadFrame(uint32_t frameIndex); + Dali::Devel::PixelBuffer LoadFrame(uint32_t frameIndex, + ImageDimensions size, + FittingMode::Type fittingMode, + Dali::SamplingMode::Type samplingMode); /** * @brief Get the size of a animated image. diff --git a/dali/internal/imaging/common/animated-image-loading-impl.h b/dali/internal/imaging/common/animated-image-loading-impl.h index d2a624c..f1dcf31 100644 --- a/dali/internal/imaging/common/animated-image-loading-impl.h +++ b/dali/internal/imaging/common/animated-image-loading-impl.h @@ -27,6 +27,7 @@ // INTERNAL INCLUDES #include #include +#include namespace Dali { @@ -66,14 +67,30 @@ public: ~AnimatedImageLoading() override = default; /** - * @copydoc Dali::AnimatedImageLoading::LoadNextNFrames() + * @brief Load a frame of the animated image. + * + * @note This function will load the entire animated image into memory if not already loaded. + * @param[in] frameIndex The frame index to load. + * @param[in] size The width and height to fit the loaded image to. + * @param[in] fittingMode The FittingMode of the resource to load + * @param[in] samplingMode The SamplingMode of the resource to load + * + * @return Dali::Devel::PixelBuffer The loaded PixelBuffer. If loading is fail, return empty handle. */ - virtual bool LoadNextNFrames(uint32_t frameStartIndex, int count, std::vector& pixelData) = 0; + Dali::Devel::PixelBuffer LoadFrame(uint32_t frameIndex, + ImageDimensions size, + FittingMode::Type fittingMode, + Dali::SamplingMode::Type samplingMode) + { + Dali::Devel::PixelBuffer pixelBuffer = LoadFrame(frameIndex); + return Dali::Internal::Platform::ApplyAttributesToBitmap(pixelBuffer, size, fittingMode, samplingMode); + } +public: /** - * @copydoc Dali::AnimatedImageLoading::LoadFrame() + * @copydoc Dali::AnimatedImageLoading::LoadNextNFrames() */ - virtual Dali::Devel::PixelBuffer LoadFrame(uint32_t frameIndex) = 0; + virtual bool LoadNextNFrames(uint32_t frameStartIndex, int count, std::vector& pixelData) = 0; /** * @copydoc Dali::AnimatedImageLoading::GetImageSize() @@ -99,6 +116,16 @@ public: * @copydoc Dali::AnimatedImageLoading::HasLoadingSucceeded() */ virtual bool HasLoadingSucceeded() const = 0; + +private: + /** + * @brief Load a frame of the animated image. + * + * @note This function will load the entire animated image into memory if not already loaded. + * @param[in] frameIndex The frame index to load. + * @return Dali::Devel::PixelBuffer The loaded PixelBuffer. If loading is fail, return empty handle. + */ + virtual Dali::Devel::PixelBuffer LoadFrame(uint32_t frameIndex) = 0; }; } // namespace Adaptor