diff options
author | tobrun <tobrun.van.nuland@gmail.com> | 2020-03-23 15:31:57 +0100 |
---|---|---|
committer | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2020-03-23 19:38:02 +0200 |
commit | 428304d13d4dbd0b01957751fcffd330375aa027 (patch) | |
tree | cf549b6dcca34300763fc78cb9fee31dcb05f01f | |
parent | 648ce071d39e275ddfcd20a94a6f96547c314635 (diff) | |
download | qtlocation-mapboxgl-upstream/tvn-local-font-fix.tar.gz |
[android] - use RGB values instead of alpha values for local glyph generationupstream/tvn-local-font-fix
-rw-r--r-- | platform/android/src/text/local_glyph_rasterizer.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/platform/android/src/text/local_glyph_rasterizer.cpp b/platform/android/src/text/local_glyph_rasterizer.cpp index 0627eb109e..c65c3ae439 100644 --- a/platform/android/src/text/local_glyph_rasterizer.cpp +++ b/platform/android/src/text/local_glyph_rasterizer.cpp @@ -120,7 +120,9 @@ Glyph LocalGlyphRasterizer::rasterizeGlyph(const FontStack& fontStack, GlyphID g // Copy alpha values from RGBA bitmap into the AlphaImage output fixedMetrics.bitmap = AlphaImage(size); for (uint32_t i = 0; i < size.width * size.height; i++) { - fixedMetrics.bitmap.data[i] = rgbaBitmap.data[4 * i + 3]; + fixedMetrics.bitmap.data[i] = + 0xff - round(0.2126 * rgbaBitmap.data[4 * i] + 0.7152 * rgbaBitmap.data[4 * i + 1] + + 0.0722 * rgbaBitmap.data[4 * i + 2]); } return fixedMetrics; |