X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Frender%2Frenderers%2Frender-surface-frame-buffer.cpp;h=babd67f54db66ddf43530599191010eba6ebdbd3;hb=b43741a90b40ca9dfbd33d6a9d390d3c09230e89;hp=7cc38bb2dda3d7cf3aabb2ebdb594645da0eb315;hpb=d8944bba8449a3c5bce03041eccccf2eba4a7ae3;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 old mode 100644 new mode 100755 index 7cc38bb..babd67f --- a/dali/internal/render/renderers/render-surface-frame-buffer.cpp +++ b/dali/internal/render/renderers/render-surface-frame-buffer.cpp @@ -30,7 +30,14 @@ 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 ), + mBackgroundColorChanged( false ), + mIsSurfaceInvalid( false ), + mPartialUpdateEnabled( true ) { } @@ -39,6 +46,11 @@ SurfaceFrameBuffer::~SurfaceFrameBuffer() void SurfaceFrameBuffer::Destroy( Context& context ) { + if ( IsSurfaceValid() ) + { + mSurface->DestroySurface(); + mSurface = nullptr; + } } void SurfaceFrameBuffer::GlContextDestroyed() @@ -47,34 +59,65 @@ 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; + mBackgroundColorChanged = false; + mPartialUpdateEnabled = true; +} + +Rect SurfaceFrameBuffer::SetDamagedRect( const Rect& damagedRect ) +{ + Rect ret; + if ( IsSurfaceValid() ) + { + ret = mSurface->SetDamagedRect( damagedRect ); + } + return ret; } Context* SurfaceFrameBuffer::GetContext() @@ -82,19 +125,50 @@ 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; + mBackgroundColorChanged = true; +} + +bool SurfaceFrameBuffer::IsSurfaceValid() const +{ + return mSurface && !mIsSurfaceInvalid; +} + +bool SurfaceFrameBuffer::IsPartialUpdateEnabled() const +{ + bool ret = false; + if ( IsSurfaceValid() ) + { + ret = mSurface->GetBufferAge() && ( mPartialUpdateEnabled && !( mSizeChanged || mBackgroundColorChanged ) ); + } + return ret; +} + +void SurfaceFrameBuffer::SetPartialUpdateEnabled( bool value ) { - return mSurface->GetBackgroundColor(); + mPartialUpdateEnabled = value; } } //Render