Revert "License conversion from Flora to Apache 2.0"
[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) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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 // INTERNAL INCLUDES
21 #include <dali/internal/event/images/image-impl.h>
22 #include <dali/public-api/images/frame-buffer-image.h>
23
24 namespace Dali
25 {
26
27 namespace Internal
28 {
29
30 class FrameBufferImage;
31 typedef IntrusivePtr<FrameBufferImage> FrameBufferImagePtr;
32
33 /**
34  * @copydoc Dali::FrameBufferImage
35  */
36 class FrameBufferImage : public Image
37 {
38 public:
39   /// @copydoc Dali::FrameBufferImage::FrameBufferImage
40   FrameBufferImage(unsigned int width, unsigned int height, Pixel::Format pixelFormat);
41
42   /// @copydoc Dali::FrameBufferImage::FrameBufferImage
43   FrameBufferImage(unsigned int width, unsigned int height, Pixel::Format pixelFormat, ReleasePolicy releasePolicy);
44
45   /// @copydoc Dali::FrameBufferImage::FrameBufferImage
46   FrameBufferImage(NativeImage& image);
47
48   /// @copydoc Dali::FrameBufferImage::FrameBufferImage
49   FrameBufferImage(NativeImage& image, ReleasePolicy releasePolicy);
50
51 public: // From Image
52   /**
53    * @copydoc Dali::Internal::Image::Connect()
54    */
55   virtual void Connect();
56
57   /**
58    * @copydoc Dali::Internal::Image::Disconnect()
59    */
60   virtual void Disconnect();
61
62 protected:
63   /**
64    * A reference counted object may only be deleted by calling Unreference()
65    */
66   virtual ~FrameBufferImage();
67
68 private:
69   // 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().
70   NativeImagePtr mNativeImage;
71   Pixel::Format mPixelFormat;
72 }; // class FrameBufferImage
73
74 } // namespace Internal
75
76 /**
77  * Helper methods for public API.
78  */
79 inline Internal::FrameBufferImage& GetImplementation(Dali::FrameBufferImage& image)
80 {
81   DALI_ASSERT_ALWAYS( image && "FrameBufferImage handle is empty" );
82
83   BaseObject& handle = image.GetBaseObject();
84
85   return static_cast<Internal::FrameBufferImage&>(handle);
86 }
87
88 inline const Internal::FrameBufferImage& GetImplementation(const Dali::FrameBufferImage& image)
89 {
90   DALI_ASSERT_ALWAYS( image && "FrameBufferImage handle is empty" );
91
92   const BaseObject& handle = image.GetBaseObject();
93
94   return static_cast<const Internal::FrameBufferImage&>(handle);
95 }
96
97 } // namespace Dali
98
99 #endif // __DALI_INTERNAL_FRAME_BUFFER_IMAGE_H__