1 #ifndef __DALI_EMSCRIPTEN_PLATFORM_ABSTRACTION_H__
2 #define __DALI_EMSCRIPTEN_PLATFORM_ABSTRACTION_H__
5 * Copyright (c) 2016 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.
28 #include <dali/integration-api/platform-abstraction.h>
29 #include <dali/integration-api/bitmap.h>
37 typedef IntrusivePtr<Dali::RefObject> ResourcePointer;
38 } // namespace Integration
41 * An Dali Platform abstraction using libSDL for Emscripten.
43 * Emscripten already wraps the SDL API so we can use this API to create windows/canvas in the browser
46 class DALI_IMPORT_API EmscriptenPlatformAbstraction : public Dali::Integration::PlatformAbstraction
60 std::vector< unsigned char> buffer;
67 EmscriptenPlatformAbstraction();
73 virtual ~EmscriptenPlatformAbstraction();
76 * @copydoc PlatformAbstraction::GetTimeMicroseconds()
78 virtual void GetTimeMicroseconds(unsigned int &seconds, unsigned int µSeconds);
80 void IncrementGetTimeResult(size_t milliseconds);
83 * @copydoc PlatformAbstraction::GetClosestImageSize()
85 virtual ImageDimensions GetClosestImageSize( const std::string& filename,
87 FittingMode::Type fittingMode,
88 SamplingMode::Type samplingMode,
89 bool orientationCorrection );
91 * @copydoc PlatformAbstraction::GetClosestImageSize()
93 virtual ImageDimensions GetClosestImageSize( Integration::ResourcePointer resourceBuffer,
95 FittingMode::Type fittingMode,
96 SamplingMode::Type samplingMode,
97 bool orientationCorrection );
100 * @copydoc PlatformAbstraction::LoadResourceSynchronously()
102 virtual Integration::ResourcePointer LoadResourceSynchronously( const Integration::ResourceType& resourceType, const std::string& resourcePath );
105 * @copydoc PlatformAbstraction::DecodeBuffer()
107 virtual Integration::BitmapPtr DecodeBuffer( const Integration::ResourceType& resourceType, uint8_t * buffer, size_t bufferSize );
110 * @copydoc PlatformAbstraction::LoadShaderBinaryFile()
112 virtual bool LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const;
115 * @copydoc PlatformAbstraction::SaveShaderBinaryFile()
117 virtual bool SaveShaderBinaryFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const;
120 * @copydoc PlatformAbstraction::UpdateDefaultsFromDevice()
122 virtual void UpdateDefaultsFromDevice();
125 std::string mGetDefaultFontFamilyResult;
128 LoadFileResult mLoadFileResult;
130 typedef std::pair< Integration::ResourceId, Integration::BitmapPtr > ResourceIdBitmapPair;
131 std::queue<ResourceIdBitmapPair> mResourceQueue;
137 #endif /* __DALI_TET_PLATFORM_ABSTRACTION_H__ */