TC fail because of tbm surface is not supporting specific color depth 16/69816/11
authordongsug.song <dongsug.song@samsung.com>
Tue, 17 May 2016 02:21:16 +0000 (11:21 +0900)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Thu, 19 May 2016 13:04:52 +0000 (06:04 -0700)
 - 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 <dongsug.song@samsung.com>
adaptors/public-api/adaptor-framework/native-image-source.cpp [changed mode: 0644->0755]
adaptors/public-api/adaptor-framework/native-image-source.h [changed mode: 0644->0755]
adaptors/tizen/native-image-source-impl-tizen.cpp [changed mode: 0644->0755]
adaptors/tizen/native-image-source-impl.h [changed mode: 0644->0755]
adaptors/x11/native-image-source-impl-x.cpp [changed mode: 0644->0755]
adaptors/x11/native-image-source-impl.h [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index c4764e4..6996e73
@@ -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();
old mode 100644 (file)
new mode 100755 (executable)
index 2f833d9..d26511c
@@ -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
 
   /**
old mode 100644 (file)
new mode 100755 (executable)
index f9d1923..f3952ae
@@ -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 )
old mode 100644 (file)
new mode 100755 (executable)
index 5e251b7..ceb1c50
@@ -77,6 +77,11 @@ public:
   void SetSource( Any source );
 
   /**
+   * @copydoc Dali::NativeImageSource::IsColorDepthSupported( ColorDepth colorDepth )
+   */
+  bool IsColorDepthSupported( Dali::NativeImageSource::ColorDepth colorDepth );
+
+  /**
    * destructor
    */
   ~NativeImageSource();
old mode 100644 (file)
new mode 100755 (executable)
index f97b681..1131d58
@@ -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.
old mode 100644 (file)
new mode 100755 (executable)
index 20f4585..b581722
@@ -75,6 +75,11 @@ public:
   void SetSource( Any source );
 
   /**
+   * @copydoc Dali::NativeImageSource::IsColorDepthSupported( ColorDepth colorDepth )
+   */
+  bool IsColorDepthSupported( Dali::NativeImageSource::ColorDepth colorDepth );
+
+  /**
    * destructor
    */
   ~NativeImageSource();