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++)
{
{
// 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 );
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;
}
// 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;
}
// 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();
{
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
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);
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
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
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
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
{
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();
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
#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>
{
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
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();
// 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()) );
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();
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();
// 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 ) );
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();
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));
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();
// 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));
// 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
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;
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 );
}
// 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;
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);
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", "");
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
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;
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);
}
}
// 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;
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);
}
}
}
-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", "");
*/
virtual Integration::GlyphSet* GetGlyphData ( const Integration::TextResourceType& textRequest,
const std::string& fontFamily,
- bool getImageData) const;
+ bool getBitmap) const;
/**
* @copydoc PlatformAbstraction::GetCachedGlyphData()
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
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
// 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)
{
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);
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)
{
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);
}
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);
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);
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);
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);
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
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
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
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
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
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
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
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
#include <stdlib.h>
#include <dali/dali.h>
#include <dali-test-suite-utils.h>
-#include <dali/integration-api/image-data.h>
using namespace Dali;
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 );
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);
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);
}
// 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) );
// 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" );
// 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;
}
#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
{
* 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.*/
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),
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;
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
};
/**
- * @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.
**/
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. */
/**@{*/
}
/**
- * @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
*
* 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
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
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)
// 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
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;
/**
* 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
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." );
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.
* 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.
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
};
/**
- * @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.
namespace Integration
{
+class Bitmap;
class DynamicsFactory;
/**
* 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
* 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
/**
* 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.
* @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.
*
* @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
// 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
{
ResourceType(ResourceTypeId typeId)
: id(typeId) {}
+ /**
+ * Destructor.
+ */
virtual ~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);
};
/**
struct DALI_IMPORT_API NativeImageResourceType : public ResourceType
{
/**
- * Default constructor initialises the base class with the correct ResourceTypeId.
+ * Constructor.
*/
NativeImageResourceType()
: ResourceType(ResourceNativeImage) {}
: ResourceType(ResourceNativeImage),
imageAttributes(attribs) {}
+ /**
+ * Destructor.
+ */
+ virtual ~NativeImageResourceType() {}
+
/**
* @copydoc ResourceType::Clone
*/
* Attributes are copied from the request (if supplied).
*/
ImageAttributes imageAttributes;
+
+private:
+
+ // Undefined copy constructor.
+ NativeImageResourceType(const NativeImageResourceType& typePath);
+
+ // Undefined assignment operator.
+ NativeImageResourceType& operator=(const NativeImageResourceType& rhs);
};
/**
struct DALI_IMPORT_API RenderTargetResourceType : public ResourceType
{
/**
- * Default constructor initialises the base class with the correct ResourceTypeId.
+ * Constructor.
*/
RenderTargetResourceType()
: ResourceType(ResourceTargetImage) {}
imageAttributes(attribs) {}
/**
+ * Destructor.
+ */
+ virtual ~RenderTargetResourceType() {}
+
+ /**
* @copydoc ResourceType::Clone
*/
virtual ResourceType* Clone() const
* Attributes are copied from the request.
*/
ImageAttributes imageAttributes;
+
+private:
+
+ // Undefined copy constructor.
+ RenderTargetResourceType(const RenderTargetResourceType& typePath);
+
+ // Undefined assignment operator.
+ RenderTargetResourceType& operator=(const RenderTargetResourceType& rhs);
};
/**
*/
struct DALI_IMPORT_API ShaderResourceType : public ResourceType
{
+ /**
+ * Constructor.
+ */
ShaderResourceType(size_t shaderHash, const std::string& vertexSource, const std::string& fragmentSource)
: ResourceType(ResourceShader),
hash(shaderHash),
}
/**
+ * Destructor.
+ */
+ virtual ~ShaderResourceType()
+ {
+ }
+
+ /**
* @copydoc ResourceType::Clone
*/
virtual ResourceType* Clone() const
size_t hash; ///< Hash of the vertex/fragment sources
const std::string vertexShader; ///< source code for vertex program
const std::string fragmentShader; ///< source code for fragment program
+
+private:
+
+ // Undefined copy constructor.
+ ShaderResourceType(const ShaderResourceType& typePath);
+
+ // Undefined assignment operator.
+ ShaderResourceType& operator=(const ShaderResourceType& rhs);
};
/**
* on the 32 bit words that follow so rather than using the minimum number of
* bits for each, we give "loaded" a whole 8 bits and push it to a byte-aligned
* address to make access possible via a plain byte load instead of a load,
- * mask, shift sequence. The naive bitwidths before this modification are as follows:<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)
}
/**
+ * virtual destructor
+ */
+ virtual ~TextResourceType()
+ {
+ }
+
+ /**
* @copydoc ResourceType::Clone
*/
virtual ResourceType* Clone() const
Vector2 mMaxGlyphSize; ///< Max glyph size for font
GlyphCacheMode mCache; ///< Whether text glyphs should be cached.
+
+private:
+
+ // Undefined copy constructor.
+ TextResourceType(const TextResourceType& typePath);
+
+ // Undefined copy constructor.
+ TextResourceType& operator=(const TextResourceType& rhs);
};
/**
struct DALI_IMPORT_API ModelResourceType : public ResourceType
{
/**
- * Default constructor initialises the base class with the correct ResourceTypeId.
+ * Constructor.
*/
ModelResourceType()
: ResourceType(ResourceModel)
}
/**
+ * Destructor.
+ */
+ virtual ~ModelResourceType()
+ {
+ }
+
+ /**
* @copydoc ResourceType::Clone
*/
virtual ResourceType* Clone() const
{
return new ModelResourceType();
}
+
+private:
+
+ // Undefined copy constructor.
+ ModelResourceType(const ModelResourceType& typePath);
+
+ // Undefined assignment operator.
+ ModelResourceType& operator=(const ModelResourceType& rhs);
};
struct DALI_IMPORT_API MeshResourceType : public ResourceType
{
/**
- * 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)
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:
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 );
}
// 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;
}
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 );
}
else
{
- // If not, return a different ticket
+ // if not, return a different ticket
ticket = IssueLoadRequest( request->url, request->attributes );
request->resourceId = ticket->GetId();
}
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;
}
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 );
attributes.SetSize( size.width, size.height );
}
- ImageResourceType resourceType( ResourceImageData, attributes );
+ BitmapResourceType resourceType( attributes );
ResourceTicketPtr ticket = mResourceClient.RequestResource( resourceType, filename );
return ticket;
}
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)
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;
}
case ResourceShader:
case ResourceMesh:
case ResourceText:
- case ResourceAppBitmap:
{
newTicket = new ResourceTicket(*this, newId, typePath);
break;
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;
}
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.
// 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;
}
case ResourceShader:
case ResourceMesh:
case ResourceText:
- case ResourceTexture:
- case ResourceAppBitmap:
{
DALI_LOG_ERROR( "Unsupported resource type passed for decoding from a memory buffer." );
}
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();
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);
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
* 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.
/**
* 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
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;
// 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 );
}
}
}
- void UploadImageData( const ResourceId id, Bitmap& bitmap );
-
PlatformAbstraction& mPlatformAbstraction;
NotificationManager& mNotificationManager;
ResourceClient* mResourceClient; // (needs to be a ptr - it's not instantiated yet)
switch( typePath.type->id )
{
+ case ResourceBitmap:
+ {
+ break;
+ }
+ case ResourceNativeImage:
+ {
+ break;
+ }
+ case ResourceTargetImage:
+ {
+ break;
+ }
case ResourceShader:
{
resource = GetShaderData(id);
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;
}
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 );
************************* 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;
}
break;
}
+ case ResourceTargetImage:
+ {
+ break;
+ }
+
case ResourceShader:
{
mImpl->mShaders.insert(ShaderDataPair(id, static_cast<ShaderData*>(resource.Get())));
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:
}
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");
}
}
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 );
}
*/
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) );
}
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) );
}
}
- 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++);
}
}
/**
* 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
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 )
{
+++ /dev/null
-#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__
// 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
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)