summaryrefslogtreecommitdiff
path: root/pango/pangoft2-render.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2004-06-22 14:40:39 +0000
committerOwen Taylor <otaylor@src.gnome.org>2004-06-22 14:40:39 +0000
commit8ba821e11ccc3c357ae244b8a6707418c78a5e29 (patch)
tree6da7942674ce7c198fce753d23b05c55a9132e00 /pango/pangoft2-render.c
parent01cec419bd966048f5944874bed1f1f14b581d81 (diff)
downloadpango-8ba821e11ccc3c357ae244b8a6707418c78a5e29.tar.gz
Allow %NULL for @matrix. (#144775, Diego González)
Tue Jun 22 10:39:32 2004 Owen Taylor <otaylor@redhat.com> * pango/pangoft2-render.c (_pango_ft2_draw_error_underline, _pango_ft2_draw_rect): Allow %NULL for @matrix. (#144775, Diego González)
Diffstat (limited to 'pango/pangoft2-render.c')
-rw-r--r--pango/pangoft2-render.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/pango/pangoft2-render.c b/pango/pangoft2-render.c
index 2b809fb7..367429e1 100644
--- a/pango/pangoft2-render.c
+++ b/pango/pangoft2-render.c
@@ -258,9 +258,8 @@ compare_points (const void *a,
/**
* _pango_ft2_draw_rect:
* @bitmap: a #FT_Bitmap
- * @matrix: a #PangoMatrix giving the user to device transformation
- * @x_offset: X offset in device coordinates to add onto transformation result
- * @y_offset: Y offset in device coordinates to add onto transformation result
+ * @matrix: a #PangoMatrix giving the user to device transformation,
+ * or %NULL for the identity.
* @x: X coordinate of rectangle, in Pango units in user coordinate system
* @y: Y coordinate of rectangle, in Pango units in user coordinate system
* @width: width of rectangle, in Pango units in user coordinate system
@@ -278,8 +277,12 @@ _pango_ft2_draw_rect (FT_Bitmap *bitmap,
int width,
int height)
{
+ static const PangoMatrix identity = PANGO_MATRIX_INIT;
Point points[4];
+ if (!matrix)
+ matrix = &identity;
+
/* Convert the points to device coordinates, and sort
* in ascending Y order. (Ordering by X for ties)
*/
@@ -413,6 +416,22 @@ get_total_matrix (PangoMatrix *total,
total->y0 = (global->yx * x + global->yy * y) / PANGO_SCALE + global->y0;
}
+/**
+ * _pango_ft2_draw_error_underline:
+ * @bitmap: a #FT_Bitmap
+ * @matrix: a #PangoMatrix giving the user to device transformation,
+ * or %NULL for the identity.
+ * @x: X coordinate of underline, in Pango units in user coordinate system
+ * @y: Y coordinate of underline, in Pango units in user coordinate system
+ * @width: width of underline, in Pango units in user coordinate system
+ * @height: height of underline, in Pango units in user coordinate system
+ *
+ * Draw a squiggly line that approximately covers the given rectangle
+ * in the style of an underline used to indicate a spelling error.
+ * (The width of the underline is rounded to an integer number
+ * of up/down segments and the resulting rectangle is centered
+ * in the original rectangle)
+ **/
void
_pango_ft2_draw_error_underline (FT_Bitmap *bitmap,
PangoMatrix *matrix,
@@ -425,10 +444,14 @@ _pango_ft2_draw_error_underline (FT_Bitmap *bitmap,
int square = height / HEIGHT_SQUARES;
int unit_width = (HEIGHT_SQUARES - 1) * square;
int width_units = (width + unit_width / 2) / unit_width;
+ static const PangoMatrix identity = PANGO_MATRIX_INIT;
x += (width - width_units * unit_width) / 2;
width = width_units * unit_width;
+ if (!matrix)
+ matrix = &identity;
+
while (TRUE)
{
PangoMatrix total;