Revert "[SRUK] Bitmap core patch 2 of 4 - Replace all uses of the Bitmap class with...
authorAndrew Cox <andrew.cox@partner.samsung.com>
Tue, 13 May 2014 17:14:31 +0000 (18:14 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Thu, 15 May 2014 11:40:09 +0000 (12:40 +0100)
This reverts commit fffd4cca80c05dbc332a2b28ade580894a3915f3.

!! Note !!  This code is good but we want to delay this series of Adaptor
changes until late May for client stability reasons.

Change-Id: I35e2c3d6940c0b531f9e47f87b15bcbc1c0abfbc
Signed-off-by: Andrew Cox <andrew.cox@partner.samsung.com>
33 files changed:
automated-tests/src/dali-internal/utc-Dali-Internal-Font.cpp
automated-tests/src/dali-internal/utc-Dali-Internal-ImageFactory.cpp
automated-tests/src/dali-internal/utc-Dali-Internal-Material.cpp
automated-tests/src/dali-internal/utc-Dali-Internal-ResourceClient.cpp
automated-tests/src/dali-unmanaged/dali-test-suite-utils/test-platform-abstraction.cpp
automated-tests/src/dali-unmanaged/dali-test-suite-utils/test-platform-abstraction.h
automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.cpp
automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.h
automated-tests/src/dali/utc-Dali-Image.cpp
automated-tests/src/dali/utc-Dali-ImageActor.cpp
automated-tests/src/dali/utc-Dali-Material.cpp
automated-tests/src/dali/utc-Dali-RenderTask.cpp
automated-tests/src/dali/utc-Dali-TextActor.cpp
dali/integration-api/bitmap.cpp
dali/integration-api/bitmap.h
dali/integration-api/glyph-set.cpp
dali/integration-api/glyph-set.h
dali/integration-api/image-data.cpp
dali/integration-api/image-data.h
dali/integration-api/platform-abstraction.h
dali/integration-api/resource-types.h
dali/internal/event/images/encoded-buffer-image-impl.cpp
dali/internal/event/images/image-factory.cpp
dali/internal/event/images/nine-patch-image-impl.cpp
dali/internal/event/resources/resource-client.cpp
dali/internal/event/resources/resource-client.h
dali/internal/event/resources/resource-type-path.cpp
dali/internal/event/text/resource/glyph-resource-manager.cpp
dali/internal/update/resources/resource-manager.cpp
dali/internal/update/resources/resource-manager.h
dali/public-api/images/glyph-image.cpp
dali/public-api/images/pixel-extras.h [deleted file]
dali/public-api/images/pixel.cpp

index a1e341f..4fe295e 100644 (file)
@@ -62,7 +62,7 @@ Integration::GlyphMetrics characters[] =
 static Integration::GlyphSet* BuildGlyphSet()
 {
   Integration::GlyphSet* set = new Integration::GlyphSet();
-  Integration::ImageDataPtr bitmapData;
+  Integration::BitmapPtr bitmapData;
 
   for (unsigned int index = 0; index < sizeof(characters)/sizeof(characters[0]); index++)
   {
index ef59164..8506891 100644 (file)
@@ -41,9 +41,9 @@ static void EmulateImageLoaded( TestApplication& application, unsigned int width
 {
   // emulate load success
   Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
-  Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( width, height, Pixel::RGBA8888 );
-
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS,  true  );
   Integration::ResourcePointer resource( bitmap );
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, width, height, width, height );
   if( request )
   {
     application.GetPlatform().SetResourceLoaded( request->GetId(), request->GetType()->id, resource );
@@ -341,41 +341,39 @@ int UtcDaliImageFactoryReload02(void)
   DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
   application.GetPlatform().ResetTrace();
 
-///@todo Modify the TestPlatformAbstraction to not keep a reference to the previous ImageData loaded around after it has lost its buffer to a bitmap and expand it to allow this detailed reload testing.
-///  ResourceTicketPtr ticket2 = imageFactory.Reload( req.Get() );
-///
-///  application.SendNotification();
-///  application.Render();
-///  application.SendNotification();
-///  application.Render();
-///
-///  DALI_TEST_EQUALS( ticket, ticket2, TEST_LOCATION );
-///  // resource is still loading, do not issue another request
-///  DALI_TEST_CHECK( !application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
-///
-///  // emulate load success
-///  EmulateImageLoaded( application, 80, 80 );
-///
-///  ResourceTicketPtr ticket3 = imageFactory.Reload( req.Get() );
-///
-///  application.SendNotification();
-///  application.Render();
-///  application.SendNotification();
-///  application.Render();
-///
-///  DALI_TEST_EQUALS( ticket, ticket3, TEST_LOCATION );
-///  DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
-///  application.GetPlatform().ResetTrace();
-///
-///  ticket3 = imageFactory.Reload( req.Get() );
-///
-///  application.SendNotification();
-///  application.Render();
-///  application.SendNotification();
-///  application.Render();
-///
-///  DALI_TEST_CHECK( !application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
+  ResourceTicketPtr ticket2 = imageFactory.Reload( req.Get() );
+
+  application.SendNotification();
+  application.Render();
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( ticket, ticket2, TEST_LOCATION );
+  // resource is still loading, do not issue another request
+  DALI_TEST_CHECK( !application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
+
+  // emulate load success
+  EmulateImageLoaded( application, 80, 80 );
 
+  ResourceTicketPtr ticket3 = imageFactory.Reload( req.Get() );
+
+  application.SendNotification();
+  application.Render();
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( ticket, ticket3, TEST_LOCATION );
+  DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
+  application.GetPlatform().ResetTrace();
+
+  ticket3 = imageFactory.Reload( req.Get() );
+
+  application.SendNotification();
+  application.Render();
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_CHECK( !application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
   END_TEST;
 }
 
@@ -445,27 +443,26 @@ int UtcDaliImageFactoryReload04(void)
   // emulate load success
   EmulateImageLoaded( application, 80, 80 );
 
-///@todo Modify the TestPlatformAbstraction to not keep a reference to the previous ImageData loaded around after it has lost its buffer to a bitmap and expand it to allow this detailed reload testing.
-///  ResourceTicketPtr ticket3 = imageFactory.Reload( req.Get() );
-///
-///  application.SendNotification();
-///  application.Render();
-///  application.SendNotification();
-///  application.Render();
-///
-///  // size didn't change, using same ticket
-///  DALI_TEST_EQUALS( ticket, ticket3, TEST_LOCATION );
-///  DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
-///  application.GetPlatform().ResetTrace();
-///
-///  // still loading
-///  ticket3 = imageFactory.Reload( req.Get() );
-///  application.SendNotification();
-///  application.Render();
-///  application.SendNotification();
-///  application.Render();
-///
-///  DALI_TEST_CHECK( !application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
+  ResourceTicketPtr ticket3 = imageFactory.Reload( req.Get() );
+
+  application.SendNotification();
+  application.Render();
+  application.SendNotification();
+  application.Render();
+
+  // size didn't change, using same ticket
+  DALI_TEST_EQUALS( ticket, ticket3, TEST_LOCATION );
+  DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
+  application.GetPlatform().ResetTrace();
+
+  // still loading
+  ticket3 = imageFactory.Reload( req.Get() );
+  application.SendNotification();
+  application.Render();
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_CHECK( !application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
   END_TEST;
 }
 
@@ -516,15 +513,12 @@ int UtcDaliImageFactoryReload05(void)
 
   // still loading, no new request
   DALI_TEST_CHECK( !application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
-  
+
   // emulate load success
   EmulateImageLoaded( application, 80, 80 );
 
   ticket = imageFactory.Reload( req.Get() );
 
-  // emulate load success
-  EmulateImageLoaded( application, 80, 80 );
-
   application.SendNotification();
   application.Render();
 
index 6b3147a..ffe3794 100644 (file)
@@ -175,17 +175,13 @@ Internal::ResourceTicketPtr CheckLoadBitmap(TestApplication& application, const
 {
   Internal::ResourceClient& resourceClient = Internal::ThreadLocalStorage::Get().GetResourceClient();
   ImageAttributes attr;
-  Integration::ImageResourceType bitmapRequest ( Integration::ResourceImageData, attr );
+  Integration::BitmapResourceType bitmapRequest(attr);
   Internal::ResourceTicketPtr ticket = resourceClient.RequestResource( bitmapRequest, name );
   application.SendNotification(); // Flush update messages
   application.Render();           // Process resource request
   Integration::ResourceRequest*   req = application.GetPlatform().GetRequest();
-  Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( w, h, Pixel::RGBA8888 );
-
-  // Make the bitmap non-opaque:
-  memset( bitmap->GetBuffer(), 0, w * h * 4 );
-  bitmap->SetAlphaUsed( true );
-
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, false );
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, w, h, w, h );
   Integration::ResourcePointer resourcePtr(bitmap); // reference it
   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
   application.Render();           // Process LoadComplete
@@ -204,7 +200,8 @@ Internal::ImagePtr LoadImage(TestApplication& application, const char* name)
   application.SendNotification(); // Flush update messages
   application.Render();           // Process resource request
   Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
-  Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( 80, 80, Pixel::RGBA8888 );
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, false );
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 80,80,80,80 );
   Integration::ResourcePointer resourcePtr(bitmap); // reference it
 
   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
@@ -322,7 +319,7 @@ int UtcDaliMaterialUnreadyTextureOffstage(void)
 
   Internal::ResourceClient& resourceClient = Internal::ThreadLocalStorage::Get().GetResourceClient();
   ImageAttributes attr;
-  Integration::ImageResourceType bitmapRequest ( Integration::ResourceImageData, attr );
+  Integration::BitmapResourceType bitmapRequest(attr);
   Internal::ResourceTicketPtr ticket = resourceClient.RequestResource( bitmapRequest, "image.png" );
   application.SendNotification(); // Flush update messages
   application.Render();           // Process resource request
@@ -335,7 +332,8 @@ int UtcDaliMaterialUnreadyTextureOffstage(void)
   DALI_TEST_CHECK( textureId == textureId2 );
 
   Integration::ResourceRequest*   req = application.GetPlatform().GetRequest();
-  Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( 80, 80, Pixel::RGBA8888 );
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, false );
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 80, 80, 80, 80 );
   Integration::ResourcePointer resourcePtr(bitmap); // reference it
   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
   application.Render();           // Process LoadComplete
@@ -540,7 +538,7 @@ int UtcDaliMaterialSetUnreadyTextureWhilstStaged(void)
 
   Internal::ResourceClient& resourceClient = Internal::ThreadLocalStorage::Get().GetResourceClient();
   ImageAttributes attr;
-  Integration::ImageResourceType bitmapRequest ( Integration::ResourceImageData, attr );
+  Integration::BitmapResourceType bitmapRequest(attr);
   Internal::ResourceTicketPtr ticket = resourceClient.RequestResource( bitmapRequest, "image.png" );
   application.SendNotification(); // Flush update messages
   application.Render();           // Process resource request
@@ -571,7 +569,8 @@ int UtcDaliMaterialSetUnreadyTextureWhilstStaged(void)
   DALI_TEST_EQUALS( boundTextures.GetNumBoundTextures(), 0u, TEST_LOCATION );
 
   Integration::ResourceRequest*   req = application.GetPlatform().GetRequest();
-  Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( 80, 80, Pixel::RGBA8888 );
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, false );
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 80, 80, 80, 80 );
   Integration::ResourcePointer resourcePtr(bitmap); // reference it
   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
   application.Render();           // Process LoadComplete
@@ -611,7 +610,7 @@ int UtcDaliMaterialIsOpaqueWithTexture(void)
 {
   TestApplication application;
 
-  Internal::ResourceTicketPtr textureImageTicket = CheckLoadBitmap(application, "diffuse.png", 80, 80);
+  Internal::ResourceTicketPtr ticket = CheckLoadBitmap(application, "diffuse.png", 80, 80);
 
   // Create object with default properties
   Internal::SceneGraph::Material* sceneObject = Internal::SceneGraph::Material::New();
@@ -630,7 +629,7 @@ int UtcDaliMaterialIsOpaqueWithTexture(void)
 
   DALI_TEST_CHECK( sceneObject->IsOpaque() );
 
-  sceneObject->SetDiffuseTextureId( textureImageTicket->GetId() );
+  sceneObject->SetDiffuseTextureId(ticket->GetId());
   application.SendNotification(); // Flush update Q
   application.Render(); // Update & Prepare material
   application.Render(); // Process render Q
index 61bb144..52b867a 100644 (file)
@@ -34,8 +34,6 @@
 #include <dali/internal/event/images/image-impl.h>
 #include <dali/internal/event/modeling/model-data-impl.h>
 #include <dali/integration-api/resource-cache.h>
-#include <dali/integration-api/image-data.h>
-#include <dali/integration-api/resource-types.h>
 #include <dali/internal/render/gl-resources/texture-declarations.h>
 #include <dali/internal/render/shaders/shader.h>
 #include <dali/internal/common/owner-pointer.h>
@@ -139,13 +137,14 @@ Internal::ResourceTicketPtr CheckLoadBitmap(TestApplication& application, const
 {
   Internal::ResourceClient& resourceClient = Internal::ThreadLocalStorage::Get().GetResourceClient();
   ImageAttributes attr;
-  Integration::ImageResourceType bitmapRequest( Integration::ResourceImageData, attr);
+  Integration::BitmapResourceType bitmapRequest(attr);
   Internal::ResourceTicketPtr ticket = resourceClient.RequestResource( bitmapRequest, name );
   ticket->AddObserver(testTicketObserver);
   application.SendNotification(); // Flush update messages
   application.Render();           // Process resource request
   Integration::ResourceRequest*   req = application.GetPlatform().GetRequest();
-  Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( w, h, Pixel::RGBA8888 );
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, false );
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, w, h, w, h );
   Integration::ResourcePointer resourcePtr(bitmap); // reference it
   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
   application.Render();           // Process LoadComplete
@@ -203,7 +202,7 @@ int UtcDaliInternalRequestResourceBitmapRequests01(void)
 
   Internal::ResourceManager& resourceManager = Internal::ThreadLocalStorage::Get().GetResourceManager();
   ImageAttributes attr;
-  Integration::ImageResourceType bitmapRequest (Integration::ResourceImageData, attr);
+  Integration::BitmapResourceType bitmapRequest (attr);
   Internal::ResourceId id(0);
 
   testTicketObserver.Reset();
@@ -234,12 +233,13 @@ int UtcDaliInternalRequestResourceBitmapRequests01(void)
 
     // Create a resource
     Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
-    Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( 80, 80, Pixel::RGBA8888 );
+    Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, false );
+    bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 80, 80, 80, 80 );
     Integration::ResourcePointer resourcePtr(bitmap); // reference it
 
     // Set up platform abstraction to load it
     id=req->GetId();
-    application.GetPlatform().SetResourceLoaded( id, Integration::ResourceImageData, resourcePtr );
+    application.GetPlatform().SetResourceLoaded( id, Integration::ResourceBitmap, resourcePtr );
 
     DALI_TEST_CHECK( ! resourceManager.IsResourceLoaded(req->GetId()) );
 
@@ -291,7 +291,7 @@ int UtcDaliInternalRequestResourceBitmapRequests02(void)
 
   Internal::ResourceManager& resourceManager = Internal::ThreadLocalStorage::Get().GetResourceManager();
   ImageAttributes attr;
-  Integration::ImageResourceType bitmapRequest (Integration::ResourceImageData, attr);
+  Integration::BitmapResourceType bitmapRequest (attr);
   Internal::ResourceId id(0);
 
   testTicketObserver.Reset();
@@ -355,7 +355,7 @@ int UtcDaliInternalRequestResourceBitmapRequests03(void)
 
   Internal::ResourceManager& resourceManager = Internal::ThreadLocalStorage::Get().GetResourceManager();
   ImageAttributes attr;
-  Integration::ImageResourceType bitmapRequest (Integration::ResourceImageData, attr);
+  Integration::BitmapResourceType bitmapRequest (attr);
   Internal::ResourceId id(0);
 
   testTicketObserver.Reset();
@@ -448,10 +448,11 @@ int UtcDaliInternalRequestReloadBitmapRequests01(void)
 
     // Create a new resource - the image size could have changed in the meantime
     Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
-    Integration::ImageDataPtr bitmap2 = Integration::NewBitmapImageData( 120, 120, Pixel::RGBA8888 );
+    Integration::Bitmap* bitmap2 = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, false );
+    bitmap2->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 120, 120, 120, 120 );
     Integration::ResourcePointer resourcePtr2(bitmap2); // reference it
     DALI_TEST_CHECK( req->GetId() == ticket->GetId() );
-    application.GetPlatform().SetResourceLoaded(id, Integration::ResourceImageData, resourcePtr2);
+    application.GetPlatform().SetResourceLoaded(id, Integration::ResourceBitmap, resourcePtr2);
 
     application.Render(0);  // Process update messages / UpdateCache
     DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::GetResourcesFunc ) );
@@ -501,7 +502,7 @@ int UtcDaliInternalRequestReloadBitmapRequests02(void)
 
   Internal::ResourceManager& resourceManager = Internal::ThreadLocalStorage::Get().GetResourceManager();
   ImageAttributes attr;
-  Integration::ImageResourceType bitmapRequest (Integration::ResourceImageData, attr);
+  Integration::BitmapResourceType bitmapRequest (attr);
   Internal::ResourceId id(0);
 
   testTicketObserver.Reset();
@@ -546,13 +547,14 @@ int UtcDaliInternalRequestReloadBitmapRequests02(void)
     DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::GetResourcesFunc ) );
     // Create a resource
     Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
-    Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( 80, 80, Pixel::RGBA8888 );
+    Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, false );
+    bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 80, 80, 80, 80 );
     Integration::ResourcePointer resourcePtr(bitmap); // reference it
 
     // Set up platform abstraction to load it
     id=req->GetId();
 
-    application.GetPlatform().SetResourceLoaded(id, Integration::ResourceImageData, resourcePtr);
+    application.GetPlatform().SetResourceLoaded(id, Integration::ResourceBitmap, resourcePtr);
 
     DALI_TEST_CHECK( ! resourceManager.IsResourceLoaded(id));
 
@@ -614,7 +616,7 @@ int UtcDaliInternalRequestReloadBitmapRequests03(void)
 
   Internal::ResourceManager& resourceManager = Internal::ThreadLocalStorage::Get().GetResourceManager();
   ImageAttributes attr;
-  Integration::ImageResourceType bitmapRequest (Integration::ResourceImageData, attr);
+  Integration::BitmapResourceType bitmapRequest (attr);
   Internal::ResourceId id(0);
 
   testTicketObserver.Reset();
@@ -655,13 +657,14 @@ int UtcDaliInternalRequestReloadBitmapRequests03(void)
 
     // Create a resource
     Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
-    Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( 80, 80, Pixel::RGBA8888 );
+    Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, false );
+    bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 80, 80, 80, 80 );
     Integration::ResourcePointer resourcePtr(bitmap); // reference it
 
     // Set up platform abstraction to load it
     id=req->GetId();
 
-    application.GetPlatform().SetResourceLoaded(id, Integration::ResourceImageData, resourcePtr);
+    application.GetPlatform().SetResourceLoaded(id, Integration::ResourceBitmap, resourcePtr);
 
     DALI_TEST_CHECK( ! resourceManager.IsResourceLoaded(id));
 
@@ -698,10 +701,11 @@ int UtcDaliInternalRequestReloadBitmapRequests03(void)
 
     // Create a new resource - the image size could have changed in the meantime
     req = application.GetPlatform().GetRequest();
-    Integration::ImageDataPtr bitmap2 = Integration::NewBitmapImageData( 120, 120, Pixel::RGBA8888 );
+    Integration::Bitmap* bitmap2 = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, false );
+    bitmap2->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 120, 120, 120, 120 );
     Integration::ResourcePointer resourcePtr2(bitmap2); // reference it
     DALI_TEST_CHECK( req->GetId() == id );
-    application.GetPlatform().SetResourceLoaded(id, Integration::ResourceImageData, resourcePtr2);
+    application.GetPlatform().SetResourceLoaded(id, Integration::ResourceBitmap, resourcePtr2);
 
     application.Render(0);  // Process update messages / UpdateCache
 
index 7a579a0..93c8ae9 100644 (file)
@@ -189,21 +189,21 @@ const PixelSize TestPlatformAbstraction::GetFontLineHeightFromCapsHeight(const s
 
 Integration::GlyphSet* TestPlatformAbstraction::GetGlyphData ( const Integration::TextResourceType& textRequest,
                                                                const std::string& fontFamily,
-                                                               bool getImageData) const
+                                                               bool getBitmap) const
 {
-  if( getImageData )
+  if( getBitmap )
   {
-    mTrace.PushCall("GetGlyphData", "getImageData:true");
+    mTrace.PushCall("GetGlyphData", "getBitmap:true");
   }
   else
   {
-    mTrace.PushCall("GetGlyphData", "getImageData:false");
+    mTrace.PushCall("GetGlyphData", "getBitmap:false");
   }
 
   // It creates fake metrics for the received characters.
 
   Integration::GlyphSet* set = new Dali::Integration::GlyphSet();
-  Integration::ImageDataPtr bitmapData;
+  Integration::BitmapPtr bitmapData;
 
   std::set<uint32_t> characters;
 
@@ -214,9 +214,10 @@ Integration::GlyphSet* TestPlatformAbstraction::GetGlyphData ( const Integration
       characters.insert( it->character );
       Integration::GlyphMetrics character = {it->character, Integration::GlyphMetrics::LOW_QUALITY,  10.0f,  10.0f, 9.0f, 1.0f, 10.0f, it->xPosition, it->yPosition };
 
-      if( getImageData )
+      if( getBitmap )
       {
-        bitmapData = Integration::NewBitmapImageData( 64, 64, Pixel::A8 );
+        bitmapData = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true);
+        bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, 64, 64);
         PixelBuffer* pixelBuffer = bitmapData->GetBuffer();
         memset( pixelBuffer, it->character, 64*64 );
       }
@@ -245,7 +246,7 @@ Integration::GlyphSet* TestPlatformAbstraction::GetCachedGlyphData( const Integr
 
   // It creates fake metrics and bitmap for received numeric characters '0' through '9'.
   Integration::GlyphSet* set = new Dali::Integration::GlyphSet();
-  Integration::ImageDataPtr bitmapData;
+  Integration::BitmapPtr bitmapData;
 
   std::set<uint32_t> characters;
 
@@ -256,7 +257,8 @@ Integration::GlyphSet* TestPlatformAbstraction::GetCachedGlyphData( const Integr
       characters.insert( it->character );
       Integration::GlyphMetrics character = {it->character, Integration::GlyphMetrics::HIGH_QUALITY,  10.0f,  10.0f, 9.0f, 1.0f, 10.0f, it->xPosition, it->yPosition };
 
-      bitmapData = Integration::NewBitmapImageData( 64, 64, Pixel::A8 );
+      bitmapData = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true);
+      bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, 64, 64);
       PixelBuffer* pixelBuffer = bitmapData->GetBuffer();
       memset( pixelBuffer, it->character, 64*64 );
       set->AddCharacter(bitmapData, character);
@@ -444,9 +446,10 @@ void TestPlatformAbstraction::GetFileNamesFromDirectory( const std::string& dire
   fileNames.push_back( std::string( "u1f601.png" ) );
 }
 
-Integration::ImageDataPtr TestPlatformAbstraction::GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character ) const
+Integration::BitmapPtr TestPlatformAbstraction::GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character ) const
 {
-  Integration::ImageDataPtr image = Integration::NewBitmapImageData( 1, 1, Pixel::A8 );
+  Integration::BitmapPtr image = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
+  image->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 1, 1 );
 
   mTrace.PushCall("GetGlyphImage", "");
 
index 0761d33..087a62c 100644 (file)
@@ -229,7 +229,7 @@ public:
   virtual void GetFileNamesFromDirectory( const std::string& directoryName,
                                           std::vector<std::string>& fileNames );
 
-  virtual Integration::ImageDataPtr GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character ) const;
+  virtual Integration::BitmapPtr GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character ) const;
 
 
 public: // TEST FUNCTIONS
index 7938835..27e806e 100644 (file)
@@ -187,21 +187,21 @@ const PixelSize TestPlatformAbstraction::GetFontLineHeightFromCapsHeight(const s
 
 Integration::GlyphSet* TestPlatformAbstraction::GetGlyphData ( const Integration::TextResourceType& textRequest,
                                                                const std::string& fontFamily,
-                                                               bool getImageData) const
+                                                               bool getBitmap) const
 {
-  if( getImageData )
+  if( getBitmap )
   {
-    mTrace.PushCall("GetGlyphData", "getImageData:true");
+    mTrace.PushCall("GetGlyphData", "getBitmap:true");
   }
   else
   {
-    mTrace.PushCall("GetGlyphData", "getImageData:false");
+    mTrace.PushCall("GetGlyphData", "getBitmap:false");
   }
 
   // It creates fake metrics for the received characters.
 
   Integration::GlyphSet* set = new Dali::Integration::GlyphSet();
-  Integration::ImageDataPtr imageData;
+  Integration::BitmapPtr bitmapData;
 
   std::set<uint32_t> characters;
 
@@ -212,15 +212,15 @@ Integration::GlyphSet* TestPlatformAbstraction::GetGlyphData ( const Integration
       characters.insert( it->character );
       Integration::GlyphMetrics character = {it->character, Integration::GlyphMetrics::LOW_QUALITY,  10.0f,  10.0f, 9.0f, 1.0f, 10.0f, it->xPosition, it->yPosition };
 
-      if( getImageData )
+      if( getBitmap )
       {
-        // Allocate an ImageData object to hold some pixels:
-        const unsigned dimension = 64;
-        imageData = Integration::NewBitmapImageData( dimension, dimension, Pixel::A8 );
-        uint8_t* const pixelBuffer = imageData->GetBuffer();
-        memset( pixelBuffer, it->character, dimension * dimension );
+        bitmapData = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true);
+        bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, 64, 64);
+        PixelBuffer* pixelBuffer = bitmapData->GetBuffer();
+        memset( pixelBuffer, it->character, 64*64 );
       }
-      set->AddCharacter(imageData, character);
+
+      set->AddCharacter(bitmapData, character);
     }
   }
 
@@ -244,7 +244,7 @@ Integration::GlyphSet* TestPlatformAbstraction::GetCachedGlyphData( const Integr
 
   // It creates fake metrics and bitmap for received numeric characters '0' through '9'.
   Integration::GlyphSet* set = new Dali::Integration::GlyphSet();
-  Integration::ImageDataPtr imageData;
+  Integration::BitmapPtr bitmapData;
 
   std::set<uint32_t> characters;
 
@@ -255,10 +255,11 @@ Integration::GlyphSet* TestPlatformAbstraction::GetCachedGlyphData( const Integr
       characters.insert( it->character );
       Integration::GlyphMetrics character = {it->character, Integration::GlyphMetrics::HIGH_QUALITY,  10.0f,  10.0f, 9.0f, 1.0f, 10.0f, it->xPosition, it->yPosition };
 
-      imageData = Integration::NewBitmapImageData( 64, 64, Pixel::A8 );
-      PixelBuffer* pixelBuffer = imageData->GetBuffer();
+      bitmapData = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true);
+      bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, 64, 64);
+      PixelBuffer* pixelBuffer = bitmapData->GetBuffer();
       memset( pixelBuffer, it->character, 64*64 );
-      set->AddCharacter(imageData, character);
+      set->AddCharacter(bitmapData, character);
     }
   }
 
@@ -441,9 +442,10 @@ void TestPlatformAbstraction::GetFileNamesFromDirectory( const std::string& dire
 }
 
 
-Integration::ImageDataPtr TestPlatformAbstraction::GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character ) const
+Integration::BitmapPtr TestPlatformAbstraction::GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character ) const
 {
-  Integration::ImageDataPtr image = Integration::NewBitmapImageData( 1, 1, Pixel::RGBA8888 );
+  Integration::BitmapPtr image = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
+  image->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 1, 1 );
 
   mTrace.PushCall("GetGlyphImage", "");
 
index f4aba56..6d56e4e 100644 (file)
@@ -152,7 +152,7 @@ public:
    */
   virtual Integration::GlyphSet* GetGlyphData ( const Integration::TextResourceType& textRequest,
                                                 const std::string& fontFamily,
-                                                bool getImageData) const;
+                                                bool getBitmap) const;
 
   /**
    * @copydoc PlatformAbstraction::GetCachedGlyphData()
@@ -233,7 +233,7 @@ public:
   virtual void GetFileNamesFromDirectory( const std::string& directoryName,
                                           std::vector<std::string>& fileNames );
 
-  virtual Integration::ImageDataPtr GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character ) const;
+  virtual Integration::BitmapPtr GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character ) const;
 
 public: // TEST FUNCTIONS
 
index f5a3e1e..5fc897f 100644 (file)
@@ -130,8 +130,9 @@ int UtcDaliImageNewWithPolicies01(void)
   ids.push_back( 23 );
   application.GetGlAbstraction().SetNextTextureIds( ids );
   Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
-  Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( 80, 80, Pixel::RGBA8888 );
-  Integration::ResourcePointer resource(bitmap.Get());
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
+  Integration::ResourcePointer resource(bitmap);
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
 
   if(request)
   {
@@ -185,8 +186,9 @@ int UtcDaliImageNewWithPolicies02(void)
   ids.push_back( 23 );
   application.GetGlAbstraction().SetNextTextureIds( ids );
   Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
-  Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( 80, 80, Pixel::RGBA8888 );
-  Integration::ResourcePointer resource(bitmap.Get());
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
+  Integration::ResourcePointer resource(bitmap);
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
 
   if(request)
   {
@@ -238,8 +240,9 @@ int UtcDaliImageNewWithPolicies03(void)
   ids.push_back( 23 );
   application.GetGlAbstraction().SetNextTextureIds( ids );
   Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
-  Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( 80, 80, Pixel::RGBA8888 );
-  Integration::ResourcePointer resource(bitmap.Get());
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
+  Integration::ResourcePointer resource(bitmap);
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
 
   if(request)
   {
@@ -303,8 +306,9 @@ int UtcDaliImageNewWithPolicies04(void)
   ids.push_back( 23 );
   application.GetGlAbstraction().SetNextTextureIds( ids );
   Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
-  Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( 80, 80, Pixel::RGBA8888 );
-  Integration::ResourcePointer resource(bitmap.Get());
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
+  Integration::ResourcePointer resource(bitmap);
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
 
   if(request)
   {
@@ -389,8 +393,9 @@ int UtcDaliImageNewDistanceFieldWithPolicies01(void)
   ids.push_back( 23 );
   application.GetGlAbstraction().SetNextTextureIds( ids );
   Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
-  Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( 80, 80, Pixel::RGBA8888 );
-  Integration::ResourcePointer resource(bitmap.Get());
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
+  Integration::ResourcePointer resource(bitmap);
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
 
   if(request)
   {
@@ -444,8 +449,9 @@ int UtcDaliImageNewDistanceFieldWithPolicies02(void)
   ids.push_back( 23 );
   application.GetGlAbstraction().SetNextTextureIds( ids );
   Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
-  Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( 80, 80, Pixel::RGBA8888 );
-  Integration::ResourcePointer resource(bitmap.Get());
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
+  Integration::ResourcePointer resource(bitmap);
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
 
   if(request)
   {
@@ -497,8 +503,9 @@ int UtcDaliImageNewDistanceFieldWithPolicies03(void)
   ids.push_back( 23 );
   application.GetGlAbstraction().SetNextTextureIds( ids );
   Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
-  Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( 80, 80, Pixel::RGBA8888 );
-  Integration::ResourcePointer resource(bitmap.Get());
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
+  Integration::ResourcePointer resource(bitmap);
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
 
   if(request)
   {
@@ -562,8 +569,9 @@ int UtcDaliImageNewDistanceFieldWithPolicies04(void)
   ids.push_back( 23 );
   application.GetGlAbstraction().SetNextTextureIds( ids );
   Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
-  Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( 80, 80, Pixel::RGBA8888 );
-  Integration::ResourcePointer resource(bitmap.Get());
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
+  Integration::ResourcePointer resource(bitmap);
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
 
   if(request)
   {
@@ -650,8 +658,9 @@ int UtcDaliImageNewDistanceFieldWithAttrandPol(void)
   ids.push_back( 23 );
   application.GetGlAbstraction().SetNextTextureIds( ids );
   Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
-  Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( 80, 80, Pixel::RGBA8888 );
-  Integration::ResourcePointer resource(bitmap.Get());
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
+  Integration::ResourcePointer resource(bitmap);
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
 
   if(request)
   {
@@ -747,8 +756,9 @@ int UtcDaliImageGetLoadingState01(void)
 
   // simulate load success
   Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
-  Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( 80, 80, Pixel::RGBA8888 );
-  Integration::ResourcePointer resource(bitmap.Get());
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
+  Integration::ResourcePointer resource(bitmap);
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
 
   if(request)
   {
@@ -863,12 +873,7 @@ int UtcDaliImageSignalLoadingFinished(void)
   Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
   if(request)
   {
-    Integration::ImageDataPtr loadedImageData = Integration::NewBitmapImageData( 80, 80, Pixel::RGBA8888 );
-    application.GetPlatform().SetResourceLoaded(
-      request->GetId(),
-      request->GetType()->id,
-      Integration::ResourcePointer( loadedImageData.Get() )
-    );
+    application.GetPlatform().SetResourceLoaded(request->GetId(), request->GetType()->id, Integration::ResourcePointer(Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true)));
   }
 
   application.Render(16);
@@ -878,14 +883,6 @@ int UtcDaliImageSignalLoadingFinished(void)
   END_TEST;
 }
 
-Integration::ResourcePointer BuildImageResource( TestApplication& application )
-{
-  Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( 80, 80, Pixel::RGBA8888 );
-  Integration::ResourcePointer resource( bitmap.Get() );
-  DALI_ASSERT_DEBUG( bitmap->GetBuffer() && "Image buffer should not be null." );
-  return resource;
-}
-
 // 1.23
 int UtcDaliImageSignalUploaded(void)
 {
@@ -906,8 +903,10 @@ int UtcDaliImageSignalUploaded(void)
   ids.push_back( 23 );
   application.GetGlAbstraction().SetNextTextureIds( ids );
   Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
-  Integration::ResourcePointer resource( BuildImageResource( application ) );
-  if( request )
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
+  Integration::ResourcePointer resource(bitmap);
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
+  if(request)
   {
     application.GetPlatform().SetResourceLoaded(request->GetId(), request->GetType()->id, resource);
   }
@@ -938,13 +937,7 @@ int UtcDaliImageSignalUploaded(void)
   SignalUploadedFlag = false;
 
   image.Reload();
-
-  // Give the fake platform abstraction a ne ImageData object to return as the result of the reload:
-  Integration::ResourcePointer reloaded_resource( BuildImageResource( application ) );
-  if( request )
-  {
-    application.GetPlatform().SetResourceLoaded(request->GetId(), request->GetType()->id, reloaded_resource);
-  }
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 160, 160, 160, 160);
 
   application.SendNotification();
   application.Render(16);
@@ -977,8 +970,9 @@ int UtcDaliImageDiscard01(void)
     ids.push_back( 23 );
     application.GetGlAbstraction().SetNextTextureIds( ids );
     Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
-    Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( 80, 80, Pixel::RGBA8888 );
-    Integration::ResourcePointer resource(bitmap.Get());
+    Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
+    Integration::ResourcePointer resource(bitmap);
+    bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
     if(request)
     {
     application.GetPlatform().SetResourceLoaded(request->GetId(), request->GetType()->id, resource);
@@ -1021,8 +1015,9 @@ int UtcDaliImageDiscard02(void)
         application.GetGlAbstraction().SetNextTextureIds( ids );
 
         Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
-        Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( 80, 80, Pixel::RGBA8888 );
-        Integration::ResourcePointer resource(bitmap.Get());
+        Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
+        Integration::ResourcePointer resource(bitmap);
+        bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
         if(request)
         {
           application.GetPlatform().SetResourceLoaded(request->GetId(), request->GetType()->id, resource);
@@ -1070,8 +1065,9 @@ int UtcDaliImageDiscard03(void)
   application.GetGlAbstraction().SetNextTextureIds( ids );
 
   Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
-  Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( 80, 80, Pixel::RGBA8888 );
-  Integration::ResourcePointer resource(bitmap.Get());
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
+  Integration::ResourcePointer resource(bitmap);
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
   if(request)
   {
     application.GetPlatform().SetResourceLoaded(request->GetId(), request->GetType()->id, resource);
index 9d63e5e..a46d7c5 100644 (file)
@@ -231,10 +231,11 @@ int UtcDaliImageActorGetCurrentImageSize02(void)
   DALI_TEST_EQUALS( actor.GetCurrentImageSize(), initialImageSize, TEST_LOCATION );
 
   // Now complete the image load
-  Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( initialImageSize.width, initialImageSize.height, Pixel::RGBA8888 );
-  Integration::ResourcePointer resourcePtr(bitmap.Get());
-
   Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, false );
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  initialImageSize.width,initialImageSize.height, initialImageSize.width,initialImageSize.height );
+
+  Integration::ResourcePointer resourcePtr(bitmap); // reference it
   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
   application.Render();           // Process LoadComplete
   application.SendNotification(); // Process event messages
@@ -282,10 +283,11 @@ int UtcDaliImageActorGetCurrentImageSize03(void)
   DALI_TEST_EQUALS( actor.GetCurrentImageSize(), closestImageSize, TEST_LOCATION );
 
   // Now complete the image load
-  Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( closestImageSize.width, closestImageSize.height, Pixel::RGBA8888 );
-  Integration::ResourcePointer resourcePtr(bitmap.Get());
-
   Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, false );
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  closestImageSize.width, closestImageSize.height, closestImageSize.width, closestImageSize.height );
+
+  Integration::ResourcePointer resourcePtr(bitmap); // reference it
   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
   application.Render();           // Process LoadComplete
   application.SendNotification(); // Process event messages
@@ -331,10 +333,11 @@ int UtcDaliImageActorGetCurrentImageSize04(void)
   DALI_TEST_EQUALS( actor.GetCurrentImageSize(), closestImageSize, TEST_LOCATION );
 
   // Now complete the image load
-  Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( closestImageSize.width, closestImageSize.height, Pixel::RGBA8888 );
-  Integration::ResourcePointer resourcePtr(bitmap.Get());
-
   Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, false );
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  closestImageSize.width, closestImageSize.height, closestImageSize.width, closestImageSize.height );
+
+  Integration::ResourcePointer resourcePtr(bitmap); // reference it
   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
   application.Render();           // Process LoadComplete
   application.SendNotification(); // Process event messages
@@ -369,10 +372,11 @@ int UtcDaliImageActorGetCurrentImageSize04(void)
   DALI_TEST_EQUALS( actor.GetCurrentImageSize(), size, TEST_LOCATION );
 
   // Now complete the image load
-  Integration::ImageDataPtr bitmap2 = Integration::NewBitmapImageData( image2ClosestSize.width, image2ClosestSize.height, Pixel::RGBA8888 );
-  Integration::ResourcePointer resourcePtr2(bitmap2.Get());
-
   req = application.GetPlatform().GetRequest();
+  Integration::Bitmap* bitmap2 = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, false );
+  bitmap2->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  image2ClosestSize.width, image2ClosestSize.height, image2ClosestSize.width, image2ClosestSize.height );
+
+  Integration::ResourcePointer resourcePtr2(bitmap2); // reference it
   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr2);
   application.Render();           // Process LoadComplete
   application.SendNotification(); // Process event messages
@@ -411,10 +415,11 @@ int UtcDaliImageActorGetCurrentImageSize05(void)
   DALI_TEST_EQUALS( actor.GetCurrentImageSize(), closestImageSize, TEST_LOCATION );
 
   // Now complete the image load
-  Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( closestImageSize.width, closestImageSize.height, Pixel::RGBA8888 );
-  Integration::ResourcePointer resourcePtr(bitmap.Get());
-
   Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, false );
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  closestImageSize.width, closestImageSize.height, closestImageSize.width, closestImageSize.height );
+
+  Integration::ResourcePointer resourcePtr(bitmap); // reference it
   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
   application.Render();           // Process LoadComplete
   application.SendNotification(); // Process event messages
@@ -441,10 +446,11 @@ int UtcDaliImageActorGetCurrentImageSize05(void)
   DALI_TEST_EQUALS( actor.GetCurrentImageSize(), closestImageSize, TEST_LOCATION );
 
   // Now complete the image load
-  Integration::ImageDataPtr bitmap2 = Integration::NewBitmapImageData( image2ClosestSize.width, image2ClosestSize.height, Pixel::RGBA8888 );
-  Integration::ResourcePointer resourcePtr2(bitmap2.Get());
-
   req = application.GetPlatform().GetRequest();
+  Integration::Bitmap* bitmap2 = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, false );
+  bitmap2->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  image2ClosestSize.width, image2ClosestSize.height, image2ClosestSize.width, image2ClosestSize.height );
+
+  Integration::ResourcePointer resourcePtr2(bitmap2); // reference it
   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr2);
   application.Render();           // Process LoadComplete
   application.SendNotification(); // Process event messages
@@ -487,10 +493,11 @@ int UtcDaliImageActorNaturalPixelAreaSize01(void)
   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), closestImageSize, TEST_LOCATION );
 
   // Now complete the image load
-  Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( closestImageSize.width, closestImageSize.height, Pixel::RGBA8888 );
-  Integration::ResourcePointer resourcePtr(bitmap.Get());
-
   Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, false );
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  closestImageSize.width, closestImageSize.height, closestImageSize.width, closestImageSize.height );
+
+  Integration::ResourcePointer resourcePtr(bitmap); // reference it
   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
   application.Render();           // Process LoadComplete
   application.SendNotification(); // Process event messages
@@ -553,10 +560,11 @@ int UtcDaliImageActorNaturalPixelAreaSize02(void)
   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), closestImageSize, TEST_LOCATION );
 
   // Now complete the image load
-  Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( closestImageSize.width, closestImageSize.height, Pixel::RGBA8888 );
-  Integration::ResourcePointer resourcePtr(bitmap.Get());
-
   Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, false );
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  closestImageSize.width, closestImageSize.height, closestImageSize.width, closestImageSize.height );
+
+  Integration::ResourcePointer resourcePtr(bitmap); // reference it
   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
   application.Render();           // Process LoadComplete
   application.SendNotification(); // Process event messages
index eb70f1c..36ce22b 100644 (file)
@@ -19,7 +19,6 @@
 #include <stdlib.h>
 #include <dali/dali.h>
 #include <dali-test-suite-utils.h>
-#include <dali/integration-api/image-data.h>
 
 using namespace Dali;
 
@@ -183,8 +182,9 @@ int UtcDaliMaterialStage01(void)
     std::vector<GLuint> ids;
     ids.push_back( 23 );
     application.GetGlAbstraction().SetNextTextureIds( ids );
-    Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( 80, 80, Pixel::RGBA8888 );
+    Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
     Integration::ResourcePointer resource(bitmap);
+    bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
     DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) );
     Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
     DALI_TEST_CHECK( request != NULL );
@@ -294,8 +294,9 @@ int UtcDaliMaterialStage02(void)
       Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
       DALI_TEST_CHECK( request != NULL );
 
-      Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( 80, 80, Pixel::RGBA8888 );
+      Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
       Integration::ResourcePointer resource(bitmap);
+      bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
       if(request)
       {
         application.GetPlatform().SetResourceLoaded(request->GetId(), request->GetType()->id, resource);
index 23a8d82..d7d32d7 100644 (file)
@@ -200,8 +200,9 @@ void CompleteImageLoad(TestApplication& application, Integration::ResourceId res
   ids.push_back( 23 );
   application.GetGlAbstraction().SetNextTextureIds( ids );
 
-  Integration::ImageDataPtr bitmap = Integration::NewBitmapImageData( 80, 80, Pixel::RGBA8888 );
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
   Integration::ResourcePointer resource(bitmap);
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
 
   application.GetPlatform().SetResourceLoaded(resourceId, requestType, resource);
 }
index c8811b7..fc7d1a6 100644 (file)
@@ -643,9 +643,9 @@ int UtcDaliTextActorSynchronousGlyphLoading(void)
   // no glyphs will be cached
 
   // so..GetGlyphData should have been called to gather metrics
-  DALI_TEST_CHECK( application.GetPlatform().GetTrace().FindMethodAndParams( "GetGlyphData", "getImageData:false" ) );
+  DALI_TEST_CHECK( application.GetPlatform().GetTrace().FindMethodAndParams( "GetGlyphData", "getBitmap:false" ) );
   // ..but not to load glyph bitmap data
-  DALI_TEST_CHECK( ! application.GetPlatform().GetTrace().FindMethodAndParams( "GetGlyphData", "getImageData:true" ) );
+  DALI_TEST_CHECK( ! application.GetPlatform().GetTrace().FindMethodAndParams( "GetGlyphData", "getBitmap:true" ) );
   // ..also, cached high quality glyphs will not have been requested yet
   DALI_TEST_CHECK( ! application.GetPlatform().WasCalled(TestPlatformAbstraction::GetCachedGlyphDataFunc) );
 
@@ -659,7 +659,7 @@ int UtcDaliTextActorSynchronousGlyphLoading(void)
   // An attempt to load high quality glyphs will have been requested and loaded nothing
   DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::GetCachedGlyphDataFunc) );
   // low quality glyphs bitmap data will have now been generated
-  DALI_TEST_CHECK( application.GetPlatform().GetTrace().FindMethodAndParams( "GetGlyphData", "getImageData:true" ) );
+  DALI_TEST_CHECK( application.GetPlatform().GetTrace().FindMethodAndParams( "GetGlyphData", "getBitmap:true" ) );
 
   // request numerals
   actor.SetText( "0123456789" );
@@ -673,7 +673,7 @@ int UtcDaliTextActorSynchronousGlyphLoading(void)
   // An attempt to load high quality glyphs will have been requested and loaded all the numerals
   DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::GetCachedGlyphDataFunc) );
   // ..therefore no low quality glyphs bitmap data will have been requested
-  DALI_TEST_CHECK( !application.GetPlatform().GetTrace().FindMethodAndParams( "GetGlyphData", "getImageData:true" ) );
+  DALI_TEST_CHECK( !application.GetPlatform().GetTrace().FindMethodAndParams( "GetGlyphData", "getBitmap:true" ) );
   END_TEST;
 }
 
index 12e5e07..836c3be 100644 (file)
 #include <dali/integration-api/bitmap.h>
 
 // EXTERNAL INCLUDES
-#include <cstring>
 
 // INTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
-#include <dali/integration-api/image-data.h>
 #include <dali/internal/event/images/bitmap-packed-pixel.h>
 #include <dali/internal/event/images/bitmap-compressed.h>
 #include <dali/internal/event/images/bitmap-external.h>
 #include <dali/integration-api/gl-abstraction.h>
-#include <dali/public-api/images/pixel-extras.h>
 
 namespace Dali
 {
@@ -255,7 +252,8 @@ Bitmap* Bitmap::New(const Profile profile = BITMAP_2D_PACKED_PIXELS, const bool
      * scanlines past the bottom of the image in the buffer if requested.*/
     case BITMAP_2D_PACKED_PIXELS:
     {
-      return new Dali::Internal::BitmapPackedPixel(managePixelBuffer);
+      Bitmap * const bitmap = new Dali::Internal::BitmapPackedPixel(managePixelBuffer);
+      return bitmap;
     }
 
     /** The data for the bitmap is buffered in an opaque form.*/
@@ -267,18 +265,6 @@ Bitmap* Bitmap::New(const Profile profile = BITMAP_2D_PACKED_PIXELS, const bool
   return 0;
 }
 
-Bitmap* Bitmap::New(const Pixel::Format format)
-{
-  if( Pixel::IsEncoded( format ) )
-  {
-    return new Dali::Internal::BitmapCompressed(true);
-  }
-  else
-  {
-    return new Dali::Internal::BitmapPackedPixel(true);
-  }
-}
-
 Bitmap::Bitmap( bool discardable, Dali::Integration::PixelBuffer* pixBuf)
 : mImageWidth(0),
   mImageHeight(0),
@@ -329,7 +315,7 @@ void Bitmap::DeletePixelBuffer()
 
 void Bitmap::Initialize( Pixel::Format pixelFormat,
                           unsigned int width,
-                          unsigned int height )
+                          unsigned int height)
 {
   DALI_ASSERT_DEBUG(width * height < (32 * 1024) * (32 * 1024) && "The total area of the bitmap is too great.\n");
   mImageWidth   = width;
@@ -339,35 +325,6 @@ void Bitmap::Initialize( Pixel::Format pixelFormat,
   mHasAlphaChannel = Pixel::HasAlpha(pixelFormat);
 }
 
-BitmapPtr ConvertToBitmap( ImageData& imageData )
-{
-  BitmapPtr bitmap = Bitmap::New( imageData.pixelFormat );
-  Bitmap::PackedPixelsProfile* packedBitmap = bitmap->GetPackedPixelsProfile();
-  if( packedBitmap )
-  {
-    // Pass the buffer of pixels into the new Bitmap:
-    packedBitmap->AssignBuffer( imageData.pixelFormat, imageData.ReleaseImageBuffer(), imageData.dataSize, imageData.imageWidth, imageData.imageHeight, imageData.imageWidth, imageData.imageHeight );
-
-    // Convert the info about the alpha channel:
-    bitmap->SetAlphaChannelUsed( imageData.GetAlphaUsage() == ImageData::ALPHA_USAGE_SOME_TRANSLUCENT );
-  }
-  else
-  {
-    ///@Todo: In one of the follow-on patches, the copy here will be replaced with a buffer ownership assignment, after the Bitmap classes are refactored, rather than enhancing BitmapCompressed in this one.
-    Bitmap::CompressedProfile * compressedBitmap = bitmap->GetCompressedProfile();
-    if( compressedBitmap )
-    {
-      compressedBitmap->ReserveBufferOfSize( imageData.pixelFormat, imageData.imageWidth, imageData.imageHeight, imageData.dataSize );
-      memcpy( bitmap->GetBuffer(), imageData.GetBuffer(), imageData.dataSize );
-    }
-    else
-    {
-      DALI_ASSERT_DEBUG( 0 == "Unknown bitmap profile." );
-    }
-  }
-  return bitmap;
-}
-
 } //namespace Integration
 
 } //namespace Dali
index 13925f8..870f54d 100644 (file)
@@ -86,8 +86,7 @@ public:
   };
 
   /**
-   * @brief Create a new instance of a Bitmap with the profile asked for.
-   *
+   * Create a new instance of a Bitmap with the profile asked for.
    * @return Pointer to created Bitmap subclass. Clients should immediately
    * wrap this in a reference-counting smart pointer or store it in a similarly
    * automatic owning collection.
@@ -99,19 +98,6 @@ public:
    **/
   static Bitmap* New(Profile profile, bool managePixelBuffer);
 
-  /**
-   * @brief Create a new instance of a Bitmap with a profile appropriate to the
-   * pixel format requested.
-   *
-   * The allocated buffer is owned by the instance and is not referenced
-   * externally, so its lifetime can be managed by the instance.
-   * @return Pointer to created Bitmap subclass. Clients should immediately
-   * wrap this in a reference-counting smart pointer or store it in a similarly
-   * automatic owning collection.
-   * @param[in] format Defines image data and required features of the bitmap.
-   **/
-  static Bitmap* New(Pixel::Format format);
-
   /** \name GeneralFeatures
    * Features that are generic between profiles. */
   /**@{*/
@@ -171,26 +157,13 @@ public:
   }
 
   /**
-   * @brief Sets whether the alpha channel is used.
-   *
-   * The definition of "used" is that at least one of the the pixels of the
-   * bitmap has an alpha value that is less than 1.0.
-   * @param[in] alphaChannelUsed If true, the alpha channel will be marked as
-   * used, else it will be marked as unused.
-   */
-  void SetAlphaChannelUsed( bool alphaChannelUsed )
-  {
-    mHasAlphaChannel = alphaChannelUsed;
-  }
-
-  /**
    * Queries if the bitmap has any transparent data
    * @return true if the bitmap has alpha data
    */
   bool IsFullyOpaque() const
   {
     // check pixel format for alpha channel
-    return !( HasAlphaChannel() && mAlphaChannelUsed );
+    return !(HasAlphaChannel() && mAlphaChannelUsed);
   }
 
   /**@}*/ ///< End of generic features
@@ -231,9 +204,9 @@ public:
      *
      * The buffer must have been allocated with the C++ array new operator, not
      * with malloc or as a local or static object. The precise form is as follows:
-     * <code>
+     *
      *    PixelBuffer * buffer = new PixelBuffer[bufSize];
-     * </code>
+     *
      * @pre bufferWidth, bufferHeight have to be power of two
      * @param[in] pixelFormat   pixel format
      * @param[in] buffer        the pixel buffer
@@ -369,17 +342,6 @@ private:
   DALI_LOG_OBJECT_STRING_DECLARATION;
 };
 
-class ImageData;
-typedef IntrusivePtr<ImageData> ImageDataPtr;
-
-/**
- * Make a Bitmap instance from an ImageData object, destructively.
- * @param[in] imageData A populated buffer of image data. Its buffer may be
- *            null on exit, so it should not be used again.
- * @returns Bitmap owning the image data buffer passed in or a copy of it.
- **/
-BitmapPtr ConvertToBitmap(ImageData& imageData);
-
 } // namespace Integration
 
 } // namespace Dali
index 846e686..5648f6a 100644 (file)
@@ -39,9 +39,9 @@ GlyphSet::~GlyphSet()
   mCharacterList.clear();
 }
 
-void GlyphSet::AddCharacter(ImageDataPtr imageData, const GlyphMetrics& glyphMetrics)
+void GlyphSet::AddCharacter(BitmapPtr bitmapData, const GlyphMetrics& glyphMetrics)
 {
-  mCharacterList.push_back(Character(imageData, glyphMetrics));
+  mCharacterList.push_back(Character(bitmapData, glyphMetrics));
 }
 
 void GlyphSet::AddCharacter(const Character& character)
index 01b9807..344db6f 100644 (file)
@@ -23,7 +23,7 @@
 // INTERNAL INCLUDES
 #include <dali/public-api/common/vector-wrapper.h>
 #include <dali/public-api/math/vector2.h>
-#include <dali/integration-api/image-data.h>
+#include <dali/integration-api/bitmap.h>
 #include <dali/integration-api/resource-declarations.h>
 
 namespace Dali
@@ -104,7 +104,7 @@ struct DALI_IMPORT_API GlobalMetrics
 class DALI_IMPORT_API GlyphSet : public Dali::RefObject
 {
 public:
-  typedef std::pair<ImageDataPtr, GlyphMetrics>  Character;
+  typedef std::pair<BitmapPtr, GlyphMetrics>  Character;
   typedef IntrusivePtr<Character>             CharacterPtr;
   typedef std::vector<Character>              CharacterList;
   typedef CharacterList::iterator             CharacterIter;
@@ -122,10 +122,10 @@ public:
 
   /**
    * Add a character to the platform font
-   * @param [in] imageData   A bitmap of the rendered character
+   * @param [in] bitmapData   A bitmap of the rendered character
    * @param [in] glyphMetrics Metrics for the character, including its character code
    */
-  void AddCharacter(ImageDataPtr imageData, const GlyphMetrics& glyphMetrics);
+  void AddCharacter(BitmapPtr bitmapData, const GlyphMetrics& glyphMetrics);
 
   /**
    * Add a character to the platform font
index 067d4b4..f768703 100644 (file)
@@ -68,14 +68,6 @@ ImageDataPtr ImageData::New( uint8_t * const imageBuffer, const BufferSize numBy
   return ImageDataPtr( new ImageData( imageBuffer, numBytes, imageWidth, imageHeight, pixelFormat ) );
 }
 
-uint8_t * ImageData::ReleaseImageBuffer()
-{
-  DALI_ASSERT_DEBUG( mData && "The buffer was released already." );
-  uint8_t * const data = mData;
-  mData = 0;
-  return data;
-}
-
 ImageDataPtr NewBitmapImageData( unsigned imageWidth, unsigned imageHeight, Pixel::Format pixelFormat )
 {
   DALI_ASSERT_DEBUG( pixelFormat <= Pixel::BGRA8888 && "Pixel format must be an addressable one." );
index b5b1d7a..e082ea6 100644 (file)
@@ -140,8 +140,6 @@ public:
   uint8_t * GetBuffer() { return mData; }
 
   /**
-   * @brief Transfer pixel buffer ownership to caller.
-   *
    * Pass ownership of the buffer of pixel-level data that this instance
    * currently owns to the caller, and forget about the buffer here as a
    * side effect.
@@ -149,7 +147,7 @@ public:
    * The caller takes ownership of the buffer and is responsible for calling
    * delete[] on it eventually.
    **/
-  uint8_t * ReleaseImageBuffer();
+  uint8_t * ReleaseImageBuffer() { uint8_t * const data = mData; mData = 0; return data; }
 
   /**
    * @brief Get whether the alpha channel in the pixels is used.
@@ -170,7 +168,7 @@ private:
   uint8_t*     mData;
 
 public:
-  const size_t        dataSize;    ///< Number of bytes in buffer pointed at by mData
+  const size_t        dataSize;   ///< Number of bytes in buffer pointed at by mData
   const uint16_t      imageWidth;  ///< Image logical width in pixels
   const uint16_t      imageHeight; ///< Image logical height in pixels
   const Pixel::Format pixelFormat; ///< Pixel format
@@ -183,8 +181,6 @@ private:
 };
 
 /**
- * @brief Use to make a simple 2d array of pixels.
- *
  * A convenience function for creating the common case of an uncompressed image
  * having width * height pixels in the buffer.
  * @param[in] imageWidth The width in pixels of the image.
index 0b7f4eb..1b5f691 100644 (file)
@@ -32,6 +32,7 @@ typedef std::vector<uint32_t> TextArray;
 namespace Integration
 {
 
+class Bitmap;
 class DynamicsFactory;
 
 /**
@@ -63,7 +64,7 @@ public:
    * to cooperate with other apps and reduce the chance of this one being
    * force-killed in a low memory situation.
    */
-  virtual void Suspend() = 0;
+  virtual void Suspend() {} ///!ToDo: Make pure virtual once dali-adaptor patch is in place = 0;
 
   /**
    * Tell the platform abstraction that Dali is resuming from a pause, such as
@@ -71,7 +72,7 @@ public:
    * It is time to wake up sleeping background threads and recreate memory
    * caches and other temporary data.
    */
-  virtual void Resume() = 0;
+  virtual void Resume() {} ///!ToDo: Make pure virtual once dali-adaptor patch is in place = 0;
 
   // Resource Loading
 
@@ -103,7 +104,7 @@ public:
 
   /**
    * Request a resource from the native filesystem. This is an asynchronous request.
-   * After this method returns, GetResources() can be polled to retrieve the result(s) of the
+   * After this method returns, FillResourceCache() will be called to retrieve the result(s) of the
    * resource loading operation. Loading resources in separate worker thread is recommended.
    * Multi-threading note: this method will be called from the main thread only i.e. not
    * from within the Core::Render() method.
@@ -192,12 +193,12 @@ public:
    * @note Font's style goes inside the textRequest parameter
    * @param[in] textRequest  Resource request. Includes font's style.
    * @param[in] fontFamily   The name of the font's family
-   * @param[in] getImageData Whether to load bitmaps for the symbols as well
+   * @param[in] getBitmap    Whether to load bitmaps for the symbols as well
    * @return A GlyphSet pointer with a list of the requested glyph metrics.
    */
   virtual Integration::GlyphSet* GetGlyphData ( const Integration::TextResourceType& textRequest,
                                                 const std::string& fontFamily,
-                                                bool getImageData) const = 0;
+                                                bool getBitmap) const = 0;
 
   /**
    * Called by GlyphResourceManager to synchronously load glyph data.
@@ -360,7 +361,7 @@ public:
    *
    * @return A bitmap representing the character.
    */
-  virtual Integration::ImageDataPtr GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character ) const = 0;
+  virtual Integration::BitmapPtr GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character ) const = 0;
 
 }; // class PlatformAbstraction
 
index 847322d..f8f0d65 100644 (file)
@@ -34,29 +34,21 @@ namespace Integration
 // Resource Types
 
 /**
- * Extendable set of resource type identifiers used by ResourceType subclasses.
+ * Extendable set of resource types
  */
 enum ResourceTypeId
 {
-  ResourceImageData,   ///< A buffer of image data with dimension and type metadata.
+  ResourceBitmap,
   ResourceNativeImage,
   ResourceTargetImage,
   ResourceShader,
   ResourceModel,
   ResourceMesh,
-  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.
+  ResourceText
 };
 
 /**
- * @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.
+ * The abstract base class for resource types.
  */
 struct DALI_IMPORT_API ResourceType
 {
@@ -67,6 +59,9 @@ struct DALI_IMPORT_API ResourceType
   ResourceType(ResourceTypeId typeId)
   : id(typeId) {}
 
+  /**
+   * Destructor.
+   */
   virtual ~ResourceType() {}
 
   /**
@@ -80,44 +75,51 @@ struct DALI_IMPORT_API ResourceType
 private:
 
   // Undefined copy constructor.
-  ResourceType( const ResourceType& type );
+  ResourceType(const ResourceType& typePath);
 
   // Undefined assignment operator.
-  ResourceType& operator=( const ResourceType& rhs );
+  ResourceType& operator=(const ResourceType& rhs);
 };
 
 /**
- * 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.
+ * BitmapResourceType describes a bitmap resource, which can be requested
+ * from ResourceLoader::LoadResource() or AllocateBitmapImage.
  */
-struct DALI_IMPORT_API ImageResourceType : public ResourceType
+struct DALI_IMPORT_API BitmapResourceType : public ResourceType
 {
   /**
    * Constructor.
-   * @param[in] typeId  One of the image ResourceTypeIds.
    * @param[in] attribs parameters for image loading request
    */
-  ImageResourceType(const ResourceTypeId typeId, const ImageAttributes& attribs)
-  : ResourceType(typeId),
-    imageAttributes(attribs)
-  {
-    DALI_ASSERT_DEBUG( typeId == ResourceTexture || typeId == ResourceImageData || typeId == ResourceNativeImage || typeId == ResourceTargetImage || typeId == ResourceAppBitmap );
-  }
+  BitmapResourceType(const ImageAttributes& attribs)
+  : ResourceType(ResourceBitmap),
+    imageAttributes(attribs) {}
+
+  /**
+   * Destructor.
+   */
+  virtual ~BitmapResourceType() {}
 
   /**
    * @copydoc ResourceType::Clone
    */
   virtual ResourceType* Clone() const
   {
-    return new ImageResourceType( id, imageAttributes );
+    return new BitmapResourceType(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);
 };
 
 /**
@@ -128,7 +130,7 @@ struct DALI_IMPORT_API ImageResourceType : public ResourceType
 struct DALI_IMPORT_API NativeImageResourceType : public ResourceType
 {
   /**
-   * Default constructor initialises the base class with the correct ResourceTypeId.
+   * Constructor.
    */
   NativeImageResourceType()
   : ResourceType(ResourceNativeImage) {}
@@ -141,6 +143,11 @@ struct DALI_IMPORT_API NativeImageResourceType : public ResourceType
   : ResourceType(ResourceNativeImage),
     imageAttributes(attribs) {}
 
+  /**
+   * Destructor.
+   */
+  virtual ~NativeImageResourceType() {}
+
  /**
   * @copydoc ResourceType::Clone
   */
@@ -153,6 +160,14 @@ struct DALI_IMPORT_API NativeImageResourceType : public ResourceType
    * 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);
 };
 
 /**
@@ -162,7 +177,7 @@ struct DALI_IMPORT_API NativeImageResourceType : public ResourceType
 struct DALI_IMPORT_API RenderTargetResourceType : public ResourceType
 {
   /**
-   * Default constructor initialises the base class with the correct ResourceTypeId.
+   * Constructor.
    */
   RenderTargetResourceType()
   : ResourceType(ResourceTargetImage) {}
@@ -176,6 +191,11 @@ struct DALI_IMPORT_API RenderTargetResourceType : public ResourceType
     imageAttributes(attribs) {}
 
   /**
+   * Destructor.
+   */
+  virtual ~RenderTargetResourceType() {}
+
+  /**
    * @copydoc ResourceType::Clone
    */
   virtual ResourceType* Clone() const
@@ -187,6 +207,14 @@ struct DALI_IMPORT_API RenderTargetResourceType : public ResourceType
    * Attributes are copied from the request.
    */
   ImageAttributes imageAttributes;
+
+private:
+
+  // Undefined copy constructor.
+  RenderTargetResourceType(const RenderTargetResourceType& typePath);
+
+  // Undefined assignment operator.
+  RenderTargetResourceType& operator=(const RenderTargetResourceType& rhs);
 };
 
 /**
@@ -195,6 +223,9 @@ struct DALI_IMPORT_API RenderTargetResourceType : public ResourceType
  */
 struct DALI_IMPORT_API ShaderResourceType : public ResourceType
 {
+  /**
+   * Constructor.
+   */
   ShaderResourceType(size_t shaderHash, const std::string& vertexSource, const std::string& fragmentSource)
   : ResourceType(ResourceShader),
     hash(shaderHash),
@@ -204,6 +235,13 @@ struct DALI_IMPORT_API ShaderResourceType : public ResourceType
   }
 
   /**
+   * Destructor.
+   */
+  virtual ~ShaderResourceType()
+  {
+  }
+
+  /**
    * @copydoc ResourceType::Clone
    */
   virtual ResourceType* Clone() const
@@ -215,6 +253,14 @@ public: // Attributes
   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);
 };
 
 /**
@@ -252,10 +298,10 @@ struct DALI_IMPORT_API TextResourceType : public ResourceType
      * 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:<code>
+     * mask, shift sequence. The naive bitwidths before this modification are as follows:
      *    character:21;
      *    quality:1;
-     *    loaded:1;</code>
+     *    loaded:1;
      *  @{
      */
     uint32_t character:21;       ///< character code (UTF-32), max value of 0x10ffff (21 bits)
@@ -309,6 +355,13 @@ struct DALI_IMPORT_API TextResourceType : public ResourceType
   }
 
   /**
+   * virtual destructor
+   */
+  virtual ~TextResourceType()
+  {
+  }
+
+  /**
    * @copydoc ResourceType::Clone
    */
   virtual ResourceType* Clone() const
@@ -339,6 +392,14 @@ struct DALI_IMPORT_API TextResourceType : public ResourceType
   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);
 };
 
 /**
@@ -348,7 +409,7 @@ struct DALI_IMPORT_API TextResourceType : public ResourceType
 struct DALI_IMPORT_API ModelResourceType : public ResourceType
 {
   /**
-   * Default constructor initialises the base class with the correct ResourceTypeId.
+   * Constructor.
    */
   ModelResourceType()
     : ResourceType(ResourceModel)
@@ -356,12 +417,27 @@ struct DALI_IMPORT_API ModelResourceType : public ResourceType
   }
 
   /**
+   * 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);
 };
 
 
@@ -372,18 +448,31 @@ struct DALI_IMPORT_API ModelResourceType : public ResourceType
 struct DALI_IMPORT_API MeshResourceType : public ResourceType
 {
   /**
-   * Default constructor initialises the base class with the correct ResourceTypeId.
+   * Constructor.
    */
   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)
index 987fb7e..42cfa52 100644 (file)
@@ -44,7 +44,7 @@ Dali::EncodedBufferImage EncodedBufferImage::New( const uint8_t * const encodedI
   Dali::EncodedBufferImage publicImage(image);
 
   // Replicate the functionality of ImageFactory::load() without the filesystem caching:
-  Dali::Integration::ImageResourceType resourceType( Dali::Integration::ResourceImageData, attributes );
+  Dali::Integration::BitmapResourceType resourceType( attributes );
   RequestBufferPtr buffer( new RequestBuffer );
   buffer->GetVector().Resize( encodedImageByteCount );
   // Resize() won't throw on failure, so avoid a SEGV if the allocation failed:
index d63e01b..393f633 100644 (file)
@@ -112,7 +112,7 @@ ResourceTicketPtr ImageFactory::Load( Request *req )
       ticket = IssueLoadRequest( req->url, req->attributes );
       req->resourceId = ticket->GetId();
     }
-    DALI_ASSERT_DEBUG( ticket->GetTypePath().type->id == ResourceImageData   ||
+    DALI_ASSERT_DEBUG( ticket->GetTypePath().type->id == ResourceBitmap      ||
                        ticket->GetTypePath().type->id == ResourceNativeImage ||
                        ticket->GetTypePath().type->id == ResourceTargetImage );
   }
@@ -130,7 +130,7 @@ ResourceTicketPtr ImageFactory::Load( Request *req )
 // new resource of size (96, 96), but reloading Req1 would load a scaled down version
 ResourceTicketPtr ImageFactory::Reload( Request* request )
 {
-  DALI_ASSERT_ALWAYS( request ); ///@todo This is not a public api so throwing and thus exiting is not appropriate. A null request indicates a logic error in calling code. Change request to a reference or handle the null case defensively / robustly. Alternatively, change to DALI_ASSERT_DEBUG.
+  DALI_ASSERT_ALWAYS( request );
 
   // go through requests, check real size and attributes again. If different, update related ticket.
   ResourceTicketPtr ticket;
@@ -151,7 +151,7 @@ ResourceTicketPtr ImageFactory::Reload( Request* request )
   }
   else // ticket still alive
   {
-    DALI_ASSERT_DEBUG( ticket->GetTypePath().type->id == ResourceImageData   ||
+    DALI_ASSERT_DEBUG( ticket->GetTypePath().type->id == ResourceBitmap      ||
                        ticket->GetTypePath().type->id == ResourceNativeImage ||
                        ticket->GetTypePath().type->id == ResourceTargetImage );
 
@@ -172,7 +172,7 @@ ResourceTicketPtr ImageFactory::Reload( Request* request )
     }
     else
     {
-      // If not, return a different ticket
+      // if not, return a different ticket
       ticket = IssueLoadRequest( request->url, request->attributes );
       request->resourceId = ticket->GetId();
     }
@@ -197,10 +197,9 @@ const ImageAttributes& ImageFactory::GetActualAttributes( ResourceId resourceId
   ResourceTicketPtr ticket = mResourceClient.RequestResourceTicket( resourceId );
   if( ticket )
   {
-    DALI_ASSERT_DEBUG( ticket->GetTypePath().type->id == ResourceImageData   ||
+    DALI_ASSERT_DEBUG( ticket->GetTypePath().type->id == ResourceBitmap      ||
                        ticket->GetTypePath().type->id == ResourceNativeImage ||
-                       ticket->GetTypePath().type->id == ResourceTargetImage ||
-                       ticket->GetTypePath().type->id == ResourceAppBitmap );
+                       ticket->GetTypePath().type->id == ResourceTargetImage );
     const ImageAttributes& attrib = static_cast<ImageTicket*>(ticket.Get())->GetAttributes();
     return attrib;
   }
@@ -337,7 +336,7 @@ ResourceTicketPtr ImageFactory::FindCompatibleResource( const std::string& filen
         continue;
       }
 
-      DALI_ASSERT_DEBUG( ticket->GetTypePath().type->id == ResourceImageData   ||
+      DALI_ASSERT_DEBUG( ticket->GetTypePath().type->id == ResourceBitmap      ||
                          ticket->GetTypePath().type->id == ResourceNativeImage ||
                          ticket->GetTypePath().type->id == ResourceTargetImage );
 
@@ -381,7 +380,7 @@ ResourceTicketPtr ImageFactory::IssueLoadRequest( const std::string& filename, c
     attributes.SetSize( size.width, size.height );
   }
 
-  ImageResourceType resourceType( ResourceImageData, attributes );
+  BitmapResourceType resourceType( attributes );
   ResourceTicketPtr ticket = mResourceClient.RequestResource( resourceType, filename );
   return ticket;
 }
index 8fbc6c9..c655760 100644 (file)
@@ -150,11 +150,11 @@ NinePatchImage::NinePatchImage( const std::string& filename, const Dali::ImageAt
   loadedAttrs.SetSize( closestSize );
   mWidth = closestSize.width;
   mHeight = closestSize.height;
-  Integration::ImageResourceType resourceType( Integration::ResourceImageData, loadedAttrs );
+  Integration::BitmapResourceType resourceType( loadedAttrs );
 
   // Note, bitmap is only destroyed when the image is destroyed.
-  Integration::ResourcePointer resource = platformAbstraction.LoadResourceSynchronously( resourceType, filename );
-  mBitmap = ConvertToBitmap( * static_cast<Integration::ImageData*>( resource.Get() ) );
+  Integration::ResourcePointer resource = platformAbstraction.LoadResourceSynchronously(resourceType, filename);
+  mBitmap = static_cast<Integration::Bitmap*>( resource.Get());
 }
 
 NinePatchImage* NinePatchImage::GetNinePatchImage( Image* image)
index 3533414..06105eb 100644 (file)
@@ -94,13 +94,12 @@ ResourceTicketPtr ResourceClient::RequestResource(
 
   switch (type.id)
   {
-    case ResourceImageData:
-    case ResourceTexture:
+    case ResourceBitmap:
     {
-      const ImageResourceType& ImageResource = static_cast <const ImageResourceType&> (type);
+      const BitmapResourceType& bitmapResource = static_cast <const BitmapResourceType&> (type);
       // image tickets will cache the requested parameters, which are updated on successful loading
       ImageTicket* imageTicket = new ImageTicket(*this, newId, typePath);
-      imageTicket->mAttributes = ImageResource.imageAttributes;
+      imageTicket->mAttributes = bitmapResource.imageAttributes;
       newTicket = imageTicket;
       break;
     }
@@ -119,7 +118,6 @@ ResourceTicketPtr ResourceClient::RequestResource(
     case ResourceShader:
     case ResourceMesh:
     case ResourceText:
-    case ResourceAppBitmap:
     {
       newTicket = new ResourceTicket(*this, newId, typePath);
       break;
@@ -130,7 +128,6 @@ ResourceTicketPtr ResourceClient::RequestResource(
 
   DALI_LOG_INFO(Debug::Filter::gResource, Debug::General, "ResourceClient: RequestResource(path:%s type.id:%d) newId:%u\n", path.c_str(), type.id, newId);
 
-  ///@ToDo: only call this in some cases. E.g., ResourceNativeImage will not "load".
   RequestLoadResourceMessage( mUpdateManager.GetEventToUpdate(), mResourceManager, newId, typePath, priority );
   return newTicket;
 }
@@ -140,7 +137,7 @@ ResourceTicketPtr ResourceClient::DecodeResource(
   RequestBufferPtr buffer,
   LoadResourcePriority priority )
 {
-  DALI_ASSERT_DEBUG( type.id == ResourceImageData && "Only bitmap resources are currently decoded from memory buffers. It should be easy to expand to other resource types though. The public API function at the front and the resource thread at the back end are all that should need to be changed. The code in the middle should be agnostic to the the resource type it is conveying.\n" );
+  DALI_ASSERT_DEBUG( type.id == ResourceBitmap && "Only bitmap resources are currently decoded from memory buffers. It should be easy to expand to other resource types though. The public API function at the front and the resource thread at the back end are all that should need to be changed. The code in the middle should be agnostic to the the resource type it is conveying.\n" );
   DALI_ASSERT_DEBUG( buffer.Get() && "Null resource buffer passed for decoding." );
   ResourceTicketPtr newTicket;
   if( buffer.Get() ) //< Check to avoid SEGV on a null pointer.
@@ -151,14 +148,14 @@ ResourceTicketPtr ResourceClient::DecodeResource(
     // Create the correct ticket type for the resource:
     switch (type.id)
     {
-      case ResourceImageData:
+      case ResourceBitmap:
       {
         // NOTE: pre-increment, otherwise we get 0 for first one.
         newId = ++(mImpl->mNextId);
-        const ImageResourceType& imageDataResource = static_cast <const ImageResourceType&> ( type );
+        const BitmapResourceType& bitmapResource = static_cast <const BitmapResourceType&> ( type );
         // Image tickets will cache the requested parameters, which are updated on successful loading
         ImageTicket* imageTicket = new ImageTicket( *this, newId, typePath );
-        imageTicket->mAttributes = imageDataResource.imageAttributes;
+        imageTicket->mAttributes = bitmapResource.imageAttributes;
         newTicket = imageTicket;
         break;
       }
@@ -170,8 +167,6 @@ ResourceTicketPtr ResourceClient::DecodeResource(
       case ResourceShader:
       case ResourceMesh:
       case ResourceText:
-      case ResourceTexture:
-      case ResourceAppBitmap:
       {
         DALI_LOG_ERROR( "Unsupported resource type passed for decoding from a memory buffer." );
       }
@@ -296,11 +291,11 @@ ImageTicketPtr ResourceClient::AddBitmapImage(Bitmap* bitmap)
 
   ImageTicketPtr newTicket;
 
-  const ResourceId newId = ++( mImpl->mNextId );
+  const ResourceId newId = ++(mImpl->mNextId);
 
-  Dali::ImageAttributes imageAttributes = Dali::ImageAttributes::New( bitmap->GetImageWidth(), bitmap->GetImageHeight(), bitmap->GetPixelFormat() );
-  ImageResourceType bitmapResourceType( ResourceAppBitmap, imageAttributes ); // construct first as no copy ctor (needed to bind ref to object)
-  ResourceTypePath typePath( bitmapResourceType, "" );
+  Dali::ImageAttributes imageAttributes = Dali::ImageAttributes::New(bitmap->GetImageWidth(), bitmap->GetImageHeight(), bitmap->GetPixelFormat());
+  BitmapResourceType bitmapResourceType(imageAttributes); // construct first as no copy ctor (needed to bind ref to object)
+  ResourceTypePath typePath(bitmapResourceType, "");
   newTicket = new ImageTicket(*this, newId, typePath);
   newTicket->mAttributes = imageAttributes;
   newTicket->LoadingSucceeded();
@@ -389,7 +384,7 @@ ResourceTicketPtr ResourceClient::AllocateTexture( unsigned int width,
   const ResourceId newId = ++(mImpl->mNextId);
 
   Dali::ImageAttributes imageAttributes = Dali::ImageAttributes::New( width, height, pixelformat);
-  ImageResourceType bitmapResourceType( ResourceTexture, imageAttributes );
+  BitmapResourceType bitmapResourceType(imageAttributes); // construct first as no copy ctor (needed to bind ref to object)
   ResourceTypePath typePath(bitmapResourceType, "");
   newTicket = new ImageTicket(*this, newId, typePath);
 
@@ -476,10 +471,10 @@ void ResourceClient::ResourceTicketDiscarded(const ResourceTicket& ticket)
   const ResourceTypePath& typePath = ticket.GetTypePath();
 
   // Ensure associated event owned resources are also removed
-  mImpl->mBitmaps.erase( deadId );
+  mImpl->mBitmaps.erase(ticket.GetId());
 
   // The ticket object is dead, remove from tickets container
-  TicketContainerSize erased = mImpl->mTickets.erase( deadId );
+  TicketContainerSize erased = mImpl->mTickets.erase(deadId);
   DALI_ASSERT_DEBUG(erased != 0);
   (void)erased; // Avoid "unused variable erased" in release builds
 
index 5628797..65ed587 100644 (file)
@@ -110,7 +110,7 @@ public: // Used by application-side objects e.g. Dali::Image
    * Adding an observer to the ticket will enable the application to determine when the
    * resource has finished decoding.
    * @note Only images are currently supported by this function.
-   * @param[in] type The type of resource. Must be ResourceImageData.
+   * @param[in] type The type of resource. Must be BitmapResourceType.
    * @param[in] buffer The raw data of the resource.
    * @param[in] priority The priority of the request. This is ignored if the resource is already being loaded.
    * @return A ref-counted request object on success or a null pointer on failure.
@@ -334,11 +334,11 @@ public: // Message methods
   /**
    * Finds ImageTicket which belongs to resource identified by id and updates the cached size and pixelformat
    * with the data from texture.
-   * @note This will replace the whole ImageAttributes member of the ticket, not just the three properties mentioned.
+   * !!! NOTE, this will replace the whole ImageAttributes member of the ticket, not just the three properties mentioned !!!
    * @param id The resource id to find the ticket of
    * @param imageAttributes The image attributes to assign to the ticket
    */
-  void UpdateImageTicket( ResourceId id, const Dali::ImageAttributes& imageAttributes );
+  void UpdateImageTicket( ResourceId id, const Dali::ImageAttributes& imageAttributes ); ///!< Issue #AHC01
 
 private:
   ResourceManager& mResourceManager;          ///< The resource manager
index b79e371..8604350 100644 (file)
@@ -48,17 +48,15 @@ int ResourceTypeCompare(const ResourceType& lhs, const ResourceType& rhs)
 
     switch (lhs.id)
     {
-      case ResourceAppBitmap:
-      case ResourceImageData:
-      case ResourceTexture:
+      case ResourceBitmap:
       {
         // compare bitmap widths & heights
-        const ImageResourceType& lhsImage = static_cast<const ImageResourceType&>(lhs);
-        const ImageResourceType& rhsImage = static_cast<const ImageResourceType&>(rhs);
+        const BitmapResourceType& lhsBitmap = static_cast<const BitmapResourceType&>(lhs);
+        const BitmapResourceType& rhsBitmap = static_cast<const BitmapResourceType&>(rhs);
 
-        if (lhsImage.imageAttributes != rhsImage.imageAttributes)
+        if (lhsBitmap.imageAttributes != rhsBitmap.imageAttributes)
         {
-          result = lhsImage.imageAttributes < rhsImage.imageAttributes ? -1 : 1;
+          result = lhsBitmap.imageAttributes < rhsBitmap.imageAttributes ? -1 : 1;
         }
         // else result = 0
         break;
index ae35ec4..1994f25 100644 (file)
@@ -274,15 +274,23 @@ void GlyphResourceManager::UploadGlyphsToTexture( GlyphResourceObserver* observe
       // if it's no longer used, don't upload
       continue;
     }
-    // grab a pointer to the image data:
-    Integration::ImageData* bitmap( charList[ i ].first.Get() );
+    // grab a pointer to the bitmap
+    Integration::Bitmap* bitmap( charList[ i ].first.Get() );
+    unsigned int bitmapWidth  = bitmap->GetImageWidth();
+    unsigned int bitmapHeight = bitmap->GetImageHeight();
+    Bitmap::PackedPixelsProfile* packedBitmap = bitmap->GetPackedPixelsProfile();
+    if( NULL != packedBitmap )
+    {
+      bitmapWidth  = packedBitmap->GetBufferWidth();
+      bitmapHeight = packedBitmap->GetBufferHeight();
+    }
 
     // create a bitmap upload object, then add it to the array
-    BitmapUpload upload( bitmap->ReleaseImageBuffer(), // Inform the bitmap we're taking ownership of it's pixel buffer.
+    BitmapUpload upload( bitmap->ReleaseBuffer(), // Inform the bitmap we're taking ownership of it's pixel buffer.
                          xPos,          // x position in the texture to upload the bitmap to
                          yPos,          // y position in the texture to upload the bitmap to
-                         bitmap->imageWidth,
-                         bitmap->imageHeight,
+                         bitmapWidth,   // bitmap width
+                         bitmapHeight,  // bitmap height
                          BitmapUpload::DISCARD_PIXEL_DATA ); // tell the the texture to delete the bitmap pixel buffer when it's done
     uploadArray.push_back( upload );
   }
index f2395c4..d935e18 100644 (file)
@@ -119,8 +119,6 @@ struct ResourceManager::ResourceManagerImpl
     }
   }
 
-  void UploadImageData( const ResourceId id, Bitmap& bitmap );
-
   PlatformAbstraction&     mPlatformAbstraction;
   NotificationManager&     mNotificationManager;
   ResourceClient*          mResourceClient; // (needs to be a ptr - it's not instantiated yet)
@@ -498,6 +496,18 @@ void ResourceManager::HandleSaveResourceRequest( ResourceId id, const ResourceTy
 
     switch( typePath.type->id )
     {
+      case ResourceBitmap:
+      {
+        break;
+      }
+      case ResourceNativeImage:
+      {
+        break;
+      }
+      case ResourceTargetImage:
+      {
+        break;
+      }
       case ResourceShader:
       {
         resource = GetShaderData(id);
@@ -508,15 +518,11 @@ void ResourceManager::HandleSaveResourceRequest( ResourceId id, const ResourceTy
         resource = GetModelData(id);
         break;
       }
-
-      // No other resource types are saveable:
-      case ResourceImageData:
-      case ResourceNativeImage:
-      case ResourceTargetImage:
       case ResourceMesh:
+      {
+        break;
+      }
       case ResourceText:
-      case ResourceTexture:
-      case ResourceAppBitmap:
       {
         break;
       }
@@ -587,10 +593,9 @@ void ResourceManager::HandleDiscardResourceRequest( ResourceId deadId, ResourceT
 
   if (wasComplete)
   {
-    if( typeId == ResourceImageData ||
-        typeId == ResourceNativeImage ||
-        typeId == ResourceTargetImage ||
-        typeId == ResourceAppBitmap )
+    if(typeId == ResourceBitmap ||
+       typeId == ResourceNativeImage ||
+       typeId == ResourceTargetImage )
     {
        // remove the meta data
       mImpl->mBitmapMetadata.erase( deadId );
@@ -737,67 +742,61 @@ LoadStatus ResourceManager::GetAtlasLoadStatus( ResourceId atlasId )
  ************************* ResourceCache Implementation  ************************
  ********************************************************************************/
 
-void ResourceManager::ResourceManagerImpl::UploadImageData( const ResourceId id, Bitmap& bitmap )
-{
-  // Either update an existing texture for a reloaded image or allocate a fresh
-  // texture for a newly loaded image:
-  BitmapMetadataIter iter = mBitmapMetadata.find( id );
-  if (iter != mBitmapMetadata.end())
-  {
-    iter->second.Update( &bitmap );
-    mTextureCacheDispatcher.DispatchUpdateTexture( id, &bitmap );
-  }
-  else
-  {
-    mTextureCacheDispatcher.DispatchCreateTextureForBitmap( id, &bitmap );
-    mBitmapMetadata.insert( BitmapMetadataPair( id, BitmapMetadata::New(&bitmap) ) );
-  }
-}
-
 void ResourceManager::LoadResponse( ResourceId id, ResourceTypeId type, ResourcePointer resource, LoadStatus loadStatus )
 {
   DALI_ASSERT_DEBUG( mImpl->mResourceClient != NULL );
   DALI_LOG_INFO(Debug::Filter::gResource, Debug::General, "ResourceManager: LoadResponse(id:%u, status=%s)\n", id, loadStatus==RESOURCE_LOADING?"LOADING":loadStatus==RESOURCE_PARTIALLY_LOADED?"PARTIAL":"COMPLETE");
 
   // ID might be in the loading set
-  LiveRequestIter iter = mImpl->loadingRequests.find( id );
+  LiveRequestIter iter = mImpl->loadingRequests.find(id);
 
   if ( iter != mImpl->loadingRequests.end() )
   {
     if( loadStatus == RESOURCE_COMPLETELY_LOADED )
     {
       // Remove from the loading set
-      mImpl->loadingRequests.erase( iter );
+      mImpl->loadingRequests.erase(iter);
 
       // Add the ID to the new-completed set, and store the resource
-      mImpl->newCompleteRequests.insert( id );
+      mImpl->newCompleteRequests.insert(id);
     }
 
     switch ( type )
     {
-      case ResourceImageData:
+      case ResourceBitmap:
       {
         DALI_ASSERT_DEBUG( loadStatus == RESOURCE_COMPLETELY_LOADED && "Partial results not handled for image loading.\n" );
-        DALI_ASSERT_DEBUG( 0 != dynamic_cast<ImageData*>( resource.Get() ) );
-
-        ImageData* const imageData = static_cast<ImageData*>( resource.Get() );
-        if( !imageData )
+        Bitmap* const bitmap = static_cast<Bitmap*>( resource.Get() );
+        if( !bitmap )
         {
-          DALI_LOG_ERROR( "Missing imageData in loaded resource with id %u.\n", id );
+          DALI_LOG_ERROR( "Missing bitmap in loaded resource with id %u.\n", id );
           break;
         }
-        unsigned int bitmapWidth  = imageData->imageWidth;
-        unsigned int bitmapHeight = imageData->imageHeight;
+        unsigned int bitmapWidth  = bitmap->GetImageWidth();
+        unsigned int bitmapHeight = bitmap->GetImageHeight();
 
-        Pixel::Format pixelFormat = imageData->pixelFormat;
+        if( Bitmap::PackedPixelsProfile * packedBitmap = bitmap->GetPackedPixelsProfile() )
+        {
+          bitmapWidth  = packedBitmap->GetBufferWidth();
+          bitmapHeight = packedBitmap->GetBufferHeight();
+        }
+        Pixel::Format pixelFormat = bitmap->GetPixelFormat();
 
-        ImageAttributes attrs = ImageAttributes::New( bitmapWidth, bitmapHeight, pixelFormat );
+        ImageAttributes attrs = ImageAttributes::New( bitmapWidth, bitmapHeight, pixelFormat ); ///!< Issue #AHC01
         UpdateImageTicket (id, attrs);
 
-        // Pass the loaded data on towards a GLES texture:
-        BitmapPtr bitmap( ConvertToBitmap( *imageData ) );
-
-        mImpl->UploadImageData( id, *bitmap );
+        // Check for reloaded bitmap
+        BitmapMetadataIter iter = mImpl->mBitmapMetadata.find(id);
+        if (iter != mImpl->mBitmapMetadata.end())
+        {
+          iter->second.Update(bitmap);
+          mImpl->mTextureCacheDispatcher.DispatchUpdateTexture( id, bitmap );
+        }
+        else
+        {
+          mImpl->mTextureCacheDispatcher.DispatchCreateTextureForBitmap( id, bitmap );
+          mImpl->mBitmapMetadata.insert(BitmapMetadataPair(id, BitmapMetadata::New(bitmap)));
+        }
 
         break;
       }
@@ -815,6 +814,11 @@ void ResourceManager::LoadResponse( ResourceId id, ResourceTypeId type, Resource
         break;
       }
 
+      case ResourceTargetImage:
+      {
+        break;
+      }
+
       case ResourceShader:
       {
         mImpl->mShaders.insert(ShaderDataPair(id, static_cast<ShaderData*>(resource.Get())));
@@ -842,15 +846,6 @@ void ResourceManager::LoadResponse( ResourceId id, ResourceTypeId type, Resource
         SendToClient( LoadingGlyphSetSucceededMessage( *mImpl->mResourceClient, id, glyphSet, loadStatus) );
         break;
       }
-
-
-      case ResourceTargetImage:
-      case ResourceTexture:
-      case ResourceAppBitmap:
-      {
-        DALI_ASSERT_DEBUG( 0 == "These resource types are never loaded." );
-        break;
-      }
     }
 
     // Let ResourceClient know that the resource manager has loaded something that its clients might want to hear about:
@@ -861,7 +856,6 @@ void ResourceManager::LoadResponse( ResourceId id, ResourceTypeId type, Resource
   }
   else
   {
-    ///@ToDo: This line outputs lots of noise in the TCT unit tests because they fake loading. Fix loading in the mock platform that they use.
     DALI_LOG_ERROR("ResourceManager::LoadResponse() received a stray load notification for a resource whose loading is not being tracked: (id:%u, status=%s)\n", id, loadStatus==RESOURCE_LOADING?"LOADING":loadStatus==RESOURCE_PARTIALLY_LOADED?"PARTIAL":"COMPLETE");
   }
 }
@@ -980,15 +974,15 @@ void ResourceManager::UploadGlyphsToTexture( const GlyphSet& glyphSet )
     const GlyphSet::Character& character( charList[i] );
 
     // grab a pointer to the bitmap
-    ImageData* imageData( character.first.Get() );
+    Bitmap* bitmap( character.first.Get() );
 
-    // create a ImageData upload object, then add it to the array
-    BitmapUpload upload( imageData->ReleaseImageBuffer(),  // Inform the ImageData we're taking ownership of it's pixel buffer.
-                         character.second.xPosition,         // x position in the texture to which upload the ImageData
-                         character.second.yPosition,         // y position in the texture to which upload the ImageData
-                         imageData->imageWidth,              // ImageData width
-                         imageData->imageHeight,             // ImageData height
-                         BitmapUpload::DISCARD_PIXEL_DATA ); // Tell the the texture to delete the ImageData pixel buffer when it's done
+    // create a bitmap upload object, then add it to the array
+    BitmapUpload upload( bitmap->ReleaseBuffer(),               // Inform the bitmap we're taking ownership of it's pixel buffer.
+                         character.second.xPosition,            // x position in the texture to which upload the bitmap
+                         character.second.yPosition,            // y position in the texture to which upload the bitmap
+                         bitmap->GetImageWidth(),              // bitmap width
+                         bitmap->GetImageHeight(),             // bitmap height
+                         BitmapUpload::DISCARD_PIXEL_DATA );    // tell the the texture to delete the bitmap pixel buffer when it's done
 
     uploadArray.push_back( upload );
   }
@@ -1057,19 +1051,14 @@ void ResourceManager::DiscardDeadResources( BufferIndex updateBufferIndex )
      */
     switch (iter->second)
     {
-      case ResourceImageData:
+      case ResourceBitmap:
       case ResourceNativeImage:
       case ResourceTargetImage:
-      case ResourceText:
-      case ResourceTexture:
-      case ResourceAppBitmap:
-      {
         break;
-      }
 
       case ResourceModel:
       {
-        ModelCacheIter model = mImpl->mModels.find( iter->first );
+        ModelCacheIter model = mImpl->mModels.find(iter->first);
         DALI_ASSERT_DEBUG( mImpl->mModels.end() != model );
 
         mImpl->mDiscardQueue.Add( updateBufferIndex, *(model->second) );
@@ -1087,9 +1076,14 @@ void ResourceManager::DiscardDeadResources( BufferIndex updateBufferIndex )
       }
       break;
 
+      case ResourceText:
+      {
+        break;
+      }
+
       case ResourceShader:
       {
-        ShaderCacheIter shaderIter = mImpl->mShaders.find( iter->first );
+        ShaderCacheIter shaderIter = mImpl->mShaders.find(iter->first);
         DALI_ASSERT_DEBUG( mImpl->mShaders.end() != shaderIter );
 
         mImpl->mDiscardQueue.Add( updateBufferIndex, *(shaderIter->second) );
@@ -1098,10 +1092,10 @@ void ResourceManager::DiscardDeadResources( BufferIndex updateBufferIndex )
       }
     }
 
-    mImpl->atlasStatus.Remove( iter->first );
+    mImpl->atlasStatus.Remove(iter->first);
 
     // Erase the item and increment the iterator
-    mImpl->deadRequests.erase( iter++ );
+    mImpl->deadRequests.erase(iter++);
   }
 }
 
index 6710e96..a11d6c9 100644 (file)
@@ -138,7 +138,7 @@ public: // Used by ResourceClient
 
   /**
    * Called to update the resource cache before rendering.
-   * New resources will be added to the cache using PlatformAbstraction::GetResources().
+   * New resources will be added to the cache using PlatformAbstraction::FillResourceCache().
    * Unwanted resources will be added to the DiscardQueue.
    * @param[in] updateBufferIndex The current update buffer index.
    * @return true, if a resource load was completed or failed
index f3cae08..f4f750d 100644 (file)
@@ -87,10 +87,10 @@ GlyphImage GlyphImage::New( const Character& character, const TextStyle& style )
 
     Integration::PlatformAbstraction& platform = Internal::ThreadLocalStorage::Get().GetPlatformAbstraction();
 
-    Integration::BitmapPtr bitmapPtr = ConvertToBitmap( *(platform.GetGlyphImage( font.GetName(),
+    Integration::BitmapPtr bitmapPtr = platform.GetGlyphImage( font.GetName(),
                                                                font.GetStyle(),
                                                                font.GetPointSize(),
-                                                               character.GetImplementation().GetCharacter() ) ) );
+                                                               character.GetImplementation().GetCharacter() );
 
     if( bitmapPtr )
     {
diff --git a/dali/public-api/images/pixel-extras.h b/dali/public-api/images/pixel-extras.h
deleted file mode 100644 (file)
index 7eff531..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef __DALI_PIXEL_EXTRAS_H__
-#define __DALI_PIXEL_EXTRAS_H__
-
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-// INTERNAL INCLUDES
-#include <dali/public-api/images/pixel.h>
-
-namespace Dali DALI_IMPORT_API
-{
-
-/**
- * Pixel format extra types, their properties, and utilities for working with
- * pixel types.
- */
-namespace Pixel
-{
-
-/**
- * For asserting that a pixel format is suitable for an addressable bitmap array
- * of pixels and not a signifier of an opaque one such as the compressed formats.
- **/
-const Format LAST_ADDRESSABLE_PIXEL_FORMAT = BGRA8888;
-
-/**
- * Whether specified pixel format is of an opaque encoded type such as a
- * GL compressed texture.
- * @param [in] pixelformat pixel format
- * @return true if format is encoded, false otherwise.
- */
-bool IsEncoded( const Format pixelformat );
-
-} //namespace Pixel
-
-} // namespace Dali
-
-/**
- * @}
- */
-#endif // __DALI_PIXEL_EXTRAS_H__
index 80121c5..7500a37 100644 (file)
@@ -16,9 +16,9 @@
 
 // CLASS HEADER
 #include <dali/public-api/images/pixel.h>
-#include <dali/public-api/images/pixel-extras.h>
 
 // INTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
 #include <dali/integration-api/debug.h>
 
 namespace Dali
@@ -121,50 +121,6 @@ unsigned int Pixel::GetBytesPerPixel(Format pixelFormat)
   return 0;
 }
 
-bool Pixel::IsEncoded( const Format pixelFormat )
-{
-  switch (pixelFormat)
-  {
-    // All "normal" formats of addressable packed pixels are not encoded:
-    case L8:
-    case A8:
-    case LA88:
-    case RGB565:
-    case RGBA4444:
-    case RGBA5551:
-    case BGR565:
-    case BGRA4444:
-    case BGRA5551:
-    case RGB888:
-    case RGB8888:
-    case BGR8888:
-    case RGBA8888:
-    case BGRA8888:
-    {
-      return false;
-    }
-
-    // All compressed texture formats are encoded:
-    case COMPRESSED_R11_EAC:
-    case COMPRESSED_SIGNED_R11_EAC:
-    case COMPRESSED_RG11_EAC:
-    case COMPRESSED_SIGNED_RG11_EAC:
-    case COMPRESSED_RGB8_ETC2:
-    case COMPRESSED_SRGB8_ETC2:
-    case COMPRESSED_RGB8_ETC1:
-    case COMPRESSED_RGB_PVRTC_4BPPV1:
-    case COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
-    case COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
-    case COMPRESSED_RGBA8_ETC2_EAC:
-    case COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
-    {
-      // Fall through to default return value:
-      break;
-    }
-  }
-  return true;
-}
-
 void Pixel::GetAlphaOffsetAndMask(Format pixelFormat, int& byteOffset, int& bitMask)
 {
   switch (pixelFormat)