New parameter for FrameBufferImage creation
[platform/core/uifw/dali-core.git] / dali / internal / update / resources / resource-manager.h
index 7d7d607..131c45c 100644 (file)
 
 // INTERNAL INCLUDES
 #include <dali/public-api/images/image.h>
+#include <dali/public-api/images/frame-buffer-image.h>
 #include <dali/public-api/images/native-image-interface.h>
 #include <dali/public-api/images/buffer-image.h>
-#include <dali/public-api/common/ref-counted-dali-vector.h>
+#include <dali/devel-api/common/ref-counted-dali-vector.h>
 
 #include <dali/integration-api/bitmap.h>
 #include <dali/integration-api/platform-abstraction.h>
@@ -35,8 +36,6 @@
 #include <dali/internal/common/message.h>
 #include <dali/internal/event/common/event-thread-services.h>
 #include <dali/internal/event/common/thread-local-storage.h>
-#include <dali/internal/common/bitmap-upload.h>
-#include <dali/internal/event/text/font-impl.h>
 #include <dali/internal/event/resources/resource-client-declarations.h>
 #include <dali/internal/event/effects/shader-factory.h>
 #include <dali/internal/update/resources/resource-manager-declarations.h>
@@ -55,11 +54,15 @@ struct ResourceType;
 namespace Internal
 {
 
+class ImageAttributes;
+
 // value types used by messages
 template <> struct ParameterType< Integration::LoadResourcePriority >
 : public BasicType< Integration::LoadResourcePriority > {};
 template <> struct ParameterType< Pixel::Format >
 : public BasicType< Pixel::Format > {};
+template <> struct ParameterType< RenderBuffer::Format >
+: public BasicType< RenderBuffer::Format > {};
 template <> struct ParameterType< Integration::ResourceTypeId >
 : public BasicType< Integration::ResourceTypeId > {};
 
@@ -218,7 +221,7 @@ public: // Used by ResourceClient
    * @param[in] height      height in pixels
    * @param[in] pixelFormat Pixel format
    */
-  void HandleAddFrameBufferImageRequest( ResourceId id, unsigned int width, unsigned int height, Pixel::Format pixelFormat );
+  void HandleAddFrameBufferImageRequest( ResourceId id, unsigned int width, unsigned int height, Pixel::Format pixelFormat, RenderBuffer::Format bufferFormat );
 
   /**
    * Add an existing resource to the resource manager.
@@ -236,17 +239,6 @@ public: // Used by ResourceClient
    */
   void HandleAllocateTextureRequest( ResourceId id, unsigned int width, unsigned int height, Pixel::Format pixelFormat );
 
-  /**
-   * Upload an array of bitmaps to a texture.
-   * @param[in] id The resource id
-   * @param[in] uploadArray  bitmap upload array.
-   */
-  void HandleUpdateTextureRequest( ResourceId id,  const BitmapUploadArray& uploadArray );
-
-  /**
-   * Requests allocation of a font resource
-   */
-  void HandleAllocateFontRequest(ResourceId id, const std::string& familyNameAndStyle);
 
   /**
    * Load a shader program from a file
@@ -301,13 +293,11 @@ public: // Used by ResourceClient
    */
   void HandleDiscardResourceRequest( ResourceId id, Integration::ResourceTypeId typeId );
 
-  /**
-   * Update font texture atlas status
-   * @param[in] id         The resource id
-   * @param[in] atlasId    texture ID of the atlas
-   * @param[in] loadStatus The status update.
-   */
-  void HandleAtlasUpdateRequest( ResourceId id, ResourceId atlasId, Integration::LoadStatus loadStatus );
+   /**
+    * @brief Create GL texture for resource.
+    * @param[in] id The resource id.
+    */
+   void HandleCreateGlTextureRequest( ResourceId id );
 
   /********************************************************************************
    ******************** Update thread object direct interface  ********************
@@ -340,21 +330,6 @@ public: // Used by ResourceClient
    */
   Integration::ShaderDataPtr GetShaderData(ResourceId id);
 
-  /**
-   * Check if current set of glyph requests on given atlas have finished loading
-   * @param[in] id Request Id of the text atlas texture
-   * @return true if the current set of glyph requests have all completed, false
-   * if there are outstanding glyph requests that haven't finished.
-   */
-  bool IsAtlasLoaded(ResourceId id);
-
-  /**
-   * Check the load status of a given atlas.
-   * @param[in] id Request Id of the text atlas texture
-   * @return LoadStatus
-   */
-  Integration::LoadStatus GetAtlasLoadStatus( ResourceId atlasId );
-
   /********************************************************************************
    ************************* ResourceCache Implementation  ************************
    ********************************************************************************/
@@ -383,19 +358,6 @@ public:
   /********************************************************************************
    ********************************* Private Methods  *****************************
    ********************************************************************************/
-private:
-
-  /**
-   * @param[in] id Resource id to clear
-   * @param[in] typePath Glyphs to be loaded, and cleared beforehand
-   */
-  void ClearRequestedGlyphArea( ResourceId id, const ResourceTypePath& typePath );
-
-  /**
-   * Sends loaded glyphs to texture atlas for uploading
-   * @param[in] glyphSet Loaded glyphs
-   */
-  void UploadGlyphsToTexture( const Integration::GlyphSet& glyphSet );
 
   /**
    * Sends notification messages for load sucess & failure,
@@ -498,15 +460,17 @@ inline void RequestAddFrameBufferImageMessage( EventThreadServices& eventThreadS
                                                ResourceId id,
                                                unsigned int width,
                                                unsigned int height,
-                                               Pixel::Format pixelFormat )
+                                               Pixel::Format pixelFormat,
+                                               RenderBuffer::Format bufferFormat
+                                               )
 {
-  typedef MessageValue4< ResourceManager, ResourceId, unsigned int, unsigned int, Pixel::Format > LocalType;
+  typedef MessageValue5< ResourceManager, ResourceId, unsigned int, unsigned int, Pixel::Format, RenderBuffer::Format > LocalType;
 
   // Reserve some memory inside the message queue
   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &manager, &ResourceManager::HandleAddFrameBufferImageRequest, id, width, height, pixelFormat );
+  new (slot) LocalType( &manager, &ResourceManager::HandleAddFrameBufferImageRequest, id, width, height, pixelFormat, bufferFormat );
 }
 
 inline void RequestAddFrameBufferImageMessage( EventThreadServices& eventThreadServices,
@@ -539,33 +503,6 @@ inline void RequestAllocateTextureMessage( EventThreadServices& eventThreadServi
   new (slot) LocalType( &manager, &ResourceManager::HandleAllocateTextureRequest, id, width, height, pixelFormat );
 }
 
-inline void RequestUpdateTextureMessage( EventThreadServices& eventThreadServices,
-                                         ResourceManager& manager,
-                                         ResourceId id,
-                                         BitmapUploadArray uploadArray )
-{
-  typedef MessageValue2< ResourceManager, ResourceId, BitmapUploadArray > LocalType;
-
-  // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &manager, &ResourceManager::HandleUpdateTextureRequest, id, uploadArray );
-}
-
-inline void RequestAllocateFontMessage( EventThreadServices& eventThreadServices,
-                                        ResourceManager& manager,
-                                        ResourceId id,
-                                        const std::string& familyNameAndStyle)
-{
-  typedef MessageValue2< ResourceManager, ResourceId, std::string > LocalType;
-
-  // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &manager, &ResourceManager::HandleAllocateFontRequest, id, familyNameAndStyle );
-}
 
 inline void RequestLoadShaderMessage( EventThreadServices& eventThreadServices,
                                       ResourceManager& manager,
@@ -671,19 +608,17 @@ inline void RequestDiscardResourceMessage( EventThreadServices& eventThreadServi
   new (slot) LocalType( &manager, &ResourceManager::HandleDiscardResourceRequest, id, typeId );
 }
 
-inline void RequestAtlasUpdateMessage( EventThreadServices& eventThreadServices,
-                                       ResourceManager& manager,
-                                       ResourceId id,
-                                       ResourceId atlasId,
-                                       Integration::LoadStatus loadStatus )
+inline void RequestCreateGlTextureMessage( EventThreadServices& eventThreadServices,
+                                           ResourceManager& manager,
+                                           ResourceId id )
 {
-  typedef MessageValue3< ResourceManager, ResourceId, ResourceId, Integration::LoadStatus > LocalType;
+  typedef MessageValue1< ResourceManager, ResourceId > LocalType;
 
   // Reserve some memory inside the message queue
   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &manager, &ResourceManager::HandleAtlasUpdateRequest, id, atlasId, loadStatus );
+  new (slot) LocalType( &manager, &ResourceManager::HandleCreateGlTextureRequest, id );
 }
 
 } // namespace Internal