{
namespace
{
-const int CUSTOM_PROPERTY_COUNT(10); // 5 transform properties + fixed(3),stretch,aux
+const int CUSTOM_PROPERTY_COUNT(5); // fixed(3),stretch,aux
}
/////////////////NPatchVisual////////////////
{
if(mImpl->mRenderer)
{
- mImpl->mTransform.RegisterUniforms(mImpl->mRenderer, Direction::LEFT_TO_RIGHT);
+ mImpl->mTransform.SetUniforms(mImpl->mRenderer, Direction::LEFT_TO_RIGHT);
}
}
mFactoryCache,
ImageVisualShaderFeature::FeatureBuilder());
- mImpl->mRenderer = Renderer::New(geometry, shader);
+ mImpl->mRenderer = VisualRenderer::New(geometry, shader);
mImpl->mRenderer.ReserveCustomProperties(CUSTOM_PROPERTY_COUNT);
//Register transform properties
- mImpl->mTransform.RegisterUniforms(mImpl->mRenderer, Direction::LEFT_TO_RIGHT);
+ mImpl->mTransform.SetUniforms(mImpl->mRenderer, Direction::LEFT_TO_RIGHT);
}
Geometry NPatchVisual::CreateGeometry()
{
textureSet = data->GetTextures();
NPatchHelper::ApplyTextureAndUniforms(mImpl->mRenderer, data);
+
+ if(mAuxiliaryPixelBuffer)
+ {
+ // If the auxiliary image is smaller than the un-stretched NPatch, use CPU resizing to enlarge it to the
+ // same size as the unstretched NPatch. This will give slightly higher quality results than just relying
+ // on GL interpolation alone.
+ if(mAuxiliaryPixelBuffer.GetWidth() < data->GetCroppedWidth() &&
+ mAuxiliaryPixelBuffer.GetHeight() < data->GetCroppedHeight())
+ {
+ mAuxiliaryPixelBuffer.Resize(data->GetCroppedWidth(), data->GetCroppedHeight());
+ }
+
+ // Note, this resets mAuxiliaryPixelBuffer handle
+ auto auxiliaryPixelData = Devel::PixelBuffer::Convert(mAuxiliaryPixelBuffer);
+
+ auto texture = Texture::New(TextureType::TEXTURE_2D,
+ auxiliaryPixelData.GetPixelFormat(),
+ auxiliaryPixelData.GetWidth(),
+ auxiliaryPixelData.GetHeight());
+ texture.Upload(auxiliaryPixelData);
+ textureSet.SetTexture(1, texture);
+ mImpl->mRenderer.RegisterProperty(DevelImageVisual::Property::AUXILIARY_IMAGE_ALPHA,
+ AUXILIARY_IMAGE_ALPHA_NAME,
+ mAuxiliaryImageAlpha);
+ }
+ mImpl->mRenderer.SetTextures(textureSet);
}
else
{
{
imageSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector2>();
}
- mFactoryCache.UpdateBrokenImageRenderer(mImpl->mRenderer, imageSize);
- Texture croppedImage = mImpl->mRenderer.GetTextures().GetTexture(0);
- textureSet.SetTexture(0u, croppedImage);
- mImpl->mRenderer.RegisterProperty("uFixed[0]", Vector2::ZERO);
- mImpl->mRenderer.RegisterProperty("uFixed[1]", Vector2::ZERO);
- mImpl->mRenderer.RegisterProperty("uFixed[2]", Vector2::ZERO);
- mImpl->mRenderer.RegisterProperty("uStretchTotal", Vector2(croppedImage.GetWidth(), croppedImage.GetHeight()));
- }
-
- if(mAuxiliaryPixelBuffer)
- {
- // If the auxiliary image is smaller than the un-stretched NPatch, use CPU resizing to enlarge it to the
- // same size as the unstretched NPatch. This will give slightly higher quality results than just relying
- // on GL interpolation alone.
- if(mAuxiliaryPixelBuffer.GetWidth() < data->GetCroppedWidth() &&
- mAuxiliaryPixelBuffer.GetHeight() < data->GetCroppedHeight())
- {
- mAuxiliaryPixelBuffer.Resize(data->GetCroppedWidth(), data->GetCroppedHeight());
- }
-
- // Note, this resets mAuxiliaryPixelBuffer handle
- auto auxiliaryPixelData = Devel::PixelBuffer::Convert(mAuxiliaryPixelBuffer);
-
- auto texture = Texture::New(TextureType::TEXTURE_2D,
- auxiliaryPixelData.GetPixelFormat(),
- auxiliaryPixelData.GetWidth(),
- auxiliaryPixelData.GetHeight());
- texture.Upload(auxiliaryPixelData);
- textureSet.SetTexture(1, texture);
- mImpl->mRenderer.RegisterProperty(DevelImageVisual::Property::AUXILIARY_IMAGE_ALPHA,
- AUXILIARY_IMAGE_ALPHA_NAME,
- mAuxiliaryImageAlpha);
+ mFactoryCache.UpdateBrokenImageRenderer(mImpl->mRenderer, imageSize, false);
}
- mImpl->mRenderer.SetTextures(textureSet);
// Register transform properties
- mImpl->mTransform.RegisterUniforms(mImpl->mRenderer, Direction::LEFT_TO_RIGHT);
+ mImpl->mTransform.SetUniforms(mImpl->mRenderer, Direction::LEFT_TO_RIGHT);
}
Geometry NPatchVisual::GetNinePatchGeometry(VisualFactoryCache::GeometryType subType)