X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Frendering%2Fatlas%2Fatlas-glyph-manager-impl.cpp;h=12d39a51b30532f3c176abd91db7e2a70442c9f0;hp=0a90ef240c92a55b2f0d6dc970d424b77a9ccbea;hb=3b5d5f82057a49f259e62aa8349e37ea6a9c221f;hpb=852a2122606480069d2fb0edb398ef11272b0f43 diff --git a/dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager-impl.cpp b/dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager-impl.cpp index 0a90ef2..12d39a5 100644 --- a/dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager-impl.cpp +++ b/dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager-impl.cpp @@ -1,4 +1,4 @@ - /* +/* * Copyright (c) 2015 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -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,17 +56,18 @@ 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 ); } ); const char* FRAGMENT_SHADER_RGBA = MAKE_SHADER( +uniform lowp vec4 uColor; uniform sampler2D sTexture; varying mediump vec2 vTexCoord; void main() { - gl_FragColor = texture2D( sTexture, vTexCoord ); + gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor; } ); @@ -88,20 +90,18 @@ AtlasGlyphManager::AtlasGlyphManager() } void AtlasGlyphManager::Add( const Text::GlyphInfo& glyph, - const BufferImage& bitmap, + const PixelData& bitmap, Dali::Toolkit::AtlasManager::AtlasSlot& slot ) { DALI_LOG_INFO( gLogFilter, Debug::General, "Added glyph, font: %d index: %d\n", glyph.fontId, glyph.index ); if ( mAtlasManager.Add( bitmap, slot ) ) { - // A new atlas was created so set the material 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 ); + // A new atlas was created so set the texture set details for the atlas + Dali::Texture atlas = mAtlasManager.GetAtlasContainer( slot.mAtlasId ); + TextureSet textureSet = TextureSet::New(); + textureSet.SetTexture( 0u, atlas ); + mAtlasManager.SetTextures( slot.mAtlasId, textureSet ); } GlyphRecordEntry record; @@ -252,9 +252,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()