1 #ifndef DALI_TIZEN_PLATFORM_ABSTRACTION_H
2 #define DALI_TIZEN_PLATFORM_ABSTRACTION_H
5 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/adaptor-framework/timer.h>
23 #include <dali/public-api/dali-adaptor-common.h>
29 #include <dali/integration-api/platform-abstraction.h>
36 namespace TizenPlatform
41 * Concrete implementation of the platform abstraction class.
43 class TizenPlatformAbstraction : public Integration::PlatformAbstraction
46 public: // Construction & Destruction
51 TizenPlatformAbstraction();
56 virtual ~TizenPlatformAbstraction();
58 public: // PlatformAbstraction overrides
61 * @copydoc PlatformAbstraction::GetClosestImageSize()
63 virtual ImageDimensions GetClosestImageSize( const std::string& filename,
65 FittingMode::Type fittingMode,
66 SamplingMode::Type samplingMode,
67 bool orientationCorrection );
70 * @copydoc PlatformAbstraction::GetClosestImageSize()
72 virtual ImageDimensions GetClosestImageSize( Integration::ResourcePointer resourceBuffer,
74 FittingMode::Type fittingMode,
75 SamplingMode::Type samplingMode,
76 bool orientationCorrection );
79 * @copydoc PlatformAbstraction::LoadImageSynchronously()
81 virtual Integration::ResourcePointer LoadImageSynchronously(const Integration::BitmapResourceType& resource, const std::string& resourcePath);
84 * @copydoc PlatformAbstraction::DecodeBuffer()
86 virtual Integration::BitmapPtr DecodeBuffer( const Integration::BitmapResourceType& resource, uint8_t * buffer, size_t size );
89 * @copydoc PlatformAbstraction::LoadShaderBinaryFile()
91 virtual bool LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const;
94 * @copydoc PlatformAbstraction::SaveShaderBinaryFile()
96 virtual bool SaveShaderBinaryFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const;
99 * @copydoc PlatformAbstraction::StartTimer()
101 virtual uint32_t StartTimer( uint32_t milliseconds, CallbackBase* callback );
104 * @copydoc PlatformAbstraction::CancelTimer()
106 virtual void CancelTimer ( uint32_t timerId );
109 * Sets path for data/resource storage.
110 * @param[in] path data/resource storage path
112 void SetDataStoragePath( const std::string& path );
115 * Clears the timers that have completed
117 void CleanupTimers();
121 struct TimerCallback;
124 * Executes callback function and cleans up timer
126 void RunTimerFunction(TimerCallback& timerPtr);
128 TizenPlatformAbstraction( const TizenPlatformAbstraction& ); ///< Undefined
129 TizenPlatformAbstraction& operator=( const TizenPlatformAbstraction& ); ///< Undefined
131 std::string mDataStoragePath;
133 std::vector<TimerCallback*> mTimerPairsWaiting;
134 std::vector<TimerCallback*> mTimerPairsSpent;
138 * Construct a platform abstraction and return it.
139 * @return TizenPlatformAbstraction instance
141 TizenPlatformAbstraction* CreatePlatformAbstraction();
144 * Save a file to disk
145 * @param filename to create
146 * @param buffer to store
147 * @param numBytes to store
148 * @return true if successful, false otherwise
150 bool SaveFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes );
152 } // namespace TizenPlatform
156 #endif // DALI_TIZEN_PLATFORM_ABSTRACTION_H