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 const int RenderBufferFormatToFrameBufferAttachments[] = { Dali::FrameBuffer::Attachment::NONE,
34 Dali::FrameBuffer::Attachment::DEPTH,
35 Dali::FrameBuffer::Attachment::STENCIL,
36 Dali::FrameBuffer::Attachment::DEPTH_STENCIL
39 } // unnamed namespace
41 FrameBufferImagePtr FrameBufferImage::New( unsigned int width,
43 Pixel::Format pixelFormat,
44 RenderBuffer::Format bufferformat )
46 FrameBufferImagePtr image = new FrameBufferImage( width, height );
49 image->mTexture = Texture::New( Dali::TextureType::TEXTURE_2D, pixelFormat, width, height );
50 image->mFrameBufferObject = FrameBuffer::New( width, height, RenderBufferFormatToFrameBufferAttachments[bufferformat] );
51 image->mFrameBufferObject->AttachColorTexture( image->mTexture, 0u, 0u );
56 FrameBufferImagePtr FrameBufferImage::New( NativeImageInterface& nativeImage )
58 FrameBufferImagePtr image = new FrameBufferImage( nativeImage );
61 image->mTexture = Texture::New( nativeImage );
62 image->mFrameBufferObject = FrameBuffer::New( image->mTexture->GetWidth(), image->mTexture->GetHeight(), Dali::FrameBuffer::Attachment::NONE );
63 image->mFrameBufferObject->AttachColorTexture( image->mTexture, 0u, 0u );
68 FrameBufferImage::FrameBufferImage( unsigned int width, unsigned int height)
77 FrameBufferImage::FrameBufferImage( NativeImageInterface& nativeImage )
79 mNativeImage( &nativeImage ),
82 mWidth = nativeImage.GetWidth();
83 mHeight = nativeImage.GetHeight();
87 bool FrameBufferImage::IsNativeFbo() const
92 FrameBufferImage::~FrameBufferImage()
96 } // namespace Internal