From: David Fumanal Date: Fri, 3 Jul 2015 10:58:29 +0000 (+0100) Subject: Boost removal from pixmap X-Git-Tag: dali_1.0.48~4^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2a93cbbddcb06a3a9b4f3ab015876bea09bc23dd;hp=e3da9a7b4705ce108218bdaa8e342404e367d3e0;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git Boost removal from pixmap Change-Id: I431e6bdc4efee3f62a36be739b7da6d32e91a4f1 --- diff --git a/adaptors/common/gl/egl-sync-implementation.cpp b/adaptors/common/gl/egl-sync-implementation.cpp index c40864d..1ef1cb0 100644 --- a/adaptors/common/gl/egl-sync-implementation.cpp +++ b/adaptors/common/gl/egl-sync-implementation.cpp @@ -28,8 +28,6 @@ #endif -#include - #include // INTERNAL INCLUDES diff --git a/adaptors/integration-api/x11/pixmap-render-surface.h b/adaptors/integration-api/x11/pixmap-render-surface.h index cf0a227..06c8903 100644 --- a/adaptors/integration-api/x11/pixmap-render-surface.h +++ b/adaptors/integration-api/x11/pixmap-render-surface.h @@ -18,9 +18,6 @@ * */ -// EXTERNAL INCLUDES -#include - // INTERNAL INCLUDES #include @@ -148,11 +145,8 @@ private: private: // Data - boost::condition_variable mSyncNotify; ///< condition to notify main thread that pixmap was flushed to onscreen - boost::mutex mSyncMutex; ///< mutex to lock during waiting sync - Ecore_X_Pixmap mX11Pixmap; ///< X-Pixmap - SyncMode mSyncMode; ///< Stores whether the post render should block waiting for compositor - bool mSyncReceived; ///< true, when a pixmap sync has occurred, (cleared after reading) + struct Impl; + Impl* mImpl; }; } // namespace ECore diff --git a/adaptors/wayland/ecore-wl-render-surface-factory.h b/adaptors/wayland/ecore-wl-render-surface-factory.h index fe3dca3..51ff9f2 100644 --- a/adaptors/wayland/ecore-wl-render-surface-factory.h +++ b/adaptors/wayland/ecore-wl-render-surface-factory.h @@ -19,7 +19,6 @@ */ // EXTERNAL INCLUDES -#include #include #include #include diff --git a/adaptors/x11/ecore-x-render-surface-factory.h b/adaptors/x11/ecore-x-render-surface-factory.h index b29bf79..781bb85 100644 --- a/adaptors/x11/ecore-x-render-surface-factory.h +++ b/adaptors/x11/ecore-x-render-surface-factory.h @@ -19,7 +19,6 @@ */ // EXTERNAL INCLUDES -#include #include #include #include diff --git a/adaptors/x11/pixmap-render-surface-x.cpp b/adaptors/x11/pixmap-render-surface-x.cpp index 816d2d5..cfdf34c 100644 --- a/adaptors/x11/pixmap-render-surface-x.cpp +++ b/adaptors/x11/pixmap-render-surface-x.cpp @@ -28,6 +28,7 @@ #include #include +#include // INTERNAL INCLUDES @@ -35,6 +36,8 @@ #include #include #include +#include + namespace Dali { @@ -46,14 +49,25 @@ extern Debug::Filter* gRenderSurfaceLogFilter; namespace ECore { + +struct PixmapRenderSurface::Impl +{ + Internal::Adaptor::ConditionalWait mSyncNotify; ///< condition to notify main thread that pixmap was flushed to onscreen + Dali::Mutex mSyncMutex; ///< mutex to lock during waiting sync + Ecore_X_Pixmap mX11Pixmap; ///< X-Pixmap + SyncMode mSyncMode; ///< Stores whether the post render should block waiting for compositor + bool mSyncReceived; ///< true, when a pixmap sync has occurred, (cleared after reading) +}; + PixmapRenderSurface::PixmapRenderSurface(Dali::PositionSize positionSize, Any surface, const std::string& name, bool isTransparent) : EcoreXRenderSurface( positionSize, surface, name, isTransparent ), - mSyncMode(SYNC_MODE_NONE), - mSyncReceived(false) + mImpl( new Impl ) { + mImpl->mSyncMode = SYNC_MODE_NONE; + mImpl->mSyncReceived = false; Init( surface ); } @@ -63,19 +77,21 @@ PixmapRenderSurface::~PixmapRenderSurface() if( mOwnSurface ) { // if we did create the pixmap, delete the pixmap - DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::General, "Own pixmap (%x) freed\n", mX11Pixmap ); - ecore_x_pixmap_free( mX11Pixmap ); + DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::General, "Own pixmap (%x) freed\n", mImpl->mX11Pixmap ); + ecore_x_pixmap_free( mImpl->mX11Pixmap ); } + + delete mImpl; } Ecore_X_Drawable PixmapRenderSurface::GetDrawable() { - return (Ecore_X_Drawable) mX11Pixmap; + return (Ecore_X_Drawable) mImpl->mX11Pixmap; } Any PixmapRenderSurface::GetSurface() { - return Any( mX11Pixmap ); + return Any( mImpl->mX11Pixmap ); } void PixmapRenderSurface::InitializeEgl( EglInterface& egl ) @@ -95,7 +111,7 @@ void PixmapRenderSurface::CreateEglSurface( EglInterface& egl ) // create the EGL surface // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit - XPixmap pixmap = static_cast( mX11Pixmap ); + XPixmap pixmap = static_cast( mImpl->mX11Pixmap ); eglImpl.CreateSurfacePixmap( (EGLNativePixmapType)pixmap, mColorDepth ); // reinterpret_cast does not compile } @@ -113,7 +129,7 @@ bool PixmapRenderSurface::ReplaceEGLSurface( EglInterface& egl ) // a new surface for the new pixmap // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit - XPixmap pixmap = static_cast( mX11Pixmap ); + XPixmap pixmap = static_cast( mImpl->mX11Pixmap ); Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); return eglImpl.ReplaceSurfacePixmap( (EGLNativePixmapType)pixmap ); // reinterpret_cast does not compile @@ -122,7 +138,7 @@ bool PixmapRenderSurface::ReplaceEGLSurface( EglInterface& egl ) void PixmapRenderSurface::StartRender() { - mSyncMode = SYNC_MODE_WAIT; + mImpl->mSyncMode = SYNC_MODE_WAIT; } bool PixmapRenderSurface::PreRender( EglInterface&, Integration::GlAbstraction& ) @@ -185,21 +201,21 @@ void PixmapRenderSurface::CreateXRenderable() DALI_ASSERT_ALWAYS( mPosition.width > 0 && mPosition.height > 0 && "Pixmap size is invalid" ); // create the pixmap - mX11Pixmap = ecore_x_pixmap_new(0, mPosition.width, mPosition.height, mColorDepth); + mImpl->mX11Pixmap = ecore_x_pixmap_new(0, mPosition.width, mPosition.height, mColorDepth); // clear the pixmap unsigned int foreground; Ecore_X_GC gc; foreground = 0; - gc = ecore_x_gc_new( mX11Pixmap, + gc = ecore_x_gc_new( mImpl->mX11Pixmap, ECORE_X_GC_VALUE_MASK_FOREGROUND, &foreground ); DALI_ASSERT_ALWAYS( gc && "CreateXRenderable(): failed to get gc" ); - ecore_x_drawable_rectangle_fill( mX11Pixmap, gc, 0, 0, mPosition.width, mPosition.height ); + ecore_x_drawable_rectangle_fill( mImpl->mX11Pixmap, gc, 0, 0, mPosition.width, mPosition.height ); - DALI_ASSERT_ALWAYS( mX11Pixmap && "Failed to create X pixmap" ); + DALI_ASSERT_ALWAYS( mImpl->mX11Pixmap && "Failed to create X pixmap" ); // we SHOULD guarantee the xpixmap/x11 window was created in x server. ecore_x_sync(); @@ -209,37 +225,37 @@ void PixmapRenderSurface::CreateXRenderable() void PixmapRenderSurface::UseExistingRenderable( unsigned int surfaceId ) { - mX11Pixmap = static_cast< Ecore_X_Pixmap >( surfaceId ); + mImpl->mX11Pixmap = static_cast< Ecore_X_Pixmap >( surfaceId ); } void PixmapRenderSurface::SetSyncMode( SyncMode syncMode ) { - mSyncMode = syncMode; + mImpl->mSyncMode = syncMode; } void PixmapRenderSurface::AcquireLock( SyncMode syncMode ) { - boost::unique_lock< boost::mutex > lock( mSyncMutex ); + Dali::Mutex::ScopedLock lock( mImpl->mSyncMutex ); // wait for sync if( syncMode != SYNC_MODE_NONE && - mSyncMode != SYNC_MODE_NONE && - !mSyncReceived ) + mImpl->mSyncMode != SYNC_MODE_NONE && + !mImpl->mSyncReceived ) { - mSyncNotify.wait( lock ); + mImpl->mSyncNotify.Wait( ); } - mSyncReceived = false; + mImpl->mSyncReceived = false; } void PixmapRenderSurface::ReleaseLock() { { - boost::unique_lock< boost::mutex > lock( mSyncMutex ); - mSyncReceived = true; + Dali::Mutex::ScopedLock lock( mImpl->mSyncMutex ); + mImpl->mSyncReceived = true; } // wake render thread if it was waiting for the notify - mSyncNotify.notify_all(); + mImpl->mSyncNotify.Notify(); } } // namespace ECore