Dali::Integration::Scene scene = Dali::Integration::Scene::New( Vector2( 480.0f, 800.0f ) );
DALI_TEST_CHECK( scene );
+ // Create the render surface for the scene
+ TestRenderSurface* renderSurface = new TestRenderSurface( Dali::PositionSize( 0, 0, 480.0f, 800.0f ) );
+ scene.SetSurface( *renderSurface );
+
// One reference of scene kept here and the other one kept in the Core
DALI_TEST_CHECK( scene.GetBaseObject().ReferenceCount() == 2 );
+ // Add a renderable actor to the scene
+ auto actor = CreateRenderableActor();
+ scene.Add( actor );
+
// Render and notify.
application.SendNotification();
application.Render(0);
void SurfaceFrameBuffer::Destroy( Context& context )
{
- if ( mSurface && !mIsSurfaceInvalid )
+ if ( IsSurfaceValid() )
{
mSurface->DestroySurface();
mSurface = nullptr;
mContext->GlContextDestroyed();
}
- if ( mSurface && !mIsSurfaceInvalid )
+ if ( IsSurfaceValid() )
{
mSurface->DestroySurface();
mSurface = nullptr;
mContext = &context;
mContext->GlContextCreated();
- if ( mSurface && !mIsSurfaceInvalid )
+ if ( IsSurfaceValid() )
{
mSurface->InitializeGraphics();
}
void SurfaceFrameBuffer::Bind( Context& context )
{
- if ( mSurface && !mIsSurfaceInvalid )
+ if ( IsSurfaceValid() )
{
mSurface->PreRender( mSizeChanged );
void SurfaceFrameBuffer::PostRender()
{
- if ( mSurface && !mIsSurfaceInvalid )
+ if ( IsSurfaceValid() )
{
mSurface->PostRender( false, false, mSizeChanged );
}
void SurfaceFrameBuffer::MakeContextCurrent()
{
- if ( mSurface && !mIsSurfaceInvalid )
+ if ( IsSurfaceValid() )
{
mSurface->MakeContextCurrent();
}
}
-Integration::DepthBufferAvailable SurfaceFrameBuffer::GetDepthBufferRequired()
-{
- return mSurface && !mIsSurfaceInvalid ? Integration::DepthBufferAvailable::FALSE : mSurface->GetDepthBufferRequired();
-}
-
-Integration::StencilBufferAvailable SurfaceFrameBuffer::GetStencilBufferRequired()
-{
- return mSurface && !mIsSurfaceInvalid ? Integration::StencilBufferAvailable::TRUE : mSurface->GetStencilBufferRequired();
-}
-
Vector4 SurfaceFrameBuffer::GetBackgroundColor()
{
return mBackgroundColor;
mBackgroundColor = color;
}
+bool SurfaceFrameBuffer::IsSurfaceValid() const
+{
+ return mSurface && !mIsSurfaceInvalid;
+}
+
} //Render
} //Internal
*/
void MarkSurfaceAsInvalid() { mIsSurfaceInvalid = true; };
+ /**
+ * @brief Gets whether the render surface in this frame buffer is valid or not
+ * @note The render surface becomes invalid when it is deleted in the event thread
+ * @return Whether the render surface is valid or not
+ */
+ bool IsSurfaceValid() const;
+
public:
/**
void MakeContextCurrent();
/**
- * @brief Gets whether the depth buffer is required
- * @return TRUE if the depth buffer is required
- */
- Integration::DepthBufferAvailable GetDepthBufferRequired();
-
- /**
- * @brief Gets whether the stencil buffer is required
- * @return TRUE if the stencil buffer is required
- */
- Integration::StencilBufferAvailable GetStencilBufferRequired();
-
- /**
* @brief Gets the background color of the surface.
* @return The background color
*/