summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alla@lysator.liu.se>2002-01-20 23:37:26 +0000
committerAlexander Larsson <alexl@src.gnome.org>2002-01-20 23:37:26 +0000
commit25c41188236ec73f0ec61b5a4d11eef0fb54560b (patch)
tree1178cd65399d1bda03b6d3c2e20f1722bb44f88c
parent51e1022cc9ce854b69e7d336c09f7b8e5395d2c8 (diff)
downloadpango-25c41188236ec73f0ec61b5a4d11eef0fb54560b.tar.gz
Clean up underline drawing. Fixes segfaults.
2002-01-20 Alexander Larsson <alla@lysator.liu.se> * pango/pangoft2.c (pango_ft2_draw_hline): Clean up underline drawing. Fixes segfaults.
-rw-r--r--ChangeLog5
-rw-r--r--ChangeLog.pre-1-05
-rw-r--r--ChangeLog.pre-1-105
-rw-r--r--ChangeLog.pre-1-25
-rw-r--r--ChangeLog.pre-1-45
-rw-r--r--ChangeLog.pre-1-65
-rw-r--r--ChangeLog.pre-1-85
-rw-r--r--pango/pangoft2.c57
8 files changed, 72 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index df0de650..3c2bfe8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2002-01-20 Alexander Larsson <alla@lysator.liu.se>
+
+ * pango/pangoft2.c (pango_ft2_draw_hline):
+ Clean up underline drawing. Fixes segfaults.
+
Sat Jan 19 11:50:32 2002 Owen Taylor <otaylor@redhat.com>
* configure.in: Add a AC_TRY_LINK() for qt, since broken setups
diff --git a/ChangeLog.pre-1-0 b/ChangeLog.pre-1-0
index df0de650..3c2bfe8c 100644
--- a/ChangeLog.pre-1-0
+++ b/ChangeLog.pre-1-0
@@ -1,3 +1,8 @@
+2002-01-20 Alexander Larsson <alla@lysator.liu.se>
+
+ * pango/pangoft2.c (pango_ft2_draw_hline):
+ Clean up underline drawing. Fixes segfaults.
+
Sat Jan 19 11:50:32 2002 Owen Taylor <otaylor@redhat.com>
* configure.in: Add a AC_TRY_LINK() for qt, since broken setups
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index df0de650..3c2bfe8c 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,3 +1,8 @@
+2002-01-20 Alexander Larsson <alla@lysator.liu.se>
+
+ * pango/pangoft2.c (pango_ft2_draw_hline):
+ Clean up underline drawing. Fixes segfaults.
+
Sat Jan 19 11:50:32 2002 Owen Taylor <otaylor@redhat.com>
* configure.in: Add a AC_TRY_LINK() for qt, since broken setups
diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2
index df0de650..3c2bfe8c 100644
--- a/ChangeLog.pre-1-2
+++ b/ChangeLog.pre-1-2
@@ -1,3 +1,8 @@
+2002-01-20 Alexander Larsson <alla@lysator.liu.se>
+
+ * pango/pangoft2.c (pango_ft2_draw_hline):
+ Clean up underline drawing. Fixes segfaults.
+
Sat Jan 19 11:50:32 2002 Owen Taylor <otaylor@redhat.com>
* configure.in: Add a AC_TRY_LINK() for qt, since broken setups
diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4
index df0de650..3c2bfe8c 100644
--- a/ChangeLog.pre-1-4
+++ b/ChangeLog.pre-1-4
@@ -1,3 +1,8 @@
+2002-01-20 Alexander Larsson <alla@lysator.liu.se>
+
+ * pango/pangoft2.c (pango_ft2_draw_hline):
+ Clean up underline drawing. Fixes segfaults.
+
Sat Jan 19 11:50:32 2002 Owen Taylor <otaylor@redhat.com>
* configure.in: Add a AC_TRY_LINK() for qt, since broken setups
diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6
index df0de650..3c2bfe8c 100644
--- a/ChangeLog.pre-1-6
+++ b/ChangeLog.pre-1-6
@@ -1,3 +1,8 @@
+2002-01-20 Alexander Larsson <alla@lysator.liu.se>
+
+ * pango/pangoft2.c (pango_ft2_draw_hline):
+ Clean up underline drawing. Fixes segfaults.
+
Sat Jan 19 11:50:32 2002 Owen Taylor <otaylor@redhat.com>
* configure.in: Add a AC_TRY_LINK() for qt, since broken setups
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index df0de650..3c2bfe8c 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,3 +1,8 @@
+2002-01-20 Alexander Larsson <alla@lysator.liu.se>
+
+ * pango/pangoft2.c (pango_ft2_draw_hline):
+ Clean up underline drawing. Fixes segfaults.
+
Sat Jan 19 11:50:32 2002 Owen Taylor <otaylor@redhat.com>
* configure.in: Add a AC_TRY_LINK() for qt, since broken setups
diff --git a/pango/pangoft2.c b/pango/pangoft2.c
index ab942dc5..01b1f354 100644
--- a/pango/pangoft2.c
+++ b/pango/pangoft2.c
@@ -718,6 +718,34 @@ pango_ft2_get_unknown_glyph (PangoFont *font)
return 0;
}
+
+static void
+pango_ft2_draw_hline (FT_Bitmap *bitmap,
+ int y,
+ int start,
+ int end)
+{
+ unsigned char *p;
+ int ix;
+
+ if (y < 0 || y >= bitmap->rows)
+ return;
+
+ if (end <= 0 || start >= bitmap->width)
+ return;
+
+ if (start < 0)
+ start = 0;
+
+ if (end >= bitmap->width)
+ end = bitmap->width;
+
+ p = bitmap->buffer + y * bitmap->pitch + start;
+
+ for (ix = 0; ix < end - start; ix++)
+ *p++ = 0xff;
+}
+
/**
* pango_ft2_render_layout_line:
* @bitmap: a FT_Bitmap to render the line onto
@@ -737,10 +765,7 @@ pango_ft2_render_layout_line (FT_Bitmap *bitmap,
PangoRectangle overall_rect;
PangoRectangle logical_rect;
PangoRectangle ink_rect;
- unsigned char *p;
- int ix;
int x_off = 0;
- int x_limit;
pango_layout_line_get_extents (line,NULL, &overall_rect);
@@ -765,32 +790,24 @@ pango_ft2_render_layout_line (FT_Bitmap *bitmap,
pango_ft2_render (bitmap, run->item->analysis.font, run->glyphs,
x + PANGO_PIXELS (x_off), y);
- x_limit = PANGO_PIXELS (ink_rect.width);
switch (uline)
{
case PANGO_UNDERLINE_NONE:
break;
case PANGO_UNDERLINE_DOUBLE:
- p = bitmap->buffer +
- (y + 4) * bitmap->pitch +
- x + PANGO_PIXELS (x_off + ink_rect.x) - 1;
-
- for (ix = 0; ix < x_limit; ix++)
- *p++ = 0xff;
+ pango_ft2_draw_hline (bitmap, y + 4,
+ x + PANGO_PIXELS (x_off + ink_rect.x),
+ x + PANGO_PIXELS (x_off + ink_rect.x + ink_rect.width));
/* Fall through */
case PANGO_UNDERLINE_SINGLE:
- p = bitmap->buffer +
- (y + 2) * bitmap->pitch +
- x + PANGO_PIXELS (x_off + ink_rect.x) - 1;
- for (ix = 0; ix < x_limit; ix++)
- *p++ = 0xff;
+ pango_ft2_draw_hline (bitmap, y + 2,
+ x + PANGO_PIXELS (x_off + ink_rect.x),
+ x + PANGO_PIXELS (x_off + ink_rect.x + ink_rect.width));
break;
case PANGO_UNDERLINE_LOW:
- p = bitmap->buffer +
- (y + PANGO_PIXELS (ink_rect.y + ink_rect.height)) * bitmap->pitch +
- x + PANGO_PIXELS (x_off + ink_rect.x) - 1;
- for (ix = 0; ix < PANGO_PIXELS (ink_rect.width); ix++)
- *p++ = 0xff;
+ pango_ft2_draw_hline (bitmap, y + PANGO_PIXELS (ink_rect.y + ink_rect.height),
+ x + PANGO_PIXELS (x_off + ink_rect.x),
+ x + PANGO_PIXELS (x_off + ink_rect.x + ink_rect.width));
break;
}