From 6351f46a2ec7a95878d51e851dcc5bd1b96a78e5 Mon Sep 17 00:00:00 2001 From: Joogab Yun Date: Tue, 14 Aug 2018 08:25:08 +0900 Subject: [PATCH] support image loader extension Allows the image loader to obtain the plugin's bitmap loader. we can add an image loader through the dali-extension plugin. Change-Id: I1c9bd58ad6075bbe4049ed6753b2b833ae0b766e --- .../src/dali-adaptor-internal/image-loaders.cpp | 6 +- .../src/dali-adaptor-internal/image-loaders.h | 6 +- .../utc-Dali-CompressedTextures.cpp | 2 +- .../adaptor-framework}/image-loader-input.h | 25 +++-- .../adaptor-framework/image-loader-plugin.h | 66 ++++++++++++ dali/devel-api/file.list | 2 + dali/internal/adaptor/common/adaptor-impl.cpp | 7 ++ .../imaging/common/image-loader-plugin-proxy.cpp | 115 +++++++++++++++++++++ .../imaging/common/image-loader-plugin-proxy.h | 68 ++++++++++++ dali/internal/imaging/common/image-loader.cpp | 74 ++++++------- dali/internal/imaging/common/loader-astc.cpp | 4 +- dali/internal/imaging/common/loader-astc.h | 6 +- dali/internal/imaging/common/loader-bmp.cpp | 4 +- dali/internal/imaging/common/loader-bmp.h | 6 +- dali/internal/imaging/common/loader-gif.cpp | 4 +- dali/internal/imaging/common/loader-gif.h | 6 +- dali/internal/imaging/common/loader-ico.cpp | 4 +- dali/internal/imaging/common/loader-ico.h | 6 +- dali/internal/imaging/common/loader-jpeg-turbo.cpp | 4 +- dali/internal/imaging/common/loader-jpeg.h | 6 +- dali/internal/imaging/common/loader-ktx.cpp | 4 +- dali/internal/imaging/common/loader-ktx.h | 6 +- dali/internal/imaging/common/loader-png.cpp | 4 +- dali/internal/imaging/common/loader-png.h | 6 +- dali/internal/imaging/common/loader-wbmp.cpp | 4 +- dali/internal/imaging/common/loader-wbmp.h | 6 +- dali/internal/imaging/file.list | 1 + 27 files changed, 362 insertions(+), 90 deletions(-) mode change 100644 => 100755 automated-tests/src/dali-adaptor-internal/image-loaders.cpp mode change 100644 => 100755 automated-tests/src/dali-adaptor-internal/image-loaders.h mode change 100644 => 100755 automated-tests/src/dali-adaptor-internal/utc-Dali-CompressedTextures.cpp rename dali/{internal/imaging/common => devel-api/adaptor-framework}/image-loader-input.h (65%) mode change 100644 => 100755 create mode 100755 dali/devel-api/adaptor-framework/image-loader-plugin.h create mode 100755 dali/internal/imaging/common/image-loader-plugin-proxy.cpp create mode 100755 dali/internal/imaging/common/image-loader-plugin-proxy.h mode change 100644 => 100755 dali/internal/imaging/common/image-loader.cpp mode change 100644 => 100755 dali/internal/imaging/common/loader-astc.cpp mode change 100644 => 100755 dali/internal/imaging/common/loader-astc.h mode change 100644 => 100755 dali/internal/imaging/common/loader-bmp.cpp mode change 100644 => 100755 dali/internal/imaging/common/loader-bmp.h mode change 100644 => 100755 dali/internal/imaging/common/loader-gif.cpp mode change 100644 => 100755 dali/internal/imaging/common/loader-gif.h mode change 100644 => 100755 dali/internal/imaging/common/loader-ico.cpp mode change 100644 => 100755 dali/internal/imaging/common/loader-ico.h mode change 100644 => 100755 dali/internal/imaging/common/loader-jpeg-turbo.cpp mode change 100644 => 100755 dali/internal/imaging/common/loader-jpeg.h mode change 100644 => 100755 dali/internal/imaging/common/loader-ktx.cpp mode change 100644 => 100755 dali/internal/imaging/common/loader-ktx.h mode change 100644 => 100755 dali/internal/imaging/common/loader-png.cpp mode change 100644 => 100755 dali/internal/imaging/common/loader-png.h mode change 100644 => 100755 dali/internal/imaging/common/loader-wbmp.cpp mode change 100644 => 100755 dali/internal/imaging/common/loader-wbmp.h mode change 100644 => 100755 dali/internal/imaging/file.list diff --git a/automated-tests/src/dali-adaptor-internal/image-loaders.cpp b/automated-tests/src/dali-adaptor-internal/image-loaders.cpp old mode 100644 new mode 100755 index faebbf3..3b8821c --- a/automated-tests/src/dali-adaptor-internal/image-loaders.cpp +++ b/automated-tests/src/dali-adaptor-internal/image-loaders.cpp @@ -98,7 +98,7 @@ void TestImageLoading( const ImageDetails& image, const LoadFunctions& functions // Check the header file. unsigned int width(0), height(0); - const Dali::TizenPlatform::ImageLoader::Input input( fp ); + const Dali::ImageLoader::Input input( fp ); DALI_TEST_CHECK( functions.header( input, width, height ) ); DALI_TEST_EQUALS( width, image.reportedWidth, TEST_LOCATION ); @@ -136,7 +136,7 @@ void CompareLoadedImageData( const ImageDetails& image, const LoadFunctions& fun // Check the header file. unsigned int width = 0, height = 0; - const Dali::TizenPlatform::ImageLoader::Input input( filePointer ); + const Dali::ImageLoader::Input input( filePointer ); DALI_TEST_CHECK( functions.header( input, width, height ) ); DALI_TEST_EQUALS( width, image.reportedWidth, TEST_LOCATION ); @@ -181,7 +181,7 @@ void DumpImageBufferToTempFile( std::string filename, std::string targetFilename AutoCloseFile autoClose( fp ); Dali::Devel::PixelBuffer bitmap; - const Dali::TizenPlatform::ImageLoader::Input input( fp ); + const Dali::ImageLoader::Input input( fp ); DALI_TEST_CHECK( functions.loader( input, bitmap ) ); diff --git a/automated-tests/src/dali-adaptor-internal/image-loaders.h b/automated-tests/src/dali-adaptor-internal/image-loaders.h old mode 100644 new mode 100755 index 824718f..088b1bd --- a/automated-tests/src/dali-adaptor-internal/image-loaders.h +++ b/automated-tests/src/dali-adaptor-internal/image-loaders.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include // Simple structure to close the file when finished with it. struct AutoCloseFile @@ -83,8 +83,8 @@ private: */ struct LoadFunctions { - typedef bool (*LoadBitmapFunction)( const Dali::TizenPlatform::ImageLoader::Input& input, Dali::Devel::PixelBuffer& ); - typedef bool (*LoadBitmapHeaderFunction)( const Dali::TizenPlatform::ImageLoader::Input& input, unsigned int& width, unsigned int& height ); + typedef bool (*LoadBitmapFunction)( const Dali::ImageLoader::Input& input, Dali::Devel::PixelBuffer& ); + typedef bool (*LoadBitmapHeaderFunction)( const Dali::ImageLoader::Input& input, unsigned int& width, unsigned int& height ); LoadFunctions( LoadBitmapHeaderFunction _header, LoadBitmapFunction _loader ); LoadBitmapHeaderFunction header; diff --git a/automated-tests/src/dali-adaptor-internal/utc-Dali-CompressedTextures.cpp b/automated-tests/src/dali-adaptor-internal/utc-Dali-CompressedTextures.cpp old mode 100644 new mode 100755 index f0e9bf6..1b1eb54 --- a/automated-tests/src/dali-adaptor-internal/utc-Dali-CompressedTextures.cpp +++ b/automated-tests/src/dali-adaptor-internal/utc-Dali-CompressedTextures.cpp @@ -119,7 +119,7 @@ class KtxTestFixture // Check the header file. unsigned int width( 0 ), height( 0 ); - const Dali::TizenPlatform::ImageLoader::Input input( fileDescriptor ); + const Dali::ImageLoader::Input input( fileDescriptor ); // Use the given loader to parse the image header. DALI_TEST_CHECK( testEntry.loadFunctions.header( input, width, height ) ); diff --git a/dali/internal/imaging/common/image-loader-input.h b/dali/devel-api/adaptor-framework/image-loader-input.h old mode 100644 new mode 100755 similarity index 65% rename from dali/internal/imaging/common/image-loader-input.h rename to dali/devel-api/adaptor-framework/image-loader-input.h index 7aecffe..a7df23a --- a/dali/internal/imaging/common/image-loader-input.h +++ b/dali/devel-api/adaptor-framework/image-loader-input.h @@ -20,21 +20,18 @@ // EXTERNAL INCLUDES #include #include +#include +#include // INTERNAL INCLUDES namespace Dali { -namespace TizenPlatform -{ namespace ImageLoader { - /** * @brief A simple immutable struct to bundle together parameters for scaling an image. - * @ToDo Move this to adaptor internal? - * @ToDo Rename it after the move to ImageScalingParameters. */ class ScalingParameters { @@ -58,8 +55,24 @@ struct Input bool reorientationRequested; }; + +using LoadBitmapFunction = bool( * )( const Dali::ImageLoader::Input& input, Dali::Devel::PixelBuffer& pixelData ); +using LoadBitmapHeaderFunction = bool( * )( const Dali::ImageLoader::Input& input, unsigned int& width, unsigned int& height ); + +/** + * Stores the magic bytes, and the loader and header functions used for each image loader. + */ +struct BitmapLoader +{ + unsigned char magicByte1; ///< The first byte in the file should be this + unsigned char magicByte2; ///< The second byte in the file should be this + LoadBitmapFunction loader; ///< The function which decodes the file + LoadBitmapHeaderFunction header; ///< The function which decodes the header of the file + Dali::Integration::Bitmap::Profile profile; ///< The kind of bitmap to be created + /// (addressable packed pixels or an opaque compressed blob). +}; + } // ImageLoader -} // TizenPlatform } // Dali #endif // __DALI_TIZEN_PLATFORM_IMAGE_LOADER_INPUT_H__ diff --git a/dali/devel-api/adaptor-framework/image-loader-plugin.h b/dali/devel-api/adaptor-framework/image-loader-plugin.h new file mode 100755 index 0000000..1a3c004 --- /dev/null +++ b/dali/devel-api/adaptor-framework/image-loader-plugin.h @@ -0,0 +1,66 @@ +#ifndef __DALI_IMAGE_LOADING_PLUGIN_H__ +#define __DALI_IMAGE_LOADING_PLUGIN_H__ + +/* + * Copyright (c) 2018 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include + +namespace Dali +{ + +/** + * @brief + */ +class ImageLoaderPlugin +{ +public: + + /** + * @brief Constructor. + */ + ImageLoaderPlugin(){} + + /** + * @brief Destructor. + */ + virtual ~ImageLoaderPlugin(){} + + /** + * @brief Get the image decorder + * @param[in] filename The path to the resource. + * @return BitmapLoader + */ + virtual const ImageLoader::BitmapLoader* BitmapLoaderLookup( const std::string& filename ) const = 0; + + /** + * @brief Function pointer called in adaptor to create a image loading plugin instance. + * @return Pointer to the newly created plugin object + */ + typedef ImageLoaderPlugin* CreateImageLoaderPlugin( void ); + + /** + * @brief Function pointer called in adaptor to destory a image loading plugin instance. + */ + typedef void DestroyImageLoaderPlugin( ImageLoaderPlugin* plugin ); + +}; + +} // namespace Dali; + +#endif diff --git a/dali/devel-api/file.list b/dali/devel-api/file.list index ea89197..59a216f 100755 --- a/dali/devel-api/file.list +++ b/dali/devel-api/file.list @@ -50,6 +50,8 @@ devel_api_adaptor_framework_header_files = \ $(adaptor_devel_api_dir)/adaptor-framework/feedback-plugin.h \ $(adaptor_devel_api_dir)/adaptor-framework/feedback-player.h \ $(adaptor_devel_api_dir)/adaptor-framework/file-loader.h \ + $(adaptor_devel_api_dir)/adaptor-framework/image-loader-input.h \ + $(adaptor_devel_api_dir)/adaptor-framework/image-loader-plugin.h \ $(adaptor_devel_api_dir)/adaptor-framework/image-loading.h \ $(adaptor_devel_api_dir)/adaptor-framework/gif-loading.h \ $(adaptor_devel_api_dir)/adaptor-framework/input-method-context.h \ diff --git a/dali/internal/adaptor/common/adaptor-impl.cpp b/dali/internal/adaptor/common/adaptor-impl.cpp index 98c9128..272a019 100755 --- a/dali/internal/adaptor/common/adaptor-impl.cpp +++ b/dali/internal/adaptor/common/adaptor-impl.cpp @@ -59,6 +59,7 @@ #include #include +#include using Dali::TextAbstraction::FontClient; @@ -322,6 +323,9 @@ void Adaptor::Start() ProcessCoreEvents(); // Ensure any startup messages are processed. + // Initialize the image loader plugin + Internal::Adaptor::ImageLoaderPluginProxy::Initialize(); + for ( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter ) { (*iter)->OnStart(); @@ -404,6 +408,9 @@ void Adaptor::Stop() } } + // Destroy the image loader plugin + Internal::Adaptor::ImageLoaderPluginProxy::Destroy(); + delete mEventHandler; mEventHandler = NULL; diff --git a/dali/internal/imaging/common/image-loader-plugin-proxy.cpp b/dali/internal/imaging/common/image-loader-plugin-proxy.cpp new file mode 100755 index 0000000..4e26864 --- /dev/null +++ b/dali/internal/imaging/common/image-loader-plugin-proxy.cpp @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2018 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// CLASS HEADER +#include + +// EXTERNAL INCLUDES +#include +#include + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ + +namespace ImageLoaderPluginProxy +{ + + +static const char * DEFAULT_OBJECT_NAME( "libdali-image-loader-plugin.so" ); + +static bool mInitializeAttempted = false; +static void* mLibHandle = NULL; +static CreateImageLoaderPlugin* mCreatePluginFunctionPtr = NULL; +static DestroyImageLoaderPlugin* mDestroyImageLoaderPluginPtr = NULL; +static Dali::ImageLoaderPlugin* mImageLoaderPlugin = NULL; + +void Initialize() +{ + // Only attempt to load dll once + char* error = NULL; + if ( !mInitializeAttempted ) + { + mInitializeAttempted = true; + mLibHandle = dlopen( DEFAULT_OBJECT_NAME, RTLD_LAZY ); + error = dlerror(); + if( !mLibHandle ) + { + DALI_LOG_ERROR( "Cannot load dali image loading plugin library error: %s\n", error ); + return; + } + + // load plugin + mCreatePluginFunctionPtr = reinterpret_cast( dlsym( mLibHandle, "CreateImageLoaderPlugin" ) ); + error = dlerror(); + if( !mCreatePluginFunctionPtr ) + { + DALI_LOG_ERROR("Cannot load symbol CreateImageLoaderPlugin(): %s\n", error ); + return; + } + + mDestroyImageLoaderPluginPtr = reinterpret_cast( dlsym( mLibHandle, "DestroyImageLoaderPlugin" ) ); + error = dlerror(); + if( !mDestroyImageLoaderPluginPtr ) + { + DALI_LOG_ERROR("Cannot load symbol DestroyImageLoaderPlugin(): %s\n", error ); + return; + } + + + mImageLoaderPlugin = mCreatePluginFunctionPtr(); + error = dlerror(); + if( !mImageLoaderPlugin ) + { + DALI_LOG_ERROR("Call to function CreateImageLoaderPlugin() failed : %s\n", error ); + return; + } + } +} + +void Destroy() +{ + if( mImageLoaderPlugin && mDestroyImageLoaderPluginPtr ) + { + mDestroyImageLoaderPluginPtr( mImageLoaderPlugin ); + mImageLoaderPlugin = NULL; + } +} + +const ImageLoader::BitmapLoader* BitmapLoaderLookup( const std::string& filename ) +{ + if( mImageLoaderPlugin ) + { + const ImageLoader::BitmapLoader* data = mImageLoaderPlugin->BitmapLoaderLookup( filename ); + return data; + } + return NULL; +} + +} // namespace ImageLoaderPluginProxy + + +} // namespace Adaptor + +} // namespace Internal + +} // namespace Dali diff --git a/dali/internal/imaging/common/image-loader-plugin-proxy.h b/dali/internal/imaging/common/image-loader-plugin-proxy.h new file mode 100755 index 0000000..53d36d8 --- /dev/null +++ b/dali/internal/imaging/common/image-loader-plugin-proxy.h @@ -0,0 +1,68 @@ +#ifndef DALI_INTERNAL_IMAGE_LOADING_PLUGIN_PROXY_H +#define DALI_INTERNAL_IMAGE_LOADING_PLUGIN_PROXY_H + +/* + * Copyright (c) 2018 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ + +namespace ImageLoaderPluginProxy +{ + + using CreateImageLoaderPlugin = Dali::ImageLoaderPlugin::CreateImageLoaderPlugin; + using DestroyImageLoaderPlugin = Dali::ImageLoaderPlugin::DestroyImageLoaderPlugin; + + + /** + * @brief Initialize + */ + void Initialize(); + + + /** + * @brief Destroy + */ + void Destroy(); + + /** + * @brief BitmapLoaderLookup + */ + const ImageLoader::BitmapLoader* BitmapLoaderLookup( const std::string& filename ); + + +} // namespace ImageLoaderPluginProxy + +} // namespace Adaptor + +} // namespace Internal + +} // namespace Dali + +#endif // DALI_INTERNAL_IMAGE_LOADING_PLUGIN_PROXY_H diff --git a/dali/internal/imaging/common/image-loader.cpp b/dali/internal/imaging/common/image-loader.cpp old mode 100644 new mode 100755 index 80824ac..09c1d00 --- a/dali/internal/imaging/common/image-loader.cpp +++ b/dali/internal/imaging/common/image-loader.cpp @@ -28,7 +28,8 @@ #include #include #include -#include +#include +#include #include using namespace Dali::Integration; @@ -40,25 +41,10 @@ namespace TizenPlatform namespace { -typedef bool (*LoadBitmapFunction)( const ImageLoader::Input& input, Dali::Devel::PixelBuffer& pixelData ); -typedef bool (*LoadBitmapHeaderFunction)( const ImageLoader::Input& input, unsigned int& width, unsigned int& height ); - #if defined(DEBUG_ENABLED) Integration::Log::Filter* gLogFilter = Debug::Filter::New( Debug::Concise, false, "LOG_IMAGE_LOADING" ); #endif -/** - * Stores the magic bytes, and the loader and header functions used for each image loader. - */ -struct BitmapLoader -{ - unsigned char magicByte1; ///< The first byte in the file should be this - unsigned char magicByte2; ///< The second byte in the file should be this - LoadBitmapFunction loader; ///< The function which decodes the file - LoadBitmapHeaderFunction header; ///< The function which decodes the header of the file - Bitmap::Profile profile; ///< The kind of bitmap to be created - /// (addressable packed pixels or an opaque compressed blob). -}; /** * Enum for file formats, has to be in sync with BITMAP_LOADER_LOOKUP_TABLE @@ -87,7 +73,7 @@ enum FileFormats * A lookup table containing all the bitmap loaders with the appropriate information. * Has to be in sync with enum FileFormats */ -const BitmapLoader BITMAP_LOADER_LOOKUP_TABLE[FORMAT_TOTAL_COUNT] = +const Dali::ImageLoader::BitmapLoader BITMAP_LOADER_LOOKUP_TABLE[FORMAT_TOTAL_COUNT] = { { Png::MAGIC_BYTE_1, Png::MAGIC_BYTE_2, LoadBitmapFromPng, LoadPngHeader, Bitmap::BITMAP_2D_PACKED_PIXELS }, { Jpeg::MAGIC_BYTE_1, Jpeg::MAGIC_BYTE_2, LoadBitmapFromJpeg, LoadJpegHeader, Bitmap::BITMAP_2D_PACKED_PIXELS }, @@ -154,9 +140,10 @@ FileFormats GetFormatHint( const std::string& filename ) */ bool GetBitmapLoaderFunctions( FILE *fp, FileFormats format, - LoadBitmapFunction& loader, - LoadBitmapHeaderFunction& header, - Bitmap::Profile& profile ) + Dali::ImageLoader::LoadBitmapFunction& loader, + Dali::ImageLoader::LoadBitmapHeaderFunction& header, + Bitmap::Profile& profile, + const std::string& filename ) { unsigned char magic[MAGIC_LENGTH]; size_t read = fread(magic, sizeof(unsigned char), MAGIC_LENGTH, fp); @@ -173,11 +160,21 @@ bool GetBitmapLoaderFunctions( FILE *fp, } bool loaderFound = false; - const BitmapLoader *lookupPtr = BITMAP_LOADER_LOOKUP_TABLE; - ImageLoader::Input defaultInput( fp ); + const Dali::ImageLoader::BitmapLoader *lookupPtr = BITMAP_LOADER_LOOKUP_TABLE; + Dali::ImageLoader::Input defaultInput( fp ); + + // try plugin image loader + const Dali::ImageLoader::BitmapLoader* data = Internal::Adaptor::ImageLoaderPluginProxy::BitmapLoaderLookup( filename ); + if( data != NULL ) + { + lookupPtr = data; + unsigned int width = 0; + unsigned int height = 0; + loaderFound = lookupPtr->header( fp, width, height ); + } - // try hinted format first - if ( format != FORMAT_UNKNOWN ) + // try hinted format + if ( false == loaderFound && format != FORMAT_UNKNOWN ) { lookupPtr = BITMAP_LOADER_LOOKUP_TABLE + format; if ( format >= FORMAT_MAGIC_BYTE_COUNT || @@ -259,8 +256,8 @@ bool ConvertStreamToBitmap( const BitmapResourceType& resource, std::string path if (fp != NULL) { - LoadBitmapFunction function; - LoadBitmapHeaderFunction header; + Dali::ImageLoader::LoadBitmapFunction function; + Dali::ImageLoader::LoadBitmapHeaderFunction header; Bitmap::Profile profile; @@ -268,10 +265,11 @@ bool ConvertStreamToBitmap( const BitmapResourceType& resource, std::string path GetFormatHint( path ), function, header, - profile ) ) + profile, + path ) ) { - const ScalingParameters scalingParameters( resource.size, resource.scalingMode, resource.samplingMode ); - const ImageLoader::Input input( fp, scalingParameters, resource.orientationCorrection ); + const Dali::ImageLoader::ScalingParameters scalingParameters( resource.size, resource.scalingMode, resource.samplingMode ); + const Dali::ImageLoader::Input input( fp, scalingParameters, resource.orientationCorrection ); // Run the image type decoder: result = function( input, pixelBuffer ); @@ -343,17 +341,18 @@ ImageDimensions GetClosestImageSize( const std::string& filename, FILE *fp = fileReader.GetFile(); if (fp != NULL) { - LoadBitmapFunction loaderFunction; - LoadBitmapHeaderFunction headerFunction; + Dali::ImageLoader::LoadBitmapFunction loaderFunction; + Dali::ImageLoader::LoadBitmapHeaderFunction headerFunction; Bitmap::Profile profile; if ( GetBitmapLoaderFunctions( fp, GetFormatHint(filename), loaderFunction, headerFunction, - profile ) ) + profile, + filename ) ) { - const ImageLoader::Input input( fp, ScalingParameters( size, fittingMode, samplingMode ), orientationCorrection ); + const Dali::ImageLoader::Input input( fp, Dali::ImageLoader::ScalingParameters( size, fittingMode, samplingMode ), orientationCorrection ); const bool read_res = headerFunction( input, width, height ); if(!read_res) @@ -391,17 +390,18 @@ ImageDimensions GetClosestImageSize( Integration::ResourcePointer resourceBuffer FILE *fp = fileReader.GetFile(); if ( fp != NULL ) { - LoadBitmapFunction loaderFunction; - LoadBitmapHeaderFunction headerFunction; + Dali::ImageLoader::LoadBitmapFunction loaderFunction; + Dali::ImageLoader::LoadBitmapHeaderFunction headerFunction; Bitmap::Profile profile; if ( GetBitmapLoaderFunctions( fp, FORMAT_UNKNOWN, loaderFunction, headerFunction, - profile ) ) + profile, + "" ) ) { - const ImageLoader::Input input( fp, ScalingParameters( size, fittingMode, samplingMode ), orientationCorrection ); + const Dali::ImageLoader::Input input( fp, Dali::ImageLoader::ScalingParameters( size, fittingMode, samplingMode ), orientationCorrection ); const bool read_res = headerFunction( input, width, height ); if( !read_res ) { diff --git a/dali/internal/imaging/common/loader-astc.cpp b/dali/internal/imaging/common/loader-astc.cpp old mode 100644 new mode 100755 index ed13b8e..4765bf9 --- a/dali/internal/imaging/common/loader-astc.cpp +++ b/dali/internal/imaging/common/loader-astc.cpp @@ -161,14 +161,14 @@ bool LoadAstcHeader( FILE * const filePointer, unsigned int& width, unsigned int // File loading API entry-point: -bool LoadAstcHeader( const ImageLoader::Input& input, unsigned int& width, unsigned int& height ) +bool LoadAstcHeader( const Dali::ImageLoader::Input& input, unsigned int& width, unsigned int& height ) { AstcFileHeader fileHeader; return LoadAstcHeader( input.file, width, height, fileHeader ); } // File loading API entry-point: -bool LoadBitmapFromAstc( const ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ) +bool LoadBitmapFromAstc( const Dali::ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ) { FILE* const filePointer = input.file; if( !filePointer ) diff --git a/dali/internal/imaging/common/loader-astc.h b/dali/internal/imaging/common/loader-astc.h old mode 100644 new mode 100755 index f0ba78d..2ee94d1 --- a/dali/internal/imaging/common/loader-astc.h +++ b/dali/internal/imaging/common/loader-astc.h @@ -19,7 +19,7 @@ */ #include -#include +#include namespace Dali { @@ -49,7 +49,7 @@ const unsigned char MAGIC_BYTE_2 = 0xAB; * @param[out] bitmap The bitmap class where the decoded image will be stored * @return True if file loaded successfully, false otherwise */ -bool LoadBitmapFromAstc( const ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ); +bool LoadBitmapFromAstc( const Dali::ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ); /** * Loads the header of a ASTC file and fills in the width and height appropriately. @@ -58,7 +58,7 @@ bool LoadBitmapFromAstc( const ImageLoader::Input& input, Dali::Devel::PixelBuff * @param[out] height Is set with the height of the image * @return True if the header was read successfully, false otherwise */ -bool LoadAstcHeader( const ImageLoader::Input& input, unsigned int& width, unsigned int& height ); +bool LoadAstcHeader( const Dali::ImageLoader::Input& input, unsigned int& width, unsigned int& height ); } // namespace TizenPlatform diff --git a/dali/internal/imaging/common/loader-bmp.cpp b/dali/internal/imaging/common/loader-bmp.cpp old mode 100644 new mode 100755 index 1e6bddf..65120f2 --- a/dali/internal/imaging/common/loader-bmp.cpp +++ b/dali/internal/imaging/common/loader-bmp.cpp @@ -1043,7 +1043,7 @@ bool DecodeRLE8(FILE *fp, } // unnamed namespace -bool LoadBmpHeader( const ImageLoader::Input& input, unsigned int& width, unsigned int& height ) +bool LoadBmpHeader( const Dali::ImageLoader::Input& input, unsigned int& width, unsigned int& height ) { BmpFileHeader fileHeader; BmpInfoHeader infoHeader; @@ -1053,7 +1053,7 @@ bool LoadBmpHeader( const ImageLoader::Input& input, unsigned int& width, unsign return ret; } -bool LoadBitmapFromBmp( const ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ) +bool LoadBitmapFromBmp( const Dali::ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ) { //DALI_ASSERT_DEBUG( bitmap.GetPackedPixelsProfile() != 0 && "Need a packed pixel bitmap to load into." ); FILE* const fp = input.file; diff --git a/dali/internal/imaging/common/loader-bmp.h b/dali/internal/imaging/common/loader-bmp.h old mode 100644 new mode 100755 index 639e3fe..c77c09f --- a/dali/internal/imaging/common/loader-bmp.h +++ b/dali/internal/imaging/common/loader-bmp.h @@ -19,7 +19,7 @@ */ #include -#include +#include namespace Dali { @@ -47,7 +47,7 @@ const unsigned char MAGIC_BYTE_2 = 0x4D; * @param[out] bitmap The bitmap class where the decoded image will be stored * @return true if file decoded successfully, false otherwise */ -bool LoadBitmapFromBmp( const ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ); +bool LoadBitmapFromBmp( const Dali::ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ); /** * Loads the header of a BMP file and fills in the width and height appropriately. @@ -57,7 +57,7 @@ bool LoadBitmapFromBmp( const ImageLoader::Input& input, Dali::Devel::PixelBuffe * @param[out] height Is set with the height of the image * @return true if the file's header was read successully, false otherwise */ -bool LoadBmpHeader( const ImageLoader::Input& input, unsigned int& width, unsigned int& height ); +bool LoadBmpHeader( const Dali::ImageLoader::Input& input, unsigned int& width, unsigned int& height ); } // namespace TizenPlatform diff --git a/dali/internal/imaging/common/loader-gif.cpp b/dali/internal/imaging/common/loader-gif.cpp old mode 100644 new mode 100755 index a7b1bee..cf9b010 --- a/dali/internal/imaging/common/loader-gif.cpp +++ b/dali/internal/imaging/common/loader-gif.cpp @@ -271,7 +271,7 @@ bool HandleExtensionRecordType( GifFileType* gifInfo ) } // unnamed namespace -bool LoadGifHeader( const ImageLoader::Input& input, unsigned int& width, unsigned int& height ) +bool LoadGifHeader( const Dali::ImageLoader::Input& input, unsigned int& width, unsigned int& height ) { GifFileType* gifInfo = NULL; AutoCleanupGif autoCleanupGif(gifInfo); @@ -280,7 +280,7 @@ bool LoadGifHeader( const ImageLoader::Input& input, unsigned int& width, unsign return LoadGifHeader(fp, width, height, &gifInfo); } -bool LoadBitmapFromGif( const ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ) +bool LoadBitmapFromGif( const Dali::ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ) { FILE* const fp = input.file; // Load the GIF Header file. diff --git a/dali/internal/imaging/common/loader-gif.h b/dali/internal/imaging/common/loader-gif.h old mode 100644 new mode 100755 index 981a885..28ed05c --- a/dali/internal/imaging/common/loader-gif.h +++ b/dali/internal/imaging/common/loader-gif.h @@ -19,7 +19,7 @@ */ #include -#include +#include namespace Dali { @@ -48,7 +48,7 @@ const unsigned char MAGIC_BYTE_2 = 0x49; * @param[out] bitmap The bitmap class where the decoded image will be stored * @return true if file decoded successfully, false otherwise */ -bool LoadBitmapFromGif( const ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ); +bool LoadBitmapFromGif( const Dali::ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ); /** * Loads the header of a GIF file and fills in the width and height appropriately. @@ -58,7 +58,7 @@ bool LoadBitmapFromGif( const ImageLoader::Input& input, Dali::Devel::PixelBuffe * @param[in/out] height Is set with the height of the image * @return true if the file's header was read successully, false otherwise */ -bool LoadGifHeader( const ImageLoader::Input& input, unsigned int& width, unsigned int& height ); +bool LoadGifHeader( const Dali::ImageLoader::Input& input, unsigned int& width, unsigned int& height ); } // namespace TizenPlatform diff --git a/dali/internal/imaging/common/loader-ico.cpp b/dali/internal/imaging/common/loader-ico.cpp old mode 100644 new mode 100755 index e8daa07..dc99750 --- a/dali/internal/imaging/common/loader-ico.cpp +++ b/dali/internal/imaging/common/loader-ico.cpp @@ -337,7 +337,7 @@ bool LoadIcoHeaderHelper( FILE* fp, }//unnamed namespace -bool LoadIcoHeader( const ImageLoader::Input& input, unsigned int& width, unsigned int& height ) +bool LoadIcoHeader( const Dali::ImageLoader::Input& input, unsigned int& width, unsigned int& height ) { IcoData chosen; Dali::Vector map; @@ -355,7 +355,7 @@ bool LoadIcoHeader( const ImageLoader::Input& input, unsigned int& width, unsign return true; } -bool LoadBitmapFromIco( const ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ) +bool LoadBitmapFromIco( const Dali::ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ) { IcoData chosen; Dali::Vector map; diff --git a/dali/internal/imaging/common/loader-ico.h b/dali/internal/imaging/common/loader-ico.h old mode 100644 new mode 100755 index 32df88c..a8f9e80 --- a/dali/internal/imaging/common/loader-ico.h +++ b/dali/internal/imaging/common/loader-ico.h @@ -19,7 +19,7 @@ */ #include -#include +#include namespace Dali { @@ -44,7 +44,7 @@ const unsigned char MAGIC_BYTE_2 = 0x00; * @param[out] bitmap The bitmap class where the decoded image will be stored * @return true if file decoded successfully, false otherwise */ -bool LoadBitmapFromIco( const ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ); +bool LoadBitmapFromIco( const Dali::ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ); /** * @param[in] input Information about the input image (including file pointer) @@ -52,7 +52,7 @@ bool LoadBitmapFromIco( const ImageLoader::Input& input, Dali::Devel::PixelBuffe * @param[out] height of image * @return true if header loaded successfully, false otherwise */ -bool LoadIcoHeader( const ImageLoader::Input& input, unsigned int& width, unsigned int& height ); +bool LoadIcoHeader( const Dali::ImageLoader::Input& input, unsigned int& width, unsigned int& height ); } diff --git a/dali/internal/imaging/common/loader-jpeg-turbo.cpp b/dali/internal/imaging/common/loader-jpeg-turbo.cpp old mode 100644 new mode 100755 index 7d78d71..1fab9a2 --- a/dali/internal/imaging/common/loader-jpeg-turbo.cpp +++ b/dali/internal/imaging/common/loader-jpeg-turbo.cpp @@ -528,7 +528,7 @@ bool LoadJpegHeader( FILE *fp, unsigned int &width, unsigned int &height ) return true; } -bool LoadBitmapFromJpeg( const ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ) +bool LoadBitmapFromJpeg( const Dali::ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ) { const int flags= 0; FILE* const fp = input.file; @@ -1114,7 +1114,7 @@ ExifHandle LoadExifData( FILE* fp ) return exifData; } -bool LoadJpegHeader( const ImageLoader::Input& input, unsigned int& width, unsigned int& height ) +bool LoadJpegHeader( const Dali::ImageLoader::Input& input, unsigned int& width, unsigned int& height ) { unsigned int requiredWidth = input.scalingParameters.dimensions.GetWidth(); unsigned int requiredHeight = input.scalingParameters.dimensions.GetHeight(); diff --git a/dali/internal/imaging/common/loader-jpeg.h b/dali/internal/imaging/common/loader-jpeg.h old mode 100644 new mode 100755 index feb4f8f..987b338 --- a/dali/internal/imaging/common/loader-jpeg.h +++ b/dali/internal/imaging/common/loader-jpeg.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include namespace Dali { @@ -50,7 +50,7 @@ const unsigned char MAGIC_BYTE_2 = 0xD8; * @param[out] bitmap The bitmap class where the decoded image will be stored * @return true if file decoded successfully, false otherwise */ -bool LoadBitmapFromJpeg( const ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ); +bool LoadBitmapFromJpeg( const Dali::ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ); /** * Loads the header of a JPEG file and fills in the width and height appropriately. @@ -63,7 +63,7 @@ bool LoadBitmapFromJpeg( const ImageLoader::Input& input, Dali::Devel::PixelBuff * @param[in/out] height Is set with the height of the image * @return true if the file's header was read successully, false otherwise */ -bool LoadJpegHeader( const ImageLoader::Input& input, unsigned int& width, unsigned int& height ); +bool LoadJpegHeader( const Dali::ImageLoader::Input& input, unsigned int& width, unsigned int& height ); /** * Encode raw pixel data to JPEG format. diff --git a/dali/internal/imaging/common/loader-ktx.cpp b/dali/internal/imaging/common/loader-ktx.cpp old mode 100644 new mode 100755 index abaad26..e431239 --- a/dali/internal/imaging/common/loader-ktx.cpp +++ b/dali/internal/imaging/common/loader-ktx.cpp @@ -523,7 +523,7 @@ bool LoadKtxHeader( FILE * const fp, unsigned int& width, unsigned int& height, } // unnamed namespace // File loading API entry-point: -bool LoadKtxHeader( const ImageLoader::Input& input, unsigned int& width, unsigned int& height ) +bool LoadKtxHeader( const Dali::ImageLoader::Input& input, unsigned int& width, unsigned int& height ) { KtxFileHeader fileHeader; FILE* const fp = input.file; @@ -533,7 +533,7 @@ bool LoadKtxHeader( const ImageLoader::Input& input, unsigned int& width, unsign } // File loading API entry-point: -bool LoadBitmapFromKtx( const ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ) +bool LoadBitmapFromKtx( const Dali::ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ) { DALI_COMPILE_TIME_ASSERT( sizeof(Byte) == 1); DALI_COMPILE_TIME_ASSERT( sizeof(uint32_t) == 4); diff --git a/dali/internal/imaging/common/loader-ktx.h b/dali/internal/imaging/common/loader-ktx.h old mode 100644 new mode 100755 index ee31cb1..966d14d --- a/dali/internal/imaging/common/loader-ktx.h +++ b/dali/internal/imaging/common/loader-ktx.h @@ -19,7 +19,7 @@ */ #include -#include +#include namespace Dali { @@ -47,7 +47,7 @@ const unsigned char MAGIC_BYTE_2 = 0x4B; * @param[out] bitmap The bitmap class where the decoded image will be stored * @return true if file loaded successfully, false otherwise */ -bool LoadBitmapFromKtx( const ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ); +bool LoadBitmapFromKtx( const Dali::ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ); /** * Loads the header of a KTX file and fills in the width and height appropriately. @@ -57,7 +57,7 @@ bool LoadBitmapFromKtx( const ImageLoader::Input& input, Dali::Devel::PixelBuffe * @param[out] height Is set with the height of the image * @return true if the file's header was read successully, false otherwise */ -bool LoadKtxHeader( const ImageLoader::Input& input, unsigned int& width, unsigned int& height ); +bool LoadKtxHeader( const Dali::ImageLoader::Input& input, unsigned int& width, unsigned int& height ); } // namespace TizenPlatform diff --git a/dali/internal/imaging/common/loader-png.cpp b/dali/internal/imaging/common/loader-png.cpp old mode 100644 new mode 100755 index 0cc7153..4b51af3 --- a/dali/internal/imaging/common/loader-png.cpp +++ b/dali/internal/imaging/common/loader-png.cpp @@ -110,7 +110,7 @@ bool LoadPngHeader(FILE *fp, unsigned int &width, unsigned int &height, png_stru } // namespace - anonymous -bool LoadPngHeader( const ImageLoader::Input& input, unsigned int& width, unsigned int& height ) +bool LoadPngHeader( const Dali::ImageLoader::Input& input, unsigned int& width, unsigned int& height ) { png_structp png = NULL; png_infop info = NULL; @@ -121,7 +121,7 @@ bool LoadPngHeader( const ImageLoader::Input& input, unsigned int& width, unsign return success; } -bool LoadBitmapFromPng( const ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ) +bool LoadBitmapFromPng( const Dali::ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ) { png_structp png = NULL; png_infop info = NULL; diff --git a/dali/internal/imaging/common/loader-png.h b/dali/internal/imaging/common/loader-png.h old mode 100644 new mode 100755 index eb9c780..49b8922 --- a/dali/internal/imaging/common/loader-png.h +++ b/dali/internal/imaging/common/loader-png.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include namespace Dali { @@ -49,7 +49,7 @@ const unsigned char MAGIC_BYTE_2 = 0x50; * @param[out] bitmap The bitmap class where the decoded image will be stored * @return true if file decoded successfully, false otherwise */ -bool LoadBitmapFromPng( const ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ); +bool LoadBitmapFromPng( const Dali::ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ); /** * Loads the header of a PNG file and fills in the width and height appropriately. @@ -59,7 +59,7 @@ bool LoadBitmapFromPng( const ImageLoader::Input& input, Dali::Devel::PixelBuffe * @param[out] height Is set with the height of the image * @return true if the file's header was read successully, false otherwise */ -bool LoadPngHeader( const ImageLoader::Input& input, unsigned int& width, unsigned int& height ); +bool LoadPngHeader( const Dali::ImageLoader::Input& input, unsigned int& width, unsigned int& height ); /** * Encode raw pixel data to PNG format. diff --git a/dali/internal/imaging/common/loader-wbmp.cpp b/dali/internal/imaging/common/loader-wbmp.cpp old mode 100644 new mode 100755 index 58c3c34..6942442 --- a/dali/internal/imaging/common/loader-wbmp.cpp +++ b/dali/internal/imaging/common/loader-wbmp.cpp @@ -90,7 +90,7 @@ int extractMultiByteInteger(unsigned int *data, void *map, size_t length, size_t }// end unnamed namespace -bool LoadBitmapFromWbmp( const ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ) +bool LoadBitmapFromWbmp( const Dali::ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ) { FILE* const fp = input.file; if(fp == NULL) @@ -211,7 +211,7 @@ bool LoadBitmapFromWbmp( const ImageLoader::Input& input, Dali::Devel::PixelBuff } -bool LoadWbmpHeader( const ImageLoader::Input& input, unsigned int& width, unsigned int& height ) +bool LoadWbmpHeader( const Dali::ImageLoader::Input& input, unsigned int& width, unsigned int& height ) { FILE* const fp = input.file; if(fp == NULL) diff --git a/dali/internal/imaging/common/loader-wbmp.h b/dali/internal/imaging/common/loader-wbmp.h old mode 100644 new mode 100755 index 2e2a1a1..6995b4c --- a/dali/internal/imaging/common/loader-wbmp.h +++ b/dali/internal/imaging/common/loader-wbmp.h @@ -19,7 +19,7 @@ */ #include -#include +#include namespace Dali { @@ -39,7 +39,7 @@ class ResourceLoadingClient; * @param[out] bitmap The bitmap class where the decoded image will be stored * @return true if file decoded successfully, false otherwise */ -bool LoadBitmapFromWbmp( const ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ); +bool LoadBitmapFromWbmp( const Dali::ImageLoader::Input& input, Dali::Devel::PixelBuffer& bitmap ); /** * @param[in] input Information about the input image (including file pointer) @@ -47,7 +47,7 @@ bool LoadBitmapFromWbmp( const ImageLoader::Input& input, Dali::Devel::PixelBuff * @param[out] height of image * @return true if header loaded successfully, false otherwise */ -bool LoadWbmpHeader( const ImageLoader::Input& input, unsigned int& width, unsigned int& height ); +bool LoadWbmpHeader( const Dali::ImageLoader::Input& input, unsigned int& width, unsigned int& height ); } diff --git a/dali/internal/imaging/file.list b/dali/internal/imaging/file.list old mode 100644 new mode 100755 index 88ad0cb..6aa7fb2 --- a/dali/internal/imaging/file.list +++ b/dali/internal/imaging/file.list @@ -9,6 +9,7 @@ adaptor_imaging_common_src_files=\ ${adaptor_imaging_dir}/common/gaussian-blur.cpp \ ${adaptor_imaging_dir}/common/http-utils.cpp \ ${adaptor_imaging_dir}/common/image-loader.cpp \ + ${adaptor_imaging_dir}/common/image-loader-plugin-proxy.cpp \ ${adaptor_imaging_dir}/common/image-operations.cpp \ ${adaptor_imaging_dir}/common/loader-astc.cpp \ ${adaptor_imaging_dir}/common/loader-bmp.cpp \ -- 2.7.4