DALI_IMAGE_DIR "gallery-medium-53.jpg",
};
+const char* NINEPATCH_IMAGE_PATH[] = {
+ DALI_IMAGE_DIR "selection-popup-bg.1.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.2.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.3.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.4.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.5.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.6.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.7.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.8.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.9.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.10.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.11.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.12.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.13.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.14.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.15.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.16.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.17.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.18.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.19.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.20.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.21.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.22.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.23.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.24.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.25.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.26.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.27.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.28.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.29.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.30.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.31.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.32.9.png",
+ DALI_IMAGE_DIR "selection-popup-bg.33.9.png",
+ DALI_IMAGE_DIR "button-disabled.9.png",
+ DALI_IMAGE_DIR "button-down.9.png",
+ DALI_IMAGE_DIR "button-down-disabled.9.png",
+ DALI_IMAGE_DIR "button-up-1.9.png",
+ DALI_IMAGE_DIR "button-up-2.9.png",
+ DALI_IMAGE_DIR "button-up-3.9.png",
+ DALI_IMAGE_DIR "button-up-4.9.png",
+ DALI_IMAGE_DIR "button-up-5.9.png",
+ DALI_IMAGE_DIR "button-up-6.9.png",
+ DALI_IMAGE_DIR "button-up-7.9.png",
+ DALI_IMAGE_DIR "button-up-8.9.png",
+ DALI_IMAGE_DIR "button-up-9.9.png",
+ DALI_IMAGE_DIR "button-up-10.9.png",
+ DALI_IMAGE_DIR "button-up-11.9.png",
+ DALI_IMAGE_DIR "button-up-12.9.png",
+ DALI_IMAGE_DIR "button-up-13.9.png",
+ DALI_IMAGE_DIR "button-up-14.9.png",
+ DALI_IMAGE_DIR "button-up-15.9.png",
+ DALI_IMAGE_DIR "button-up-16.9.png",
+ DALI_IMAGE_DIR "button-up-17.9.png",
+};
+
const unsigned int NUM_IMAGES = sizeof(IMAGE_PATH) / sizeof(char*);
+const unsigned int NUM_NINEPATCH_IMAGES = sizeof(NINEPATCH_IMAGE_PATH) / sizeof(char*);
const float ANIMATION_TIME ( 5.0f ); // animation length in seconds
return mesh;
}
+bool gUseMesh(false);
+bool gUseImageView(false);
+bool gNinePatch(false);
+unsigned int gRowsPerPage(25);
+unsigned int gColumnsPerPage( 25 );
+unsigned int gPageCount(13);
+
Renderer CreateRenderer( unsigned int index )
{
- static Renderer renderers[NUM_IMAGES];
+
+ int numImages = !gNinePatch ? NUM_IMAGES : NUM_NINEPATCH_IMAGES;
+ static Renderer* renderers = new Renderer[numImages];
if( !renderers[index] )
{
//Create the renderer
Shader shader = Shader::New( VERTEX_SHADER_TEXTURE, FRAGMENT_SHADER_TEXTURE );
- Image image = ResourceImage::New(IMAGE_PATH[index]);
+
+ const char* imagePath = !gNinePatch ? IMAGE_PATH[index] : NINEPATCH_IMAGE_PATH[index];
+ Image image = ResourceImage::New(imagePath);
Sampler textureSampler = Sampler::New( image, "sTexture" );
Material material = Material::New( shader );
material.AddSampler(textureSampler);
return meshActor;
}
-bool gUseMesh(false);
-bool gUseImageView(false);
-unsigned int gRowsPerPage(25);
-unsigned int gColumnsPerPage( 25 );
-unsigned int gPageCount(13);
-
-
}
// Test application to compare performance between ImageActor and ImageView
// By default, the application consist of 10 pages of 25x25 ImageActors, this can be modified using the following command line arguments:
// -p NumberOfPages (Modifies the nimber of pages )
// --use-imageview ( Use ImageView instead of ImageActor )
// --use-mesh ( Use new renderer API (as ImageView) but shares renderers between actors when possible )
+// --use-nine-patch ( Use nine patch images )
//
class Benchmark : public ConnectionTracker
return true;
}
+ const char* ImagePath( int i )
+ {
+ return !gNinePatch ? IMAGE_PATH[i % NUM_IMAGES] : NINEPATCH_IMAGE_PATH[i % NUM_NINEPATCH_IMAGES];
+ }
+
void CreateImageActors()
{
Stage stage = Stage::GetCurrent();
for( size_t i(0); i<actorCount; ++i )
{
- Image image = ResourceImage::New(IMAGE_PATH[i % NUM_IMAGES]);
+ Image image = ResourceImage::New(ImagePath(i));
mActor[i] = ImageActor::New(image);
mActor[i].SetSize(Vector3(0.0f,0.0f,0.0f));
mActor[i].SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
for( size_t i(0); i<actorCount; ++i )
{
- Image image = ResourceImage::New(IMAGE_PATH[i % NUM_IMAGES]);
+ Image image = ResourceImage::New(ImagePath(i));
mImageView[i] = ImageView::New(image);
mImageView[i].SetSize(Vector3(0.0f,0.0f,0.0f));
mImageView[i].SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
mActor.resize(actorCount);
for( size_t i(0); i<actorCount; ++i )
{
- mActor[i] = CreateMeshActor(i % NUM_IMAGES);
+ size_t numImages = !gNinePatch ? NUM_IMAGES : NUM_NINEPATCH_IMAGES;
+ mActor[i] = CreateMeshActor(i % numImages);
mActor[i].SetSize(0.0f,0.0f,0.0f);
stage.Add(mActor[i]);
{
gUseImageView = true;
}
+ else if( arg.compare("--nine-patch" ) == 0)
+ {
+ gNinePatch = true;
+ }
else if( arg.compare(0, 2, "-r" ) == 0)
{
gRowsPerPage = atoi( arg.substr( 2, arg.size()).c_str());
{
gPageCount = atoi( arg.substr( 2, arg.size()).c_str());
}
-
-
}
RunTest( application );