Merge branch 'master' of https://github.com/mapnik/mapnik into feature/cmake-static
This commit is contained in:
commit
213be3777c
71 changed files with 17507 additions and 14528 deletions
|
@ -30,7 +30,7 @@ BraceWrapping:
|
||||||
AfterFunction: true # see AllowShortFunctionsOnASingleLine
|
AfterFunction: true # see AllowShortFunctionsOnASingleLine
|
||||||
AfterNamespace: false
|
AfterNamespace: false
|
||||||
AfterStruct: true
|
AfterStruct: true
|
||||||
AfterExternBlock: true
|
AfterExternBlock: false
|
||||||
BeforeCatch: false
|
BeforeCatch: false
|
||||||
BeforeElse: true
|
BeforeElse: true
|
||||||
BeforeLambdaBody: false
|
BeforeLambdaBody: false
|
||||||
|
|
17
.github/workflows/build_test.yml
vendored
17
.github/workflows/build_test.yml
vendored
|
@ -9,7 +9,17 @@ on:
|
||||||
- "**"
|
- "**"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
checkSource:
|
||||||
|
name: Check Source Code
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-python@v3
|
||||||
|
- uses: pre-commit/action@v3.0.0
|
||||||
|
|
||||||
windows:
|
windows:
|
||||||
|
needs: checkSource
|
||||||
name: Windows memory mapped
|
name: Windows memory mapped
|
||||||
uses: ./.github/workflows/windows.yml
|
uses: ./.github/workflows/windows.yml
|
||||||
with:
|
with:
|
||||||
|
@ -20,8 +30,9 @@ jobs:
|
||||||
BUILD_SHARED: true
|
BUILD_SHARED: true
|
||||||
secrets:
|
secrets:
|
||||||
NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }}
|
NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }}
|
||||||
|
|
||||||
windows-mmf-off:
|
windows-mmf-off:
|
||||||
|
needs: checkSource
|
||||||
name: Windows file based
|
name: Windows file based
|
||||||
uses: ./.github/workflows/windows.yml
|
uses: ./.github/workflows/windows.yml
|
||||||
with:
|
with:
|
||||||
|
@ -46,6 +57,7 @@ jobs:
|
||||||
NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }}
|
NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }}
|
||||||
|
|
||||||
ubuntu:
|
ubuntu:
|
||||||
|
needs: checkSource
|
||||||
name: Linux memory mapped
|
name: Linux memory mapped
|
||||||
uses: ./.github/workflows/ubuntu.yml
|
uses: ./.github/workflows/ubuntu.yml
|
||||||
with:
|
with:
|
||||||
|
@ -58,6 +70,7 @@ jobs:
|
||||||
NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }}
|
NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }}
|
||||||
|
|
||||||
ubuntu-mmf-off:
|
ubuntu-mmf-off:
|
||||||
|
needs: checkSource
|
||||||
name: Linux file based
|
name: Linux file based
|
||||||
uses: ./.github/workflows/ubuntu.yml
|
uses: ./.github/workflows/ubuntu.yml
|
||||||
with:
|
with:
|
||||||
|
@ -82,6 +95,7 @@ jobs:
|
||||||
NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }}
|
NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }}
|
||||||
|
|
||||||
macos:
|
macos:
|
||||||
|
needs: checkSource
|
||||||
name: MacOS memory mapped
|
name: MacOS memory mapped
|
||||||
uses: ./.github/workflows/macos.yml
|
uses: ./.github/workflows/macos.yml
|
||||||
with:
|
with:
|
||||||
|
@ -94,6 +108,7 @@ jobs:
|
||||||
NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }}
|
NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }}
|
||||||
|
|
||||||
macos-mmf-off:
|
macos-mmf-off:
|
||||||
|
needs: checkSource
|
||||||
name: MacOS file based
|
name: MacOS file based
|
||||||
uses: ./.github/workflows/macos.yml
|
uses: ./.github/workflows/macos.yml
|
||||||
with:
|
with:
|
||||||
|
|
16
.pre-commit-config.yaml
Normal file
16
.pre-commit-config.yaml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# See https://pre-commit.com for more information
|
||||||
|
# See https://pre-commit.com/hooks.html for more hooks
|
||||||
|
repos:
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v4.3.0
|
||||||
|
hooks:
|
||||||
|
- id: trailing-whitespace
|
||||||
|
files: ^.*\.cmake|CMakeLists\.txt$
|
||||||
|
- id: end-of-file-fixer
|
||||||
|
files: ^.*\.cmake|CMakeLists\.txt$
|
||||||
|
|
||||||
|
- repo: https://github.com/pre-commit/mirrors-clang-format
|
||||||
|
rev: v14.0.6
|
||||||
|
hooks:
|
||||||
|
- id: clang-format
|
||||||
|
types_or: [c++, c]
|
|
@ -5,11 +5,11 @@ cmake_minimum_required(VERSION 3.15)
|
||||||
include(cmake/GetVersion.cmake)
|
include(cmake/GetVersion.cmake)
|
||||||
get_mapnik_version()
|
get_mapnik_version()
|
||||||
|
|
||||||
project(mapnik
|
project(mapnik
|
||||||
VERSION ${MAPNIK_MAJOR_VERSION}.${MAPNIK_MINOR_VERSION}.${MAPNIK_PATCH_VERSION}
|
VERSION ${MAPNIK_MAJOR_VERSION}.${MAPNIK_MINOR_VERSION}.${MAPNIK_PATCH_VERSION}
|
||||||
HOMEPAGE_URL "https://mapnik.org/"
|
HOMEPAGE_URL "https://mapnik.org/"
|
||||||
DESCRIPTION "Mapnik is an open source toolkit for developing mapping applications"
|
DESCRIPTION "Mapnik is an open source toolkit for developing mapping applications"
|
||||||
LANGUAGES CXX
|
LANGUAGES CXX
|
||||||
)
|
)
|
||||||
message(STATUS "mapnik version: ${PROJECT_VERSION}")
|
message(STATUS "mapnik version: ${PROJECT_VERSION}")
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ if(harfbuzz_FOUND)
|
||||||
message(STATUS "Found harfbuzz native cmake")
|
message(STATUS "Found harfbuzz native cmake")
|
||||||
list(APPEND MAPNIK_OPTIONAL_LIBS harfbuzz::harfbuzz)
|
list(APPEND MAPNIK_OPTIONAL_LIBS harfbuzz::harfbuzz)
|
||||||
else()
|
else()
|
||||||
# Use pkg-config when harfbuzz is not found.
|
# Use pkg-config when harfbuzz is not found.
|
||||||
# It might be possible that in future version harfbuzz could only be found via pkg-config.
|
# It might be possible that in future version harfbuzz could only be found via pkg-config.
|
||||||
# harfbuzz related discussion: https://github.com/harfbuzz/harfbuzz/issues/2653
|
# harfbuzz related discussion: https://github.com/harfbuzz/harfbuzz/issues/2653
|
||||||
message(STATUS "harfbuzz not found via cmake. Searching via pkg-config...")
|
message(STATUS "harfbuzz not found via cmake. Searching via pkg-config...")
|
||||||
|
@ -182,13 +182,13 @@ if(USE_EXTERNAL_MAPBOX_GEOMETRY)
|
||||||
find_path(MAPBOX_GEOMETRY_INCLUDE_DIRS "mapbox/geometry.hpp" REQUIRED)
|
find_path(MAPBOX_GEOMETRY_INCLUDE_DIRS "mapbox/geometry.hpp" REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
set(MAPBOX_GEOMETRY_INCLUDE_DIRS
|
set(MAPBOX_GEOMETRY_INCLUDE_DIRS
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/geometry/include>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/geometry/include>
|
||||||
$<INSTALL_INTERFACE:include>
|
$<INSTALL_INTERFACE:include>
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
if(NOT MAPBOX_GEOMETRY_INCLUDE_DIRS)
|
if(NOT MAPBOX_GEOMETRY_INCLUDE_DIRS)
|
||||||
message(FATAL_ERROR "Set -DMAPBOX_GEOMETRY_INCLUDE_DIRS to the mapbox/geometry.hpp include dir")
|
message(FATAL_ERROR "Set -DMAPBOX_GEOMETRY_INCLUDE_DIRS to the mapbox/geometry.hpp include dir")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(USE_EXTERNAL_MAPBOX_POLYLABEL)
|
if(USE_EXTERNAL_MAPBOX_POLYLABEL)
|
||||||
|
@ -197,13 +197,13 @@ if(USE_EXTERNAL_MAPBOX_POLYLABEL)
|
||||||
find_path(MAPBOX_POLYLABEL_INCLUDE_DIRS "mapbox/polylabel.hpp")
|
find_path(MAPBOX_POLYLABEL_INCLUDE_DIRS "mapbox/polylabel.hpp")
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
set(MAPBOX_POLYLABEL_INCLUDE_DIRS
|
set(MAPBOX_POLYLABEL_INCLUDE_DIRS
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/polylabel/include>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/polylabel/include>
|
||||||
$<INSTALL_INTERFACE:include>
|
$<INSTALL_INTERFACE:include>
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
if(NOT MAPBOX_POLYLABEL_INCLUDE_DIRS)
|
if(NOT MAPBOX_POLYLABEL_INCLUDE_DIRS)
|
||||||
message(FATAL_ERROR "Set MAPBOX_POLYLABEL_INCLUDE_DIRS to the mapbox/geometry include dir")
|
message(FATAL_ERROR "Set MAPBOX_POLYLABEL_INCLUDE_DIRS to the mapbox/geometry include dir")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(USE_EXTERNAL_MAPBOX_PROTOZERO)
|
if(USE_EXTERNAL_MAPBOX_PROTOZERO)
|
||||||
|
@ -212,13 +212,13 @@ if(USE_EXTERNAL_MAPBOX_PROTOZERO)
|
||||||
find_path(MAPBOX_PROTOZERO_INCLUDE_DIRS "protozero/pbf_message.hpp")
|
find_path(MAPBOX_PROTOZERO_INCLUDE_DIRS "protozero/pbf_message.hpp")
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
set(MAPBOX_PROTOZERO_INCLUDE_DIRS
|
set(MAPBOX_PROTOZERO_INCLUDE_DIRS
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/protozero/include>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/protozero/include>
|
||||||
$<INSTALL_INTERFACE:include>
|
$<INSTALL_INTERFACE:include>
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
if(NOT MAPBOX_PROTOZERO_INCLUDE_DIRS)
|
if(NOT MAPBOX_PROTOZERO_INCLUDE_DIRS)
|
||||||
message(FATAL_ERROR "Set MAPBOX_PROTOZERO_INCLUDE_DIRS to the mapbox/protozero include dir")
|
message(FATAL_ERROR "Set MAPBOX_PROTOZERO_INCLUDE_DIRS to the mapbox/protozero include dir")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(USE_EXTERNAL_MAPBOX_VARIANT)
|
if(USE_EXTERNAL_MAPBOX_VARIANT)
|
||||||
|
@ -227,13 +227,13 @@ if(USE_EXTERNAL_MAPBOX_VARIANT)
|
||||||
find_path(MAPBOX_VARIANT_INCLUDE_DIRS "mapbox/variant.hpp")
|
find_path(MAPBOX_VARIANT_INCLUDE_DIRS "mapbox/variant.hpp")
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
set(MAPBOX_VARIANT_INCLUDE_DIRS
|
set(MAPBOX_VARIANT_INCLUDE_DIRS
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/variant/include>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/variant/include>
|
||||||
$<INSTALL_INTERFACE:include>
|
$<INSTALL_INTERFACE:include>
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
if(NOT MAPBOX_VARIANT_INCLUDE_DIRS)
|
if(NOT MAPBOX_VARIANT_INCLUDE_DIRS)
|
||||||
message(FATAL_ERROR "Set MAPBOX_VARIANT_INCLUDE_DIRS to the mapbox/variant include dir")
|
message(FATAL_ERROR "Set MAPBOX_VARIANT_INCLUDE_DIRS to the mapbox/variant include dir")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# (used by MapnikInstall.cmake. properties are needed since "set(...)" will be out of scope
|
# (used by MapnikInstall.cmake. properties are needed since "set(...)" will be out of scope
|
||||||
|
@ -245,7 +245,7 @@ if(USE_GLIBC_WORKAROUND)
|
||||||
list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_ENABLE_GLIBC_WORKAROUND)
|
list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_ENABLE_GLIBC_WORKAROUND)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(USE_BIGINT)
|
if(USE_BIGINT)
|
||||||
list(APPEND MAPNIK_COMPILE_DEFS BIGINT)
|
list(APPEND MAPNIK_COMPILE_DEFS BIGINT)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ if(USE_SVG_RENDERER)
|
||||||
list(APPEND MAPNIK_COMPILE_DEFS SVG_RENDERER)
|
list(APPEND MAPNIK_COMPILE_DEFS SVG_RENDERER)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
message(STATUS "Compiling with -DMAPNIK_HAS_DLCFN")
|
message(STATUS "Compiling with -DMAPNIK_HAS_DLCFN")
|
||||||
list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_HAS_DLCFN)
|
list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_HAS_DLCFN)
|
||||||
list(APPEND MAPNIK_OPTIONAL_LIBS ${CMAKE_DL_LIBS})
|
list(APPEND MAPNIK_OPTIONAL_LIBS ${CMAKE_DL_LIBS})
|
||||||
|
@ -365,8 +365,8 @@ add_compile_options(
|
||||||
add_library(core INTERFACE)
|
add_library(core INTERFACE)
|
||||||
add_library(mapnik::core ALIAS core)
|
add_library(mapnik::core ALIAS core)
|
||||||
|
|
||||||
target_include_directories(core INTERFACE
|
target_include_directories(core INTERFACE
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||||
$<BUILD_INTERFACE:${MAPBOX_GEOMETRY_INCLUDE_DIRS}>
|
$<BUILD_INTERFACE:${MAPBOX_GEOMETRY_INCLUDE_DIRS}>
|
||||||
$<BUILD_INTERFACE:${MAPBOX_POLYLABEL_INCLUDE_DIRS}>
|
$<BUILD_INTERFACE:${MAPBOX_POLYLABEL_INCLUDE_DIRS}>
|
||||||
$<BUILD_INTERFACE:${MAPBOX_VARIANT_INCLUDE_DIRS}>
|
$<BUILD_INTERFACE:${MAPBOX_VARIANT_INCLUDE_DIRS}>
|
||||||
|
@ -375,7 +375,7 @@ target_include_directories(core INTERFACE
|
||||||
$<INSTALL_INTERFACE:include>
|
$<INSTALL_INTERFACE:include>
|
||||||
${MAPNIK_OPTIONAL_LIBS_INCLUDE}
|
${MAPNIK_OPTIONAL_LIBS_INCLUDE}
|
||||||
)
|
)
|
||||||
target_link_libraries(core INTERFACE
|
target_link_libraries(core INTERFACE
|
||||||
Threads::Threads
|
Threads::Threads
|
||||||
ICU::uc
|
ICU::uc
|
||||||
ICU::data
|
ICU::data
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
project(mapnik-benchmark)
|
project(mapnik-benchmark)
|
||||||
|
|
||||||
set(BENCHMARK_SRCS
|
set(BENCHMARK_SRCS
|
||||||
src/normalize_angle.cpp
|
src/normalize_angle.cpp
|
||||||
src/test_array_allocation.cpp
|
src/test_array_allocation.cpp
|
||||||
src/test_expression_parse.cpp
|
src/test_expression_parse.cpp
|
||||||
|
@ -32,7 +32,7 @@ function(mapnik_create_benchmark)
|
||||||
add_executable(${TARGET_NAME} ${ARGV0})
|
add_executable(${TARGET_NAME} ${ARGV0})
|
||||||
target_include_directories(${TARGET_NAME} PRIVATE include)
|
target_include_directories(${TARGET_NAME} PRIVATE include)
|
||||||
target_link_libraries(${TARGET_NAME} PRIVATE mapnik::agg mapnik::mapnik)
|
target_link_libraries(${TARGET_NAME} PRIVATE mapnik::agg mapnik::mapnik)
|
||||||
set_target_properties(${TARGET_NAME} PROPERTIES
|
set_target_properties(${TARGET_NAME} PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||||
ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib"
|
ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib"
|
||||||
|
@ -46,7 +46,7 @@ foreach(benchmark ${BENCHMARK_SRCS})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
file(COPY data DESTINATION "${MAPNIK_OUTPUT_DIR}/benchmark")
|
file(COPY data DESTINATION "${MAPNIK_OUTPUT_DIR}/benchmark")
|
||||||
file(COPY run_benchmarks
|
file(COPY run_benchmarks
|
||||||
DESTINATION "${MAPNIK_OUTPUT_DIR}"
|
DESTINATION "${MAPNIK_OUTPUT_DIR}"
|
||||||
FILE_PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE GROUP_WRITE GROUP_READ GROUP_EXECUTE WORLD_READ
|
FILE_PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE GROUP_WRITE GROUP_READ GROUP_EXECUTE WORLD_READ
|
||||||
)
|
)
|
||||||
|
|
|
@ -9,7 +9,7 @@ Name: @_lib_name@
|
||||||
Description: @_description@
|
Description: @_description@
|
||||||
Version: @MAPNIK_VERSION@
|
Version: @MAPNIK_VERSION@
|
||||||
Libs: -L"${libdir}" -l$<TARGET_FILE_BASE_NAME:@_target@>$<TARGET_PROPERTY:@_target@,$<CONFIG>_POSTFIX>
|
Libs: -L"${libdir}" -l$<TARGET_FILE_BASE_NAME:@_target@>$<TARGET_PROPERTY:@_target@,$<CONFIG>_POSTFIX>
|
||||||
Cflags: -I"${includedir}" ]]
|
Cflags: -I"${includedir}" ]]
|
||||||
_contents @ONLY)
|
_contents @ONLY)
|
||||||
|
|
||||||
file(GENERATE
|
file(GENERATE
|
||||||
|
@ -26,11 +26,11 @@ endfunction()
|
||||||
function(create_pkg_config_file_mapnik _lib_name _description)
|
function(create_pkg_config_file_mapnik _lib_name _description)
|
||||||
get_target_property(m_compile_defs core INTERFACE_COMPILE_DEFINITIONS)
|
get_target_property(m_compile_defs core INTERFACE_COMPILE_DEFINITIONS)
|
||||||
string(JOIN " -D" m_str_compile_defs ${m_compile_defs})
|
string(JOIN " -D" m_str_compile_defs ${m_compile_defs})
|
||||||
if(m_str_compile_defs)
|
if(m_str_compile_defs)
|
||||||
set(m_str_compile_defs "-D${m_str_compile_defs}")
|
set(m_str_compile_defs "-D${m_str_compile_defs}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(m_requires
|
set(m_requires
|
||||||
libmapnikwkt
|
libmapnikwkt
|
||||||
libmapnikjson
|
libmapnikjson
|
||||||
icu-uc
|
icu-uc
|
||||||
|
@ -71,7 +71,7 @@ Description: @_description@
|
||||||
Version: @MAPNIK_VERSION@
|
Version: @MAPNIK_VERSION@
|
||||||
Requires: @m_requires@
|
Requires: @m_requires@
|
||||||
Libs: -L"${libdir}" -l$<TARGET_FILE_BASE_NAME:mapnik>$<TARGET_PROPERTY:mapnik,$<CONFIG>_POSTFIX>
|
Libs: -L"${libdir}" -l$<TARGET_FILE_BASE_NAME:mapnik>$<TARGET_PROPERTY:mapnik,$<CONFIG>_POSTFIX>
|
||||||
Cflags: -I"${includedir}" @m_str_compile_defs@]]
|
Cflags: -I"${includedir}" @m_str_compile_defs@]]
|
||||||
_contents @ONLY)
|
_contents @ONLY)
|
||||||
file(GENERATE
|
file(GENERATE
|
||||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_lib_name}-$<CONFIG>.pc
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_lib_name}-$<CONFIG>.pc
|
||||||
|
|
|
@ -90,7 +90,7 @@ function(mapnik_install_targets)
|
||||||
message(STATUS \"internal_executables: ${_internal_executables}\")
|
message(STATUS \"internal_executables: ${_internal_executables}\")
|
||||||
message(STATUS \"internal_libraries: ${_internal_libraries}\")
|
message(STATUS \"internal_libraries: ${_internal_libraries}\")
|
||||||
message(STATUS \"ADDITIONAL_LIBARIES_PATHS: ${ADDITIONAL_LIBARIES_PATHS}\")
|
message(STATUS \"ADDITIONAL_LIBARIES_PATHS: ${ADDITIONAL_LIBARIES_PATHS}\")
|
||||||
|
|
||||||
include(BundleUtilities)
|
include(BundleUtilities)
|
||||||
fixup_bundle(\"${_internal_executables}\" \"${_internal_libraries}\" \"${ADDITIONAL_LIBARIES_PATHS}\")
|
fixup_bundle(\"${_internal_executables}\" \"${_internal_libraries}\" \"${ADDITIONAL_LIBARIES_PATHS}\")
|
||||||
" COMPONENT MapnikRuntime)
|
" COMPONENT MapnikRuntime)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function(format_dir dir)
|
function(format_dir dir)
|
||||||
file(GLOB_RECURSE sources
|
file(GLOB_RECURSE sources
|
||||||
"${dir}/*.cpp"
|
"${dir}/*.cpp"
|
||||||
"${dir}/*.hpp"
|
"${dir}/*.hpp"
|
||||||
)
|
)
|
||||||
|
|
|
@ -32,14 +32,14 @@ function(mapnik_find_plugin_dir PLUGIN_DIR)
|
||||||
string(TOUPPER "${CMAKE_BUILD_TYPE}" _build_type_l)
|
string(TOUPPER "${CMAKE_BUILD_TYPE}" _build_type_l)
|
||||||
set(_plugin_dir "${MAPNIK_PLUGINS_DIR_${_build_type_l}}")
|
set(_plugin_dir "${MAPNIK_PLUGINS_DIR_${_build_type_l}}")
|
||||||
# only release has more then one configuration
|
# only release has more then one configuration
|
||||||
if(NOT _plugin_dir)
|
if(NOT _plugin_dir)
|
||||||
set(_all_rel_cfgs RELEASE RELWITHDEBINFO MINSIZEREL)
|
set(_all_rel_cfgs RELEASE RELWITHDEBINFO MINSIZEREL)
|
||||||
list(FIND _all_rel_cfgs ${_build_type_l} _is_rel_cfg)
|
list(FIND _all_rel_cfgs ${_build_type_l} _is_rel_cfg)
|
||||||
# check if the current configuration is a known release configuration
|
# check if the current configuration is a known release configuration
|
||||||
if(${_is_rel_cfg} GREATER_EQUAL 0)
|
if(${_is_rel_cfg} GREATER_EQUAL 0)
|
||||||
foreach(_rel_cfg IN LISTS _all_rel_cfgs)
|
foreach(_rel_cfg IN LISTS _all_rel_cfgs)
|
||||||
set(_plugin_dir "${MAPNIK_PLUGINS_DIR_${_rel_cfg}}")
|
set(_plugin_dir "${MAPNIK_PLUGINS_DIR_${_rel_cfg}}")
|
||||||
if(_plugin_dir)
|
if(_plugin_dir)
|
||||||
break()
|
break()
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
@ -49,4 +49,4 @@ function(mapnik_find_plugin_dir PLUGIN_DIR)
|
||||||
message(WARNING "Could not find a plugin install dir for configuration ${_build_type_l}")
|
message(WARNING "Could not find a plugin install dir for configuration ${_build_type_l}")
|
||||||
endif()
|
endif()
|
||||||
set(${PLUGIN_DIR} ${_plugin_dir} PARENT_SCOPE)
|
set(${PLUGIN_DIR} ${_plugin_dir} PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
add_executable(mapnik-demo rundemo.cpp)
|
add_executable(mapnik-demo rundemo.cpp)
|
||||||
set_target_properties(mapnik-demo PROPERTIES
|
set_target_properties(mapnik-demo PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||||
ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib"
|
ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib"
|
||||||
|
|
|
@ -14,7 +14,7 @@ set(PROJECT_SOURCES
|
||||||
styles_model.cpp
|
styles_model.cpp
|
||||||
forms/about.ui
|
forms/about.ui
|
||||||
forms/info.ui
|
forms/info.ui
|
||||||
forms/layer_info.ui
|
forms/layer_info.ui
|
||||||
mapnik_viewer.qrc
|
mapnik_viewer.qrc
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ endif()
|
||||||
|
|
||||||
set_target_properties(mapnik-viewer PROPERTIES
|
set_target_properties(mapnik-viewer PROPERTIES
|
||||||
AUTOUIC_SEARCH_PATHS forms
|
AUTOUIC_SEARCH_PATHS forms
|
||||||
AUTORCC ON
|
AUTORCC ON
|
||||||
AUTOUIC ON
|
AUTOUIC ON
|
||||||
AUTOMOC ON
|
AUTOMOC ON
|
||||||
LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||||
|
@ -46,16 +46,17 @@ set_target_properties(mapnik-viewer PROPERTIES
|
||||||
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${BUILD_SHARED_CRT}>:DLL>"
|
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${BUILD_SHARED_CRT}>:DLL>"
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(mapnik-viewer PRIVATE
|
target_link_libraries(mapnik-viewer PRIVATE
|
||||||
Qt${QT_VERSION_MAJOR}::Widgets
|
Qt${QT_VERSION_MAJOR}::Widgets
|
||||||
mapnik::agg
|
mapnik::agg
|
||||||
mapnik::mapnik
|
mapnik::mapnik
|
||||||
)
|
)
|
||||||
|
|
||||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini
|
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini
|
||||||
"[mapnik]
|
"[mapnik]
|
||||||
plugins_dir=${PLUGINS_INSTALL_DIR}
|
plugins_dir=${PLUGINS_INSTALL_DIR}
|
||||||
fonts/1/dir=${FONTS_INSTALL_DIR}"
|
fonts/1/dir=${FONTS_INSTALL_DIR}
|
||||||
|
fonts/size=1"
|
||||||
)
|
)
|
||||||
|
|
||||||
if(QT_VERSION_MAJOR EQUAL 6)
|
if(QT_VERSION_MAJOR EQUAL 6)
|
||||||
|
|
1
deps/agg/.clang-format
vendored
Normal file
1
deps/agg/.clang-format
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
DisableFormat: true
|
4
deps/agg/CMakeLists.txt
vendored
4
deps/agg/CMakeLists.txt
vendored
|
@ -3,8 +3,8 @@ project(agg)
|
||||||
add_library(agg INTERFACE)
|
add_library(agg INTERFACE)
|
||||||
add_library(mapnik::agg ALIAS agg)
|
add_library(mapnik::agg ALIAS agg)
|
||||||
|
|
||||||
target_include_directories(agg INTERFACE
|
target_include_directories(agg INTERFACE
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||||
$<INSTALL_INTERFACE:include>
|
$<INSTALL_INTERFACE:include>
|
||||||
)
|
)
|
||||||
target_link_libraries(agg INTERFACE mapnik::core)
|
target_link_libraries(agg INTERFACE mapnik::core)
|
||||||
|
|
2
deps/agg/include/agg_basics.h
vendored
2
deps/agg/include/agg_basics.h
vendored
|
@ -365,7 +365,7 @@ namespace agg
|
||||||
inline bool is_close(unsigned c)
|
inline bool is_close(unsigned c)
|
||||||
{
|
{
|
||||||
return (c & ~(path_flags_cw | path_flags_ccw)) ==
|
return (c & ~(path_flags_cw | path_flags_ccw)) ==
|
||||||
(path_cmd_end_poly | path_flags_close);
|
(path_cmd_end_poly | static_cast<path_commands_e>(path_flags_close));
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------is_next_poly
|
//------------------------------------------------------------is_next_poly
|
||||||
|
|
11
deps/agg/include/agg_color_gray.h
vendored
11
deps/agg/include/agg_color_gray.h
vendored
|
@ -436,7 +436,8 @@ struct gray16
|
||||||
static value_type luminance(const rgba& c)
|
static value_type luminance(const rgba& c)
|
||||||
{
|
{
|
||||||
// Calculate grayscale value as per ITU-R BT.709.
|
// Calculate grayscale value as per ITU-R BT.709.
|
||||||
return value_type(uround((0.2126 * c.r + 0.7152 * c.g + 0.0722 * c.b) * base_mask));
|
return value_type(uround((0.2126 * c.r + 0.7152 * c.g + 0.0722 * c.b)
|
||||||
|
* static_cast<double>(base_mask)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static value_type luminance(const rgba16& c)
|
static value_type luminance(const rgba16& c)
|
||||||
|
@ -537,13 +538,13 @@ struct gray16
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
static AGG_INLINE double to_double(value_type a)
|
static AGG_INLINE double to_double(value_type a)
|
||||||
{
|
{
|
||||||
return double(a) / base_mask;
|
return static_cast<double>(a) / static_cast<double>(base_mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
static AGG_INLINE value_type from_double(double a)
|
static AGG_INLINE value_type from_double(double a)
|
||||||
{
|
{
|
||||||
return value_type(uround(a * base_mask));
|
return value_type(uround(a * static_cast<double>(base_mask)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
@ -698,7 +699,7 @@ struct gray16
|
||||||
self_type gradient(self_type c, double k) const
|
self_type gradient(self_type c, double k) const
|
||||||
{
|
{
|
||||||
self_type ret;
|
self_type ret;
|
||||||
calc_type ik = uround(k * base_scale);
|
calc_type ik = uround(k * static_cast<double>(base_scale));
|
||||||
ret.v = lerp(v, c.v, ik);
|
ret.v = lerp(v, c.v, ik);
|
||||||
ret.a = lerp(a, c.a, ik);
|
ret.a = lerp(a, c.a, ik);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -949,7 +950,7 @@ struct gray32
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
static AGG_INLINE value_type mult_cover(value_type a, cover_type b)
|
static AGG_INLINE value_type mult_cover(value_type a, cover_type b)
|
||||||
{
|
{
|
||||||
return value_type(a * b / cover_mask);
|
return value_type(a * b / static_cast<double>(cover_mask));
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
|
16
deps/agg/include/agg_color_rgba.h
vendored
16
deps/agg/include/agg_color_rgba.h
vendored
|
@ -281,10 +281,10 @@ struct rgba8T
|
||||||
|
|
||||||
static void convert(rgba8T<linear>& dst, const rgba& src)
|
static void convert(rgba8T<linear>& dst, const rgba& src)
|
||||||
{
|
{
|
||||||
dst.r = value_type(uround(src.r * base_mask));
|
dst.r = value_type(uround(src.r * static_cast<double>(base_mask)));
|
||||||
dst.g = value_type(uround(src.g * base_mask));
|
dst.g = value_type(uround(src.g * static_cast<double>(base_mask)));
|
||||||
dst.b = value_type(uround(src.b * base_mask));
|
dst.b = value_type(uround(src.b * static_cast<double>(base_mask)));
|
||||||
dst.a = value_type(uround(src.a * base_mask));
|
dst.a = value_type(uround(src.a * static_cast<double>(base_mask)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void convert(rgba8T<sRGB>& dst, const rgba& src)
|
static void convert(rgba8T<sRGB>& dst, const rgba& src)
|
||||||
|
@ -761,13 +761,13 @@ struct rgba16
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
static AGG_INLINE double to_double(value_type a)
|
static AGG_INLINE double to_double(value_type a)
|
||||||
{
|
{
|
||||||
return double(a) / base_mask;
|
return static_cast<double>(a) / static_cast<double>(base_mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
static AGG_INLINE value_type from_double(double a)
|
static AGG_INLINE value_type from_double(double a)
|
||||||
{
|
{
|
||||||
return value_type(uround(a * base_mask));
|
return value_type(uround(a * static_cast<double>(base_mask)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
@ -955,7 +955,7 @@ struct rgba16
|
||||||
AGG_INLINE self_type gradient(const self_type& c, double k) const
|
AGG_INLINE self_type gradient(const self_type& c, double k) const
|
||||||
{
|
{
|
||||||
self_type ret;
|
self_type ret;
|
||||||
calc_type ik = uround(k * base_mask);
|
calc_type ik = uround(k * static_cast<double>(base_mask));
|
||||||
ret.r = lerp(r, c.r, ik);
|
ret.r = lerp(r, c.r, ik);
|
||||||
ret.g = lerp(g, c.g, ik);
|
ret.g = lerp(g, c.g, ik);
|
||||||
ret.b = lerp(b, c.b, ik);
|
ret.b = lerp(b, c.b, ik);
|
||||||
|
@ -1194,7 +1194,7 @@ struct rgba32
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
static AGG_INLINE value_type mult_cover(value_type a, cover_type b)
|
static AGG_INLINE value_type mult_cover(value_type a, cover_type b)
|
||||||
{
|
{
|
||||||
return value_type(a * b / cover_mask);
|
return value_type(a * b / static_cast<float>(cover_mask));
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
|
23
deps/agg/include/agg_conv_adaptor_vpgen.h
vendored
23
deps/agg/include/agg_conv_adaptor_vpgen.h
vendored
|
@ -2,8 +2,8 @@
|
||||||
// Anti-Grain Geometry - Version 2.4
|
// Anti-Grain Geometry - Version 2.4
|
||||||
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Permission to copy, use, modify, sell and distribute this software
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// is granted provided this copyright notice appears in all copies.
|
||||||
// This software is provided "as is" without express or implied
|
// This software is provided "as is" without express or implied
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
// warranty, and with no claim as to its suitability for any purpose.
|
||||||
//
|
//
|
||||||
|
@ -37,7 +37,7 @@ namespace agg
|
||||||
|
|
||||||
private:
|
private:
|
||||||
conv_adaptor_vpgen(const conv_adaptor_vpgen<VertexSource, VPGen>&);
|
conv_adaptor_vpgen(const conv_adaptor_vpgen<VertexSource, VPGen>&);
|
||||||
const conv_adaptor_vpgen<VertexSource, VPGen>&
|
const conv_adaptor_vpgen<VertexSource, VPGen>&
|
||||||
operator = (const conv_adaptor_vpgen<VertexSource, VPGen>&);
|
operator = (const conv_adaptor_vpgen<VertexSource, VPGen>&);
|
||||||
|
|
||||||
VertexSource* m_source;
|
VertexSource* m_source;
|
||||||
|
@ -52,8 +52,8 @@ namespace agg
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VertexSource, class VPGen>
|
template<class VertexSource, class VPGen>
|
||||||
void conv_adaptor_vpgen<VertexSource, VPGen>::rewind(unsigned path_id)
|
void conv_adaptor_vpgen<VertexSource, VPGen>::rewind(unsigned path_id)
|
||||||
{
|
{
|
||||||
m_source->rewind(path_id);
|
m_source->rewind(path_id);
|
||||||
m_vpgen.reset();
|
m_vpgen.reset();
|
||||||
m_start_x = 0;
|
m_start_x = 0;
|
||||||
|
@ -84,7 +84,7 @@ namespace agg
|
||||||
|
|
||||||
if(m_vertices < 0)
|
if(m_vertices < 0)
|
||||||
{
|
{
|
||||||
if(m_vertices < -1)
|
if(m_vertices < -1)
|
||||||
{
|
{
|
||||||
m_vertices = 0;
|
m_vertices = 0;
|
||||||
return path_cmd_stop;
|
return path_cmd_stop;
|
||||||
|
@ -98,12 +98,13 @@ namespace agg
|
||||||
cmd = m_source->vertex(&tx, &ty);
|
cmd = m_source->vertex(&tx, &ty);
|
||||||
if(is_vertex(cmd))
|
if(is_vertex(cmd))
|
||||||
{
|
{
|
||||||
if(is_move_to(cmd))
|
if(is_move_to(cmd))
|
||||||
{
|
{
|
||||||
if(m_vpgen.auto_close() && m_vertices > 2)
|
if(m_vpgen.auto_close() && m_vertices > 2)
|
||||||
{
|
{
|
||||||
m_vpgen.line_to(m_start_x, m_start_y);
|
m_vpgen.line_to(m_start_x, m_start_y);
|
||||||
m_poly_flags = path_cmd_end_poly | path_flags_close;
|
m_poly_flags = path_cmd_end_poly
|
||||||
|
| static_cast<path_commands_e>(path_flags_close);
|
||||||
m_start_x = tx;
|
m_start_x = tx;
|
||||||
m_start_y = ty;
|
m_start_y = ty;
|
||||||
m_vertices = -1;
|
m_vertices = -1;
|
||||||
|
@ -114,7 +115,7 @@ namespace agg
|
||||||
m_start_y = ty;
|
m_start_y = ty;
|
||||||
m_vertices = 1;
|
m_vertices = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_vpgen.line_to(tx, ty);
|
m_vpgen.line_to(tx, ty);
|
||||||
++m_vertices;
|
++m_vertices;
|
||||||
|
@ -141,7 +142,8 @@ namespace agg
|
||||||
if(m_vpgen.auto_close() && m_vertices > 2)
|
if(m_vpgen.auto_close() && m_vertices > 2)
|
||||||
{
|
{
|
||||||
m_vpgen.line_to(m_start_x, m_start_y);
|
m_vpgen.line_to(m_start_x, m_start_y);
|
||||||
m_poly_flags = path_cmd_end_poly | path_flags_close;
|
m_poly_flags = path_cmd_end_poly
|
||||||
|
| static_cast<path_commands_e>(path_flags_close);
|
||||||
m_vertices = -2;
|
m_vertices = -2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -157,4 +159,3 @@ namespace agg
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
38
deps/agg/include/agg_image_filters.h
vendored
38
deps/agg/include/agg_image_filters.h
vendored
|
@ -2,8 +2,8 @@
|
||||||
// Anti-Grain Geometry - Version 2.4
|
// Anti-Grain Geometry - Version 2.4
|
||||||
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Permission to copy, use, modify, sell and distribute this software
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// is granted provided this copyright notice appears in all copies.
|
||||||
// This software is provided "as is" without express or implied
|
// This software is provided "as is" without express or implied
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
// warranty, and with no claim as to its suitability for any purpose.
|
||||||
//
|
//
|
||||||
|
@ -22,24 +22,25 @@
|
||||||
|
|
||||||
#include "agg_array.h"
|
#include "agg_array.h"
|
||||||
#include "agg_math.h"
|
#include "agg_math.h"
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
namespace agg
|
namespace agg
|
||||||
{
|
{
|
||||||
|
|
||||||
// See Implementation agg_image_filters.cpp
|
// See Implementation agg_image_filters.cpp
|
||||||
|
|
||||||
enum image_filter_scale_e
|
enum image_filter_scale_e
|
||||||
{
|
{
|
||||||
image_filter_shift = 14, //----image_filter_shift
|
image_filter_shift = 14, //----image_filter_shift
|
||||||
image_filter_scale = 1 << image_filter_shift, //----image_filter_scale
|
image_filter_scale = 1 << image_filter_shift, //----image_filter_scale
|
||||||
image_filter_mask = image_filter_scale - 1 //----image_filter_mask
|
image_filter_mask = image_filter_scale - 1 //----image_filter_mask
|
||||||
};
|
};
|
||||||
|
|
||||||
enum image_subpixel_scale_e
|
enum image_subpixel_scale_e
|
||||||
{
|
{
|
||||||
image_subpixel_shift = 8, //----image_subpixel_shift
|
image_subpixel_shift = 8, //----image_subpixel_shift
|
||||||
image_subpixel_scale = 1 << image_subpixel_shift, //----image_subpixel_scale
|
image_subpixel_scale = 1 << image_subpixel_shift, //----image_subpixel_scale
|
||||||
image_subpixel_mask = image_subpixel_scale - 1 //----image_subpixel_mask
|
image_subpixel_mask = image_subpixel_scale - 1 //----image_subpixel_mask
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,12 +59,13 @@ namespace agg
|
||||||
{
|
{
|
||||||
double x = double(i) / double(image_subpixel_scale);
|
double x = double(i) / double(image_subpixel_scale);
|
||||||
double y = filter.calc_weight(x);
|
double y = filter.calc_weight(x);
|
||||||
m_weight_array[pivot + i] =
|
m_weight_array[pivot + i] =
|
||||||
m_weight_array[pivot - i] = (int16)iround(y * image_filter_scale);
|
m_weight_array[pivot - i] =
|
||||||
|
static_cast<std::int16_t>(iround(y * static_cast<double>(image_filter_scale)));
|
||||||
}
|
}
|
||||||
unsigned end = (diameter() << image_subpixel_shift) - 1;
|
unsigned end = (diameter() << image_subpixel_shift) - 1;
|
||||||
m_weight_array[0] = m_weight_array[end];
|
m_weight_array[0] = m_weight_array[end];
|
||||||
if(normalization)
|
if(normalization)
|
||||||
{
|
{
|
||||||
normalize();
|
normalize();
|
||||||
}
|
}
|
||||||
|
@ -71,7 +73,7 @@ namespace agg
|
||||||
|
|
||||||
image_filter_lut() : m_radius(0), m_diameter(0), m_start(0) {}
|
image_filter_lut() : m_radius(0), m_diameter(0), m_start(0) {}
|
||||||
|
|
||||||
template<class FilterF> image_filter_lut(const FilterF& filter,
|
template<class FilterF> image_filter_lut(const FilterF& filter,
|
||||||
bool normalization=true)
|
bool normalization=true)
|
||||||
{
|
{
|
||||||
calculate(filter, normalization);
|
calculate(filter, normalization);
|
||||||
|
@ -80,7 +82,7 @@ namespace agg
|
||||||
double radius() const { return m_radius; }
|
double radius() const { return m_radius; }
|
||||||
unsigned diameter() const { return m_diameter; }
|
unsigned diameter() const { return m_diameter; }
|
||||||
int start() const { return m_start; }
|
int start() const { return m_start; }
|
||||||
const int16* weight_array() const { return &m_weight_array[0]; }
|
std::int16_t const* weight_array() const { return &m_weight_array[0]; }
|
||||||
void normalize();
|
void normalize();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -91,7 +93,7 @@ namespace agg
|
||||||
double m_radius;
|
double m_radius;
|
||||||
unsigned m_diameter;
|
unsigned m_diameter;
|
||||||
int m_start;
|
int m_start;
|
||||||
pod_array<int16> m_weight_array;
|
pod_array<std::int16_t> m_weight_array;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -150,7 +152,7 @@ namespace agg
|
||||||
return (2.0 * x - 3.0) * x * x + 1.0;
|
return (2.0 * x - 3.0) * x * x + 1.0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------------------------image_filter_quadric
|
//------------------------------------------------image_filter_quadric
|
||||||
struct image_filter_quadric
|
struct image_filter_quadric
|
||||||
{
|
{
|
||||||
|
@ -177,7 +179,7 @@ namespace agg
|
||||||
static double calc_weight(double x)
|
static double calc_weight(double x)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
(1.0/6.0) *
|
(1.0/6.0) *
|
||||||
(pow3(x + 2) - 4 * pow3(x + 1) + 6 * pow3(x) - 4 * pow3(x - 1));
|
(pow3(x + 2) - 4 * pow3(x + 1) + 6 * pow3(x) - 4 * pow3(x - 1));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -211,7 +213,7 @@ namespace agg
|
||||||
sum = 1.;
|
sum = 1.;
|
||||||
y = x * x / 4.;
|
y = x * x / 4.;
|
||||||
t = y;
|
t = y;
|
||||||
|
|
||||||
for(i = 2; t > epsilon; i++)
|
for(i = 2; t > epsilon; i++)
|
||||||
{
|
{
|
||||||
sum += t;
|
sum += t;
|
||||||
|
@ -298,7 +300,7 @@ namespace agg
|
||||||
struct image_filter_gaussian
|
struct image_filter_gaussian
|
||||||
{
|
{
|
||||||
static double radius() { return 2.0; }
|
static double radius() { return 2.0; }
|
||||||
static double calc_weight(double x)
|
static double calc_weight(double x)
|
||||||
{
|
{
|
||||||
return exp(-2.0 * x * x) * sqrt(2.0 / pi);
|
return exp(-2.0 * x * x) * sqrt(2.0 / pi);
|
||||||
}
|
}
|
||||||
|
@ -308,7 +310,7 @@ namespace agg
|
||||||
//------------------------------------------------image_filter_bessel
|
//------------------------------------------------image_filter_bessel
|
||||||
struct image_filter_bessel
|
struct image_filter_bessel
|
||||||
{
|
{
|
||||||
static double radius() { return 3.2383; }
|
static double radius() { return 3.2383; }
|
||||||
static double calc_weight(double x)
|
static double calc_weight(double x)
|
||||||
{
|
{
|
||||||
return (x == 0.0) ? pi / 4.0 : besj(pi * x, 1) / (2.0 * x);
|
return (x == 0.0) ? pi / 4.0 : besj(pi * x, 1) / (2.0 * x);
|
||||||
|
|
8
deps/agg/include/agg_line_aa_basics.h
vendored
8
deps/agg/include/agg_line_aa_basics.h
vendored
|
@ -44,13 +44,13 @@ namespace agg
|
||||||
//------------------------------------------------------------------line_mr
|
//------------------------------------------------------------------line_mr
|
||||||
AGG_INLINE int line_mr(int x)
|
AGG_INLINE int line_mr(int x)
|
||||||
{
|
{
|
||||||
return x >> (line_subpixel_shift - line_mr_subpixel_shift);
|
return x >> (line_subpixel_shift - static_cast<line_subpixel_scale_e>(line_mr_subpixel_shift));
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------line_hr
|
//-------------------------------------------------------------------line_hr
|
||||||
AGG_INLINE int line_hr(int x)
|
AGG_INLINE int line_hr(int x)
|
||||||
{
|
{
|
||||||
return x << (line_subpixel_shift - line_mr_subpixel_shift);
|
return x << (line_subpixel_shift - static_cast<line_subpixel_scale_e>(line_mr_subpixel_shift));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------line_dbl_hr
|
//---------------------------------------------------------------line_dbl_hr
|
||||||
|
@ -64,7 +64,7 @@ namespace agg
|
||||||
{
|
{
|
||||||
AGG_INLINE static int conv(double x)
|
AGG_INLINE static int conv(double x)
|
||||||
{
|
{
|
||||||
return iround(x * line_subpixel_scale);
|
return iround(x * static_cast<double>(line_subpixel_scale));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ namespace agg
|
||||||
{
|
{
|
||||||
AGG_INLINE static int conv(double x)
|
AGG_INLINE static int conv(double x)
|
||||||
{
|
{
|
||||||
return saturation<line_max_coord>::iround(x * line_subpixel_scale);
|
return saturation<line_max_coord>::iround(x * static_cast<double>(line_subpixel_scale));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
273
deps/agg/include/agg_path_storage.h
vendored
273
deps/agg/include/agg_path_storage.h
vendored
|
@ -2,8 +2,8 @@
|
||||||
// Anti-Grain Geometry - Version 2.4
|
// Anti-Grain Geometry - Version 2.4
|
||||||
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Permission to copy, use, modify, sell and distribute this software
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// is granted provided this copyright notice appears in all copies.
|
||||||
// This software is provided "as is" without express or implied
|
// This software is provided "as is" without express or implied
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
// warranty, and with no claim as to its suitability for any purpose.
|
||||||
//
|
//
|
||||||
|
@ -92,7 +92,7 @@ namespace agg
|
||||||
{
|
{
|
||||||
pod_allocator<T>::deallocate(
|
pod_allocator<T>::deallocate(
|
||||||
*coord_blk,
|
*coord_blk,
|
||||||
block_size * 2 +
|
block_size * 2 +
|
||||||
block_size / (sizeof(T) / sizeof(unsigned char)));
|
block_size / (sizeof(T) / sizeof(unsigned char)));
|
||||||
--coord_blk;
|
--coord_blk;
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ namespace agg
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class T, unsigned S, unsigned P>
|
template<class T, unsigned S, unsigned P>
|
||||||
const vertex_block_storage<T,S,P>&
|
const vertex_block_storage<T,S,P>&
|
||||||
vertex_block_storage<T,S,P>::operator = (const vertex_block_storage<T,S,P>& v)
|
vertex_block_storage<T,S,P>::operator = (const vertex_block_storage<T,S,P>& v)
|
||||||
{
|
{
|
||||||
remove_all();
|
remove_all();
|
||||||
|
@ -160,7 +160,7 @@ namespace agg
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class T, unsigned S, unsigned P>
|
template<class T, unsigned S, unsigned P>
|
||||||
inline void vertex_block_storage<T,S,P>::add_vertex(double x, double y,
|
inline void vertex_block_storage<T,S,P>::add_vertex(double x, double y,
|
||||||
unsigned cmd)
|
unsigned cmd)
|
||||||
{
|
{
|
||||||
T* coord_ptr = 0;
|
T* coord_ptr = 0;
|
||||||
|
@ -172,7 +172,7 @@ namespace agg
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class T, unsigned S, unsigned P>
|
template<class T, unsigned S, unsigned P>
|
||||||
inline void vertex_block_storage<T,S,P>::modify_vertex(unsigned idx,
|
inline void vertex_block_storage<T,S,P>::modify_vertex(unsigned idx,
|
||||||
double x, double y)
|
double x, double y)
|
||||||
{
|
{
|
||||||
T* pv = m_coord_blocks[idx >> block_shift] + ((idx & block_mask) << 1);
|
T* pv = m_coord_blocks[idx >> block_shift] + ((idx & block_mask) << 1);
|
||||||
|
@ -182,8 +182,8 @@ namespace agg
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class T, unsigned S, unsigned P>
|
template<class T, unsigned S, unsigned P>
|
||||||
inline void vertex_block_storage<T,S,P>::modify_vertex(unsigned idx,
|
inline void vertex_block_storage<T,S,P>::modify_vertex(unsigned idx,
|
||||||
double x, double y,
|
double x, double y,
|
||||||
unsigned cmd)
|
unsigned cmd)
|
||||||
{
|
{
|
||||||
unsigned block = idx >> block_shift;
|
unsigned block = idx >> block_shift;
|
||||||
|
@ -196,7 +196,7 @@ namespace agg
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class T, unsigned S, unsigned P>
|
template<class T, unsigned S, unsigned P>
|
||||||
inline void vertex_block_storage<T,S,P>::modify_command(unsigned idx,
|
inline void vertex_block_storage<T,S,P>::modify_command(unsigned idx,
|
||||||
unsigned cmd)
|
unsigned cmd)
|
||||||
{
|
{
|
||||||
m_cmd_blocks[idx >> block_shift][idx & block_mask] = (int8u)cmd;
|
m_cmd_blocks[idx >> block_shift][idx & block_mask] = (int8u)cmd;
|
||||||
|
@ -277,7 +277,7 @@ namespace agg
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class T, unsigned S, unsigned P>
|
template<class T, unsigned S, unsigned P>
|
||||||
inline unsigned vertex_block_storage<T,S,P>::vertex(unsigned idx,
|
inline unsigned vertex_block_storage<T,S,P>::vertex(unsigned idx,
|
||||||
double* x, double* y) const
|
double* x, double* y) const
|
||||||
{
|
{
|
||||||
unsigned nb = idx >> block_shift;
|
unsigned nb = idx >> block_shift;
|
||||||
|
@ -298,22 +298,22 @@ namespace agg
|
||||||
template<class T, unsigned S, unsigned P>
|
template<class T, unsigned S, unsigned P>
|
||||||
void vertex_block_storage<T,S,P>::allocate_block(unsigned nb)
|
void vertex_block_storage<T,S,P>::allocate_block(unsigned nb)
|
||||||
{
|
{
|
||||||
if(nb >= m_max_blocks)
|
if(nb >= m_max_blocks)
|
||||||
{
|
{
|
||||||
T** new_coords =
|
T** new_coords =
|
||||||
pod_allocator<T*>::allocate((m_max_blocks + block_pool) * 2);
|
pod_allocator<T*>::allocate((m_max_blocks + block_pool) * 2);
|
||||||
|
|
||||||
unsigned char** new_cmds =
|
unsigned char** new_cmds =
|
||||||
(unsigned char**)(new_coords + m_max_blocks + block_pool);
|
(unsigned char**)(new_coords + m_max_blocks + block_pool);
|
||||||
|
|
||||||
if(m_coord_blocks)
|
if(m_coord_blocks)
|
||||||
{
|
{
|
||||||
memcpy(new_coords,
|
memcpy(new_coords,
|
||||||
m_coord_blocks,
|
m_coord_blocks,
|
||||||
m_max_blocks * sizeof(T*));
|
m_max_blocks * sizeof(T*));
|
||||||
|
|
||||||
memcpy(new_cmds,
|
memcpy(new_cmds,
|
||||||
m_cmd_blocks,
|
m_cmd_blocks,
|
||||||
m_max_blocks * sizeof(unsigned char*));
|
m_max_blocks * sizeof(unsigned char*));
|
||||||
|
|
||||||
pod_allocator<T*>::deallocate(m_coord_blocks, m_max_blocks * 2);
|
pod_allocator<T*>::deallocate(m_coord_blocks, m_max_blocks * 2);
|
||||||
|
@ -322,11 +322,11 @@ namespace agg
|
||||||
m_cmd_blocks = new_cmds;
|
m_cmd_blocks = new_cmds;
|
||||||
m_max_blocks += block_pool;
|
m_max_blocks += block_pool;
|
||||||
}
|
}
|
||||||
m_coord_blocks[nb] =
|
m_coord_blocks[nb] =
|
||||||
pod_allocator<T>::allocate(block_size * 2 +
|
pod_allocator<T>::allocate(block_size * 2 +
|
||||||
block_size / (sizeof(T) / sizeof(unsigned char)));
|
block_size / (sizeof(T) / sizeof(unsigned char)));
|
||||||
|
|
||||||
m_cmd_blocks[nb] =
|
m_cmd_blocks[nb] =
|
||||||
(unsigned char*)(m_coord_blocks[nb] + block_size * 2);
|
(unsigned char*)(m_coord_blocks[nb] + block_size * 2);
|
||||||
|
|
||||||
m_total_blocks++;
|
m_total_blocks++;
|
||||||
|
@ -354,8 +354,8 @@ namespace agg
|
||||||
public:
|
public:
|
||||||
typedef T value_type;
|
typedef T value_type;
|
||||||
|
|
||||||
poly_plain_adaptor() :
|
poly_plain_adaptor() :
|
||||||
m_data(0),
|
m_data(0),
|
||||||
m_ptr(0),
|
m_ptr(0),
|
||||||
m_end(0),
|
m_end(0),
|
||||||
m_closed(false),
|
m_closed(false),
|
||||||
|
@ -363,7 +363,7 @@ namespace agg
|
||||||
{}
|
{}
|
||||||
|
|
||||||
poly_plain_adaptor(const T* data, unsigned num_points, bool closed) :
|
poly_plain_adaptor(const T* data, unsigned num_points, bool closed) :
|
||||||
m_data(data),
|
m_data(data),
|
||||||
m_ptr(data),
|
m_ptr(data),
|
||||||
m_end(data + num_points * 2),
|
m_end(data + num_points * 2),
|
||||||
m_closed(closed),
|
m_closed(closed),
|
||||||
|
@ -398,7 +398,8 @@ namespace agg
|
||||||
if(m_closed && !m_stop)
|
if(m_closed && !m_stop)
|
||||||
{
|
{
|
||||||
m_stop = true;
|
m_stop = true;
|
||||||
return path_cmd_end_poly | path_flags_close;
|
return path_cmd_end_poly
|
||||||
|
| static_cast<agg::path_commands_e>(path_flags_close);
|
||||||
}
|
}
|
||||||
return path_cmd_stop;
|
return path_cmd_stop;
|
||||||
}
|
}
|
||||||
|
@ -421,15 +422,15 @@ namespace agg
|
||||||
public:
|
public:
|
||||||
typedef typename Container::value_type vertex_type;
|
typedef typename Container::value_type vertex_type;
|
||||||
|
|
||||||
poly_container_adaptor() :
|
poly_container_adaptor() :
|
||||||
m_container(0),
|
m_container(0),
|
||||||
m_index(0),
|
m_index(0),
|
||||||
m_closed(false),
|
m_closed(false),
|
||||||
m_stop(false)
|
m_stop(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
poly_container_adaptor(const Container& data, bool closed) :
|
poly_container_adaptor(const Container& data, bool closed) :
|
||||||
m_container(&data),
|
m_container(&data),
|
||||||
m_index(0),
|
m_index(0),
|
||||||
m_closed(closed),
|
m_closed(closed),
|
||||||
m_stop(false)
|
m_stop(false)
|
||||||
|
@ -463,7 +464,8 @@ namespace agg
|
||||||
if(m_closed && !m_stop)
|
if(m_closed && !m_stop)
|
||||||
{
|
{
|
||||||
m_stop = true;
|
m_stop = true;
|
||||||
return path_cmd_end_poly | path_flags_close;
|
return path_cmd_end_poly
|
||||||
|
| static_cast<agg::path_commands_e>(path_flags_close);
|
||||||
}
|
}
|
||||||
return path_cmd_stop;
|
return path_cmd_stop;
|
||||||
}
|
}
|
||||||
|
@ -483,15 +485,15 @@ namespace agg
|
||||||
public:
|
public:
|
||||||
typedef typename Container::value_type vertex_type;
|
typedef typename Container::value_type vertex_type;
|
||||||
|
|
||||||
poly_container_reverse_adaptor() :
|
poly_container_reverse_adaptor() :
|
||||||
m_container(0),
|
m_container(0),
|
||||||
m_index(-1),
|
m_index(-1),
|
||||||
m_closed(false),
|
m_closed(false),
|
||||||
m_stop(false)
|
m_stop(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
poly_container_reverse_adaptor(const Container& data, bool closed) :
|
poly_container_reverse_adaptor(const Container& data, bool closed) :
|
||||||
m_container(&data),
|
m_container(&data),
|
||||||
m_index(-1),
|
m_index(-1),
|
||||||
m_closed(closed),
|
m_closed(closed),
|
||||||
m_stop(false)
|
m_stop(false)
|
||||||
|
@ -525,7 +527,8 @@ namespace agg
|
||||||
if(m_closed && !m_stop)
|
if(m_closed && !m_stop)
|
||||||
{
|
{
|
||||||
m_stop = true;
|
m_stop = true;
|
||||||
return path_cmd_end_poly | path_flags_close;
|
return path_cmd_end_poly
|
||||||
|
| static_cast<agg::path_commands_e>(path_flags_close);
|
||||||
}
|
}
|
||||||
return path_cmd_stop;
|
return path_cmd_stop;
|
||||||
}
|
}
|
||||||
|
@ -556,7 +559,7 @@ namespace agg
|
||||||
m_coord[2] = x2;
|
m_coord[2] = x2;
|
||||||
m_coord[3] = y2;
|
m_coord[3] = y2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init(double x1, double y1, double x2, double y2)
|
void init(double x1, double y1, double x2, double y2)
|
||||||
{
|
{
|
||||||
m_coord[0] = x1;
|
m_coord[0] = x1;
|
||||||
|
@ -594,10 +597,10 @@ namespace agg
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------path_base
|
//---------------------------------------------------------------path_base
|
||||||
// A container to store vertices with their flags.
|
// A container to store vertices with their flags.
|
||||||
// A path consists of a number of contours separated with "move_to"
|
// A path consists of a number of contours separated with "move_to"
|
||||||
// commands. The path storage can keep and maintain more than one
|
// commands. The path storage can keep and maintain more than one
|
||||||
// path.
|
// path.
|
||||||
// To navigate to the beginning of a particular path, use rewind(path_id);
|
// To navigate to the beginning of a particular path, use rewind(path_id);
|
||||||
// Where path_id is what start_new_path() returns. So, when you call
|
// Where path_id is what start_new_path() returns. So, when you call
|
||||||
// start_new_path() you need to store its return value somewhere else
|
// start_new_path() you need to store its return value somewhere else
|
||||||
|
@ -644,28 +647,28 @@ namespace agg
|
||||||
bool sweep_flag,
|
bool sweep_flag,
|
||||||
double dx, double dy);
|
double dx, double dy);
|
||||||
|
|
||||||
void curve3(double x_ctrl, double y_ctrl,
|
void curve3(double x_ctrl, double y_ctrl,
|
||||||
double x_to, double y_to);
|
double x_to, double y_to);
|
||||||
|
|
||||||
void curve3_rel(double dx_ctrl, double dy_ctrl,
|
void curve3_rel(double dx_ctrl, double dy_ctrl,
|
||||||
double dx_to, double dy_to);
|
double dx_to, double dy_to);
|
||||||
|
|
||||||
void curve3(double x_to, double y_to);
|
void curve3(double x_to, double y_to);
|
||||||
|
|
||||||
void curve3_rel(double dx_to, double dy_to);
|
void curve3_rel(double dx_to, double dy_to);
|
||||||
|
|
||||||
void curve4(double x_ctrl1, double y_ctrl1,
|
void curve4(double x_ctrl1, double y_ctrl1,
|
||||||
double x_ctrl2, double y_ctrl2,
|
double x_ctrl2, double y_ctrl2,
|
||||||
double x_to, double y_to);
|
double x_to, double y_to);
|
||||||
|
|
||||||
void curve4_rel(double dx_ctrl1, double dy_ctrl1,
|
void curve4_rel(double dx_ctrl1, double dy_ctrl1,
|
||||||
double dx_ctrl2, double dy_ctrl2,
|
double dx_ctrl2, double dy_ctrl2,
|
||||||
double dx_to, double dy_to);
|
double dx_to, double dy_to);
|
||||||
|
|
||||||
void curve4(double x_ctrl2, double y_ctrl2,
|
void curve4(double x_ctrl2, double y_ctrl2,
|
||||||
double x_to, double y_to);
|
double x_to, double y_to);
|
||||||
|
|
||||||
void curve4_rel(double x_ctrl2, double y_ctrl2,
|
void curve4_rel(double x_ctrl2, double y_ctrl2,
|
||||||
double x_to, double y_to);
|
double x_to, double y_to);
|
||||||
|
|
||||||
|
|
||||||
|
@ -674,8 +677,8 @@ namespace agg
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
const container_type& vertices() const { return m_vertices; }
|
const container_type& vertices() const { return m_vertices; }
|
||||||
container_type& vertices() { return m_vertices; }
|
container_type& vertices() { return m_vertices; }
|
||||||
|
|
||||||
unsigned total_vertices() const;
|
unsigned total_vertices() const;
|
||||||
|
|
||||||
|
@ -699,9 +702,9 @@ namespace agg
|
||||||
void rewind(unsigned path_id);
|
void rewind(unsigned path_id);
|
||||||
unsigned vertex(double* x, double* y);
|
unsigned vertex(double* x, double* y);
|
||||||
|
|
||||||
// Arrange the orientation of a polygon, all polygons in a path,
|
// Arrange the orientation of a polygon, all polygons in a path,
|
||||||
// or in all paths. After calling arrange_orientations() or
|
// or in all paths. After calling arrange_orientations() or
|
||||||
// arrange_orientations_all_paths(), all the polygons will have
|
// arrange_orientations_all_paths(), all the polygons will have
|
||||||
// the same orientation, i.e. path_flags_cw or path_flags_ccw
|
// the same orientation, i.e. path_flags_cw or path_flags_ccw
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
unsigned arrange_polygon_orientation(unsigned start, path_flags_e orientation);
|
unsigned arrange_polygon_orientation(unsigned start, path_flags_e orientation);
|
||||||
|
@ -709,7 +712,7 @@ namespace agg
|
||||||
void arrange_orientations_all_paths(path_flags_e orientation);
|
void arrange_orientations_all_paths(path_flags_e orientation);
|
||||||
void invert_polygon(unsigned start);
|
void invert_polygon(unsigned start);
|
||||||
|
|
||||||
// Flip all vertices horizontally or vertically,
|
// Flip all vertices horizontally or vertically,
|
||||||
// between x1 and x2, or between y1 and y2 respectively
|
// between x1 and x2, or between y1 and y2 respectively
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
void flip_x(double x1, double x2);
|
void flip_x(double x1, double x2);
|
||||||
|
@ -717,7 +720,7 @@ namespace agg
|
||||||
|
|
||||||
// Concatenate path. The path is added as is.
|
// Concatenate path. The path is added as is.
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
template<class VertexSource>
|
template<class VertexSource>
|
||||||
void concat_path(VertexSource& vs, unsigned path_id = 0)
|
void concat_path(VertexSource& vs, unsigned path_id = 0)
|
||||||
{
|
{
|
||||||
double x=0;
|
double x=0;
|
||||||
|
@ -731,9 +734,9 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
// Join path. The path is joined with the existing one, that is,
|
// Join path. The path is joined with the existing one, that is,
|
||||||
// it behaves as if the pen of a plotter was always down (drawing)
|
// it behaves as if the pen of a plotter was always down (drawing)
|
||||||
template<class VertexSource>
|
template<class VertexSource>
|
||||||
void join_path(VertexSource& vs, unsigned path_id = 0)
|
void join_path(VertexSource& vs, unsigned path_id = 0)
|
||||||
{
|
{
|
||||||
double x=0.0, y=0.0;
|
double x=0.0, y=0.0;
|
||||||
|
@ -769,16 +772,16 @@ namespace agg
|
||||||
}
|
}
|
||||||
while(!is_stop(cmd = vs.vertex(&x, &y)))
|
while(!is_stop(cmd = vs.vertex(&x, &y)))
|
||||||
{
|
{
|
||||||
m_vertices.add_vertex(x, y, is_move_to(cmd) ?
|
m_vertices.add_vertex(x, y, is_move_to(cmd) ?
|
||||||
unsigned(path_cmd_line_to) :
|
unsigned(path_cmd_line_to) :
|
||||||
cmd);
|
cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Concatenate polygon/polyline.
|
// Concatenate polygon/polyline.
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
template<class T> void concat_poly(const T* data,
|
template<class T> void concat_poly(const T* data,
|
||||||
unsigned num_points,
|
unsigned num_points,
|
||||||
bool closed)
|
bool closed)
|
||||||
{
|
{
|
||||||
|
@ -788,7 +791,7 @@ namespace agg
|
||||||
|
|
||||||
// Join polygon/polyline continuously.
|
// Join polygon/polyline continuously.
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
template<class T> void join_poly(const T* data,
|
template<class T> void join_poly(const T* data,
|
||||||
unsigned num_points,
|
unsigned num_points,
|
||||||
bool closed)
|
bool closed)
|
||||||
{
|
{
|
||||||
|
@ -846,7 +849,7 @@ namespace agg
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
unsigned path_base<VC>::start_new_path()
|
unsigned path_base<VC>::start_new_path()
|
||||||
{
|
{
|
||||||
if(!is_stop(m_vertices.last_command()))
|
if(!is_stop(m_vertices.last_command()))
|
||||||
|
@ -858,7 +861,7 @@ namespace agg
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
inline void path_base<VC>::rel_to_abs(double* x, double* y) const
|
inline void path_base<VC>::rel_to_abs(double* x, double* y) const
|
||||||
{
|
{
|
||||||
if(m_vertices.total_vertices())
|
if(m_vertices.total_vertices())
|
||||||
|
@ -870,7 +873,7 @@ namespace agg
|
||||||
*x += x2;
|
*x += x2;
|
||||||
*y += y2;
|
*y += y2;
|
||||||
}
|
}
|
||||||
else if (!is_stop(m_vertices.last_command()) &&
|
else if (!is_stop(m_vertices.last_command()) &&
|
||||||
is_vertex(m_vertices.prev_vertex(&x2, &y2)))
|
is_vertex(m_vertices.prev_vertex(&x2, &y2)))
|
||||||
{
|
{
|
||||||
*x += x2;
|
*x += x2;
|
||||||
|
@ -880,14 +883,14 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
inline void path_base<VC>::move_to(double x, double y)
|
inline void path_base<VC>::move_to(double x, double y)
|
||||||
{
|
{
|
||||||
m_vertices.add_vertex(x, y, path_cmd_move_to);
|
m_vertices.add_vertex(x, y, path_cmd_move_to);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
inline void path_base<VC>::move_rel(double dx, double dy)
|
inline void path_base<VC>::move_rel(double dx, double dy)
|
||||||
{
|
{
|
||||||
rel_to_abs(&dx, &dy);
|
rel_to_abs(&dx, &dy);
|
||||||
|
@ -895,14 +898,14 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
inline void path_base<VC>::line_to(double x, double y)
|
inline void path_base<VC>::line_to(double x, double y)
|
||||||
{
|
{
|
||||||
m_vertices.add_vertex(x, y, path_cmd_line_to);
|
m_vertices.add_vertex(x, y, path_cmd_line_to);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
inline void path_base<VC>::line_rel(double dx, double dy)
|
inline void path_base<VC>::line_rel(double dx, double dy)
|
||||||
{
|
{
|
||||||
rel_to_abs(&dx, &dy);
|
rel_to_abs(&dx, &dy);
|
||||||
|
@ -910,14 +913,14 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
inline void path_base<VC>::hline_to(double x)
|
inline void path_base<VC>::hline_to(double x)
|
||||||
{
|
{
|
||||||
m_vertices.add_vertex(x, last_y(), path_cmd_line_to);
|
m_vertices.add_vertex(x, last_y(), path_cmd_line_to);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
inline void path_base<VC>::hline_rel(double dx)
|
inline void path_base<VC>::hline_rel(double dx)
|
||||||
{
|
{
|
||||||
double dy = 0;
|
double dy = 0;
|
||||||
|
@ -926,14 +929,14 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
inline void path_base<VC>::vline_to(double y)
|
inline void path_base<VC>::vline_to(double y)
|
||||||
{
|
{
|
||||||
m_vertices.add_vertex(last_x(), y, path_cmd_line_to);
|
m_vertices.add_vertex(last_x(), y, path_cmd_line_to);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
inline void path_base<VC>::vline_rel(double dy)
|
inline void path_base<VC>::vline_rel(double dy)
|
||||||
{
|
{
|
||||||
double dx = 0;
|
double dx = 0;
|
||||||
|
@ -942,7 +945,7 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
void path_base<VC>::arc_to(double rx, double ry,
|
void path_base<VC>::arc_to(double rx, double ry,
|
||||||
double angle,
|
double angle,
|
||||||
bool large_arc_flag,
|
bool large_arc_flag,
|
||||||
|
@ -961,7 +964,7 @@ namespace agg
|
||||||
|
|
||||||
// Ensure radii are valid
|
// Ensure radii are valid
|
||||||
//-------------------------
|
//-------------------------
|
||||||
if(rx < epsilon || ry < epsilon)
|
if(rx < epsilon || ry < epsilon)
|
||||||
{
|
{
|
||||||
line_to(x, y);
|
line_to(x, y);
|
||||||
return;
|
return;
|
||||||
|
@ -990,7 +993,7 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
void path_base<VC>::arc_rel(double rx, double ry,
|
void path_base<VC>::arc_rel(double rx, double ry,
|
||||||
double angle,
|
double angle,
|
||||||
bool large_arc_flag,
|
bool large_arc_flag,
|
||||||
|
@ -1002,8 +1005,8 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
void path_base<VC>::curve3(double x_ctrl, double y_ctrl,
|
void path_base<VC>::curve3(double x_ctrl, double y_ctrl,
|
||||||
double x_to, double y_to)
|
double x_to, double y_to)
|
||||||
{
|
{
|
||||||
m_vertices.add_vertex(x_ctrl, y_ctrl, path_cmd_curve3);
|
m_vertices.add_vertex(x_ctrl, y_ctrl, path_cmd_curve3);
|
||||||
|
@ -1011,8 +1014,8 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
void path_base<VC>::curve3_rel(double dx_ctrl, double dy_ctrl,
|
void path_base<VC>::curve3_rel(double dx_ctrl, double dy_ctrl,
|
||||||
double dx_to, double dy_to)
|
double dx_to, double dy_to)
|
||||||
{
|
{
|
||||||
rel_to_abs(&dx_ctrl, &dy_ctrl);
|
rel_to_abs(&dx_ctrl, &dy_ctrl);
|
||||||
|
@ -1022,7 +1025,7 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
void path_base<VC>::curve3(double x_to, double y_to)
|
void path_base<VC>::curve3(double x_to, double y_to)
|
||||||
{
|
{
|
||||||
double x0;
|
double x0;
|
||||||
|
@ -1030,7 +1033,7 @@ namespace agg
|
||||||
if(is_vertex(m_vertices.last_vertex(&x0, &y0)))
|
if(is_vertex(m_vertices.last_vertex(&x0, &y0)))
|
||||||
{
|
{
|
||||||
double x_ctrl;
|
double x_ctrl;
|
||||||
double y_ctrl;
|
double y_ctrl;
|
||||||
unsigned cmd = m_vertices.prev_vertex(&x_ctrl, &y_ctrl);
|
unsigned cmd = m_vertices.prev_vertex(&x_ctrl, &y_ctrl);
|
||||||
if(is_curve(cmd))
|
if(is_curve(cmd))
|
||||||
{
|
{
|
||||||
|
@ -1047,7 +1050,7 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
void path_base<VC>::curve3_rel(double dx_to, double dy_to)
|
void path_base<VC>::curve3_rel(double dx_to, double dy_to)
|
||||||
{
|
{
|
||||||
rel_to_abs(&dx_to, &dy_to);
|
rel_to_abs(&dx_to, &dy_to);
|
||||||
|
@ -1055,9 +1058,9 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
void path_base<VC>::curve4(double x_ctrl1, double y_ctrl1,
|
void path_base<VC>::curve4(double x_ctrl1, double y_ctrl1,
|
||||||
double x_ctrl2, double y_ctrl2,
|
double x_ctrl2, double y_ctrl2,
|
||||||
double x_to, double y_to)
|
double x_to, double y_to)
|
||||||
{
|
{
|
||||||
m_vertices.add_vertex(x_ctrl1, y_ctrl1, path_cmd_curve4);
|
m_vertices.add_vertex(x_ctrl1, y_ctrl1, path_cmd_curve4);
|
||||||
|
@ -1066,9 +1069,9 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
void path_base<VC>::curve4_rel(double dx_ctrl1, double dy_ctrl1,
|
void path_base<VC>::curve4_rel(double dx_ctrl1, double dy_ctrl1,
|
||||||
double dx_ctrl2, double dy_ctrl2,
|
double dx_ctrl2, double dy_ctrl2,
|
||||||
double dx_to, double dy_to)
|
double dx_to, double dy_to)
|
||||||
{
|
{
|
||||||
rel_to_abs(&dx_ctrl1, &dy_ctrl1);
|
rel_to_abs(&dx_ctrl1, &dy_ctrl1);
|
||||||
|
@ -1080,8 +1083,8 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
void path_base<VC>::curve4(double x_ctrl2, double y_ctrl2,
|
void path_base<VC>::curve4(double x_ctrl2, double y_ctrl2,
|
||||||
double x_to, double y_to)
|
double x_to, double y_to)
|
||||||
{
|
{
|
||||||
double x0;
|
double x0;
|
||||||
|
@ -1089,7 +1092,7 @@ namespace agg
|
||||||
if(is_vertex(last_vertex(&x0, &y0)))
|
if(is_vertex(last_vertex(&x0, &y0)))
|
||||||
{
|
{
|
||||||
double x_ctrl1;
|
double x_ctrl1;
|
||||||
double y_ctrl1;
|
double y_ctrl1;
|
||||||
unsigned cmd = prev_vertex(&x_ctrl1, &y_ctrl1);
|
unsigned cmd = prev_vertex(&x_ctrl1, &y_ctrl1);
|
||||||
if(is_curve(cmd))
|
if(is_curve(cmd))
|
||||||
{
|
{
|
||||||
|
@ -1106,8 +1109,8 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
void path_base<VC>::curve4_rel(double dx_ctrl2, double dy_ctrl2,
|
void path_base<VC>::curve4_rel(double dx_ctrl2, double dy_ctrl2,
|
||||||
double dx_to, double dy_to)
|
double dx_to, double dy_to)
|
||||||
{
|
{
|
||||||
rel_to_abs(&dx_ctrl2, &dy_ctrl2);
|
rel_to_abs(&dx_ctrl2, &dy_ctrl2);
|
||||||
|
@ -1116,7 +1119,7 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
inline void path_base<VC>::end_poly(unsigned flags)
|
inline void path_base<VC>::end_poly(unsigned flags)
|
||||||
{
|
{
|
||||||
if(is_vertex(m_vertices.last_command()))
|
if(is_vertex(m_vertices.last_command()))
|
||||||
|
@ -1126,91 +1129,91 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
inline void path_base<VC>::close_polygon(unsigned flags)
|
inline void path_base<VC>::close_polygon(unsigned flags)
|
||||||
{
|
{
|
||||||
end_poly(path_flags_close | flags);
|
end_poly(path_flags_close | flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
inline unsigned path_base<VC>::total_vertices() const
|
inline unsigned path_base<VC>::total_vertices() const
|
||||||
{
|
{
|
||||||
return m_vertices.total_vertices();
|
return m_vertices.total_vertices();
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
inline unsigned path_base<VC>::last_vertex(double* x, double* y) const
|
inline unsigned path_base<VC>::last_vertex(double* x, double* y) const
|
||||||
{
|
{
|
||||||
return m_vertices.last_vertex(x, y);
|
return m_vertices.last_vertex(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
inline unsigned path_base<VC>::prev_vertex(double* x, double* y) const
|
inline unsigned path_base<VC>::prev_vertex(double* x, double* y) const
|
||||||
{
|
{
|
||||||
return m_vertices.prev_vertex(x, y);
|
return m_vertices.prev_vertex(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
inline double path_base<VC>::last_x() const
|
inline double path_base<VC>::last_x() const
|
||||||
{
|
{
|
||||||
return m_vertices.last_x();
|
return m_vertices.last_x();
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
inline double path_base<VC>::last_y() const
|
inline double path_base<VC>::last_y() const
|
||||||
{
|
{
|
||||||
return m_vertices.last_y();
|
return m_vertices.last_y();
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
inline unsigned path_base<VC>::vertex(unsigned idx, double* x, double* y) const
|
inline unsigned path_base<VC>::vertex(unsigned idx, double* x, double* y) const
|
||||||
{
|
{
|
||||||
return m_vertices.vertex(idx, x, y);
|
return m_vertices.vertex(idx, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
inline unsigned path_base<VC>::command(unsigned idx) const
|
inline unsigned path_base<VC>::command(unsigned idx) const
|
||||||
{
|
{
|
||||||
return m_vertices.command(idx);
|
return m_vertices.command(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
void path_base<VC>::modify_vertex(unsigned idx, double x, double y)
|
void path_base<VC>::modify_vertex(unsigned idx, double x, double y)
|
||||||
{
|
{
|
||||||
m_vertices.modify_vertex(idx, x, y);
|
m_vertices.modify_vertex(idx, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
void path_base<VC>::modify_vertex(unsigned idx, double x, double y, unsigned cmd)
|
void path_base<VC>::modify_vertex(unsigned idx, double x, double y, unsigned cmd)
|
||||||
{
|
{
|
||||||
m_vertices.modify_vertex(idx, x, y, cmd);
|
m_vertices.modify_vertex(idx, x, y, cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
void path_base<VC>::modify_command(unsigned idx, unsigned cmd)
|
void path_base<VC>::modify_command(unsigned idx, unsigned cmd)
|
||||||
{
|
{
|
||||||
m_vertices.modify_command(idx, cmd);
|
m_vertices.modify_command(idx, cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
inline void path_base<VC>::rewind(unsigned path_id)
|
inline void path_base<VC>::rewind(unsigned path_id)
|
||||||
{
|
{
|
||||||
m_iterator = path_id;
|
m_iterator = path_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
inline unsigned path_base<VC>::vertex(double* x, double* y)
|
inline unsigned path_base<VC>::vertex(double* x, double* y)
|
||||||
{
|
{
|
||||||
if(m_iterator >= m_vertices.total_vertices()) return path_cmd_stop;
|
if(m_iterator >= m_vertices.total_vertices()) return path_cmd_stop;
|
||||||
|
@ -1218,7 +1221,7 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
unsigned path_base<VC>::perceive_polygon_orientation(unsigned start,
|
unsigned path_base<VC>::perceive_polygon_orientation(unsigned start,
|
||||||
unsigned end)
|
unsigned end)
|
||||||
{
|
{
|
||||||
|
@ -1238,12 +1241,12 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
void path_base<VC>::invert_polygon(unsigned start, unsigned end)
|
void path_base<VC>::invert_polygon(unsigned start, unsigned end)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
unsigned tmp_cmd = m_vertices.command(start);
|
unsigned tmp_cmd = m_vertices.command(start);
|
||||||
|
|
||||||
--end; // Make "end" inclusive
|
--end; // Make "end" inclusive
|
||||||
|
|
||||||
// Shift all commands to one position
|
// Shift all commands to one position
|
||||||
|
@ -1263,45 +1266,45 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
void path_base<VC>::invert_polygon(unsigned start)
|
void path_base<VC>::invert_polygon(unsigned start)
|
||||||
{
|
{
|
||||||
// Skip all non-vertices at the beginning
|
// Skip all non-vertices at the beginning
|
||||||
while(start < m_vertices.total_vertices() &&
|
while(start < m_vertices.total_vertices() &&
|
||||||
!is_vertex(m_vertices.command(start))) ++start;
|
!is_vertex(m_vertices.command(start))) ++start;
|
||||||
|
|
||||||
// Skip all insignificant move_to
|
// Skip all insignificant move_to
|
||||||
while(start+1 < m_vertices.total_vertices() &&
|
while(start+1 < m_vertices.total_vertices() &&
|
||||||
is_move_to(m_vertices.command(start)) &&
|
is_move_to(m_vertices.command(start)) &&
|
||||||
is_move_to(m_vertices.command(start+1))) ++start;
|
is_move_to(m_vertices.command(start+1))) ++start;
|
||||||
|
|
||||||
// Find the last vertex
|
// Find the last vertex
|
||||||
unsigned end = start + 1;
|
unsigned end = start + 1;
|
||||||
while(end < m_vertices.total_vertices() &&
|
while(end < m_vertices.total_vertices() &&
|
||||||
!is_next_poly(m_vertices.command(end))) ++end;
|
!is_next_poly(m_vertices.command(end))) ++end;
|
||||||
|
|
||||||
invert_polygon(start, end);
|
invert_polygon(start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
unsigned path_base<VC>::arrange_polygon_orientation(unsigned start,
|
unsigned path_base<VC>::arrange_polygon_orientation(unsigned start,
|
||||||
path_flags_e orientation)
|
path_flags_e orientation)
|
||||||
{
|
{
|
||||||
if(orientation == path_flags_none) return start;
|
if(orientation == path_flags_none) return start;
|
||||||
|
|
||||||
// Skip all non-vertices at the beginning
|
// Skip all non-vertices at the beginning
|
||||||
while(start < m_vertices.total_vertices() &&
|
while(start < m_vertices.total_vertices() &&
|
||||||
!is_vertex(m_vertices.command(start))) ++start;
|
!is_vertex(m_vertices.command(start))) ++start;
|
||||||
|
|
||||||
// Skip all insignificant move_to
|
// Skip all insignificant move_to
|
||||||
while(start+1 < m_vertices.total_vertices() &&
|
while(start+1 < m_vertices.total_vertices() &&
|
||||||
is_move_to(m_vertices.command(start)) &&
|
is_move_to(m_vertices.command(start)) &&
|
||||||
is_move_to(m_vertices.command(start+1))) ++start;
|
is_move_to(m_vertices.command(start+1))) ++start;
|
||||||
|
|
||||||
// Find the last vertex
|
// Find the last vertex
|
||||||
unsigned end = start + 1;
|
unsigned end = start + 1;
|
||||||
while(end < m_vertices.total_vertices() &&
|
while(end < m_vertices.total_vertices() &&
|
||||||
!is_next_poly(m_vertices.command(end))) ++end;
|
!is_next_poly(m_vertices.command(end))) ++end;
|
||||||
|
|
||||||
if(end - start > 2)
|
if(end - start > 2)
|
||||||
|
@ -1311,7 +1314,7 @@ namespace agg
|
||||||
// Invert polygon, set orientation flag, and skip all end_poly
|
// Invert polygon, set orientation flag, and skip all end_poly
|
||||||
invert_polygon(start, end);
|
invert_polygon(start, end);
|
||||||
unsigned cmd;
|
unsigned cmd;
|
||||||
while(end < m_vertices.total_vertices() &&
|
while(end < m_vertices.total_vertices() &&
|
||||||
is_end_poly(cmd = m_vertices.command(end)))
|
is_end_poly(cmd = m_vertices.command(end)))
|
||||||
{
|
{
|
||||||
m_vertices.modify_command(end++, set_orientation(cmd, orientation));
|
m_vertices.modify_command(end++, set_orientation(cmd, orientation));
|
||||||
|
@ -1322,8 +1325,8 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
unsigned path_base<VC>::arrange_orientations(unsigned start,
|
unsigned path_base<VC>::arrange_orientations(unsigned start,
|
||||||
path_flags_e orientation)
|
path_flags_e orientation)
|
||||||
{
|
{
|
||||||
if(orientation != path_flags_none)
|
if(orientation != path_flags_none)
|
||||||
|
@ -1342,7 +1345,7 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
void path_base<VC>::arrange_orientations_all_paths(path_flags_e orientation)
|
void path_base<VC>::arrange_orientations_all_paths(path_flags_e orientation)
|
||||||
{
|
{
|
||||||
if(orientation != path_flags_none)
|
if(orientation != path_flags_none)
|
||||||
|
@ -1356,7 +1359,7 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
void path_base<VC>::flip_x(double x1, double x2)
|
void path_base<VC>::flip_x(double x1, double x2)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
@ -1372,7 +1375,7 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
void path_base<VC>::flip_y(double y1, double y2)
|
void path_base<VC>::flip_y(double y1, double y2)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
@ -1388,7 +1391,7 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
void path_base<VC>::translate(double dx, double dy, unsigned path_id)
|
void path_base<VC>::translate(double dx, double dy, unsigned path_id)
|
||||||
{
|
{
|
||||||
unsigned num_ver = m_vertices.total_vertices();
|
unsigned num_ver = m_vertices.total_vertices();
|
||||||
|
@ -1407,7 +1410,7 @@ namespace agg
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class VC>
|
template<class VC>
|
||||||
void path_base<VC>::translate_all_paths(double dx, double dy)
|
void path_base<VC>::translate_all_paths(double dx, double dy)
|
||||||
{
|
{
|
||||||
unsigned idx;
|
unsigned idx;
|
||||||
|
@ -1440,8 +1443,8 @@ namespace agg
|
||||||
|
|
||||||
void add_vertex(double x, double y, unsigned cmd)
|
void add_vertex(double x, double y, unsigned cmd)
|
||||||
{
|
{
|
||||||
m_vertices.push_back(vertex_type(value_type(x),
|
m_vertices.push_back(vertex_type(value_type(x),
|
||||||
value_type(y),
|
value_type(y),
|
||||||
int8u(cmd)));
|
int8u(cmd)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1474,8 +1477,8 @@ namespace agg
|
||||||
|
|
||||||
unsigned last_command() const
|
unsigned last_command() const
|
||||||
{
|
{
|
||||||
return m_vertices.size() ?
|
return m_vertices.size() ?
|
||||||
m_vertices[m_vertices.size() - 1].cmd :
|
m_vertices[m_vertices.size() - 1].cmd :
|
||||||
path_cmd_stop;
|
path_cmd_stop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1545,11 +1548,11 @@ namespace agg
|
||||||
// Example of declarations path_storage with std::vector as a container
|
// Example of declarations path_storage with std::vector as a container
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
//#include <vector>
|
//#include <vector>
|
||||||
//namespace agg
|
//namespace agg
|
||||||
//{
|
//{
|
||||||
// typedef path_base<vertex_stl_storage<std::vector<vertex_d> > > path_storage;
|
// typedef path_base<vertex_stl_storage<std::vector<vertex_d> > > path_storage;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
22
deps/agg/include/agg_pixfmt_base.h
vendored
22
deps/agg/include/agg_pixfmt_base.h
vendored
|
@ -2,8 +2,8 @@
|
||||||
// Anti-Grain Geometry - Version 2.4
|
// Anti-Grain Geometry - Version 2.4
|
||||||
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Permission to copy, use, modify, sell and distribute this software
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// is granted provided this copyright notice appears in all copies.
|
||||||
// This software is provided "as is" without express or implied
|
// This software is provided "as is" without express or implied
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
// warranty, and with no claim as to its suitability for any purpose.
|
||||||
//
|
//
|
||||||
|
@ -35,7 +35,7 @@ namespace agg
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------------blender_base
|
//--------------------------------------------------------------blender_base
|
||||||
template<class ColorT, class Order = void>
|
template<class ColorT, class Order = void>
|
||||||
struct blender_base
|
struct blender_base
|
||||||
{
|
{
|
||||||
typedef ColorT color_type;
|
typedef ColorT color_type;
|
||||||
|
@ -47,14 +47,14 @@ namespace agg
|
||||||
if (cover > cover_none)
|
if (cover > cover_none)
|
||||||
{
|
{
|
||||||
rgba c(
|
rgba c(
|
||||||
color_type::to_double(r),
|
color_type::to_double(r),
|
||||||
color_type::to_double(g),
|
color_type::to_double(g),
|
||||||
color_type::to_double(b),
|
color_type::to_double(b),
|
||||||
color_type::to_double(a));
|
color_type::to_double(a));
|
||||||
|
|
||||||
if (cover < cover_full)
|
if (cover < cover_full)
|
||||||
{
|
{
|
||||||
double x = double(cover) / cover_full;
|
double x = static_cast<double>(cover) / static_cast<double>(cover_full);
|
||||||
c.r *= x;
|
c.r *= x;
|
||||||
c.g *= x;
|
c.g *= x;
|
||||||
c.b *= x;
|
c.b *= x;
|
||||||
|
@ -69,10 +69,10 @@ namespace agg
|
||||||
static rgba get(const value_type* p, cover_type cover = cover_full)
|
static rgba get(const value_type* p, cover_type cover = cover_full)
|
||||||
{
|
{
|
||||||
return get(
|
return get(
|
||||||
p[order_type::R],
|
p[order_type::R],
|
||||||
p[order_type::G],
|
p[order_type::G],
|
||||||
p[order_type::B],
|
p[order_type::B],
|
||||||
p[order_type::A],
|
p[order_type::A],
|
||||||
cover);
|
cover);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
54
deps/agg/include/agg_rasterizer_sl_clip.h
vendored
54
deps/agg/include/agg_rasterizer_sl_clip.h
vendored
|
@ -2,8 +2,8 @@
|
||||||
// Anti-Grain Geometry - Version 2.4
|
// Anti-Grain Geometry - Version 2.4
|
||||||
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Permission to copy, use, modify, sell and distribute this software
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// is granted provided this copyright notice appears in all copies.
|
||||||
// This software is provided "as is" without express or implied
|
// This software is provided "as is" without express or implied
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
// warranty, and with no claim as to its suitability for any purpose.
|
||||||
//
|
//
|
||||||
|
@ -24,7 +24,7 @@ namespace agg
|
||||||
{
|
{
|
||||||
poly_max_coord = (1 << 30) - 1 //----poly_max_coord
|
poly_max_coord = (1 << 30) - 1 //----poly_max_coord
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------------------------------------ras_conv_int
|
//------------------------------------------------------------ras_conv_int
|
||||||
struct ras_conv_int
|
struct ras_conv_int
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,7 @@ namespace agg
|
||||||
}
|
}
|
||||||
static int xi(int v) { return v; }
|
static int xi(int v) { return v; }
|
||||||
static int yi(int v) { return v; }
|
static int yi(int v) { return v; }
|
||||||
static int upscale(double v) { return iround(v * poly_subpixel_scale); }
|
static int upscale(double v) { return iround(v * static_cast<double>(poly_subpixel_scale)); }
|
||||||
static int downscale(int v) { return v; }
|
static int downscale(int v) { return v; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -49,9 +49,9 @@ namespace agg
|
||||||
}
|
}
|
||||||
static int xi(int v) { return v; }
|
static int xi(int v) { return v; }
|
||||||
static int yi(int v) { return v; }
|
static int yi(int v) { return v; }
|
||||||
static int upscale(double v)
|
static int upscale(double v)
|
||||||
{
|
{
|
||||||
return saturation<poly_max_coord>::iround(v * poly_subpixel_scale);
|
return saturation<poly_max_coord>::iround(v * static_cast<double>(poly_subpixel_scale));
|
||||||
}
|
}
|
||||||
static int downscale(int v) { return v; }
|
static int downscale(int v) { return v; }
|
||||||
};
|
};
|
||||||
|
@ -66,7 +66,7 @@ namespace agg
|
||||||
}
|
}
|
||||||
static int xi(int v) { return v * 3; }
|
static int xi(int v) { return v * 3; }
|
||||||
static int yi(int v) { return v; }
|
static int yi(int v) { return v; }
|
||||||
static int upscale(double v) { return iround(v * poly_subpixel_scale); }
|
static int upscale(double v) { return iround(v * static_cast<double>(poly_subpixel_scale)); }
|
||||||
static int downscale(int v) { return v; }
|
static int downscale(int v) { return v; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -78,10 +78,10 @@ namespace agg
|
||||||
{
|
{
|
||||||
return a * b / c;
|
return a * b / c;
|
||||||
}
|
}
|
||||||
static int xi(double v) { return iround(v * poly_subpixel_scale); }
|
static int xi(double v) { return iround(v * static_cast<double>(poly_subpixel_scale)); }
|
||||||
static int yi(double v) { return iround(v * poly_subpixel_scale); }
|
static int yi(double v) { return iround(v * static_cast<double>(poly_subpixel_scale)); }
|
||||||
static double upscale(double v) { return v; }
|
static double upscale(double v) { return v; }
|
||||||
static double downscale(int v) { return v / double(poly_subpixel_scale); }
|
static double downscale(int v) { return v / static_cast<double>(poly_subpixel_scale); }
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------ras_conv_dbl_3x
|
//--------------------------------------------------------ras_conv_dbl_3x
|
||||||
|
@ -92,10 +92,10 @@ namespace agg
|
||||||
{
|
{
|
||||||
return a * b / c;
|
return a * b / c;
|
||||||
}
|
}
|
||||||
static int xi(double v) { return iround(v * poly_subpixel_scale * 3); }
|
static int xi(double v) { return iround(v * static_cast<double>(poly_subpixel_scale) * 3); }
|
||||||
static int yi(double v) { return iround(v * poly_subpixel_scale); }
|
static int yi(double v) { return iround(v * static_cast<double>(poly_subpixel_scale)); }
|
||||||
static double upscale(double v) { return v; }
|
static double upscale(double v) { return v; }
|
||||||
static double downscale(int v) { return v / double(poly_subpixel_scale); }
|
static double downscale(int v) { return v / static_cast<double>(poly_subpixel_scale); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -111,12 +111,12 @@ namespace agg
|
||||||
typedef rect_base<coord_type> rect_type;
|
typedef rect_base<coord_type> rect_type;
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
rasterizer_sl_clip() :
|
rasterizer_sl_clip() :
|
||||||
m_clip_box(0,0,0,0),
|
m_clip_box(0,0,0,0),
|
||||||
m_x1(0),
|
m_x1(0),
|
||||||
m_y1(0),
|
m_y1(0),
|
||||||
m_f1(0),
|
m_f1(0),
|
||||||
m_clipping(false)
|
m_clipping(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
@ -145,8 +145,8 @@ namespace agg
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
template<class Rasterizer>
|
template<class Rasterizer>
|
||||||
AGG_INLINE void line_clip_y(Rasterizer& ras,
|
AGG_INLINE void line_clip_y(Rasterizer& ras,
|
||||||
coord_type x1, coord_type y1,
|
coord_type x1, coord_type y1,
|
||||||
coord_type x2, coord_type y2,
|
coord_type x2, coord_type y2,
|
||||||
unsigned f1, unsigned f2) const
|
unsigned f1, unsigned f2) const
|
||||||
{
|
{
|
||||||
f1 &= 10;
|
f1 &= 10;
|
||||||
|
@ -154,7 +154,7 @@ namespace agg
|
||||||
if((f1 | f2) == 0)
|
if((f1 | f2) == 0)
|
||||||
{
|
{
|
||||||
// Fully visible
|
// Fully visible
|
||||||
ras.line(Conv::xi(x1), Conv::yi(y1), Conv::xi(x2), Conv::yi(y2));
|
ras.line(Conv::xi(x1), Conv::yi(y1), Conv::xi(x2), Conv::yi(y2));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -192,8 +192,8 @@ namespace agg
|
||||||
tx2 = x1 + Conv::mul_div(m_clip_box.y2-y1, x2-x1, y2-y1);
|
tx2 = x1 + Conv::mul_div(m_clip_box.y2-y1, x2-x1, y2-y1);
|
||||||
ty2 = m_clip_box.y2;
|
ty2 = m_clip_box.y2;
|
||||||
}
|
}
|
||||||
ras.line(Conv::xi(tx1), Conv::yi(ty1),
|
ras.line(Conv::xi(tx1), Conv::yi(ty1),
|
||||||
Conv::xi(tx2), Conv::yi(ty2));
|
Conv::xi(tx2), Conv::yi(ty2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,8 +288,8 @@ namespace agg
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ras.line(Conv::xi(m_x1), Conv::yi(m_y1),
|
ras.line(Conv::xi(m_x1), Conv::yi(m_y1),
|
||||||
Conv::xi(x2), Conv::yi(y2));
|
Conv::xi(x2), Conv::yi(y2));
|
||||||
}
|
}
|
||||||
m_x1 = x2;
|
m_x1 = x2;
|
||||||
m_y1 = y2;
|
m_y1 = y2;
|
||||||
|
@ -321,10 +321,10 @@ namespace agg
|
||||||
void move_to(coord_type x1, coord_type y1) { m_x1 = x1; m_y1 = y1; }
|
void move_to(coord_type x1, coord_type y1) { m_x1 = x1; m_y1 = y1; }
|
||||||
|
|
||||||
template<class Rasterizer>
|
template<class Rasterizer>
|
||||||
void line_to(Rasterizer& ras, coord_type x2, coord_type y2)
|
void line_to(Rasterizer& ras, coord_type x2, coord_type y2)
|
||||||
{
|
{
|
||||||
ras.line(m_x1, m_y1, x2, y2);
|
ras.line(m_x1, m_y1, x2, y2);
|
||||||
m_x1 = x2;
|
m_x1 = x2;
|
||||||
m_y1 = y2;
|
m_y1 = y2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
deps/agg/include/agg_renderer_outline_aa.h
vendored
2
deps/agg/include/agg_renderer_outline_aa.h
vendored
|
@ -1305,7 +1305,7 @@ namespace agg
|
||||||
for(i = 0; i < aa_scale; i++)
|
for(i = 0; i < aa_scale; i++)
|
||||||
{
|
{
|
||||||
m_gamma[i] = value_type(
|
m_gamma[i] = value_type(
|
||||||
uround(gamma_function(double(i) / aa_mask) * aa_mask));
|
uround(gamma_function(static_cast<double>(i) / static_cast<double>(aa_mask)) * aa_mask));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
8
deps/agg/src/agg_arrowhead.cpp
vendored
8
deps/agg/src/agg_arrowhead.cpp
vendored
|
@ -66,7 +66,9 @@ void arrowhead::rewind(unsigned path_id)
|
||||||
m_cmd[3] = path_cmd_line_to;
|
m_cmd[3] = path_cmd_line_to;
|
||||||
m_cmd[4] = path_cmd_line_to;
|
m_cmd[4] = path_cmd_line_to;
|
||||||
m_cmd[5] = path_cmd_line_to;
|
m_cmd[5] = path_cmd_line_to;
|
||||||
m_cmd[7] = path_cmd_end_poly | path_flags_close | path_flags_ccw;
|
m_cmd[7] = path_cmd_end_poly
|
||||||
|
| static_cast<path_commands_e>(path_flags_close)
|
||||||
|
| static_cast<path_commands_e>(path_flags_ccw);
|
||||||
m_cmd[6] = path_cmd_stop;
|
m_cmd[6] = path_cmd_stop;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -87,7 +89,9 @@ void arrowhead::rewind(unsigned path_id)
|
||||||
m_cmd[1] = path_cmd_line_to;
|
m_cmd[1] = path_cmd_line_to;
|
||||||
m_cmd[2] = path_cmd_line_to;
|
m_cmd[2] = path_cmd_line_to;
|
||||||
m_cmd[3] = path_cmd_line_to;
|
m_cmd[3] = path_cmd_line_to;
|
||||||
m_cmd[4] = path_cmd_end_poly | path_flags_close | path_flags_ccw;
|
m_cmd[4] = path_cmd_end_poly
|
||||||
|
| static_cast<path_commands_e>(path_flags_close)
|
||||||
|
| static_cast<path_commands_e>(path_flags_ccw);
|
||||||
m_cmd[5] = path_cmd_stop;
|
m_cmd[5] = path_cmd_stop;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
17
deps/agg/src/agg_line_profile_aa.cpp
vendored
17
deps/agg/src/agg_line_profile_aa.cpp
vendored
|
@ -42,7 +42,7 @@ void line_profile_aa::width(double w)
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
line_profile_aa::value_type* line_profile_aa::profile(double w)
|
line_profile_aa::value_type* line_profile_aa::profile(double w)
|
||||||
{
|
{
|
||||||
m_subpixel_width = uround(w * subpixel_scale);
|
m_subpixel_width = uround(w * static_cast<double>(subpixel_scale));
|
||||||
unsigned size = m_subpixel_width + subpixel_scale * 6;
|
unsigned size = m_subpixel_width + subpixel_scale * 6;
|
||||||
if(size > m_profile.size())
|
if(size > m_profile.size())
|
||||||
{
|
{
|
||||||
|
@ -56,8 +56,8 @@ line_profile_aa::value_type* line_profile_aa::profile(double w)
|
||||||
void line_profile_aa::set(double center_width, double smoother_width)
|
void line_profile_aa::set(double center_width, double smoother_width)
|
||||||
{
|
{
|
||||||
double base_val = 1.0;
|
double base_val = 1.0;
|
||||||
if(center_width == 0.0) center_width = 1.0 / subpixel_scale;
|
if(center_width == 0.0) center_width = 1.0 / static_cast<double>(subpixel_scale);
|
||||||
if(smoother_width == 0.0) smoother_width = 1.0 / subpixel_scale;
|
if(smoother_width == 0.0) smoother_width = 1.0 / static_cast<double>(subpixel_scale);
|
||||||
|
|
||||||
double width = center_width + smoother_width;
|
double width = center_width + smoother_width;
|
||||||
if(width < m_min_width)
|
if(width < m_min_width)
|
||||||
|
@ -70,15 +70,15 @@ void line_profile_aa::set(double center_width, double smoother_width)
|
||||||
|
|
||||||
value_type* ch = profile(center_width + smoother_width);
|
value_type* ch = profile(center_width + smoother_width);
|
||||||
|
|
||||||
unsigned subpixel_center_width = unsigned(center_width * subpixel_scale);
|
unsigned subpixel_center_width = unsigned(center_width * static_cast<double>(subpixel_scale));
|
||||||
unsigned subpixel_smoother_width = unsigned(smoother_width * subpixel_scale);
|
unsigned subpixel_smoother_width = unsigned(smoother_width * static_cast<double>(subpixel_scale));
|
||||||
|
|
||||||
value_type* ch_center = ch + subpixel_scale*2;
|
value_type* ch_center = ch + subpixel_scale * 2;
|
||||||
value_type* ch_smoother = ch_center + subpixel_center_width;
|
value_type* ch_smoother = ch_center + subpixel_center_width;
|
||||||
|
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
unsigned val = m_gamma[unsigned(base_val * aa_mask)];
|
unsigned val = m_gamma[unsigned(base_val * static_cast<double>(aa_mask))];
|
||||||
ch = ch_center;
|
ch = ch_center;
|
||||||
for(i = 0; i < subpixel_center_width; i++)
|
for(i = 0; i < subpixel_center_width; i++)
|
||||||
{
|
{
|
||||||
|
@ -90,7 +90,7 @@ void line_profile_aa::set(double center_width, double smoother_width)
|
||||||
*ch_smoother++ =
|
*ch_smoother++ =
|
||||||
m_gamma[unsigned((base_val -
|
m_gamma[unsigned((base_val -
|
||||||
base_val *
|
base_val *
|
||||||
(double(i) / subpixel_smoother_width)) * aa_mask)];
|
(double(i) / subpixel_smoother_width)) * static_cast<double>(aa_mask))];
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned n_smoother = profile_size() -
|
unsigned n_smoother = profile_size() -
|
||||||
|
@ -113,4 +113,3 @@ void line_profile_aa::set(double center_width, double smoother_width)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
5
deps/agg/src/agg_rounded_rect.cpp
vendored
5
deps/agg/src/agg_rounded_rect.cpp
vendored
|
@ -152,7 +152,9 @@ unsigned rounded_rect::vertex(double* x, double* y)
|
||||||
else return path_cmd_line_to;
|
else return path_cmd_line_to;
|
||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
cmd = path_cmd_end_poly | path_flags_close | path_flags_ccw;
|
cmd = path_cmd_end_poly
|
||||||
|
| static_cast<path_commands_e>(path_flags_close)
|
||||||
|
| static_cast<path_commands_e>(path_flags_ccw);
|
||||||
m_status++;
|
m_status++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -161,4 +163,3 @@ unsigned rounded_rect::vertex(double* x, double* y)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
deps/agg/src/agg_vcgen_contour.cpp
vendored
4
deps/agg/src/agg_vcgen_contour.cpp
vendored
|
@ -153,7 +153,9 @@ unsigned vcgen_contour::vertex(double* x, double* y)
|
||||||
case end_poly:
|
case end_poly:
|
||||||
if(!m_closed) return path_cmd_stop;
|
if(!m_closed) return path_cmd_stop;
|
||||||
m_status = stop;
|
m_status = stop;
|
||||||
return path_cmd_end_poly | path_flags_close | path_flags_ccw;
|
return path_cmd_end_poly
|
||||||
|
| static_cast<path_commands_e>(path_flags_close)
|
||||||
|
| static_cast<path_commands_e>(path_flags_ccw);
|
||||||
|
|
||||||
case stop:
|
case stop:
|
||||||
return path_cmd_stop;
|
return path_cmd_stop;
|
||||||
|
|
8
deps/agg/src/agg_vcgen_stroke.cpp
vendored
8
deps/agg/src/agg_vcgen_stroke.cpp
vendored
|
@ -196,11 +196,15 @@ unsigned vcgen_stroke::vertex(double* x, double* y)
|
||||||
|
|
||||||
case end_poly1:
|
case end_poly1:
|
||||||
m_status = m_prev_status;
|
m_status = m_prev_status;
|
||||||
return path_cmd_end_poly | path_flags_close | path_flags_ccw;
|
return path_cmd_end_poly
|
||||||
|
| static_cast<path_commands_e>(path_flags_close)
|
||||||
|
| static_cast<path_commands_e>(path_flags_ccw);
|
||||||
|
|
||||||
case end_poly2:
|
case end_poly2:
|
||||||
m_status = m_prev_status;
|
m_status = m_prev_status;
|
||||||
return path_cmd_end_poly | path_flags_close | path_flags_cw;
|
return path_cmd_end_poly
|
||||||
|
| static_cast<path_commands_e>(path_flags_close)
|
||||||
|
| static_cast<path_commands_e>(path_flags_cw);
|
||||||
|
|
||||||
case stop:
|
case stop:
|
||||||
cmd = path_cmd_stop;
|
cmd = path_cmd_stop;
|
||||||
|
|
1
deps/boost/.clang-format
vendored
Normal file
1
deps/boost/.clang-format
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
DisableFormat: true
|
1
deps/mapbox/.clang-format
vendored
Normal file
1
deps/mapbox/.clang-format
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
DisableFormat: true
|
2334
deps/mapnik/sparsehash/internal/densehashtable.h
vendored
2334
deps/mapnik/sparsehash/internal/densehashtable.h
vendored
File diff suppressed because it is too large
Load diff
410
deps/mapnik/sparsehash/internal/hashtable-common.h
vendored
410
deps/mapnik/sparsehash/internal/hashtable-common.h
vendored
|
@ -43,9 +43,9 @@
|
||||||
#include <mapnik/sparsehash/internal/sparseconfig.h>
|
#include <mapnik/sparsehash/internal/sparseconfig.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stddef.h> // for size_t
|
#include <stddef.h> // for size_t
|
||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
#include <stdexcept> // For length_error
|
#include <stdexcept> // For length_error
|
||||||
|
|
||||||
_START_GOOGLE_NAMESPACE_
|
_START_GOOGLE_NAMESPACE_
|
||||||
|
|
||||||
|
@ -80,15 +80,15 @@ namespace sparsehash_internal {
|
||||||
// ----- low-level I/O for FILE* ----
|
// ----- low-level I/O for FILE* ----
|
||||||
|
|
||||||
template<typename Ignored>
|
template<typename Ignored>
|
||||||
inline bool read_data_internal(Ignored*, FILE* fp,
|
inline bool read_data_internal(Ignored*, FILE* fp, void* data, size_t length)
|
||||||
void* data, size_t length) {
|
{
|
||||||
return fread(data, length, 1, fp) == 1;
|
return fread(data, length, 1, fp) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Ignored>
|
template<typename Ignored>
|
||||||
inline bool write_data_internal(Ignored*, FILE* fp,
|
inline bool write_data_internal(Ignored*, FILE* fp, const void* data, size_t length)
|
||||||
const void* data, size_t length) {
|
{
|
||||||
return fwrite(data, length, 1, fp) == 1;
|
return fwrite(data, length, 1, fp) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- low-level I/O for iostream ----
|
// ----- low-level I/O for iostream ----
|
||||||
|
@ -98,55 +98,57 @@ inline bool write_data_internal(Ignored*, FILE* fp,
|
||||||
// it's only legal to delay the instantiation the way we want to if
|
// it's only legal to delay the instantiation the way we want to if
|
||||||
// the istream/ostream is a template type. So we jump through hoops.
|
// the istream/ostream is a template type. So we jump through hoops.
|
||||||
template<typename ISTREAM>
|
template<typename ISTREAM>
|
||||||
inline bool read_data_internal_for_istream(ISTREAM* fp,
|
inline bool read_data_internal_for_istream(ISTREAM* fp, void* data, size_t length)
|
||||||
void* data, size_t length) {
|
{
|
||||||
return fp->read(reinterpret_cast<char*>(data), length).good();
|
return fp->read(reinterpret_cast<char*>(data), length).good();
|
||||||
}
|
}
|
||||||
template<typename Ignored>
|
template<typename Ignored>
|
||||||
inline bool read_data_internal(Ignored*, std::istream* fp,
|
inline bool read_data_internal(Ignored*, std::istream* fp, void* data, size_t length)
|
||||||
void* data, size_t length) {
|
{
|
||||||
return read_data_internal_for_istream(fp, data, length);
|
return read_data_internal_for_istream(fp, data, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename OSTREAM>
|
template<typename OSTREAM>
|
||||||
inline bool write_data_internal_for_ostream(OSTREAM* fp,
|
inline bool write_data_internal_for_ostream(OSTREAM* fp, const void* data, size_t length)
|
||||||
const void* data, size_t length) {
|
{
|
||||||
return fp->write(reinterpret_cast<const char*>(data), length).good();
|
return fp->write(reinterpret_cast<const char*>(data), length).good();
|
||||||
}
|
}
|
||||||
template<typename Ignored>
|
template<typename Ignored>
|
||||||
inline bool write_data_internal(Ignored*, std::ostream* fp,
|
inline bool write_data_internal(Ignored*, std::ostream* fp, const void* data, size_t length)
|
||||||
const void* data, size_t length) {
|
{
|
||||||
return write_data_internal_for_ostream(fp, data, length);
|
return write_data_internal_for_ostream(fp, data, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- low-level I/O for custom streams ----
|
// ----- low-level I/O for custom streams ----
|
||||||
|
|
||||||
// The INPUT type needs to support a Read() method that takes a
|
// The INPUT type needs to support a Read() method that takes a
|
||||||
// buffer and a length and returns the number of bytes read.
|
// buffer and a length and returns the number of bytes read.
|
||||||
template <typename INPUT>
|
template<typename INPUT>
|
||||||
inline bool read_data_internal(INPUT* fp, void*,
|
inline bool read_data_internal(INPUT* fp, void*, void* data, size_t length)
|
||||||
void* data, size_t length) {
|
{
|
||||||
return static_cast<size_t>(fp->Read(data, length)) == length;
|
return static_cast<size_t>(fp->Read(data, length)) == length;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The OUTPUT type needs to support a Write() operation that takes
|
// The OUTPUT type needs to support a Write() operation that takes
|
||||||
// a buffer and a length and returns the number of bytes written.
|
// a buffer and a length and returns the number of bytes written.
|
||||||
template <typename OUTPUT>
|
template<typename OUTPUT>
|
||||||
inline bool write_data_internal(OUTPUT* fp, void*,
|
inline bool write_data_internal(OUTPUT* fp, void*, const void* data, size_t length)
|
||||||
const void* data, size_t length) {
|
{
|
||||||
return static_cast<size_t>(fp->Write(data, length)) == length;
|
return static_cast<size_t>(fp->Write(data, length)) == length;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- low-level I/O: the public API ----
|
// ----- low-level I/O: the public API ----
|
||||||
|
|
||||||
template <typename INPUT>
|
template<typename INPUT>
|
||||||
inline bool read_data(INPUT* fp, void* data, size_t length) {
|
inline bool read_data(INPUT* fp, void* data, size_t length)
|
||||||
return read_data_internal(fp, fp, data, length);
|
{
|
||||||
|
return read_data_internal(fp, fp, data, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename OUTPUT>
|
template<typename OUTPUT>
|
||||||
inline bool write_data(OUTPUT* fp, const void* data, size_t length) {
|
inline bool write_data(OUTPUT* fp, const void* data, size_t length)
|
||||||
return write_data_internal(fp, fp, data, length);
|
{
|
||||||
|
return write_data_internal(fp, fp, data, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uses read_data() and write_data() to read/write an integer.
|
// Uses read_data() and write_data() to read/write an integer.
|
||||||
|
@ -154,26 +156,32 @@ inline bool write_data(OUTPUT* fp, const void* data, size_t length) {
|
||||||
// from sizeof(IntType), allowing us to save on a 32-bit system
|
// from sizeof(IntType), allowing us to save on a 32-bit system
|
||||||
// and load on a 64-bit system). Excess bytes are taken to be 0.
|
// and load on a 64-bit system). Excess bytes are taken to be 0.
|
||||||
// INPUT and OUTPUT must match legal inputs to read/write_data (above).
|
// INPUT and OUTPUT must match legal inputs to read/write_data (above).
|
||||||
template <typename INPUT, typename IntType>
|
template<typename INPUT, typename IntType>
|
||||||
bool read_bigendian_number(INPUT* fp, IntType* value, size_t length) {
|
bool read_bigendian_number(INPUT* fp, IntType* value, size_t length)
|
||||||
*value = 0;
|
{
|
||||||
unsigned char byte;
|
*value = 0;
|
||||||
for (size_t i = 0; i < length; ++i) {
|
unsigned char byte;
|
||||||
if (!read_data(fp, &byte, sizeof(byte))) return false;
|
for (size_t i = 0; i < length; ++i)
|
||||||
*value |= static_cast<IntType>(byte) << ((length - 1 - i) * 8);
|
{
|
||||||
}
|
if (!read_data(fp, &byte, sizeof(byte)))
|
||||||
return true;
|
return false;
|
||||||
|
*value |= static_cast<IntType>(byte) << ((length - 1 - i) * 8);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename OUTPUT, typename IntType>
|
template<typename OUTPUT, typename IntType>
|
||||||
bool write_bigendian_number(OUTPUT* fp, IntType value, size_t length) {
|
bool write_bigendian_number(OUTPUT* fp, IntType value, size_t length)
|
||||||
unsigned char byte;
|
{
|
||||||
for (size_t i = 0; i < length; ++i) {
|
unsigned char byte;
|
||||||
byte = (sizeof(value) <= length-1 - i)
|
for (size_t i = 0; i < length; ++i)
|
||||||
? 0 : static_cast<unsigned char>((value >> ((length-1 - i) * 8)) & 255);
|
{
|
||||||
if (!write_data(fp, &byte, sizeof(byte))) return false;
|
byte =
|
||||||
}
|
(sizeof(value) <= length - 1 - i) ? 0 : static_cast<unsigned char>((value >> ((length - 1 - i) * 8)) & 255);
|
||||||
return true;
|
if (!write_data(fp, &byte, sizeof(byte)))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If your keys and values are simple enough, you can pass this
|
// If your keys and values are simple enough, you can pass this
|
||||||
|
@ -181,19 +189,22 @@ bool write_bigendian_number(OUTPUT* fp, IntType value, size_t length) {
|
||||||
// value_type is a POD type that contains no pointers. Note,
|
// value_type is a POD type that contains no pointers. Note,
|
||||||
// however, we don't try to normalize endianness.
|
// however, we don't try to normalize endianness.
|
||||||
// This is the type used for NopointerSerializer.
|
// This is the type used for NopointerSerializer.
|
||||||
template <typename value_type> struct pod_serializer {
|
template<typename value_type>
|
||||||
template <typename INPUT>
|
struct pod_serializer
|
||||||
bool operator()(INPUT* fp, value_type* value) const {
|
{
|
||||||
return read_data(fp, value, sizeof(*value));
|
template<typename INPUT>
|
||||||
}
|
bool operator()(INPUT* fp, value_type* value) const
|
||||||
|
{
|
||||||
|
return read_data(fp, value, sizeof(*value));
|
||||||
|
}
|
||||||
|
|
||||||
template <typename OUTPUT>
|
template<typename OUTPUT>
|
||||||
bool operator()(OUTPUT* fp, const value_type& value) const {
|
bool operator()(OUTPUT* fp, const value_type& value) const
|
||||||
return write_data(fp, &value, sizeof(value));
|
{
|
||||||
}
|
return write_data(fp, &value, sizeof(value));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Settings contains parameters for growing and shrinking the table.
|
// Settings contains parameters for growing and shrinking the table.
|
||||||
// It also packages zero-size functor (ie. hasher).
|
// It also packages zero-size functor (ie. hasher).
|
||||||
//
|
//
|
||||||
|
@ -206,165 +217,136 @@ template <typename value_type> struct pod_serializer {
|
||||||
// for sure that the hash is the identity hash. If it's not, this
|
// for sure that the hash is the identity hash. If it's not, this
|
||||||
// is needless work (and possibly, though not likely, harmful).
|
// is needless work (and possibly, though not likely, harmful).
|
||||||
|
|
||||||
template<typename Key, typename HashFunc,
|
template<typename Key, typename HashFunc, typename SizeType, int HT_MIN_BUCKETS>
|
||||||
typename SizeType, int HT_MIN_BUCKETS>
|
class sh_hashtable_settings : public HashFunc
|
||||||
class sh_hashtable_settings : public HashFunc {
|
{
|
||||||
public:
|
public:
|
||||||
typedef Key key_type;
|
typedef Key key_type;
|
||||||
typedef HashFunc hasher;
|
typedef HashFunc hasher;
|
||||||
typedef SizeType size_type;
|
typedef SizeType size_type;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
sh_hashtable_settings(const hasher& hf,
|
sh_hashtable_settings(const hasher& hf, const float ht_occupancy_flt, const float ht_empty_flt)
|
||||||
const float ht_occupancy_flt,
|
: hasher(hf)
|
||||||
const float ht_empty_flt)
|
, enlarge_threshold_(0)
|
||||||
: hasher(hf),
|
, shrink_threshold_(0)
|
||||||
enlarge_threshold_(0),
|
, consider_shrink_(false)
|
||||||
shrink_threshold_(0),
|
, use_empty_(false)
|
||||||
consider_shrink_(false),
|
, use_deleted_(false)
|
||||||
use_empty_(false),
|
, num_ht_copies_(0)
|
||||||
use_deleted_(false),
|
{
|
||||||
num_ht_copies_(0) {
|
set_enlarge_factor(ht_occupancy_flt);
|
||||||
set_enlarge_factor(ht_occupancy_flt);
|
set_shrink_factor(ht_empty_flt);
|
||||||
set_shrink_factor(ht_empty_flt);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_type hash(const key_type& v) const {
|
|
||||||
// We munge the hash value when we don't trust hasher::operator().
|
|
||||||
return hash_munger<Key>::MungedHash(hasher::operator()(v));
|
|
||||||
}
|
|
||||||
|
|
||||||
float enlarge_factor() const {
|
|
||||||
return enlarge_factor_;
|
|
||||||
}
|
|
||||||
void set_enlarge_factor(float f) {
|
|
||||||
enlarge_factor_ = f;
|
|
||||||
}
|
|
||||||
float shrink_factor() const {
|
|
||||||
return shrink_factor_;
|
|
||||||
}
|
|
||||||
void set_shrink_factor(float f) {
|
|
||||||
shrink_factor_ = f;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_type enlarge_threshold() const {
|
|
||||||
return enlarge_threshold_;
|
|
||||||
}
|
|
||||||
void set_enlarge_threshold(size_type t) {
|
|
||||||
enlarge_threshold_ = t;
|
|
||||||
}
|
|
||||||
size_type shrink_threshold() const {
|
|
||||||
return shrink_threshold_;
|
|
||||||
}
|
|
||||||
void set_shrink_threshold(size_type t) {
|
|
||||||
shrink_threshold_ = t;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_type enlarge_size(size_type x) const {
|
|
||||||
return static_cast<size_type>(x * enlarge_factor_);
|
|
||||||
}
|
|
||||||
size_type shrink_size(size_type x) const {
|
|
||||||
return static_cast<size_type>(x * shrink_factor_);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool consider_shrink() const {
|
|
||||||
return consider_shrink_;
|
|
||||||
}
|
|
||||||
void set_consider_shrink(bool t) {
|
|
||||||
consider_shrink_ = t;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool use_empty() const {
|
|
||||||
return use_empty_;
|
|
||||||
}
|
|
||||||
void set_use_empty(bool t) {
|
|
||||||
use_empty_ = t;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool use_deleted() const {
|
|
||||||
return use_deleted_;
|
|
||||||
}
|
|
||||||
void set_use_deleted(bool t) {
|
|
||||||
use_deleted_ = t;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_type num_ht_copies() const {
|
|
||||||
return static_cast<size_type>(num_ht_copies_);
|
|
||||||
}
|
|
||||||
void inc_num_ht_copies() {
|
|
||||||
++num_ht_copies_;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset the enlarge and shrink thresholds
|
|
||||||
void reset_thresholds(size_type num_buckets) {
|
|
||||||
set_enlarge_threshold(enlarge_size(num_buckets));
|
|
||||||
set_shrink_threshold(shrink_size(num_buckets));
|
|
||||||
// whatever caused us to reset already considered
|
|
||||||
set_consider_shrink(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Caller is resposible for calling reset_threshold right after
|
|
||||||
// set_resizing_parameters.
|
|
||||||
void set_resizing_parameters(float shrink, float grow) {
|
|
||||||
assert(shrink >= 0.0);
|
|
||||||
assert(grow <= 1.0);
|
|
||||||
if (shrink > grow/2.0f)
|
|
||||||
shrink = grow / 2.0f; // otherwise we thrash hashtable size
|
|
||||||
set_shrink_factor(shrink);
|
|
||||||
set_enlarge_factor(grow);
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is the smallest size a hashtable can be without being too crowded
|
|
||||||
// If you like, you can give a min #buckets as well as a min #elts
|
|
||||||
size_type min_buckets(size_type num_elts, size_type min_buckets_wanted) {
|
|
||||||
float enlarge = enlarge_factor();
|
|
||||||
size_type sz = HT_MIN_BUCKETS; // min buckets allowed
|
|
||||||
while ( sz < min_buckets_wanted ||
|
|
||||||
num_elts >= static_cast<size_type>(sz * enlarge) ) {
|
|
||||||
// This just prevents overflowing size_type, since sz can exceed
|
|
||||||
// max_size() here.
|
|
||||||
if (static_cast<size_type>(sz * 2) < sz) {
|
|
||||||
throw std::length_error("resize overflow"); // protect against overflow
|
|
||||||
}
|
|
||||||
sz *= 2;
|
|
||||||
}
|
}
|
||||||
return sz;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
size_type hash(const key_type& v) const
|
||||||
template<class HashKey> class hash_munger {
|
{
|
||||||
public:
|
// We munge the hash value when we don't trust hasher::operator().
|
||||||
static size_t MungedHash(size_t hash) {
|
return hash_munger<Key>::MungedHash(hasher::operator()(v));
|
||||||
return hash;
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
// This matches when the hashtable key is a pointer.
|
|
||||||
template<class HashKey> class hash_munger<HashKey*> {
|
|
||||||
public:
|
|
||||||
static size_t MungedHash(size_t hash) {
|
|
||||||
// TODO(csilvers): consider rotating instead:
|
|
||||||
// static const int shift = (sizeof(void *) == 4) ? 2 : 3;
|
|
||||||
// return (hash << (sizeof(hash) * 8) - shift)) | (hash >> shift);
|
|
||||||
// This matters if we ever change sparse/dense_hash_* to compare
|
|
||||||
// hashes before comparing actual values. It's speedy on x86.
|
|
||||||
return hash / sizeof(void*); // get rid of known-0 bits
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
size_type enlarge_threshold_; // table.size() * enlarge_factor
|
float enlarge_factor() const { return enlarge_factor_; }
|
||||||
size_type shrink_threshold_; // table.size() * shrink_factor
|
void set_enlarge_factor(float f) { enlarge_factor_ = f; }
|
||||||
float enlarge_factor_; // how full before resize
|
float shrink_factor() const { return shrink_factor_; }
|
||||||
float shrink_factor_; // how empty before resize
|
void set_shrink_factor(float f) { shrink_factor_ = f; }
|
||||||
// consider_shrink=true if we should try to shrink before next insert
|
|
||||||
bool consider_shrink_;
|
size_type enlarge_threshold() const { return enlarge_threshold_; }
|
||||||
bool use_empty_; // used only by densehashtable, not sparsehashtable
|
void set_enlarge_threshold(size_type t) { enlarge_threshold_ = t; }
|
||||||
bool use_deleted_; // false until delkey has been set
|
size_type shrink_threshold() const { return shrink_threshold_; }
|
||||||
// num_ht_copies is a counter incremented every Copy/Move
|
void set_shrink_threshold(size_type t) { shrink_threshold_ = t; }
|
||||||
unsigned int num_ht_copies_;
|
|
||||||
|
size_type enlarge_size(size_type x) const { return static_cast<size_type>(x * enlarge_factor_); }
|
||||||
|
size_type shrink_size(size_type x) const { return static_cast<size_type>(x * shrink_factor_); }
|
||||||
|
|
||||||
|
bool consider_shrink() const { return consider_shrink_; }
|
||||||
|
void set_consider_shrink(bool t) { consider_shrink_ = t; }
|
||||||
|
|
||||||
|
bool use_empty() const { return use_empty_; }
|
||||||
|
void set_use_empty(bool t) { use_empty_ = t; }
|
||||||
|
|
||||||
|
bool use_deleted() const { return use_deleted_; }
|
||||||
|
void set_use_deleted(bool t) { use_deleted_ = t; }
|
||||||
|
|
||||||
|
size_type num_ht_copies() const { return static_cast<size_type>(num_ht_copies_); }
|
||||||
|
void inc_num_ht_copies() { ++num_ht_copies_; }
|
||||||
|
|
||||||
|
// Reset the enlarge and shrink thresholds
|
||||||
|
void reset_thresholds(size_type num_buckets)
|
||||||
|
{
|
||||||
|
set_enlarge_threshold(enlarge_size(num_buckets));
|
||||||
|
set_shrink_threshold(shrink_size(num_buckets));
|
||||||
|
// whatever caused us to reset already considered
|
||||||
|
set_consider_shrink(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Caller is resposible for calling reset_threshold right after
|
||||||
|
// set_resizing_parameters.
|
||||||
|
void set_resizing_parameters(float shrink, float grow)
|
||||||
|
{
|
||||||
|
assert(shrink >= 0.0);
|
||||||
|
assert(grow <= 1.0);
|
||||||
|
if (shrink > grow / 2.0f)
|
||||||
|
shrink = grow / 2.0f; // otherwise we thrash hashtable size
|
||||||
|
set_shrink_factor(shrink);
|
||||||
|
set_enlarge_factor(grow);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is the smallest size a hashtable can be without being too crowded
|
||||||
|
// If you like, you can give a min #buckets as well as a min #elts
|
||||||
|
size_type min_buckets(size_type num_elts, size_type min_buckets_wanted)
|
||||||
|
{
|
||||||
|
float enlarge = enlarge_factor();
|
||||||
|
size_type sz = HT_MIN_BUCKETS; // min buckets allowed
|
||||||
|
while (sz < min_buckets_wanted || num_elts >= static_cast<size_type>(sz * enlarge))
|
||||||
|
{
|
||||||
|
// This just prevents overflowing size_type, since sz can exceed
|
||||||
|
// max_size() here.
|
||||||
|
if (static_cast<size_type>(sz * 2) < sz)
|
||||||
|
{
|
||||||
|
throw std::length_error("resize overflow"); // protect against overflow
|
||||||
|
}
|
||||||
|
sz *= 2;
|
||||||
|
}
|
||||||
|
return sz;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
template<class HashKey>
|
||||||
|
class hash_munger
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static size_t MungedHash(size_t hash) { return hash; }
|
||||||
|
};
|
||||||
|
// This matches when the hashtable key is a pointer.
|
||||||
|
template<class HashKey>
|
||||||
|
class hash_munger<HashKey*>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static size_t MungedHash(size_t hash)
|
||||||
|
{
|
||||||
|
// TODO(csilvers): consider rotating instead:
|
||||||
|
// static const int shift = (sizeof(void *) == 4) ? 2 : 3;
|
||||||
|
// return (hash << (sizeof(hash) * 8) - shift)) | (hash >> shift);
|
||||||
|
// This matters if we ever change sparse/dense_hash_* to compare
|
||||||
|
// hashes before comparing actual values. It's speedy on x86.
|
||||||
|
return hash / sizeof(void*); // get rid of known-0 bits
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
size_type enlarge_threshold_; // table.size() * enlarge_factor
|
||||||
|
size_type shrink_threshold_; // table.size() * shrink_factor
|
||||||
|
float enlarge_factor_; // how full before resize
|
||||||
|
float shrink_factor_; // how empty before resize
|
||||||
|
// consider_shrink=true if we should try to shrink before next insert
|
||||||
|
bool consider_shrink_;
|
||||||
|
bool use_empty_; // used only by densehashtable, not sparsehashtable
|
||||||
|
bool use_deleted_; // false until delkey has been set
|
||||||
|
// num_ht_copies is a counter incremented every Copy/Move
|
||||||
|
unsigned int num_ht_copies_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sparsehash_internal
|
} // namespace sparsehash_internal
|
||||||
|
|
||||||
_END_GOOGLE_NAMESPACE_
|
_END_GOOGLE_NAMESPACE_
|
||||||
|
|
||||||
#endif // UTIL_GTL_HASHTABLE_COMMON_H_
|
#endif // UTIL_GTL_HASHTABLE_COMMON_H_
|
||||||
|
|
|
@ -33,87 +33,82 @@
|
||||||
#define UTIL_GTL_LIBC_ALLOCATOR_WITH_REALLOC_H_
|
#define UTIL_GTL_LIBC_ALLOCATOR_WITH_REALLOC_H_
|
||||||
|
|
||||||
#include <mapnik/sparsehash/internal/sparseconfig.h>
|
#include <mapnik/sparsehash/internal/sparseconfig.h>
|
||||||
#include <stdlib.h> // for malloc/realloc/free
|
#include <stdlib.h> // for malloc/realloc/free
|
||||||
#include <stddef.h> // for ptrdiff_t
|
#include <stddef.h> // for ptrdiff_t
|
||||||
#include <new> // for placement new
|
#include <new> // for placement new
|
||||||
|
|
||||||
_START_GOOGLE_NAMESPACE_
|
_START_GOOGLE_NAMESPACE_
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
class libc_allocator_with_realloc {
|
class libc_allocator_with_realloc
|
||||||
public:
|
{
|
||||||
typedef T value_type;
|
public:
|
||||||
typedef size_t size_type;
|
typedef T value_type;
|
||||||
typedef ptrdiff_t difference_type;
|
typedef size_t size_type;
|
||||||
|
typedef ptrdiff_t difference_type;
|
||||||
|
|
||||||
typedef T* pointer;
|
typedef T* pointer;
|
||||||
typedef const T* const_pointer;
|
typedef const T* const_pointer;
|
||||||
typedef T& reference;
|
typedef T& reference;
|
||||||
typedef const T& const_reference;
|
typedef const T& const_reference;
|
||||||
|
|
||||||
libc_allocator_with_realloc() {}
|
libc_allocator_with_realloc() {}
|
||||||
libc_allocator_with_realloc(const libc_allocator_with_realloc&) {}
|
libc_allocator_with_realloc(const libc_allocator_with_realloc&) {}
|
||||||
~libc_allocator_with_realloc() {}
|
~libc_allocator_with_realloc() {}
|
||||||
|
|
||||||
pointer address(reference r) const { return &r; }
|
pointer address(reference r) const { return &r; }
|
||||||
const_pointer address(const_reference r) const { return &r; }
|
const_pointer address(const_reference r) const { return &r; }
|
||||||
|
|
||||||
pointer allocate(size_type n, const_pointer = 0) {
|
pointer allocate(size_type n, const_pointer = 0) { return static_cast<pointer>(malloc(n * sizeof(value_type))); }
|
||||||
return static_cast<pointer>(malloc(n * sizeof(value_type)));
|
void deallocate(pointer p, size_type) { free(p); }
|
||||||
}
|
pointer reallocate(pointer p, size_type n) { return static_cast<pointer>(realloc(p, n * sizeof(value_type))); }
|
||||||
void deallocate(pointer p, size_type) {
|
|
||||||
free(p);
|
|
||||||
}
|
|
||||||
pointer reallocate(pointer p, size_type n) {
|
|
||||||
return static_cast<pointer>(realloc(p, n * sizeof(value_type)));
|
|
||||||
}
|
|
||||||
|
|
||||||
size_type max_size() const {
|
size_type max_size() const { return static_cast<size_type>(-1) / sizeof(value_type); }
|
||||||
return static_cast<size_type>(-1) / sizeof(value_type);
|
|
||||||
}
|
|
||||||
|
|
||||||
void construct(pointer p, const value_type& val) {
|
void construct(pointer p, const value_type& val) { new (p) value_type(val); }
|
||||||
new(p) value_type(val);
|
void destroy(pointer p) { p->~value_type(); }
|
||||||
}
|
|
||||||
void destroy(pointer p) { p->~value_type(); }
|
|
||||||
|
|
||||||
template <class U>
|
template<class U>
|
||||||
libc_allocator_with_realloc(const libc_allocator_with_realloc<U>&) {}
|
libc_allocator_with_realloc(const libc_allocator_with_realloc<U>&)
|
||||||
|
{}
|
||||||
|
|
||||||
template<class U>
|
template<class U>
|
||||||
struct rebind {
|
struct rebind
|
||||||
typedef libc_allocator_with_realloc<U> other;
|
{
|
||||||
};
|
typedef libc_allocator_with_realloc<U> other;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// libc_allocator_with_realloc<void> specialization.
|
// libc_allocator_with_realloc<void> specialization.
|
||||||
template<>
|
template<>
|
||||||
class libc_allocator_with_realloc<void> {
|
class libc_allocator_with_realloc<void>
|
||||||
public:
|
{
|
||||||
typedef void value_type;
|
public:
|
||||||
typedef size_t size_type;
|
typedef void value_type;
|
||||||
typedef ptrdiff_t difference_type;
|
typedef size_t size_type;
|
||||||
typedef void* pointer;
|
typedef ptrdiff_t difference_type;
|
||||||
typedef const void* const_pointer;
|
typedef void* pointer;
|
||||||
|
typedef const void* const_pointer;
|
||||||
|
|
||||||
template<class U>
|
template<class U>
|
||||||
struct rebind {
|
struct rebind
|
||||||
typedef libc_allocator_with_realloc<U> other;
|
{
|
||||||
};
|
typedef libc_allocator_with_realloc<U> other;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline bool operator==(const libc_allocator_with_realloc<T>&,
|
inline bool operator==(const libc_allocator_with_realloc<T>&, const libc_allocator_with_realloc<T>&)
|
||||||
const libc_allocator_with_realloc<T>&) {
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline bool operator!=(const libc_allocator_with_realloc<T>&,
|
inline bool operator!=(const libc_allocator_with_realloc<T>&, const libc_allocator_with_realloc<T>&)
|
||||||
const libc_allocator_with_realloc<T>&) {
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_END_GOOGLE_NAMESPACE_
|
_END_GOOGLE_NAMESPACE_
|
||||||
|
|
||||||
#endif // UTIL_GTL_LIBC_ALLOCATOR_WITH_REALLOC_H_
|
#endif // UTIL_GTL_LIBC_ALLOCATOR_WITH_REALLOC_H_
|
||||||
|
|
59
deps/mapnik/sparsehash/template_util.h
vendored
59
deps/mapnik/sparsehash/template_util.h
vendored
|
@ -56,14 +56,16 @@ _START_GOOGLE_NAMESPACE_
|
||||||
// sizeof(big_)
|
// sizeof(big_)
|
||||||
typedef char small_;
|
typedef char small_;
|
||||||
|
|
||||||
struct big_ {
|
struct big_
|
||||||
char dummy[2];
|
{
|
||||||
|
char dummy[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
// Identity metafunction.
|
// Identity metafunction.
|
||||||
template <class T>
|
template<class T>
|
||||||
struct identity_ {
|
struct identity_
|
||||||
typedef T type;
|
{
|
||||||
|
typedef T type;
|
||||||
};
|
};
|
||||||
|
|
||||||
// integral_constant, defined in tr1, is a wrapper for an integer
|
// integral_constant, defined in tr1, is a wrapper for an integer
|
||||||
|
@ -72,63 +74,64 @@ struct identity_ {
|
||||||
// general integer_constant for compatibility with tr1.
|
// general integer_constant for compatibility with tr1.
|
||||||
|
|
||||||
template<class T, T v>
|
template<class T, T v>
|
||||||
struct integral_constant {
|
struct integral_constant
|
||||||
static const T value = v;
|
{
|
||||||
typedef T value_type;
|
static const T value = v;
|
||||||
typedef integral_constant<T, v> type;
|
typedef T value_type;
|
||||||
|
typedef integral_constant<T, v> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T, T v> const T integral_constant<T, v>::value;
|
template<class T, T v>
|
||||||
|
const T integral_constant<T, v>::value;
|
||||||
|
|
||||||
// Abbreviations: true_type and false_type are structs that represent boolean
|
// Abbreviations: true_type and false_type are structs that represent boolean
|
||||||
// true and false values. Also define the boost::mpl versions of those names,
|
// true and false values. Also define the boost::mpl versions of those names,
|
||||||
// true_ and false_.
|
// true_ and false_.
|
||||||
typedef integral_constant<bool, true> true_type;
|
typedef integral_constant<bool, true> true_type;
|
||||||
typedef integral_constant<bool, false> false_type;
|
typedef integral_constant<bool, false> false_type;
|
||||||
typedef true_type true_;
|
typedef true_type true_;
|
||||||
typedef false_type false_;
|
typedef false_type false_;
|
||||||
|
|
||||||
// if_ is a templatized conditional statement.
|
// if_ is a templatized conditional statement.
|
||||||
// if_<cond, A, B> is a compile time evaluation of cond.
|
// if_<cond, A, B> is a compile time evaluation of cond.
|
||||||
// if_<>::type contains A if cond is true, B otherwise.
|
// if_<>::type contains A if cond is true, B otherwise.
|
||||||
template<bool cond, typename A, typename B>
|
template<bool cond, typename A, typename B>
|
||||||
struct if_{
|
struct if_
|
||||||
typedef A type;
|
{
|
||||||
|
typedef A type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename A, typename B>
|
template<typename A, typename B>
|
||||||
struct if_<false, A, B> {
|
struct if_<false, A, B>
|
||||||
typedef B type;
|
{
|
||||||
|
typedef B type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// type_equals_ is a template type comparator, similar to Loki IsSameType.
|
// type_equals_ is a template type comparator, similar to Loki IsSameType.
|
||||||
// type_equals_<A, B>::value is true iff "A" is the same type as "B".
|
// type_equals_<A, B>::value is true iff "A" is the same type as "B".
|
||||||
//
|
//
|
||||||
// New code should prefer base::is_same, defined in base/type_traits.h.
|
// New code should prefer base::is_same, defined in base/type_traits.h.
|
||||||
// It is functionally identical, but is_same is the standard spelling.
|
// It is functionally identical, but is_same is the standard spelling.
|
||||||
template<typename A, typename B>
|
template<typename A, typename B>
|
||||||
struct type_equals_ : public false_ {
|
struct type_equals_ : public false_
|
||||||
};
|
{};
|
||||||
|
|
||||||
template<typename A>
|
template<typename A>
|
||||||
struct type_equals_<A, A> : public true_ {
|
struct type_equals_<A, A> : public true_
|
||||||
};
|
{};
|
||||||
|
|
||||||
// and_ is a template && operator.
|
// and_ is a template && operator.
|
||||||
// and_<A, B>::value evaluates "A::value && B::value".
|
// and_<A, B>::value evaluates "A::value && B::value".
|
||||||
template<typename A, typename B>
|
template<typename A, typename B>
|
||||||
struct and_ : public integral_constant<bool, (A::value && B::value)> {
|
struct and_ : public integral_constant<bool, (A::value && B::value)>
|
||||||
};
|
{};
|
||||||
|
|
||||||
// or_ is a template || operator.
|
// or_ is a template || operator.
|
||||||
// or_<A, B>::value evaluates "A::value || B::value".
|
// or_<A, B>::value evaluates "A::value || B::value".
|
||||||
template<typename A, typename B>
|
template<typename A, typename B>
|
||||||
struct or_ : public integral_constant<bool, (A::value || B::value)> {
|
struct or_ : public integral_constant<bool, (A::value || B::value)>
|
||||||
};
|
{};
|
||||||
|
|
||||||
|
|
||||||
_END_GOOGLE_NAMESPACE_
|
_END_GOOGLE_NAMESPACE_
|
||||||
|
|
||||||
#endif // BASE_TEMPLATE_UTIL_H_
|
#endif // BASE_TEMPLATE_UTIL_H_
|
||||||
|
|
469
deps/mapnik/sparsehash/type_traits.h
vendored
469
deps/mapnik/sparsehash/type_traits.h
vendored
|
@ -58,106 +58,188 @@
|
||||||
#define BASE_TYPE_TRAITS_H_
|
#define BASE_TYPE_TRAITS_H_
|
||||||
|
|
||||||
#include <mapnik/sparsehash/internal/sparseconfig.h>
|
#include <mapnik/sparsehash/internal/sparseconfig.h>
|
||||||
#include <utility> // For pair
|
#include <utility> // For pair
|
||||||
|
|
||||||
#include <mapnik/sparsehash/template_util.h> // For true_type and false_type
|
#include <mapnik/sparsehash/template_util.h> // For true_type and false_type
|
||||||
|
|
||||||
_START_GOOGLE_NAMESPACE_
|
_START_GOOGLE_NAMESPACE_
|
||||||
|
|
||||||
template <class T> struct is_integral;
|
template<class T>
|
||||||
template <class T> struct is_floating_point;
|
struct is_integral;
|
||||||
template <class T> struct is_pointer;
|
template<class T>
|
||||||
|
struct is_floating_point;
|
||||||
|
template<class T>
|
||||||
|
struct is_pointer;
|
||||||
// MSVC can't compile this correctly, and neither can gcc 3.3.5 (at least)
|
// MSVC can't compile this correctly, and neither can gcc 3.3.5 (at least)
|
||||||
#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3)
|
#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3)
|
||||||
// is_enum uses is_convertible, which is not available on MSVC.
|
// is_enum uses is_convertible, which is not available on MSVC.
|
||||||
template <class T> struct is_enum;
|
template<class T>
|
||||||
|
struct is_enum;
|
||||||
#endif
|
#endif
|
||||||
template <class T> struct is_reference;
|
template<class T>
|
||||||
template <class T> struct is_pod;
|
struct is_reference;
|
||||||
template <class T> struct has_trivial_constructor;
|
template<class T>
|
||||||
template <class T> struct has_trivial_copy;
|
struct is_pod;
|
||||||
template <class T> struct has_trivial_assign;
|
template<class T>
|
||||||
template <class T> struct has_trivial_destructor;
|
struct has_trivial_constructor;
|
||||||
template <class T> struct remove_const;
|
template<class T>
|
||||||
template <class T> struct remove_volatile;
|
struct has_trivial_copy;
|
||||||
template <class T> struct remove_cv;
|
template<class T>
|
||||||
template <class T> struct remove_reference;
|
struct has_trivial_assign;
|
||||||
template <class T> struct add_reference;
|
template<class T>
|
||||||
template <class T> struct remove_pointer;
|
struct has_trivial_destructor;
|
||||||
template <class T, class U> struct is_same;
|
template<class T>
|
||||||
|
struct remove_const;
|
||||||
|
template<class T>
|
||||||
|
struct remove_volatile;
|
||||||
|
template<class T>
|
||||||
|
struct remove_cv;
|
||||||
|
template<class T>
|
||||||
|
struct remove_reference;
|
||||||
|
template<class T>
|
||||||
|
struct add_reference;
|
||||||
|
template<class T>
|
||||||
|
struct remove_pointer;
|
||||||
|
template<class T, class U>
|
||||||
|
struct is_same;
|
||||||
#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3)
|
#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3)
|
||||||
template <class From, class To> struct is_convertible;
|
template<class From, class To>
|
||||||
|
struct is_convertible;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// is_integral is false except for the built-in integer types. A
|
// is_integral is false except for the built-in integer types. A
|
||||||
// cv-qualified type is integral if and only if the underlying type is.
|
// cv-qualified type is integral if and only if the underlying type is.
|
||||||
template <class T> struct is_integral : false_type { };
|
template<class T>
|
||||||
template<> struct is_integral<bool> : true_type { };
|
struct is_integral : false_type
|
||||||
template<> struct is_integral<char> : true_type { };
|
{};
|
||||||
template<> struct is_integral<unsigned char> : true_type { };
|
template<>
|
||||||
template<> struct is_integral<signed char> : true_type { };
|
struct is_integral<bool> : true_type
|
||||||
|
{};
|
||||||
|
template<>
|
||||||
|
struct is_integral<char> : true_type
|
||||||
|
{};
|
||||||
|
template<>
|
||||||
|
struct is_integral<unsigned char> : true_type
|
||||||
|
{};
|
||||||
|
template<>
|
||||||
|
struct is_integral<signed char> : true_type
|
||||||
|
{};
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
// wchar_t is not by default a distinct type from unsigned short in
|
// wchar_t is not by default a distinct type from unsigned short in
|
||||||
// Microsoft C.
|
// Microsoft C.
|
||||||
// See http://msdn2.microsoft.com/en-us/library/dh8che7s(VS.80).aspx
|
// See http://msdn2.microsoft.com/en-us/library/dh8che7s(VS.80).aspx
|
||||||
template<> struct is_integral<__wchar_t> : true_type { };
|
template<>
|
||||||
|
struct is_integral<__wchar_t> : true_type
|
||||||
|
{};
|
||||||
#else
|
#else
|
||||||
template<> struct is_integral<wchar_t> : true_type { };
|
template<>
|
||||||
|
struct is_integral<wchar_t> : true_type
|
||||||
|
{};
|
||||||
#endif
|
#endif
|
||||||
template<> struct is_integral<short> : true_type { };
|
template<>
|
||||||
template<> struct is_integral<unsigned short> : true_type { };
|
struct is_integral<short> : true_type
|
||||||
template<> struct is_integral<int> : true_type { };
|
{};
|
||||||
template<> struct is_integral<unsigned int> : true_type { };
|
template<>
|
||||||
template<> struct is_integral<long> : true_type { };
|
struct is_integral<unsigned short> : true_type
|
||||||
template<> struct is_integral<unsigned long> : true_type { };
|
{};
|
||||||
|
template<>
|
||||||
|
struct is_integral<int> : true_type
|
||||||
|
{};
|
||||||
|
template<>
|
||||||
|
struct is_integral<unsigned int> : true_type
|
||||||
|
{};
|
||||||
|
template<>
|
||||||
|
struct is_integral<long> : true_type
|
||||||
|
{};
|
||||||
|
template<>
|
||||||
|
struct is_integral<unsigned long> : true_type
|
||||||
|
{};
|
||||||
#ifdef HAVE_LONG_LONG
|
#ifdef HAVE_LONG_LONG
|
||||||
template<> struct is_integral<long long> : true_type { };
|
template<>
|
||||||
template<> struct is_integral<unsigned long long> : true_type { };
|
struct is_integral<long long> : true_type
|
||||||
|
{};
|
||||||
|
template<>
|
||||||
|
struct is_integral<unsigned long long> : true_type
|
||||||
|
{};
|
||||||
#endif
|
#endif
|
||||||
template <class T> struct is_integral<const T> : is_integral<T> { };
|
template<class T>
|
||||||
template <class T> struct is_integral<volatile T> : is_integral<T> { };
|
struct is_integral<const T> : is_integral<T>
|
||||||
template <class T> struct is_integral<const volatile T> : is_integral<T> { };
|
{};
|
||||||
|
template<class T>
|
||||||
|
struct is_integral<volatile T> : is_integral<T>
|
||||||
|
{};
|
||||||
|
template<class T>
|
||||||
|
struct is_integral<const volatile T> : is_integral<T>
|
||||||
|
{};
|
||||||
|
|
||||||
// is_floating_point is false except for the built-in floating-point types.
|
// is_floating_point is false except for the built-in floating-point types.
|
||||||
// A cv-qualified type is integral if and only if the underlying type is.
|
// A cv-qualified type is integral if and only if the underlying type is.
|
||||||
template <class T> struct is_floating_point : false_type { };
|
template<class T>
|
||||||
template<> struct is_floating_point<float> : true_type { };
|
struct is_floating_point : false_type
|
||||||
template<> struct is_floating_point<double> : true_type { };
|
{};
|
||||||
template<> struct is_floating_point<long double> : true_type { };
|
template<>
|
||||||
template <class T> struct is_floating_point<const T>
|
struct is_floating_point<float> : true_type
|
||||||
: is_floating_point<T> { };
|
{};
|
||||||
template <class T> struct is_floating_point<volatile T>
|
template<>
|
||||||
: is_floating_point<T> { };
|
struct is_floating_point<double> : true_type
|
||||||
template <class T> struct is_floating_point<const volatile T>
|
{};
|
||||||
: is_floating_point<T> { };
|
template<>
|
||||||
|
struct is_floating_point<long double> : true_type
|
||||||
|
{};
|
||||||
|
template<class T>
|
||||||
|
struct is_floating_point<const T> : is_floating_point<T>
|
||||||
|
{};
|
||||||
|
template<class T>
|
||||||
|
struct is_floating_point<volatile T> : is_floating_point<T>
|
||||||
|
{};
|
||||||
|
template<class T>
|
||||||
|
struct is_floating_point<const volatile T> : is_floating_point<T>
|
||||||
|
{};
|
||||||
|
|
||||||
// is_pointer is false except for pointer types. A cv-qualified type (e.g.
|
// is_pointer is false except for pointer types. A cv-qualified type (e.g.
|
||||||
// "int* const", as opposed to "int const*") is cv-qualified if and only if
|
// "int* const", as opposed to "int const*") is cv-qualified if and only if
|
||||||
// the underlying type is.
|
// the underlying type is.
|
||||||
template <class T> struct is_pointer : false_type { };
|
template<class T>
|
||||||
template <class T> struct is_pointer<T*> : true_type { };
|
struct is_pointer : false_type
|
||||||
template <class T> struct is_pointer<const T> : is_pointer<T> { };
|
{};
|
||||||
template <class T> struct is_pointer<volatile T> : is_pointer<T> { };
|
template<class T>
|
||||||
template <class T> struct is_pointer<const volatile T> : is_pointer<T> { };
|
struct is_pointer<T*> : true_type
|
||||||
|
{};
|
||||||
|
template<class T>
|
||||||
|
struct is_pointer<const T> : is_pointer<T>
|
||||||
|
{};
|
||||||
|
template<class T>
|
||||||
|
struct is_pointer<volatile T> : is_pointer<T>
|
||||||
|
{};
|
||||||
|
template<class T>
|
||||||
|
struct is_pointer<const volatile T> : is_pointer<T>
|
||||||
|
{};
|
||||||
|
|
||||||
#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3)
|
#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3)
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
template <class T> struct is_class_or_union {
|
template<class T>
|
||||||
template <class U> static small_ tester(void (U::*)());
|
struct is_class_or_union
|
||||||
template <class U> static big_ tester(...);
|
{
|
||||||
static const bool value = sizeof(tester<T>(0)) == sizeof(small_);
|
template<class U>
|
||||||
|
static small_ tester(void (U::*)());
|
||||||
|
template<class U>
|
||||||
|
static big_ tester(...);
|
||||||
|
static const bool value = sizeof(tester<T>(0)) == sizeof(small_);
|
||||||
};
|
};
|
||||||
|
|
||||||
// is_convertible chokes if the first argument is an array. That's why
|
// is_convertible chokes if the first argument is an array. That's why
|
||||||
// we use add_reference here.
|
// we use add_reference here.
|
||||||
template <bool NotUnum, class T> struct is_enum_impl
|
template<bool NotUnum, class T>
|
||||||
: is_convertible<typename add_reference<T>::type, int> { };
|
struct is_enum_impl : is_convertible<typename add_reference<T>::type, int>
|
||||||
|
{};
|
||||||
|
|
||||||
template <class T> struct is_enum_impl<true, T> : false_type { };
|
template<class T>
|
||||||
|
struct is_enum_impl<true, T> : false_type
|
||||||
|
{};
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
||||||
// Specified by TR1 [4.5.1] primary type categories.
|
// Specified by TR1 [4.5.1] primary type categories.
|
||||||
|
|
||||||
|
@ -174,127 +256,212 @@ template <class T> struct is_enum_impl<true, T> : false_type { };
|
||||||
// Is-convertible-to-int check is done only if all other checks pass,
|
// Is-convertible-to-int check is done only if all other checks pass,
|
||||||
// because it can't be used with some types (e.g. void or classes with
|
// because it can't be used with some types (e.g. void or classes with
|
||||||
// inaccessible conversion operators).
|
// inaccessible conversion operators).
|
||||||
template <class T> struct is_enum
|
template<class T>
|
||||||
: internal::is_enum_impl<
|
struct is_enum
|
||||||
is_same<T, void>::value ||
|
: internal::is_enum_impl<is_same<T, void>::value || is_integral<T>::value || is_floating_point<T>::value ||
|
||||||
is_integral<T>::value ||
|
is_reference<T>::value || internal::is_class_or_union<T>::value,
|
||||||
is_floating_point<T>::value ||
|
T>
|
||||||
is_reference<T>::value ||
|
{};
|
||||||
internal::is_class_or_union<T>::value,
|
|
||||||
T> { };
|
|
||||||
|
|
||||||
template <class T> struct is_enum<const T> : is_enum<T> { };
|
template<class T>
|
||||||
template <class T> struct is_enum<volatile T> : is_enum<T> { };
|
struct is_enum<const T> : is_enum<T>
|
||||||
template <class T> struct is_enum<const volatile T> : is_enum<T> { };
|
{};
|
||||||
|
template<class T>
|
||||||
|
struct is_enum<volatile T> : is_enum<T>
|
||||||
|
{};
|
||||||
|
template<class T>
|
||||||
|
struct is_enum<const volatile T> : is_enum<T>
|
||||||
|
{};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// is_reference is false except for reference types.
|
// is_reference is false except for reference types.
|
||||||
template<typename T> struct is_reference : false_type {};
|
template<typename T>
|
||||||
template<typename T> struct is_reference<T&> : true_type {};
|
struct is_reference : false_type
|
||||||
|
{};
|
||||||
|
template<typename T>
|
||||||
|
struct is_reference<T&> : true_type
|
||||||
|
{};
|
||||||
|
|
||||||
// We can't get is_pod right without compiler help, so fail conservatively.
|
// We can't get is_pod right without compiler help, so fail conservatively.
|
||||||
// We will assume it's false except for arithmetic types, enumerations,
|
// We will assume it's false except for arithmetic types, enumerations,
|
||||||
// pointers and cv-qualified versions thereof. Note that std::pair<T,U>
|
// pointers and cv-qualified versions thereof. Note that std::pair<T,U>
|
||||||
// is not a POD even if T and U are PODs.
|
// is not a POD even if T and U are PODs.
|
||||||
template <class T> struct is_pod
|
template<class T>
|
||||||
: integral_constant<bool, (is_integral<T>::value ||
|
struct is_pod : integral_constant<bool,
|
||||||
is_floating_point<T>::value ||
|
(is_integral<T>::value || is_floating_point<T>::value ||
|
||||||
#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3)
|
#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3)
|
||||||
// is_enum is not available on MSVC.
|
// is_enum is not available on MSVC.
|
||||||
is_enum<T>::value ||
|
is_enum<T>::value ||
|
||||||
#endif
|
#endif
|
||||||
is_pointer<T>::value)> { };
|
is_pointer<T>::value)>
|
||||||
template <class T> struct is_pod<const T> : is_pod<T> { };
|
{};
|
||||||
template <class T> struct is_pod<volatile T> : is_pod<T> { };
|
template<class T>
|
||||||
template <class T> struct is_pod<const volatile T> : is_pod<T> { };
|
struct is_pod<const T> : is_pod<T>
|
||||||
|
{};
|
||||||
|
template<class T>
|
||||||
|
struct is_pod<volatile T> : is_pod<T>
|
||||||
|
{};
|
||||||
|
template<class T>
|
||||||
|
struct is_pod<const volatile T> : is_pod<T>
|
||||||
|
{};
|
||||||
|
|
||||||
// We can't get has_trivial_constructor right without compiler help, so
|
// We can't get has_trivial_constructor right without compiler help, so
|
||||||
// fail conservatively. We will assume it's false except for: (1) types
|
// fail conservatively. We will assume it's false except for: (1) types
|
||||||
// for which is_pod is true. (2) std::pair of types with trivial
|
// for which is_pod is true. (2) std::pair of types with trivial
|
||||||
// constructors. (3) array of a type with a trivial constructor.
|
// constructors. (3) array of a type with a trivial constructor.
|
||||||
// (4) const versions thereof.
|
// (4) const versions thereof.
|
||||||
template <class T> struct has_trivial_constructor : is_pod<T> { };
|
template<class T>
|
||||||
template <class T, class U> struct has_trivial_constructor<std::pair<T, U> >
|
struct has_trivial_constructor : is_pod<T>
|
||||||
: integral_constant<bool,
|
{};
|
||||||
(has_trivial_constructor<T>::value &&
|
template<class T, class U>
|
||||||
has_trivial_constructor<U>::value)> { };
|
struct has_trivial_constructor<std::pair<T, U>>
|
||||||
template <class A, int N> struct has_trivial_constructor<A[N]>
|
: integral_constant<bool, (has_trivial_constructor<T>::value && has_trivial_constructor<U>::value)>
|
||||||
: has_trivial_constructor<A> { };
|
{};
|
||||||
template <class T> struct has_trivial_constructor<const T>
|
template<class A, int N>
|
||||||
: has_trivial_constructor<T> { };
|
struct has_trivial_constructor<A[N]> : has_trivial_constructor<A>
|
||||||
|
{};
|
||||||
|
template<class T>
|
||||||
|
struct has_trivial_constructor<const T> : has_trivial_constructor<T>
|
||||||
|
{};
|
||||||
|
|
||||||
// We can't get has_trivial_copy right without compiler help, so fail
|
// We can't get has_trivial_copy right without compiler help, so fail
|
||||||
// conservatively. We will assume it's false except for: (1) types
|
// conservatively. We will assume it's false except for: (1) types
|
||||||
// for which is_pod is true. (2) std::pair of types with trivial copy
|
// for which is_pod is true. (2) std::pair of types with trivial copy
|
||||||
// constructors. (3) array of a type with a trivial copy constructor.
|
// constructors. (3) array of a type with a trivial copy constructor.
|
||||||
// (4) const versions thereof.
|
// (4) const versions thereof.
|
||||||
template <class T> struct has_trivial_copy : is_pod<T> { };
|
template<class T>
|
||||||
template <class T, class U> struct has_trivial_copy<std::pair<T, U> >
|
struct has_trivial_copy : is_pod<T>
|
||||||
: integral_constant<bool,
|
{};
|
||||||
(has_trivial_copy<T>::value &&
|
template<class T, class U>
|
||||||
has_trivial_copy<U>::value)> { };
|
struct has_trivial_copy<std::pair<T, U>>
|
||||||
template <class A, int N> struct has_trivial_copy<A[N]>
|
: integral_constant<bool, (has_trivial_copy<T>::value && has_trivial_copy<U>::value)>
|
||||||
: has_trivial_copy<A> { };
|
{};
|
||||||
template <class T> struct has_trivial_copy<const T> : has_trivial_copy<T> { };
|
template<class A, int N>
|
||||||
|
struct has_trivial_copy<A[N]> : has_trivial_copy<A>
|
||||||
|
{};
|
||||||
|
template<class T>
|
||||||
|
struct has_trivial_copy<const T> : has_trivial_copy<T>
|
||||||
|
{};
|
||||||
|
|
||||||
// We can't get has_trivial_assign right without compiler help, so fail
|
// We can't get has_trivial_assign right without compiler help, so fail
|
||||||
// conservatively. We will assume it's false except for: (1) types
|
// conservatively. We will assume it's false except for: (1) types
|
||||||
// for which is_pod is true. (2) std::pair of types with trivial copy
|
// for which is_pod is true. (2) std::pair of types with trivial copy
|
||||||
// constructors. (3) array of a type with a trivial assign constructor.
|
// constructors. (3) array of a type with a trivial assign constructor.
|
||||||
template <class T> struct has_trivial_assign : is_pod<T> { };
|
template<class T>
|
||||||
template <class T, class U> struct has_trivial_assign<std::pair<T, U> >
|
struct has_trivial_assign : is_pod<T>
|
||||||
: integral_constant<bool,
|
{};
|
||||||
(has_trivial_assign<T>::value &&
|
template<class T, class U>
|
||||||
has_trivial_assign<U>::value)> { };
|
struct has_trivial_assign<std::pair<T, U>>
|
||||||
template <class A, int N> struct has_trivial_assign<A[N]>
|
: integral_constant<bool, (has_trivial_assign<T>::value && has_trivial_assign<U>::value)>
|
||||||
: has_trivial_assign<A> { };
|
{};
|
||||||
|
template<class A, int N>
|
||||||
|
struct has_trivial_assign<A[N]> : has_trivial_assign<A>
|
||||||
|
{};
|
||||||
|
|
||||||
// We can't get has_trivial_destructor right without compiler help, so
|
// We can't get has_trivial_destructor right without compiler help, so
|
||||||
// fail conservatively. We will assume it's false except for: (1) types
|
// fail conservatively. We will assume it's false except for: (1) types
|
||||||
// for which is_pod is true. (2) std::pair of types with trivial
|
// for which is_pod is true. (2) std::pair of types with trivial
|
||||||
// destructors. (3) array of a type with a trivial destructor.
|
// destructors. (3) array of a type with a trivial destructor.
|
||||||
// (4) const versions thereof.
|
// (4) const versions thereof.
|
||||||
template <class T> struct has_trivial_destructor : is_pod<T> { };
|
template<class T>
|
||||||
template <class T, class U> struct has_trivial_destructor<std::pair<T, U> >
|
struct has_trivial_destructor : is_pod<T>
|
||||||
: integral_constant<bool,
|
{};
|
||||||
(has_trivial_destructor<T>::value &&
|
template<class T, class U>
|
||||||
has_trivial_destructor<U>::value)> { };
|
struct has_trivial_destructor<std::pair<T, U>>
|
||||||
template <class A, int N> struct has_trivial_destructor<A[N]>
|
: integral_constant<bool, (has_trivial_destructor<T>::value && has_trivial_destructor<U>::value)>
|
||||||
: has_trivial_destructor<A> { };
|
{};
|
||||||
template <class T> struct has_trivial_destructor<const T>
|
template<class A, int N>
|
||||||
: has_trivial_destructor<T> { };
|
struct has_trivial_destructor<A[N]> : has_trivial_destructor<A>
|
||||||
|
{};
|
||||||
|
template<class T>
|
||||||
|
struct has_trivial_destructor<const T> : has_trivial_destructor<T>
|
||||||
|
{};
|
||||||
|
|
||||||
// Specified by TR1 [4.7.1]
|
// Specified by TR1 [4.7.1]
|
||||||
template<typename T> struct remove_const { typedef T type; };
|
template<typename T>
|
||||||
template<typename T> struct remove_const<T const> { typedef T type; };
|
struct remove_const
|
||||||
template<typename T> struct remove_volatile { typedef T type; };
|
{
|
||||||
template<typename T> struct remove_volatile<T volatile> { typedef T type; };
|
typedef T type;
|
||||||
template<typename T> struct remove_cv {
|
};
|
||||||
typedef typename remove_const<typename remove_volatile<T>::type>::type type;
|
template<typename T>
|
||||||
|
struct remove_const<T const>
|
||||||
|
{
|
||||||
|
typedef T type;
|
||||||
|
};
|
||||||
|
template<typename T>
|
||||||
|
struct remove_volatile
|
||||||
|
{
|
||||||
|
typedef T type;
|
||||||
|
};
|
||||||
|
template<typename T>
|
||||||
|
struct remove_volatile<T volatile>
|
||||||
|
{
|
||||||
|
typedef T type;
|
||||||
|
};
|
||||||
|
template<typename T>
|
||||||
|
struct remove_cv
|
||||||
|
{
|
||||||
|
typedef typename remove_const<typename remove_volatile<T>::type>::type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Specified by TR1 [4.7.2] Reference modifications.
|
// Specified by TR1 [4.7.2] Reference modifications.
|
||||||
template<typename T> struct remove_reference { typedef T type; };
|
template<typename T>
|
||||||
template<typename T> struct remove_reference<T&> { typedef T type; };
|
struct remove_reference
|
||||||
|
{
|
||||||
|
typedef T type;
|
||||||
|
};
|
||||||
|
template<typename T>
|
||||||
|
struct remove_reference<T&>
|
||||||
|
{
|
||||||
|
typedef T type;
|
||||||
|
};
|
||||||
|
|
||||||
template <typename T> struct add_reference { typedef T& type; };
|
template<typename T>
|
||||||
template <typename T> struct add_reference<T&> { typedef T& type; };
|
struct add_reference
|
||||||
|
{
|
||||||
|
typedef T& type;
|
||||||
|
};
|
||||||
|
template<typename T>
|
||||||
|
struct add_reference<T&>
|
||||||
|
{
|
||||||
|
typedef T& type;
|
||||||
|
};
|
||||||
|
|
||||||
// Specified by TR1 [4.7.4] Pointer modifications.
|
// Specified by TR1 [4.7.4] Pointer modifications.
|
||||||
template<typename T> struct remove_pointer { typedef T type; };
|
template<typename T>
|
||||||
template<typename T> struct remove_pointer<T*> { typedef T type; };
|
struct remove_pointer
|
||||||
template<typename T> struct remove_pointer<T* const> { typedef T type; };
|
{
|
||||||
template<typename T> struct remove_pointer<T* volatile> { typedef T type; };
|
typedef T type;
|
||||||
template<typename T> struct remove_pointer<T* const volatile> {
|
};
|
||||||
typedef T type; };
|
template<typename T>
|
||||||
|
struct remove_pointer<T*>
|
||||||
|
{
|
||||||
|
typedef T type;
|
||||||
|
};
|
||||||
|
template<typename T>
|
||||||
|
struct remove_pointer<T* const>
|
||||||
|
{
|
||||||
|
typedef T type;
|
||||||
|
};
|
||||||
|
template<typename T>
|
||||||
|
struct remove_pointer<T* volatile>
|
||||||
|
{
|
||||||
|
typedef T type;
|
||||||
|
};
|
||||||
|
template<typename T>
|
||||||
|
struct remove_pointer<T* const volatile>
|
||||||
|
{
|
||||||
|
typedef T type;
|
||||||
|
};
|
||||||
|
|
||||||
// Specified by TR1 [4.6] Relationships between types
|
// Specified by TR1 [4.6] Relationships between types
|
||||||
template<typename T, typename U> struct is_same : public false_type { };
|
template<typename T, typename U>
|
||||||
template<typename T> struct is_same<T, T> : public true_type { };
|
struct is_same : public false_type
|
||||||
|
{};
|
||||||
|
template<typename T>
|
||||||
|
struct is_same<T, T> : public true_type
|
||||||
|
{};
|
||||||
|
|
||||||
// Specified by TR1 [4.6] Relationships between types
|
// Specified by TR1 [4.6] Relationships between types
|
||||||
#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3)
|
#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3)
|
||||||
|
@ -309,22 +476,22 @@ namespace internal {
|
||||||
// had called it with an argument of type From. See Alexandrescu's
|
// had called it with an argument of type From. See Alexandrescu's
|
||||||
// _Modern C++ Design_ for more details on this sort of trick.
|
// _Modern C++ Design_ for more details on this sort of trick.
|
||||||
|
|
||||||
template <typename From, typename To>
|
template<typename From, typename To>
|
||||||
struct ConvertHelper {
|
struct ConvertHelper
|
||||||
static small_ Test(To);
|
{
|
||||||
static big_ Test(...);
|
static small_ Test(To);
|
||||||
static From Create();
|
static big_ Test(...);
|
||||||
|
static From Create();
|
||||||
};
|
};
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
||||||
// Inherits from true_type if From is convertible to To, false_type otherwise.
|
// Inherits from true_type if From is convertible to To, false_type otherwise.
|
||||||
template <typename From, typename To>
|
template<typename From, typename To>
|
||||||
struct is_convertible
|
struct is_convertible
|
||||||
: integral_constant<bool,
|
: integral_constant<bool,
|
||||||
sizeof(internal::ConvertHelper<From, To>::Test(
|
sizeof(internal::ConvertHelper<From, To>::Test(internal::ConvertHelper<From, To>::Create())) ==
|
||||||
internal::ConvertHelper<From, To>::Create()))
|
sizeof(small_)>
|
||||||
== sizeof(small_)> {
|
{};
|
||||||
};
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_END_GOOGLE_NAMESPACE_
|
_END_GOOGLE_NAMESPACE_
|
||||||
|
@ -333,10 +500,10 @@ _END_GOOGLE_NAMESPACE_
|
||||||
// these types are PODs, for human use. They may be made more contentful
|
// these types are PODs, for human use. They may be made more contentful
|
||||||
// later. The typedef is just to make it legal to put a semicolon after
|
// later. The typedef is just to make it legal to put a semicolon after
|
||||||
// these macros.
|
// these macros.
|
||||||
#define DECLARE_POD(TypeName) typedef int Dummy_Type_For_DECLARE_POD
|
#define DECLARE_POD(TypeName) typedef int Dummy_Type_For_DECLARE_POD
|
||||||
#define DECLARE_NESTED_POD(TypeName) DECLARE_POD(TypeName)
|
#define DECLARE_NESTED_POD(TypeName) DECLARE_POD(TypeName)
|
||||||
#define PROPAGATE_POD_FROM_TEMPLATE_ARGUMENT(TemplateName) \
|
#define PROPAGATE_POD_FROM_TEMPLATE_ARGUMENT(TemplateName) \
|
||||||
typedef int Dummy_Type_For_PROPAGATE_POD_FROM_TEMPLATE_ARGUMENT
|
typedef int Dummy_Type_For_PROPAGATE_POD_FROM_TEMPLATE_ARGUMENT
|
||||||
#define ENFORCE_POD(TypeName) typedef int Dummy_Type_For_ENFORCE_POD
|
#define ENFORCE_POD(TypeName) typedef int Dummy_Type_For_ENFORCE_POD
|
||||||
|
|
||||||
#endif // BASE_TYPE_TRAITS_H_
|
#endif // BASE_TYPE_TRAITS_H_
|
||||||
|
|
|
@ -96,7 +96,10 @@ class MAPNIK_DECL logger : public singleton<logger, CreateStatic>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// format
|
// format
|
||||||
static std::string const& get_format() { return format_; }
|
static std::string const& get_format()
|
||||||
|
{
|
||||||
|
return format_;
|
||||||
|
}
|
||||||
|
|
||||||
static void set_format(std::string const& format)
|
static void set_format(std::string const& format)
|
||||||
{
|
{
|
||||||
|
@ -208,7 +211,10 @@ class base_log : public util::noncopyable
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
inline bool check_severity() { return Severity >= logger::get_object_severity(object_name_); }
|
inline bool check_severity()
|
||||||
|
{
|
||||||
|
return Severity >= logger::get_object_severity(object_name_);
|
||||||
|
}
|
||||||
|
|
||||||
typename output_policy::stream_buffer streambuf_;
|
typename output_policy::stream_buffer streambuf_;
|
||||||
std::string object_name_;
|
std::string object_name_;
|
||||||
|
|
|
@ -152,7 +152,10 @@ class hextree : private util::noncopyable
|
||||||
|
|
||||||
~hextree() {}
|
~hextree() {}
|
||||||
|
|
||||||
void setMaxColors(unsigned max_colors) { max_colors_ = max_colors; }
|
void setMaxColors(unsigned max_colors)
|
||||||
|
{
|
||||||
|
max_colors_ = max_colors;
|
||||||
|
}
|
||||||
|
|
||||||
void setGamma(double g)
|
void setGamma(double g)
|
||||||
{
|
{
|
||||||
|
@ -163,9 +166,15 @@ class hextree : private util::noncopyable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setTransMode(unsigned t) { trans_mode_ = t; }
|
void setTransMode(unsigned t)
|
||||||
|
{
|
||||||
|
trans_mode_ = t;
|
||||||
|
}
|
||||||
|
|
||||||
transparency_mode_t getTransMode() const { return trans_mode_; }
|
transparency_mode_t getTransMode() const
|
||||||
|
{
|
||||||
|
return trans_mode_;
|
||||||
|
}
|
||||||
|
|
||||||
// process alpha value based on trans_mode_
|
// process alpha value based on trans_mode_
|
||||||
std::uint8_t preprocessAlpha(std::uint8_t a) const
|
std::uint8_t preprocessAlpha(std::uint8_t a) const
|
||||||
|
|
|
@ -640,7 +640,10 @@ struct offset_converter
|
||||||
return cur_.cmd;
|
return cur_.cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
void push_vertex(vertex2d const& v) { vertices_.push_back(v); }
|
void push_vertex(vertex2d const& v)
|
||||||
|
{
|
||||||
|
vertices_.push_back(v);
|
||||||
|
}
|
||||||
|
|
||||||
Geometry& geom_;
|
Geometry& geom_;
|
||||||
double offset_;
|
double offset_;
|
||||||
|
|
|
@ -73,10 +73,10 @@ class linear_gradient_from_segment
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
linear_gradient_from_segment(double x1, double y1, double x2, double y2)
|
linear_gradient_from_segment(double x1, double y1, double x2, double y2)
|
||||||
: x1_(x1 * agg::gradient_subpixel_scale)
|
: x1_(x1 * static_cast<double>(agg::gradient_subpixel_scale))
|
||||||
, y1_(y1 * agg::gradient_subpixel_scale)
|
, y1_(y1 * static_cast<double>(agg::gradient_subpixel_scale))
|
||||||
, x2_(x2 * agg::gradient_subpixel_scale)
|
, x2_(x2 * static_cast<double>(agg::gradient_subpixel_scale))
|
||||||
, y2_(y2 * agg::gradient_subpixel_scale)
|
, y2_(y2 * static_cast<double>(agg::gradient_subpixel_scale))
|
||||||
{
|
{
|
||||||
double dx = x2_ - x1_;
|
double dx = x2_ - x1_;
|
||||||
double dy = y2_ - y1_;
|
double dy = y2_ - y1_;
|
||||||
|
@ -492,8 +492,14 @@ class renderer_agg : util::noncopyable
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inline VertexSource& source() const { return source_; }
|
inline VertexSource& source() const
|
||||||
inline AttributeSource const& attributes() const { return attributes_; }
|
{
|
||||||
|
return source_;
|
||||||
|
}
|
||||||
|
inline AttributeSource const& attributes() const
|
||||||
|
{
|
||||||
|
return attributes_;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -207,12 +207,12 @@ struct tag_setter
|
||||||
TIFFSetField(output_, TIFFTAG_SAMPLESPERPIXEL, 4);
|
TIFFSetField(output_, TIFFTAG_SAMPLESPERPIXEL, 4);
|
||||||
if (data.get_premultiplied())
|
if (data.get_premultiplied())
|
||||||
{
|
{
|
||||||
uint16 extras[] = {EXTRASAMPLE_ASSOCALPHA};
|
std::uint16_t extras[] = {EXTRASAMPLE_ASSOCALPHA};
|
||||||
TIFFSetField(output_, TIFFTAG_EXTRASAMPLES, 1, extras);
|
TIFFSetField(output_, TIFFTAG_EXTRASAMPLES, 1, extras);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint16 extras[] = {EXTRASAMPLE_UNASSALPHA};
|
std::uint16_t extras[] = {EXTRASAMPLE_UNASSALPHA};
|
||||||
TIFFSetField(output_, TIFFTAG_EXTRASAMPLES, 1, extras);
|
TIFFSetField(output_, TIFFTAG_EXTRASAMPLES, 1, extras);
|
||||||
}
|
}
|
||||||
if (config_.compression == COMPRESSION_DEFLATE || config_.compression == COMPRESSION_ADOBE_DEFLATE ||
|
if (config_.compression == COMPRESSION_DEFLATE || config_.compression == COMPRESSION_ADOBE_DEFLATE ||
|
||||||
|
|
|
@ -60,13 +60,25 @@ class file : public util::noncopyable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool is_open() const { return file_ ? true : false; }
|
inline bool is_open() const
|
||||||
|
{
|
||||||
|
return file_ ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
explicit operator bool() const { return this->is_open(); }
|
explicit operator bool() const
|
||||||
|
{
|
||||||
|
return this->is_open();
|
||||||
|
}
|
||||||
|
|
||||||
inline std::FILE* get() const { return file_.get(); }
|
inline std::FILE* get() const
|
||||||
|
{
|
||||||
|
return file_.get();
|
||||||
|
}
|
||||||
|
|
||||||
inline std::size_t size() const { return size_; }
|
inline std::size_t size() const
|
||||||
|
{
|
||||||
|
return size_;
|
||||||
|
}
|
||||||
|
|
||||||
inline data_type data() const
|
inline data_type data() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -77,7 +77,10 @@ class singleton
|
||||||
singleton(const singleton& rhs);
|
singleton(const singleton& rhs);
|
||||||
singleton& operator=(const singleton&);
|
singleton& operator=(const singleton&);
|
||||||
|
|
||||||
static void onDeadReference() { throw std::runtime_error("dead reference!"); }
|
static void onDeadReference()
|
||||||
|
{
|
||||||
|
throw std::runtime_error("dead reference!");
|
||||||
|
}
|
||||||
|
|
||||||
static void DestroySingleton()
|
static void DestroySingleton()
|
||||||
{
|
{
|
||||||
|
|
|
@ -89,7 +89,7 @@ if(BUILD_SHARED_PLUGINS AND WIN32)
|
||||||
file(COPY ${m_deps} DESTINATION "@MAPNIK_OUTPUT_DIR@")
|
file(COPY ${m_deps} DESTINATION "@MAPNIK_OUTPUT_DIR@")
|
||||||
]] m_copy_dlls_str @ONLY
|
]] m_copy_dlls_str @ONLY
|
||||||
)
|
)
|
||||||
file (GENERATE OUTPUT "copy_dlls_$<CONFIG>.cmake"
|
file (GENERATE OUTPUT "copy_dlls_$<CONFIG>.cmake"
|
||||||
CONTENT "${m_copy_dlls_str}"
|
CONTENT "${m_copy_dlls_str}"
|
||||||
)
|
)
|
||||||
add_custom_target(copy_plugin_dependencies ALL
|
add_custom_target(copy_plugin_dependencies ALL
|
||||||
|
|
|
@ -11,4 +11,3 @@ target_link_libraries(input-gdal ${_plugin_visibility}
|
||||||
mapnik::datasource-base
|
mapnik::datasource-base
|
||||||
${GDAL_LIBRARIES}
|
${GDAL_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -8,4 +8,3 @@ target_link_libraries(input-geobuf ${_plugin_visibility}
|
||||||
mapnik::mapnik
|
mapnik::mapnik
|
||||||
mapnik::datasource-base
|
mapnik::datasource-base
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -144,11 +144,20 @@ class ogr_layer_ptr
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string const& layer_name() const { return layer_name_; }
|
std::string const& layer_name() const
|
||||||
|
{
|
||||||
|
return layer_name_;
|
||||||
|
}
|
||||||
|
|
||||||
OGRLayer* layer() const { return layer_; }
|
OGRLayer* layer() const
|
||||||
|
{
|
||||||
|
return layer_;
|
||||||
|
}
|
||||||
|
|
||||||
bool is_valid() const { return is_valid_; }
|
bool is_valid() const
|
||||||
|
{
|
||||||
|
return is_valid_;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ target_sources(input-pgraster ${_plugin_visibility}
|
||||||
pgraster_wkb_reader.cpp
|
pgraster_wkb_reader.cpp
|
||||||
)
|
)
|
||||||
target_link_libraries(input-pgraster ${_plugin_visibility}
|
target_link_libraries(input-pgraster ${_plugin_visibility}
|
||||||
mapnik::mapnik
|
mapnik::mapnik
|
||||||
mapnik::datasource-base
|
mapnik::datasource-base
|
||||||
PostgreSQL::PostgreSQL
|
PostgreSQL::PostgreSQL
|
||||||
)
|
)
|
||||||
|
|
|
@ -6,7 +6,7 @@ target_sources(input-postgis ${_plugin_visibility}
|
||||||
postgis_featureset.cpp
|
postgis_featureset.cpp
|
||||||
)
|
)
|
||||||
target_link_libraries(input-postgis ${_plugin_visibility}
|
target_link_libraries(input-postgis ${_plugin_visibility}
|
||||||
mapnik::mapnik
|
mapnik::mapnik
|
||||||
mapnik::datasource-base
|
mapnik::datasource-base
|
||||||
PostgreSQL::PostgreSQL
|
PostgreSQL::PostgreSQL
|
||||||
)
|
)
|
||||||
|
|
|
@ -236,11 +236,20 @@ class Connection
|
||||||
return std::make_shared<ResultSet>(result);
|
return std::make_shared<ResultSet>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string client_encoding() const { return PQparameterStatus(conn_, "client_encoding"); }
|
std::string client_encoding() const
|
||||||
|
{
|
||||||
|
return PQparameterStatus(conn_, "client_encoding");
|
||||||
|
}
|
||||||
|
|
||||||
bool isOK() const { return (!closed_) && (PQstatus(conn_) != CONNECTION_BAD); }
|
bool isOK() const
|
||||||
|
{
|
||||||
|
return (!closed_) && (PQstatus(conn_) != CONNECTION_BAD);
|
||||||
|
}
|
||||||
|
|
||||||
bool isPending() const { return pending_; }
|
bool isPending() const
|
||||||
|
{
|
||||||
|
return pending_;
|
||||||
|
}
|
||||||
|
|
||||||
void close()
|
void close()
|
||||||
{
|
{
|
||||||
|
|
|
@ -171,15 +171,30 @@ class shape_file : public mapnik::util::mapped_memory_file
|
||||||
file_.read(reinterpret_cast<char*>(&envelope), sizeof(envelope));
|
file_.read(reinterpret_cast<char*>(&envelope), sizeof(envelope));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void rewind() { seek(100); }
|
inline void rewind()
|
||||||
|
{
|
||||||
|
seek(100);
|
||||||
|
}
|
||||||
|
|
||||||
inline void seek(std::streampos pos) { file_.seekg(pos, std::ios::beg); }
|
inline void seek(std::streampos pos)
|
||||||
|
{
|
||||||
|
file_.seekg(pos, std::ios::beg);
|
||||||
|
}
|
||||||
|
|
||||||
inline std::streampos pos() { return file_.tellg(); }
|
inline std::streampos pos()
|
||||||
|
{
|
||||||
|
return file_.tellg();
|
||||||
|
}
|
||||||
|
|
||||||
inline bool is_eof() { return file_.eof(); }
|
inline bool is_eof()
|
||||||
|
{
|
||||||
|
return file_.eof();
|
||||||
|
}
|
||||||
|
|
||||||
inline bool is_good() { return file_.good(); }
|
inline bool is_good()
|
||||||
|
{
|
||||||
|
return file_.good();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SHAPEFILE_HPP
|
#endif // SHAPEFILE_HPP
|
||||||
|
|
|
@ -160,7 +160,10 @@ class sqlite_connection
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlite3* operator*() { return db_; }
|
sqlite3* operator*()
|
||||||
|
{
|
||||||
|
return db_;
|
||||||
|
}
|
||||||
|
|
||||||
bool load_extension(std::string const& ext_path)
|
bool load_extension(std::string const& ext_path)
|
||||||
{
|
{
|
||||||
|
|
|
@ -65,7 +65,6 @@ if(MSVC)
|
||||||
target_compile_options(mapnik PUBLIC "/bigobj" "/wd4068" "/wd4661" "/wd4910")
|
target_compile_options(mapnik PUBLIC "/bigobj" "/wd4068" "/wd4661" "/wd4910")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
target_sources(mapnik PRIVATE
|
target_sources(mapnik PRIVATE
|
||||||
cairo_io.cpp
|
cairo_io.cpp
|
||||||
color_factory.cpp
|
color_factory.cpp
|
||||||
|
@ -132,7 +131,7 @@ target_sources(mapnik PRIVATE
|
||||||
simplify.cpp
|
simplify.cpp
|
||||||
symbolizer_enumerations.cpp
|
symbolizer_enumerations.cpp
|
||||||
symbolizer_keys.cpp
|
symbolizer_keys.cpp
|
||||||
symbolizer.cpp
|
symbolizer.cpp
|
||||||
transform_expression_grammar_x3.cpp
|
transform_expression_grammar_x3.cpp
|
||||||
transform_expression.cpp
|
transform_expression.cpp
|
||||||
twkb.cpp
|
twkb.cpp
|
||||||
|
@ -145,7 +144,7 @@ target_sources(mapnik PRIVATE
|
||||||
wkb.cpp
|
wkb.cpp
|
||||||
xml_tree.cpp
|
xml_tree.cpp
|
||||||
)
|
)
|
||||||
target_sources(mapnik PRIVATE
|
target_sources(mapnik PRIVATE
|
||||||
../deps/agg/src/agg_arc.cpp
|
../deps/agg/src/agg_arc.cpp
|
||||||
../deps/agg/src/agg_arrowhead.cpp
|
../deps/agg/src/agg_arrowhead.cpp
|
||||||
../deps/agg/src/agg_bezier_arc.cpp
|
../deps/agg/src/agg_bezier_arc.cpp
|
||||||
|
@ -189,7 +188,7 @@ target_sources(mapnik PRIVATE
|
||||||
agg/process_text_symbolizer.cpp
|
agg/process_text_symbolizer.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_sources(mapnik PRIVATE
|
target_sources(mapnik PRIVATE
|
||||||
css/css_color_grammar_x3.cpp
|
css/css_color_grammar_x3.cpp
|
||||||
css/css_grammar_x3.cpp
|
css/css_grammar_x3.cpp
|
||||||
)
|
)
|
||||||
|
@ -247,12 +246,12 @@ target_sources(mapnik PRIVATE
|
||||||
text/formatting/list.cpp
|
text/formatting/list.cpp
|
||||||
text/formatting/registry.cpp
|
text/formatting/registry.cpp
|
||||||
text/formatting/text.cpp
|
text/formatting/text.cpp
|
||||||
|
|
||||||
text/placements/base.cpp
|
text/placements/base.cpp
|
||||||
text/placements/dummy.cpp
|
text/placements/dummy.cpp
|
||||||
text/placements/list.cpp
|
text/placements/list.cpp
|
||||||
text/placements/registry.cpp
|
text/placements/registry.cpp
|
||||||
text/placements/simple.cpp
|
text/placements/simple.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_sources(mapnik PRIVATE
|
target_sources(mapnik PRIVATE
|
||||||
|
@ -302,7 +301,7 @@ endif()
|
||||||
if(USE_GRID_RENDERER)
|
if(USE_GRID_RENDERER)
|
||||||
target_sources(mapnik PRIVATE
|
target_sources(mapnik PRIVATE
|
||||||
grid/grid_renderer.cpp
|
grid/grid_renderer.cpp
|
||||||
grid/grid.cpp
|
grid/grid.cpp
|
||||||
grid/process_building_symbolizer.cpp
|
grid/process_building_symbolizer.cpp
|
||||||
grid/process_group_symbolizer.cpp
|
grid/process_group_symbolizer.cpp
|
||||||
grid/process_line_pattern_symbolizer.cpp
|
grid/process_line_pattern_symbolizer.cpp
|
||||||
|
|
|
@ -17,19 +17,19 @@ target_sources(json PRIVATE
|
||||||
target_include_directories(json PRIVATE
|
target_include_directories(json PRIVATE
|
||||||
${JPEG_INCLUDE_DIR}
|
${JPEG_INCLUDE_DIR}
|
||||||
${LIBXML2_INCLUDE_DIR}
|
${LIBXML2_INCLUDE_DIR}
|
||||||
${MAPBOX_POLYLABEL_INCLUDE_DIRS}
|
${MAPBOX_POLYLABEL_INCLUDE_DIRS}
|
||||||
${MAPBOX_GEOMETRY_INCLUDE_DIRS}
|
${MAPBOX_GEOMETRY_INCLUDE_DIRS}
|
||||||
${MAPBOX_VARIANT_INCLUDE_DIRS}
|
${MAPBOX_VARIANT_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
target_link_libraries(json PRIVATE mapnik::core ${ICUU_LIB})
|
target_link_libraries(json PRIVATE mapnik::core ${ICUU_LIB})
|
||||||
|
|
||||||
set_target_properties(json PROPERTIES
|
set_target_properties(json PROPERTIES
|
||||||
POSITION_INDEPENDENT_CODE ON
|
POSITION_INDEPENDENT_CODE ON
|
||||||
DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}"
|
DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}"
|
||||||
OUTPUT_NAME "mapnikjson"
|
OUTPUT_NAME "mapnikjson"
|
||||||
PREFIX "lib"
|
PREFIX "lib"
|
||||||
IMPORT_PREFIX "lib"
|
IMPORT_PREFIX "lib"
|
||||||
VERSION ${MAPNIK_VERSION}
|
VERSION ${MAPNIK_VERSION}
|
||||||
# see mapnik target for explanation
|
# see mapnik target for explanation
|
||||||
SOVERSION ${MAPNIK_VERSION}
|
SOVERSION ${MAPNIK_VERSION}
|
||||||
LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||||
|
|
|
@ -128,23 +128,25 @@ proj_transform::proj_transform(projection const& source, projection const& dest)
|
||||||
transform_ = proj_create_crs_to_crs(ctx_, source.params().c_str(), dest.params().c_str(), nullptr);
|
transform_ = proj_create_crs_to_crs(ctx_, source.params().c_str(), dest.params().c_str(), nullptr);
|
||||||
if (transform_ == nullptr)
|
if (transform_ == nullptr)
|
||||||
{
|
{
|
||||||
throw std::runtime_error(std::string("Cannot initialize proj_transform (crs_to_crs) for given projections: '") +
|
throw std::runtime_error(
|
||||||
source.params() + "'->'" + dest.params() +
|
std::string("Cannot initialize proj_transform (crs_to_crs) for given projections: '") +
|
||||||
|
source.params() + "'->'" + dest.params() +
|
||||||
#if MAPNIK_PROJ_VERSION >= 80000
|
#if MAPNIK_PROJ_VERSION >= 80000
|
||||||
"' because of " + std::string(proj_context_errno_string(ctx_, proj_context_errno(ctx_))));
|
"' because of " + std::string(proj_context_errno_string(ctx_, proj_context_errno(ctx_))));
|
||||||
#else
|
#else
|
||||||
"'");
|
"'");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
PJ* transform_gis = proj_normalize_for_visualization(ctx_, transform_);
|
PJ* transform_gis = proj_normalize_for_visualization(ctx_, transform_);
|
||||||
if (transform_gis == nullptr)
|
if (transform_gis == nullptr)
|
||||||
{
|
{
|
||||||
throw std::runtime_error(std::string("Cannot initialize proj_transform (normalize) for given projections: '") +
|
throw std::runtime_error(
|
||||||
source.params() + "'->'" + dest.params() +
|
std::string("Cannot initialize proj_transform (normalize) for given projections: '") +
|
||||||
|
source.params() + "'->'" + dest.params() +
|
||||||
#if MAPNIK_PROJ_VERSION >= 80000
|
#if MAPNIK_PROJ_VERSION >= 80000
|
||||||
"' because of " + std::string(proj_context_errno_string(ctx_, proj_context_errno(ctx_))));
|
"' because of " + std::string(proj_context_errno_string(ctx_, proj_context_errno(ctx_))));
|
||||||
#else
|
#else
|
||||||
"'");
|
"'");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
proj_destroy(transform_);
|
proj_destroy(transform_);
|
||||||
|
|
|
@ -96,19 +96,49 @@ class tiff_reader : public image_reader
|
||||||
unsigned width() const final;
|
unsigned width() const final;
|
||||||
unsigned height() const final;
|
unsigned height() const final;
|
||||||
boost::optional<box2d<double>> bounding_box() const final;
|
boost::optional<box2d<double>> bounding_box() const final;
|
||||||
inline bool has_alpha() const final { return has_alpha_; }
|
inline bool has_alpha() const final
|
||||||
|
{
|
||||||
|
return has_alpha_;
|
||||||
|
}
|
||||||
void read(unsigned x, unsigned y, image_rgba8& image) final;
|
void read(unsigned x, unsigned y, image_rgba8& image) final;
|
||||||
image_any read(unsigned x, unsigned y, unsigned width, unsigned height) final;
|
image_any read(unsigned x, unsigned y, unsigned width, unsigned height) final;
|
||||||
// methods specific to tiff reader
|
// methods specific to tiff reader
|
||||||
unsigned bits_per_sample() const { return bps_; }
|
unsigned bits_per_sample() const
|
||||||
unsigned sample_format() const { return sample_format_; }
|
{
|
||||||
unsigned photometric() const { return photometric_; }
|
return bps_;
|
||||||
bool is_tiled() const { return is_tiled_; }
|
}
|
||||||
unsigned tile_width() const { return tile_width_; }
|
unsigned sample_format() const
|
||||||
unsigned tile_height() const { return tile_height_; }
|
{
|
||||||
unsigned rows_per_strip() const { return rows_per_strip_; }
|
return sample_format_;
|
||||||
unsigned planar_config() const { return planar_config_; }
|
}
|
||||||
unsigned compression() const { return compression_; }
|
unsigned photometric() const
|
||||||
|
{
|
||||||
|
return photometric_;
|
||||||
|
}
|
||||||
|
bool is_tiled() const
|
||||||
|
{
|
||||||
|
return is_tiled_;
|
||||||
|
}
|
||||||
|
unsigned tile_width() const
|
||||||
|
{
|
||||||
|
return tile_width_;
|
||||||
|
}
|
||||||
|
unsigned tile_height() const
|
||||||
|
{
|
||||||
|
return tile_height_;
|
||||||
|
}
|
||||||
|
unsigned rows_per_strip() const
|
||||||
|
{
|
||||||
|
return rows_per_strip_;
|
||||||
|
}
|
||||||
|
unsigned planar_config() const
|
||||||
|
{
|
||||||
|
return planar_config_;
|
||||||
|
}
|
||||||
|
unsigned compression() const
|
||||||
|
{
|
||||||
|
return compression_;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
tiff_reader(const tiff_reader&);
|
tiff_reader(const tiff_reader&);
|
||||||
|
@ -253,8 +283,8 @@ void tiff_reader<T>::init()
|
||||||
read_method_ = stripped;
|
read_method_ = stripped;
|
||||||
}
|
}
|
||||||
// TIFFTAG_EXTRASAMPLES
|
// TIFFTAG_EXTRASAMPLES
|
||||||
uint16 extrasamples = 0;
|
std::uint16_t extrasamples = 0;
|
||||||
uint16* sampleinfo = nullptr;
|
std::uint16_t* sampleinfo = nullptr;
|
||||||
if (TIFFGetField(tif, TIFFTAG_EXTRASAMPLES, &extrasamples, &sampleinfo))
|
if (TIFFGetField(tif, TIFFTAG_EXTRASAMPLES, &extrasamples, &sampleinfo))
|
||||||
{
|
{
|
||||||
has_alpha_ = true;
|
has_alpha_ = true;
|
||||||
|
@ -265,7 +295,7 @@ void tiff_reader<T>::init()
|
||||||
}
|
}
|
||||||
// Try extracting bounding box from geoTIFF tags
|
// Try extracting bounding box from geoTIFF tags
|
||||||
{
|
{
|
||||||
uint16 count = 0;
|
std::uint16_t count = 0;
|
||||||
double* pixelscale;
|
double* pixelscale;
|
||||||
double* tilepoint;
|
double* tilepoint;
|
||||||
if (TIFFGetField(tif, 33550, &count, &pixelscale) == 1 && count == 3 &&
|
if (TIFFGetField(tif, 33550, &count, &pixelscale) == 1 && count == 3 &&
|
||||||
|
|
|
@ -9,19 +9,19 @@ target_include_directories(wkt PRIVATE
|
||||||
${MAPNIK_INCLUDE_PATH}
|
${MAPNIK_INCLUDE_PATH}
|
||||||
${JPEG_INCLUDE_DIR}
|
${JPEG_INCLUDE_DIR}
|
||||||
${LIBXML2_INCLUDE_DIR}
|
${LIBXML2_INCLUDE_DIR}
|
||||||
${MAPBOX_POLYLABEL_INCLUDE_DIRS}
|
${MAPBOX_POLYLABEL_INCLUDE_DIRS}
|
||||||
${MAPBOX_GEOMETRY_INCLUDE_DIRS}
|
${MAPBOX_GEOMETRY_INCLUDE_DIRS}
|
||||||
${MAPBOX_VARIANT_INCLUDE_DIRS}
|
${MAPBOX_VARIANT_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
target_link_libraries(wkt PRIVATE mapnik::core)
|
target_link_libraries(wkt PRIVATE mapnik::core)
|
||||||
|
|
||||||
set_target_properties(wkt PROPERTIES
|
set_target_properties(wkt PROPERTIES
|
||||||
POSITION_INDEPENDENT_CODE ON
|
POSITION_INDEPENDENT_CODE ON
|
||||||
DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}"
|
DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}"
|
||||||
OUTPUT_NAME "mapnikwkt"
|
OUTPUT_NAME "mapnikwkt"
|
||||||
PREFIX "lib"
|
PREFIX "lib"
|
||||||
IMPORT_PREFIX "lib"
|
IMPORT_PREFIX "lib"
|
||||||
VERSION ${MAPNIK_VERSION}
|
VERSION ${MAPNIK_VERSION}
|
||||||
# see mapnik target for explanation
|
# see mapnik target for explanation
|
||||||
SOVERSION ${MAPNIK_VERSION}
|
SOVERSION ${MAPNIK_VERSION}
|
||||||
LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||||
|
|
|
@ -9,7 +9,7 @@ FetchContent_Declare(
|
||||||
GIT_TAG v2.13.7)
|
GIT_TAG v2.13.7)
|
||||||
FetchContent_MakeAvailable(Catch2)
|
FetchContent_MakeAvailable(Catch2)
|
||||||
|
|
||||||
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.19.0")
|
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.19.0")
|
||||||
# for cmake 3.19+ https://cmake.org/cmake/help/git-stage/policy/CMP0110.html
|
# for cmake 3.19+ https://cmake.org/cmake/help/git-stage/policy/CMP0110.html
|
||||||
# might not be needed if catch updates its cmakes
|
# might not be needed if catch updates its cmakes
|
||||||
cmake_policy(SET CMP0110 OLD)
|
cmake_policy(SET CMP0110 OLD)
|
||||||
|
@ -17,7 +17,7 @@ endif()
|
||||||
|
|
||||||
add_subdirectory(visual)
|
add_subdirectory(visual)
|
||||||
|
|
||||||
add_executable(mapnik-test-unit
|
add_executable(mapnik-test-unit
|
||||||
unit/run.cpp
|
unit/run.cpp
|
||||||
unit/color/css_color.cpp
|
unit/color/css_color.cpp
|
||||||
unit/core/box2d_test.cpp
|
unit/core/box2d_test.cpp
|
||||||
|
@ -100,14 +100,14 @@ add_executable(mapnik-test-unit
|
||||||
unit/vertex_adapter/transform_path_adapter.cpp
|
unit/vertex_adapter/transform_path_adapter.cpp
|
||||||
unit/vertex_adapter/vertex_adapter.cpp
|
unit/vertex_adapter/vertex_adapter.cpp
|
||||||
)
|
)
|
||||||
set_target_properties(mapnik-test-unit PROPERTIES
|
set_target_properties(mapnik-test-unit PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||||
ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib"
|
ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib"
|
||||||
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${BUILD_SHARED_CRT}>:DLL>"
|
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${BUILD_SHARED_CRT}>:DLL>"
|
||||||
)
|
)
|
||||||
target_link_libraries(mapnik-test-unit PUBLIC
|
target_link_libraries(mapnik-test-unit PUBLIC
|
||||||
Catch2::Catch2
|
Catch2::Catch2
|
||||||
mapnik::agg
|
mapnik::agg
|
||||||
mapnik::mapnik
|
mapnik::mapnik
|
||||||
mapnik::json
|
mapnik::json
|
||||||
|
@ -120,22 +120,22 @@ file(COPY cleanup.hpp DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
target_include_directories(mapnik-test-unit PRIVATE "${Catch2_SOURCE_DIR}/single_include/catch2" "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
|
target_include_directories(mapnik-test-unit PRIVATE "${Catch2_SOURCE_DIR}/single_include/catch2" "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
|
|
||||||
add_executable(agg_rasterizer_integer_overflow_test standalone/agg_rasterizer_integer_overflow_test.cpp)
|
add_executable(agg_rasterizer_integer_overflow_test standalone/agg_rasterizer_integer_overflow_test.cpp)
|
||||||
set_target_properties(agg_rasterizer_integer_overflow_test PROPERTIES
|
set_target_properties(agg_rasterizer_integer_overflow_test PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||||
ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib"
|
ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib"
|
||||||
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${BUILD_SHARED_CRT}>:DLL>"
|
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${BUILD_SHARED_CRT}>:DLL>"
|
||||||
)
|
)
|
||||||
target_link_libraries(agg_rasterizer_integer_overflow_test PUBLIC
|
target_link_libraries(agg_rasterizer_integer_overflow_test PUBLIC
|
||||||
Catch2::Catch2
|
Catch2::Catch2
|
||||||
mapnik::mapnik
|
mapnik::mapnik
|
||||||
mapnik::agg
|
mapnik::agg
|
||||||
mapnik::json
|
mapnik::json
|
||||||
)
|
)
|
||||||
target_include_directories(agg_rasterizer_integer_overflow_test PRIVATE "${Catch2_SOURCE_DIR}/single_include/catch2" "${CMAKE_CURRENT_BINARY_DIR}")
|
target_include_directories(agg_rasterizer_integer_overflow_test PRIVATE "${Catch2_SOURCE_DIR}/single_include/catch2" "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
|
||||||
add_executable(datasource_registration_test standalone/datasource_registration_test.cpp)
|
add_executable(datasource_registration_test standalone/datasource_registration_test.cpp)
|
||||||
set_target_properties(datasource_registration_test PROPERTIES
|
set_target_properties(datasource_registration_test PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||||
ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib"
|
ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib"
|
||||||
|
@ -143,36 +143,36 @@ set_target_properties(datasource_registration_test PROPERTIES
|
||||||
)
|
)
|
||||||
target_link_libraries(datasource_registration_test PUBLIC
|
target_link_libraries(datasource_registration_test PUBLIC
|
||||||
Catch2::Catch2
|
Catch2::Catch2
|
||||||
mapnik::mapnik
|
mapnik::mapnik
|
||||||
mapnik::agg
|
mapnik::agg
|
||||||
)
|
)
|
||||||
target_include_directories(datasource_registration_test PRIVATE "${Catch2_SOURCE_DIR}/single_include/catch2" "${CMAKE_CURRENT_BINARY_DIR}")
|
target_include_directories(datasource_registration_test PRIVATE "${Catch2_SOURCE_DIR}/single_include/catch2" "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
|
||||||
add_executable(font_registration_test standalone/font_registration_test.cpp)
|
add_executable(font_registration_test standalone/font_registration_test.cpp)
|
||||||
set_target_properties(font_registration_test PROPERTIES
|
set_target_properties(font_registration_test PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||||
ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib"
|
ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib"
|
||||||
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${BUILD_SHARED_CRT}>:DLL>"
|
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${BUILD_SHARED_CRT}>:DLL>"
|
||||||
)
|
)
|
||||||
target_link_libraries(font_registration_test PUBLIC
|
target_link_libraries(font_registration_test PUBLIC
|
||||||
Catch2::Catch2
|
Catch2::Catch2
|
||||||
mapnik::mapnik
|
mapnik::mapnik
|
||||||
mapnik::agg
|
mapnik::agg
|
||||||
mapnik::json
|
mapnik::json
|
||||||
)
|
)
|
||||||
target_include_directories(font_registration_test PRIVATE "${Catch2_SOURCE_DIR}/single_include/catch2" "${CMAKE_CURRENT_BINARY_DIR}")
|
target_include_directories(font_registration_test PRIVATE "${Catch2_SOURCE_DIR}/single_include/catch2" "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
|
||||||
add_executable(map_xml_test standalone/map_xml_test.cpp)
|
add_executable(map_xml_test standalone/map_xml_test.cpp)
|
||||||
set_target_properties(map_xml_test PROPERTIES
|
set_target_properties(map_xml_test PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||||
ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib"
|
ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib"
|
||||||
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${BUILD_SHARED_CRT}>:DLL>"
|
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${BUILD_SHARED_CRT}>:DLL>"
|
||||||
)
|
)
|
||||||
target_link_libraries(map_xml_test PUBLIC
|
target_link_libraries(map_xml_test PUBLIC
|
||||||
Catch2::Catch2
|
Catch2::Catch2
|
||||||
mapnik::mapnik
|
mapnik::mapnik
|
||||||
mapnik::agg
|
mapnik::agg
|
||||||
mapnik::json
|
mapnik::json
|
||||||
)
|
)
|
||||||
|
@ -194,8 +194,8 @@ endif()
|
||||||
|
|
||||||
catch_discover_tests(mapnik-test-unit
|
catch_discover_tests(mapnik-test-unit
|
||||||
WORKING_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
WORKING_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
ENVIRONMENT
|
ENVIRONMENT
|
||||||
"PATH=${m_test_path}"
|
"PATH=${m_test_path}"
|
||||||
)
|
)
|
||||||
catch_discover_tests(agg_rasterizer_integer_overflow_test WORKING_DIRECTORY "${MAPNIK_OUTPUT_DIR}")
|
catch_discover_tests(agg_rasterizer_integer_overflow_test WORKING_DIRECTORY "${MAPNIK_OUTPUT_DIR}")
|
||||||
|
|
27624
test/catch.hpp
27624
test/catch.hpp
File diff suppressed because it is too large
Load diff
|
@ -3,20 +3,21 @@
|
||||||
|
|
||||||
#include "catch.hpp"
|
#include "catch.hpp"
|
||||||
|
|
||||||
#define TRY_CHECK( expr ) \
|
#define TRY_CHECK(expr) \
|
||||||
try { \
|
try \
|
||||||
CHECK( expr ); \
|
{ \
|
||||||
} \
|
CHECK(expr); \
|
||||||
catch ( Catch::TestFailureException & ) { \
|
} catch (Catch::TestFailureException&) \
|
||||||
/* thrown by CHECK after it catches and reports */ \
|
{ \
|
||||||
/* an exception from expr => swallow this */ \
|
/* thrown by CHECK after it catches and reports */ \
|
||||||
|
/* an exception from expr => swallow this */ \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TRY_CHECK_FALSE( expr ) \
|
#define TRY_CHECK_FALSE(expr) \
|
||||||
try { \
|
try \
|
||||||
CHECK_FALSE( expr ); \
|
{ \
|
||||||
} \
|
CHECK_FALSE(expr); \
|
||||||
catch ( Catch::TestFailureException & ) { \
|
} catch (Catch::TestFailureException&) \
|
||||||
}
|
{}
|
||||||
|
|
||||||
#endif // TEST_CATCH_EXT_HPP
|
#endif // TEST_CATCH_EXT_HPP
|
||||||
|
|
|
@ -343,7 +343,10 @@ TEST_CASE("postgis")
|
||||||
REQUIRE(ds != nullptr);
|
REQUIRE(ds != nullptr);
|
||||||
auto featureset = all_features(ds);
|
auto featureset = all_features(ds);
|
||||||
auto feature = featureset->next();
|
auto feature = featureset->next();
|
||||||
CHECKED_IF(feature != nullptr) { CHECK(feature->get("email").to_string() == "fake@mail.ru"); }
|
CHECKED_IF(feature != nullptr)
|
||||||
|
{
|
||||||
|
CHECK(feature->get("email").to_string() == "fake@mail.ru");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("Postgis interpolates !@uservar! tokens in query")
|
SECTION("Postgis interpolates !@uservar! tokens in query")
|
||||||
|
|
|
@ -381,7 +381,10 @@ TEST_CASE("image class")
|
||||||
// swap empty <-> non-empty
|
// swap empty <-> non-empty
|
||||||
CHECK_NOTHROW(im.swap(im3));
|
CHECK_NOTHROW(im.swap(im3));
|
||||||
CHECK(im3.data() == nullptr);
|
CHECK(im3.data() == nullptr);
|
||||||
CHECKED_IF(im.data() != nullptr) { CHECK(im(0, 0) == blue); }
|
CHECKED_IF(im.data() != nullptr)
|
||||||
|
{
|
||||||
|
CHECK(im(0, 0) == blue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // END TEST CASE
|
} // END TEST CASE
|
||||||
|
|
|
@ -167,9 +167,15 @@ void test_tiff_reader(std::string const& pattern)
|
||||||
|
|
||||||
TEST_CASE("tiff io")
|
TEST_CASE("tiff io")
|
||||||
{
|
{
|
||||||
SECTION("tiff-reader rgb8+rgba8") { test_tiff_reader<mapnik::image_rgba8>("tiff_rgb"); }
|
SECTION("tiff-reader rgb8+rgba8")
|
||||||
|
{
|
||||||
|
test_tiff_reader<mapnik::image_rgba8>("tiff_rgb");
|
||||||
|
}
|
||||||
|
|
||||||
SECTION("tiff-reader gray8") { test_tiff_reader<mapnik::image_gray8>("tiff_gray"); }
|
SECTION("tiff-reader gray8")
|
||||||
|
{
|
||||||
|
test_tiff_reader<mapnik::image_gray8>("tiff_gray");
|
||||||
|
}
|
||||||
|
|
||||||
SECTION("scan rgb8 striped")
|
SECTION("scan rgb8 striped")
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,23 +32,62 @@
|
||||||
|
|
||||||
TEST_CASE("saturated cast")
|
TEST_CASE("saturated cast")
|
||||||
{
|
{
|
||||||
SECTION("int8") { CAST_ASSERT(std::int8_t); }
|
SECTION("int8")
|
||||||
SECTION("int16") { CAST_ASSERT(std::int16_t); }
|
{
|
||||||
SECTION("int32") { CAST_ASSERT(std::int32_t); }
|
CAST_ASSERT(std::int8_t);
|
||||||
|
}
|
||||||
|
SECTION("int16")
|
||||||
|
{
|
||||||
|
CAST_ASSERT(std::int16_t);
|
||||||
|
}
|
||||||
|
SECTION("int32")
|
||||||
|
{
|
||||||
|
CAST_ASSERT(std::int32_t);
|
||||||
|
}
|
||||||
|
|
||||||
SECTION("int64") { CAST_ASSERT2(std::int64_t); }
|
SECTION("int64")
|
||||||
SECTION("intmax") { CAST_ASSERT2(std::intmax_t); }
|
{
|
||||||
SECTION("intptr") { CAST_ASSERT2(std::intptr_t); }
|
CAST_ASSERT2(std::int64_t);
|
||||||
|
}
|
||||||
|
SECTION("intmax")
|
||||||
|
{
|
||||||
|
CAST_ASSERT2(std::intmax_t);
|
||||||
|
}
|
||||||
|
SECTION("intptr")
|
||||||
|
{
|
||||||
|
CAST_ASSERT2(std::intptr_t);
|
||||||
|
}
|
||||||
|
|
||||||
SECTION("uint8") { CAST_ASSERT(std::uint8_t); }
|
SECTION("uint8")
|
||||||
SECTION("uint16") { CAST_ASSERT(std::uint16_t); }
|
{
|
||||||
SECTION("uint32") { CAST_ASSERT(std::uint32_t); }
|
CAST_ASSERT(std::uint8_t);
|
||||||
|
}
|
||||||
|
SECTION("uint16")
|
||||||
|
{
|
||||||
|
CAST_ASSERT(std::uint16_t);
|
||||||
|
}
|
||||||
|
SECTION("uint32")
|
||||||
|
{
|
||||||
|
CAST_ASSERT(std::uint32_t);
|
||||||
|
}
|
||||||
|
|
||||||
SECTION("uint64") { CAST_ASSERT3(std::uint64_t); }
|
SECTION("uint64")
|
||||||
SECTION("uintmax") { CAST_ASSERT3(std::uintmax_t); }
|
{
|
||||||
SECTION("uintptr") { CAST_ASSERT3(std::uintptr_t); }
|
CAST_ASSERT3(std::uint64_t);
|
||||||
|
}
|
||||||
|
SECTION("uintmax")
|
||||||
|
{
|
||||||
|
CAST_ASSERT3(std::uintmax_t);
|
||||||
|
}
|
||||||
|
SECTION("uintptr")
|
||||||
|
{
|
||||||
|
CAST_ASSERT3(std::uintptr_t);
|
||||||
|
}
|
||||||
|
|
||||||
SECTION("float") { CAST_ASSERT4(float); }
|
SECTION("float")
|
||||||
|
{
|
||||||
|
CAST_ASSERT4(float);
|
||||||
|
}
|
||||||
|
|
||||||
SECTION("freeform")
|
SECTION("freeform")
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
add_executable(mapnik-test-visual
|
add_executable(mapnik-test-visual
|
||||||
parse_map_sizes.cpp
|
parse_map_sizes.cpp
|
||||||
report.cpp
|
report.cpp
|
||||||
runner.cpp
|
runner.cpp
|
||||||
run.cpp
|
run.cpp
|
||||||
)
|
)
|
||||||
set_target_properties(mapnik-test-visual PROPERTIES
|
set_target_properties(mapnik-test-visual PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||||
ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib"
|
ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib"
|
||||||
|
|
|
@ -2,7 +2,7 @@ add_executable(geometry_to_wkb main.cpp)
|
||||||
|
|
||||||
target_link_libraries(geometry_to_wkb PRIVATE mapnik::mapnik)
|
target_link_libraries(geometry_to_wkb PRIVATE mapnik::mapnik)
|
||||||
|
|
||||||
set_target_properties(geometry_to_wkb PROPERTIES
|
set_target_properties(geometry_to_wkb PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||||
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${BUILD_SHARED_CRT}>:DLL>"
|
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${BUILD_SHARED_CRT}>:DLL>"
|
||||||
)
|
)
|
||||||
|
|
|
@ -13,7 +13,7 @@ target_link_libraries(mapnik-index PRIVATE
|
||||||
Boost::program_options
|
Boost::program_options
|
||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties(mapnik-index PROPERTIES
|
set_target_properties(mapnik-index PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||||
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${BUILD_SHARED_CRT}>:DLL>"
|
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${BUILD_SHARED_CRT}>:DLL>"
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,12 +2,12 @@ find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options)
|
||||||
|
|
||||||
add_executable(mapnik-render mapnik-render.cpp)
|
add_executable(mapnik-render mapnik-render.cpp)
|
||||||
|
|
||||||
target_link_libraries(mapnik-render PRIVATE
|
target_link_libraries(mapnik-render PRIVATE
|
||||||
mapnik::mapnik
|
mapnik::mapnik
|
||||||
Boost::program_options
|
Boost::program_options
|
||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties(mapnik-render PROPERTIES
|
set_target_properties(mapnik-render PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||||
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${BUILD_SHARED_CRT}>:DLL>"
|
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${BUILD_SHARED_CRT}>:DLL>"
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,7 +2,7 @@ add_executable(ogrindex ogrindex.cpp)
|
||||||
|
|
||||||
target_link_libraries(ogrindex PRIVATE mapnik::mapnik)
|
target_link_libraries(ogrindex PRIVATE mapnik::mapnik)
|
||||||
|
|
||||||
set_target_properties(ogrindex PROPERTIES
|
set_target_properties(ogrindex PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||||
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${BUILD_SHARED_CRT}>:DLL>"
|
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${BUILD_SHARED_CRT}>:DLL>"
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,20 +2,20 @@ mapnik_find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_optio
|
||||||
mapnik_find_package(SQLite3 REQUIRED)
|
mapnik_find_package(SQLite3 REQUIRED)
|
||||||
mapnik_find_package(PostgreSQL REQUIRED)
|
mapnik_find_package(PostgreSQL REQUIRED)
|
||||||
|
|
||||||
add_executable(pgsql2sqlite
|
add_executable(pgsql2sqlite
|
||||||
main.cpp
|
main.cpp
|
||||||
sqlite.cpp
|
sqlite.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(pgsql2sqlite PRIVATE ../../plugins/input/postgis)
|
target_include_directories(pgsql2sqlite PRIVATE ../../plugins/input/postgis)
|
||||||
target_link_libraries(pgsql2sqlite PRIVATE
|
target_link_libraries(pgsql2sqlite PRIVATE
|
||||||
SQLite::SQLite3
|
SQLite::SQLite3
|
||||||
PostgreSQL::PostgreSQL
|
PostgreSQL::PostgreSQL
|
||||||
Boost::program_options
|
Boost::program_options
|
||||||
mapnik::mapnik
|
mapnik::mapnik
|
||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties(pgsql2sqlite PROPERTIES
|
set_target_properties(pgsql2sqlite PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||||
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${BUILD_SHARED_CRT}>:DLL>"
|
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${BUILD_SHARED_CRT}>:DLL>"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options)
|
find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options)
|
||||||
|
|
||||||
add_executable(shapeindex
|
add_executable(shapeindex
|
||||||
shapeindex.cpp
|
shapeindex.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ target_link_libraries(shapeindex PRIVATE
|
||||||
mapnik::mapnik
|
mapnik::mapnik
|
||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties(shapeindex PROPERTIES
|
set_target_properties(shapeindex PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||||
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${BUILD_SHARED_CRT}>:DLL>"
|
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${BUILD_SHARED_CRT}>:DLL>"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options)
|
find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options)
|
||||||
|
|
||||||
add_executable(svg2png
|
add_executable(svg2png
|
||||||
svg2png.cpp
|
svg2png.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(svg2png PRIVATE
|
target_link_libraries(svg2png PRIVATE
|
||||||
Boost::program_options
|
Boost::program_options
|
||||||
mapnik::mapnik
|
mapnik::mapnik
|
||||||
mapnik::agg
|
mapnik::agg
|
||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties(svg2png PROPERTIES
|
set_target_properties(svg2png PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||||
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${BUILD_SHARED_CRT}>:DLL>"
|
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${BUILD_SHARED_CRT}>:DLL>"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue