mNewSurface(NULL),
mDeletedSurface(nullptr),
mPostRendering(FALSE),
- mSurfaceResized(FALSE),
+ mSurfaceResized(0),
mForceClear(FALSE),
mUploadWithoutRendering(FALSE),
mFirstFrameAfterResume(FALSE)
{
ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition);
- mPostRendering = FALSE; // Clear the post-rendering flag as Update/Render thread will resize the surface now
- mSurfaceResized = TRUE;
+ mPostRendering = FALSE; // Clear the post-rendering flag as Update/Render thread will resize the surface now
+ // Surface is resized and the surface resized count is increased.
+ mSurfaceResized++;
mUpdateRenderThreadWaitCondition.Notify(lock);
}
}
// Then create a new pixmap/window and new surface
// If the new surface has a different display connection, then the context will be lost
mAdaptorInterfaces.GetDisplayConnectionInterface().Initialize();
- newSurface->InitializeGraphics();
- newSurface->MakeContextCurrent();
+ graphics.ActivateSurfaceContext(newSurface);
// TODO: ReplaceGraphicsSurface doesn't work, InitializeGraphics()
// already creates new surface window, the surface and the context.
// We probably don't need ReplaceGraphicsSurface at all.
LOG_UPDATE_RENDER("Notification Triggered");
}
- // Check resize
- bool surfaceResized = false;
- bool shouldSurfaceBeResized = ShouldSurfaceBeResized();
- if(DALI_UNLIKELY(shouldSurfaceBeResized))
- {
- if(updateStatus.SurfaceRectChanged())
- {
- LOG_UPDATE_RENDER_TRACE_FMT("Resizing Surface");
- SurfaceResized();
- surfaceResized = true;
- }
- }
-
// Optional logging of update/render status
mUpdateStatusLogger.Log(keepUpdatingStatus);
WindowContainer windows;
mAdaptorInterfaces.GetWindowContainerInterface(windows);
+ bool sceneSurfaceResized;
+
for(auto&& window : windows)
{
Dali::Integration::Scene scene = window->GetScene();
{
Integration::RenderStatus windowRenderStatus;
- windowSurface->InitializeGraphics();
+ // Get Surface Resized flag
+ sceneSurfaceResized = scene.IsSurfaceRectChanged();
+ windowSurface->SetIsResizing(sceneSurfaceResized);
// clear previous frame damaged render items rects, buffer history is tracked on surface level
mDamagedRects.clear();
Rect<int> clippingRect; // Empty for fbo rendering
- // Switch to the context of the surface, merge damaged areas for previous frames
- windowSurface->PreRender(surfaceResized, mDamagedRects, clippingRect); // Switch GL context
+ windowSurface->InitializeGraphics();
- if(clippingRect.IsEmpty())
- {
- mDamagedRects.clear();
- }
+ // Switch to the context of the surface, merge damaged areas for previous frames
+ windowSurface->PreRender(sceneSurfaceResized, mDamagedRects, clippingRect); // Switch GL context
// Render the surface
mCore.RenderScene(windowRenderStatus, scene, false, clippingRect);
- if(windowRenderStatus.NeedsPostRender())
+ // Buffer swapping now happens when the surface render target is presented.
+
+ // If surface is resized, the surface resized count is decreased.
+ if(DALI_UNLIKELY(sceneSurfaceResized))
{
- windowSurface->PostRender(false, false, surfaceResized, mDamagedRects); // Swap Buffer with damage
+ SurfaceResized();
}
}
}
}
+ if(!mUploadWithoutRendering)
+ {
+ graphics.PostRender();
+ }
+
mCore.PostRender(mUploadWithoutRendering);
//////////////////////////////
mSurfaceSemaphore.Release(1);
}
-bool CombinedUpdateRenderController::ShouldSurfaceBeResized()
-{
- ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition);
- return mSurfaceResized;
-}
-
void CombinedUpdateRenderController::SurfaceResized()
{
ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition);
- mSurfaceResized = FALSE;
+ if(mSurfaceResized)
+ {
+ mSurfaceResized--;
+ }
}
///////////////////////////////////////////////////////////////////////////////////////////////////