Updates for NativeImageInterface
[platform/core/uifw/dali-adaptor.git] / dali / internal / imaging / ubuntu-x11 / native-image-source-impl-x.cpp
old mode 100644 (file)
new mode 100755 (executable)
index 82518f5..384844d
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
@@ -28,9 +28,7 @@
 #include <dali/internal/graphics/common/egl-image-extensions.h>
 #include <dali/internal/graphics/gles/egl-graphics.h>
 #include <dali/internal/adaptor/common/adaptor-impl.h>
-#include <dali/devel-api/adaptor-framework/bitmap-saver.h>
-#include <dali/integration-api/render-surface.h>
-
+#include <dali/integration-api/adaptor-framework/render-surface-interface.h>
 
 namespace Dali
 {
@@ -265,19 +263,6 @@ bool NativeImageSourceX::GetPixels(std::vector<unsigned char>& pixbuf, unsigned&
   return success;
 }
 
-bool NativeImageSourceX::EncodeToFile(const std::string& filename) const
-{
-  std::vector< unsigned char > pixbuf;
-  unsigned int width(0), height(0);
-  Pixel::Format pixelFormat;
-
-  if(GetPixels(pixbuf, width, height, pixelFormat))
-  {
-    return Dali::EncodeToFile(&pixbuf[0], filename, pixelFormat, width, height);
-  }
-  return false;
-}
-
 void NativeImageSourceX::SetSource( Any source )
 {
   mPixmap = GetPixmapFromAny( source );
@@ -297,12 +282,12 @@ bool NativeImageSourceX::IsColorDepthSupported( Dali::NativeImageSource::ColorDe
   return true;
 }
 
-bool NativeImageSourceX::GlExtensionCreate()
+bool NativeImageSourceX::CreateResource()
 {
   // if the image existed previously delete it.
   if (mEglImageKHR != NULL)
   {
-    GlExtensionDestroy();
+    DestroyResource();
   }
 
   // casting from an unsigned int to a void *, which should then be cast back
@@ -314,7 +299,7 @@ bool NativeImageSourceX::GlExtensionCreate()
   return mEglImageKHR != NULL;
 }
 
-void NativeImageSourceX::GlExtensionDestroy()
+void NativeImageSourceX::DestroyResource()
 {
   mEglImageExtensions->DestroyImageKHR(mEglImageKHR);
 
@@ -365,6 +350,31 @@ int NativeImageSourceX::GetPixelDepth(Dali::NativeImageSource::ColorDepth depth)
   }
 }
 
+int NativeImageSourceX::GetTextureTarget() const
+{
+  return GL_TEXTURE_2D;
+}
+
+const char* NativeImageSourceX::GetCustomFragmentPrefix() const
+{
+  return nullptr;
+}
+
+const char* NativeImageSourceX::GetCustomSamplerTypename() const
+{
+  return nullptr;
+}
+
+Any NativeImageSourceX::GetNativeImageHandle() const
+{
+  return Any(mPixmap);
+}
+
+bool NativeImageSourceX::SourceChanged() const
+{
+  return false;
+}
+
 Ecore_X_Pixmap NativeImageSourceX::GetPixmapFromAny(Any pixmap) const
 {
   if (pixmap.Empty())
@@ -403,6 +413,17 @@ void NativeImageSourceX::GetPixmapDetails()
   mBlendingRequired = ( depth == 32 || depth == 8 );
 }
 
+uint8_t* NativeImageSourceX::AcquireBuffer( uint16_t& width, uint16_t& height, uint16_t& stride )
+{
+  return NULL;
+}
+
+
+bool NativeImageSourceX::ReleaseBuffer()
+{
+  return false;
+}
+
 } // namespace Adaptor
 
 } // namespace internal