X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Frendering%2Ftext-typesetter.cpp;h=1821db4482c129eb577521a0a446e5add535a312;hb=3d5e4b0be899a9ca1d82209e140f8f097c334622;hp=11cde00a2b5affcc38556341e318f55881c2933f;hpb=b26dd9c746eeb66b7011b506222d87d9fd89cf3c;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/rendering/text-typesetter.cpp b/dali-toolkit/internal/text/rendering/text-typesetter.cpp index 11cde00..1821db4 100644 --- a/dali-toolkit/internal/text/rendering/text-typesetter.cpp +++ b/dali-toolkit/internal/text/rendering/text-typesetter.cpp @@ -151,10 +151,26 @@ void TypesetGlyph( GlyphData& data, { // Update the alpha channel. const uint8_t alpha = *( data.glyphBitmap.buffer + glyphBufferOffset + index ); - *( packedColorBuffer + 3u ) = static_cast( color->a * static_cast( alpha ) ); - // Set the color into the final pixel buffer. - *( bitmapBuffer + verticalOffset + xOffsetIndex ) = packedColor; + // Copy non-transparent pixels only + if ( alpha > 0u ) + { + // Check alpha of overlapped pixels + uint32_t& currentColor = *( bitmapBuffer + verticalOffset + xOffsetIndex ); + uint8_t* packedCurrentColorBuffer = reinterpret_cast( ¤tColor ); + + uint8_t currentAlpha = *( packedCurrentColorBuffer + 3u ); + uint8_t newAlpha = static_cast( color->a * static_cast( alpha ) ); + + // For any pixel overlapped with the pixel in previous glyphs, make sure we don't + // overwrite a previous bigger alpha with a smaller alpha (in order to avoid + // semi-transparent gaps between joint glyphs with overlapped pixels, which could + // happen, for example, in the RTL text when we copy glyphs from right to left). + *( packedColorBuffer + 3u ) = std::max( currentAlpha, newAlpha ); + + // Set the color into the final pixel buffer. + currentColor = packedColor; + } } } }