Keep track of Bitmap data ownership
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / rendering / shaders / text-bgra-shader.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 // INTERNAL HEADERS
19 #include <dali-toolkit/internal/text/rendering/text-renderer.h>
20 #include <dali/public-api/shader-effects/shader-effect.h>
21
22 namespace Dali
23 {
24
25 namespace Toolkit
26 {
27
28 namespace Text
29 {
30
31 namespace BgraShader
32 {
33
34 Dali::ShaderEffect New()
35 {
36   std::string vertexShader = DALI_COMPOSE_SHADER(
37       uniform mediump vec4 uTextureRect;\n
38       void main()\n
39       {\n
40         gl_Position = uMvpMatrix * vec4( aPosition.xy, 0.0, 1.0 );\n
41         vTexCoord = aTexCoord.xy;\n
42       }\n
43   );
44
45   std::string fragmentShader = DALI_COMPOSE_SHADER(
46       void main()\n
47       {\n
48         gl_FragColor = texture2D( sTexture, vTexCoord );
49       }\n
50   );
51
52   Dali::ShaderEffect shaderEffect = Dali::ShaderEffect::New( vertexShader, fragmentShader,
53                                                              Dali::ShaderEffect::GeometryHints( Dali::ShaderEffect::HINT_NONE ) );
54   return shaderEffect;
55 }
56
57 } // namespace BGRAShader
58
59 } // namespace Text
60
61 } // namespace Toolkit
62
63 } // namespace Dali
64