summaryrefslogtreecommitdiff
path: root/pango/pangoft2.c
diff options
context:
space:
mode:
authorAlex Larsson <alexl@redhat.com>2001-12-12 02:59:52 +0000
committerAlexander Larsson <alexl@src.gnome.org>2001-12-12 02:59:52 +0000
commitbcf6c7a607dbce17ed36e8596b0a9465a7711e0a (patch)
tree3697ec955a6231aa7cc37fb51352289d39ef3058 /pango/pangoft2.c
parenta05b5bfdadf2013f19779781028e5e85cdab3657 (diff)
downloadpango-bcf6c7a607dbce17ed36e8596b0a9465a7711e0a.tar.gz
Fix the details in clipping to the bitmap size.
2001-12-11 Alex Larsson <alexl@redhat.com> * pango/pangoft2.c (pango_ft2_render): Fix the details in clipping to the bitmap size.
Diffstat (limited to 'pango/pangoft2.c')
-rw-r--r--pango/pangoft2.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/pango/pangoft2.c b/pango/pangoft2.c
index fc62b6f7..7ef2930c 100644
--- a/pango/pangoft2.c
+++ b/pango/pangoft2.c
@@ -280,7 +280,7 @@ pango_ft2_render (FT_Bitmap *bitmap,
int x_position = 0;
int ix, iy, ixoff, iyoff, y_start, y_limit, x_start, x_limit;
PangoGlyphInfo *gi;
- guchar *p, *q;
+ guchar *dest, *src;
g_return_if_fail (bitmap != NULL);
g_return_if_fail (glyphs != NULL);
@@ -305,12 +305,11 @@ pango_ft2_render (FT_Bitmap *bitmap,
ixoff = x + PANGO_PIXELS (x_position + gi->geometry.x_offset);
iyoff = y + PANGO_PIXELS (gi->geometry.y_offset);
- x_start = MAX (0, -face->glyph->bitmap_left - ixoff);
- x_limit = MIN (face->glyph->bitmap.width, face->glyph->bitmap_left - ixoff + bitmap->width);
-
- y_start = MAX (0, face->glyph->bitmap_top - iyoff);
- y_limit = MIN (face->glyph->bitmap.rows, face->glyph->bitmap_top - iyoff + bitmap->rows);
+ x_start = MAX (0, - (ixoff + face->glyph->bitmap_left));
+ x_limit = MIN (face->glyph->bitmap.width, bitmap->width - (ixoff + face->glyph->bitmap_left));
+ y_start = MAX (0, - (iyoff - face->glyph->bitmap_top));
+ y_limit = MIN (face->glyph->bitmap.rows, bitmap->rows - (iyoff - face->glyph->bitmap_top));
PING (("glyph %d:%d: bitmap: %dx%d, left:%d top:%d",
i, glyph_index,
@@ -322,48 +321,47 @@ pango_ft2_render (FT_Bitmap *bitmap,
if (face->glyph->bitmap.pixel_mode == ft_pixel_mode_grays)
for (iy = y_start; iy < y_limit; iy++)
{
- p = bitmap->buffer +
+ dest = 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;
+ src = face->glyph->bitmap.buffer +
+ iy * face->glyph->bitmap.pitch + x_start;
for (ix = x_start; ix < x_limit; ix++)
{
- switch (*q)
+ switch (*src)
{
case 0:
break;
case 0xff:
- *p = 0xff;
+ *dest = 0xff;
default:
- *p = MIN ((gushort) *p + (gushort) *q, 0xff);
+ *dest = MIN ((gushort) *dest + (gushort) *src, 0xff);
break;
}
- q++;
- p++;
+ dest++;
+ src++;
}
}
else if (face->glyph->bitmap.pixel_mode == ft_pixel_mode_mono)
for (iy = y_start; iy < y_limit; iy++)
{
- p = bitmap->buffer +
+ dest = bitmap->buffer +
(iyoff - face->glyph->bitmap_top + iy) * bitmap->pitch +
ixoff + face->glyph->bitmap_left +
x_start;
- q = face->glyph->bitmap.buffer +
+ src = face->glyph->bitmap.buffer +
iy*face->glyph->bitmap.pitch;
for (ix = x_start; ix < x_limit; ix++)
{
- if ((*q) & (1 << (7 - (ix % 8))))
- *p = 0xff;
+ if ((*src) & (1 << (7 - (ix % 8))))
+ *dest |= (1 << (7 - (ix % 8)));
if ((ix % 8) == 7)
- q++;
- p++;
+ src++;
+ dest++;
}
}
else