Remove TypeRegistration from deprecated Image classes
[platform/core/uifw/dali-core.git] / dali / internal / event / images / frame-buffer-image-impl.cpp
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/internal/event/images/frame-buffer-image-impl.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/object/type-registry.h>
23 #include <dali/internal/event/common/thread-local-storage.h>
24
25 namespace Dali
26 {
27
28 namespace Internal
29 {
30
31 namespace
32 {
33 const int RenderBufferFormatToFrameBufferAttachments[]  = { Dali::FrameBuffer::Attachment::NONE,
34                                                             Dali::FrameBuffer::Attachment::DEPTH,
35                                                             Dali::FrameBuffer::Attachment::STENCIL,
36                                                             Dali::FrameBuffer::Attachment::DEPTH_STENCIL
37                                                           };
38
39 } // unnamed namespace
40
41 FrameBufferImagePtr FrameBufferImage::New( unsigned int width,
42                                            unsigned int height,
43                                            Pixel::Format pixelFormat,
44                                            RenderBuffer::Format bufferformat )
45 {
46   FrameBufferImagePtr image = new FrameBufferImage( width, height );
47   image->Initialize();
48
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 );
52
53   return image;
54 }
55
56 FrameBufferImagePtr FrameBufferImage::New( NativeImageInterface& nativeImage )
57 {
58   FrameBufferImagePtr image = new FrameBufferImage( nativeImage );
59   image->Initialize();
60
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 );
64
65   return image;
66 }
67
68 FrameBufferImage::FrameBufferImage( unsigned int width, unsigned int height)
69 : Image(),
70   mNativeImage(0),
71   mIsNativeFbo( false )
72 {
73   mWidth  = width;
74   mHeight = height;
75 }
76
77 FrameBufferImage::FrameBufferImage( NativeImageInterface& nativeImage )
78 : Image(),
79   mNativeImage( &nativeImage ),
80   mIsNativeFbo( true )
81 {
82   mWidth = nativeImage.GetWidth();
83   mHeight = nativeImage.GetHeight();
84 }
85
86
87 bool FrameBufferImage::IsNativeFbo() const
88 {
89   return mIsNativeFbo;
90 }
91
92 FrameBufferImage::~FrameBufferImage()
93 {
94 }
95
96 } // namespace Internal
97
98 } // namespace Dali