[PATCH] Rename cairo_format_width to cairo_format_bits_per_pixel and correct its logic

Carl Worth cworth at cworth.org
Sat Jan 26 16:42:26 PST 2008


---
 src/cairo-image-surface.c |    6 +++---
 src/cairo-scaled-font.c   |    3 ++-
 src/cairoint.h            |    4 ++--
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 5f31d93..9273f17 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -615,14 +615,14 @@ _cairo_content_from_format (cairo_format_t format)
     return CAIRO_CONTENT_COLOR_ALPHA;
 }

-cairo_private cairo_format_t
-_cairo_format_width (cairo_format_t format)
+int
+_cairo_format_bits_per_pixel (cairo_format_t format)
 {
     switch (format) {
     case CAIRO_FORMAT_ARGB32:
 	return 32;
     case CAIRO_FORMAT_RGB24:
-	return 24;
+	return 32;
     case CAIRO_FORMAT_A8:
 	return 8;
     case CAIRO_FORMAT_A1:
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index c5752ba..117020c 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -1258,7 +1258,8 @@ _cairo_scaled_font_show_glyphs (cairo_scaled_font_t    *scaled_font,
 	/* If we have glyphs of different formats, we "upgrade" the mask
 	 * to the wider of the formats. */
 	if (glyph_surface->format != mask_format &&
-	    _cairo_format_width (mask_format) < _cairo_format_width (glyph_surface->format) )
+	    _cairo_format_bits_per_pixel (mask_format) <
+	    _cairo_format_bits_per_pixel (glyph_surface->format) )
 	{
 	    cairo_surface_t *new_mask;
 	    cairo_surface_pattern_t mask_pattern;
diff --git a/src/cairoint.h b/src/cairoint.h
index b5b69d2..34de5d2 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -1795,8 +1795,8 @@ _cairo_surface_has_device_transform (cairo_surface_t *surface);
 						      CAIRO_CONTENT_COLOR_ALPHA))\
 				       == 0))

-cairo_private cairo_format_t
-_cairo_format_width (cairo_format_t format);
+cairo_private int
+_cairo_format_bits_per_pixel (cairo_format_t format);

 cairo_private cairo_format_t
 _cairo_format_from_content (cairo_content_t content);
--
1.5.3.2


--Multipart_Sun_Jan_27_21:35:32_2008-1
Content-Type: application/octet-stream; type=patch
Content-Disposition: attachment; filename="0002-Add-cairo_image_surface_stride_for_width.patch"
Content-Transfer-Encoding: 7bit



More information about the cairo mailing list