Permalink
Browse files

add support for GD renderer in raster masking

  • Loading branch information...
1 parent ccc9c72 commit 8f53e69a583899f7f389adb65179f793e07e11af @tbonfort tbonfort committed Sep 7, 2012
Showing with 15 additions and 0 deletions.
  1. +3 −0 mapdraw.c
  2. +12 −0 mapdrawgdal.c
View
@@ -777,6 +777,9 @@ int msDrawLayer(mapObj *map, layerObj *layer, imageObj *image)
} else if (MS_RENDERER_PLUGIN(image_draw->format)) {
rendererVTableObj *renderer = MS_IMAGE_RENDERER(image_draw);
if ((layer->mask && layer->connectiontype!=MS_WMS && layer->type != MS_LAYER_RASTER) || (layer->opacity > 0 && layer->opacity < 100)) {
+ /* masking occurs at the pixel/layer level for raster images, so we don't need to create a temporary image
+ in these cases
+ */
if (layer->mask || !renderer->supports_transparent_layers) {
image_draw = msImageCreate(image->width, image->height,
image->format, image->imagepath, image->imageurl, map->resolution, map->defresolution, NULL);
View
@@ -818,6 +818,9 @@ int msDrawRasterLayerGDAL(mapObj *map, layerObj *layer, imageObj *image,
alpha = pabyRawAlpha[k];
result = cmap[pabyRaw1[k++]];
+ if(SKIP_MASK(j,i)) {
+ continue;
+ }
/*
** We don't do alpha blending in non-truecolor mode, just
@@ -844,6 +847,9 @@ int msDrawRasterLayerGDAL(mapObj *map, layerObj *layer, imageObj *image,
for( j = dst_xoff; j < dst_xoff + dst_xsize; j++ ) {
result = cmap[pabyRaw1[k++]];
+ if(SKIP_MASK(j,i)) {
+ continue;
+ }
if( result != -1 ) {
rb->data.gd_img->pixels[i][j] = result;
}
@@ -992,6 +998,9 @@ int msDrawRasterLayerGDAL(mapObj *map, layerObj *layer, imageObj *image,
k = 0;
for( i = dst_yoff; i < dst_yoff + dst_ysize; i++ ) {
for( j = dst_xoff; j < dst_xoff + dst_xsize; j++, k++ ) {
+ if(SKIP_MASK(j,i)) {
+ continue;
+ }
if( MS_VALID_COLOR( layer->offsite )
&& pabyRaw1[k] == layer->offsite.red
&& pabyRaw2[k] == layer->offsite.green
@@ -1020,6 +1029,9 @@ int msDrawRasterLayerGDAL(mapObj *map, layerObj *layer, imageObj *image,
for( i = dst_yoff; i < dst_yoff + dst_ysize; i++ ) {
for( j = dst_xoff; j < dst_xoff + dst_xsize; j++, k++ ) {
int cc_index;
+ if(SKIP_MASK(j,i)) {
+ continue;
+ }
if( MS_VALID_COLOR( layer->offsite )
&& pabyRaw1[k] == layer->offsite.red

0 comments on commit 8f53e69

Please sign in to comment.