- // got to the end so no match, decode N patch and append new item to cache
- if( border == Rect< int >( 0, 0, 0, 0 ) )
- {
- NinePatchImage ninePatch = NinePatchImage::New( url );
- if( ninePatch )
- {
- BufferImage croppedImage = ninePatch.CreateCroppedBufferImage();
- if( croppedImage )
- {
- Data* data = new Data();
- data->hash = hash;
- data->url = url;
- data->textureSet = TextureSet::New();
- TextureSetImage( data->textureSet, 0u, croppedImage );
- data->croppedWidth = croppedImage.GetWidth();
- 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