Merge "Automated test fix for framebuffer creation" into devel/master
[platform/core/uifw/dali-adaptor.git] / adaptors / wayland / pixmap-image-impl-wl.cpp
index 70a6423..3ebc0e7 100644 (file)
 
 // EXTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
-#include <render-surface.h>
 
 // INTERNAL INCLUDES
 #include <gl/egl-image-extensions.h>
 #include <gl/egl-factory.h>
 #include <adaptor-impl.h>
+#include <render-surface.h>
 
 // Allow this to be encoded and saved:
-#include <platform-abstractions/slp/resource-loader/resource-loader.h>
+#include <platform-abstractions/tizen/resource-loader/resource-loader.h>
 #include <bitmap-saver.h>
 
 namespace Dali
@@ -59,7 +59,6 @@ PixmapImage::PixmapImage( unsigned int width, unsigned int height, Dali::PixmapI
 : mWidth( width ),
   mHeight( height ),
   mOwnPixmap( true ),
-  mPixelFormat( Pixel::RGB888 ),
   mColorDepth( depth ),
   mEglImageKHR( NULL ),
   mEglImageExtensions( NULL )
@@ -67,6 +66,8 @@ PixmapImage::PixmapImage( unsigned int width, unsigned int height, Dali::PixmapI
   DALI_ASSERT_ALWAYS( Adaptor::IsAvailable() );
   EglFactory& eglFactory = Adaptor::GetImplementation( Adaptor::Get() ).GetEGLFactory();
   mEglImageExtensions = eglFactory.GetImageExtensions();
+  SetBlending( mColorDepth );
+
   DALI_ASSERT_DEBUG( mEglImageExtensions );
 }
 
@@ -78,6 +79,12 @@ PixmapImage::~PixmapImage()
 {
 }
 
+Any PixmapImage::GetPixmap() const
+{
+  DALI_ASSERT_ALWAYS( false && "PixmapImage::GetPixmap() is not supported for Wayland." );
+  return Any();
+}
+
 bool PixmapImage::GetPixels(std::vector<unsigned char>& pixbuf, unsigned& width, unsigned& height, Pixel::Format& pixelFormat) const
 {
     return false;
@@ -115,59 +122,25 @@ unsigned int PixmapImage::TargetTexture()
   return 0;
 }
 
-int PixmapImage::GetPixelDepth(Dali::PixmapImage::ColorDepth depth) const
+void PixmapImage::SetBlending(Dali::PixmapImage::ColorDepth depth)
 {
   switch (depth)
   {
-    case Dali::PixmapImage::COLOR_DEPTH_8:
-    {
-      return 8;
-    }
-    case Dali::PixmapImage::COLOR_DEPTH_16:
-    {
-      return 16;
-    }
-    case Dali::PixmapImage::COLOR_DEPTH_24:
-    {
-      return 24;
-    }
-    case Dali::PixmapImage::COLOR_DEPTH_32:
-    {
-      return 32;
-    }
-    default:
+    case Dali::PixmapImage::COLOR_DEPTH_16: //Pixel::RGB565
+    case Dali::PixmapImage::COLOR_DEPTH_24: // Pixel::RGB888
     {
-      DALI_ASSERT_DEBUG(0 && "unknown color enum");
-      return 0;
-    }
-  }
-}
-
-void PixmapImage::SetPixelFormat(int depth)
-{
-  // store the pixel format based on the depth
-  switch (depth)
-  {
-    case 8:
-    {
-      mPixelFormat = Pixel::A8;
+      mBlendingRequired = false;
       break;
     }
-    case 16:
+    case Dali::PixmapImage::COLOR_DEPTH_8: //Pixel::A8
+    case Dali::PixmapImage::COLOR_DEPTH_32: // Pixel::RGBA8888
     {
-      mPixelFormat = Pixel::RGB565;
+      mBlendingRequired = true;
       break;
     }
-    case 32:
-    {
-      mPixelFormat = Pixel::RGBA8888;
-      break;
-    }
-    case 24:
     default:
     {
-      mPixelFormat = Pixel::RGB888;
-      break;
+      DALI_ASSERT_DEBUG(0 && "unknown color enum");
     }
   }
 }