/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
: ControlRenderer( factoryCache ),
mGradientType( LINEAR )
{
+ mImpl->mFlags |= Impl::IS_PREMULTIPLIED_ALPHA;
}
GradientRenderer::~GradientRenderer()
for( unsigned int i=0; i<stops.Count(); i++ )
{
offsets.PushBack( stops[i].mOffset );
- colors.PushBack( stops[i].mStopColor );
+ if( EqualsZero(stops[i].mStopColor.a) )
+ {
+ colors.PushBack( Vector4::ZERO );
+ }
+ else
+ {
+ colors.PushBack( Vector4( stops[i].mStopColor.r / stops[i].mStopColor.a,
+ stops[i].mStopColor.g / stops[i].mStopColor.a,
+ stops[i].mStopColor.b / stops[i].mStopColor.a,
+ stops[i].mStopColor.a));
+ }
}
map.Insert( STOP_OFFSET_NAME, offsets );
Geometry geometry = mFactoryCache.GetGeometry( RendererFactoryCache::QUAD_GEOMETRY );
if( !geometry )
{
- geometry = RendererFactoryCache::CreateQuadGeometry();
+ geometry = Geometry::QUAD();
mFactoryCache.SaveGeometry( RendererFactoryCache::QUAD_GEOMETRY, geometry );
}
//Set up the texture set
TextureSet textureSet = TextureSet::New();
- Dali::BufferImage lookupTexture = mGradient->GenerateLookupTexture();
- textureSet.SetImage( 0u, lookupTexture );
+ Dali::Texture lookupTexture = mGradient->GenerateLookupTexture();
+ textureSet.SetTexture( 0u, lookupTexture );
Dali::WrapMode::Type wrap = GetWrapMode( mGradient->GetSpreadMethod() );
Sampler sampler = Sampler::New();
sampler.SetWrapMode( wrap, wrap );
{
if( (colorArray->GetElementAt(i)).Get(color) )
{
- mGradient->AddStop( offsetArray[i], color);
+ mGradient->AddStop( offsetArray[i], Vector4(color.r*color.a, color.g*color.a, color.b*color.a, color.a));
numValidStop++;
}
}
case Property::ARRAY:
{
Property::Array* offsetArray = value->GetArray();
- unsigned int numStop = offsetArray->Count();
- float offset;
- for( unsigned int i=0; i<numStop; i++ )
+ if( offsetArray )
{
- if( offsetArray->GetElementAt(i).Get(offset) )
+ unsigned int numStop = offsetArray->Count();
+ float offset;
+ for( unsigned int i=0; i<numStop; i++ )
{
- stopOffsets.PushBack( offset );
+ if( offsetArray->GetElementAt(i).Get(offset) )
+ {
+ stopOffsets.PushBack( offset );
+ }
}
}
break;