Separating integration-devel from devel package for 2nd party to use adaptor #2 ...
[platform/core/uifw/dali-adaptor.git] / adaptors / integration-api / x11 / ecore-x-render-surface.h
@@ -1,5 +1,5 @@
-#ifndef __DALI_INTERNAL_ECORE_X_RENDER_SURFACE_H__
-#define __DALI_INTERNAL_ECORE_X_RENDER_SURFACE_H__
+#ifndef __DALI_ECORE_X_RENDER_SURFACE_H__
+#define __DALI_ECORE_X_RENDER_SURFACE_H__
 
 /*
  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
  */
 
 // EXTERNAL INCLUDES
-#include <string>
-#include <boost/thread.hpp>
 #include <Ecore_X.h>
 #include <dali/public-api/common/dali-common.h>
 
 // INTERNAL INCLUDES
-#include <render-surface-impl.h>
+#include <render-surface.h>
 #include <ecore-x-types.h>
-#include <gl/egl-implementation.h>
+#include <egl-interface.h>
 
 namespace Dali
 {
 
-namespace Internal
-{
-
-namespace Adaptor
-{
-class TriggerEvent;
+class TriggerEventInterface;
 
 namespace ECore
 {
@@ -47,31 +40,27 @@ namespace ECore
  * @todo change namespace to ECore_X11 as the class
  * is no longer pure X11.
  */
-class RenderSurface : public Internal::Adaptor::RenderSurface
+class DALI_IMPORT_API EcoreXRenderSurface : public Dali::RenderSurface
 {
 public:
   /**
     * Uses an X11 surface to render to.
-    * @param [in] type the type of surface passed in
     * @param [in] positionSize the position and size of the surface
     * @param [in] surface can be a X-window or X-pixmap (type must be unsigned int).
-    * @param [in] display connection to X-server if the surface is a X window or pixmap (type must be void * to X display struct)
     * @param [in] name optional name of surface passed in
     * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit
     */
-  RenderSurface( SurfaceType type,
-                 Dali::PositionSize positionSize,
-                 Any surface,
-                 Any display,
-                 const std::string& name,
-                 bool isTransparent = false);
+  EcoreXRenderSurface(Dali::PositionSize positionSize,
+                      Any surface,
+                      const std::string& name,
+                      bool isTransparent = false);
 
   /**
    * Destructor.
    * Will delete the display, if it has ownership.
    * Will delete the window/pixmap if it has owner ship
    */
-  virtual ~RenderSurface();
+  virtual ~EcoreXRenderSurface();
 
 protected:
   /**
@@ -83,114 +72,91 @@ protected:
 public: // API
 
   /**
-   * @return the Ecore X window handle
-   */
-  Ecore_X_Window GetXWindow();
-
-  /**
-   * @return the Main X display
+   * @brief Sets the render notification trigger to call when render thread is completed a frame
+   *
+   * @param renderNotification to use
    */
-  XDisplay* GetMainDisplay();
+  void SetRenderNotification(TriggerEventInterface* renderNotification);
 
   /**
-   * Sets the render notification trigger to call when render thread is completed a frame
-   * @param renderNotification to use
+   * @brief Get window handle
+   *
+   * @return the Ecore X window handle
    */
-  void SetRenderNotification( TriggerEvent* renderNotification );
+  Ecore_X_Window GetXWindow();
 
   /**
    * Get the surface as an Ecore_X_drawable
    */
   virtual Ecore_X_Drawable GetDrawable();
 
-public: // from Dali::RenderSurface
-
   /**
-   * @copydoc Dali::RenderSurface::GetType()
-   */
-  virtual Dali::RenderSurface::SurfaceType GetType() = 0;
-
-  /**
-   * @copydoc Dali::RenderSurface::GetSurface()
+   * @brief Get the render surface the adaptor is using to render to.
+   *
+   * @return reference to current render surface (eg, pixmap / window)
    */
   virtual Any GetSurface() = 0;
 
-  /**
-   * @copydoc Dali::RenderSurface::GetDisplay()
-   */
-  virtual Any GetDisplay();
+public: // from Dali::RenderSurface
 
   /**
    * @copydoc Dali::RenderSurface::GetPositionSize()
    */
   virtual PositionSize GetPositionSize() const;
 
-public:  // from Internal::Adaptor::RenderSurface
+  /**
+   * @copydoc Dali::RenderSurface::InitializeEgl()
+   */
+  virtual void InitializeEgl( EglInterface& egl ) = 0;
 
   /**
-   * @copydoc Dali::Internal::Adaptor::RenderSurface::CreateEglSurface()
+   * @copydoc Dali::RenderSurface::CreateEglSurface()
    */
   virtual void CreateEglSurface( EglInterface& egl ) = 0;
 
   /**
-   * @copydoc Dali::Internal::Adaptor::RenderSurface::DestroyEglSurface()
+   * @copydoc Dali::RenderSurface::DestroyEglSurface()
    */
   virtual void DestroyEglSurface( EglInterface& egl ) = 0;
 
   /**
-   * @copydoc Dali::Internal::Adaptor::RenderSurface::ReplaceEGLSurface()
+   * @copydoc Dali::RenderSurface::ReplaceEGLSurface()
    */
   virtual bool ReplaceEGLSurface( EglInterface& egl ) = 0;
 
   /**
-   * @copydoc Dali::Internal::Adaptor::RenderSurface::MoveResize()
+   * @copydoc Dali::RenderSurface::MoveResize()
    */
   virtual void MoveResize( Dali::PositionSize positionSize);
 
   /**
-   * @copydoc Dali::Internal::Adaptor::RenderSurface::GetDpi()
-   */
-  virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) const;
-
-  /**
-   * @copydoc Dali::Internal::Adaptor::RenderSurface::Map()
-   */
-  virtual void Map();
-
-  /**
-   * @copydoc Dali::Internal::Adaptor::RenderSurface::TransferDisplayOwner()
+   * @copydoc Dali::RenderSurface::SetViewMode()
    */
-  virtual void TransferDisplayOwner( Internal::Adaptor::RenderSurface& newSurface );
+  void SetViewMode( ViewMode viewMode );
 
   /**
-   * @copydoc Dali::Internal::Adaptor::RenderSurface::ConsumeEvents()
+   * @copydoc Dali::RenderSurface::StartRender()
    */
-  virtual void ConsumeEvents();
+  virtual void StartRender() = 0;
 
   /**
-   * @copydoc Dali::Internal::Adaptor::RenderSurface::SetViewMode()
+   * @copydoc Dali::RenderSurface::PreRender()
    */
-  void SetViewMode( ViewMode );
+  virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction ) = 0;
 
   /**
-   * @copydoc Dali::Internal::Adaptor::RenderSurface::PreRender()
+   * @copydoc Dali::RenderSurface::PostRender()
    */
-  virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction ) = 0;
+  virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, unsigned int deltaTime, bool replacingSurface ) = 0;
 
   /**
-   * @copydoc Dali::Internal::Adaptor::RenderSurface::PostRender()
+   * @copydoc Dali::RenderSurface::ReleaseLock()
    */
-  virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, unsigned int timeDelta, bool replacingSurface ) = 0;
+  virtual void ReleaseLock() = 0;
 
 private:
 
   /**
-   * Sets the display, if display parameter is empty it opens a new display
-   * @param display
-   */
-  void SetDisplay( Any display );
-
-  /**
    * Get the surface id if the surface parameter is not empty
    * @param surface Any containing a surface id, or can be empty
    * @return surface id, or zero if surface is empty
@@ -212,23 +178,15 @@ protected:
 
 protected: // Data
 
-  XDisplay*                   mMainDisplay;        ///< X-connection for rendering
-  SurfaceType                 mType;               ///< type of renderable
   PositionSize                mPosition;           ///< Position
   std::string                 mTitle;              ///< Title of window which shows from "xinfo -topvwins" command
+  TriggerEventInterface*      mRenderNotification; ///< Render notification trigger
   ColorDepth                  mColorDepth;         ///< Color depth of surface (32 bit or 24 bit)
-  TriggerEvent*               mRenderNotification; ///< Render notification trigger
-
   bool                        mOwnSurface;         ///< Whether we own the surface (responsible for deleting it)
-  bool                        mOwnDisplay;         ///< Whether we own the display (responsible for deleting it)
 };
 
 } // namespace ECore
 
-} // namespace Adaptor
-
-} // namespace internal
-
 } // namespace Dali
 
-#endif // __DALI_INTERNAL_ECORE_X_RENDER_SURFACE_H__
+#endif // __DALI_ECORE_X_RENDER_SURFACE_H__