Fix build error.
[platform/core/uifw/dali-adaptor.git] / adaptors / common / native-bitmap-buffer-impl.h
1 #ifndef __DALI_NATIVE_BITMAP_BUFFER_H__
2 #define __DALI_NATIVE_BITMAP_BUFFER_H__
3
4 /*
5  * Copyright (c) 2014 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 // EXTERNAL HEADERS
22 #include <dali/public-api/images/native-image-interface.h>
23 #include <dali/public-api/images/pixel.h>
24 #include <dali/integration-api/gl-abstraction.h>
25 #include <dali/integration-api/lockless-buffer.h>
26 #include <dali/public-api/common/dali-vector.h>
27
28 // INTERNAL HEADERS
29 #include <adaptor-impl.h>
30
31 namespace Dali
32 {
33
34 namespace Internal
35 {
36
37 namespace Adaptor
38 {
39
40 class NativeBitmapBuffer;
41 typedef IntrusivePtr<NativeBitmapBuffer> NativeBitmapBufferPtr;
42
43 /**
44  * A Bitmap-based implementation of the NativeImage interface.
45  */
46 class NativeBitmapBuffer : public NativeImageInterface
47 {
48
49 public:
50   /**
51    * Constructor.
52    * @param adaptor Adaptor used
53    * @param width width of image
54    * @param height height of image
55    * @param pixelFormat pixel format for image
56    */
57   NativeBitmapBuffer( Adaptor* adaptor, unsigned int width, unsigned int height, Pixel::Format pixelFormat );
58
59   /**
60    * virtual destructor
61    */
62   virtual ~NativeBitmapBuffer();
63
64   /**
65    * Write to buffer. Does not block.
66    * @param[in] src  data source
67    * @param[in] size size of data in bytes
68    * @return true if successful, false if currently reading from buffer in render thread
69    */
70   void Write( const unsigned char* src, size_t size );
71
72 public:
73   /**
74    * @copydoc Dali::NativeImageInterface::GlExtensionCreate()
75    */
76   virtual bool GlExtensionCreate();
77
78   /**
79    * @copydoc Dali::NativeImageInterface::GlExtensionDestroy()
80    */
81   virtual void GlExtensionDestroy();
82
83   /**
84    * @copydoc Dali::NativeImageInterface::TargetTexture()
85    */
86   virtual unsigned int TargetTexture();
87
88   /**
89    * @copydoc Dali::NativeImageInterface::PrepareTexture()
90    */
91   virtual void PrepareTexture();
92
93   /**
94    * @copydoc Dali::NativeImageInterface::GetWidth()
95    */
96   virtual unsigned int GetWidth() const;
97
98   /**
99    * @copydoc Dali::NativeImageInterface::GetHeight()
100    */
101   virtual unsigned int GetHeight() const;
102
103   /**
104    * @copydoc Dali::NativeImageInterface::RequiresBlending()
105    */
106   virtual bool RequiresBlending() const;
107
108 private:
109   NativeBitmapBuffer( const NativeBitmapBuffer& );             ///< not defined
110   NativeBitmapBuffer& operator =( const NativeBitmapBuffer& ); ///< not defined
111   NativeBitmapBuffer(); ///< not defined
112
113 private:
114   Integration::GlAbstraction*  mGlAbstraction; ///< GlAbstraction used
115
116   Integration::LocklessBuffer* mBuffer;        ///< bitmap data double buffered
117   unsigned int                 mWidth;         ///< Image width
118   unsigned int                 mHeight;        ///< Image height
119   Pixel::Format                mPixelFormat;   ///< Image pixelformat
120   const unsigned char*         mLastReadBuffer; ///< last buffer that was read
121 };
122
123 } // namespace Adaptor
124
125 } // namespace Internal
126
127 } // namespace Dali
128
129 #endif // __DALI_NATIVE_BITMAP_BUFFER_H__