[mapserver-commits] r12456 - trunk/mapserver/mapcache/src

svn at osgeo.org svn at osgeo.org
Fri Aug 26 07:28:01 EDT 2011


Author: tbonfort
Date: 2011-08-26 04:28:00 -0700 (Fri, 26 Aug 2011)
New Revision: 12456

Modified:
   trunk/mapserver/mapcache/src/image.c
Log:


Modified: trunk/mapserver/mapcache/src/image.c
===================================================================
--- trunk/mapserver/mapcache/src/image.c	2011-08-26 11:27:56 UTC (rev 12455)
+++ trunk/mapserver/mapcache/src/image.c	2011-08-26 11:28:00 UTC (rev 12456)
@@ -44,14 +44,30 @@
 }
 
 void geocache_image_merge(geocache_context *ctx, geocache_image *base, geocache_image *overlay) {
-   int i,j,starti,startj;
-   unsigned char *browptr, *orowptr, *bptr, *optr;
+   int starti,startj;
    if(base->w < overlay->w || base->h < overlay->h) {
       ctx->set_error(ctx, 500, "attempting to merge an larger image onto another");
       return;
    }
    starti = (base->h - overlay->h)/2;
    startj = (base->w - overlay->w)/2;
+#ifdef USE_PIXMAN
+   pixman_image_t *si = pixman_image_create_bits(PIXMAN_a8r8g8b8,overlay->w,overlay->h,
+         (uint32_t*)overlay->data,overlay->stride);
+   pixman_image_t *bi = pixman_image_create_bits(PIXMAN_a8r8g8b8,base->w,base->h,
+         (uint32_t*)base->data,base->stride);
+   pixman_transform_t transform;
+   pixman_transform_init_translate(&transform,
+         pixman_int_to_fixed(-startj),
+         pixman_int_to_fixed(-starti));
+   pixman_image_set_filter(si,PIXMAN_FILTER_NEAREST, NULL, 0);
+   pixman_image_composite32 (PIXMAN_OP_OVER, si, si, bi,
+                            0, 0, 0, 0, 0, 0, base->w,base->h);
+   pixman_image_unref(si);
+   pixman_image_unref(bi);
+#else
+   int i,j;
+   unsigned char *browptr, *orowptr, *bptr, *optr;
 
    browptr = base->data + starti * base->stride + startj*4;
    orowptr = overlay->data;
@@ -85,6 +101,7 @@
       browptr += base->stride;
       orowptr += overlay->stride;
    }
+#endif
 }
 
 #ifndef USE_PIXMAN



More information about the mapserver-commits mailing list