Exposing Exif Image metadata
[platform/core/uifw/dali-adaptor.git] / platform-abstractions / tizen / image-loaders / loader-astc.cpp
index bddf954..a0362aa 100755 (executable)
 #include "loader-astc.h"
 
 // EXTERNAL INCLUDES
-#include <cstdio>
-#include <cstdlib>
 #include <cstring>
-#include <stdint.h>
 #include <dali/public-api/common/compile-time-assert.h>
 #include <dali/integration-api/debug.h>
-#include <dali/integration-api/bitmap.h>
 #include <dali/public-api/images/pixel.h>
+#include <adaptors/devel-api/adaptor-framework/pixel-buffer.h>
 
 namespace Dali
 {
-using Integration::Bitmap;
-using Dali::Integration::PixelBuffer;
-
 namespace TizenPlatform
 {
-
 namespace
 {
 
@@ -174,7 +167,7 @@ bool LoadAstcHeader( const ImageLoader::Input& input, unsigned int& width, unsig
 }
 
 // File loading API entry-point:
-bool LoadBitmapFromAstc( const ImageLoader::Input& input, Integration::Bitmap& bitmap )
+bool LoadBitmapFromAstc( const ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap )
 {
   FILE* const filePointer = input.file;
   if( !filePointer )
@@ -231,16 +224,13 @@ bool LoadBitmapFromAstc( const ImageLoader::Input& input, Integration::Bitmap& b
     return false;
   }
 
-  // Allocate space to load the image data in to.
-  PixelBuffer* const pixels = bitmap.GetCompressedProfile()->ReserveBufferOfSize( pixelFormat, width, height, imageByteCount );
-  if( !pixels )
-  {
-    DALI_LOG_ERROR( "Unable to reserve a pixel buffer to load the requested bitmap into.\n" );
-    return false;
-  }
+  // allocate pixel data
+  bitmap = Dali::Devel::PixelBuffer::New(width, height, pixelFormat);
+  auto pixels = bitmap.GetBuffer();
 
   // Load the image data.
   const size_t bytesRead = fread( pixels, 1, imageByteCount, filePointer );
+
   // Check the size of loaded data is what we expected.
   if( bytesRead != imageByteCount )
   {