X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Frender%2Frenderers%2Frender-surface-frame-buffer.cpp;h=7154ff698723d1488c251b48f7933549daf64efb;hb=66e7d2f6bcca8a495e126bc9fbcc1640c74b3c01;hp=7cc38bb2dda3d7cf3aabb2ebdb594645da0eb315;hpb=2ecd4fa47f0f90ff8679460fe35b433a09d45b47;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/render/renderers/render-surface-frame-buffer.cpp b/dali/internal/render/renderers/render-surface-frame-buffer.cpp index 7cc38bb..7154ff6 100644 --- a/dali/internal/render/renderers/render-surface-frame-buffer.cpp +++ b/dali/internal/render/renderers/render-surface-frame-buffer.cpp @@ -30,7 +30,12 @@ namespace Render SurfaceFrameBuffer::SurfaceFrameBuffer( Integration::RenderSurface* surface ) : FrameBuffer(), mSurface( surface ), - mContext( nullptr ) + mContext( nullptr ), + mWidth( mSurface->GetPositionSize().width ), + mHeight( mSurface->GetPositionSize().height ), + mBackgroundColor( 0.f, 0.f, 0.f, 1.f ), + mSizeChanged( false ), + mIsSurfaceInvalid( false ) { } @@ -39,6 +44,11 @@ SurfaceFrameBuffer::~SurfaceFrameBuffer() void SurfaceFrameBuffer::Destroy( Context& context ) { + if ( IsSurfaceValid() ) + { + mSurface->DestroySurface(); + mSurface = nullptr; + } } void SurfaceFrameBuffer::GlContextDestroyed() @@ -47,34 +57,53 @@ void SurfaceFrameBuffer::GlContextDestroyed() { mContext->GlContextDestroyed(); } + + if ( IsSurfaceValid() ) + { + mSurface->DestroySurface(); + mSurface = nullptr; + } } void SurfaceFrameBuffer::Initialize(Context& context) { mContext = &context; mContext->GlContextCreated(); - mSurface->InitializeGraphics(); + + if ( IsSurfaceValid() ) + { + mSurface->InitializeGraphics(); + } } void SurfaceFrameBuffer::Bind( Context& context ) { - mSurface->PreRender( false ); - context.BindFramebuffer( GL_FRAMEBUFFER, 0u ); + if ( IsSurfaceValid() ) + { + mSurface->PreRender( mSizeChanged ); + + context.BindFramebuffer( GL_FRAMEBUFFER, 0u ); + } } uint32_t SurfaceFrameBuffer::GetWidth() const { - return mSurface->GetPositionSize().width; + return mWidth; } uint32_t SurfaceFrameBuffer::GetHeight() const { - return mSurface->GetPositionSize().height; + return mHeight; } void SurfaceFrameBuffer::PostRender() { - mSurface->PostRender( false, false, false ); + if ( IsSurfaceValid() ) + { + mSurface->PostRender( false, false, mSizeChanged ); + } + + mSizeChanged = false; } Context* SurfaceFrameBuffer::GetContext() @@ -82,19 +111,34 @@ Context* SurfaceFrameBuffer::GetContext() return mContext; } -Integration::DepthBufferAvailable SurfaceFrameBuffer::GetDepthBufferRequired() +void SurfaceFrameBuffer::MakeContextCurrent() { - return mSurface->GetDepthBufferRequired(); + if ( IsSurfaceValid() ) + { + mSurface->MakeContextCurrent(); + } } -Integration::StencilBufferAvailable SurfaceFrameBuffer::GetStencilBufferRequired() +Vector4 SurfaceFrameBuffer::GetBackgroundColor() { - return mSurface->GetStencilBufferRequired(); + return mBackgroundColor; } -Vector4 SurfaceFrameBuffer::GetBackgroundColor() +void SurfaceFrameBuffer::SetSize( uint32_t width, uint32_t height ) +{ + mWidth = width; + mHeight = height; + mSizeChanged = true; +} + +void SurfaceFrameBuffer::SetBackgroundColor( const Vector4& color ) +{ + mBackgroundColor = color; +} + +bool SurfaceFrameBuffer::IsSurfaceValid() const { - return mSurface->GetBackgroundColor(); + return mSurface && !mIsSurfaceInvalid; } } //Render