use modern construct 'override' in the derive class.
[platform/core/uifw/dali-core.git] / dali / internal / event / rendering / sampler-impl.h
1 #ifndef DALI_INTERNAL_SAMPLER_H
2 #define DALI_INTERNAL_SAMPLER_H
3
4 /*
5  * Copyright (c) 2016 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/actors/sampling.h>
23 #include <dali/public-api/common/dali-common.h> // DALI_ASSERT_ALWAYS
24 #include <dali/public-api/common/intrusive-ptr.h> // Dali::IntrusivePtr
25 #include <dali/public-api/rendering/sampler.h> // Dali::Sampler
26 #include <dali/internal/event/common/connectable.h> // Dali::Internal::Connectable
27 #include <dali/internal/event/common/object-connector.h> // Dali::Internal::ObjectConnector
28 #include <dali/internal/event/common/object-impl.h> // Dali::Internal::Object
29
30 namespace Dali
31 {
32 namespace Internal
33 {
34 namespace Render
35 {
36 struct Sampler;
37 }
38
39 class Sampler;
40 using SamplerPtr = IntrusivePtr<Sampler>;
41
42 /**
43  * Sampler is an object that contains an array of structures of values that
44  * can be accessed as properties.
45  */
46 class Sampler : public BaseObject
47 {
48 public:
49
50   /**
51    * Create a new Sampler.
52    * @return A smart-pointer to the newly allocated Sampler.
53    */
54   static SamplerPtr New( );
55
56   /**
57    * @copydoc Dali::Sampler::SetFilterMode()
58    */
59   void SetFilterMode( Dali::FilterMode::Type minFilter, Dali::FilterMode::Type magFilter );
60
61   /**
62    * @copydoc Dali::Sampler::SetWrapMode()
63    */
64   void SetWrapMode( Dali::WrapMode::Type rWrap, Dali::WrapMode::Type sWrap, Dali::WrapMode::Type tWrap );
65
66   /**
67    * Get the render thread sampler
68    *
69    * @return The render thread sampler
70    */
71   Render::Sampler* GetSamplerRenderObject();
72
73 private:
74   Sampler();
75
76   /**
77    * Second stage initialization
78    */
79   void Initialize( );
80
81 protected:
82   /**
83    * A reference counted object may only be deleted by calling Unreference()
84    */
85   ~Sampler() override;
86
87 private: // data
88   EventThreadServices& mEventThreadServices;    ///<Used to send messages to the render thread via the update thread
89   Render::Sampler* mRenderObject;               ///<Render thread sampler for this sampler
90
91 };
92
93 } // namespace Internal
94
95 // Helpers for public-api forwarding methods
96 inline Internal::Sampler& GetImplementation(Dali::Sampler& handle)
97 {
98   DALI_ASSERT_ALWAYS(handle && "Sampler handle is empty");
99
100   BaseObject& object = handle.GetBaseObject();
101
102   return static_cast<Internal::Sampler&>(object);
103 }
104
105 inline const Internal::Sampler& GetImplementation(const Dali::Sampler& handle)
106 {
107   DALI_ASSERT_ALWAYS(handle && "Sampler handle is empty");
108
109   const BaseObject& object = handle.GetBaseObject();
110
111   return static_cast<const Internal::Sampler&>(object);
112 }
113
114 } // namespace Dali
115
116 #endif // DALI_INTERNAL_SAMPLER_H