X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ffilters%2Fspread-filter.cpp;h=d0b54f9b3681b28dfbbdae3fc219a81c0bb727a1;hb=1ef48207a956ca5a78cad6f953074953fbcf9f60;hp=0dab8c67657020c72c11c0c7823faa1c804ae631;hpb=e2eda444afbe82e9591fe198eef339227f90a616;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/filters/spread-filter.cpp b/dali-toolkit/internal/filters/spread-filter.cpp index 0dab8c6..d0b54f9 100644 --- a/dali-toolkit/internal/filters/spread-filter.cpp +++ b/dali-toolkit/internal/filters/spread-filter.cpp @@ -1,24 +1,28 @@ -// -// 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 "spread-filter.h" // EXTERNAL INCLUDES #include +#include +#include +#include // INTERNAL INCLUDES @@ -38,6 +42,7 @@ const float ARBITRARY_FIELD_OF_VIEW = Math::PI / 4.0f; const char* const SPREAD_FRAGMENT_SOURCE = { + "precision highp float;\n" "uniform float uSpread;\n" "uniform vec2 uTexScale;\n" "void main()\n" @@ -91,16 +96,16 @@ void SpreadFilter::Enable() // create actor to render input with applied emboss effect mActorForInput = ImageActor::New( mInputImage ); mActorForInput.SetParentOrigin( ParentOrigin::CENTER ); - mActorForInput.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + mActorForInput.SetSize(mTargetSize); mActorForInput.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // create internal offscreen for result of horizontal pass - mImageForHorz = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Image::Unused ); + mImageForHorz = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Image::UNUSED ); // create an actor to render mImageForHorz for vertical blur pass mActorForHorz = ImageActor::New( mImageForHorz ); mActorForHorz.SetParentOrigin( ParentOrigin::CENTER ); - mActorForHorz.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + mActorForHorz.SetSize(mTargetSize); mActorForHorz.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); mRootActor.Add( mActorForInput ); @@ -178,6 +183,19 @@ void SpreadFilter::Refresh() } } +void SpreadFilter::SetSize( const Vector2& size ) +{ + mTargetSize = size; + if( mActorForInput ) + { + mActorForInput.SetSize(mTargetSize); + } + if( mActorForHorz ) + { + mActorForHorz.SetSize(mTargetSize); + } +} + void SpreadFilter::SetupCamera() { // Create and place a camera for the embossing render, corresponding to its render target size @@ -185,7 +203,6 @@ void SpreadFilter::SetupCamera() mCameraActor.SetNearClippingPlane(1.0f); mCameraActor.SetAspectRatio(mTargetSize.width / mTargetSize.height); mCameraActor.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor - mCameraActor.SetRotation(Quaternion(M_PI, Vector3::YAXIS)); mCameraActor.SetPosition(0.0f, 0.0f, ((mTargetSize.height * 0.5f) / tanf(ARBITRARY_FIELD_OF_VIEW * 0.5f))); }