X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=dali%2Finternal%2Fwindow-system%2Ftizen-wayland%2Fnative-render-surface-ecore-wl.cpp;h=7ade18fc9f3f8777a25647b992a8ff060ac3d047;hb=ab6276d5a0686fbbcbd559a992819ee5a8695876;hp=876e9893c37c66eac10bcb283acc664ba1498cfa;hpb=3084d50ac7eec2059ed5c53b6b7ef0ca798ce460;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/window-system/tizen-wayland/native-render-surface-ecore-wl.cpp b/dali/internal/window-system/tizen-wayland/native-render-surface-ecore-wl.cpp index 876e989..7ade18f 100644 --- a/dali/internal/window-system/tizen-wayland/native-render-surface-ecore-wl.cpp +++ b/dali/internal/window-system/tizen-wayland/native-render-surface-ecore-wl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,8 +53,8 @@ Debug::Filter* gNativeSurfaceLogFilter = Debug::Filter::New(Debug::Verbose, fals } // unnamed namespace -NativeRenderSurfaceEcoreWl::NativeRenderSurfaceEcoreWl( Dali::PositionSize positionSize, bool isTransparent ) -: mPosition( positionSize ), +NativeRenderSurfaceEcoreWl::NativeRenderSurfaceEcoreWl( SurfaceSize surfaceSize, Any surface, bool isTransparent ) +: mSurfaceSize( surfaceSize ), mRenderNotification( NULL ), mGraphics( NULL ), mEGL( nullptr ), @@ -70,8 +70,16 @@ NativeRenderSurfaceEcoreWl::NativeRenderSurfaceEcoreWl( Dali::PositionSize posit { Dali::Internal::Adaptor::WindowSystem::Initialize(); - CreateNativeRenderable(); - setenv( "EGL_PLATFORM", "tbm", 1 ); + if( surface.Empty() ) + { + CreateNativeRenderable(); + } + else + { + // check we have a valid type + DALI_ASSERT_ALWAYS( ( surface.GetType() == typeid (tbm_surface_queue_h) ) && "Surface type is invalid" ); + mTbmQueue = AnyCast< tbm_surface_queue_h >( surface ); + } } NativeRenderSurfaceEcoreWl::~NativeRenderSurfaceEcoreWl() @@ -120,7 +128,7 @@ void NativeRenderSurfaceEcoreWl::WaitUntilSurfaceReplaced() PositionSize NativeRenderSurfaceEcoreWl::GetPositionSize() const { - return mPosition; + return PositionSize( 0, 0, static_cast( mSurfaceSize.GetWidth() ), static_cast( mSurfaceSize.GetHeight() ) ); } void NativeRenderSurfaceEcoreWl::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) @@ -142,15 +150,9 @@ void NativeRenderSurfaceEcoreWl::GetDpi( unsigned int& dpiHorizontal, unsigned i dpiVertical = int( yres + 0.5f ); } -int NativeRenderSurfaceEcoreWl::GetOrientation() const -{ - return 0; -} - void NativeRenderSurfaceEcoreWl::InitializeGraphics() { DALI_LOG_TRACE_METHOD( gNativeSurfaceLogFilter ); - unsetenv( "EGL_PLATFORM" ); mGraphics = &mAdaptor->GetGraphicsInterface(); auto eglGraphics = static_cast(mGraphics); @@ -214,27 +216,38 @@ void NativeRenderSurfaceEcoreWl::MoveResize( Dali::PositionSize positionSize ) DALI_LOG_ERROR( "Failed to resize tbm_surface_queue" ); } - mPosition = positionSize; + mSurfaceSize.SetWidth( static_cast( positionSize.width ) ); + mSurfaceSize.SetHeight( static_cast( positionSize.height ) ); } void NativeRenderSurfaceEcoreWl::StartRender() { } -bool NativeRenderSurfaceEcoreWl::PreRender( bool ) +bool NativeRenderSurfaceEcoreWl::PreRender( bool resizingSurface, const std::vector>& damagedRects, Rect& clippingRect ) { - // nothing to do for pixmaps + auto eglGraphics = static_cast(mGraphics); + if (eglGraphics) + { + Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation(); + if (resizingSurface) + { + eglImpl.SetFullSwapNextFrame(); + } + + eglImpl.SetDamage(mEGLSurface, damagedRects, clippingRect); + } + return true; } -void NativeRenderSurfaceEcoreWl::PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface ) +void NativeRenderSurfaceEcoreWl::PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface, const std::vector>& damagedRects ) { auto eglGraphics = static_cast(mGraphics); - if ( eglGraphics ) + if (eglGraphics) { Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation(); - - eglImpl.SwapBuffers( mEGLSurface ); + eglImpl.SwapBuffers( mEGLSurface, damagedRects ); } if( mThreadSynchronization ) @@ -288,9 +301,9 @@ void NativeRenderSurfaceEcoreWl::SetThreadSynchronization( ThreadSynchronization mThreadSynchronization = &threadSynchronization; } -Integration::RenderSurface::Type NativeRenderSurfaceEcoreWl::GetSurfaceType() +Dali::RenderSurfaceInterface::Type NativeRenderSurfaceEcoreWl::GetSurfaceType() { - return Integration::RenderSurface::NATIVE_RENDER_SURFACE; + return Dali::RenderSurfaceInterface::NATIVE_RENDER_SURFACE; } void NativeRenderSurfaceEcoreWl::MakeContextCurrent() @@ -321,10 +334,13 @@ void NativeRenderSurfaceEcoreWl::ReleaseLock() void NativeRenderSurfaceEcoreWl::CreateNativeRenderable() { + int width = static_cast( mSurfaceSize.GetWidth() ); + int height = static_cast( mSurfaceSize.GetHeight() ); + // check we're creating one with a valid size - DALI_ASSERT_ALWAYS( mPosition.width > 0 && mPosition.height > 0 && "tbm_surface size is invalid" ); + DALI_ASSERT_ALWAYS( width > 0 && height > 0 && "tbm_surface size is invalid" ); - mTbmQueue = tbm_surface_queue_create( 3, mPosition.width, mPosition.height, mTbmFormat, TBM_BO_DEFAULT ); + mTbmQueue = tbm_surface_queue_create( 3, width, height, mTbmFormat, TBM_BO_DEFAULT ); if( mTbmQueue ) {