summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
3b81473)
We can use custom bitmap font without using glyph.
In this case, glyphBuffer can be RGBA.
Current logic assume that glyphBuffer only L8 if isColor is false.
This patch it that case works well
Change-Id: Ia68bfb4a292cb4bc34f4041b55f2a9d661e58df7
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
const int32_t xOffset = data.horizontalOffset + position->x;
// Whether the given glyph is a color one.
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);
// Determinate iterator range.
const int32_t lineIndexRangeMin = std::max(0, -yOffset);
for(int32_t index = indexRangeMin; index < indexRangeMax; ++index)
{
// Update the alpha channel.
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)
// Copy non-transparent pixels only
if(alpha > 0u)
// Skip basic line.
bitmapBuffer += (lineIndexRangeMin + yOffset) * static_cast<int32_t>(data.width);
// Skip basic line.
bitmapBuffer += (lineIndexRangeMin + yOffset) * static_cast<int32_t>(data.width);
- glyphBuffer += (lineIndexRangeMin) * static_cast<int32_t>(data.glyphBitmap.width);
+ glyphBuffer += (lineIndexRangeMin) * static_cast<int32_t>(data.glyphBitmap.width) * glyphPixelSize;
// Traverse the pixels of the glyph line per line.
for(int32_t lineIndex = lineIndexRangeMin; lineIndex < lineIndexRangeMax; ++lineIndex)
// Traverse the pixels of the glyph line per line.
for(int32_t lineIndex = lineIndexRangeMin; lineIndex < lineIndexRangeMax; ++lineIndex)
const int32_t xOffsetIndex = xOffset + index;
// Update the alpha channel.
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)
// Copy non-transparent pixels only
if(alpha > 0u)
}
bitmapBuffer += data.width;
}
bitmapBuffer += data.width;
- glyphBuffer += data.glyphBitmap.width;
+ glyphBuffer += data.glyphBitmap.width * glyphPixelSize;