Merge "BufferImage Fix for multiple area updates." into devel/master
[platform/core/uifw/dali-core.git] / dali / internal / event / images / native-image-impl.h
1 #ifndef __DALI_INTERNAL_NATIVE_IMAGE_H__
2 #define __DALI_INTERNAL_NATIVE_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/public-api/images/native-image.h>
23 #include <dali/internal/event/images/image-impl.h>
24
25 namespace Dali
26 {
27
28 namespace Internal
29 {
30
31 class NativeImage;
32 typedef IntrusivePtr<NativeImage> NativeImagePtr;
33
34 /**
35  * @copydoc Dali::NativeImage
36  */
37 class NativeImage : public Image
38 {
39 public:
40
41   /**
42    * Creates object by using native resources
43    * the maximum size of the image is limited by GL_MAX_TEXTURE_SIZE
44    * @param [in] nativeImageInterface An reference to the object of the interface implementation.
45    * @return a pointer to a newly created object.
46    */
47   static NativeImagePtr New( NativeImageInterface& nativeImageInterface );
48
49   /**
50    * @copydoc Dali::NativeImage::CreateGlTexture
51    */
52   void CreateGlTexture();
53
54 protected:
55
56   /**
57    * Constructor
58    */
59   NativeImage();
60
61   /**
62    * A reference counted object may only be deleted by calling Unreference()
63    */
64   virtual ~NativeImage();
65 };
66
67 } // namespace Internal
68
69 /**
70  * Helper methods for public API.
71  */
72 inline Internal::NativeImage& GetImplementation(Dali::NativeImage& image)
73 {
74   DALI_ASSERT_ALWAYS( image && "Image handle is empty" );
75
76   BaseObject& handle = image.GetBaseObject();
77
78   return static_cast<Internal::NativeImage&>(handle);
79 }
80
81 inline const Internal::NativeImage& GetImplementation(const Dali::NativeImage& image)
82 {
83   DALI_ASSERT_ALWAYS( image && "Image handle is empty" );
84
85   const BaseObject& handle = image.GetBaseObject();
86
87   return static_cast<const Internal::NativeImage&>(handle);
88 }
89
90 } // namespace Dali
91 #endif // __DALI_INTERNAL_NATIVE_IMAGE_H__