Shader binary synchronous simplified IO
[platform/core/uifw/dali-adaptor.git] / platform-abstractions / tizen / tizen-platform-abstraction.h
1 #ifndef __DALI_TIZEN_PLATFORM_ABSTRACTION_H__
2 #define __DALI_TIZEN_PLATFORM_ABSTRACTION_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 #include <dali/integration-api/platform-abstraction.h>
22 #include <dali/integration-api/resource-cache.h>
23 #include <dali/public-api/common/dali-common.h>
24
25 #include <string>
26
27 namespace Dali
28 {
29
30 /**
31  * Construct a platform abstraction and return it.
32  */
33 Integration::PlatformAbstraction* CreatePlatformAbstraction();
34
35 namespace TizenPlatform
36 {
37
38 class ResourceLoader;
39
40 /**
41  * Concrete implementation of the platform abstraction class.
42  */
43 class TizenPlatformAbstraction : public Integration::PlatformAbstraction
44 {
45
46 public: // Construction & Destruction
47
48   /**
49    * Constructor
50    */
51   TizenPlatformAbstraction();
52
53   /**
54    * Destructor
55    */
56   virtual ~TizenPlatformAbstraction();
57
58 public: // PlatformAbstraction overrides
59
60   /**
61    * @copydoc PlatformAbstraction::GetTimeMicroseconds()
62    */
63   virtual void GetTimeMicroseconds(unsigned int &seconds, unsigned int &microSeconds);
64
65   /**
66    * @copydoc PlatformAbstraction::Suspend()
67    */
68   virtual void Suspend();
69
70   /**
71    * @copydoc PlatformAbstraction::Resume()
72    */
73   virtual void Resume();
74
75   /**
76    * @copydoc PlatformAbstraction::GetClosestImageSize()
77    */
78   virtual ImageDimensions GetClosestImageSize( const std::string& filename,
79                                                ImageDimensions size,
80                                                FittingMode::Type fittingMode,
81                                                SamplingMode::Type samplingMode,
82                                                bool orientationCorrection );
83
84   /**
85    * @copydoc PlatformAbstraction::GetClosestImageSize()
86    */
87   virtual ImageDimensions GetClosestImageSize( Integration::ResourcePointer resourceBuffer,
88                                                ImageDimensions size,
89                                                FittingMode::Type fittingMode,
90                                                SamplingMode::Type samplingMode,
91                                                bool orientationCorrection );
92
93   /**
94    * @copydoc PlatformAbstraction::LoadResource()
95    */
96   virtual void LoadResource(const Integration::ResourceRequest& request);
97
98   /**
99    * @copydoc PlatformAbstraction::LoadResourceSynchronously()
100    */
101   virtual Integration::ResourcePointer LoadResourceSynchronously(const Integration::ResourceType& resourceType, const std::string& resourcePath);
102
103   /**
104    * @copydoc PlatformAbstraction::SaveResource()
105    */
106   virtual void SaveResource(const Integration::ResourceRequest& request);
107
108   /**
109    * @copydoc PlatformAbstraction::CancelLoad()
110    */
111   virtual void CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId);
112
113   /**
114    * @copydoc PlatformAbstraction::GetResources()
115    */
116   virtual void GetResources(Integration::ResourceCache& cache);
117
118   /**
119    * @copydoc PlatformAbstraction::IsLoading()
120    */
121   virtual bool IsLoading();
122
123   /**
124    * @copydoc PlatformAbstraction::JoinLoaderThreads()
125    */
126   virtual void JoinLoaderThreads();
127
128   /**
129    * @copydoc PlatformAbstraction::GetDefaultFontDescription()
130    */
131   virtual void GetDefaultFontDescription( std::string& family, std::string& style ) const;
132
133   /**
134    * @copydoc PlatformAbstraction::GetDefaultFontSize()
135    */
136   virtual int GetDefaultFontSize() const;
137
138   /**
139    * @copydoc PlatformAbstraction::SetDpi()
140    */
141   virtual void SetDpi (unsigned int DpiHorizontal, unsigned int DpiVertical);
142
143   /**
144    * @copydoc PlatformAbstraction::LoadFile()
145    */
146   virtual bool LoadFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const;
147
148   /**
149    * @copydoc PlatformAbstraction::LoadFile()
150    */
151   virtual std::string LoadFile( const std::string& filename );
152
153   /**
154    * @copydoc PlatformAbstraction::SaveFile()
155    */
156   virtual bool SaveFile(const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const;
157
158   /**
159    * @copydoc PlatformAbstraction::LoadShaderBinaryFile()
160    */
161   virtual bool LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const;
162
163   /**
164    * @copydoc PlatformAbstraction::SaveShaderBinaryFile()
165    */
166   virtual bool SaveShaderBinaryFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const;
167
168   /**
169    * Sets path for data/resource storage.
170    * @param[in] path data/resource storage path
171    */
172   void SetDataStoragePath( const std::string& path );
173
174 private:
175   ResourceLoader* mResourceLoader;
176   std::string mDataStoragePath;
177 };
178
179 }  // namespace TizenPlatform
180 }  // namespace Dali
181
182 #endif // __DALI_TIZEN_PLATFORM_ABSTRACTION_H__