2 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <dali/internal/render/renderers/render-surface-frame-buffer.h>
21 #include <dali/internal/render/renderers/render-texture.h>
30 SurfaceFrameBuffer::SurfaceFrameBuffer( Integration::RenderSurface* surface )
34 mWidth( mSurface->GetPositionSize().width ),
35 mHeight( mSurface->GetPositionSize().height ),
36 mBackgroundColor( 0.f, 0.f, 0.f, 1.f ),
41 SurfaceFrameBuffer::~SurfaceFrameBuffer()
44 void SurfaceFrameBuffer::Destroy( Context& context )
48 void SurfaceFrameBuffer::GlContextDestroyed()
52 mContext->GlContextDestroyed();
56 void SurfaceFrameBuffer::Initialize(Context& context)
59 mContext->GlContextCreated();
60 mSurface->InitializeGraphics();
63 void SurfaceFrameBuffer::Bind( Context& context )
65 mSurface->PreRender( mSizeChanged );
67 context.BindFramebuffer( GL_FRAMEBUFFER, 0u );
70 uint32_t SurfaceFrameBuffer::GetWidth() const
75 uint32_t SurfaceFrameBuffer::GetHeight() const
80 void SurfaceFrameBuffer::PostRender()
82 mSurface->PostRender( false, false, mSizeChanged );
87 Context* SurfaceFrameBuffer::GetContext()
92 Integration::DepthBufferAvailable SurfaceFrameBuffer::GetDepthBufferRequired()
94 return mSurface->GetDepthBufferRequired();
97 Integration::StencilBufferAvailable SurfaceFrameBuffer::GetStencilBufferRequired()
99 return mSurface->GetStencilBufferRequired();
102 Vector4 SurfaceFrameBuffer::GetBackgroundColor()
104 return mBackgroundColor;
107 void SurfaceFrameBuffer::SetSize( uint32_t width, uint32_t height )
114 void SurfaceFrameBuffer::SetBackgroundColor( const Vector4& color )
116 mBackgroundColor = color;