if( contextLost )
{
DALI_LOG_WARNING("Context lost\n");
- mCore.ContextToBeDestroyed();
+ mCore.ContextDestroyed();
mCore.ContextCreated();
}
void RenderThread::ShutdownEgl()
{
- // inform core the context is about to be destroyed,
- mCore.ContextToBeDestroyed();
+ // inform core of context destruction
+ mCore.ContextDestroyed();
// give a chance to destroy the OpenGL surface that created externally
mSurface->DestroyEglSurface( *mEGL );
#include <dali/public-api/common/dali-common.h>
#include <dali/integration-api/debug.h>
#include <dali/integration-api/core.h>
+#include <dali/integration-api/context-notifier.h>
#include <dali/integration-api/profiling.h>
#include <dali/integration-api/input-options.h>
#include <dali/integration-api/events/touch-event-integ.h>
#include <callback-manager.h>
#include <trigger-event.h>
+#include <window-render-surface.h>
#include <render-surface-impl.h>
#include <tts-player-impl.h>
#include <accessibility-manager-impl.h>
} // unnamed namespace
-Dali::Adaptor* Adaptor::New( RenderSurface *surface, const DeviceLayout& baseLayout )
+Dali::Adaptor* Adaptor::New( RenderSurface *surface, const DeviceLayout& baseLayout,
+ Dali::Configuration::ContextLoss configuration )
{
DALI_ASSERT_ALWAYS( surface->GetType() != Dali::RenderSurface::NO_SURFACE && "No surface for adaptor" );
Adaptor* impl = new Adaptor( *adaptor, surface, baseLayout );
adaptor->mImpl = impl;
- impl->Initialize();
+ impl->Initialize(configuration);
return adaptor;
}
mEnvironmentOptions.InstallLogFunction();
}
-void Adaptor::Initialize()
+void Adaptor::Initialize(Dali::Configuration::ContextLoss configuration)
{
ParseEnvironmentOptions();
mPlatformAbstraction = new SlpPlatform::SlpPlatformAbstraction;
+ ResourcePolicy::DataRetention dataRetentionPolicy = ResourcePolicy::DALI_DISCARDS_ALL_DATA;
+ if( configuration == Dali::Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS )
+ {
+ dataRetentionPolicy = ResourcePolicy::DALI_RETAINS_MESH_DATA;
+ }
+ // Note, Tizen does not use DALI_RETAINS_ALL_DATA, as it can reload images from
+ // files automatically.
+
if( mEnvironmentOptions.GetPerformanceLoggingLevel() > 0 )
{
mPerformanceInterface = PerformanceInterfaceFactory::CreateInterface( *this, mEnvironmentOptions );
EglSyncImplementation* eglSyncImpl = mEglFactory->GetSyncImplementation();
- mCore = Integration::Core::New( *this, *mPlatformAbstraction, *mGLES, *eglSyncImpl, *mGestureManager );
+ mCore = Integration::Core::New( *this, *mPlatformAbstraction, *mGLES, *eglSyncImpl, *mGestureManager, dataRetentionPolicy );
mObjectProfiler = new ObjectProfiler();
RenderSurface* internalSurface = dynamic_cast<Internal::Adaptor::RenderSurface*>( &surface );
DALI_ASSERT_ALWAYS( internalSurface && "Incorrect surface" );
+ ECore::WindowRenderSurface* windowSurface = dynamic_cast<Internal::Adaptor::ECore::WindowRenderSurface*>( &surface);
+ if( windowSurface != NULL )
+ {
+ windowSurface->Map();
+ // @todo Restart event handler with new surface
+ }
+
mSurface = internalSurface;
SurfaceSizeChanged( internalSurface->GetPositionSize() );
// to start processing messages for new camera setup etc as soon as possible
ProcessCoreEvents();
- // this method is synchronous
+ mCore->GetContextNotifier()->NotifyContextLost(); // Inform stage
+
+ // this method blocks until the render thread has completed the replace.
mUpdateRenderController->ReplaceSurface(internalSurface);
+
+ // Inform core, so that texture resources can be reloaded
+ mCore->RecoverFromContextLoss();
+
+ mCore->GetContextNotifier()->NotifyContextRegained(); // Inform stage
}
Dali::RenderSurface& Adaptor::GetSurface() const
}
}
+
void Adaptor::AddObserver( LifeCycleObserver& observer )
{
ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
}
Adaptor::Adaptor(Dali::Adaptor& adaptor, RenderSurface* surface, const DeviceLayout& baseLayout)
-: mAdaptor(adaptor),
+: mResizedSignalV2(),
+ mLanguageChangedSignalV2(),
+ mAdaptor(adaptor),
mState(READY),
mCore(NULL),
mUpdateRenderController(NULL),
* - Pixmap, adaptor will use existing Pixmap to draw on to
* - Window, adaptor will use existing Window to draw on to
* @param[in] baseLayout The base layout that the application has been written for
+ * @param[in] configuration The context loss configuration ( to choose resource discard policy )
*/
- static Dali::Adaptor* New( RenderSurface* surface, const DeviceLayout& baseLayout );
+ static Dali::Adaptor* New( RenderSurface* surface,
+ const DeviceLayout& baseLayout,
+ Dali::Configuration::ContextLoss configuration );
/**
* 2-step initialisation, this should be called after creating an adaptor instance.
*/
- void Initialize();
+ void Initialize(Dali::Configuration::ContextLoss configuration);
/**
* Virtual destructor.
Adaptor& Adaptor::New( Window window )
{
- return New( window, DeviceLayout::DEFAULT_BASE_LAYOUT );
+ return New( window, DeviceLayout::DEFAULT_BASE_LAYOUT, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
}
-Adaptor& Adaptor::New( Window window, const DeviceLayout& baseLayout )
+Adaptor& Adaptor::New( Window window, const DeviceLayout& baseLayout, Configuration::ContextLoss configuration )
{
Internal::Adaptor::Window& windowImpl = GetImplementation(window);
- Adaptor* adaptor = Internal::Adaptor::Adaptor::New( windowImpl.GetSurface(), baseLayout );
+ Adaptor* adaptor = Internal::Adaptor::Adaptor::New( windowImpl.GetSurface(), baseLayout, configuration );
windowImpl.SetAdaptor(*adaptor);
return *adaptor;
}
// EXTERNAL INCLUDES
#include <boost/function.hpp>
#include "window.h"
+#include "application-configuration.h"
#include "tts-player.h"
#include <dali/public-api/signals/dali-signal-v2.h>
#include <dali/public-api/math/rect.h>
*
* @param[in] window The window to draw onto
* @param[in] baseLayout The base layout that the application has been written for
+ * @param[in] configuration The context loss configuration.
* @return a reference to the adaptor handle
*/
- static Adaptor& New( Window window, const DeviceLayout& baseLayout );
+ static Adaptor& New( Window window, const DeviceLayout& baseLayout, Configuration::ContextLoss configuration );
/**
* @brief Virtual Destructor.
{
DALI_ASSERT_ALWAYS( mWindow && "Window required to create adaptor" );
- mAdaptor = &Dali::Adaptor::New( mWindow, mBaseLayout);
+ mAdaptor = &Dali::Adaptor::New( mWindow, mBaseLayout, mContextLossConfiguration );
// Allow DPI to be overridden from command line.
unsigned int hDPI=DEFAULT_HORIZONTAL_DPI;
mAdaptor->ResizedSignal().Connect( mSlotDelegate, &Application::OnResize );
}
-void Application::MainLoop()
+void Application::MainLoop(Dali::Configuration::ContextLoss configuration)
{
+ mContextLossConfiguration = configuration;
+
// Run the application
mFramework->Run();
}
return Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).GetStereoBase();
}
+
+void Application::ReplaceWindow(PositionSize windowPosition, const std::string& name)
+{
+ Dali::Window newWindow = Dali::Window::New( windowPosition, name, mWindowMode == Dali::Application::TRANSPARENT );
+ Window& windowImpl = GetImplementation(newWindow);
+ windowImpl.SetAdaptor(*mAdaptor);
+ newWindow.ShowIndicator(Dali::Window::INVISIBLE);
+ Dali::RenderSurface* renderSurface = windowImpl.GetSurface();
+ Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).ReplaceSurface(*renderSurface);
+ mWindow = newWindow;
+}
+
} // namespace Adaptor
} // namespace Internal
/**
* @copydoc Dali::Application::MainLoop()
*/
- void MainLoop();
+ void MainLoop(Dali::Configuration::ContextLoss configuration);
/**
* @copydoc Dali::Application::Lower()
*/
void SetTheme(const std::string& themeFilePath);
+ /**
+ * @copydoc Dali::Application::ReplaceWindow();
+ */
+ void ReplaceWindow(PositionSize windowPosition, const std::string& name);
+
public: // Stereoscopy
/**
EventLoop* mEventLoop;
Framework* mFramework;
+ Dali::Configuration::ContextLoss mContextLossConfiguration;
CommandLineOptions* mCommandLineOptions;
Dali::SingletonService mSingletonService;
+++ /dev/null
-/*
- * Copyright (c) 2014 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include "window-impl.h"
-
-// EXTERNAL HEADERS
-#include <Ecore.h>
-#ifdef WAYLAND
-#include <Ecore_Wayland.h>
-#else
-#include <Ecore_X.h>
-#endif
-
-#include <dali/integration-api/core.h>
-#include <dali/integration-api/system-overlay.h>
-#include <dali/public-api/render-tasks/render-task.h>
-#include <dali/public-api/render-tasks/render-task-list.h>
-#include <orientation.h>
-
-// INTERNAL HEADERS
-#ifdef WAYLAND
-#include <ecore-wl/wl-window-render-surface.h>
-#else
-#include <ecore-x/window-render-surface.h>
-#endif
-#include <drag-and-drop-detector-impl.h>
-#include <indicator-impl.h>
-#include <window-visibility-observer.h>
-#include <orientation-impl.h>
-
-namespace
-{
-const float INDICATOR_ANIMATION_DURATION( 0.18f ); // 180 milli seconds
-const float INDICATOR_SHOW_Y_POSITION( 0.0f );
-const float INDICATOR_HIDE_Y_POSITION( -52.0f );
-}
-
-namespace Dali
-{
-namespace Internal
-{
-namespace Adaptor
-{
-#if defined(DEBUG_ENABLED)
-Debug::Filter* gWindowLogFilter = Debug::Filter::New(Debug::Concise, false, "LOG_WINDOW");
-#endif
-
-/**
- * TODO: Abstract Window class out and move this into a window implementation for Ecore
- */
-struct Window::EventHandler
-{
- /**
- * Constructor
- * @param[in] window A pointer to the window class.
- */
- EventHandler( Window* window )
- : mWindow( window ),
-#ifndef WAYLAND
- mWindowPropertyHandler( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_PROPERTY, EcoreEventWindowPropertyChanged, this ) ),
- mClientMessagehandler( ecore_event_handler_add( ECORE_X_EVENT_CLIENT_MESSAGE, EcoreEventClientMessage, this ) ),
-#endif
- mEcoreWindow( 0 )
- {
-#ifndef WAYLAND
- // store ecore window handle
- ECoreX::WindowRenderSurface* x11Window( dynamic_cast< ECoreX::WindowRenderSurface * >( mWindow->mSurface ) );
- if( x11Window )
- {
- mEcoreWindow = x11Window->GetXWindow();
- }
- DALI_ASSERT_ALWAYS( mEcoreWindow != 0 && "There is no ecore x window");
-
- // set property on window to get deiconify approve client message
- unsigned int tmp = 1;
- ecore_x_window_prop_card32_set(mEcoreWindow,
- ECORE_X_ATOM_E_DEICONIFY_APPROVE,
- &tmp, 1);
-#endif
- }
-
- /**
- * Destructor
- */
- ~EventHandler()
- {
- if ( mWindowPropertyHandler )
- {
- ecore_event_handler_del( mWindowPropertyHandler );
- }
- if ( mClientMessagehandler )
- {
- ecore_event_handler_del( mClientMessagehandler );
- }
- }
-
- // Static methods
-
- /// Called when the window properties are changed.
- static Eina_Bool EcoreEventWindowPropertyChanged( void* data, int type, void* event )
- {
-#ifdef WAYLAND
- return EINA_FALSE;
-#else
- Ecore_X_Event_Window_Property* propertyChangedEvent( (Ecore_X_Event_Window_Property*)event );
- EventHandler* handler( (EventHandler*)data );
- Eina_Bool handled( ECORE_CALLBACK_PASS_ON );
-
- if ( handler && handler->mWindow )
- {
- WindowVisibilityObserver* observer( handler->mWindow->mAdaptor );
- if ( observer && ( propertyChangedEvent->win == handler->mEcoreWindow ) )
- {
- Ecore_X_Window_State_Hint state( ecore_x_icccm_state_get( propertyChangedEvent->win ) );
-
- switch ( state )
- {
- case ECORE_X_WINDOW_STATE_HINT_WITHDRAWN:
- {
- // Window was hidden.
- observer->OnWindowHidden();
- DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window (%d) Withdrawn\n", handler->mEcoreWindow );
- handled = ECORE_CALLBACK_DONE;
- }
- break;
-
- case ECORE_X_WINDOW_STATE_HINT_ICONIC:
- {
- // Window was iconified (minimised).
- observer->OnWindowHidden();
- DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window (%d) Iconfied\n", handler->mEcoreWindow );
- handled = ECORE_CALLBACK_DONE;
- }
- break;
-
- case ECORE_X_WINDOW_STATE_HINT_NORMAL:
- {
- // Window was shown.
- observer->OnWindowShown();
- DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window (%d) Shown\n", handler->mEcoreWindow );
- handled = ECORE_CALLBACK_DONE;
- }
- break;
-
- default:
- // Ignore
- break;
- }
- }
- }
-
- return handled;
-#endif
- }
-
- /// Called when the window properties are changed.
- static Eina_Bool EcoreEventClientMessage( void* data, int type, void* event )
- {
-#ifdef WAYLAND
- return EINA_FALSE;
-#else
- Eina_Bool handled( ECORE_CALLBACK_PASS_ON );
- Ecore_X_Event_Client_Message* clientMessageEvent( (Ecore_X_Event_Client_Message*)event );
- EventHandler* handler( (EventHandler*)data );
-
- if (clientMessageEvent->message_type == ECORE_X_ATOM_E_DEICONIFY_APPROVE)
- {
- ECoreX::WindowRenderSurface* x11Window( dynamic_cast< ECoreX::WindowRenderSurface * >( handler->mWindow->mSurface ) );
- WindowVisibilityObserver* observer( handler->mWindow->mAdaptor );
-
- if ( observer && ( (unsigned int)clientMessageEvent->data.l[0] == handler->mEcoreWindow ) )
- {
- if (clientMessageEvent->data.l[1] == 0) //wm sends request message using value 0
- {
- observer->OnWindowShown();
-
- // request to approve the deiconify. render-surface should send proper event after real rendering
- if(x11Window)
- {
- x11Window->RequestToApproveDeiconify();
- }
-
- handled = ECORE_CALLBACK_DONE;
- }
- }
- }
-
- return handled;
-#endif
- }
-
- // Data
- Window* mWindow;
- Ecore_Event_Handler* mWindowPropertyHandler;
- Ecore_Event_Handler* mClientMessagehandler;
-#ifdef WAYLAND
- Ecore_Wl_Window* mEcoreWindow;
-#else
- Ecore_X_Window mEcoreWindow;
-#endif
-};
-
-
-Window* Window::New(const PositionSize& posSize, const std::string& name, bool isTransparent)
-{
- Window* window = new Window();
- window->mIsTransparent = isTransparent;
- window->Initialize(posSize, name);
- return window;
-}
-
-void Window::SetAdaptor(Dali::Adaptor& adaptor)
-{
- DALI_ASSERT_ALWAYS( !mStarted && "Adaptor already started" );
- mStarted = true;
-
- // Only create one overlay per window
- Internal::Adaptor::Adaptor& adaptorImpl = Internal::Adaptor::Adaptor::GetImplementation(adaptor);
- Integration::Core& core = adaptorImpl.GetCore();
- mOverlay = &core.GetSystemOverlay();
-
- Dali::RenderTaskList taskList = mOverlay->GetOverlayRenderTasks();
- taskList.CreateTask();
-
- mAdaptor = &adaptorImpl;
- mAdaptor->AddObserver( *this );
-
- // Can only create the detector when we know the Core has been instantiated.
- mDragAndDropDetector = DragAndDropDetector::New();
- mAdaptor->SetDragAndDropDetector( &GetImplementation( mDragAndDropDetector ) );
-
- if( mOrientation )
- {
- mOrientation->SetAdaptor(adaptor);
- }
-
- if( mIndicator != NULL )
- {
- mIndicator->SetAdaptor(mAdaptor);
- }
-}
-
-RenderSurface* Window::GetSurface()
-{
- return mSurface;
-}
-
-void Window::SetIndicatorStyle( Dali::Window::IndicatorStyle style )
-{
- mIndicatorStyle = style;
-}
-
-void Window::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode )
-{
- DALI_LOG_TRACE_METHOD_FMT( gWindowLogFilter, "visible : %d\n", visibleMode );
- DALI_ASSERT_DEBUG(mOverlay);
-
-#ifndef WAYLAND
- ECoreX::WindowRenderSurface* x11Window = dynamic_cast< ECoreX::WindowRenderSurface * >( mSurface );
- DALI_ASSERT_DEBUG(x11Window);
- Ecore_X_Window xWinId = x11Window->GetXWindow();
-
- mIndicatorVisible = visibleMode;
-
- if ( mIndicatorVisible == Dali::Window::VISIBLE )
- {
- // when the indicator is visible, set proper mode for indicator server according to bg mode
- if ( mIndicatorOpacityMode == Dali::Window::OPAQUE )
- {
- ecore_x_e_illume_indicator_opacity_set(xWinId, ECORE_X_ILLUME_INDICATOR_OPAQUE);
- }
- else if ( mIndicatorOpacityMode == Dali::Window::TRANSLUCENT )
- {
- ecore_x_e_illume_indicator_opacity_set(xWinId, ECORE_X_ILLUME_INDICATOR_TRANSLUCENT);
- }
-#if defined(DALI_PROFILE_MOBILE)
- else if ( mIndicatorOpacityMode == Dali::Window::TRANSPARENT )
- {
- ecore_x_e_illume_indicator_opacity_set(xWinId, ECORE_X_ILLUME_INDICATOR_BG_TRANSPARENT);
- }
-#endif
- }
- else
- {
- // when the indicator is not visible, set TRANSPARENT mode for indicator server
- ecore_x_e_illume_indicator_opacity_set(xWinId, ECORE_X_ILLUME_INDICATOR_TRANSPARENT); // it means hidden indicator
- }
-#endif
-
- DoShowIndicator( mIndicatorOrientation );
-}
-
-void Window::RotateIndicator(Dali::Window::WindowOrientation orientation)
-{
- DALI_LOG_TRACE_METHOD_FMT( gWindowLogFilter, "Orientation: %d\n", orientation );
-
- DoRotateIndicator( orientation );
-}
-
-void Window::SetIndicatorBgOpacity( Dali::Window::IndicatorBgOpacity opacityMode )
-{
- mIndicatorOpacityMode = opacityMode;
-
- if( mIndicator != NULL )
- {
- mIndicator->SetOpacityMode( opacityMode );
- }
-}
-
-void Window::SetClass(std::string name, std::string klass)
-{
- // Get render surface's x11 window
- if( mSurface )
- {
-#ifndef WAYLAND
- ECoreX::WindowRenderSurface* x11Window = dynamic_cast< ECoreX::WindowRenderSurface * >( mSurface );
- if( x11Window )
- {
- ecore_x_icccm_name_class_set( x11Window->GetXWindow(), name.c_str(), klass.c_str() );
- }
-#endif
- }
-}
-
-Window::Window()
-: mSurface(NULL),
- mIndicatorStyle(Dali::Window::CHANGEABLE_COLOR),
- mIndicatorVisible(Dali::Window::VISIBLE),
- mIndicatorIsShown(false),
- mShowRotatedIndicatorOnClose(false),
- mStarted(false),
- mIsTransparent(false),
- mWMRotationAppSet(false),
- mIndicator(NULL),
- mIndicatorOrientation(Dali::Window::PORTRAIT),
- mNextIndicatorOrientation(Dali::Window::PORTRAIT),
- mIndicatorOpacityMode(Dali::Window::OPAQUE),
- mOverlay(NULL),
- mAdaptor(NULL)
-{
-}
-
-Window::~Window()
-{
- delete mEventHandler;
-
- if ( mAdaptor )
- {
- mAdaptor->RemoveObserver( *this );
- mAdaptor->SetDragAndDropDetector( NULL );
- mAdaptor = NULL;
- }
-
- delete mSurface;
-}
-
-void Window::Initialize(const PositionSize& windowPosition, const std::string& name)
-{
- // create an X11 window by default
- Any surface;
- Any display;
-#ifdef WAYLAND
- mSurface = new ECoreWayland::WindowRenderSurface( windowPosition, surface, display, name, mIsTransparent );
-#else
- mSurface = new ECoreX::WindowRenderSurface( windowPosition, surface, display, name, mIsTransparent );
-#endif
- mOrientation = Orientation::New(this);
-
- // create event handler for X11 window
- mEventHandler = new EventHandler( this );
-}
-
-void Window::DoShowIndicator( Dali::Window::WindowOrientation lastOrientation )
-{
- if( mIndicator == NULL )
- {
- if( mIndicatorVisible != Dali::Window::INVISIBLE )
- {
- mIndicator = new Indicator( mAdaptor, mIndicatorOrientation, mIndicatorStyle, this );
- mIndicator->SetOpacityMode( mIndicatorOpacityMode );
- Dali::Actor actor = mIndicator->GetActor();
- SetIndicatorActorRotation();
- mOverlay->Add(actor);
- }
- // else don't create a hidden indicator
- }
- else // Already have indicator
- {
- if( mIndicatorVisible == Dali::Window::VISIBLE )
- {
- // If we are resuming, and rotation has changed,
- if( mIndicatorIsShown == false && mIndicatorOrientation != mNextIndicatorOrientation )
- {
- // then close current indicator and open new one
- mShowRotatedIndicatorOnClose = true;
- mIndicator->Close(); // May synchronously call IndicatorClosed() callback & 1 level of recursion
- // Don't show actor - will contain indicator for old orientation.
- }
- }
- }
-
- // set indicator visible mode
- if( mIndicator != NULL )
- {
- mIndicator->SetVisible( mIndicatorVisible );
- }
-
- bool show = (mIndicatorVisible != Dali::Window::INVISIBLE );
- SetIndicatorProperties( show, lastOrientation );
- mIndicatorIsShown = show;
-}
-
-void Window::DoRotateIndicator( Dali::Window::WindowOrientation orientation )
-{
- if( mIndicatorIsShown )
- {
- mShowRotatedIndicatorOnClose = true;
- mNextIndicatorOrientation = orientation;
- mIndicator->Close(); // May synchronously call IndicatorClosed() callback
- }
- else
- {
- // Save orientation for when the indicator is next shown
- mShowRotatedIndicatorOnClose = false;
- mNextIndicatorOrientation = orientation;
- }
-}
-
-void Window::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation )
-{
-#ifndef WAYLAND
- ECoreX::WindowRenderSurface* x11Window = dynamic_cast< ECoreX::WindowRenderSurface * >( mSurface );
- if( x11Window )
- {
- Ecore_X_Window win = x11Window->GetXWindow();
-
- int show_state = static_cast<int>( isShow );
- ecore_x_window_prop_property_set( win,
- ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE,
- ECORE_X_ATOM_CARDINAL, 32, &show_state, 1);
-
- if ( isShow )
- {
- ecore_x_e_illume_indicator_state_set(win, ECORE_X_ILLUME_INDICATOR_STATE_ON);
- }
- else
- {
- ecore_x_e_illume_indicator_state_set(win, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
- }
- }
-#endif
-}
-
-void Window::IndicatorTypeChanged(Indicator::Type type)
-{
-#ifndef WAYLAND
- ECoreX::WindowRenderSurface* x11Window = dynamic_cast< ECoreX::WindowRenderSurface * >( mSurface );
- if( x11Window )
- {
- Ecore_X_Window win = x11Window->GetXWindow();
- switch(type)
- {
- case Indicator::INDICATOR_TYPE_1:
- ecore_x_e_illume_indicator_type_set( win, ECORE_X_ILLUME_INDICATOR_TYPE_1 );
- break;
-
- case Indicator::INDICATOR_TYPE_2:
- ecore_x_e_illume_indicator_type_set( win, ECORE_X_ILLUME_INDICATOR_TYPE_2 );
- break;
-
- case Indicator::INDICATOR_TYPE_UNKNOWN:
- default:
- break;
- }
- }
-#endif
-}
-
-void Window::IndicatorClosed( Indicator* indicator )
-{
- DALI_LOG_TRACE_METHOD( gWindowLogFilter );
-
- if( mShowRotatedIndicatorOnClose )
- {
- Dali::Window::WindowOrientation currentOrientation = mIndicatorOrientation;
- mIndicator->Open(mNextIndicatorOrientation);
- mIndicatorOrientation = mNextIndicatorOrientation;
- SetIndicatorActorRotation();
- DoShowIndicator(currentOrientation);
- }
-}
-
-void Window::SetIndicatorActorRotation()
-{
- DALI_LOG_TRACE_METHOD( gWindowLogFilter );
- DALI_ASSERT_DEBUG( mIndicator != NULL );
-
- Dali::Actor actor = mIndicator->GetActor();
- switch( mIndicatorOrientation )
- {
- case Dali::Window::PORTRAIT:
- actor.SetParentOrigin( ParentOrigin::TOP_CENTER );
- actor.SetAnchorPoint( AnchorPoint::TOP_CENTER );
- actor.SetRotation( Degree(0), Vector3::ZAXIS );
- break;
- case Dali::Window::PORTRAIT_INVERSE:
- actor.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
- actor.SetAnchorPoint( AnchorPoint::TOP_CENTER );
- actor.SetRotation( Degree(180), Vector3::ZAXIS );
- break;
- case Dali::Window::LANDSCAPE:
- actor.SetParentOrigin( ParentOrigin::CENTER_LEFT );
- actor.SetAnchorPoint( AnchorPoint::TOP_CENTER );
- actor.SetRotation( Degree(270), Vector3::ZAXIS );
- break;
- case Dali::Window::LANDSCAPE_INVERSE:
- actor.SetParentOrigin( ParentOrigin::CENTER_RIGHT );
- actor.SetAnchorPoint( AnchorPoint::TOP_CENTER );
- actor.SetRotation( Degree(90), Vector3::ZAXIS );
- break;
- }
-}
-
-void Window::Raise()
-{
-#ifndef WAYLAND
- ECoreX::WindowRenderSurface* x11Window = dynamic_cast< ECoreX::WindowRenderSurface * >( mSurface );
- if( x11Window )
- {
- Ecore_X_Window win = x11Window->GetXWindow();
- ecore_x_window_raise(win);
- }
-#endif
-}
-
-void Window::Lower()
-{
-#ifndef WAYLAND
- ECoreX::WindowRenderSurface* x11Window = dynamic_cast< ECoreX::WindowRenderSurface * >( mSurface );
- if( x11Window )
- {
- Ecore_X_Window win = x11Window->GetXWindow();
- ecore_x_window_lower(win);
- }
-#endif
-}
-
-void Window::Activate()
-{
-#ifndef WAYLAND
- ECoreX::WindowRenderSurface* x11Window = dynamic_cast< ECoreX::WindowRenderSurface * >( mSurface );
- if( x11Window )
- {
- Ecore_X_Window win = x11Window->GetXWindow();
- ecore_x_netwm_client_active_request(ecore_x_window_root_get(win), win, 1 /* request type, 1:application, 2:pager */, 0);
- }
-#endif
-}
-
-Dali::DragAndDropDetector Window::GetDragAndDropDetector() const
-{
- return mDragAndDropDetector;
-}
-
-void Window::OnStart()
-{
- DoShowIndicator( mIndicatorOrientation );
-}
-
-void Window::OnPause()
-{
-}
-
-void Window::OnResume()
-{
- // resume indicator status
- if( mIndicator != NULL )
- {
- // Restore own indicator opacity
- // Send opacity mode to indicator service when app resumed
- mIndicator->SetOpacityMode( mIndicatorOpacityMode );
- }
-}
-
-void Window::OnStop()
-{
- if( mIndicator )
- {
- mIndicator->Close();
- }
-
- delete mIndicator;
- mIndicator = NULL;
-}
-
-void Window::OnDestroy()
-{
- mAdaptor = NULL;
-}
-
-OrientationPtr Window::GetOrientation()
-{
- return mOrientation;
-}
-
-void Window::AddAvailableOrientation(Dali::Window::WindowOrientation orientation)
-{
- bool found = false;
-
- for( std::size_t i=0; i<mAvailableOrientations.size(); i++ )
- {
- if(mAvailableOrientations[i] == orientation)
- {
- found = true;
- break;
- }
- }
-
- if( ! found )
- {
- mAvailableOrientations.push_back(orientation);
- SetAvailableOrientations( mAvailableOrientations );
- }
-}
-
-void Window::RemoveAvailableOrientation(Dali::Window::WindowOrientation orientation)
-{
- for( std::vector<Dali::Window::WindowOrientation>::iterator iter = mAvailableOrientations.begin();
- iter != mAvailableOrientations.end(); ++iter )
- {
- if( *iter == orientation )
- {
- mAvailableOrientations.erase( iter );
- break;
- }
- }
- SetAvailableOrientations( mAvailableOrientations );
-}
-
-void Window::SetAvailableOrientations(const std::vector<Dali::Window::WindowOrientation>& orientations)
-{
- DALI_ASSERT_ALWAYS( mAvailableOrientations.size() <= 4 && "Incorrect number of available orientations" );
-
-#ifndef WAYLAND
- mAvailableOrientations = orientations;
- ECoreX::WindowRenderSurface* x11Window = dynamic_cast< ECoreX::WindowRenderSurface * >( mSurface );
- if( x11Window )
- {
- Ecore_X_Window ecoreWindow = x11Window->GetXWindow();
- if( ! mWMRotationAppSet )
- {
- mWMRotationAppSet = true;
- ecore_x_e_window_rotation_app_set(ecoreWindow, EINA_TRUE);
- }
-
- int rotations[4];
- for( std::size_t i=0; i<mAvailableOrientations.size(); i++ )
- {
- rotations[i] = static_cast<int>(mAvailableOrientations[i]);
- }
- ecore_x_e_window_rotation_available_rotations_set(ecoreWindow, rotations, mAvailableOrientations.size() );
-
- }
-#endif
-}
-
-const std::vector<Dali::Window::WindowOrientation>& Window::GetAvailableOrientations()
-{
- return mAvailableOrientations;
-}
-
-void Window::SetPreferredOrientation(Dali::Window::WindowOrientation orientation)
-{
- mPreferredOrientation = orientation;
-
-#ifndef WAYLAND
- ECoreX::WindowRenderSurface* x11Window = dynamic_cast< ECoreX::WindowRenderSurface * >( mSurface );
- if( x11Window )
- {
- Ecore_X_Window ecoreWindow = x11Window->GetXWindow();
-
- if( ! mWMRotationAppSet )
- {
- mWMRotationAppSet = true;
- ecore_x_e_window_rotation_app_set(ecoreWindow, EINA_TRUE);
- }
-
- ecore_x_e_window_rotation_preferred_rotation_set(ecoreWindow, orientation);
- }
-#endif
-}
-
-Dali::Window::WindowOrientation Window::GetPreferredOrientation()
-{
- return mPreferredOrientation;
-}
-
-void Window::RotationDone( int orientation, int width, int height )
-{
-#ifndef WAYLAND
- // Tell window manager we're done
- ECoreX::WindowRenderSurface* x11Window = dynamic_cast< ECoreX::WindowRenderSurface * >( mSurface );
- if( x11Window )
- {
- Ecore_X_Window ecoreWindow = x11Window->GetXWindow();
- Ecore_X_Window root = ecore_x_window_root_get(ecoreWindow);
-
- /**
- * send rotation done message to wm, even if window is already rotated.
- * that's why wm must be wait for comming rotation done message
- * after sending rotation request.
- */
- ecore_x_e_window_rotation_change_done_send(root, ecoreWindow, orientation, width, height);
-
- /**
- * set rotate window property
- */
- int angles[2] = { orientation, orientation };
- ecore_x_window_prop_property_set( ecoreWindow,
- ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
- ECORE_X_ATOM_CARDINAL, 32, &angles, 2 );
- }
-#endif
-}
-
-
-} // Adaptor
-} // Internal
-} // Dali
--- /dev/null
+#ifndef __DALI_APPLICATION_CONFIGURATION_H__
+#define __DALI_APPLICATION_CONFIGURATION_H__
+
+/*
+ * Copyright (c) 2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Dali
+{
+namespace Configuration
+{
+enum ContextLoss
+{
+ APPLICATION_HANDLES_CONTEXT_LOSS, ///< Application will tear down and recreate UI on context loss and context regained signals. Dali doesn't need to retain data.
+ APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS, ///< Application expects Dali to retain data ( increased memory footprint )
+};
+
+} // Configuration
+} // namespace Dali
+
+#endif
void Application::MainLoop()
{
- Internal::Adaptor::GetImplementation(*this).MainLoop();
+ Internal::Adaptor::GetImplementation(*this).MainLoop(Configuration::APPLICATION_HANDLES_CONTEXT_LOSS);
+}
+
+void Application::MainLoop(Configuration::ContextLoss configuration)
+{
+ Internal::Adaptor::GetImplementation(*this).MainLoop(configuration);
}
void Application::Lower()
return Internal::Adaptor::GetImplementation(*this).GetWindow();
}
+void Application::ReplaceWindow(PositionSize windowPosition, const std::string& name)
+{
+ Internal::Adaptor::GetImplementation(*this).ReplaceWindow(windowPosition, name);
+}
+
void Application::SetViewMode( ViewMode viewMode )
{
Internal::Adaptor::GetImplementation(*this).SetViewMode( viewMode );
#include <dali/public-api/object/base-handle.h>
#include <dali/public-api/common/view-mode.h>
+#include "application-configuration.h"
#include "style-monitor.h"
#include "device-layout.h"
#include "window.h"
public:
/**
- * This starts the application.
+ * This starts the application. Choosing this form of main loop indicates that the default
+ * application configuration of APPLICATION_HANDLES_CONTEXT_LOSS is used. On platforms where
+ * context loss can occur, the application is responsible for tearing down and re-loading UI.
+ * The application should listen to Stage::ContextLostSignal and Stage::ContextRegainedSignal.
*/
void MainLoop();
/**
+ * This starts the application, and allows the app to choose a different configuration.
+ * If the application plans on using the ReplaceSurface or ReplaceWindow API, then this will
+ * trigger context loss & regain.
+ * The application should listen to Stage::ContextLostSignal and Stage::ContextRegainedSignal.
+ */
+ void MainLoop(Configuration::ContextLoss configuration);
+
+ /**
* This lowers the application to bottom without actually quitting it
*/
void Lower();
*/
Window GetWindow();
+ /**
+ * Replace the current window.
+ * This will force context loss.
+ * If you plan on using this API in your application, then you should configure
+ * it to prevent discard behaviour when handling the Init signal.
+ * @param[in] windowPosition The position and size parameters of the new window
+ * @param[in] name The name of the new window
+ */
+ void ReplaceWindow(PositionSize windowPosition, const std::string& name);
+
public: // Stereoscopy
/**
/**
* The user should connect to this signal to determine when they should initialise
- * their application
+ * their application.
*/
AppSignalV2& InitSignal();
#include <dali/public-api/adaptor-framework/accessibility-gesture-handler.h>
#include <dali/public-api/adaptor-framework/accessibility-manager.h>
#include <dali/public-api/adaptor-framework/application.h>
+#include <dali/public-api/adaptor-framework/application-configuration.h>
#include <dali/public-api/adaptor-framework/bitmap-loader.h>
#include <dali/public-api/adaptor-framework/bitmap-saver.h>
#include <dali/public-api/adaptor-framework/clipboard.h>
$(adaptor_public_api_dir)/adaptor-framework/accessibility-gesture-handler.h \
$(adaptor_public_api_dir)/adaptor-framework/accessibility-manager.h \
$(adaptor_public_api_dir)/adaptor-framework/application.h \
+ $(adaptor_public_api_dir)/adaptor-framework/application-configuration.h \
$(adaptor_public_api_dir)/adaptor-framework/bitmap-loader.h \
$(adaptor_public_api_dir)/adaptor-framework/bitmap-saver.h \
$(adaptor_public_api_dir)/adaptor-framework/clipboard-event-notifier.h \
{
delete mEventHandler;
+ if( mIndicator )
+ {
+ mIndicator->Close();
+ delete mIndicator;
+ }
+
if ( mAdaptor )
{
mAdaptor->RemoveObserver( *this );
{
bool contextLost = false;
- // the surface is bound to the context, so set the context to null
- MakeContextNull();
-
- // destroy the surface
- DestroySurface();
-
- // If the display has not changed, then we can just create a new surface
+ // If the display connection has not changed, then we can just create a new surface
if ( display == mEglNativeDisplay )
{
+ // the surface is bound to the context, so set the context to null
+ MakeContextNull();
+
+ // destroy the surface
+ DestroySurface();
+
// create the EGL surface
CreateSurfaceWindow( window, mColorDepth );
// set the context to be current with the new surface
MakeContextCurrent();
}
- else // the display has changed, we need to start egl with a new x-connection
+ else // the display connection has changed, we need to start egl with a new x-connection
{
- // Note! this code path is untested
-
- // this will release all EGL specific resources
- eglTerminate( mEglDisplay );
-
- mGlesInitialized = false;
+ TerminateGles();
// let the adaptor know that all resources have been lost
contextLost = true;
// create the EGL surface
CreateSurfaceWindow( window, mColorDepth );
- // create the OpenGL context
+ // create the OpenGL context
CreateContext();
// Make it current
{
delete mEventHandler;
- if ( mAdaptor )
+ if( mIndicator )
+ {
+ mOverlay->Remove( mIndicator->GetActor() );
+ Dali::RenderTaskList taskList = mOverlay->GetOverlayRenderTasks();
+ Dali::RenderTask indicatorTask = taskList.GetTask(0);
+ mOverlay->GetOverlayRenderTasks().RemoveTask(indicatorTask);
+ mIndicator->Close();
+ delete mIndicator;
+ }
+
+ if( mAdaptor )
{
mAdaptor->RemoveObserver( *this );
mAdaptor->SetDragAndDropDetector( NULL );
fseek( fp, 0, 0 );
// Create a bitmap object and store a pointer to that object so it is destroyed at the end.
- Dali::Integration::Bitmap * bitmap = Dali::Integration::Bitmap::New( Dali::Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, false );
+ Dali::Integration::Bitmap * bitmap = Dali::Integration::Bitmap::New( Dali::Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
Dali::Integration::BitmapPtr bitmapPtr( bitmap );
FILE* fp = fopen( filename.c_str() , "rb" );
AutoCloseFile autoClose( fp );
- Dali::Integration::Bitmap* bitmap = Dali::Integration::Bitmap::New( Dali::Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, false );
+ Dali::Integration::Bitmap* bitmap = Dali::Integration::Bitmap::New( Dali::Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
Dali::Integration::BitmapPtr bitmapPtr( bitmap );
Dali::ImageAttributes attributes;
TestApplication::TestApplication( size_t surfaceWidth,
size_t surfaceHeight,
float horizontalDpi,
- float verticalDpi)
+ float verticalDpi,
+ ResourcePolicy::DataRetention policy)
: mCore( NULL ),
mSurfaceWidth( surfaceWidth ),
mSurfaceHeight( surfaceHeight ),
mFrame( 0u ),
mDpi( horizontalDpi, verticalDpi ),
- mLastVSyncTime(0u)
+ mLastVSyncTime(0u),
+ mDataRetentionPolicy( policy )
{
Initialize();
}
size_t surfaceWidth,
size_t surfaceHeight,
float horizontalDpi,
- float verticalDpi )
+ float verticalDpi,
+ ResourcePolicy::DataRetention policy)
: mCore( NULL ),
mSurfaceWidth( surfaceWidth ),
mSurfaceHeight( surfaceHeight ),
mFrame( 0u ),
- mDpi( horizontalDpi, verticalDpi )
+ mDpi( horizontalDpi, verticalDpi ),
+ mDataRetentionPolicy( policy )
{
if ( initialize )
{
mPlatformAbstraction,
mGlAbstraction,
mGlSyncAbstraction,
- mGestureManager );
+ mGestureManager,
+ mDataRetentionPolicy);
mCore->ContextCreated();
mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight );
void TestApplication::ResetContext()
{
- mCore->ContextToBeDestroyed();
+ mCore->ContextDestroyed();
mCore->ContextCreated();
}
#include "test-gl-abstraction.h"
#include "test-render-controller.h"
#include <dali/public-api/common/dali-common.h>
+#include <dali/integration-api/resource-policies.h>
namespace Dali
{
TestApplication( size_t surfaceWidth = DEFAULT_SURFACE_WIDTH,
size_t surfaceHeight = DEFAULT_SURFACE_HEIGHT,
float horizontalDpi = DEFAULT_HORIZONTAL_DPI,
- float verticalDpi = DEFAULT_VERTICAL_DPI );
+ float verticalDpi = DEFAULT_VERTICAL_DPI,
+ ResourcePolicy::DataRetention policy = ResourcePolicy::DALI_DISCARDS_ALL_DATA);
TestApplication( bool initialize,
size_t surfaceWidth = DEFAULT_SURFACE_WIDTH,
size_t surfaceHeight = DEFAULT_SURFACE_HEIGHT,
float horizontalDpi = DEFAULT_HORIZONTAL_DPI,
- float verticalDpi = DEFAULT_VERTICAL_DPI );
+ float verticalDpi = DEFAULT_VERTICAL_DPI,
+ ResourcePolicy::DataRetention policy = ResourcePolicy::DALI_DISCARDS_ALL_DATA);
void Initialize();
virtual ~TestApplication();
Vector2 mDpi;
unsigned int mLastVSyncTime;
+ ResourcePolicy::DataRetention mDataRetentionPolicy;
};
} // Dali
if( getBitmap )
{
- bitmapData = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true);
+ bitmapData = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD);
bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, 64, 64);
PixelBuffer* pixelBuffer = bitmapData->GetBuffer();
memset( pixelBuffer, it->character, 64*64 );
characters.insert( it->character );
Integration::GlyphMetrics character = {it->character, Integration::GlyphMetrics::HIGH_QUALITY, 10.0f, 10.0f, 9.0f, 1.0f, 10.0f, it->xPosition, it->yPosition };
- bitmapData = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true);
+ bitmapData = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD);
bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, 64, 64);
PixelBuffer* pixelBuffer = bitmapData->GetBuffer();
memset( pixelBuffer, it->character, 64*64 );
Integration::BitmapPtr TestPlatformAbstraction::GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character ) const
{
- Integration::BitmapPtr image = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
+ Integration::BitmapPtr image = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD );
image->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 1, 1 );
mTrace.PushCall("GetGlyphImage", "");
void SetReadMetricsResult( bool success, std::vector<Integration::GlyphMetrics>& glyphMetricsContainer );
-
private:
mutable TraceCallStack mTrace;
size_t mSeconds;
header,
profile ) )
{
- bitmap = Bitmap::New(profile, true);
+ bitmap = Bitmap::New(profile, ResourcePolicy::DISCARD );
DALI_LOG_SET_OBJECT_STRING(bitmap, path);
const BitmapResourceType& resType = static_cast<const BitmapResourceType&>(resourceType);
const unsigned newWidth = loadedWidth - 2 * columnsToTrim;
const unsigned newHeight = loadedHeight - 2 * scanlinesToTrim;
- BitmapPtr croppedBitmap = Bitmap::New( Bitmap::BITMAP_2D_PACKED_PIXELS, true );
+ BitmapPtr croppedBitmap = Bitmap::New( Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD );
Bitmap::PackedPixelsProfile * packedView = croppedBitmap->GetPackedPixelsProfile();
DALI_ASSERT_DEBUG( packedView );
const Pixel::Format pixelFormat = bitmap->GetPixelFormat();
std::vector<unsigned char> underlineAlphaMap(underlineBitmapSize);
std::fill(underlineAlphaMap.begin(), underlineAlphaMap.end(), 0xff);
- bitmapData = Integration::Bitmap::New(Bitmap::BITMAP_2D_PACKED_PIXELS, true);
+ bitmapData = Integration::Bitmap::New(Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD);
bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, fieldSize, fieldSize);
GenerateDistanceFieldMap( &(*underlineAlphaMap.begin()), Vector2(underlineBitmapWidth, underlineBitmapHeight),
bitmapData->GetBuffer(), Vector2(fieldSize, fieldSize),
{
if (0 != (bitmap.width * bitmap.rows))
{
- bitmapData = Integration::Bitmap::New(Bitmap::BITMAP_2D_PACKED_PIXELS, true);
+ bitmapData = Integration::Bitmap::New(Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD);
bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, fieldSize, fieldSize);
GenerateDistanceFieldMap(bitmap.buffer, Vector2(bitmap.width, bitmap.rows),
// However we will still need this code for characters like OGHAM SPACE MARK
// which will be blank with some fonts, and visible with others.
// Create a dummy bitmap of size 64,64
- bitmapData = Integration::Bitmap::New(Bitmap::BITMAP_2D_PACKED_PIXELS, true);
+ bitmapData = Integration::Bitmap::New(Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD);
bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, fieldSize, fieldSize);
PixelBuffer* pixelBuffer = bitmapData->GetBuffer();
memset( pixelBuffer, 0x0, fieldSize * fieldSize );
const std::size_t size = ftBitmap.width * ftBitmap.rows;
if( 0 < size )
{
- image = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
+ image = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD );
image->GetPackedPixelsProfile()->ReserveBuffer( Pixel::A8, ftBitmap.width, ftBitmap.rows );
memcpy( static_cast<unsigned char*>( image->GetBuffer() ), ftBitmap.buffer, size );
glyphMetrics.yPosition = requestedCharacters[n].yPosition;
// create a new bitmap, and copy in the data
- BitmapPtr bitmapData ( Integration::Bitmap::New(Bitmap::BITMAP_2D_PACKED_PIXELS, true) );
+ BitmapPtr bitmapData ( Integration::Bitmap::New(Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD) );
DALI_ASSERT_ALWAYS( data.length == DISTANCE_FIELD_SIZE * DISTANCE_FIELD_SIZE );
// assign the data
bool result = false;
bool file_not_found = false;
- BitmapPtr bitmap = Bitmap::New( Bitmap::BITMAP_2D_PACKED_PIXELS, true );
+ BitmapPtr bitmap = Bitmap::New( Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD );
DALI_LOG_SET_OBJECT_STRING(bitmap, request.GetPath());
BitmapResourceType& resType = static_cast<BitmapResourceType&>(*(request.GetType()));
if ((bitmap->GetPixelFormat() == Pixel::RGBA8888) || (bitmap->GetPixelFormat() == Pixel::RGB888))
{
// create a bitmap, so we can get its buffersize - to avoid a slow copy.
- BitmapPtr destBitmap = Bitmap::New( Bitmap::BITMAP_2D_PACKED_PIXELS, true );
+ BitmapPtr destBitmap = Bitmap::New( Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD );
destBitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, attributes.GetWidth(), attributes.GetHeight());
uint8_t* srcPixels = bitmap->GetBuffer();
glyphMetrics.yPosition = requestedCharacters[n].yPosition;
// create a new bitmap, and copy in the data
- BitmapPtr bitmapData ( Integration::Bitmap::New(Bitmap::BITMAP_2D_PACKED_PIXELS, true) );
+ BitmapPtr bitmapData ( Integration::Bitmap::New(Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD) );
DALI_ASSERT_ALWAYS( data.length == DISTANCE_FIELD_SIZE );
// assign the data