Rendering API clean-up
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / rendering / atlas / atlas-glyph-manager-impl.cpp
index 0a90ef2..f40b3a4 100644 (file)
@@ -48,6 +48,7 @@ void main()
 );
 
 const char* FRAGMENT_SHADER_L8 = MAKE_SHADER(
+uniform lowp    vec4      uColor;
 uniform         sampler2D sTexture;
 varying mediump vec2      vTexCoord;
 varying mediump vec4      vColor;
@@ -55,7 +56,7 @@ varying mediump vec4      vColor;
 void main()
 {
   mediump vec4 color = texture2D( sTexture, vTexCoord );
-  gl_FragColor = vec4( vColor.rgb, vColor.a * color.r );
+  gl_FragColor = vec4( vColor.rgb * uColor.rgb, vColor.a * uColor.a * color.r );
 }
 );
 
@@ -95,13 +96,11 @@ void AtlasGlyphManager::Add( const Text::GlyphInfo& glyph,
 
   if ( mAtlasManager.Add( bitmap, slot ) )
   {
-    // A new atlas was created so set the material details for the atlas
+    // A new atlas was created so set the texture set details for the atlas
     Dali::Atlas atlas = mAtlasManager.GetAtlasContainer( slot.mAtlasId );
-    Pixel::Format pixelFormat = mAtlasManager.GetPixelFormat( slot.mAtlasId );
-    Material material = Material::New( pixelFormat == Pixel::L8 ? mShaderL8 : mShaderRgba );
-    material.AddTexture( atlas, "sTexture" );
-    material.SetBlendMode( BlendingMode::ON );
-    mAtlasManager.SetMaterial( slot.mAtlasId, material );
+    TextureSet textureSet = TextureSet::New();
+    textureSet.SetImage( 0u, atlas );
+    mAtlasManager.SetTextures( slot.mAtlasId, textureSet );
   }
 
   GlyphRecordEntry record;
@@ -252,9 +251,15 @@ void AtlasGlyphManager::AdjustReferenceCount( Text::FontId fontId, Text::GlyphIn
   }
 }
 
-Material AtlasGlyphManager::GetMaterial( uint32_t atlasId ) const
+TextureSet AtlasGlyphManager::GetTextures( uint32_t atlasId ) const
 {
-  return mAtlasManager.GetMaterial( atlasId );
+  return mAtlasManager.GetTextures( atlasId );
+}
+
+Shader AtlasGlyphManager::GetShader( uint32_t atlasId ) const
+{
+  Pixel::Format pixelFormat = mAtlasManager.GetPixelFormat( atlasId );
+  return pixelFormat == Pixel::L8 ? mShaderL8 : mShaderRgba;
 }
 
 AtlasGlyphManager::~AtlasGlyphManager()