diff options
author | Sven Neumann <sven@gimp.org> | 2001-08-14 13:26:39 +0000 |
---|---|---|
committer | Sven Neumann <neo@src.gnome.org> | 2001-08-14 13:26:39 +0000 |
commit | b7983377840cc221c9b9ca01b1fd83947b3d8e98 (patch) | |
tree | 2bc826156c7ccaf25e77170ecb50d132add536a8 /pango/pangoft2.c | |
parent | 2a5cffcf5c0caa54f753d8b15fafdd4edf71e346 (diff) | |
download | pango-b7983377840cc221c9b9ca01b1fd83947b3d8e98.tar.gz |
composite glyphs over the buffer instead of simply copying into it so
2001-08-14 Sven Neumann <sven@gimp.org>
* pango/pangoft2.c (pango_ft2_render): composite glyphs over the
buffer instead of simply copying into it so glyphs with overlapping
ink rectangles do not overwrite each other.
Diffstat (limited to 'pango/pangoft2.c')
-rw-r--r-- | pango/pangoft2.c | 53 |
1 files changed, 39 insertions, 14 deletions
diff --git a/pango/pangoft2.c b/pango/pangoft2.c index 2c619aea..b44d11d3 100644 --- a/pango/pangoft2.c +++ b/pango/pangoft2.c @@ -351,14 +351,39 @@ pango_ft2_render (FT_Bitmap *bitmap, { p = bitmap->buffer + (iyoff - face->glyph->bitmap_top + iy) * bitmap->pitch + - ixoff + - face->glyph->bitmap_left + x_start; + ixoff + face->glyph->bitmap_left + + x_start; - q = face->glyph->bitmap.buffer + iy*face->glyph->bitmap.pitch; + q = face->glyph->bitmap.buffer + + iy * face->glyph->bitmap.pitch; + for (ix = x_start; ix < x_limit; ix++) { - *p = *q; - q++; + switch (*q) + { + case 0: + break; + case 0xff: + *p = 0xff; + default: + switch (*p) + { + case 0: + *p = *q; + break; + case 0xff: + break; + default: + { + gushort pixel = *(q); + gushort s = (*p)+1; + *(p) = (pixel * (256-s) + s) >> 8; + } + break; + } + break; + } + q++; p++; } } @@ -367,17 +392,17 @@ pango_ft2_render (FT_Bitmap *bitmap, { p = bitmap->buffer + (iyoff - face->glyph->bitmap_top + iy) * bitmap->pitch + - ixoff + - face->glyph->bitmap_left + x_start; - - q = face->glyph->bitmap.buffer + iy*face->glyph->bitmap.pitch; + ixoff + face->glyph->bitmap_left + + x_start; + + q = face->glyph->bitmap.buffer + + iy*face->glyph->bitmap.pitch; + for (ix = x_start; ix < x_limit; ix++) { - if ((*q) & (1 << (7 - (ix%8)))) - *p = 0; - else - *p = MIN (*p, 0xFF); - if ((ix%8) == 7) + if ((*q) & (1 << (7 - (ix % 8)))) + *p = 0xff; + if ((ix % 8) == 7) q++; p++; } |