2 * Copyright (c) 2015 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.
19 #include <dali/internal/event/images/frame-buffer-image-impl.h>
22 #include <dali/public-api/object/type-registry.h>
23 #include <dali/internal/event/common/thread-local-storage.h>
33 TypeRegistration mType( typeid( Dali::FrameBufferImage ), typeid( Dali::Image ), NULL );
35 const int RenderBufferFormatToFrameBufferAttachments[] = { Dali::FrameBuffer::Attachment::NONE,
36 Dali::FrameBuffer::Attachment::DEPTH,
37 Dali::FrameBuffer::Attachment::STENCIL,
38 Dali::FrameBuffer::Attachment::DEPTH_STENCIL
41 } // unnamed namespace
43 FrameBufferImagePtr FrameBufferImage::New( unsigned int width,
45 Pixel::Format pixelFormat,
46 RenderBuffer::Format bufferformat )
48 FrameBufferImagePtr image = new FrameBufferImage( width, height );
51 image->mTexture = Texture::New( Dali::TextureType::TEXTURE_2D, pixelFormat, width, height );
52 image->mFrameBufferObject = FrameBuffer::New( width, height, RenderBufferFormatToFrameBufferAttachments[bufferformat] );
53 image->mFrameBufferObject->AttachColorTexture( image->mTexture, 0u, 0u );
58 FrameBufferImagePtr FrameBufferImage::New( NativeImageInterface& nativeImage )
60 FrameBufferImagePtr image = new FrameBufferImage( nativeImage );
63 image->mTexture = Texture::New( nativeImage );
64 image->mFrameBufferObject = FrameBuffer::New( image->mTexture->GetWidth(), image->mTexture->GetHeight(), Dali::FrameBuffer::Attachment::NONE );
65 image->mFrameBufferObject->AttachColorTexture( image->mTexture, 0u, 0u );
70 FrameBufferImage::FrameBufferImage( unsigned int width, unsigned int height)
79 FrameBufferImage::FrameBufferImage( NativeImageInterface& nativeImage )
81 mNativeImage( &nativeImage ),
84 mWidth = nativeImage.GetWidth();
85 mHeight = nativeImage.GetHeight();
89 bool FrameBufferImage::IsNativeFbo() const
94 FrameBufferImage::~FrameBufferImage()
98 } // namespace Internal