Merge "Fix for cursor. Avoid the jump of the grab handle when there is a mix of...
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / shader-effects / alpha-discard-effect.cpp
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali-toolkit/devel-api/shader-effects/alpha-discard-effect.h>
20
21 namespace Dali
22 {
23
24 namespace Toolkit
25 {
26
27 AlphaDiscardEffect::AlphaDiscardEffect()
28 {
29 }
30
31 AlphaDiscardEffect::~AlphaDiscardEffect()
32 {
33 }
34
35 AlphaDiscardEffect AlphaDiscardEffect::New()
36 {
37   const char* ALPHA_DISCARD_FRAGMENT_SHADER_SOURCE =
38       "void main()                                                    \n"
39       "{                                                              \n"
40       "  mediump vec4 color = texture2D( sTexture, vTexCoord );       \n"
41       "  if(color.a <= 0.0001)                                        \n"
42       "  {                                                            \n"
43       "    discard;                                                   \n"
44       "  }                                                            \n"
45       "  gl_FragColor = color * uColor;                               \n"
46       "}                                                              \n";
47
48   ShaderEffect shader = ShaderEffect::New( "", // Use default
49                                            ALPHA_DISCARD_FRAGMENT_SHADER_SOURCE );
50   return AlphaDiscardEffect( shader );
51 }
52
53 //Call the Parent copy constructor to add reference to the implementation for this object
54 AlphaDiscardEffect::AlphaDiscardEffect( ShaderEffect handle )
55 : ShaderEffect( handle )
56 {
57 }
58
59 } // namespace Toolkit
60
61 } // namespace Dali