// Resource Types
/**
- * Extendable set of resource types
+ * Extendable set of resource type identifiers used by ResourceType subclasses.
*/
enum ResourceTypeId
{
- ResourceBitmap,
+ ResourceImageData, ///< A buffer of image data with dimension and type metadata.
ResourceNativeImage,
ResourceTargetImage,
ResourceShader,
ResourceModel,
ResourceMesh,
- ResourceText
+ ResourceText,
+ ResourceTexture, ///< Used to pass through a request for a GLES texture to be allocated on the render thread.
+ ResourceAppBitmap ///< Used in Core to tag Bitmaps that belong to BitmapImages.
};
/**
- * The abstract base class for resource types.
+ * @brief A ResourceType-derived class is just a data bucket.
+ *
+ * Each ResourceType derived class carries a bundle of data specific to one or
+ * more resource request types that are unambiguously specified by the
+ * <code>id</code> member of this base class.
+ * Dispatch on that ResourceTypeId to know exactly which kind of resource
+ * request is associated with a particular instance.
*/
struct DALI_IMPORT_API ResourceType
{
ResourceType(ResourceTypeId typeId)
: id(typeId) {}
- /**
- * Destructor.
- */
virtual ~ResourceType() {}
/**
private:
// Undefined copy constructor.
- ResourceType(const ResourceType& typePath);
+ ResourceType( const ResourceType& type );
// Undefined assignment operator.
- ResourceType& operator=(const ResourceType& rhs);
+ ResourceType& operator=( const ResourceType& rhs );
};
/**
- * BitmapResourceType describes a bitmap resource, which can be requested
- * from ResourceLoader::LoadResource() or AllocateBitmapImage.
+ * ImageResourceType can be used to identify a a request as pertaining
+ * to images and carries some image attributes to modify the request.
+ * @todo Replace all uses of other image-related ResourceTypes with
+ * this one as they are duplicates.
*/
-struct DALI_IMPORT_API BitmapResourceType : public ResourceType
+struct DALI_IMPORT_API ImageResourceType : public ResourceType
{
/**
* Constructor.
+ * @param[in] typeId One of the image ResourceTypeIds.
* @param[in] attribs parameters for image loading request
*/
- BitmapResourceType(const ImageAttributes& attribs)
- : ResourceType(ResourceBitmap),
- imageAttributes(attribs) {}
-
- /**
- * Destructor.
- */
- virtual ~BitmapResourceType() {}
+ ImageResourceType(const ResourceTypeId typeId, const ImageAttributes& attribs)
+ : ResourceType(typeId),
+ imageAttributes(attribs)
+ {
+ DALI_ASSERT_DEBUG( typeId == ResourceTexture || typeId == ResourceImageData || typeId == ResourceNativeImage || typeId == ResourceTargetImage || typeId == ResourceAppBitmap );
+ }
/**
* @copydoc ResourceType::Clone
*/
virtual ResourceType* Clone() const
{
- return new BitmapResourceType(imageAttributes);
+ return new ImageResourceType( id, imageAttributes );
}
/**
* Attributes are copied from the request.
*/
ImageAttributes imageAttributes;
-
-private:
-
- // Undefined copy constructor.
- BitmapResourceType(const BitmapResourceType& typePath);
-
- // Undefined assignment operator.
- BitmapResourceType& operator=(const BitmapResourceType& rhs);
};
/**
struct DALI_IMPORT_API NativeImageResourceType : public ResourceType
{
/**
- * Constructor.
+ * Default constructor initialises the base class with the correct ResourceTypeId.
*/
NativeImageResourceType()
: ResourceType(ResourceNativeImage) {}
: ResourceType(ResourceNativeImage),
imageAttributes(attribs) {}
- /**
- * Destructor.
- */
- virtual ~NativeImageResourceType() {}
-
/**
* @copydoc ResourceType::Clone
*/
* Attributes are copied from the request (if supplied).
*/
ImageAttributes imageAttributes;
-
-private:
-
- // Undefined copy constructor.
- NativeImageResourceType(const NativeImageResourceType& typePath);
-
- // Undefined assignment operator.
- NativeImageResourceType& operator=(const NativeImageResourceType& rhs);
};
/**
struct DALI_IMPORT_API RenderTargetResourceType : public ResourceType
{
/**
- * Constructor.
+ * Default constructor initialises the base class with the correct ResourceTypeId.
*/
RenderTargetResourceType()
: ResourceType(ResourceTargetImage) {}
imageAttributes(attribs) {}
/**
- * Destructor.
- */
- virtual ~RenderTargetResourceType() {}
-
- /**
* @copydoc ResourceType::Clone
*/
virtual ResourceType* Clone() const
* Attributes are copied from the request.
*/
ImageAttributes imageAttributes;
-
-private:
-
- // Undefined copy constructor.
- RenderTargetResourceType(const RenderTargetResourceType& typePath);
-
- // Undefined assignment operator.
- RenderTargetResourceType& operator=(const RenderTargetResourceType& rhs);
};
/**
*/
struct DALI_IMPORT_API ShaderResourceType : public ResourceType
{
- /**
- * Constructor.
- */
ShaderResourceType(size_t shaderHash, const std::string& vertexSource, const std::string& fragmentSource)
: ResourceType(ResourceShader),
hash(shaderHash),
}
/**
- * Destructor.
- */
- virtual ~ShaderResourceType()
- {
- }
-
- /**
* @copydoc ResourceType::Clone
*/
virtual ResourceType* Clone() const
size_t hash; ///< Hash of the vertex/fragment sources
const std::string vertexShader; ///< source code for vertex program
const std::string fragmentShader; ///< source code for fragment program
-
-private:
-
- // Undefined copy constructor.
- ShaderResourceType(const ShaderResourceType& typePath);
-
- // Undefined assignment operator.
- ShaderResourceType& operator=(const ShaderResourceType& rhs);
};
/**
* on the 32 bit words that follow so rather than using the minimum number of
* bits for each, we give "loaded" a whole 8 bits and push it to a byte-aligned
* address to make access possible via a plain byte load instead of a load,
- * mask, shift sequence. The naive bitwidths before this modification are as follows:
+ * mask, shift sequence. The naive bitwidths before this modification are as follows:<code>
* character:21;
* quality:1;
- * loaded:1;
+ * loaded:1;</code>
* @{
*/
uint32_t character:21; ///< character code (UTF-32), max value of 0x10ffff (21 bits)
}
/**
- * virtual destructor
- */
- virtual ~TextResourceType()
- {
- }
-
- /**
* @copydoc ResourceType::Clone
*/
virtual ResourceType* Clone() const
Vector2 mMaxGlyphSize; ///< Max glyph size for font
GlyphCacheMode mCache; ///< Whether text glyphs should be cached.
-
-private:
-
- // Undefined copy constructor.
- TextResourceType(const TextResourceType& typePath);
-
- // Undefined copy constructor.
- TextResourceType& operator=(const TextResourceType& rhs);
};
/**
struct DALI_IMPORT_API ModelResourceType : public ResourceType
{
/**
- * Constructor.
+ * Default constructor initialises the base class with the correct ResourceTypeId.
*/
ModelResourceType()
: ResourceType(ResourceModel)
}
/**
- * Destructor.
- */
- virtual ~ModelResourceType()
- {
- }
-
- /**
* @copydoc ResourceType::Clone
*/
virtual ResourceType* Clone() const
{
return new ModelResourceType();
}
-
-private:
-
- // Undefined copy constructor.
- ModelResourceType(const ModelResourceType& typePath);
-
- // Undefined assignment operator.
- ModelResourceType& operator=(const ModelResourceType& rhs);
};
struct DALI_IMPORT_API MeshResourceType : public ResourceType
{
/**
- * Constructor.
+ * Default constructor initialises the base class with the correct ResourceTypeId.
*/
MeshResourceType()
: ResourceType(ResourceMesh) {}
/**
- * Destructor.
- */
- virtual ~MeshResourceType() {}
-
- /**
* @copydoc ResourceType::Clone
*/
virtual ResourceType* Clone() const
{
return new MeshResourceType();
}
-
-private:
-
- // Undefined copy constructor.
- MeshResourceType(const MeshResourceType& typePath);
-
- // Undefined assignment operator.
- MeshResourceType& operator=(const MeshResourceType& rhs);
};
inline bool operator==(const TextResourceType::GlyphPosition& lhs, const TextResourceType::GlyphPosition& rhs)