Merge "[3.0] Modify native render surface for sync. with replace surface" into tizen_3.0 accepted/tizen/3.0/common/20161124.181854 accepted/tizen/3.0/ivi/20161124.030241 accepted/tizen/3.0/mobile/20161124.030050 accepted/tizen/3.0/tv/20161124.030142 accepted/tizen/3.0/wearable/20161124.030211 submit/tizen_3.0/20161123.111804
authortaeyoon <taeyoon0.lee@samsung.com>
Wed, 23 Nov 2016 09:27:34 +0000 (01:27 -0800)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Wed, 23 Nov 2016 09:27:35 +0000 (01:27 -0800)
adaptors/ecore/wayland/event-handler-ecore-wl.cpp
adaptors/ecore/wayland/window-impl-ecore-wl.cpp
adaptors/tizen/key-grab.h
adaptors/tizen/native-image-source-impl-tizen.cpp
adaptors/tizen/native-image-source-impl.h
adaptors/wearable/watch/watch-application.h
adaptors/wearable/watch/watch-time.h

index 81c4a0d..1b3012d 100644 (file)
@@ -293,6 +293,9 @@ struct EventHandler::Impl
       mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_DATA_SOURCE_SEND, EcoreEventDataSend, handler ) );
       mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_SELECTION_DATA_READY, EcoreEventDataReceive, handler ) );
 
+      // Register Rotate event
+      mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_WINDOW_ROTATE, EcoreEventRotate, handler) );
+
       // Register Detent event
       mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_DETENT_ROTATE, EcoreEventDetent, handler) );
 
@@ -1151,6 +1154,31 @@ struct EventHandler::Impl
    }
 
   /*
+  * Called when rotate event is recevied
+  */
+  static Eina_Bool EcoreEventRotate( void* data, int type, void* event )
+  {
+    DALI_LOG_INFO( gSelectionEventLogFilter, Debug::Concise, "EcoreEventRotate\n" );
+
+    EventHandler* handler( (EventHandler*)data );
+    Ecore_Wl_Event_Window_Rotate* ev( (Ecore_Wl_Event_Window_Rotate*)event );
+
+    if( ev->win != (unsigned int)ecore_wl_window_id_get( handler->mImpl->mWindow ) )
+    {
+      return ECORE_CALLBACK_PASS_ON;
+    }
+
+    RotationEvent rotationEvent;
+    rotationEvent.angle = ev->angle;
+    rotationEvent.winResize = 0;
+    rotationEvent.width = ev->w;
+    rotationEvent.height = ev->h;
+    handler->SendRotationPrepareEvent( rotationEvent );
+
+    return ECORE_CALLBACK_PASS_ON;
+  }
+
+  /*
   * Called when detent event is recevied
   */
   static Eina_Bool EcoreEventDetent( void* data, int type, void* event )
@@ -1306,15 +1334,13 @@ void EventHandler::SendRotationPrepareEvent( const RotationEvent& event )
   if( mRotationObserver != NULL )
   {
     mRotationObserver->OnRotationPrepare( event );
+    mRotationObserver->OnRotationRequest();
   }
 }
 
 void EventHandler::SendRotationRequestEvent( )
 {
-  if( mRotationObserver != NULL )
-  {
-    mRotationObserver->OnRotationRequest( );
-  }
+  // No need to separate event into prepare and request in wayland
 }
 
 void EventHandler::FeedTouchPoint( TouchPoint& point, int timeStamp)
index 184299c..2160e4f 100644 (file)
@@ -466,14 +466,17 @@ void Window::SetIndicatorActorRotation()
 
 void Window::Raise()
 {
+  ecore_wl_window_raise( mEventHandler->mEcoreWindow );
 }
 
 void Window::Lower()
 {
+  ecore_wl_window_lower( mEventHandler->mEcoreWindow );
 }
 
 void Window::Activate()
 {
+  ecore_wl_window_activate( mEventHandler->mEcoreWindow );
 }
 
 Dali::DragAndDropDetector Window::GetDragAndDropDetector() const
@@ -565,7 +568,12 @@ void Window::RemoveAvailableOrientation(Dali::Window::WindowOrientation orientat
 
 void Window::SetAvailableOrientations(const std::vector<Dali::Window::WindowOrientation>& orientations)
 {
-  DALI_ASSERT_ALWAYS( mAvailableOrientations.size() <= 4 && "Incorrect number of available orientations" );
+  int rotations[4];
+  for( std::size_t i = 0; i < mAvailableOrientations.size(); ++i )
+  {
+    rotations[i] = static_cast< int >( mAvailableOrientations[i] );
+  }
+  ecore_wl_window_rotation_available_rotations_set( mEventHandler->mEcoreWindow, rotations, mAvailableOrientations.size() );
 }
 
 const std::vector<Dali::Window::WindowOrientation>& Window::GetAvailableOrientations()
@@ -576,6 +584,8 @@ const std::vector<Dali::Window::WindowOrientation>& Window::GetAvailableOrientat
 void Window::SetPreferredOrientation(Dali::Window::WindowOrientation orientation)
 {
   mPreferredOrientation = orientation;
+
+  ecore_wl_window_rotation_preferred_rotation_set( mEventHandler->mEcoreWindow, orientation );
 }
 
 Dali::Window::WindowOrientation Window::GetPreferredOrientation()
@@ -585,6 +595,7 @@ Dali::Window::WindowOrientation Window::GetPreferredOrientation()
 
 void Window::RotationDone( int orientation, int width, int height )
 {
+  ecore_wl_window_rotation_change_done_send( mEventHandler->mEcoreWindow );
 }
 
 
index ff310e5..56d6c05 100755 (executable)
@@ -113,7 +113,7 @@ DALI_IMPORT_API bool UngrabKey( Window window, Dali::KEY daliKey );
 
 /**
  * @PLATFORM
- * @brief Grabs the list of keys specfied by @Dali::Vector of keys for @a window in @Vector of grabModes.
+ * @brief Grabs the list of keys specfied by Dali::Vector of keys for @a window in Vector of grabModes.
  *
  * @details This function can be used for following example scenarios:
  * - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app.
@@ -133,7 +133,7 @@ DALI_IMPORT_API Dali::Vector<bool> GrabKeyList( Window window, const Dali::Vecto
 
 /**
  * @PLATFORM
- * @brief Ungrabs the list of keys specfied by @Dali::Vector of keys for @a window.
+ * @brief Ungrabs the list of keys specfied by Dali::Vector of keys for @a window.
  *
  * @SINCE_1_2.0
  * @PRIVLEVEL_PLATFORM
index e998ed4..38000a9 100755 (executable)
@@ -46,6 +46,21 @@ namespace
 {
 const char* FRAGMENT_PREFIX = "#extension GL_OES_EGL_image_external:require\n";
 const char* SAMPLER_TYPE = "samplerExternalOES";
+
+tbm_format FORMATS_BLENDING_REQUIRED[] = {
+  TBM_FORMAT_ARGB4444, TBM_FORMAT_ABGR4444,
+  TBM_FORMAT_RGBA4444, TBM_FORMAT_BGRA4444,
+  TBM_FORMAT_RGBX5551, TBM_FORMAT_BGRX5551,
+  TBM_FORMAT_ARGB1555, TBM_FORMAT_ABGR1555,
+  TBM_FORMAT_RGBA5551, TBM_FORMAT_BGRA5551,
+  TBM_FORMAT_ARGB8888, TBM_FORMAT_ABGR8888,
+  TBM_FORMAT_RGBA8888, TBM_FORMAT_BGRA8888,
+  TBM_FORMAT_ARGB2101010, TBM_FORMAT_ABGR2101010,
+  TBM_FORMAT_RGBA1010102, TBM_FORMAT_BGRA1010102
+};
+
+const int NUM_FORMATS_BLENDING_REQUIRED = 18;
+
 }
 
 using Dali::Integration::PixelBuffer;
@@ -66,8 +81,8 @@ NativeImageSource* NativeImageSource::New(unsigned int width, unsigned int heigh
 NativeImageSource::NativeImageSource( unsigned int width, unsigned int height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource )
 : mWidth( width ),
   mHeight( height ),
-  mOwnTbmsurface( false ),
-  mTbmsurface( NULL ),
+  mOwnTbmSurface( false ),
+  mTbmSurface( NULL ),
   mBlendingRequired( false ),
   mColorDepth( depth ),
   mEglImageKHR( NULL ),
@@ -79,18 +94,19 @@ NativeImageSource::NativeImageSource( unsigned int width, unsigned int height, D
   mEglImageExtensions = eglFactory.GetImageExtensions();
   DALI_ASSERT_DEBUG( mEglImageExtensions );
 
-  mTbmsurface = GetSurfaceFromAny( nativeImageSource );
+  mTbmSurface = GetSurfaceFromAny( nativeImageSource );
 
-  if( mTbmsurface != NULL )
+  if( mTbmSurface != NULL )
   {
-    mWidth = tbm_surface_get_width( mTbmsurface );
-    mHeight = tbm_surface_get_height( mTbmsurface );
+    mBlendingRequired = CheckBlending( tbm_surface_get_format( mTbmSurface ) );
+    mWidth = tbm_surface_get_width( mTbmSurface );
+    mHeight = tbm_surface_get_height( mTbmSurface );
   }
 }
 
 void NativeImageSource::Initialize()
 {
-  if( mTbmsurface != NULL || mWidth == 0 || mHeight == 0 )
+  if( mTbmSurface != NULL || mWidth == 0 || mHeight == 0 )
   {
     return;
   }
@@ -144,8 +160,8 @@ void NativeImageSource::Initialize()
      If depth = 32, Pixel::RGBA8888 */
   mBlendingRequired = ( depth == 32 || depth == 8 );
 
-  mTbmsurface = tbm_surface_create( mWidth, mHeight, format );
-  mOwnTbmsurface = true;
+  mTbmSurface = tbm_surface_create( mWidth, mHeight, format );
+  mOwnTbmSurface = true;
 }
 
 tbm_surface_h NativeImageSource::GetSurfaceFromAny( Any source ) const
@@ -167,9 +183,9 @@ tbm_surface_h NativeImageSource::GetSurfaceFromAny( Any source ) const
 
 NativeImageSource::~NativeImageSource()
 {
-  if( mOwnTbmsurface && mTbmsurface != NULL )
+  if( mOwnTbmSurface && mTbmSurface != NULL )
   {
-    if( tbm_surface_destroy( mTbmsurface ) != TBM_SURFACE_ERROR_NONE )
+    if( tbm_surface_destroy( mTbmSurface ) != TBM_SURFACE_ERROR_NONE )
     {
       DALI_LOG_ERROR( "Failed to destroy tbm_surface\n" );
     }
@@ -178,16 +194,16 @@ NativeImageSource::~NativeImageSource()
 
 Any NativeImageSource::GetNativeImageSource() const
 {
-  return Any( mTbmsurface );
+  return Any( mTbmSurface );
 }
 
 bool NativeImageSource::GetPixels(std::vector<unsigned char>& pixbuf, unsigned& width, unsigned& height, Pixel::Format& pixelFormat) const
 {
-  if( mTbmsurface != NULL )
+  if( mTbmSurface != NULL )
   {
     tbm_surface_info_s surface_info;
 
-    if( tbm_surface_map( mTbmsurface, TBM_SURF_OPTION_READ, &surface_info) != TBM_SURFACE_ERROR_NONE )
+    if( tbm_surface_map( mTbmSurface, TBM_SURF_OPTION_READ, &surface_info) != TBM_SURFACE_ERROR_NONE )
     {
       DALI_LOG_ERROR( "Fail to map tbm_surface\n" );
 
@@ -262,7 +278,7 @@ bool NativeImageSource::GetPixels(std::vector<unsigned char>& pixbuf, unsigned&
       }
     }
 
-    if( tbm_surface_unmap( mTbmsurface ) != TBM_SURFACE_ERROR_NONE )
+    if( tbm_surface_unmap( mTbmSurface ) != TBM_SURFACE_ERROR_NONE )
     {
       DALI_LOG_ERROR( "Fail to unmap tbm_surface\n" );
     }
@@ -293,24 +309,25 @@ bool NativeImageSource::EncodeToFile(const std::string& filename) const
 
 void NativeImageSource::SetSource( Any source )
 {
-  if( mOwnTbmsurface && mTbmsurface != NULL )
+  if( mOwnTbmSurface && mTbmSurface != NULL )
   {
-    if( tbm_surface_destroy( mTbmsurface ) != TBM_SURFACE_ERROR_NONE )
+    if( tbm_surface_destroy( mTbmSurface ) != TBM_SURFACE_ERROR_NONE )
     {
       DALI_LOG_ERROR( "Failed to destroy tbm_surface\n" );
     }
 
-    mTbmsurface = NULL;
-    mOwnTbmsurface = false;
+    mTbmSurface = NULL;
+    mOwnTbmSurface = false;
   }
 
-  mTbmsurface = GetSurfaceFromAny( source );
+  mTbmSurface = GetSurfaceFromAny( source );
   mSetSource = true;
 
-  if( mTbmsurface != NULL )
+  if( mTbmSurface != NULL )
   {
-    mWidth = tbm_surface_get_width( mTbmsurface );
-    mHeight = tbm_surface_get_height( mTbmsurface );
+    mBlendingRequired = CheckBlending( tbm_surface_get_format( mTbmSurface ) );
+    mWidth = tbm_surface_get_width( mTbmSurface );
+    mHeight = tbm_surface_get_height( mTbmSurface );
   }
 
   if( mEglImageKHRContainer.Size() > 2 )
@@ -377,7 +394,7 @@ bool NativeImageSource::GlExtensionCreate()
 {
   // casting from an unsigned int to a void *, which should then be cast back
   // to an unsigned int in the driver.
-  EGLClientBuffer eglBuffer = reinterpret_cast< EGLClientBuffer > (mTbmsurface);
+  EGLClientBuffer eglBuffer = reinterpret_cast< EGLClientBuffer > (mTbmSurface);
 
   mEglImageKHR = mEglImageExtensions->CreateImageKHR( eglBuffer );
 
@@ -455,6 +472,24 @@ int NativeImageSource::GetEglImageTextureTarget()
   return GL_TEXTURE_EXTERNAL_OES;
 }
 
+bool NativeImageSource::CheckBlending( tbm_format format )
+{
+  if( mTbmFormat != format )
+  {
+    for(int i = 0; i < NUM_FORMATS_BLENDING_REQUIRED; ++i)
+    {
+      if( format == FORMATS_BLENDING_REQUIRED[i] )
+      {
+        mBlendingRequired = true;
+        break;
+      }
+    }
+    mTbmFormat = format;
+  }
+
+  return mBlendingRequired;
+}
+
 } // namespace Adaptor
 
 } // namespace internal
index 48876f0..9bed6e7 100755 (executable)
@@ -179,12 +179,15 @@ private:
 
   tbm_surface_h GetSurfaceFromAny( Any source ) const;
 
+  bool CheckBlending( tbm_format format );
+
 private:
 
   unsigned int mWidth;                        ///< image width
   unsigned int mHeight;                       ///< image heights
-  bool mOwnTbmsurface;                            ///< Whether we created pixmap or not
-  tbm_surface_h mTbmsurface;
+  bool mOwnTbmSurface;                            ///< Whether we created pixmap or not
+  tbm_surface_h mTbmSurface;
+  tbm_format mTbmFormat;
   bool mBlendingRequired;                      ///< Whether blending is required
   Dali::NativeImageSource::ColorDepth mColorDepth;  ///< color depth of image
   void* mEglImageKHR;                         ///< From EGL extension
index 705ef2f..8151061 100644 (file)
@@ -104,6 +104,7 @@ public:
   /**
    * @brief This is the constructor for applications without an argument list.
    * @SINCE_1_1.37
+   * @return A handle to the WatchApplication
    */
   static WatchApplication New();
 
@@ -113,6 +114,7 @@ public:
    * @SINCE_1_1.37
    * @param[in,out]  argc        A pointer to the number of arguments
    * @param[in,out]  argv        A pointer the the argument list
+   * @return A handle to the WatchApplication
    */
   static WatchApplication New( int* argc, char **argv[] );
 
@@ -123,6 +125,7 @@ public:
    * @param[in,out]  argc        A pointer to the number of arguments
    * @param[in,out]  argv        A pointer the the argument list
    * @param[in]      stylesheet  The path to user defined theme file
+   * @return A handle to the WatchApplication
    */
   static WatchApplication New( int* argc, char **argv[], const std::string& stylesheet );
 
@@ -135,12 +138,15 @@ public:
   /**
    * @brief Copy Constructor
    * @SINCE_1_1.37
+   * @param[in] implementation The WatchApplication implementation
    */
   WatchApplication( const WatchApplication& implementation );
 
   /**
    * @brief Assignment operator
    * @SINCE_1_1.37
+   * @param[in] handle Handle to an object
+   * @return A reference to this
    */
   WatchApplication& operator=( const WatchApplication& applicaton );
 
@@ -161,6 +167,7 @@ public:
    * @endcode
    * time(watch time handle) will not be available after returning this callback. It will be freed by the framework.
    * @SINCE_1_1.37
+   * @return The signal to connect to
    */
   WatchTimeSignal& TimeTickSignal();
 
@@ -174,6 +181,7 @@ public:
    * @SINCE_1_1.37
    * @remarks http://tizen.org/privilege/alarm.set privilege is needed to receive ambient ticks at each minute.
    * The AmbientTickSignal() will be ignored if your app doesn't have the privilege
+   * @return The signal to connect to
    */
   WatchTimeSignal& AmbientTickSignal();
 
@@ -185,6 +193,7 @@ public:
    * @endcode
    * ambient_mode If true the device enters the ambient mode, otherwise false
    * @SINCE_1_1.37
+   * @return The signal to connect to
    */
   WatchBoolSignal& AmbientChangedSignal();
 
index 0dc19e8..1a304b5 100644 (file)
@@ -57,6 +57,7 @@ public:
    * @brief return current hour
    *
    * @SINCE_1_1.37
+   * @return the current hour
    * @pre The WatchTime needs to be initialized.
    */
   int GetHour() const;
@@ -65,6 +66,7 @@ public:
    * @brief return current hour24
    *
    * @SINCE_1_1.37
+   * @return the current hour(the 24-hour clock)
    * @pre The WatchTime needs to be initialized.
    */
   int GetHour24() const;
@@ -73,6 +75,7 @@ public:
    * @brief return current minute
    *
    * @SINCE_1_1.37
+   * @return the current minute
    * @pre The WatchTime needs to be initialized.
    */
   int GetMinute() const;
@@ -81,6 +84,7 @@ public:
    * @brief return current second
    *
    * @SINCE_1_1.37
+   * @return the current second
    * @pre The WatchTime needs to be initialized.
    */
   int GetSecond() const;