From: Adeel Kazmi Date: Tue, 7 Jun 2022 15:33:13 +0000 (+0000) Subject: Merge "Fix bug when we use bitmap font." into devel/master X-Git-Tag: dali_2.1.26~7 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=e70007fa5b0de4fcaa1960c52a2f1dc582d1d44d;hp=5a936aac073676657d48db5c42e5d2ad3f5cac9f Merge "Fix bug when we use bitmap font." into devel/master --- diff --git a/dali-toolkit/internal/text/rendering/text-typesetter.cpp b/dali-toolkit/internal/text/rendering/text-typesetter.cpp index 30f76fc..2689ffb 100644 --- a/dali-toolkit/internal/text/rendering/text-typesetter.cpp +++ b/dali-toolkit/internal/text/rendering/text-typesetter.cpp @@ -96,8 +96,9 @@ void TypesetGlyph(GlyphData& data, const int32_t xOffset = data.horizontalOffset + position->x; // Whether the given glyph is a color one. - const bool isColorGlyph = data.glyphBitmap.isColorEmoji || data.glyphBitmap.isColorBitmap; - const uint32_t glyphPixelSize = Pixel::GetBytesPerPixel(data.glyphBitmap.format); + const bool isColorGlyph = data.glyphBitmap.isColorEmoji || data.glyphBitmap.isColorBitmap; + const uint32_t glyphPixelSize = Pixel::GetBytesPerPixel(data.glyphBitmap.format); + const uint32_t glyphAlphaIndex = glyphPixelSize - 1u; // Determinate iterator range. const int32_t lineIndexRangeMin = std::max(0, -yOffset); @@ -204,7 +205,7 @@ void TypesetGlyph(GlyphData& data, for(int32_t index = indexRangeMin; index < indexRangeMax; ++index) { // Update the alpha channel. - const uint8_t alpha = *(glyphBuffer + index); + const uint8_t alpha = *(glyphBuffer + index * glyphPixelSize + glyphAlphaIndex); // Copy non-transparent pixels only if(alpha > 0u) @@ -259,7 +260,7 @@ void TypesetGlyph(GlyphData& data, // Skip basic line. bitmapBuffer += (lineIndexRangeMin + yOffset) * static_cast(data.width); - glyphBuffer += (lineIndexRangeMin) * static_cast(data.glyphBitmap.width); + glyphBuffer += (lineIndexRangeMin) * static_cast(data.glyphBitmap.width) * glyphPixelSize; // Traverse the pixels of the glyph line per line. for(int32_t lineIndex = lineIndexRangeMin; lineIndex < lineIndexRangeMax; ++lineIndex) @@ -269,7 +270,7 @@ void TypesetGlyph(GlyphData& data, const int32_t xOffsetIndex = xOffset + index; // Update the alpha channel. - const uint8_t alpha = *(glyphBuffer + index); + const uint8_t alpha = *(glyphBuffer + index * glyphPixelSize + glyphAlphaIndex); // Copy non-transparent pixels only if(alpha > 0u) @@ -286,7 +287,7 @@ void TypesetGlyph(GlyphData& data, } bitmapBuffer += data.width; - glyphBuffer += data.glyphBitmap.width; + glyphBuffer += data.glyphBitmap.width * glyphPixelSize; } } }