diff -Nru mapcache-1.12.0/CMakeLists.txt mapcache-1.12.1/CMakeLists.txt --- mapcache-1.12.0/CMakeLists.txt 2022-01-27 19:52:39.000000000 +0000 +++ mapcache-1.12.1/CMakeLists.txt 2022-03-24 13:10:09.000000000 +0000 @@ -13,7 +13,7 @@ set (MAPCACHE_VERSION_MAJOR 1) set (MAPCACHE_VERSION_MINOR 12) -set (MAPCACHE_VERSION_REVISION 0) +set (MAPCACHE_VERSION_REVISION 1) if(NOT DEFINED CMAKE_INSTALL_LIBDIR) set(CMAKE_INSTALL_LIBDIR lib) diff -Nru mapcache-1.12.0/debian/changelog mapcache-1.12.1/debian/changelog --- mapcache-1.12.0/debian/changelog 2022-02-23 04:50:31.000000000 +0000 +++ mapcache-1.12.1/debian/changelog 2022-12-05 08:00:00.000000000 +0000 @@ -1,3 +1,15 @@ +mapcache (1.12.1-1~jammy0) jammy; urgency=medium + + * No change rebuild for Jammy. + + -- Angelos Tzotsos Mon, 05 Dec 2022 10:00:00 +0200 + +mapcache (1.12.1-1) unstable; urgency=medium + + * New upstream release. + + -- Bas Couwenberg Thu, 24 Mar 2022 16:30:40 +0100 + mapcache (1.12.0-1) unstable; urgency=medium * New upstream release. diff -Nru mapcache-1.12.0/.github/workflows/build-windows.yml mapcache-1.12.1/.github/workflows/build-windows.yml --- mapcache-1.12.0/.github/workflows/build-windows.yml 2022-01-27 19:52:39.000000000 +0000 +++ mapcache-1.12.1/.github/workflows/build-windows.yml 2022-03-24 13:10:09.000000000 +0000 @@ -98,7 +98,7 @@ $env:PATH_INFO = "/wmts/1.0.0/global/default/GoogleMapsCompatible/0/0/0.jpg" $env:QUERY_STRING = "" Start-Process -FilePath ".\mapcache.fcgi.exe" -RedirectStandardOutput "${{github.workspace}}\fcgi.jpg" -NoNewWindow -Wait - perl.exe -0777 -pi -e 'binmode ARGV;binmode ARGVOUT;s/[A-Z][-:; ,\/=A-Za-z0-9]*\r\n//g;s/\r\n//' "${{github.workspace}}\fcgi.jpg" + perl.exe -0777 -pi -e 'binmode ARGV;binmode ARGVOUT;s/[A-Z][a-z][-:; ,\/=A-Za-z0-9\r\n]*//' "${{github.workspace}}\fcgi.jpg" $match = (.\gdal\apps\gdalinfo.exe -checksum "${{github.workspace}}\fcgi.jpg" | Select-String -CaseSensitive -Pattern "Checksum=21336" -Quiet) if ( $match ) { "Success" diff -Nru mapcache-1.12.0/lib/source_gdal.c mapcache-1.12.1/lib/source_gdal.c --- mapcache-1.12.0/lib/source_gdal.c 2022-01-27 19:52:39.000000000 +0000 +++ mapcache-1.12.1/lib/source_gdal.c 2022-03-24 13:10:09.000000000 +0000 @@ -465,6 +465,11 @@ return hDstDS; } +#define PREMULTIPLY(out,color,alpha)\ +{\ + int temp = ((alpha) * (color)) + 0x80;\ + out =((temp + (temp >> 8)) >> 8);\ +} /** * \private \memberof mapcache_source_gdal @@ -478,6 +483,9 @@ GDALDatasetH hTmpDS = NULL; mapcache_buffer *data; unsigned char *rasterdata; + unsigned char* rowptr; + unsigned char** row_pointers; + int i, j; CPLErr eErr; mapcache_pooled_connection *pc = NULL; int bands_bgra[] = { 3, 2, 1, 4 }; /* mapcache buffer order is BGRA */ @@ -587,9 +595,41 @@ map->raw_image->w = map->width; map->raw_image->h = map->height; map->raw_image->stride = map->width * 4; - map->raw_image->data = rasterdata; map->raw_image->has_alpha = MC_ALPHA_UNKNOWN; + // Handling of premulitiplication for GDAL sources. + // Since the data is already in BGRA order, there is no need to swap the bytes around. + + row_pointers = malloc(map->raw_image->h * sizeof(unsigned char*)); + apr_pool_cleanup_register(ctx->pool, row_pointers, (void*)free, apr_pool_cleanup_null); + + rowptr = rasterdata; + for(i = 0; i < map->raw_image->h; i++) { + row_pointers[i] = rowptr; + rowptr += map->raw_image->stride; + } + + for(i = 0; i < map->raw_image->h; i++) { + unsigned char pixel[4]; + unsigned char alpha; + unsigned char* pixptr = row_pointers[i]; + for(j = 0; j < map->raw_image->w; j++) { + memcpy(pixel, pixptr, sizeof(unsigned int)); + alpha = pixel[3]; + if(alpha == 0) { + pixptr[0] = 0; + pixptr[1] = 0; + pixptr[2] = 0; + } else if (alpha < 255) { + PREMULTIPLY(pixptr[0], pixel[0], alpha); + PREMULTIPLY(pixptr[1], pixel[1], alpha); + PREMULTIPLY(pixptr[2], pixel[2], alpha); + } + pixptr += 4; + } + } + + map->raw_image->data = rasterdata; GDALClose( hDstDS ); /* close first this one, as it references hTmpDS or hSrcDS */ if( hTmpDS ) GDALClose(hTmpDS); /* references hSrcDS, so close before */