X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=adaptors%2Fx11%2Fpixmap-render-surface-x.cpp;h=816d2d57954d29ca819f91c31a74c877e766ef57;hb=9c64a009db96b6195bf8274ae0e98545c132f78d;hp=1cfd6ff54a4b05a3bdf54f0ca33999456ad76709;hpb=ba492405ac8a02caef1fd87f88bf54620a9c7164;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/adaptors/x11/pixmap-render-surface-x.cpp b/adaptors/x11/pixmap-render-surface-x.cpp index 1cfd6ff..816d2d5 100644 --- a/adaptors/x11/pixmap-render-surface-x.cpp +++ b/adaptors/x11/pixmap-render-surface-x.cpp @@ -30,18 +30,15 @@ #include // INTERNAL INCLUDES + #include #include +#include +#include namespace Dali { -namespace Internal -{ - -namespace Adaptor -{ - #if defined(DEBUG_ENABLED) extern Debug::Filter* gRenderSurfaceLogFilter; #endif @@ -49,12 +46,11 @@ extern Debug::Filter* gRenderSurfaceLogFilter; namespace ECore { -PixmapRenderSurface::PixmapRenderSurface( Dali::PositionSize positionSize, - Any surface, - Any display, - const std::string& name, - bool isTransparent) -: RenderSurface( Dali::RenderSurface::PIXMAP, positionSize, surface, display, name, isTransparent ), +PixmapRenderSurface::PixmapRenderSurface(Dali::PositionSize positionSize, + Any surface, + const std::string& name, + bool isTransparent) +: EcoreXRenderSurface( positionSize, surface, name, isTransparent ), mSyncMode(SYNC_MODE_NONE), mSyncReceived(false) { @@ -74,12 +70,7 @@ PixmapRenderSurface::~PixmapRenderSurface() Ecore_X_Drawable PixmapRenderSurface::GetDrawable() { - return (Ecore_X_Drawable)mX11Pixmap; -} - -Dali::RenderSurface::SurfaceType PixmapRenderSurface::GetType() -{ - return Dali::RenderSurface::PIXMAP; + return (Ecore_X_Drawable) mX11Pixmap; } Any PixmapRenderSurface::GetSurface() @@ -87,48 +78,46 @@ Any PixmapRenderSurface::GetSurface() return Any( mX11Pixmap ); } -void PixmapRenderSurface::InitializeEgl( EglInterface& eglIf ) +void PixmapRenderSurface::InitializeEgl( EglInterface& egl ) { DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); - EglImplementation& eglImpl = static_cast( eglIf ); - eglImpl.InitializeGles( reinterpret_cast< EGLNativeDisplayType >( mMainDisplay ) ); + Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); eglImpl.ChooseConfig(false, mColorDepth); } -void PixmapRenderSurface::CreateEglSurface( EglInterface& eglIf ) +void PixmapRenderSurface::CreateEglSurface( EglInterface& egl ) { DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); - EglImplementation& eglImpl = static_cast( eglIf ); + Internal::Adaptor::EglImplementation& eglImpl = static_cast( 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< XPixmap>( mX11Pixmap ); + XPixmap pixmap = static_cast( mX11Pixmap ); eglImpl.CreateSurfacePixmap( (EGLNativePixmapType)pixmap, mColorDepth ); // reinterpret_cast does not compile } -void PixmapRenderSurface::DestroyEglSurface( EglInterface& eglIf ) +void PixmapRenderSurface::DestroyEglSurface( EglInterface& egl ) { DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); - EglImplementation& eglImpl = static_cast( eglIf ); + Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); eglImpl.DestroySurface(); } -bool PixmapRenderSurface::ReplaceEGLSurface( EglInterface& eglIf ) +bool PixmapRenderSurface::ReplaceEGLSurface( EglInterface& egl ) { DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); - EglImplementation& eglImpl = static_cast( eglIf ); - eglImpl.InitializeGles( reinterpret_cast< EGLNativeDisplayType >( mMainDisplay ) ); - // 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< XPixmap>( mX11Pixmap ); - return eglImpl.ReplaceSurfacePixmap( (EGLNativePixmapType)pixmap, // reinterpret_cast does not compile - reinterpret_cast< EGLNativeDisplayType >( mMainDisplay ) ); + XPixmap pixmap = static_cast( mX11Pixmap ); + Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); + + return eglImpl.ReplaceSurfacePixmap( (EGLNativePixmapType)pixmap ); // reinterpret_cast does not compile + } void PixmapRenderSurface::StartRender() @@ -142,7 +131,7 @@ bool PixmapRenderSurface::PreRender( EglInterface&, Integration::GlAbstraction& return true; } -void PixmapRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, unsigned int timeDelta, bool replacingSurface ) +void PixmapRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, unsigned int deltaTime, bool replacingSurface ) { // flush gl instruction queue glAbstraction.Flush(); @@ -156,8 +145,7 @@ void PixmapRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstract } else { - // as a fallback, send damage event. This is needed until livebox is fixed to - // stop using damage events for render + // as a fallback, send damage event. Ecore_X_Drawable drawable = GetDrawable(); if( drawable ) @@ -170,13 +158,15 @@ void PixmapRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstract rect.width = mPosition.width; rect.height = mPosition.height; + XDisplay* display = AnyCast(displayConnection->GetDisplay()); + // make a fixes region as updated area - region = XFixesCreateRegion( mMainDisplay, &rect, 1 ); + region = XFixesCreateRegion( display, &rect, 1 ); // add damage event to updated drawable - XDamageAdd( mMainDisplay, (Drawable)drawable, region ); - XFixesDestroyRegion( mMainDisplay, region ); + XDamageAdd( display, (Drawable)drawable, region ); + XFixesDestroyRegion( display, region ); - XFlush( mMainDisplay ); + XFlush( display ); } } @@ -204,6 +194,9 @@ void PixmapRenderSurface::CreateXRenderable() gc = ecore_x_gc_new( 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 ); DALI_ASSERT_ALWAYS( mX11Pixmap && "Failed to create X pixmap" ); @@ -249,11 +242,6 @@ void PixmapRenderSurface::ReleaseLock() mSyncNotify.notify_all(); } - } // namespace ECore -} // namespace Adaptor - -} // namespace Internal - } // namespace Dali