From: Chu Hoang Date: Wed, 11 Nov 2015 15:53:00 +0000 (+0000) Subject: Remove NinePatchMaskEffect X-Git-Tag: dali_1.1.11~13 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=ad53b94122312bbc15de0b437cdc1afee47e5834 Remove NinePatchMaskEffect Change-Id: Ib3f5c029ea7f80a559edcbc631db968cd1656bed --- diff --git a/automated-tests/src/dali-toolkit/CMakeLists.txt b/automated-tests/src/dali-toolkit/CMakeLists.txt index d6e2eaa..aaefe8e 100644 --- a/automated-tests/src/dali-toolkit/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit/CMakeLists.txt @@ -40,7 +40,6 @@ SET(TC_SOURCES utc-Dali-ItemView.cpp utc-Dali-KeyboardFocusManager.cpp utc-Dali-Magnifier.cpp - utc-Dali-NinePatchMaskEffect.cpp utc-Dali-Popup.cpp utc-Dali-PushButton.cpp utc-Dali-RadioButton.cpp diff --git a/automated-tests/src/dali-toolkit/utc-Dali-NinePatchMaskEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-NinePatchMaskEffect.cpp deleted file mode 100644 index 7d76ab3..0000000 --- a/automated-tests/src/dali-toolkit/utc-Dali-NinePatchMaskEffect.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - * - */ - -#include -#include - -// Need to override adaptor classes for toolkit test harness, so include -// test harness headers before dali headers. -#include - -#include -#include -#include - -using namespace Dali; - -void utc_dali_toolkit_nine_patch_startup(void) -{ - test_return_value = TET_UNDEF; -} - -void utc_dali_toolkit_nine_patch_cleanup(void) -{ - test_return_value = TET_PASS; -} - - -int UtcDaliNinePatchMaskEffectApply(void) -{ - ToolkitTestApplication application; - - BufferImage image = CreateBufferImage(); - ImageActor actor0 = ImageActor::New( image ); - Toolkit::NinePatchMaskEffect::Apply( actor0, "" ); - - Stage::GetCurrent().Add( actor0 ); - - application.SendNotification(); // Force usage of constraint - application.Render(); - - DALI_TEST_CHECK( actor0.GetStyle() == ImageActor::STYLE_NINE_PATCH ); - - ImageActor actor1 = ImageActor::New( image ); - Vector4 border( 0, 0, 0, 0 ); - Toolkit::NinePatchMaskEffect::Apply( actor1, "", border ); - - Stage::GetCurrent().Add( actor1 ); - - application.SendNotification(); - application.Render(); - - DALI_TEST_CHECK( actor1.GetStyle() == ImageActor::STYLE_NINE_PATCH ); - END_TEST; -} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ShaderEffects.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ShaderEffects.cpp index 96ffb55..1870b9e 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ShaderEffects.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ShaderEffects.cpp @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include diff --git a/dali-toolkit/devel-api/file.list b/dali-toolkit/devel-api/file.list index f234c23..953c478 100755 --- a/dali-toolkit/devel-api/file.list +++ b/dali-toolkit/devel-api/file.list @@ -89,7 +89,6 @@ devel_api_shader_effects_header_files = \ $(devel_api_src_dir)/shader-effects/mirror-effect.h \ $(devel_api_src_dir)/shader-effects/motion-blur-effect.h \ $(devel_api_src_dir)/shader-effects/motion-stretch-effect.h \ - $(devel_api_src_dir)/shader-effects/nine-patch-mask-effect.h \ $(devel_api_src_dir)/shader-effects/overlay-effect.h \ $(devel_api_src_dir)/shader-effects/quadratic-bezier.h \ $(devel_api_src_dir)/shader-effects/ripple-effect.h \ diff --git a/dali-toolkit/devel-api/shader-effects/nine-patch-mask-effect.h b/dali-toolkit/devel-api/shader-effects/nine-patch-mask-effect.h deleted file mode 100644 index 931e5cd..0000000 --- a/dali-toolkit/devel-api/shader-effects/nine-patch-mask-effect.h +++ /dev/null @@ -1,153 +0,0 @@ -#ifndef __DALI_TOOLKIT_NINE_PATCH_MASK_EFFECT_H__ -#define __DALI_TOOLKIT_NINE_PATCH_MASK_EFFECT_H__ - -/* - * Copyright (c) 2015 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. - * - */ - -// EXTERNAL INCLUDES -#include - -namespace Dali -{ - -namespace Toolkit -{ - -/** - * @brief NinePatchMaskEffect is used to control which parts of an image are visible, using the alpha channel of a separate mask image. - * - * The mask image is expected to be smaller than the main image being viewed. - * Conceptually the mask image is divided into a 3x3 grid (9 patches). The middle patch is stretched whilst the outer border is not. - * - * Usage example: - * - * @code - * ImageActor actor = ImageActor::New( Image( EXAMPLE_IMAGE_PATH ) ); - * NinePatchMaskEffect::Apply( actor, MASK_IMAGE_PATH ); - * @endcode - * - * NinePatchMaskEffect is mutually exclusive with ImageActor::STYLE_NINE_PATCH i.e. the actor's main image should not be a nine-patch. - */ -namespace NinePatchMaskEffect -{ - -static void NinePatchMaskEffectSizeConstraint( Vector2& current, const PropertyInputContainer& inputs ) -{ - const Vector3& actorSize = inputs[0]->GetVector3(); - current.x = actorSize.x; - current.y = actorSize.y; -} - -inline 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" - " \n" - "void main() \n" - "{ \n" - " gl_Position = uMvpMatrix * vec4(aPosition, 1.0); \n" - " \n" - " // Ignore mask UVs for image \n" - " \n" - " highp vec2 halfImageSize = uImageSize * 0.5; \n" - " vTexCoord = (aPosition.xy + halfImageSize) / uImageSize; \n" - " \n" - " // UVs were calculated for image size, so convert for mask size \n" - " \n" - " highp vec2 halfMaskSize = uMaskSize * 0.5; \n" - " highp vec2 halfSizeDelta = halfImageSize - halfMaskSize; \n" - " \n" - " highp vec2 maskPosition = aPosition.xy; \n" - " maskPosition.x -= halfSizeDelta.x * sign(aPosition.x); \n" - " maskPosition.y -= halfSizeDelta.y * sign(aPosition.y); \n" - " \n" - " vMaskTexCoord = (maskPosition + halfMaskSize) / uMaskSize; \n" - "} \n"; - - const char* ALPHA_MASK_FRAGMENT_SHADER_SOURCE = - "varying mediump vec2 vMaskTexCoord; \n" - " \n" - "void main() \n" - "{ \n" - " highp vec4 mask = texture2D(sEffect, vMaskTexCoord); \n" - " 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, - ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ) ); - - maskEffect.SetEffectImage( ResourceImage::New( maskImage ) ); - - maskEffect.SetUniform( "uImageSize", Vector2(0,0) /*Constrained to actor size*/ ); - - Constraint constraint = Constraint::New( maskEffect, maskEffect.GetPropertyIndex("uImageSize"), NinePatchMaskEffectSizeConstraint ); - constraint.AddSource( Source(actor, Actor::Property::SIZE) ); - constraint.Apply(); - - maskEffect.SetUniform( "uMaskSize", maskSize ); - - // Actor must provide nine-patch style geometry for this effect to work - actor.SetStyle( ImageActor::STYLE_NINE_PATCH ); - actor.SetNinePatchBorder( maskBorder ); - - actor.SetShaderEffect( maskEffect ); -} - -/** - * @brief Apply the mask effect to an ImageActor. - * - * NinePatchMaskEffect is mutually exclusive with ImageActor::STYLE_NINE_PATCH i.e. the actor's main image should not be a nine-patch. - * @param [in] actor The actor which needs the effect. To remove the effect call actor.RemoveShaderEffect(). - * @param [in] maskImage The path to a file containing the mask. The center pixels of the mask will be stretched. - */ -inline void Apply( ImageActor actor, const std::string& maskImage ) -{ - const Uint16Pair maskSize = ResourceImage::GetImageSize( maskImage ); - - const float leftRight = (maskSize.GetWidth() - 1.0f) * 0.5f; - const float topBottom = (maskSize.GetHeight() - 1.0f) * 0.5f; - - DoApply( actor, maskImage, Vector2( maskSize.GetWidth(), maskSize.GetHeight() ), Vector4( leftRight, topBottom, leftRight, topBottom ) ); -} - -/** - * @brief Apply the mask effect to an ImageActor. - * - * NinePatchMaskEffect is mutually exclusive with ImageActor::STYLE_NINE_PATCH i.e. the actor's main image should not be a nine-patch. - * @param [in] actor The actor which needs the effect. To remove the effect call actor.RemoveShaderEffect(). - * @param [in] maskImage The path to a file containing the mask. - * @param [in] maskBorder Specifies the part of the mask image that will be stretched (left, top, right, bottom). - */ -inline void Apply( ImageActor actor, const std::string& maskImage, const Vector4& maskBorder ) -{ - const Uint16Pair maskSize = ResourceImage::GetImageSize( maskImage ); - - DoApply( actor, maskImage, Vector2( maskSize.GetWidth(), maskSize.GetHeight() ), maskBorder ); -} - -} // namespace NinePatchMaskEffect - -} // namespace Toolkit - -} // namespace Dali - -#endif // __DALI_TOOLKIT_NINE_PATCH_MASK_EFFECT_H__ diff --git a/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp b/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp index f3e2ed1..f40290c 100644 --- a/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp +++ b/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp @@ -26,6 +26,7 @@ #include #include #include +#include // INTERNAL INCLUDES #include