From ac26a16171326d542d10e5c017e60bc2c2248172 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 21 Aug 2023 16:16:47 +0100 Subject: [PATCH] Make Cairo dither to Pixman dither conversion static We don't use it anywhere outside of the image surface, so there's no need to make it a project-wide private function. The name is also updated: it's a cairo function, so it should not abuse the pixman namespace. --- src/cairo-image-surface.c | 16 ++++++++-------- src/cairoint.h | 5 ----- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c index 047acf133..fe64cd76c 100644 --- a/src/cairo-image-surface.c +++ b/src/cairo-image-surface.c @@ -250,20 +250,20 @@ _pixman_format_from_masks (cairo_format_masks_t *masks, #if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0,39,0) /* Convenience function to convert #cairo_dither_t into #pixman_dither_t */ -pixman_dither_t -_pixman_dither_from_cairo_dither (cairo_dither_t dither) +static pixman_dither_t +_cairo_dither_to_pixman_dither (cairo_dither_t dither) { - switch(dither) { - default: - case CAIRO_DITHER_NONE: - case CAIRO_DITHER_DEFAULT: - return PIXMAN_DITHER_NONE; + switch (dither) { case CAIRO_DITHER_FAST: return PIXMAN_DITHER_FAST; case CAIRO_DITHER_GOOD: return PIXMAN_DITHER_GOOD; case CAIRO_DITHER_BEST: return PIXMAN_DITHER_BEST; + case CAIRO_DITHER_NONE: + case CAIRO_DITHER_DEFAULT: + default: + return PIXMAN_DITHER_NONE; } } #endif @@ -951,7 +951,7 @@ _cairo_image_surface_paint (void *abstract_surface, const cairo_clip_t *clip) { cairo_image_surface_t *surface = abstract_surface; - pixman_dither_t pixman_dither = _pixman_dither_from_cairo_dither(source->dither); + pixman_dither_t pixman_dither = _cairo_dither_to_pixman_dither (source->dither); pixman_image_set_dither (surface->pixman_image, pixman_dither); TRACE ((stderr, "%s (surface=%d)\n", diff --git a/src/cairoint.h b/src/cairoint.h index 85636d826..cac7f56d4 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -1606,11 +1606,6 @@ cairo_private cairo_bool_t _pixman_format_to_masks (pixman_format_code_t pixman_format, cairo_format_masks_t *masks); -#if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0,39,0) -cairo_private pixman_dither_t -_pixman_dither_from_cairo_dither (cairo_dither_t dither); -#endif - cairo_private void _cairo_image_scaled_glyph_fini (cairo_scaled_font_t *scaled_font,