summaryrefslogtreecommitdiff
path: root/pango/pango-matrix.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2008-01-22 02:08:36 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2008-01-22 02:08:36 +0000
commit792cb2621ea727020f361675f7637ce1207734c9 (patch)
treedd9fcd088ee4b6451939b385eae1899268cba0ca /pango/pango-matrix.c
parent8eb3f4c814f512aaae70b080ec7d9acff1495f5b (diff)
downloadpango-792cb2621ea727020f361675f7637ce1207734c9.tar.gz
Bug 508002 – change pango_layout_pixel_extents() to round logical rect
2008-01-21 Behdad Esfahbod <behdad@gnome.org> Bug 508002 – change pango_layout_pixel_extents() to round logical rect to be inclusive * pango/pango-layout.c (pango_layout_get_pixel_extents), (pango_layout_line_get_pixel_extents): Round extents to pixels inclusively. That is, pass both ink_rect and logical_rect as first argument to pango_extents_to_pixels(). * pango/pango-matrix.c (pango_matrix_transform_pixel_rectangle): Fix rounding. * pango/pango-types.h: * docs/tmpl/glyphs.sgml: * pango/pango-utils.c (pango_extents_to_pixels): Rename pango_extents_to_pixels() function arguments from @ink_rect and @logical_rect to @inclusive and @nearest. Given that this API is a fairly new addition and not commonly used, language bindings are encouraged to update their argument names accordingly. Moreover, they are encouraged to wrap this function as two different calls: extents_to_pixels_inclusive() and extents_to_pixels_nearest(), or similar conventions that best reflect their native language. svn path=/trunk/; revision=2548
Diffstat (limited to 'pango/pango-matrix.c')
-rw-r--r--pango/pango-matrix.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/pango/pango-matrix.c b/pango/pango-matrix.c
index a8df59e3..3168be35 100644
--- a/pango/pango-matrix.c
+++ b/pango/pango-matrix.c
@@ -332,8 +332,9 @@ pango_matrix_transform_point (const PangoMatrix *matrix,
* If you have the rectangle in Pango units and want to convert to
* transformed pixel bounding box, it is more accurate to transform it first
* (using this function) and pass the result to pango_extents_to_pixels(),
- * as @ink_rect. However, there is a reason that you may want to convert
- * to pixels first and then transform, and that is when the transformed
+ * first argument, for an inclusive rounded rectangle.
+ * However, there are valid reasons that you may want to convert
+ * to pixels first and then transform, for example when the transformed
* coordinates may overflow in Pango units (large matrix translation for
* example).
*
@@ -408,7 +409,7 @@ pango_matrix_transform_rectangle (const PangoMatrix *matrix,
*
* For better accuracy, you should use pango_matrix_transform_rectangle() on
* original rectangle in Pango units and convert to pixels afterward
- * using pango_extents_to_pixels() as @ink_rect.
+ * using pango_extents_to_pixels()'s first argument.
*
* Since: 1.16
**/
@@ -460,8 +461,8 @@ pango_matrix_transform_pixel_rectangle (const PangoMatrix *matrix,
max_y = quad_y[i];
}
- rect->x = min_x;
- rect->y = min_y;
- rect->width = max_x - rect->x;
- rect->height = max_y - rect->y;
+ rect->x = floor (min_x);
+ rect->y = floor (min_y);
+ rect->width = ceil (max_x - rect->x);
+ rect->height = ceil (max_y - rect->y);
}