X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fshader-effects%2Fnine-patch-mask-effect.cpp;h=0aef67f4ac98ddf23fb598bd10880a02b5e91df0;hb=2d176ad7e81d50e266dced075281b7a2a92f6b45;hp=fc1740b95e36920b550f66874033091db40ac13b;hpb=e2eda444afbe82e9591fe198eef339227f90a616;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/public-api/shader-effects/nine-patch-mask-effect.cpp b/dali-toolkit/public-api/shader-effects/nine-patch-mask-effect.cpp index fc1740b..0aef67f 100644 --- a/dali-toolkit/public-api/shader-effects/nine-patch-mask-effect.cpp +++ b/dali-toolkit/public-api/shader-effects/nine-patch-mask-effect.cpp @@ -1,22 +1,30 @@ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.0 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// +/* + * Copyright (c) 2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ // CLASS HEADER #include +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include + namespace Dali { @@ -38,6 +46,7 @@ struct NinePatchMaskEffectSizeConstraint static void DoApply( ImageActor actor, const std::string& maskImage, const Vector2& maskSize, Vector4 maskBorder ) { const char* ALPHA_MASK_VERTEX_SHADER_SOURCE = + "precision mediump float;\n" "uniform vec2 uImageSize; \n" "uniform vec2 uMaskSize; \n" "varying vec2 vMaskTexCoord; \n" @@ -64,7 +73,7 @@ static void DoApply( ImageActor actor, const std::string& maskImage, const Vecto "} \n"; const char* ALPHA_MASK_FRAGMENT_SHADER_SOURCE = - "varying vec2 vMaskTexCoord; \n" + "varying mediump vec2 vMaskTexCoord; \n" " \n" "void main() \n" "{ \n" @@ -72,16 +81,17 @@ static void DoApply( ImageActor actor, const std::string& maskImage, const Vecto " gl_FragColor = texture2D(sTexture, vTexCoord) * uColor * vec4(1,1,1,mask.a); \n" "} \n"; - ShaderEffect maskEffect = ShaderEffect::New( ALPHA_MASK_VERTEX_SHADER_SOURCE, - ALPHA_MASK_FRAGMENT_SHADER_SOURCE, - GeometryType( GEOMETRY_TYPE_IMAGE ), - ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ) ); + ShaderEffect maskEffect = ShaderEffect::New( + ALPHA_MASK_VERTEX_SHADER_SOURCE, + ALPHA_MASK_FRAGMENT_SHADER_SOURCE, + GeometryType( GEOMETRY_TYPE_IMAGE ), + ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ) ); - maskEffect.SetEffectImage( Image::New( maskImage ) ); + maskEffect.SetEffectImage( ResourceImage::New( maskImage ) ); maskEffect.SetUniform( "uImageSize", Vector2(0,0) /*Constrained to actor size*/ ); maskEffect.ApplyConstraint( Constraint::New( maskEffect.GetPropertyIndex("uImageSize"), - Source(actor, Actor::SIZE), + Source(actor, Actor::Property::SIZE), NinePatchMaskEffectSizeConstraint() ) ); maskEffect.SetUniform( "uMaskSize", maskSize ); @@ -95,7 +105,7 @@ static void DoApply( ImageActor actor, const std::string& maskImage, const Vecto void Apply( ImageActor actor, const std::string& maskImage ) { - Vector2 maskSize = Image::GetImageSize( maskImage ); + Vector2 maskSize = ResourceImage::GetImageSize( maskImage ); const float leftRight = (maskSize.width - 1.0f) * 0.5f; const float topBottom = (maskSize.height - 1.0f) * 0.5f; @@ -105,7 +115,7 @@ void Apply( ImageActor actor, const std::string& maskImage ) void Apply( ImageActor actor, const std::string& maskImage, const Vector4& maskBorder ) { - Vector2 maskSize = Image::GetImageSize( maskImage ); + Vector2 maskSize = ResourceImage::GetImageSize( maskImage ); DoApply( actor, maskImage, maskSize, maskBorder ); }