[dali_1.2.49] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / texture-upload-observer.h
1 #ifndef DALI_TOOLKIT_INTERNAL_TEXTURE_UPLOAD_OBSERVER_H
2 #define DALI_TOOLKIT_INTERNAL_TEXTURE_UPLOAD_OBSERVER_H
3
4 /*
5  * Copyright (c) 2017 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 #include <dali/public-api/common/dali-common.h>
22 #include <dali/public-api/signals/dali-signal.h>
23
24 namespace Dali
25 {
26
27 class TextureSet;
28
29 namespace Toolkit
30 {
31
32
33 /**
34  * @brief Base class used to observe the upload status of a texture.
35  *
36  * Derived class must implement the UploadComplete method which is
37  * executed once the texture is ready to draw.
38  */
39 class DALI_IMPORT_API TextureUploadObserver
40 {
41 public:
42
43   typedef Signal< void ( TextureUploadObserver* ) > DestructionSignalType; ///< Signal prototype for the Destruction Signal.
44
45   /**
46    * @brief Constructor.
47    */
48   TextureUploadObserver();
49
50   /**
51    * @brief Virtual destructor.
52    */
53   virtual ~TextureUploadObserver();
54
55   /**
56    * The action to be taken once the async load has finished and the upload to GPU is completed.
57    * This should be overridden by the deriving class.
58    *
59    * @param[in] loadSuccess True if the texture load was successful (i.e. the resource is available). If false, then the resource failed to load. In future, this will automatically upload a "broken" image.
60    * @param[in] textureId   The textureId of the loaded texture in the TextureManager
61    * @param[in] textureSet  The TextureSet containing the Texture
62    * @param[in] useAtlasing True if atlasing was used (note: this may be different to what was requested)
63    * @param[in] atlasRect   If using atlasing, this is the rectangle within the atlas to use.
64    */
65   virtual void UploadComplete( bool loadSuccess, int32_t textureId, TextureSet textureSet, bool useAtlasing, const Vector4& atlasRect ) = 0;
66
67   /**
68    * @brief Returns the destruction signal.
69    * This is emitted when the observer is destroyed.
70    * This is used by the observer notifier to mark this observer as destroyed (IE. It no longer needs notifying).
71    */
72   DestructionSignalType& DestructionSignal();
73
74 private:
75
76   DestructionSignalType mDestructionSignal; ///< The destruction signal emitted when the observer is destroyed.
77
78 };
79
80
81 } // namespace Toolkit
82
83 } // namespace Dali
84
85 #endif // DALI_TOOLKIT_INTERNAL_TEXTURE_UPLOAD_OBSERVER_H