Revert "[Tizen] Restore Uploaded signal for BufferImage and ResourceImage"
[platform/core/uifw/dali-core.git] / dali / internal / event / images / frame-buffer-image-impl.h
1 #ifndef __DALI_INTERNAL_FRAME_BUFFER_IMAGE_H__
2 #define __DALI_INTERNAL_FRAME_BUFFER_IMAGE_H__
3
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali/internal/event/images/image-impl.h>
23 #include <dali/public-api/images/frame-buffer-image.h>
24 #include <dali/internal/event/rendering/frame-buffer-impl.h>
25
26 namespace Dali
27 {
28
29 namespace Internal
30 {
31
32 class FrameBufferImage;
33 typedef IntrusivePtr<FrameBufferImage> FrameBufferImagePtr;
34
35 /**
36  * @copydoc Dali::FrameBufferImage
37  */
38 class FrameBufferImage : public Image
39 {
40 public:
41
42   /**
43    * @copydoc Dali::FrameBufferImage::New(unsigned int, unsigned int, Pixel::Format)
44    */
45   static FrameBufferImagePtr New( unsigned int width, unsigned int height, Pixel::Format pixelFormat, RenderBuffer::Format bufferformat );
46
47   /**
48    * @copydoc Dali::FrameBufferImage::New(NativeImageInterface&)
49    */
50   static FrameBufferImagePtr New( NativeImageInterface& nativeImage );
51
52   /**
53    * @copydoc Dali::FrameBufferImage::FrameBufferImage
54    */
55   FrameBufferImage( unsigned int width, unsigned int height );
56
57   /**
58    * @copydoc Dali::FrameBufferImage::FrameBufferImage
59    */
60   FrameBufferImage( NativeImageInterface& image );
61
62   /**
63    * @return true if this FBO is targeting a NativeImageInterface
64    */
65   bool IsNativeFbo() const;
66
67   /**
68    * @return Internal FrameBuffer used by this FrameBufferImage
69    */
70   FrameBuffer* GetFrameBuffer() const
71   {
72     return mFrameBufferObject.Get();
73   }
74
75 protected:
76   /**
77    * A reference counted object may only be deleted by calling Unreference()
78    */
79   virtual ~FrameBufferImage();
80
81 private:
82   // cached values for the size / pixel format we were created with. Needed to recreate us when we Connect() to stage and mTicket was reset from a previous call to Disconnect().
83   FrameBufferPtr  mFrameBufferObject;
84   NativeImageInterfacePtr mNativeImage;
85   bool mIsNativeFbo;
86 }; // class FrameBufferImage
87
88 } // namespace Internal
89
90 /**
91  * Helper methods for public API.
92  */
93 inline Internal::FrameBufferImage& GetImplementation(Dali::FrameBufferImage& image)
94 {
95   DALI_ASSERT_ALWAYS( image && "FrameBufferImage handle is empty" );
96
97   BaseObject& handle = image.GetBaseObject();
98
99   return static_cast<Internal::FrameBufferImage&>(handle);
100 }
101
102 inline const Internal::FrameBufferImage& GetImplementation(const Dali::FrameBufferImage& image)
103 {
104   DALI_ASSERT_ALWAYS( image && "FrameBufferImage handle is empty" );
105
106   const BaseObject& handle = image.GetBaseObject();
107
108   return static_cast<const Internal::FrameBufferImage&>(handle);
109 }
110
111 } // namespace Dali
112
113 #endif // __DALI_INTERNAL_FRAME_BUFFER_IMAGE_H__