Commit 220a777c authored by Bas Couwenberg's avatar Bas Couwenberg

New upstream version 7.2.0~beta1

parent a6d472c5
......@@ -16,9 +16,9 @@ include(CheckCSourceCompiles)
set (MapServer_VERSION_MAJOR 7)
set (MapServer_VERSION_MINOR 0)
set (MapServer_VERSION_REVISION 7)
set (MapServer_VERSION_SUFFIX "")
set (MapServer_VERSION_MINOR 2)
set (MapServer_VERSION_REVISION 0)
set (MapServer_VERSION_SUFFIX "-beta1")
set(TARGET_VERSION_MAJOR ${MapServer_VERSION_MAJOR})
set(TARGET_VERSION_MINOR ${MapServer_VERSION_MINOR})
......@@ -92,7 +92,6 @@ endif(NOT(WIN32))
check_function_exists("strrstr" HAVE_STRRSTR)
check_function_exists("strcasecmp" HAVE_STRCASECMP)
check_function_exists("strcasestr" HAVE_STRCASESTR)
check_function_exists("strdup" HAVE_STRDUP)
check_function_exists("strlcat" HAVE_STRLCAT)
check_function_exists("strlcpy" HAVE_STRLCPY)
check_function_exists("strlen" HAVE_STRLEN)
......@@ -117,6 +116,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
#options suported by the cmake builder
option(WITH_PROJ "Choose if reprojection support should be built in" ON)
option(WITH_PROTOBUFC "Choose if protocol buffers support should be built in (required for vector tiles)" ON)
option(WITH_KML "Enable native KML output support (requires libxml2 support)" OFF)
option(WITH_SOS "Enable SOS Server support (requires PROJ and libxml2 support)" OFF)
option(WITH_WMS "Enable WMS Server support (requires proj support)" ON)
......@@ -166,8 +166,8 @@ option(WITH_GENERIC_NINT "generic rounding" OFF)
# Add compiler flags for warnings
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wdeclaration-after-statement")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror=format-security -Wdeclaration-after-statement")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror=format-security")
endif()
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
......@@ -258,11 +258,12 @@ mapprojhack.c maptree.c mapdebug.c maplexer.c mapquantization.c mapunion.c
mapdraw.c maplibxml2.c mapquery.c maputil.c strptime.c mapdrawgdal.c
mapraster.c mapuvraster.c mapdummyrenderer.c mapobject.c maprasterquery.c
mapwcs.c maperror.c mapogcfilter.c mapregex.c mapwcs11.c mapfile.c
mapogcfiltercommon.c maprendering.c mapwcs20.c mapogcsld.c
mapogcfiltercommon.c maprendering.c mapwcs20.c mapogcsld.c mapmetadata.c
mapresample.c mapwfs.c mapgdal.c mapogcsos.c mapscale.c mapwfs11.c mapwfs20.c
mapgeomtransform.c mapogroutput.c mapwfslayer.c mapagg.cpp mapkml.cpp
mapgeomutil.cpp mapkmlrenderer.cpp fontcache.c textlayout.c maputfgrid.cpp
mapogr.cpp mapcontour.c mapsmoothing.c mapv8.cpp ${REGEX_SOURCES} kerneldensity.c)
mapogr.cpp mapcontour.c mapsmoothing.c mapv8.cpp ${REGEX_SOURCES} kerneldensity.c
mapcompositingfilter.c mapmvt.c)
set(mapserver_HEADERS
cgiutil.h dejavu-sans-condensed.h dxfcolor.h fontcache.h hittest.h mapagg.h
......@@ -273,8 +274,39 @@ mappostgis.h mapprimitive.h mapproject.h mapraster.h mapregex.h mapresample.h
mapserver-api.h mapserver.h mapserv.h mapshape.h mapsymbol.h maptemplate.h
mapthread.h maptile.h maptime.h maptree.h maputfgrid.h mapwcs.h uthash.h)
if(WIN32)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/version.rc.in
${CMAKE_CURRENT_BINARY_DIR}/version.rc
@ONLY)
set(mapserver_SOURCES ${mapserver_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
endif(WIN32)
if(WITH_PROTOBUFC)
find_package(ProtobufC)
if(NOT PROTOBUFC_FOUND)
report_optional_not_found(PROTOBUFC)
else(NOT PROTOBUFC_FOUND)
list(APPEND ALL_INCLUDE_DIRS ${PROTOBUFC_INCLUDE_DIR})
FILE(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/renderers/mvt)
# Create custom command for protoc-c
ADD_CUSTOM_COMMAND(
COMMAND ${PROTOBUFC_COMPILER}
ARGS --c_out=${PROJECT_BINARY_DIR}/renderers/mvt --proto_path=${PROJECT_SOURCE_DIR}/renderers/mvt ${PROJECT_SOURCE_DIR}/renderers/mvt/vector_tile.proto
OUTPUT ${PROJECT_BINARY_DIR}/renderers/mvt/vector_tile.pb-c.c ${PROJECT_BINARY_DIR}/renderers/mvt/vector_tile.pb-c.h
)
SET_SOURCE_FILES_PROPERTIES(${PROJECT_BINARY_DIR}/renderers/mvt/vector_tile.pb-c.h ${PROJECT_BINARY_DIR}/renderers/mvt/vector_tile.pb-c.c GENERATED)
set (vectortile_SOURCES ${PROJECT_BINARY_DIR}/renderers/mvt/vector_tile.pb-c.c)
set (USE_PBF 1)
endif(NOT PROTOBUFC_FOUND)
endif (WITH_PROTOBUFC)
if(BUILD_DYNAMIC)
add_library(mapserver SHARED ${mapserver_SOURCES} ${agg_SOURCES} ${v8_SOURCES})
add_library(mapserver SHARED ${vectortile_SOURCES} ${mapserver_SOURCES} ${agg_SOURCES} ${v8_SOURCES})
set_target_properties( mapserver PROPERTIES
VERSION ${MapServer_VERSION_STRING}
SOVERSION 2
......@@ -282,7 +314,7 @@ if(BUILD_DYNAMIC)
endif(BUILD_DYNAMIC)
if(BUILD_STATIC)
add_library(mapserver_static STATIC ${mapserver_SOURCES} ${agg_SOURCES} ${v8_SOURCES})
add_library(mapserver_static STATIC ${vectortile_SOURCES} ${mapserver_SOURCES} ${agg_SOURCES} ${v8_SOURCES})
set_target_properties( mapserver_static PROPERTIES
VERSION ${MapServer_VERSION_STRING}
SOVERSION 2
......@@ -363,6 +395,12 @@ if(WITH_PROJ)
endif(NOT PROJ_FOUND)
endif (WITH_PROJ)
if(USE_PBF)
include_directories(${PROJECT_BINARY_DIR}/renderers/mvt)
include_directories(${PROTOBUFC_INCLUDE_DIR})
ms_link_libraries( ${PROTOBUFC_LIBRARY})
endif()
if(WITH_PIXMAN)
find_package(Pixman)
if(PIXMAN_FOUND)
......@@ -914,6 +952,7 @@ status_optional_component("LIBXML2" "${USE_LIBXML2}" "${LIBXML2_LIBRARY}")
status_optional_component("POSTGIS" "${USE_POSTGIS}" "${POSTGRESQL_LIBRARY}")
status_optional_component("GEOS" "${USE_GEOS}" "${GEOS_LIBRARY}")
status_optional_component("FastCGI" "${USE_FASTCGI}" "${FCGI_LIBRARY}")
status_optional_component("PROTOBUFC" "${USE_PBF}" "${PROTOBUFC_LIBRARY}")
if(USE_ORACLESPATIAL OR USE_ORACLE_PLUGIN)
if(USE_ORACLESPATIAL)
status_optional_component("Oracle Spatial" "${USE_ORACLESPATIAL}" "${ORACLE_LIBRARY}")
......
# How to contribute to MapServer
Contributions to the MapServer project are most welcome, and can take many forms such as detailed bug reports, documentation,
tests, features, and patches.
## Bugs and Help
GitHub issues should only be created to log bugs. For general help and support the MapServer [mailing lists](http://mapserver.org/community/lists.html)
should be used. If you are unsure if you have discovered a bug, or may need help with configuring MapServer please
post to the [mapserver-users list](http://lists.osgeo.org/mailman/listinfo/mapserver-users). There is also
a [MapServer FAQ](http://www.mapserver.org/faq.html) which may have a solution to your problem.
If you have discovered a bug, please refer to the [Bug Submission page](http://mapserver.org/development/bugs.html) for
guidelines on creating an issue on GitHub. Please also search the existing issues to see if the bug has already been reported, and
add any further details to the existing issue.
For professional support please see the [MapServer Service Providers page](http://mapserver.org/community/service_providers.html).
## Development
A seperate [mapserver-dev mailing list](http://lists.osgeo.org/mailman/listinfo/mapserver-dev) is available for developers
working on the MapServer code.
Details on using GitHub can be found on the [MapServer GutHub page](http://mapserver.org/development/git.html)
Additional developer notes can be found in the [MapServer wiki](https://github.com/mapserver/mapserver/wiki#developer-notes), including
coding style and guidelines, memory management, and working with Git.
## Documentation
The MapServer documentation is stored in a [seperate repository](https://github.com/mapserver/docs). Please submit any documentation
issues or changes there. See the [Documentation Development Guide](http://mapserver.org/development/documentation.html) for further details.
......@@ -12,6 +12,33 @@ For a complete change history, please see the Git log comments. For more
details about recent point releases, please see the online changelog at:
http://mapserver.org/development/changelog/
7.2.0-beta1 release (2018-5-9)
--------------------
- Support for Enhanced Layer Metadata Management (RFC82)
- Calculate MINDISTANCE from label bounds instead of label center (#5369)
- Reposition follow labels on maxoverlapangle colisions (RFC112)
- Implement chainable compositing filters (RFC113)
- Faster retrieval of shape count (RFC114)
- WMS layer groups are now requestable
- Support C-style multi-line content types (#5362)
- PHP 7 MapScript Support Through SWIG (RFC117)
- Python 3.x support (#5561)
- Support Vendor-Specific OGC FILTER parameter in WMS requests (RFC118)
- Mapbox Vector Tile (MVT) Support (RFC119)
- INSPIRE download service support for WCS 2.0 (RFC120)
7.0.0 release (2015/07/24)
--------------------------
......@@ -1630,7 +1657,7 @@ Version 5.4.0-beta1 (2009-2-18):
- Fixed a scalebar rounding problem causing to draw zero scalebar width (#2890)
- SLD: if it conatins a Filer Encoding tag, try to always set the
- SLD: if it contains a Filter Encoding tag, try to always set the
layer's FILTER element (#2889)
- Add support for rendering INLINE layers with layer attributes (items) (#2870)
......
......@@ -67,7 +67,7 @@ License
::
Copyright (c) 2008-2017 Open Source Geospatial Foundation.
Copyright (c) 2008-2018 Open Source Geospatial Foundation.
Copyright (c) 1996-2008 Regents of the University of Minnesota.
Permission is hereby granted, free of charge, to any person obtaining a copy
......
......@@ -40,7 +40,7 @@ static int
msIO_apacheError (void *cbData, void *data, int byteCount)
{
/* error reporting is done through the log file... */
ap_log_error (APLOG_MARK, APLOG_ERR, 0, NULL, (char*) data);
ap_log_error (APLOG_MARK, APLOG_ERR, 0, NULL, "%s", (char*) data);
return strlen ((char*) data);
}
......
# - Find protobuf-c
# Find protobuf c implementation libraries, includes and the protoc-c compiler
# FindProtobufC was loosely based on FindProtobuf that is shipped with cmake
#
# Module defines:
# PROTOBUFC_FOUND - library, includes and compiler where found
# PROTOBUFC_INCLUDE_DIRS - include directories
# PROTOBUFC_LIBRARIES - protobuf-c libraries
# PROTOBUFC_EXECUTEABLE - protobuf-c compiler
#
# Environment variables:
# PROTOBUFC_ROOTDIR - optional - rootdir of protobuf-c installation
#
# Cache entries:
# PROTOBUFC_LIBRARY - detected protobuf-c library
# PROTOBUF_INCLUDE_DIR - detected protobuf-c include dir(s)
# PROTOBUF_COMPILER - detected protobuf-c compiler
#
####
#
# ====================================================================
# Example:
#
# find_package(ProtobufC REQUIRED)
# include_directories(${PROTOBUFC_INCLUDE_DIRS})
# include_directories(${CMAKE_CURRENT_BINARY_DIR})
# PROTOBUFC_GENERATE_C(PROTO_SOURCES PROTO_HEADERS protobuf.proto)
# add_executable(bar bar.c ${PROTO_SRCn} ${PROTO_HDRS})
# target_link_libraries(bar ${PROTOBUF_LIBRARIES})
#
# NOTE: You may need to link against pthreads, depending
# on the platform.
#
# NOTE: The PROTOBUF_GENERATE_CPP macro & add_executable() or add_library()
# calls only work properly within the same directory.
#
# ====================================================================
#=============================================================================
# Copyright 2013 Thinstuff Technologies GmbH
# Copyright 2013 Bernhard Miklautz <bmiklautz@thinstuff.at>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#=============================================================================
set(PROTBUFC_SOURCE_EXTENSION "pb-c.c")
set(PROTBUFC_HEADER_EXTENSION "pb-c.h")
function(PROTOBUFC_GENERATE_C SOURCES HEADERS)
if(NOT ARGN)
message(SEND_ERROR "Error: PROTOBUFC_GENERATE_C() called without any proto files")
return()
endif(NOT ARGN)
foreach(FIL ${ARGN})
get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
get_filename_component(FIL_WE ${FIL} NAME_WE)
get_filename_component(FIL_PATH ${ABS_FIL} PATH)
list(APPEND ${SOURCES} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.${PROTBUFC_SOURCE_EXTENSION}")
list(APPEND ${HEADERS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.${PROTBUFC_HEADER_EXTENSION}")
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.${PROTBUFC_SOURCE_EXTENSION}"
"${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.${PROTBUFC_HEADER_EXTENSION}"
COMMAND ${PROTOBUFC_COMPILER}
ARGS --c_out ${CMAKE_CURRENT_BINARY_DIR} -I ${CMAKE_CURRENT_SOURCE_DIR} -I ${FIL_PATH} ${ABS_FIL}
DEPENDS ${ABS_FIL}
COMMENT "Running protobuf-c compiler on ${FIL}"
VERBATIM )
endforeach()
set_source_files_properties(${${SOURCES}} ${${HEADERS}} PROPERTIES GENERATED TRUE)
set(${SOURCES} ${${SOURCES}} PARENT_SCOPE)
set(${HEADERS} ${${HEADERS}} PARENT_SCOPE)
endfunction()
find_library(PROTOBUFC_LIBRARY
NAMES "protobuf-c"
PATHS "/usr" "/usr/local" "/opt" ENV PROTOBUFC_ROOTDIR
PATH_SUFFIXES "lib")
mark_as_advanced(PROTOBUFC_LIBRARY)
find_path(PROTOBUFC_INCLUDE_DIR
NAMES "google/protobuf-c/protobuf-c.h"
PATHS "/usr" "/usr/local" "/opt" ENV PROTOBUFC_ROOTDIR
PATH_SUFFIXES "include")
mark_as_advanced(PROTOBUFC_INCLUDE_DIR)
find_program(PROTOBUFC_COMPILER
NAMES "protoc-c"
PATHS "/usr" "/usr/local" "/opt" ENV PROTOBUFC_ROOTDIR
PATH_SUFFIXES "bin")
mark_as_advanced(PROTOBUFC_COMPILER)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ProtobufC DEFAULT_MSG PROTOBUFC_LIBRARY PROTOBUFC_COMPILER PROTOBUFC_INCLUDE_DIR )
if (PROTOBUFC_FOUND)
set(PROTOBUFC_LIBRARIES ${PROTOBUFC_LIBRARY})
set(PROTOBUFC_INCLUDE_DIRS ${PROTOBUFC_INCLUDE_DIR})
set(PROTOBUFC_EXECUTEABLE ${PROTOBUFC_COMPILER})
endif(PROTOBUFC_FOUND)
......@@ -46,6 +46,7 @@ struct ft_thread_cache{
ft_cache cache;
};
ft_thread_cache *ft_caches;
int use_global_ft_cache;
#else
ft_cache global_ft_cache;
#endif
......@@ -102,9 +103,12 @@ ft_cache* msGetFontCache() {
#ifndef USE_THREAD
return &global_ft_cache;
#else
void* nThreadId = msGetThreadId();
void* nThreadId = 0;
ft_thread_cache *prev = NULL, *cur = ft_caches;
if (!use_global_ft_cache)
nThreadId = msGetThreadId();
if( cur != NULL && cur->thread_id == nThreadId )
return &cur->cache;
......@@ -155,6 +159,12 @@ void msFontCacheSetup() {
ft_cache *c = msGetFontCache();
msInitFontCache(c);
#else
char* use_global_cache = getenv("MS_USE_GLOBAL_FT_CACHE");
if (use_global_cache)
use_global_ft_cache = atoi(use_global_cache);
else
use_global_ft_cache = 0;
ft_caches = NULL;
#endif
}
......@@ -202,15 +212,23 @@ face_element* msGetFontFace(char *key, fontSetObj *fontset) {
if(!key) {
key = MS_DEFAULT_FONT_KEY;
}
#ifdef USE_THREAD
if (use_global_ft_cache)
msAcquireLock(TLOCK_TTF);
#endif
UT_HASH_FIND_STR(cache->face_cache,key,fc);
if(!fc) {
char *fontfile = NULL;
const char *fontfile = NULL;
fc = msSmallCalloc(1,sizeof(face_element));
if(fontset && strcmp(key,MS_DEFAULT_FONT_KEY)) {
fontfile = msLookupHashTable(&(fontset->fonts),key);
if(!fontfile) {
msSetError(MS_MISCERR, "Could not find font with key \"%s\" in fontset", "msGetFontFace()", key);
free(fc);
#ifdef USE_THREAD
if (use_global_ft_cache)
msReleaseLock(TLOCK_TTF);
#endif
return NULL;
}
error = FT_New_Face(cache->library,fontfile,0, &(fc->face));
......@@ -220,6 +238,10 @@ face_element* msGetFontFace(char *key, fontSetObj *fontset) {
if(error) {
msSetError(MS_MISCERR, "Freetype was unable to load font file \"%s\" for key \"%s\"", "msGetFontFace()", fontfile, key);
free(fc);
#ifdef USE_THREAD
if (use_global_ft_cache)
msReleaseLock(TLOCK_TTF);
#endif
return NULL;
}
if(!fc->face->charmap) {
......@@ -231,7 +253,10 @@ face_element* msGetFontFace(char *key, fontSetObj *fontset) {
fc->font = msStrdup(key);
UT_HASH_ADD_KEYPTR(hh,cache->face_cache,fc->font, strlen(key), fc);
}
#ifdef USE_THREAD
if (use_global_ft_cache)
msReleaseLock(TLOCK_TTF);
#endif
return fc;
}
......@@ -271,6 +296,10 @@ outline_element* msGetGlyphOutline(face_element *face, glyph_element *glyph) {
ft_cache *cache = msGetFontCache();
memset(&key,0,sizeof(outline_element_key));
key.glyph = glyph;
#ifdef USE_THREAD
if (use_global_ft_cache)
msAcquireLock(TLOCK_TTF);
#endif
UT_HASH_FIND(hh,face->outline_cache,&key, sizeof(outline_element_key),oc);
if(!oc) {
FT_Matrix matrix;
......@@ -284,9 +313,13 @@ outline_element* msGetGlyphOutline(face_element *face, glyph_element *glyph) {
matrix.xy = matrix.yx = 0x00000L;
pen.x = pen.y = 0;
FT_Set_Transform(face->face, &matrix, &pen);
error = FT_Load_Glyph(face->face,glyph->key.codepoint,FT_LOAD_DEFAULT/*|FT_LOAD_IGNORE_TRANSFORM*/|FT_LOAD_NO_HINTING|FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH);
error = FT_Load_Glyph(face->face,glyph->key.codepoint,FT_LOAD_DEFAULT|FT_LOAD_NO_BITMAP/*|FT_LOAD_IGNORE_TRANSFORM*/|FT_LOAD_NO_HINTING|FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH);
if(error) {
msSetError(MS_MISCERR, "unable to load glyph %ud for font \"%s\"", "msGetGlyphByIndex()",glyph->key.codepoint, face->font);
#ifdef USE_THREAD
if (use_global_ft_cache)
msReleaseLock(TLOCK_TTF);
#endif
return NULL;
}
error = FT_Outline_New(cache->library, face->face->glyph->outline.n_points,
......@@ -295,5 +328,17 @@ outline_element* msGetGlyphOutline(face_element *face, glyph_element *glyph) {
oc->key = key;
UT_HASH_ADD(hh,face->outline_cache,key,sizeof(outline_element_key), oc);
}
#ifdef USE_THREAD
if (use_global_ft_cache)
msReleaseLock(TLOCK_TTF);
#endif
return oc;
}
int msIsGlyphASpace(glyphObj *glyph) {
/* space or tab, for now */
unsigned int space,tab;
space = msGetGlyphIndex(glyph->face,0x20);
tab = msGetGlyphIndex(glyph->face,0x9);
return glyph->glyph->key.codepoint == space || glyph->glyph->key.codepoint == tab;
}
......@@ -80,6 +80,7 @@ outline_element* msGetGlyphOutline(face_element *face, glyph_element *glyph);
glyph_element* msGetBitmapGlyph(rendererVTableObj *renderer, unsigned int size, unsigned int unicode);
unsigned int msGetGlyphIndex(face_element *face, unsigned int unicode);
glyph_element* msGetGlyphByIndex(face_element *face, unsigned int size, unsigned int codepoint);
int msIsGlyphASpace(glyphObj *glyph);
#ifdef __cplusplus
}
......
......@@ -84,7 +84,7 @@ int msComputeKernelDensityDataset(mapObj *map, imageObj *image, layerObj *kernel
int status,layer_idx, i,j, nclasses=0, have_sample=0;
rectObj searchrect;
shapeObj shape;
layerObj *layer;
layerObj *layer = NULL;
float *values = NULL;
int radius = 10, im_width = image->width, im_height = image->height;
int expand_searchrect=1;
......
......@@ -1333,15 +1333,10 @@ int aggCompositeRasterBuffer(imageObj *dest, rasterBufferObj *overlay, Compositi
#endif
}
rasterBufferObj* msApplyFilterToRasterBuffer(const rasterBufferObj *rb, CompositingFilter *filter) {
rasterBufferObj *rbret = (rasterBufferObj*)msSmallCalloc(sizeof(rasterBufferObj),1);
msCopyRasterBuffer(rbret,rb);
rendering_buffer b(rbret->data.rgba.pixels, rbret->width, rbret->height, rbret->data.rgba.row_step);
void msApplyBlurringCompositingFilter(rasterBufferObj *rb, unsigned int radius) {
rendering_buffer b(rb->data.rgba.pixels, rb->width, rb->height, rb->data.rgba.row_step);
pixel_format pf(b);
/* for now, we only support a blurring filter */
int radius = atoi(filter->filter);
mapserver::stack_blur_rgba32(pf,radius,radius);
return rbret;
}
int msPopulateRendererVTableAGG(rendererVTableObj * renderer)
......
......@@ -1017,6 +1017,7 @@ int msRenderRasterizedSVGSymbol(imageObj *img, double x, double y, symbolObj *sy
struct svg_symbol_cache *svg_cache;
symbolStyleObj pixstyle;
symbolObj pixsymbol;
int status;
if(MS_SUCCESS != msPreloadSVGSymbol(symbol))
return MS_FAILURE;
......@@ -1084,10 +1085,9 @@ int msRenderRasterizedSVGSymbol(imageObj *img, double x, double y, symbolObj *sy
pixsymbol.pixmap_buffer = svg_cache->pixmap_buffer;
pixsymbol.type = MS_SYMBOL_PIXMAP;
if(MS_SUCCESS != MS_IMAGE_RENDERER(img)->renderPixmapSymbol(img,x,y,&pixsymbol,&pixstyle))
return MS_FAILURE;
status = MS_IMAGE_RENDERER(img)->renderPixmapSymbol(img,x,y,&pixsymbol,&pixstyle);
MS_IMAGE_RENDERER(img)->freeSymbol(&pixsymbol);
return MS_SUCCESS;
return status;
#else
msSetError(MS_MISCERR, "SVG Symbols requested but MapServer is not built with libsvgcairo",
"renderSVGSymbolCairo()");
......
This diff is collapsed.
/******************************************************************************
*
* Project: MapServer
* Purpose: RFC 113 Layer compositing
* Author: Thomas Bonfort and the MapServer team.
*
******************************************************************************
* Copyright (c) 1996-2015 Regents of the University of Minnesota.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies of this Software or works derived from this Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*****************************************************************************/
#include "mapserver.h"
#include <regex.h>
#define pixmove(rb,srcx,srcy,dstx,dsty) \
memcpy(rb->data.rgba.pixels+dsty*rb->data.rgba.row_step+dstx*4,\
rb->data.rgba.pixels+srcy*rb->data.rgba.row_step+srcx*4,\
4)
#define pixerase(rb,x,y) memset(rb->data.rgba.pixels+y*rb->data.rgba.row_step+x*4,0,4)
void msApplyTranslationCompositingFilter(rasterBufferObj *rb, int xtrans, int ytrans) {
int src_sx,src_sy,dst_sx,dst_sy,x,y,dst_x,dst_y;
if(abs(xtrans)>=rb->width || abs(ytrans)>=rb->height) {
for(y = 0; y<rb->height; y++)
for(x = 0; x<rb->width; x++)
pixerase(rb,x,y);
}
if(xtrans == 0 && ytrans == 0)
return;
if(xtrans>=0) {
if(ytrans>=0) {
src_sx = rb->width - xtrans - 1;
src_sy = rb->height - ytrans - 1;
dst_sx = rb->width - 1;
dst_sy = rb->height -1;
for(y = src_sy,dst_y= dst_sy;y>=0;y--,dst_y--) {
for(x = src_sx,dst_x= dst_sx;x>=0;x--,dst_x--) {
pixmove(rb,x,y,dst_x,dst_y);
}
}
for(y=0;y<ytrans;y++)
for(x=0;x<rb->width;x++)
pixerase(rb,x,y);
for(y=ytrans;y<rb->height;y++)
for(x=0;x<xtrans;x++)
pixerase(rb,x,y);
} else {
src_sx = rb->width - xtrans - 1;
src_sy = - ytrans;
dst_sx = rb->width - 1;
dst_sy = 0;
for(y = src_sy,dst_y= dst_sy;y<rb->height;y++,dst_y++) {
for(x = src_sx,dst_x= dst_sx;x>=0;x--,dst_x--) {
pixmove(rb,x,y,dst_x,dst_y);
}
}
for(y=0;y<rb->height+ytrans;y++)
for(x=0;x<xtrans;x++)
pixerase(rb,x,y);
for(y=rb->height+ytrans;y<rb->height;y++)
for(x=0;x<rb->width;x++)
pixerase(rb,x,y);
}
} else {
if(ytrans>=0) {
src_sx = - xtrans;
src_sy = rb->height - ytrans - 1;
dst_sx = 0;
dst_sy = rb->height -1;
for(y = src_sy,dst_y= dst_sy;y>=0;y--,dst_y--) {
for(x = src_sx,dst_x= dst_sx;x<rb->width;x++,dst_x++) {
pixmove(rb,x,y,dst_x,dst_y);
}
}
for(y=0;y<ytrans;y++)
for(x=0;x<rb->width;x++)
pixerase(rb,x,y);
for(y=ytrans;y<rb->height;y++)
for(x=rb->width+xtrans;x<rb->width;x++)
pixerase(rb,x,y);
} else {
src_sx = - xtrans;
src_sy = - ytrans;
dst_sx = 0;
dst_sy = 0;
for(y = src_sy,dst_y= dst_sy;y<rb->height;y++,dst_y++) {
for(x = src_sx,dst_x= dst_sx;x<rb->width;x++,dst_x++) {
pixmove(rb,x,y,dst_x,dst_y);
}
}
for(y=0;y<rb->height+ytrans;y++)
for(x=rb->width+xtrans;x<rb->width;x++)
pixerase(rb,x,y);
for(y=rb->height+ytrans;y<rb->height;y++)
for(x=0;x<rb->width;x++)
pixerase(rb,x,y);
}
}
}
void msApplyBlackeningCompositingFilter(rasterBufferObj *rb) {
int row,col;
unsigned char *r,*g,*b;
for(row=0;row<rb->height;row++) {
r = rb->data.rgba.r + row*rb->data.rgba.row_step;
g = rb->data.rgba.g + row*rb->data.rgba.row_step;
b = rb->data.rgba.b + row*rb->data.rgba.row_step;
for(col=0;col<rb->width;col++) {
*r = *g = *b = 0;
r+=4;g+=4;b+=4;
}
}
}
void msApplyWhiteningCompositingFilter(rasterBufferObj *rb) {
int row,col;
unsigned char *r,*g,*b,*a;
for(row=0;row<rb->height;row++) {
r = rb->data.rgba.r + row*rb->data.rgba.row_step;
g = rb->data.rgba.g + row*rb->data.rgba.row_step;
b = rb->data.rgba.b + row*rb->data.rgba.row_step;
a = rb->data.rgba.a + row*rb->data.rgba.row_step;
for(col=0;col<rb->width;col++) {
*r = *g = *b = *a;
r+=4;g+=4;b+=4;a+=4;
}
}
}
void msApplyGrayscaleCompositingFilter(rasterBufferObj *rb) {
int row,col;
unsigned char *r,*g,*b;
for(row=0;row<rb->height;row++) {
r = rb->data.rgba.r + row*rb->data.rgba.row_step;
g = rb->data.rgba.g + row*rb->data.rgba.row_step;
b = rb->data.rgba.b + row*rb->data.rgba.row_step;
for(col=0;col<rb->width;col++) {
unsigned int mix = (unsigned int)*r + (unsigned int)*g + (unsigned int)*b;
mix /=3;
*r = *g = *b = (unsigned char)mix;
r+=4;g+=4;b+=4;