1 #ifndef DALI_INTERNAL_FRAME_BUFFER_H
2 #define DALI_INTERNAL_FRAME_BUFFER_H
5 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/common/dali-common.h> // DALI_ASSERT_ALWAYS
23 #include <dali/public-api/common/intrusive-ptr.h> // Dali::IntrusivePtr
24 #include <dali/public-api/object/base-object.h>
25 #include <dali/devel-api/rendering/frame-buffer.h>
26 #include <dali/internal/event/rendering/texture-impl.h>
27 #include <dali/internal/event/common/event-thread-services.h>
39 typedef IntrusivePtr<FrameBuffer> FrameBufferPtr;
41 class FrameBuffer : public BaseObject
45 typedef Dali::FrameBuffer::Format Format;
48 * @brief Create a new FrameBuffer
50 * @param[in] width The width of the FrameBuffer
51 * @param[in] height The height of the FrameBuffer
52 * @param[in] format The format of the FrameBuffer
53 * @return A smart-pointer to the newly allocated Texture.
55 static FrameBufferPtr New( unsigned int width, unsigned int height, Format format );
58 * @brief Get the FrameBuffer render object
60 * @return the FrameBuffer render object
62 Render::FrameBuffer* GetRenderObject() const;
65 * @copydoc Dali::FrameBuffer::AttachColorTexture()
67 void AttachColorTexture( NewTexturePtr texture, unsigned int mipmapLevel, unsigned int layer );
70 * @copydoc Dali::FrameBuffer::GetColorTexture()
72 NewTexture* GetColorTexture();
74 private: // implementation
78 * @param[in] width The width of the FrameBuffer
79 * @param[in] height The height of the FrameBuffer
80 * @param[in] format The format of the FrameBuffer
82 FrameBuffer( unsigned int width, unsigned int height, Format format );
85 * Second stage initialization of the Texture
92 * A reference counted object may only be deleted by calling Unreference()
94 virtual ~FrameBuffer();
96 private: // unimplemented methods
97 FrameBuffer( const FrameBuffer& );
98 FrameBuffer& operator=( const FrameBuffer& );
102 Internal::EventThreadServices& mEventThreadServices; ///<Used to send messages to the render thread via update thread
103 Internal::Render::FrameBuffer* mRenderObject; ///<The Render::Texture associated to this texture
105 NewTexturePtr mColor;
107 unsigned int mHeight;
112 } // namespace Internal
114 // Helpers for public-api forwarding methods
115 inline Internal::FrameBuffer& GetImplementation(Dali::FrameBuffer& handle)
117 DALI_ASSERT_ALWAYS(handle && "FrameBuffer handle is empty");
119 BaseObject& object = handle.GetBaseObject();
121 return static_cast<Internal::FrameBuffer&>(object);
124 inline const Internal::FrameBuffer& GetImplementation(const Dali::FrameBuffer& handle)
126 DALI_ASSERT_ALWAYS(handle && "FrameBuffer handle is empty");
128 const BaseObject& object = handle.GetBaseObject();
130 return static_cast<const Internal::FrameBuffer&>(object);
135 #endif // DALI_INTERNAL_FRAME_BUFFER_H