[Git][debian-gis-team/mapcache][upstream] New upstream version 1.12.1
Bas Couwenberg (@sebastic)
gitlab at salsa.debian.org
Thu Mar 24 15:44:30 GMT 2022
Bas Couwenberg pushed to branch upstream at Debian GIS Project / mapcache
Commits:
26d8bd98 by Bas Couwenberg at 2022-03-24T16:28:15+01:00
New upstream version 1.12.1
- - - - -
3 changed files:
- .github/workflows/build-windows.yml
- CMakeLists.txt
- lib/source_gdal.c
Changes:
=====================================
.github/workflows/build-windows.yml
=====================================
@@ -98,7 +98,7 @@ jobs:
$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"
=====================================
CMakeLists.txt
=====================================
@@ -13,7 +13,7 @@ endif ()
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)
=====================================
lib/source_gdal.c
=====================================
@@ -465,6 +465,11 @@ CreateWarpedVRT( GDALDatasetH hSrcDS,
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 @@ void _mapcache_source_gdal_render_metatile(mapcache_context *ctx, mapcache_sourc
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 @@ void _mapcache_source_gdal_render_metatile(mapcache_context *ctx, mapcache_sourc
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 */
View it on GitLab: https://salsa.debian.org/debian-gis-team/mapcache/-/commit/26d8bd988821aed26fc271d8e20c3f938aa15d98
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/mapcache/-/commit/26d8bd988821aed26fc271d8e20c3f938aa15d98
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20220324/a0fa669d/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list