/*
- * 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.
// INTERNAL INCLUDES
#include <dali/integration-api/adaptor-framework/thread-synchronization-interface.h>
-#include <dali/integration-api/adaptor-framework/trigger-event-factory-interface.h>
+#include <dali/integration-api/adaptor-framework/trigger-event-factory.h>
#include <dali/internal/adaptor/common/adaptor-impl.h>
#include <dali/internal/adaptor/common/adaptor-internal-services.h>
#include <dali/internal/graphics/gles/egl-graphics.h>
{
delete mRotationTrigger;
}
-
- if ( mEGLSurface )
- {
- DestroySurface();
- }
}
void WindowRenderSurface::Initialize( Any surface )
if( mScreenRotationAngle != 0 )
{
mScreenRotationFinished = false;
- mResizeFinished = false;
}
}
void WindowRenderSurface::RequestRotation( int angle, int width, int height )
{
+ if( !mRotationSupported )
+ {
+ DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::Rotate: Rotation is not supported!\n" );
+ return;
+ }
+
if( !mRotationTrigger )
{
- TriggerEventFactoryInterface& triggerFactory = Internal::Adaptor::Adaptor::GetImplementation( Adaptor::Get() ).GetTriggerEventFactoryInterface();
- mRotationTrigger = triggerFactory.CreateTriggerEvent( MakeCallback( this, &WindowRenderSurface::ProcessRotationRequest ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER );
+ mRotationTrigger = TriggerEventFactory::CreateTriggerEvent( MakeCallback( this, &WindowRenderSurface::ProcessRotationRequest ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER );
}
mPositionSize.width = width;
dpiVertical = mDpiVertical;
}
-int WindowRenderSurface::GetOrientation() const
-{
- return mWindowBase->GetOrientation();
-}
-
void WindowRenderSurface::InitializeGraphics()
{
-
mGraphics = &mAdaptor->GetGraphicsInterface();
+ DALI_ASSERT_ALWAYS( mGraphics && "Graphics interface is not created" );
+
auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
mEGL = &eglGraphics->GetEglInterface();
DALI_LOG_TRACE_METHOD( gWindowRenderSurfaceLogFilter );
auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
+ if( eglGraphics )
+ {
+ DALI_LOG_RELEASE_INFO("WindowRenderSurface::DestroySurface: WinId (%d)\n", mWindowBase->GetNativeWindowId() );
- DALI_LOG_RELEASE_INFO("WindowRenderSurface::DestroySurface: WinId (%d)\n", mWindowBase->GetNativeWindowId() );
+ Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
- Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
- eglImpl.DestroySurface( mEGLSurface );
+ eglImpl.DestroySurface( mEGLSurface );
+ mEGLSurface = nullptr;
- mWindowBase->DestroyEglWindow();
+ // Destroy context also
+ eglImpl.DestroyContext( mEGLContext );
+ mEGLContext = nullptr;
+
+ mWindowBase->DestroyEglWindow();
+ }
}
bool WindowRenderSurface::ReplaceGraphicsSurface()
if( resizingSurface )
{
- int totalAngle = (mRotationAngle + mScreenRotationAngle) % 360;
-
// Window rotate or screen rotate
if( !mRotationFinished || !mScreenRotationFinished )
{
+ int totalAngle = (mRotationAngle + mScreenRotationAngle) % 360;
+
mWindowBase->SetEglWindowRotation( totalAngle );
mWindowBase->SetEglWindowBufferTransform( totalAngle );
}
// Resize case
- if ( !mResizeFinished )
+ if( !mResizeFinished )
{
- Dali::PositionSize positionSize;
- positionSize.x = mPositionSize.x;
- positionSize.y = mPositionSize.y;
- if( totalAngle == 0 || totalAngle == 180 )
- {
- positionSize.width = mPositionSize.width;
- positionSize.height = mPositionSize.height;
- }
- else
- {
- positionSize.width = mPositionSize.height;
- positionSize.height = mPositionSize.width;
- }
-
- mWindowBase->ResizeEglWindow( positionSize );
+ mWindowBase->ResizeEglWindow( mPositionSize );
mResizeFinished = true;
DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::PreRender: Set resize\n" );
{
if( !mRotationFinished )
{
- DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::PostRender: Trigger rotation event\n" );
+ if( mThreadSynchronization )
+ {
+ // Enable PostRender flag
+ mThreadSynchronization->PostRenderStarted();
+ }
+
+ DALI_LOG_RELEASE_INFO("WindowRenderSurface::PostRender: Trigger rotation event\n" );
mRotationTrigger->Trigger();
// Nothing to do.
}
-Integration::RenderSurface::Type WindowRenderSurface::GetSurfaceType()
+Dali::RenderSurfaceInterface::Type WindowRenderSurface::GetSurfaceType()
{
- return RenderSurface::WINDOW_RENDER_SURFACE;
+ return Dali::RenderSurfaceInterface::WINDOW_RENDER_SURFACE;
}
void WindowRenderSurface::MakeContextCurrent()
{
mScreenRotationAngle = screenRotationAngle;
mScreenRotationFinished = false;
- mResizeFinished = false;
mOutputTransformedSignal.Emit();