#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
+
#include <ecore-x-types.h>
#include <trigger-event.h>
+#include <gl/egl-implementation.h>
+#include <base/display-connection.h>
namespace Dali
{
-namespace Internal
-{
-
-namespace Adaptor
-{
-
#if defined(DEBUG_ENABLED)
extern Debug::Filter* gRenderSurfaceLogFilter;
#endif
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)
{
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()
return Any( mX11Pixmap );
}
-void PixmapRenderSurface::InitializeEgl( EglInterface& eglIf )
+void PixmapRenderSurface::InitializeEgl( EglInterface& egl )
{
DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
- EglImplementation& eglImpl = static_cast<EglImplementation&>( eglIf );
- eglImpl.InitializeGles( reinterpret_cast< EGLNativeDisplayType >( mMainDisplay ) );
+ Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
eglImpl.ChooseConfig(false, mColorDepth);
}
-void PixmapRenderSurface::CreateEglSurface( EglInterface& eglIf )
+void PixmapRenderSurface::CreateEglSurface( EglInterface& egl )
{
DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
- EglImplementation& eglImpl = static_cast<EglImplementation&>( eglIf );
+ Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( 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<XPixmap>( 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<EglImplementation&>( eglIf );
+ Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
eglImpl.DestroySurface();
}
-bool PixmapRenderSurface::ReplaceEGLSurface( EglInterface& eglIf )
+bool PixmapRenderSurface::ReplaceEGLSurface( EglInterface& egl )
{
DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
- EglImplementation& eglImpl = static_cast<EglImplementation&>( 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<XPixmap>( mX11Pixmap );
+ Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+
+ return eglImpl.ReplaceSurfacePixmap( (EGLNativePixmapType)pixmap ); // reinterpret_cast does not compile
+
}
void PixmapRenderSurface::StartRender()
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();
}
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 )
rect.width = mPosition.width;
rect.height = mPosition.height;
+ XDisplay* display = AnyCast<XDisplay*>(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 );
}
}
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" );
mSyncNotify.notify_all();
}
-
} // namespace ECore
-} // namespace Adaptor
-
-} // namespace Internal
-
} // namespace Dali