/*
- * Copyright (c) 2015 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.
: mGLES( adaptorInterfaces.GetGlesInterface() ),
mEglFactory( &adaptorInterfaces.GetEGLFactoryInterface()),
mEGL( NULL ),
- mSurfaceReplaced( false )
+ mSurfaceReplaced( false ),
+ mSurfaceResized( false )
{
// set the initial values before render thread starts
mSurface = adaptorInterfaces.GetRenderSurfaceInterface();
- mDisplayConnection = Dali::DisplayConnection::New();
+ if( mSurface )
+ {
+ mDisplayConnection = Dali::DisplayConnection::New( mSurface->GetSurfaceType() );
+ }
+ else
+ {
+ mDisplayConnection = Dali::DisplayConnection::New();
+ }
}
RenderHelper::~RenderHelper()
{
// Tell surface we have stopped rendering
mSurface->StopRender();
-
- // The surface will be destroyed soon; this pointer will become invalid
- mSurface = NULL;
}
}
void RenderHelper::ReplaceSurface( RenderSurface* newSurface )
{
+ mSurface->DestroyEglSurface(*mEGL);
+
// This is designed for replacing pixmap surfaces, but should work for window as well
// we need to delete the egl surface and renderable (pixmap / window)
// Then create a new pixmap/window and new egl surface
mSurfaceReplaced = true;
}
+void RenderHelper::ResizeSurface()
+{
+ mSurfaceResized = true;
+}
+
void RenderHelper::ShutdownEgl()
{
if( mSurface )
{
// give a chance to destroy the OpenGL surface that created externally
mSurface->DestroyEglSurface( *mEGL );
+
+ mSurface = NULL;
}
// delete the GL context / egl surface
{
if( mSurface )
{
- mSurface->PreRender( *mEGL, mGLES );
+ mSurface->PreRender( *mEGL, mGLES, mSurfaceResized );
}
mGLES.PreRender();
return true;
if( mSurface )
{
// Inform the surface that rendering this frame has finished.
- mSurface->PostRender( *mEGL, mGLES, mDisplayConnection, mSurfaceReplaced );
+ mSurface->PostRender( *mEGL, mGLES, mDisplayConnection, mSurfaceReplaced, mSurfaceResized );
}
mSurfaceReplaced = false;
+ mSurfaceResized = false;
}
} // namespace Adaptor