summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/text/qfontengine_ft.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index fe72df64bd..af458c11a2 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -588,6 +588,16 @@ static void convertRGBToARGB_V(const uchar *src, uint *dst, int width, int heigh
}
}
+static void convertGRAYToARGB(const uchar *src, uint *dst, int width, int height, int src_pitch) {
+ for (int y = 0; y < height; ++y) {
+ int readpos = (y * src_pitch);
+ int writepos = (y * width);
+ for (int x = 0; x < width; ++x) {
+ dst[writepos + x] = (0xFF << 24) + (src[readpos + x] << 16) + (src[readpos + x] << 8) + src[readpos + x];
+ }
+ }
+}
+
static void convoluteBitmap(const uchar *src, uchar *dst, int width, int height, int pitch)
{
// convolute the bitmap with a triangle filter to get rid of color fringes
@@ -1016,7 +1026,7 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph,
bitmap.rows = info.height*vfactor;
bitmap.width = hpixels;
bitmap.pitch = format == Format_Mono ? (((info.width + 31) & ~31) >> 3) : ((bitmap.width + 3) & ~3);
- if (!hsubpixel && vfactor == 1)
+ if (!hsubpixel && vfactor == 1 && format != Format_A32)
bitmap.buffer = glyph_buffer;
else
bitmap.buffer = new uchar[bitmap.rows*bitmap.pitch];
@@ -1047,6 +1057,8 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph,
delete [] convoluted;
} else if (vfactor != 1) {
convertRGBToARGB_V(bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, bitmap.pitch, subpixelType != QFontEngineFT::Subpixel_VRGB, true);
+ } else if (format == Format_A32 && bitmap.pixel_mode == FT_PIXEL_MODE_GRAY) {
+ convertGRAYToARGB(bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, bitmap.pitch);
}
if (bitmap.buffer != glyph_buffer)