Only use PIXMAN_r8g8b8_sRGB if available

Pixman 0.42.3 added PIXMAN_r8g8b8_sRGB to pixman_format_code_t. CI
fails if it is missing from switch statements. Building with pixman <
0.42.3 will fail if the enum is used. So put it in a versioned #if.
This commit is contained in:
Adrian Johnson 2024-05-21 19:47:55 +09:30
parent 54cbe51481
commit 3d46485365
2 changed files with 7 additions and 1 deletions

View file

@ -643,6 +643,9 @@ pixman_dep = dependency('pixman-1',
if pixman_dep.found()
feature_conf.set('CAIRO_HAS_IMAGE_SURFACE', 1)
conf.set('HAS_PIXMAN_GLYPHS', 1)
if pixman_dep.version().version_compare('>= 0.42.3')
conf.set('HAS_PIXMAN_r8g8b8_sRGB', 1)
endif
if pixman_dep.type_name() == 'internal'
internal_deps += [pixman_dep]
else

View file

@ -110,7 +110,10 @@ _cairo_format_from_pixman_format (pixman_format_code_t pixman_format)
case PIXMAN_r5g6b5:
return CAIRO_FORMAT_RGB16_565;
case PIXMAN_r8g8b8a8: case PIXMAN_r8g8b8x8:
case PIXMAN_a8r8g8b8_sRGB: case PIXMAN_r8g8b8_sRGB:
case PIXMAN_a8r8g8b8_sRGB:
#if HAS_PIXMAN_r8g8b8_sRGB
case PIXMAN_r8g8b8_sRGB:
#endif
case PIXMAN_a8b8g8r8: case PIXMAN_x8b8g8r8: case PIXMAN_r8g8b8:
case PIXMAN_b8g8r8: case PIXMAN_b5g6r5:
case PIXMAN_a1r5g5b5: case PIXMAN_x1r5g5b5: case PIXMAN_a1b5g5r5: