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>
30 #include <dali/integration-api/platform-abstraction.h>
37 namespace TizenPlatform
42 * Concrete implementation of the platform abstraction class.
44 class TizenPlatformAbstraction : public Integration::PlatformAbstraction
47 public: // Construction & Destruction
52 TizenPlatformAbstraction();
57 virtual ~TizenPlatformAbstraction();
59 public: // PlatformAbstraction overrides
62 * @copydoc PlatformAbstraction::GetClosestImageSize()
64 virtual ImageDimensions GetClosestImageSize( const std::string& filename,
66 FittingMode::Type fittingMode,
67 SamplingMode::Type samplingMode,
68 bool orientationCorrection );
71 * @copydoc PlatformAbstraction::GetClosestImageSize()
73 virtual ImageDimensions GetClosestImageSize( Integration::ResourcePointer resourceBuffer,
75 FittingMode::Type fittingMode,
76 SamplingMode::Type samplingMode,
77 bool orientationCorrection );
80 * @copydoc PlatformAbstraction::LoadImageSynchronously()
82 virtual Integration::ResourcePointer LoadImageSynchronously(const Integration::BitmapResourceType& resource, const std::string& resourcePath);
85 * @copydoc PlatformAbstraction::DecodeBuffer()
87 virtual Integration::BitmapPtr DecodeBuffer( const Integration::BitmapResourceType& resource, uint8_t * buffer, size_t size );
90 * @copydoc PlatformAbstraction::LoadShaderBinaryFile()
92 virtual bool LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const;
95 * @copydoc PlatformAbstraction::SaveShaderBinaryFile()
97 virtual bool SaveShaderBinaryFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const;
100 * @copydoc PlatformAbstraction::StartTimer()
102 virtual uint32_t StartTimer( uint32_t milliseconds, CallbackBase* callback );
105 * @copydoc PlatformAbstraction::CancelTimer()
107 virtual void CancelTimer ( uint32_t timerId );
110 * Sets path for data/resource storage.
111 * @param[in] path data/resource storage path
113 void SetDataStoragePath( const std::string& path );
116 * Clears the timers that have completed
118 void CleanupTimers();
122 struct TimerCallback;
125 * Executes callback function and cleans up timer
127 void RunTimerFunction(TimerCallback& timerPtr);
129 TizenPlatformAbstraction( const TizenPlatformAbstraction& ); ///< Undefined
130 TizenPlatformAbstraction& operator=( const TizenPlatformAbstraction& ); ///< Undefined
132 std::string mDataStoragePath;
134 std::vector< std::unique_ptr< TimerCallback > > mTimerPairsWaiting;
135 std::vector< std::unique_ptr< TimerCallback > > mTimerPairsSpent;
139 * Construct a platform abstraction and return it.
140 * @return TizenPlatformAbstraction instance
142 TizenPlatformAbstraction* CreatePlatformAbstraction();
145 * Save a file to disk
146 * @param filename to create
147 * @param buffer to store
148 * @param numBytes to store
149 * @return true if successful, false otherwise
151 bool SaveFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes );
153 } // namespace TizenPlatform
157 #endif // DALI_TIZEN_PLATFORM_ABSTRACTION_H