DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
}
+ propertyMap.Clear();
+ propertyMap.Insert( Visual::Property::TYPE, DevelVisual::N_PATCH );
+ propertyMap.Insert( ImageVisual::Property::URL, gImage_34_RGBA );
+ propertyMap.Insert( DevelImageVisual::Property::BORDER, Rect< int >( 1, 1, 1, 1 ) );
+ {
+ tet_infoline( "whole grid" );
+ Visual::Base visual = factory.CreateVisual( propertyMap );
+ DALI_TEST_CHECK( visual );
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
+ DummyControl actor = DummyControl::New();
+ TestVisualRender( application, actor, visual, 1u );
+
+ DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
+ }
+
END_TEST;
}
std::size_t hash = CalculateHash( url );
OwnerContainer< Data* >::SizeType index = UNINITIALIZED_ID;
const OwnerContainer< Data* >::SizeType count = mCache.Count();
+ int cachedIndex = -1;
+
for( ; index < count; ++index )
{
if( mCache[ index ]->hash == hash )
// hash match, check url as well in case of hash collision
if( mCache[ index ]->url == url )
{
- return index+1u; // valid indices are from 1 onwards
+ // Use cached data
+ if( mCache[ index ]->border == border )
+ {
+ return index+1u; // valid indices are from 1 onwards
+ }
+ else
+ {
+ cachedIndex = index;
+ }
}
}
}
+
+ if( cachedIndex != -1 )
+ {
+ // Same url but border is different - use the existing texture
+ Data* data = new Data();
+ data->hash = hash;
+ data->url = url;
+ data->croppedWidth = mCache[ cachedIndex ]->croppedWidth;
+ data->croppedHeight = mCache[ cachedIndex ]->croppedHeight;
+
+ data->textureSet = mCache[ cachedIndex ]->textureSet;
+
+ NinePatchImage::StretchRanges stretchRangesX;
+ stretchRangesX.PushBack( Uint16Pair( border.left, data->croppedWidth - border.right ) );
+
+ NinePatchImage::StretchRanges stretchRangesY;
+ stretchRangesY.PushBack( Uint16Pair( border.top, data->croppedHeight - border.bottom ) );
+
+ data->stretchPixelsX = stretchRangesX;
+ data->stretchPixelsY = stretchRangesY;
+ data->border = border;
+
+ mCache.PushBack( data );
+
+ return mCache.Count(); // valid ids start from 1u
+ }
+
// got to the end so no match, decode N patch and append new item to cache
if( border == Rect< int >( 0, 0, 0, 0 ) )
{
data->croppedHeight = croppedImage.GetHeight();
data->stretchPixelsX = ninePatch.GetStretchPixelsX();
data->stretchPixelsY = ninePatch.GetStretchPixelsY();
+ data->border = Rect< int >( 0, 0, 0, 0 );
mCache.PushBack( data );
return mCache.Count(); // valid ids start from 1u
data->stretchPixelsX = stretchRangesX;
data->stretchPixelsY = stretchRangesY;
+ data->border = border;
mCache.PushBack( data );