[mapserver-commits] r11549 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Wed Apr 13 06:09:54 EDT 2011
Author: tbonfort
Date: 2011-04-13 03:09:54 -0700 (Wed, 13 Apr 2011)
New Revision: 11549
Modified:
trunk/mapserver/HISTORY.TXT
trunk/mapserver/mapcairo.c
trunk/mapserver/mapdraw.c
Log:
fix crash/corruptions with raster layers in pdf outputs (#3799)
Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT 2011-04-12 17:59:26 UTC (rev 11548)
+++ trunk/mapserver/HISTORY.TXT 2011-04-13 10:09:54 UTC (rev 11549)
@@ -15,6 +15,8 @@
Current Version (SVN trunk):
----------------------------
+- fix crash/corruptions with raster layers in pdf outputs (#3799)
+
- fix memory leak in msFreeLabelCacheSlot (#3829)
- use a circle brush for wide GD lines (#3835)
Modified: trunk/mapserver/mapcairo.c
===================================================================
--- trunk/mapserver/mapcairo.c 2011-04-12 17:59:26 UTC (rev 11548)
+++ trunk/mapserver/mapcairo.c 2011-04-13 10:09:54 UTC (rev 11549)
@@ -666,17 +666,22 @@
int startLayerVectorCairo(imageObj *img, mapObj *map, layerObj *layer) {
- cairo_renderer *r = CAIRO_RENDERER(img);
- cairo_push_group (r->cr);
- return MS_SUCCESS;
+ if(layer->opacity != 100) {
+ cairo_renderer *r = CAIRO_RENDERER(img);
+ cairo_push_group (r->cr);
+ }
+ return MS_SUCCESS;
}
int closeLayerVectorCairo(imageObj *img, mapObj *map, layerObj *layer) {
- cairo_renderer *r = CAIRO_RENDERER(img);
- cairo_pop_group_to_source (r->cr);
- cairo_paint_with_alpha (r->cr, layer->opacity*0.01);
- return MS_SUCCESS;
+ if(layer->opacity != 100) {
+ cairo_renderer *r = CAIRO_RENDERER(img);
+ cairo_pop_group_to_source (r->cr);
+ cairo_paint_with_alpha (r->cr, layer->opacity*0.01);
+ }
+ return MS_SUCCESS;
}
+
int startLayerRasterCairo(imageObj *img, mapObj *map, layerObj *layer) {
return MS_SUCCESS;
}
@@ -752,6 +757,8 @@
cairo_set_source_surface (r->cr,src,0,0);
cairo_paint_with_alpha(r->cr,opacity);
}
+ cairo_surface_finish(src);
+ cairo_surface_destroy(src);
return MS_SUCCESS;
}
@@ -763,6 +770,7 @@
cairo_path_destroy(s->renderer_cache);
break;
case MS_SYMBOL_PIXMAP:
+ cairo_surface_finish(s->renderer_cache);
cairo_surface_destroy(s->renderer_cache);
break;
}
Modified: trunk/mapserver/mapdraw.c
===================================================================
--- trunk/mapserver/mapdraw.c 2011-04-12 17:59:26 UTC (rev 11548)
+++ trunk/mapserver/mapdraw.c 2011-04-13 10:09:54 UTC (rev 11549)
@@ -1216,34 +1216,33 @@
{
rendererVTableObj *renderer = MS_IMAGE_RENDERER(image);
- rasterBufferObj rb;
+ rasterBufferObj *rb = msSmallCalloc(1,sizeof(rasterBufferObj));
int ret;
- memset(&rb,0,sizeof(rasterBufferObj));
if( renderer->supports_pixel_buffer )
{
- if (MS_SUCCESS != renderer->getRasterBufferHandle( image, &rb )) {
+ if (MS_SUCCESS != renderer->getRasterBufferHandle( image, rb )) {
msSetError(MS_MISCERR,"renderer failed to extract raster buffer","msDrawRasterLayer()");
return MS_FAILURE;
}
- ret = msDrawRasterLayerLow( map, layer, image, &rb );
+ ret = msDrawRasterLayerLow( map, layer, image, rb );
}
else
{
- if (MS_SUCCESS != renderer->initializeRasterBuffer( &rb, image->width, image->height, MS_IMAGEMODE_RGBA )) {
+ if (MS_SUCCESS != renderer->initializeRasterBuffer( rb, image->width, image->height, MS_IMAGEMODE_RGBA )) {
msSetError(MS_MISCERR,"renderer failed to create raster buffer","msDrawRasterLayer()");
return MS_FAILURE;
}
- ret = msDrawRasterLayerLow( map, layer, image, &rb );
+ ret = msDrawRasterLayerLow( map, layer, image, rb );
if( ret == 0 )
{
- renderer->mergeRasterBuffer( image, &rb, 1.0, 0, 0, 0, 0, rb.width, rb.height );
+ renderer->mergeRasterBuffer( image, rb, 1.0, 0, 0, 0, 0, rb->width, rb->height );
}
- msFreeRasterBuffer(&rb);
+ msFreeRasterBuffer(rb);
+ free(rb);
-
}
#define RB_GET_R(rb,x,y) *((rb)->data.rgba.r + (x) * (rb)->data.rgba.pixel_step + (y) * (rb)->data.rgba.row_step)
#define RB_GET_G(rb,x,y) *((rb)->data.rgba.g + (x) * (rb)->data.rgba.pixel_step + (y) * (rb)->data.rgba.row_step)
More information about the mapserver-commits
mailing list