textureTrace.Reset();
- ResourceImage image = ResourceImage::New( TEST_9_PATCH_FILE_NAME );
- Visual::Base nPatchVisual = factory.CreateVisual( image );
-
- DummyControl actor1 = DummyControl::New(true);
- TestVisualRender( application, actor1, nPatchVisual );
-
- DALI_TEST_EQUALS( textureTrace.CountMethod("BindTexture"), 0, TEST_LOCATION ); // The same texture should be used with the first visual.
-
- naturalSize = Vector2( 0.0f, 0.0f );
- nPatchVisual.GetNaturalSize( naturalSize );
- DALI_TEST_EQUALS( naturalSize, Vector2( imageSize.GetWidth() - 2.0f, imageSize.GetHeight() - 2.0f ), TEST_LOCATION );
-
END_TEST;
}
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <string.h>
#include <cfloat>
#include <dali/public-api/animation/animation.h>
-#include <dali/devel-api/images/nine-patch-image.h>
#include <dali/public-api/images/resource-image.h>
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/math/vector4.h>
return nPatchVisual;
}
-NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache, NinePatchImage image )
-{
- NPatchVisualPtr nPatchVisual( new NPatchVisual( factoryCache ) );
- VisualUrl visualUrl( image.GetUrl() );
- nPatchVisual->mImageUrl = visualUrl;
- return nPatchVisual;
-}
-
void NPatchVisual::LoadImages()
{
TextureManager& textureManager = mFactoryCache.GetTextureManager();
#include <dali/public-api/common/intrusive-ptr.h>
#include <dali/public-api/images/image.h>
#include <dali/public-api/images/image-operations.h>
-#include <dali/devel-api/images/nine-patch-image.h>
#include <dali/public-api/rendering/geometry.h>
#include <dali/public-api/rendering/sampler.h>
#include <dali/public-api/rendering/shader.h>
*/
static NPatchVisualPtr New( VisualFactoryCache& factoryCache, const VisualUrl& imageUrl );
- /**
- * @brief Create an N-patch visual with a NinePatchImage resource.
- *
- * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
- * @param[in] image The NinePatchImage to use
- */
- static NPatchVisualPtr New( VisualFactoryCache& factoryCache, NinePatchImage image );
-
public: // from Visual
/**
if( image )
{
- NinePatchImage npatchImage = NinePatchImage::DownCast( image );
- if( npatchImage )
- {
- visualPtr = NPatchVisual::New( GetFactoryCache(), npatchImage );
- }
- else
- {
- visualPtr = ImageVisual::New(GetFactoryCache(), GetImageVisualShaderFactory(), image );
- }
+ visualPtr = ImageVisual::New(GetFactoryCache(), GetImageVisualShaderFactory(), image );
}
if( mDebugEnabled )