vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n
mediump vec2 scale = vec2( length( uModelMatrix[ 0 ].xyz ), length( uModelMatrix[ 1 ].xyz ) );\n
- mediump vec2 size = visualSize.xy * scale;\n
+ mediump vec2 size = visualSize.xy;\n
\n
mediump vec2 fixedFactor = vec2( uFixed[ int( ( aPosition.x + 1.0 ) * 0.5 ) ].x, uFixed[ int( ( aPosition.y + 1.0 ) * 0.5 ) ].y );\n
mediump vec2 stretch = floor( aPosition * 0.5 );\n
\n
mediump vec4 vertexPosition = vec4( fixedFactor + ( size - fixedTotal ) * stretch, 0.0, 1.0 );
vertexPosition.xy -= size * vec2( 0.5, 0.5 );\n
- vertexPosition.xy = vertexPosition.xy / scale + anchorPoint*size + (visualOffset + origin)*uSize.xy;\
+ vertexPosition.xy = vertexPosition.xy + anchorPoint*size + (visualOffset + origin)*uSize.xy;\
\n
vertexPosition = uMvpMatrix * vertexPosition;\n
\n
varying mediump vec2 vTexCoord;\n
uniform sampler2D sTexture;\n
uniform lowp vec4 uColor;\n
- \n
+ uniform lowp vec4 mixColor;\n
+ uniform lowp float preMultipliedAlpha;\n
+ lowp vec4 visualMixColor()\n
+ {\n
+ return vec4( mixColor.rgb * mix( 1.0, mixColor.a, preMultipliedAlpha ), mixColor.a );\n
+ }\n
void main()\n
{\n
- gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n
+ gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor * visualMixColor();\n
}\n
);
/////////////////NPatchVisual////////////////
+NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache, const std::string& imageUrl, const Property::Map& properties )
+{
+ NPatchVisualPtr nPatchVisual( new NPatchVisual( factoryCache ) );
+ nPatchVisual->mImageUrl = imageUrl;
+ nPatchVisual->SetProperties( properties );
+
+ return nPatchVisual;
+}
+
NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache, const std::string& imageUrl )
{
- NPatchVisual* nPatchVisual = new NPatchVisual( factoryCache );
+ NPatchVisualPtr nPatchVisual( new NPatchVisual( factoryCache ) );
nPatchVisual->mImageUrl = imageUrl;
return nPatchVisual;
NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache, NinePatchImage image )
{
- NPatchVisual* nPatchVisual = new NPatchVisual( factoryCache );
+ NPatchVisualPtr nPatchVisual( new NPatchVisual( factoryCache ) );
nPatchVisual->mImageUrl = image.GetUrl();
return nPatchVisual;