Remove NinePatchMaskEffect 43/51643/4
authorChu Hoang <c.hoang@samsung.com>
Wed, 11 Nov 2015 15:53:00 +0000 (15:53 +0000)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 13 Nov 2015 16:06:53 +0000 (16:06 +0000)
Change-Id: Ib3f5c029ea7f80a559edcbc631db968cd1656bed

automated-tests/src/dali-toolkit/CMakeLists.txt
automated-tests/src/dali-toolkit/utc-Dali-NinePatchMaskEffect.cpp [deleted file]
automated-tests/src/dali-toolkit/utc-Dali-ShaderEffects.cpp
dali-toolkit/devel-api/file.list
dali-toolkit/devel-api/shader-effects/nine-patch-mask-effect.h [deleted file]
dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp

index d6e2eaa..aaefe8e 100644 (file)
@@ -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 (file)
index 7d76ab3..0000000
+++ /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 <iostream>
-#include <stdlib.h>
-
-// Need to override adaptor classes for toolkit test harness, so include
-// test harness headers before dali headers.
-#include <dali-toolkit-test-suite-utils.h>
-
-#include <dali.h>
-#include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/shader-effects/nine-patch-mask-effect.h>
-
-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;
-}
index 96ffb55..1870b9e 100644 (file)
@@ -35,7 +35,6 @@
 #include <dali-toolkit/devel-api/shader-effects/mirror-effect.h>
 #include <dali-toolkit/devel-api/shader-effects/motion-blur-effect.h>
 #include <dali-toolkit/devel-api/shader-effects/motion-stretch-effect.h>
-#include <dali-toolkit/devel-api/shader-effects/nine-patch-mask-effect.h>
 #include <dali-toolkit/devel-api/shader-effects/overlay-effect.h>
 #include <dali-toolkit/devel-api/shader-effects/quadratic-bezier.h>
 #include <dali-toolkit/devel-api/shader-effects/ripple-effect.h>
index f234c23..953c478 100755 (executable)
@@ -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 (file)
index 931e5cd..0000000
+++ /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 <dali/public-api/actors/image-actor.h>
-
-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<Vector2>( 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__
index f3e2ed1..f40290c 100644 (file)
@@ -26,6 +26,7 @@
 #include <dali/public-api/object/type-registry.h>
 #include <dali/devel-api/object/type-registry-helper.h>
 #include <dali/public-api/render-tasks/render-task-list.h>
+#include <dali/devel-api/rendering/cull-face.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/controls/page-turn-view/page-turn-effect.h>