From 27493811a37274fa58201ea6f01ab17a124f3324 Mon Sep 17 00:00:00 2001 From: "dongsug.song" Date: Tue, 17 May 2016 11:21:16 +0900 Subject: [PATCH] [3.0] TC fail because of tbm surface is not supporting specific color depth - Add "IsSupportedColorDepth()" method to check which color depth is supported on a specific HW - change the API name of "IsSupportedColorDepth()" to "IsColorDepthSupported()" IsSupportedColorDepth - fix Dali server build error Change-Id: Ie2fb36bca91962a6ecd5c5054daf17ce5efea0f2 Signed-off-by: dongsug.song --- .../adaptor-framework/native-image-source.cpp | 5 +++ .../adaptor-framework/native-image-source.h | 9 ++++ adaptors/tizen/native-image-source-impl-tizen.cpp | 51 ++++++++++++++++++++++ adaptors/tizen/native-image-source-impl.h | 5 +++ adaptors/x11/native-image-source-impl-x.cpp | 5 +++ adaptors/x11/native-image-source-impl.h | 5 +++ 6 files changed, 80 insertions(+) mode change 100644 => 100755 adaptors/public-api/adaptor-framework/native-image-source.cpp mode change 100644 => 100755 adaptors/public-api/adaptor-framework/native-image-source.h mode change 100644 => 100755 adaptors/tizen/native-image-source-impl-tizen.cpp mode change 100644 => 100755 adaptors/tizen/native-image-source-impl.h mode change 100644 => 100755 adaptors/x11/native-image-source-impl-x.cpp mode change 100644 => 100755 adaptors/x11/native-image-source-impl.h diff --git a/adaptors/public-api/adaptor-framework/native-image-source.cpp b/adaptors/public-api/adaptor-framework/native-image-source.cpp old mode 100644 new mode 100755 index c4764e4..6996e73 --- a/adaptors/public-api/adaptor-framework/native-image-source.cpp +++ b/adaptors/public-api/adaptor-framework/native-image-source.cpp @@ -60,6 +60,11 @@ void NativeImageSource::SetSource( Any source ) mImpl->SetSource( source ); } +bool NativeImageSource::IsColorDepthSupported( ColorDepth colorDepth ) +{ + return mImpl->IsColorDepthSupported( colorDepth ); +} + bool NativeImageSource::GlExtensionCreate() { return mImpl->GlExtensionCreate(); diff --git a/adaptors/public-api/adaptor-framework/native-image-source.h b/adaptors/public-api/adaptor-framework/native-image-source.h old mode 100644 new mode 100755 index 2f833d9..d26511c --- a/adaptors/public-api/adaptor-framework/native-image-source.h +++ b/adaptors/public-api/adaptor-framework/native-image-source.h @@ -136,6 +136,15 @@ public: */ void SetSource( Any source ); + /** + * @brief Check if the specified color depth is supported. + * + * @SINCE_1_1.34 + * @param[in] colorDepth The color depth to check. + * @return true if colorDepth is supported, false otherwise. + */ + bool IsColorDepthSupported( ColorDepth colorDepth ); + private: // native image /** diff --git a/adaptors/tizen/native-image-source-impl-tizen.cpp b/adaptors/tizen/native-image-source-impl-tizen.cpp old mode 100644 new mode 100755 index f9d1923..f3952ae --- a/adaptors/tizen/native-image-source-impl-tizen.cpp +++ b/adaptors/tizen/native-image-source-impl-tizen.cpp @@ -311,6 +311,57 @@ void NativeImageSource::SetSource( Any source ) } } +bool NativeImageSource::IsColorDepthSupported( Dali::NativeImageSource::ColorDepth colorDepth ) +{ + uint32_t* formats; + uint32_t formatNum; + tbm_format format = TBM_FORMAT_RGB888; + + switch( colorDepth ) + { + case Dali::NativeImageSource::COLOR_DEPTH_DEFAULT: + { + format = TBM_FORMAT_RGBA8888; + break; + } + case Dali::NativeImageSource::COLOR_DEPTH_8: + { + format = TBM_FORMAT_C8; + break; + } + case Dali::NativeImageSource::COLOR_DEPTH_16: + { + format = TBM_FORMAT_RGB565; + break; + } + case Dali::NativeImageSource::COLOR_DEPTH_24: + { + format = TBM_FORMAT_RGB888; + break; + } + case Dali::NativeImageSource::COLOR_DEPTH_32: + { + format = TBM_FORMAT_RGBA8888; + break; + } + } + + if( tbm_surface_query_formats( &formats, &formatNum ) ) + { + for( unsigned int i = 0; i < formatNum; i++ ) + { + if( formats[i] == format ) + { + free( formats ); + return true; + } + } + } + + free( formats ); + return false; +} + bool NativeImageSource::GlExtensionCreate() { if( mEglImageKHR != NULL ) diff --git a/adaptors/tizen/native-image-source-impl.h b/adaptors/tizen/native-image-source-impl.h old mode 100644 new mode 100755 index 5e251b7..ceb1c50 --- a/adaptors/tizen/native-image-source-impl.h +++ b/adaptors/tizen/native-image-source-impl.h @@ -77,6 +77,11 @@ public: void SetSource( Any source ); /** + * @copydoc Dali::NativeImageSource::IsColorDepthSupported( ColorDepth colorDepth ) + */ + bool IsColorDepthSupported( Dali::NativeImageSource::ColorDepth colorDepth ); + + /** * destructor */ ~NativeImageSource(); diff --git a/adaptors/x11/native-image-source-impl-x.cpp b/adaptors/x11/native-image-source-impl-x.cpp old mode 100644 new mode 100755 index f97b681..1131d58 --- a/adaptors/x11/native-image-source-impl-x.cpp +++ b/adaptors/x11/native-image-source-impl-x.cpp @@ -287,6 +287,11 @@ void NativeImageSource::SetSource( Any source ) } } +bool NativeImageSource::IsColorDepthSupported( Dali::NativeImageSource::ColorDepth colorDepth ) +{ + return true; +} + bool NativeImageSource::GlExtensionCreate() { // if the image existed previously delete it. diff --git a/adaptors/x11/native-image-source-impl.h b/adaptors/x11/native-image-source-impl.h old mode 100644 new mode 100755 index 20f4585..b581722 --- a/adaptors/x11/native-image-source-impl.h +++ b/adaptors/x11/native-image-source-impl.h @@ -75,6 +75,11 @@ public: void SetSource( Any source ); /** + * @copydoc Dali::NativeImageSource::IsColorDepthSupported( ColorDepth colorDepth ) + */ + bool IsColorDepthSupported( Dali::NativeImageSource::ColorDepth colorDepth ); + + /** * destructor */ ~NativeImageSource(); -- 2.7.4