/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Internal
{
-FrameBufferPtr FrameBuffer::New( unsigned int width, unsigned int height, Format format )
+FrameBufferPtr FrameBuffer::New( uint32_t width, uint32_t height, Mask attachments )
{
- FrameBufferPtr frameBuffer( new FrameBuffer( width, height, format ) );
+ FrameBufferPtr frameBuffer( new FrameBuffer( width, height, attachments ) );
frameBuffer->Initialize();
return frameBuffer;
}
return mRenderObject;
}
-FrameBuffer::FrameBuffer( unsigned int width, unsigned int height, Format format )
+FrameBuffer::FrameBuffer( uint32_t width, uint32_t height, Mask attachments )
: mEventThreadServices( *Stage::GetCurrent() ),
mRenderObject( NULL ),
- mColor(NULL),
+ mColor( NULL ),
mWidth( width ),
mHeight( height ),
- mFormat( format )
+ mAttachments( attachments )
{
}
void FrameBuffer::Initialize()
{
- mRenderObject = new Render::FrameBuffer( mWidth, mHeight, mFormat );
+ mRenderObject = new Render::FrameBuffer( mWidth, mHeight, mAttachments );
AddFrameBuffer( mEventThreadServices.GetUpdateManager(), *mRenderObject );
}
-void FrameBuffer::AttachColorTexture( NewTexturePtr texture, unsigned int mipmapLevel, unsigned int layer )
+void FrameBuffer::AttachColorTexture( TexturePtr texture, uint32_t mipmapLevel, uint32_t layer )
{
- if( (unsigned int)(texture->GetWidth() / (1<<mipmapLevel)) != mWidth ||
- (unsigned int)(texture->GetHeight() / (1<<mipmapLevel)) != mHeight )
+ if( ( texture->GetWidth() / ( 1u << mipmapLevel ) == mWidth ) &&
+ ( texture->GetHeight() / ( 1u << mipmapLevel ) == mHeight ) )
{
- DALI_LOG_ERROR( "Failed to attach color texture to FrameBuffer: Size mismatch \n" );
+ mColor = texture;
+ AttachColorTextureToFrameBuffer( mEventThreadServices.GetUpdateManager(), *mRenderObject, texture->GetRenderObject(), mipmapLevel, layer );
}
else
{
- mColor = texture;
- AttachColorTextureToFrameBuffer( mEventThreadServices.GetUpdateManager(), *mRenderObject, texture->GetRenderObject(), mipmapLevel, layer );
+ DALI_LOG_ERROR( "Failed to attach color texture to FrameBuffer: Size mismatch \n" );
}
}
-NewTexture* FrameBuffer::GetColorTexture()
+Texture* FrameBuffer::GetColorTexture()
{
return mColor.Get();
}