[3.0] NativeImageSource with tbm_surface for tizen 3.0 wayland
[platform/core/uifw/dali-adaptor.git] / adaptors / tizen / native-image-source-impl.h
@@ -19,6 +19,8 @@
  */
 
 // EXTERNAL INCLUDES
+#include <tbm_surface.h>
+#include <dali/devel-api/images/native-image-interface-extension.h>
 
 // INTERNAL INCLUDES
 #include <native-image-source.h>
@@ -36,7 +38,7 @@ class EglImageExtensions;
 /**
  * Dali internal NativeImageSource.
  */
-class NativeImageSource
+class NativeImageSource: public NativeImageInterface::Extension
 {
 public:
 
@@ -70,6 +72,11 @@ public:
   bool EncodeToFile(const std::string& filename) const;
 
   /**
+   * @copydoc Dali::NativeImageSource::SetNativeImageSource( Any nativeImageSource )
+   */
+  void SetNativeImageSource( Any nativeImageSource );
+
+  /**
    * destructor
    */
   ~NativeImageSource();
@@ -113,6 +120,24 @@ public:
     return mBlendingRequired;
   }
 
+  /**
+   * @copydoc Dali::NativeImageInterface::GetExtension()
+   */
+  NativeImageInterface::Extension* GetNativeImageInterfaceExtension()
+  {
+    return this;
+  }
+
+  /**
+   * @copydoc Dali::NativeImageInterface::Extension::GetCustomFragmentPreFix()
+   */
+  const char* GetCustomFragmentPreFix();
+
+  /**
+   * @copydoc Dali::NativeImageInterface::Extension::GetCustomSamplerTypename()
+   */
+  const char* GetCustomSamplerTypename();
+
 private:
 
   /**
@@ -127,22 +152,18 @@ private:
               Dali::NativeImageSource::ColorDepth depth,
               Any nativeImageSource);
 
-  /**
-   * 2nd phase construction.
-   */
   void Initialize();
 
-  /**
-   * Decide whether blending is required based on the color depth.
-   * @param depth the PixelImage depth enum
-   */
-  void SetBlending(Dali::NativeImageSource::ColorDepth depth);
+  int GetPixelDepth(Dali::NativeImageSource::ColorDepth depth) const;
+
+  tbm_surface_h GetSurfaceFromAny( Any source ) const;
 
 private:
 
   unsigned int mWidth;                        ///< image width
   unsigned int mHeight;                       ///< image heights
-  bool mOwnPixmap;                            ///< Whether we created pixmap or not
+  bool mOwnTbmsurface;                            ///< Whether we created pixmap or not
+  tbm_surface_h mTbmsurface;
   bool mBlendingRequired;                      ///< Whether blending is required
   Dali::NativeImageSource::ColorDepth mColorDepth;  ///< color depth of image
   void* mEglImageKHR;                         ///< From EGL extension