TestPlatformAbstraction::TestPlatformAbstraction()
: mTrace(),
mIsLoadingResult( false ),
- mSize(),
mClosestSize(),
mLoadFileResult(),
mSaveFileResult( false ),
return closestSize;
}
-Integration::ResourcePointer TestPlatformAbstraction::LoadResourceSynchronously( const Integration::ResourceType& resourceType, const std::string& resourcePath )
+Integration::ResourcePointer TestPlatformAbstraction::LoadImageSynchronously( const Integration::BitmapResourceType& resourceType, const std::string& resourcePath )
{
mTrace.PushCall("LoadResourceSynchronously", "");
return mSynchronouslyLoadedResource;
}
-Integration::BitmapPtr TestPlatformAbstraction::DecodeBuffer( const Integration::ResourceType& resourceType, uint8_t * buffer, size_t size )
+Integration::BitmapPtr TestPlatformAbstraction::DecodeBuffer( const Integration::BitmapResourceType& resourceType, uint8_t * buffer, size_t size )
{
mTrace.PushCall("DecodeBuffer", "");
return mDecodedBitmap;
// INTERNAL INCLUDES
#include <dali/integration-api/platform-abstraction.h>
+#include <dali/public-api/math/vector2.h>
#include "test-trace-call-stack.h"
/**
* @copydoc PlatformAbstraction::LoadResourceSynchronously()
*/
- virtual Integration::ResourcePointer LoadResourceSynchronously( const Integration::ResourceType& resourceType, const std::string& resourcePath );
+ virtual Integration::ResourcePointer LoadImageSynchronously( const Integration::BitmapResourceType& resourceType, const std::string& resourcePath );
/**
* @copydoc PlatformAbstraction::DecodeBuffer()
*/
- virtual Integration::BitmapPtr DecodeBuffer( const Dali::Integration::ResourceType& resourceType, uint8_t * buffer, size_t size );
+ virtual Integration::BitmapPtr DecodeBuffer( const Dali::Integration::BitmapResourceType& resourceType, uint8_t * buffer, size_t size );
/**
* @copydoc PlatformAbstraction::LoadShaderBinaryFile()
mutable TraceCallStack mTrace;
bool mIsLoadingResult;
- Vector2 mSize;
Vector2 mClosestSize;
LoadFileResult mLoadFileResult;
} // Dali
-#endif /* __DALI_TET_PLATFORM_ABSTRACTION_H__ */
+#endif /* __DALI_TEST_PLATFORM_ABSTRACTION_H__ */
#define __DALI_INTEGRATION_PLATFORM_ABSTRACTION_H__
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
public:
- /**
- * Virtual destructor.
- */
- virtual ~PlatformAbstraction() {}
-
// Resource Loading
/**
bool orientationCorrection = true) = 0;
/**
- * Request a resource from the native filesystem. This is a synchronous request, i.e.
- * it will block the main loop whilst executing. It should therefore be used sparingly.
+ * Request an image from the native filesystem. This is a synchronous request, i.e.
+ * it will block the main loop whilst executing.
*
* Multi-threading note: this method will be called from the main thread only i.e. not
* from within the Core::Render() method.
* @param[in] resourcePath The path to the resource
* @return A pointer to a ref-counted resource
*/
- virtual ResourcePointer LoadResourceSynchronously( const ResourceType& resourceType, const std::string& resourcePath ) = 0;
+ virtual ResourcePointer LoadImageSynchronously( const BitmapResourceType& resourceType, const std::string& resourcePath ) = 0;
/**
* Decode a buffer of data synchronously.
*
* @return A pointer to the decoded buffer.
*/
- virtual BitmapPtr DecodeBuffer( const ResourceType& resourceType, uint8_t * buffer, size_t bufferSize ) = 0;
+ virtual BitmapPtr DecodeBuffer( const BitmapResourceType& resourceType, uint8_t * buffer, size_t bufferSize ) = 0;
/**
* Load a shader binary file into a buffer
*/
virtual bool SaveShaderBinaryFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const = 0;
+protected:
+
+ /**
+ * Virtual destructor.
+ */
+ virtual ~PlatformAbstraction() {}
+
}; // class PlatformAbstraction
} // namespace Integration
// EXTERNAL INCLUDES
#include <stdint.h>
-#include <string>
// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/images/image-operations.h>
#include <dali/public-api/math/uint-16-pair.h>
-#include <dali/public-api/math/vector2.h>
namespace Dali
{
namespace Integration
{
-// Resource Types
-
-/**
- * Extendable set of resource types
- */
-enum ResourceTypeId
-{
- ResourceBitmap
-};
-
-/**
- * The abstract base class for resource types.
- */
-struct ResourceType
-{
- /**
- * Constructor.
- * @param[in] typeId resource type id
- */
- ResourceType(ResourceTypeId typeId)
- : id(typeId) {}
-
- /**
- * Destructor.
- */
- virtual ~ResourceType() {}
-
- /**
- * Create a copy of the resource type with the same attributes.
- * @return pointer to the new ResourceType.
- */
- virtual ResourceType* Clone() const = 0;
-
- const ResourceTypeId id;
-
-private:
-
- // Undefined copy constructor.
- ResourceType(const ResourceType& typePath);
-
- // Undefined assignment operator.
- ResourceType& operator=(const ResourceType& rhs);
-};
-
/**
- * BitmapResourceType describes a bitmap resource, which can be requested
- * from ResourceLoader::LoadResource() or AllocateBitmapImage.
+ * BitmapResourceType describes a bitmap resource.
*/
-struct BitmapResourceType : public ResourceType
+struct BitmapResourceType
{
/**
* Constructor.
FittingMode::Type scalingMode = FittingMode::DEFAULT,
SamplingMode::Type samplingMode = SamplingMode::DEFAULT,
bool orientationCorrection = true )
- : ResourceType(ResourceBitmap),
- size(size), scalingMode(scalingMode), samplingMode(samplingMode), orientationCorrection(orientationCorrection) {}
+ : size( size ),
+ scalingMode( scalingMode ),
+ samplingMode( samplingMode ),
+ orientationCorrection( orientationCorrection )
+ {}
/**
* Destructor.
*/
- virtual ~BitmapResourceType() {}
-
- /**
- * @copydoc ResourceType::Clone
- */
- virtual ResourceType* Clone() const
- {
- return new BitmapResourceType( size, scalingMode, samplingMode, orientationCorrection );
- }
+ ~BitmapResourceType()
+ {}
/**
* Attributes are copied from the request.
// Undefined assignment operator.
BitmapResourceType& operator=(const BitmapResourceType& rhs);
+
};
} // namespace Integration
Integration::BitmapResourceType resourceType;
// Note, bitmap is only destroyed when the image is destroyed.
- Integration::ResourcePointer resource = platformAbstraction.LoadResourceSynchronously( resourceType, filename );
+ Integration::ResourcePointer resource = platformAbstraction.LoadImageSynchronously( resourceType, filename );
if( resource )
{
mBitmap = static_cast<Integration::Bitmap*>( resource.Get());
mAttributes.GetOrientationCorrection() );
// Note, bitmap is only destroyed when the image is destroyed.
- Integration::ResourcePointer resource = platformAbstraction.LoadResourceSynchronously( resourceType, mUrl );
+ Integration::ResourcePointer resource = platformAbstraction.LoadImageSynchronously( resourceType, mUrl );
if( resource )
{
Integration::Bitmap* bitmap = static_cast<Integration::Bitmap*>( resource.Get() );