Support WebP format
[platform/core/uifw/dali-adaptor-legacy.git] / dali / internal / imaging / common / gif-loading.cpp
old mode 100755 (executable)
new mode 100644 (file)
similarity index 97%
rename from dali/devel-api/adaptor-framework/gif-loading.cpp
rename to dali/internal/imaging/common/gif-loading.cpp
index e49fbc8..187d91c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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,7 @@
  */
 
 // CLASS HEADER
-#include <dali/devel-api/adaptor-framework/gif-loading.h>
+#include <dali/internal/imaging/common/gif-loading.h>
 
 // EXTERNAL INCLUDES
 #include <sys/types.h>
 namespace Dali
 {
 
+namespace Internal
+{
+
+namespace Adaptor
+{
+
 namespace
 {
 #if defined(DEBUG_ENABLED)
@@ -1232,9 +1238,9 @@ public:
   ImageProperties imageProperties;
 };
 
-std::unique_ptr<GifLoading> GifLoading::New( const std::string &url, bool isLocalResource )
+AnimatedImageLoadingPtr GifLoading::New( const std::string &url, bool isLocalResource )
 {
-  return std::unique_ptr<GifLoading>( new GifLoading( url, isLocalResource ) );
+  return AnimatedImageLoadingPtr( new GifLoading( url, isLocalResource ) );
 }
 
 GifLoading::GifLoading( const std::string &url, bool isLocalResource )
@@ -1248,7 +1254,7 @@ GifLoading::~GifLoading()
   delete mImpl;
 }
 
-bool GifLoading::LoadNextNFrames( int frameStartIndex, int count, std::vector<Dali::PixelData> &pixelData )
+bool GifLoading::LoadNextNFrames( uint32_t frameStartIndex, int count, std::vector<Dali::PixelData> &pixelData )
 {
   int error;
   bool ret = false;
@@ -1278,36 +1284,23 @@ bool GifLoading::LoadNextNFrames( int frameStartIndex, int count, std::vector<Da
   return ret;
 }
 
-bool GifLoading::LoadAllFrames( std::vector<Dali::PixelData> &pixelData, Dali::Vector<uint32_t> &frameDelays )
-{
-  if( LoadFrameDelays( frameDelays ) )
-  {
-    return LoadNextNFrames( 0, mImpl->loaderInfo.animated.frameCount, pixelData );
-  }
-  return false;
-}
-
-ImageDimensions GifLoading::GetImageSize()
+ImageDimensions GifLoading::GetImageSize() const
 {
   return ImageDimensions( mImpl->imageProperties.w, mImpl->imageProperties.h );
 }
 
-int GifLoading::GetImageCount()
+uint32_t GifLoading::GetImageCount() const
 {
   return mImpl->loaderInfo.animated.frameCount;
 }
 
-bool GifLoading::LoadFrameDelays( Dali::Vector<uint32_t> &frameDelays )
+uint32_t GifLoading::GetFrameInterval( uint32_t frameIndex ) const
 {
-  frameDelays.Clear();
+  return mImpl->loaderInfo.animated.frames[frameIndex].info.delay * 10;
+}
 
-  for( auto &&elem : mImpl->loaderInfo.animated.frames )
-  {
-    // Read frame delay time, multiply 10 to change time unit to milliseconds
-    frameDelays.PushBack( elem.info.delay * 10 );
-  }
+} // namespace Adaptor
 
-  return true;
-}
+} // namespace Internal
 
-} // namespace Dali
+} // namespace Dali
\ No newline at end of file