X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Frendering%2Fatlas%2Fatlas-glyph-manager-impl.cpp;h=8532b93ef1b42ef77bb498f3cc372d33f52e3ed9;hb=6f990775daf7adf6170db59f0b99e00ae25fceed;hp=f2c328e51c8576bd5e3c4333ee67e17ee3f1b2fb;hpb=225ea9dd33c2d8669d8dac1f2b116eeb2ea00c0d;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git 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 f2c328e..8532b93 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 @@ -32,15 +32,18 @@ namespace const char* VERTEX_SHADER = MAKE_SHADER( attribute mediump vec2 aPosition; attribute mediump vec2 aTexCoord; +attribute mediump vec4 aColor; uniform mediump vec2 uOffset; uniform mediump mat4 uMvpMatrix; varying mediump vec2 vTexCoord; +varying mediump vec4 vColor; void main() { mediump vec4 position = vec4( aPosition.xy + uOffset, 0.0, 1.0 ); gl_Position = uMvpMatrix * position; vTexCoord = aTexCoord; + vColor = aColor; } ); @@ -48,11 +51,12 @@ const char* FRAGMENT_SHADER_L8 = MAKE_SHADER( uniform lowp vec4 uColor; uniform sampler2D sTexture; varying mediump vec2 vTexCoord; +varying mediump vec4 vColor; void main() { mediump vec4 color = texture2D( sTexture, vTexCoord ); - gl_FragColor = vec4( uColor.rgb, uColor.a * color.r ); + gl_FragColor = vec4( vColor.rgb * uColor.rgb, vColor.a * uColor.a * color.r ); } ); @@ -85,20 +89,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; @@ -249,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()