X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=adaptors%2Fcommon%2Fadaptor-impl.cpp;h=2eb5e8256d52eb826d4eb5eb3d5dc49dd0814a07;hb=26e723d732dee359276f8affa3be6dc57849ec62;hp=ab2ecac68ba2681331bc75da3648b21749fa586d;hpb=d5f1e74a3fe68d52e16053fa403c3053c00977a2;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/adaptors/common/adaptor-impl.cpp b/adaptors/common/adaptor-impl.cpp index ab2ecac..2eb5e82 100644 --- a/adaptors/common/adaptor-impl.cpp +++ b/adaptors/common/adaptor-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -29,7 +29,7 @@ // INTERNAL INCLUDES #include -# include +#include #include #include @@ -53,6 +53,7 @@ #include #include +#include using Dali::TextAbstraction::FontClient; @@ -67,7 +68,7 @@ namespace Adaptor namespace { -__thread Adaptor* gThreadLocalAdaptor = NULL; // raw thread specific pointer to allow Adaptor::Get +thread_local Adaptor* gThreadLocalAdaptor = NULL; // raw thread specific pointer to allow Adaptor::Get } // unnamed namespace Dali::Adaptor* Adaptor::New( Any nativeWindow, RenderSurface *surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions ) @@ -84,7 +85,6 @@ Dali::Adaptor* Adaptor::New( Any nativeWindow, RenderSurface *surface, Dali::Con Dali::Adaptor* Adaptor::New( Dali::Window window, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions ) { Any winId = window.GetNativeHandle(); - Window& windowImpl = Dali::GetImplementation(window); Dali::Adaptor* adaptor = New( winId, windowImpl.GetSurface(), configuration, environmentOptions ); windowImpl.SetAdaptor(*adaptor); @@ -132,7 +132,7 @@ void Adaptor::Initialize( Dali::Configuration::ContextLoss configuration ) mGLES = new GlImplementation(); } - mEglFactory = new EglFactory(); + mEglFactory = new EglFactory( mEnvironmentOptions->GetMultiSamplingLevel() ); EglSyncImplementation* eglSyncImpl = mEglFactory->GetSyncImplementation(); @@ -183,6 +183,12 @@ void Adaptor::Initialize( Dali::Configuration::ContextLoss configuration ) { Integration::SetPanGestureSmoothingAmount(mEnvironmentOptions->GetPanGestureSmoothingAmount()); } + + // Set max texture size + if( mEnvironmentOptions->GetMaxTextureSize() > 0 ) + { + Dali::SetMaxTextureSize( mEnvironmentOptions->GetMaxTextureSize() ); + } } Adaptor::~Adaptor() @@ -385,45 +391,19 @@ void Adaptor::FeedKeyEvent( KeyEvent& keyEvent ) mEventHandler->FeedKeyEvent( keyEvent ); } -bool Adaptor::MoveResize( const PositionSize& positionSize ) -{ - PositionSize old = mSurface->GetPositionSize(); - - // just resize the surface. The driver should automatically resize the egl Surface (untested) - // EGL Spec says : EGL window surfaces need to be resized when their corresponding native window - // is resized. Implementations typically use hooks into the OS and native window - // system to perform this resizing on demand, transparently to the client. - mSurface->MoveResize( positionSize ); - - if(old.width != positionSize.width || old.height != positionSize.height) - { - SurfaceSizeChanged(positionSize); - } - - return true; -} - -void Adaptor::SurfaceResized( const PositionSize& positionSize ) +void Adaptor::ReplaceSurface( Any nativeWindow, RenderSurface& surface ) { - PositionSize old = mSurface->GetPositionSize(); + PositionSize positionSize = surface.GetPositionSize(); - // Called by an application, when it has resized a window outside of Dali. - // The EGL driver automatically detects X Window resize calls, and resizes - // the EGL surface for us. - mSurface->MoveResize( positionSize ); + // let the core know the surface size has changed + mCore->SurfaceResized( positionSize.width, positionSize.height ); - if(old.width != positionSize.width || old.height != positionSize.height) - { - SurfaceSizeChanged(positionSize); - } -} + mResizedSignal.Emit( mAdaptor ); -void Adaptor::ReplaceSurface( Any nativeWindow, RenderSurface& surface ) -{ mNativeWindow = nativeWindow; mSurface = &surface; - // flush the event queue to give update and render threads chance + // flush the event queue to give the update-render thread chance // to start processing messages for new camera setup etc as soon as possible ProcessCoreEvents(); @@ -722,14 +702,24 @@ void Adaptor::OnDamaged( const DamageArea& area ) RequestUpdate(); } -void Adaptor::SurfaceSizeChanged( const PositionSize& positionSize ) +void Adaptor::SurfaceResizePrepare( Dali::Adaptor::SurfaceSize surfaceSize ) { // let the core know the surface size has changed - mCore->SurfaceResized(positionSize.width, positionSize.height); + mCore->SurfaceResized( surfaceSize.GetWidth(), surfaceSize.GetHeight() ); mResizedSignal.Emit( mAdaptor ); } +void Adaptor::SurfaceResizeComplete( Dali::Adaptor::SurfaceSize surfaceSize ) +{ + // flush the event queue to give the update-render thread chance + // to start processing messages for new camera setup etc as soon as possible + ProcessCoreEvents(); + + // this method blocks until the render thread has completed the resizing. + mThreadController->ResizeSurface(); +} + void Adaptor::NotifySceneCreated() { GetCore().SceneCreated();