From 4b66137654cc27f470fa818a4fc0f8fd1461b152 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Mon, 15 Nov 2021 15:32:58 +0100 Subject: [PATCH 01/38] initial docker --- .dockerignore | 3 +++ Dockerfile | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..becd9cb6b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +build +.vs +.vscode diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..34ceb8d9d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,54 @@ +FROM ubuntu:21.04 +LABEL description="mapnik" + +ARG DEBIAN_FRONTEND=noninteractive + +RUN mkdir /app +COPY . /app +WORKDIR /app + +RUN apt update +RUN apt install -y gpg wget +RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null +RUN echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null +RUN apt update +RUN apt install -y \ + cmake \ + ninja-build \ + build-essential + +ENV BUILD_DEPENDENCIES="libicu-dev \ + libfreetype6-dev \ + libharfbuzz-dev \ + libxml2-dev \ + libjpeg-dev \ + libtiff-dev \ + libwebp-dev \ + libcairo2-dev \ + libproj-dev \ + libgdal-dev \ + libboost-filesystem-dev \ + libboost-program-options-dev \ + libboost-regex-dev \ + " + +ENV RUNTIME_DEPENDENCIES="libfreetype6 \ + libharfbuzz-bin \ + libxml2 \ + libjpeg8 \ + libtiff5 \ + libwebp6 \ + libcairo2 \ + libproj19 \ + libgdal28 \ + libboost-filesystem1.74-dev \ + libboost-program-options1.74.0 \ + libboost-regex1.74.0 \ + " + +RUN apt install -y $BUILD_DEPENDENCIES $RUNTIME_DEPENDENCIES +RUN cmake --preset linux-gcc-release -DBUILD_DEMO_VIEWER=OFF -DBUILD_TESTING=OFF -DBUILD_DEMO_CPP=OFF -DBUILD_BENCHMARK=OFF +RUN cmake --build --preset linux-gcc-release +RUN cmake --build --preset linux-gcc-release --target install + +RUN apt autoremove -y --purge $BUILD_DEPENDENCIES From 500728e51ffa0ba3863b177a3a6ba2af64cbafdc Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Mon, 15 Nov 2021 16:08:27 +0100 Subject: [PATCH 02/38] test workflow --- .github/workflows/docker-image.yml | 54 ++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 000000000..2942e43fc --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,54 @@ +name: Docker Image CI + +on: + push: + branches: + - "master" + tags: + - "v*.*.*" + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + # list of Docker images to use as base name for tags + images: | + mathisloge/mapnik + ghcr.io/mathisloge/mapnik + # generate Docker tags based on the following events/attributes + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to GHCR + if: github.event_name != 'pull_request' + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From 719544833492fd42eb486276d53f652a51c04e28 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Mon, 15 Nov 2021 16:08:48 +0100 Subject: [PATCH 03/38] all branches --- .github/workflows/docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 2942e43fc..bffd99612 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -3,7 +3,7 @@ name: Docker Image CI on: push: branches: - - "master" + - "**" tags: - "v*.*.*" From c6619d042c30af6c7c9d9727fd6ae01470b4631f Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Mon, 15 Nov 2021 16:09:46 +0100 Subject: [PATCH 04/38] check out correctly --- .github/workflows/docker-image.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index bffd99612..15c12146c 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -12,8 +12,9 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 + - uses: actions/checkout@v2 + with: + submodules: "recursive" - name: Docker meta id: meta From c5d3d9c188e3503a11796cdd9e4fadbc63e01c3f Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Mon, 15 Nov 2021 16:39:10 +0100 Subject: [PATCH 05/38] wip --- .github/workflows/docker-image.yml | 2 +- Dockerfile | 18 ++---------------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 15c12146c..480044ded 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -22,7 +22,6 @@ jobs: with: # list of Docker images to use as base name for tags images: | - mathisloge/mapnik ghcr.io/mathisloge/mapnik # generate Docker tags based on the following events/attributes tags: | @@ -35,6 +34,7 @@ jobs: type=sha - name: Set up QEMU uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 diff --git a/Dockerfile b/Dockerfile index 34ceb8d9d..e4bb5ef02 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,23 +32,9 @@ ENV BUILD_DEPENDENCIES="libicu-dev \ libboost-regex-dev \ " -ENV RUNTIME_DEPENDENCIES="libfreetype6 \ - libharfbuzz-bin \ - libxml2 \ - libjpeg8 \ - libtiff5 \ - libwebp6 \ - libcairo2 \ - libproj19 \ - libgdal28 \ - libboost-filesystem1.74-dev \ - libboost-program-options1.74.0 \ - libboost-regex1.74.0 \ - " - -RUN apt install -y $BUILD_DEPENDENCIES $RUNTIME_DEPENDENCIES +RUN apt install -y $BUILD_DEPENDENCIES RUN cmake --preset linux-gcc-release -DBUILD_DEMO_VIEWER=OFF -DBUILD_TESTING=OFF -DBUILD_DEMO_CPP=OFF -DBUILD_BENCHMARK=OFF RUN cmake --build --preset linux-gcc-release RUN cmake --build --preset linux-gcc-release --target install -RUN apt autoremove -y --purge $BUILD_DEPENDENCIES +RUN rm -rf build From 92b1dbaf32aca32804c8897e380c76352ac17def Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Mon, 15 Nov 2021 16:41:37 +0100 Subject: [PATCH 06/38] delete all data --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e4bb5ef02..1d7f7d1b3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,4 +37,5 @@ RUN cmake --preset linux-gcc-release -DBUILD_DEMO_VIEWER=OFF -DBUILD_TESTING=OFF RUN cmake --build --preset linux-gcc-release RUN cmake --build --preset linux-gcc-release --target install -RUN rm -rf build +WORKDIR / +RUN rm -rf /app From 2d846dd5f339c51831a35d591309c80164ea3992 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 29 Jan 2022 12:52:23 +0100 Subject: [PATCH 07/38] static plugins wip static plugins add remaining datasources wip formatting --- CMakeLists.txt | 22 +++++++- cmake/MapnikInstall.cmake | 3 + include/mapnik/config.hpp | 20 +++++-- include/mapnik/datasource.hpp | 6 +- include/mapnik/webp_io.hpp | 22 +------- plugins/input/CMakeLists.txt | 10 +++- plugins/input/base/CMakeLists.txt | 11 ++++ .../base/include/mapnik/datasource_plugin.hpp | 42 ++++++++++++++ plugins/input/csv/CMakeLists.txt | 6 +- plugins/input/csv/csv_datasource.cpp | 5 +- plugins/input/csv/csv_datasource.hpp | 5 ++ plugins/input/gdal/CMakeLists.txt | 8 ++- plugins/input/gdal/gdal_datasource.cpp | 8 +-- plugins/input/gdal/gdal_datasource.hpp | 4 +- plugins/input/geobuf/CMakeLists.txt | 8 ++- plugins/input/geobuf/geobuf_datasource.cpp | 4 +- plugins/input/geobuf/geobuf_datasource.hpp | 2 + plugins/input/geojson/CMakeLists.txt | 6 +- plugins/input/geojson/geojson_datasource.cpp | 4 +- plugins/input/geojson/geojson_datasource.hpp | 3 + plugins/input/ogr/CMakeLists.txt | 8 ++- plugins/input/ogr/ogr_datasource.cpp | 7 +-- plugins/input/ogr/ogr_datasource.hpp | 3 + plugins/input/pgraster/CMakeLists.txt | 6 +- .../input/pgraster/pgraster_datasource.cpp | 4 +- .../input/pgraster/pgraster_datasource.hpp | 2 + plugins/input/postgis/CMakeLists.txt | 6 +- plugins/input/postgis/postgis_datasource.cpp | 4 +- plugins/input/postgis/postgis_datasource.hpp | 2 + plugins/input/raster/CMakeLists.txt | 8 ++- plugins/input/raster/raster_datasource.cpp | 4 +- plugins/input/raster/raster_datasource.hpp | 2 + plugins/input/shape/CMakeLists.txt | 8 ++- plugins/input/shape/shape_datasource.cpp | 4 +- plugins/input/shape/shape_datasource.hpp | 3 + plugins/input/sqlite/CMakeLists.txt | 7 ++- plugins/input/sqlite/sqlite_datasource.cpp | 4 +- plugins/input/sqlite/sqlite_datasource.hpp | 3 + plugins/input/topojson/CMakeLists.txt | 7 ++- .../input/topojson/topojson_datasource.cpp | 4 +- .../input/topojson/topojson_datasource.hpp | 3 + src/CMakeLists.txt | 47 ++++++++++++++-- src/datasource_cache_static.cpp | 55 +++++++++++++------ src/json/CMakeLists.txt | 3 +- src/plugin.cpp | 13 +++-- src/webp_io.cpp | 24 ++++++++ src/wkt/CMakeLists.txt | 3 +- 47 files changed, 333 insertions(+), 110 deletions(-) create mode 100644 plugins/input/base/CMakeLists.txt create mode 100644 plugins/input/base/include/mapnik/datasource_plugin.hpp create mode 100644 src/webp_io.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index f2dc1f02d..05a9ccc26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,6 +56,7 @@ mapnik_option(USE_LOG "enables logging output. See log severity level." OFF) set(USE_LOG_SEVERITY "1" CACHE STRING "sets the logging severity (only applies when USE_LOG is ON") mapnik_option(USE_STATS "Enable statistics reporting" OFF) +mapnik_option(STATIC_PLUGINS "statically link plugins into libmapnik" OFF) mapnik_option(USE_PLUGIN_INPUT_CSV "adds plugin input csv" ON) mapnik_option(USE_PLUGIN_INPUT_GDAL "adds plugin input gdal" ON) mapnik_option(USE_PLUGIN_INPUT_GEOBUF "adds plugin input geobuf" ON) @@ -344,6 +345,16 @@ if(NOT WIN32) list(APPEND MAPNIK_OPTIONAL_LIBS ${CMAKE_DL_LIBS}) endif() +if(MAPNIK_STATIC_PLUGINS) + list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_STATIC_PLUGINS) +endif() + + +# when building static, this have to be public so that all depending libs know about +if(NOT BUILD_SHARED_LIBS) + list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_STATIC_DEFINE) +endif() + # force utf-8 source code processing # see https://docs.microsoft.com/de-de/cpp/build/reference/utf-8-set-source-and-executable-character-sets-to-utf-8?view=msvc-170 add_compile_options("$<$:/utf-8>") @@ -377,9 +388,18 @@ target_compile_definitions(core INTERFACE ${MAPNIK_COMPILE_DEFS}) mapnik_install(core) +# forward declaring libraries to consume them when building static plugins (circle deps between mapnik <-> plugin_target) +add_library(mapnik "") +add_library(mapnik::mapnik ALIAS mapnik) +add_library(wkt STATIC "") +add_library(mapnik::wkt ALIAS wkt) +add_library(json STATIC "") +add_library(mapnik::json ALIAS json) +# end forward declaration + add_subdirectory(deps) -add_subdirectory(src) add_subdirectory(plugins) +add_subdirectory(src) add_subdirectory(utils) add_subdirectory(demo) if(BUILD_BENCHMARK) diff --git a/cmake/MapnikInstall.cmake b/cmake/MapnikInstall.cmake index 0953c09db..7983c75e5 100644 --- a/cmake/MapnikInstall.cmake +++ b/cmake/MapnikInstall.cmake @@ -23,6 +23,9 @@ endfunction() # Install plugins # function(mapnik_install_plugin _target) + if(MAPNIK_STATIC_PLUGINS) + return() + endif() install(TARGETS ${_target} RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} COMPONENT MapnikPluginRuntime diff --git a/include/mapnik/config.hpp b/include/mapnik/config.hpp index 99f2bae3c..fa0129dc1 100644 --- a/include/mapnik/config.hpp +++ b/include/mapnik/config.hpp @@ -26,13 +26,21 @@ // Windows DLL support #ifdef _WIN32 -# define MAPNIK_EXP __declspec (dllexport) -# define MAPNIK_IMP __declspec (dllimport) -# ifdef MAPNIK_EXPORTS -# define MAPNIK_DECL __declspec (dllexport) -# else -# define MAPNIK_DECL __declspec (dllimport) +#ifdef MAPNIK_STATIC_DEFINE +# define MAPNIK_DECL +# define MAPNIK_EXP +#else +# define MAPNIK_EXP __declspec(dllexport) +# ifndef MAPNIK_DECL +# ifdef MAPNIK_EXPORTS + /* We are building this library */ +# define MAPNIK_DECL __declspec(dllexport) +# else + /* We are using this library */ +# define MAPNIK_DECL __declspec(dllimport) +# endif # endif +#endif # pragma warning( disable: 4251 ) # pragma warning( disable: 4275 ) # if (_MSC_VER >= 1400) // vc8 diff --git a/include/mapnik/datasource.hpp b/include/mapnik/datasource.hpp index 9525c1fb7..0099ce5a4 100644 --- a/include/mapnik/datasource.hpp +++ b/include/mapnik/datasource.hpp @@ -136,15 +136,15 @@ using datasource_ptr = std::shared_ptr; #define DATASOURCE_PLUGIN(classname) #else #define DATASOURCE_PLUGIN(classname) \ - extern "C" MAPNIK_EXP const char * datasource_name() \ + extern "C" MAPNIK_DECL const char * datasource_name() \ { \ return classname::name(); \ } \ - extern "C" MAPNIK_EXP datasource* create(parameters const& params) \ + extern "C" MAPNIK_DECL datasource* create(parameters const& params) \ { \ return new classname(params); \ } \ - extern "C" MAPNIK_EXP void destroy(datasource *ds) \ + extern "C" MAPNIK_DECL void destroy(datasource *ds) \ { \ delete ds; \ } diff --git a/include/mapnik/webp_io.hpp b/include/mapnik/webp_io.hpp index 06f9d6bdc..b25312747 100644 --- a/include/mapnik/webp_io.hpp +++ b/include/mapnik/webp_io.hpp @@ -24,6 +24,7 @@ #define MAPNIK_WEBP_IO_HPP // mapnik +#include #include #include @@ -51,26 +52,7 @@ int webp_stream_write(const uint8_t* data, size_t data_size, const WebPPicture* return true; } -std::string webp_encoding_error(WebPEncodingError error) -{ - std::string os; - switch (error) - { - case VP8_ENC_ERROR_OUT_OF_MEMORY: os = "memory error allocating objects"; break; - case VP8_ENC_ERROR_BITSTREAM_OUT_OF_MEMORY: os = "memory error while flushing bits"; break; - case VP8_ENC_ERROR_NULL_PARAMETER: os = "a pointer parameter is NULL"; break; - case VP8_ENC_ERROR_INVALID_CONFIGURATION: os = "configuration is invalid"; break; - case VP8_ENC_ERROR_BAD_DIMENSION: os = "picture has invalid width/height"; break; - case VP8_ENC_ERROR_PARTITION0_OVERFLOW: os = "partition is bigger than 512k"; break; - case VP8_ENC_ERROR_PARTITION_OVERFLOW: os = "partition is bigger than 16M"; break; - case VP8_ENC_ERROR_BAD_WRITE: os = "error while flushing bytes"; break; - case VP8_ENC_ERROR_FILE_TOO_BIG: os = "file is bigger than 4G"; break; - default: - mapnik::util::to_string(os,error); - os = "unknown error (" + os + ")"; break; - } - return os; -} +std::string MAPNIK_DECL webp_encoding_error(WebPEncodingError error); template inline int import_image(T2 const& im_in, diff --git a/plugins/input/CMakeLists.txt b/plugins/input/CMakeLists.txt index 5f89249ec..2849b8766 100644 --- a/plugins/input/CMakeLists.txt +++ b/plugins/input/CMakeLists.txt @@ -1,5 +1,13 @@ set(_plugin_prefix "") set(_plugin_suffix ".input") +set(_plugin_linkage MODULE) +set(_plugin_source_visibility PRIVATE) +if(MAPNIK_STATIC_PLUGINS) + set(_plugin_linkage INTERFACE) + set(_plugin_visibility INTERFACE) +endif() + +add_subdirectory(base) # add a list with all build plugins so the copy dependencies command can wait for all build events set(m_build_plugins "") @@ -51,7 +59,7 @@ endif() # # Copy all plugin dlls, so that these are in the main output dir, since cmake copies those into ${MAPNIK_OUTPUT_DIR}/plugins/input, too. # -if(WIN32) +if(NOT MAPNIK_STATIC_PLUGINS AND WIN32) list(LENGTH m_build_plugins m_number_plugins) if(m_number_plugins GREATER 0) string(CONFIGURE diff --git a/plugins/input/base/CMakeLists.txt b/plugins/input/base/CMakeLists.txt new file mode 100644 index 000000000..1dca6a808 --- /dev/null +++ b/plugins/input/base/CMakeLists.txt @@ -0,0 +1,11 @@ +add_library(datasource-base INTERFACE) +add_library(mapnik::datasource-base ALIAS datasource-base) + + +target_include_directories(datasource-base INTERFACE + $ + $ +) +target_link_libraries(datasource-base INTERFACE mapnik::core) + +mapnik_install(datasource-base) diff --git a/plugins/input/base/include/mapnik/datasource_plugin.hpp b/plugins/input/base/include/mapnik/datasource_plugin.hpp new file mode 100644 index 000000000..dad3eb3ed --- /dev/null +++ b/plugins/input/base/include/mapnik/datasource_plugin.hpp @@ -0,0 +1,42 @@ +#ifndef DATASOURCE_PLUGIN_HPP +#define DATASOURCE_PLUGIN_HPP +#include +#include +#include + + +namespace mapnik +{ + class MAPNIK_DECL datasource_plugin + { + public: + datasource_plugin() {} + virtual ~datasource_plugin() {} + virtual void init_once() const = 0; + virtual const std::string& name() const = 0; + virtual datasource_ptr create(parameters const ¶ms) const= 0; + + }; +} + +#define DATASOURCE_PLUGIN_DEF(classname, pluginname) class classname : public mapnik::datasource_plugin {\ +public:\ + static constexpr const char* kName = #pluginname;\ + void init_once() const override;\ + const std::string& name() const override;\ + mapnik::datasource_ptr create(mapnik::parameters const ¶ms) const override;\ +}; + +#define DATASOURCE_PLUGIN_IMPL(classname, pluginclassname) const std::string& classname::name() const { return kName; } \ +mapnik::datasource_ptr classname::create(mapnik::parameters const ¶ms) const { return std::make_shared(params); } + +#define DATASOURCE_PLUGIN_EMPTY_INIT(classname) void classname::init_once() const {} + +#ifndef MAPNIK_STATIC_PLUGINS +#define DATASOURCE_PLUGIN_EXPORT(classname) extern "C" MAPNIK_EXP classname plugin; \ +classname plugin; +#else +#define DATASOURCE_PLUGIN_EXPORT(classname) // export classname +#endif + +#endif diff --git a/plugins/input/csv/CMakeLists.txt b/plugins/input/csv/CMakeLists.txt index dcc966157..b5a89f0b2 100644 --- a/plugins/input/csv/CMakeLists.txt +++ b/plugins/input/csv/CMakeLists.txt @@ -1,14 +1,16 @@ -add_library(input-csv MODULE +add_library(input-csv ${_plugin_linkage}) +target_sources(input-csv ${_plugin_visibility} csv_datasource.cpp csv_featureset.cpp csv_index_featureset.cpp csv_inline_featureset.cpp csv_utils.cpp ) -target_link_libraries(input-csv PRIVATE +target_link_libraries(input-csv ${_plugin_visibility} mapnik::mapnik mapnik::wkt mapnik::json + mapnik::datasource-base ) set_target_properties(input-csv PROPERTIES OUTPUT_NAME "csv" diff --git a/plugins/input/csv/csv_datasource.cpp b/plugins/input/csv/csv_datasource.cpp index ed6bbb12d..fe0ea76cd 100644 --- a/plugins/input/csv/csv_datasource.cpp +++ b/plugins/input/csv/csv_datasource.cpp @@ -65,7 +65,10 @@ MAPNIK_DISABLE_WARNING_POP using mapnik::datasource; using mapnik::parameters; -DATASOURCE_PLUGIN(csv_datasource) +DATASOURCE_PLUGIN_IMPL(csv_datasource_plugin, csv_datasource); +DATASOURCE_PLUGIN_EXPORT(csv_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_INIT(csv_datasource_plugin); + csv_datasource::csv_datasource(parameters const& params) : datasource(params), diff --git a/plugins/input/csv/csv_datasource.hpp b/plugins/input/csv/csv_datasource.hpp index a81d308e2..2d549640b 100644 --- a/plugins/input/csv/csv_datasource.hpp +++ b/plugins/input/csv/csv_datasource.hpp @@ -48,6 +48,8 @@ MAPNIK_DISABLE_WARNING_POP #include #include +#include + template struct csv_linear : boost::geometry::index::linear {}; @@ -70,6 +72,9 @@ struct options_type > }; }}}}} +DATASOURCE_PLUGIN_DEF(csv_datasource_plugin, csv); + + class csv_datasource : public mapnik::datasource, private csv_utils::csv_file_parser { diff --git a/plugins/input/gdal/CMakeLists.txt b/plugins/input/gdal/CMakeLists.txt index 746953a3c..2db11e1c9 100644 --- a/plugins/input/gdal/CMakeLists.txt +++ b/plugins/input/gdal/CMakeLists.txt @@ -1,12 +1,14 @@ find_package(GDAL REQUIRED) -add_library(input-gdal MODULE +add_library(input-gdal ${_plugin_linkage}) +target_sources(input-gdal ${_plugin_visibility} gdal_datasource.cpp gdal_featureset.cpp ) -target_include_directories(input-gdal PRIVATE ${GDAL_INCLUDE_DIRS}) -target_link_libraries(input-gdal PRIVATE +target_include_directories(input-gdal ${_plugin_visibility} ${GDAL_INCLUDE_DIRS}) +target_link_libraries(input-gdal ${_plugin_visibility} mapnik::mapnik + mapnik::datasource-base ${GDAL_LIBRARIES} ) set_target_properties(input-gdal PROPERTIES diff --git a/plugins/input/gdal/gdal_datasource.cpp b/plugins/input/gdal/gdal_datasource.cpp index ccb3da029..ac2a7a809 100644 --- a/plugins/input/gdal/gdal_datasource.cpp +++ b/plugins/input/gdal/gdal_datasource.cpp @@ -37,8 +37,6 @@ using mapnik::datasource; using mapnik::parameters; -DATASOURCE_PLUGIN(gdal_datasource) - using mapnik::box2d; using mapnik::coord2d; using mapnik::query; @@ -48,9 +46,9 @@ using mapnik::datasource_exception; static std::once_flag once_flag; -extern "C" MAPNIK_EXP void on_plugin_load() -{ - // initialize gdal formats +DATASOURCE_PLUGIN_IMPL(gdal_datasource_plugin, gdal_datasource); +DATASOURCE_PLUGIN_EXPORT(gdal_datasource_plugin); +void gdal_datasource_plugin::init_once() const { std::call_once(once_flag,[](){ GDALAllRegister(); }); diff --git a/plugins/input/gdal/gdal_datasource.hpp b/plugins/input/gdal/gdal_datasource.hpp index 27e3a2104..ddd363900 100644 --- a/plugins/input/gdal/gdal_datasource.hpp +++ b/plugins/input/gdal/gdal_datasource.hpp @@ -31,7 +31,7 @@ #include #include #include - +#include // boost #include @@ -42,6 +42,8 @@ // gdal #include +DATASOURCE_PLUGIN_DEF(gdal_datasource_plugin, gdal); + class gdal_datasource : public mapnik::datasource { public: diff --git a/plugins/input/geobuf/CMakeLists.txt b/plugins/input/geobuf/CMakeLists.txt index 870b603d9..57447fbed 100644 --- a/plugins/input/geobuf/CMakeLists.txt +++ b/plugins/input/geobuf/CMakeLists.txt @@ -1,8 +1,12 @@ -add_library(input-geobuf MODULE +add_library(input-geobuf ${_plugin_linkage}) +target_sources(input-geobuf ${_plugin_visibility} geobuf_datasource.cpp geobuf_featureset.cpp ) -target_link_libraries(input-geobuf PRIVATE mapnik::mapnik) +target_link_libraries(input-geobuf ${_plugin_visibility} + mapnik::mapnik + mapnik::datasource-base +) set_target_properties(input-geobuf PROPERTIES OUTPUT_NAME "geobuf" PREFIX "${_plugin_prefix}" diff --git a/plugins/input/geobuf/geobuf_datasource.cpp b/plugins/input/geobuf/geobuf_datasource.cpp index 3dbdc93fc..7992dccda 100644 --- a/plugins/input/geobuf/geobuf_datasource.cpp +++ b/plugins/input/geobuf/geobuf_datasource.cpp @@ -48,7 +48,9 @@ using mapnik::datasource; using mapnik::parameters; -DATASOURCE_PLUGIN(geobuf_datasource) +DATASOURCE_PLUGIN_IMPL(geobuf_datasource_plugin, geobuf_datasource); +DATASOURCE_PLUGIN_EXPORT(geobuf_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_INIT(geobuf_datasource_plugin); struct attr_value_converter { diff --git a/plugins/input/geobuf/geobuf_datasource.hpp b/plugins/input/geobuf/geobuf_datasource.hpp index 16dc048f0..e30202555 100644 --- a/plugins/input/geobuf/geobuf_datasource.hpp +++ b/plugins/input/geobuf/geobuf_datasource.hpp @@ -32,6 +32,7 @@ #include #include #include +#include // boost #include #include @@ -75,6 +76,7 @@ struct options_type > }}}}} +DATASOURCE_PLUGIN_DEF(geobuf_datasource_plugin, geobuf); class geobuf_datasource : public mapnik::datasource { public: diff --git a/plugins/input/geojson/CMakeLists.txt b/plugins/input/geojson/CMakeLists.txt index e32dcfcb1..967f47820 100644 --- a/plugins/input/geojson/CMakeLists.txt +++ b/plugins/input/geojson/CMakeLists.txt @@ -1,12 +1,14 @@ -add_library(input-geojson MODULE +add_library(input-geojson ${_plugin_linkage}) +target_sources(input-geojson ${_plugin_visibility} geojson_datasource.cpp geojson_featureset.cpp geojson_index_featureset.cpp geojson_memory_index_featureset.cpp ) -target_link_libraries(input-geojson PRIVATE +target_link_libraries(input-geojson ${_plugin_visibility} mapnik::mapnik mapnik::json + mapnik::datasource-base ) set_target_properties(input-geojson PROPERTIES OUTPUT_NAME "geojson" diff --git a/plugins/input/geojson/geojson_datasource.cpp b/plugins/input/geojson/geojson_datasource.cpp index 62952e9ce..dce61d0d3 100644 --- a/plugins/input/geojson/geojson_datasource.cpp +++ b/plugins/input/geojson/geojson_datasource.cpp @@ -67,7 +67,9 @@ MAPNIK_DISABLE_WARNING_POP using mapnik::datasource; using mapnik::parameters; -DATASOURCE_PLUGIN(geojson_datasource) +DATASOURCE_PLUGIN_IMPL(geojson_datasource_plugin, geojson_datasource); +DATASOURCE_PLUGIN_EXPORT(geojson_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_INIT(geojson_datasource_plugin); struct attr_value_converter { diff --git a/plugins/input/geojson/geojson_datasource.hpp b/plugins/input/geojson/geojson_datasource.hpp index 4bb965f3c..2c1f11562 100644 --- a/plugins/input/geojson/geojson_datasource.hpp +++ b/plugins/input/geojson/geojson_datasource.hpp @@ -32,6 +32,7 @@ #include #include #include +#include #include MAPNIK_DISABLE_WARNING_PUSH @@ -73,6 +74,8 @@ struct options_type > }}}}} +DATASOURCE_PLUGIN_DEF(geojson_datasource_plugin, geojson); + class geojson_datasource : public mapnik::datasource { public: diff --git a/plugins/input/ogr/CMakeLists.txt b/plugins/input/ogr/CMakeLists.txt index f460eb033..f6e562181 100644 --- a/plugins/input/ogr/CMakeLists.txt +++ b/plugins/input/ogr/CMakeLists.txt @@ -1,14 +1,16 @@ find_package(GDAL REQUIRED) -add_library(input-ogr MODULE +add_library(input-ogr ${_plugin_linkage}) +target_sources(input-ogr ${_plugin_visibility} ogr_converter.cpp ogr_datasource.cpp ogr_featureset.cpp ogr_index_featureset.cpp ) -target_include_directories(input-ogr PRIVATE ${GDAL_INCLUDE_DIRS}) -target_link_libraries(input-ogr PRIVATE +target_include_directories(input-ogr ${_plugin_visibility} ${GDAL_INCLUDE_DIRS}) +target_link_libraries(input-ogr ${_plugin_visibility} mapnik::mapnik + mapnik::datasource-base ${GDAL_LIBRARIES} ) set_target_properties(input-ogr PROPERTIES diff --git a/plugins/input/ogr/ogr_datasource.cpp b/plugins/input/ogr/ogr_datasource.cpp index bf2652690..ed87a107e 100644 --- a/plugins/input/ogr/ogr_datasource.cpp +++ b/plugins/input/ogr/ogr_datasource.cpp @@ -49,8 +49,6 @@ MAPNIK_DISABLE_WARNING_POP using mapnik::datasource; using mapnik::parameters; -DATASOURCE_PLUGIN(ogr_datasource) - using mapnik::box2d; using mapnik::coord2d; using mapnik::query; @@ -63,8 +61,9 @@ using mapnik::filter_at_point; static std::once_flag once_flag; -extern "C" MAPNIK_EXP void on_plugin_load() -{ +DATASOURCE_PLUGIN_IMPL(ogr_datasource_plugin, ogr_datasource); +DATASOURCE_PLUGIN_EXPORT(ogr_datasource_plugin); +void ogr_datasource_plugin::init_once() const { // initialize ogr formats // NOTE: in GDAL >= 2.0 this is the same as GDALAllRegister() std::call_once(once_flag,[](){ diff --git a/plugins/input/ogr/ogr_datasource.hpp b/plugins/input/ogr/ogr_datasource.hpp index 4523b0134..4ffdfc0e9 100644 --- a/plugins/input/ogr/ogr_datasource.hpp +++ b/plugins/input/ogr/ogr_datasource.hpp @@ -31,6 +31,7 @@ #include #include #include +#include // boost #include @@ -47,6 +48,8 @@ MAPNIK_DISABLE_WARNING_PUSH MAPNIK_DISABLE_WARNING_POP #include "ogr_layer_ptr.hpp" +DATASOURCE_PLUGIN_DEF(ogr_datasource_plugin, ogr); + class ogr_datasource : public mapnik::datasource { public: diff --git a/plugins/input/pgraster/CMakeLists.txt b/plugins/input/pgraster/CMakeLists.txt index f7ac4ff66..4a570502d 100644 --- a/plugins/input/pgraster/CMakeLists.txt +++ b/plugins/input/pgraster/CMakeLists.txt @@ -1,12 +1,14 @@ find_package(PostgreSQL REQUIRED) -add_library(input-pgraster MODULE +add_library(input-pgraster ${_plugin_linkage}) +target_sources(input-pgraster ${_plugin_visibility} pgraster_datasource.cpp pgraster_featureset.cpp pgraster_wkb_reader.cpp ) -target_link_libraries(input-pgraster PRIVATE +target_link_libraries(input-pgraster ${_plugin_visibility} mapnik::mapnik + mapnik::datasource-base PostgreSQL::PostgreSQL ) set_target_properties(input-pgraster PROPERTIES diff --git a/plugins/input/pgraster/pgraster_datasource.cpp b/plugins/input/pgraster/pgraster_datasource.cpp index 545f80c5a..ce841deeb 100644 --- a/plugins/input/pgraster/pgraster_datasource.cpp +++ b/plugins/input/pgraster/pgraster_datasource.cpp @@ -51,7 +51,9 @@ MAPNIK_DISABLE_WARNING_POP #include #include -DATASOURCE_PLUGIN(pgraster_datasource) +DATASOURCE_PLUGIN_IMPL(pgraster_datasource_plugin, pgraster_datasource); +DATASOURCE_PLUGIN_EXPORT(pgraster_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_INIT(pgraster_datasource_plugin); const std::string pgraster_datasource::RASTER_COLUMNS = "raster_columns"; const std::string pgraster_datasource::RASTER_OVERVIEWS = "raster_overviews"; diff --git a/plugins/input/pgraster/pgraster_datasource.hpp b/plugins/input/pgraster/pgraster_datasource.hpp index 7f74bbbcf..87f858814 100644 --- a/plugins/input/pgraster/pgraster_datasource.hpp +++ b/plugins/input/pgraster/pgraster_datasource.hpp @@ -37,6 +37,7 @@ #include #include #include +#include // boost #include @@ -74,6 +75,7 @@ struct pgraster_overview }; +DATASOURCE_PLUGIN_DEF(pgraster_datasource_plugin, pgraster); class pgraster_datasource : public datasource { public: diff --git a/plugins/input/postgis/CMakeLists.txt b/plugins/input/postgis/CMakeLists.txt index 796e0c90e..7e7061b7a 100644 --- a/plugins/input/postgis/CMakeLists.txt +++ b/plugins/input/postgis/CMakeLists.txt @@ -1,11 +1,13 @@ find_package(PostgreSQL REQUIRED) -add_library(input-postgis MODULE +add_library(input-postgis ${_plugin_linkage}) +target_sources(input-postgis ${_plugin_visibility} postgis_datasource.cpp postgis_featureset.cpp ) -target_link_libraries(input-postgis PRIVATE +target_link_libraries(input-postgis ${_plugin_visibility} mapnik::mapnik + mapnik::datasource-base PostgreSQL::PostgreSQL ) set_target_properties(input-postgis PROPERTIES diff --git a/plugins/input/postgis/postgis_datasource.cpp b/plugins/input/postgis/postgis_datasource.cpp index d40caa540..4c79c9a2a 100644 --- a/plugins/input/postgis/postgis_datasource.cpp +++ b/plugins/input/postgis/postgis_datasource.cpp @@ -49,7 +49,9 @@ MAPNIK_DISABLE_WARNING_POP #include #include -DATASOURCE_PLUGIN(postgis_datasource) +DATASOURCE_PLUGIN_IMPL(postgis_datasource_plugin, postgis_datasource); +DATASOURCE_PLUGIN_EXPORT(postgis_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_INIT(postgis_datasource_plugin); const std::string postgis_datasource::GEOMETRY_COLUMNS = "geometry_columns"; const std::string postgis_datasource::SPATIAL_REF_SYS = "spatial_ref_system"; diff --git a/plugins/input/postgis/postgis_datasource.hpp b/plugins/input/postgis/postgis_datasource.hpp index 6d50f9cf0..8bb398947 100644 --- a/plugins/input/postgis/postgis_datasource.hpp +++ b/plugins/input/postgis/postgis_datasource.hpp @@ -34,6 +34,7 @@ #include #include #include +#include // boost #include @@ -62,6 +63,7 @@ using mapnik::coord2d; using CnxPool_ptr = std::shared_ptr< ConnectionManager::PoolType>; +DATASOURCE_PLUGIN_DEF(postgis_datasource_plugin, postgis); class postgis_datasource : public datasource { public: diff --git a/plugins/input/raster/CMakeLists.txt b/plugins/input/raster/CMakeLists.txt index c7426ea3a..c9f12d9e6 100644 --- a/plugins/input/raster/CMakeLists.txt +++ b/plugins/input/raster/CMakeLists.txt @@ -1,9 +1,13 @@ -add_library(input-raster MODULE +add_library(input-raster ${_plugin_linkage}) +target_sources(input-raster ${_plugin_visibility} raster_datasource.cpp raster_featureset.cpp raster_info.cpp ) -target_link_libraries(input-raster PRIVATE mapnik::mapnik) +target_link_libraries(input-raster ${_plugin_visibility} + mapnik::mapnik + mapnik::datasource-base +) set_target_properties(input-raster PROPERTIES OUTPUT_NAME "raster" PREFIX "${_plugin_prefix}" diff --git a/plugins/input/raster/raster_datasource.cpp b/plugins/input/raster/raster_datasource.cpp index 71eb0dec3..97b7cb20d 100644 --- a/plugins/input/raster/raster_datasource.cpp +++ b/plugins/input/raster/raster_datasource.cpp @@ -43,7 +43,9 @@ using mapnik::datasource; using mapnik::parameters; using mapnik::image_reader; -DATASOURCE_PLUGIN(raster_datasource) +DATASOURCE_PLUGIN_IMPL(raster_datasource_plugin, raster_datasource); +DATASOURCE_PLUGIN_EXPORT(raster_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_INIT(raster_datasource_plugin); raster_datasource::raster_datasource(parameters const& params) : datasource(params), diff --git a/plugins/input/raster/raster_datasource.hpp b/plugins/input/raster/raster_datasource.hpp index 3007ed7f7..651c5b99d 100644 --- a/plugins/input/raster/raster_datasource.hpp +++ b/plugins/input/raster/raster_datasource.hpp @@ -31,6 +31,7 @@ #include #include #include +#include // boost #include @@ -40,6 +41,7 @@ #include #include +DATASOURCE_PLUGIN_DEF(raster_datasource_plugin, raster); class raster_datasource : public mapnik::datasource { diff --git a/plugins/input/shape/CMakeLists.txt b/plugins/input/shape/CMakeLists.txt index 6d9a9a7d1..2cd86cdac 100644 --- a/plugins/input/shape/CMakeLists.txt +++ b/plugins/input/shape/CMakeLists.txt @@ -1,4 +1,5 @@ -add_library(input-shape MODULE +add_library(input-shape ${_plugin_linkage}) +target_sources(input-shape ${_plugin_visibility} dbfile.cpp dbf_test.cpp shape_datasource.cpp @@ -6,7 +7,10 @@ add_library(input-shape MODULE shape_index_featureset.cpp shape_io.cpp shape_utils.cpp ) -target_link_libraries(input-shape PRIVATE mapnik::mapnik) +target_link_libraries(input-shape ${_plugin_visibility} + mapnik::mapnik + mapnik::datasource-base +) set_target_properties(input-shape PROPERTIES OUTPUT_NAME "shape" PREFIX "${_plugin_prefix}" diff --git a/plugins/input/shape/shape_datasource.cpp b/plugins/input/shape/shape_datasource.cpp index 21a8d5867..ce0b73e5e 100644 --- a/plugins/input/shape/shape_datasource.cpp +++ b/plugins/input/shape/shape_datasource.cpp @@ -47,7 +47,9 @@ MAPNIK_DISABLE_WARNING_POP #include #include -DATASOURCE_PLUGIN(shape_datasource) +DATASOURCE_PLUGIN_IMPL(shape_datasource_plugin, shape_datasource); +DATASOURCE_PLUGIN_EXPORT(shape_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_INIT(shape_datasource_plugin); using mapnik::String; using mapnik::Double; diff --git a/plugins/input/shape/shape_datasource.hpp b/plugins/input/shape/shape_datasource.hpp index 66841bdb0..b915ea0fe 100644 --- a/plugins/input/shape/shape_datasource.hpp +++ b/plugins/input/shape/shape_datasource.hpp @@ -32,6 +32,7 @@ #include #include #include +#include // boost #include @@ -50,6 +51,8 @@ using mapnik::featureset_ptr; using mapnik::layer_descriptor; using mapnik::coord2d; +DATASOURCE_PLUGIN_DEF(shape_datasource_plugin, shape); + class shape_datasource : public datasource { public: diff --git a/plugins/input/sqlite/CMakeLists.txt b/plugins/input/sqlite/CMakeLists.txt index 984bdfd1b..d690db4fa 100644 --- a/plugins/input/sqlite/CMakeLists.txt +++ b/plugins/input/sqlite/CMakeLists.txt @@ -1,12 +1,13 @@ find_package(SQLite3 REQUIRED) -add_library(input-sqlite MODULE +add_library(input-sqlite ${_plugin_linkage}) +target_sources(input-sqlite ${_plugin_visibility} sqlite_datasource.cpp sqlite_featureset.cpp ) -add_library(mapnik::plugin::input::sqlite ALIAS input-sqlite) -target_link_libraries(input-sqlite PRIVATE +target_link_libraries(input-sqlite ${_plugin_visibility} mapnik::mapnik + mapnik::datasource-base SQLite::SQLite3 ) set_target_properties(input-sqlite PROPERTIES diff --git a/plugins/input/sqlite/sqlite_datasource.cpp b/plugins/input/sqlite/sqlite_datasource.cpp index f3811e032..4809e6164 100644 --- a/plugins/input/sqlite/sqlite_datasource.cpp +++ b/plugins/input/sqlite/sqlite_datasource.cpp @@ -50,7 +50,9 @@ using mapnik::datasource_exception; using mapnik::datasource; using mapnik::parameters; -DATASOURCE_PLUGIN(sqlite_datasource) +DATASOURCE_PLUGIN_IMPL(sqlite_datasource_plugin, sqlite_datasource); +DATASOURCE_PLUGIN_EXPORT(sqlite_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_INIT(sqlite_datasource_plugin); sqlite_datasource::sqlite_datasource(parameters const& params) : datasource(params), diff --git a/plugins/input/sqlite/sqlite_datasource.hpp b/plugins/input/sqlite/sqlite_datasource.hpp index 6495e409a..5b064169c 100644 --- a/plugins/input/sqlite/sqlite_datasource.hpp +++ b/plugins/input/sqlite/sqlite_datasource.hpp @@ -33,6 +33,7 @@ #include #include #include +#include // boost #include @@ -45,6 +46,8 @@ // sqlite #include "sqlite_connection.hpp" +DATASOURCE_PLUGIN_DEF(sqlite_datasource_plugin, sqlite); + class sqlite_datasource : public mapnik::datasource { public: diff --git a/plugins/input/topojson/CMakeLists.txt b/plugins/input/topojson/CMakeLists.txt index fd2b4994b..4b8fd3153 100644 --- a/plugins/input/topojson/CMakeLists.txt +++ b/plugins/input/topojson/CMakeLists.txt @@ -1,11 +1,12 @@ -add_library(input-topojson MODULE +add_library(input-topojson ${_plugin_linkage}) +target_sources(input-topojson ${_plugin_visibility} topojson_datasource.cpp topojson_featureset.cpp ) -add_library(mapnik::plugin::input::topojson ALIAS input-topojson) -target_link_libraries(input-topojson PRIVATE +target_link_libraries(input-topojson ${_plugin_visibility} mapnik::mapnik mapnik::json + mapnik::datasource-base ) set_target_properties(input-topojson PROPERTIES OUTPUT_NAME "topojson" diff --git a/plugins/input/topojson/topojson_datasource.cpp b/plugins/input/topojson/topojson_datasource.cpp index fd0d55cf6..eabc280c2 100644 --- a/plugins/input/topojson/topojson_datasource.cpp +++ b/plugins/input/topojson/topojson_datasource.cpp @@ -42,7 +42,9 @@ using mapnik::datasource; using mapnik::parameters; -DATASOURCE_PLUGIN(topojson_datasource) +DATASOURCE_PLUGIN_IMPL(topojson_datasource_plugin, topojson_datasource); +DATASOURCE_PLUGIN_EXPORT(topojson_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_INIT(topojson_datasource_plugin); struct attr_value_converter { diff --git a/plugins/input/topojson/topojson_datasource.hpp b/plugins/input/topojson/topojson_datasource.hpp index 0c0937899..c9d605013 100644 --- a/plugins/input/topojson/topojson_datasource.hpp +++ b/plugins/input/topojson/topojson_datasource.hpp @@ -33,6 +33,7 @@ #include #include #include +#include #include MAPNIK_DISABLE_WARNING_PUSH @@ -52,6 +53,8 @@ MAPNIK_DISABLE_WARNING_POP #include #include +DATASOURCE_PLUGIN_DEF(topojson_datasource_plugin, topojson); + class topojson_datasource : public mapnik::datasource { public: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e21672ae8..2c86112cb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,15 +1,46 @@ add_subdirectory(json) add_subdirectory(wkt) -add_library(mapnik "") -add_library(mapnik::mapnik ALIAS mapnik) - if(BUILD_SHARED_LIBS) + # private as this should only be visibile when building, to dllexport/dllimport correctly target_compile_definitions(mapnik PRIVATE MAPNIK_EXPORTS) endif() -target_link_libraries(mapnik PUBLIC mapnik::core) -target_link_libraries(mapnik PRIVATE mapnik::agg) +target_link_libraries(mapnik PUBLIC mapnik::core mapnik::datasource-base) +target_link_libraries(mapnik PRIVATE + mapnik::agg + # expr: if(MAPNIK_STATIC_PLUGINS == ON && is build) then add link target + $<$,$>:input-csv> + $<$,$>:input-gdal> + $<$,$>:input-geobuf> + $<$,$>:input-geojson> + $<$,$>:input-ogr> + $<$,$>:input-pgraster> + $<$,$>:input-postgis> + $<$,$>:input-raster> + $<$,$>:input-shape> + $<$,$>:input-sqlite> + $<$,$>:input-topojson> +) +target_compile_definitions(mapnik PRIVATE + # expr: if(MAPNIK_STATIC_PLUGINS == ON && is build) then add build definition + $<$,$>:MAPNIK_STATIC_PLUGIN_CSV> + $<$,$>:MAPNIK_STATIC_PLUGIN_GDAL> + $<$,$>:MAPNIK_STATIC_PLUGIN_GEOBUF> + $<$,$>:MAPNIK_STATIC_PLUGIN_GEOJSON> + $<$,$>:MAPNIK_STATIC_PLUGIN_OGR> + $<$,$>:MAPNIK_STATIC_PLUGIN_PGRASTER> + $<$,$>:MAPNIK_STATIC_PLUGIN_POSTGIS> + $<$,$>:MAPNIK_STATIC_PLUGIN_RASTER> + $<$,$>:MAPNIK_STATIC_PLUGIN_SHAPE> + $<$,$>:MAPNIK_STATIC_PLUGIN_SQLITE> + $<$,$>:MAPNIK_STATIC_PLUGIN_TOPOJSON> + +) + +if(MAPNIK_STATIC_PLUGINS) + target_include_directories(mapnik PRIVATE "${PROJECT_SOURCE_DIR}/plugins") +endif() set_target_properties(mapnik PROPERTIES DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}" @@ -32,6 +63,7 @@ if(MSVC) target_compile_options(mapnik PUBLIC "/bigobj" "/wd4068" "/wd4661" "/wd4910") endif() + target_sources(mapnik PRIVATE cairo_io.cpp color_factory.cpp @@ -258,7 +290,10 @@ if(USE_TIFF) endif() if(USE_WEBP) - target_sources(mapnik PRIVATE webp_reader.cpp) + target_sources(mapnik PRIVATE + webp_reader.cpp + webp_io.cpp + ) endif() if(USE_GRID_RENDERER) diff --git a/src/datasource_cache_static.cpp b/src/datasource_cache_static.cpp index 7bbc58566..7af94fa4f 100644 --- a/src/datasource_cache_static.cpp +++ b/src/datasource_cache_static.cpp @@ -26,15 +26,16 @@ #ifdef MAPNIK_STATIC_PLUGINS #include - -// boost -#include +#include #endif // stl #include #include + +#define REGISTER_STATIC_DATASOURCE_PLUGIN(classname) {std::string{classname::kName}, std::make_shared()} + // static plugin linkage #ifdef MAPNIK_STATIC_PLUGINS #if defined(MAPNIK_STATIC_PLUGIN_CSV) @@ -43,6 +44,9 @@ #if defined(MAPNIK_STATIC_PLUGIN_GDAL) #include "input/gdal/gdal_datasource.hpp" #endif + #if defined(MAPNIK_STATIC_PLUGIN_GEOBUF) + #include "input/geobuf/geobuf_datasource.hpp" + #endif #if defined(MAPNIK_STATIC_PLUGIN_GEOJSON) #include "input/geojson/geojson_datasource.hpp" #endif @@ -58,6 +62,9 @@ #if defined(MAPNIK_STATIC_PLUGIN_OGR) #include "input/ogr/ogr_datasource.hpp" #endif + #if defined(MAPNIK_STATIC_PLUGIN_PGRASTER) + #include "input/pgraster/pgraster_datasource.hpp" + #endif #if defined(MAPNIK_STATIC_PLUGIN_OSM) #include "input/osm/osm_datasource.hpp" #endif @@ -76,6 +83,9 @@ #if defined(MAPNIK_STATIC_PLUGIN_SQLITE) #include "input/sqlite/sqlite_datasource.hpp" #endif + #if defined(MAPNIK_STATIC_PLUGIN_TOPOJSON) + #include "input/topojson/topojson_datasource.hpp" + #endif #endif namespace mapnik { @@ -88,43 +98,52 @@ datasource_ptr ds_generator(parameters const& params) } typedef datasource_ptr (*ds_generator_ptr)(parameters const& params); -using datasource_map = std::unordered_map; +using datasource_map = std::unordered_map>; -static datasource_map ds_map = boost::assign::map_list_of +static datasource_map ds_map{ #if defined(MAPNIK_STATIC_PLUGIN_CSV) - (std::string("csv"), &ds_generator) + REGISTER_STATIC_DATASOURCE_PLUGIN(csv_datasource_plugin), #endif #if defined(MAPNIK_STATIC_PLUGIN_GDAL) - (std::string("gdal"), &ds_generator) + REGISTER_STATIC_DATASOURCE_PLUGIN(gdal_datasource_plugin), + #endif + #if defined(MAPNIK_STATIC_PLUGIN_GEOBUF) + REGISTER_STATIC_DATASOURCE_PLUGIN(geobuf_datasource_plugin), #endif #if defined(MAPNIK_STATIC_PLUGIN_GEOJSON) - (std::string("geojson"), &ds_generator) + REGISTER_STATIC_DATASOURCE_PLUGIN(geojson_datasource_plugin), #endif #if defined(MAPNIK_STATIC_PLUGIN_OCCI) - (std::string("occi"), &ds_generator) + REGISTER_STATIC_DATASOURCE_PLUGIN(occi_datasource_plugin), #endif #if defined(MAPNIK_STATIC_PLUGIN_OGR) - (std::string("ogr"), &ds_generator) + REGISTER_STATIC_DATASOURCE_PLUGIN(ogr_datasource_plugin), + #endif + #if defined(MAPNIK_STATIC_PLUGIN_PGRASTER) + REGISTER_STATIC_DATASOURCE_PLUGIN(pgraster_datasource_plugin), #endif #if defined(MAPNIK_STATIC_PLUGIN_OSM) - (std::string("osm"), &ds_generator) + REGISTER_STATIC_DATASOURCE_PLUGIN(osm_datasource_plugin), #endif #if defined(MAPNIK_STATIC_PLUGIN_POSTGIS) - (std::string("postgis"), &ds_generator) + REGISTER_STATIC_DATASOURCE_PLUGIN(postgis_datasource_plugin), #endif #if defined(MAPNIK_STATIC_PLUGIN_RASTER) - (std::string("raster"), &ds_generator) + REGISTER_STATIC_DATASOURCE_PLUGIN(raster_datasource_plugin), #endif #if defined(MAPNIK_STATIC_PLUGIN_RASTERLITE) - (std::string("rasterlite"), &ds_generator) + REGISTER_STATIC_DATASOURCE_PLUGIN(rasterlite_datasource_plugin), #endif #if defined(MAPNIK_STATIC_PLUGIN_SHAPE) - (std::string("shape"), &ds_generator) + REGISTER_STATIC_DATASOURCE_PLUGIN(shape_datasource_plugin), #endif #if defined(MAPNIK_STATIC_PLUGIN_SQLITE) - (std::string("sqlite"), &ds_generator) + REGISTER_STATIC_DATASOURCE_PLUGIN(sqlite_datasource_plugin), #endif -; + #if defined(MAPNIK_STATIC_PLUGIN_TOPOJSON) + REGISTER_STATIC_DATASOURCE_PLUGIN(topojson_datasource_plugin), + #endif +}; #endif #ifdef MAPNIK_STATIC_PLUGINS @@ -135,7 +154,7 @@ datasource_ptr create_static_datasource(parameters const& params) datasource_map::iterator it = ds_map.find(*type); if (it != ds_map.end()) { - ds = it->second(params); + ds = it->second->create(params); } return ds; } diff --git a/src/json/CMakeLists.txt b/src/json/CMakeLists.txt index b35e0183a..bdda4a042 100644 --- a/src/json/CMakeLists.txt +++ b/src/json/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(json STATIC +target_sources(json PRIVATE extract_bounding_boxes_x3.cpp feature_from_geojson.cpp feature_grammar_x3.cpp @@ -13,7 +13,6 @@ add_library(json STATIC topojson_grammar_x3.cpp unicode_string_grammar_x3.cpp ) -add_library(mapnik::json ALIAS json) target_include_directories(json PRIVATE ${JPEG_INCLUDE_DIR} diff --git a/src/plugin.cpp b/src/plugin.cpp index 281bc02f8..3540da2ea 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -23,6 +23,8 @@ #include #include +#include + #ifdef _WIN32 #define NOMINMAX #include @@ -58,12 +60,11 @@ PluginInfo::PluginInfo(std::string const& filename, if (module_) module_->dl = LoadLibraryA(filename.c_str()); if (module_ && module_->dl) { - callable_returning_string name_call = reinterpret_cast(dlsym(module_->dl, library_name.c_str())); - if (name_call) name_ = name_call(); - callable_returning_void init_once = reinterpret_cast(dlsym(module_->dl, "on_plugin_load")); - if (init_once) { - init_once(); - } + datasource_plugin* plugin = reinterpret_cast(dlsym(module_->dl, "plugin")); + if(!plugin) + throw std::runtime_error("plugin has a false interface"); //! todo: better error text + name_ = plugin->name(); + plugin->init_once(); } #else #ifdef MAPNIK_HAS_DLCFN diff --git a/src/webp_io.cpp b/src/webp_io.cpp new file mode 100644 index 000000000..2f2e7ab1f --- /dev/null +++ b/src/webp_io.cpp @@ -0,0 +1,24 @@ +#include + +namespace mapnik { + std::string MAPNIK_DECL webp_encoding_error(WebPEncodingError error) { + std::string os; + switch (error) + { + case VP8_ENC_ERROR_OUT_OF_MEMORY: os = "memory error allocating objects"; break; + case VP8_ENC_ERROR_BITSTREAM_OUT_OF_MEMORY: os = "memory error while flushing bits"; break; + case VP8_ENC_ERROR_NULL_PARAMETER: os = "a pointer parameter is NULL"; break; + case VP8_ENC_ERROR_INVALID_CONFIGURATION: os = "configuration is invalid"; break; + case VP8_ENC_ERROR_BAD_DIMENSION: os = "picture has invalid width/height"; break; + case VP8_ENC_ERROR_PARTITION0_OVERFLOW: os = "partition is bigger than 512k"; break; + case VP8_ENC_ERROR_PARTITION_OVERFLOW: os = "partition is bigger than 16M"; break; + case VP8_ENC_ERROR_BAD_WRITE: os = "error while flushing bytes"; break; + case VP8_ENC_ERROR_FILE_TOO_BIG: os = "file is bigger than 4G"; break; + default: + mapnik::util::to_string(os,error); + os = "unknown error (" + os + ")"; break; + } + return os; +} + +} diff --git a/src/wkt/CMakeLists.txt b/src/wkt/CMakeLists.txt index 8e42bef69..7cb0db1fd 100644 --- a/src/wkt/CMakeLists.txt +++ b/src/wkt/CMakeLists.txt @@ -1,10 +1,9 @@ -add_library(wkt STATIC +target_sources(wkt PRIVATE geometry_to_wkt.cpp mapnik_wkt_generator_grammar.cpp wkt_factory.cpp wkt_grammar_x3.cpp ) -add_library(mapnik::wkt ALIAS wkt) target_include_directories(wkt PRIVATE ${MAPNIK_INCLUDE_PATH} From 42f465f8424bec76d605cdef101314cdc3e19714 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 2 Feb 2022 17:20:29 +0100 Subject: [PATCH 08/38] refactor datasource plugins fix merge remove old DATASOURCE_PLUGIN call fix memory_datasource wip wip fix temp return fix install wip before_unload linux remove docker remove docker comments add windows error message if libmapnik=static and plugins=dynamic fix false plugin macro plugin default de/constructor to remove UB simplyfy plugin targets - add fpic fix makro simplyfy use unique_ptr for plugin handle rename option static plugins replace local init with fnc call call setup everywhere init datasource_static --- .dockerignore | 3 - .github/workflows/docker-image.yml | 55 ---- CMakeLists.txt | 28 +- Dockerfile | 41 --- benchmark/include/bench_framework.hpp | 2 + benchmark/src/normalize_angle.cpp | 1 + benchmark/src/test_array_allocation.cpp | 1 + benchmark/src/test_expression_parse.cpp | 1 + benchmark/src/test_face_ptr_creation.cpp | 1 + benchmark/src/test_getline.cpp | 1 + .../src/test_numeric_cast_vs_static_cast.cpp | 1 + benchmark/src/test_offset_converter.cpp | 1 + benchmark/src/test_polygon_clipping.cpp | 1 + .../src/test_polygon_clipping_rendering.cpp | 1 + benchmark/src/test_proj_transform1.cpp | 1 + benchmark/src/test_rendering.cpp | 1 + benchmark/src/test_rendering_shared_map.cpp | 1 + benchmark/src/test_utf_encoding.cpp | 1 + demo/c++/rundemo.cpp | 3 +- demo/viewer/main.cpp | 2 + include/mapnik/config.hpp | 66 ++--- include/mapnik/mapnik.hpp | 9 + include/mapnik/memory_datasource.hpp | 2 + include/mapnik/plugin.hpp | 5 +- include/mapnik/warning.hpp | 256 +++++++++--------- plugins/input/CMakeLists.txt | 21 +- plugins/input/base/CMakeLists.txt | 1 + .../base/include/mapnik/datasource_plugin.hpp | 24 +- plugins/input/csv/CMakeLists.txt | 12 +- plugins/input/csv/csv_datasource.cpp | 3 +- plugins/input/gdal/CMakeLists.txt | 12 +- plugins/input/gdal/gdal_datasource.cpp | 11 +- plugins/input/geobuf/CMakeLists.txt | 13 +- plugins/input/geobuf/geobuf_datasource.cpp | 3 +- plugins/input/geojson/CMakeLists.txt | 11 +- plugins/input/geojson/geojson_datasource.cpp | 3 +- plugins/input/ogr/CMakeLists.txt | 11 +- plugins/input/ogr/ogr_datasource.cpp | 15 +- plugins/input/pgraster/CMakeLists.txt | 11 +- .../input/pgraster/pgraster_datasource.cpp | 4 +- plugins/input/postgis/CMakeLists.txt | 11 +- plugins/input/postgis/postgis_datasource.cpp | 3 +- plugins/input/raster/CMakeLists.txt | 11 +- plugins/input/raster/raster_datasource.cpp | 3 +- plugins/input/shape/CMakeLists.txt | 11 +- plugins/input/shape/shape_datasource.cpp | 3 +- plugins/input/sqlite/CMakeLists.txt | 11 +- plugins/input/sqlite/sqlite_datasource.cpp | 3 +- plugins/input/topojson/CMakeLists.txt | 11 +- .../input/topojson/topojson_datasource.cpp | 3 +- src/CMakeLists.txt | 2 + src/create_image_reader.hpp | 19 ++ src/datasource_cache.cpp | 11 +- src/datasource_cache_static.cpp | 42 ++- src/jpeg_reader.cpp | 10 +- src/mapnik.cpp | 41 +++ src/memory_datasource.cpp | 9 +- src/plugin.cpp | 91 +++---- src/png_reader.cpp | 10 +- src/tiff_reader.cpp | 11 +- src/webp_reader.cpp | 10 +- .../agg_rasterizer_integer_overflow_test.cpp | 2 + .../datasource_registration_test.cpp | 2 + test/standalone/font_registration_test.cpp | 2 + test/standalone/map_xml_test.cpp | 2 + test/unit/run.cpp | 2 + test/visual/run.cpp | 2 + utils/geometry_to_wkb/main.cpp | 2 + utils/mapnik-index/mapnik-index.cpp | 2 + utils/mapnik-render/mapnik-render.cpp | 3 + utils/ogrindex/ogrindex.cpp | 2 + utils/pgsql2sqlite/main.cpp | 2 + utils/shapeindex/shapeindex.cpp | 2 + utils/svg2png/svg2png.cpp | 2 + 74 files changed, 474 insertions(+), 519 deletions(-) delete mode 100644 .dockerignore delete mode 100644 .github/workflows/docker-image.yml delete mode 100644 Dockerfile create mode 100644 include/mapnik/mapnik.hpp create mode 100644 src/create_image_reader.hpp create mode 100644 src/mapnik.cpp diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index becd9cb6b..000000000 --- a/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -build -.vs -.vscode diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml deleted file mode 100644 index 480044ded..000000000 --- a/.github/workflows/docker-image.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Docker Image CI - -on: - push: - branches: - - "**" - tags: - - "v*.*.*" - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - with: - submodules: "recursive" - - - name: Docker meta - id: meta - uses: docker/metadata-action@v3 - with: - # list of Docker images to use as base name for tags - images: | - ghcr.io/mathisloge/mapnik - # generate Docker tags based on the following events/attributes - tags: | - type=schedule - type=ref,event=branch - type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - type=sha - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Login to GHCR - if: github.event_name != 'pull_request' - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v2 - with: - context: . - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 05a9ccc26..578cbe08e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,11 @@ add_feature_info(BUILD_TESTING BUILD_TESTING "Adds tests") mapnik_option(INSTALL_DEPENDENCIES "if ON, all dependencies (eg. required dlls) will be copied into CMAKE_INSTALL_PREFIX/MAPNIK_BIN_DIR." ON) mapnik_option(BUILD_SHARED_LIBS "build mapnik dynamic(ON) or static(OFF)" ON) +mapnik_option(BUILD_SHARED_PLUGINS "build dynamic plugins" ${BUILD_SHARED_LIBS}) # use BUILD_SHARED_LIBS as default option +if(WIN32 AND BUILD_SHARED_PLUGINS AND NOT BUILD_SHARED_LIBS) + message(FATAL_ERROR "static libmapnik and dynamic plugins won't work correctly") +endif() + mapnik_option(USE_EXTERNAL_MAPBOX_GEOMETRY "Use a external mapnik/geometry.hpp. If off, use the submodule" OFF) mapnik_option(USE_EXTERNAL_MAPBOX_POLYLABEL "Use a external mapnik/polylabel. If off, use the submodule" OFF) mapnik_option(USE_EXTERNAL_MAPBOX_PROTOZERO "Use a external mapnik/protozero. If off, use the submodule" OFF) @@ -56,7 +61,6 @@ mapnik_option(USE_LOG "enables logging output. See log severity level." OFF) set(USE_LOG_SEVERITY "1" CACHE STRING "sets the logging severity (only applies when USE_LOG is ON") mapnik_option(USE_STATS "Enable statistics reporting" OFF) -mapnik_option(STATIC_PLUGINS "statically link plugins into libmapnik" OFF) mapnik_option(USE_PLUGIN_INPUT_CSV "adds plugin input csv" ON) mapnik_option(USE_PLUGIN_INPUT_GDAL "adds plugin input gdal" ON) mapnik_option(USE_PLUGIN_INPUT_GEOBUF "adds plugin input geobuf" ON) @@ -345,11 +349,9 @@ if(NOT WIN32) list(APPEND MAPNIK_OPTIONAL_LIBS ${CMAKE_DL_LIBS}) endif() -if(MAPNIK_STATIC_PLUGINS) +if(NOT BUILD_SHARED_PLUGINS) list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_STATIC_PLUGINS) endif() - - # when building static, this have to be public so that all depending libs know about if(NOT BUILD_SHARED_LIBS) list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_STATIC_DEFINE) @@ -388,6 +390,7 @@ target_compile_definitions(core INTERFACE ${MAPNIK_COMPILE_DEFS}) mapnik_install(core) +### # forward declaring libraries to consume them when building static plugins (circle deps between mapnik <-> plugin_target) add_library(mapnik "") add_library(mapnik::mapnik ALIAS mapnik) @@ -396,6 +399,7 @@ add_library(mapnik::wkt ALIAS wkt) add_library(json STATIC "") add_library(mapnik::json ALIAS json) # end forward declaration +### add_subdirectory(deps) add_subdirectory(plugins) @@ -416,22 +420,22 @@ feature_summary(FILENAME "${CMAKE_CURRENT_BINARY_DIR}/packages.log" WHAT PACKAGE include(MapnikExport) include(MapnikExportPkgConfig) -install(DIRECTORY include/ DESTINATION ${MAPNIK_INCLUDE_DIR}) -install(DIRECTORY deps/agg/include/ DESTINATION ${MAPNIK_INCLUDE_DIR}) -install(DIRECTORY deps/mapnik DESTINATION ${MAPNIK_INCLUDE_DIR}) -install(DIRECTORY fonts/ DESTINATION ${FONTS_INSTALL_DIR} FILES_MATCHING PATTERN "*.py" EXCLUDE PATTERN "*") +install(DIRECTORY include/ DESTINATION "${MAPNIK_INCLUDE_DIR}") +install(DIRECTORY deps/agg/include/ DESTINATION "${MAPNIK_INCLUDE_DIR}") +install(DIRECTORY deps/mapnik DESTINATION "${MAPNIK_INCLUDE_DIR}") +install(DIRECTORY fonts/ DESTINATION "${FONTS_INSTALL_DIR}" FILES_MATCHING PATTERN "*.py" EXCLUDE PATTERN "*") if(NOT USE_EXTERNAL_MAPBOX_GEOMETRY) - install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/geometry/include/ DESTINATION ${MAPNIK_INCLUDE_DIR}) + install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/geometry/include/" DESTINATION "${MAPNIK_INCLUDE_DIR}") endif() if(NOT USE_EXTERNAL_MAPBOX_POLYLABEL) - install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/polylabel/include/ DESTINATION ${MAPNIK_INCLUDE_DIR}) + install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/polylabel/include/" DESTINATION "${MAPNIK_INCLUDE_DIR}") endif() if(NOT USE_EXTERNAL_MAPBOX_PROTOZERO) - install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/protozero/include/ DESTINATION ${MAPNIK_INCLUDE_DIR}) + install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/protozero/include/" DESTINATION "${MAPNIK_INCLUDE_DIR}") endif() if(NOT USE_EXTERNAL_MAPBOX_VARIANT) - install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/variant/include/ DESTINATION ${MAPNIK_INCLUDE_DIR}) + install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/variant/include/" DESTINATION "${MAPNIK_INCLUDE_DIR}") endif() mapnik_install_targets() diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 1d7f7d1b3..000000000 --- a/Dockerfile +++ /dev/null @@ -1,41 +0,0 @@ -FROM ubuntu:21.04 -LABEL description="mapnik" - -ARG DEBIAN_FRONTEND=noninteractive - -RUN mkdir /app -COPY . /app -WORKDIR /app - -RUN apt update -RUN apt install -y gpg wget -RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null -RUN echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null -RUN apt update -RUN apt install -y \ - cmake \ - ninja-build \ - build-essential - -ENV BUILD_DEPENDENCIES="libicu-dev \ - libfreetype6-dev \ - libharfbuzz-dev \ - libxml2-dev \ - libjpeg-dev \ - libtiff-dev \ - libwebp-dev \ - libcairo2-dev \ - libproj-dev \ - libgdal-dev \ - libboost-filesystem-dev \ - libboost-program-options-dev \ - libboost-regex-dev \ - " - -RUN apt install -y $BUILD_DEPENDENCIES -RUN cmake --preset linux-gcc-release -DBUILD_DEMO_VIEWER=OFF -DBUILD_TESTING=OFF -DBUILD_DEMO_CPP=OFF -DBUILD_BENCHMARK=OFF -RUN cmake --build --preset linux-gcc-release -RUN cmake --build --preset linux-gcc-release --target install - -WORKDIR / -RUN rm -rf /app diff --git a/benchmark/include/bench_framework.hpp b/benchmark/include/bench_framework.hpp index 593931103..cc9439eee 100644 --- a/benchmark/include/bench_framework.hpp +++ b/benchmark/include/bench_framework.hpp @@ -2,6 +2,7 @@ #define MAPNIK_BENCH_FRAMEWORK_HPP // mapnik +#include #include #include #include @@ -124,6 +125,7 @@ inline int handle_args(int argc, char** argv, mapnik::parameters& params) #define BENCHMARK(test_class, name) \ int main(int argc, char** argv) \ { \ + mapnik::setup(); \ try \ { \ mapnik::parameters params; \ diff --git a/benchmark/src/normalize_angle.cpp b/benchmark/src/normalize_angle.cpp index fcfc7a5c2..97b6cdad1 100644 --- a/benchmark/src/normalize_angle.cpp +++ b/benchmark/src/normalize_angle.cpp @@ -30,6 +30,7 @@ struct bench_func : benchmark::test_case int main(int argc, char** argv) { + mapnik::setup(); return benchmark::sequencer(argc, argv) .BENCH_FUNC1(mapnik::util::normalize_angle, +3) .BENCH_FUNC1(mapnik::util::normalize_angle, +6) diff --git a/benchmark/src/test_array_allocation.cpp b/benchmark/src/test_array_allocation.cpp index 592a93d07..b80e9271f 100644 --- a/benchmark/src/test_array_allocation.cpp +++ b/benchmark/src/test_array_allocation.cpp @@ -349,6 +349,7 @@ class test7 : public benchmark::test_case int main(int argc, char** argv) { + mapnik::setup(); return benchmark::sequencer(argc, argv) .run("calloc") .run("malloc/memcpy") diff --git a/benchmark/src/test_expression_parse.cpp b/benchmark/src/test_expression_parse.cpp index d35a57ab2..956dcd39e 100644 --- a/benchmark/src/test_expression_parse.cpp +++ b/benchmark/src/test_expression_parse.cpp @@ -36,6 +36,7 @@ class test : public benchmark::test_case int main(int argc, char** argv) { + mapnik::setup(); mapnik::parameters params; benchmark::handle_args(argc, argv, params); test test_runner(params); diff --git a/benchmark/src/test_face_ptr_creation.cpp b/benchmark/src/test_face_ptr_creation.cpp index 4bbdf0301..64071c32f 100644 --- a/benchmark/src/test_face_ptr_creation.cpp +++ b/benchmark/src/test_face_ptr_creation.cpp @@ -59,6 +59,7 @@ class test : public benchmark::test_case int main(int argc, char** argv) { + mapnik::setup(); mapnik::parameters params; benchmark::handle_args(argc, argv, params); bool success = mapnik::freetype_engine::register_fonts("./fonts", true); diff --git a/benchmark/src/test_getline.cpp b/benchmark/src/test_getline.cpp index 305d1b530..b3ca0df7f 100644 --- a/benchmark/src/test_getline.cpp +++ b/benchmark/src/test_getline.cpp @@ -101,6 +101,7 @@ class test2 : public benchmark::test_case int main(int argc, char** argv) { + mapnik::setup(); int return_value = 0; try { diff --git a/benchmark/src/test_numeric_cast_vs_static_cast.cpp b/benchmark/src/test_numeric_cast_vs_static_cast.cpp index 542006910..b71c5bcf8 100644 --- a/benchmark/src/test_numeric_cast_vs_static_cast.cpp +++ b/benchmark/src/test_numeric_cast_vs_static_cast.cpp @@ -74,5 +74,6 @@ class test_numeric : public benchmark::test_case int main(int argc, char** argv) { + mapnik::setup(); return benchmark::sequencer(argc, argv).run("static_cast").run("numeric_cast").done(); } diff --git a/benchmark/src/test_offset_converter.cpp b/benchmark/src/test_offset_converter.cpp index 93988ce4c..e591d552f 100644 --- a/benchmark/src/test_offset_converter.cpp +++ b/benchmark/src/test_offset_converter.cpp @@ -92,6 +92,7 @@ class test_offset : public benchmark::test_case int main(int argc, char** argv) { + mapnik::setup(); mapnik::parameters params; benchmark::handle_args(argc, argv, params); int return_value = 0; diff --git a/benchmark/src/test_polygon_clipping.cpp b/benchmark/src/test_polygon_clipping.cpp index 9ec54f251..d8c3fce6d 100644 --- a/benchmark/src/test_polygon_clipping.cpp +++ b/benchmark/src/test_polygon_clipping.cpp @@ -510,6 +510,7 @@ expected_count << "\n"; valid = false; int main(int argc, char** argv) { + mapnik::setup(); mapnik::parameters params; benchmark::handle_args(argc, argv, params); diff --git a/benchmark/src/test_polygon_clipping_rendering.cpp b/benchmark/src/test_polygon_clipping_rendering.cpp index b0daba0c9..9c3e99b33 100644 --- a/benchmark/src/test_polygon_clipping_rendering.cpp +++ b/benchmark/src/test_polygon_clipping_rendering.cpp @@ -43,6 +43,7 @@ class test : public benchmark::test_case int main(int argc, char** argv) { + mapnik::setup(); mapnik::parameters params; benchmark::handle_args(argc, argv, params); mapnik::datasource_cache::instance().register_datasources("./plugins/input/"); diff --git a/benchmark/src/test_proj_transform1.cpp b/benchmark/src/test_proj_transform1.cpp index 96e338ceb..e179a671b 100644 --- a/benchmark/src/test_proj_transform1.cpp +++ b/benchmark/src/test_proj_transform1.cpp @@ -60,6 +60,7 @@ class test : public benchmark::test_case // echo -180 -60 | cs2cs -f "%.10f" epsg:4326 +to epsg:3857 int main(int argc, char** argv) { + mapnik::setup(); mapnik::box2d from(-180, -80, 180, 80); mapnik::box2d to(-20037508.3427892476, -15538711.0963092316, 20037508.3427892476, 15538711.0963092316); std::string from_str("epsg:4326"); diff --git a/benchmark/src/test_rendering.cpp b/benchmark/src/test_rendering.cpp index 0ba1fdff4..38cc9318a 100644 --- a/benchmark/src/test_rendering.cpp +++ b/benchmark/src/test_rendering.cpp @@ -95,6 +95,7 @@ class test : public benchmark::test_case int main(int argc, char** argv) { + mapnik::setup(); int return_value = 0; try { diff --git a/benchmark/src/test_rendering_shared_map.cpp b/benchmark/src/test_rendering_shared_map.cpp index 3d16f61fd..331033efc 100644 --- a/benchmark/src/test_rendering_shared_map.cpp +++ b/benchmark/src/test_rendering_shared_map.cpp @@ -150,6 +150,7 @@ class test : public benchmark::test_case int main(int argc, char** argv) { + mapnik::setup(); int return_value = 0; try { diff --git a/benchmark/src/test_utf_encoding.cpp b/benchmark/src/test_utf_encoding.cpp index badb0a661..c677541db 100644 --- a/benchmark/src/test_utf_encoding.cpp +++ b/benchmark/src/test_utf_encoding.cpp @@ -106,6 +106,7 @@ class test3 : public benchmark::test_case int main(int argc, char** argv) { + mapnik::setup(); mapnik::parameters params; benchmark::handle_args(argc, argv, params); int return_value = 0; diff --git a/demo/c++/rundemo.cpp b/demo/c++/rundemo.cpp index dc4f8e823..961b95a8f 100644 --- a/demo/c++/rundemo.cpp +++ b/demo/c++/rundemo.cpp @@ -20,6 +20,7 @@ * *****************************************************************************/ +#include #include #include #include @@ -52,7 +53,7 @@ int main(int, char**) "+proj=lcc +ellps=GRS80 +lat_0=49 +lon_0=-95 +lat+1=49 +lat_2=77 +datum=NAD83 +units=m +no_defs"; const std::string srs_merc = "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 " "+units=m +nadgrids=@null +wktext +no_defs +over"; - + mapnik::setup(); try { std::cout << " running demo ... \n"; diff --git a/demo/viewer/main.cpp b/demo/viewer/main.cpp index 09e90fac3..9f5cd3dbe 100644 --- a/demo/viewer/main.cpp +++ b/demo/viewer/main.cpp @@ -23,12 +23,14 @@ #include #include #include +#include #include "mainwindow.hpp" int main(int argc, char** argv) { using mapnik::datasource_cache; using mapnik::freetype_engine; + mapnik::setup(); try { #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) diff --git a/include/mapnik/config.hpp b/include/mapnik/config.hpp index 27ada9b5e..312d72ffb 100644 --- a/include/mapnik/config.hpp +++ b/include/mapnik/config.hpp @@ -24,48 +24,40 @@ #define MAPNIK_CONFIG_HPP // Windows DLL support - +// clang-format off #ifdef _WIN32 #ifdef MAPNIK_STATIC_DEFINE -#define MAPNIK_DECL -#define MAPNIK_EXP +# define MAPNIK_DECL +# define MAPNIK_EXP #else -#define MAPNIK_EXP __declspec(dllexport) -#ifndef MAPNIK_DECL -#ifdef MAPNIK_EXPORTS -/* We are building this library */ -#define MAPNIK_DECL __declspec(dllexport) +# define MAPNIK_EXP __declspec(dllexport) +# ifndef MAPNIK_DECL +# ifdef MAPNIK_EXPORTS + /* We are building this library */ +# define MAPNIK_DECL __declspec(dllexport) +# else + /* We are using this library */ +# define MAPNIK_DECL __declspec(dllimport) +# endif +# endif +#endif +# pragma warning( disable: 4251 ) +# pragma warning( disable: 4275 ) +# if (_MSC_VER >= 1400) // vc8 +# pragma warning(disable : 4996) //_CRT_SECURE_NO_DEPRECATE +# endif #else -/* We are using this library */ -#define MAPNIK_DECL __declspec(dllimport) +# if __GNUC__ >= 4 +# define MAPNIK_EXP __attribute__ ((visibility ("default"))) +# define MAPNIK_DECL __attribute__ ((visibility ("default"))) +# define MAPNIK_IMP __attribute__ ((visibility ("default"))) +# else +# define MAPNIK_EXP +# define MAPNIK_DECL +# define MAPNIK_IMP +# endif #endif -#endif -#endif -#pragma warning(disable: 4251) -#pragma warning(disable: 4275) -#if (_MSC_VER >= 1400) // vc8 -#pragma warning(disable: 4996) //_CRT_SECURE_NO_DEPRECATE -#endif -#else -#define MAPNIK_DECL __declspec(dllimport) -#endif -#pragma warning(disable: 4251) -#pragma warning(disable: 4275) -#if (_MSC_VER >= 1400) // vc8 -#pragma warning(disable: 4996) //_CRT_SECURE_NO_DEPRECATE -#endif -#else -#if __GNUC__ >= 4 -#define MAPNIK_EXP __attribute__((visibility("default"))) -#define MAPNIK_DECL __attribute__((visibility("default"))) -#define MAPNIK_IMP __attribute__((visibility("default"))) -#else -#define MAPNIK_EXP -#define MAPNIK_DECL -#define MAPNIK_IMP -#endif -#endif - +// clang-format on #define PROJ_ENVELOPE_POINTS 20 #endif // MAPNIK_CONFIG_HPP diff --git a/include/mapnik/mapnik.hpp b/include/mapnik/mapnik.hpp new file mode 100644 index 000000000..e1545a48d --- /dev/null +++ b/include/mapnik/mapnik.hpp @@ -0,0 +1,9 @@ +#ifndef MAPNIK_MAPNIK_HPP +#define MAPNIK_MAPNIK_HPP +#include "config.hpp" + +namespace mapnik { +MAPNIK_DECL void setup(); +} + +#endif diff --git a/include/mapnik/memory_datasource.hpp b/include/mapnik/memory_datasource.hpp index 833b3c09e..9591c8181 100644 --- a/include/mapnik/memory_datasource.hpp +++ b/include/mapnik/memory_datasource.hpp @@ -26,12 +26,14 @@ // mapnik #include #include +#include // stl #include namespace mapnik { +DATASOURCE_PLUGIN_DEF(memory_datasource_plugin, memory) class MAPNIK_DECL memory_datasource : public datasource { friend class memory_featureset; diff --git a/include/mapnik/plugin.hpp b/include/mapnik/plugin.hpp index 46c06c421..b730a99c0 100644 --- a/include/mapnik/plugin.hpp +++ b/include/mapnik/plugin.hpp @@ -25,9 +25,9 @@ // mapnik #include - // stl #include +#include namespace mapnik { @@ -50,8 +50,7 @@ class PluginInfo : util::noncopyable private: std::string filename_; - std::string name_; - mapnik_lib_t* module_; + std::unique_ptr module_; }; } // namespace mapnik diff --git a/include/mapnik/warning.hpp b/include/mapnik/warning.hpp index 3ab29d16b..1c027026b 100644 --- a/include/mapnik/warning.hpp +++ b/include/mapnik/warning.hpp @@ -1,135 +1,137 @@ #ifndef MAPNIK_WARNING_HPP #define MAPNIK_WARNING_HPP +// clang-format off #if defined(_MSC_VER) -#define MAPNIK_DISABLE_WARNING_PUSH __pragma(warning(push)) -#define MAPNIK_DISABLE_WARNING_POP __pragma(warning(pop)) -#define MAPNIK_DISABLE_WARNING(warningNumber) __pragma(warning(disable : warningNumber)) - -// add warnings to deactivate here -// example: #define DISABLE_WARNING_UNREFERENCED_FORMAL_PARAMETER DISABLE_WARNING(4100) -#define MAPNIK_DISABLE_WARNING_UNKNOWN_PRAGMAS MAPNIK_DISABLE_WARNING(4068) -#define MAPNIK_DISABLE_WARNING_PRAGMAS // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_PRAGMA_MESSAGES // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_UNSEQUENCED // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_UNUSED_FUNCTION // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_UNUSED_PARAMETER // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_REDECLARED_CLASS_MEMBER // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_UNUSED_LOCAL_TYPEDEF // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_UNUSED_LOCAL_TYPEDEFS // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_SHADOW // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_CPP11_NARROWING // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_SIGN_CONVERSION // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_SIGN_COMPARE // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_CONVERSION MAPNIK_DISABLE_WARNING(4244) -#define MAPNIK_DISABLE_WARNING_CPP_98_COMPAT_PEDANTIC // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_DISABLE_MACRO_EXPANSION // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_OLD_STYLE_CAST // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_DOCUMENTATION // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_DOCUMENTATION_UNKNOWN_COMMAND // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_UNDEF // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_DEPRECATED MAPNIK_DISABLE_WARNING(4996) -#define MAPNIK_DISABLE_WARNING_PADDED // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_CPP_98_COMPAT // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_RESERVED_ID_MACRO // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_WEAK_VTABLE // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_EXTRA_SEMI // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_GLOBAL_CONSTRUCTORS // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_HEADER_HYGIENE // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_EXIT_TIME_DESTRUCTORS // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_SWITCH_ENUM // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_MISSING_NORETURN // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_COVERED_SWITCH_DEFAULT // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_FLOAT_EQUAL // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_LONG_LONG // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_UNDEFINED_VAR_TEMPLATE // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_UNUSED_VARIABLE MAPNIK_DISABLE_WARNING(4101) -#define MAPNIK_DISABLE_MISMATCHED_TAGS // MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_PUSH __pragma(warning( push )) + #define MAPNIK_DISABLE_WARNING_POP __pragma(warning( pop )) + #define MAPNIK_DISABLE_WARNING(warningNumber) __pragma(warning( disable : warningNumber )) + // add warnings to deactivate here + // example: #define DISABLE_WARNING_UNREFERENCED_FORMAL_PARAMETER DISABLE_WARNING(4100) + #define MAPNIK_DISABLE_WARNING_UNKNOWN_PRAGMAS MAPNIK_DISABLE_WARNING(4068) + #define MAPNIK_DISABLE_WARNING_PRAGMAS //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_PRAGMA_MESSAGES //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_UNSEQUENCED //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_UNUSED_FUNCTION //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_UNUSED_PARAMETER //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_REDECLARED_CLASS_MEMBER //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_UNUSED_LOCAL_TYPEDEF //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_UNUSED_LOCAL_TYPEDEFS //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_SHADOW //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_CPP11_NARROWING //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_SIGN_CONVERSION //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_SIGN_COMPARE //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_CONVERSION MAPNIK_DISABLE_WARNING(4244) + #define MAPNIK_DISABLE_WARNING_CPP_98_COMPAT_PEDANTIC //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_DISABLE_MACRO_EXPANSION //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_OLD_STYLE_CAST //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_DOCUMENTATION //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_DOCUMENTATION_UNKNOWN_COMMAND //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_UNDEF //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_DEPRECATED MAPNIK_DISABLE_WARNING(4996) + #define MAPNIK_DISABLE_WARNING_PADDED //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_CPP_98_COMPAT //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_RESERVED_ID_MACRO //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_WEAK_VTABLE //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_EXTRA_SEMI //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_GLOBAL_CONSTRUCTORS //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_HEADER_HYGIENE //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_EXIT_TIME_DESTRUCTORS //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_SWITCH_ENUM //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_MISSING_NORETURN //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_COVERED_SWITCH_DEFAULT //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_FLOAT_EQUAL //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_LONG_LONG //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_UNDEFINED_VAR_TEMPLATE //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_UNUSED_VARIABLE MAPNIK_DISABLE_WARNING(4101) + #define MAPNIK_DISABLE_MISMATCHED_TAGS //MAPNIK_DISABLE_WARNING(??) + #elif defined(__GNUC__) || defined(__clang__) -#define MAPNIK_DO_PRAGMA(X) _Pragma(#X) -#define MAPNIK_DISABLE_WARNING_PUSH MAPNIK_DO_PRAGMA(GCC diagnostic push) -#define MAPNIK_DISABLE_WARNING_POP MAPNIK_DO_PRAGMA(GCC diagnostic pop) -#define MAPNIK_DISABLE_WARNING(warningName) MAPNIK_DO_PRAGMA(GCC diagnostic ignored #warningName) -// add warnings to deactivate here -// example: #define DISABLE_WARNING_UNREFERENCED_FORMAL_PARAMETER DISABLE_WARNING(-Wunused-parameter) -#define MAPNIK_DISABLE_WARNING_UNKNOWN_PRAGMAS MAPNIK_DISABLE_WARNING(-Wunknown - pragmas) -#define MAPNIK_DISABLE_WARNING_PRAGMAS MAPNIK_DISABLE_WARNING(-Wpragmas) -#define MAPNIK_DISABLE_WARNING_PRAGMA_MESSAGES MAPNIK_DISABLE_WARNING(-W #pragma - messages) -#define MAPNIK_DISABLE_WARNING_UNSEQUENCED MAPNIK_DISABLE_WARNING(-Wunsequenced) -#define MAPNIK_DISABLE_WARNING_UNUSED_FUNCTION MAPNIK_DISABLE_WARNING(-Wunused - function) -#define MAPNIK_DISABLE_WARNING_UNUSED_PARAMETER MAPNIK_DISABLE_WARNING(-Wunused - parameter) -#define MAPNIK_DISABLE_WARNING_REDECLARED_CLASS_MEMBER MAPNIK_DISABLE_WARNING(-Wredeclared - class - member) -#define MAPNIK_DISABLE_WARNING_UNUSED_LOCAL_TYPEDEF MAPNIK_DISABLE_WARNING(-Wunused - local - typedef) -#define MAPNIK_DISABLE_WARNING_UNUSED_LOCAL_TYPEDEFS MAPNIK_DISABLE_WARNING(-Wunused - local - typedefs) -#define MAPNIK_DISABLE_WARNING_SHADOW MAPNIK_DISABLE_WARNING(-Wshadow) -#define MAPNIK_DISABLE_WARNING_CPP11_NARROWING MAPNIK_DISABLE_WARNING(-Wc++ 11 - narrowing) -#define MAPNIK_DISABLE_WARNING_SIGN_CONVERSION MAPNIK_DISABLE_WARNING(-Wsign - conversion) -#define MAPNIK_DISABLE_WARNING_SIGN_COMPARE MAPNIK_DISABLE_WARNING(-Wsign - compare) -#define MAPNIK_DISABLE_WARNING_CONVERSION MAPNIK_DISABLE_WARNING(-Wconversion) -#define MAPNIK_DISABLE_WARNING_CPP_98_COMPAT_PEDANTIC MAPNIK_DISABLE_WARNING(-Wc++ 98 - compat - pedantic) -#define MAPNIK_DISABLE_WARNING_DISABLE_MACRO_EXPANSION MAPNIK_DISABLE_WARNING(-Wdisabled - macro - expansion) -#define MAPNIK_DISABLE_WARNING_OLD_STYLE_CAST MAPNIK_DISABLE_WARNING(-Wold - style - cast) -#define MAPNIK_DISABLE_WARNING_DOCUMENTATION MAPNIK_DISABLE_WARNING(-Wdocumentation) -#define MAPNIK_DISABLE_WARNING_DOCUMENTATION_UNKNOWN_COMMAND MAPNIK_DISABLE_WARNING(-Wdocumentation - unknown - command) -#define MAPNIK_DISABLE_WARNING_UNDEF MAPNIK_DISABLE_WARNING(-Wundef) -#define MAPNIK_DISABLE_WARNING_DEPRECATED MAPNIK_DISABLE_WARNING(-Wdeprecated) -#define MAPNIK_DISABLE_WARNING_PADDED MAPNIK_DISABLE_WARNING(-Wpadded) -#define MAPNIK_DISABLE_WARNING_CPP_98_COMPAT MAPNIK_DISABLE_WARNING(-Wc++ 98 - compat) -#define MAPNIK_DISABLE_WARNING_RESERVED_ID_MACRO MAPNIK_DISABLE_WARNING(-Wreserved - id - macro) -#define MAPNIK_DISABLE_WARNING_WEAK_VTABLE MAPNIK_DISABLE_WARNING(-Wweak - vtables) -#define MAPNIK_DISABLE_WARNING_EXTRA_SEMI MAPNIK_DISABLE_WARNING(-Wextra - semi) -#define MAPNIK_DISABLE_WARNING_GLOBAL_CONSTRUCTORS MAPNIK_DISABLE_WARNING(-Wglobal - constructors) -#define MAPNIK_DISABLE_WARNING_HEADER_HYGIENE MAPNIK_DISABLE_WARNING(-Wheader - hygiene) -#define MAPNIK_DISABLE_WARNING_EXIT_TIME_DESTRUCTORS MAPNIK_DISABLE_WARNING(-Wexit - time - destructors) -#define MAPNIK_DISABLE_WARNING_SWITCH_ENUM MAPNIK_DISABLE_WARNING(-Wswitch - enum) -#define MAPNIK_DISABLE_WARNING_MISSING_NORETURN MAPNIK_DISABLE_WARNING(-Wmissing - noreturn) -#define MAPNIK_DISABLE_WARNING_COVERED_SWITCH_DEFAULT MAPNIK_DISABLE_WARNING(-Wcovered - switch - default) -#define MAPNIK_DISABLE_WARNING_FLOAT_EQUAL MAPNIK_DISABLE_WARNING(-Wfloat - equal) -#define MAPNIK_DISABLE_LONG_LONG MAPNIK_DISABLE_WARNING(-Wlong - long) -#define MAPNIK_DISABLE_UNDEFINED_VAR_TEMPLATE MAPNIK_DISABLE_WARNING(-Wundefined - var - template) -#define MAPNIK_DISABLE_UNUSED_VARIABLE MAPNIK_DISABLE_WARNING(-Wunused - variable) -#define MAPNIK_DISABLE_MISMATCHED_TAGS MAPNIK_DISABLE_WARNING(-Wmismatched - tags) + #define MAPNIK_DO_PRAGMA(X) _Pragma(#X) + #define MAPNIK_DISABLE_WARNING_PUSH MAPNIK_DO_PRAGMA(GCC diagnostic push) + #define MAPNIK_DISABLE_WARNING_POP MAPNIK_DO_PRAGMA(GCC diagnostic pop) + #define MAPNIK_DISABLE_WARNING(warningName) MAPNIK_DO_PRAGMA(GCC diagnostic ignored #warningName) + // add warnings to deactivate here + // example: #define DISABLE_WARNING_UNREFERENCED_FORMAL_PARAMETER DISABLE_WARNING(-Wunused-parameter) + #define MAPNIK_DISABLE_WARNING_UNKNOWN_PRAGMAS MAPNIK_DISABLE_WARNING(-Wunknown-pragmas) + #define MAPNIK_DISABLE_WARNING_PRAGMAS MAPNIK_DISABLE_WARNING(-Wpragmas) + #define MAPNIK_DISABLE_WARNING_PRAGMA_MESSAGES MAPNIK_DISABLE_WARNING(-W#pragma-messages) + #define MAPNIK_DISABLE_WARNING_UNSEQUENCED MAPNIK_DISABLE_WARNING(-Wunsequenced) + #define MAPNIK_DISABLE_WARNING_UNUSED_FUNCTION MAPNIK_DISABLE_WARNING(-Wunused-function) + #define MAPNIK_DISABLE_WARNING_UNUSED_PARAMETER MAPNIK_DISABLE_WARNING(-Wunused-parameter) + #define MAPNIK_DISABLE_WARNING_REDECLARED_CLASS_MEMBER MAPNIK_DISABLE_WARNING(-Wredeclared-class-member) + #define MAPNIK_DISABLE_WARNING_UNUSED_LOCAL_TYPEDEF MAPNIK_DISABLE_WARNING(-Wunused-local-typedef) + #define MAPNIK_DISABLE_WARNING_UNUSED_LOCAL_TYPEDEFS MAPNIK_DISABLE_WARNING(-Wunused-local-typedefs) + #define MAPNIK_DISABLE_WARNING_SHADOW MAPNIK_DISABLE_WARNING(-Wshadow) + #define MAPNIK_DISABLE_WARNING_CPP11_NARROWING MAPNIK_DISABLE_WARNING(-Wc++11-narrowing) + #define MAPNIK_DISABLE_WARNING_SIGN_CONVERSION MAPNIK_DISABLE_WARNING(-Wsign-conversion) + #define MAPNIK_DISABLE_WARNING_SIGN_COMPARE MAPNIK_DISABLE_WARNING(-Wsign-compare) + #define MAPNIK_DISABLE_WARNING_CONVERSION MAPNIK_DISABLE_WARNING(-Wconversion) + #define MAPNIK_DISABLE_WARNING_CPP_98_COMPAT_PEDANTIC MAPNIK_DISABLE_WARNING(-Wc++98-compat-pedantic) + #define MAPNIK_DISABLE_WARNING_DISABLE_MACRO_EXPANSION MAPNIK_DISABLE_WARNING(-Wdisabled-macro-expansion) + #define MAPNIK_DISABLE_WARNING_OLD_STYLE_CAST MAPNIK_DISABLE_WARNING(-Wold-style-cast) + #define MAPNIK_DISABLE_WARNING_DOCUMENTATION MAPNIK_DISABLE_WARNING(-Wdocumentation) + #define MAPNIK_DISABLE_WARNING_DOCUMENTATION_UNKNOWN_COMMAND MAPNIK_DISABLE_WARNING(-Wdocumentation-unknown-command) + #define MAPNIK_DISABLE_WARNING_UNDEF MAPNIK_DISABLE_WARNING(-Wundef) + #define MAPNIK_DISABLE_WARNING_DEPRECATED MAPNIK_DISABLE_WARNING(-Wdeprecated) + #define MAPNIK_DISABLE_WARNING_PADDED MAPNIK_DISABLE_WARNING(-Wpadded) + #define MAPNIK_DISABLE_WARNING_CPP_98_COMPAT MAPNIK_DISABLE_WARNING(-Wc++98-compat) + #define MAPNIK_DISABLE_WARNING_RESERVED_ID_MACRO MAPNIK_DISABLE_WARNING(-Wreserved-id-macro) + #define MAPNIK_DISABLE_WARNING_WEAK_VTABLE MAPNIK_DISABLE_WARNING(-Wweak-vtables) + #define MAPNIK_DISABLE_WARNING_EXTRA_SEMI MAPNIK_DISABLE_WARNING(-Wextra-semi) + #define MAPNIK_DISABLE_WARNING_GLOBAL_CONSTRUCTORS MAPNIK_DISABLE_WARNING(-Wglobal-constructors) + #define MAPNIK_DISABLE_WARNING_HEADER_HYGIENE MAPNIK_DISABLE_WARNING(-Wheader-hygiene) + #define MAPNIK_DISABLE_WARNING_EXIT_TIME_DESTRUCTORS MAPNIK_DISABLE_WARNING(-Wexit-time-destructors) + #define MAPNIK_DISABLE_WARNING_SWITCH_ENUM MAPNIK_DISABLE_WARNING(-Wswitch-enum) + #define MAPNIK_DISABLE_WARNING_MISSING_NORETURN MAPNIK_DISABLE_WARNING(-Wmissing-noreturn) + #define MAPNIK_DISABLE_WARNING_COVERED_SWITCH_DEFAULT MAPNIK_DISABLE_WARNING(-Wcovered-switch-default) + #define MAPNIK_DISABLE_WARNING_FLOAT_EQUAL MAPNIK_DISABLE_WARNING(-Wfloat-equal) + #define MAPNIK_DISABLE_LONG_LONG MAPNIK_DISABLE_WARNING(-Wlong-long) + #define MAPNIK_DISABLE_UNDEFINED_VAR_TEMPLATE MAPNIK_DISABLE_WARNING(-Wundefined-var-template) + #define MAPNIK_DISABLE_UNUSED_VARIABLE MAPNIK_DISABLE_WARNING(-Wunused-variable) + #define MAPNIK_DISABLE_MISMATCHED_TAGS MAPNIK_DISABLE_WARNING(-Wmismatched-tags) #else -#define MAPNIK_DISABLE_WARNING_PUSH -#define MAPNIK_DISABLE_WARNING_POP -// add all of the above warnings here (will be used if unknown compiler) -#define MAPNIK_DISABLE_WARNING_UNKNOWN_PRAGMAS -#define MAPNIK_DISABLE_WARNING_PRAGMAS -#define MAPNIK_DISABLE_WARNING_PRAGMA_MESSAGES -#define MAPNIK_DISABLE_WARNING_UNSEQUENCED -#define MAPNIK_DISABLE_WARNING_UNUSED_FUNCTION -#define MAPNIK_DISABLE_WARNING_UNUSED_PARAMETER -#define MAPNIK_DISABLE_WARNING_REDECLARED_CLASS_MEMBER -#define MAPNIK_DISABLE_WARNING_UNUSED_LOCAL_TYPEDEF -#define MAPNIK_DISABLE_WARNING_UNUSED_LOCAL_TYPEDEFS -#define MAPNIK_DISABLE_WARNING_SHADOW -#define MAPNIK_DISABLE_WARNING_CPP11_NARROWING -#define MAPNIK_DISABLE_WARNING_SIGN_CONVERSION -#define MAPNIK_DISABLE_WARNING_SIGN_COMPARE -#define MAPNIK_DISABLE_WARNING_CONVERSION -#define MAPNIK_DISABLE_WARNING_CPP_98_COMPAT_PEDANTIC -#define MAPNIK_DISABLE_WARNING_DISABLE_MACRO_EXPANSION -#define MAPNIK_DISABLE_WARNING_OLD_STYLE_CAST -#define MAPNIK_DISABLE_WARNING_DOCUMENTATION -#define MAPNIK_DISABLE_WARNING_DOCUMENTATION_UNKNOWN_COMMAND -#define MAPNIK_DISABLE_WARNING_UNDEF -#define MAPNIK_DISABLE_WARNING_DEPRECATED -#define MAPNIK_DISABLE_WARNING_PADDED -#define MAPNIK_DISABLE_WARNING_CPP_98_COMPAT -#define MAPNIK_DISABLE_WARNING_RESERVED_ID_MACRO -#define MAPNIK_DISABLE_WARNING_WEAK_VTABLE -#define MAPNIK_DISABLE_WARNING_EXTRA_SEMI -#define MAPNIK_DISABLE_WARNING_GLOBAL_CONSTRUCTORS -#define MAPNIK_DISABLE_WARNING_HEADER_HYGIENE -#define MAPNIK_DISABLE_WARNING_EXIT_TIME_DESTRUCTORS -#define MAPNIK_DISABLE_WARNING_SWITCH_ENUM -#define MAPNIK_DISABLE_WARNING_MISSING_NORETURN -#define MAPNIK_DISABLE_WARNING_COVERED_SWITCH_DEFAULT -#define MAPNIK_DISABLE_WARNING_FLOAT_EQUAL -#define MAPNIK_DISABLE_LONG_LONG -#define MAPNIK_DISABLE_UNDEFINED_VAR_TEMPLATE -#define MAPNIK_DISABLE_UNUSED_VARIABLE -#define MAPNIK_DISABLE_MISMATCHED_TAGS + #define MAPNIK_DISABLE_WARNING_PUSH + #define MAPNIK_DISABLE_WARNING_POP + // add all of the above warnings here (will be used if unknown compiler) + #define MAPNIK_DISABLE_WARNING_UNKNOWN_PRAGMAS + #define MAPNIK_DISABLE_WARNING_PRAGMAS + #define MAPNIK_DISABLE_WARNING_PRAGMA_MESSAGES + #define MAPNIK_DISABLE_WARNING_UNSEQUENCED + #define MAPNIK_DISABLE_WARNING_UNUSED_FUNCTION + #define MAPNIK_DISABLE_WARNING_UNUSED_PARAMETER + #define MAPNIK_DISABLE_WARNING_REDECLARED_CLASS_MEMBER + #define MAPNIK_DISABLE_WARNING_UNUSED_LOCAL_TYPEDEF + #define MAPNIK_DISABLE_WARNING_UNUSED_LOCAL_TYPEDEFS + #define MAPNIK_DISABLE_WARNING_SHADOW + #define MAPNIK_DISABLE_WARNING_CPP11_NARROWING + #define MAPNIK_DISABLE_WARNING_SIGN_CONVERSION + #define MAPNIK_DISABLE_WARNING_SIGN_COMPARE + #define MAPNIK_DISABLE_WARNING_CONVERSION + #define MAPNIK_DISABLE_WARNING_CPP_98_COMPAT_PEDANTIC + #define MAPNIK_DISABLE_WARNING_DISABLE_MACRO_EXPANSION + #define MAPNIK_DISABLE_WARNING_OLD_STYLE_CAST + #define MAPNIK_DISABLE_WARNING_DOCUMENTATION + #define MAPNIK_DISABLE_WARNING_DOCUMENTATION_UNKNOWN_COMMAND + #define MAPNIK_DISABLE_WARNING_UNDEF + #define MAPNIK_DISABLE_WARNING_DEPRECATED + #define MAPNIK_DISABLE_WARNING_PADDED + #define MAPNIK_DISABLE_WARNING_CPP_98_COMPAT + #define MAPNIK_DISABLE_WARNING_RESERVED_ID_MACRO + #define MAPNIK_DISABLE_WARNING_WEAK_VTABLE + #define MAPNIK_DISABLE_WARNING_EXTRA_SEMI + #define MAPNIK_DISABLE_WARNING_GLOBAL_CONSTRUCTORS + #define MAPNIK_DISABLE_WARNING_HEADER_HYGIENE + #define MAPNIK_DISABLE_WARNING_EXIT_TIME_DESTRUCTORS + #define MAPNIK_DISABLE_WARNING_SWITCH_ENUM + #define MAPNIK_DISABLE_WARNING_MISSING_NORETURN + #define MAPNIK_DISABLE_WARNING_COVERED_SWITCH_DEFAULT + #define MAPNIK_DISABLE_WARNING_FLOAT_EQUAL + #define MAPNIK_DISABLE_LONG_LONG + #define MAPNIK_DISABLE_UNDEFINED_VAR_TEMPLATE + #define MAPNIK_DISABLE_UNUSED_VARIABLE + #define MAPNIK_DISABLE_MISMATCHED_TAGS +#endif +// clang-format on #endif -#endif \ No newline at end of file diff --git a/plugins/input/CMakeLists.txt b/plugins/input/CMakeLists.txt index 2849b8766..b5167c84a 100644 --- a/plugins/input/CMakeLists.txt +++ b/plugins/input/CMakeLists.txt @@ -1,12 +1,31 @@ set(_plugin_prefix "") set(_plugin_suffix ".input") +set(_plugin_library_output "${MAPNIK_OUTPUT_DIR}/plugins/input") +set(_plugin_runtime_output "${MAPNIK_OUTPUT_DIR}") +set(_plugin_archive_output "${MAPNIK_OUTPUT_DIR}/lib") +set(_plugin_fpic ON) set(_plugin_linkage MODULE) -set(_plugin_source_visibility PRIVATE) +set(_plugin_visibility PRIVATE) if(MAPNIK_STATIC_PLUGINS) set(_plugin_linkage INTERFACE) set(_plugin_visibility INTERFACE) endif() +macro(add_plugin_target plugin_target output_name) + add_library(${plugin_target} ${_plugin_linkage}) + set_target_properties(${plugin_target} PROPERTIES + OUTPUT_NAME "${output_name}" + POSITION_INDEPENDENT_CODE ${_plugin_fpic} + PREFIX "${_plugin_prefix}" + SUFFIX "${_plugin_suffix}" + LIBRARY_OUTPUT_DIRECTORY "${_plugin_library_output}" + RUNTIME_OUTPUT_DIRECTORY "${_plugin_runtime_output}" + ARCHIVE_OUTPUT_DIRECTORY "${_plugin_archive_output}" + ) + mapnik_install_plugin(${plugin_target}) +endmacro() + + add_subdirectory(base) # add a list with all build plugins so the copy dependencies command can wait for all build events diff --git a/plugins/input/base/CMakeLists.txt b/plugins/input/base/CMakeLists.txt index 1dca6a808..2e080bd29 100644 --- a/plugins/input/base/CMakeLists.txt +++ b/plugins/input/base/CMakeLists.txt @@ -9,3 +9,4 @@ target_include_directories(datasource-base INTERFACE target_link_libraries(datasource-base INTERFACE mapnik::core) mapnik_install(datasource-base) +install(DIRECTORY include/ DESTINATION "${MAPNIK_INCLUDE_DIR}") diff --git a/plugins/input/base/include/mapnik/datasource_plugin.hpp b/plugins/input/base/include/mapnik/datasource_plugin.hpp index cbff13d96..32d67dcfa 100644 --- a/plugins/input/base/include/mapnik/datasource_plugin.hpp +++ b/plugins/input/base/include/mapnik/datasource_plugin.hpp @@ -1,17 +1,18 @@ #ifndef DATASOURCE_PLUGIN_HPP #define DATASOURCE_PLUGIN_HPP #include -#include #include +#include namespace mapnik { class MAPNIK_DECL datasource_plugin { public: - datasource_plugin() {} - virtual ~datasource_plugin() {} - virtual void init_once() const = 0; - virtual const std::string& name() const = 0; + datasource_plugin() = default; + virtual ~datasource_plugin() = default; + virtual void after_load() const = 0; + virtual void before_unload() const = 0; + virtual const char* name() const = 0; virtual datasource_ptr create(parameters const& params) const = 0; }; } // namespace mapnik @@ -21,20 +22,23 @@ class MAPNIK_DECL datasource_plugin { \ public: \ static constexpr const char* kName = #pluginname; \ - void init_once() const override; \ - const std::string& name() const override; \ + void after_load() const override; \ + void before_unload() const override; \ + const char* name() const override; \ mapnik::datasource_ptr create(mapnik::parameters const& params) const override; \ }; #define DATASOURCE_PLUGIN_IMPL(classname, pluginclassname) \ - const std::string& classname::name() const { return kName; } \ + const char* classname::name() const { return kName; } \ mapnik::datasource_ptr classname::create(mapnik::parameters const& params) const \ { \ return std::make_shared(params); \ } -#define DATASOURCE_PLUGIN_EMPTY_INIT(classname) \ - void classname::init_once() const {} +#define DATASOURCE_PLUGIN_EMPTY_AFTER_LOAD(classname) \ + void classname::after_load() const {} +#define DATASOURCE_PLUGIN_EMPTY_BEFORE_UNLOAD(classname) \ + void classname::before_unload() const {} #ifndef MAPNIK_STATIC_PLUGINS #define DATASOURCE_PLUGIN_EXPORT(classname) \ diff --git a/plugins/input/csv/CMakeLists.txt b/plugins/input/csv/CMakeLists.txt index b5a89f0b2..9d9d028b9 100644 --- a/plugins/input/csv/CMakeLists.txt +++ b/plugins/input/csv/CMakeLists.txt @@ -1,4 +1,5 @@ -add_library(input-csv ${_plugin_linkage}) +add_plugin_target(input-csv "csv") + target_sources(input-csv ${_plugin_visibility} csv_datasource.cpp csv_featureset.cpp @@ -12,12 +13,3 @@ target_link_libraries(input-csv ${_plugin_visibility} mapnik::json mapnik::datasource-base ) -set_target_properties(input-csv PROPERTIES - OUTPUT_NAME "csv" - PREFIX "${_plugin_prefix}" - SUFFIX "${_plugin_suffix}" - LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/plugins/input" - RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" - ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" -) -mapnik_install_plugin(input-csv) diff --git a/plugins/input/csv/csv_datasource.cpp b/plugins/input/csv/csv_datasource.cpp index 2ce50efeb..ee752110b 100644 --- a/plugins/input/csv/csv_datasource.cpp +++ b/plugins/input/csv/csv_datasource.cpp @@ -67,7 +67,8 @@ using mapnik::parameters; DATASOURCE_PLUGIN_IMPL(csv_datasource_plugin, csv_datasource); DATASOURCE_PLUGIN_EXPORT(csv_datasource_plugin); -DATASOURCE_PLUGIN_EMPTY_INIT(csv_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_AFTER_LOAD(csv_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_BEFORE_UNLOAD(csv_datasource_plugin); csv_datasource::csv_datasource(parameters const& params) : datasource(params) diff --git a/plugins/input/gdal/CMakeLists.txt b/plugins/input/gdal/CMakeLists.txt index 2db11e1c9..c6ae1f633 100644 --- a/plugins/input/gdal/CMakeLists.txt +++ b/plugins/input/gdal/CMakeLists.txt @@ -1,6 +1,6 @@ find_package(GDAL REQUIRED) -add_library(input-gdal ${_plugin_linkage}) +add_plugin_target(input-gdal "gdal") target_sources(input-gdal ${_plugin_visibility} gdal_datasource.cpp gdal_featureset.cpp @@ -11,12 +11,4 @@ target_link_libraries(input-gdal ${_plugin_visibility} mapnik::datasource-base ${GDAL_LIBRARIES} ) -set_target_properties(input-gdal PROPERTIES - OUTPUT_NAME "gdal" - PREFIX "${_plugin_prefix}" - SUFFIX "${_plugin_suffix}" - LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/plugins/input" - RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" - ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" -) -mapnik_install_plugin(input-gdal) + diff --git a/plugins/input/gdal/gdal_datasource.cpp b/plugins/input/gdal/gdal_datasource.cpp index dbfe90cbd..f86e17361 100644 --- a/plugins/input/gdal/gdal_datasource.cpp +++ b/plugins/input/gdal/gdal_datasource.cpp @@ -44,13 +44,16 @@ using mapnik::featureset_ptr; using mapnik::layer_descriptor; using mapnik::query; -static std::once_flag once_flag; - DATASOURCE_PLUGIN_IMPL(gdal_datasource_plugin, gdal_datasource); DATASOURCE_PLUGIN_EXPORT(gdal_datasource_plugin); -void gdal_datasource_plugin::init_once() const +void gdal_datasource_plugin::after_load() const { - std::call_once(once_flag, []() { GDALAllRegister(); }); + GDALAllRegister(); +} + +void gdal_datasource_plugin::before_unload() const +{ + GDALDestroyDriverManager(); } gdal_datasource::gdal_datasource(parameters const& params) diff --git a/plugins/input/geobuf/CMakeLists.txt b/plugins/input/geobuf/CMakeLists.txt index 57447fbed..4bd67c6e4 100644 --- a/plugins/input/geobuf/CMakeLists.txt +++ b/plugins/input/geobuf/CMakeLists.txt @@ -1,4 +1,5 @@ -add_library(input-geobuf ${_plugin_linkage}) +add_plugin_target(input-geobuf "geobuf") + target_sources(input-geobuf ${_plugin_visibility} geobuf_datasource.cpp geobuf_featureset.cpp @@ -7,12 +8,4 @@ target_link_libraries(input-geobuf ${_plugin_visibility} mapnik::mapnik mapnik::datasource-base ) -set_target_properties(input-geobuf PROPERTIES - OUTPUT_NAME "geobuf" - PREFIX "${_plugin_prefix}" - SUFFIX "${_plugin_suffix}" - LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/plugins/input" - RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" - ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" -) -mapnik_install_plugin(input-geobuf) + diff --git a/plugins/input/geobuf/geobuf_datasource.cpp b/plugins/input/geobuf/geobuf_datasource.cpp index 8945538c3..48eafa299 100644 --- a/plugins/input/geobuf/geobuf_datasource.cpp +++ b/plugins/input/geobuf/geobuf_datasource.cpp @@ -50,7 +50,8 @@ using mapnik::parameters; DATASOURCE_PLUGIN_IMPL(geobuf_datasource_plugin, geobuf_datasource); DATASOURCE_PLUGIN_EXPORT(geobuf_datasource_plugin); -DATASOURCE_PLUGIN_EMPTY_INIT(geobuf_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_AFTER_LOAD(geobuf_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_BEFORE_UNLOAD(geobuf_datasource_plugin); struct attr_value_converter { diff --git a/plugins/input/geojson/CMakeLists.txt b/plugins/input/geojson/CMakeLists.txt index 967f47820..cf86e73d5 100644 --- a/plugins/input/geojson/CMakeLists.txt +++ b/plugins/input/geojson/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(input-geojson ${_plugin_linkage}) +add_plugin_target(input-geojson "geojson") target_sources(input-geojson ${_plugin_visibility} geojson_datasource.cpp geojson_featureset.cpp @@ -10,12 +10,3 @@ target_link_libraries(input-geojson ${_plugin_visibility} mapnik::json mapnik::datasource-base ) -set_target_properties(input-geojson PROPERTIES - OUTPUT_NAME "geojson" - PREFIX "${_plugin_prefix}" - SUFFIX "${_plugin_suffix}" - LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/plugins/input" - RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" - ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" -) -mapnik_install_plugin(input-geojson) diff --git a/plugins/input/geojson/geojson_datasource.cpp b/plugins/input/geojson/geojson_datasource.cpp index 98a4ff899..84b63f5d4 100644 --- a/plugins/input/geojson/geojson_datasource.cpp +++ b/plugins/input/geojson/geojson_datasource.cpp @@ -69,7 +69,8 @@ using mapnik::parameters; DATASOURCE_PLUGIN_IMPL(geojson_datasource_plugin, geojson_datasource); DATASOURCE_PLUGIN_EXPORT(geojson_datasource_plugin); -DATASOURCE_PLUGIN_EMPTY_INIT(geojson_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_AFTER_LOAD(geojson_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_BEFORE_UNLOAD(geojson_datasource_plugin); struct attr_value_converter { diff --git a/plugins/input/ogr/CMakeLists.txt b/plugins/input/ogr/CMakeLists.txt index f6e562181..0034d4684 100644 --- a/plugins/input/ogr/CMakeLists.txt +++ b/plugins/input/ogr/CMakeLists.txt @@ -1,6 +1,6 @@ find_package(GDAL REQUIRED) -add_library(input-ogr ${_plugin_linkage}) +add_plugin_target(input-ogr "ogr") target_sources(input-ogr ${_plugin_visibility} ogr_converter.cpp ogr_datasource.cpp @@ -13,12 +13,3 @@ target_link_libraries(input-ogr ${_plugin_visibility} mapnik::datasource-base ${GDAL_LIBRARIES} ) -set_target_properties(input-ogr PROPERTIES - OUTPUT_NAME "ogr" - PREFIX "${_plugin_prefix}" - SUFFIX "${_plugin_suffix}" - LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/plugins/input" - RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" - ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" -) -mapnik_install_plugin(input-ogr) diff --git a/plugins/input/ogr/ogr_datasource.cpp b/plugins/input/ogr/ogr_datasource.cpp index 5acf30c6b..2e4cad22e 100644 --- a/plugins/input/ogr/ogr_datasource.cpp +++ b/plugins/input/ogr/ogr_datasource.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include MAPNIK_DISABLE_WARNING_PUSH @@ -49,8 +50,6 @@ MAPNIK_DISABLE_WARNING_POP using mapnik::datasource; using mapnik::parameters; -DATASOURCE_PLUGIN(ogr_datasource) - using mapnik::attribute_descriptor; using mapnik::box2d; using mapnik::coord2d; @@ -65,11 +64,19 @@ static std::once_flag once_flag; DATASOURCE_PLUGIN_IMPL(ogr_datasource_plugin, ogr_datasource); DATASOURCE_PLUGIN_EXPORT(ogr_datasource_plugin); -void ogr_datasource_plugin::init_once() const + +void ogr_datasource_plugin::after_load() const { // initialize ogr formats // NOTE: in GDAL >= 2.0 this is the same as GDALAllRegister() - std::call_once(once_flag, []() { OGRRegisterAll(); }); + OGRRegisterAll(); +} + +void ogr_datasource_plugin::before_unload() const +{ + // initialize ogr formats + // NOTE: in GDAL >= 2.0 this is the same as GDALDestroyDriverManager() + OGRCleanupAll(); } ogr_datasource::ogr_datasource(parameters const& params) diff --git a/plugins/input/pgraster/CMakeLists.txt b/plugins/input/pgraster/CMakeLists.txt index 4a570502d..7458a4420 100644 --- a/plugins/input/pgraster/CMakeLists.txt +++ b/plugins/input/pgraster/CMakeLists.txt @@ -1,6 +1,6 @@ find_package(PostgreSQL REQUIRED) -add_library(input-pgraster ${_plugin_linkage}) +add_plugin_target(input-pgraster "pgraster") target_sources(input-pgraster ${_plugin_visibility} pgraster_datasource.cpp pgraster_featureset.cpp @@ -11,12 +11,3 @@ target_link_libraries(input-pgraster ${_plugin_visibility} mapnik::datasource-base PostgreSQL::PostgreSQL ) -set_target_properties(input-pgraster PROPERTIES - OUTPUT_NAME "pgraster" - PREFIX "${_plugin_prefix}" - SUFFIX "${_plugin_suffix}" - LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/plugins/input" - RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" - ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" -) -mapnik_install_plugin(input-pgraster) diff --git a/plugins/input/pgraster/pgraster_datasource.cpp b/plugins/input/pgraster/pgraster_datasource.cpp index 62acc1ebc..9ee183703 100644 --- a/plugins/input/pgraster/pgraster_datasource.cpp +++ b/plugins/input/pgraster/pgraster_datasource.cpp @@ -53,7 +53,9 @@ MAPNIK_DISABLE_WARNING_POP DATASOURCE_PLUGIN_IMPL(pgraster_datasource_plugin, pgraster_datasource); DATASOURCE_PLUGIN_EXPORT(pgraster_datasource_plugin); -DATASOURCE_PLUGIN_EMPTY_INIT(pgraster_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_AFTER_LOAD(pgraster_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_BEFORE_UNLOAD(pgraster_datasource_plugin); + const std::string pgraster_datasource::RASTER_COLUMNS = "raster_columns"; const std::string pgraster_datasource::RASTER_OVERVIEWS = "raster_overviews"; diff --git a/plugins/input/postgis/CMakeLists.txt b/plugins/input/postgis/CMakeLists.txt index 7e7061b7a..93346d6e4 100644 --- a/plugins/input/postgis/CMakeLists.txt +++ b/plugins/input/postgis/CMakeLists.txt @@ -1,6 +1,6 @@ find_package(PostgreSQL REQUIRED) -add_library(input-postgis ${_plugin_linkage}) +add_plugin_target(input-postgis "postgis") target_sources(input-postgis ${_plugin_visibility} postgis_datasource.cpp postgis_featureset.cpp @@ -10,12 +10,3 @@ target_link_libraries(input-postgis ${_plugin_visibility} mapnik::datasource-base PostgreSQL::PostgreSQL ) -set_target_properties(input-postgis PROPERTIES - OUTPUT_NAME "postgis" - PREFIX "${_plugin_prefix}" - SUFFIX "${_plugin_suffix}" - LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/plugins/input" - RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" - ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" -) -mapnik_install_plugin(input-postgis) diff --git a/plugins/input/postgis/postgis_datasource.cpp b/plugins/input/postgis/postgis_datasource.cpp index f33ac5763..24965f0da 100644 --- a/plugins/input/postgis/postgis_datasource.cpp +++ b/plugins/input/postgis/postgis_datasource.cpp @@ -50,7 +50,8 @@ MAPNIK_DISABLE_WARNING_POP DATASOURCE_PLUGIN_IMPL(postgis_datasource_plugin, postgis_datasource); DATASOURCE_PLUGIN_EXPORT(postgis_datasource_plugin); -DATASOURCE_PLUGIN_EMPTY_INIT(postgis_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_AFTER_LOAD(postgis_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_BEFORE_UNLOAD(postgis_datasource_plugin); const std::string postgis_datasource::GEOMETRY_COLUMNS = "geometry_columns"; const std::string postgis_datasource::SPATIAL_REF_SYS = "spatial_ref_system"; diff --git a/plugins/input/raster/CMakeLists.txt b/plugins/input/raster/CMakeLists.txt index c9f12d9e6..5adca0106 100644 --- a/plugins/input/raster/CMakeLists.txt +++ b/plugins/input/raster/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(input-raster ${_plugin_linkage}) +add_plugin_target(input-raster "raster") target_sources(input-raster ${_plugin_visibility} raster_datasource.cpp raster_featureset.cpp @@ -8,12 +8,3 @@ target_link_libraries(input-raster ${_plugin_visibility} mapnik::mapnik mapnik::datasource-base ) -set_target_properties(input-raster PROPERTIES - OUTPUT_NAME "raster" - PREFIX "${_plugin_prefix}" - SUFFIX "${_plugin_suffix}" - LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/plugins/input" - RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" - ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" -) -mapnik_install_plugin(input-raster) diff --git a/plugins/input/raster/raster_datasource.cpp b/plugins/input/raster/raster_datasource.cpp index 88d7c68f2..bf50c529d 100644 --- a/plugins/input/raster/raster_datasource.cpp +++ b/plugins/input/raster/raster_datasource.cpp @@ -45,7 +45,8 @@ using mapnik::query; DATASOURCE_PLUGIN_IMPL(raster_datasource_plugin, raster_datasource); DATASOURCE_PLUGIN_EXPORT(raster_datasource_plugin); -DATASOURCE_PLUGIN_EMPTY_INIT(raster_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_AFTER_LOAD(raster_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_BEFORE_UNLOAD(raster_datasource_plugin); raster_datasource::raster_datasource(parameters const& params) : datasource(params) diff --git a/plugins/input/shape/CMakeLists.txt b/plugins/input/shape/CMakeLists.txt index 2cd86cdac..695312b23 100644 --- a/plugins/input/shape/CMakeLists.txt +++ b/plugins/input/shape/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(input-shape ${_plugin_linkage}) +add_plugin_target(input-shape "shape") target_sources(input-shape ${_plugin_visibility} dbfile.cpp dbf_test.cpp @@ -11,12 +11,3 @@ target_link_libraries(input-shape ${_plugin_visibility} mapnik::mapnik mapnik::datasource-base ) -set_target_properties(input-shape PROPERTIES - OUTPUT_NAME "shape" - PREFIX "${_plugin_prefix}" - SUFFIX "${_plugin_suffix}" - LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/plugins/input" - RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" - ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" -) -mapnik_install_plugin(input-shape) diff --git a/plugins/input/shape/shape_datasource.cpp b/plugins/input/shape/shape_datasource.cpp index 0ad264584..cff910796 100644 --- a/plugins/input/shape/shape_datasource.cpp +++ b/plugins/input/shape/shape_datasource.cpp @@ -49,7 +49,8 @@ MAPNIK_DISABLE_WARNING_POP DATASOURCE_PLUGIN_IMPL(shape_datasource_plugin, shape_datasource); DATASOURCE_PLUGIN_EXPORT(shape_datasource_plugin); -DATASOURCE_PLUGIN_EMPTY_INIT(shape_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_AFTER_LOAD(shape_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_BEFORE_UNLOAD(shape_datasource_plugin); using mapnik::attribute_descriptor; using mapnik::Boolean; diff --git a/plugins/input/sqlite/CMakeLists.txt b/plugins/input/sqlite/CMakeLists.txt index d690db4fa..d3e9bc821 100644 --- a/plugins/input/sqlite/CMakeLists.txt +++ b/plugins/input/sqlite/CMakeLists.txt @@ -1,6 +1,6 @@ find_package(SQLite3 REQUIRED) -add_library(input-sqlite ${_plugin_linkage}) +add_plugin_target(input-sqlite "sqlite") target_sources(input-sqlite ${_plugin_visibility} sqlite_datasource.cpp sqlite_featureset.cpp @@ -10,12 +10,3 @@ target_link_libraries(input-sqlite ${_plugin_visibility} mapnik::datasource-base SQLite::SQLite3 ) -set_target_properties(input-sqlite PROPERTIES - OUTPUT_NAME "sqlite" - PREFIX "${_plugin_prefix}" - SUFFIX "${_plugin_suffix}" - LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/plugins/input" - RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" - ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" -) -mapnik_install_plugin(input-sqlite) diff --git a/plugins/input/sqlite/sqlite_datasource.cpp b/plugins/input/sqlite/sqlite_datasource.cpp index ace3039b8..71a55a2eb 100644 --- a/plugins/input/sqlite/sqlite_datasource.cpp +++ b/plugins/input/sqlite/sqlite_datasource.cpp @@ -52,7 +52,8 @@ using mapnik::query; DATASOURCE_PLUGIN_IMPL(sqlite_datasource_plugin, sqlite_datasource); DATASOURCE_PLUGIN_EXPORT(sqlite_datasource_plugin); -DATASOURCE_PLUGIN_EMPTY_INIT(sqlite_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_AFTER_LOAD(sqlite_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_BEFORE_UNLOAD(sqlite_datasource_plugin); sqlite_datasource::sqlite_datasource(parameters const& params) : datasource(params) diff --git a/plugins/input/topojson/CMakeLists.txt b/plugins/input/topojson/CMakeLists.txt index 4b8fd3153..03f885e44 100644 --- a/plugins/input/topojson/CMakeLists.txt +++ b/plugins/input/topojson/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(input-topojson ${_plugin_linkage}) +add_plugin_target(input-topojson "topojson") target_sources(input-topojson ${_plugin_visibility} topojson_datasource.cpp topojson_featureset.cpp @@ -8,12 +8,3 @@ target_link_libraries(input-topojson ${_plugin_visibility} mapnik::json mapnik::datasource-base ) -set_target_properties(input-topojson PROPERTIES - OUTPUT_NAME "topojson" - PREFIX "${_plugin_prefix}" - SUFFIX "${_plugin_suffix}" - LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/plugins/input" - RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" - ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" -) -mapnik_install_plugin(input-topojson) diff --git a/plugins/input/topojson/topojson_datasource.cpp b/plugins/input/topojson/topojson_datasource.cpp index 1d10e33f6..8dec2f387 100644 --- a/plugins/input/topojson/topojson_datasource.cpp +++ b/plugins/input/topojson/topojson_datasource.cpp @@ -44,7 +44,8 @@ using mapnik::parameters; DATASOURCE_PLUGIN_IMPL(topojson_datasource_plugin, topojson_datasource); DATASOURCE_PLUGIN_EXPORT(topojson_datasource_plugin); -DATASOURCE_PLUGIN_EMPTY_INIT(topojson_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_AFTER_LOAD(topojson_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_BEFORE_UNLOAD(topojson_datasource_plugin); struct attr_value_converter { diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2c86112cb..9fe5da903 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -43,6 +43,7 @@ if(MAPNIK_STATIC_PLUGINS) endif() set_target_properties(mapnik PROPERTIES + POSITION_INDEPENDENT_CODE ON DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}" OUTPUT_NAME "mapnik" PREFIX "lib" @@ -106,6 +107,7 @@ target_sources(mapnik PRIVATE layer.cpp load_map.cpp map.cpp + mapnik.cpp mapped_memory_cache.cpp marker_cache.cpp marker_helpers.cpp diff --git a/src/create_image_reader.hpp b/src/create_image_reader.hpp new file mode 100644 index 000000000..184b4eb13 --- /dev/null +++ b/src/create_image_reader.hpp @@ -0,0 +1,19 @@ +#ifndef MAPNIK_CREATE_IMAGE_READER_HPP +#define MAPNIK_CREATE_IMAGE_READER_HPP + +namespace mapnik { +#ifdef HAVE_JPEG +void register_jpeg_reader(); +#endif +#ifdef HAVE_PNG +void register_png_reader(); +#endif +#ifdef HAVE_TIFF +void register_tiff_reader(); +#endif +#ifdef HAVE_WEBP +void register_webp_reader(); +#endif +} // namespace mapnik + +#endif diff --git a/src/datasource_cache.cpp b/src/datasource_cache.cpp index 4b08a2b7c..28ae3a12d 100644 --- a/src/datasource_cache.cpp +++ b/src/datasource_cache.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -71,11 +72,9 @@ datasource_ptr datasource_cache::create(parameters const& params) throw config_error(std::string("Could not create datasource. Required ") + "parameter 'type' is missing"); } - datasource_ptr ds; - #ifdef MAPNIK_STATIC_PLUGINS // return if it's created, raise otherwise - ds = create_static_datasource(params); + datasource_ptr ds = create_static_datasource(params); if (ds) { return ds; @@ -114,16 +113,14 @@ datasource_ptr datasource_cache::create(parameters const& params) #ifdef __GNUC__ __extension__ #endif - create_ds create_datasource = reinterpret_cast(itr->second->get_symbol("create")); + datasource_plugin* create_datasource = reinterpret_cast(itr->second->get_symbol("plugin")); if (!create_datasource) { throw std::runtime_error(std::string("Cannot load symbols: ") + itr->second->get_error()); } - ds = datasource_ptr(create_datasource(params), datasource_deleter()); - - return ds; + return create_datasource->create(params); } std::string datasource_cache::plugin_directories() diff --git a/src/datasource_cache_static.cpp b/src/datasource_cache_static.cpp index 98a75998b..0577404a0 100644 --- a/src/datasource_cache_static.cpp +++ b/src/datasource_cache_static.cpp @@ -33,11 +33,6 @@ #include #include -#define REGISTER_STATIC_DATASOURCE_PLUGIN(classname) \ - { \ - std::string{classname::kName}, std::make_shared() \ - } - // static plugin linkage #ifdef MAPNIK_STATIC_PLUGINS #if defined(MAPNIK_STATIC_PLUGIN_CSV) @@ -90,9 +85,12 @@ #endif #endif +#define REGISTER_STATIC_DATASOURCE_PLUGIN(classname) \ + ds_map.emplace(std::string{classname::kName}, std::make_shared()) namespace mapnik { #ifdef MAPNIK_STATIC_PLUGINS + template datasource_ptr ds_generator(parameters const& params) { @@ -102,54 +100,54 @@ datasource_ptr ds_generator(parameters const& params) typedef datasource_ptr (*ds_generator_ptr)(parameters const& params); using datasource_map = std::unordered_map>; -static datasource_map ds_map +static datasource_map ds_map{}; + +void init_datasource_cache_static() { #if defined(MAPNIK_STATIC_PLUGIN_CSV) - REGISTER_STATIC_DATASOURCE_PLUGIN(csv_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(csv_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_GDAL) - REGISTER_STATIC_DATASOURCE_PLUGIN(gdal_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(gdal_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_GEOBUF) - REGISTER_STATIC_DATASOURCE_PLUGIN(geobuf_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(geobuf_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_GEOJSON) - REGISTER_STATIC_DATASOURCE_PLUGIN(geojson_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(geojson_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_OCCI) - REGISTER_STATIC_DATASOURCE_PLUGIN(occi_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(occi_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_OGR) - REGISTER_STATIC_DATASOURCE_PLUGIN(ogr_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(ogr_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_PGRASTER) - REGISTER_STATIC_DATASOURCE_PLUGIN(pgraster_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(pgraster_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_OSM) - REGISTER_STATIC_DATASOURCE_PLUGIN(osm_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(osm_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_POSTGIS) - REGISTER_STATIC_DATASOURCE_PLUGIN(postgis_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(postgis_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_RASTER) - REGISTER_STATIC_DATASOURCE_PLUGIN(raster_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(raster_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_RASTERLITE) - REGISTER_STATIC_DATASOURCE_PLUGIN(rasterlite_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(rasterlite_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_SHAPE) - REGISTER_STATIC_DATASOURCE_PLUGIN(shape_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(shape_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_SQLITE) - REGISTER_STATIC_DATASOURCE_PLUGIN(sqlite_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(sqlite_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_TOPOJSON) - REGISTER_STATIC_DATASOURCE_PLUGIN(topojson_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(topojson_datasource_plugin); #endif }; -#endif -#ifdef MAPNIK_STATIC_PLUGINS datasource_ptr create_static_datasource(parameters const& params) { datasource_ptr ds; diff --git a/src/jpeg_reader.cpp b/src/jpeg_reader.cpp index ff704f691..1e14acb59 100644 --- a/src/jpeg_reader.cpp +++ b/src/jpeg_reader.cpp @@ -91,7 +91,6 @@ class jpeg_reader : public image_reader static void attach_stream(j_decompress_ptr cinfo, input_stream* in); }; -namespace { image_reader* create_jpeg_reader(std::string const& filename) { return new jpeg_reader(filename); @@ -101,10 +100,11 @@ image_reader* create_jpeg_reader2(char const* data, size_t size) { return new jpeg_reader(data, size); } - -const bool registered = register_image_reader("jpeg", create_jpeg_reader); -const bool registered2 = register_image_reader("jpeg", create_jpeg_reader2); -} // namespace +void register_jpeg_reader() +{ + const bool registered = register_image_reader("jpeg", create_jpeg_reader); + const bool registered2 = register_image_reader("jpeg", create_jpeg_reader2); +} // ctors template diff --git a/src/mapnik.cpp b/src/mapnik.cpp new file mode 100644 index 000000000..0a9630ea9 --- /dev/null +++ b/src/mapnik.cpp @@ -0,0 +1,41 @@ +#include +#include // call once +#include "create_image_reader.hpp" +namespace mapnik { + +static void setup_once(); + +void setup() +{ + static std::once_flag init_flag; + std::call_once(init_flag, setup_once); +} +#ifdef MAPNIK_STATIC_PLUGINS +extern void init_datasource_cache_static(); +#endif +static void register_image_readers(); + +void setup_once() +{ +#ifdef MAPNIK_STATIC_PLUGINS + init_datasource_cache_static(); // defined in datasource_cache_static.cpp +#endif + register_image_readers(); +} + +void register_image_readers() +{ +#ifdef HAVE_JPEG + register_jpeg_reader(); +#endif +#ifdef HAVE_PNG + register_png_reader(); +#endif +#ifdef HAVE_TIFF + register_tiff_reader(); +#endif +#ifdef HAVE_WEBP + register_webp_reader(); +#endif +} +} // namespace mapnik diff --git a/src/memory_datasource.cpp b/src/memory_datasource.cpp index eee058be6..605f36ec6 100644 --- a/src/memory_datasource.cpp +++ b/src/memory_datasource.cpp @@ -35,10 +35,15 @@ using mapnik::datasource; using mapnik::parameters; -DATASOURCE_PLUGIN(mapnik::memory_datasource) + +DATASOURCE_PLUGIN_EXPORT(mapnik::memory_datasource_plugin) namespace mapnik { +DATASOURCE_PLUGIN_IMPL(memory_datasource_plugin, memory_datasource); +DATASOURCE_PLUGIN_EMPTY_AFTER_LOAD(memory_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_BEFORE_UNLOAD(memory_datasource_plugin); + struct accumulate_extent { accumulate_extent(box2d& ext) @@ -67,7 +72,7 @@ struct accumulate_extent const char* memory_datasource::name() { - return "memory"; + return mapnik::memory_datasource_plugin::kName; } memory_datasource::memory_datasource(parameters const& _params) diff --git a/src/plugin.cpp b/src/plugin.cpp index e268fd999..f16f46499 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -47,51 +47,13 @@ namespace mapnik { struct _mapnik_lib_t { + std::string name; handle dl; -}; - -PluginInfo::PluginInfo(std::string const& filename, std::string const& library_name) - : filename_(filename) - , name_() - , module_(new mapnik_lib_t) -{ -#ifdef _WIN32 - if (module_) - module_->dl = LoadLibraryA(filename.c_str()); - if (module_ && module_->dl) - { - datasource_plugin* plugin = reinterpret_cast(dlsym(module_->dl, "plugin")); - if (!plugin) - throw std::runtime_error("plugin has a false interface"); //! todo: better error text - name_ = plugin->name(); - plugin->init_once(); - } -#else -#ifdef MAPNIK_HAS_DLCFN - if (module_) - module_->dl = dlopen(filename.c_str(), RTLD_LAZY); - if (module_ && module_->dl) - { - callable_returning_string name_call = - reinterpret_cast(dlsym(module_->dl, library_name.c_str())); - if (name_call) - name_ = name_call(); - callable_returning_void init_once = - reinterpret_cast(dlsym(module_->dl, "on_plugin_load")); - if (init_once) - { - init_once(); - } - } -#else - throw std::runtime_error("no support for loading dynamic objects (Mapnik not compiled with -DMAPNIK_HAS_DLCFN)"); -#endif -#endif -} - -PluginInfo::~PluginInfo() -{ - if (module_) + _mapnik_lib_t() + : name{"unknown"} + , dl{0} + {} + ~_mapnik_lib_t() { #ifdef MAPNIK_SUPPORTS_DLOPEN /* @@ -105,17 +67,46 @@ PluginInfo::~PluginInfo() in the case that gdal is linked as a shared library. This workaround therefore prevents crashes with gdal 1.11.x and gdal 2.x when using a static libgdal. */ - if (module_->dl && name_ != "gdal" && name_ != "ogr") + if (dl /*&& name_ != "gdal" && name_ != "ogr"*/) // is the gdal issue sill present? We are now + // unregister all drivers for ogal and gdal (todo: + // before_unload call) { #ifndef MAPNIK_NO_DLCLOSE - dlclose(module_->dl), module_->dl = 0; + dlclose(dl); + dl = 0; #endif } #endif - delete module_; } +}; + +PluginInfo::PluginInfo(std::string const& filename, std::string const& library_name) + : filename_(filename) + , module_{std::make_unique()} +{ +#if defined(_WIN32) + if (module_) + module_->dl = LoadLibraryA(filename.c_str()); +#elif defined(MAPNIK_HAS_DLCFN) + if (module_) + module_->dl = dlopen(filename.c_str(), RTLD_LAZY); +#else + throw std::runtime_error("no support for loading dynamic objects (Mapnik not compiled with -DMAPNIK_HAS_DLCFN)"); +#endif +#if defined(MAPNIK_HAS_DLCFN) || defined(_WIN32) + if (module_ && module_->dl) + { + datasource_plugin* plugin{reinterpret_cast(get_symbol("plugin"))}; + if (!plugin) + throw std::runtime_error("plugin has a false interface"); //! todo: better error text + module_->name = plugin->name(); + plugin->after_load(); + } +#endif } +PluginInfo::~PluginInfo() {} + void* PluginInfo::get_symbol(std::string const& sym_name) const { #ifdef MAPNIK_SUPPORTS_DLOPEN @@ -127,13 +118,13 @@ void* PluginInfo::get_symbol(std::string const& sym_name) const std::string const& PluginInfo::name() const { - return name_; + return module_->name; } bool PluginInfo::valid() const { #ifdef MAPNIK_SUPPORTS_DLOPEN - if (module_ && module_->dl && !name_.empty()) + if (module_ && module_->dl && !module_->name.empty()) return true; #endif return false; @@ -141,7 +132,7 @@ bool PluginInfo::valid() const std::string PluginInfo::get_error() const { - return std::string("could not open: '") + name_ + "'"; + return std::string("could not open: '") + module_->name + "'"; } void PluginInfo::init() diff --git a/src/png_reader.cpp b/src/png_reader.cpp index 746705b21..799cdeda5 100644 --- a/src/png_reader.cpp +++ b/src/png_reader.cpp @@ -80,8 +80,6 @@ class png_reader : public image_reader static void png_read_data(png_structp png_ptr, png_bytep data, png_size_t length); }; -namespace { - image_reader* create_png_reader(std::string const& filename) { return new png_reader(filename); @@ -92,9 +90,11 @@ image_reader* create_png_reader2(char const* data, std::size_t size) return new png_reader(data, size); } -const bool registered = register_image_reader("png", create_png_reader); -const bool registered2 = register_image_reader("png", create_png_reader2); -} // namespace +void register_png_reader() +{ + const bool registered = register_image_reader("png", create_png_reader); + const bool registered2 = register_image_reader("png", create_png_reader2); +} void user_error_fn(png_structp /*png_ptr*/, png_const_charp error_msg) { diff --git a/src/tiff_reader.cpp b/src/tiff_reader.cpp index fb8b243a8..4446add71 100644 --- a/src/tiff_reader.cpp +++ b/src/tiff_reader.cpp @@ -104,8 +104,6 @@ int tiff_map_proc(thandle_t, tdata_t*, toff_t*) } } // namespace detail -namespace { - image_reader* create_tiff_reader(std::string const& filename) { #if defined(MAPNIK_MEMORY_MAPPED_FILE) @@ -120,9 +118,10 @@ image_reader* create_tiff_reader2(char const* data, std::size_t size) return new tiff_reader(data, size); } -const bool registered = register_image_reader("tiff", create_tiff_reader); -const bool registered2 = register_image_reader("tiff", create_tiff_reader2); - -} // namespace +void register_tiff_reader() +{ + const bool registered = register_image_reader("tiff", create_tiff_reader); + const bool registered2 = register_image_reader("tiff", create_tiff_reader2); +} } // namespace mapnik diff --git a/src/webp_reader.cpp b/src/webp_reader.cpp index fa85d6dfc..24b942525 100644 --- a/src/webp_reader.cpp +++ b/src/webp_reader.cpp @@ -110,7 +110,6 @@ class webp_reader : public image_reader void init(); }; -namespace { image_reader* create_webp_reader(char const* data, std::size_t size) { return new webp_reader(data, size); @@ -121,10 +120,11 @@ image_reader* create_webp_reader2(std::string const& filename) return new webp_reader(filename); } -const bool registered = register_image_reader("webp", create_webp_reader); -const bool registered2 = register_image_reader("webp", create_webp_reader2); - -} // namespace +void register_webp_reader() +{ + const bool registered = register_image_reader("webp", create_webp_reader); + const bool registered2 = register_image_reader("webp", create_webp_reader2); +} // ctor template diff --git a/test/standalone/agg_rasterizer_integer_overflow_test.cpp b/test/standalone/agg_rasterizer_integer_overflow_test.cpp index 9ab9cfd95..05d3556f0 100644 --- a/test/standalone/agg_rasterizer_integer_overflow_test.cpp +++ b/test/standalone/agg_rasterizer_integer_overflow_test.cpp @@ -1,6 +1,7 @@ #define CATCH_CONFIG_MAIN #include "catch.hpp" +#include #include #include #include @@ -22,6 +23,7 @@ const std::string TEST_CASE("agg_rasterizer_integer_overflow") { + mapnik::setup(); SECTION("coordinates_do_not_overflow_and_polygon_is_rendered") { auto expected_color = mapnik::color("white"); diff --git a/test/standalone/datasource_registration_test.cpp b/test/standalone/datasource_registration_test.cpp index b93fb03df..c5226e5bb 100644 --- a/test/standalone/datasource_registration_test.cpp +++ b/test/standalone/datasource_registration_test.cpp @@ -1,6 +1,7 @@ #define CATCH_CONFIG_MAIN #include "catch.hpp" +#include #include #include #include @@ -11,6 +12,7 @@ TEST_CASE("datasource_cache") { + mapnik::setup(); SECTION("registration") { try diff --git a/test/standalone/font_registration_test.cpp b/test/standalone/font_registration_test.cpp index 5197f57ac..0e88711d0 100644 --- a/test/standalone/font_registration_test.cpp +++ b/test/standalone/font_registration_test.cpp @@ -1,6 +1,7 @@ #define CATCH_CONFIG_MAIN #include "catch.hpp" +#include #include #include #include @@ -13,6 +14,7 @@ TEST_CASE("font") { + mapnik::setup(); SECTION("registration") { try diff --git a/test/standalone/map_xml_test.cpp b/test/standalone/map_xml_test.cpp index b9755588e..c2aa6893e 100644 --- a/test/standalone/map_xml_test.cpp +++ b/test/standalone/map_xml_test.cpp @@ -1,6 +1,7 @@ #define CATCH_CONFIG_MAIN #include "catch.hpp" +#include #include #include #include @@ -142,6 +143,7 @@ const bool registered = TEST_CASE("map xml I/O") { + mapnik::setup(); // make sure plugins are loaded REQUIRE(registered); diff --git a/test/unit/run.cpp b/test/unit/run.cpp index 8bf68870c..94836d7ed 100644 --- a/test/unit/run.cpp +++ b/test/unit/run.cpp @@ -2,6 +2,7 @@ #include "catch.hpp" #include +#include #include #include #include @@ -20,6 +21,7 @@ int main(int argc, char** argv) session.cli(cli); int result = session.applyCommandLine(argc, argv); + mapnik::setup(); if (!plugin_path.empty()) { if (!mapnik::util::exists(plugin_path)) diff --git a/test/visual/run.cpp b/test/visual/run.cpp index d25da763d..4ea3473d4 100644 --- a/test/visual/run.cpp +++ b/test/visual/run.cpp @@ -23,6 +23,7 @@ #include "runner.hpp" #include "config.hpp" +#include #include #include @@ -166,6 +167,7 @@ int main(int argc, char** argv) return 1; } + mapnik::setup(); #ifdef MAPNIK_LOG std::string log_level(vm["log"].as()); log_levels_map::const_iterator level_iter = log_levels.find(log_level); diff --git a/utils/geometry_to_wkb/main.cpp b/utils/geometry_to_wkb/main.cpp index 74d4aa0b6..46f289162 100644 --- a/utils/geometry_to_wkb/main.cpp +++ b/utils/geometry_to_wkb/main.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -40,6 +41,7 @@ int main(int argc, char** argv) std::cerr << "Geometry to WKB converter\n"; + mapnik::setup(); mapnik::datasource_cache::instance().register_datasources("/opt/mapnik/lib/mapnik/input/"); std::string filename(argv[1]); diff --git a/utils/mapnik-index/mapnik-index.cpp b/utils/mapnik-index/mapnik-index.cpp index 895db2714..a56f48a7c 100644 --- a/utils/mapnik-index/mapnik-index.cpp +++ b/utils/mapnik-index/mapnik-index.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -62,6 +63,7 @@ int main(int argc, char** argv) { // using namespace mapnik; namespace po = boost::program_options; + mapnik::setup(); bool verbose = false; bool validate_features = false; unsigned int depth = DEFAULT_DEPTH; diff --git a/utils/mapnik-render/mapnik-render.cpp b/utils/mapnik-render/mapnik-render.cpp index 608dea754..f4fd96d33 100644 --- a/utils/mapnik-render/mapnik-render.cpp +++ b/utils/mapnik-render/mapnik-render.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -21,6 +22,8 @@ int main(int argc, char** argv) { namespace po = boost::program_options; + mapnik::setup(); + bool verbose = false; bool auto_open = false; int return_value = 0; diff --git a/utils/ogrindex/ogrindex.cpp b/utils/ogrindex/ogrindex.cpp index f4b39d8fe..d6bf7a38d 100644 --- a/utils/ogrindex/ogrindex.cpp +++ b/utils/ogrindex/ogrindex.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -60,6 +61,7 @@ int main(int argc, char** argv) double ratio = DEFAULT_RATIO; vector ogr_files; + mapnik::setup(); try { po::options_description desc("ogrindex utility"); diff --git a/utils/pgsql2sqlite/main.cpp b/utils/pgsql2sqlite/main.cpp index 14a698124..25b51bc94 100644 --- a/utils/pgsql2sqlite/main.cpp +++ b/utils/pgsql2sqlite/main.cpp @@ -24,6 +24,7 @@ #include "pgsql2sqlite.hpp" #include #include +#include #include "connection_manager.hpp" #include @@ -46,6 +47,7 @@ int main(int argc, char** argv) po::options_description desc("Postgresql/PostGIS to SQLite3 converter\n Options"); std::string usage = "usage: pgsql2sqlite --dbname db --table planet_osm_line --file osm.sqlite --query \"select * " "from planet_osm_line\""; + mapnik::setup(); try { // clang-format off diff --git a/utils/shapeindex/shapeindex.cpp b/utils/shapeindex/shapeindex.cpp index 914d122d4..d205603c5 100644 --- a/utils/shapeindex/shapeindex.cpp +++ b/utils/shapeindex/shapeindex.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -58,6 +59,7 @@ int main(int argc, char** argv) double ratio = DEFAULT_RATIO; std::vector shape_files; + mapnik::setup(); try { po::options_description desc("shapeindex utility"); diff --git a/utils/svg2png/svg2png.cpp b/utils/svg2png/svg2png.cpp index 2307781be..7a78b7dde 100644 --- a/utils/svg2png/svg2png.cpp +++ b/utils/svg2png/svg2png.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -160,6 +161,7 @@ int main(int argc, char** argv) bool strict = false; int status = 0; std::vector svg_files; + mapnik::setup(); mapnik::logger::instance().set_severity(mapnik::logger::error); double scale_factor = 1.0; std::string usage = "Usage: svg2png [options] "; From 49ef468e84b82b51bc33934eab89a59d63a41f63 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 3 Feb 2022 23:58:22 +0100 Subject: [PATCH 09/38] [CMake] add msvc EHsc option --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 578cbe08e..a41f4ec83 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -359,8 +359,10 @@ endif() # force utf-8 source code processing # see https://docs.microsoft.com/de-de/cpp/build/reference/utf-8-set-source-and-executable-character-sets-to-utf-8?view=msvc-170 -add_compile_options("$<$:/utf-8>") -add_compile_options("$<$:/utf-8>") +add_compile_options( + "$<$:/utf-8>" + "$<$:/EHsc>" +) add_library(core INTERFACE) add_library(mapnik::core ALIAS core) From c0d52ced1854b0937a3643a56b2fb8db50e8d146 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Tue, 8 Feb 2022 16:55:42 +0100 Subject: [PATCH 10/38] [Changelog] describe breaking changes --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57ebfda65..eec348739 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,11 @@ For a complete change history, see the git log. - Mapnik now requires C++14 compliant compiler (`-std=c++14`) +#### Breaking Changes + +- Reworked datasource plugin system. Plugins now need to implement a class with the macros in `datasource_plugin.hpp` ([#4291](https://github.com/mapnik/mapnik/pull/4291)) +- mapnik now has a global `mapnik::setup()` method which have to be called before any other functions of mapnik. Defined in `mapnik.hpp` ([#4291](https://github.com/mapnik/mapnik/pull/4291)) + #### Core - Rewrote parser grammars using Boost.Spirit X3 (replacing Boost.Spirit Qi) @@ -27,6 +32,7 @@ For a complete change history, see the git log. - Slightly improved `sql_utils::table_from_sql` ([2587bb3](https://github.com/mapnik/mapnik/commit/2587bb3a1d8db397acfa8dcc2d332da3a8a9399f)) - Added wrappers for proper quoting in SQL query construction: `sql_utils::identifier`, `sql_utils::literal` ([7b21713](https://github.com/mapnik/mapnik/commit/7b217133e2749b82c2638551045c4edbece15086)) - Added two-argument `sql_utils::unquote`, `sql_utils::unquote_copy` that also collapse inner quotes ([a4e8ea2](https://github.com/mapnik/mapnik/commit/a4e8ea21be297d89bbf36ba594d6c661a7a9ac81)) +- Fixed mapnik static build with static plugins ([#4291](https://github.com/mapnik/mapnik/pull/4291)) #### Plugins From 6fcdccaf831bf413f2e9fc1e4d10b662ef050b36 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 9 Feb 2022 15:57:03 +0100 Subject: [PATCH 11/38] [CMake] fix rename MAPNIK_STATIC_PLUGINS => BUILD_SHARED_PLUGINS --- cmake/MapnikInstall.cmake | 2 +- plugins/input/CMakeLists.txt | 4 +-- src/CMakeLists.txt | 50 ++++++++++++++++++------------------ 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/cmake/MapnikInstall.cmake b/cmake/MapnikInstall.cmake index 7983c75e5..b12ccab4c 100644 --- a/cmake/MapnikInstall.cmake +++ b/cmake/MapnikInstall.cmake @@ -23,7 +23,7 @@ endfunction() # Install plugins # function(mapnik_install_plugin _target) - if(MAPNIK_STATIC_PLUGINS) + if(NOT BUILD_SHARED_PLUGINS) return() endif() install(TARGETS ${_target} diff --git a/plugins/input/CMakeLists.txt b/plugins/input/CMakeLists.txt index b5167c84a..500e8248c 100644 --- a/plugins/input/CMakeLists.txt +++ b/plugins/input/CMakeLists.txt @@ -6,7 +6,7 @@ set(_plugin_archive_output "${MAPNIK_OUTPUT_DIR}/lib") set(_plugin_fpic ON) set(_plugin_linkage MODULE) set(_plugin_visibility PRIVATE) -if(MAPNIK_STATIC_PLUGINS) +if(NOT BUILD_SHARED_PLUGINS) set(_plugin_linkage INTERFACE) set(_plugin_visibility INTERFACE) endif() @@ -78,7 +78,7 @@ endif() # # Copy all plugin dlls, so that these are in the main output dir, since cmake copies those into ${MAPNIK_OUTPUT_DIR}/plugins/input, too. # -if(NOT MAPNIK_STATIC_PLUGINS AND WIN32) +if(BUILD_SHARED_PLUGINS AND WIN32) list(LENGTH m_build_plugins m_number_plugins) if(m_number_plugins GREATER 0) string(CONFIGURE diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9fe5da903..dbbbcefe3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -9,36 +9,36 @@ endif() target_link_libraries(mapnik PUBLIC mapnik::core mapnik::datasource-base) target_link_libraries(mapnik PRIVATE mapnik::agg - # expr: if(MAPNIK_STATIC_PLUGINS == ON && is build) then add link target - $<$,$>:input-csv> - $<$,$>:input-gdal> - $<$,$>:input-geobuf> - $<$,$>:input-geojson> - $<$,$>:input-ogr> - $<$,$>:input-pgraster> - $<$,$>:input-postgis> - $<$,$>:input-raster> - $<$,$>:input-shape> - $<$,$>:input-sqlite> - $<$,$>:input-topojson> + # expr: if(BUILD_SHARED_PLUGINS == OFF && is build) then add link target + $<$>,$>:input-csv> + $<$>,$>:input-gdal> + $<$>,$>:input-geobuf> + $<$>,$>:input-geojson> + $<$>,$>:input-ogr> + $<$>,$>:input-pgraster> + $<$>,$>:input-postgis> + $<$>,$>:input-raster> + $<$>,$>:input-shape> + $<$>,$>:input-sqlite> + $<$>,$>:input-topojson> ) target_compile_definitions(mapnik PRIVATE - # expr: if(MAPNIK_STATIC_PLUGINS == ON && is build) then add build definition - $<$,$>:MAPNIK_STATIC_PLUGIN_CSV> - $<$,$>:MAPNIK_STATIC_PLUGIN_GDAL> - $<$,$>:MAPNIK_STATIC_PLUGIN_GEOBUF> - $<$,$>:MAPNIK_STATIC_PLUGIN_GEOJSON> - $<$,$>:MAPNIK_STATIC_PLUGIN_OGR> - $<$,$>:MAPNIK_STATIC_PLUGIN_PGRASTER> - $<$,$>:MAPNIK_STATIC_PLUGIN_POSTGIS> - $<$,$>:MAPNIK_STATIC_PLUGIN_RASTER> - $<$,$>:MAPNIK_STATIC_PLUGIN_SHAPE> - $<$,$>:MAPNIK_STATIC_PLUGIN_SQLITE> - $<$,$>:MAPNIK_STATIC_PLUGIN_TOPOJSON> + # expr: if(BUILD_SHARED_PLUGINS == OFF && is build) then add build definition + $<$>,$>:MAPNIK_STATIC_PLUGIN_CSV> + $<$>,$>:MAPNIK_STATIC_PLUGIN_GDAL> + $<$>,$>:MAPNIK_STATIC_PLUGIN_GEOBUF> + $<$>,$>:MAPNIK_STATIC_PLUGIN_GEOJSON> + $<$>,$>:MAPNIK_STATIC_PLUGIN_OGR> + $<$>,$>:MAPNIK_STATIC_PLUGIN_PGRASTER> + $<$>,$>:MAPNIK_STATIC_PLUGIN_POSTGIS> + $<$>,$>:MAPNIK_STATIC_PLUGIN_RASTER> + $<$>,$>:MAPNIK_STATIC_PLUGIN_SHAPE> + $<$>,$>:MAPNIK_STATIC_PLUGIN_SQLITE> + $<$>,$>:MAPNIK_STATIC_PLUGIN_TOPOJSON> ) -if(MAPNIK_STATIC_PLUGINS) +if(NOT BUILD_SHARED_PLUGINS) target_include_directories(mapnik PRIVATE "${PROJECT_SOURCE_DIR}/plugins") endif() From 0f0e06c6b893c11631b9da7a837f30c55eaaa31f Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Mon, 14 Feb 2022 10:14:59 +0100 Subject: [PATCH 12/38] [datasource] add plugin_registered function --- include/mapnik/datasource_cache.hpp | 5 +++-- src/datasource_cache.cpp | 26 ++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/include/mapnik/datasource_cache.hpp b/include/mapnik/datasource_cache.hpp index 8504b05c2..4e321c9ad 100644 --- a/include/mapnik/datasource_cache.hpp +++ b/include/mapnik/datasource_cache.hpp @@ -47,7 +47,8 @@ class MAPNIK_DECL datasource_cache : public singleton; public: - std::vector plugin_names(); + bool plugin_registered(const std::string& plugin_name) const; + std::vector plugin_names() const; std::string plugin_directories(); bool register_datasources(std::string const& path, bool recurse = false); bool register_datasource(std::string const& path); @@ -62,7 +63,7 @@ class MAPNIK_DECL datasource_cache : public singleton; diff --git a/src/datasource_cache.cpp b/src/datasource_cache.cpp index 28ae3a12d..bcb5d49da 100644 --- a/src/datasource_cache.cpp +++ b/src/datasource_cache.cpp @@ -113,7 +113,7 @@ datasource_ptr datasource_cache::create(parameters const& params) #ifdef __GNUC__ __extension__ #endif - datasource_plugin* create_datasource = reinterpret_cast(itr->second->get_symbol("plugin")); + datasource_plugin* create_datasource = reinterpret_cast(itr->second->get_symbol("plugin")); if (!create_datasource) { @@ -131,7 +131,29 @@ std::string datasource_cache::plugin_directories() return boost::algorithm::join(plugin_directories_, ", "); } -std::vector datasource_cache::plugin_names() +bool datasource_cache::plugin_registered(const std::string& plugin_name) const +{ +#ifdef MAPNIK_STATIC_PLUGINS + const auto static_names = get_static_datasource_names(); + const auto static_it = std::find(static_names.begin(), static_names.end(), plugin_name); + if (static_it != static_names.end()) + return true; +#endif + +#ifdef MAPNIK_THREADSAFE + std::lock_guard lock(instance_mutex_); +#endif + + std::map>::const_iterator itr; + for (itr = plugins_.begin(); itr != plugins_.end(); ++itr) + { + if (itr->second->name() == plugin_name) + return true; + } + return false; +} + +std::vector datasource_cache::plugin_names() const { std::vector names; From ee63a6f05540924ea5796eac147ae66cf238ebe7 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Mon, 14 Feb 2022 10:15:09 +0100 Subject: [PATCH 13/38] [tests] also test when using static --- test/unit/datasource/csv.cpp | 128 +++++++++++++--------------- test/unit/datasource/gdal.cpp | 4 +- test/unit/datasource/geobuf.cpp | 4 +- test/unit/datasource/geojson.cpp | 4 +- test/unit/datasource/ogr.cpp | 6 +- test/unit/datasource/shapeindex.cpp | 8 +- 6 files changed, 73 insertions(+), 81 deletions(-) diff --git a/test/unit/datasource/csv.cpp b/test/unit/datasource/csv.cpp index 93724d05e..d9734edca 100644 --- a/test/unit/datasource/csv.cpp +++ b/test/unit/datasource/csv.cpp @@ -85,17 +85,15 @@ mapnik::datasource_ptr get_csv_ds(std::string const& file_name, bool strict = tr TEST_CASE("csv") { using mapnik::util::from_u8string; - std::string csv_plugin("./plugins/input/csv.input"); - if (mapnik::util::exists(csv_plugin)) + + // check the CSV datasource is loaded + const bool have_csv_plugin = mapnik::datasource_cache::instance().plugin_registered("csv"); + if (have_csv_plugin) { // make the tests silent since we intentionally test error conditions that are noisy auto const severity = mapnik::logger::instance().get_severity(); mapnik::logger::instance().set_severity(mapnik::logger::none); - // check the CSV datasource is loaded - const std::vector plugin_names = mapnik::datasource_cache::instance().plugin_names(); - const bool have_csv_plugin = std::find(plugin_names.begin(), plugin_names.end(), "csv") != plugin_names.end(); - SECTION("CSV I/O errors") { std::string filename = "does_not_exist.csv"; @@ -125,83 +123,77 @@ TEST_CASE("csv") { for (auto create_index : {false, true}) { - if (have_csv_plugin) - { - std::vector broken; - add_csv_files("test/data/csv/fails", broken); - add_csv_files("test/data/csv/warns", broken); - broken.emplace_back("test/data/csv/fails/does_not_exist.csv"); + std::vector broken; + add_csv_files("test/data/csv/fails", broken); + add_csv_files("test/data/csv/warns", broken); + broken.emplace_back("test/data/csv/fails/does_not_exist.csv"); - for (auto const& path : broken) + for (auto const& path : broken) + { + bool require_fail = true; + if (create_index) { - bool require_fail = true; - if (create_index) + int ret = create_disk_index(path); + int ret_posix = (ret >> 8) & 0x000000ff; + INFO(ret); + INFO(ret_posix); + require_fail = (boost::iends_with(path, "feature_id_counting.csv")) ? false : true; + if (!require_fail) { - int ret = create_disk_index(path); - int ret_posix = (ret >> 8) & 0x000000ff; - INFO(ret); - INFO(ret_posix); - require_fail = (boost::iends_with(path, "feature_id_counting.csv")) ? false : true; - if (!require_fail) - { - REQUIRE(mapnik::util::exists(path + ".index")); - } - } - INFO(path); - if (require_fail) - { - REQUIRE_THROWS(get_csv_ds(path)); - } - else - { - CHECK(bool(get_csv_ds(path))); - } - if (mapnik::util::exists(path + ".index")) - { - CHECK(mapnik::util::remove(path + ".index")); + REQUIRE(mapnik::util::exists(path + ".index")); } } + INFO(path); + if (require_fail) + { + REQUIRE_THROWS(get_csv_ds(path)); + } + else + { + CHECK(bool(get_csv_ds(path))); + } + if (mapnik::util::exists(path + ".index")) + { + CHECK(mapnik::util::remove(path + ".index")); + } } } } // END SECTION SECTION("good files") { - if (have_csv_plugin) - { - std::vector good; - add_csv_files("test/data/csv", good); - add_csv_files("test/data/csv/warns", good); + std::vector good; + add_csv_files("test/data/csv", good); + add_csv_files("test/data/csv/warns", good); - for (auto const& path : good) + for (auto const& path : good) + { + // cleanup in the case of a failed previous run + if (mapnik::util::exists(path + ".index")) { - // cleanup in the case of a failed previous run + mapnik::util::remove(path + ".index"); + } + for (auto create_index : {false, true}) + { + if (create_index) + { + int ret = create_disk_index(path); + int ret_posix = (ret >> 8) & 0x000000ff; + INFO(ret); + INFO(ret_posix); + if (!boost::iends_with(path, + "more_headers_than_column_values.csv")) // mapnik-index won't create + // *.index for 0 features + { + CHECK(mapnik::util::exists(path + ".index")); + } + } + auto ds = get_csv_ds(path, false); + // require a non-null pointer returned + REQUIRE(bool(ds)); if (mapnik::util::exists(path + ".index")) { - mapnik::util::remove(path + ".index"); - } - for (auto create_index : {false, true}) - { - if (create_index) - { - int ret = create_disk_index(path); - int ret_posix = (ret >> 8) & 0x000000ff; - INFO(ret); - INFO(ret_posix); - if (!boost::iends_with(path, - "more_headers_than_column_values.csv")) // mapnik-index won't create - // *.index for 0 features - { - CHECK(mapnik::util::exists(path + ".index")); - } - } - auto ds = get_csv_ds(path, false); - // require a non-null pointer returned - REQUIRE(bool(ds)); - if (mapnik::util::exists(path + ".index")) - { - CHECK(mapnik::util::remove(path + ".index")); - } + CHECK(mapnik::util::remove(path + ".index")); } } } diff --git a/test/unit/datasource/gdal.cpp b/test/unit/datasource/gdal.cpp index e7d13b3dc..e83cd5a52 100644 --- a/test/unit/datasource/gdal.cpp +++ b/test/unit/datasource/gdal.cpp @@ -31,8 +31,8 @@ namespace { mapnik::datasource_ptr get_gdal_ds(std::string const& file_name, boost::optional band) { - std::string gdal_plugin("./plugins/input/gdal.input"); - if (!mapnik::util::exists(gdal_plugin)) + const bool have_gdal_plugin = mapnik::datasource_cache::instance().plugin_registered("gdal"); + if (!have_gdal_plugin) { return mapnik::datasource_ptr(); } diff --git a/test/unit/datasource/geobuf.cpp b/test/unit/datasource/geobuf.cpp index 82859851c..4d371ced6 100644 --- a/test/unit/datasource/geobuf.cpp +++ b/test/unit/datasource/geobuf.cpp @@ -37,8 +37,8 @@ TEST_CASE("Geobuf") { - std::string geobuf_plugin("./plugins/input/geobuf.input"); - if (mapnik::util::exists(geobuf_plugin)) + const bool have_geobuf_plugin = mapnik::datasource_cache::instance().plugin_registered("geobuf"); + if (have_geobuf_plugin) { SECTION("Point") { diff --git a/test/unit/datasource/geojson.cpp b/test/unit/datasource/geojson.cpp index 528c0263b..308e51cff 100644 --- a/test/unit/datasource/geojson.cpp +++ b/test/unit/datasource/geojson.cpp @@ -81,8 +81,8 @@ void iterate_over_features(mapnik::featureset_ptr features) TEST_CASE("geojson") { - std::string geojson_plugin("./plugins/input/geojson.input"); - if (mapnik::util::exists(geojson_plugin)) + const bool have_geojson_plugin = mapnik::datasource_cache::instance().plugin_registered("geojson"); + if (have_geojson_plugin) { SECTION("GeoJSON I/O errors") { diff --git a/test/unit/datasource/ogr.cpp b/test/unit/datasource/ogr.cpp index c6bfc8bb9..8441ecc55 100644 --- a/test/unit/datasource/ogr.cpp +++ b/test/unit/datasource/ogr.cpp @@ -28,12 +28,12 @@ #include #include #include -#include +#include TEST_CASE("ogr") { - std::string geojson_plugin("./plugins/input/ogr.input"); - if (mapnik::util::exists(geojson_plugin)) + const bool have_ogr_plugin = mapnik::datasource_cache::instance().plugin_registered("ogr"); + if (have_ogr_plugin) { SECTION("ogr point feature") { diff --git a/test/unit/datasource/shapeindex.cpp b/test/unit/datasource/shapeindex.cpp index 45aaa2334..76881235b 100644 --- a/test/unit/datasource/shapeindex.cpp +++ b/test/unit/datasource/shapeindex.cpp @@ -98,8 +98,8 @@ int create_shapefile_index(std::string const& filename, bool index_parts, bool s TEST_CASE("invalid shapeindex") { - std::string shape_plugin("./plugins/input/shape.input"); - if (mapnik::util::exists(shape_plugin)) + const bool have_shape_plugin = mapnik::datasource_cache::instance().plugin_registered("shape"); + if (have_shape_plugin) { SECTION("Invalid index") { @@ -141,8 +141,8 @@ TEST_CASE("invalid shapeindex") TEST_CASE("shapeindex") { - std::string shape_plugin("./plugins/input/shape.input"); - if (mapnik::util::exists(shape_plugin)) + const bool have_shape_plugin = mapnik::datasource_cache::instance().plugin_registered("shape"); + if (have_shape_plugin) { SECTION("Index") { From 45568e8895d2fe2b4df2bdbe89c6c163f004ea50 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Mon, 14 Feb 2022 17:34:20 +0100 Subject: [PATCH 14/38] [datasource] call after_load for static plugins --- src/datasource_cache_static.cpp | 37 ++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/datasource_cache_static.cpp b/src/datasource_cache_static.cpp index 0577404a0..97e67aad4 100644 --- a/src/datasource_cache_static.cpp +++ b/src/datasource_cache_static.cpp @@ -86,7 +86,11 @@ #endif #define REGISTER_STATIC_DATASOURCE_PLUGIN(classname) \ - ds_map.emplace(std::string{classname::kName}, std::make_shared()) + { \ + auto plugin = std::make_shared(); \ + plugin->after_load(); \ + ds_map.emplace(std::string{classname::kName}, std::move(plugin)); \ + } namespace mapnik { #ifdef MAPNIK_STATIC_PLUGINS @@ -108,56 +112,55 @@ void init_datasource_cache_static() REGISTER_STATIC_DATASOURCE_PLUGIN(csv_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_GDAL) - REGISTER_STATIC_DATASOURCE_PLUGIN(gdal_datasource_plugin); + REGISTER_STATIC_DATASOURCE_PLUGIN(gdal_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_GEOBUF) - REGISTER_STATIC_DATASOURCE_PLUGIN(geobuf_datasource_plugin); + REGISTER_STATIC_DATASOURCE_PLUGIN(geobuf_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_GEOJSON) - REGISTER_STATIC_DATASOURCE_PLUGIN(geojson_datasource_plugin); + REGISTER_STATIC_DATASOURCE_PLUGIN(geojson_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_OCCI) - REGISTER_STATIC_DATASOURCE_PLUGIN(occi_datasource_plugin); + REGISTER_STATIC_DATASOURCE_PLUGIN(occi_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_OGR) - REGISTER_STATIC_DATASOURCE_PLUGIN(ogr_datasource_plugin); + REGISTER_STATIC_DATASOURCE_PLUGIN(ogr_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_PGRASTER) - REGISTER_STATIC_DATASOURCE_PLUGIN(pgraster_datasource_plugin); + REGISTER_STATIC_DATASOURCE_PLUGIN(pgraster_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_OSM) - REGISTER_STATIC_DATASOURCE_PLUGIN(osm_datasource_plugin); + REGISTER_STATIC_DATASOURCE_PLUGIN(osm_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_POSTGIS) - REGISTER_STATIC_DATASOURCE_PLUGIN(postgis_datasource_plugin); + REGISTER_STATIC_DATASOURCE_PLUGIN(postgis_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_RASTER) - REGISTER_STATIC_DATASOURCE_PLUGIN(raster_datasource_plugin); + REGISTER_STATIC_DATASOURCE_PLUGIN(raster_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_RASTERLITE) - REGISTER_STATIC_DATASOURCE_PLUGIN(rasterlite_datasource_plugin); + REGISTER_STATIC_DATASOURCE_PLUGIN(rasterlite_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_SHAPE) - REGISTER_STATIC_DATASOURCE_PLUGIN(shape_datasource_plugin); + REGISTER_STATIC_DATASOURCE_PLUGIN(shape_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_SQLITE) - REGISTER_STATIC_DATASOURCE_PLUGIN(sqlite_datasource_plugin); + REGISTER_STATIC_DATASOURCE_PLUGIN(sqlite_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_TOPOJSON) - REGISTER_STATIC_DATASOURCE_PLUGIN(topojson_datasource_plugin); + REGISTER_STATIC_DATASOURCE_PLUGIN(topojson_datasource_plugin); #endif }; datasource_ptr create_static_datasource(parameters const& params) { - datasource_ptr ds; boost::optional type = params.get("type"); datasource_map::iterator it = ds_map.find(*type); if (it != ds_map.end()) { - ds = it->second->create(params); + return it->second->create(params); } - return ds; + return datasource_ptr{}; } #else datasource_ptr create_static_datasource(parameters const& /*params*/) From 2d03db8ef1015ac3074c2e073bb9bd1e990c7ee3 Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Tue, 15 Feb 2022 15:40:16 +0000 Subject: [PATCH 15/38] Fix scons build --- SConstruct | 1 + src/build.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/SConstruct b/SConstruct index 9df2c5f9f..99577df30 100644 --- a/SConstruct +++ b/SConstruct @@ -1879,6 +1879,7 @@ if not preconfigured: env.Prepend(CPPPATH = '#deps/mapbox/geometry/include') env.Prepend(CPPPATH = '#deps/mapbox/protozero/include') env.Prepend(CPPPATH = '#deps/mapbox/polylabel/include') + env.Prepend(CPPPATH = '#plugins/input/base/include') # prepend deps dir for auxillary headers env.Prepend(CPPPATH = '#deps') diff --git a/src/build.py b/src/build.py index ac35d44f0..b68d33ef1 100644 --- a/src/build.py +++ b/src/build.py @@ -87,6 +87,7 @@ if '-DHAVE_TIFF' in env['CPPDEFINES']: if '-DHAVE_WEBP' in env['CPPDEFINES']: lib_env['LIBS'].append('webp') enabled_imaging_libraries.append('webp_reader.cpp') + enabled_imaging_libraries.append('webp_io.cpp') if env['XMLPARSER'] == 'libxml2' and env['HAS_LIBXML2']: lib_env['LIBS'].append('xml2') @@ -152,6 +153,7 @@ else: # unix, non-macos source = Split( """ + mapnik.cpp expression_grammar_x3.cpp fs.cpp request.cpp From bb1bc2f07bdd85ed76d2dfa07a46670fa8b53769 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 18 Feb 2022 18:48:27 +0100 Subject: [PATCH 16/38] [CMake] enable msvc static crt --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a41f4ec83..4e77bc927 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,7 @@ mapnik_option(INSTALL_DEPENDENCIES "if ON, all dependencies (eg. required dlls) mapnik_option(BUILD_SHARED_LIBS "build mapnik dynamic(ON) or static(OFF)" ON) mapnik_option(BUILD_SHARED_PLUGINS "build dynamic plugins" ${BUILD_SHARED_LIBS}) # use BUILD_SHARED_LIBS as default option +mapnik_option(BUILD_SHARED_CRT "(only windows with msvc) use msvc shared crt" ${BUILD_SHARED_LIBS}) # use BUILD_SHARED_LIBS as default option if(WIN32 AND BUILD_SHARED_PLUGINS AND NOT BUILD_SHARED_LIBS) message(FATAL_ERROR "static libmapnik and dynamic plugins won't work correctly") endif() @@ -363,6 +364,11 @@ add_compile_options( "$<$:/utf-8>" "$<$:/EHsc>" ) +if(BUILD_SHARED_CRT) + set_property(GLOBAL PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") +else() + set_property(GLOBAL PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") +endif() add_library(core INTERFACE) add_library(mapnik::core ALIAS core) From 515a7e8279855297a34b11e64633eb8567318f98 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Tue, 15 Mar 2022 16:00:51 +0100 Subject: [PATCH 17/38] changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eec348739..3475adb4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,11 +12,12 @@ For a complete change history, see the git log. #### Notice - Mapnik now requires C++14 compliant compiler (`-std=c++14`) +- Mapnik now supports CMake as a build system. See [#4191](https://github.com/mapnik/mapnik/pull/4191) and the [docs](https://github.com/mapnik/mapnik/blob/master/docs/cmake-usage.md) for more info. #### Breaking Changes - Reworked datasource plugin system. Plugins now need to implement a class with the macros in `datasource_plugin.hpp` ([#4291](https://github.com/mapnik/mapnik/pull/4291)) -- mapnik now has a global `mapnik::setup()` method which have to be called before any other functions of mapnik. Defined in `mapnik.hpp` ([#4291](https://github.com/mapnik/mapnik/pull/4291)) +- mapnik now has a global `mapnik::setup()` method which have to be called before any other functions of mapnik. Defined in `mapnik.hpp`. Note: In order not to insert this change into every code base, it is currently still called during the dynamic initialisation time. However, if mapnik is compiled statically, this function must be called. ([#4291](https://github.com/mapnik/mapnik/pull/4291)) #### Core From 4493a06878dd9cf751525a1143719fffe9872248 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Tue, 15 Mar 2022 17:34:51 +0100 Subject: [PATCH 18/38] call mapnik::setup automatically --- src/mapnik.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mapnik.cpp b/src/mapnik.cpp index 0a9630ea9..0a67bce34 100644 --- a/src/mapnik.cpp +++ b/src/mapnik.cpp @@ -39,3 +39,12 @@ void register_image_readers() #endif } } // namespace mapnik + +namespace { +class AutoSetup final +{ + public: + AutoSetup() { mapnik::setup(); }; +}; +AutoSetup auto_setup{}; +} // namespace From 5ee7571761c5bfbd088fc8e1895034f25cc9a4ec Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Tue, 15 Mar 2022 21:07:02 +0100 Subject: [PATCH 19/38] add dlerror for plugin loading --- src/plugin.cpp | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/plugin.cpp b/src/plugin.cpp index f16f46499..339a51df3 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -48,10 +48,12 @@ namespace mapnik { struct _mapnik_lib_t { std::string name; + std::string error_str; handle dl; _mapnik_lib_t() : name{"unknown"} - , dl{0} + , error_str{""} + , dl{nullptr} {} ~_mapnik_lib_t() { @@ -73,7 +75,7 @@ struct _mapnik_lib_t { #ifndef MAPNIK_NO_DLCLOSE dlclose(dl); - dl = 0; + dl = nullptr; #endif } #endif @@ -84,25 +86,34 @@ PluginInfo::PluginInfo(std::string const& filename, std::string const& library_n : filename_(filename) , module_{std::make_unique()} { + assert(module_ != nullptr); #if defined(_WIN32) - if (module_) - module_->dl = LoadLibraryA(filename.c_str()); + module_->dl = LoadLibraryA(filename.c_str()); #elif defined(MAPNIK_HAS_DLCFN) - if (module_) - module_->dl = dlopen(filename.c_str(), RTLD_LAZY); + module_->dl = dlopen(filename.c_str(), RTLD_LAZY); #else throw std::runtime_error("no support for loading dynamic objects (Mapnik not compiled with -DMAPNIK_HAS_DLCFN)"); #endif #if defined(MAPNIK_HAS_DLCFN) || defined(_WIN32) - if (module_ && module_->dl) + if (module_->dl) { datasource_plugin* plugin{reinterpret_cast(get_symbol("plugin"))}; if (!plugin) throw std::runtime_error("plugin has a false interface"); //! todo: better error text module_->name = plugin->name(); + module_->error_str = ""; plugin->after_load(); } + else + { + const auto errcode = dlerror(); +#ifdef _WIN32 + module_->error_str = std::system_category().message(errcode); +#else + module_->error_str = errcode ? errcode : ""; #endif + } +#endif // defined(MAPNIK_HAS_DLCFN) || defined(_WIN32) } PluginInfo::~PluginInfo() {} @@ -124,7 +135,7 @@ std::string const& PluginInfo::name() const bool PluginInfo::valid() const { #ifdef MAPNIK_SUPPORTS_DLOPEN - if (module_ && module_->dl && !module_->name.empty()) + if (module_->dl && !module_->name.empty()) return true; #endif return false; @@ -132,7 +143,7 @@ bool PluginInfo::valid() const std::string PluginInfo::get_error() const { - return std::string("could not open: '") + module_->name + "'"; + return std::string{"could not open: '"} + module_->name + "'. Error: " + module_->error_str; } void PluginInfo::init() From 2b8eec969b2cbeb151dd90cc148d65121298e460 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Tue, 15 Mar 2022 21:08:14 +0100 Subject: [PATCH 20/38] PluginInfo: remove static init and exit methods those aren't used. --- include/mapnik/plugin.hpp | 2 -- src/datasource_cache.cpp | 11 ++--------- src/plugin.cpp | 10 ---------- 3 files changed, 2 insertions(+), 21 deletions(-) diff --git a/include/mapnik/plugin.hpp b/include/mapnik/plugin.hpp index b730a99c0..d1907411d 100644 --- a/include/mapnik/plugin.hpp +++ b/include/mapnik/plugin.hpp @@ -45,8 +45,6 @@ class PluginInfo : util::noncopyable bool valid() const; std::string get_error() const; void* get_symbol(std::string const& sym_name) const; - static void init(); - static void exit(); private: std::string filename_; diff --git a/src/datasource_cache.cpp b/src/datasource_cache.cpp index bcb5d49da..8e08d19a0 100644 --- a/src/datasource_cache.cpp +++ b/src/datasource_cache.cpp @@ -54,15 +54,8 @@ bool is_input_plugin(std::string const& filename) return boost::algorithm::ends_with(filename, std::string(".input")); } -datasource_cache::datasource_cache() -{ - PluginInfo::init(); -} - -datasource_cache::~datasource_cache() -{ - PluginInfo::exit(); -} +datasource_cache::datasource_cache() {} +datasource_cache::~datasource_cache() {} datasource_ptr datasource_cache::create(parameters const& params) { diff --git a/src/plugin.cpp b/src/plugin.cpp index 339a51df3..fb37f9a03 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -146,14 +146,4 @@ std::string PluginInfo::get_error() const return std::string{"could not open: '"} + module_->name + "'. Error: " + module_->error_str; } -void PluginInfo::init() -{ - // do any initialization needed -} - -void PluginInfo::exit() -{ - // do any shutdown needed -} - } // namespace mapnik From e00847e711120a7ac4e472a3d15441da65f243f9 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 19 Mar 2022 10:27:34 +0100 Subject: [PATCH 21/38] [CI] fix sqlite dep --- vcpkg.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vcpkg.json b/vcpkg.json index e3553d412..3f5afdbc7 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -62,7 +62,12 @@ "mapbox-variant", "proj4", "protozero", - "sqlite3", + { + "name": "sqlite3", + "features": [ + "rtree" + ] + }, "tiff", "zlib" ] From 25012517aab79610d7749dbdc1c19a38fd33aedb Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 16 Apr 2022 11:26:34 +0200 Subject: [PATCH 22/38] [CI] add static builds --- .github/workflows/build_test.yml | 42 ++++++++++++++++++++++++++++++++ .github/workflows/macos.yml | 5 +++- .github/workflows/ubuntu.yml | 5 +++- .github/workflows/windows.yml | 5 +++- 4 files changed, 54 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index dfaa9be28..252ef2567 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -17,6 +17,7 @@ jobs: NUGET_REGISTRY: https://nuget.pkg.github.com/mapnik/index.json NUGET_USERNAME: mapnik USE_MEMORY_MAPPED_FILE: 'ON' + BUILD_SHARED: true secrets: NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }} @@ -28,6 +29,19 @@ jobs: NUGET_REGISTRY: https://nuget.pkg.github.com/mapnik/index.json NUGET_USERNAME: mapnik USE_MEMORY_MAPPED_FILE: 'OFF' + BUILD_SHARED: true + secrets: + NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }} + + windows-static: + name: Windows static + uses: ./.github/workflows/windows.yml + with: + VCPKG_SHA: f6af75acc923c833a5620943e3fc7d5e4930f0df + NUGET_REGISTRY: https://nuget.pkg.github.com/mapnik/index.json + NUGET_USERNAME: mapnik + USE_MEMORY_MAPPED_FILE: 'ON' + BUILD_SHARED: false secrets: NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }} @@ -39,6 +53,7 @@ jobs: NUGET_REGISTRY: https://nuget.pkg.github.com/mapnik/index.json NUGET_USERNAME: mapnik USE_MEMORY_MAPPED_FILE: 'ON' + BUILD_SHARED: true secrets: NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }} @@ -50,6 +65,19 @@ jobs: NUGET_REGISTRY: https://nuget.pkg.github.com/mapnik/index.json NUGET_USERNAME: mapnik USE_MEMORY_MAPPED_FILE: 'OFF' + BUILD_SHARED: true + secrets: + NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }} + + ubuntu-static: + name: Linux static + uses: ./.github/workflows/ubuntu.yml + with: + VCPKG_SHA: f6af75acc923c833a5620943e3fc7d5e4930f0df + NUGET_REGISTRY: https://nuget.pkg.github.com/mapnik/index.json + NUGET_USERNAME: mapnik + USE_MEMORY_MAPPED_FILE: 'ON' + BUILD_SHARED: false secrets: NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }} @@ -61,6 +89,7 @@ jobs: NUGET_REGISTRY: https://nuget.pkg.github.com/mapnik/index.json NUGET_USERNAME: mapnik USE_MEMORY_MAPPED_FILE: 'ON' + BUILD_SHARED: true secrets: NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }} @@ -72,5 +101,18 @@ jobs: NUGET_REGISTRY: https://nuget.pkg.github.com/mapnik/index.json NUGET_USERNAME: mapnik USE_MEMORY_MAPPED_FILE: 'OFF' + BUILD_SHARED: true + secrets: + NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }} + + macos-static: + name: MacOS static + uses: ./.github/workflows/macos.yml + with: + VCPKG_SHA: f6af75acc923c833a5620943e3fc7d5e4930f0df + NUGET_REGISTRY: https://nuget.pkg.github.com/mapnik/index.json + NUGET_USERNAME: mapnik + USE_MEMORY_MAPPED_FILE: 'ON' + BUILD_SHARED: false secrets: NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }} diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 092d10c45..244d95870 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -15,6 +15,9 @@ on: USE_MEMORY_MAPPED_FILE: required: true type: string + BUILD_SHARED: + required: true + type: boolean secrets: NUGET_REGISTRY_PAT: required: true @@ -89,7 +92,7 @@ jobs: setapikey "${{ secrets.GITHUB_TOKEN }}" -Source "${{ inputs.NUGET_REGISTRY }}" - name: Configure CMake - run: cmake -DUSE_MEMORY_MAPPED_FILE=${{ inputs.USE_MEMORY_MAPPED_FILE }} --preset=${{ env.preset }} + run: cmake -DUSE_MEMORY_MAPPED_FILE=${{ inputs.USE_MEMORY_MAPPED_FILE }} -DBUILD_SHARED_LIBS=${{ inputs.BUILD_SHARED }} --preset=${{ env.preset }} - name: Build run: cmake --build --preset ${{ env.preset }} diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 7035afda7..2877bc643 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -15,6 +15,9 @@ on: USE_MEMORY_MAPPED_FILE: required: true type: string + BUILD_SHARED: + required: true + type: boolean secrets: NUGET_REGISTRY_PAT: required: true @@ -105,7 +108,7 @@ jobs: setapikey "${{ secrets.GITHUB_TOKEN }}" -Source "${{ inputs.NUGET_REGISTRY }}" - name: Configure CMake - run: cmake -DUSE_MEMORY_MAPPED_FILE=${{ inputs.USE_MEMORY_MAPPED_FILE }} --preset=${{ env.preset }} + run: cmake -DUSE_MEMORY_MAPPED_FILE=${{ inputs.USE_MEMORY_MAPPED_FILE }} -DBUILD_SHARED_LIBS=${{ inputs.BUILD_SHARED }} --preset=${{ env.preset }} - name: Build run: cmake --build --preset ${{ env.preset }} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 2ad229ddf..b35324b12 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -15,6 +15,9 @@ on: USE_MEMORY_MAPPED_FILE: required: true type: string + BUILD_SHARED: + required: true + type: boolean secrets: NUGET_REGISTRY_PAT: required: true @@ -91,7 +94,7 @@ jobs: setapikey "${{ secrets.GITHUB_TOKEN }}" -Source "${{ inputs.NUGET_REGISTRY }}" - name: Configure CMake - run: cmake -DUSE_MEMORY_MAPPED_FILE=${{ inputs.USE_MEMORY_MAPPED_FILE }} --preset ${{env.preset}} + run: cmake -DUSE_MEMORY_MAPPED_FILE=${{ inputs.USE_MEMORY_MAPPED_FILE }} -DBUILD_SHARED_LIBS=${{ inputs.BUILD_SHARED }} --preset ${{env.preset}} - name: Build run: cmake --build --preset ${{env.preset}} From 59d2f21369e5c8a327ebc6519b6e2da3241ae2f8 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 22 Apr 2022 15:10:02 +0200 Subject: [PATCH 23/38] [CMake] remove FindCairo and use pkgconfig --- CMakeLists.txt | 14 +------ cmake/FindCairo.cmake | 98 ------------------------------------------- 2 files changed, 2 insertions(+), 110 deletions(-) delete mode 100644 cmake/FindCairo.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e77bc927..0f8148fc0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -302,13 +302,8 @@ if(USE_WEBP) endif() if(USE_CAIRO) - if(WIN32) - mapnik_find_package(Cairo REQUIRED) - list(APPEND MAPNIK_OPTIONAL_LIBS Cairo::Cairo) - else() - pkg_check_modules(Cairo REQUIRED IMPORTED_TARGET cairo) - list(APPEND MAPNIK_OPTIONAL_LIBS PkgConfig::Cairo) - endif() + pkg_check_modules(Cairo REQUIRED IMPORTED_TARGET cairo) + list(APPEND MAPNIK_OPTIONAL_LIBS PkgConfig::Cairo) list(APPEND MAPNIK_COMPILE_DEFS HAVE_CAIRO) endif() @@ -364,11 +359,6 @@ add_compile_options( "$<$:/utf-8>" "$<$:/EHsc>" ) -if(BUILD_SHARED_CRT) - set_property(GLOBAL PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") -else() - set_property(GLOBAL PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") -endif() add_library(core INTERFACE) add_library(mapnik::core ALIAS core) diff --git a/cmake/FindCairo.cmake b/cmake/FindCairo.cmake deleted file mode 100644 index 1dc42a6a0..000000000 --- a/cmake/FindCairo.cmake +++ /dev/null @@ -1,98 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#[=======================================================================[.rst: -FindCairo ------------ - -Find Cairo 2D graphics library. - - -Imported Targets -^^^^^^^^^^^^^^^^ -This module defines :prop_tgt:`IMPORTED` target ``Cairo::Cairo``, if -cairo has been found. - -Result variables -^^^^^^^^^^^^^^^^ - -This module will set the following variables in your project: - -``CAIRO_FOUND`` - True if cairo headers and library were found. -``CAIRO_INCLUDE_DIRS`` - Directory where cairo headers are located. -``CAIRO_LIBRARIES`` - cairo libraries to link against. -``CAIRO_VERSION_MAJOR`` - The major version of cairo -``CAIRO_VERSION_MINOR`` - The minor version of cairo -``CAIRO_VERSION_PATCH`` - The patch version of cairo -``CAIRO_VERSION_STRING`` - version number as a string (ex: "1.16.0") -#]=======================================================================] - -if(NOT CAIRO_LIBRARY) - find_path(CAIRO_INCLUDE_DIR NAMES cairo.h HINTS ${PC_CAIRO_INCLUDEDIR} ${PC_CAIRO_INCLUDE_DIR} PATH_SUFFIXES cairo) - find_library(CAIRO_LIBRARY_RELEASE NAMES ${Cairo_NAMES} cairo HINTS ${PC_CAIRO_LIBDIR} ${PC_CAIRO_LIBRARY_DIRS}) - find_library(CAIRO_LIBRARY_DEBUG NAMES ${Cairo_NAMES} cairod HINTS ${PC_CAIRO_LIBDIR} ${PC_CAIRO_LIBRARY_DIRS}) - include(SelectLibraryConfigurations) - select_library_configurations(CAIRO) -else() - file(TO_CMAKE_PATH "${CAIRO_LIBRARY}" CAIRO_LIBRARY) -endif() - -if(CAIRO_INCLUDE_DIR AND NOT CAIRO_VERSION) - if(EXISTS "${CAIRO_INCLUDE_DIR}/cairo-version.h") - file(READ "${CAIRO_INCLUDE_DIR}/cairo-version.h" CAIRO_VERSION_CONTENT) - - string(REGEX MATCH "#define +CAIRO_VERSION_MAJOR +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}") - set(CAIRO_VERSION_MAJOR "${CMAKE_MATCH_1}") - - string(REGEX MATCH "#define +CAIRO_VERSION_MINOR +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}") - set(CAIRO_VERSION_MINOR "${CMAKE_MATCH_1}") - - string(REGEX MATCH "#define +CAIRO_VERSION_MICRO +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}") - set(CAIRO_VERSION_PATCH "${CMAKE_MATCH_1}") - - set(CAIRO_VERSION "${CAIRO_VERSION_MAJOR}.${CAIRO_VERSION_MINOR}.${CAIRO_VERSION_PATCH}") - set(CAIRO_VERSION_STRING ${CAIRO_VERSION}) - endif() -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Cairo - REQUIRED_VARS - CAIRO_LIBRARY - CAIRO_INCLUDE_DIR - VERSION_VAR - CAIRO_VERSION_STRING -) -mark_as_advanced(CAIRO_INCLUDE_DIR CAIRO_LIBRARY) - -if (CAIRO_FOUND) - set(CAIRO_LIBRARIES ${CAIRO_LIBRARY}) - set(CAIRO_INCLUDE_DIRS ${CAIRO_INCLUDE_DIR}) - if(NOT TARGET Cairo::Cairo) - add_library(Cairo::Cairo UNKNOWN IMPORTED) - set_target_properties(Cairo::Cairo PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES ${CAIRO_INCLUDE_DIR} - IMPORTED_LINK_INTERFACE_LANGUAGES C) - - if(CAIRO_LIBRARY_RELEASE) - set_property(TARGET Cairo::Cairo APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) - set_target_properties(Cairo::Cairo PROPERTIES IMPORTED_LOCATION_RELEASE "${CAIRO_LIBRARY_RELEASE}") - endif() - - if(CAIRO_LIBRARY_DEBUG) - set_property(TARGET Cairo::Cairo APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) - set_target_properties(Cairo::Cairo PROPERTIES IMPORTED_LOCATION_DEBUG "${CAIRO_LIBRARY_DEBUG}") - endif() - - if(NOT CAIRO_LIBRARY_RELEASE AND NOT CAIRO_LIBRARY_DEBUG) - set_target_properties(Cairo::Cairo PROPERTIES IMPORTED_LOCATION "${CAIRO_LIBRARY}") - endif() - endif() -endif () From c85f8462fd62a0de0ea04d773475ec1074629778 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 22 Apr 2022 15:10:49 +0200 Subject: [PATCH 24/38] [CMake] fixes for windows (WIP) --- benchmark/CMakeLists.txt | 1 + demo/c++/CMakeLists.txt | 1 + demo/viewer/CMakeLists.txt | 1 + plugins/input/CMakeLists.txt | 1 + src/CMakeLists.txt | 1 + src/json/CMakeLists.txt | 1 + src/mapnik.cpp | 2 ++ src/wkt/CMakeLists.txt | 1 + test/CMakeLists.txt | 5 +++++ test/visual/CMakeLists.txt | 1 + utils/geometry_to_wkb/CMakeLists.txt | 1 + utils/mapnik-index/CMakeLists.txt | 1 + utils/mapnik-render/CMakeLists.txt | 1 + utils/ogrindex/CMakeLists.txt | 1 + utils/pgsql2sqlite/CMakeLists.txt | 1 + utils/shapeindex/CMakeLists.txt | 1 + utils/svg2png/CMakeLists.txt | 1 + 17 files changed, 22 insertions(+) diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt index 87809b55e..9aefc6b29 100644 --- a/benchmark/CMakeLists.txt +++ b/benchmark/CMakeLists.txt @@ -37,6 +37,7 @@ function(mapnik_create_benchmark) RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" OUTPUT_NAME "${BENCHNAME}" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) endfunction() diff --git a/demo/c++/CMakeLists.txt b/demo/c++/CMakeLists.txt index ee9e79af5..fdf365528 100644 --- a/demo/c++/CMakeLists.txt +++ b/demo/c++/CMakeLists.txt @@ -3,6 +3,7 @@ set_target_properties(mapnik-demo PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) target_link_libraries(mapnik-demo PRIVATE mapnik::agg mapnik::mapnik) diff --git a/demo/viewer/CMakeLists.txt b/demo/viewer/CMakeLists.txt index cbe348291..b1e2355ae 100644 --- a/demo/viewer/CMakeLists.txt +++ b/demo/viewer/CMakeLists.txt @@ -43,6 +43,7 @@ set_target_properties(mapnik-viewer PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) target_link_libraries(mapnik-viewer PRIVATE diff --git a/plugins/input/CMakeLists.txt b/plugins/input/CMakeLists.txt index 500e8248c..dbc06c835 100644 --- a/plugins/input/CMakeLists.txt +++ b/plugins/input/CMakeLists.txt @@ -21,6 +21,7 @@ macro(add_plugin_target plugin_target output_name) LIBRARY_OUTPUT_DIRECTORY "${_plugin_library_output}" RUNTIME_OUTPUT_DIRECTORY "${_plugin_runtime_output}" ARCHIVE_OUTPUT_DIRECTORY "${_plugin_archive_output}" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) mapnik_install_plugin(${plugin_target}) endmacro() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dbbbcefe3..6bf3714ce 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -54,6 +54,7 @@ set_target_properties(mapnik PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) if(MSVC) diff --git a/src/json/CMakeLists.txt b/src/json/CMakeLists.txt index bdda4a042..0444942fc 100644 --- a/src/json/CMakeLists.txt +++ b/src/json/CMakeLists.txt @@ -35,6 +35,7 @@ set_target_properties(json PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) mapnik_install(json) diff --git a/src/mapnik.cpp b/src/mapnik.cpp index 0a67bce34..9dbe3a8e0 100644 --- a/src/mapnik.cpp +++ b/src/mapnik.cpp @@ -40,6 +40,7 @@ void register_image_readers() } } // namespace mapnik +#if !defined(MAPNIK_STATIC_PLUGINS) || !defined(_WIN32) namespace { class AutoSetup final { @@ -48,3 +49,4 @@ class AutoSetup final }; AutoSetup auto_setup{}; } // namespace +#endif diff --git a/src/wkt/CMakeLists.txt b/src/wkt/CMakeLists.txt index 7cb0db1fd..562cc67e9 100644 --- a/src/wkt/CMakeLists.txt +++ b/src/wkt/CMakeLists.txt @@ -27,6 +27,7 @@ set_target_properties(wkt PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) mapnik_install(wkt) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a7aa3f98e..d1c98cc08 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -104,6 +104,7 @@ set_target_properties(mapnik-test-unit PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) target_link_libraries(mapnik-test-unit PUBLIC Catch2::Catch2 @@ -123,6 +124,7 @@ set_target_properties(agg_rasterizer_integer_overflow_test PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) target_link_libraries(agg_rasterizer_integer_overflow_test PUBLIC Catch2::Catch2 @@ -137,6 +139,7 @@ set_target_properties(datasource_registration_test PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) target_link_libraries(datasource_registration_test PUBLIC Catch2::Catch2 @@ -150,6 +153,7 @@ set_target_properties(font_registration_test PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) target_link_libraries(font_registration_test PUBLIC Catch2::Catch2 @@ -165,6 +169,7 @@ set_target_properties(map_xml_test PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) target_link_libraries(map_xml_test PUBLIC Catch2::Catch2 diff --git a/test/visual/CMakeLists.txt b/test/visual/CMakeLists.txt index a1d561c7e..582fff51b 100644 --- a/test/visual/CMakeLists.txt +++ b/test/visual/CMakeLists.txt @@ -8,6 +8,7 @@ set_target_properties(mapnik-test-visual PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) target_link_libraries(mapnik-test-visual PRIVATE Catch2::Catch2 diff --git a/utils/geometry_to_wkb/CMakeLists.txt b/utils/geometry_to_wkb/CMakeLists.txt index 518f4ac9a..c858d692f 100644 --- a/utils/geometry_to_wkb/CMakeLists.txt +++ b/utils/geometry_to_wkb/CMakeLists.txt @@ -4,6 +4,7 @@ target_link_libraries(geometry_to_wkb PRIVATE mapnik::mapnik) set_target_properties(geometry_to_wkb PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) mapnik_install_utility(geometry_to_wkb) diff --git a/utils/mapnik-index/CMakeLists.txt b/utils/mapnik-index/CMakeLists.txt index ec6ce97eb..897747288 100644 --- a/utils/mapnik-index/CMakeLists.txt +++ b/utils/mapnik-index/CMakeLists.txt @@ -15,6 +15,7 @@ target_link_libraries(mapnik-index PRIVATE set_target_properties(mapnik-index PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) mapnik_install_utility(mapnik-index) diff --git a/utils/mapnik-render/CMakeLists.txt b/utils/mapnik-render/CMakeLists.txt index 27ccfbe8d..974a8990b 100644 --- a/utils/mapnik-render/CMakeLists.txt +++ b/utils/mapnik-render/CMakeLists.txt @@ -9,6 +9,7 @@ target_link_libraries(mapnik-render PRIVATE set_target_properties(mapnik-render PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) mapnik_install_utility(mapnik-render) diff --git a/utils/ogrindex/CMakeLists.txt b/utils/ogrindex/CMakeLists.txt index 69f27cdd6..564783771 100644 --- a/utils/ogrindex/CMakeLists.txt +++ b/utils/ogrindex/CMakeLists.txt @@ -4,6 +4,7 @@ target_link_libraries(ogrindex PRIVATE mapnik::mapnik) set_target_properties(ogrindex PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) mapnik_install_utility(ogrindex) diff --git a/utils/pgsql2sqlite/CMakeLists.txt b/utils/pgsql2sqlite/CMakeLists.txt index 6def100c0..b5264ae60 100644 --- a/utils/pgsql2sqlite/CMakeLists.txt +++ b/utils/pgsql2sqlite/CMakeLists.txt @@ -17,6 +17,7 @@ target_link_libraries(pgsql2sqlite PRIVATE set_target_properties(pgsql2sqlite PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) mapnik_install_utility(pgsql2sqlite) diff --git a/utils/shapeindex/CMakeLists.txt b/utils/shapeindex/CMakeLists.txt index d39ca3f04..386ebd3c0 100644 --- a/utils/shapeindex/CMakeLists.txt +++ b/utils/shapeindex/CMakeLists.txt @@ -12,6 +12,7 @@ target_link_libraries(shapeindex PRIVATE set_target_properties(shapeindex PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) mapnik_install_utility(shapeindex) diff --git a/utils/svg2png/CMakeLists.txt b/utils/svg2png/CMakeLists.txt index dc239cd2b..34ee18462 100644 --- a/utils/svg2png/CMakeLists.txt +++ b/utils/svg2png/CMakeLists.txt @@ -12,6 +12,7 @@ target_link_libraries(svg2png PRIVATE set_target_properties(svg2png PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) mapnik_install_utility(svg2png) From 34df24f4e286f717bc4d03344b54a532608db854 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 22 Apr 2022 21:10:42 +0200 Subject: [PATCH 25/38] [CMake] use pkgconfig for webp; make some statements more clearly --- CMakeLists.txt | 6 +-- cmake/FindWebP.cmake | 97 ----------------------------------- cmake/MapnikExport.cmake | 63 +++++++++++------------ cmake/MapnikFindPackage.cmake | 22 ++++---- 4 files changed, 44 insertions(+), 144 deletions(-) delete mode 100644 cmake/FindWebP.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f8148fc0..1267e4fcf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -296,15 +296,15 @@ if(USE_TIFF) endif() if(USE_WEBP) - mapnik_find_package(WebP REQUIRED) + pkg_check_modules(WebP REQUIRED IMPORTED_TARGET libwebp) list(APPEND MAPNIK_COMPILE_DEFS HAVE_WEBP) - list(APPEND MAPNIK_OPTIONAL_LIBS WebP::WebP) + list(APPEND MAPNIK_OPTIONAL_LIBS PkgConfig::WebP) endif() if(USE_CAIRO) pkg_check_modules(Cairo REQUIRED IMPORTED_TARGET cairo) - list(APPEND MAPNIK_OPTIONAL_LIBS PkgConfig::Cairo) list(APPEND MAPNIK_COMPILE_DEFS HAVE_CAIRO) + list(APPEND MAPNIK_OPTIONAL_LIBS PkgConfig::Cairo) endif() if(USE_PROJ) diff --git a/cmake/FindWebP.cmake b/cmake/FindWebP.cmake deleted file mode 100644 index 860dc3dfe..000000000 --- a/cmake/FindWebP.cmake +++ /dev/null @@ -1,97 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#[=======================================================================[.rst: -FindWebP -------- - -Finds the WebP library. - -Imported Targets -^^^^^^^^^^^^^^^^ - -This module provides the following imported targets, if found: - -``WebP::WebP`` - The WebP library - -Result Variables -^^^^^^^^^^^^^^^^ - -This will define the following variables: - -``WebP_FOUND`` - True if the system has the WebP library. -``WebP_VERSION`` - The version of the WebP library which was found. -``WebP_INCLUDE_DIRS`` - Include directories needed to use WebP. -``WebP_LIBRARIES`` - Libraries needed to link to WebP. - -Cache Variables -^^^^^^^^^^^^^^^ - -The following cache variables may also be set: - -``WebP_INCLUDE_DIR`` - The directory containing ``decode.h``. -``WebP_LIBRARY`` - The path to the Foo library. - -#]=======================================================================] - -if(NOT WebP_LIBRARY) - find_package(PkgConfig QUIET) - pkg_check_modules(PC_WebP QUIET libwebp) - set(WebP_VERSION ${PC_WebP_VERSION}) - find_path(WebP_INCLUDE_DIR NAMES decode.h HINTS ${PC_WebP_INCLUDEDIR} ${PC_WebP_INCLUDE_DIR} PATH_SUFFIXES webp) - find_library(WebP_LIBRARY_RELEASE NAMES ${WebP_NAMES} webp HINTS ${PC_WebP_LIBDIR} ${PC_WebP_LIBRARY_DIRS}) - find_library(WebP_LIBRARY_DEBUG NAMES ${WebP_NAMES} webpd HINTS ${PC_WebP_LIBDIR} ${PC_WebP_LIBRARY_DIRS}) - include(SelectLibraryConfigurations) - select_library_configurations(WebP) -else() - file(TO_CMAKE_PATH "${WebP_LIBRARY}" WebP_LIBRARY) -endif() - -if ("${WebP_FIND_VERSION}" VERSION_GREATER "${WebP_VERSION}") - if (WebP_VERSION) - message(FATAL_ERROR "Required version (" ${WebP_FIND_VERSION} ") is higher than found version (" ${PC_WebP_VERSION} ")") - else () - message(WARNING "Cannot determine WebP version without pkg-config") - endif () -endif () - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(WebP - REQUIRED_VARS - WebP_LIBRARY - WebP_INCLUDE_DIR - VERSION_VAR WebP_VERSION -) -mark_as_advanced(WebP_INCLUDE_DIR WebP_LIBRARY) - -if (WebP_FOUND) - set(WebP_LIBRARIES ${WebP_LIBRARY}) - set(WebP_INCLUDE_DIRS ${WebP_INCLUDE_DIR}) - if(NOT TARGET WebP::WebP) - add_library(WebP::WebP UNKNOWN IMPORTED) - set_target_properties(WebP::WebP PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES ${WebP_INCLUDE_DIR} - IMPORTED_LINK_INTERFACE_LANGUAGES C) - - if(WebP_LIBRARY_RELEASE) - set_property(TARGET WebP::WebP APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) - set_target_properties(WebP::WebP PROPERTIES IMPORTED_LOCATION_RELEASE "${WebP_LIBRARY_RELEASE}") - endif() - - if(WebP_LIBRARY_DEBUG) - set_property(TARGET WebP::WebP APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) - set_target_properties(WebP::WebP PROPERTIES IMPORTED_LOCATION_DEBUG "${WebP_LIBRARY_DEBUG}") - endif() - - if(NOT WebP_LIBRARY_RELEASE AND NOT WebP_LIBRARY_DEBUG) - set_target_properties(WebP::WebP PROPERTIES IMPORTED_LOCATION "${WebP_LIBRARY}") - endif() - endif() -endif () diff --git a/cmake/MapnikExport.cmake b/cmake/MapnikExport.cmake index 5d63f0050..267c64f9f 100644 --- a/cmake/MapnikExport.cmake +++ b/cmake/MapnikExport.cmake @@ -1,34 +1,31 @@ include(CMakePackageConfigHelpers) -# export mapnik configuration -write_basic_package_version_file( - "${CMAKE_CURRENT_BINARY_DIR}/mapnikConfigVersion.cmake" - VERSION ${MAPNIK_VERSION} - COMPATIBILITY ExactVersion -) -get_property(MAPNIK_UTILITIES GLOBAL PROPERTY MAPNIK_UTILITIES) -list(JOIN MAPNIK_DEPENDENCIES "\n" MAPNIK_DEPENDENCIES) -configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/mapnikConfig.cmake.in - "${CMAKE_CURRENT_BINARY_DIR}/mapnikConfig.cmake" - INSTALL_DESTINATION ${MAPNIK_CMAKE_DIR} - PATH_VARS MAPNIK_INCLUDE_DIR PLUGINS_INSTALL_DIR FONTS_INSTALL_DIR MAPNIK_DEPENDENCIES MAPNIK_UTILITIES - NO_CHECK_REQUIRED_COMPONENTS_MACRO -) - -install( - FILES - "${CMAKE_CURRENT_BINARY_DIR}/mapnikConfig.cmake" +### exports mapnik cmake config files (mapnikConfigVersion and mapnikConfig) +function(mapnik_export_cmake_config) + # export mapnik configuration + write_basic_package_version_file( "${CMAKE_CURRENT_BINARY_DIR}/mapnikConfigVersion.cmake" - DESTINATION ${MAPNIK_CMAKE_DIR} -) + VERSION ${MAPNIK_VERSION} + COMPATIBILITY ExactVersion + ) + get_property(MAPNIK_UTILITIES GLOBAL PROPERTY MAPNIK_UTILITIES) + list(JOIN MAPNIK_DEPENDENCIES "\n" MAPNIK_DEPENDENCIES) + configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/mapnikConfig.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/mapnikConfig.cmake" + INSTALL_DESTINATION ${MAPNIK_CMAKE_DIR} + PATH_VARS MAPNIK_INCLUDE_DIR PLUGINS_INSTALL_DIR FONTS_INSTALL_DIR MAPNIK_DEPENDENCIES MAPNIK_UTILITIES + NO_CHECK_REQUIRED_COMPONENTS_MACRO + ) + install( + FILES + "${CMAKE_CURRENT_BINARY_DIR}/mapnikConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/mapnikConfigVersion.cmake" + DESTINATION ${MAPNIK_CMAKE_DIR} + ) +endfunction() -# install our modules, so that the expected target names are found. -install( - FILES - "${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindCairo.cmake" - "${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindWebP.cmake" - DESTINATION ${MAPNIK_CMAKE_DIR}/Modules -) + +mapnik_export_cmake_config() install(EXPORT MapnikTargets DESTINATION ${MAPNIK_CMAKE_DIR} @@ -36,21 +33,21 @@ install(EXPORT MapnikTargets NAMESPACE mapnik:: ) - +### install plugin cmake config files ### # Create configuration dependend files for the plugin install dirs. # some package managers are using different paths per configuration. string(TOLOWER "${CMAKE_BUILD_TYPE}" _build_type) string(TOUPPER "${CMAKE_BUILD_TYPE}" _build_type_l) -set(_mapnik_plugin_file_name "mapnikPlugins-${_build_type}") -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_mapnik_plugin_file_name}.cmake.in "set(MAPNIK_PLUGINS_DIR_${_build_type_l} \"@PACKAGE_PLUGINS_INSTALL_DIR@\" CACHE STRING \"\")\n") +set(m_mapnik_plugin_file_name mapnikPlugins-${_build_type}) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${m_mapnik_plugin_file_name}.cmake.in" "set(MAPNIK_PLUGINS_DIR_${_build_type_l} \"@PACKAGE_PLUGINS_INSTALL_DIR@\" CACHE STRING \"\")\n") include(CMakePackageConfigHelpers) configure_package_config_file( - ${CMAKE_CURRENT_BINARY_DIR}/${_mapnik_plugin_file_name}.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/${_mapnik_plugin_file_name}.cmake + "${CMAKE_CURRENT_BINARY_DIR}/${m_mapnik_plugin_file_name}.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/${m_mapnik_plugin_file_name}.cmake" PATH_VARS PLUGINS_INSTALL_DIR INSTALL_DESTINATION ${MAPNIK_CMAKE_DIR} ) install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/${_mapnik_plugin_file_name}.cmake + FILES "${CMAKE_CURRENT_BINARY_DIR}/${m_mapnik_plugin_file_name}.cmake" DESTINATION ${MAPNIK_CMAKE_DIR} ) diff --git a/cmake/MapnikFindPackage.cmake b/cmake/MapnikFindPackage.cmake index 8bcd96216..ed2997f23 100644 --- a/cmake/MapnikFindPackage.cmake +++ b/cmake/MapnikFindPackage.cmake @@ -1,16 +1,16 @@ macro(mapnik_print_version) - string(TOUPPER ${ARGV0} TLNUP) - set(TLN ${ARGV0}) - if(${TLN}_VERSION_STRING) - message(STATUS "Using ${ARGV0} version: ${${TLN}_VERSION_STRING}") - elseif(${TLN}_VERSION) - message(STATUS "Using ${ARGV0} version: ${${TLN}_VERSION}") - elseif(${TLNUP}_VERSION_STRING) - message(STATUS "Using ${ARGV0} version: ${${TLNUP}_VERSION_STRING}") - elseif(${TLNUP}_VERSION) - message(STATUS "Using ${ARGV0} version: ${${TLNUP}_VERSION}") + string(TOUPPER ${ARGV0} m_package_name_upc) + set(m_package_name ${ARGV0}) + if(${m_package_name}_VERSION_STRING) + message(STATUS "Using ${m_package_name} version: ${${m_package_name}_VERSION_STRING}") + elseif(${m_package_name}_VERSION) + message(STATUS "Using ${m_package_name} version: ${${m_package_name}_VERSION}") + elseif(${m_package_name_upc}_VERSION_STRING) + message(STATUS "Using ${m_package_name} version: ${${m_package_name_upc}_VERSION_STRING}") + elseif(${m_package_name_upc}_VERSION) + message(STATUS "Using ${m_package_name} version: ${${m_package_name_upc}_VERSION}") else() - message(STATUS "Using ${ARGV0}") + message(STATUS "Using ${m_package_name}") endif() endmacro() From 54b0381f4daff69a2ca2f481c84965b018815b2d Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Tue, 16 Aug 2022 21:03:56 +0200 Subject: [PATCH 26/38] wip --- CMakeLists.txt | 2 ++ plugins/input/pgraster/CMakeLists.txt | 2 +- plugins/input/postgis/CMakeLists.txt | 2 +- test/CMakeLists.txt | 5 ++--- utils/pgsql2sqlite/CMakeLists.txt | 6 +++--- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1267e4fcf..c36d9f7ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,7 @@ message(STATUS "mapnik version: ${PROJECT_VERSION}") # https://cliutils.gitlab.io/modern-cmake/chapters/features/ides.html set_property(GLOBAL PROPERTY USE_FOLDERS ON) +set(CMAKE_FIND_PACKAGE_TARGETS_GLOBAL ON) # with newer cmake versions put all find_package in global scope set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") include(FeatureSummary) include(MapnikOption) @@ -132,6 +133,7 @@ set(MAPNIK_OPTIONAL_LIBS_INCLUDE "") # Begin project configuration # needs to be before the first call of find_boost. +list(APPEND MAPNIK_COMPILE_DEFS BOOST_SPIRIT_X3_HIDE_CXX17_WARNING) if(USE_MULTITHREADED) set(Boost_USE_MULTITHREADED ON) list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_THREADSAFE) diff --git a/plugins/input/pgraster/CMakeLists.txt b/plugins/input/pgraster/CMakeLists.txt index 7458a4420..e75370c28 100644 --- a/plugins/input/pgraster/CMakeLists.txt +++ b/plugins/input/pgraster/CMakeLists.txt @@ -1,4 +1,4 @@ -find_package(PostgreSQL REQUIRED) +mapnik_find_package(PostgreSQL REQUIRED) add_plugin_target(input-pgraster "pgraster") target_sources(input-pgraster ${_plugin_visibility} diff --git a/plugins/input/postgis/CMakeLists.txt b/plugins/input/postgis/CMakeLists.txt index 93346d6e4..7eaae3402 100644 --- a/plugins/input/postgis/CMakeLists.txt +++ b/plugins/input/postgis/CMakeLists.txt @@ -1,4 +1,4 @@ -find_package(PostgreSQL REQUIRED) +mapnik_find_package(PostgreSQL REQUIRED) add_plugin_target(input-postgis "postgis") target_sources(input-postgis ${_plugin_visibility} diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d1c98cc08..191524ae6 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,5 +1,5 @@ -find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options) -find_package(PostgreSQL REQUIRED) +mapnik_find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options) +mapnik_find_package(PostgreSQL REQUIRED) include(FetchContent) @@ -163,7 +163,6 @@ target_link_libraries(font_registration_test PUBLIC ) target_include_directories(font_registration_test PRIVATE "${Catch2_SOURCE_DIR}/single_include/catch2" "${CMAKE_CURRENT_BINARY_DIR}") -#not workable since boost::filesystem native returns a wstring and the function taskes a std::string add_executable(map_xml_test standalone/map_xml_test.cpp) set_target_properties(map_xml_test PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" diff --git a/utils/pgsql2sqlite/CMakeLists.txt b/utils/pgsql2sqlite/CMakeLists.txt index b5264ae60..9b7c929fe 100644 --- a/utils/pgsql2sqlite/CMakeLists.txt +++ b/utils/pgsql2sqlite/CMakeLists.txt @@ -1,6 +1,6 @@ -find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options) -find_package(SQLite3 REQUIRED) -find_package(PostgreSQL REQUIRED) +mapnik_find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options) +mapnik_find_package(SQLite3 REQUIRED) +mapnik_find_package(PostgreSQL REQUIRED) add_executable(pgsql2sqlite main.cpp From f6bcdac258eabe1bd211ed2c2cdaa133be6dfcad Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 17 Aug 2022 17:16:32 +0200 Subject: [PATCH 27/38] default crt = 0N --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c36d9f7ce..ae664dd95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ mapnik_option(INSTALL_DEPENDENCIES "if ON, all dependencies (eg. required dlls) mapnik_option(BUILD_SHARED_LIBS "build mapnik dynamic(ON) or static(OFF)" ON) mapnik_option(BUILD_SHARED_PLUGINS "build dynamic plugins" ${BUILD_SHARED_LIBS}) # use BUILD_SHARED_LIBS as default option -mapnik_option(BUILD_SHARED_CRT "(only windows with msvc) use msvc shared crt" ${BUILD_SHARED_LIBS}) # use BUILD_SHARED_LIBS as default option +mapnik_option(BUILD_SHARED_CRT "(only windows with msvc) use msvc shared crt" ON) if(WIN32 AND BUILD_SHARED_PLUGINS AND NOT BUILD_SHARED_LIBS) message(FATAL_ERROR "static libmapnik and dynamic plugins won't work correctly") endif() From f48589738f9eb70b8503827e32f62d9f75cefaa8 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 17 Aug 2022 17:19:59 +0200 Subject: [PATCH 28/38] precommit --- .pre-commit-config.yaml | 16 + CMakeLists.txt | 36 +- benchmark/CMakeLists.txt | 8 +- cmake/MapnikExportPkgConfig.cmake | 8 +- cmake/MapnikInstall.cmake | 2 +- cmake/clang-format.cmake | 2 +- cmake/mapnikConfig.cmake.in | 6 +- demo/c++/CMakeLists.txt | 2 +- demo/viewer/CMakeLists.txt | 8 +- deps/agg/CMakeLists.txt | 4 +- deps/agg/include/agg_alpha_mask_u8.h | 786 +- deps/agg/include/agg_arc.h | 78 +- deps/agg/include/agg_array.h | 1993 +- deps/agg/include/agg_arrowhead.h | 101 +- deps/agg/include/agg_basics.h | 827 +- deps/agg/include/agg_bezier_arc.h | 226 +- deps/agg/include/agg_bitset_iterator.h | 50 +- deps/agg/include/agg_blur.h | 2419 +- deps/agg/include/agg_bounding_rect.h | 155 +- deps/agg/include/agg_bspline.h | 86 +- deps/agg/include/agg_clip_liang_barsky.h | 521 +- deps/agg/include/agg_color_gray.h | 524 +- deps/agg/include/agg_color_rgba.h | 525 +- deps/agg/include/agg_config.h | 13 +- deps/agg/include/agg_conv_adaptor_vcgen.h | 161 +- deps/agg/include/agg_conv_adaptor_vpgen.h | 217 +- deps/agg/include/agg_conv_bspline.h | 38 +- deps/agg/include/agg_conv_clip_polygon.h | 56 +- deps/agg/include/agg_conv_clip_polyline.h | 56 +- deps/agg/include/agg_conv_close_polygon.h | 195 +- deps/agg/include/agg_conv_concat.h | 93 +- deps/agg/include/agg_conv_contour.h | 65 +- deps/agg/include/agg_conv_curve.h | 279 +- deps/agg/include/agg_conv_dash.h | 57 +- deps/agg/include/agg_conv_gpc.h | 690 +- deps/agg/include/agg_conv_marker.h | 146 +- deps/agg/include/agg_conv_marker_adaptor.h | 43 +- deps/agg/include/agg_conv_offset.h | 139 +- deps/agg/include/agg_conv_segmentator.h | 39 +- deps/agg/include/agg_conv_shorten_path.h | 42 +- deps/agg/include/agg_conv_smooth_poly1.h | 110 +- deps/agg/include/agg_conv_stroke.h | 73 +- deps/agg/include/agg_conv_transform.h | 68 +- deps/agg/include/agg_conv_unclose_polygon.h | 53 +- deps/agg/include/agg_curves.h | 1170 +- deps/agg/include/agg_dda_line.h | 417 +- deps/agg/include/agg_ellipse.h | 189 +- deps/agg/include/agg_ellipse_bresenham.h | 156 +- deps/agg/include/agg_embedded_raster_fonts.h | 77 +- deps/agg/include/agg_font_cache_manager.h | 617 +- deps/agg/include/agg_gamma_functions.h | 227 +- deps/agg/include/agg_gamma_lut.h | 461 +- deps/agg/include/agg_glyph_raster_bin.h | 253 +- deps/agg/include/agg_gradient_lut.h | 392 +- deps/agg/include/agg_gsv_text.h | 201 +- deps/agg/include/agg_image_accessors.h | 781 +- deps/agg/include/agg_image_filters.h | 817 +- deps/agg/include/agg_line_aa_basics.h | 312 +- deps/agg/include/agg_math.h | 684 +- deps/agg/include/agg_math_stroke.h | 745 +- deps/agg/include/agg_path_length.h | 69 +- deps/agg/include/agg_path_storage.h | 2787 +- deps/agg/include/agg_path_storage_integer.h | 458 +- deps/agg/include/agg_pattern_filters_rgba.h | 146 +- deps/agg/include/agg_pixfmt_amask_adaptor.h | 335 +- deps/agg/include/agg_pixfmt_base.h | 121 +- deps/agg/include/agg_pixfmt_gray.h | 1114 +- deps/agg/include/agg_pixfmt_rgb.h | 1356 +- deps/agg/include/agg_pixfmt_rgb_packed.h | 2205 +- deps/agg/include/agg_pixfmt_rgba.h | 1886 +- deps/agg/include/agg_pixfmt_transposer.h | 213 +- deps/agg/include/agg_rasterizer_cells_aa.h | 1269 +- deps/agg/include/agg_rasterizer_compound_aa.h | 1177 +- deps/agg/include/agg_rasterizer_outline.h | 187 +- deps/agg/include/agg_rasterizer_outline_aa.h | 875 +- deps/agg/include/agg_rasterizer_scanline_aa.h | 816 +- deps/agg/include/agg_rasterizer_sl_clip.h | 479 +- deps/agg/include/agg_renderer_base.h | 1355 +- deps/agg/include/agg_renderer_markers.h | 2044 +- deps/agg/include/agg_renderer_mclip.h | 533 +- deps/agg/include/agg_renderer_outline_aa.h | 3340 +- deps/agg/include/agg_renderer_outline_image.h | 1732 +- deps/agg/include/agg_renderer_primitives.h | 342 +- deps/agg/include/agg_renderer_raster_text.h | 382 +- deps/agg/include/agg_renderer_scanline.h | 1610 +- deps/agg/include/agg_rendering_buffer.h | 481 +- .../include/agg_rendering_buffer_dynarow.h | 180 +- deps/agg/include/agg_rounded_rect.h | 79 +- deps/agg/include/agg_scanline_bin.h | 388 +- .../include/agg_scanline_boolean_algebra.h | 2481 +- deps/agg/include/agg_scanline_p.h | 500 +- deps/agg/include/agg_scanline_storage_aa.h | 1352 +- deps/agg/include/agg_scanline_storage_bin.h | 987 +- deps/agg/include/agg_scanline_u.h | 879 +- deps/agg/include/agg_shorten_path.h | 74 +- deps/agg/include/agg_simul_eq.h | 231 +- deps/agg/include/agg_span_allocator.h | 53 +- deps/agg/include/agg_span_converter.h | 64 +- deps/agg/include/agg_span_gouraud.h | 314 +- deps/agg/include/agg_span_gouraud_gray.h | 409 +- deps/agg/include/agg_span_gouraud_rgba.h | 492 +- deps/agg/include/agg_span_gradient.h | 604 +- deps/agg/include/agg_span_gradient_alpha.h | 190 +- deps/agg/include/agg_span_image_filter.h | 380 +- deps/agg/include/agg_span_image_filter_gray.h | 1197 +- deps/agg/include/agg_span_image_filter_rgb.h | 1399 +- deps/agg/include/agg_span_image_filter_rgba.h | 1477 +- .../include/agg_span_interpolator_adaptor.h | 93 +- .../include/agg_span_interpolator_linear.h | 380 +- .../agg/include/agg_span_interpolator_persp.h | 758 +- .../agg/include/agg_span_interpolator_trans.h | 114 +- deps/agg/include/agg_span_pattern_gray.h | 119 +- deps/agg/include/agg_span_pattern_rgb.h | 125 +- deps/agg/include/agg_span_pattern_rgba.h | 121 +- deps/agg/include/agg_span_solid.h | 52 +- deps/agg/include/agg_span_subdiv_adaptor.h | 203 +- deps/agg/include/agg_trans_affine.h | 904 +- deps/agg/include/agg_trans_bilinear.h | 244 +- deps/agg/include/agg_trans_double_path.h | 184 +- deps/agg/include/agg_trans_lens.h | 98 +- deps/agg/include/agg_trans_perspective.h | 1317 +- deps/agg/include/agg_trans_single_path.h | 121 +- deps/agg/include/agg_trans_viewport.h | 498 +- deps/agg/include/agg_trans_warp_magnifier.h | 64 +- deps/agg/include/agg_vcgen_bspline.h | 73 +- deps/agg/include/agg_vcgen_contour.h | 113 +- deps/agg/include/agg_vcgen_dash.h | 97 +- deps/agg/include/agg_vcgen_markers_term.h | 80 +- deps/agg/include/agg_vcgen_smooth_poly1.h | 237 +- deps/agg/include/agg_vcgen_stroke.h | 151 +- deps/agg/include/agg_vcgen_vertex_sequence.h | 197 +- deps/agg/include/agg_vertex_sequence.h | 269 +- deps/agg/include/agg_vpgen_clip_polygon.h | 106 +- deps/agg/include/agg_vpgen_clip_polyline.h | 97 +- deps/agg/include/agg_vpgen_segmentator.h | 66 +- deps/agg/src/agg_arc.cpp | 47 +- deps/agg/src/agg_arrowhead.cpp | 77 +- deps/agg/src/agg_bezier_arc.cpp | 124 +- deps/agg/src/agg_bspline.cpp | 162 +- deps/agg/src/agg_curves.cpp | 499 +- deps/agg/src/agg_embedded_raster_fonts.cpp | 14558 ++++---- deps/agg/src/agg_gsv_text.cpp | 863 +- deps/agg/src/agg_image_filters.cpp | 36 +- deps/agg/src/agg_line_aa_basics.cpp | 26 +- deps/agg/src/agg_line_profile_aa.cpp | 50 +- deps/agg/src/agg_pixfmt_rgba.cpp | 117 +- deps/agg/src/agg_rounded_rect.cpp | 186 +- deps/agg/src/agg_sqrt_tables.cpp | 167 +- deps/agg/src/agg_trans_affine.cpp | 104 +- deps/agg/src/agg_trans_double_path.cpp | 186 +- deps/agg/src/agg_trans_single_path.cpp | 152 +- deps/agg/src/agg_trans_warp_magnifier.cpp | 18 +- deps/agg/src/agg_vcgen_bspline.cpp | 142 +- deps/agg/src/agg_vcgen_contour.cpp | 147 +- deps/agg/src/agg_vcgen_dash.cpp | 186 +- deps/agg/src/agg_vcgen_markers_term.cpp | 23 +- deps/agg/src/agg_vcgen_stroke.cpp | 264 +- deps/agg/src/agg_vpgen_clip_polygon.cpp | 47 +- deps/agg/src/agg_vpgen_clip_polyline.cpp | 11 +- deps/agg/src/agg_vpgen_segmentator.cpp | 23 +- .../extensions/algorithms/closest_point.hpp | 133 +- .../strategies/cartesian/closest_point.hpp | 66 +- deps/boost/gil/extension/toolbox/hsl.hpp | 385 +- deps/boost/gil/extension/toolbox/hsv.hpp | 345 +- .../sparsehash/internal/densehashtable.h | 2334 +- .../sparsehash/internal/hashtable-common.h | 410 +- .../internal/libc_allocator_with_realloc.h | 109 +- deps/mapnik/sparsehash/template_util.h | 59 +- deps/mapnik/sparsehash/type_traits.h | 469 +- include/mapnik/debug.hpp | 10 +- include/mapnik/hextree.hpp | 15 +- include/mapnik/jpeg_io.hpp | 3 +- include/mapnik/offset_converter.hpp | 5 +- include/mapnik/png_io.hpp | 3 +- include/mapnik/svg/svg_renderer_agg.hpp | 10 +- include/mapnik/text/color_font_renderer.hpp | 3 +- include/mapnik/text/face.hpp | 3 +- include/mapnik/text/renderer.hpp | 3 +- include/mapnik/tiff_io.hpp | 3 +- include/mapnik/util/file_io.hpp | 20 +- include/mapnik/util/singleton.hpp | 5 +- include/mapnik/webp_io.hpp | 3 +- plugins/input/CMakeLists.txt | 4 +- plugins/input/base/CMakeLists.txt | 4 +- .../base/include/mapnik/datasource_plugin.hpp | 5 +- plugins/input/csv/CMakeLists.txt | 4 +- plugins/input/gdal/CMakeLists.txt | 3 +- plugins/input/geobuf/CMakeLists.txt | 3 +- plugins/input/geojson/CMakeLists.txt | 6 +- plugins/input/ogr/ogr_layer_ptr.hpp | 15 +- plugins/input/pgraster/CMakeLists.txt | 6 +- .../input/pgraster/pgraster_datasource.cpp | 1 - plugins/input/postgis/CMakeLists.txt | 6 +- plugins/input/postgis/connection.hpp | 18 +- plugins/input/postgis/resultset.hpp | 3 +- plugins/input/raster/CMakeLists.txt | 2 +- plugins/input/shape/CMakeLists.txt | 4 +- plugins/input/shape/shapefile.hpp | 25 +- plugins/input/sqlite/CMakeLists.txt | 2 +- plugins/input/sqlite/sqlite_connection.hpp | 8 +- plugins/input/sqlite/sqlite_prepared.hpp | 3 +- plugins/input/sqlite/sqlite_resultset.hpp | 3 +- plugins/input/sqlite/sqlite_utils.hpp | 3 +- src/CMakeLists.txt | 20 +- src/font_engine_freetype.cpp | 3 +- src/image_options.cpp | 3 +- src/image_util_png.cpp | 3 +- src/jpeg_reader.cpp | 3 +- src/json/CMakeLists.txt | 6 +- src/mapnik.cpp | 2 +- src/memory_datasource.cpp | 1 - src/png_reader.cpp | 3 +- src/proj_transform.cpp | 18 +- src/text/face.cpp | 3 +- src/text/font_library.cpp | 3 +- src/tiff_reader.cpp | 3 +- src/tiff_reader.hpp | 53 +- src/webp_reader.cpp | 3 +- src/wkt/CMakeLists.txt | 8 +- test/CMakeLists.txt | 34 +- test/catch.hpp | 27624 +++++++++------- test/catch_ext.hpp | 27 +- test/unit/datasource/postgis.cpp | 5 +- test/unit/imaging/image.cpp | 5 +- test/unit/imaging/tiff_io.cpp | 10 +- test/unit/numerics/safe_cast.cpp | 65 +- test/visual/CMakeLists.txt | 4 +- utils/geometry_to_wkb/CMakeLists.txt | 2 +- utils/mapnik-index/CMakeLists.txt | 2 +- utils/mapnik-render/CMakeLists.txt | 4 +- utils/ogrindex/CMakeLists.txt | 2 +- utils/pgsql2sqlite/CMakeLists.txt | 6 +- utils/shapeindex/CMakeLists.txt | 4 +- utils/svg2png/CMakeLists.txt | 8 +- 234 files changed, 58907 insertions(+), 58207 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..0df4f091e --- /dev/null +++ b/.pre-commit-config.yaml @@ -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] diff --git a/CMakeLists.txt b/CMakeLists.txt index ae664dd95..a09e6f1f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,11 +5,11 @@ cmake_minimum_required(VERSION 3.15) include(cmake/GetVersion.cmake) get_mapnik_version() -project(mapnik +project(mapnik VERSION ${MAPNIK_MAJOR_VERSION}.${MAPNIK_MINOR_VERSION}.${MAPNIK_PATCH_VERSION} - HOMEPAGE_URL "https://mapnik.org/" - DESCRIPTION "Mapnik is an open source toolkit for developing mapping applications" - LANGUAGES CXX + HOMEPAGE_URL "https://mapnik.org/" + DESCRIPTION "Mapnik is an open source toolkit for developing mapping applications" + LANGUAGES CXX ) message(STATUS "mapnik version: ${PROJECT_VERSION}") @@ -167,7 +167,7 @@ if(harfbuzz_FOUND) message(STATUS "Found harfbuzz native cmake") list(APPEND MAPNIK_OPTIONAL_LIBS harfbuzz::harfbuzz) 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. # harfbuzz related discussion: https://github.com/harfbuzz/harfbuzz/issues/2653 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) endif() else() - set(MAPBOX_GEOMETRY_INCLUDE_DIRS + set(MAPBOX_GEOMETRY_INCLUDE_DIRS $ $ ) endif() 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() if(USE_EXTERNAL_MAPBOX_POLYLABEL) @@ -197,13 +197,13 @@ if(USE_EXTERNAL_MAPBOX_POLYLABEL) find_path(MAPBOX_POLYLABEL_INCLUDE_DIRS "mapbox/polylabel.hpp") endif() else() - set(MAPBOX_POLYLABEL_INCLUDE_DIRS + set(MAPBOX_POLYLABEL_INCLUDE_DIRS $ $ ) endif() 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() if(USE_EXTERNAL_MAPBOX_PROTOZERO) @@ -212,13 +212,13 @@ if(USE_EXTERNAL_MAPBOX_PROTOZERO) find_path(MAPBOX_PROTOZERO_INCLUDE_DIRS "protozero/pbf_message.hpp") endif() else() - set(MAPBOX_PROTOZERO_INCLUDE_DIRS + set(MAPBOX_PROTOZERO_INCLUDE_DIRS $ $ ) endif() 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() if(USE_EXTERNAL_MAPBOX_VARIANT) @@ -227,13 +227,13 @@ if(USE_EXTERNAL_MAPBOX_VARIANT) find_path(MAPBOX_VARIANT_INCLUDE_DIRS "mapbox/variant.hpp") endif() else() - set(MAPBOX_VARIANT_INCLUDE_DIRS + set(MAPBOX_VARIANT_INCLUDE_DIRS $ $ ) endif() 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() # (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) endif() -if(USE_BIGINT) +if(USE_BIGINT) list(APPEND MAPNIK_COMPILE_DEFS BIGINT) endif() @@ -341,7 +341,7 @@ if(USE_SVG_RENDERER) list(APPEND MAPNIK_COMPILE_DEFS SVG_RENDERER) endif() -if(NOT WIN32) +if(NOT WIN32) message(STATUS "Compiling with -DMAPNIK_HAS_DLCFN") list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_HAS_DLCFN) list(APPEND MAPNIK_OPTIONAL_LIBS ${CMAKE_DL_LIBS}) @@ -365,8 +365,8 @@ add_compile_options( add_library(core INTERFACE) add_library(mapnik::core ALIAS core) -target_include_directories(core INTERFACE - $ +target_include_directories(core INTERFACE + $ $ $ $ @@ -375,7 +375,7 @@ target_include_directories(core INTERFACE $ ${MAPNIK_OPTIONAL_LIBS_INCLUDE} ) -target_link_libraries(core INTERFACE +target_link_libraries(core INTERFACE Threads::Threads ICU::uc ICU::data diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt index 9aefc6b29..0d8e96059 100644 --- a/benchmark/CMakeLists.txt +++ b/benchmark/CMakeLists.txt @@ -1,6 +1,6 @@ project(mapnik-benchmark) -set(BENCHMARK_SRCS +set(BENCHMARK_SRCS src/normalize_angle.cpp src/test_array_allocation.cpp src/test_expression_parse.cpp @@ -32,7 +32,7 @@ function(mapnik_create_benchmark) add_executable(${TARGET_NAME} ${ARGV0}) target_include_directories(${TARGET_NAME} PRIVATE include) 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}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" @@ -46,7 +46,7 @@ foreach(benchmark ${BENCHMARK_SRCS}) endforeach() file(COPY data DESTINATION "${MAPNIK_OUTPUT_DIR}/benchmark") -file(COPY run_benchmarks - DESTINATION "${MAPNIK_OUTPUT_DIR}" +file(COPY run_benchmarks + DESTINATION "${MAPNIK_OUTPUT_DIR}" FILE_PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE GROUP_WRITE GROUP_READ GROUP_EXECUTE WORLD_READ ) diff --git a/cmake/MapnikExportPkgConfig.cmake b/cmake/MapnikExportPkgConfig.cmake index b4b9cd5ef..f92e1e203 100644 --- a/cmake/MapnikExportPkgConfig.cmake +++ b/cmake/MapnikExportPkgConfig.cmake @@ -9,7 +9,7 @@ Name: @_lib_name@ Description: @_description@ Version: @MAPNIK_VERSION@ Libs: -L"${libdir}" -l$$_POSTFIX> -Cflags: -I"${includedir}" ]] +Cflags: -I"${includedir}" ]] _contents @ONLY) file(GENERATE @@ -26,11 +26,11 @@ endfunction() function(create_pkg_config_file_mapnik _lib_name _description) get_target_property(m_compile_defs core INTERFACE_COMPILE_DEFINITIONS) 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}") endif() - set(m_requires + set(m_requires libmapnikwkt libmapnikjson icu-uc @@ -71,7 +71,7 @@ Description: @_description@ Version: @MAPNIK_VERSION@ Requires: @m_requires@ Libs: -L"${libdir}" -l$$_POSTFIX> -Cflags: -I"${includedir}" @m_str_compile_defs@]] +Cflags: -I"${includedir}" @m_str_compile_defs@]] _contents @ONLY) file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_lib_name}-$.pc diff --git a/cmake/MapnikInstall.cmake b/cmake/MapnikInstall.cmake index b12ccab4c..43e01b8dd 100644 --- a/cmake/MapnikInstall.cmake +++ b/cmake/MapnikInstall.cmake @@ -90,7 +90,7 @@ function(mapnik_install_targets) message(STATUS \"internal_executables: ${_internal_executables}\") message(STATUS \"internal_libraries: ${_internal_libraries}\") message(STATUS \"ADDITIONAL_LIBARIES_PATHS: ${ADDITIONAL_LIBARIES_PATHS}\") - + include(BundleUtilities) fixup_bundle(\"${_internal_executables}\" \"${_internal_libraries}\" \"${ADDITIONAL_LIBARIES_PATHS}\") " COMPONENT MapnikRuntime) diff --git a/cmake/clang-format.cmake b/cmake/clang-format.cmake index 7681ffbf2..33af54f8e 100644 --- a/cmake/clang-format.cmake +++ b/cmake/clang-format.cmake @@ -1,5 +1,5 @@ function(format_dir dir) - file(GLOB_RECURSE sources + file(GLOB_RECURSE sources "${dir}/*.cpp" "${dir}/*.hpp" ) diff --git a/cmake/mapnikConfig.cmake.in b/cmake/mapnikConfig.cmake.in index e0aee8778..e5553f964 100644 --- a/cmake/mapnikConfig.cmake.in +++ b/cmake/mapnikConfig.cmake.in @@ -32,14 +32,14 @@ function(mapnik_find_plugin_dir PLUGIN_DIR) string(TOUPPER "${CMAKE_BUILD_TYPE}" _build_type_l) set(_plugin_dir "${MAPNIK_PLUGINS_DIR_${_build_type_l}}") # only release has more then one configuration - if(NOT _plugin_dir) + if(NOT _plugin_dir) set(_all_rel_cfgs RELEASE RELWITHDEBINFO MINSIZEREL) list(FIND _all_rel_cfgs ${_build_type_l} _is_rel_cfg) # check if the current configuration is a known release configuration if(${_is_rel_cfg} GREATER_EQUAL 0) foreach(_rel_cfg IN LISTS _all_rel_cfgs) set(_plugin_dir "${MAPNIK_PLUGINS_DIR_${_rel_cfg}}") - if(_plugin_dir) + if(_plugin_dir) break() endif() 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}") endif() set(${PLUGIN_DIR} ${_plugin_dir} PARENT_SCOPE) -endfunction() +endfunction() diff --git a/demo/c++/CMakeLists.txt b/demo/c++/CMakeLists.txt index fdf365528..567610f7e 100644 --- a/demo/c++/CMakeLists.txt +++ b/demo/c++/CMakeLists.txt @@ -1,5 +1,5 @@ add_executable(mapnik-demo rundemo.cpp) -set_target_properties(mapnik-demo PROPERTIES +set_target_properties(mapnik-demo PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" diff --git a/demo/viewer/CMakeLists.txt b/demo/viewer/CMakeLists.txt index b1e2355ae..b4a0c1113 100644 --- a/demo/viewer/CMakeLists.txt +++ b/demo/viewer/CMakeLists.txt @@ -14,7 +14,7 @@ set(PROJECT_SOURCES styles_model.cpp forms/about.ui forms/info.ui - forms/layer_info.ui + forms/layer_info.ui mapnik_viewer.qrc ) @@ -37,7 +37,7 @@ endif() set_target_properties(mapnik-viewer PROPERTIES AUTOUIC_SEARCH_PATHS forms - AUTORCC ON + AUTORCC ON AUTOUIC ON AUTOMOC ON LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" @@ -46,13 +46,13 @@ set_target_properties(mapnik-viewer PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) -target_link_libraries(mapnik-viewer PRIVATE +target_link_libraries(mapnik-viewer PRIVATE Qt${QT_VERSION_MAJOR}::Widgets mapnik::agg mapnik::mapnik ) -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini "[mapnik] plugins_dir=${PLUGINS_INSTALL_DIR} fonts/1/dir=${FONTS_INSTALL_DIR}" diff --git a/deps/agg/CMakeLists.txt b/deps/agg/CMakeLists.txt index a91a55bde..a08410b91 100644 --- a/deps/agg/CMakeLists.txt +++ b/deps/agg/CMakeLists.txt @@ -3,8 +3,8 @@ project(agg) add_library(agg INTERFACE) add_library(mapnik::agg ALIAS agg) -target_include_directories(agg INTERFACE - $ +target_include_directories(agg INTERFACE + $ $ ) target_link_libraries(agg INTERFACE mapnik::core) diff --git a/deps/agg/include/agg_alpha_mask_u8.h b/deps/agg/include/agg_alpha_mask_u8.h index ef7f32980..05483df04 100644 --- a/deps/agg/include/agg_alpha_mask_u8.h +++ b/deps/agg/include/agg_alpha_mask_u8.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -23,477 +23,427 @@ #include "agg_basics.h" #include "agg_rendering_buffer.h" -namespace agg +namespace agg { +//===================================================one_component_mask_u8 +struct one_component_mask_u8 { - //===================================================one_component_mask_u8 - struct one_component_mask_u8 + static unsigned calculate(const int8u* p) { return *p; } +}; + +//=====================================================rgb_to_gray_mask_u8 +template +struct rgb_to_gray_mask_u8 +{ + static unsigned calculate(const int8u* p) { return (p[R] * 77 + p[G] * 150 + p[B] * 29) >> 8; } +}; + +//==========================================================alpha_mask_u8 +template +class alpha_mask_u8 +{ + public: + typedef int8u cover_type; + typedef alpha_mask_u8 self_type; + enum cover_scale_e { cover_shift = 8, cover_none = 0, cover_full = 255 }; + + alpha_mask_u8() + : m_rbuf(0) + {} + explicit alpha_mask_u8(rendering_buffer& rbuf) + : m_rbuf(&rbuf) + {} + + void attach(rendering_buffer& rbuf) { m_rbuf = &rbuf; } + + MaskF& mask_function() { return m_mask_function; } + const MaskF& mask_function() const { return m_mask_function; } + + //-------------------------------------------------------------------- + cover_type pixel(int x, int y) const { - static unsigned calculate(const int8u* p) { return *p; } - }; - - - //=====================================================rgb_to_gray_mask_u8 - template - struct rgb_to_gray_mask_u8 - { - static unsigned calculate(const int8u* p) - { - return (p[R]*77 + p[G]*150 + p[B]*29) >> 8; - } - }; - - //==========================================================alpha_mask_u8 - template - class alpha_mask_u8 - { - public: - typedef int8u cover_type; - typedef alpha_mask_u8 self_type; - enum cover_scale_e - { - cover_shift = 8, - cover_none = 0, - cover_full = 255 - }; - - alpha_mask_u8() : m_rbuf(0) {} - explicit alpha_mask_u8(rendering_buffer& rbuf) : m_rbuf(&rbuf) {} - - void attach(rendering_buffer& rbuf) { m_rbuf = &rbuf; } - - MaskF& mask_function() { return m_mask_function; } - const MaskF& mask_function() const { return m_mask_function; } - - - //-------------------------------------------------------------------- - cover_type pixel(int x, int y) const + if (x >= 0 && y >= 0 && x < (int)m_rbuf->width() && y < (int)m_rbuf->height()) { - if(x >= 0 && y >= 0 && - x < (int)m_rbuf->width() && - y < (int)m_rbuf->height()) - { - return (cover_type)m_mask_function.calculate( - m_rbuf->row_ptr(y) + x * Step + Offset); - } - return 0; + return (cover_type)m_mask_function.calculate(m_rbuf->row_ptr(y) + x * Step + Offset); + } + return 0; + } + + //-------------------------------------------------------------------- + cover_type combine_pixel(int x, int y, cover_type val) const + { + if (x >= 0 && y >= 0 && x < (int)m_rbuf->width() && y < (int)m_rbuf->height()) + { + return ( + cover_type)((cover_full + val * m_mask_function.calculate(m_rbuf->row_ptr(y) + x * Step + Offset)) >> + cover_shift); + } + return 0; + } + + //-------------------------------------------------------------------- + void fill_hspan(int x, int y, cover_type* dst, int num_pix) const + { + int xmax = m_rbuf->width() - 1; + int ymax = m_rbuf->height() - 1; + + int count = num_pix; + cover_type* covers = dst; + + if (y < 0 || y > ymax) + { + memset(dst, 0, num_pix * sizeof(cover_type)); + return; } - //-------------------------------------------------------------------- - cover_type combine_pixel(int x, int y, cover_type val) const + if (x < 0) { - if(x >= 0 && y >= 0 && - x < (int)m_rbuf->width() && - y < (int)m_rbuf->height()) - { - return (cover_type)((cover_full + val * - m_mask_function.calculate( - m_rbuf->row_ptr(y) + x * Step + Offset)) >> - cover_shift); - } - return 0; - } - - - //-------------------------------------------------------------------- - void fill_hspan(int x, int y, cover_type* dst, int num_pix) const - { - int xmax = m_rbuf->width() - 1; - int ymax = m_rbuf->height() - 1; - - int count = num_pix; - cover_type* covers = dst; - - if(y < 0 || y > ymax) + count += x; + if (count <= 0) { memset(dst, 0, num_pix * sizeof(cover_type)); return; } - - if(x < 0) - { - count += x; - if(count <= 0) - { - memset(dst, 0, num_pix * sizeof(cover_type)); - return; - } - memset(covers, 0, -x * sizeof(cover_type)); - covers -= x; - x = 0; - } - - if(x + count > xmax) - { - int rest = x + count - xmax - 1; - count -= rest; - if(count <= 0) - { - memset(dst, 0, num_pix * sizeof(cover_type)); - return; - } - memset(covers + count, 0, rest * sizeof(cover_type)); - } - - const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; - do - { - *covers++ = (cover_type)m_mask_function.calculate(mask); - mask += Step; - } - while(--count); + memset(covers, 0, -x * sizeof(cover_type)); + covers -= x; + x = 0; } - - //-------------------------------------------------------------------- - void combine_hspan(int x, int y, cover_type* dst, int num_pix) const + if (x + count > xmax) { - int xmax = m_rbuf->width() - 1; - int ymax = m_rbuf->height() - 1; - - int count = num_pix; - cover_type* covers = dst; - - if(y < 0 || y > ymax) + int rest = x + count - xmax - 1; + count -= rest; + if (count <= 0) { memset(dst, 0, num_pix * sizeof(cover_type)); return; } - - if(x < 0) - { - count += x; - if(count <= 0) - { - memset(dst, 0, num_pix * sizeof(cover_type)); - return; - } - memset(covers, 0, -x * sizeof(cover_type)); - covers -= x; - x = 0; - } - - if(x + count > xmax) - { - int rest = x + count - xmax - 1; - count -= rest; - if(count <= 0) - { - memset(dst, 0, num_pix * sizeof(cover_type)); - return; - } - memset(covers + count, 0, rest * sizeof(cover_type)); - } - - const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; - do - { - *covers = (cover_type)((cover_full + (*covers) * - m_mask_function.calculate(mask)) >> - cover_shift); - ++covers; - mask += Step; - } - while(--count); + memset(covers + count, 0, rest * sizeof(cover_type)); } - //-------------------------------------------------------------------- - void fill_vspan(int x, int y, cover_type* dst, int num_pix) const + const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; + do { - int xmax = m_rbuf->width() - 1; - int ymax = m_rbuf->height() - 1; + *covers++ = (cover_type)m_mask_function.calculate(mask); + mask += Step; + } while (--count); + } - int count = num_pix; - cover_type* covers = dst; - - if(x < 0 || x > xmax) - { - memset(dst, 0, num_pix * sizeof(cover_type)); - return; - } - - if(y < 0) - { - count += y; - if(count <= 0) - { - memset(dst, 0, num_pix * sizeof(cover_type)); - return; - } - memset(covers, 0, -y * sizeof(cover_type)); - covers -= y; - y = 0; - } - - if(y + count > ymax) - { - int rest = y + count - ymax - 1; - count -= rest; - if(count <= 0) - { - memset(dst, 0, num_pix * sizeof(cover_type)); - return; - } - memset(covers + count, 0, rest * sizeof(cover_type)); - } - - const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; - do - { - *covers++ = (cover_type)m_mask_function.calculate(mask); - mask += m_rbuf->stride(); - } - while(--count); - } - - //-------------------------------------------------------------------- - void combine_vspan(int x, int y, cover_type* dst, int num_pix) const - { - int xmax = m_rbuf->width() - 1; - int ymax = m_rbuf->height() - 1; - - int count = num_pix; - cover_type* covers = dst; - - if(x < 0 || x > xmax) - { - memset(dst, 0, num_pix * sizeof(cover_type)); - return; - } - - if(y < 0) - { - count += y; - if(count <= 0) - { - memset(dst, 0, num_pix * sizeof(cover_type)); - return; - } - memset(covers, 0, -y * sizeof(cover_type)); - covers -= y; - y = 0; - } - - if(y + count > ymax) - { - int rest = y + count - ymax - 1; - count -= rest; - if(count <= 0) - { - memset(dst, 0, num_pix * sizeof(cover_type)); - return; - } - memset(covers + count, 0, rest * sizeof(cover_type)); - } - - const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; - do - { - *covers = (cover_type)((cover_full + (*covers) * - m_mask_function.calculate(mask)) >> - cover_shift); - ++covers; - mask += m_rbuf->stride(); - } - while(--count); - } - - - private: - alpha_mask_u8(const self_type&); - const self_type& operator = (const self_type&); - - rendering_buffer* m_rbuf; - MaskF m_mask_function; - }; - - - typedef alpha_mask_u8<1, 0> alpha_mask_gray8; //----alpha_mask_gray8 - - typedef alpha_mask_u8<3, 0> alpha_mask_rgb24r; //----alpha_mask_rgb24r - typedef alpha_mask_u8<3, 1> alpha_mask_rgb24g; //----alpha_mask_rgb24g - typedef alpha_mask_u8<3, 2> alpha_mask_rgb24b; //----alpha_mask_rgb24b - - typedef alpha_mask_u8<3, 2> alpha_mask_bgr24r; //----alpha_mask_bgr24r - typedef alpha_mask_u8<3, 1> alpha_mask_bgr24g; //----alpha_mask_bgr24g - typedef alpha_mask_u8<3, 0> alpha_mask_bgr24b; //----alpha_mask_bgr24b - - typedef alpha_mask_u8<4, 0> alpha_mask_rgba32r; //----alpha_mask_rgba32r - typedef alpha_mask_u8<4, 1> alpha_mask_rgba32g; //----alpha_mask_rgba32g - typedef alpha_mask_u8<4, 2> alpha_mask_rgba32b; //----alpha_mask_rgba32b - typedef alpha_mask_u8<4, 3> alpha_mask_rgba32a; //----alpha_mask_rgba32a - - typedef alpha_mask_u8<4, 1> alpha_mask_argb32r; //----alpha_mask_argb32r - typedef alpha_mask_u8<4, 2> alpha_mask_argb32g; //----alpha_mask_argb32g - typedef alpha_mask_u8<4, 3> alpha_mask_argb32b; //----alpha_mask_argb32b - typedef alpha_mask_u8<4, 0> alpha_mask_argb32a; //----alpha_mask_argb32a - - typedef alpha_mask_u8<4, 2> alpha_mask_bgra32r; //----alpha_mask_bgra32r - typedef alpha_mask_u8<4, 1> alpha_mask_bgra32g; //----alpha_mask_bgra32g - typedef alpha_mask_u8<4, 0> alpha_mask_bgra32b; //----alpha_mask_bgra32b - typedef alpha_mask_u8<4, 3> alpha_mask_bgra32a; //----alpha_mask_bgra32a - - typedef alpha_mask_u8<4, 3> alpha_mask_abgr32r; //----alpha_mask_abgr32r - typedef alpha_mask_u8<4, 2> alpha_mask_abgr32g; //----alpha_mask_abgr32g - typedef alpha_mask_u8<4, 1> alpha_mask_abgr32b; //----alpha_mask_abgr32b - typedef alpha_mask_u8<4, 0> alpha_mask_abgr32a; //----alpha_mask_abgr32a - - typedef alpha_mask_u8<3, 0, rgb_to_gray_mask_u8<0, 1, 2> > alpha_mask_rgb24gray; //----alpha_mask_rgb24gray - typedef alpha_mask_u8<3, 0, rgb_to_gray_mask_u8<2, 1, 0> > alpha_mask_bgr24gray; //----alpha_mask_bgr24gray - typedef alpha_mask_u8<4, 0, rgb_to_gray_mask_u8<0, 1, 2> > alpha_mask_rgba32gray; //----alpha_mask_rgba32gray - typedef alpha_mask_u8<4, 1, rgb_to_gray_mask_u8<0, 1, 2> > alpha_mask_argb32gray; //----alpha_mask_argb32gray - typedef alpha_mask_u8<4, 0, rgb_to_gray_mask_u8<2, 1, 0> > alpha_mask_bgra32gray; //----alpha_mask_bgra32gray - typedef alpha_mask_u8<4, 1, rgb_to_gray_mask_u8<2, 1, 0> > alpha_mask_abgr32gray; //----alpha_mask_abgr32gray - - - - //==========================================================amask_no_clip_u8 - template - class amask_no_clip_u8 + //-------------------------------------------------------------------- + void combine_hspan(int x, int y, cover_type* dst, int num_pix) const { - public: - typedef int8u cover_type; - typedef amask_no_clip_u8 self_type; - enum cover_scale_e - { - cover_shift = 8, - cover_none = 0, - cover_full = 255 - }; + int xmax = m_rbuf->width() - 1; + int ymax = m_rbuf->height() - 1; - amask_no_clip_u8() : m_rbuf(0) {} - explicit amask_no_clip_u8(rendering_buffer& rbuf) : m_rbuf(&rbuf) {} + int count = num_pix; + cover_type* covers = dst; - void attach(rendering_buffer& rbuf) { m_rbuf = &rbuf; } - - MaskF& mask_function() { return m_mask_function; } - const MaskF& mask_function() const { return m_mask_function; } - - - //-------------------------------------------------------------------- - cover_type pixel(int x, int y) const + if (y < 0 || y > ymax) { - return (cover_type)m_mask_function.calculate( - m_rbuf->row_ptr(y) + x * Step + Offset); + memset(dst, 0, num_pix * sizeof(cover_type)); + return; } - - //-------------------------------------------------------------------- - cover_type combine_pixel(int x, int y, cover_type val) const + if (x < 0) { - return (cover_type)((cover_full + val * - m_mask_function.calculate( - m_rbuf->row_ptr(y) + x * Step + Offset)) >> - cover_shift); - } - - - //-------------------------------------------------------------------- - void fill_hspan(int x, int y, cover_type* dst, int num_pix) const - { - const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; - do + count += x; + if (count <= 0) { - *dst++ = (cover_type)m_mask_function.calculate(mask); - mask += Step; + memset(dst, 0, num_pix * sizeof(cover_type)); + return; } - while(--num_pix); + memset(covers, 0, -x * sizeof(cover_type)); + covers -= x; + x = 0; } - - - //-------------------------------------------------------------------- - void combine_hspan(int x, int y, cover_type* dst, int num_pix) const + if (x + count > xmax) { - const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; - do + int rest = x + count - xmax - 1; + count -= rest; + if (count <= 0) { - *dst = (cover_type)((cover_full + (*dst) * - m_mask_function.calculate(mask)) >> - cover_shift); - ++dst; - mask += Step; + memset(dst, 0, num_pix * sizeof(cover_type)); + return; } - while(--num_pix); + memset(covers + count, 0, rest * sizeof(cover_type)); } - - //-------------------------------------------------------------------- - void fill_vspan(int x, int y, cover_type* dst, int num_pix) const + const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; + do { - const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; - do - { - *dst++ = (cover_type)m_mask_function.calculate(mask); - mask += m_rbuf->stride(); - } - while(--num_pix); - } + *covers = (cover_type)((cover_full + (*covers) * m_mask_function.calculate(mask)) >> cover_shift); + ++covers; + mask += Step; + } while (--count); + } + //-------------------------------------------------------------------- + void fill_vspan(int x, int y, cover_type* dst, int num_pix) const + { + int xmax = m_rbuf->width() - 1; + int ymax = m_rbuf->height() - 1; - //-------------------------------------------------------------------- - void combine_vspan(int x, int y, cover_type* dst, int num_pix) const + int count = num_pix; + cover_type* covers = dst; + + if (x < 0 || x > xmax) { - const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; - do - { - *dst = (cover_type)((cover_full + (*dst) * - m_mask_function.calculate(mask)) >> - cover_shift); - ++dst; - mask += m_rbuf->stride(); - } - while(--num_pix); + memset(dst, 0, num_pix * sizeof(cover_type)); + return; } - private: - amask_no_clip_u8(const self_type&); - const self_type& operator = (const self_type&); + if (y < 0) + { + count += y; + if (count <= 0) + { + memset(dst, 0, num_pix * sizeof(cover_type)); + return; + } + memset(covers, 0, -y * sizeof(cover_type)); + covers -= y; + y = 0; + } - rendering_buffer* m_rbuf; - MaskF m_mask_function; - }; - + if (y + count > ymax) + { + int rest = y + count - ymax - 1; + count -= rest; + if (count <= 0) + { + memset(dst, 0, num_pix * sizeof(cover_type)); + return; + } + memset(covers + count, 0, rest * sizeof(cover_type)); + } - typedef amask_no_clip_u8<1, 0> amask_no_clip_gray8; //----amask_no_clip_gray8 + const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; + do + { + *covers++ = (cover_type)m_mask_function.calculate(mask); + mask += m_rbuf->stride(); + } while (--count); + } - typedef amask_no_clip_u8<3, 0> amask_no_clip_rgb24r; //----amask_no_clip_rgb24r - typedef amask_no_clip_u8<3, 1> amask_no_clip_rgb24g; //----amask_no_clip_rgb24g - typedef amask_no_clip_u8<3, 2> amask_no_clip_rgb24b; //----amask_no_clip_rgb24b + //-------------------------------------------------------------------- + void combine_vspan(int x, int y, cover_type* dst, int num_pix) const + { + int xmax = m_rbuf->width() - 1; + int ymax = m_rbuf->height() - 1; - typedef amask_no_clip_u8<3, 2> amask_no_clip_bgr24r; //----amask_no_clip_bgr24r - typedef amask_no_clip_u8<3, 1> amask_no_clip_bgr24g; //----amask_no_clip_bgr24g - typedef amask_no_clip_u8<3, 0> amask_no_clip_bgr24b; //----amask_no_clip_bgr24b + int count = num_pix; + cover_type* covers = dst; - typedef amask_no_clip_u8<4, 0> amask_no_clip_rgba32r; //----amask_no_clip_rgba32r - typedef amask_no_clip_u8<4, 1> amask_no_clip_rgba32g; //----amask_no_clip_rgba32g - typedef amask_no_clip_u8<4, 2> amask_no_clip_rgba32b; //----amask_no_clip_rgba32b - typedef amask_no_clip_u8<4, 3> amask_no_clip_rgba32a; //----amask_no_clip_rgba32a + if (x < 0 || x > xmax) + { + memset(dst, 0, num_pix * sizeof(cover_type)); + return; + } - typedef amask_no_clip_u8<4, 1> amask_no_clip_argb32r; //----amask_no_clip_argb32r - typedef amask_no_clip_u8<4, 2> amask_no_clip_argb32g; //----amask_no_clip_argb32g - typedef amask_no_clip_u8<4, 3> amask_no_clip_argb32b; //----amask_no_clip_argb32b - typedef amask_no_clip_u8<4, 0> amask_no_clip_argb32a; //----amask_no_clip_argb32a + if (y < 0) + { + count += y; + if (count <= 0) + { + memset(dst, 0, num_pix * sizeof(cover_type)); + return; + } + memset(covers, 0, -y * sizeof(cover_type)); + covers -= y; + y = 0; + } - typedef amask_no_clip_u8<4, 2> amask_no_clip_bgra32r; //----amask_no_clip_bgra32r - typedef amask_no_clip_u8<4, 1> amask_no_clip_bgra32g; //----amask_no_clip_bgra32g - typedef amask_no_clip_u8<4, 0> amask_no_clip_bgra32b; //----amask_no_clip_bgra32b - typedef amask_no_clip_u8<4, 3> amask_no_clip_bgra32a; //----amask_no_clip_bgra32a + if (y + count > ymax) + { + int rest = y + count - ymax - 1; + count -= rest; + if (count <= 0) + { + memset(dst, 0, num_pix * sizeof(cover_type)); + return; + } + memset(covers + count, 0, rest * sizeof(cover_type)); + } - typedef amask_no_clip_u8<4, 3> amask_no_clip_abgr32r; //----amask_no_clip_abgr32r - typedef amask_no_clip_u8<4, 2> amask_no_clip_abgr32g; //----amask_no_clip_abgr32g - typedef amask_no_clip_u8<4, 1> amask_no_clip_abgr32b; //----amask_no_clip_abgr32b - typedef amask_no_clip_u8<4, 0> amask_no_clip_abgr32a; //----amask_no_clip_abgr32a + const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; + do + { + *covers = (cover_type)((cover_full + (*covers) * m_mask_function.calculate(mask)) >> cover_shift); + ++covers; + mask += m_rbuf->stride(); + } while (--count); + } - typedef amask_no_clip_u8<3, 0, rgb_to_gray_mask_u8<0, 1, 2> > amask_no_clip_rgb24gray; //----amask_no_clip_rgb24gray - typedef amask_no_clip_u8<3, 0, rgb_to_gray_mask_u8<2, 1, 0> > amask_no_clip_bgr24gray; //----amask_no_clip_bgr24gray - typedef amask_no_clip_u8<4, 0, rgb_to_gray_mask_u8<0, 1, 2> > amask_no_clip_rgba32gray; //----amask_no_clip_rgba32gray - typedef amask_no_clip_u8<4, 1, rgb_to_gray_mask_u8<0, 1, 2> > amask_no_clip_argb32gray; //----amask_no_clip_argb32gray - typedef amask_no_clip_u8<4, 0, rgb_to_gray_mask_u8<2, 1, 0> > amask_no_clip_bgra32gray; //----amask_no_clip_bgra32gray - typedef amask_no_clip_u8<4, 1, rgb_to_gray_mask_u8<2, 1, 0> > amask_no_clip_abgr32gray; //----amask_no_clip_abgr32gray + private: + alpha_mask_u8(const self_type&); + const self_type& operator=(const self_type&); + rendering_buffer* m_rbuf; + MaskF m_mask_function; +}; -} +typedef alpha_mask_u8<1, 0> alpha_mask_gray8; //----alpha_mask_gray8 +typedef alpha_mask_u8<3, 0> alpha_mask_rgb24r; //----alpha_mask_rgb24r +typedef alpha_mask_u8<3, 1> alpha_mask_rgb24g; //----alpha_mask_rgb24g +typedef alpha_mask_u8<3, 2> alpha_mask_rgb24b; //----alpha_mask_rgb24b +typedef alpha_mask_u8<3, 2> alpha_mask_bgr24r; //----alpha_mask_bgr24r +typedef alpha_mask_u8<3, 1> alpha_mask_bgr24g; //----alpha_mask_bgr24g +typedef alpha_mask_u8<3, 0> alpha_mask_bgr24b; //----alpha_mask_bgr24b + +typedef alpha_mask_u8<4, 0> alpha_mask_rgba32r; //----alpha_mask_rgba32r +typedef alpha_mask_u8<4, 1> alpha_mask_rgba32g; //----alpha_mask_rgba32g +typedef alpha_mask_u8<4, 2> alpha_mask_rgba32b; //----alpha_mask_rgba32b +typedef alpha_mask_u8<4, 3> alpha_mask_rgba32a; //----alpha_mask_rgba32a + +typedef alpha_mask_u8<4, 1> alpha_mask_argb32r; //----alpha_mask_argb32r +typedef alpha_mask_u8<4, 2> alpha_mask_argb32g; //----alpha_mask_argb32g +typedef alpha_mask_u8<4, 3> alpha_mask_argb32b; //----alpha_mask_argb32b +typedef alpha_mask_u8<4, 0> alpha_mask_argb32a; //----alpha_mask_argb32a + +typedef alpha_mask_u8<4, 2> alpha_mask_bgra32r; //----alpha_mask_bgra32r +typedef alpha_mask_u8<4, 1> alpha_mask_bgra32g; //----alpha_mask_bgra32g +typedef alpha_mask_u8<4, 0> alpha_mask_bgra32b; //----alpha_mask_bgra32b +typedef alpha_mask_u8<4, 3> alpha_mask_bgra32a; //----alpha_mask_bgra32a + +typedef alpha_mask_u8<4, 3> alpha_mask_abgr32r; //----alpha_mask_abgr32r +typedef alpha_mask_u8<4, 2> alpha_mask_abgr32g; //----alpha_mask_abgr32g +typedef alpha_mask_u8<4, 1> alpha_mask_abgr32b; //----alpha_mask_abgr32b +typedef alpha_mask_u8<4, 0> alpha_mask_abgr32a; //----alpha_mask_abgr32a + +typedef alpha_mask_u8<3, 0, rgb_to_gray_mask_u8<0, 1, 2>> alpha_mask_rgb24gray; //----alpha_mask_rgb24gray +typedef alpha_mask_u8<3, 0, rgb_to_gray_mask_u8<2, 1, 0>> alpha_mask_bgr24gray; //----alpha_mask_bgr24gray +typedef alpha_mask_u8<4, 0, rgb_to_gray_mask_u8<0, 1, 2>> alpha_mask_rgba32gray; //----alpha_mask_rgba32gray +typedef alpha_mask_u8<4, 1, rgb_to_gray_mask_u8<0, 1, 2>> alpha_mask_argb32gray; //----alpha_mask_argb32gray +typedef alpha_mask_u8<4, 0, rgb_to_gray_mask_u8<2, 1, 0>> alpha_mask_bgra32gray; //----alpha_mask_bgra32gray +typedef alpha_mask_u8<4, 1, rgb_to_gray_mask_u8<2, 1, 0>> alpha_mask_abgr32gray; //----alpha_mask_abgr32gray + +//==========================================================amask_no_clip_u8 +template +class amask_no_clip_u8 +{ + public: + typedef int8u cover_type; + typedef amask_no_clip_u8 self_type; + enum cover_scale_e { cover_shift = 8, cover_none = 0, cover_full = 255 }; + + amask_no_clip_u8() + : m_rbuf(0) + {} + explicit amask_no_clip_u8(rendering_buffer& rbuf) + : m_rbuf(&rbuf) + {} + + void attach(rendering_buffer& rbuf) { m_rbuf = &rbuf; } + + MaskF& mask_function() { return m_mask_function; } + const MaskF& mask_function() const { return m_mask_function; } + + //-------------------------------------------------------------------- + cover_type pixel(int x, int y) const + { + return (cover_type)m_mask_function.calculate(m_rbuf->row_ptr(y) + x * Step + Offset); + } + + //-------------------------------------------------------------------- + cover_type combine_pixel(int x, int y, cover_type val) const + { + return (cover_type)((cover_full + val * m_mask_function.calculate(m_rbuf->row_ptr(y) + x * Step + Offset)) >> + cover_shift); + } + + //-------------------------------------------------------------------- + void fill_hspan(int x, int y, cover_type* dst, int num_pix) const + { + const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; + do + { + *dst++ = (cover_type)m_mask_function.calculate(mask); + mask += Step; + } while (--num_pix); + } + + //-------------------------------------------------------------------- + void combine_hspan(int x, int y, cover_type* dst, int num_pix) const + { + const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; + do + { + *dst = (cover_type)((cover_full + (*dst) * m_mask_function.calculate(mask)) >> cover_shift); + ++dst; + mask += Step; + } while (--num_pix); + } + + //-------------------------------------------------------------------- + void fill_vspan(int x, int y, cover_type* dst, int num_pix) const + { + const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; + do + { + *dst++ = (cover_type)m_mask_function.calculate(mask); + mask += m_rbuf->stride(); + } while (--num_pix); + } + + //-------------------------------------------------------------------- + void combine_vspan(int x, int y, cover_type* dst, int num_pix) const + { + const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; + do + { + *dst = (cover_type)((cover_full + (*dst) * m_mask_function.calculate(mask)) >> cover_shift); + ++dst; + mask += m_rbuf->stride(); + } while (--num_pix); + } + + private: + amask_no_clip_u8(const self_type&); + const self_type& operator=(const self_type&); + + rendering_buffer* m_rbuf; + MaskF m_mask_function; +}; + +typedef amask_no_clip_u8<1, 0> amask_no_clip_gray8; //----amask_no_clip_gray8 + +typedef amask_no_clip_u8<3, 0> amask_no_clip_rgb24r; //----amask_no_clip_rgb24r +typedef amask_no_clip_u8<3, 1> amask_no_clip_rgb24g; //----amask_no_clip_rgb24g +typedef amask_no_clip_u8<3, 2> amask_no_clip_rgb24b; //----amask_no_clip_rgb24b + +typedef amask_no_clip_u8<3, 2> amask_no_clip_bgr24r; //----amask_no_clip_bgr24r +typedef amask_no_clip_u8<3, 1> amask_no_clip_bgr24g; //----amask_no_clip_bgr24g +typedef amask_no_clip_u8<3, 0> amask_no_clip_bgr24b; //----amask_no_clip_bgr24b + +typedef amask_no_clip_u8<4, 0> amask_no_clip_rgba32r; //----amask_no_clip_rgba32r +typedef amask_no_clip_u8<4, 1> amask_no_clip_rgba32g; //----amask_no_clip_rgba32g +typedef amask_no_clip_u8<4, 2> amask_no_clip_rgba32b; //----amask_no_clip_rgba32b +typedef amask_no_clip_u8<4, 3> amask_no_clip_rgba32a; //----amask_no_clip_rgba32a + +typedef amask_no_clip_u8<4, 1> amask_no_clip_argb32r; //----amask_no_clip_argb32r +typedef amask_no_clip_u8<4, 2> amask_no_clip_argb32g; //----amask_no_clip_argb32g +typedef amask_no_clip_u8<4, 3> amask_no_clip_argb32b; //----amask_no_clip_argb32b +typedef amask_no_clip_u8<4, 0> amask_no_clip_argb32a; //----amask_no_clip_argb32a + +typedef amask_no_clip_u8<4, 2> amask_no_clip_bgra32r; //----amask_no_clip_bgra32r +typedef amask_no_clip_u8<4, 1> amask_no_clip_bgra32g; //----amask_no_clip_bgra32g +typedef amask_no_clip_u8<4, 0> amask_no_clip_bgra32b; //----amask_no_clip_bgra32b +typedef amask_no_clip_u8<4, 3> amask_no_clip_bgra32a; //----amask_no_clip_bgra32a + +typedef amask_no_clip_u8<4, 3> amask_no_clip_abgr32r; //----amask_no_clip_abgr32r +typedef amask_no_clip_u8<4, 2> amask_no_clip_abgr32g; //----amask_no_clip_abgr32g +typedef amask_no_clip_u8<4, 1> amask_no_clip_abgr32b; //----amask_no_clip_abgr32b +typedef amask_no_clip_u8<4, 0> amask_no_clip_abgr32a; //----amask_no_clip_abgr32a + +typedef amask_no_clip_u8<3, 0, rgb_to_gray_mask_u8<0, 1, 2>> amask_no_clip_rgb24gray; //----amask_no_clip_rgb24gray +typedef amask_no_clip_u8<3, 0, rgb_to_gray_mask_u8<2, 1, 0>> amask_no_clip_bgr24gray; //----amask_no_clip_bgr24gray +typedef amask_no_clip_u8<4, 0, rgb_to_gray_mask_u8<0, 1, 2>> amask_no_clip_rgba32gray; //----amask_no_clip_rgba32gray +typedef amask_no_clip_u8<4, 1, rgb_to_gray_mask_u8<0, 1, 2>> amask_no_clip_argb32gray; //----amask_no_clip_argb32gray +typedef amask_no_clip_u8<4, 0, rgb_to_gray_mask_u8<2, 1, 0>> amask_no_clip_bgra32gray; //----amask_no_clip_bgra32gray +typedef amask_no_clip_u8<4, 1, rgb_to_gray_mask_u8<2, 1, 0>> amask_no_clip_abgr32gray; //----amask_no_clip_abgr32gray + +} // namespace agg #endif diff --git a/deps/agg/include/agg_arc.h b/deps/agg/include/agg_arc.h index 8ffb559ed..d71b79dd5 100644 --- a/deps/agg/include/agg_arc.h +++ b/deps/agg/include/agg_arc.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -23,52 +23,46 @@ #include #include "agg_basics.h" -namespace agg +namespace agg { + +//=====================================================================arc +// +// See Implementation agg_arc.cpp +// +class arc { + public: + arc() + : m_scale(1.0) + , m_initialized(false) + {} + arc(double x, double y, double rx, double ry, double a1, double a2, bool ccw = true); - //=====================================================================arc - // - // See Implementation agg_arc.cpp - // - class arc - { - public: - arc() : m_scale(1.0), m_initialized(false) {} - arc(double x, double y, - double rx, double ry, - double a1, double a2, - bool ccw=true); + void init(double x, double y, double rx, double ry, double a1, double a2, bool ccw = true); - void init(double x, double y, - double rx, double ry, - double a1, double a2, - bool ccw=true); + void approximation_scale(double s); + double approximation_scale() const { return m_scale; } - void approximation_scale(double s); - double approximation_scale() const { return m_scale; } + void rewind(unsigned); + unsigned vertex(double* x, double* y); - void rewind(unsigned); - unsigned vertex(double* x, double* y); + private: + void normalize(double a1, double a2, bool ccw); - private: - void normalize(double a1, double a2, bool ccw); - - double m_x; - double m_y; - double m_rx; - double m_ry; - double m_angle; - double m_start; - double m_end; - double m_scale; - double m_da; - bool m_ccw; - bool m_initialized; - unsigned m_path_cmd; - }; - - -} + double m_x; + double m_y; + double m_rx; + double m_ry; + double m_angle; + double m_start; + double m_end; + double m_scale; + double m_da; + bool m_ccw; + bool m_initialized; + unsigned m_path_cmd; +}; +} // namespace agg #endif diff --git a/deps/agg/include/agg_array.h b/deps/agg/include/agg_array.h index 19af752aa..2669b0893 100644 --- a/deps/agg/include/agg_array.h +++ b/deps/agg/include/agg_array.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -19,1123 +19,1080 @@ #include #include "agg_basics.h" -namespace agg +namespace agg { + +//-------------------------------------------------------pod_array_adaptor +template +class pod_array_adaptor { + public: + typedef T value_type; + pod_array_adaptor(T* array, unsigned _size) + : m_array(array) + , m_size(_size) + {} - //-------------------------------------------------------pod_array_adaptor - template class pod_array_adaptor + unsigned size() const { return m_size; } + const T& operator[](unsigned i) const { return m_array[i]; } + T& operator[](unsigned i) { return m_array[i]; } + const T& at(unsigned i) const { return m_array[i]; } + T& at(unsigned i) { return m_array[i]; } + T value_at(unsigned i) const { return m_array[i]; } + + private: + T* m_array; + unsigned m_size; +}; + +//---------------------------------------------------------pod_auto_array +template +class pod_auto_array +{ + public: + typedef T value_type; + typedef pod_auto_array self_type; + + pod_auto_array() {} + explicit pod_auto_array(const T* c) { memcpy(m_array, c, sizeof(T) * Size); } + + const self_type& operator=(const T* c) { - public: - typedef T value_type; - pod_array_adaptor(T* array, unsigned _size) : - m_array(array), m_size(_size) {} - - unsigned size() const { return m_size; } - const T& operator [] (unsigned i) const { return m_array[i]; } - T& operator [] (unsigned i) { return m_array[i]; } - const T& at(unsigned i) const { return m_array[i]; } - T& at(unsigned i) { return m_array[i]; } - T value_at(unsigned i) const { return m_array[i]; } - - private: - T* m_array; - unsigned m_size; - }; - - - //---------------------------------------------------------pod_auto_array - template class pod_auto_array - { - public: - typedef T value_type; - typedef pod_auto_array self_type; - - pod_auto_array() {} - explicit pod_auto_array(const T* c) - { - memcpy(m_array, c, sizeof(T) * Size); - } - - const self_type& operator = (const T* c) - { - memcpy(m_array, c, sizeof(T) * Size); - return *this; - } - - static unsigned size() { return Size; } - const T& operator [] (unsigned i) const { return m_array[i]; } - T& operator [] (unsigned i) { return m_array[i]; } - const T& at(unsigned i) const { return m_array[i]; } - T& at(unsigned i) { return m_array[i]; } - T value_at(unsigned i) const { return m_array[i]; } - - private: - T m_array[Size]; - }; - - - //--------------------------------------------------------pod_auto_vector - template class pod_auto_vector - { - public: - typedef T value_type; - typedef pod_auto_vector self_type; - - pod_auto_vector() : m_size(0) {} - - void remove_all() { m_size = 0; } - void clear() { m_size = 0; } - void add(const T& v) { m_array[m_size++] = v; } - void push_back(const T& v) { m_array[m_size++] = v; } - void inc_size(unsigned _size) { m_size += _size; } - - unsigned size() const { return m_size; } - const T& operator [] (unsigned i) const { return m_array[i]; } - T& operator [] (unsigned i) { return m_array[i]; } - const T& at(unsigned i) const { return m_array[i]; } - T& at(unsigned i) { return m_array[i]; } - T value_at(unsigned i) const { return m_array[i]; } - - private: - T m_array[Size]; - unsigned m_size; - }; - - - //---------------------------------------------------------------pod_array - template class pod_array - { - public: - typedef T value_type; - typedef pod_array self_type; - - ~pod_array() { pod_allocator::deallocate(m_array, m_size); } - pod_array() : m_array(0), m_size(0) {} - - pod_array(unsigned _size) : - m_array(pod_allocator::allocate(_size)), - m_size(_size) - {} - - pod_array(const self_type& v) : - m_array(pod_allocator::allocate(v.m_size)), - m_size(v.m_size) - { - memcpy(m_array, v.m_array, sizeof(T) * m_size); - } - - pod_array(self_type && rhs) : - m_array(rhs.m_array), - m_size(rhs.m_size) - { - rhs.m_array = nullptr; - rhs.m_size = 0; - } - - void resize(unsigned _size) - { - if(_size != m_size) - { - pod_allocator::deallocate(m_array, m_size); - m_array = pod_allocator::allocate(m_size = _size); - } - } - const self_type& operator = (const self_type& v) - { - resize(v.size()); - memcpy(m_array, v.m_array, sizeof(T) * m_size); - return *this; - } - - unsigned size() const { return m_size; } - const T& operator [] (unsigned i) const { return m_array[i]; } - T& operator [] (unsigned i) { return m_array[i]; } - const T& at(unsigned i) const { return m_array[i]; } - T& at(unsigned i) { return m_array[i]; } - T value_at(unsigned i) const { return m_array[i]; } - - const T* data() const { return m_array; } - T* data() { return m_array; } - private: - T* m_array; - unsigned m_size; - }; - - - - //--------------------------------------------------------------pod_vector - // A simple class template to store Plain Old Data, a vector - // of a fixed size. The data is continous in memory - //------------------------------------------------------------------------ - template class pod_vector - { - public: - typedef T value_type; - - ~pod_vector() { pod_allocator::deallocate(m_array, m_capacity); } - pod_vector() : m_size(0), m_capacity(0), m_array(0) {} - pod_vector(unsigned cap, unsigned extra_tail=0); - - // Copying - pod_vector(const pod_vector&); - const pod_vector& operator = (const pod_vector&); - - pod_vector(pod_vector && rhs); - - // Set new capacity. All data is lost, size is set to zero. - void capacity(unsigned cap, unsigned extra_tail=0); - unsigned capacity() const { return m_capacity; } - - // Allocate n elements. All data is lost, - // but elements can be accessed in range 0...size-1. - void allocate(unsigned size, unsigned extra_tail=0); - - // Resize keeping the content. - void resize(unsigned new_size); - - void zero() - { - memset(m_array, 0, sizeof(T) * m_size); - } - - void add(const T& v) { m_array[m_size++] = v; } - void push_back(const T& v) { m_array[m_size++] = v; } - void insert_at(unsigned pos, const T& val); - void inc_size(unsigned _size) { m_size += _size; } - unsigned size() const { return m_size; } - unsigned byte_size() const { return m_size * sizeof(T); } - void serialize(int8u* ptr) const; - void deserialize(const int8u* data, unsigned byte_size); - const T& operator [] (unsigned i) const { return m_array[i]; } - T& operator [] (unsigned i) { return m_array[i]; } - const T& at(unsigned i) const { return m_array[i]; } - T& at(unsigned i) { return m_array[i]; } - T value_at(unsigned i) const { return m_array[i]; } - - const T* data() const { return m_array; } - T* data() { return m_array; } - - void remove_all() { m_size = 0; } - void clear() { m_size = 0; } - void cut_at(unsigned num) { if(num < m_size) m_size = num; } - - private: - unsigned m_size; - unsigned m_capacity; - T* m_array; - }; - - //------------------------------------------------------------------------ - template - void pod_vector::capacity(unsigned cap, unsigned extra_tail) - { - m_size = 0; - if(cap > m_capacity) - { - pod_allocator::deallocate(m_array, m_capacity); - m_capacity = cap + extra_tail; - m_array = m_capacity ? pod_allocator::allocate(m_capacity) : 0; - } + memcpy(m_array, c, sizeof(T) * Size); + return *this; } - //------------------------------------------------------------------------ - template - void pod_vector::allocate(unsigned _size, unsigned extra_tail) + static unsigned size() { return Size; } + const T& operator[](unsigned i) const { return m_array[i]; } + T& operator[](unsigned i) { return m_array[i]; } + const T& at(unsigned i) const { return m_array[i]; } + T& at(unsigned i) { return m_array[i]; } + T value_at(unsigned i) const { return m_array[i]; } + + private: + T m_array[Size]; +}; + +//--------------------------------------------------------pod_auto_vector +template +class pod_auto_vector +{ + public: + typedef T value_type; + typedef pod_auto_vector self_type; + + pod_auto_vector() + : m_size(0) + {} + + void remove_all() { m_size = 0; } + void clear() { m_size = 0; } + void add(const T& v) { m_array[m_size++] = v; } + void push_back(const T& v) { m_array[m_size++] = v; } + void inc_size(unsigned _size) { m_size += _size; } + + unsigned size() const { return m_size; } + const T& operator[](unsigned i) const { return m_array[i]; } + T& operator[](unsigned i) { return m_array[i]; } + const T& at(unsigned i) const { return m_array[i]; } + T& at(unsigned i) { return m_array[i]; } + T value_at(unsigned i) const { return m_array[i]; } + + private: + T m_array[Size]; + unsigned m_size; +}; + +//---------------------------------------------------------------pod_array +template +class pod_array +{ + public: + typedef T value_type; + typedef pod_array self_type; + + ~pod_array() { pod_allocator::deallocate(m_array, m_size); } + pod_array() + : m_array(0) + , m_size(0) + {} + + pod_array(unsigned _size) + : m_array(pod_allocator::allocate(_size)) + , m_size(_size) + {} + + pod_array(const self_type& v) + : m_array(pod_allocator::allocate(v.m_size)) + , m_size(v.m_size) { - capacity(_size, extra_tail); - m_size = _size; + memcpy(m_array, v.m_array, sizeof(T) * m_size); } - - //------------------------------------------------------------------------ - template - void pod_vector::resize(unsigned new_size) + pod_array(self_type&& rhs) + : m_array(rhs.m_array) + , m_size(rhs.m_size) { - if(new_size > m_size) - { - if(new_size > m_capacity) - { - T* _data = pod_allocator::allocate(new_size); - memcpy(_data, m_array, m_size * sizeof(T)); - pod_allocator::deallocate(m_array, m_capacity); - m_array = _data; - } - } - else - { - m_size = new_size; - } - } - - //------------------------------------------------------------------------ - template pod_vector::pod_vector(unsigned cap, unsigned extra_tail) : - m_size(0), - m_capacity(cap + extra_tail), - m_array(pod_allocator::allocate(m_capacity)) {} - - //------------------------------------------------------------------------ - template pod_vector::pod_vector(const pod_vector& v) : - m_size(v.m_size), - m_capacity(v.m_capacity), - m_array(v.m_capacity ? pod_allocator::allocate(v.m_capacity) : 0) - { - memcpy(m_array, v.m_array, sizeof(T) * v.m_size); - } - - //------------------------------------------------------------------------ - template pod_vector::pod_vector(pod_vector && rhs) : - m_size(rhs.m_size), - m_capacity(rhs.m_capacity), - m_array(rhs.m_array) - { - rhs.m_size = 0; - rhs.m_capacity = 0; rhs.m_array = nullptr; + rhs.m_size = 0; } - //------------------------------------------------------------------------ - template const pod_vector& - pod_vector::operator = (const pod_vector&v) + void resize(unsigned _size) { - allocate(v.m_size); - if(v.m_size) memcpy(m_array, v.m_array, sizeof(T) * v.m_size); + if (_size != m_size) + { + pod_allocator::deallocate(m_array, m_size); + m_array = pod_allocator::allocate(m_size = _size); + } + } + const self_type& operator=(const self_type& v) + { + resize(v.size()); + memcpy(m_array, v.m_array, sizeof(T) * m_size); return *this; } - //------------------------------------------------------------------------ - template void pod_vector::serialize(int8u* ptr) const - { - if(m_size) memcpy(ptr, m_array, m_size * sizeof(T)); + unsigned size() const { return m_size; } + const T& operator[](unsigned i) const { return m_array[i]; } + T& operator[](unsigned i) { return m_array[i]; } + const T& at(unsigned i) const { return m_array[i]; } + T& at(unsigned i) { return m_array[i]; } + T value_at(unsigned i) const { return m_array[i]; } + + const T* data() const { return m_array; } + T* data() { return m_array; } + + private: + T* m_array; + unsigned m_size; +}; + +//--------------------------------------------------------------pod_vector +// A simple class template to store Plain Old Data, a vector +// of a fixed size. The data is continous in memory +//------------------------------------------------------------------------ +template +class pod_vector +{ + public: + typedef T value_type; + + ~pod_vector() { pod_allocator::deallocate(m_array, m_capacity); } + pod_vector() + : m_size(0) + , m_capacity(0) + , m_array(0) + {} + pod_vector(unsigned cap, unsigned extra_tail = 0); + + // Copying + pod_vector(const pod_vector&); + const pod_vector& operator=(const pod_vector&); + + pod_vector(pod_vector&& rhs); + + // Set new capacity. All data is lost, size is set to zero. + void capacity(unsigned cap, unsigned extra_tail = 0); + unsigned capacity() const { return m_capacity; } + + // Allocate n elements. All data is lost, + // but elements can be accessed in range 0...size-1. + void allocate(unsigned size, unsigned extra_tail = 0); + + // Resize keeping the content. + void resize(unsigned new_size); + + void zero() { memset(m_array, 0, sizeof(T) * m_size); } + + void add(const T& v) { m_array[m_size++] = v; } + void push_back(const T& v) { m_array[m_size++] = v; } + void insert_at(unsigned pos, const T& val); + void inc_size(unsigned _size) { m_size += _size; } + unsigned size() const { return m_size; } + unsigned byte_size() const { return m_size * sizeof(T); } + void serialize(int8u* ptr) const; + void deserialize(const int8u* data, unsigned byte_size); + const T& operator[](unsigned i) const { return m_array[i]; } + T& operator[](unsigned i) { return m_array[i]; } + const T& at(unsigned i) const { return m_array[i]; } + T& at(unsigned i) { return m_array[i]; } + T value_at(unsigned i) const { return m_array[i]; } + + const T* data() const { return m_array; } + T* data() { return m_array; } + + void remove_all() { m_size = 0; } + void clear() { m_size = 0; } + void cut_at(unsigned num) + { + if (num < m_size) + m_size = num; } - //------------------------------------------------------------------------ - template - void pod_vector::deserialize(const int8u* _data, unsigned _byte_size) + private: + unsigned m_size; + unsigned m_capacity; + T* m_array; +}; + +//------------------------------------------------------------------------ +template +void pod_vector::capacity(unsigned cap, unsigned extra_tail) +{ + m_size = 0; + if (cap > m_capacity) { - _byte_size /= sizeof(T); - allocate(_byte_size); - if(_byte_size) memcpy(m_array, _data, _byte_size * sizeof(T)); + pod_allocator::deallocate(m_array, m_capacity); + m_capacity = cap + extra_tail; + m_array = m_capacity ? pod_allocator::allocate(m_capacity) : 0; + } +} + +//------------------------------------------------------------------------ +template +void pod_vector::allocate(unsigned _size, unsigned extra_tail) +{ + capacity(_size, extra_tail); + m_size = _size; +} + +//------------------------------------------------------------------------ +template +void pod_vector::resize(unsigned new_size) +{ + if (new_size > m_size) + { + if (new_size > m_capacity) + { + T* _data = pod_allocator::allocate(new_size); + memcpy(_data, m_array, m_size * sizeof(T)); + pod_allocator::deallocate(m_array, m_capacity); + m_array = _data; + } + } + else + { + m_size = new_size; + } +} + +//------------------------------------------------------------------------ +template +pod_vector::pod_vector(unsigned cap, unsigned extra_tail) + : m_size(0) + , m_capacity(cap + extra_tail) + , m_array(pod_allocator::allocate(m_capacity)) +{} + +//------------------------------------------------------------------------ +template +pod_vector::pod_vector(const pod_vector& v) + : m_size(v.m_size) + , m_capacity(v.m_capacity) + , m_array(v.m_capacity ? pod_allocator::allocate(v.m_capacity) : 0) +{ + memcpy(m_array, v.m_array, sizeof(T) * v.m_size); +} + +//------------------------------------------------------------------------ +template +pod_vector::pod_vector(pod_vector&& rhs) + : m_size(rhs.m_size) + , m_capacity(rhs.m_capacity) + , m_array(rhs.m_array) +{ + rhs.m_size = 0; + rhs.m_capacity = 0; + rhs.m_array = nullptr; +} + +//------------------------------------------------------------------------ +template +const pod_vector& pod_vector::operator=(const pod_vector& v) +{ + allocate(v.m_size); + if (v.m_size) + memcpy(m_array, v.m_array, sizeof(T) * v.m_size); + return *this; +} + +//------------------------------------------------------------------------ +template +void pod_vector::serialize(int8u* ptr) const +{ + if (m_size) + memcpy(ptr, m_array, m_size * sizeof(T)); +} + +//------------------------------------------------------------------------ +template +void pod_vector::deserialize(const int8u* _data, unsigned _byte_size) +{ + _byte_size /= sizeof(T); + allocate(_byte_size); + if (_byte_size) + memcpy(m_array, _data, _byte_size * sizeof(T)); +} + +//------------------------------------------------------------------------ +template +void pod_vector::insert_at(unsigned pos, const T& val) +{ + if (pos >= m_size) + { + m_array[m_size] = val; + } + else + { + memmove(m_array + pos + 1, m_array + pos, (m_size - pos) * sizeof(T)); + m_array[pos] = val; + } + ++m_size; +} + +//---------------------------------------------------------------pod_bvector +// A simple class template to store Plain Old Data, similar to std::deque +// It doesn't reallocate memory but instead, uses blocks of data of size +// of (1 << S), that is, power of two. The data is NOT contiguous in memory, +// so the only valid access method is operator [] or curr(), prev(), next() +// +// There reallocs occure only when the pool of pointers to blocks needs +// to be extended (it happens very rarely). You can control the value +// of increment to reallocate the pointer buffer. See the second constructor. +// By default, the incremeent value equals (1 << S), i.e., the block size. +//------------------------------------------------------------------------ +template +class pod_bvector +{ + public: + enum block_scale_e { block_shift = S, block_size = 1 << block_shift, block_mask = block_size - 1 }; + + typedef T value_type; + + ~pod_bvector(); + pod_bvector(); + pod_bvector(unsigned block_ptr_inc); + + // Copying + pod_bvector(const pod_bvector& v); + const pod_bvector& operator=(const pod_bvector& v); + + void remove_all() { m_size = 0; } + void clear() { m_size = 0; } + void free_all() { free_tail(0); } + void free_tail(unsigned size); + void add(const T& val); + void push_back(const T& val) { add(val); } + void modify_last(const T& val); + void remove_last(); + + int allocate_continuous_block(unsigned num_elements); + + void add_array(const T* ptr, unsigned num_elem) + { + while (num_elem--) + { + add(*ptr++); + } } - //------------------------------------------------------------------------ - template - void pod_vector::insert_at(unsigned pos, const T& val) + template + void add_data(DataAccessor& data) { - if(pos >= m_size) + while (data.size()) { - m_array[m_size] = val; + add(*data); + ++data; } - else - { - memmove(m_array + pos + 1, m_array + pos, (m_size - pos) * sizeof(T)); - m_array[pos] = val; - } - ++m_size; } - //---------------------------------------------------------------pod_bvector - // A simple class template to store Plain Old Data, similar to std::deque - // It doesn't reallocate memory but instead, uses blocks of data of size - // of (1 << S), that is, power of two. The data is NOT contiguous in memory, - // so the only valid access method is operator [] or curr(), prev(), next() - // - // There reallocs occure only when the pool of pointers to blocks needs - // to be extended (it happens very rarely). You can control the value - // of increment to reallocate the pointer buffer. See the second constructor. - // By default, the incremeent value equals (1 << S), i.e., the block size. - //------------------------------------------------------------------------ - template class pod_bvector + void cut_at(unsigned _size) { - public: - enum block_scale_e - { - block_shift = S, - block_size = 1 << block_shift, - block_mask = block_size - 1 - }; - - typedef T value_type; - - ~pod_bvector(); - pod_bvector(); - pod_bvector(unsigned block_ptr_inc); - - // Copying - pod_bvector(const pod_bvector& v); - const pod_bvector& operator = (const pod_bvector& v); - - void remove_all() { m_size = 0; } - void clear() { m_size = 0; } - void free_all() { free_tail(0); } - void free_tail(unsigned size); - void add(const T& val); - void push_back(const T& val) { add(val); } - void modify_last(const T& val); - void remove_last(); - - int allocate_continuous_block(unsigned num_elements); - - void add_array(const T* ptr, unsigned num_elem) - { - while(num_elem--) - { - add(*ptr++); - } - } - - template void add_data(DataAccessor& data) - { - while(data.size()) - { - add(*data); - ++data; - } - } - - void cut_at(unsigned _size) - { - if(_size < m_size) m_size = _size; - } - - unsigned size() const { return m_size; } - - const T& operator [] (unsigned i) const - { - return m_blocks[i >> block_shift][i & block_mask]; - } - - T& operator [] (unsigned i) - { - return m_blocks[i >> block_shift][i & block_mask]; - } - - const T& at(unsigned i) const - { - return m_blocks[i >> block_shift][i & block_mask]; - } - - T& at(unsigned i) - { - return m_blocks[i >> block_shift][i & block_mask]; - } - - T value_at(unsigned i) const - { - return m_blocks[i >> block_shift][i & block_mask]; - } - - const T& curr(unsigned idx) const - { - return (*this)[idx]; - } - - T& curr(unsigned idx) - { - return (*this)[idx]; - } - - const T& prev(unsigned idx) const - { - return (*this)[(idx + m_size - 1) % m_size]; - } - - T& prev(unsigned idx) - { - return (*this)[(idx + m_size - 1) % m_size]; - } - - const T& next(unsigned idx) const - { - return (*this)[(idx + 1) % m_size]; - } - - T& next(unsigned idx) - { - return (*this)[(idx + 1) % m_size]; - } - - const T& last() const - { - return (*this)[m_size - 1]; - } - - T& last() - { - return (*this)[m_size - 1]; - } - - unsigned byte_size() const; - void serialize(int8u* ptr) const; - void deserialize(const int8u* data, unsigned byte_size); - void deserialize(unsigned start, const T& empty_val, - const int8u* data, unsigned byte_size); - - template - void deserialize(ByteAccessor data) - { - remove_all(); - unsigned elem_size = data.size() / sizeof(T); - - for(unsigned i = 0; i < elem_size; ++i) - { - int8u* ptr = (int8u*)data_ptr(); - for(unsigned j = 0; j < sizeof(T); ++j) - { - *ptr++ = *data; - ++data; - } - ++m_size; - } - } - - template - void deserialize(unsigned start, const T& empty_val, ByteAccessor data) - { - while(m_size < start) - { - add(empty_val); - } - - unsigned elem_size = data.size() / sizeof(T); - for(unsigned i = 0; i < elem_size; ++i) - { - int8u* ptr; - if(start + i < m_size) - { - ptr = (int8u*)(&((*this)[start + i])); - } - else - { - ptr = (int8u*)data_ptr(); - ++m_size; - } - for(unsigned j = 0; j < sizeof(T); ++j) - { - *ptr++ = *data; - ++data; - } - } - } - - const T* block(unsigned nb) const { return m_blocks[nb]; } - - private: - void allocate_block(unsigned nb); - T* data_ptr(); - - unsigned m_size; - unsigned m_num_blocks; - unsigned m_max_blocks; - T** m_blocks; - unsigned m_block_ptr_inc; - }; - - - //------------------------------------------------------------------------ - template pod_bvector::~pod_bvector() - { - if(m_num_blocks) - { - T** blk = m_blocks + m_num_blocks - 1; - while(m_num_blocks > 0) - { - pod_allocator::deallocate(*blk, block_size); - --blk; - --m_num_blocks; - } - } - pod_allocator::deallocate(m_blocks, m_max_blocks); - } - - - //------------------------------------------------------------------------ - template - void pod_bvector::free_tail(unsigned _size) - { - if(_size < m_size) - { - unsigned nb = (_size + block_mask) >> block_shift; - while(m_num_blocks > nb) - { - pod_allocator::deallocate(m_blocks[--m_num_blocks], block_size); - } - if(m_num_blocks == 0) - { - pod_allocator::deallocate(m_blocks, m_max_blocks); - m_blocks = 0; - m_max_blocks = 0; - } + if (_size < m_size) m_size = _size; - } } + unsigned size() const { return m_size; } - //------------------------------------------------------------------------ - template pod_bvector::pod_bvector() : - m_size(0), - m_num_blocks(0), - m_max_blocks(0), - m_blocks(0), - m_block_ptr_inc(block_size) - { - } + const T& operator[](unsigned i) const { return m_blocks[i >> block_shift][i & block_mask]; } + T& operator[](unsigned i) { return m_blocks[i >> block_shift][i & block_mask]; } - //------------------------------------------------------------------------ - template - pod_bvector::pod_bvector(unsigned block_ptr_inc) : - m_size(0), - m_num_blocks(0), - m_max_blocks(0), - m_blocks(0), - m_block_ptr_inc(block_ptr_inc) - { - } + const T& at(unsigned i) const { return m_blocks[i >> block_shift][i & block_mask]; } + T& at(unsigned i) { return m_blocks[i >> block_shift][i & block_mask]; } - //------------------------------------------------------------------------ - template - pod_bvector::pod_bvector(const pod_bvector& v) : - m_size(v.m_size), - m_num_blocks(v.m_num_blocks), - m_max_blocks(v.m_max_blocks), - m_blocks(v.m_max_blocks ? - pod_allocator::allocate(v.m_max_blocks) : - 0), - m_block_ptr_inc(v.m_block_ptr_inc) - { - unsigned i; - for(i = 0; i < v.m_num_blocks; ++i) - { - m_blocks[i] = pod_allocator::allocate(block_size); - memcpy(m_blocks[i], v.m_blocks[i], block_size * sizeof(T)); - } - } + T value_at(unsigned i) const { return m_blocks[i >> block_shift][i & block_mask]; } + const T& curr(unsigned idx) const { return (*this)[idx]; } - //------------------------------------------------------------------------ - template - const pod_bvector& - pod_bvector::operator = (const pod_bvector& v) - { - unsigned i; - for(i = m_num_blocks; i < v.m_num_blocks; ++i) - { - allocate_block(i); - } - for(i = 0; i < v.m_num_blocks; ++i) - { - memcpy(m_blocks[i], v.m_blocks[i], block_size * sizeof(T)); - } - m_size = v.m_size; - return *this; - } + T& curr(unsigned idx) { return (*this)[idx]; } + const T& prev(unsigned idx) const { return (*this)[(idx + m_size - 1) % m_size]; } - //------------------------------------------------------------------------ - template - void pod_bvector::allocate_block(unsigned nb) - { - if(nb >= m_max_blocks) - { - T** new_blocks = pod_allocator::allocate(m_max_blocks + m_block_ptr_inc); + T& prev(unsigned idx) { return (*this)[(idx + m_size - 1) % m_size]; } - if(m_blocks) - { - memcpy(new_blocks, - m_blocks, - m_num_blocks * sizeof(T*)); + const T& next(unsigned idx) const { return (*this)[(idx + 1) % m_size]; } - pod_allocator::deallocate(m_blocks, m_max_blocks); - } - m_blocks = new_blocks; - m_max_blocks += m_block_ptr_inc; - } - m_blocks[nb] = pod_allocator::allocate(block_size); - m_num_blocks++; - } + T& next(unsigned idx) { return (*this)[(idx + 1) % m_size]; } + const T& last() const { return (*this)[m_size - 1]; } + T& last() { return (*this)[m_size - 1]; } - //------------------------------------------------------------------------ - template - inline T* pod_bvector::data_ptr() - { - unsigned nb = m_size >> block_shift; - if(nb >= m_num_blocks) - { - allocate_block(nb); - } - return m_blocks[nb] + (m_size & block_mask); - } + unsigned byte_size() const; + void serialize(int8u* ptr) const; + void deserialize(const int8u* data, unsigned byte_size); + void deserialize(unsigned start, const T& empty_val, const int8u* data, unsigned byte_size); - - - //------------------------------------------------------------------------ - template - inline void pod_bvector::add(const T& val) - { - *data_ptr() = val; - ++m_size; - } - - - //------------------------------------------------------------------------ - template - inline void pod_bvector::remove_last() - { - if(m_size) --m_size; - } - - - //------------------------------------------------------------------------ - template - void pod_bvector::modify_last(const T& val) - { - remove_last(); - add(val); - } - - - //------------------------------------------------------------------------ - template - int pod_bvector::allocate_continuous_block(unsigned num_elements) - { - if(num_elements < block_size) - { - data_ptr(); // Allocate initial block if necessary - unsigned rest = block_size - (m_size & block_mask); - unsigned index; - if(num_elements <= rest) - { - // The rest of the block is good, we can use it - //----------------- - index = m_size; - m_size += num_elements; - return index; - } - - // New block - //--------------- - m_size += rest; - data_ptr(); - index = m_size; - m_size += num_elements; - return index; - } - return -1; // Impossible to allocate - } - - - //------------------------------------------------------------------------ - template - unsigned pod_bvector::byte_size() const - { - return m_size * sizeof(T); - } - - - //------------------------------------------------------------------------ - template - void pod_bvector::serialize(int8u* ptr) const - { - unsigned i; - for(i = 0; i < m_size; i++) - { - memcpy(ptr, &(*this)[i], sizeof(T)); - ptr += sizeof(T); - } - } - - //------------------------------------------------------------------------ - template - void pod_bvector::deserialize(const int8u* _data, unsigned _byte_size) + template + void deserialize(ByteAccessor data) { remove_all(); - _byte_size /= sizeof(T); - for(unsigned i = 0; i < _byte_size; ++i) + unsigned elem_size = data.size() / sizeof(T); + + for (unsigned i = 0; i < elem_size; ++i) { - T* ptr = data_ptr(); - memcpy(ptr, _data, sizeof(T)); + int8u* ptr = (int8u*)data_ptr(); + for (unsigned j = 0; j < sizeof(T); ++j) + { + *ptr++ = *data; + ++data; + } ++m_size; - _data += sizeof(T); } } - - // Replace or add a number of elements starting from "start" position - //------------------------------------------------------------------------ - template - void pod_bvector::deserialize(unsigned start, const T& empty_val, - const int8u* _data, unsigned _byte_size) + template + void deserialize(unsigned start, const T& empty_val, ByteAccessor data) { - while(m_size < start) + while (m_size < start) { add(empty_val); } - _byte_size /= sizeof(T); - for(unsigned i = 0; i < _byte_size; ++i) + unsigned elem_size = data.size() / sizeof(T); + for (unsigned i = 0; i < elem_size; ++i) { - if(start + i < m_size) + int8u* ptr; + if (start + i < m_size) { - memcpy(&((*this)[start + i]), _data, sizeof(T)); + ptr = (int8u*)(&((*this)[start + i])); } else { - T* ptr = data_ptr(); - memcpy(ptr, _data, sizeof(T)); + ptr = (int8u*)data_ptr(); ++m_size; } - _data += sizeof(T); + for (unsigned j = 0; j < sizeof(T); ++j) + { + *ptr++ = *data; + ++data; + } } } + const T* block(unsigned nb) const { return m_blocks[nb]; } - //---------------------------------------------------------block_allocator - // Allocator for arbitrary POD data. Most usable in different cache - // systems for efficient memory allocations. - // Memory is allocated with blocks of fixed size ("block_size" in - // the constructor). If required size exceeds the block size the allocator - // creates a new block of the required size. However, the most efficient - // use is when the average reqired size is much less than the block size. - //------------------------------------------------------------------------ - class block_allocator + private: + void allocate_block(unsigned nb); + T* data_ptr(); + + unsigned m_size; + unsigned m_num_blocks; + unsigned m_max_blocks; + T** m_blocks; + unsigned m_block_ptr_inc; +}; + +//------------------------------------------------------------------------ +template +pod_bvector::~pod_bvector() +{ + if (m_num_blocks) { - struct block_type + T** blk = m_blocks + m_num_blocks - 1; + while (m_num_blocks > 0) { - int8u* data; - unsigned size; - }; + pod_allocator::deallocate(*blk, block_size); + --blk; + --m_num_blocks; + } + } + pod_allocator::deallocate(m_blocks, m_max_blocks); +} - public: - void remove_all() +//------------------------------------------------------------------------ +template +void pod_bvector::free_tail(unsigned _size) +{ + if (_size < m_size) + { + unsigned nb = (_size + block_mask) >> block_shift; + while (m_num_blocks > nb) { - if(m_num_blocks) + pod_allocator::deallocate(m_blocks[--m_num_blocks], block_size); + } + if (m_num_blocks == 0) + { + pod_allocator::deallocate(m_blocks, m_max_blocks); + m_blocks = 0; + m_max_blocks = 0; + } + m_size = _size; + } +} + +//------------------------------------------------------------------------ +template +pod_bvector::pod_bvector() + : m_size(0) + , m_num_blocks(0) + , m_max_blocks(0) + , m_blocks(0) + , m_block_ptr_inc(block_size) +{} + +//------------------------------------------------------------------------ +template +pod_bvector::pod_bvector(unsigned block_ptr_inc) + : m_size(0) + , m_num_blocks(0) + , m_max_blocks(0) + , m_blocks(0) + , m_block_ptr_inc(block_ptr_inc) +{} + +//------------------------------------------------------------------------ +template +pod_bvector::pod_bvector(const pod_bvector& v) + : m_size(v.m_size) + , m_num_blocks(v.m_num_blocks) + , m_max_blocks(v.m_max_blocks) + , m_blocks(v.m_max_blocks ? pod_allocator::allocate(v.m_max_blocks) : 0) + , m_block_ptr_inc(v.m_block_ptr_inc) +{ + unsigned i; + for (i = 0; i < v.m_num_blocks; ++i) + { + m_blocks[i] = pod_allocator::allocate(block_size); + memcpy(m_blocks[i], v.m_blocks[i], block_size * sizeof(T)); + } +} + +//------------------------------------------------------------------------ +template +const pod_bvector& pod_bvector::operator=(const pod_bvector& v) +{ + unsigned i; + for (i = m_num_blocks; i < v.m_num_blocks; ++i) + { + allocate_block(i); + } + for (i = 0; i < v.m_num_blocks; ++i) + { + memcpy(m_blocks[i], v.m_blocks[i], block_size * sizeof(T)); + } + m_size = v.m_size; + return *this; +} + +//------------------------------------------------------------------------ +template +void pod_bvector::allocate_block(unsigned nb) +{ + if (nb >= m_max_blocks) + { + T** new_blocks = pod_allocator::allocate(m_max_blocks + m_block_ptr_inc); + + if (m_blocks) + { + memcpy(new_blocks, m_blocks, m_num_blocks * sizeof(T*)); + + pod_allocator::deallocate(m_blocks, m_max_blocks); + } + m_blocks = new_blocks; + m_max_blocks += m_block_ptr_inc; + } + m_blocks[nb] = pod_allocator::allocate(block_size); + m_num_blocks++; +} + +//------------------------------------------------------------------------ +template +inline T* pod_bvector::data_ptr() +{ + unsigned nb = m_size >> block_shift; + if (nb >= m_num_blocks) + { + allocate_block(nb); + } + return m_blocks[nb] + (m_size & block_mask); +} + +//------------------------------------------------------------------------ +template +inline void pod_bvector::add(const T& val) +{ + *data_ptr() = val; + ++m_size; +} + +//------------------------------------------------------------------------ +template +inline void pod_bvector::remove_last() +{ + if (m_size) + --m_size; +} + +//------------------------------------------------------------------------ +template +void pod_bvector::modify_last(const T& val) +{ + remove_last(); + add(val); +} + +//------------------------------------------------------------------------ +template +int pod_bvector::allocate_continuous_block(unsigned num_elements) +{ + if (num_elements < block_size) + { + data_ptr(); // Allocate initial block if necessary + unsigned rest = block_size - (m_size & block_mask); + unsigned index; + if (num_elements <= rest) + { + // The rest of the block is good, we can use it + //----------------- + index = m_size; + m_size += num_elements; + return index; + } + + // New block + //--------------- + m_size += rest; + data_ptr(); + index = m_size; + m_size += num_elements; + return index; + } + return -1; // Impossible to allocate +} + +//------------------------------------------------------------------------ +template +unsigned pod_bvector::byte_size() const +{ + return m_size * sizeof(T); +} + +//------------------------------------------------------------------------ +template +void pod_bvector::serialize(int8u* ptr) const +{ + unsigned i; + for (i = 0; i < m_size; i++) + { + memcpy(ptr, &(*this)[i], sizeof(T)); + ptr += sizeof(T); + } +} + +//------------------------------------------------------------------------ +template +void pod_bvector::deserialize(const int8u* _data, unsigned _byte_size) +{ + remove_all(); + _byte_size /= sizeof(T); + for (unsigned i = 0; i < _byte_size; ++i) + { + T* ptr = data_ptr(); + memcpy(ptr, _data, sizeof(T)); + ++m_size; + _data += sizeof(T); + } +} + +// Replace or add a number of elements starting from "start" position +//------------------------------------------------------------------------ +template +void pod_bvector::deserialize(unsigned start, const T& empty_val, const int8u* _data, unsigned _byte_size) +{ + while (m_size < start) + { + add(empty_val); + } + + _byte_size /= sizeof(T); + for (unsigned i = 0; i < _byte_size; ++i) + { + if (start + i < m_size) + { + memcpy(&((*this)[start + i]), _data, sizeof(T)); + } + else + { + T* ptr = data_ptr(); + memcpy(ptr, _data, sizeof(T)); + ++m_size; + } + _data += sizeof(T); + } +} + +//---------------------------------------------------------block_allocator +// Allocator for arbitrary POD data. Most usable in different cache +// systems for efficient memory allocations. +// Memory is allocated with blocks of fixed size ("block_size" in +// the constructor). If required size exceeds the block size the allocator +// creates a new block of the required size. However, the most efficient +// use is when the average reqired size is much less than the block size. +//------------------------------------------------------------------------ +class block_allocator +{ + struct block_type + { + int8u* data; + unsigned size; + }; + + public: + void remove_all() + { + if (m_num_blocks) + { + block_type* blk = m_blocks + m_num_blocks - 1; + while (m_num_blocks--) { - block_type* blk = m_blocks + m_num_blocks - 1; - while(m_num_blocks--) + pod_allocator::deallocate(blk->data, blk->size); + --blk; + } + pod_allocator::deallocate(m_blocks, m_max_blocks); + } + m_num_blocks = 0; + m_max_blocks = 0; + m_blocks = 0; + m_buf_ptr = 0; + m_rest = 0; + } + + ~block_allocator() { remove_all(); } + + block_allocator(unsigned block_size, unsigned block_ptr_inc = 256 - 8) + : m_block_size(block_size) + , m_block_ptr_inc(block_ptr_inc) + , m_num_blocks(0) + , m_max_blocks(0) + , m_blocks(0) + , m_buf_ptr(0) + , m_rest(0) + {} + + int8u* allocate(unsigned size, unsigned alignment = 1) + { + if (size == 0) + return 0; + if (size <= m_rest) + { + int8u* ptr = m_buf_ptr; + if (alignment > 1) + { + unsigned align = (alignment - unsigned((size_t)ptr) % alignment) % alignment; + + size += align; + ptr += align; + if (size <= m_rest) { - pod_allocator::deallocate(blk->data, blk->size); - --blk; + m_rest -= size; + m_buf_ptr += size; + return ptr; } + allocate_block(size); + return allocate(size - align, alignment); + } + m_rest -= size; + m_buf_ptr += size; + return ptr; + } + allocate_block(size + alignment - 1); + return allocate(size, alignment); + } + + private: + void allocate_block(unsigned size) + { + if (size < m_block_size) + size = m_block_size; + if (m_num_blocks >= m_max_blocks) + { + block_type* new_blocks = pod_allocator::allocate(m_max_blocks + m_block_ptr_inc); + + if (m_blocks) + { + memcpy(new_blocks, m_blocks, m_num_blocks * sizeof(block_type)); pod_allocator::deallocate(m_blocks, m_max_blocks); } - m_num_blocks = 0; - m_max_blocks = 0; - m_blocks = 0; - m_buf_ptr = 0; - m_rest = 0; + m_blocks = new_blocks; + m_max_blocks += m_block_ptr_inc; } - ~block_allocator() - { - remove_all(); - } + m_blocks[m_num_blocks].size = size; + m_blocks[m_num_blocks].data = m_buf_ptr = pod_allocator::allocate(size); - block_allocator(unsigned block_size, unsigned block_ptr_inc=256-8) : - m_block_size(block_size), - m_block_ptr_inc(block_ptr_inc), - m_num_blocks(0), - m_max_blocks(0), - m_blocks(0), - m_buf_ptr(0), - m_rest(0) - { - } - - - int8u* allocate(unsigned size, unsigned alignment=1) - { - if(size == 0) return 0; - if(size <= m_rest) - { - int8u* ptr = m_buf_ptr; - if(alignment > 1) - { - unsigned align = - (alignment - unsigned((size_t)ptr) % alignment) % alignment; - - size += align; - ptr += align; - if(size <= m_rest) - { - m_rest -= size; - m_buf_ptr += size; - return ptr; - } - allocate_block(size); - return allocate(size - align, alignment); - } - m_rest -= size; - m_buf_ptr += size; - return ptr; - } - allocate_block(size + alignment - 1); - return allocate(size, alignment); - } - - - private: - void allocate_block(unsigned size) - { - if(size < m_block_size) size = m_block_size; - if(m_num_blocks >= m_max_blocks) - { - block_type* new_blocks = - pod_allocator::allocate(m_max_blocks + m_block_ptr_inc); - - if(m_blocks) - { - memcpy(new_blocks, - m_blocks, - m_num_blocks * sizeof(block_type)); - pod_allocator::deallocate(m_blocks, m_max_blocks); - } - m_blocks = new_blocks; - m_max_blocks += m_block_ptr_inc; - } - - m_blocks[m_num_blocks].size = size; - m_blocks[m_num_blocks].data = - m_buf_ptr = - pod_allocator::allocate(size); - - m_num_blocks++; - m_rest = size; - } - - unsigned m_block_size; - unsigned m_block_ptr_inc; - unsigned m_num_blocks; - unsigned m_max_blocks; - block_type* m_blocks; - int8u* m_buf_ptr; - unsigned m_rest; - }; - - - - - - - - - //------------------------------------------------------------------------ - enum quick_sort_threshold_e - { - quick_sort_threshold = 9 - }; - - - //-----------------------------------------------------------swap_elements - template inline void swap_elements(T& a, T& b) - { - T temp = a; - a = b; - b = temp; + m_num_blocks++; + m_rest = size; } + unsigned m_block_size; + unsigned m_block_ptr_inc; + unsigned m_num_blocks; + unsigned m_max_blocks; + block_type* m_blocks; + int8u* m_buf_ptr; + unsigned m_rest; +}; - //--------------------------------------------------------------quick_sort - template - void quick_sort(Array& arr, Less less) +//------------------------------------------------------------------------ +enum quick_sort_threshold_e { quick_sort_threshold = 9 }; + +//-----------------------------------------------------------swap_elements +template +inline void swap_elements(T& a, T& b) +{ + T temp = a; + a = b; + b = temp; +} + +//--------------------------------------------------------------quick_sort +template +void quick_sort(Array& arr, Less less) +{ + if (arr.size() < 2) + return; + + typename Array::value_type* e1; + typename Array::value_type* e2; + + int stack[80]; + int* top = stack; + int limit = arr.size(); + int base = 0; + + for (;;) { - if(arr.size() < 2) return; + int len = limit - base; - typename Array::value_type* e1; - typename Array::value_type* e2; + int i; + int j; + int pivot; - int stack[80]; - int* top = stack; - int limit = arr.size(); - int base = 0; - - for(;;) + if (len > quick_sort_threshold) { - int len = limit - base; + // we use base + len/2 as the pivot + pivot = base + len / 2; + swap_elements(arr[base], arr[pivot]); - int i; - int j; - int pivot; + i = base + 1; + j = limit - 1; - if(len > quick_sort_threshold) + // now ensure that *i <= *base <= *j + e1 = &(arr[j]); + e2 = &(arr[i]); + if (less(*e1, *e2)) + swap_elements(*e1, *e2); + + e1 = &(arr[base]); + e2 = &(arr[i]); + if (less(*e1, *e2)) + swap_elements(*e1, *e2); + + e1 = &(arr[j]); + e2 = &(arr[base]); + if (less(*e1, *e2)) + swap_elements(*e1, *e2); + + for (;;) { - // we use base + len/2 as the pivot - pivot = base + len / 2; - swap_elements(arr[base], arr[pivot]); + do + i++; + while (less(arr[i], arr[base])); + do + j--; + while (less(arr[base], arr[j])); - i = base + 1; - j = limit - 1; - - // now ensure that *i <= *base <= *j - e1 = &(arr[j]); - e2 = &(arr[i]); - if(less(*e1, *e2)) swap_elements(*e1, *e2); - - e1 = &(arr[base]); - e2 = &(arr[i]); - if(less(*e1, *e2)) swap_elements(*e1, *e2); - - e1 = &(arr[j]); - e2 = &(arr[base]); - if(less(*e1, *e2)) swap_elements(*e1, *e2); - - for(;;) - { - do i++; while( less(arr[i], arr[base]) ); - do j--; while( less(arr[base], arr[j]) ); - - if( i > j ) - { - break; - } - - swap_elements(arr[i], arr[j]); - } - - swap_elements(arr[base], arr[j]); - - // now, push the largest sub-array - if(j - base > limit - i) - { - top[0] = base; - top[1] = j; - base = i; - } - else - { - top[0] = i; - top[1] = limit; - limit = j; - } - top += 2; - } - else - { - // the sub-array is small, perform insertion sort - j = base; - i = j + 1; - - for(; i < limit; j = i, i++) - { - for(; less(*(e1 = &(arr[j + 1])), *(e2 = &(arr[j]))); j--) - { - swap_elements(*e1, *e2); - if(j == base) - { - break; - } - } - } - if(top > stack) - { - top -= 2; - base = top[0]; - limit = top[1]; - } - else + if (i > j) { break; } + + swap_elements(arr[i], arr[j]); } - } - } + swap_elements(arr[base], arr[j]); - - - //------------------------------------------------------remove_duplicates - // Remove duplicates from a sorted array. It doesn't cut the - // tail of the array, it just returns the number of remaining elements. - //----------------------------------------------------------------------- - template - unsigned remove_duplicates(Array& arr, Equal equal) - { - if(arr.size() < 2) return arr.size(); - - unsigned i, j; - for(i = 1, j = 1; i < arr.size(); i++) - { - typename Array::value_type& e = arr[i]; - if(!equal(e, arr[i - 1])) + // now, push the largest sub-array + if (j - base > limit - i) { - arr[j++] = e; + top[0] = base; + top[1] = j; + base = i; + } + else + { + top[0] = i; + top[1] = limit; + limit = j; + } + top += 2; + } + else + { + // the sub-array is small, perform insertion sort + j = base; + i = j + 1; + + for (; i < limit; j = i, i++) + { + for (; less(*(e1 = &(arr[j + 1])), *(e2 = &(arr[j]))); j--) + { + swap_elements(*e1, *e2); + if (j == base) + { + break; + } + } + } + if (top > stack) + { + top -= 2; + base = top[0]; + limit = top[1]; + } + else + { + break; } } - return j; } - - //--------------------------------------------------------invert_container - template void invert_container(Array& arr) - { - int i = 0; - int j = arr.size() - 1; - while(i < j) - { - swap_elements(arr[i++], arr[j--]); - } - } - - //------------------------------------------------------binary_search_pos - template - unsigned binary_search_pos(const Array& arr, const Value& val, Less less) - { - if(arr.size() == 0) return 0; - - unsigned beg = 0; - unsigned end = arr.size() - 1; - - if(less(val, arr[0])) return 0; - if(less(arr[end], val)) return end + 1; - - while(end - beg > 1) - { - unsigned mid = (end + beg) >> 1; - if(less(val, arr[mid])) end = mid; - else beg = mid; - } - - //if(beg <= 0 && less(val, arr[0])) return 0; - //if(end >= arr.size() - 1 && less(arr[end], val)) ++end; - - return end; - } - - //----------------------------------------------------------range_adaptor - template class range_adaptor - { - public: - typedef typename Array::value_type value_type; - - range_adaptor(Array& array, unsigned start, unsigned _size) : - m_array(array), m_start(start), m_size(_size) - {} - - unsigned size() const { return m_size; } - const value_type& operator [] (unsigned i) const { return m_array[m_start + i]; } - value_type& operator [] (unsigned i) { return m_array[m_start + i]; } - const value_type& at(unsigned i) const { return m_array[m_start + i]; } - value_type& at(unsigned i) { return m_array[m_start + i]; } - value_type value_at(unsigned i) const { return m_array[m_start + i]; } - - private: - Array& m_array; - unsigned m_start; - unsigned m_size; - }; - - //---------------------------------------------------------------int_less - inline bool int_less(int a, int b) { return a < b; } - - //------------------------------------------------------------int_greater - inline bool int_greater(int a, int b) { return a > b; } - - //----------------------------------------------------------unsigned_less - inline bool unsigned_less(unsigned a, unsigned b) { return a < b; } - - //-------------------------------------------------------unsigned_greater - inline bool unsigned_greater(unsigned a, unsigned b) { return a > b; } } +//------------------------------------------------------remove_duplicates +// Remove duplicates from a sorted array. It doesn't cut the +// tail of the array, it just returns the number of remaining elements. +//----------------------------------------------------------------------- +template +unsigned remove_duplicates(Array& arr, Equal equal) +{ + if (arr.size() < 2) + return arr.size(); + + unsigned i, j; + for (i = 1, j = 1; i < arr.size(); i++) + { + typename Array::value_type& e = arr[i]; + if (!equal(e, arr[i - 1])) + { + arr[j++] = e; + } + } + return j; +} + +//--------------------------------------------------------invert_container +template +void invert_container(Array& arr) +{ + int i = 0; + int j = arr.size() - 1; + while (i < j) + { + swap_elements(arr[i++], arr[j--]); + } +} + +//------------------------------------------------------binary_search_pos +template +unsigned binary_search_pos(const Array& arr, const Value& val, Less less) +{ + if (arr.size() == 0) + return 0; + + unsigned beg = 0; + unsigned end = arr.size() - 1; + + if (less(val, arr[0])) + return 0; + if (less(arr[end], val)) + return end + 1; + + while (end - beg > 1) + { + unsigned mid = (end + beg) >> 1; + if (less(val, arr[mid])) + end = mid; + else + beg = mid; + } + + // if(beg <= 0 && less(val, arr[0])) return 0; + // if(end >= arr.size() - 1 && less(arr[end], val)) ++end; + + return end; +} + +//----------------------------------------------------------range_adaptor +template +class range_adaptor +{ + public: + typedef typename Array::value_type value_type; + + range_adaptor(Array& array, unsigned start, unsigned _size) + : m_array(array) + , m_start(start) + , m_size(_size) + {} + + unsigned size() const { return m_size; } + const value_type& operator[](unsigned i) const { return m_array[m_start + i]; } + value_type& operator[](unsigned i) { return m_array[m_start + i]; } + const value_type& at(unsigned i) const { return m_array[m_start + i]; } + value_type& at(unsigned i) { return m_array[m_start + i]; } + value_type value_at(unsigned i) const { return m_array[m_start + i]; } + + private: + Array& m_array; + unsigned m_start; + unsigned m_size; +}; + +//---------------------------------------------------------------int_less +inline bool int_less(int a, int b) +{ + return a < b; +} + +//------------------------------------------------------------int_greater +inline bool int_greater(int a, int b) +{ + return a > b; +} + +//----------------------------------------------------------unsigned_less +inline bool unsigned_less(unsigned a, unsigned b) +{ + return a < b; +} + +//-------------------------------------------------------unsigned_greater +inline bool unsigned_greater(unsigned a, unsigned b) +{ + return a > b; +} +} // namespace agg + #endif diff --git a/deps/agg/include/agg_arrowhead.h b/deps/agg/include/agg_arrowhead.h index 5e029ddee..182126145 100644 --- a/deps/agg/include/agg_arrowhead.h +++ b/deps/agg/include/agg_arrowhead.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -13,7 +13,7 @@ // http://www.antigrain.com //---------------------------------------------------------------------------- // -// Simple arrowhead/arrowtail generator +// Simple arrowhead/arrowtail generator // //---------------------------------------------------------------------------- #ifndef AGG_ARROWHEAD_INCLUDED @@ -21,62 +21,61 @@ #include "agg_basics.h" -namespace agg +namespace agg { + +//===============================================================arrowhead +// +// See implementation agg_arrowhead.cpp +// +class arrowhead { + public: + arrowhead(); - //===============================================================arrowhead - // - // See implementation agg_arrowhead.cpp - // - class arrowhead + void head(double d1, double d2, double d3, double d4) { - public: - arrowhead(); + m_head_d1 = d1; + m_head_d2 = d2; + m_head_d3 = d3; + m_head_d4 = d4; + m_head_flag = true; + } - void head(double d1, double d2, double d3, double d4) - { - m_head_d1 = d1; - m_head_d2 = d2; - m_head_d3 = d3; - m_head_d4 = d4; - m_head_flag = true; - } + void head() { m_head_flag = true; } + void no_head() { m_head_flag = false; } - void head() { m_head_flag = true; } - void no_head() { m_head_flag = false; } + void tail(double d1, double d2, double d3, double d4) + { + m_tail_d1 = d1; + m_tail_d2 = d2; + m_tail_d3 = d3; + m_tail_d4 = d4; + m_tail_flag = true; + } - void tail(double d1, double d2, double d3, double d4) - { - m_tail_d1 = d1; - m_tail_d2 = d2; - m_tail_d3 = d3; - m_tail_d4 = d4; - m_tail_flag = true; - } + void tail() { m_tail_flag = true; } + void no_tail() { m_tail_flag = false; } - void tail() { m_tail_flag = true; } - void no_tail() { m_tail_flag = false; } + void rewind(unsigned path_id); + unsigned vertex(double* x, double* y); - void rewind(unsigned path_id); - unsigned vertex(double* x, double* y); + private: + double m_head_d1; + double m_head_d2; + double m_head_d3; + double m_head_d4; + double m_tail_d1; + double m_tail_d2; + double m_tail_d3; + double m_tail_d4; + bool m_head_flag; + bool m_tail_flag; + double m_coord[16]; + unsigned m_cmd[8]; + unsigned m_curr_id; + unsigned m_curr_coord; +}; - private: - double m_head_d1; - double m_head_d2; - double m_head_d3; - double m_head_d4; - double m_tail_d1; - double m_tail_d2; - double m_tail_d3; - double m_tail_d4; - bool m_head_flag; - bool m_tail_flag; - double m_coord[16]; - unsigned m_cmd[8]; - unsigned m_curr_id; - unsigned m_curr_coord; - }; - -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_basics.h b/deps/agg/include/agg_basics.h index a617cf253..9e9708ab9 100644 --- a/deps/agg/include/agg_basics.h +++ b/deps/agg/include/agg_basics.h @@ -23,41 +23,41 @@ #ifdef AGG_CUSTOM_ALLOCATOR #include "agg_allocator.h" #else -namespace agg +namespace agg { +// The policy of all AGG containers and memory allocation strategy +// in general is that no allocated data requires explicit construction. +// It means that the allocator can be really simple; you can even +// replace new/delete to malloc/free. The constructors and destructors +// won't be called in this case, however everything will remain working. +// The second argument of deallocate() is the size of the allocated +// block. You can use this information if you wish. +//------------------------------------------------------------pod_allocator +template +struct pod_allocator { - // The policy of all AGG containers and memory allocation strategy - // in general is that no allocated data requires explicit construction. - // It means that the allocator can be really simple; you can even - // replace new/delete to malloc/free. The constructors and destructors - // won't be called in this case, however everything will remain working. - // The second argument of deallocate() is the size of the allocated - // block. You can use this information if you wish. - //------------------------------------------------------------pod_allocator - template struct pod_allocator - { - //static T* allocate(unsigned num) { return static_cast(::operator new(sizeof(T)*num));} - //static void deallocate(T* ptr, unsigned) { ::operator delete(ptr) ;} - static T* allocate(unsigned num) { return new T [num]; } - static void deallocate(T* ptr, unsigned) { delete [] ptr; } - }; + // static T* allocate(unsigned num) { return static_cast(::operator new(sizeof(T)*num));} + // static void deallocate(T* ptr, unsigned) { ::operator delete(ptr) ;} + static T* allocate(unsigned num) { return new T[num]; } + static void deallocate(T* ptr, unsigned) { delete[] ptr; } +}; - // Single object allocator. It's also can be replaced with your custom - // allocator. The difference is that it can only allocate a single - // object and the constructor and destructor must be called. - // In AGG there is no need to allocate an array of objects with - // calling their constructors (only single ones). So that, if you - // replace these new/delete to malloc/free make sure that the in-place - // new is called and take care of calling the destructor too. - //------------------------------------------------------------obj_allocator - template struct obj_allocator - { - static T* allocate() { return new T; } - static void deallocate(T* ptr) { delete ptr; } - }; -} +// Single object allocator. It's also can be replaced with your custom +// allocator. The difference is that it can only allocate a single +// object and the constructor and destructor must be called. +// In AGG there is no need to allocate an array of objects with +// calling their constructors (only single ones). So that, if you +// replace these new/delete to malloc/free make sure that the in-place +// new is called and take care of calling the destructor too. +//------------------------------------------------------------obj_allocator +template +struct obj_allocator +{ + static T* allocate() { return new T; } + static void deallocate(T* ptr) { delete ptr; } +}; +} // namespace agg #endif - //-------------------------------------------------------- Default basic types // // If the compiler has different capacity of the basic types you can redefine @@ -98,7 +98,7 @@ namespace agg //------------------------------------------------ Some fixes for MS Visual C++ #if defined(_MSC_VER) -#pragma warning(disable:4786) // Identifier was truncated... +#pragma warning(disable: 4786) // Identifier was truncated... #endif #if defined(_MSC_VER) @@ -107,372 +107,407 @@ namespace agg #define AGG_INLINE inline #endif -namespace agg +namespace agg { +//------------------------------------------------------------------------- +typedef AGG_INT8 int8; //----int8 +typedef AGG_INT8U int8u; //----int8u +typedef AGG_INT16 int16; //----int16 +typedef AGG_INT16U int16u; //----int16u +typedef AGG_INT32 int32; //----int32 +typedef AGG_INT32U int32u; //----int32u +typedef AGG_INT64 int64; //----int64 +typedef AGG_INT64U int64u; //----int64u + +AGG_INLINE int iround(double v) { - //------------------------------------------------------------------------- - typedef AGG_INT8 int8; //----int8 - typedef AGG_INT8U int8u; //----int8u - typedef AGG_INT16 int16; //----int16 - typedef AGG_INT16U int16u; //----int16u - typedef AGG_INT32 int32; //----int32 - typedef AGG_INT32U int32u; //----int32u - typedef AGG_INT64 int64; //----int64 - typedef AGG_INT64U int64u; //----int64u - - AGG_INLINE int iround(double v) - { - return int((v < 0.0) ? v - 0.5 : v + 0.5); - } - AGG_INLINE int uround(double v) - { - return unsigned(v + 0.5); - } - AGG_INLINE unsigned ufloor(double v) - { - return unsigned(v); - } - AGG_INLINE unsigned uceil(double v) - { - return unsigned(std::ceil(v)); - } - - //---------------------------------------------------------------saturation - template struct saturation - { - AGG_INLINE static int iround(double v) - { - if(v < double(-Limit)) return -Limit; - if(v > double( Limit)) return Limit; - return agg::iround(v); - } - }; - - //------------------------------------------------------------------mul_one - template struct mul_one - { - AGG_INLINE static unsigned mul(unsigned a, unsigned b) - { - unsigned q = a * b + (1 << (Shift-1)); - return (q + (q >> Shift)) >> Shift; - } - }; - - //------------------------------------------------------------------------- - typedef unsigned char cover_type; //----cover_type - enum cover_scale_e - { - cover_shift = 8, //----cover_shift - cover_size = 1 << cover_shift, //----cover_size - cover_mask = cover_size - 1, //----cover_mask - cover_none = 0, //----cover_none - cover_full = cover_mask //----cover_full - }; - - //----------------------------------------------------poly_subpixel_scale_e - // These constants determine the subpixel accuracy, to be more precise, - // the number of bits of the fractional part of the coordinates. - // The possible coordinate capacity in bits can be calculated by formula: - // sizeof(int) * 8 - poly_subpixel_shift, i.e, for 32-bit integers and - // 8-bits fractional part the capacity is 24 bits. - enum poly_subpixel_scale_e - { - poly_subpixel_shift = 8, //----poly_subpixel_shift - poly_subpixel_scale = 1< struct rect_base - { - typedef T value_type; - typedef rect_base self_type; - T x1, y1, x2, y2; - - rect_base() {} - rect_base(T x1_, T y1_, T x2_, T y2_) : - x1(x1_), y1(y1_), x2(x2_), y2(y2_) {} - - void init(T x1_, T y1_, T x2_, T y2_) - { - x1 = x1_; y1 = y1_; x2 = x2_; y2 = y2_; - } - - const self_type& normalize() - { - T t; - if(x1 > x2) { t = x1; x1 = x2; x2 = t; } - if(y1 > y2) { t = y1; y1 = y2; y2 = t; } - return *this; - } - - bool clip(const self_type& r) - { - if(x2 > r.x2) x2 = r.x2; - if(y2 > r.y2) y2 = r.y2; - if(x1 < r.x1) x1 = r.x1; - if(y1 < r.y1) y1 = r.y1; - return x1 <= x2 && y1 <= y2; - } - - bool is_valid() const - { - return x1 <= x2 && y1 <= y2; - } - - bool hit_test(T x, T y) const - { - return (x >= x1 && x <= x2 && y >= y1 && y <= y2); - } - }; - - //-----------------------------------------------------intersect_rectangles - template - inline Rect intersect_rectangles(const Rect& r1, const Rect& r2) - { - Rect r = r1; - - // First process x2,y2 because the other order - // results in Internal Compiler Error under - // Microsoft Visual C++ .NET 2003 69462-335-0000007-18038 in - // case of "Maximize Speed" optimization option. - //----------------- - if(r.x2 > r2.x2) r.x2 = r2.x2; - if(r.y2 > r2.y2) r.y2 = r2.y2; - if(r.x1 < r2.x1) r.x1 = r2.x1; - if(r.y1 < r2.y1) r.y1 = r2.y1; - return r; - } - - - //---------------------------------------------------------unite_rectangles - template - inline Rect unite_rectangles(const Rect& r1, const Rect& r2) - { - Rect r = r1; - if(r.x2 < r2.x2) r.x2 = r2.x2; - if(r.y2 < r2.y2) r.y2 = r2.y2; - if(r.x1 > r2.x1) r.x1 = r2.x1; - if(r.y1 > r2.y1) r.y1 = r2.y1; - return r; - } - - typedef rect_base rect_i; //----rect_i - typedef rect_base rect_f; //----rect_f - typedef rect_base rect_d; //----rect_d - - //---------------------------------------------------------path_commands_e - enum path_commands_e - { - path_cmd_stop = 0, //----path_cmd_stop - path_cmd_move_to = 1, //----path_cmd_move_to - path_cmd_line_to = 2, //----path_cmd_line_to - path_cmd_curve3 = 3, //----path_cmd_curve3 - path_cmd_curve4 = 4, //----path_cmd_curve4 - path_cmd_curveN = 5, //----path_cmd_curveN - path_cmd_catrom = 6, //----path_cmd_catrom - path_cmd_ubspline = 7, //----path_cmd_ubspline - path_cmd_end_poly = 0x0F, //----path_cmd_end_poly - path_cmd_mask = 0x0F //----path_cmd_mask - }; - - //------------------------------------------------------------path_flags_e - enum path_flags_e - { - path_flags_none = 0, //----path_flags_none - path_flags_ccw = 0x10, //----path_flags_ccw - path_flags_cw = 0x20, //----path_flags_cw - path_flags_close = 0x40, //----path_flags_close - path_flags_mask = 0xF0 //----path_flags_mask - }; - - //---------------------------------------------------------------is_vertex - inline bool is_vertex(unsigned c) - { - return c >= path_cmd_move_to && c < path_cmd_end_poly; - } - - //--------------------------------------------------------------is_drawing - inline bool is_drawing(unsigned c) - { - return c >= path_cmd_line_to && c < path_cmd_end_poly; - } - - //-----------------------------------------------------------------is_stop - inline bool is_stop(unsigned c) - { - return c == path_cmd_stop; - } - - //--------------------------------------------------------------is_move_to - inline bool is_move_to(unsigned c) - { - return c == path_cmd_move_to; - } - - //--------------------------------------------------------------is_line_to - inline bool is_line_to(unsigned c) - { - return c == path_cmd_line_to; - } - - //----------------------------------------------------------------is_curve - inline bool is_curve(unsigned c) - { - return c == path_cmd_curve3 || c == path_cmd_curve4; - } - - //---------------------------------------------------------------is_curve3 - inline bool is_curve3(unsigned c) - { - return c == path_cmd_curve3; - } - - //---------------------------------------------------------------is_curve4 - inline bool is_curve4(unsigned c) - { - return c == path_cmd_curve4; - } - - //-------------------------------------------------------------is_end_poly - inline bool is_end_poly(unsigned c) - { - return (c & path_cmd_mask) == path_cmd_end_poly; - } - - //----------------------------------------------------------------is_close - inline bool is_close(unsigned c) - { - return (c & ~(path_flags_cw | path_flags_ccw)) == - (path_cmd_end_poly | path_flags_close); - } - - //------------------------------------------------------------is_next_poly - inline bool is_next_poly(unsigned c) - { - return is_stop(c) || is_move_to(c) || is_end_poly(c); - } - - //-------------------------------------------------------------------is_cw - inline bool is_cw(unsigned c) - { - return (c & path_flags_cw) != 0; - } - - //------------------------------------------------------------------is_ccw - inline bool is_ccw(unsigned c) - { - return (c & path_flags_ccw) != 0; - } - - //-------------------------------------------------------------is_oriented - inline bool is_oriented(unsigned c) - { - return (c & (path_flags_cw | path_flags_ccw)) != 0; - } - - //---------------------------------------------------------------is_closed - inline bool is_closed(unsigned c) - { - return (c & path_flags_close) != 0; - } - - //----------------------------------------------------------get_close_flag - inline unsigned get_close_flag(unsigned c) - { - return c & path_flags_close; - } - - //-------------------------------------------------------clear_orientation - inline unsigned clear_orientation(unsigned c) - { - return c & ~(path_flags_cw | path_flags_ccw); - } - - //---------------------------------------------------------get_orientation - inline unsigned get_orientation(unsigned c) - { - return c & (path_flags_cw | path_flags_ccw); - } - - //---------------------------------------------------------set_orientation - inline unsigned set_orientation(unsigned c, unsigned o) - { - return clear_orientation(c) | o; - } - - //--------------------------------------------------------------point_base - template struct point_base - { - typedef T value_type; - T x,y; - point_base() {} - point_base(T x_, T y_) : x(x_), y(y_) {} - }; - typedef point_base point_i; //-----point_i - typedef point_base point_f; //-----point_f - typedef point_base point_d; //-----point_d - - //-------------------------------------------------------------vertex_base - template struct vertex_base - { - typedef T value_type; - T x,y; - unsigned cmd; - vertex_base() {} - vertex_base(T x_, T y_, unsigned cmd_) : x(x_), y(y_), cmd(cmd_) {} - }; - typedef vertex_base vertex_i; //-----vertex_i - typedef vertex_base vertex_f; //-----vertex_f - typedef vertex_base vertex_d; //-----vertex_d - - //----------------------------------------------------------------row_info - template struct row_info - { - int x1, x2; - T* ptr; - row_info() {} - row_info(int x1_, int x2_, T* ptr_) : x1(x1_), x2(x2_), ptr(ptr_) {} - }; - - //----------------------------------------------------------const_row_info - template struct const_row_info - { - int x1, x2; - const T* ptr; - const_row_info() {} - const_row_info(int x1_, int x2_, const T* ptr_) : - x1(x1_), x2(x2_), ptr(ptr_) {} - }; - - //------------------------------------------------------------is_equal_eps - template inline bool is_equal_eps(T v1, T v2, T epsilon) - { - return std::fabs(v1 - v2) <= double(epsilon); - } - + return int((v < 0.0) ? v - 0.5 : v + 0.5); +} +AGG_INLINE int uround(double v) +{ + return unsigned(v + 0.5); +} +AGG_INLINE unsigned ufloor(double v) +{ + return unsigned(v); +} +AGG_INLINE unsigned uceil(double v) +{ + return unsigned(std::ceil(v)); } +//---------------------------------------------------------------saturation +template +struct saturation +{ + AGG_INLINE static int iround(double v) + { + if (v < double(-Limit)) + return -Limit; + if (v > double(Limit)) + return Limit; + return agg::iround(v); + } +}; + +//------------------------------------------------------------------mul_one +template +struct mul_one +{ + AGG_INLINE static unsigned mul(unsigned a, unsigned b) + { + unsigned q = a * b + (1 << (Shift - 1)); + return (q + (q >> Shift)) >> Shift; + } +}; + +//------------------------------------------------------------------------- +typedef unsigned char cover_type; //----cover_type +enum cover_scale_e { + cover_shift = 8, //----cover_shift + cover_size = 1 << cover_shift, //----cover_size + cover_mask = cover_size - 1, //----cover_mask + cover_none = 0, //----cover_none + cover_full = cover_mask //----cover_full +}; + +//----------------------------------------------------poly_subpixel_scale_e +// These constants determine the subpixel accuracy, to be more precise, +// the number of bits of the fractional part of the coordinates. +// The possible coordinate capacity in bits can be calculated by formula: +// sizeof(int) * 8 - poly_subpixel_shift, i.e, for 32-bit integers and +// 8-bits fractional part the capacity is 24 bits. +enum poly_subpixel_scale_e { + poly_subpixel_shift = 8, //----poly_subpixel_shift + poly_subpixel_scale = 1 << poly_subpixel_shift, //----poly_subpixel_scale + poly_subpixel_mask = poly_subpixel_scale - 1 //----poly_subpixel_mask +}; + +//----------------------------------------------------------filling_rule_e +enum filling_rule_e { fill_non_zero, fill_even_odd }; + +//-----------------------------------------------------------------------pi +const double pi = 3.14159265358979323846; + +//------------------------------------------------------------------deg2rad +inline double deg2rad(double deg) +{ + return deg * pi / 180.0; +} + +//------------------------------------------------------------------rad2deg +inline double rad2deg(double rad) +{ + return rad * 180.0 / pi; +} + +//----------------------------------------------------------------rect_base +template +struct rect_base +{ + typedef T value_type; + typedef rect_base self_type; + T x1, y1, x2, y2; + + rect_base() {} + rect_base(T x1_, T y1_, T x2_, T y2_) + : x1(x1_) + , y1(y1_) + , x2(x2_) + , y2(y2_) + {} + + void init(T x1_, T y1_, T x2_, T y2_) + { + x1 = x1_; + y1 = y1_; + x2 = x2_; + y2 = y2_; + } + + const self_type& normalize() + { + T t; + if (x1 > x2) + { + t = x1; + x1 = x2; + x2 = t; + } + if (y1 > y2) + { + t = y1; + y1 = y2; + y2 = t; + } + return *this; + } + + bool clip(const self_type& r) + { + if (x2 > r.x2) + x2 = r.x2; + if (y2 > r.y2) + y2 = r.y2; + if (x1 < r.x1) + x1 = r.x1; + if (y1 < r.y1) + y1 = r.y1; + return x1 <= x2 && y1 <= y2; + } + + bool is_valid() const { return x1 <= x2 && y1 <= y2; } + + bool hit_test(T x, T y) const { return (x >= x1 && x <= x2 && y >= y1 && y <= y2); } +}; + +//-----------------------------------------------------intersect_rectangles +template +inline Rect intersect_rectangles(const Rect& r1, const Rect& r2) +{ + Rect r = r1; + + // First process x2,y2 because the other order + // results in Internal Compiler Error under + // Microsoft Visual C++ .NET 2003 69462-335-0000007-18038 in + // case of "Maximize Speed" optimization option. + //----------------- + if (r.x2 > r2.x2) + r.x2 = r2.x2; + if (r.y2 > r2.y2) + r.y2 = r2.y2; + if (r.x1 < r2.x1) + r.x1 = r2.x1; + if (r.y1 < r2.y1) + r.y1 = r2.y1; + return r; +} + +//---------------------------------------------------------unite_rectangles +template +inline Rect unite_rectangles(const Rect& r1, const Rect& r2) +{ + Rect r = r1; + if (r.x2 < r2.x2) + r.x2 = r2.x2; + if (r.y2 < r2.y2) + r.y2 = r2.y2; + if (r.x1 > r2.x1) + r.x1 = r2.x1; + if (r.y1 > r2.y1) + r.y1 = r2.y1; + return r; +} + +typedef rect_base rect_i; //----rect_i +typedef rect_base rect_f; //----rect_f +typedef rect_base rect_d; //----rect_d + +//---------------------------------------------------------path_commands_e +enum path_commands_e { + path_cmd_stop = 0, //----path_cmd_stop + path_cmd_move_to = 1, //----path_cmd_move_to + path_cmd_line_to = 2, //----path_cmd_line_to + path_cmd_curve3 = 3, //----path_cmd_curve3 + path_cmd_curve4 = 4, //----path_cmd_curve4 + path_cmd_curveN = 5, //----path_cmd_curveN + path_cmd_catrom = 6, //----path_cmd_catrom + path_cmd_ubspline = 7, //----path_cmd_ubspline + path_cmd_end_poly = 0x0F, //----path_cmd_end_poly + path_cmd_mask = 0x0F //----path_cmd_mask +}; + +//------------------------------------------------------------path_flags_e +enum path_flags_e { + path_flags_none = 0, //----path_flags_none + path_flags_ccw = 0x10, //----path_flags_ccw + path_flags_cw = 0x20, //----path_flags_cw + path_flags_close = 0x40, //----path_flags_close + path_flags_mask = 0xF0 //----path_flags_mask +}; + +//---------------------------------------------------------------is_vertex +inline bool is_vertex(unsigned c) +{ + return c >= path_cmd_move_to && c < path_cmd_end_poly; +} + +//--------------------------------------------------------------is_drawing +inline bool is_drawing(unsigned c) +{ + return c >= path_cmd_line_to && c < path_cmd_end_poly; +} + +//-----------------------------------------------------------------is_stop +inline bool is_stop(unsigned c) +{ + return c == path_cmd_stop; +} + +//--------------------------------------------------------------is_move_to +inline bool is_move_to(unsigned c) +{ + return c == path_cmd_move_to; +} + +//--------------------------------------------------------------is_line_to +inline bool is_line_to(unsigned c) +{ + return c == path_cmd_line_to; +} + +//----------------------------------------------------------------is_curve +inline bool is_curve(unsigned c) +{ + return c == path_cmd_curve3 || c == path_cmd_curve4; +} + +//---------------------------------------------------------------is_curve3 +inline bool is_curve3(unsigned c) +{ + return c == path_cmd_curve3; +} + +//---------------------------------------------------------------is_curve4 +inline bool is_curve4(unsigned c) +{ + return c == path_cmd_curve4; +} + +//-------------------------------------------------------------is_end_poly +inline bool is_end_poly(unsigned c) +{ + return (c & path_cmd_mask) == path_cmd_end_poly; +} + +//----------------------------------------------------------------is_close +inline bool is_close(unsigned c) +{ + return (c & ~(path_flags_cw | path_flags_ccw)) == (path_cmd_end_poly | path_flags_close); +} + +//------------------------------------------------------------is_next_poly +inline bool is_next_poly(unsigned c) +{ + return is_stop(c) || is_move_to(c) || is_end_poly(c); +} + +//-------------------------------------------------------------------is_cw +inline bool is_cw(unsigned c) +{ + return (c & path_flags_cw) != 0; +} + +//------------------------------------------------------------------is_ccw +inline bool is_ccw(unsigned c) +{ + return (c & path_flags_ccw) != 0; +} + +//-------------------------------------------------------------is_oriented +inline bool is_oriented(unsigned c) +{ + return (c & (path_flags_cw | path_flags_ccw)) != 0; +} + +//---------------------------------------------------------------is_closed +inline bool is_closed(unsigned c) +{ + return (c & path_flags_close) != 0; +} + +//----------------------------------------------------------get_close_flag +inline unsigned get_close_flag(unsigned c) +{ + return c & path_flags_close; +} + +//-------------------------------------------------------clear_orientation +inline unsigned clear_orientation(unsigned c) +{ + return c & ~(path_flags_cw | path_flags_ccw); +} + +//---------------------------------------------------------get_orientation +inline unsigned get_orientation(unsigned c) +{ + return c & (path_flags_cw | path_flags_ccw); +} + +//---------------------------------------------------------set_orientation +inline unsigned set_orientation(unsigned c, unsigned o) +{ + return clear_orientation(c) | o; +} + +//--------------------------------------------------------------point_base +template +struct point_base +{ + typedef T value_type; + T x, y; + point_base() {} + point_base(T x_, T y_) + : x(x_) + , y(y_) + {} +}; +typedef point_base point_i; //-----point_i +typedef point_base point_f; //-----point_f +typedef point_base point_d; //-----point_d + +//-------------------------------------------------------------vertex_base +template +struct vertex_base +{ + typedef T value_type; + T x, y; + unsigned cmd; + vertex_base() {} + vertex_base(T x_, T y_, unsigned cmd_) + : x(x_) + , y(y_) + , cmd(cmd_) + {} +}; +typedef vertex_base vertex_i; //-----vertex_i +typedef vertex_base vertex_f; //-----vertex_f +typedef vertex_base vertex_d; //-----vertex_d + +//----------------------------------------------------------------row_info +template +struct row_info +{ + int x1, x2; + T* ptr; + row_info() {} + row_info(int x1_, int x2_, T* ptr_) + : x1(x1_) + , x2(x2_) + , ptr(ptr_) + {} +}; + +//----------------------------------------------------------const_row_info +template +struct const_row_info +{ + int x1, x2; + const T* ptr; + const_row_info() {} + const_row_info(int x1_, int x2_, const T* ptr_) + : x1(x1_) + , x2(x2_) + , ptr(ptr_) + {} +}; + +//------------------------------------------------------------is_equal_eps +template +inline bool is_equal_eps(T v1, T v2, T epsilon) +{ + return std::fabs(v1 - v2) <= double(epsilon); +} + +} // namespace agg #endif diff --git a/deps/agg/include/agg_bezier_arc.h b/deps/agg/include/agg_bezier_arc.h index b3d65492f..bd979ece3 100644 --- a/deps/agg/include/agg_bezier_arc.h +++ b/deps/agg/include/agg_bezier_arc.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -13,7 +13,7 @@ // http://www.antigrain.com //---------------------------------------------------------------------------- // -// Arc generator. Produces at most 4 consecutive cubic bezier curves, i.e., +// Arc generator. Produces at most 4 consecutive cubic bezier curves, i.e., // 4, 7, 10, or 13 vertices. // //---------------------------------------------------------------------------- @@ -23,137 +23,127 @@ #include "agg_conv_transform.h" -namespace agg +namespace agg { + +//----------------------------------------------------------------------- +void arc_to_bezier(double cx, double cy, double rx, double ry, double start_angle, double sweep_angle, double* curve); + +//==============================================================bezier_arc +// +// See implemantaion agg_bezier_arc.cpp +// +class bezier_arc { - - //----------------------------------------------------------------------- - void arc_to_bezier(double cx, double cy, double rx, double ry, - double start_angle, double sweep_angle, - double* curve); - - - //==============================================================bezier_arc - // - // See implemantaion agg_bezier_arc.cpp - // - class bezier_arc + public: + //-------------------------------------------------------------------- + bezier_arc() + : m_vertex(26) + , m_num_vertices(0) + , m_cmd(path_cmd_line_to) + {} + bezier_arc(double x, double y, double rx, double ry, double start_angle, double sweep_angle) { - public: - //-------------------------------------------------------------------- - bezier_arc() : m_vertex(26), m_num_vertices(0), m_cmd(path_cmd_line_to) {} - bezier_arc(double x, double y, - double rx, double ry, - double start_angle, - double sweep_angle) - { - init(x, y, rx, ry, start_angle, sweep_angle); - } + init(x, y, rx, ry, start_angle, sweep_angle); + } - //-------------------------------------------------------------------- - void init(double x, double y, - double rx, double ry, - double start_angle, - double sweep_angle); + //-------------------------------------------------------------------- + void init(double x, double y, double rx, double ry, double start_angle, double sweep_angle); - //-------------------------------------------------------------------- - void rewind(unsigned) - { - m_vertex = 0; - } + //-------------------------------------------------------------------- + void rewind(unsigned) { m_vertex = 0; } - //-------------------------------------------------------------------- - unsigned vertex(double* x, double* y) - { - if(m_vertex >= m_num_vertices) return path_cmd_stop; - *x = m_vertices[m_vertex]; - *y = m_vertices[m_vertex + 1]; - m_vertex += 2; - return (m_vertex == 2) ? (unsigned)path_cmd_move_to : m_cmd; - } - - // Supplemantary functions. num_vertices() actually returns doubled - // number of vertices. That is, for 1 vertex it returns 2. - //-------------------------------------------------------------------- - unsigned num_vertices() const { return m_num_vertices; } - const double* vertices() const { return m_vertices; } - double* vertices() { return m_vertices; } - - private: - unsigned m_vertex; - unsigned m_num_vertices; - double m_vertices[26]; - unsigned m_cmd; - }; - - - - //==========================================================bezier_arc_svg - // Compute an SVG-style bezier arc. - // - // Computes an elliptical arc from (x1, y1) to (x2, y2). The size and - // orientation of the ellipse are defined by two radii (rx, ry) - // and an x-axis-rotation, which indicates how the ellipse as a whole - // is rotated relative to the current coordinate system. The center - // (cx, cy) of the ellipse is calculated automatically to satisfy the - // constraints imposed by the other parameters. - // large-arc-flag and sweep-flag contribute to the automatic calculations - // and help determine how the arc is drawn. - class bezier_arc_svg + //-------------------------------------------------------------------- + unsigned vertex(double* x, double* y) { - public: - //-------------------------------------------------------------------- - bezier_arc_svg() : m_arc(), m_radii_ok(false) {} + if (m_vertex >= m_num_vertices) + return path_cmd_stop; + *x = m_vertices[m_vertex]; + *y = m_vertices[m_vertex + 1]; + m_vertex += 2; + return (m_vertex == 2) ? (unsigned)path_cmd_move_to : m_cmd; + } - bezier_arc_svg(double x1, double y1, - double rx, double ry, - double angle, - bool large_arc_flag, - bool sweep_flag, - double x2, double y2) : - m_arc(), m_radii_ok(false) - { - init(x1, y1, rx, ry, angle, large_arc_flag, sweep_flag, x2, y2); - } + // Supplemantary functions. num_vertices() actually returns doubled + // number of vertices. That is, for 1 vertex it returns 2. + //-------------------------------------------------------------------- + unsigned num_vertices() const { return m_num_vertices; } + const double* vertices() const { return m_vertices; } + double* vertices() { return m_vertices; } - //-------------------------------------------------------------------- - void init(double x1, double y1, - double rx, double ry, - double angle, - bool large_arc_flag, - bool sweep_flag, - double x2, double y2); + private: + unsigned m_vertex; + unsigned m_num_vertices; + double m_vertices[26]; + unsigned m_cmd; +}; - //-------------------------------------------------------------------- - bool radii_ok() const { return m_radii_ok; } +//==========================================================bezier_arc_svg +// Compute an SVG-style bezier arc. +// +// Computes an elliptical arc from (x1, y1) to (x2, y2). The size and +// orientation of the ellipse are defined by two radii (rx, ry) +// and an x-axis-rotation, which indicates how the ellipse as a whole +// is rotated relative to the current coordinate system. The center +// (cx, cy) of the ellipse is calculated automatically to satisfy the +// constraints imposed by the other parameters. +// large-arc-flag and sweep-flag contribute to the automatic calculations +// and help determine how the arc is drawn. +class bezier_arc_svg +{ + public: + //-------------------------------------------------------------------- + bezier_arc_svg() + : m_arc() + , m_radii_ok(false) + {} - //-------------------------------------------------------------------- - void rewind(unsigned) - { - m_arc.rewind(0); - } + bezier_arc_svg(double x1, + double y1, + double rx, + double ry, + double angle, + bool large_arc_flag, + bool sweep_flag, + double x2, + double y2) + : m_arc() + , m_radii_ok(false) + { + init(x1, y1, rx, ry, angle, large_arc_flag, sweep_flag, x2, y2); + } - //-------------------------------------------------------------------- - unsigned vertex(double* x, double* y) - { - return m_arc.vertex(x, y); - } + //-------------------------------------------------------------------- + void init(double x1, + double y1, + double rx, + double ry, + double angle, + bool large_arc_flag, + bool sweep_flag, + double x2, + double y2); - // Supplemantary functions. num_vertices() actually returns doubled - // number of vertices. That is, for 1 vertex it returns 2. - //-------------------------------------------------------------------- - unsigned num_vertices() const { return m_arc.num_vertices(); } - const double* vertices() const { return m_arc.vertices(); } - double* vertices() { return m_arc.vertices(); } + //-------------------------------------------------------------------- + bool radii_ok() const { return m_radii_ok; } - private: - bezier_arc m_arc; - bool m_radii_ok; - }; + //-------------------------------------------------------------------- + void rewind(unsigned) { m_arc.rewind(0); } + //-------------------------------------------------------------------- + unsigned vertex(double* x, double* y) { return m_arc.vertex(x, y); } + // Supplemantary functions. num_vertices() actually returns doubled + // number of vertices. That is, for 1 vertex it returns 2. + //-------------------------------------------------------------------- + unsigned num_vertices() const { return m_arc.num_vertices(); } + const double* vertices() const { return m_arc.vertices(); } + double* vertices() { return m_arc.vertices(); } + private: + bezier_arc m_arc; + bool m_radii_ok; +}; -} - +} // namespace agg #endif diff --git a/deps/agg/include/agg_bitset_iterator.h b/deps/agg/include/agg_bitset_iterator.h index 7382d5c33..c6dbcd72a 100644 --- a/deps/agg/include/agg_bitset_iterator.h +++ b/deps/agg/include/agg_bitset_iterator.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -18,37 +18,33 @@ #include "agg_basics.h" -namespace agg +namespace agg { + +class bitset_iterator { - - class bitset_iterator + public: + bitset_iterator(const int8u* bits, unsigned offset = 0) + : m_bits(bits + (offset >> 3)) + , m_mask(0x80 >> (offset & 7)) + {} + + void operator++() { - public: - bitset_iterator(const int8u* bits, unsigned offset = 0) : - m_bits(bits + (offset >> 3)), - m_mask(0x80 >> (offset & 7)) - {} - - void operator ++ () + m_mask >>= 1; + if (m_mask == 0) { - m_mask >>= 1; - if(m_mask == 0) - { - ++m_bits; - m_mask = 0x80; - } + ++m_bits; + m_mask = 0x80; } + } - unsigned bit() const - { - return (*m_bits) & m_mask; - } + unsigned bit() const { return (*m_bits) & m_mask; } - private: - const int8u* m_bits; - int8u m_mask; - }; + private: + const int8u* m_bits; + int8u m_mask; +}; -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_blur.h b/deps/agg/include/agg_blur.h index 0860f52e1..7263c47da 100644 --- a/deps/agg/include/agg_blur.h +++ b/deps/agg/include/agg_blur.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -13,14 +13,14 @@ // http://www.antigrain.com //---------------------------------------------------------------------------- // -// The Stack Blur Algorithm was invented by Mario Klingemann, +// The Stack Blur Algorithm was invented by Mario Klingemann, // mario@quasimondo.com and described here: // http://incubator.quasimondo.com/processing/fast_blur_deluxe.php -// (search phrase "Stackblur: Fast But Goodlooking"). +// (search phrase "Stackblur: Fast But Goodlooking"). // The major improvement is that there's no more division table -// that was very expensive to create for large blur radii. Insted, -// for 8-bit per channel and radius not exceeding 254 the division is -// replaced by multiplication and shift. +// that was very expensive to create for large blur radii. Insted, +// for 8-bit per channel and radius not exceeding 254 the division is +// replaced by multiplication and shift. // //---------------------------------------------------------------------------- @@ -30,1265 +30,1232 @@ #include "agg_array.h" #include "agg_pixfmt_transposer.h" -namespace agg +namespace agg { + +template +struct stack_blur_tables { + static int16u const g_stack_blur8_mul[255]; + static int8u const g_stack_blur8_shr[255]; +}; - template struct stack_blur_tables +//------------------------------------------------------------------------ +template +int16u const stack_blur_tables::g_stack_blur8_mul[255] = { + 512, 512, 456, 512, 328, 456, 335, 512, 405, 328, 271, 456, 388, 335, 292, 512, 454, 405, 364, 328, 298, 271, + 496, 456, 420, 388, 360, 335, 312, 292, 273, 512, 482, 454, 428, 405, 383, 364, 345, 328, 312, 298, 284, 271, + 259, 496, 475, 456, 437, 420, 404, 388, 374, 360, 347, 335, 323, 312, 302, 292, 282, 273, 265, 512, 497, 482, + 468, 454, 441, 428, 417, 405, 394, 383, 373, 364, 354, 345, 337, 328, 320, 312, 305, 298, 291, 284, 278, 271, + 265, 259, 507, 496, 485, 475, 465, 456, 446, 437, 428, 420, 412, 404, 396, 388, 381, 374, 367, 360, 354, 347, + 341, 335, 329, 323, 318, 312, 307, 302, 297, 292, 287, 282, 278, 273, 269, 265, 261, 512, 505, 497, 489, 482, + 475, 468, 461, 454, 447, 441, 435, 428, 422, 417, 411, 405, 399, 394, 389, 383, 378, 373, 368, 364, 359, 354, + 350, 345, 341, 337, 332, 328, 324, 320, 316, 312, 309, 305, 301, 298, 294, 291, 287, 284, 281, 278, 274, 271, + 268, 265, 262, 259, 257, 507, 501, 496, 491, 485, 480, 475, 470, 465, 460, 456, 451, 446, 442, 437, 433, 428, + 424, 420, 416, 412, 408, 404, 400, 396, 392, 388, 385, 381, 377, 374, 370, 367, 363, 360, 357, 354, 350, 347, + 344, 341, 338, 335, 332, 329, 326, 323, 320, 318, 315, 312, 310, 307, 304, 302, 299, 297, 294, 292, 289, 287, + 285, 282, 280, 278, 275, 273, 271, 269, 267, 265, 263, 261, 259}; + +//------------------------------------------------------------------------ +template +int8u const stack_blur_tables::g_stack_blur8_shr[255] = { + 9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24}; + +//==============================================================stack_blur +template +class stack_blur +{ + public: + typedef ColorT color_type; + typedef CalculatorT calculator_type; + + //-------------------------------------------------------------------- + template + void blur_x(Img& img, unsigned radius) { - static int16u const g_stack_blur8_mul[255]; - static int8u const g_stack_blur8_shr[255]; - }; + if (radius < 1) + return; - //------------------------------------------------------------------------ - template - int16u const stack_blur_tables::g_stack_blur8_mul[255] = - { - 512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512, - 454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512, - 482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456, - 437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512, - 497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328, - 320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456, - 446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335, - 329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512, - 505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405, - 399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328, - 324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271, - 268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456, - 451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388, - 385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335, - 332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292, - 289,287,285,282,280,278,275,273,271,269,267,265,263,261,259 - }; - - //------------------------------------------------------------------------ - template - int8u const stack_blur_tables::g_stack_blur8_shr[255] = - { - 9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, - 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, - 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24 - }; - - - - //==============================================================stack_blur - template class stack_blur - { - public: - typedef ColorT color_type; - typedef CalculatorT calculator_type; - - //-------------------------------------------------------------------- - template void blur_x(Img& img, unsigned radius) - { - if(radius < 1) return; - - unsigned x, y, xp, i; - unsigned stack_ptr; - unsigned stack_start; - - color_type pix; - color_type* stack_pix; - calculator_type sum; - calculator_type sum_in; - calculator_type sum_out; - - unsigned w = img.width(); - unsigned h = img.height(); - unsigned wm = w - 1; - unsigned div = radius * 2 + 1; - - unsigned div_sum = (radius + 1) * (radius + 1); - unsigned mul_sum = 0; - unsigned shr_sum = 0; - unsigned max_val = color_type::base_mask; - - if(max_val <= 255 && radius < 255) - { - mul_sum = stack_blur_tables::g_stack_blur8_mul[radius]; - shr_sum = stack_blur_tables::g_stack_blur8_shr[radius]; - } - - m_buf.allocate(w, 128); - m_stack.allocate(div, 32); - - for(y = 0; y < h; y++) - { - sum.clear(); - sum_in.clear(); - sum_out.clear(); - - pix = img.pixel(0, y); - for(i = 0; i <= radius; i++) - { - m_stack[i] = pix; - sum.add(pix, i + 1); - sum_out.add(pix); - } - for(i = 1; i <= radius; i++) - { - pix = img.pixel((i > wm) ? wm : i, y); - m_stack[i + radius] = pix; - sum.add(pix, radius + 1 - i); - sum_in.add(pix); - } - - stack_ptr = radius; - for(x = 0; x < w; x++) - { - if(mul_sum) sum.calc_pix(m_buf[x], mul_sum, shr_sum); - else sum.calc_pix(m_buf[x], div_sum); - - sum.sub(sum_out); - - stack_start = stack_ptr + div - radius; - if(stack_start >= div) stack_start -= div; - stack_pix = &m_stack[stack_start]; - - sum_out.sub(*stack_pix); - - xp = x + radius + 1; - if(xp > wm) xp = wm; - pix = img.pixel(xp, y); - - *stack_pix = pix; - - sum_in.add(pix); - sum.add(sum_in); - - ++stack_ptr; - if(stack_ptr >= div) stack_ptr = 0; - stack_pix = &m_stack[stack_ptr]; - - sum_out.add(*stack_pix); - sum_in.sub(*stack_pix); - } - img.copy_color_hspan(0, y, w, &m_buf[0]); - } - } - - //-------------------------------------------------------------------- - template void blur_y(Img& img, unsigned radius) - { - pixfmt_transposer img2(img); - blur_x(img2, radius); - } - - //-------------------------------------------------------------------- - template void blur(Img& img, unsigned radius) - { - blur_x(img, radius); - pixfmt_transposer img2(img); - blur_x(img2, radius); - } - - private: - pod_vector m_buf; - pod_vector m_stack; - }; - - //====================================================stack_blur_calc_rgba - template struct stack_blur_calc_rgba - { - typedef T value_type; - value_type r,g,b,a; - - AGG_INLINE void clear() - { - r = g = b = a = 0; - } - - template AGG_INLINE void add(const ArgT& v) - { - r += v.r; - g += v.g; - b += v.b; - a += v.a; - } - - template AGG_INLINE void add(const ArgT& v, unsigned k) - { - r += v.r * k; - g += v.g * k; - b += v.b * k; - a += v.a * k; - } - - template AGG_INLINE void sub(const ArgT& v) - { - r -= v.r; - g -= v.g; - b -= v.b; - a -= v.a; - } - - template AGG_INLINE void calc_pix(ArgT& v, unsigned div) - { - typedef typename ArgT::value_type value_type; - v.r = value_type(r / div); - v.g = value_type(g / div); - v.b = value_type(b / div); - v.a = value_type(a / div); - } - - template - AGG_INLINE void calc_pix(ArgT& v, unsigned mul, unsigned shr) - { - typedef typename ArgT::value_type value_type; - v.r = value_type((r * mul) >> shr); - v.g = value_type((g * mul) >> shr); - v.b = value_type((b * mul) >> shr); - v.a = value_type((a * mul) >> shr); - } - }; - - - //=====================================================stack_blur_calc_rgb - template struct stack_blur_calc_rgb - { - typedef T value_type; - value_type r,g,b; - - AGG_INLINE void clear() - { - r = g = b = 0; - } - - template AGG_INLINE void add(const ArgT& v) - { - r += v.r; - g += v.g; - b += v.b; - } - - template AGG_INLINE void add(const ArgT& v, unsigned k) - { - r += v.r * k; - g += v.g * k; - b += v.b * k; - } - - template AGG_INLINE void sub(const ArgT& v) - { - r -= v.r; - g -= v.g; - b -= v.b; - } - - template AGG_INLINE void calc_pix(ArgT& v, unsigned div) - { - typedef typename ArgT::value_type value_type; - v.r = value_type(r / div); - v.g = value_type(g / div); - v.b = value_type(b / div); - } - - template - AGG_INLINE void calc_pix(ArgT& v, unsigned mul, unsigned shr) - { - typedef typename ArgT::value_type value_type; - v.r = value_type((r * mul) >> shr); - v.g = value_type((g * mul) >> shr); - v.b = value_type((b * mul) >> shr); - } - }; - - - //====================================================stack_blur_calc_gray - template struct stack_blur_calc_gray - { - typedef T value_type; - value_type v; - - AGG_INLINE void clear() - { - v = 0; - } - - template AGG_INLINE void add(const ArgT& a) - { - v += a.v; - } - - template AGG_INLINE void add(const ArgT& a, unsigned k) - { - v += a.v * k; - } - - template AGG_INLINE void sub(const ArgT& a) - { - v -= a.v; - } - - template AGG_INLINE void calc_pix(ArgT& a, unsigned div) - { - typedef typename ArgT::value_type value_type; - a.v = value_type(v / div); - } - - template - AGG_INLINE void calc_pix(ArgT& a, unsigned mul, unsigned shr) - { - typedef typename ArgT::value_type value_type; - a.v = value_type((v * mul) >> shr); - } - }; - - - - //========================================================stack_blur_gray8 - template - void stack_blur_gray8(Img& img, unsigned rx, unsigned ry) - { - unsigned x, y, xp, yp, i; + unsigned x, y, xp, i; unsigned stack_ptr; unsigned stack_start; - const int8u* src_pix_ptr; - int8u* dst_pix_ptr; - unsigned pix; - unsigned stack_pix; - unsigned sum; - unsigned sum_in; - unsigned sum_out; + color_type pix; + color_type* stack_pix; + calculator_type sum; + calculator_type sum_in; + calculator_type sum_out; - unsigned w = img.width(); - unsigned h = img.height(); - unsigned wm = w - 1; - unsigned hm = h - 1; + unsigned w = img.width(); + unsigned h = img.height(); + unsigned wm = w - 1; + unsigned div = radius * 2 + 1; - unsigned div; - unsigned mul_sum; - unsigned shr_sum; + unsigned div_sum = (radius + 1) * (radius + 1); + unsigned mul_sum = 0; + unsigned shr_sum = 0; + unsigned max_val = color_type::base_mask; - pod_vector stack; - - if(rx > 0) + if (max_val <= 255 && radius < 255) { - if(rx > 254) rx = 254; - div = rx * 2 + 1; - mul_sum = stack_blur_tables::g_stack_blur8_mul[rx]; - shr_sum = stack_blur_tables::g_stack_blur8_shr[rx]; - stack.allocate(div); + mul_sum = stack_blur_tables::g_stack_blur8_mul[radius]; + shr_sum = stack_blur_tables::g_stack_blur8_shr[radius]; + } - for(y = 0; y < h; y++) + m_buf.allocate(w, 128); + m_stack.allocate(div, 32); + + for (y = 0; y < h; y++) + { + sum.clear(); + sum_in.clear(); + sum_out.clear(); + + pix = img.pixel(0, y); + for (i = 0; i <= radius; i++) { - sum = sum_in = sum_out = 0; + m_stack[i] = pix; + sum.add(pix, i + 1); + sum_out.add(pix); + } + for (i = 1; i <= radius; i++) + { + pix = img.pixel((i > wm) ? wm : i, y); + m_stack[i + radius] = pix; + sum.add(pix, radius + 1 - i); + sum_in.add(pix); + } - src_pix_ptr = img.pix_ptr(0, y); + stack_ptr = radius; + for (x = 0; x < w; x++) + { + if (mul_sum) + sum.calc_pix(m_buf[x], mul_sum, shr_sum); + else + sum.calc_pix(m_buf[x], div_sum); + + sum.sub(sum_out); + + stack_start = stack_ptr + div - radius; + if (stack_start >= div) + stack_start -= div; + stack_pix = &m_stack[stack_start]; + + sum_out.sub(*stack_pix); + + xp = x + radius + 1; + if (xp > wm) + xp = wm; + pix = img.pixel(xp, y); + + *stack_pix = pix; + + sum_in.add(pix); + sum.add(sum_in); + + ++stack_ptr; + if (stack_ptr >= div) + stack_ptr = 0; + stack_pix = &m_stack[stack_ptr]; + + sum_out.add(*stack_pix); + sum_in.sub(*stack_pix); + } + img.copy_color_hspan(0, y, w, &m_buf[0]); + } + } + + //-------------------------------------------------------------------- + template + void blur_y(Img& img, unsigned radius) + { + pixfmt_transposer img2(img); + blur_x(img2, radius); + } + + //-------------------------------------------------------------------- + template + void blur(Img& img, unsigned radius) + { + blur_x(img, radius); + pixfmt_transposer img2(img); + blur_x(img2, radius); + } + + private: + pod_vector m_buf; + pod_vector m_stack; +}; + +//====================================================stack_blur_calc_rgba +template +struct stack_blur_calc_rgba +{ + typedef T value_type; + value_type r, g, b, a; + + AGG_INLINE void clear() { r = g = b = a = 0; } + + template + AGG_INLINE void add(const ArgT& v) + { + r += v.r; + g += v.g; + b += v.b; + a += v.a; + } + + template + AGG_INLINE void add(const ArgT& v, unsigned k) + { + r += v.r * k; + g += v.g * k; + b += v.b * k; + a += v.a * k; + } + + template + AGG_INLINE void sub(const ArgT& v) + { + r -= v.r; + g -= v.g; + b -= v.b; + a -= v.a; + } + + template + AGG_INLINE void calc_pix(ArgT& v, unsigned div) + { + typedef typename ArgT::value_type value_type; + v.r = value_type(r / div); + v.g = value_type(g / div); + v.b = value_type(b / div); + v.a = value_type(a / div); + } + + template + AGG_INLINE void calc_pix(ArgT& v, unsigned mul, unsigned shr) + { + typedef typename ArgT::value_type value_type; + v.r = value_type((r * mul) >> shr); + v.g = value_type((g * mul) >> shr); + v.b = value_type((b * mul) >> shr); + v.a = value_type((a * mul) >> shr); + } +}; + +//=====================================================stack_blur_calc_rgb +template +struct stack_blur_calc_rgb +{ + typedef T value_type; + value_type r, g, b; + + AGG_INLINE void clear() { r = g = b = 0; } + + template + AGG_INLINE void add(const ArgT& v) + { + r += v.r; + g += v.g; + b += v.b; + } + + template + AGG_INLINE void add(const ArgT& v, unsigned k) + { + r += v.r * k; + g += v.g * k; + b += v.b * k; + } + + template + AGG_INLINE void sub(const ArgT& v) + { + r -= v.r; + g -= v.g; + b -= v.b; + } + + template + AGG_INLINE void calc_pix(ArgT& v, unsigned div) + { + typedef typename ArgT::value_type value_type; + v.r = value_type(r / div); + v.g = value_type(g / div); + v.b = value_type(b / div); + } + + template + AGG_INLINE void calc_pix(ArgT& v, unsigned mul, unsigned shr) + { + typedef typename ArgT::value_type value_type; + v.r = value_type((r * mul) >> shr); + v.g = value_type((g * mul) >> shr); + v.b = value_type((b * mul) >> shr); + } +}; + +//====================================================stack_blur_calc_gray +template +struct stack_blur_calc_gray +{ + typedef T value_type; + value_type v; + + AGG_INLINE void clear() { v = 0; } + + template + AGG_INLINE void add(const ArgT& a) + { + v += a.v; + } + + template + AGG_INLINE void add(const ArgT& a, unsigned k) + { + v += a.v * k; + } + + template + AGG_INLINE void sub(const ArgT& a) + { + v -= a.v; + } + + template + AGG_INLINE void calc_pix(ArgT& a, unsigned div) + { + typedef typename ArgT::value_type value_type; + a.v = value_type(v / div); + } + + template + AGG_INLINE void calc_pix(ArgT& a, unsigned mul, unsigned shr) + { + typedef typename ArgT::value_type value_type; + a.v = value_type((v * mul) >> shr); + } +}; + +//========================================================stack_blur_gray8 +template +void stack_blur_gray8(Img& img, unsigned rx, unsigned ry) +{ + unsigned x, y, xp, yp, i; + unsigned stack_ptr; + unsigned stack_start; + + const int8u* src_pix_ptr; + int8u* dst_pix_ptr; + unsigned pix; + unsigned stack_pix; + unsigned sum; + unsigned sum_in; + unsigned sum_out; + + unsigned w = img.width(); + unsigned h = img.height(); + unsigned wm = w - 1; + unsigned hm = h - 1; + + unsigned div; + unsigned mul_sum; + unsigned shr_sum; + + pod_vector stack; + + if (rx > 0) + { + if (rx > 254) + rx = 254; + div = rx * 2 + 1; + mul_sum = stack_blur_tables::g_stack_blur8_mul[rx]; + shr_sum = stack_blur_tables::g_stack_blur8_shr[rx]; + stack.allocate(div); + + for (y = 0; y < h; y++) + { + sum = sum_in = sum_out = 0; + + src_pix_ptr = img.pix_ptr(0, y); + pix = *src_pix_ptr; + for (i = 0; i <= rx; i++) + { + stack[i] = pix; + sum += pix * (i + 1); + sum_out += pix; + } + for (i = 1; i <= rx; i++) + { + if (i <= wm) + src_pix_ptr += Img::pix_step; pix = *src_pix_ptr; - for(i = 0; i <= rx; i++) + stack[i + rx] = pix; + sum += pix * (rx + 1 - i); + sum_in += pix; + } + + stack_ptr = rx; + xp = rx; + if (xp > wm) + xp = wm; + src_pix_ptr = img.pix_ptr(xp, y); + dst_pix_ptr = img.pix_ptr(0, y); + for (x = 0; x < w; x++) + { + *dst_pix_ptr = (sum * mul_sum) >> shr_sum; + dst_pix_ptr += Img::pix_step; + + sum -= sum_out; + + stack_start = stack_ptr + div - rx; + if (stack_start >= div) + stack_start -= div; + sum_out -= stack[stack_start]; + + if (xp < wm) { - stack[i] = pix; - sum += pix * (i + 1); - sum_out += pix; - } - for(i = 1; i <= rx; i++) - { - if(i <= wm) src_pix_ptr += Img::pix_step; - pix = *src_pix_ptr; - stack[i + rx] = pix; - sum += pix * (rx + 1 - i); - sum_in += pix; + src_pix_ptr += Img::pix_step; + pix = *src_pix_ptr; + ++xp; } - stack_ptr = rx; - xp = rx; - if(xp > wm) xp = wm; - src_pix_ptr = img.pix_ptr(xp, y); - dst_pix_ptr = img.pix_ptr(0, y); - for(x = 0; x < w; x++) - { - *dst_pix_ptr = (sum * mul_sum) >> shr_sum; - dst_pix_ptr += Img::pix_step; + stack[stack_start] = pix; - sum -= sum_out; - - stack_start = stack_ptr + div - rx; - if(stack_start >= div) stack_start -= div; - sum_out -= stack[stack_start]; + sum_in += pix; + sum += sum_in; - if(xp < wm) - { - src_pix_ptr += Img::pix_step; - pix = *src_pix_ptr; - ++xp; - } - - stack[stack_start] = pix; - - sum_in += pix; - sum += sum_in; - - ++stack_ptr; - if(stack_ptr >= div) stack_ptr = 0; - stack_pix = stack[stack_ptr]; + ++stack_ptr; + if (stack_ptr >= div) + stack_ptr = 0; + stack_pix = stack[stack_ptr]; - sum_out += stack_pix; - sum_in -= stack_pix; - } + sum_out += stack_pix; + sum_in -= stack_pix; } } + } - if(ry > 0) + if (ry > 0) + { + if (ry > 254) + ry = 254; + div = ry * 2 + 1; + mul_sum = stack_blur_tables::g_stack_blur8_mul[ry]; + shr_sum = stack_blur_tables::g_stack_blur8_shr[ry]; + stack.allocate(div); + + int stride = img.stride(); + for (x = 0; x < w; x++) { - if(ry > 254) ry = 254; - div = ry * 2 + 1; - mul_sum = stack_blur_tables::g_stack_blur8_mul[ry]; - shr_sum = stack_blur_tables::g_stack_blur8_shr[ry]; - stack.allocate(div); + sum = sum_in = sum_out = 0; - int stride = img.stride(); - for(x = 0; x < w; x++) + src_pix_ptr = img.pix_ptr(x, 0); + pix = *src_pix_ptr; + for (i = 0; i <= ry; i++) { - sum = sum_in = sum_out = 0; - - src_pix_ptr = img.pix_ptr(x, 0); + stack[i] = pix; + sum += pix * (i + 1); + sum_out += pix; + } + for (i = 1; i <= ry; i++) + { + if (i <= hm) + src_pix_ptr += stride; pix = *src_pix_ptr; - for(i = 0; i <= ry; i++) + stack[i + ry] = pix; + sum += pix * (ry + 1 - i); + sum_in += pix; + } + + stack_ptr = ry; + yp = ry; + if (yp > hm) + yp = hm; + src_pix_ptr = img.pix_ptr(x, yp); + dst_pix_ptr = img.pix_ptr(x, 0); + for (y = 0; y < h; y++) + { + *dst_pix_ptr = (sum * mul_sum) >> shr_sum; + dst_pix_ptr += stride; + + sum -= sum_out; + + stack_start = stack_ptr + div - ry; + if (stack_start >= div) + stack_start -= div; + sum_out -= stack[stack_start]; + + if (yp < hm) { - stack[i] = pix; - sum += pix * (i + 1); - sum_out += pix; - } - for(i = 1; i <= ry; i++) - { - if(i <= hm) src_pix_ptr += stride; - pix = *src_pix_ptr; - stack[i + ry] = pix; - sum += pix * (ry + 1 - i); - sum_in += pix; + src_pix_ptr += stride; + pix = *src_pix_ptr; + ++yp; } - stack_ptr = ry; - yp = ry; - if(yp > hm) yp = hm; - src_pix_ptr = img.pix_ptr(x, yp); - dst_pix_ptr = img.pix_ptr(x, 0); - for(y = 0; y < h; y++) - { - *dst_pix_ptr = (sum * mul_sum) >> shr_sum; - dst_pix_ptr += stride; + stack[stack_start] = pix; - sum -= sum_out; - - stack_start = stack_ptr + div - ry; - if(stack_start >= div) stack_start -= div; - sum_out -= stack[stack_start]; + sum_in += pix; + sum += sum_in; - if(yp < hm) - { - src_pix_ptr += stride; - pix = *src_pix_ptr; - ++yp; - } - - stack[stack_start] = pix; - - sum_in += pix; - sum += sum_in; - - ++stack_ptr; - if(stack_ptr >= div) stack_ptr = 0; - stack_pix = stack[stack_ptr]; + ++stack_ptr; + if (stack_ptr >= div) + stack_ptr = 0; + stack_pix = stack[stack_ptr]; - sum_out += stack_pix; - sum_in -= stack_pix; - } + sum_out += stack_pix; + sum_in -= stack_pix; } } } - - - - //========================================================stack_blur_rgb24 - template - void stack_blur_rgb24(Img& img, unsigned rx, unsigned ry) - { - typedef typename Img::color_type color_type; - typedef typename Img::order_type order_type; - enum order_e - { - R = order_type::R, - G = order_type::G, - B = order_type::B - }; - - unsigned x, y, xp, yp, i; - unsigned stack_ptr; - unsigned stack_start; - - const int8u* src_pix_ptr; - int8u* dst_pix_ptr; - color_type* stack_pix_ptr; - - unsigned sum_r; - unsigned sum_g; - unsigned sum_b; - unsigned sum_in_r; - unsigned sum_in_g; - unsigned sum_in_b; - unsigned sum_out_r; - unsigned sum_out_g; - unsigned sum_out_b; - - unsigned w = img.width(); - unsigned h = img.height(); - unsigned wm = w - 1; - unsigned hm = h - 1; - - unsigned div; - unsigned mul_sum; - unsigned shr_sum; - - pod_vector stack; - - if(rx > 0) - { - if(rx > 254) rx = 254; - div = rx * 2 + 1; - mul_sum = stack_blur_tables::g_stack_blur8_mul[rx]; - shr_sum = stack_blur_tables::g_stack_blur8_shr[rx]; - stack.allocate(div); - - for(y = 0; y < h; y++) - { - sum_r = - sum_g = - sum_b = - sum_in_r = - sum_in_g = - sum_in_b = - sum_out_r = - sum_out_g = - sum_out_b = 0; - - src_pix_ptr = img.pix_ptr(0, y); - for(i = 0; i <= rx; i++) - { - stack_pix_ptr = &stack[i]; - stack_pix_ptr->r = src_pix_ptr[R]; - stack_pix_ptr->g = src_pix_ptr[G]; - stack_pix_ptr->b = src_pix_ptr[B]; - sum_r += src_pix_ptr[R] * (i + 1); - sum_g += src_pix_ptr[G] * (i + 1); - sum_b += src_pix_ptr[B] * (i + 1); - sum_out_r += src_pix_ptr[R]; - sum_out_g += src_pix_ptr[G]; - sum_out_b += src_pix_ptr[B]; - } - for(i = 1; i <= rx; i++) - { - if(i <= wm) src_pix_ptr += Img::pix_width; - stack_pix_ptr = &stack[i + rx]; - stack_pix_ptr->r = src_pix_ptr[R]; - stack_pix_ptr->g = src_pix_ptr[G]; - stack_pix_ptr->b = src_pix_ptr[B]; - sum_r += src_pix_ptr[R] * (rx + 1 - i); - sum_g += src_pix_ptr[G] * (rx + 1 - i); - sum_b += src_pix_ptr[B] * (rx + 1 - i); - sum_in_r += src_pix_ptr[R]; - sum_in_g += src_pix_ptr[G]; - sum_in_b += src_pix_ptr[B]; - } - - stack_ptr = rx; - xp = rx; - if(xp > wm) xp = wm; - src_pix_ptr = img.pix_ptr(xp, y); - dst_pix_ptr = img.pix_ptr(0, y); - for(x = 0; x < w; x++) - { - dst_pix_ptr[R] = (sum_r * mul_sum) >> shr_sum; - dst_pix_ptr[G] = (sum_g * mul_sum) >> shr_sum; - dst_pix_ptr[B] = (sum_b * mul_sum) >> shr_sum; - dst_pix_ptr += Img::pix_width; - - sum_r -= sum_out_r; - sum_g -= sum_out_g; - sum_b -= sum_out_b; - - stack_start = stack_ptr + div - rx; - if(stack_start >= div) stack_start -= div; - stack_pix_ptr = &stack[stack_start]; - - sum_out_r -= stack_pix_ptr->r; - sum_out_g -= stack_pix_ptr->g; - sum_out_b -= stack_pix_ptr->b; - - if(xp < wm) - { - src_pix_ptr += Img::pix_width; - ++xp; - } - - stack_pix_ptr->r = src_pix_ptr[R]; - stack_pix_ptr->g = src_pix_ptr[G]; - stack_pix_ptr->b = src_pix_ptr[B]; - - sum_in_r += src_pix_ptr[R]; - sum_in_g += src_pix_ptr[G]; - sum_in_b += src_pix_ptr[B]; - sum_r += sum_in_r; - sum_g += sum_in_g; - sum_b += sum_in_b; - - ++stack_ptr; - if(stack_ptr >= div) stack_ptr = 0; - stack_pix_ptr = &stack[stack_ptr]; - - sum_out_r += stack_pix_ptr->r; - sum_out_g += stack_pix_ptr->g; - sum_out_b += stack_pix_ptr->b; - sum_in_r -= stack_pix_ptr->r; - sum_in_g -= stack_pix_ptr->g; - sum_in_b -= stack_pix_ptr->b; - } - } - } - - if(ry > 0) - { - if(ry > 254) ry = 254; - div = ry * 2 + 1; - mul_sum = stack_blur_tables::g_stack_blur8_mul[ry]; - shr_sum = stack_blur_tables::g_stack_blur8_shr[ry]; - stack.allocate(div); - - int stride = img.stride(); - for(x = 0; x < w; x++) - { - sum_r = - sum_g = - sum_b = - sum_in_r = - sum_in_g = - sum_in_b = - sum_out_r = - sum_out_g = - sum_out_b = 0; - - src_pix_ptr = img.pix_ptr(x, 0); - for(i = 0; i <= ry; i++) - { - stack_pix_ptr = &stack[i]; - stack_pix_ptr->r = src_pix_ptr[R]; - stack_pix_ptr->g = src_pix_ptr[G]; - stack_pix_ptr->b = src_pix_ptr[B]; - sum_r += src_pix_ptr[R] * (i + 1); - sum_g += src_pix_ptr[G] * (i + 1); - sum_b += src_pix_ptr[B] * (i + 1); - sum_out_r += src_pix_ptr[R]; - sum_out_g += src_pix_ptr[G]; - sum_out_b += src_pix_ptr[B]; - } - for(i = 1; i <= ry; i++) - { - if(i <= hm) src_pix_ptr += stride; - stack_pix_ptr = &stack[i + ry]; - stack_pix_ptr->r = src_pix_ptr[R]; - stack_pix_ptr->g = src_pix_ptr[G]; - stack_pix_ptr->b = src_pix_ptr[B]; - sum_r += src_pix_ptr[R] * (ry + 1 - i); - sum_g += src_pix_ptr[G] * (ry + 1 - i); - sum_b += src_pix_ptr[B] * (ry + 1 - i); - sum_in_r += src_pix_ptr[R]; - sum_in_g += src_pix_ptr[G]; - sum_in_b += src_pix_ptr[B]; - } - - stack_ptr = ry; - yp = ry; - if(yp > hm) yp = hm; - src_pix_ptr = img.pix_ptr(x, yp); - dst_pix_ptr = img.pix_ptr(x, 0); - for(y = 0; y < h; y++) - { - dst_pix_ptr[R] = (sum_r * mul_sum) >> shr_sum; - dst_pix_ptr[G] = (sum_g * mul_sum) >> shr_sum; - dst_pix_ptr[B] = (sum_b * mul_sum) >> shr_sum; - dst_pix_ptr += stride; - - sum_r -= sum_out_r; - sum_g -= sum_out_g; - sum_b -= sum_out_b; - - stack_start = stack_ptr + div - ry; - if(stack_start >= div) stack_start -= div; - - stack_pix_ptr = &stack[stack_start]; - sum_out_r -= stack_pix_ptr->r; - sum_out_g -= stack_pix_ptr->g; - sum_out_b -= stack_pix_ptr->b; - - if(yp < hm) - { - src_pix_ptr += stride; - ++yp; - } - - stack_pix_ptr->r = src_pix_ptr[R]; - stack_pix_ptr->g = src_pix_ptr[G]; - stack_pix_ptr->b = src_pix_ptr[B]; - - sum_in_r += src_pix_ptr[R]; - sum_in_g += src_pix_ptr[G]; - sum_in_b += src_pix_ptr[B]; - sum_r += sum_in_r; - sum_g += sum_in_g; - sum_b += sum_in_b; - - ++stack_ptr; - if(stack_ptr >= div) stack_ptr = 0; - stack_pix_ptr = &stack[stack_ptr]; - - sum_out_r += stack_pix_ptr->r; - sum_out_g += stack_pix_ptr->g; - sum_out_b += stack_pix_ptr->b; - sum_in_r -= stack_pix_ptr->r; - sum_in_g -= stack_pix_ptr->g; - sum_in_b -= stack_pix_ptr->b; - } - } - } - } - - - - //=======================================================stack_blur_rgba32 - template - void stack_blur_rgba32(Img& img, unsigned rx, unsigned ry) - { - typedef typename Img::color_type color_type; - typedef typename Img::order_type order_type; - enum order_e - { - R = order_type::R, - G = order_type::G, - B = order_type::B, - A = order_type::A - }; - - unsigned x, y, xp, yp, i; - unsigned stack_ptr; - unsigned stack_start; - - const int8u* src_pix_ptr; - int8u* dst_pix_ptr; - color_type* stack_pix_ptr; - - unsigned sum_r; - unsigned sum_g; - unsigned sum_b; - unsigned sum_a; - unsigned sum_in_r; - unsigned sum_in_g; - unsigned sum_in_b; - unsigned sum_in_a; - unsigned sum_out_r; - unsigned sum_out_g; - unsigned sum_out_b; - unsigned sum_out_a; - - unsigned w = img.width(); - unsigned h = img.height(); - unsigned wm = w - 1; - unsigned hm = h - 1; - - unsigned div; - unsigned mul_sum; - unsigned shr_sum; - - pod_vector stack; - - if(rx > 0) - { - if(rx > 254) rx = 254; - div = rx * 2 + 1; - mul_sum = stack_blur_tables::g_stack_blur8_mul[rx]; - shr_sum = stack_blur_tables::g_stack_blur8_shr[rx]; - stack.allocate(div); - - for(y = 0; y < h; y++) - { - sum_r = - sum_g = - sum_b = - sum_a = - sum_in_r = - sum_in_g = - sum_in_b = - sum_in_a = - sum_out_r = - sum_out_g = - sum_out_b = - sum_out_a = 0; - - src_pix_ptr = img.pix_ptr(0, y); - for(i = 0; i <= rx; i++) - { - stack_pix_ptr = &stack[i]; - stack_pix_ptr->r = src_pix_ptr[R]; - stack_pix_ptr->g = src_pix_ptr[G]; - stack_pix_ptr->b = src_pix_ptr[B]; - stack_pix_ptr->a = src_pix_ptr[A]; - sum_r += src_pix_ptr[R] * (i + 1); - sum_g += src_pix_ptr[G] * (i + 1); - sum_b += src_pix_ptr[B] * (i + 1); - sum_a += src_pix_ptr[A] * (i + 1); - sum_out_r += src_pix_ptr[R]; - sum_out_g += src_pix_ptr[G]; - sum_out_b += src_pix_ptr[B]; - sum_out_a += src_pix_ptr[A]; - } - for(i = 1; i <= rx; i++) - { - if(i <= wm) src_pix_ptr += Img::pix_width; - stack_pix_ptr = &stack[i + rx]; - stack_pix_ptr->r = src_pix_ptr[R]; - stack_pix_ptr->g = src_pix_ptr[G]; - stack_pix_ptr->b = src_pix_ptr[B]; - stack_pix_ptr->a = src_pix_ptr[A]; - sum_r += src_pix_ptr[R] * (rx + 1 - i); - sum_g += src_pix_ptr[G] * (rx + 1 - i); - sum_b += src_pix_ptr[B] * (rx + 1 - i); - sum_a += src_pix_ptr[A] * (rx + 1 - i); - sum_in_r += src_pix_ptr[R]; - sum_in_g += src_pix_ptr[G]; - sum_in_b += src_pix_ptr[B]; - sum_in_a += src_pix_ptr[A]; - } - - stack_ptr = rx; - xp = rx; - if(xp > wm) xp = wm; - src_pix_ptr = img.pix_ptr(xp, y); - dst_pix_ptr = img.pix_ptr(0, y); - for(x = 0; x < w; x++) - { - dst_pix_ptr[R] = (sum_r * mul_sum) >> shr_sum; - dst_pix_ptr[G] = (sum_g * mul_sum) >> shr_sum; - dst_pix_ptr[B] = (sum_b * mul_sum) >> shr_sum; - dst_pix_ptr[A] = (sum_a * mul_sum) >> shr_sum; - dst_pix_ptr += Img::pix_width; - - sum_r -= sum_out_r; - sum_g -= sum_out_g; - sum_b -= sum_out_b; - sum_a -= sum_out_a; - - stack_start = stack_ptr + div - rx; - if(stack_start >= div) stack_start -= div; - stack_pix_ptr = &stack[stack_start]; - - sum_out_r -= stack_pix_ptr->r; - sum_out_g -= stack_pix_ptr->g; - sum_out_b -= stack_pix_ptr->b; - sum_out_a -= stack_pix_ptr->a; - - if(xp < wm) - { - src_pix_ptr += Img::pix_width; - ++xp; - } - - stack_pix_ptr->r = src_pix_ptr[R]; - stack_pix_ptr->g = src_pix_ptr[G]; - stack_pix_ptr->b = src_pix_ptr[B]; - stack_pix_ptr->a = src_pix_ptr[A]; - - sum_in_r += src_pix_ptr[R]; - sum_in_g += src_pix_ptr[G]; - sum_in_b += src_pix_ptr[B]; - sum_in_a += src_pix_ptr[A]; - sum_r += sum_in_r; - sum_g += sum_in_g; - sum_b += sum_in_b; - sum_a += sum_in_a; - - ++stack_ptr; - if(stack_ptr >= div) stack_ptr = 0; - stack_pix_ptr = &stack[stack_ptr]; - - sum_out_r += stack_pix_ptr->r; - sum_out_g += stack_pix_ptr->g; - sum_out_b += stack_pix_ptr->b; - sum_out_a += stack_pix_ptr->a; - sum_in_r -= stack_pix_ptr->r; - sum_in_g -= stack_pix_ptr->g; - sum_in_b -= stack_pix_ptr->b; - sum_in_a -= stack_pix_ptr->a; - } - } - } - - if(ry > 0) - { - if(ry > 254) ry = 254; - div = ry * 2 + 1; - mul_sum = stack_blur_tables::g_stack_blur8_mul[ry]; - shr_sum = stack_blur_tables::g_stack_blur8_shr[ry]; - stack.allocate(div); - - int stride = img.stride(); - for(x = 0; x < w; x++) - { - sum_r = - sum_g = - sum_b = - sum_a = - sum_in_r = - sum_in_g = - sum_in_b = - sum_in_a = - sum_out_r = - sum_out_g = - sum_out_b = - sum_out_a = 0; - - src_pix_ptr = img.pix_ptr(x, 0); - for(i = 0; i <= ry; i++) - { - stack_pix_ptr = &stack[i]; - stack_pix_ptr->r = src_pix_ptr[R]; - stack_pix_ptr->g = src_pix_ptr[G]; - stack_pix_ptr->b = src_pix_ptr[B]; - stack_pix_ptr->a = src_pix_ptr[A]; - sum_r += src_pix_ptr[R] * (i + 1); - sum_g += src_pix_ptr[G] * (i + 1); - sum_b += src_pix_ptr[B] * (i + 1); - sum_a += src_pix_ptr[A] * (i + 1); - sum_out_r += src_pix_ptr[R]; - sum_out_g += src_pix_ptr[G]; - sum_out_b += src_pix_ptr[B]; - sum_out_a += src_pix_ptr[A]; - } - for(i = 1; i <= ry; i++) - { - if(i <= hm) src_pix_ptr += stride; - stack_pix_ptr = &stack[i + ry]; - stack_pix_ptr->r = src_pix_ptr[R]; - stack_pix_ptr->g = src_pix_ptr[G]; - stack_pix_ptr->b = src_pix_ptr[B]; - stack_pix_ptr->a = src_pix_ptr[A]; - sum_r += src_pix_ptr[R] * (ry + 1 - i); - sum_g += src_pix_ptr[G] * (ry + 1 - i); - sum_b += src_pix_ptr[B] * (ry + 1 - i); - sum_a += src_pix_ptr[A] * (ry + 1 - i); - sum_in_r += src_pix_ptr[R]; - sum_in_g += src_pix_ptr[G]; - sum_in_b += src_pix_ptr[B]; - sum_in_a += src_pix_ptr[A]; - } - - stack_ptr = ry; - yp = ry; - if(yp > hm) yp = hm; - src_pix_ptr = img.pix_ptr(x, yp); - dst_pix_ptr = img.pix_ptr(x, 0); - for(y = 0; y < h; y++) - { - dst_pix_ptr[R] = (sum_r * mul_sum) >> shr_sum; - dst_pix_ptr[G] = (sum_g * mul_sum) >> shr_sum; - dst_pix_ptr[B] = (sum_b * mul_sum) >> shr_sum; - dst_pix_ptr[A] = (sum_a * mul_sum) >> shr_sum; - dst_pix_ptr += stride; - - sum_r -= sum_out_r; - sum_g -= sum_out_g; - sum_b -= sum_out_b; - sum_a -= sum_out_a; - - stack_start = stack_ptr + div - ry; - if(stack_start >= div) stack_start -= div; - - stack_pix_ptr = &stack[stack_start]; - sum_out_r -= stack_pix_ptr->r; - sum_out_g -= stack_pix_ptr->g; - sum_out_b -= stack_pix_ptr->b; - sum_out_a -= stack_pix_ptr->a; - - if(yp < hm) - { - src_pix_ptr += stride; - ++yp; - } - - stack_pix_ptr->r = src_pix_ptr[R]; - stack_pix_ptr->g = src_pix_ptr[G]; - stack_pix_ptr->b = src_pix_ptr[B]; - stack_pix_ptr->a = src_pix_ptr[A]; - - sum_in_r += src_pix_ptr[R]; - sum_in_g += src_pix_ptr[G]; - sum_in_b += src_pix_ptr[B]; - sum_in_a += src_pix_ptr[A]; - sum_r += sum_in_r; - sum_g += sum_in_g; - sum_b += sum_in_b; - sum_a += sum_in_a; - - ++stack_ptr; - if(stack_ptr >= div) stack_ptr = 0; - stack_pix_ptr = &stack[stack_ptr]; - - sum_out_r += stack_pix_ptr->r; - sum_out_g += stack_pix_ptr->g; - sum_out_b += stack_pix_ptr->b; - sum_out_a += stack_pix_ptr->a; - sum_in_r -= stack_pix_ptr->r; - sum_in_g -= stack_pix_ptr->g; - sum_in_b -= stack_pix_ptr->b; - sum_in_a -= stack_pix_ptr->a; - } - } - } - } - - - - //===========================================================recursive_blur - template class recursive_blur - { - public: - typedef ColorT color_type; - typedef CalculatorT calculator_type; - typedef typename color_type::value_type value_type; - typedef typename calculator_type::value_type calc_type; - - //-------------------------------------------------------------------- - template void blur_x(Img& img, double radius) - { - if(radius < 0.62) return; - if(img.width() < 3) return; - - calc_type s = calc_type(radius * 0.5); - calc_type q = calc_type((s < 2.5) ? - 3.97156 - 4.14554 * sqrt(1 - 0.26891 * s) : - 0.98711 * s - 0.96330); - - calc_type q2 = calc_type(q * q); - calc_type q3 = calc_type(q2 * q); - - calc_type b0 = calc_type(1.0 / (1.578250 + - 2.444130 * q + - 1.428100 * q2 + - 0.422205 * q3)); - - calc_type b1 = calc_type( 2.44413 * q + - 2.85619 * q2 + - 1.26661 * q3); - - calc_type b2 = calc_type(-1.42810 * q2 + - -1.26661 * q3); - - calc_type b3 = calc_type(0.422205 * q3); - - calc_type b = calc_type(1 - (b1 + b2 + b3) * b0); - - b1 *= b0; - b2 *= b0; - b3 *= b0; - - int w = img.width(); - int h = img.height(); - int wm = w-1; - int x, y; - - m_sum1.allocate(w); - m_sum2.allocate(w); - m_buf.allocate(w); - - for(y = 0; y < h; y++) - { - calculator_type c; - c.from_pix(img.pixel(0, y)); - m_sum1[0].calc(b, b1, b2, b3, c, c, c, c); - c.from_pix(img.pixel(1, y)); - m_sum1[1].calc(b, b1, b2, b3, c, m_sum1[0], m_sum1[0], m_sum1[0]); - c.from_pix(img.pixel(2, y)); - m_sum1[2].calc(b, b1, b2, b3, c, m_sum1[1], m_sum1[0], m_sum1[0]); - - for(x = 3; x < w; ++x) - { - c.from_pix(img.pixel(x, y)); - m_sum1[x].calc(b, b1, b2, b3, c, m_sum1[x-1], m_sum1[x-2], m_sum1[x-3]); - } - - m_sum2[wm ].calc(b, b1, b2, b3, m_sum1[wm ], m_sum1[wm ], m_sum1[wm], m_sum1[wm]); - m_sum2[wm-1].calc(b, b1, b2, b3, m_sum1[wm-1], m_sum2[wm ], m_sum2[wm], m_sum2[wm]); - m_sum2[wm-2].calc(b, b1, b2, b3, m_sum1[wm-2], m_sum2[wm-1], m_sum2[wm], m_sum2[wm]); - m_sum2[wm ].to_pix(m_buf[wm ]); - m_sum2[wm-1].to_pix(m_buf[wm-1]); - m_sum2[wm-2].to_pix(m_buf[wm-2]); - - for(x = wm-3; x >= 0; --x) - { - m_sum2[x].calc(b, b1, b2, b3, m_sum1[x], m_sum2[x+1], m_sum2[x+2], m_sum2[x+3]); - m_sum2[x].to_pix(m_buf[x]); - } - img.copy_color_hspan(0, y, w, &m_buf[0]); - } - } - - //-------------------------------------------------------------------- - template void blur_y(Img& img, double radius) - { - pixfmt_transposer img2(img); - blur_x(img2, radius); - } - - //-------------------------------------------------------------------- - template void blur(Img& img, double radius) - { - blur_x(img, radius); - pixfmt_transposer img2(img); - blur_x(img2, radius); - } - - private: - agg::pod_vector m_sum1; - agg::pod_vector m_sum2; - agg::pod_vector m_buf; - }; - - - //=================================================recursive_blur_calc_rgba - template struct recursive_blur_calc_rgba - { - typedef T value_type; - typedef recursive_blur_calc_rgba self_type; - - value_type r,g,b,a; - - template - AGG_INLINE void from_pix(const ColorT& c) - { - r = c.r; - g = c.g; - b = c.b; - a = c.a; - } - - AGG_INLINE void calc(value_type b1, - value_type b2, - value_type b3, - value_type b4, - const self_type& c1, - const self_type& c2, - const self_type& c3, - const self_type& c4) - { - r = b1*c1.r + b2*c2.r + b3*c3.r + b4*c4.r; - g = b1*c1.g + b2*c2.g + b3*c3.g + b4*c4.g; - b = b1*c1.b + b2*c2.b + b3*c3.b + b4*c4.b; - a = b1*c1.a + b2*c2.a + b3*c3.a + b4*c4.a; - } - - template - AGG_INLINE void to_pix(ColorT& c) const - { - typedef typename ColorT::value_type cv_type; - c.r = (cv_type)uround(r); - c.g = (cv_type)uround(g); - c.b = (cv_type)uround(b); - c.a = (cv_type)uround(a); - } - }; - - - //=================================================recursive_blur_calc_rgb - template struct recursive_blur_calc_rgb - { - typedef T value_type; - typedef recursive_blur_calc_rgb self_type; - - value_type r,g,b; - - template - AGG_INLINE void from_pix(const ColorT& c) - { - r = c.r; - g = c.g; - b = c.b; - } - - AGG_INLINE void calc(value_type b1, - value_type b2, - value_type b3, - value_type b4, - const self_type& c1, - const self_type& c2, - const self_type& c3, - const self_type& c4) - { - r = b1*c1.r + b2*c2.r + b3*c3.r + b4*c4.r; - g = b1*c1.g + b2*c2.g + b3*c3.g + b4*c4.g; - b = b1*c1.b + b2*c2.b + b3*c3.b + b4*c4.b; - } - - template - AGG_INLINE void to_pix(ColorT& c) const - { - typedef typename ColorT::value_type cv_type; - c.r = (cv_type)uround(r); - c.g = (cv_type)uround(g); - c.b = (cv_type)uround(b); - } - }; - - - //================================================recursive_blur_calc_gray - template struct recursive_blur_calc_gray - { - typedef T value_type; - typedef recursive_blur_calc_gray self_type; - - value_type v; - - template - AGG_INLINE void from_pix(const ColorT& c) - { - v = c.v; - } - - AGG_INLINE void calc(value_type b1, - value_type b2, - value_type b3, - value_type b4, - const self_type& c1, - const self_type& c2, - const self_type& c3, - const self_type& c4) - { - v = b1*c1.v + b2*c2.v + b3*c3.v + b4*c4.v; - } - - template - AGG_INLINE void to_pix(ColorT& c) const - { - typedef typename ColorT::value_type cv_type; - c.v = (cv_type)uround(v); - } - }; - } +//========================================================stack_blur_rgb24 +template +void stack_blur_rgb24(Img& img, unsigned rx, unsigned ry) +{ + typedef typename Img::color_type color_type; + typedef typename Img::order_type order_type; + enum order_e { R = order_type::R, G = order_type::G, B = order_type::B }; + unsigned x, y, xp, yp, i; + unsigned stack_ptr; + unsigned stack_start; + const int8u* src_pix_ptr; + int8u* dst_pix_ptr; + color_type* stack_pix_ptr; + + unsigned sum_r; + unsigned sum_g; + unsigned sum_b; + unsigned sum_in_r; + unsigned sum_in_g; + unsigned sum_in_b; + unsigned sum_out_r; + unsigned sum_out_g; + unsigned sum_out_b; + + unsigned w = img.width(); + unsigned h = img.height(); + unsigned wm = w - 1; + unsigned hm = h - 1; + + unsigned div; + unsigned mul_sum; + unsigned shr_sum; + + pod_vector stack; + + if (rx > 0) + { + if (rx > 254) + rx = 254; + div = rx * 2 + 1; + mul_sum = stack_blur_tables::g_stack_blur8_mul[rx]; + shr_sum = stack_blur_tables::g_stack_blur8_shr[rx]; + stack.allocate(div); + + for (y = 0; y < h; y++) + { + sum_r = sum_g = sum_b = sum_in_r = sum_in_g = sum_in_b = sum_out_r = sum_out_g = sum_out_b = 0; + + src_pix_ptr = img.pix_ptr(0, y); + for (i = 0; i <= rx; i++) + { + stack_pix_ptr = &stack[i]; + stack_pix_ptr->r = src_pix_ptr[R]; + stack_pix_ptr->g = src_pix_ptr[G]; + stack_pix_ptr->b = src_pix_ptr[B]; + sum_r += src_pix_ptr[R] * (i + 1); + sum_g += src_pix_ptr[G] * (i + 1); + sum_b += src_pix_ptr[B] * (i + 1); + sum_out_r += src_pix_ptr[R]; + sum_out_g += src_pix_ptr[G]; + sum_out_b += src_pix_ptr[B]; + } + for (i = 1; i <= rx; i++) + { + if (i <= wm) + src_pix_ptr += Img::pix_width; + stack_pix_ptr = &stack[i + rx]; + stack_pix_ptr->r = src_pix_ptr[R]; + stack_pix_ptr->g = src_pix_ptr[G]; + stack_pix_ptr->b = src_pix_ptr[B]; + sum_r += src_pix_ptr[R] * (rx + 1 - i); + sum_g += src_pix_ptr[G] * (rx + 1 - i); + sum_b += src_pix_ptr[B] * (rx + 1 - i); + sum_in_r += src_pix_ptr[R]; + sum_in_g += src_pix_ptr[G]; + sum_in_b += src_pix_ptr[B]; + } + + stack_ptr = rx; + xp = rx; + if (xp > wm) + xp = wm; + src_pix_ptr = img.pix_ptr(xp, y); + dst_pix_ptr = img.pix_ptr(0, y); + for (x = 0; x < w; x++) + { + dst_pix_ptr[R] = (sum_r * mul_sum) >> shr_sum; + dst_pix_ptr[G] = (sum_g * mul_sum) >> shr_sum; + dst_pix_ptr[B] = (sum_b * mul_sum) >> shr_sum; + dst_pix_ptr += Img::pix_width; + + sum_r -= sum_out_r; + sum_g -= sum_out_g; + sum_b -= sum_out_b; + + stack_start = stack_ptr + div - rx; + if (stack_start >= div) + stack_start -= div; + stack_pix_ptr = &stack[stack_start]; + + sum_out_r -= stack_pix_ptr->r; + sum_out_g -= stack_pix_ptr->g; + sum_out_b -= stack_pix_ptr->b; + + if (xp < wm) + { + src_pix_ptr += Img::pix_width; + ++xp; + } + + stack_pix_ptr->r = src_pix_ptr[R]; + stack_pix_ptr->g = src_pix_ptr[G]; + stack_pix_ptr->b = src_pix_ptr[B]; + + sum_in_r += src_pix_ptr[R]; + sum_in_g += src_pix_ptr[G]; + sum_in_b += src_pix_ptr[B]; + sum_r += sum_in_r; + sum_g += sum_in_g; + sum_b += sum_in_b; + + ++stack_ptr; + if (stack_ptr >= div) + stack_ptr = 0; + stack_pix_ptr = &stack[stack_ptr]; + + sum_out_r += stack_pix_ptr->r; + sum_out_g += stack_pix_ptr->g; + sum_out_b += stack_pix_ptr->b; + sum_in_r -= stack_pix_ptr->r; + sum_in_g -= stack_pix_ptr->g; + sum_in_b -= stack_pix_ptr->b; + } + } + } + + if (ry > 0) + { + if (ry > 254) + ry = 254; + div = ry * 2 + 1; + mul_sum = stack_blur_tables::g_stack_blur8_mul[ry]; + shr_sum = stack_blur_tables::g_stack_blur8_shr[ry]; + stack.allocate(div); + + int stride = img.stride(); + for (x = 0; x < w; x++) + { + sum_r = sum_g = sum_b = sum_in_r = sum_in_g = sum_in_b = sum_out_r = sum_out_g = sum_out_b = 0; + + src_pix_ptr = img.pix_ptr(x, 0); + for (i = 0; i <= ry; i++) + { + stack_pix_ptr = &stack[i]; + stack_pix_ptr->r = src_pix_ptr[R]; + stack_pix_ptr->g = src_pix_ptr[G]; + stack_pix_ptr->b = src_pix_ptr[B]; + sum_r += src_pix_ptr[R] * (i + 1); + sum_g += src_pix_ptr[G] * (i + 1); + sum_b += src_pix_ptr[B] * (i + 1); + sum_out_r += src_pix_ptr[R]; + sum_out_g += src_pix_ptr[G]; + sum_out_b += src_pix_ptr[B]; + } + for (i = 1; i <= ry; i++) + { + if (i <= hm) + src_pix_ptr += stride; + stack_pix_ptr = &stack[i + ry]; + stack_pix_ptr->r = src_pix_ptr[R]; + stack_pix_ptr->g = src_pix_ptr[G]; + stack_pix_ptr->b = src_pix_ptr[B]; + sum_r += src_pix_ptr[R] * (ry + 1 - i); + sum_g += src_pix_ptr[G] * (ry + 1 - i); + sum_b += src_pix_ptr[B] * (ry + 1 - i); + sum_in_r += src_pix_ptr[R]; + sum_in_g += src_pix_ptr[G]; + sum_in_b += src_pix_ptr[B]; + } + + stack_ptr = ry; + yp = ry; + if (yp > hm) + yp = hm; + src_pix_ptr = img.pix_ptr(x, yp); + dst_pix_ptr = img.pix_ptr(x, 0); + for (y = 0; y < h; y++) + { + dst_pix_ptr[R] = (sum_r * mul_sum) >> shr_sum; + dst_pix_ptr[G] = (sum_g * mul_sum) >> shr_sum; + dst_pix_ptr[B] = (sum_b * mul_sum) >> shr_sum; + dst_pix_ptr += stride; + + sum_r -= sum_out_r; + sum_g -= sum_out_g; + sum_b -= sum_out_b; + + stack_start = stack_ptr + div - ry; + if (stack_start >= div) + stack_start -= div; + + stack_pix_ptr = &stack[stack_start]; + sum_out_r -= stack_pix_ptr->r; + sum_out_g -= stack_pix_ptr->g; + sum_out_b -= stack_pix_ptr->b; + + if (yp < hm) + { + src_pix_ptr += stride; + ++yp; + } + + stack_pix_ptr->r = src_pix_ptr[R]; + stack_pix_ptr->g = src_pix_ptr[G]; + stack_pix_ptr->b = src_pix_ptr[B]; + + sum_in_r += src_pix_ptr[R]; + sum_in_g += src_pix_ptr[G]; + sum_in_b += src_pix_ptr[B]; + sum_r += sum_in_r; + sum_g += sum_in_g; + sum_b += sum_in_b; + + ++stack_ptr; + if (stack_ptr >= div) + stack_ptr = 0; + stack_pix_ptr = &stack[stack_ptr]; + + sum_out_r += stack_pix_ptr->r; + sum_out_g += stack_pix_ptr->g; + sum_out_b += stack_pix_ptr->b; + sum_in_r -= stack_pix_ptr->r; + sum_in_g -= stack_pix_ptr->g; + sum_in_b -= stack_pix_ptr->b; + } + } + } +} + +//=======================================================stack_blur_rgba32 +template +void stack_blur_rgba32(Img& img, unsigned rx, unsigned ry) +{ + typedef typename Img::color_type color_type; + typedef typename Img::order_type order_type; + enum order_e { R = order_type::R, G = order_type::G, B = order_type::B, A = order_type::A }; + + unsigned x, y, xp, yp, i; + unsigned stack_ptr; + unsigned stack_start; + + const int8u* src_pix_ptr; + int8u* dst_pix_ptr; + color_type* stack_pix_ptr; + + unsigned sum_r; + unsigned sum_g; + unsigned sum_b; + unsigned sum_a; + unsigned sum_in_r; + unsigned sum_in_g; + unsigned sum_in_b; + unsigned sum_in_a; + unsigned sum_out_r; + unsigned sum_out_g; + unsigned sum_out_b; + unsigned sum_out_a; + + unsigned w = img.width(); + unsigned h = img.height(); + unsigned wm = w - 1; + unsigned hm = h - 1; + + unsigned div; + unsigned mul_sum; + unsigned shr_sum; + + pod_vector stack; + + if (rx > 0) + { + if (rx > 254) + rx = 254; + div = rx * 2 + 1; + mul_sum = stack_blur_tables::g_stack_blur8_mul[rx]; + shr_sum = stack_blur_tables::g_stack_blur8_shr[rx]; + stack.allocate(div); + + for (y = 0; y < h; y++) + { + sum_r = sum_g = sum_b = sum_a = sum_in_r = sum_in_g = sum_in_b = sum_in_a = sum_out_r = sum_out_g = + sum_out_b = sum_out_a = 0; + + src_pix_ptr = img.pix_ptr(0, y); + for (i = 0; i <= rx; i++) + { + stack_pix_ptr = &stack[i]; + stack_pix_ptr->r = src_pix_ptr[R]; + stack_pix_ptr->g = src_pix_ptr[G]; + stack_pix_ptr->b = src_pix_ptr[B]; + stack_pix_ptr->a = src_pix_ptr[A]; + sum_r += src_pix_ptr[R] * (i + 1); + sum_g += src_pix_ptr[G] * (i + 1); + sum_b += src_pix_ptr[B] * (i + 1); + sum_a += src_pix_ptr[A] * (i + 1); + sum_out_r += src_pix_ptr[R]; + sum_out_g += src_pix_ptr[G]; + sum_out_b += src_pix_ptr[B]; + sum_out_a += src_pix_ptr[A]; + } + for (i = 1; i <= rx; i++) + { + if (i <= wm) + src_pix_ptr += Img::pix_width; + stack_pix_ptr = &stack[i + rx]; + stack_pix_ptr->r = src_pix_ptr[R]; + stack_pix_ptr->g = src_pix_ptr[G]; + stack_pix_ptr->b = src_pix_ptr[B]; + stack_pix_ptr->a = src_pix_ptr[A]; + sum_r += src_pix_ptr[R] * (rx + 1 - i); + sum_g += src_pix_ptr[G] * (rx + 1 - i); + sum_b += src_pix_ptr[B] * (rx + 1 - i); + sum_a += src_pix_ptr[A] * (rx + 1 - i); + sum_in_r += src_pix_ptr[R]; + sum_in_g += src_pix_ptr[G]; + sum_in_b += src_pix_ptr[B]; + sum_in_a += src_pix_ptr[A]; + } + + stack_ptr = rx; + xp = rx; + if (xp > wm) + xp = wm; + src_pix_ptr = img.pix_ptr(xp, y); + dst_pix_ptr = img.pix_ptr(0, y); + for (x = 0; x < w; x++) + { + dst_pix_ptr[R] = (sum_r * mul_sum) >> shr_sum; + dst_pix_ptr[G] = (sum_g * mul_sum) >> shr_sum; + dst_pix_ptr[B] = (sum_b * mul_sum) >> shr_sum; + dst_pix_ptr[A] = (sum_a * mul_sum) >> shr_sum; + dst_pix_ptr += Img::pix_width; + + sum_r -= sum_out_r; + sum_g -= sum_out_g; + sum_b -= sum_out_b; + sum_a -= sum_out_a; + + stack_start = stack_ptr + div - rx; + if (stack_start >= div) + stack_start -= div; + stack_pix_ptr = &stack[stack_start]; + + sum_out_r -= stack_pix_ptr->r; + sum_out_g -= stack_pix_ptr->g; + sum_out_b -= stack_pix_ptr->b; + sum_out_a -= stack_pix_ptr->a; + + if (xp < wm) + { + src_pix_ptr += Img::pix_width; + ++xp; + } + + stack_pix_ptr->r = src_pix_ptr[R]; + stack_pix_ptr->g = src_pix_ptr[G]; + stack_pix_ptr->b = src_pix_ptr[B]; + stack_pix_ptr->a = src_pix_ptr[A]; + + sum_in_r += src_pix_ptr[R]; + sum_in_g += src_pix_ptr[G]; + sum_in_b += src_pix_ptr[B]; + sum_in_a += src_pix_ptr[A]; + sum_r += sum_in_r; + sum_g += sum_in_g; + sum_b += sum_in_b; + sum_a += sum_in_a; + + ++stack_ptr; + if (stack_ptr >= div) + stack_ptr = 0; + stack_pix_ptr = &stack[stack_ptr]; + + sum_out_r += stack_pix_ptr->r; + sum_out_g += stack_pix_ptr->g; + sum_out_b += stack_pix_ptr->b; + sum_out_a += stack_pix_ptr->a; + sum_in_r -= stack_pix_ptr->r; + sum_in_g -= stack_pix_ptr->g; + sum_in_b -= stack_pix_ptr->b; + sum_in_a -= stack_pix_ptr->a; + } + } + } + + if (ry > 0) + { + if (ry > 254) + ry = 254; + div = ry * 2 + 1; + mul_sum = stack_blur_tables::g_stack_blur8_mul[ry]; + shr_sum = stack_blur_tables::g_stack_blur8_shr[ry]; + stack.allocate(div); + + int stride = img.stride(); + for (x = 0; x < w; x++) + { + sum_r = sum_g = sum_b = sum_a = sum_in_r = sum_in_g = sum_in_b = sum_in_a = sum_out_r = sum_out_g = + sum_out_b = sum_out_a = 0; + + src_pix_ptr = img.pix_ptr(x, 0); + for (i = 0; i <= ry; i++) + { + stack_pix_ptr = &stack[i]; + stack_pix_ptr->r = src_pix_ptr[R]; + stack_pix_ptr->g = src_pix_ptr[G]; + stack_pix_ptr->b = src_pix_ptr[B]; + stack_pix_ptr->a = src_pix_ptr[A]; + sum_r += src_pix_ptr[R] * (i + 1); + sum_g += src_pix_ptr[G] * (i + 1); + sum_b += src_pix_ptr[B] * (i + 1); + sum_a += src_pix_ptr[A] * (i + 1); + sum_out_r += src_pix_ptr[R]; + sum_out_g += src_pix_ptr[G]; + sum_out_b += src_pix_ptr[B]; + sum_out_a += src_pix_ptr[A]; + } + for (i = 1; i <= ry; i++) + { + if (i <= hm) + src_pix_ptr += stride; + stack_pix_ptr = &stack[i + ry]; + stack_pix_ptr->r = src_pix_ptr[R]; + stack_pix_ptr->g = src_pix_ptr[G]; + stack_pix_ptr->b = src_pix_ptr[B]; + stack_pix_ptr->a = src_pix_ptr[A]; + sum_r += src_pix_ptr[R] * (ry + 1 - i); + sum_g += src_pix_ptr[G] * (ry + 1 - i); + sum_b += src_pix_ptr[B] * (ry + 1 - i); + sum_a += src_pix_ptr[A] * (ry + 1 - i); + sum_in_r += src_pix_ptr[R]; + sum_in_g += src_pix_ptr[G]; + sum_in_b += src_pix_ptr[B]; + sum_in_a += src_pix_ptr[A]; + } + + stack_ptr = ry; + yp = ry; + if (yp > hm) + yp = hm; + src_pix_ptr = img.pix_ptr(x, yp); + dst_pix_ptr = img.pix_ptr(x, 0); + for (y = 0; y < h; y++) + { + dst_pix_ptr[R] = (sum_r * mul_sum) >> shr_sum; + dst_pix_ptr[G] = (sum_g * mul_sum) >> shr_sum; + dst_pix_ptr[B] = (sum_b * mul_sum) >> shr_sum; + dst_pix_ptr[A] = (sum_a * mul_sum) >> shr_sum; + dst_pix_ptr += stride; + + sum_r -= sum_out_r; + sum_g -= sum_out_g; + sum_b -= sum_out_b; + sum_a -= sum_out_a; + + stack_start = stack_ptr + div - ry; + if (stack_start >= div) + stack_start -= div; + + stack_pix_ptr = &stack[stack_start]; + sum_out_r -= stack_pix_ptr->r; + sum_out_g -= stack_pix_ptr->g; + sum_out_b -= stack_pix_ptr->b; + sum_out_a -= stack_pix_ptr->a; + + if (yp < hm) + { + src_pix_ptr += stride; + ++yp; + } + + stack_pix_ptr->r = src_pix_ptr[R]; + stack_pix_ptr->g = src_pix_ptr[G]; + stack_pix_ptr->b = src_pix_ptr[B]; + stack_pix_ptr->a = src_pix_ptr[A]; + + sum_in_r += src_pix_ptr[R]; + sum_in_g += src_pix_ptr[G]; + sum_in_b += src_pix_ptr[B]; + sum_in_a += src_pix_ptr[A]; + sum_r += sum_in_r; + sum_g += sum_in_g; + sum_b += sum_in_b; + sum_a += sum_in_a; + + ++stack_ptr; + if (stack_ptr >= div) + stack_ptr = 0; + stack_pix_ptr = &stack[stack_ptr]; + + sum_out_r += stack_pix_ptr->r; + sum_out_g += stack_pix_ptr->g; + sum_out_b += stack_pix_ptr->b; + sum_out_a += stack_pix_ptr->a; + sum_in_r -= stack_pix_ptr->r; + sum_in_g -= stack_pix_ptr->g; + sum_in_b -= stack_pix_ptr->b; + sum_in_a -= stack_pix_ptr->a; + } + } + } +} + +//===========================================================recursive_blur +template +class recursive_blur +{ + public: + typedef ColorT color_type; + typedef CalculatorT calculator_type; + typedef typename color_type::value_type value_type; + typedef typename calculator_type::value_type calc_type; + + //-------------------------------------------------------------------- + template + void blur_x(Img& img, double radius) + { + if (radius < 0.62) + return; + if (img.width() < 3) + return; + + calc_type s = calc_type(radius * 0.5); + calc_type q = calc_type((s < 2.5) ? 3.97156 - 4.14554 * sqrt(1 - 0.26891 * s) : 0.98711 * s - 0.96330); + + calc_type q2 = calc_type(q * q); + calc_type q3 = calc_type(q2 * q); + + calc_type b0 = calc_type(1.0 / (1.578250 + 2.444130 * q + 1.428100 * q2 + 0.422205 * q3)); + + calc_type b1 = calc_type(2.44413 * q + 2.85619 * q2 + 1.26661 * q3); + + calc_type b2 = calc_type(-1.42810 * q2 + -1.26661 * q3); + + calc_type b3 = calc_type(0.422205 * q3); + + calc_type b = calc_type(1 - (b1 + b2 + b3) * b0); + + b1 *= b0; + b2 *= b0; + b3 *= b0; + + int w = img.width(); + int h = img.height(); + int wm = w - 1; + int x, y; + + m_sum1.allocate(w); + m_sum2.allocate(w); + m_buf.allocate(w); + + for (y = 0; y < h; y++) + { + calculator_type c; + c.from_pix(img.pixel(0, y)); + m_sum1[0].calc(b, b1, b2, b3, c, c, c, c); + c.from_pix(img.pixel(1, y)); + m_sum1[1].calc(b, b1, b2, b3, c, m_sum1[0], m_sum1[0], m_sum1[0]); + c.from_pix(img.pixel(2, y)); + m_sum1[2].calc(b, b1, b2, b3, c, m_sum1[1], m_sum1[0], m_sum1[0]); + + for (x = 3; x < w; ++x) + { + c.from_pix(img.pixel(x, y)); + m_sum1[x].calc(b, b1, b2, b3, c, m_sum1[x - 1], m_sum1[x - 2], m_sum1[x - 3]); + } + + m_sum2[wm].calc(b, b1, b2, b3, m_sum1[wm], m_sum1[wm], m_sum1[wm], m_sum1[wm]); + m_sum2[wm - 1].calc(b, b1, b2, b3, m_sum1[wm - 1], m_sum2[wm], m_sum2[wm], m_sum2[wm]); + m_sum2[wm - 2].calc(b, b1, b2, b3, m_sum1[wm - 2], m_sum2[wm - 1], m_sum2[wm], m_sum2[wm]); + m_sum2[wm].to_pix(m_buf[wm]); + m_sum2[wm - 1].to_pix(m_buf[wm - 1]); + m_sum2[wm - 2].to_pix(m_buf[wm - 2]); + + for (x = wm - 3; x >= 0; --x) + { + m_sum2[x].calc(b, b1, b2, b3, m_sum1[x], m_sum2[x + 1], m_sum2[x + 2], m_sum2[x + 3]); + m_sum2[x].to_pix(m_buf[x]); + } + img.copy_color_hspan(0, y, w, &m_buf[0]); + } + } + + //-------------------------------------------------------------------- + template + void blur_y(Img& img, double radius) + { + pixfmt_transposer img2(img); + blur_x(img2, radius); + } + + //-------------------------------------------------------------------- + template + void blur(Img& img, double radius) + { + blur_x(img, radius); + pixfmt_transposer img2(img); + blur_x(img2, radius); + } + + private: + agg::pod_vector m_sum1; + agg::pod_vector m_sum2; + agg::pod_vector m_buf; +}; + +//=================================================recursive_blur_calc_rgba +template +struct recursive_blur_calc_rgba +{ + typedef T value_type; + typedef recursive_blur_calc_rgba self_type; + + value_type r, g, b, a; + + template + AGG_INLINE void from_pix(const ColorT& c) + { + r = c.r; + g = c.g; + b = c.b; + a = c.a; + } + + AGG_INLINE void calc(value_type b1, + value_type b2, + value_type b3, + value_type b4, + const self_type& c1, + const self_type& c2, + const self_type& c3, + const self_type& c4) + { + r = b1 * c1.r + b2 * c2.r + b3 * c3.r + b4 * c4.r; + g = b1 * c1.g + b2 * c2.g + b3 * c3.g + b4 * c4.g; + b = b1 * c1.b + b2 * c2.b + b3 * c3.b + b4 * c4.b; + a = b1 * c1.a + b2 * c2.a + b3 * c3.a + b4 * c4.a; + } + + template + AGG_INLINE void to_pix(ColorT& c) const + { + typedef typename ColorT::value_type cv_type; + c.r = (cv_type)uround(r); + c.g = (cv_type)uround(g); + c.b = (cv_type)uround(b); + c.a = (cv_type)uround(a); + } +}; + +//=================================================recursive_blur_calc_rgb +template +struct recursive_blur_calc_rgb +{ + typedef T value_type; + typedef recursive_blur_calc_rgb self_type; + + value_type r, g, b; + + template + AGG_INLINE void from_pix(const ColorT& c) + { + r = c.r; + g = c.g; + b = c.b; + } + + AGG_INLINE void calc(value_type b1, + value_type b2, + value_type b3, + value_type b4, + const self_type& c1, + const self_type& c2, + const self_type& c3, + const self_type& c4) + { + r = b1 * c1.r + b2 * c2.r + b3 * c3.r + b4 * c4.r; + g = b1 * c1.g + b2 * c2.g + b3 * c3.g + b4 * c4.g; + b = b1 * c1.b + b2 * c2.b + b3 * c3.b + b4 * c4.b; + } + + template + AGG_INLINE void to_pix(ColorT& c) const + { + typedef typename ColorT::value_type cv_type; + c.r = (cv_type)uround(r); + c.g = (cv_type)uround(g); + c.b = (cv_type)uround(b); + } +}; + +//================================================recursive_blur_calc_gray +template +struct recursive_blur_calc_gray +{ + typedef T value_type; + typedef recursive_blur_calc_gray self_type; + + value_type v; + + template + AGG_INLINE void from_pix(const ColorT& c) + { + v = c.v; + } + + AGG_INLINE void calc(value_type b1, + value_type b2, + value_type b3, + value_type b4, + const self_type& c1, + const self_type& c2, + const self_type& c3, + const self_type& c4) + { + v = b1 * c1.v + b2 * c2.v + b3 * c3.v + b4 * c4.v; + } + + template + AGG_INLINE void to_pix(ColorT& c) const + { + typedef typename ColorT::value_type cv_type; + c.v = (cv_type)uround(v); + } +}; + +} // namespace agg #endif diff --git a/deps/agg/include/agg_bounding_rect.h b/deps/agg/include/agg_bounding_rect.h index f13b863f0..ebad6ba1e 100644 --- a/deps/agg/include/agg_bounding_rect.h +++ b/deps/agg/include/agg_bounding_rect.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -21,76 +21,38 @@ #include "agg_basics.h" -namespace agg +namespace agg { + +//-----------------------------------------------------------bounding_rect +template +bool bounding_rect(VertexSource& vs, + GetId& gi, + unsigned start, + unsigned num, + CoordT* x1, + CoordT* y1, + CoordT* x2, + CoordT* y2) { + unsigned i; + double x; + double y; + bool first = true; - //-----------------------------------------------------------bounding_rect - template - bool bounding_rect(VertexSource& vs, GetId& gi, - unsigned start, unsigned num, - CoordT* x1, CoordT* y1, CoordT* x2, CoordT* y2) + *x1 = CoordT(1); + *y1 = CoordT(1); + *x2 = CoordT(0); + *y2 = CoordT(0); + + for (i = 0; i < num; i++) { - unsigned i; - double x; - double y; - bool first = true; - - *x1 = CoordT(1); - *y1 = CoordT(1); - *x2 = CoordT(0); - *y2 = CoordT(0); - - for(i = 0; i < num; i++) - { - vs.rewind(gi[start + i]); - unsigned cmd; - while(!is_stop(cmd = vs.vertex(&x, &y))) - { - if(is_vertex(cmd)) - { - if(first) - { - *x1 = CoordT(x); - *y1 = CoordT(y); - *x2 = CoordT(x); - *y2 = CoordT(y); - first = false; - } - else - { - if(CoordT(x) < *x1) *x1 = CoordT(x); - if(CoordT(y) < *y1) *y1 = CoordT(y); - if(CoordT(x) > *x2) *x2 = CoordT(x); - if(CoordT(y) > *y2) *y2 = CoordT(y); - } - } - } - } - return *x1 <= *x2 && *y1 <= *y2; - } - - - //-----------------------------------------------------bounding_rect_single - template - bool bounding_rect_single(VertexSource& vs, unsigned path_id, - CoordT* x1, CoordT* y1, CoordT* x2, CoordT* y2) - { - double x; - double y; - bool first = true; - - *x1 = CoordT(1); - *y1 = CoordT(1); - *x2 = CoordT(0); - *y2 = CoordT(0); - - vs.rewind(path_id); + vs.rewind(gi[start + i]); unsigned cmd; - while(!is_stop(cmd = vs.vertex(&x, &y))) + while (!is_stop(cmd = vs.vertex(&x, &y))) { - if(is_vertex(cmd)) + if (is_vertex(cmd)) { - if(first) + if (first) { *x1 = CoordT(x); *y1 = CoordT(y); @@ -100,17 +62,64 @@ namespace agg } else { - if(CoordT(x) < *x1) *x1 = CoordT(x); - if(CoordT(y) < *y1) *y1 = CoordT(y); - if(CoordT(x) > *x2) *x2 = CoordT(x); - if(CoordT(y) > *y2) *y2 = CoordT(y); + if (CoordT(x) < *x1) + *x1 = CoordT(x); + if (CoordT(y) < *y1) + *y1 = CoordT(y); + if (CoordT(x) > *x2) + *x2 = CoordT(x); + if (CoordT(y) > *y2) + *y2 = CoordT(y); } } } - return *x1 <= *x2 && *y1 <= *y2; } - - + return *x1 <= *x2 && *y1 <= *y2; } +//-----------------------------------------------------bounding_rect_single +template +bool bounding_rect_single(VertexSource& vs, unsigned path_id, CoordT* x1, CoordT* y1, CoordT* x2, CoordT* y2) +{ + double x; + double y; + bool first = true; + + *x1 = CoordT(1); + *y1 = CoordT(1); + *x2 = CoordT(0); + *y2 = CoordT(0); + + vs.rewind(path_id); + unsigned cmd; + while (!is_stop(cmd = vs.vertex(&x, &y))) + { + if (is_vertex(cmd)) + { + if (first) + { + *x1 = CoordT(x); + *y1 = CoordT(y); + *x2 = CoordT(x); + *y2 = CoordT(y); + first = false; + } + else + { + if (CoordT(x) < *x1) + *x1 = CoordT(x); + if (CoordT(y) < *y1) + *y1 = CoordT(y); + if (CoordT(x) > *x2) + *x2 = CoordT(x); + if (CoordT(y) > *y2) + *y2 = CoordT(y); + } + } + } + return *x1 <= *x2 && *y1 <= *y2; +} + +} // namespace agg + #endif diff --git a/deps/agg/include/agg_bspline.h b/deps/agg/include/agg_bspline.h index 2c1ed9a38..6ee5fa089 100644 --- a/deps/agg/include/agg_bspline.h +++ b/deps/agg/include/agg_bspline.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -22,55 +22,53 @@ #include "agg_array.h" -namespace agg +namespace agg { +//----------------------------------------------------------------bspline +// A very simple class of Bi-cubic Spline interpolation. +// First call init(num, x[], y[]) where num - number of source points, +// x, y - arrays of X and Y values respectively. Here Y must be a function +// of X. It means that all the X-coordinates must be arranged in the ascending +// order. +// Then call get(x) that calculates a value Y for the respective X. +// The class supports extrapolation, i.e. you can call get(x) where x is +// outside the given with init() X-range. Extrapolation is a simple linear +// function. +// +// See Implementation agg_bspline.cpp +//------------------------------------------------------------------------ +class bspline { - //----------------------------------------------------------------bspline - // A very simple class of Bi-cubic Spline interpolation. - // First call init(num, x[], y[]) where num - number of source points, - // x, y - arrays of X and Y values respectively. Here Y must be a function - // of X. It means that all the X-coordinates must be arranged in the ascending - // order. - // Then call get(x) that calculates a value Y for the respective X. - // The class supports extrapolation, i.e. you can call get(x) where x is - // outside the given with init() X-range. Extrapolation is a simple linear - // function. - // - // See Implementation agg_bspline.cpp - //------------------------------------------------------------------------ - class bspline - { - public: - bspline(); - bspline(int num); - bspline(int num, const double* x, const double* y); + public: + bspline(); + bspline(int num); + bspline(int num, const double* x, const double* y); - void init(int num); - void add_point(double x, double y); - void prepare(); + void init(int num); + void add_point(double x, double y); + void prepare(); - void init(int num, const double* x, const double* y); + void init(int num, const double* x, const double* y); - double get(double x) const; - double get_stateful(double x) const; - - private: - bspline(const bspline&); - const bspline& operator = (const bspline&); + double get(double x) const; + double get_stateful(double x) const; - static void bsearch(int n, const double *x, double x0, int *i); - double extrapolation_left(double x) const; - double extrapolation_right(double x) const; - double interpolation(double x, int i) const; + private: + bspline(const bspline&); + const bspline& operator=(const bspline&); - int m_max; - int m_num; - double* m_x; - double* m_y; - pod_array m_am; - mutable int m_last_idx; - }; + static void bsearch(int n, const double* x, double x0, int* i); + double extrapolation_left(double x) const; + double extrapolation_right(double x) const; + double interpolation(double x, int i) const; + int m_max; + int m_num; + double* m_x; + double* m_y; + pod_array m_am; + mutable int m_last_idx; +}; -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_clip_liang_barsky.h b/deps/agg/include/agg_clip_liang_barsky.h index 28765a79c..ce4b22988 100644 --- a/deps/agg/include/agg_clip_liang_barsky.h +++ b/deps/agg/include/agg_clip_liang_barsky.h @@ -21,313 +21,296 @@ #include "agg_basics.h" -namespace agg +namespace agg { + +//------------------------------------------------------------------------ +enum clipping_flags_e { + clipping_flags_x1_clipped = 4, + clipping_flags_x2_clipped = 1, + clipping_flags_y1_clipped = 8, + clipping_flags_y2_clipped = 2, + clipping_flags_x_clipped = clipping_flags_x1_clipped | clipping_flags_x2_clipped, + clipping_flags_y_clipped = clipping_flags_y1_clipped | clipping_flags_y2_clipped +}; + +//----------------------------------------------------------clipping_flags +// Determine the clipping code of the vertex according to the +// Cyrus-Beck line clipping algorithm +// +// | | +// 0110 | 0010 | 0011 +// | | +// -------+--------+-------- clip_box.y2 +// | | +// 0100 | 0000 | 0001 +// | | +// -------+--------+-------- clip_box.y1 +// | | +// 1100 | 1000 | 1001 +// | | +// clip_box.x1 clip_box.x2 +// +// +template +inline unsigned clipping_flags(T x, T y, const rect_base& clip_box) { + return (x > clip_box.x2) | ((y > clip_box.y2) << 1) | ((x < clip_box.x1) << 2) | ((y < clip_box.y1) << 3); +} - //------------------------------------------------------------------------ - enum clipping_flags_e - { - clipping_flags_x1_clipped = 4, - clipping_flags_x2_clipped = 1, - clipping_flags_y1_clipped = 8, - clipping_flags_y2_clipped = 2, - clipping_flags_x_clipped = clipping_flags_x1_clipped | clipping_flags_x2_clipped, - clipping_flags_y_clipped = clipping_flags_y1_clipped | clipping_flags_y2_clipped - }; +//--------------------------------------------------------clipping_flags_x +template +inline unsigned clipping_flags_x(T x, const rect_base& clip_box) +{ + return (x > clip_box.x2) | ((x < clip_box.x1) << 2); +} - //----------------------------------------------------------clipping_flags - // Determine the clipping code of the vertex according to the - // Cyrus-Beck line clipping algorithm - // - // | | - // 0110 | 0010 | 0011 - // | | - // -------+--------+-------- clip_box.y2 - // | | - // 0100 | 0000 | 0001 - // | | - // -------+--------+-------- clip_box.y1 - // | | - // 1100 | 1000 | 1001 - // | | - // clip_box.x1 clip_box.x2 - // - // - template - inline unsigned clipping_flags(T x, T y, const rect_base& clip_box) +//--------------------------------------------------------clipping_flags_y +template +inline unsigned clipping_flags_y(T y, const rect_base& clip_box) +{ + return ((y > clip_box.y2) << 1) | ((y < clip_box.y1) << 3); +} + +//-------------------------------------------------------clip_liang_barsky +template +inline unsigned clip_liang_barsky(T x1, T y1, T x2, T y2, const rect_base& clip_box, T* x, T* y) +{ + const double nearzero = 1e-30; + + double deltax = x2 - x1; + double deltay = y2 - y1; + double xin; + double xout; + double yin; + double yout; + double tinx; + double tiny; + double toutx; + double touty; + double tin1; + double tin2; + double tout1; + unsigned np = 0; + + if (deltax == 0.0) { - return (x > clip_box.x2) | - ((y > clip_box.y2) << 1) | - ((x < clip_box.x1) << 2) | - ((y < clip_box.y1) << 3); + // bump off of the vertical + deltax = (x1 > clip_box.x1) ? -nearzero : nearzero; } - //--------------------------------------------------------clipping_flags_x - template - inline unsigned clipping_flags_x(T x, const rect_base& clip_box) + if (deltay == 0.0) { - return (x > clip_box.x2) | ((x < clip_box.x1) << 2); + // bump off of the horizontal + deltay = (y1 > clip_box.y1) ? -nearzero : nearzero; } - - //--------------------------------------------------------clipping_flags_y - template - inline unsigned clipping_flags_y(T y, const rect_base& clip_box) + if (deltax > 0.0) { - return ((y > clip_box.y2) << 1) | ((y < clip_box.y1) << 3); + // points to right + xin = clip_box.x1; + xout = clip_box.x2; + } + else + { + xin = clip_box.x2; + xout = clip_box.x1; } - - //-------------------------------------------------------clip_liang_barsky - template - inline unsigned clip_liang_barsky(T x1, T y1, T x2, T y2, - const rect_base& clip_box, - T* x, T* y) + if (deltay > 0.0) { - const double nearzero = 1e-30; + // points up + yin = clip_box.y1; + yout = clip_box.y2; + } + else + { + yin = clip_box.y2; + yout = clip_box.y1; + } - double deltax = x2 - x1; - double deltay = y2 - y1; - double xin; - double xout; - double yin; - double yout; - double tinx; - double tiny; - double toutx; - double touty; - double tin1; - double tin2; - double tout1; - unsigned np = 0; + tinx = (xin - x1) / deltax; + tiny = (yin - y1) / deltay; - if(deltax == 0.0) + if (tinx < tiny) + { + // hits x first + tin1 = tinx; + tin2 = tiny; + } + else + { + // hits y first + tin1 = tiny; + tin2 = tinx; + } + + if (tin1 <= 1.0) + { + if (0.0 < tin1) { - // bump off of the vertical - deltax = (x1 > clip_box.x1) ? -nearzero : nearzero; + *x++ = (T)xin; + *y++ = (T)yin; + ++np; } - if(deltay == 0.0) + if (tin2 <= 1.0) { - // bump off of the horizontal - deltay = (y1 > clip_box.y1) ? -nearzero : nearzero; - } + toutx = (xout - x1) / deltax; + touty = (yout - y1) / deltay; - if(deltax > 0.0) - { - // points to right - xin = clip_box.x1; - xout = clip_box.x2; - } - else - { - xin = clip_box.x2; - xout = clip_box.x1; - } + tout1 = (toutx < touty) ? toutx : touty; - if(deltay > 0.0) - { - // points up - yin = clip_box.y1; - yout = clip_box.y2; - } - else - { - yin = clip_box.y2; - yout = clip_box.y1; - } - - tinx = (xin - x1) / deltax; - tiny = (yin - y1) / deltay; - - if (tinx < tiny) - { - // hits x first - tin1 = tinx; - tin2 = tiny; - } - else - { - // hits y first - tin1 = tiny; - tin2 = tinx; - } - - if(tin1 <= 1.0) - { - if(0.0 < tin1) + if (tin2 > 0.0 || tout1 > 0.0) { - *x++ = (T)xin; - *y++ = (T)yin; - ++np; - } - - if(tin2 <= 1.0) - { - toutx = (xout - x1) / deltax; - touty = (yout - y1) / deltay; - - tout1 = (toutx < touty) ? toutx : touty; - - if(tin2 > 0.0 || tout1 > 0.0) + if (tin2 <= tout1) { - if(tin2 <= tout1) + if (tin2 > 0.0) { - if(tin2 > 0.0) - { - if(tinx > tiny) - { - *x++ = (T)xin; - *y++ = (T)(y1 + tinx * deltay); - } - else - { - *x++ = (T)(x1 + tiny * deltax); - *y++ = (T)yin; - } - ++np; - } - - if(tout1 < 1.0) - { - if(toutx < touty) - { - *x++ = (T)xout; - *y++ = (T)(y1 + toutx * deltay); - } - else - { - *x++ = (T)(x1 + touty * deltax); - *y++ = (T)yout; - } - } - else - { - *x++ = x2; - *y++ = y2; - } - ++np; - } - else - { - if(tinx > tiny) + if (tinx > tiny) { *x++ = (T)xin; - *y++ = (T)yout; + *y++ = (T)(y1 + tinx * deltay); } else { - *x++ = (T)xout; + *x++ = (T)(x1 + tiny * deltax); *y++ = (T)yin; } ++np; } + + if (tout1 < 1.0) + { + if (toutx < touty) + { + *x++ = (T)xout; + *y++ = (T)(y1 + toutx * deltay); + } + else + { + *x++ = (T)(x1 + touty * deltax); + *y++ = (T)yout; + } + } + else + { + *x++ = x2; + *y++ = y2; + } + ++np; + } + else + { + if (tinx > tiny) + { + *x++ = (T)xin; + *y++ = (T)yout; + } + else + { + *x++ = (T)xout; + *y++ = (T)yin; + } + ++np; } } } - return np; } - - - //---------------------------------------------------------------------------- - template - bool clip_move_point(T x1, T y1, T x2, T y2, - const rect_base& clip_box, - T* x, T* y, unsigned flags) - { - T bound; - - if(flags & clipping_flags_x_clipped) - { - if(x1 == x2) - { - return false; - } - bound = (flags & clipping_flags_x1_clipped) ? clip_box.x1 : clip_box.x2; - *y = (T)(double(bound - x1) * (y2 - y1) / (x2 - x1) + y1); - *x = bound; - } - - flags = clipping_flags_y(*y, clip_box); - if(flags & clipping_flags_y_clipped) - { - if(y1 == y2) - { - return false; - } - bound = (flags & clipping_flags_y1_clipped) ? clip_box.y1 : clip_box.y2; - *x = (T)(double(bound - y1) * (x2 - x1) / (y2 - y1) + x1); - *y = bound; - } - return true; - } - - //-------------------------------------------------------clip_line_segment - // Returns: ret >= 4 - Fully clipped - // (ret & 1) != 0 - First point has been moved - // (ret & 2) != 0 - Second point has been moved - // - template - unsigned clip_line_segment(T* x1, T* y1, T* x2, T* y2, - const rect_base& clip_box) - { - unsigned f1 = clipping_flags(*x1, *y1, clip_box); - unsigned f2 = clipping_flags(*x2, *y2, clip_box); - unsigned ret = 0; - - if((f2 | f1) == 0) - { - // Fully visible - return 0; - } - - if((f1 & clipping_flags_x_clipped) != 0 && - (f1 & clipping_flags_x_clipped) == (f2 & clipping_flags_x_clipped)) - { - // Fully clipped - return 4; - } - - if((f1 & clipping_flags_y_clipped) != 0 && - (f1 & clipping_flags_y_clipped) == (f2 & clipping_flags_y_clipped)) - { - // Fully clipped - return 4; - } - - T tx1 = *x1; - T ty1 = *y1; - T tx2 = *x2; - T ty2 = *y2; - if(f1) - { - if(!clip_move_point(tx1, ty1, tx2, ty2, clip_box, x1, y1, f1)) - { - return 4; - } - if(*x1 == *x2 && *y1 == *y2) - { - return 4; - } - ret |= 1; - } - if(f2) - { - if(!clip_move_point(tx1, ty1, tx2, ty2, clip_box, x2, y2, f2)) - { - return 4; - } - if(*x1 == *x2 && *y1 == *y2) - { - return 4; - } - ret |= 2; - } - return ret; - } - - + return np; } +//---------------------------------------------------------------------------- +template +bool clip_move_point(T x1, T y1, T x2, T y2, const rect_base& clip_box, T* x, T* y, unsigned flags) +{ + T bound; + + if (flags & clipping_flags_x_clipped) + { + if (x1 == x2) + { + return false; + } + bound = (flags & clipping_flags_x1_clipped) ? clip_box.x1 : clip_box.x2; + *y = (T)(double(bound - x1) * (y2 - y1) / (x2 - x1) + y1); + *x = bound; + } + + flags = clipping_flags_y(*y, clip_box); + if (flags & clipping_flags_y_clipped) + { + if (y1 == y2) + { + return false; + } + bound = (flags & clipping_flags_y1_clipped) ? clip_box.y1 : clip_box.y2; + *x = (T)(double(bound - y1) * (x2 - x1) / (y2 - y1) + x1); + *y = bound; + } + return true; +} + +//-------------------------------------------------------clip_line_segment +// Returns: ret >= 4 - Fully clipped +// (ret & 1) != 0 - First point has been moved +// (ret & 2) != 0 - Second point has been moved +// +template +unsigned clip_line_segment(T* x1, T* y1, T* x2, T* y2, const rect_base& clip_box) +{ + unsigned f1 = clipping_flags(*x1, *y1, clip_box); + unsigned f2 = clipping_flags(*x2, *y2, clip_box); + unsigned ret = 0; + + if ((f2 | f1) == 0) + { + // Fully visible + return 0; + } + + if ((f1 & clipping_flags_x_clipped) != 0 && (f1 & clipping_flags_x_clipped) == (f2 & clipping_flags_x_clipped)) + { + // Fully clipped + return 4; + } + + if ((f1 & clipping_flags_y_clipped) != 0 && (f1 & clipping_flags_y_clipped) == (f2 & clipping_flags_y_clipped)) + { + // Fully clipped + return 4; + } + + T tx1 = *x1; + T ty1 = *y1; + T tx2 = *x2; + T ty2 = *y2; + if (f1) + { + if (!clip_move_point(tx1, ty1, tx2, ty2, clip_box, x1, y1, f1)) + { + return 4; + } + if (*x1 == *x2 && *y1 == *y2) + { + return 4; + } + ret |= 1; + } + if (f2) + { + if (!clip_move_point(tx1, ty1, tx2, ty2, clip_box, x2, y2, f2)) + { + return 4; + } + if (*x1 == *x2 && *y1 == *y2) + { + return 4; + } + ret |= 2; + } + return ret; +} + +} // namespace agg #endif diff --git a/deps/agg/include/agg_color_gray.h b/deps/agg/include/agg_color_gray.h index bf300b8f1..dbf9a47d7 100644 --- a/deps/agg/include/agg_color_gray.h +++ b/deps/agg/include/agg_color_gray.h @@ -31,21 +31,19 @@ #include "agg_basics.h" #include "agg_color_rgba.h" -namespace agg -{ +namespace agg { //===================================================================gray8 template struct gray8T { - typedef int8u value_type; + typedef int8u value_type; typedef int32u calc_type; - typedef int32 long_type; - enum base_scale_e - { + typedef int32 long_type; + enum base_scale_e { base_shift = 8, base_scale = 1 << base_shift, - base_mask = base_scale - 1, + base_mask = base_scale - 1, base_MSB = 1 << (base_shift - 1) }; typedef gray8T self_type; @@ -105,17 +103,22 @@ struct gray8T gray8T() {} //-------------------------------------------------------------------- - gray8T(unsigned v_, unsigned a_=base_mask) : - v(int8u(v_)), a(int8u(a_)) {} + gray8T(unsigned v_, unsigned a_ = base_mask) + : v(int8u(v_)) + , a(int8u(a_)) + {} //-------------------------------------------------------------------- - gray8T(const self_type& c, unsigned a_) : - v(c.v), a(value_type(a_)) {} + gray8T(const self_type& c, unsigned a_) + : v(c.v) + , a(value_type(a_)) + {} //-------------------------------------------------------------------- - gray8T(const rgba& c) : - v(luminance(c)), - a(value_type(uround(c.a * base_mask))) {} + gray8T(const rgba& c) + : v(luminance(c)) + , a(value_type(uround(c.a * base_mask))) + {} //-------------------------------------------------------------------- template @@ -147,36 +150,18 @@ struct gray8T } //-------------------------------------------------------------------- - rgba8 make_rgba8(const linear&) const - { - return rgba8(v, v, v, a); - } + rgba8 make_rgba8(const linear&) const { return rgba8(v, v, v, a); } - rgba8 make_rgba8(const sRGB&) const - { - return convert_from_sRGB(); - } + rgba8 make_rgba8(const sRGB&) const { return convert_from_sRGB(); } - operator rgba8() const - { - return make_rgba8(Colorspace()); - } + operator rgba8() const { return make_rgba8(Colorspace()); } //-------------------------------------------------------------------- - srgba8 make_srgba8(const linear&) const - { - return convert_to_sRGB(); - } + srgba8 make_srgba8(const linear&) const { return convert_to_sRGB(); } - srgba8 make_srgba8(const sRGB&) const - { - return srgba8(v, v, v, a); - } + srgba8 make_srgba8(const sRGB&) const { return srgba8(v, v, v, a); } - operator srgba8() const - { - return make_rgba8(Colorspace()); - } + operator srgba8() const { return make_rgba8(Colorspace()); } //-------------------------------------------------------------------- rgba16 make_rgba16(const linear&) const @@ -185,15 +170,9 @@ struct gray8T return rgba16(rgb, rgb, rgb, (a << 8) | a); } - rgba16 make_rgba16(const sRGB&) const - { - return convert_from_sRGB(); - } + rgba16 make_rgba16(const sRGB&) const { return convert_from_sRGB(); } - operator rgba16() const - { - return make_rgba16(Colorspace()); - } + operator rgba16() const { return make_rgba16(Colorspace()); } //-------------------------------------------------------------------- rgba32 make_rgba32(const linear&) const @@ -202,51 +181,27 @@ struct gray8T return rgba32(v32, v32, v32, a / 255.0); } - rgba32 make_rgba32(const sRGB&) const - { - return convert_from_sRGB(); - } + rgba32 make_rgba32(const sRGB&) const { return convert_from_sRGB(); } - operator rgba32() const - { - return make_rgba32(Colorspace()); - } + operator rgba32() const { return make_rgba32(Colorspace()); } //-------------------------------------------------------------------- - static AGG_INLINE double to_double(value_type a) - { - return double(a) / base_mask; - } + static AGG_INLINE double to_double(value_type a) { return double(a) / base_mask; } //-------------------------------------------------------------------- - static AGG_INLINE value_type from_double(double a) - { - return value_type(uround(a * base_mask)); - } + static AGG_INLINE value_type from_double(double a) { return value_type(uround(a * base_mask)); } //-------------------------------------------------------------------- - static AGG_INLINE value_type empty_value() - { - return 0; - } + static AGG_INLINE value_type empty_value() { return 0; } //-------------------------------------------------------------------- - static AGG_INLINE value_type full_value() - { - return base_mask; - } + static AGG_INLINE value_type full_value() { return base_mask; } //-------------------------------------------------------------------- - AGG_INLINE bool is_transparent() const - { - return a == 0; - } + AGG_INLINE bool is_transparent() const { return a == 0; } //-------------------------------------------------------------------- - AGG_INLINE bool is_opaque() const - { - return a == base_mask; - } + AGG_INLINE bool is_opaque() const { return a == base_mask; } //-------------------------------------------------------------------- // Fixed-point multiply, exact over int8u. @@ -267,7 +222,8 @@ struct gray8T { return base_mask; } - else return value_type((a * base_mask + (b >> 1)) / b); + else + return value_type((a * base_mask + (b >> 1)) / b); } //-------------------------------------------------------------------- @@ -287,23 +243,14 @@ struct gray8T //-------------------------------------------------------------------- // Fixed-point multiply, exact over int8u. // Specifically for multiplying a color component by a cover. - static AGG_INLINE value_type mult_cover(value_type a, value_type b) - { - return multiply(a, b); - } + static AGG_INLINE value_type mult_cover(value_type a, value_type b) { return multiply(a, b); } //-------------------------------------------------------------------- - static AGG_INLINE cover_type scale_cover(cover_type a, value_type b) - { - return multiply(b, a); - } + static AGG_INLINE cover_type scale_cover(cover_type a, value_type b) { return multiply(b, a); } //-------------------------------------------------------------------- // Interpolate p to q by a, assuming q is premultiplied by a. - static AGG_INLINE value_type prelerp(value_type p, value_type q, value_type a) - { - return p + q - multiply(p, a); - } + static AGG_INLINE value_type prelerp(value_type p, value_type q, value_type a) { return p + q - multiply(p, a); } //-------------------------------------------------------------------- // Interpolate p to q by a. @@ -330,25 +277,27 @@ struct gray8T //-------------------------------------------------------------------- self_type& opacity(double a_) { - if (a_ < 0) a = 0; - else if (a_ > 1) a = 1; - else a = (value_type)uround(a_ * double(base_mask)); + if (a_ < 0) + a = 0; + else if (a_ > 1) + a = 1; + else + a = (value_type)uround(a_ * double(base_mask)); return *this; } //-------------------------------------------------------------------- - double opacity() const - { - return double(a) / double(base_mask); - } + double opacity() const { return double(a) / double(base_mask); } //-------------------------------------------------------------------- self_type& premultiply() { if (a < base_mask) { - if (a == 0) v = 0; - else v = multiply(v, a); + if (a == 0) + v = 0; + else + v = multiply(v, a); } return *this; } @@ -408,24 +357,22 @@ struct gray8T } //-------------------------------------------------------------------- - static self_type no_color() { return self_type(0,0); } + static self_type no_color() { return self_type(0, 0); } }; typedef gray8T gray8; typedef gray8T sgray8; - //==================================================================gray16 struct gray16 { typedef int16u value_type; typedef int32u calc_type; - typedef int64 long_type; - enum base_scale_e - { + typedef int64 long_type; + enum base_scale_e { base_shift = 16, base_scale = 1 << base_shift, - base_mask = base_scale - 1, + base_mask = base_scale - 1, base_MSB = 1 << (base_shift - 1) }; typedef gray16 self_type; @@ -445,67 +392,65 @@ struct gray16 return value_type((13933u * c.r + 46872u * c.g + 4732u * c.b) >> 16); } - static value_type luminance(const rgba8& c) - { - return luminance(rgba16(c)); - } + static value_type luminance(const rgba8& c) { return luminance(rgba16(c)); } - static value_type luminance(const srgba8& c) - { - return luminance(rgba16(c)); - } + static value_type luminance(const srgba8& c) { return luminance(rgba16(c)); } - static value_type luminance(const rgba32& c) - { - return luminance(rgba(c)); - } + static value_type luminance(const rgba32& c) { return luminance(rgba(c)); } //-------------------------------------------------------------------- gray16() {} //-------------------------------------------------------------------- - gray16(unsigned v_, unsigned a_ = base_mask) : - v(int16u(v_)), a(int16u(a_)) {} + gray16(unsigned v_, unsigned a_ = base_mask) + : v(int16u(v_)) + , a(int16u(a_)) + {} //-------------------------------------------------------------------- - gray16(const self_type& c, unsigned a_) : - v(c.v), a(value_type(a_)) {} + gray16(const self_type& c, unsigned a_) + : v(c.v) + , a(value_type(a_)) + {} //-------------------------------------------------------------------- - gray16(const rgba& c) : - v(luminance(c)), - a((value_type)uround(c.a * double(base_mask))) {} + gray16(const rgba& c) + : v(luminance(c)) + , a((value_type)uround(c.a * double(base_mask))) + {} //-------------------------------------------------------------------- - gray16(const rgba8& c) : - v(luminance(c)), - a((value_type(c.a) << 8) | c.a) {} + gray16(const rgba8& c) + : v(luminance(c)) + , a((value_type(c.a) << 8) | c.a) + {} //-------------------------------------------------------------------- - gray16(const srgba8& c) : - v(luminance(c)), - a((value_type(c.a) << 8) | c.a) {} + gray16(const srgba8& c) + : v(luminance(c)) + , a((value_type(c.a) << 8) | c.a) + {} //-------------------------------------------------------------------- - gray16(const rgba16& c) : - v(luminance(c)), - a(c.a) {} + gray16(const rgba16& c) + : v(luminance(c)) + , a(c.a) + {} //-------------------------------------------------------------------- - gray16(const gray8& c) : - v((value_type(c.v) << 8) | c.v), - a((value_type(c.a) << 8) | c.a) {} + gray16(const gray8& c) + : v((value_type(c.v) << 8) | c.v) + , a((value_type(c.a) << 8) | c.a) + {} //-------------------------------------------------------------------- - gray16(const sgray8& c) : - v(sRGB_conv::rgb_from_sRGB(c.v)), - a(sRGB_conv::alpha_from_sRGB(c.a)) {} + gray16(const sgray8& c) + : v(sRGB_conv::rgb_from_sRGB(c.v)) + , a(sRGB_conv::alpha_from_sRGB(c.a)) + {} //-------------------------------------------------------------------- - operator rgba8() const - { - return rgba8(v >> 8, v >> 8, v >> 8, a >> 8); - } + operator rgba8() const { return rgba8(v >> 8, v >> 8, v >> 8, a >> 8); } //-------------------------------------------------------------------- operator srgba8() const @@ -515,60 +460,34 @@ struct gray16 } //-------------------------------------------------------------------- - operator rgba16() const - { - return rgba16(v, v, v, a); - } + operator rgba16() const { return rgba16(v, v, v, a); } //-------------------------------------------------------------------- - operator gray8() const - { - return gray8(v >> 8, a >> 8); - } + operator gray8() const { return gray8(v >> 8, a >> 8); } //-------------------------------------------------------------------- operator sgray8() const { - return sgray8( - sRGB_conv::rgb_to_sRGB(v), - sRGB_conv::alpha_to_sRGB(a)); + return sgray8(sRGB_conv::rgb_to_sRGB(v), sRGB_conv::alpha_to_sRGB(a)); } //-------------------------------------------------------------------- - static AGG_INLINE double to_double(value_type a) - { - return double(a) / base_mask; - } + static AGG_INLINE double to_double(value_type a) { return double(a) / base_mask; } //-------------------------------------------------------------------- - static AGG_INLINE value_type from_double(double a) - { - return value_type(uround(a * base_mask)); - } + static AGG_INLINE value_type from_double(double a) { return value_type(uround(a * base_mask)); } //-------------------------------------------------------------------- - static AGG_INLINE value_type empty_value() - { - return 0; - } + static AGG_INLINE value_type empty_value() { return 0; } //-------------------------------------------------------------------- - static AGG_INLINE value_type full_value() - { - return base_mask; - } + static AGG_INLINE value_type full_value() { return base_mask; } //-------------------------------------------------------------------- - AGG_INLINE bool is_transparent() const - { - return a == 0; - } + AGG_INLINE bool is_transparent() const { return a == 0; } //-------------------------------------------------------------------- - AGG_INLINE bool is_opaque() const - { - return a == base_mask; - } + AGG_INLINE bool is_opaque() const { return a == base_mask; } //-------------------------------------------------------------------- // Fixed-point multiply, exact over int16u. @@ -589,7 +508,8 @@ struct gray16 { return base_mask; } - else return value_type((a * base_mask + (b >> 1)) / b); + else + return value_type((a * base_mask + (b >> 1)) / b); } //-------------------------------------------------------------------- @@ -609,23 +529,14 @@ struct gray16 //-------------------------------------------------------------------- // Fixed-point multiply, almost exact over int16u. // Specifically for multiplying a color component by a cover. - static AGG_INLINE value_type mult_cover(value_type a, cover_type b) - { - return multiply(a, b << 8 | b); - } + static AGG_INLINE value_type mult_cover(value_type a, cover_type b) { return multiply(a, b << 8 | b); } //-------------------------------------------------------------------- - static AGG_INLINE cover_type scale_cover(cover_type a, value_type b) - { - return mult_cover(b, a) >> 8; - } + static AGG_INLINE cover_type scale_cover(cover_type a, value_type b) { return mult_cover(b, a) >> 8; } //-------------------------------------------------------------------- // Interpolate p to q by a, assuming q is premultiplied by a. - static AGG_INLINE value_type prelerp(value_type p, value_type q, value_type a) - { - return p + q - multiply(p, a); - } + static AGG_INLINE value_type prelerp(value_type p, value_type q, value_type a) { return p + q - multiply(p, a); } //-------------------------------------------------------------------- // Interpolate p to q by a. @@ -652,26 +563,27 @@ struct gray16 //-------------------------------------------------------------------- self_type& opacity(double a_) { - if (a_ < 0) a = 0; - else if(a_ > 1) a = 1; - else a = (value_type)uround(a_ * double(base_mask)); + if (a_ < 0) + a = 0; + else if (a_ > 1) + a = 1; + else + a = (value_type)uround(a_ * double(base_mask)); return *this; } //-------------------------------------------------------------------- - double opacity() const - { - return double(a) / double(base_mask); - } - + double opacity() const { return double(a) / double(base_mask); } //-------------------------------------------------------------------- self_type& premultiply() { if (a < base_mask) { - if(a == 0) v = 0; - else v = multiply(v, a); + if (a == 0) + v = 0; + else + v = multiply(v, a); } return *this; } @@ -731,10 +643,9 @@ struct gray16 } //-------------------------------------------------------------------- - static self_type no_color() { return self_type(0,0); } + static self_type no_color() { return self_type(0, 0); } }; - //===================================================================gray32 struct gray32 { @@ -746,11 +657,10 @@ struct gray32 value_type v; value_type a; - enum base_scale_e - { + enum base_scale_e { base_shift = 8, base_scale = 1 << base_shift, - base_mask = base_scale - 1, + base_mask = base_scale - 1, }; // Calculate grayscale value as per ITU-R BT.709. @@ -759,103 +669,92 @@ struct gray32 return value_type(0.2126 * r + 0.7152 * g + 0.0722 * b); } - static value_type luminance(const rgba& c) - { - return luminance(c.r, c.g, c.b); - } + static value_type luminance(const rgba& c) { return luminance(c.r, c.g, c.b); } - static value_type luminance(const rgba32& c) - { - return luminance(c.r, c.g, c.b); - } + static value_type luminance(const rgba32& c) { return luminance(c.r, c.g, c.b); } - static value_type luminance(const rgba8& c) - { - return luminance(c.r / 255.0, c.g / 255.0, c.g / 255.0); - } + static value_type luminance(const rgba8& c) { return luminance(c.r / 255.0, c.g / 255.0, c.g / 255.0); } - static value_type luminance(const rgba16& c) - { - return luminance(c.r / 65535.0, c.g / 65535.0, c.g / 65535.0); - } + static value_type luminance(const rgba16& c) { return luminance(c.r / 65535.0, c.g / 65535.0, c.g / 65535.0); } //-------------------------------------------------------------------- gray32() {} //-------------------------------------------------------------------- - gray32(value_type v_, value_type a_ = 1) : - v(v_), a(a_) {} + gray32(value_type v_, value_type a_ = 1) + : v(v_) + , a(a_) + {} //-------------------------------------------------------------------- - gray32(const self_type& c, value_type a_) : - v(c.v), a(a_) {} + gray32(const self_type& c, value_type a_) + : v(c.v) + , a(a_) + {} //-------------------------------------------------------------------- - gray32(const rgba& c) : - v(luminance(c)), - a(value_type(c.a)) {} + gray32(const rgba& c) + : v(luminance(c)) + , a(value_type(c.a)) + {} //-------------------------------------------------------------------- - gray32(const rgba8& c) : - v(luminance(c)), - a(value_type(c.a / 255.0)) {} + gray32(const rgba8& c) + : v(luminance(c)) + , a(value_type(c.a / 255.0)) + {} //-------------------------------------------------------------------- - gray32(const srgba8& c) : - v(luminance(rgba32(c))), - a(value_type(c.a / 255.0)) {} + gray32(const srgba8& c) + : v(luminance(rgba32(c))) + , a(value_type(c.a / 255.0)) + {} //-------------------------------------------------------------------- - gray32(const rgba16& c) : - v(luminance(c)), - a(value_type(c.a / 65535.0)) {} + gray32(const rgba16& c) + : v(luminance(c)) + , a(value_type(c.a / 65535.0)) + {} //-------------------------------------------------------------------- - gray32(const rgba32& c) : - v(luminance(c)), - a(value_type(c.a)) {} + gray32(const rgba32& c) + : v(luminance(c)) + , a(value_type(c.a)) + {} //-------------------------------------------------------------------- - gray32(const gray8& c) : - v(value_type(c.v / 255.0)), - a(value_type(c.a / 255.0)) {} + gray32(const gray8& c) + : v(value_type(c.v / 255.0)) + , a(value_type(c.a / 255.0)) + {} //-------------------------------------------------------------------- - gray32(const sgray8& c) : - v(sRGB_conv::rgb_from_sRGB(c.v)), - a(sRGB_conv::alpha_from_sRGB(c.a)) {} + gray32(const sgray8& c) + : v(sRGB_conv::rgb_from_sRGB(c.v)) + , a(sRGB_conv::alpha_from_sRGB(c.a)) + {} //-------------------------------------------------------------------- - gray32(const gray16& c) : - v(value_type(c.v / 65535.0)), - a(value_type(c.a / 65535.0)) {} + gray32(const gray16& c) + : v(value_type(c.v / 65535.0)) + , a(value_type(c.a / 65535.0)) + {} //-------------------------------------------------------------------- - operator rgba() const - { - return rgba(v, v, v, a); - } + operator rgba() const { return rgba(v, v, v, a); } //-------------------------------------------------------------------- - operator gray8() const - { - return gray8(uround(v * 255.0), uround(a * 255.0)); - } + operator gray8() const { return gray8(uround(v * 255.0), uround(a * 255.0)); } //-------------------------------------------------------------------- operator sgray8() const { // Return (non-premultiplied) sRGB values. - return sgray8( - sRGB_conv::rgb_to_sRGB(v), - sRGB_conv::alpha_to_sRGB(a)); + return sgray8(sRGB_conv::rgb_to_sRGB(v), sRGB_conv::alpha_to_sRGB(a)); } //-------------------------------------------------------------------- - operator gray16() const - { - return gray16(uround(v * 65535.0), uround(a * 65535.0)); - } + operator gray16() const { return gray16(uround(v * 65535.0), uround(a * 65535.0)); } //-------------------------------------------------------------------- operator rgba8() const @@ -879,58 +778,31 @@ struct gray32 } //-------------------------------------------------------------------- - static AGG_INLINE double to_double(value_type a) - { - return a; - } + static AGG_INLINE double to_double(value_type a) { return a; } //-------------------------------------------------------------------- - static AGG_INLINE value_type from_double(double a) - { - return value_type(a); - } + static AGG_INLINE value_type from_double(double a) { return value_type(a); } //-------------------------------------------------------------------- - static AGG_INLINE value_type empty_value() - { - return 0; - } + static AGG_INLINE value_type empty_value() { return 0; } //-------------------------------------------------------------------- - static AGG_INLINE value_type full_value() - { - return 1; - } + static AGG_INLINE value_type full_value() { return 1; } //-------------------------------------------------------------------- - AGG_INLINE bool is_transparent() const - { - return a <= 0; - } + AGG_INLINE bool is_transparent() const { return a <= 0; } //-------------------------------------------------------------------- - AGG_INLINE bool is_opaque() const - { - return a >= 1; - } + AGG_INLINE bool is_opaque() const { return a >= 1; } //-------------------------------------------------------------------- - static AGG_INLINE value_type invert(value_type x) - { - return 1 - x; - } + static AGG_INLINE value_type invert(value_type x) { return 1 - x; } //-------------------------------------------------------------------- - static AGG_INLINE value_type multiply(value_type a, value_type b) - { - return value_type(a * b); - } + static AGG_INLINE value_type multiply(value_type a, value_type b) { return value_type(a * b); } //-------------------------------------------------------------------- - static AGG_INLINE value_type demultiply(value_type a, value_type b) - { - return (b == 0) ? 0 : value_type(a / b); - } + static AGG_INLINE value_type demultiply(value_type a, value_type b) { return (b == 0) ? 0 : value_type(a / b); } //-------------------------------------------------------------------- template @@ -947,16 +819,10 @@ struct gray32 } //-------------------------------------------------------------------- - static AGG_INLINE value_type mult_cover(value_type a, cover_type b) - { - return value_type(a * b / cover_mask); - } + static AGG_INLINE value_type mult_cover(value_type a, cover_type b) { return value_type(a * b / cover_mask); } //-------------------------------------------------------------------- - static AGG_INLINE cover_type scale_cover(cover_type a, value_type b) - { - return cover_type(uround(a * b)); - } + static AGG_INLINE cover_type scale_cover(cover_type a, value_type b) { return cover_type(uround(a * b)); } //-------------------------------------------------------------------- // Interpolate p to q by a, assuming q is premultiplied by a. @@ -993,49 +859,47 @@ struct gray32 //-------------------------------------------------------------------- self_type& opacity(double a_) { - if (a_ < 0) a = 0; - else if (a_ > 1) a = 1; - else a = value_type(a_); + if (a_ < 0) + a = 0; + else if (a_ > 1) + a = 1; + else + a = value_type(a_); return *this; } //-------------------------------------------------------------------- - double opacity() const - { - return a; - } - + double opacity() const { return a; } //-------------------------------------------------------------------- self_type& premultiply() { - if (a < 0) v = 0; - else if(a < 1) v *= a; + if (a < 0) + v = 0; + else if (a < 1) + v *= a; return *this; } //-------------------------------------------------------------------- self_type& demultiply() { - if (a < 0) v = 0; - else if (a < 1) v /= a; + if (a < 0) + v = 0; + else if (a < 1) + v /= a; return *this; } //-------------------------------------------------------------------- self_type gradient(self_type c, double k) const { - return self_type( - value_type(v + (c.v - v) * k), - value_type(a + (c.a - a) * k)); + return self_type(value_type(v + (c.v - v) * k), value_type(a + (c.a - a) * k)); } //-------------------------------------------------------------------- - static self_type no_color() { return self_type(0,0); } + static self_type no_color() { return self_type(0, 0); } }; -} - - - +} // namespace agg #endif diff --git a/deps/agg/include/agg_color_rgba.h b/deps/agg/include/agg_color_rgba.h index b4e3f76d8..d03fd9f7c 100644 --- a/deps/agg/include/agg_color_rgba.h +++ b/deps/agg/include/agg_color_rgba.h @@ -28,20 +28,39 @@ #include "agg_basics.h" #include "agg_gamma_lut.h" -namespace agg -{ +namespace agg { // Supported byte orders for RGB and RGBA pixel formats //======================================================================= -struct order_rgb { enum rgb_e { R=0, G=1, B=2, rgb_tag, hasAlpha=false }; }; //----order_rgb -struct order_bgr { enum bgr_e { B=0, G=1, R=2, rgb_tag, hasAlpha=false }; }; //----order_bgr -struct order_rgba { enum rgba_e { R=0, G=1, B=2, A=3, rgba_tag, hasAlpha=true }; }; //----order_rgba -struct order_argb { enum argb_e { A=0, R=1, G=2, B=3, rgba_tag, hasAlpha=true }; }; //----order_argb -struct order_abgr { enum abgr_e { A=0, B=1, G=2, R=3, rgba_tag, hasAlpha=true }; }; //----order_abgr -struct order_bgra { enum bgra_e { B=0, G=1, R=2, A=3, rgba_tag, hasAlpha=true }; }; //----order_bgra +struct order_rgb +{ + enum rgb_e { R = 0, G = 1, B = 2, rgb_tag, hasAlpha = false }; +}; //----order_rgb +struct order_bgr +{ + enum bgr_e { B = 0, G = 1, R = 2, rgb_tag, hasAlpha = false }; +}; //----order_bgr +struct order_rgba +{ + enum rgba_e { R = 0, G = 1, B = 2, A = 3, rgba_tag, hasAlpha = true }; +}; //----order_rgba +struct order_argb +{ + enum argb_e { A = 0, R = 1, G = 2, B = 3, rgba_tag, hasAlpha = true }; +}; //----order_argb +struct order_abgr +{ + enum abgr_e { A = 0, B = 1, G = 2, R = 3, rgba_tag, hasAlpha = true }; +}; //----order_abgr +struct order_bgra +{ + enum bgra_e { B = 0, G = 1, R = 2, A = 3, rgba_tag, hasAlpha = true }; +}; //----order_bgra // Colorspace tag types. -struct linear {}; -struct sRGB {}; +struct linear +{}; +struct sRGB +{}; //====================================================================rgba struct rgba @@ -57,11 +76,20 @@ struct rgba rgba() {} //-------------------------------------------------------------------- - rgba(double r_, double g_, double b_, double a_=1.0) : - r(r_), g(g_), b(b_), a(a_) {} + rgba(double r_, double g_, double b_, double a_ = 1.0) + : r(r_) + , g(g_) + , b(b_) + , a(a_) + {} //-------------------------------------------------------------------- - rgba(const rgba& c, double a_) : r(c.r), g(c.g), b(c.b), a(a_) {} + rgba(const rgba& c, double a_) + : r(c.r) + , g(c.g) + , b(c.b) + , a(a_) + {} //-------------------------------------------------------------------- rgba& clear() @@ -80,17 +108,17 @@ struct rgba //-------------------------------------------------------------------- rgba& opacity(double a_) { - if (a_ < 0) a = 0; - else if (a_ > 1) a = 1; - else a = a_; + if (a_ < 0) + a = 0; + else if (a_ > 1) + a = 1; + else + a = a_; return *this; } //-------------------------------------------------------------------- - double opacity() const - { - return a; - } + double opacity() const { return a; } //-------------------------------------------------------------------- rgba& premultiply() @@ -114,7 +142,7 @@ struct rgba r *= a_; g *= a_; b *= a_; - a = a_; + a = a_; } return *this; } @@ -136,7 +164,6 @@ struct rgba return *this; } - //-------------------------------------------------------------------- rgba gradient(rgba c, double k) const { @@ -167,17 +194,13 @@ struct rgba } //-------------------------------------------------------------------- - static rgba no_color() { return rgba(0,0,0,0); } + static rgba no_color() { return rgba(0, 0, 0, 0); } //-------------------------------------------------------------------- static rgba from_wavelength(double wl, double gamma = 1.0); //-------------------------------------------------------------------- - explicit rgba(double wavelen, double gamma=1.0) - { - *this = from_wavelength(wavelen, gamma); - } - + explicit rgba(double wavelen, double gamma = 1.0) { *this = from_wavelength(wavelen, gamma); } }; inline rgba operator+(const rgba& a, const rgba& b) @@ -226,8 +249,10 @@ inline rgba rgba::from_wavelength(double wl, double gamma) } double s = 1.0; - if (wl > 700.0) s = 0.3 + 0.7 * (780.0 - wl) / (780.0 - 700.0); - else if (wl < 420.0) s = 0.3 + 0.7 * (wl - 380.0) / (420.0 - 380.0); + if (wl > 700.0) + s = 0.3 + 0.7 * (780.0 - wl) / (780.0 - 700.0); + else if (wl < 420.0) + s = 0.3 + 0.7 * (wl - 380.0) / (420.0 - 380.0); t.r = pow(t.r * s, gamma); t.g = pow(t.g * s, gamma); @@ -240,24 +265,21 @@ inline rgba rgba_pre(double r, double g, double b, double a) return rgba(r, g, b, a).premultiply(); } - //===================================================================rgba8 template struct rgba8T { - typedef int8u value_type; + typedef int8u value_type; typedef int32u calc_type; - typedef int32 long_type; - enum base_scale_e - { + typedef int32 long_type; + enum base_scale_e { base_shift = 8, base_scale = 1 << base_shift, - base_mask = base_scale - 1, + base_mask = base_scale - 1, base_MSB = 1 << (base_shift - 1) }; typedef rgba8T self_type; - value_type r; value_type g; value_type b; @@ -317,21 +339,23 @@ struct rgba8T rgba8T() {} //-------------------------------------------------------------------- - rgba8T(unsigned r_, unsigned g_, unsigned b_, unsigned a_ = base_mask) : - r(value_type(r_)), - g(value_type(g_)), - b(value_type(b_)), - a(value_type(a_)) {} + rgba8T(unsigned r_, unsigned g_, unsigned b_, unsigned a_ = base_mask) + : r(value_type(r_)) + , g(value_type(g_)) + , b(value_type(b_)) + , a(value_type(a_)) + {} //-------------------------------------------------------------------- - rgba8T(const rgba& c) - { - convert(*this, c); - } + rgba8T(const rgba& c) { convert(*this, c); } //-------------------------------------------------------------------- - rgba8T(const self_type& c, unsigned a_) : - r(c.r), g(c.g), b(c.b), a(value_type(a_)) {} + rgba8T(const self_type& c, unsigned a_) + : r(c.r) + , g(c.g) + , b(c.b) + , a(value_type(a_)) + {} //-------------------------------------------------------------------- template @@ -349,46 +373,25 @@ struct rgba8T } //-------------------------------------------------------------------- - static AGG_INLINE double to_double(value_type a) - { - return double(a) / base_mask; - } + static AGG_INLINE double to_double(value_type a) { return double(a) / base_mask; } //-------------------------------------------------------------------- - static AGG_INLINE value_type from_double(double a) - { - return value_type(uround(a * base_mask)); - } + static AGG_INLINE value_type from_double(double a) { return value_type(uround(a * base_mask)); } //-------------------------------------------------------------------- - static AGG_INLINE value_type empty_value() - { - return 0; - } + static AGG_INLINE value_type empty_value() { return 0; } //-------------------------------------------------------------------- - static AGG_INLINE value_type full_value() - { - return base_mask; - } + static AGG_INLINE value_type full_value() { return base_mask; } //-------------------------------------------------------------------- - AGG_INLINE bool is_transparent() const - { - return a == 0; - } + AGG_INLINE bool is_transparent() const { return a == 0; } //-------------------------------------------------------------------- - AGG_INLINE bool is_opaque() const - { - return a == base_mask; - } + AGG_INLINE bool is_opaque() const { return a == base_mask; } //-------------------------------------------------------------------- - static AGG_INLINE value_type invert(value_type x) - { - return base_mask - x; - } + static AGG_INLINE value_type invert(value_type x) { return base_mask - x; } //-------------------------------------------------------------------- // Fixed-point multiply, exact over int8u. @@ -409,7 +412,8 @@ struct rgba8T { return base_mask; } - else return value_type((a * base_mask + (b >> 1)) / b); + else + return value_type((a * base_mask + (b >> 1)) / b); } //-------------------------------------------------------------------- @@ -429,23 +433,14 @@ struct rgba8T //-------------------------------------------------------------------- // Fixed-point multiply, exact over int8u. // Specifically for multiplying a color component by a cover. - static AGG_INLINE value_type mult_cover(value_type a, cover_type b) - { - return multiply(a, b); - } + static AGG_INLINE value_type mult_cover(value_type a, cover_type b) { return multiply(a, b); } //-------------------------------------------------------------------- - static AGG_INLINE cover_type scale_cover(cover_type a, value_type b) - { - return multiply(b, a); - } + static AGG_INLINE cover_type scale_cover(cover_type a, value_type b) { return multiply(b, a); } //-------------------------------------------------------------------- // Interpolate p to q by a, assuming q is premultiplied by a. - static AGG_INLINE value_type prelerp(value_type p, value_type q, value_type a) - { - return p + q - multiply(p, a); - } + static AGG_INLINE value_type prelerp(value_type p, value_type q, value_type a) { return p + q - multiply(p, a); } //-------------------------------------------------------------------- // Interpolate p to q by a. @@ -472,17 +467,17 @@ struct rgba8T //-------------------------------------------------------------------- self_type& opacity(double a_) { - if (a_ < 0) a = 0; - else if (a_ > 1) a = 1; - else a = (value_type)uround(a_ * double(base_mask)); + if (a_ < 0) + a = 0; + else if (a_ > 1) + a = 1; + else + a = (value_type)uround(a_ * double(base_mask)); return *this; } //-------------------------------------------------------------------- - double opacity() const - { - return double(a) / double(base_mask); - } + double opacity() const { return double(a) / double(base_mask); } //-------------------------------------------------------------------- AGG_INLINE self_type& premultiply() @@ -604,7 +599,7 @@ struct rgba8T } //-------------------------------------------------------------------- - static self_type no_color() { return self_type(0,0,0,0); } + static self_type no_color() { return self_type(0, 0, 0, 0); } //-------------------------------------------------------------------- static self_type from_wavelength(double wl, double gamma = 1.0) @@ -617,10 +612,9 @@ typedef rgba8T rgba8; typedef rgba8T srgba8; //-------------------------------------------------------------rgba8_pre -inline rgba8 rgba8_pre(unsigned r, unsigned g, unsigned b, - unsigned a = rgba8::base_mask) +inline rgba8 rgba8_pre(unsigned r, unsigned g, unsigned b, unsigned a = rgba8::base_mask) { - return rgba8(r,g,b,a).premultiply(); + return rgba8(r, g, b, a).premultiply(); } inline rgba8 rgba8_pre(const rgba8& c) { @@ -628,7 +622,7 @@ inline rgba8 rgba8_pre(const rgba8& c) } inline rgba8 rgba8_pre(const rgba8& c, unsigned a) { - return rgba8(c,a).premultiply(); + return rgba8(c, a).premultiply(); } inline rgba8 rgba8_pre(const rgba& c) { @@ -636,12 +630,9 @@ inline rgba8 rgba8_pre(const rgba& c) } inline rgba8 rgba8_pre(const rgba& c, double a) { - return rgba8(c,a).premultiply(); + return rgba8(c, a).premultiply(); } - - - //-------------------------------------------------------------rgb8_packed inline rgba8 rgb8_packed(unsigned v) { @@ -674,19 +665,16 @@ rgba8 rgba8_gamma_inv(rgba8 c, const GammaLUT& gamma) return rgba8(gamma.inv(c.r), gamma.inv(c.g), gamma.inv(c.b), c.a); } - - //==================================================================rgba16 struct rgba16 { typedef int16u value_type; typedef int32u calc_type; - typedef int64 long_type; - enum base_scale_e - { + typedef int64 long_type; + enum base_scale_e { base_shift = 16, base_scale = 1 << base_shift, - base_mask = base_scale - 1, + base_mask = base_scale - 1, base_MSB = 1 << (base_shift - 1) }; typedef rgba16 self_type; @@ -700,105 +688,81 @@ struct rgba16 rgba16() {} //-------------------------------------------------------------------- - rgba16(unsigned r_, unsigned g_, unsigned b_, unsigned a_=base_mask) : - r(value_type(r_)), - g(value_type(g_)), - b(value_type(b_)), - a(value_type(a_)) {} + rgba16(unsigned r_, unsigned g_, unsigned b_, unsigned a_ = base_mask) + : r(value_type(r_)) + , g(value_type(g_)) + , b(value_type(b_)) + , a(value_type(a_)) + {} //-------------------------------------------------------------------- - rgba16(const self_type& c, unsigned a_) : - r(c.r), g(c.g), b(c.b), a(value_type(a_)) {} + rgba16(const self_type& c, unsigned a_) + : r(c.r) + , g(c.g) + , b(c.b) + , a(value_type(a_)) + {} //-------------------------------------------------------------------- - rgba16(const rgba& c) : - r((value_type)uround(c.r * double(base_mask))), - g((value_type)uround(c.g * double(base_mask))), - b((value_type)uround(c.b * double(base_mask))), - a((value_type)uround(c.a * double(base_mask))) {} + rgba16(const rgba& c) + : r((value_type)uround(c.r * double(base_mask))) + , g((value_type)uround(c.g * double(base_mask))) + , b((value_type)uround(c.b * double(base_mask))) + , a((value_type)uround(c.a * double(base_mask))) + {} //-------------------------------------------------------------------- - rgba16(const rgba8& c) : - r(value_type((value_type(c.r) << 8) | c.r)), - g(value_type((value_type(c.g) << 8) | c.g)), - b(value_type((value_type(c.b) << 8) | c.b)), - a(value_type((value_type(c.a) << 8) | c.a)) {} + rgba16(const rgba8& c) + : r(value_type((value_type(c.r) << 8) | c.r)) + , g(value_type((value_type(c.g) << 8) | c.g)) + , b(value_type((value_type(c.b) << 8) | c.b)) + , a(value_type((value_type(c.a) << 8) | c.a)) + {} //-------------------------------------------------------------------- - rgba16(const srgba8& c) : - r(sRGB_conv::rgb_from_sRGB(c.r)), - g(sRGB_conv::rgb_from_sRGB(c.g)), - b(sRGB_conv::rgb_from_sRGB(c.b)), - a(sRGB_conv::alpha_from_sRGB(c.a)) {} + rgba16(const srgba8& c) + : r(sRGB_conv::rgb_from_sRGB(c.r)) + , g(sRGB_conv::rgb_from_sRGB(c.g)) + , b(sRGB_conv::rgb_from_sRGB(c.b)) + , a(sRGB_conv::alpha_from_sRGB(c.a)) + {} //-------------------------------------------------------------------- - operator rgba() const - { - return rgba( - r / 65535.0, - g / 65535.0, - b / 65535.0, - a / 65535.0); - } + operator rgba() const { return rgba(r / 65535.0, g / 65535.0, b / 65535.0, a / 65535.0); } //-------------------------------------------------------------------- - operator rgba8() const - { - return rgba8(r >> 8, g >> 8, b >> 8, a >> 8); - } + operator rgba8() const { return rgba8(r >> 8, g >> 8, b >> 8, a >> 8); } //-------------------------------------------------------------------- operator srgba8() const { // Return (non-premultiplied) sRGB values. - return srgba8( - sRGB_conv::rgb_to_sRGB(r), - sRGB_conv::rgb_to_sRGB(g), - sRGB_conv::rgb_to_sRGB(b), - sRGB_conv::alpha_to_sRGB(a)); + return srgba8(sRGB_conv::rgb_to_sRGB(r), + sRGB_conv::rgb_to_sRGB(g), + sRGB_conv::rgb_to_sRGB(b), + sRGB_conv::alpha_to_sRGB(a)); } //-------------------------------------------------------------------- - static AGG_INLINE double to_double(value_type a) - { - return double(a) / base_mask; - } + static AGG_INLINE double to_double(value_type a) { return double(a) / base_mask; } //-------------------------------------------------------------------- - static AGG_INLINE value_type from_double(double a) - { - return value_type(uround(a * base_mask)); - } + static AGG_INLINE value_type from_double(double a) { return value_type(uround(a * base_mask)); } //-------------------------------------------------------------------- - static AGG_INLINE value_type empty_value() - { - return 0; - } + static AGG_INLINE value_type empty_value() { return 0; } //-------------------------------------------------------------------- - static AGG_INLINE value_type full_value() - { - return base_mask; - } + static AGG_INLINE value_type full_value() { return base_mask; } //-------------------------------------------------------------------- - AGG_INLINE bool is_transparent() const - { - return a == 0; - } + AGG_INLINE bool is_transparent() const { return a == 0; } //-------------------------------------------------------------------- - AGG_INLINE bool is_opaque() const - { - return a == base_mask; - } + AGG_INLINE bool is_opaque() const { return a == base_mask; } //-------------------------------------------------------------------- - static AGG_INLINE value_type invert(value_type x) - { - return base_mask - x; - } + static AGG_INLINE value_type invert(value_type x) { return base_mask - x; } //-------------------------------------------------------------------- // Fixed-point multiply, exact over int16u. @@ -819,7 +783,8 @@ struct rgba16 { return base_mask; } - else return value_type((a * base_mask + (b >> 1)) / b); + else + return value_type((a * base_mask + (b >> 1)) / b); } //-------------------------------------------------------------------- @@ -839,23 +804,14 @@ struct rgba16 //-------------------------------------------------------------------- // Fixed-point multiply, almost exact over int16u. // Specifically for multiplying a color component by a cover. - static AGG_INLINE value_type mult_cover(value_type a, cover_type b) - { - return multiply(a, (b << 8) | b); - } + static AGG_INLINE value_type mult_cover(value_type a, cover_type b) { return multiply(a, (b << 8) | b); } //-------------------------------------------------------------------- - static AGG_INLINE cover_type scale_cover(cover_type a, value_type b) - { - return multiply((a << 8) | a, b) >> 8; - } + static AGG_INLINE cover_type scale_cover(cover_type a, value_type b) { return multiply((a << 8) | a, b) >> 8; } //-------------------------------------------------------------------- // Interpolate p to q by a, assuming q is premultiplied by a. - static AGG_INLINE value_type prelerp(value_type p, value_type q, value_type a) - { - return p + q - multiply(p, a); - } + static AGG_INLINE value_type prelerp(value_type p, value_type q, value_type a) { return p + q - multiply(p, a); } //-------------------------------------------------------------------- // Interpolate p to q by a. @@ -882,17 +838,16 @@ struct rgba16 //-------------------------------------------------------------------- AGG_INLINE self_type& opacity(double a_) { - if (a_ < 0) a = 0; - if (a_ > 1) a = 1; + if (a_ < 0) + a = 0; + if (a_ > 1) + a = 1; a = value_type(uround(a_ * double(base_mask))); return *this; } //-------------------------------------------------------------------- - double opacity() const - { - return double(a) / double(base_mask); - } + double opacity() const { return double(a) / double(base_mask); } //-------------------------------------------------------------------- AGG_INLINE self_type& premultiply() @@ -1014,7 +969,7 @@ struct rgba16 } //-------------------------------------------------------------------- - static self_type no_color() { return self_type(0,0,0,0); } + static self_type no_color() { return self_type(0, 0, 0, 0); } //-------------------------------------------------------------------- static self_type from_wavelength(double wl, double gamma = 1.0) @@ -1023,7 +978,6 @@ struct rgba16 } }; - //------------------------------------------------------rgba16_gamma_dir template rgba16 rgba16_gamma_dir(rgba16 c, const GammaLUT& gamma) @@ -1055,127 +1009,100 @@ struct rgba32 rgba32() {} //-------------------------------------------------------------------- - rgba32(value_type r_, value_type g_, value_type b_, value_type a_= 1) : - r(r_), g(g_), b(b_), a(a_) {} + rgba32(value_type r_, value_type g_, value_type b_, value_type a_ = 1) + : r(r_) + , g(g_) + , b(b_) + , a(a_) + {} //-------------------------------------------------------------------- - rgba32(const self_type& c, float a_) : - r(c.r), g(c.g), b(c.b), a(a_) {} + rgba32(const self_type& c, float a_) + : r(c.r) + , g(c.g) + , b(c.b) + , a(a_) + {} //-------------------------------------------------------------------- - rgba32(const rgba& c) : - r(value_type(c.r)), g(value_type(c.g)), b(value_type(c.b)), a(value_type(c.a)) {} + rgba32(const rgba& c) + : r(value_type(c.r)) + , g(value_type(c.g)) + , b(value_type(c.b)) + , a(value_type(c.a)) + {} //-------------------------------------------------------------------- - rgba32(const rgba8& c) : - r(value_type(c.r / 255.0)), - g(value_type(c.g / 255.0)), - b(value_type(c.b / 255.0)), - a(value_type(c.a / 255.0)) {} + rgba32(const rgba8& c) + : r(value_type(c.r / 255.0)) + , g(value_type(c.g / 255.0)) + , b(value_type(c.b / 255.0)) + , a(value_type(c.a / 255.0)) + {} //-------------------------------------------------------------------- - rgba32(const srgba8& c) : - r(sRGB_conv::rgb_from_sRGB(c.r)), - g(sRGB_conv::rgb_from_sRGB(c.g)), - b(sRGB_conv::rgb_from_sRGB(c.b)), - a(sRGB_conv::alpha_from_sRGB(c.a)) {} + rgba32(const srgba8& c) + : r(sRGB_conv::rgb_from_sRGB(c.r)) + , g(sRGB_conv::rgb_from_sRGB(c.g)) + , b(sRGB_conv::rgb_from_sRGB(c.b)) + , a(sRGB_conv::alpha_from_sRGB(c.a)) + {} //-------------------------------------------------------------------- - rgba32(const rgba16& c) : - r(value_type(c.r / 65535.0)), - g(value_type(c.g / 65535.0)), - b(value_type(c.b / 65535.0)), - a(value_type(c.a / 65535.0)) {} + rgba32(const rgba16& c) + : r(value_type(c.r / 65535.0)) + , g(value_type(c.g / 65535.0)) + , b(value_type(c.b / 65535.0)) + , a(value_type(c.a / 65535.0)) + {} //-------------------------------------------------------------------- - operator rgba() const - { - return rgba(r, g, b, a); - } + operator rgba() const { return rgba(r, g, b, a); } //-------------------------------------------------------------------- - operator rgba8() const - { - return rgba8( - uround(r * 255.0), - uround(g * 255.0), - uround(b * 255.0), - uround(a * 255.0)); - } + operator rgba8() const { return rgba8(uround(r * 255.0), uround(g * 255.0), uround(b * 255.0), uround(a * 255.0)); } //-------------------------------------------------------------------- operator srgba8() const { - return srgba8( - sRGB_conv::rgb_to_sRGB(r), - sRGB_conv::rgb_to_sRGB(g), - sRGB_conv::rgb_to_sRGB(b), - sRGB_conv::alpha_to_sRGB(a)); + return srgba8(sRGB_conv::rgb_to_sRGB(r), + sRGB_conv::rgb_to_sRGB(g), + sRGB_conv::rgb_to_sRGB(b), + sRGB_conv::alpha_to_sRGB(a)); } //-------------------------------------------------------------------- operator rgba16() const { - return rgba8( - uround(r * 65535.0), - uround(g * 65535.0), - uround(b * 65535.0), - uround(a * 65535.0)); + return rgba8(uround(r * 65535.0), uround(g * 65535.0), uround(b * 65535.0), uround(a * 65535.0)); } //-------------------------------------------------------------------- - static AGG_INLINE double to_double(value_type a) - { - return a; - } + static AGG_INLINE double to_double(value_type a) { return a; } //-------------------------------------------------------------------- - static AGG_INLINE value_type from_double(double a) - { - return value_type(a); - } + static AGG_INLINE value_type from_double(double a) { return value_type(a); } //-------------------------------------------------------------------- - static AGG_INLINE value_type empty_value() - { - return 0; - } + static AGG_INLINE value_type empty_value() { return 0; } //-------------------------------------------------------------------- - static AGG_INLINE value_type full_value() - { - return 1; - } + static AGG_INLINE value_type full_value() { return 1; } //-------------------------------------------------------------------- - AGG_INLINE bool is_transparent() const - { - return a <= 0; - } + AGG_INLINE bool is_transparent() const { return a <= 0; } //-------------------------------------------------------------------- - AGG_INLINE bool is_opaque() const - { - return a >= 1; - } + AGG_INLINE bool is_opaque() const { return a >= 1; } //-------------------------------------------------------------------- - static AGG_INLINE value_type invert(value_type x) - { - return 1 - x; - } + static AGG_INLINE value_type invert(value_type x) { return 1 - x; } //-------------------------------------------------------------------- - static AGG_INLINE value_type multiply(value_type a, value_type b) - { - return value_type(a * b); - } + static AGG_INLINE value_type multiply(value_type a, value_type b) { return value_type(a * b); } //-------------------------------------------------------------------- - static AGG_INLINE value_type demultiply(value_type a, value_type b) - { - return (b == 0) ? 0 : value_type(a / b); - } + static AGG_INLINE value_type demultiply(value_type a, value_type b) { return (b == 0) ? 0 : value_type(a / b); } //-------------------------------------------------------------------- template @@ -1192,16 +1119,10 @@ struct rgba32 } //-------------------------------------------------------------------- - static AGG_INLINE value_type mult_cover(value_type a, cover_type b) - { - return value_type(a * b / cover_mask); - } + static AGG_INLINE value_type mult_cover(value_type a, cover_type b) { return value_type(a * b / cover_mask); } //-------------------------------------------------------------------- - static AGG_INLINE cover_type scale_cover(cover_type a, value_type b) - { - return cover_type(uround(a * b)); - } + static AGG_INLINE cover_type scale_cover(cover_type a, value_type b) { return cover_type(uround(a * b)); } //-------------------------------------------------------------------- // Interpolate p to q by a, assuming q is premultiplied by a. @@ -1238,17 +1159,17 @@ struct rgba32 //-------------------------------------------------------------------- AGG_INLINE self_type& opacity(double a_) { - if (a_ < 0) a = 0; - else if (a_ > 1) a = 1; - else a = value_type(a_); + if (a_ < 0) + a = 0; + else if (a_ > 1) + a = 1; + else + a = value_type(a_); return *this; } //-------------------------------------------------------------------- - double opacity() const - { - return a; - } + double opacity() const { return a; } //-------------------------------------------------------------------- AGG_INLINE self_type& premultiply() @@ -1324,10 +1245,14 @@ struct rgba32 b += mult_cover(c.b, cover); a += mult_cover(c.a, cover); } - if (a > 1) a = 1; - if (r > a) r = a; - if (g > a) g = a; - if (b > a) b = a; + if (a > 1) + a = 1; + if (r > a) + r = a; + if (g > a) + g = a; + if (b > a) + b = a; } //-------------------------------------------------------------------- @@ -1349,7 +1274,7 @@ struct rgba32 } //-------------------------------------------------------------------- - static self_type no_color() { return self_type(0,0,0,0); } + static self_type no_color() { return self_type(0, 0, 0, 0); } //-------------------------------------------------------------------- static self_type from_wavelength(double wl, double gamma = 1) @@ -1357,8 +1282,6 @@ struct rgba32 return self_type(rgba::from_wavelength(wl, gamma)); } }; -} - - +} // namespace agg #endif diff --git a/deps/agg/include/agg_config.h b/deps/agg/include/agg_config.h index 4babdcf22..7a2a2e080 100644 --- a/deps/agg/include/agg_config.h +++ b/deps/agg/include/agg_config.h @@ -5,7 +5,7 @@ //--------------------------------------- // 1. Default basic types such as: -// +// // AGG_INT8 // AGG_INT8U // AGG_INT16 @@ -15,7 +15,7 @@ // AGG_INT64 // AGG_INT64U // -// Just replace this file with new defines if necessary. +// Just replace this file with new defines if necessary. // For example, if your compiler doesn't have a 64 bit integer type // you can still use AGG if you define the follows: // @@ -23,22 +23,21 @@ // #define AGG_INT64U unsigned // // It will result in overflow in 16 bit-per-component image/pattern resampling -// but it won't result any crash and the rest of the library will remain +// but it won't result any crash and the rest of the library will remain // fully functional. - //--------------------------------------- // 2. Default rendering_buffer type. Can be: // -// Provides faster access for massive pixel operations, +// Provides faster access for massive pixel operations, // such as blur, image filtering: #define AGG_RENDERING_BUFFER row_ptr_cache -// +// // Provides cheaper creation and destruction (no mem allocs): // #define AGG_RENDERING_BUFFER row_accessor // -// You can still use both of them simultaneouslyin your applications +// You can still use both of them simultaneouslyin your applications // This #define is used only for default rendering_buffer type, // in short hand typedefs like pixfmt_rgba32. diff --git a/deps/agg/include/agg_conv_adaptor_vcgen.h b/deps/agg/include/agg_conv_adaptor_vcgen.h index 91a076e26..2269c2bb5 100644 --- a/deps/agg/include/agg_conv_adaptor_vcgen.h +++ b/deps/agg/include/agg_conv_adaptor_vcgen.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -18,106 +18,95 @@ #include "agg_basics.h" -namespace agg +namespace agg { +//------------------------------------------------------------null_markers +struct null_markers { - //------------------------------------------------------------null_markers - struct null_markers + void remove_all() {} + void add_vertex(double, double, unsigned) {} + void prepare_src() {} + + void rewind(unsigned) {} + unsigned vertex(double*, double*) { return path_cmd_stop; } + unsigned type() const { return 0; } +}; + +//------------------------------------------------------conv_adaptor_vcgen +template +class conv_adaptor_vcgen +{ + enum status { initial, accumulate, generate }; + + public: + explicit conv_adaptor_vcgen(VertexSource& source) + : m_source(&source) + , m_status(initial) + {} + + conv_adaptor_vcgen(conv_adaptor_vcgen&&) = default; + + void attach(VertexSource& source) { m_source = &source; } + + Generator& generator() { return m_generator; } + const Generator& generator() const { return m_generator; } + + Markers& markers() { return m_markers; } + const Markers& markers() const { return m_markers; } + + void rewind(unsigned path_id) { - void remove_all() {} - void add_vertex(double, double, unsigned) {} - void prepare_src() {} + m_source->rewind(path_id); + m_status = initial; + } - void rewind(unsigned) {} - unsigned vertex(double*, double*) { return path_cmd_stop; } - unsigned type() const { return 0; } - }; + unsigned vertex(double* x, double* y); + unsigned type() const { return m_source->type(); } + private: + // Prohibit copying + conv_adaptor_vcgen(const conv_adaptor_vcgen&); + const conv_adaptor_vcgen& + operator=(const conv_adaptor_vcgen&); - //------------------------------------------------------conv_adaptor_vcgen - template class conv_adaptor_vcgen + VertexSource* m_source; + Generator m_generator; + Markers m_markers; + status m_status; + unsigned m_last_cmd; + double m_start_x; + double m_start_y; +}; + +//------------------------------------------------------------------------ +template +unsigned conv_adaptor_vcgen::vertex(double* x, double* y) +{ + unsigned cmd = path_cmd_stop; + bool done = false; + while (!done) { - enum status + switch (m_status) { - initial, - accumulate, - generate - }; - - public: - explicit conv_adaptor_vcgen(VertexSource& source) : - m_source(&source), - m_status(initial) - {} - - conv_adaptor_vcgen(conv_adaptor_vcgen &&) = default; - - void attach(VertexSource& source) { m_source = &source; } - - Generator& generator() { return m_generator; } - const Generator& generator() const { return m_generator; } - - Markers& markers() { return m_markers; } - const Markers& markers() const { return m_markers; } - - void rewind(unsigned path_id) - { - m_source->rewind(path_id); - m_status = initial; - } - - unsigned vertex(double* x, double* y); - unsigned type() const { return m_source->type(); } - - private: - // Prohibit copying - conv_adaptor_vcgen(const conv_adaptor_vcgen&); - const conv_adaptor_vcgen& - operator = (const conv_adaptor_vcgen&); - - VertexSource* m_source; - Generator m_generator; - Markers m_markers; - status m_status; - unsigned m_last_cmd; - double m_start_x; - double m_start_y; - }; - - - - - - //------------------------------------------------------------------------ - template - unsigned conv_adaptor_vcgen::vertex(double* x, double* y) - { - unsigned cmd = path_cmd_stop; - bool done = false; - while(!done) - { - switch(m_status) - { case initial: m_markers.remove_all(); m_last_cmd = m_source->vertex(&m_start_x, &m_start_y); m_status = accumulate; case accumulate: - if(is_stop(m_last_cmd)) return path_cmd_stop; + if (is_stop(m_last_cmd)) + return path_cmd_stop; m_generator.remove_all(); m_generator.add_vertex(m_start_x, m_start_y, path_cmd_move_to); m_markers.add_vertex(m_start_x, m_start_y, path_cmd_move_to); - for(;;) + for (;;) { cmd = m_source->vertex(x, y); - if(is_vertex(cmd)) + if (is_vertex(cmd)) { m_last_cmd = cmd; - if(is_move_to(cmd)) + if (is_move_to(cmd)) { m_start_x = *x; m_start_y = *y; @@ -128,12 +117,12 @@ namespace agg } else { - if(is_stop(cmd)) + if (is_stop(cmd)) { m_last_cmd = path_cmd_stop; break; } - if(is_end_poly(cmd)) + if (is_end_poly(cmd)) { m_generator.add_vertex(*x, *y, cmd); break; @@ -145,18 +134,18 @@ namespace agg case generate: cmd = m_generator.vertex(x, y); - if(is_stop(cmd)) + if (is_stop(cmd)) { m_status = accumulate; break; } done = true; break; - } } - return cmd; } - + return cmd; } +} // namespace agg + #endif diff --git a/deps/agg/include/agg_conv_adaptor_vpgen.h b/deps/agg/include/agg_conv_adaptor_vpgen.h index ae8d59320..cba24de5f 100644 --- a/deps/agg/include/agg_conv_adaptor_vpgen.h +++ b/deps/agg/include/agg_conv_adaptor_vpgen.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -18,143 +18,140 @@ #include "agg_basics.h" -namespace agg +namespace agg { + +//======================================================conv_adaptor_vpgen +template +class conv_adaptor_vpgen { + public: + explicit conv_adaptor_vpgen(VertexSource& source) + : m_source(&source) + {} + void attach(VertexSource& source) { m_source = &source; } - //======================================================conv_adaptor_vpgen - template class conv_adaptor_vpgen + VPGen& vpgen() { return m_vpgen; } + const VPGen& vpgen() const { return m_vpgen; } + + void rewind(unsigned path_id); + unsigned vertex(double* x, double* y); + unsigned type() const { return m_source->type(); } + + private: + conv_adaptor_vpgen(const conv_adaptor_vpgen&); + const conv_adaptor_vpgen& operator=(const conv_adaptor_vpgen&); + + VertexSource* m_source; + VPGen m_vpgen; + double m_start_x; + double m_start_y; + unsigned m_poly_flags; + int m_vertices; +}; + +//------------------------------------------------------------------------ +template +void conv_adaptor_vpgen::rewind(unsigned path_id) +{ + m_source->rewind(path_id); + m_vpgen.reset(); + m_start_x = 0; + m_start_y = 0; + m_poly_flags = 0; + m_vertices = 0; +} + +//------------------------------------------------------------------------ +template +unsigned conv_adaptor_vpgen::vertex(double* x, double* y) +{ + unsigned cmd = path_cmd_stop; + for (;;) { - public: - explicit conv_adaptor_vpgen(VertexSource& source) : m_source(&source) {} - void attach(VertexSource& source) { m_source = &source; } + cmd = m_vpgen.vertex(x, y); + if (!is_stop(cmd)) + break; - VPGen& vpgen() { return m_vpgen; } - const VPGen& vpgen() const { return m_vpgen; } - - void rewind(unsigned path_id); - unsigned vertex(double* x, double* y); - unsigned type() const { return m_source->type(); } - - private: - conv_adaptor_vpgen(const conv_adaptor_vpgen&); - const conv_adaptor_vpgen& - operator = (const conv_adaptor_vpgen&); - - VertexSource* m_source; - VPGen m_vpgen; - double m_start_x; - double m_start_y; - unsigned m_poly_flags; - int m_vertices; - }; - - - - //------------------------------------------------------------------------ - template - void conv_adaptor_vpgen::rewind(unsigned path_id) - { - m_source->rewind(path_id); - m_vpgen.reset(); - m_start_x = 0; - m_start_y = 0; - m_poly_flags = 0; - m_vertices = 0; - } - - - //------------------------------------------------------------------------ - template - unsigned conv_adaptor_vpgen::vertex(double* x, double* y) - { - unsigned cmd = path_cmd_stop; - for(;;) + if (m_poly_flags && !m_vpgen.auto_unclose()) { - cmd = m_vpgen.vertex(x, y); - if(!is_stop(cmd)) break; + *x = 0.0; + *y = 0.0; + cmd = m_poly_flags; + m_poly_flags = 0; + break; + } - if(m_poly_flags && !m_vpgen.auto_unclose()) + if (m_vertices < 0) + { + if (m_vertices < -1) { - *x = 0.0; - *y = 0.0; - cmd = m_poly_flags; - m_poly_flags = 0; - break; + m_vertices = 0; + return path_cmd_stop; } + m_vpgen.move_to(m_start_x, m_start_y); + m_vertices = 1; + continue; + } - if(m_vertices < 0) + double tx, ty; + cmd = m_source->vertex(&tx, &ty); + if (is_vertex(cmd)) + { + if (is_move_to(cmd)) { - if(m_vertices < -1) + if (m_vpgen.auto_close() && m_vertices > 2) { - m_vertices = 0; - return path_cmd_stop; + m_vpgen.line_to(m_start_x, m_start_y); + m_poly_flags = path_cmd_end_poly | path_flags_close; + m_start_x = tx; + m_start_y = ty; + m_vertices = -1; + continue; } - m_vpgen.move_to(m_start_x, m_start_y); + m_vpgen.move_to(tx, ty); + m_start_x = tx; + m_start_y = ty; m_vertices = 1; - continue; } - - double tx, ty; - cmd = m_source->vertex(&tx, &ty); - if(is_vertex(cmd)) + else { - if(is_move_to(cmd)) + m_vpgen.line_to(tx, ty); + ++m_vertices; + } + } + else + { + if (is_end_poly(cmd)) + { + m_poly_flags = cmd; + if (is_closed(cmd) || m_vpgen.auto_close()) { - if(m_vpgen.auto_close() && m_vertices > 2) + if (m_vpgen.auto_close()) + m_poly_flags |= path_flags_close; + if (m_vertices > 2) { m_vpgen.line_to(m_start_x, m_start_y); - m_poly_flags = path_cmd_end_poly | path_flags_close; - m_start_x = tx; - m_start_y = ty; - m_vertices = -1; - continue; } - m_vpgen.move_to(tx, ty); - m_start_x = tx; - m_start_y = ty; - m_vertices = 1; - } - else - { - m_vpgen.line_to(tx, ty); - ++m_vertices; + m_vertices = 0; } } else { - if(is_end_poly(cmd)) + // path_cmd_stop + if (m_vpgen.auto_close() && m_vertices > 2) { - m_poly_flags = cmd; - if(is_closed(cmd) || m_vpgen.auto_close()) - { - if(m_vpgen.auto_close()) m_poly_flags |= path_flags_close; - if(m_vertices > 2) - { - m_vpgen.line_to(m_start_x, m_start_y); - } - m_vertices = 0; - } - } - else - { - // path_cmd_stop - if(m_vpgen.auto_close() && m_vertices > 2) - { - m_vpgen.line_to(m_start_x, m_start_y); - m_poly_flags = path_cmd_end_poly | path_flags_close; - m_vertices = -2; - continue; - } - break; + m_vpgen.line_to(m_start_x, m_start_y); + m_poly_flags = path_cmd_end_poly | path_flags_close; + m_vertices = -2; + continue; } + break; } } - return cmd; } - - + return cmd; } +} // namespace agg #endif - diff --git a/deps/agg/include/agg_conv_bspline.h b/deps/agg/include/agg_conv_bspline.h index 13d22d929..ba0c93b87 100644 --- a/deps/agg/include/agg_conv_bspline.h +++ b/deps/agg/include/agg_conv_bspline.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -19,30 +19,26 @@ #include "agg_vcgen_bspline.h" #include "agg_conv_adaptor_vcgen.h" +namespace agg { -namespace agg +//---------------------------------------------------------conv_bspline +template +struct conv_bspline : public conv_adaptor_vcgen { + typedef conv_adaptor_vcgen base_type; - //---------------------------------------------------------conv_bspline - template - struct conv_bspline : public conv_adaptor_vcgen - { - typedef conv_adaptor_vcgen base_type; + conv_bspline(VertexSource& vs) + : conv_adaptor_vcgen(vs) + {} - conv_bspline(VertexSource& vs) : - conv_adaptor_vcgen(vs) {} + void interpolation_step(double v) { base_type::generator().interpolation_step(v); } + double interpolation_step() const { return base_type::generator().interpolation_step(); } - void interpolation_step(double v) { base_type::generator().interpolation_step(v); } - double interpolation_step() const { return base_type::generator().interpolation_step(); } - - private: - conv_bspline(const conv_bspline&); - const conv_bspline& - operator = (const conv_bspline&); - }; - -} + private: + conv_bspline(const conv_bspline&); + const conv_bspline& operator=(const conv_bspline&); +}; +} // namespace agg #endif - diff --git a/deps/agg/include/agg_conv_clip_polygon.h b/deps/agg/include/agg_conv_clip_polygon.h index a7e28db87..48f81838a 100644 --- a/deps/agg/include/agg_conv_clip_polygon.h +++ b/deps/agg/include/agg_conv_clip_polygon.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -14,12 +14,12 @@ //---------------------------------------------------------------------------- // // Polygon clipping converter -// There an optimized Liang-Basky algorithm is used. +// There an optimized Liang-Basky algorithm is used. // The algorithm doesn't optimize the degenerate edges, i.e. it will never -// break a closed polygon into two or more ones, instead, there will be +// break a closed polygon into two or more ones, instead, there will be // degenerate edges coinciding with the respective clipping boundaries. -// This is a sub-optimal solution, because that optimization would require -// extra, rather expensive math while the rasterizer tolerates it quite well, +// This is a sub-optimal solution, because that optimization would require +// extra, rather expensive math while the rasterizer tolerates it quite well, // without any considerable overhead. // //---------------------------------------------------------------------------- @@ -30,35 +30,31 @@ #include "agg_conv_adaptor_vpgen.h" #include "agg_vpgen_clip_polygon.h" -namespace agg +namespace agg { + +//=======================================================conv_clip_polygon +template +struct conv_clip_polygon : public conv_adaptor_vpgen { + typedef conv_adaptor_vpgen base_type; - //=======================================================conv_clip_polygon - template - struct conv_clip_polygon : public conv_adaptor_vpgen - { - typedef conv_adaptor_vpgen base_type; + conv_clip_polygon(VertexSource& vs) + : conv_adaptor_vpgen(vs) + {} - conv_clip_polygon(VertexSource& vs) : - conv_adaptor_vpgen(vs) {} + void clip_box(double _x1, double _y1, double _x2, double _y2) { base_type::vpgen().clip_box(_x1, _y1, _x2, _y2); } - void clip_box(double _x1, double _y1, double _x2, double _y2) - { - base_type::vpgen().clip_box(_x1, _y1, _x2, _y2); - } + double x1() const { return base_type::vpgen().x1(); } + double y1() const { return base_type::vpgen().y1(); } + double x2() const { return base_type::vpgen().x2(); } + double y2() const { return base_type::vpgen().y2(); } + unsigned type() const { return base_type::type(); } - double x1() const { return base_type::vpgen().x1(); } - double y1() const { return base_type::vpgen().y1(); } - double x2() const { return base_type::vpgen().x2(); } - double y2() const { return base_type::vpgen().y2(); } - unsigned type() const { return base_type::type(); } + private: + conv_clip_polygon(const conv_clip_polygon&); + const conv_clip_polygon& operator=(const conv_clip_polygon&); +}; - private: - conv_clip_polygon(const conv_clip_polygon&); - const conv_clip_polygon& - operator = (const conv_clip_polygon&); - }; - -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_conv_clip_polyline.h b/deps/agg/include/agg_conv_clip_polyline.h index 8aa34c9d9..7fa71bd84 100644 --- a/deps/agg/include/agg_conv_clip_polyline.h +++ b/deps/agg/include/agg_conv_clip_polyline.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -14,12 +14,12 @@ //---------------------------------------------------------------------------- // // polyline clipping converter -// There an optimized Liang-Basky algorithm is used. +// There an optimized Liang-Basky algorithm is used. // The algorithm doesn't optimize the degenerate edges, i.e. it will never -// break a closed polyline into two or more ones, instead, there will be +// break a closed polyline into two or more ones, instead, there will be // degenerate edges coinciding with the respective clipping boundaries. -// This is a sub-optimal solution, because that optimization would require -// extra, rather expensive math while the rasterizer tolerates it quite well, +// This is a sub-optimal solution, because that optimization would require +// extra, rather expensive math while the rasterizer tolerates it quite well, // without any considerable overhead. // //---------------------------------------------------------------------------- @@ -30,35 +30,31 @@ #include "agg_conv_adaptor_vpgen.h" #include "agg_vpgen_clip_polyline.h" -namespace agg +namespace agg { + +//=======================================================conv_clip_polyline +template +struct conv_clip_polyline : public conv_adaptor_vpgen { + typedef conv_adaptor_vpgen base_type; - //=======================================================conv_clip_polyline - template - struct conv_clip_polyline : public conv_adaptor_vpgen - { - typedef conv_adaptor_vpgen base_type; + conv_clip_polyline(VertexSource& vs) + : conv_adaptor_vpgen(vs) + {} - conv_clip_polyline(VertexSource& vs) : - conv_adaptor_vpgen(vs) {} + void clip_box(double _x1, double _y1, double _x2, double _y2) { base_type::vpgen().clip_box(_x1, _y1, _x2, _y2); } - void clip_box(double _x1, double _y1, double _x2, double _y2) - { - base_type::vpgen().clip_box(_x1, _y1, _x2, _y2); - } + double x1() const { return base_type::vpgen().x1(); } + double y1() const { return base_type::vpgen().y1(); } + double x2() const { return base_type::vpgen().x2(); } + double y2() const { return base_type::vpgen().y2(); } + unsigned type() const { return base_type::type(); } - double x1() const { return base_type::vpgen().x1(); } - double y1() const { return base_type::vpgen().y1(); } - double x2() const { return base_type::vpgen().x2(); } - double y2() const { return base_type::vpgen().y2(); } - unsigned type() const { return base_type::type(); } + private: + conv_clip_polyline(const conv_clip_polyline&); + const conv_clip_polyline& operator=(const conv_clip_polyline&); +}; - private: - conv_clip_polyline(const conv_clip_polyline&); - const conv_clip_polyline& - operator = (const conv_clip_polyline&); - }; - -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_conv_close_polygon.h b/deps/agg/include/agg_conv_close_polygon.h index c46594fdf..6df1cb88e 100644 --- a/deps/agg/include/agg_conv_close_polygon.h +++ b/deps/agg/include/agg_conv_close_polygon.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -18,108 +18,105 @@ #include "agg_basics.h" -namespace agg +namespace agg { + +//======================================================conv_close_polygon +template +class conv_close_polygon { + public: + explicit conv_close_polygon(VertexSource& vs) + : m_source(&vs) + {} + void attach(VertexSource& source) { m_source = &source; } - //======================================================conv_close_polygon - template class conv_close_polygon - { - public: - explicit conv_close_polygon(VertexSource& vs) : m_source(&vs) {} - void attach(VertexSource& source) { m_source = &source; } + void rewind(unsigned path_id); + unsigned vertex(double* x, double* y); - void rewind(unsigned path_id); - unsigned vertex(double* x, double* y); + private: + conv_close_polygon(const conv_close_polygon&); + const conv_close_polygon& operator=(const conv_close_polygon&); - private: - conv_close_polygon(const conv_close_polygon&); - const conv_close_polygon& - operator = (const conv_close_polygon&); - - VertexSource* m_source; - unsigned m_cmd[2]; - double m_x[2]; - double m_y[2]; - unsigned m_vertex; - bool m_line_to; - }; - - - - //------------------------------------------------------------------------ - template - void conv_close_polygon::rewind(unsigned path_id) - { - m_source->rewind(path_id); - m_vertex = 2; - m_line_to = false; - } - - - - //------------------------------------------------------------------------ - template - unsigned conv_close_polygon::vertex(double* x, double* y) - { - unsigned cmd = path_cmd_stop; - for(;;) - { - if(m_vertex < 2) - { - *x = m_x[m_vertex]; - *y = m_y[m_vertex]; - cmd = m_cmd[m_vertex]; - ++m_vertex; - break; - } - - cmd = m_source->vertex(x, y); - - if(is_end_poly(cmd)) - { - cmd |= path_flags_close; - break; - } - - if(is_stop(cmd)) - { - if(m_line_to) - { - m_cmd[0] = path_cmd_end_poly | path_flags_close; - m_cmd[1] = path_cmd_stop; - m_vertex = 0; - m_line_to = false; - continue; - } - break; - } - - if(is_move_to(cmd)) - { - if(m_line_to) - { - m_x[0] = 0.0; - m_y[0] = 0.0; - m_cmd[0] = path_cmd_end_poly | path_flags_close; - m_x[1] = *x; - m_y[1] = *y; - m_cmd[1] = cmd; - m_vertex = 0; - m_line_to = false; - continue; - } - break; - } - - if(is_vertex(cmd)) - { - m_line_to = true; - break; - } - } - return cmd; - } + VertexSource* m_source; + unsigned m_cmd[2]; + double m_x[2]; + double m_y[2]; + unsigned m_vertex; + bool m_line_to; +}; +//------------------------------------------------------------------------ +template +void conv_close_polygon::rewind(unsigned path_id) +{ + m_source->rewind(path_id); + m_vertex = 2; + m_line_to = false; } +//------------------------------------------------------------------------ +template +unsigned conv_close_polygon::vertex(double* x, double* y) +{ + unsigned cmd = path_cmd_stop; + for (;;) + { + if (m_vertex < 2) + { + *x = m_x[m_vertex]; + *y = m_y[m_vertex]; + cmd = m_cmd[m_vertex]; + ++m_vertex; + break; + } + + cmd = m_source->vertex(x, y); + + if (is_end_poly(cmd)) + { + cmd |= path_flags_close; + break; + } + + if (is_stop(cmd)) + { + if (m_line_to) + { + m_cmd[0] = path_cmd_end_poly | path_flags_close; + m_cmd[1] = path_cmd_stop; + m_vertex = 0; + m_line_to = false; + continue; + } + break; + } + + if (is_move_to(cmd)) + { + if (m_line_to) + { + m_x[0] = 0.0; + m_y[0] = 0.0; + m_cmd[0] = path_cmd_end_poly | path_flags_close; + m_x[1] = *x; + m_y[1] = *y; + m_cmd[1] = cmd; + m_vertex = 0; + m_line_to = false; + continue; + } + break; + } + + if (is_vertex(cmd)) + { + m_line_to = true; + break; + } + } + return cmd; +} + +} // namespace agg + #endif diff --git a/deps/agg/include/agg_conv_concat.h b/deps/agg/include/agg_conv_concat.h index 745d349c6..a3c44a979 100644 --- a/deps/agg/include/agg_conv_concat.h +++ b/deps/agg/include/agg_conv_concat.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -18,56 +18,57 @@ #include "agg_basics.h" -namespace agg +namespace agg { +//=============================================================conv_concat +// Concatenation of two paths. Usually used to combine lines or curves +// with markers such as arrowheads +template +class conv_concat { - //=============================================================conv_concat - // Concatenation of two paths. Usually used to combine lines or curves - // with markers such as arrowheads - template class conv_concat + public: + conv_concat(VS1& source1, VS2& source2) + : m_source1(&source1) + , m_source2(&source2) + , m_status(2) + {} + void attach1(VS1& source) { m_source1 = &source; } + void attach2(VS2& source) { m_source2 = &source; } + + void rewind(unsigned path_id) { - public: - conv_concat(VS1& source1, VS2& source2) : - m_source1(&source1), m_source2(&source2), m_status(2) {} - void attach1(VS1& source) { m_source1 = &source; } - void attach2(VS2& source) { m_source2 = &source; } + m_source1->rewind(path_id); + m_source2->rewind(0); + m_status = 0; + } - - void rewind(unsigned path_id) - { - m_source1->rewind(path_id); - m_source2->rewind(0); - m_status = 0; - } - - unsigned vertex(double* x, double* y) + unsigned vertex(double* x, double* y) + { + unsigned cmd; + if (m_status == 0) { - unsigned cmd; - if(m_status == 0) - { - cmd = m_source1->vertex(x, y); - if(!is_stop(cmd)) return cmd; - m_status = 1; - } - if(m_status == 1) - { - cmd = m_source2->vertex(x, y); - if(!is_stop(cmd)) return cmd; - m_status = 2; - } - return path_cmd_stop; + cmd = m_source1->vertex(x, y); + if (!is_stop(cmd)) + return cmd; + m_status = 1; } + if (m_status == 1) + { + cmd = m_source2->vertex(x, y); + if (!is_stop(cmd)) + return cmd; + m_status = 2; + } + return path_cmd_stop; + } - private: - conv_concat(const conv_concat&); - const conv_concat& - operator = (const conv_concat&); - - VS1* m_source1; - VS2* m_source2; - int m_status; - - }; -} + private: + conv_concat(const conv_concat&); + const conv_concat& operator=(const conv_concat&); + VS1* m_source1; + VS2* m_source2; + int m_status; +}; +} // namespace agg #endif diff --git a/deps/agg/include/agg_conv_contour.h b/deps/agg/include/agg_conv_contour.h index b4b5a9047..64fdb42b3 100644 --- a/deps/agg/include/agg_conv_contour.h +++ b/deps/agg/include/agg_conv_contour.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -23,43 +23,40 @@ #include "agg_vcgen_contour.h" #include "agg_conv_adaptor_vcgen.h" -namespace agg +namespace agg { + +//-----------------------------------------------------------conv_contour +template +struct conv_contour : public conv_adaptor_vcgen { + typedef conv_adaptor_vcgen base_type; - //-----------------------------------------------------------conv_contour - template - struct conv_contour : public conv_adaptor_vcgen - { - typedef conv_adaptor_vcgen base_type; + conv_contour(VertexSource& vs) + : conv_adaptor_vcgen(vs) + {} - conv_contour(VertexSource& vs) : - conv_adaptor_vcgen(vs) - { - } + void line_join(line_join_e lj) { base_type::generator().line_join(lj); } + void inner_join(inner_join_e ij) { base_type::generator().inner_join(ij); } + void width(double w) { base_type::generator().width(w); } + void miter_limit(double ml) { base_type::generator().miter_limit(ml); } + void miter_limit_theta(double t) { base_type::generator().miter_limit_theta(t); } + void inner_miter_limit(double ml) { base_type::generator().inner_miter_limit(ml); } + void approximation_scale(double as) { base_type::generator().approximation_scale(as); } + void auto_detect_orientation(bool v) { base_type::generator().auto_detect_orientation(v); } - void line_join(line_join_e lj) { base_type::generator().line_join(lj); } - void inner_join(inner_join_e ij) { base_type::generator().inner_join(ij); } - void width(double w) { base_type::generator().width(w); } - void miter_limit(double ml) { base_type::generator().miter_limit(ml); } - void miter_limit_theta(double t) { base_type::generator().miter_limit_theta(t); } - void inner_miter_limit(double ml) { base_type::generator().inner_miter_limit(ml); } - void approximation_scale(double as) { base_type::generator().approximation_scale(as); } - void auto_detect_orientation(bool v) { base_type::generator().auto_detect_orientation(v); } + line_join_e line_join() const { return base_type::generator().line_join(); } + inner_join_e inner_join() const { return base_type::generator().inner_join(); } + double width() const { return base_type::generator().width(); } + double miter_limit() const { return base_type::generator().miter_limit(); } + double inner_miter_limit() const { return base_type::generator().inner_miter_limit(); } + double approximation_scale() const { return base_type::generator().approximation_scale(); } + bool auto_detect_orientation() const { return base_type::generator().auto_detect_orientation(); } - line_join_e line_join() const { return base_type::generator().line_join(); } - inner_join_e inner_join() const { return base_type::generator().inner_join(); } - double width() const { return base_type::generator().width(); } - double miter_limit() const { return base_type::generator().miter_limit(); } - double inner_miter_limit() const { return base_type::generator().inner_miter_limit(); } - double approximation_scale() const { return base_type::generator().approximation_scale(); } - bool auto_detect_orientation() const { return base_type::generator().auto_detect_orientation(); } + private: + conv_contour(const conv_contour&); + const conv_contour& operator=(const conv_contour&); +}; - private: - conv_contour(const conv_contour&); - const conv_contour& - operator = (const conv_contour&); - }; - -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_conv_curve.h b/deps/agg/include/agg_conv_curve.h index c02b182b1..78dba8e02 100644 --- a/deps/agg/include/agg_conv_curve.h +++ b/deps/agg/include/agg_conv_curve.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -23,157 +23,140 @@ #include "agg_basics.h" #include "agg_curves.h" -namespace agg +namespace agg { + +//---------------------------------------------------------------conv_curve +// Curve converter class. Any path storage can have Bezier curves defined +// by their control points. There're two types of curves supported: curve3 +// and curve4. Curve3 is a conic Bezier curve with 2 endpoints and 1 control +// point. Curve4 has 2 control points (4 points in total) and can be used +// to interpolate more complicated curves. Curve4, unlike curve3 can be used +// to approximate arcs, both circular and elliptical. Curves are approximated +// with straight lines and one of the approaches is just to store the whole +// sequence of vertices that approximate our curve. It takes additional +// memory, and at the same time the consecutive vertices can be calculated +// on demand. +// +// Initially, path storages are not suppose to keep all the vertices of the +// curves (although, nothing prevents us from doing so). Instead, path_storage +// keeps only vertices, needed to calculate a curve on demand. Those vertices +// are marked with special commands. So, if the path_storage contains curves +// (which are not real curves yet), and we render this storage directly, +// all we will see is only 2 or 3 straight line segments (for curve3 and +// curve4 respectively). If we need to see real curves drawn we need to +// include this class into the conversion pipeline. +// +// Class conv_curve recognizes commands path_cmd_curve3 and path_cmd_curve4 +// and converts these vertices into a move_to/line_to sequence. +//----------------------------------------------------------------------- +template +class conv_curve { + public: + typedef Curve3 curve3_type; + typedef Curve4 curve4_type; + typedef conv_curve self_type; + explicit conv_curve(VertexSource& source) + : m_source(&source) + , m_last_x(0.0) + , m_last_y(0.0) + {} - //---------------------------------------------------------------conv_curve - // Curve converter class. Any path storage can have Bezier curves defined - // by their control points. There're two types of curves supported: curve3 - // and curve4. Curve3 is a conic Bezier curve with 2 endpoints and 1 control - // point. Curve4 has 2 control points (4 points in total) and can be used - // to interpolate more complicated curves. Curve4, unlike curve3 can be used - // to approximate arcs, both circular and elliptical. Curves are approximated - // with straight lines and one of the approaches is just to store the whole - // sequence of vertices that approximate our curve. It takes additional - // memory, and at the same time the consecutive vertices can be calculated - // on demand. - // - // Initially, path storages are not suppose to keep all the vertices of the - // curves (although, nothing prevents us from doing so). Instead, path_storage - // keeps only vertices, needed to calculate a curve on demand. Those vertices - // are marked with special commands. So, if the path_storage contains curves - // (which are not real curves yet), and we render this storage directly, - // all we will see is only 2 or 3 straight line segments (for curve3 and - // curve4 respectively). If we need to see real curves drawn we need to - // include this class into the conversion pipeline. - // - // Class conv_curve recognizes commands path_cmd_curve3 and path_cmd_curve4 - // and converts these vertices into a move_to/line_to sequence. - //----------------------------------------------------------------------- - template class conv_curve + conv_curve(self_type&&) = default; + + void attach(VertexSource& source) { m_source = &source; } + + void approximation_method(curve_approximation_method_e v) { - public: - typedef Curve3 curve3_type; - typedef Curve4 curve4_type; - typedef conv_curve self_type; - - explicit conv_curve(VertexSource& source) : - m_source(&source), m_last_x(0.0), m_last_y(0.0) {} - - conv_curve(self_type &&) = default; - - void attach(VertexSource& source) { m_source = &source; } - - void approximation_method(curve_approximation_method_e v) - { - m_curve3.approximation_method(v); - m_curve4.approximation_method(v); - } - - curve_approximation_method_e approximation_method() const - { - return m_curve4.approximation_method(); - } - - void approximation_scale(double s) - { - m_curve3.approximation_scale(s); - m_curve4.approximation_scale(s); - } - - double approximation_scale() const - { - return m_curve4.approximation_scale(); - } - - void angle_tolerance(double v) - { - m_curve3.angle_tolerance(v); - m_curve4.angle_tolerance(v); - } - - double angle_tolerance() const - { - return m_curve4.angle_tolerance(); - } - - void cusp_limit(double v) - { - m_curve3.cusp_limit(v); - m_curve4.cusp_limit(v); - } - - double cusp_limit() const - { - return m_curve4.cusp_limit(); - } - - void rewind(unsigned path_id); - unsigned vertex(double* x, double* y); - - private: - conv_curve(const self_type&); - const self_type& operator = (const self_type&); - - VertexSource* m_source; - double m_last_x; - double m_last_y; - curve3_type m_curve3; - curve4_type m_curve4; - }; - - - - //------------------------------------------------------------------------ - template - void conv_curve::rewind(unsigned path_id) - { - m_source->rewind(path_id); - m_last_x = 0.0; - m_last_y = 0.0; - m_curve3.reset(); - m_curve4.reset(); + m_curve3.approximation_method(v); + m_curve4.approximation_method(v); } + curve_approximation_method_e approximation_method() const { return m_curve4.approximation_method(); } - //------------------------------------------------------------------------ - template - unsigned conv_curve::vertex(double* x, double* y) + void approximation_scale(double s) { - if(!is_stop(m_curve3.vertex(x, y))) - { - m_last_x = *x; - m_last_y = *y; - return path_cmd_line_to; - } + m_curve3.approximation_scale(s); + m_curve4.approximation_scale(s); + } - if(!is_stop(m_curve4.vertex(x, y))) - { - m_last_x = *x; - m_last_y = *y; - return path_cmd_line_to; - } + double approximation_scale() const { return m_curve4.approximation_scale(); } - double ct2_x=0; - double ct2_y=0; - double end_x=0; - double end_y=0; + void angle_tolerance(double v) + { + m_curve3.angle_tolerance(v); + m_curve4.angle_tolerance(v); + } - unsigned cmd = m_source->vertex(x, y); - switch(cmd) - { + double angle_tolerance() const { return m_curve4.angle_tolerance(); } + + void cusp_limit(double v) + { + m_curve3.cusp_limit(v); + m_curve4.cusp_limit(v); + } + + double cusp_limit() const { return m_curve4.cusp_limit(); } + + void rewind(unsigned path_id); + unsigned vertex(double* x, double* y); + + private: + conv_curve(const self_type&); + const self_type& operator=(const self_type&); + + VertexSource* m_source; + double m_last_x; + double m_last_y; + curve3_type m_curve3; + curve4_type m_curve4; +}; + +//------------------------------------------------------------------------ +template +void conv_curve::rewind(unsigned path_id) +{ + m_source->rewind(path_id); + m_last_x = 0.0; + m_last_y = 0.0; + m_curve3.reset(); + m_curve4.reset(); +} + +//------------------------------------------------------------------------ +template +unsigned conv_curve::vertex(double* x, double* y) +{ + if (!is_stop(m_curve3.vertex(x, y))) + { + m_last_x = *x; + m_last_y = *y; + return path_cmd_line_to; + } + + if (!is_stop(m_curve4.vertex(x, y))) + { + m_last_x = *x; + m_last_y = *y; + return path_cmd_line_to; + } + + double ct2_x = 0; + double ct2_y = 0; + double end_x = 0; + double end_y = 0; + + unsigned cmd = m_source->vertex(x, y); + switch (cmd) + { case path_cmd_curve3: m_source->vertex(&end_x, &end_y); - m_curve3.init(m_last_x, m_last_y, - *x, *y, - end_x, end_y); + m_curve3.init(m_last_x, m_last_y, *x, *y, end_x, end_y); - m_curve3.vertex(x, y); // First call returns path_cmd_move_to - m_curve3.vertex(x, y); // This is the first vertex of the curve + m_curve3.vertex(x, y); // First call returns path_cmd_move_to + m_curve3.vertex(x, y); // This is the first vertex of the curve cmd = path_cmd_line_to; break; @@ -181,24 +164,18 @@ namespace agg m_source->vertex(&ct2_x, &ct2_y); m_source->vertex(&end_x, &end_y); - m_curve4.init(m_last_x, m_last_y, - *x, *y, - ct2_x, ct2_y, - end_x, end_y); + m_curve4.init(m_last_x, m_last_y, *x, *y, ct2_x, ct2_y, end_x, end_y); - m_curve4.vertex(x, y); // First call returns path_cmd_move_to - m_curve4.vertex(x, y); // This is the first vertex of the curve + m_curve4.vertex(x, y); // First call returns path_cmd_move_to + m_curve4.vertex(x, y); // This is the first vertex of the curve cmd = path_cmd_line_to; break; - } - m_last_x = *x; - m_last_y = *y; - return cmd; } - - + m_last_x = *x; + m_last_y = *y; + return cmd; } - +} // namespace agg #endif diff --git a/deps/agg/include/agg_conv_dash.h b/deps/agg/include/agg_conv_dash.h index 23c13ad0a..9ff9a3d23 100644 --- a/deps/agg/include/agg_conv_dash.h +++ b/deps/agg/include/agg_conv_dash.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -23,46 +23,33 @@ #include "agg_vcgen_dash.h" #include "agg_conv_adaptor_vcgen.h" -namespace agg +namespace agg { + +//---------------------------------------------------------------conv_dash +template +struct conv_dash : public conv_adaptor_vcgen { + typedef Markers marker_type; + typedef conv_adaptor_vcgen base_type; - //---------------------------------------------------------------conv_dash - template - struct conv_dash : public conv_adaptor_vcgen - { - typedef Markers marker_type; - typedef conv_adaptor_vcgen base_type; + conv_dash(VertexSource& vs) + : conv_adaptor_vcgen(vs) + {} - conv_dash(VertexSource& vs) : - conv_adaptor_vcgen(vs) - { - } + void remove_all_dashes() { base_type::generator().remove_all_dashes(); } - void remove_all_dashes() - { - base_type::generator().remove_all_dashes(); - } + void add_dash(double dash_len, double gap_len) { base_type::generator().add_dash(dash_len, gap_len); } - void add_dash(double dash_len, double gap_len) - { - base_type::generator().add_dash(dash_len, gap_len); - } + void dash_start(double ds) { base_type::generator().dash_start(ds); } - void dash_start(double ds) - { - base_type::generator().dash_start(ds); - } + void shorten(double s) { base_type::generator().shorten(s); } + double shorten() const { return base_type::generator().shorten(); } - void shorten(double s) { base_type::generator().shorten(s); } - double shorten() const { return base_type::generator().shorten(); } + private: + conv_dash(const conv_dash&); + const conv_dash& operator=(const conv_dash&); +}; - private: - conv_dash(const conv_dash&); - const conv_dash& - operator = (const conv_dash&); - }; - - -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_conv_gpc.h b/deps/agg/include/agg_conv_gpc.h index a1f7ba218..0af437a81 100644 --- a/deps/agg/include/agg_conv_gpc.h +++ b/deps/agg/include/agg_conv_gpc.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -13,7 +13,7 @@ // http://www.antigrain.com //---------------------------------------------------------------------------- // -// General Polygon Clipper based on the GPC library by Alan Murta +// General Polygon Clipper based on the GPC library by Alan Murta // Union, Intersection, XOR, A-B, B-A // Contact the author if you intend to use it in commercial applications! // http://www.cs.man.ac.uk/aig/staff/alan/software/ @@ -28,405 +28,353 @@ #include "agg_basics.h" #include "agg_array.h" -extern "C" -{ -#include "gpc.h" +extern "C" +{ +#include "gpc.h" } -namespace agg +namespace agg { +enum gpc_op_e { gpc_or, gpc_and, gpc_xor, gpc_a_minus_b, gpc_b_minus_a }; + +//================================================================conv_gpc +template +class conv_gpc { - enum gpc_op_e + enum status { status_move_to, status_line_to, status_stop }; + + struct contour_header_type { - gpc_or, - gpc_and, - gpc_xor, - gpc_a_minus_b, - gpc_b_minus_a + int num_vertices; + int hole_flag; + gpc_vertex* vertices; }; + typedef pod_bvector vertex_array_type; + typedef pod_bvector contour_header_array_type; - //================================================================conv_gpc - template class conv_gpc + public: + typedef VSA source_a_type; + typedef VSB source_b_type; + typedef conv_gpc self_type; + + ~conv_gpc() { free_gpc_data(); } + + conv_gpc(source_a_type& a, source_b_type& b, gpc_op_e op = gpc_or) + : m_src_a(&a) + , m_src_b(&b) + , m_status(status_move_to) + , m_vertex(-1) + , m_contour(-1) + , m_operation(op) { - enum status - { - status_move_to, - status_line_to, - status_stop - }; - - struct contour_header_type - { - int num_vertices; - int hole_flag; - gpc_vertex* vertices; - }; - - typedef pod_bvector vertex_array_type; - typedef pod_bvector contour_header_array_type; - - - public: - typedef VSA source_a_type; - typedef VSB source_b_type; - typedef conv_gpc self_type; - - ~conv_gpc() - { - free_gpc_data(); - } - - conv_gpc(source_a_type& a, source_b_type& b, gpc_op_e op = gpc_or) : - m_src_a(&a), - m_src_b(&b), - m_status(status_move_to), - m_vertex(-1), - m_contour(-1), - m_operation(op) - { - memset(&m_poly_a, 0, sizeof(m_poly_a)); - memset(&m_poly_b, 0, sizeof(m_poly_b)); - memset(&m_result, 0, sizeof(m_result)); - } - - void attach1(VSA& source) { m_src_a = &source; } - void attach2(VSB& source) { m_src_b = &source; } - - void operation(gpc_op_e v) { m_operation = v; } - - // Vertex Source Interface - void rewind(unsigned path_id); - unsigned vertex(double* x, double* y); - - private: - conv_gpc(const conv_gpc&); - const conv_gpc& operator = (const conv_gpc&); - - //-------------------------------------------------------------------- - void free_polygon(gpc_polygon& p); - void free_result(); - void free_gpc_data(); - void start_contour(); - void add_vertex(double x, double y); - void end_contour(unsigned orientation); - void make_polygon(gpc_polygon& p); - void start_extracting(); - bool next_contour(); - bool next_vertex(double* x, double* y); - - - //-------------------------------------------------------------------- - template void add(VS& src, gpc_polygon& p) - { - unsigned cmd; - double x, y; - double start_x = 0.0; - double start_y = 0.0; - bool line_to = false; - unsigned orientation = 0; - - m_contour_accumulator.remove_all(); - - while(!is_stop(cmd = src.vertex(&x, &y))) - { - if(is_vertex(cmd)) - { - if(is_move_to(cmd)) - { - if(line_to) - { - end_contour(orientation); - orientation = 0; - } - start_contour(); - start_x = x; - start_y = y; - } - add_vertex(x, y); - line_to = true; - } - else - { - if(is_end_poly(cmd)) - { - orientation = get_orientation(cmd); - if(line_to && is_closed(cmd)) - { - add_vertex(start_x, start_y); - } - } - } - } - if(line_to) - { - end_contour(orientation); - } - make_polygon(p); - } - - - private: - //-------------------------------------------------------------------- - source_a_type* m_src_a; - source_b_type* m_src_b; - status m_status; - int m_vertex; - int m_contour; - gpc_op_e m_operation; - vertex_array_type m_vertex_accumulator; - contour_header_array_type m_contour_accumulator; - gpc_polygon m_poly_a; - gpc_polygon m_poly_b; - gpc_polygon m_result; - }; - - - - - - //------------------------------------------------------------------------ - template - void conv_gpc::free_polygon(gpc_polygon& p) - { - int i; - for(i = 0; i < p.num_contours; i++) - { - pod_allocator::deallocate(p.contour[i].vertex, - p.contour[i].num_vertices); - } - pod_allocator::deallocate(p.contour, p.num_contours); - memset(&p, 0, sizeof(gpc_polygon)); - } - - - //------------------------------------------------------------------------ - template - void conv_gpc::free_result() - { - if(m_result.contour) - { - gpc_free_polygon(&m_result); - } + memset(&m_poly_a, 0, sizeof(m_poly_a)); + memset(&m_poly_b, 0, sizeof(m_poly_b)); memset(&m_result, 0, sizeof(m_result)); } + void attach1(VSA& source) { m_src_a = &source; } + void attach2(VSB& source) { m_src_b = &source; } - //------------------------------------------------------------------------ - template - void conv_gpc::free_gpc_data() + void operation(gpc_op_e v) { m_operation = v; } + + // Vertex Source Interface + void rewind(unsigned path_id); + unsigned vertex(double* x, double* y); + + private: + conv_gpc(const conv_gpc&); + const conv_gpc& operator=(const conv_gpc&); + + //-------------------------------------------------------------------- + void free_polygon(gpc_polygon& p); + void free_result(); + void free_gpc_data(); + void start_contour(); + void add_vertex(double x, double y); + void end_contour(unsigned orientation); + void make_polygon(gpc_polygon& p); + void start_extracting(); + bool next_contour(); + bool next_vertex(double* x, double* y); + + //-------------------------------------------------------------------- + template + void add(VS& src, gpc_polygon& p) { - free_polygon(m_poly_a); - free_polygon(m_poly_b); - free_result(); - } + unsigned cmd; + double x, y; + double start_x = 0.0; + double start_y = 0.0; + bool line_to = false; + unsigned orientation = 0; + m_contour_accumulator.remove_all(); - //------------------------------------------------------------------------ - template - void conv_gpc::start_contour() - { - contour_header_type h; - memset(&h, 0, sizeof(h)); - m_contour_accumulator.add(h); - m_vertex_accumulator.remove_all(); - } - - - //------------------------------------------------------------------------ - template - inline void conv_gpc::add_vertex(double x, double y) - { - gpc_vertex v; - v.x = x; - v.y = y; - m_vertex_accumulator.add(v); - } - - - //------------------------------------------------------------------------ - template - void conv_gpc::end_contour(unsigned orientation) - { - if(m_contour_accumulator.size()) + while (!is_stop(cmd = src.vertex(&x, &y))) { - if(m_vertex_accumulator.size() > 2) + if (is_vertex(cmd)) { - contour_header_type& h = - m_contour_accumulator[m_contour_accumulator.size() - 1]; - - h.num_vertices = m_vertex_accumulator.size(); - h.hole_flag = 0; - - // TO DO: Clarify the "holes" - //if(is_cw(orientation)) h.hole_flag = 1; - - h.vertices = pod_allocator::allocate(h.num_vertices); - gpc_vertex* d = h.vertices; - int i; - for(i = 0; i < h.num_vertices; i++) + if (is_move_to(cmd)) { - const gpc_vertex& s = m_vertex_accumulator[i]; - d->x = s.x; - d->y = s.y; - ++d; + if (line_to) + { + end_contour(orientation); + orientation = 0; + } + start_contour(); + start_x = x; + start_y = y; } + add_vertex(x, y); + line_to = true; } else { - m_vertex_accumulator.remove_last(); - } - } - } - - - //------------------------------------------------------------------------ - template - void conv_gpc::make_polygon(gpc_polygon& p) - { - free_polygon(p); - if(m_contour_accumulator.size()) - { - p.num_contours = m_contour_accumulator.size(); - - p.hole = 0; - p.contour = pod_allocator::allocate(p.num_contours); - - int i; - gpc_vertex_list* pv = p.contour; - for(i = 0; i < p.num_contours; i++) - { - const contour_header_type& h = m_contour_accumulator[i]; - pv->num_vertices = h.num_vertices; - pv->vertex = h.vertices; - ++pv; - } - } - } - - - //------------------------------------------------------------------------ - template - void conv_gpc::start_extracting() - { - m_status = status_move_to; - m_contour = -1; - m_vertex = -1; - } - - - //------------------------------------------------------------------------ - template - bool conv_gpc::next_contour() - { - if(++m_contour < m_result.num_contours) - { - m_vertex = -1; - return true; - } - return false; - } - - - //------------------------------------------------------------------------ - template - inline bool conv_gpc::next_vertex(double* x, double* y) - { - const gpc_vertex_list& vlist = m_result.contour[m_contour]; - if(++m_vertex < vlist.num_vertices) - { - const gpc_vertex& v = vlist.vertex[m_vertex]; - *x = v.x; - *y = v.y; - return true; - } - return false; - } - - - //------------------------------------------------------------------------ - template - void conv_gpc::rewind(unsigned path_id) - { - free_result(); - m_src_a->rewind(path_id); - m_src_b->rewind(path_id); - add(*m_src_a, m_poly_a); - add(*m_src_b, m_poly_b); - switch(m_operation) - { - case gpc_or: - gpc_polygon_clip(GPC_UNION, - &m_poly_a, - &m_poly_b, - &m_result); - break; - - case gpc_and: - gpc_polygon_clip(GPC_INT, - &m_poly_a, - &m_poly_b, - &m_result); - break; - - case gpc_xor: - gpc_polygon_clip(GPC_XOR, - &m_poly_a, - &m_poly_b, - &m_result); - break; - - case gpc_a_minus_b: - gpc_polygon_clip(GPC_DIFF, - &m_poly_a, - &m_poly_b, - &m_result); - break; - - case gpc_b_minus_a: - gpc_polygon_clip(GPC_DIFF, - &m_poly_b, - &m_poly_a, - &m_result); - break; - } - start_extracting(); - } - - - //------------------------------------------------------------------------ - template - unsigned conv_gpc::vertex(double* x, double* y) - { - if(m_status == status_move_to) - { - if(next_contour()) - { - if(next_vertex(x, y)) + if (is_end_poly(cmd)) { - m_status = status_line_to; - return path_cmd_move_to; + orientation = get_orientation(cmd); + if (line_to && is_closed(cmd)) + { + add_vertex(start_x, start_y); + } } - m_status = status_stop; - return path_cmd_end_poly | path_flags_close; + } + } + if (line_to) + { + end_contour(orientation); + } + make_polygon(p); + } + + private: + //-------------------------------------------------------------------- + source_a_type* m_src_a; + source_b_type* m_src_b; + status m_status; + int m_vertex; + int m_contour; + gpc_op_e m_operation; + vertex_array_type m_vertex_accumulator; + contour_header_array_type m_contour_accumulator; + gpc_polygon m_poly_a; + gpc_polygon m_poly_b; + gpc_polygon m_result; +}; + +//------------------------------------------------------------------------ +template +void conv_gpc::free_polygon(gpc_polygon& p) +{ + int i; + for (i = 0; i < p.num_contours; i++) + { + pod_allocator::deallocate(p.contour[i].vertex, p.contour[i].num_vertices); + } + pod_allocator::deallocate(p.contour, p.num_contours); + memset(&p, 0, sizeof(gpc_polygon)); +} + +//------------------------------------------------------------------------ +template +void conv_gpc::free_result() +{ + if (m_result.contour) + { + gpc_free_polygon(&m_result); + } + memset(&m_result, 0, sizeof(m_result)); +} + +//------------------------------------------------------------------------ +template +void conv_gpc::free_gpc_data() +{ + free_polygon(m_poly_a); + free_polygon(m_poly_b); + free_result(); +} + +//------------------------------------------------------------------------ +template +void conv_gpc::start_contour() +{ + contour_header_type h; + memset(&h, 0, sizeof(h)); + m_contour_accumulator.add(h); + m_vertex_accumulator.remove_all(); +} + +//------------------------------------------------------------------------ +template +inline void conv_gpc::add_vertex(double x, double y) +{ + gpc_vertex v; + v.x = x; + v.y = y; + m_vertex_accumulator.add(v); +} + +//------------------------------------------------------------------------ +template +void conv_gpc::end_contour(unsigned orientation) +{ + if (m_contour_accumulator.size()) + { + if (m_vertex_accumulator.size() > 2) + { + contour_header_type& h = m_contour_accumulator[m_contour_accumulator.size() - 1]; + + h.num_vertices = m_vertex_accumulator.size(); + h.hole_flag = 0; + + // TO DO: Clarify the "holes" + // if(is_cw(orientation)) h.hole_flag = 1; + + h.vertices = pod_allocator::allocate(h.num_vertices); + gpc_vertex* d = h.vertices; + int i; + for (i = 0; i < h.num_vertices; i++) + { + const gpc_vertex& s = m_vertex_accumulator[i]; + d->x = s.x; + d->y = s.y; + ++d; } } else { - if(next_vertex(x, y)) - { - return path_cmd_line_to; - } - else - { - m_status = status_move_to; - } - return path_cmd_end_poly | path_flags_close; + m_vertex_accumulator.remove_last(); } - return path_cmd_stop; } - - } +//------------------------------------------------------------------------ +template +void conv_gpc::make_polygon(gpc_polygon& p) +{ + free_polygon(p); + if (m_contour_accumulator.size()) + { + p.num_contours = m_contour_accumulator.size(); + + p.hole = 0; + p.contour = pod_allocator::allocate(p.num_contours); + + int i; + gpc_vertex_list* pv = p.contour; + for (i = 0; i < p.num_contours; i++) + { + const contour_header_type& h = m_contour_accumulator[i]; + pv->num_vertices = h.num_vertices; + pv->vertex = h.vertices; + ++pv; + } + } +} + +//------------------------------------------------------------------------ +template +void conv_gpc::start_extracting() +{ + m_status = status_move_to; + m_contour = -1; + m_vertex = -1; +} + +//------------------------------------------------------------------------ +template +bool conv_gpc::next_contour() +{ + if (++m_contour < m_result.num_contours) + { + m_vertex = -1; + return true; + } + return false; +} + +//------------------------------------------------------------------------ +template +inline bool conv_gpc::next_vertex(double* x, double* y) +{ + const gpc_vertex_list& vlist = m_result.contour[m_contour]; + if (++m_vertex < vlist.num_vertices) + { + const gpc_vertex& v = vlist.vertex[m_vertex]; + *x = v.x; + *y = v.y; + return true; + } + return false; +} + +//------------------------------------------------------------------------ +template +void conv_gpc::rewind(unsigned path_id) +{ + free_result(); + m_src_a->rewind(path_id); + m_src_b->rewind(path_id); + add(*m_src_a, m_poly_a); + add(*m_src_b, m_poly_b); + switch (m_operation) + { + case gpc_or: + gpc_polygon_clip(GPC_UNION, &m_poly_a, &m_poly_b, &m_result); + break; + + case gpc_and: + gpc_polygon_clip(GPC_INT, &m_poly_a, &m_poly_b, &m_result); + break; + + case gpc_xor: + gpc_polygon_clip(GPC_XOR, &m_poly_a, &m_poly_b, &m_result); + break; + + case gpc_a_minus_b: + gpc_polygon_clip(GPC_DIFF, &m_poly_a, &m_poly_b, &m_result); + break; + + case gpc_b_minus_a: + gpc_polygon_clip(GPC_DIFF, &m_poly_b, &m_poly_a, &m_result); + break; + } + start_extracting(); +} + +//------------------------------------------------------------------------ +template +unsigned conv_gpc::vertex(double* x, double* y) +{ + if (m_status == status_move_to) + { + if (next_contour()) + { + if (next_vertex(x, y)) + { + m_status = status_line_to; + return path_cmd_move_to; + } + m_status = status_stop; + return path_cmd_end_poly | path_flags_close; + } + } + else + { + if (next_vertex(x, y)) + { + return path_cmd_line_to; + } + else + { + m_status = status_move_to; + } + return path_cmd_end_poly | path_flags_close; + } + return path_cmd_stop; +} + +} // namespace agg #endif diff --git a/deps/agg/include/agg_conv_marker.h b/deps/agg/include/agg_conv_marker.h index e60101513..8b6f9cf38 100644 --- a/deps/agg/include/agg_conv_marker.h +++ b/deps/agg/include/agg_conv_marker.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -22,82 +22,70 @@ #include "agg_basics.h" #include "agg_trans_affine.h" -namespace agg +namespace agg { +//-------------------------------------------------------------conv_marker +template +class conv_marker { - //-------------------------------------------------------------conv_marker - template - class conv_marker + public: + conv_marker(MarkerLocator& ml, MarkerShapes& ms); + + trans_affine& transform() { return m_transform; } + const trans_affine& transform() const { return m_transform; } + + void rewind(unsigned path_id); + unsigned vertex(double* x, double* y); + + private: + conv_marker(const conv_marker&); + const conv_marker& operator=(const conv_marker&); + + enum status_e { initial, markers, polygon, stop }; + + MarkerLocator* m_marker_locator; + MarkerShapes* m_marker_shapes; + trans_affine m_transform; + trans_affine m_mtx; + status_e m_status; + unsigned m_marker; + unsigned m_num_markers; +}; + +//------------------------------------------------------------------------ +template +conv_marker::conv_marker(MarkerLocator& ml, MarkerShapes& ms) + : m_marker_locator(&ml) + , m_marker_shapes(&ms) + , m_status(initial) + , m_marker(0) + , m_num_markers(1) +{} + +//------------------------------------------------------------------------ +template +void conv_marker::rewind(unsigned) +{ + m_status = initial; + m_marker = 0; + m_num_markers = 1; +} + +//------------------------------------------------------------------------ +template +unsigned conv_marker::vertex(double* x, double* y) +{ + unsigned cmd = path_cmd_move_to; + double x1, y1, x2, y2; + + while (!is_stop(cmd)) { - public: - conv_marker(MarkerLocator& ml, MarkerShapes& ms); - - trans_affine& transform() { return m_transform; } - const trans_affine& transform() const { return m_transform; } - - void rewind(unsigned path_id); - unsigned vertex(double* x, double* y); - - private: - conv_marker(const conv_marker&); - const conv_marker& - operator = (const conv_marker&); - - enum status_e + switch (m_status) { - initial, - markers, - polygon, - stop - }; - - MarkerLocator* m_marker_locator; - MarkerShapes* m_marker_shapes; - trans_affine m_transform; - trans_affine m_mtx; - status_e m_status; - unsigned m_marker; - unsigned m_num_markers; - }; - - - //------------------------------------------------------------------------ - template - conv_marker::conv_marker(MarkerLocator& ml, MarkerShapes& ms) : - m_marker_locator(&ml), - m_marker_shapes(&ms), - m_status(initial), - m_marker(0), - m_num_markers(1) - { - } - - - //------------------------------------------------------------------------ - template - void conv_marker::rewind(unsigned) - { - m_status = initial; - m_marker = 0; - m_num_markers = 1; - } - - - //------------------------------------------------------------------------ - template - unsigned conv_marker::vertex(double* x, double* y) - { - unsigned cmd = path_cmd_move_to; - double x1, y1, x2, y2; - - while(!is_stop(cmd)) - { - switch(m_status) - { case initial: - if(m_num_markers == 0) + if (m_num_markers == 0) { - cmd = path_cmd_stop; - break; + cmd = path_cmd_stop; + break; } m_marker_locator->rewind(m_marker); ++m_marker; @@ -105,12 +93,12 @@ namespace agg m_status = markers; case markers: - if(is_stop(m_marker_locator->vertex(&x1, &y1))) + if (is_stop(m_marker_locator->vertex(&x1, &y1))) { m_status = initial; break; } - if(is_stop(m_marker_locator->vertex(&x2, &y2))) + if (is_stop(m_marker_locator->vertex(&x2, &y2))) { m_status = initial; break; @@ -124,7 +112,7 @@ namespace agg case polygon: cmd = m_marker_shapes->vertex(x, y); - if(is_stop(cmd)) + if (is_stop(cmd)) { cmd = path_cmd_move_to; m_status = markers; @@ -136,13 +124,11 @@ namespace agg case stop: cmd = path_cmd_stop; break; - } } - return cmd; } - + return cmd; } +} // namespace agg #endif - diff --git a/deps/agg/include/agg_conv_marker_adaptor.h b/deps/agg/include/agg_conv_marker_adaptor.h index 4486d6ace..1c03fedf6 100644 --- a/deps/agg/include/agg_conv_marker_adaptor.h +++ b/deps/agg/include/agg_conv_marker_adaptor.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -20,32 +20,27 @@ #include "agg_conv_adaptor_vcgen.h" #include "agg_vcgen_vertex_sequence.h" -namespace agg +namespace agg { + +//=====================================================conv_marker_adaptor +template +struct conv_marker_adaptor : public conv_adaptor_vcgen { + typedef Markers marker_type; + typedef conv_adaptor_vcgen base_type; - //=====================================================conv_marker_adaptor - template - struct conv_marker_adaptor : - public conv_adaptor_vcgen - { - typedef Markers marker_type; - typedef conv_adaptor_vcgen base_type; + conv_marker_adaptor(VertexSource& vs) + : conv_adaptor_vcgen(vs) + {} - conv_marker_adaptor(VertexSource& vs) : - conv_adaptor_vcgen(vs) - { - } + void shorten(double s) { base_type::generator().shorten(s); } + double shorten() const { return base_type::generator().shorten(); } - void shorten(double s) { base_type::generator().shorten(s); } - double shorten() const { return base_type::generator().shorten(); } + private: + conv_marker_adaptor(const conv_marker_adaptor&); + const conv_marker_adaptor& operator=(const conv_marker_adaptor&); +}; - private: - conv_marker_adaptor(const conv_marker_adaptor&); - const conv_marker_adaptor& - operator = (const conv_marker_adaptor&); - }; - - -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_conv_offset.h b/deps/agg/include/agg_conv_offset.h index efecfaae6..ebd258351 100644 --- a/deps/agg/include/agg_conv_offset.h +++ b/deps/agg/include/agg_conv_offset.h @@ -22,59 +22,53 @@ #include "agg_array.h" #include "clipper.hpp" -namespace agg -{ +namespace agg { -template class conv_offset +template +class conv_offset { enum status { status_move_to, status_line_to, status_stop }; typedef VSA source_a_type; typedef conv_offset self_type; -private: - source_a_type* m_src_a; + private: + source_a_type* m_src_a; double m_offset; status m_status; int m_vertex; int m_contour; int m_scaling_factor; pod_bvector m_vertex_accumulator; - ClipperLib::Paths m_poly_a; - ClipperLib::Paths m_result; + ClipperLib::Paths m_poly_a; + ClipperLib::Paths m_result; ClipperLib::ClipperOffset m_clipper_offset; int Round(double val) { - if ((val < 0)) return (int)(val - 0.5); else return (int)(val + 0.5); + if ((val < 0)) + return (int)(val - 0.5); + else + return (int)(val + 0.5); } -public: - conv_offset(source_a_type &a, double offset = 0.0, - int scaling_factor = 0) - : m_src_a(&a), - m_offset(offset), - m_status(status_move_to), - m_vertex(-1), - m_contour(-1) + public: + conv_offset(source_a_type& a, double offset = 0.0, int scaling_factor = 0) + : m_src_a(&a) + , m_offset(offset) + , m_status(status_move_to) + , m_vertex(-1) + , m_contour(-1) { - m_scaling_factor = std::max(std::min(scaling_factor, 6),0); + m_scaling_factor = std::max(std::min(scaling_factor, 6), 0); m_scaling_factor = Round(std::pow((double)10, m_scaling_factor)); } - ~conv_offset() - { - } + ~conv_offset() {} - void set_offset(double offset) { m_offset = offset;} - unsigned type() const - { - return static_cast(m_src_a->type()); - } + void set_offset(double offset) { m_offset = offset; } + unsigned type() const { return static_cast(m_src_a->type()); } - double get_offset() const - { - return m_offset; - } + double get_offset() const { return m_offset; } void rewind(unsigned path_id); unsigned vertex(double* x, double* y); @@ -82,13 +76,17 @@ public: bool next_contour(); bool next_vertex(double* x, double* y); void start_extracting(); - void add_vertex_(double &x, double &y); - void end_contour(ClipperLib::Paths &p); + void add_vertex_(double& x, double& y); + void end_contour(ClipperLib::Paths& p); - template void add(VS &src, ClipperLib::Paths &p) + template + void add(VS& src, ClipperLib::Paths& p) { unsigned cmd; - double x; double y; double start_x; double start_y; + double x; + double y; + double start_x; + double start_y; bool starting_first_line; start_x = 0.0; @@ -96,26 +94,27 @@ public: starting_first_line = true; p.resize(0); - cmd = src->vertex( &x , &y ); - while(!is_stop(cmd)) + cmd = src->vertex(&x, &y); + while (!is_stop(cmd)) { - if(is_vertex(cmd)) + if (is_vertex(cmd)) { - if(is_move_to(cmd)) + if (is_move_to(cmd)) { - if(!starting_first_line ) end_contour(p); + if (!starting_first_line) + end_contour(p); start_x = x; start_y = y; } - add_vertex_( x, y ); + add_vertex_(x, y); starting_first_line = false; } - else if(is_end_poly(cmd)) + else if (is_end_poly(cmd)) { - if(!starting_first_line && is_closed(cmd)) - add_vertex_( start_x, start_y ); + if (!starting_first_line && is_closed(cmd)) + add_vertex_(start_x, start_y); } - cmd = src->vertex( &x, &y ); + cmd = src->vertex(&x, &y); } end_contour(p); } @@ -135,42 +134,43 @@ void conv_offset::start_extracting() template void conv_offset::rewind(unsigned path_id) { - m_src_a->rewind( path_id ); - //m_src_b->rewind( path_id ); + m_src_a->rewind(path_id); + // m_src_b->rewind( path_id ); - add( m_src_a , m_poly_a ); - //add( m_src_b , m_poly_b ); + add(m_src_a, m_poly_a); + // add( m_src_b , m_poly_b ); m_result.resize(0); m_clipper_offset.Clear(); - m_clipper_offset.AddPaths(m_poly_a,ClipperLib::jtMiter, ClipperLib::etOpenButt);//ClosedLine);//Polygon); + m_clipper_offset.AddPaths(m_poly_a, ClipperLib::jtMiter, ClipperLib::etOpenButt); // ClosedLine);//Polygon); m_clipper_offset.Execute(m_result, m_offset * m_scaling_factor); start_extracting(); } //------------------------------------------------------------------------------ template -void conv_offset::end_contour( ClipperLib::Paths &p) +void conv_offset::end_contour(ClipperLib::Paths& p) { unsigned i, len; - if( m_vertex_accumulator.size() < 3 ) return; + if (m_vertex_accumulator.size() < 3) + return; len = p.size(); - p.resize(len+1); + p.resize(len + 1); p[len].resize(m_vertex_accumulator.size()); - for( i = 0 ; i < m_vertex_accumulator.size() ; i++ ) + for (i = 0; i < m_vertex_accumulator.size(); i++) p[len][i] = m_vertex_accumulator[i]; m_vertex_accumulator.remove_all(); } //------------------------------------------------------------------------------ template -void conv_offset::add_vertex_(double &x, double &y) +void conv_offset::add_vertex_(double& x, double& y) { ClipperLib::IntPoint v; v.X = Round(x * m_scaling_factor); v.Y = Round(y * m_scaling_factor); - m_vertex_accumulator.add( v ); + m_vertex_accumulator.add(v); } //------------------------------------------------------------------------------ @@ -178,33 +178,35 @@ template bool conv_offset::next_contour() { m_contour++; - if(m_contour >= (int)m_result.size()) return false; - m_vertex =-1; + if (m_contour >= (int)m_result.size()) + return false; + m_vertex = -1; return true; } //------------------------------------------------------------------------------ template -bool conv_offset::next_vertex(double *x, double *y) +bool conv_offset::next_vertex(double* x, double* y) { m_vertex++; - if(m_vertex >= (int)m_result[m_contour].size()) return false; - *x = (double)m_result[ m_contour ][ m_vertex ].X / m_scaling_factor; - *y = (double)m_result[ m_contour ][ m_vertex ].Y / m_scaling_factor; + if (m_vertex >= (int)m_result[m_contour].size()) + return false; + *x = (double)m_result[m_contour][m_vertex].X / m_scaling_factor; + *y = (double)m_result[m_contour][m_vertex].Y / m_scaling_factor; return true; } //------------------------------------------------------------------------------ template -unsigned conv_offset::vertex(double *x, double *y) +unsigned conv_offset::vertex(double* x, double* y) { - if( m_status == status_move_to ) + if (m_status == status_move_to) { - if( next_contour() ) + if (next_contour()) { - if( next_vertex( x, y ) ) + if (next_vertex(x, y)) { - m_status =status_line_to; + m_status = status_line_to; return path_cmd_move_to; } else @@ -218,7 +220,7 @@ unsigned conv_offset::vertex(double *x, double *y) } else { - if( next_vertex( x, y ) ) + if (next_vertex(x, y)) { return path_cmd_line_to; } @@ -231,6 +233,5 @@ unsigned conv_offset::vertex(double *x, double *y) } //------------------------------------------------------------------------------ - -} //namespace agg -#endif //AGG_CONV_OFFSET_INCLUDED +} // namespace agg +#endif // AGG_CONV_OFFSET_INCLUDED diff --git a/deps/agg/include/agg_conv_segmentator.h b/deps/agg/include/agg_conv_segmentator.h index e69a9e7d7..84641dff3 100644 --- a/deps/agg/include/agg_conv_segmentator.h +++ b/deps/agg/include/agg_conv_segmentator.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -20,29 +20,26 @@ #include "agg_conv_adaptor_vpgen.h" #include "agg_vpgen_segmentator.h" -namespace agg +namespace agg { + +//========================================================conv_segmentator +template +struct conv_segmentator : public conv_adaptor_vpgen { + typedef conv_adaptor_vpgen base_type; - //========================================================conv_segmentator - template - struct conv_segmentator : public conv_adaptor_vpgen - { - typedef conv_adaptor_vpgen base_type; + conv_segmentator(VertexSource& vs) + : conv_adaptor_vpgen(vs) + {} - conv_segmentator(VertexSource& vs) : - conv_adaptor_vpgen(vs) {} + void approximation_scale(double s) { base_type::vpgen().approximation_scale(s); } + double approximation_scale() const { return base_type::vpgen().approximation_scale(); } - void approximation_scale(double s) { base_type::vpgen().approximation_scale(s); } - double approximation_scale() const { return base_type::vpgen().approximation_scale(); } + private: + conv_segmentator(const conv_segmentator&); + const conv_segmentator& operator=(const conv_segmentator&); +}; - private: - conv_segmentator(const conv_segmentator&); - const conv_segmentator& - operator = (const conv_segmentator&); - }; - - -} +} // namespace agg #endif - diff --git a/deps/agg/include/agg_conv_shorten_path.h b/deps/agg/include/agg_conv_shorten_path.h index 5617e51d1..b3073c9a8 100644 --- a/deps/agg/include/agg_conv_shorten_path.h +++ b/deps/agg/include/agg_conv_shorten_path.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -20,31 +20,27 @@ #include "agg_conv_adaptor_vcgen.h" #include "agg_vcgen_vertex_sequence.h" -namespace agg +namespace agg { + +//=======================================================conv_shorten_path +template +class conv_shorten_path : public conv_adaptor_vcgen { + public: + typedef conv_adaptor_vcgen base_type; - //=======================================================conv_shorten_path - template class conv_shorten_path : - public conv_adaptor_vcgen - { - public: - typedef conv_adaptor_vcgen base_type; + conv_shorten_path(VertexSource& vs) + : conv_adaptor_vcgen(vs) + {} - conv_shorten_path(VertexSource& vs) : - conv_adaptor_vcgen(vs) - { - } + void shorten(double s) { base_type::generator().shorten(s); } + double shorten() const { return base_type::generator().shorten(); } - void shorten(double s) { base_type::generator().shorten(s); } - double shorten() const { return base_type::generator().shorten(); } + private: + conv_shorten_path(const conv_shorten_path&); + const conv_shorten_path& operator=(const conv_shorten_path&); +}; - private: - conv_shorten_path(const conv_shorten_path&); - const conv_shorten_path& - operator = (const conv_shorten_path&); - }; - - -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_conv_smooth_poly1.h b/deps/agg/include/agg_conv_smooth_poly1.h index fd55085b5..eb389d2a4 100644 --- a/deps/agg/include/agg_conv_smooth_poly1.h +++ b/deps/agg/include/agg_conv_smooth_poly1.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -24,70 +24,62 @@ #include "agg_conv_adaptor_vcgen.h" #include "agg_conv_curve.h" +namespace agg { -namespace agg +//-------------------------------------------------------conv_smooth +template +struct conv_smooth : public conv_adaptor_vcgen { + typedef conv_adaptor_vcgen base_type; - //-------------------------------------------------------conv_smooth - template - struct conv_smooth : - public conv_adaptor_vcgen + conv_smooth(VertexSource& vs) + : conv_adaptor_vcgen(vs) + {} + + conv_smooth(conv_smooth&&) = default; + + conv_smooth(const conv_smooth&) = delete; + const conv_smooth& + operator=(const conv_smooth&) = delete; + + void smooth_value(double v) { base_type::generator().smooth_value(v); } + double smooth_value() const { return base_type::generator().smooth_value(); } + unsigned type() const { return base_type::type(); } +}; + +template +using conv_smooth_poly1 = conv_smooth; + +//-------------------------------------------------conv_smooth_curve +template +struct conv_smooth_curve : public conv_curve> +{ + conv_smooth_curve(VertexSource& vs) + : conv_curve>(m_smooth) + , m_smooth(vs) + {} + + conv_smooth_curve(conv_smooth_curve&& rhs) + : conv_curve>(std::move(rhs)) + , m_smooth(std::move(rhs.m_smooth)) { - typedef conv_adaptor_vcgen base_type; + this->attach(m_smooth); + } - conv_smooth(VertexSource& vs) : - conv_adaptor_vcgen(vs) - { - } + conv_smooth_curve(const conv_smooth_curve&) = delete; + const conv_smooth_curve& + operator=(const conv_smooth_curve&) = delete; - conv_smooth(conv_smooth &&) = default; + void smooth_value(double v) { m_smooth.generator().smooth_value(v); } + double smooth_value() const { return m_smooth.generator().smooth_value(); } + unsigned type() const { return m_smooth.type(); } - conv_smooth(const conv_smooth&) = delete; - const conv_smooth& - operator = (const conv_smooth&) = delete; - - void smooth_value(double v) { base_type::generator().smooth_value(v); } - double smooth_value() const { return base_type::generator().smooth_value(); } - unsigned type() const { return base_type::type(); } - }; - - template - using conv_smooth_poly1 = conv_smooth; - - //-------------------------------------------------conv_smooth_curve - template - struct conv_smooth_curve : - public conv_curve> - { - conv_smooth_curve(VertexSource& vs) : - conv_curve>(m_smooth), - m_smooth(vs) - { - } - - conv_smooth_curve(conv_smooth_curve && rhs) : - conv_curve>(std::move(rhs)), - m_smooth(std::move(rhs.m_smooth)) - { - this->attach(m_smooth); - } - - conv_smooth_curve(const conv_smooth_curve&) = delete; - const conv_smooth_curve& - operator = (const conv_smooth_curve&) = delete; - - void smooth_value(double v) { m_smooth.generator().smooth_value(v); } - double smooth_value() const { return m_smooth.generator().smooth_value(); } - unsigned type() const { return m_smooth.type(); } - - private: - conv_smooth m_smooth; - }; - - template - using conv_smooth_poly1_curve = conv_smooth_curve; -} + private: + conv_smooth m_smooth; +}; +template +using conv_smooth_poly1_curve = conv_smooth_curve; +} // namespace agg #endif - diff --git a/deps/agg/include/agg_conv_stroke.h b/deps/agg/include/agg_conv_stroke.h index e19a6b61f..c08945daf 100644 --- a/deps/agg/include/agg_conv_stroke.h +++ b/deps/agg/include/agg_conv_stroke.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -23,51 +23,46 @@ #include "agg_vcgen_stroke.h" #include "agg_conv_adaptor_vcgen.h" -namespace agg +namespace agg { + +//-------------------------------------------------------------conv_stroke +template +struct conv_stroke : public conv_adaptor_vcgen { + typedef Markers marker_type; + typedef conv_adaptor_vcgen base_type; - //-------------------------------------------------------------conv_stroke - template - struct conv_stroke : - public conv_adaptor_vcgen - { - typedef Markers marker_type; - typedef conv_adaptor_vcgen base_type; + conv_stroke(VertexSource& vs) + : conv_adaptor_vcgen(vs) + {} - conv_stroke(VertexSource& vs) : - conv_adaptor_vcgen(vs) - { - } + void line_cap(line_cap_e lc) { base_type::generator().line_cap(lc); } + void line_join(line_join_e lj) { base_type::generator().line_join(lj); } + void inner_join(inner_join_e ij) { base_type::generator().inner_join(ij); } - void line_cap(line_cap_e lc) { base_type::generator().line_cap(lc); } - void line_join(line_join_e lj) { base_type::generator().line_join(lj); } - void inner_join(inner_join_e ij) { base_type::generator().inner_join(ij); } + line_cap_e line_cap() const { return base_type::generator().line_cap(); } + line_join_e line_join() const { return base_type::generator().line_join(); } + inner_join_e inner_join() const { return base_type::generator().inner_join(); } - line_cap_e line_cap() const { return base_type::generator().line_cap(); } - line_join_e line_join() const { return base_type::generator().line_join(); } - inner_join_e inner_join() const { return base_type::generator().inner_join(); } + void width(double w) { base_type::generator().width(w); } + void miter_limit(double ml) { base_type::generator().miter_limit(ml); } + void miter_limit_theta(double t) { base_type::generator().miter_limit_theta(t); } + void inner_miter_limit(double ml) { base_type::generator().inner_miter_limit(ml); } + void approximation_scale(double as) { base_type::generator().approximation_scale(as); } - void width(double w) { base_type::generator().width(w); } - void miter_limit(double ml) { base_type::generator().miter_limit(ml); } - void miter_limit_theta(double t) { base_type::generator().miter_limit_theta(t); } - void inner_miter_limit(double ml) { base_type::generator().inner_miter_limit(ml); } - void approximation_scale(double as) { base_type::generator().approximation_scale(as); } + double width() const { return base_type::generator().width(); } + double miter_limit() const { return base_type::generator().miter_limit(); } + double inner_miter_limit() const { return base_type::generator().inner_miter_limit(); } + double approximation_scale() const { return base_type::generator().approximation_scale(); } - double width() const { return base_type::generator().width(); } - double miter_limit() const { return base_type::generator().miter_limit(); } - double inner_miter_limit() const { return base_type::generator().inner_miter_limit(); } - double approximation_scale() const { return base_type::generator().approximation_scale(); } + void shorten(double s) { base_type::generator().shorten(s); } + double shorten() const { return base_type::generator().shorten(); } - void shorten(double s) { base_type::generator().shorten(s); } - double shorten() const { return base_type::generator().shorten(); } + private: + conv_stroke(const conv_stroke&); + const conv_stroke& operator=(const conv_stroke&); +}; - private: - conv_stroke(const conv_stroke&); - const conv_stroke& - operator = (const conv_stroke&); - - }; - -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_conv_transform.h b/deps/agg/include/agg_conv_transform.h index 886acb35b..c78f312d0 100644 --- a/deps/agg/include/agg_conv_transform.h +++ b/deps/agg/include/agg_conv_transform.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -22,50 +22,44 @@ #include "agg_basics.h" #include "agg_trans_affine.h" -namespace agg +namespace agg { + +//----------------------------------------------------------conv_transform +template +class conv_transform { + public: + conv_transform(VertexSource& source, Transformer& tr) + : m_source(&source) + , m_trans(&tr) + {} - //----------------------------------------------------------conv_transform - template class conv_transform + void attach(VertexSource& source) { m_source = &source; } + + void rewind(unsigned path_id) { m_source->rewind(path_id); } + + unsigned vertex(double* x, double* y) { - public: - conv_transform(VertexSource& source, Transformer& tr) : - m_source(&source), m_trans(&tr) {} - - void attach(VertexSource& source) { m_source = &source; } - - void rewind(unsigned path_id) - { - m_source->rewind(path_id); - } - - unsigned vertex(double* x, double* y) + unsigned cmd = m_source->vertex(x, y); + if (is_vertex(cmd)) { - unsigned cmd = m_source->vertex(x, y); - if(is_vertex(cmd)) - { - m_trans->transform(x, y); - } - return cmd; + m_trans->transform(x, y); } + return cmd; + } - void transformer(Transformer& tr) - { - m_trans = &tr; - } + void transformer(Transformer& tr) { m_trans = &tr; } - unsigned type() const { return m_source->type(); } + unsigned type() const { return m_source->type(); } - private: - conv_transform(const conv_transform&); - const conv_transform& - operator = (const conv_transform&); + private: + conv_transform(const conv_transform&); + const conv_transform& operator=(const conv_transform&); - VertexSource* m_source; - const Transformer* m_trans; - }; + VertexSource* m_source; + const Transformer* m_trans; +}; - -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_conv_unclose_polygon.h b/deps/agg/include/agg_conv_unclose_polygon.h index fe5c26381..72c752503 100644 --- a/deps/agg/include/agg_conv_unclose_polygon.h +++ b/deps/agg/include/agg_conv_unclose_polygon.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -18,35 +18,34 @@ #include "agg_basics.h" -namespace agg +namespace agg { +//====================================================conv_unclose_polygon +template +class conv_unclose_polygon { - //====================================================conv_unclose_polygon - template class conv_unclose_polygon + public: + explicit conv_unclose_polygon(VertexSource& vs) + : m_source(&vs) + {} + void attach(VertexSource& source) { m_source = &source; } + + void rewind(unsigned path_id) { m_source->rewind(path_id); } + + unsigned vertex(double* x, double* y) { - public: - explicit conv_unclose_polygon(VertexSource& vs) : m_source(&vs) {} - void attach(VertexSource& source) { m_source = &source; } + unsigned cmd = m_source->vertex(x, y); + if (is_end_poly(cmd)) + cmd &= ~path_flags_close; + return cmd; + } - void rewind(unsigned path_id) - { - m_source->rewind(path_id); - } + private: + conv_unclose_polygon(const conv_unclose_polygon&); + const conv_unclose_polygon& operator=(const conv_unclose_polygon&); - unsigned vertex(double* x, double* y) - { - unsigned cmd = m_source->vertex(x, y); - if(is_end_poly(cmd)) cmd &= ~path_flags_close; - return cmd; - } + VertexSource* m_source; +}; - private: - conv_unclose_polygon(const conv_unclose_polygon&); - const conv_unclose_polygon& - operator = (const conv_unclose_polygon&); - - VertexSource* m_source; - }; - -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_curves.h b/deps/agg/include/agg_curves.h index ad893adb4..aa318a81c 100644 --- a/deps/agg/include/agg_curves.h +++ b/deps/agg/include/agg_curves.h @@ -3,8 +3,8 @@ // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // Copyright (C) 2005 Tony Juricic (tonygeek@yahoo.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -21,675 +21,559 @@ #include -namespace agg +namespace agg { + +// See Implementation agg_curves.cpp + +//--------------------------------------------curve_approximation_method_e +enum curve_approximation_method_e { curve_inc, curve_div }; + +//--------------------------------------------------------------curve3_inc +class MAPNIK_DECL curve3_inc { + public: + curve3_inc() + : m_num_steps(0) + , m_step(0) + , m_scale(1.0) + {} - // See Implementation agg_curves.cpp - - //--------------------------------------------curve_approximation_method_e - enum curve_approximation_method_e + curve3_inc(double x1, double y1, double x2, double y2, double x3, double y3) + : m_num_steps(0) + , m_step(0) + , m_scale(1.0) { - curve_inc, - curve_div - }; - - //--------------------------------------------------------------curve3_inc - class MAPNIK_DECL curve3_inc - { - public: - curve3_inc() : - m_num_steps(0), m_step(0), m_scale(1.0) { } - - curve3_inc(double x1, double y1, - double x2, double y2, - double x3, double y3) : - m_num_steps(0), m_step(0), m_scale(1.0) - { - init(x1, y1, x2, y2, x3, y3); - } - - void reset() { m_num_steps = 0; m_step = -1; } - void init(double x1, double y1, - double x2, double y2, - double x3, double y3); - - void approximation_method(curve_approximation_method_e) {} - curve_approximation_method_e approximation_method() const { return curve_inc; } - - void approximation_scale(double s); - double approximation_scale() const; - - void angle_tolerance(double) {} - double angle_tolerance() const { return 0.0; } - - void cusp_limit(double) {} - double cusp_limit() const { return 0.0; } - - void rewind(unsigned path_id); - unsigned vertex(double* x, double* y); - - private: - int m_num_steps; - int m_step; - double m_scale; - double m_start_x; - double m_start_y; - double m_end_x; - double m_end_y; - double m_fx; - double m_fy; - double m_dfx; - double m_dfy; - double m_ddfx; - double m_ddfy; - double m_saved_fx; - double m_saved_fy; - double m_saved_dfx; - double m_saved_dfy; - }; - - - - - - //-------------------------------------------------------------curve3_div - class MAPNIK_DECL curve3_div - { - public: - curve3_div() : - m_approximation_scale(1.0), - m_angle_tolerance(0.0), - m_count(0) - {} - - curve3_div(double x1, double y1, - double x2, double y2, - double x3, double y3) : - m_approximation_scale(1.0), - m_angle_tolerance(0.0), - m_count(0) - { - init(x1, y1, x2, y2, x3, y3); - } - - void reset() { m_points.remove_all(); m_count = 0; } - void init(double x1, double y1, - double x2, double y2, - double x3, double y3); - - void approximation_method(curve_approximation_method_e) {} - curve_approximation_method_e approximation_method() const { return curve_div; } - - void approximation_scale(double s) { m_approximation_scale = s; } - double approximation_scale() const { return m_approximation_scale; } - - void angle_tolerance(double a) { m_angle_tolerance = a; } - double angle_tolerance() const { return m_angle_tolerance; } - - void cusp_limit(double) {} - double cusp_limit() const { return 0.0; } - - void rewind(unsigned) - { - m_count = 0; - } - - unsigned vertex(double* x, double* y) - { - if(m_count >= m_points.size()) return path_cmd_stop; - const point_d& p = m_points[m_count++]; - *x = p.x; - *y = p.y; - return (m_count == 1) ? path_cmd_move_to : path_cmd_line_to; - } - - private: - void bezier(double x1, double y1, - double x2, double y2, - double x3, double y3); - void recursive_bezier(double x1, double y1, - double x2, double y2, - double x3, double y3, - unsigned level); - - double m_approximation_scale; - double m_distance_tolerance_square; - double m_angle_tolerance; - unsigned m_count; - pod_bvector m_points; - }; - - - - - - - - //-------------------------------------------------------------curve4_points - struct MAPNIK_DECL curve4_points - { - double cp[8]; - curve4_points() {} - curve4_points(double x1, double y1, - double x2, double y2, - double x3, double y3, - double x4, double y4) - { - cp[0] = x1; cp[1] = y1; cp[2] = x2; cp[3] = y2; - cp[4] = x3; cp[5] = y3; cp[6] = x4; cp[7] = y4; - } - void init(double x1, double y1, - double x2, double y2, - double x3, double y3, - double x4, double y4) - { - cp[0] = x1; cp[1] = y1; cp[2] = x2; cp[3] = y2; - cp[4] = x3; cp[5] = y3; cp[6] = x4; cp[7] = y4; - } - double operator [] (unsigned i) const { return cp[i]; } - double& operator [] (unsigned i) { return cp[i]; } - }; - - - - //-------------------------------------------------------------curve4_inc - class MAPNIK_DECL curve4_inc - { - public: - curve4_inc() : - m_num_steps(0), m_step(0), m_scale(1.0) { } - - curve4_inc(double x1, double y1, - double x2, double y2, - double x3, double y3, - double x4, double y4) : - m_num_steps(0), m_step(0), m_scale(1.0) - { - init(x1, y1, x2, y2, x3, y3, x4, y4); - } - - curve4_inc(const curve4_points& cp) : - m_num_steps(0), m_step(0), m_scale(1.0) - { - init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]); - } - - void reset() { m_num_steps = 0; m_step = -1; } - void init(double x1, double y1, - double x2, double y2, - double x3, double y3, - double x4, double y4); - - void init(const curve4_points& cp) - { - init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]); - } - - void approximation_method(curve_approximation_method_e) {} - curve_approximation_method_e approximation_method() const { return curve_inc; } - - void approximation_scale(double s); - double approximation_scale() const; - - void angle_tolerance(double) {} - double angle_tolerance() const { return 0.0; } - - void cusp_limit(double) {} - double cusp_limit() const { return 0.0; } - - void rewind(unsigned path_id); - unsigned vertex(double* x, double* y); - - private: - int m_num_steps; - int m_step; - double m_scale; - double m_start_x; - double m_start_y; - double m_end_x; - double m_end_y; - double m_fx; - double m_fy; - double m_dfx; - double m_dfy; - double m_ddfx; - double m_ddfy; - double m_dddfx; - double m_dddfy; - double m_saved_fx; - double m_saved_fy; - double m_saved_dfx; - double m_saved_dfy; - double m_saved_ddfx; - double m_saved_ddfy; - }; - - - - //-------------------------------------------------------catrom_to_bezier - inline curve4_points catrom_to_bezier(double x1, double y1, - double x2, double y2, - double x3, double y3, - double x4, double y4) - { - // Trans. matrix Catmull-Rom to Bezier - // - // 0 1 0 0 - // -1/6 1 1/6 0 - // 0 1/6 1 -1/6 - // 0 0 1 0 - // - return curve4_points( - x2, - y2, - (-x1 + 6*x2 + x3) / 6, - (-y1 + 6*y2 + y3) / 6, - ( x2 + 6*x3 - x4) / 6, - ( y2 + 6*y3 - y4) / 6, - x3, - y3); + init(x1, y1, x2, y2, x3, y3); } - - //----------------------------------------------------------------------- - inline curve4_points - catrom_to_bezier(const curve4_points& cp) + void reset() { - return catrom_to_bezier(cp[0], cp[1], cp[2], cp[3], - cp[4], cp[5], cp[6], cp[7]); + m_num_steps = 0; + m_step = -1; + } + void init(double x1, double y1, double x2, double y2, double x3, double y3); + + void approximation_method(curve_approximation_method_e) {} + curve_approximation_method_e approximation_method() const { return curve_inc; } + + void approximation_scale(double s); + double approximation_scale() const; + + void angle_tolerance(double) {} + double angle_tolerance() const { return 0.0; } + + void cusp_limit(double) {} + double cusp_limit() const { return 0.0; } + + void rewind(unsigned path_id); + unsigned vertex(double* x, double* y); + + private: + int m_num_steps; + int m_step; + double m_scale; + double m_start_x; + double m_start_y; + double m_end_x; + double m_end_y; + double m_fx; + double m_fy; + double m_dfx; + double m_dfy; + double m_ddfx; + double m_ddfy; + double m_saved_fx; + double m_saved_fy; + double m_saved_dfx; + double m_saved_dfy; +}; + +//-------------------------------------------------------------curve3_div +class MAPNIK_DECL curve3_div +{ + public: + curve3_div() + : m_approximation_scale(1.0) + , m_angle_tolerance(0.0) + , m_count(0) + {} + + curve3_div(double x1, double y1, double x2, double y2, double x3, double y3) + : m_approximation_scale(1.0) + , m_angle_tolerance(0.0) + , m_count(0) + { + init(x1, y1, x2, y2, x3, y3); } - - - //-----------------------------------------------------ubspline_to_bezier - inline curve4_points ubspline_to_bezier(double x1, double y1, - double x2, double y2, - double x3, double y3, - double x4, double y4) + void reset() { - // Trans. matrix Uniform BSpline to Bezier - // - // 1/6 4/6 1/6 0 - // 0 4/6 2/6 0 - // 0 2/6 4/6 0 - // 0 1/6 4/6 1/6 - // - return curve4_points( - (x1 + 4*x2 + x3) / 6, - (y1 + 4*y2 + y3) / 6, - (4*x2 + 2*x3) / 6, - (4*y2 + 2*y3) / 6, - (2*x2 + 4*x3) / 6, - (2*y2 + 4*y3) / 6, - (x2 + 4*x3 + x4) / 6, - (y2 + 4*y3 + y4) / 6); + m_points.remove_all(); + m_count = 0; + } + void init(double x1, double y1, double x2, double y2, double x3, double y3); + + void approximation_method(curve_approximation_method_e) {} + curve_approximation_method_e approximation_method() const { return curve_div; } + + void approximation_scale(double s) { m_approximation_scale = s; } + double approximation_scale() const { return m_approximation_scale; } + + void angle_tolerance(double a) { m_angle_tolerance = a; } + double angle_tolerance() const { return m_angle_tolerance; } + + void cusp_limit(double) {} + double cusp_limit() const { return 0.0; } + + void rewind(unsigned) { m_count = 0; } + + unsigned vertex(double* x, double* y) + { + if (m_count >= m_points.size()) + return path_cmd_stop; + const point_d& p = m_points[m_count++]; + *x = p.x; + *y = p.y; + return (m_count == 1) ? path_cmd_move_to : path_cmd_line_to; } + private: + void bezier(double x1, double y1, double x2, double y2, double x3, double y3); + void recursive_bezier(double x1, double y1, double x2, double y2, double x3, double y3, unsigned level); - //----------------------------------------------------------------------- - inline curve4_points - ubspline_to_bezier(const curve4_points& cp) + double m_approximation_scale; + double m_distance_tolerance_square; + double m_angle_tolerance; + unsigned m_count; + pod_bvector m_points; +}; + +//-------------------------------------------------------------curve4_points +struct MAPNIK_DECL curve4_points +{ + double cp[8]; + curve4_points() {} + curve4_points(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) { - return ubspline_to_bezier(cp[0], cp[1], cp[2], cp[3], - cp[4], cp[5], cp[6], cp[7]); + cp[0] = x1; + cp[1] = y1; + cp[2] = x2; + cp[3] = y2; + cp[4] = x3; + cp[5] = y3; + cp[6] = x4; + cp[7] = y4; + } + void init(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) + { + cp[0] = x1; + cp[1] = y1; + cp[2] = x2; + cp[3] = y2; + cp[4] = x3; + cp[5] = y3; + cp[6] = x4; + cp[7] = y4; + } + double operator[](unsigned i) const { return cp[i]; } + double& operator[](unsigned i) { return cp[i]; } +}; + +//-------------------------------------------------------------curve4_inc +class MAPNIK_DECL curve4_inc +{ + public: + curve4_inc() + : m_num_steps(0) + , m_step(0) + , m_scale(1.0) + {} + + curve4_inc(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) + : m_num_steps(0) + , m_step(0) + , m_scale(1.0) + { + init(x1, y1, x2, y2, x3, y3, x4, y4); } - - - - //------------------------------------------------------hermite_to_bezier - inline curve4_points hermite_to_bezier(double x1, double y1, - double x2, double y2, - double x3, double y3, - double x4, double y4) + curve4_inc(const curve4_points& cp) + : m_num_steps(0) + , m_step(0) + , m_scale(1.0) { - // Trans. matrix Hermite to Bezier - // - // 1 0 0 0 - // 1 0 1/3 0 - // 0 1 0 -1/3 - // 0 1 0 0 - // - return curve4_points( - x1, - y1, - (3*x1 + x3) / 3, - (3*y1 + y3) / 3, - (3*x2 - x4) / 3, - (3*y2 - y4) / 3, - x2, - y2); + init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]); } - - - //----------------------------------------------------------------------- - inline curve4_points - hermite_to_bezier(const curve4_points& cp) + void reset() { - return hermite_to_bezier(cp[0], cp[1], cp[2], cp[3], - cp[4], cp[5], cp[6], cp[7]); + m_num_steps = 0; + m_step = -1; } + void init(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4); + void init(const curve4_points& cp) { init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]); } - //-------------------------------------------------------------curve4_div - class MAPNIK_DECL curve4_div - { - public: - curve4_div() : - m_approximation_scale(1.0), - m_angle_tolerance(0.0), - m_cusp_limit(0.0), - m_count(0) - {} + void approximation_method(curve_approximation_method_e) {} + curve_approximation_method_e approximation_method() const { return curve_inc; } - curve4_div(double x1, double y1, - double x2, double y2, - double x3, double y3, - double x4, double y4) : - m_approximation_scale(1.0), - m_angle_tolerance(0.0), - m_cusp_limit(0.0), - m_count(0) - { - init(x1, y1, x2, y2, x3, y3, x4, y4); - } + void approximation_scale(double s); + double approximation_scale() const; - curve4_div(const curve4_points& cp) : - m_approximation_scale(1.0), - m_angle_tolerance(0.0), - m_count(0) - { - init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]); - } - - void reset() { m_points.remove_all(); m_count = 0; } - void init(double x1, double y1, - double x2, double y2, - double x3, double y3, - double x4, double y4); - - void init(const curve4_points& cp) - { - init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]); - } - - void approximation_method(curve_approximation_method_e) {} - - curve_approximation_method_e approximation_method() const - { - return curve_div; - } - - void approximation_scale(double s) { m_approximation_scale = s; } - double approximation_scale() const { return m_approximation_scale; } - - void angle_tolerance(double a) { m_angle_tolerance = a; } - double angle_tolerance() const { return m_angle_tolerance; } - - void cusp_limit(double v) - { - m_cusp_limit = (v == 0.0) ? 0.0 : pi - v; - } - - double cusp_limit() const - { - return (m_cusp_limit == 0.0) ? 0.0 : pi - m_cusp_limit; - } - - void rewind(unsigned) - { - m_count = 0; - } - - unsigned vertex(double* x, double* y) - { - if(m_count >= m_points.size()) return path_cmd_stop; - const point_d& p = m_points[m_count++]; - *x = p.x; - *y = p.y; - return (m_count == 1) ? path_cmd_move_to : path_cmd_line_to; - } - - private: - void bezier(double x1, double y1, - double x2, double y2, - double x3, double y3, - double x4, double y4); - - void recursive_bezier(double x1, double y1, - double x2, double y2, - double x3, double y3, - double x4, double y4, - unsigned level); - - double m_approximation_scale; - double m_distance_tolerance_square; - double m_angle_tolerance; - double m_cusp_limit; - unsigned m_count; - pod_bvector m_points; - }; - - - //-----------------------------------------------------------------curve3 - class MAPNIK_DECL curve3 - { - public: - curve3() : m_approximation_method(curve_div) {} - curve3(double x1, double y1, - double x2, double y2, - double x3, double y3) : - m_approximation_method(curve_div) - { - init(x1, y1, x2, y2, x3, y3); - } - - void reset() - { - m_curve_inc.reset(); - m_curve_div.reset(); - } - - void init(double x1, double y1, - double x2, double y2, - double x3, double y3) - { - if(m_approximation_method == curve_inc) - { - m_curve_inc.init(x1, y1, x2, y2, x3, y3); - } - else - { - m_curve_div.init(x1, y1, x2, y2, x3, y3); - } - } - - void approximation_method(curve_approximation_method_e v) - { - m_approximation_method = v; - } - - curve_approximation_method_e approximation_method() const - { - return m_approximation_method; - } - - void approximation_scale(double s) - { - m_curve_inc.approximation_scale(s); - m_curve_div.approximation_scale(s); - } - - double approximation_scale() const - { - return m_curve_inc.approximation_scale(); - } - - void angle_tolerance(double a) - { - m_curve_div.angle_tolerance(a); - } - - double angle_tolerance() const - { - return m_curve_div.angle_tolerance(); - } - - void cusp_limit(double v) - { - m_curve_div.cusp_limit(v); - } - - double cusp_limit() const - { - return m_curve_div.cusp_limit(); - } - - void rewind(unsigned path_id) - { - if(m_approximation_method == curve_inc) - { - m_curve_inc.rewind(path_id); - } - else - { - m_curve_div.rewind(path_id); - } - } - - unsigned vertex(double* x, double* y) - { - if(m_approximation_method == curve_inc) - { - return m_curve_inc.vertex(x, y); - } - return m_curve_div.vertex(x, y); - } - - private: - curve3_inc m_curve_inc; - curve3_div m_curve_div; - curve_approximation_method_e m_approximation_method; - }; - - - - - - //-----------------------------------------------------------------curve4 - class MAPNIK_DECL curve4 - { - public: - curve4() : m_approximation_method(curve_div) {} - curve4(double x1, double y1, - double x2, double y2, - double x3, double y3, - double x4, double y4) : - m_approximation_method(curve_div) - { - init(x1, y1, x2, y2, x3, y3, x4, y4); - } - - curve4(const curve4_points& cp) : - m_approximation_method(curve_div) - { - init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]); - } - - void reset() - { - m_curve_inc.reset(); - m_curve_div.reset(); - } - - void init(double x1, double y1, - double x2, double y2, - double x3, double y3, - double x4, double y4) - { - if(m_approximation_method == curve_inc) - { - m_curve_inc.init(x1, y1, x2, y2, x3, y3, x4, y4); - } - else - { - m_curve_div.init(x1, y1, x2, y2, x3, y3, x4, y4); - } - } - - void init(const curve4_points& cp) - { - init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]); - } - - void approximation_method(curve_approximation_method_e v) - { - m_approximation_method = v; - } - - curve_approximation_method_e approximation_method() const - { - return m_approximation_method; - } - - void approximation_scale(double s) - { - m_curve_inc.approximation_scale(s); - m_curve_div.approximation_scale(s); - } - double approximation_scale() const { return m_curve_inc.approximation_scale(); } - - void angle_tolerance(double v) - { - m_curve_div.angle_tolerance(v); - } - - double angle_tolerance() const - { - return m_curve_div.angle_tolerance(); - } - - void cusp_limit(double v) - { - m_curve_div.cusp_limit(v); - } - - double cusp_limit() const - { - return m_curve_div.cusp_limit(); - } - - void rewind(unsigned path_id) - { - if(m_approximation_method == curve_inc) - { - m_curve_inc.rewind(path_id); - } - else - { - m_curve_div.rewind(path_id); - } - } - - unsigned vertex(double* x, double* y) - { - if(m_approximation_method == curve_inc) - { - return m_curve_inc.vertex(x, y); - } - return m_curve_div.vertex(x, y); - } - - private: - curve4_inc m_curve_inc; - curve4_div m_curve_div; - curve_approximation_method_e m_approximation_method; - }; + void angle_tolerance(double) {} + double angle_tolerance() const { return 0.0; } + void cusp_limit(double) {} + double cusp_limit() const { return 0.0; } + void rewind(unsigned path_id); + unsigned vertex(double* x, double* y); + private: + int m_num_steps; + int m_step; + double m_scale; + double m_start_x; + double m_start_y; + double m_end_x; + double m_end_y; + double m_fx; + double m_fy; + double m_dfx; + double m_dfy; + double m_ddfx; + double m_ddfy; + double m_dddfx; + double m_dddfy; + double m_saved_fx; + double m_saved_fy; + double m_saved_dfx; + double m_saved_dfy; + double m_saved_ddfx; + double m_saved_ddfy; +}; +//-------------------------------------------------------catrom_to_bezier +inline curve4_points + catrom_to_bezier(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) +{ + // Trans. matrix Catmull-Rom to Bezier + // + // 0 1 0 0 + // -1/6 1 1/6 0 + // 0 1/6 1 -1/6 + // 0 0 1 0 + // + return curve4_points(x2, + y2, + (-x1 + 6 * x2 + x3) / 6, + (-y1 + 6 * y2 + y3) / 6, + (x2 + 6 * x3 - x4) / 6, + (y2 + 6 * y3 - y4) / 6, + x3, + y3); } +//----------------------------------------------------------------------- +inline curve4_points catrom_to_bezier(const curve4_points& cp) +{ + return catrom_to_bezier(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]); +} + +//-----------------------------------------------------ubspline_to_bezier +inline curve4_points + ubspline_to_bezier(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) +{ + // Trans. matrix Uniform BSpline to Bezier + // + // 1/6 4/6 1/6 0 + // 0 4/6 2/6 0 + // 0 2/6 4/6 0 + // 0 1/6 4/6 1/6 + // + return curve4_points((x1 + 4 * x2 + x3) / 6, + (y1 + 4 * y2 + y3) / 6, + (4 * x2 + 2 * x3) / 6, + (4 * y2 + 2 * y3) / 6, + (2 * x2 + 4 * x3) / 6, + (2 * y2 + 4 * y3) / 6, + (x2 + 4 * x3 + x4) / 6, + (y2 + 4 * y3 + y4) / 6); +} + +//----------------------------------------------------------------------- +inline curve4_points ubspline_to_bezier(const curve4_points& cp) +{ + return ubspline_to_bezier(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]); +} + +//------------------------------------------------------hermite_to_bezier +inline curve4_points + hermite_to_bezier(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) +{ + // Trans. matrix Hermite to Bezier + // + // 1 0 0 0 + // 1 0 1/3 0 + // 0 1 0 -1/3 + // 0 1 0 0 + // + return curve4_points(x1, y1, (3 * x1 + x3) / 3, (3 * y1 + y3) / 3, (3 * x2 - x4) / 3, (3 * y2 - y4) / 3, x2, y2); +} + +//----------------------------------------------------------------------- +inline curve4_points hermite_to_bezier(const curve4_points& cp) +{ + return hermite_to_bezier(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]); +} + +//-------------------------------------------------------------curve4_div +class MAPNIK_DECL curve4_div +{ + public: + curve4_div() + : m_approximation_scale(1.0) + , m_angle_tolerance(0.0) + , m_cusp_limit(0.0) + , m_count(0) + {} + + curve4_div(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) + : m_approximation_scale(1.0) + , m_angle_tolerance(0.0) + , m_cusp_limit(0.0) + , m_count(0) + { + init(x1, y1, x2, y2, x3, y3, x4, y4); + } + + curve4_div(const curve4_points& cp) + : m_approximation_scale(1.0) + , m_angle_tolerance(0.0) + , m_count(0) + { + init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]); + } + + void reset() + { + m_points.remove_all(); + m_count = 0; + } + void init(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4); + + void init(const curve4_points& cp) { init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]); } + + void approximation_method(curve_approximation_method_e) {} + + curve_approximation_method_e approximation_method() const { return curve_div; } + + void approximation_scale(double s) { m_approximation_scale = s; } + double approximation_scale() const { return m_approximation_scale; } + + void angle_tolerance(double a) { m_angle_tolerance = a; } + double angle_tolerance() const { return m_angle_tolerance; } + + void cusp_limit(double v) { m_cusp_limit = (v == 0.0) ? 0.0 : pi - v; } + + double cusp_limit() const { return (m_cusp_limit == 0.0) ? 0.0 : pi - m_cusp_limit; } + + void rewind(unsigned) { m_count = 0; } + + unsigned vertex(double* x, double* y) + { + if (m_count >= m_points.size()) + return path_cmd_stop; + const point_d& p = m_points[m_count++]; + *x = p.x; + *y = p.y; + return (m_count == 1) ? path_cmd_move_to : path_cmd_line_to; + } + + private: + void bezier(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4); + + void recursive_bezier(double x1, + double y1, + double x2, + double y2, + double x3, + double y3, + double x4, + double y4, + unsigned level); + + double m_approximation_scale; + double m_distance_tolerance_square; + double m_angle_tolerance; + double m_cusp_limit; + unsigned m_count; + pod_bvector m_points; +}; + +//-----------------------------------------------------------------curve3 +class MAPNIK_DECL curve3 +{ + public: + curve3() + : m_approximation_method(curve_div) + {} + curve3(double x1, double y1, double x2, double y2, double x3, double y3) + : m_approximation_method(curve_div) + { + init(x1, y1, x2, y2, x3, y3); + } + + void reset() + { + m_curve_inc.reset(); + m_curve_div.reset(); + } + + void init(double x1, double y1, double x2, double y2, double x3, double y3) + { + if (m_approximation_method == curve_inc) + { + m_curve_inc.init(x1, y1, x2, y2, x3, y3); + } + else + { + m_curve_div.init(x1, y1, x2, y2, x3, y3); + } + } + + void approximation_method(curve_approximation_method_e v) { m_approximation_method = v; } + + curve_approximation_method_e approximation_method() const { return m_approximation_method; } + + void approximation_scale(double s) + { + m_curve_inc.approximation_scale(s); + m_curve_div.approximation_scale(s); + } + + double approximation_scale() const { return m_curve_inc.approximation_scale(); } + + void angle_tolerance(double a) { m_curve_div.angle_tolerance(a); } + + double angle_tolerance() const { return m_curve_div.angle_tolerance(); } + + void cusp_limit(double v) { m_curve_div.cusp_limit(v); } + + double cusp_limit() const { return m_curve_div.cusp_limit(); } + + void rewind(unsigned path_id) + { + if (m_approximation_method == curve_inc) + { + m_curve_inc.rewind(path_id); + } + else + { + m_curve_div.rewind(path_id); + } + } + + unsigned vertex(double* x, double* y) + { + if (m_approximation_method == curve_inc) + { + return m_curve_inc.vertex(x, y); + } + return m_curve_div.vertex(x, y); + } + + private: + curve3_inc m_curve_inc; + curve3_div m_curve_div; + curve_approximation_method_e m_approximation_method; +}; + +//-----------------------------------------------------------------curve4 +class MAPNIK_DECL curve4 +{ + public: + curve4() + : m_approximation_method(curve_div) + {} + curve4(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) + : m_approximation_method(curve_div) + { + init(x1, y1, x2, y2, x3, y3, x4, y4); + } + + curve4(const curve4_points& cp) + : m_approximation_method(curve_div) + { + init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]); + } + + void reset() + { + m_curve_inc.reset(); + m_curve_div.reset(); + } + + void init(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) + { + if (m_approximation_method == curve_inc) + { + m_curve_inc.init(x1, y1, x2, y2, x3, y3, x4, y4); + } + else + { + m_curve_div.init(x1, y1, x2, y2, x3, y3, x4, y4); + } + } + + void init(const curve4_points& cp) { init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]); } + + void approximation_method(curve_approximation_method_e v) { m_approximation_method = v; } + + curve_approximation_method_e approximation_method() const { return m_approximation_method; } + + void approximation_scale(double s) + { + m_curve_inc.approximation_scale(s); + m_curve_div.approximation_scale(s); + } + double approximation_scale() const { return m_curve_inc.approximation_scale(); } + + void angle_tolerance(double v) { m_curve_div.angle_tolerance(v); } + + double angle_tolerance() const { return m_curve_div.angle_tolerance(); } + + void cusp_limit(double v) { m_curve_div.cusp_limit(v); } + + double cusp_limit() const { return m_curve_div.cusp_limit(); } + + void rewind(unsigned path_id) + { + if (m_approximation_method == curve_inc) + { + m_curve_inc.rewind(path_id); + } + else + { + m_curve_div.rewind(path_id); + } + } + + unsigned vertex(double* x, double* y) + { + if (m_approximation_method == curve_inc) + { + return m_curve_inc.vertex(x, y); + } + return m_curve_div.vertex(x, y); + } + + private: + curve4_inc m_curve_inc; + curve4_div m_curve_div; + curve_approximation_method_e m_approximation_method; +}; + +} // namespace agg + #endif diff --git a/deps/agg/include/agg_dda_line.h b/deps/agg/include/agg_dda_line.h index 6efcd9179..262fe25c2 100644 --- a/deps/agg/include/agg_dda_line.h +++ b/deps/agg/include/agg_dda_line.h @@ -23,268 +23,229 @@ #include #include "agg_basics.h" -namespace agg +namespace agg { + +//===================================================dda_line_interpolator +template +class dda_line_interpolator { + static constexpr int factor = 2 << (FractionShift - 1); - //===================================================dda_line_interpolator - template class dda_line_interpolator + public: + //-------------------------------------------------------------------- + dda_line_interpolator() {} + + //-------------------------------------------------------------------- + dda_line_interpolator(int y1, int y2, unsigned count) + : m_y(y1) + , m_inc(((y2 - y1) * factor) / static_cast(count)) + , m_dy(0) + {} + + //-------------------------------------------------------------------- + void operator++() { m_dy += m_inc; } + + //-------------------------------------------------------------------- + void operator--() { m_dy -= m_inc; } + + //-------------------------------------------------------------------- + void operator+=(unsigned n) { m_dy += m_inc * n; } + + //-------------------------------------------------------------------- + void operator-=(unsigned n) { m_dy -= m_inc * n; } + + //-------------------------------------------------------------------- + int y() const { return m_y + (m_dy >> (FractionShift - YShift)); } + int dy() const { return m_dy; } + + private: + int m_y; + int m_inc; + int m_dy; +}; + +//=================================================dda2_line_interpolator +class dda2_line_interpolator +{ + public: + typedef int save_data_type; + enum save_size_e { save_size = 2 }; + + //-------------------------------------------------------------------- + dda2_line_interpolator() {} + + //-------------------------------------------- Forward-adjusted line + dda2_line_interpolator(int y1, int y2, int count) + : m_cnt(count <= 0 ? 1 : count) + , m_lft((y2 - y1) / m_cnt) + , m_rem((y2 - y1) % m_cnt) + , m_mod(m_rem) + , m_y(y1) { - static constexpr int factor = 2 << (FractionShift - 1); - public: - //-------------------------------------------------------------------- - dda_line_interpolator() {} - - //-------------------------------------------------------------------- - dda_line_interpolator(int y1, int y2, unsigned count) : - m_y(y1), - m_inc(((y2 - y1) * factor) / static_cast(count)), - m_dy(0) + if (m_mod <= 0) { + m_mod += count; + m_rem += count; + m_lft--; } + m_mod -= count; + } - //-------------------------------------------------------------------- - void operator ++ () - { - m_dy += m_inc; - } - - //-------------------------------------------------------------------- - void operator -- () - { - m_dy -= m_inc; - } - - //-------------------------------------------------------------------- - void operator += (unsigned n) - { - m_dy += m_inc * n; - } - - //-------------------------------------------------------------------- - void operator -= (unsigned n) - { - m_dy -= m_inc * n; - } - - - //-------------------------------------------------------------------- - int y() const { return m_y + (m_dy >> (FractionShift - YShift)); } - int dy() const { return m_dy; } - - private: - int m_y; - int m_inc; - int m_dy; - }; - - - - - - //=================================================dda2_line_interpolator - class dda2_line_interpolator + //-------------------------------------------- Backward-adjusted line + dda2_line_interpolator(int y1, int y2, int count, int) + : m_cnt(count <= 0 ? 1 : count) + , m_lft((y2 - y1) / m_cnt) + , m_rem((y2 - y1) % m_cnt) + , m_mod(m_rem) + , m_y(y1) { - public: - typedef int save_data_type; - enum save_size_e { save_size = 2 }; - - //-------------------------------------------------------------------- - dda2_line_interpolator() {} - - //-------------------------------------------- Forward-adjusted line - dda2_line_interpolator(int y1, int y2, int count) : - m_cnt(count <= 0 ? 1 : count), - m_lft((y2 - y1) / m_cnt), - m_rem((y2 - y1) % m_cnt), - m_mod(m_rem), - m_y(y1) + if (m_mod <= 0) { - if(m_mod <= 0) - { - m_mod += count; - m_rem += count; - m_lft--; - } - m_mod -= count; + m_mod += count; + m_rem += count; + m_lft--; } + } - //-------------------------------------------- Backward-adjusted line - dda2_line_interpolator(int y1, int y2, int count, int) : - m_cnt(count <= 0 ? 1 : count), - m_lft((y2 - y1) / m_cnt), - m_rem((y2 - y1) % m_cnt), - m_mod(m_rem), - m_y(y1) + //-------------------------------------------- Backward-adjusted line + dda2_line_interpolator(int y, int count) + : m_cnt(count <= 0 ? 1 : count) + , m_lft(y / m_cnt) + , m_rem(y % m_cnt) + , m_mod(m_rem) + , m_y(0) + { + if (m_mod <= 0) { - if(m_mod <= 0) - { - m_mod += count; - m_rem += count; - m_lft--; - } + m_mod += count; + m_rem += count; + m_lft--; } + } - //-------------------------------------------- Backward-adjusted line - dda2_line_interpolator(int y, int count) : - m_cnt(count <= 0 ? 1 : count), - m_lft(y / m_cnt), - m_rem(y % m_cnt), - m_mod(m_rem), - m_y(0) - { - if(m_mod <= 0) - { - m_mod += count; - m_rem += count; - m_lft--; - } - } + //-------------------------------------------------------------------- + void save(save_data_type* data) const + { + data[0] = m_mod; + data[1] = m_y; + } + //-------------------------------------------------------------------- + void load(const save_data_type* data) + { + m_mod = data[0]; + m_y = data[1]; + } - //-------------------------------------------------------------------- - void save(save_data_type* data) const - { - data[0] = m_mod; - data[1] = m_y; - } - - //-------------------------------------------------------------------- - void load(const save_data_type* data) - { - m_mod = data[0]; - m_y = data[1]; - } - - //-------------------------------------------------------------------- - void operator++() - { - m_mod += m_rem; - m_y += m_lft; - if(m_mod > 0) - { - m_mod -= m_cnt; - m_y++; - } - } - - //-------------------------------------------------------------------- - void operator--() - { - if(m_mod <= m_rem) - { - m_mod += m_cnt; - m_y--; - } - m_mod -= m_rem; - m_y -= m_lft; - } - - //-------------------------------------------------------------------- - void adjust_forward() + //-------------------------------------------------------------------- + void operator++() + { + m_mod += m_rem; + m_y += m_lft; + if (m_mod > 0) { m_mod -= m_cnt; + m_y++; } + } - //-------------------------------------------------------------------- - void adjust_backward() + //-------------------------------------------------------------------- + void operator--() + { + if (m_mod <= m_rem) { m_mod += m_cnt; + m_y--; } + m_mod -= m_rem; + m_y -= m_lft; + } - //-------------------------------------------------------------------- - int mod() const { return m_mod; } - int rem() const { return m_rem; } - int lft() const { return m_lft; } + //-------------------------------------------------------------------- + void adjust_forward() { m_mod -= m_cnt; } - //-------------------------------------------------------------------- - int y() const { return m_y; } + //-------------------------------------------------------------------- + void adjust_backward() { m_mod += m_cnt; } - private: - int m_cnt; - int m_lft; - int m_rem; - int m_mod; - int m_y; + //-------------------------------------------------------------------- + int mod() const { return m_mod; } + int rem() const { return m_rem; } + int lft() const { return m_lft; } + + //-------------------------------------------------------------------- + int y() const { return m_y; } + + private: + int m_cnt; + int m_lft; + int m_rem; + int m_mod; + int m_y; +}; + +//---------------------------------------------line_bresenham_interpolator +class line_bresenham_interpolator +{ + public: + enum subpixel_scale_e { + subpixel_shift = 8, + subpixel_scale = 1 << subpixel_shift, + subpixel_mask = subpixel_scale - 1 }; + //-------------------------------------------------------------------- + static int line_lr(int v) { return v >> subpixel_shift; } + //-------------------------------------------------------------------- + line_bresenham_interpolator(int x1, int y1, int x2, int y2) + : m_x1_lr(line_lr(x1)) + , m_y1_lr(line_lr(y1)) + , m_x2_lr(line_lr(x2)) + , m_y2_lr(line_lr(y2)) + , m_ver(std::abs(m_x2_lr - m_x1_lr) < std::abs(m_y2_lr - m_y1_lr)) + , m_len(m_ver ? std::abs(m_y2_lr - m_y1_lr) : std::abs(m_x2_lr - m_x1_lr)) + , m_inc(m_ver ? ((y2 > y1) ? 1 : -1) : ((x2 > x1) ? 1 : -1)) + , m_interpolator(m_ver ? x1 : y1, m_ver ? x2 : y2, m_len) + {} + //-------------------------------------------------------------------- + bool is_ver() const { return m_ver; } + unsigned len() const { return m_len; } + int inc() const { return m_inc; } - - - - //---------------------------------------------line_bresenham_interpolator - class line_bresenham_interpolator + //-------------------------------------------------------------------- + void hstep() { - public: - enum subpixel_scale_e - { - subpixel_shift = 8, - subpixel_scale = 1 << subpixel_shift, - subpixel_mask = subpixel_scale - 1 - }; + ++m_interpolator; + m_x1_lr += m_inc; + } - //-------------------------------------------------------------------- - static int line_lr(int v) { return v >> subpixel_shift; } + //-------------------------------------------------------------------- + void vstep() + { + ++m_interpolator; + m_y1_lr += m_inc; + } - //-------------------------------------------------------------------- - line_bresenham_interpolator(int x1, int y1, int x2, int y2) : - m_x1_lr(line_lr(x1)), - m_y1_lr(line_lr(y1)), - m_x2_lr(line_lr(x2)), - m_y2_lr(line_lr(y2)), - m_ver(std::abs(m_x2_lr - m_x1_lr) < std::abs(m_y2_lr - m_y1_lr)), - m_len(m_ver ? std::abs(m_y2_lr - m_y1_lr) : - std::abs(m_x2_lr - m_x1_lr)), - m_inc(m_ver ? ((y2 > y1) ? 1 : -1) : ((x2 > x1) ? 1 : -1)), - m_interpolator(m_ver ? x1 : y1, - m_ver ? x2 : y2, - m_len) - { - } - - //-------------------------------------------------------------------- - bool is_ver() const { return m_ver; } - unsigned len() const { return m_len; } - int inc() const { return m_inc; } - - //-------------------------------------------------------------------- - void hstep() - { - ++m_interpolator; - m_x1_lr += m_inc; - } - - //-------------------------------------------------------------------- - void vstep() - { - ++m_interpolator; - m_y1_lr += m_inc; - } - - //-------------------------------------------------------------------- - int x1() const { return m_x1_lr; } - int y1() const { return m_y1_lr; } - int x2() const { return line_lr(m_interpolator.y()); } - int y2() const { return line_lr(m_interpolator.y()); } - int x2_hr() const { return m_interpolator.y(); } - int y2_hr() const { return m_interpolator.y(); } - - private: - int m_x1_lr; - int m_y1_lr; - int m_x2_lr; - int m_y2_lr; - bool m_ver; - unsigned m_len; - int m_inc; - dda2_line_interpolator m_interpolator; - - }; - - -} + //-------------------------------------------------------------------- + int x1() const { return m_x1_lr; } + int y1() const { return m_y1_lr; } + int x2() const { return line_lr(m_interpolator.y()); } + int y2() const { return line_lr(m_interpolator.y()); } + int x2_hr() const { return m_interpolator.y(); } + int y2_hr() const { return m_interpolator.y(); } + private: + int m_x1_lr; + int m_y1_lr; + int m_x2_lr; + int m_y2_lr; + bool m_ver; + unsigned m_len; + int m_inc; + dda2_line_interpolator m_interpolator; +}; +} // namespace agg #endif diff --git a/deps/agg/include/agg_ellipse.h b/deps/agg/include/agg_ellipse.h index 671fd571c..05a3d3185 100644 --- a/deps/agg/include/agg_ellipse.h +++ b/deps/agg/include/agg_ellipse.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -23,102 +23,111 @@ #include "agg_basics.h" #include -namespace agg +namespace agg { + +//----------------------------------------------------------------ellipse +class ellipse { + public: + ellipse() + : m_x(0.0) + , m_y(0.0) + , m_rx(1.0) + , m_ry(1.0) + , m_scale(1.0) + , m_num(4) + , m_step(0) + , m_cw(false) + {} - //----------------------------------------------------------------ellipse - class ellipse + ellipse(double x, double y, double rx, double ry, unsigned num_steps = 0, bool cw = false) + : m_x(x) + , m_y(y) + , m_rx(rx) + , m_ry(ry) + , m_scale(1.0) + , m_num(num_steps) + , m_step(0) + , m_cw(cw) { - public: - ellipse() : - m_x(0.0), m_y(0.0), m_rx(1.0), m_ry(1.0), m_scale(1.0), - m_num(4), m_step(0), m_cw(false) {} - - ellipse(double x, double y, double rx, double ry, - unsigned num_steps=0, bool cw=false) : - m_x(x), m_y(y), m_rx(rx), m_ry(ry), m_scale(1.0), - m_num(num_steps), m_step(0), m_cw(cw) - { - if(m_num == 0) calc_num_steps(); - } - - void init(double x, double y, double rx, double ry, - unsigned num_steps=0, bool cw=false); - - void approximation_scale(double scale); - void rewind(unsigned path_id); - unsigned vertex(double* x, double* y); - unsigned num_steps() { return m_num; } - - private: - void calc_num_steps(); - - double m_x; - double m_y; - double m_rx; - double m_ry; - double m_scale; - unsigned m_num; - unsigned m_step; - bool m_cw; - }; - - //------------------------------------------------------------------------ - inline void ellipse::init(double x, double y, double rx, double ry, - unsigned num_steps, bool cw) - { - m_x = x; - m_y = y; - m_rx = rx; - m_ry = ry; - m_num = num_steps; - m_step = 0; - m_cw = cw; - if(m_num == 0) calc_num_steps(); + if (m_num == 0) + calc_num_steps(); } - //------------------------------------------------------------------------ - inline void ellipse::approximation_scale(double scale) - { - m_scale = scale; + void init(double x, double y, double rx, double ry, unsigned num_steps = 0, bool cw = false); + + void approximation_scale(double scale); + void rewind(unsigned path_id); + unsigned vertex(double* x, double* y); + unsigned num_steps() { return m_num; } + + private: + void calc_num_steps(); + + double m_x; + double m_y; + double m_rx; + double m_ry; + double m_scale; + unsigned m_num; + unsigned m_step; + bool m_cw; +}; + +//------------------------------------------------------------------------ +inline void ellipse::init(double x, double y, double rx, double ry, unsigned num_steps, bool cw) +{ + m_x = x; + m_y = y; + m_rx = rx; + m_ry = ry; + m_num = num_steps; + m_step = 0; + m_cw = cw; + if (m_num == 0) calc_num_steps(); - } - - //------------------------------------------------------------------------ - inline void ellipse::calc_num_steps() - { - double ra = (std::fabs(m_rx) + std::fabs(m_ry)) / 2; - double da = std::acos(ra / (ra + 0.125 / m_scale)) * 2; - m_num = uround(2*pi / da); - } - - //------------------------------------------------------------------------ - inline void ellipse::rewind(unsigned) - { - m_step = 0; - } - - //------------------------------------------------------------------------ - inline unsigned ellipse::vertex(double* x, double* y) - { - if(m_step == m_num) - { - ++m_step; - return path_cmd_end_poly | path_flags_close | path_flags_ccw; - } - if(m_step > m_num) return path_cmd_stop; - double angle = double(m_step) / double(m_num) * 2.0 * pi; - if(m_cw) angle = 2.0 * pi - angle; - *x = m_x + std::cos(angle) * m_rx; - *y = m_y + std::sin(angle) * m_ry; - m_step++; - return ((m_step == 1) ? path_cmd_move_to : path_cmd_line_to); - } - } +//------------------------------------------------------------------------ +inline void ellipse::approximation_scale(double scale) +{ + m_scale = scale; + calc_num_steps(); +} +//------------------------------------------------------------------------ +inline void ellipse::calc_num_steps() +{ + double ra = (std::fabs(m_rx) + std::fabs(m_ry)) / 2; + double da = std::acos(ra / (ra + 0.125 / m_scale)) * 2; + m_num = uround(2 * pi / da); +} + +//------------------------------------------------------------------------ +inline void ellipse::rewind(unsigned) +{ + m_step = 0; +} + +//------------------------------------------------------------------------ +inline unsigned ellipse::vertex(double* x, double* y) +{ + if (m_step == m_num) + { + ++m_step; + return path_cmd_end_poly | path_flags_close | path_flags_ccw; + } + if (m_step > m_num) + return path_cmd_stop; + double angle = double(m_step) / double(m_num) * 2.0 * pi; + if (m_cw) + angle = 2.0 * pi - angle; + *x = m_x + std::cos(angle) * m_rx; + *y = m_y + std::sin(angle) * m_ry; + m_step++; + return ((m_step == 1) ? path_cmd_move_to : path_cmd_line_to); +} + +} // namespace agg #endif - - diff --git a/deps/agg/include/agg_ellipse_bresenham.h b/deps/agg/include/agg_ellipse_bresenham.h index ee3b9c463..309282e45 100644 --- a/deps/agg/include/agg_ellipse_bresenham.h +++ b/deps/agg/include/agg_ellipse_bresenham.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -20,94 +20,92 @@ #ifndef AGG_ELLIPSE_BRESENHAM_INCLUDED #define AGG_ELLIPSE_BRESENHAM_INCLUDED - #include "agg_basics.h" +namespace agg { -namespace agg +//------------------------------------------ellipse_bresenham_interpolator +class ellipse_bresenham_interpolator { + public: + ellipse_bresenham_interpolator(int rx, int ry) + : m_rx2(rx * rx) + , m_ry2(ry * ry) + , m_two_rx2(m_rx2 << 1) + , m_two_ry2(m_ry2 << 1) + , m_dx(0) + , m_dy(0) + , m_inc_x(0) + , m_inc_y(-ry * m_two_rx2) + , m_cur_f(0) + {} - //------------------------------------------ellipse_bresenham_interpolator - class ellipse_bresenham_interpolator + int dx() const { return m_dx; } + int dy() const { return m_dy; } + + void operator++() { - public: - ellipse_bresenham_interpolator(int rx, int ry) : - m_rx2(rx * rx), - m_ry2(ry * ry), - m_two_rx2(m_rx2 << 1), - m_two_ry2(m_ry2 << 1), - m_dx(0), - m_dy(0), - m_inc_x(0), - m_inc_y(-ry * m_two_rx2), - m_cur_f(0) - {} - - int dx() const { return m_dx; } - int dy() const { return m_dy; } + int mx, my, mxy, min_m; + int fx, fy, fxy; - void operator++ () + mx = fx = m_cur_f + m_inc_x + m_ry2; + if (mx < 0) + mx = -mx; + + my = fy = m_cur_f + m_inc_y + m_rx2; + if (my < 0) + my = -my; + + mxy = fxy = m_cur_f + m_inc_x + m_ry2 + m_inc_y + m_rx2; + if (mxy < 0) + mxy = -mxy; + + min_m = mx; + bool flag = true; + + if (min_m > my) { - int mx, my, mxy, min_m; - int fx, fy, fxy; - - mx = fx = m_cur_f + m_inc_x + m_ry2; - if(mx < 0) mx = -mx; - - my = fy = m_cur_f + m_inc_y + m_rx2; - if(my < 0) my = -my; - - mxy = fxy = m_cur_f + m_inc_x + m_ry2 + m_inc_y + m_rx2; - if(mxy < 0) mxy = -mxy; - - min_m = mx; - bool flag = true; - - if(min_m > my) - { - min_m = my; - flag = false; - } - - m_dx = m_dy = 0; - - if(min_m > mxy) - { - m_inc_x += m_two_ry2; - m_inc_y += m_two_rx2; - m_cur_f = fxy; - m_dx = 1; - m_dy = 1; - return; - } - - if(flag) - { - m_inc_x += m_two_ry2; - m_cur_f = fx; - m_dx = 1; - return; - } - - m_inc_y += m_two_rx2; - m_cur_f = fy; - m_dy = 1; + min_m = my; + flag = false; } - private: - int m_rx2; - int m_ry2; - int m_two_rx2; - int m_two_ry2; - int m_dx; - int m_dy; - int m_inc_x; - int m_inc_y; - int m_cur_f; + m_dx = m_dy = 0; - }; + if (min_m > mxy) + { + m_inc_x += m_two_ry2; + m_inc_y += m_two_rx2; + m_cur_f = fxy; + m_dx = 1; + m_dy = 1; + return; + } -} + if (flag) + { + m_inc_x += m_two_ry2; + m_cur_f = fx; + m_dx = 1; + return; + } + + m_inc_y += m_two_rx2; + m_cur_f = fy; + m_dy = 1; + } + + private: + int m_rx2; + int m_ry2; + int m_two_rx2; + int m_two_ry2; + int m_dx; + int m_dy; + int m_inc_x; + int m_inc_y; + int m_cur_f; +}; + +} // namespace agg #endif - diff --git a/deps/agg/include/agg_embedded_raster_fonts.h b/deps/agg/include/agg_embedded_raster_fonts.h index 9d522d671..8e463d7ac 100644 --- a/deps/agg/include/agg_embedded_raster_fonts.h +++ b/deps/agg/include/agg_embedded_raster_fonts.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -18,42 +18,41 @@ #include "agg_basics.h" -namespace agg -{ - extern const int8u gse4x6[]; - extern const int8u gse4x8[]; - extern const int8u gse5x7[]; - extern const int8u gse5x9[]; - extern const int8u gse6x12[]; - extern const int8u gse6x9[]; - extern const int8u gse7x11[]; - extern const int8u gse7x11_bold[]; - extern const int8u gse7x15[]; - extern const int8u gse7x15_bold[]; - extern const int8u gse8x16[]; - extern const int8u gse8x16_bold[]; - extern const int8u mcs11_prop[]; - extern const int8u mcs11_prop_condensed[]; - extern const int8u mcs12_prop[]; - extern const int8u mcs13_prop[]; - extern const int8u mcs5x10_mono[]; - extern const int8u mcs5x11_mono[]; - extern const int8u mcs6x10_mono[]; - extern const int8u mcs6x11_mono[]; - extern const int8u mcs7x12_mono_high[]; - extern const int8u mcs7x12_mono_low[]; - extern const int8u verdana12[]; - extern const int8u verdana12_bold[]; - extern const int8u verdana13[]; - extern const int8u verdana13_bold[]; - extern const int8u verdana14[]; - extern const int8u verdana14_bold[]; - extern const int8u verdana16[]; - extern const int8u verdana16_bold[]; - extern const int8u verdana17[]; - extern const int8u verdana17_bold[]; - extern const int8u verdana18[]; - extern const int8u verdana18_bold[]; -} +namespace agg { +extern const int8u gse4x6[]; +extern const int8u gse4x8[]; +extern const int8u gse5x7[]; +extern const int8u gse5x9[]; +extern const int8u gse6x12[]; +extern const int8u gse6x9[]; +extern const int8u gse7x11[]; +extern const int8u gse7x11_bold[]; +extern const int8u gse7x15[]; +extern const int8u gse7x15_bold[]; +extern const int8u gse8x16[]; +extern const int8u gse8x16_bold[]; +extern const int8u mcs11_prop[]; +extern const int8u mcs11_prop_condensed[]; +extern const int8u mcs12_prop[]; +extern const int8u mcs13_prop[]; +extern const int8u mcs5x10_mono[]; +extern const int8u mcs5x11_mono[]; +extern const int8u mcs6x10_mono[]; +extern const int8u mcs6x11_mono[]; +extern const int8u mcs7x12_mono_high[]; +extern const int8u mcs7x12_mono_low[]; +extern const int8u verdana12[]; +extern const int8u verdana12_bold[]; +extern const int8u verdana13[]; +extern const int8u verdana13_bold[]; +extern const int8u verdana14[]; +extern const int8u verdana14_bold[]; +extern const int8u verdana16[]; +extern const int8u verdana16_bold[]; +extern const int8u verdana17[]; +extern const int8u verdana17_bold[]; +extern const int8u verdana18[]; +extern const int8u verdana18_bold[]; +} // namespace agg #endif diff --git a/deps/agg/include/agg_font_cache_manager.h b/deps/agg/include/agg_font_cache_manager.h index fc1249bd4..659043895 100644 --- a/deps/agg/include/agg_font_cache_manager.h +++ b/deps/agg/include/agg_font_cache_manager.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -19,307 +19,265 @@ #include #include "agg_array.h" -namespace agg +namespace agg { + +//---------------------------------------------------------glyph_data_type +enum glyph_data_type { glyph_data_invalid = 0, glyph_data_mono = 1, glyph_data_gray8 = 2, glyph_data_outline = 3 }; + +//-------------------------------------------------------------glyph_cache +struct glyph_cache { + unsigned glyph_index; + int8u* data; + unsigned data_size; + glyph_data_type data_type; + rect_i bounds; + double advance_x; + double advance_y; +}; - //---------------------------------------------------------glyph_data_type - enum glyph_data_type +//--------------------------------------------------------------font_cache +class font_cache +{ + public: + enum block_size_e { block_size = 16384 - 16 }; + + //-------------------------------------------------------------------- + font_cache() + : m_allocator(block_size) + , m_font_signature(0) + {} + + //-------------------------------------------------------------------- + void signature(const char* font_signature) { - glyph_data_invalid = 0, - glyph_data_mono = 1, - glyph_data_gray8 = 2, - glyph_data_outline = 3 - }; + m_font_signature = (char*)m_allocator.allocate(strlen(font_signature) + 1); + strcpy(m_font_signature, font_signature); + memset(m_glyphs, 0, sizeof(m_glyphs)); + } + //-------------------------------------------------------------------- + bool font_is(const char* font_signature) const { return strcmp(font_signature, m_font_signature) == 0; } - //-------------------------------------------------------------glyph_cache - struct glyph_cache + //-------------------------------------------------------------------- + const glyph_cache* find_glyph(unsigned glyph_code) const { - unsigned glyph_index; - int8u* data; - unsigned data_size; - glyph_data_type data_type; - rect_i bounds; - double advance_x; - double advance_y; - }; + unsigned msb = (glyph_code >> 8) & 0xFF; + if (m_glyphs[msb]) + { + return m_glyphs[msb][glyph_code & 0xFF]; + } + return 0; + } - - //--------------------------------------------------------------font_cache - class font_cache + //-------------------------------------------------------------------- + glyph_cache* cache_glyph(unsigned glyph_code, + unsigned glyph_index, + unsigned data_size, + glyph_data_type data_type, + const rect_i& bounds, + double advance_x, + double advance_y) { - public: - enum block_size_e { block_size = 16384-16 }; - - //-------------------------------------------------------------------- - font_cache() : - m_allocator(block_size), - m_font_signature(0) - {} - - //-------------------------------------------------------------------- - void signature(const char* font_signature) + unsigned msb = (glyph_code >> 8) & 0xFF; + if (m_glyphs[msb] == 0) { - m_font_signature = (char*)m_allocator.allocate(strlen(font_signature) + 1); - strcpy(m_font_signature, font_signature); - memset(m_glyphs, 0, sizeof(m_glyphs)); + m_glyphs[msb] = (glyph_cache**)m_allocator.allocate(sizeof(glyph_cache*) * 256, sizeof(glyph_cache*)); + memset(m_glyphs[msb], 0, sizeof(glyph_cache*) * 256); } - //-------------------------------------------------------------------- - bool font_is(const char* font_signature) const - { - return strcmp(font_signature, m_font_signature) == 0; - } + unsigned lsb = glyph_code & 0xFF; + if (m_glyphs[msb][lsb]) + return 0; // Already exists, do not overwrite - //-------------------------------------------------------------------- - const glyph_cache* find_glyph(unsigned glyph_code) const - { - unsigned msb = (glyph_code >> 8) & 0xFF; - if(m_glyphs[msb]) - { - return m_glyphs[msb][glyph_code & 0xFF]; - } - return 0; - } + glyph_cache* glyph = (glyph_cache*)m_allocator.allocate(sizeof(glyph_cache), sizeof(double)); - //-------------------------------------------------------------------- - glyph_cache* cache_glyph(unsigned glyph_code, - unsigned glyph_index, - unsigned data_size, - glyph_data_type data_type, - const rect_i& bounds, - double advance_x, - double advance_y) - { - unsigned msb = (glyph_code >> 8) & 0xFF; - if(m_glyphs[msb] == 0) - { - m_glyphs[msb] = - (glyph_cache**)m_allocator.allocate(sizeof(glyph_cache*) * 256, - sizeof(glyph_cache*)); - memset(m_glyphs[msb], 0, sizeof(glyph_cache*) * 256); - } + glyph->glyph_index = glyph_index; + glyph->data = m_allocator.allocate(data_size); + glyph->data_size = data_size; + glyph->data_type = data_type; + glyph->bounds = bounds; + glyph->advance_x = advance_x; + glyph->advance_y = advance_y; + return m_glyphs[msb][lsb] = glyph; + } - unsigned lsb = glyph_code & 0xFF; - if(m_glyphs[msb][lsb]) return 0; // Already exists, do not overwrite + private: + block_allocator m_allocator; + glyph_cache** m_glyphs[256]; + char* m_font_signature; +}; - glyph_cache* glyph = - (glyph_cache*)m_allocator.allocate(sizeof(glyph_cache), - sizeof(double)); - - glyph->glyph_index = glyph_index; - glyph->data = m_allocator.allocate(data_size); - glyph->data_size = data_size; - glyph->data_type = data_type; - glyph->bounds = bounds; - glyph->advance_x = advance_x; - glyph->advance_y = advance_y; - return m_glyphs[msb][lsb] = glyph; - } - - private: - block_allocator m_allocator; - glyph_cache** m_glyphs[256]; - char* m_font_signature; - }; - - - - - - - - //---------------------------------------------------------font_cache_pool - class font_cache_pool +//---------------------------------------------------------font_cache_pool +class font_cache_pool +{ + public: + //-------------------------------------------------------------------- + ~font_cache_pool() { - public: - //-------------------------------------------------------------------- - ~font_cache_pool() + unsigned i; + for (i = 0; i < m_num_fonts; ++i) { - unsigned i; - for(i = 0; i < m_num_fonts; ++i) - { - obj_allocator::deallocate(m_fonts[i]); - } - pod_allocator::deallocate(m_fonts, m_max_fonts); + obj_allocator::deallocate(m_fonts[i]); } + pod_allocator::deallocate(m_fonts, m_max_fonts); + } - //-------------------------------------------------------------------- - font_cache_pool(unsigned max_fonts=32) : - m_fonts(pod_allocator::allocate(max_fonts)), - m_max_fonts(max_fonts), - m_num_fonts(0), - m_cur_font(0) - {} + //-------------------------------------------------------------------- + font_cache_pool(unsigned max_fonts = 32) + : m_fonts(pod_allocator::allocate(max_fonts)) + , m_max_fonts(max_fonts) + , m_num_fonts(0) + , m_cur_font(0) + {} - - //-------------------------------------------------------------------- - void font(const char* font_signature, bool reset_cache = false) - { - int idx = find_font(font_signature); - if(idx >= 0) - { - if(reset_cache) - { - obj_allocator::deallocate(m_fonts[idx]); - m_fonts[idx] = obj_allocator::allocate(); - m_fonts[idx]->signature(font_signature); - } - m_cur_font = m_fonts[idx]; - } - else - { - if(m_num_fonts >= m_max_fonts) - { - obj_allocator::deallocate(m_fonts[0]); - memcpy(m_fonts, - m_fonts + 1, - (m_max_fonts - 1) * sizeof(font_cache*)); - m_num_fonts = m_max_fonts - 1; - } - m_fonts[m_num_fonts] = obj_allocator::allocate(); - m_fonts[m_num_fonts]->signature(font_signature); - m_cur_font = m_fonts[m_num_fonts]; - ++m_num_fonts; - } - } - - //-------------------------------------------------------------------- - const font_cache* font() const - { - return m_cur_font; - } - - //-------------------------------------------------------------------- - const glyph_cache* find_glyph(unsigned glyph_code) const - { - if(m_cur_font) return m_cur_font->find_glyph(glyph_code); - return 0; - } - - //-------------------------------------------------------------------- - glyph_cache* cache_glyph(unsigned glyph_code, - unsigned glyph_index, - unsigned data_size, - glyph_data_type data_type, - const rect_i& bounds, - double advance_x, - double advance_y) - { - if(m_cur_font) - { - return m_cur_font->cache_glyph(glyph_code, - glyph_index, - data_size, - data_type, - bounds, - advance_x, - advance_y); - } - return 0; - } - - - //-------------------------------------------------------------------- - int find_font(const char* font_signature) - { - unsigned i; - for(i = 0; i < m_num_fonts; i++) - { - if(m_fonts[i]->font_is(font_signature)) return int(i); - } - return -1; - } - - private: - font_cache** m_fonts; - unsigned m_max_fonts; - unsigned m_num_fonts; - font_cache* m_cur_font; - }; - - - - - //------------------------------------------------------------------------ - enum glyph_rendering + //-------------------------------------------------------------------- + void font(const char* font_signature, bool reset_cache = false) { - glyph_ren_native_mono, - glyph_ren_native_gray8, - glyph_ren_outline, - glyph_ren_agg_mono, - glyph_ren_agg_gray8 - }; - - - - - //------------------------------------------------------font_cache_manager - template class font_cache_manager - { - public: - typedef FontEngine font_engine_type; - typedef font_cache_manager self_type; - typedef typename font_engine_type::path_adaptor_type path_adaptor_type; - typedef typename font_engine_type::gray8_adaptor_type gray8_adaptor_type; - typedef typename gray8_adaptor_type::embedded_scanline gray8_scanline_type; - typedef typename font_engine_type::mono_adaptor_type mono_adaptor_type; - typedef typename mono_adaptor_type::embedded_scanline mono_scanline_type; - - //-------------------------------------------------------------------- - font_cache_manager(font_engine_type& engine, unsigned max_fonts=32) : - m_fonts(max_fonts), - m_engine(engine), - m_change_stamp(-1), - m_prev_glyph(0), - m_last_glyph(0) - {} - - //-------------------------------------------------------------------- - void reset_last_glyph() + int idx = find_font(font_signature); + if (idx >= 0) { - m_prev_glyph = m_last_glyph = 0; + if (reset_cache) + { + obj_allocator::deallocate(m_fonts[idx]); + m_fonts[idx] = obj_allocator::allocate(); + m_fonts[idx]->signature(font_signature); + } + m_cur_font = m_fonts[idx]; } - - //-------------------------------------------------------------------- - const glyph_cache* glyph(unsigned glyph_code) + else { - synchronize(); - const glyph_cache* gl = m_fonts.find_glyph(glyph_code); - if(gl) + if (m_num_fonts >= m_max_fonts) + { + obj_allocator::deallocate(m_fonts[0]); + memcpy(m_fonts, m_fonts + 1, (m_max_fonts - 1) * sizeof(font_cache*)); + m_num_fonts = m_max_fonts - 1; + } + m_fonts[m_num_fonts] = obj_allocator::allocate(); + m_fonts[m_num_fonts]->signature(font_signature); + m_cur_font = m_fonts[m_num_fonts]; + ++m_num_fonts; + } + } + + //-------------------------------------------------------------------- + const font_cache* font() const { return m_cur_font; } + + //-------------------------------------------------------------------- + const glyph_cache* find_glyph(unsigned glyph_code) const + { + if (m_cur_font) + return m_cur_font->find_glyph(glyph_code); + return 0; + } + + //-------------------------------------------------------------------- + glyph_cache* cache_glyph(unsigned glyph_code, + unsigned glyph_index, + unsigned data_size, + glyph_data_type data_type, + const rect_i& bounds, + double advance_x, + double advance_y) + { + if (m_cur_font) + { + return m_cur_font->cache_glyph(glyph_code, glyph_index, data_size, data_type, bounds, advance_x, advance_y); + } + return 0; + } + + //-------------------------------------------------------------------- + int find_font(const char* font_signature) + { + unsigned i; + for (i = 0; i < m_num_fonts; i++) + { + if (m_fonts[i]->font_is(font_signature)) + return int(i); + } + return -1; + } + + private: + font_cache** m_fonts; + unsigned m_max_fonts; + unsigned m_num_fonts; + font_cache* m_cur_font; +}; + +//------------------------------------------------------------------------ +enum glyph_rendering { + glyph_ren_native_mono, + glyph_ren_native_gray8, + glyph_ren_outline, + glyph_ren_agg_mono, + glyph_ren_agg_gray8 +}; + +//------------------------------------------------------font_cache_manager +template +class font_cache_manager +{ + public: + typedef FontEngine font_engine_type; + typedef font_cache_manager self_type; + typedef typename font_engine_type::path_adaptor_type path_adaptor_type; + typedef typename font_engine_type::gray8_adaptor_type gray8_adaptor_type; + typedef typename gray8_adaptor_type::embedded_scanline gray8_scanline_type; + typedef typename font_engine_type::mono_adaptor_type mono_adaptor_type; + typedef typename mono_adaptor_type::embedded_scanline mono_scanline_type; + + //-------------------------------------------------------------------- + font_cache_manager(font_engine_type& engine, unsigned max_fonts = 32) + : m_fonts(max_fonts) + , m_engine(engine) + , m_change_stamp(-1) + , m_prev_glyph(0) + , m_last_glyph(0) + {} + + //-------------------------------------------------------------------- + void reset_last_glyph() { m_prev_glyph = m_last_glyph = 0; } + + //-------------------------------------------------------------------- + const glyph_cache* glyph(unsigned glyph_code) + { + synchronize(); + const glyph_cache* gl = m_fonts.find_glyph(glyph_code); + if (gl) + { + m_prev_glyph = m_last_glyph; + return m_last_glyph = gl; + } + else + { + if (m_engine.prepare_glyph(glyph_code)) { m_prev_glyph = m_last_glyph; - return m_last_glyph = gl; + m_last_glyph = m_fonts.cache_glyph(glyph_code, + m_engine.glyph_index(), + m_engine.data_size(), + m_engine.data_type(), + m_engine.bounds(), + m_engine.advance_x(), + m_engine.advance_y()); + m_engine.write_glyph_to(m_last_glyph->data); + return m_last_glyph; } - else - { - if(m_engine.prepare_glyph(glyph_code)) - { - m_prev_glyph = m_last_glyph; - m_last_glyph = m_fonts.cache_glyph(glyph_code, - m_engine.glyph_index(), - m_engine.data_size(), - m_engine.data_type(), - m_engine.bounds(), - m_engine.advance_x(), - m_engine.advance_y()); - m_engine.write_glyph_to(m_last_glyph->data); - return m_last_glyph; - } - } - return 0; } + return 0; + } - //-------------------------------------------------------------------- - void init_embedded_adaptors(const glyph_cache* gl, - double x, double y, - double scale=1.0) + //-------------------------------------------------------------------- + void init_embedded_adaptors(const glyph_cache* gl, double x, double y, double scale = 1.0) + { + if (gl) { - if(gl) + switch (gl->data_type) { - switch(gl->data_type) - { - default: return; + default: + return; case glyph_data_mono: m_mono_adaptor.init(gl->data, gl->data_size, x, y); break; @@ -331,79 +289,76 @@ namespace agg case glyph_data_outline: m_path_adaptor.init(gl->data, gl->data_size, x, y, scale); break; - } } } + } + //-------------------------------------------------------------------- + path_adaptor_type& path_adaptor() { return m_path_adaptor; } + gray8_adaptor_type& gray8_adaptor() { return m_gray8_adaptor; } + gray8_scanline_type& gray8_scanline() { return m_gray8_scanline; } + mono_adaptor_type& mono_adaptor() { return m_mono_adaptor; } + mono_scanline_type& mono_scanline() { return m_mono_scanline; } - //-------------------------------------------------------------------- - path_adaptor_type& path_adaptor() { return m_path_adaptor; } - gray8_adaptor_type& gray8_adaptor() { return m_gray8_adaptor; } - gray8_scanline_type& gray8_scanline() { return m_gray8_scanline; } - mono_adaptor_type& mono_adaptor() { return m_mono_adaptor; } - mono_scanline_type& mono_scanline() { return m_mono_scanline; } + //-------------------------------------------------------------------- + const glyph_cache* perv_glyph() const { return m_prev_glyph; } + const glyph_cache* last_glyph() const { return m_last_glyph; } - //-------------------------------------------------------------------- - const glyph_cache* perv_glyph() const { return m_prev_glyph; } - const glyph_cache* last_glyph() const { return m_last_glyph; } - - //-------------------------------------------------------------------- - bool add_kerning(double* x, double* y) + //-------------------------------------------------------------------- + bool add_kerning(double* x, double* y) + { + if (m_prev_glyph && m_last_glyph) { - if(m_prev_glyph && m_last_glyph) - { - return m_engine.add_kerning(m_prev_glyph->glyph_index, - m_last_glyph->glyph_index, - x, y); - } - return false; + return m_engine.add_kerning(m_prev_glyph->glyph_index, m_last_glyph->glyph_index, x, y); } + return false; + } - //-------------------------------------------------------------------- - void precache(unsigned from, unsigned to) - { - for(; from <= to; ++from) glyph(from); - } + //-------------------------------------------------------------------- + void precache(unsigned from, unsigned to) + { + for (; from <= to; ++from) + glyph(from); + } - //-------------------------------------------------------------------- - void reset_cache() + //-------------------------------------------------------------------- + void reset_cache() + { + m_fonts.font(m_engine.font_signature(), true); + m_change_stamp = m_engine.change_stamp(); + m_prev_glyph = m_last_glyph = 0; + } + + private: + //-------------------------------------------------------------------- + font_cache_manager(const self_type&); + const self_type& operator=(const self_type&); + + //-------------------------------------------------------------------- + void synchronize() + { + if (m_change_stamp != m_engine.change_stamp()) { - m_fonts.font(m_engine.font_signature(), true); + m_fonts.font(m_engine.font_signature()); m_change_stamp = m_engine.change_stamp(); m_prev_glyph = m_last_glyph = 0; } + } - private: - //-------------------------------------------------------------------- - font_cache_manager(const self_type&); - const self_type& operator = (const self_type&); + font_cache_pool m_fonts; + font_engine_type& m_engine; + int m_change_stamp; + double m_dx; + double m_dy; + const glyph_cache* m_prev_glyph; + const glyph_cache* m_last_glyph; + path_adaptor_type m_path_adaptor; + gray8_adaptor_type m_gray8_adaptor; + gray8_scanline_type m_gray8_scanline; + mono_adaptor_type m_mono_adaptor; + mono_scanline_type m_mono_scanline; +}; - //-------------------------------------------------------------------- - void synchronize() - { - if(m_change_stamp != m_engine.change_stamp()) - { - m_fonts.font(m_engine.font_signature()); - m_change_stamp = m_engine.change_stamp(); - m_prev_glyph = m_last_glyph = 0; - } - } - - font_cache_pool m_fonts; - font_engine_type& m_engine; - int m_change_stamp; - double m_dx; - double m_dy; - const glyph_cache* m_prev_glyph; - const glyph_cache* m_last_glyph; - path_adaptor_type m_path_adaptor; - gray8_adaptor_type m_gray8_adaptor; - gray8_scanline_type m_gray8_scanline; - mono_adaptor_type m_mono_adaptor; - mono_scanline_type m_mono_scanline; - }; - -} +} // namespace agg #endif - diff --git a/deps/agg/include/agg_gamma_functions.h b/deps/agg/include/agg_gamma_functions.h index 0ad1115b5..5ff6230ea 100644 --- a/deps/agg/include/agg_gamma_functions.h +++ b/deps/agg/include/agg_gamma_functions.h @@ -19,116 +19,135 @@ #include #include "agg_basics.h" -namespace agg +namespace agg { +//===============================================================gamma_none +struct gamma_none { - //===============================================================gamma_none - struct gamma_none + double operator()(double x) const { return x; } +}; + +//==============================================================gamma_power +class gamma_power +{ + public: + gamma_power() + : m_gamma(1.0) + {} + gamma_power(double g) + : m_gamma(g) + {} + + void gamma(double g) { m_gamma = g; } + double gamma() const { return m_gamma; } + + double operator()(double x) const { - double operator()(double x) const { return x; } - }; - - - //==============================================================gamma_power - class gamma_power - { - public: - gamma_power() : m_gamma(1.0) {} - gamma_power(double g) : m_gamma(g) {} - - void gamma(double g) { m_gamma = g; } - double gamma() const { return m_gamma; } - - double operator() (double x) const - { - if (x == 0.0) return 0.0; - return pow(x, m_gamma); - } - - private: - double m_gamma; - }; - - - //==========================================================gamma_threshold - class gamma_threshold - { - public: - gamma_threshold() : m_threshold(0.5) {} - gamma_threshold(double t) : m_threshold(t) {} - - void threshold(double t) { m_threshold = t; } - double threshold() const { return m_threshold; } - - double operator() (double x) const - { - return (x < m_threshold) ? 0.0 : 1.0; - } - - private: - double m_threshold; - }; - - - //============================================================gamma_linear - class gamma_linear - { - public: - gamma_linear() : m_start(0.0), m_end(1.0) {} - gamma_linear(double s, double e) : m_start(s), m_end(e) {} - - void set(double s, double e) { m_start = s; m_end = e; } - void start(double s) { m_start = s; } - void end(double e) { m_end = e; } - double start() const { return m_start; } - double end() const { return m_end; } - - double operator() (double x) const - { - if(x < m_start) return 0.0; - if(x > m_end) return 1.0; - double delta = m_end - m_start; - // avoid nan from potential zero division - // https://github.com/mapnik/mapnik/issues/761 - if (delta <= 0.0) return 0.0; - return (x - m_start) / delta; - } - - private: - double m_start; - double m_end; - }; - - - //==========================================================gamma_multiply - class gamma_multiply - { - public: - gamma_multiply() : m_mul(1.0) {} - gamma_multiply(double v) : m_mul(v) {} - - void value(double v) { m_mul = v; } - double value() const { return m_mul; } - - double operator() (double x) const - { - double y = x * m_mul; - if(y > 1.0) y = 1.0; - return y; - } - - private: - double m_mul; - }; - - inline double sRGB_to_linear(double x) - { - return (x <= 0.04045) ? (x / 12.92) : pow((x + 0.055) / (1.055), 2.4); + if (x == 0.0) + return 0.0; + return pow(x, m_gamma); } - inline double linear_to_sRGB(double x) + private: + double m_gamma; +}; + +//==========================================================gamma_threshold +class gamma_threshold +{ + public: + gamma_threshold() + : m_threshold(0.5) + {} + gamma_threshold(double t) + : m_threshold(t) + {} + + void threshold(double t) { m_threshold = t; } + double threshold() const { return m_threshold; } + + double operator()(double x) const { return (x < m_threshold) ? 0.0 : 1.0; } + + private: + double m_threshold; +}; + +//============================================================gamma_linear +class gamma_linear +{ + public: + gamma_linear() + : m_start(0.0) + , m_end(1.0) + {} + gamma_linear(double s, double e) + : m_start(s) + , m_end(e) + {} + + void set(double s, double e) { - return (x <= 0.0031308) ? (x * 12.92) : (1.055 * pow(x, 1 / 2.4) - 0.055); + m_start = s; + m_end = e; } + void start(double s) { m_start = s; } + void end(double e) { m_end = e; } + double start() const { return m_start; } + double end() const { return m_end; } + + double operator()(double x) const + { + if (x < m_start) + return 0.0; + if (x > m_end) + return 1.0; + double delta = m_end - m_start; + // avoid nan from potential zero division + // https://github.com/mapnik/mapnik/issues/761 + if (delta <= 0.0) + return 0.0; + return (x - m_start) / delta; + } + + private: + double m_start; + double m_end; +}; + +//==========================================================gamma_multiply +class gamma_multiply +{ + public: + gamma_multiply() + : m_mul(1.0) + {} + gamma_multiply(double v) + : m_mul(v) + {} + + void value(double v) { m_mul = v; } + double value() const { return m_mul; } + + double operator()(double x) const + { + double y = x * m_mul; + if (y > 1.0) + y = 1.0; + return y; + } + + private: + double m_mul; +}; + +inline double sRGB_to_linear(double x) +{ + return (x <= 0.04045) ? (x / 12.92) : pow((x + 0.055) / (1.055), 2.4); } +inline double linear_to_sRGB(double x) +{ + return (x <= 0.0031308) ? (x * 12.92) : (1.055 * pow(x, 1 / 2.4) - 0.055); +} +} // namespace agg + #endif diff --git a/deps/agg/include/agg_gamma_lut.h b/deps/agg/include/agg_gamma_lut.h index 6f3ccb9b4..ea63906aa 100644 --- a/deps/agg/include/agg_gamma_lut.h +++ b/deps/agg/include/agg_gamma_lut.h @@ -20,286 +20,247 @@ #include "agg_basics.h" #include "agg_gamma_functions.h" -namespace agg +namespace agg { +template +class gamma_lut { - template class gamma_lut + public: + typedef gamma_lut self_type; + + enum gamma_scale_e { gamma_shift = GammaShift, gamma_size = 1 << gamma_shift, gamma_mask = gamma_size - 1 }; + + enum hi_res_scale_e { hi_res_shift = HiResShift, hi_res_size = 1 << hi_res_shift, hi_res_mask = hi_res_size - 1 }; + + ~gamma_lut() { - public: - typedef gamma_lut self_type; + pod_allocator::deallocate(m_inv_gamma, hi_res_size); + pod_allocator::deallocate(m_dir_gamma, gamma_size); + } - enum gamma_scale_e - { - gamma_shift = GammaShift, - gamma_size = 1 << gamma_shift, - gamma_mask = gamma_size - 1 - }; - - enum hi_res_scale_e - { - hi_res_shift = HiResShift, - hi_res_size = 1 << hi_res_shift, - hi_res_mask = hi_res_size - 1 - }; - - ~gamma_lut() - { - pod_allocator::deallocate(m_inv_gamma, hi_res_size); - pod_allocator::deallocate(m_dir_gamma, gamma_size); - } - - gamma_lut() : - m_gamma(1.0), - m_dir_gamma(pod_allocator::allocate(gamma_size)), - m_inv_gamma(pod_allocator::allocate(hi_res_size)) - { - unsigned i; - for(i = 0; i < gamma_size; i++) - { - m_dir_gamma[i] = HiResT(i << (hi_res_shift - gamma_shift)); - } - - for(i = 0; i < hi_res_size; i++) - { - m_inv_gamma[i] = LoResT(i >> (hi_res_shift - gamma_shift)); - } - } - - gamma_lut(double g) : - m_gamma(1.0), - m_dir_gamma(pod_allocator::allocate(gamma_size)), - m_inv_gamma(pod_allocator::allocate(hi_res_size)) - { - gamma(g); - } - - void gamma(double g) - { - m_gamma = g; - - unsigned i; - for(i = 0; i < gamma_size; i++) - { - m_dir_gamma[i] = (HiResT) - uround(pow(i / double(gamma_mask), m_gamma) * double(hi_res_mask)); - } - - double inv_g = 1.0 / g; - for(i = 0; i < hi_res_size; i++) - { - m_inv_gamma[i] = (LoResT) - uround(pow(i / double(hi_res_mask), inv_g) * double(gamma_mask)); - } - } - - double gamma() const - { - return m_gamma; - } - - HiResT dir(LoResT v) const - { - return m_dir_gamma[unsigned(v)]; - } - - LoResT inv(HiResT v) const - { - return m_inv_gamma[unsigned(v)]; - } - - private: - gamma_lut(const self_type&); - const self_type& operator = (const self_type&); - - double m_gamma; - HiResT* m_dir_gamma; - LoResT* m_inv_gamma; - }; - - // - // sRGB support classes - // - - // Optimized sRGB lookup table. The direct conversion (sRGB to linear) - // is a straightforward lookup. The inverse conversion (linear to sRGB) - // is implemented using binary search. - template - class sRGB_lut_base + gamma_lut() + : m_gamma(1.0) + , m_dir_gamma(pod_allocator::allocate(gamma_size)) + , m_inv_gamma(pod_allocator::allocate(hi_res_size)) { - public: - LinearType dir(int8u v) const + unsigned i; + for (i = 0; i < gamma_size; i++) { - return m_dir_table[v]; + m_dir_gamma[i] = HiResT(i << (hi_res_shift - gamma_shift)); } - int8u inv(LinearType v) const + for (i = 0; i < hi_res_size; i++) { - // Unrolled binary search. - int8u x = 0; - if (v > m_inv_table[128]) x = 128; - if (v > m_inv_table[x + 64]) x += 64; - if (v > m_inv_table[x + 32]) x += 32; - if (v > m_inv_table[x + 16]) x += 16; - if (v > m_inv_table[x + 8]) x += 8; - if (v > m_inv_table[x + 4]) x += 4; - if (v > m_inv_table[x + 2]) x += 2; - if (v > m_inv_table[x + 1]) x += 1; - return x; + m_inv_gamma[i] = LoResT(i >> (hi_res_shift - gamma_shift)); } + } - protected: - LinearType m_dir_table[256]; - LinearType m_inv_table[256]; - - // Only derived classes may instantiate. - sRGB_lut_base() - { - } - }; - - // sRGB_lut - implements sRGB conversion for the various types. - // Base template is undefined, specializations are provided below. - template - class sRGB_lut; - - template<> - class sRGB_lut : public sRGB_lut_base + gamma_lut(double g) + : m_gamma(1.0) + , m_dir_gamma(pod_allocator::allocate(gamma_size)) + , m_inv_gamma(pod_allocator::allocate(hi_res_size)) { - public: - sRGB_lut() - { - // Generate lookup tables. - m_dir_table[0] = 0; - m_inv_table[0] = 0; - for (unsigned i = 1; i <= 255; ++i) - { - // Floating-point RGB is in range [0,1]. - m_dir_table[i] = float(sRGB_to_linear(i / 255.0)); - m_inv_table[i] = float(sRGB_to_linear((i - 0.5) / 255.0)); - } - } - }; + gamma(g); + } - template<> - class sRGB_lut : public sRGB_lut_base + void gamma(double g) { - public: - sRGB_lut() - { - // Generate lookup tables. - m_dir_table[0] = 0; - m_inv_table[0] = 0; - for (unsigned i = 1; i <= 255; ++i) - { - // 16-bit RGB is in range [0,65535]. - m_dir_table[i] = uround(65535.0 * sRGB_to_linear(i / 255.0)); - m_inv_table[i] = uround(65535.0 * sRGB_to_linear((i - 0.5) / 255.0)); - } - } - }; + m_gamma = g; - template<> - class sRGB_lut : public sRGB_lut_base + unsigned i; + for (i = 0; i < gamma_size; i++) + { + m_dir_gamma[i] = (HiResT)uround(pow(i / double(gamma_mask), m_gamma) * double(hi_res_mask)); + } + + double inv_g = 1.0 / g; + for (i = 0; i < hi_res_size; i++) + { + m_inv_gamma[i] = (LoResT)uround(pow(i / double(hi_res_mask), inv_g) * double(gamma_mask)); + } + } + + double gamma() const { return m_gamma; } + + HiResT dir(LoResT v) const { return m_dir_gamma[unsigned(v)]; } + + LoResT inv(HiResT v) const { return m_inv_gamma[unsigned(v)]; } + + private: + gamma_lut(const self_type&); + const self_type& operator=(const self_type&); + + double m_gamma; + HiResT* m_dir_gamma; + LoResT* m_inv_gamma; +}; + +// +// sRGB support classes +// + +// Optimized sRGB lookup table. The direct conversion (sRGB to linear) +// is a straightforward lookup. The inverse conversion (linear to sRGB) +// is implemented using binary search. +template +class sRGB_lut_base +{ + public: + LinearType dir(int8u v) const { return m_dir_table[v]; } + + int8u inv(LinearType v) const { - public: - sRGB_lut() - { - // Generate lookup tables. - m_dir_table[0] = 0; - m_inv_table[0] = 0; - for (unsigned i = 1; i <= 255; ++i) - { - // 8-bit RGB is handled with simple bidirectional lookup tables. - m_dir_table[i] = uround(255.0 * sRGB_to_linear(i / 255.0)); - m_inv_table[i] = uround(255.0 * linear_to_sRGB(i / 255.0)); - } - } + // Unrolled binary search. + int8u x = 0; + if (v > m_inv_table[128]) + x = 128; + if (v > m_inv_table[x + 64]) + x += 64; + if (v > m_inv_table[x + 32]) + x += 32; + if (v > m_inv_table[x + 16]) + x += 16; + if (v > m_inv_table[x + 8]) + x += 8; + if (v > m_inv_table[x + 4]) + x += 4; + if (v > m_inv_table[x + 2]) + x += 2; + if (v > m_inv_table[x + 1]) + x += 1; + return x; + } - int8u inv(int8u v) const - { - // In this case, the inverse transform is a simple lookup. - return m_inv_table[v]; - } - }; + protected: + LinearType m_dir_table[256]; + LinearType m_inv_table[256]; - // Common base class for sRGB_conv objects. Defines an internal - // sRGB_lut object so that users don't have to. - template - class sRGB_conv_base + // Only derived classes may instantiate. + sRGB_lut_base() {} +}; + +// sRGB_lut - implements sRGB conversion for the various types. +// Base template is undefined, specializations are provided below. +template +class sRGB_lut; + +template<> +class sRGB_lut : public sRGB_lut_base +{ + public: + sRGB_lut() { - public: - static T rgb_from_sRGB(int8u x) + // Generate lookup tables. + m_dir_table[0] = 0; + m_inv_table[0] = 0; + for (unsigned i = 1; i <= 255; ++i) { - return lut.dir(x); + // Floating-point RGB is in range [0,1]. + m_dir_table[i] = float(sRGB_to_linear(i / 255.0)); + m_inv_table[i] = float(sRGB_to_linear((i - 0.5) / 255.0)); } + } +}; - static int8u rgb_to_sRGB(T x) - { - return lut.inv(x); - } - - private: - static sRGB_lut lut; - }; - - // Definition of sRGB_conv_base::lut. Due to the fact that this a template, - // we don't need to place the definition in a cpp file. Hurrah. - template - sRGB_lut sRGB_conv_base::lut; - - // Wrapper for sRGB-linear conversion. - // Base template is undefined, specializations are provided below. - template - class sRGB_conv; - - template<> - class sRGB_conv : public sRGB_conv_base +template<> +class sRGB_lut : public sRGB_lut_base +{ + public: + sRGB_lut() { - public: - static float alpha_from_sRGB(int8u x) + // Generate lookup tables. + m_dir_table[0] = 0; + m_inv_table[0] = 0; + for (unsigned i = 1; i <= 255; ++i) { - return float(x / 255.0); + // 16-bit RGB is in range [0,65535]. + m_dir_table[i] = uround(65535.0 * sRGB_to_linear(i / 255.0)); + m_inv_table[i] = uround(65535.0 * sRGB_to_linear((i - 0.5) / 255.0)); } + } +}; - static int8u alpha_to_sRGB(float x) - { - if (x <= 0) return 0; - else if (x >= 1) return 255; - else return int8u(0.5 + x * 255); - } - }; - - template<> - class sRGB_conv : public sRGB_conv_base +template<> +class sRGB_lut : public sRGB_lut_base +{ + public: + sRGB_lut() { - public: - static int16u alpha_from_sRGB(int8u x) + // Generate lookup tables. + m_dir_table[0] = 0; + m_inv_table[0] = 0; + for (unsigned i = 1; i <= 255; ++i) { - return (x << 8) | x; + // 8-bit RGB is handled with simple bidirectional lookup tables. + m_dir_table[i] = uround(255.0 * sRGB_to_linear(i / 255.0)); + m_inv_table[i] = uround(255.0 * linear_to_sRGB(i / 255.0)); } + } - static int8u alpha_to_sRGB(int16u x) - { - return x >> 8; - } - }; - - template<> - class sRGB_conv : public sRGB_conv_base + int8u inv(int8u v) const { - public: - static int8u alpha_from_sRGB(int8u x) - { - return x; - } + // In this case, the inverse transform is a simple lookup. + return m_inv_table[v]; + } +}; - static int8u alpha_to_sRGB(int8u x) - { - return x; - } - }; -} +// Common base class for sRGB_conv objects. Defines an internal +// sRGB_lut object so that users don't have to. +template +class sRGB_conv_base +{ + public: + static T rgb_from_sRGB(int8u x) { return lut.dir(x); } + + static int8u rgb_to_sRGB(T x) { return lut.inv(x); } + + private: + static sRGB_lut lut; +}; + +// Definition of sRGB_conv_base::lut. Due to the fact that this a template, +// we don't need to place the definition in a cpp file. Hurrah. +template +sRGB_lut sRGB_conv_base::lut; + +// Wrapper for sRGB-linear conversion. +// Base template is undefined, specializations are provided below. +template +class sRGB_conv; + +template<> +class sRGB_conv : public sRGB_conv_base +{ + public: + static float alpha_from_sRGB(int8u x) { return float(x / 255.0); } + + static int8u alpha_to_sRGB(float x) + { + if (x <= 0) + return 0; + else if (x >= 1) + return 255; + else + return int8u(0.5 + x * 255); + } +}; + +template<> +class sRGB_conv : public sRGB_conv_base +{ + public: + static int16u alpha_from_sRGB(int8u x) { return (x << 8) | x; } + + static int8u alpha_to_sRGB(int16u x) { return x >> 8; } +}; + +template<> +class sRGB_conv : public sRGB_conv_base +{ + public: + static int8u alpha_from_sRGB(int8u x) { return x; } + + static int8u alpha_to_sRGB(int8u x) { return x; } +}; +} // namespace agg #endif diff --git a/deps/agg/include/agg_glyph_raster_bin.h b/deps/agg/include/agg_glyph_raster_bin.h index 720b51832..24feccb57 100644 --- a/deps/agg/include/agg_glyph_raster_bin.h +++ b/deps/agg/include/agg_glyph_raster_bin.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -19,137 +19,134 @@ #include #include "agg_basics.h" -namespace agg +namespace agg { + +//========================================================glyph_raster_bin +template +class glyph_raster_bin { + public: + typedef ColorT color_type; - //========================================================glyph_raster_bin - template class glyph_raster_bin + //-------------------------------------------------------------------- + struct glyph_rect { - public: - typedef ColorT color_type; - - //-------------------------------------------------------------------- - struct glyph_rect - { - int x1,y1,x2,y2; - double dx, dy; - }; - - //-------------------------------------------------------------------- - glyph_raster_bin(const int8u* font) : - m_font(font), - m_big_endian(false) - { - int t = 1; - if(*(char*)&t == 0) m_big_endian = true; - memset(m_span, 0, sizeof(m_span)); - } - - //-------------------------------------------------------------------- - const int8u* font() const { return m_font; } - void font(const int8u* f) { m_font = f; } - - //-------------------------------------------------------------------- - double height() const { return m_font[0]; } - double base_line() const { return m_font[1]; } - - //-------------------------------------------------------------------- - template - double width(const CharT* str) const - { - unsigned start_char = m_font[2]; - unsigned num_chars = m_font[3]; - - unsigned w = 0; - while(*str) - { - unsigned glyph = *str; - const int8u* bits = m_font + 4 + num_chars * 2 + - value(m_font + 4 + (glyph - start_char) * 2); - w += *bits; - ++str; - } - return w; - } - - //-------------------------------------------------------------------- - void prepare(glyph_rect* r, double x, double y, unsigned glyph, bool flip) - { - unsigned start_char = m_font[2]; - unsigned num_chars = m_font[3]; - - m_bits = m_font + 4 + num_chars * 2 + - value(m_font + 4 + (glyph - start_char) * 2); - - m_glyph_width = *m_bits++; - m_glyph_byte_width = (m_glyph_width + 7) >> 3; - - r->x1 = int(x); - r->x2 = r->x1 + m_glyph_width - 1; - if(flip) - { - r->y1 = int(y) - m_font[0] + m_font[1]; - r->y2 = r->y1 + m_font[0] - 1; - } - else - { - r->y1 = int(y) - m_font[1] + 1; - r->y2 = r->y1 + m_font[0] - 1; - } - r->dx = m_glyph_width; - r->dy = 0; - } - - //-------------------------------------------------------------------- - const cover_type* span(unsigned i) - { - i = m_font[0] - i - 1; - const int8u* bits = m_bits + i * m_glyph_byte_width; - unsigned j; - unsigned val = *bits; - unsigned nb = 0; - for(j = 0; j < m_glyph_width; ++j) - { - m_span[j] = (cover_type)((val & 0x80) ? cover_full : cover_none); - val <<= 1; - if(++nb >= 8) - { - val = *++bits; - nb = 0; - } - } - return m_span; - } - - private: - //-------------------------------------------------------------------- - int16u value(const int8u* p) const - { - int16u v; - if(m_big_endian) - { - *(int8u*)&v = p[1]; - *((int8u*)&v + 1) = p[0]; - } - else - { - *(int8u*)&v = p[0]; - *((int8u*)&v + 1) = p[1]; - } - return v; - } - - - //-------------------------------------------------------------------- - const int8u* m_font; - bool m_big_endian; - cover_type m_span[32]; - const int8u* m_bits; - unsigned m_glyph_width; - unsigned m_glyph_byte_width; + int x1, y1, x2, y2; + double dx, dy; }; + //-------------------------------------------------------------------- + glyph_raster_bin(const int8u* font) + : m_font(font) + , m_big_endian(false) + { + int t = 1; + if (*(char*)&t == 0) + m_big_endian = true; + memset(m_span, 0, sizeof(m_span)); + } -} + //-------------------------------------------------------------------- + const int8u* font() const { return m_font; } + void font(const int8u* f) { m_font = f; } + + //-------------------------------------------------------------------- + double height() const { return m_font[0]; } + double base_line() const { return m_font[1]; } + + //-------------------------------------------------------------------- + template + double width(const CharT* str) const + { + unsigned start_char = m_font[2]; + unsigned num_chars = m_font[3]; + + unsigned w = 0; + while (*str) + { + unsigned glyph = *str; + const int8u* bits = m_font + 4 + num_chars * 2 + value(m_font + 4 + (glyph - start_char) * 2); + w += *bits; + ++str; + } + return w; + } + + //-------------------------------------------------------------------- + void prepare(glyph_rect* r, double x, double y, unsigned glyph, bool flip) + { + unsigned start_char = m_font[2]; + unsigned num_chars = m_font[3]; + + m_bits = m_font + 4 + num_chars * 2 + value(m_font + 4 + (glyph - start_char) * 2); + + m_glyph_width = *m_bits++; + m_glyph_byte_width = (m_glyph_width + 7) >> 3; + + r->x1 = int(x); + r->x2 = r->x1 + m_glyph_width - 1; + if (flip) + { + r->y1 = int(y) - m_font[0] + m_font[1]; + r->y2 = r->y1 + m_font[0] - 1; + } + else + { + r->y1 = int(y) - m_font[1] + 1; + r->y2 = r->y1 + m_font[0] - 1; + } + r->dx = m_glyph_width; + r->dy = 0; + } + + //-------------------------------------------------------------------- + const cover_type* span(unsigned i) + { + i = m_font[0] - i - 1; + const int8u* bits = m_bits + i * m_glyph_byte_width; + unsigned j; + unsigned val = *bits; + unsigned nb = 0; + for (j = 0; j < m_glyph_width; ++j) + { + m_span[j] = (cover_type)((val & 0x80) ? cover_full : cover_none); + val <<= 1; + if (++nb >= 8) + { + val = *++bits; + nb = 0; + } + } + return m_span; + } + + private: + //-------------------------------------------------------------------- + int16u value(const int8u* p) const + { + int16u v; + if (m_big_endian) + { + *(int8u*)&v = p[1]; + *((int8u*)&v + 1) = p[0]; + } + else + { + *(int8u*)&v = p[0]; + *((int8u*)&v + 1) = p[1]; + } + return v; + } + + //-------------------------------------------------------------------- + const int8u* m_font; + bool m_big_endian; + cover_type m_span[32]; + const int8u* m_bits; + unsigned m_glyph_width; + unsigned m_glyph_byte_width; +}; + +} // namespace agg #endif diff --git a/deps/agg/include/agg_gradient_lut.h b/deps/agg/include/agg_gradient_lut.h index 079bed93a..6df3f749b 100644 --- a/deps/agg/include/agg_gradient_lut.h +++ b/deps/agg/include/agg_gradient_lut.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -21,226 +21,200 @@ #include "agg_color_rgba.h" #include "agg_color_gray.h" -namespace agg +namespace agg { + +//======================================================color_interpolator +template +struct color_interpolator { + public: + typedef ColorT color_type; - //======================================================color_interpolator - template struct color_interpolator + color_interpolator(const color_type& c1, const color_type& c2, unsigned len) + : m_c1(c1) + , m_c2(c2) + , m_len(len) + , m_count(0) + {} + + void operator++() { ++m_count; } + + color_type color() const { return m_c1.gradient(m_c2, double(m_count) / m_len); } + + private: + color_type m_c1; + color_type m_c2; + unsigned m_len; + unsigned m_count; +}; + +//======================================================================== +// Fast specialization for rgba8 +template<> +struct color_interpolator +{ + public: + typedef rgba8 color_type; + + color_interpolator(const color_type& c1, const color_type& c2, unsigned len) + : r(c1.r, c2.r, len) + , g(c1.g, c2.g, len) + , b(c1.b, c2.b, len) + , a(c1.a, c2.a, len) + {} + + void operator++() { - public: - typedef ColorT color_type; - - color_interpolator(const color_type& c1, - const color_type& c2, - unsigned len) : - m_c1(c1), - m_c2(c2), - m_len(len), - m_count(0) - {} - - void operator ++ () - { - ++m_count; - } - - color_type color() const - { - return m_c1.gradient(m_c2, double(m_count) / m_len); - } - - private: - color_type m_c1; - color_type m_c2; - unsigned m_len; - unsigned m_count; - }; - - //======================================================================== - // Fast specialization for rgba8 - template<> struct color_interpolator - { - public: - typedef rgba8 color_type; - - color_interpolator(const color_type& c1, - const color_type& c2, - unsigned len) : - r(c1.r, c2.r, len), - g(c1.g, c2.g, len), - b(c1.b, c2.b, len), - a(c1.a, c2.a, len) - {} - - void operator ++ () - { - ++r; ++g; ++b; ++a; - } - - color_type color() const - { - return color_type(r.y(), g.y(), b.y(), a.y()); - } - - private: - agg::dda_line_interpolator<14> r, g, b, a; - }; - - //======================================================================== - // Fast specialization for gray8 - template<> struct color_interpolator - { - public: - typedef gray8 color_type; - - color_interpolator(const color_type& c1, - const color_type& c2, - unsigned len) : - v(c1.v, c2.v, len), - a(c1.a, c2.a, len) - {} - - void operator ++ () - { - ++v; ++a; - } - - color_type color() const - { - return color_type(v.y(), a.y()); - } - - private: - agg::dda_line_interpolator<14> v,a; - }; - - //============================================================gradient_lut - template class gradient_lut - { - public: - typedef ColorInterpolator interpolator_type; - typedef typename interpolator_type::color_type color_type; - enum { color_lut_size = ColorLutSize }; - - //-------------------------------------------------------------------- - gradient_lut() : m_color_lut(color_lut_size) {} - - // Build Gradient Lut - // First, call remove_all(), then add_color() at least twice, - // then build_lut(). Argument "offset" in add_color must be - // in range [0...1] and defines a color stop as it is described - // in SVG specification, section Gradients and Patterns. - // The simplest linear gradient is: - // gradient_lut.add_color(0.0, start_color); - // gradient_lut.add_color(1.0, end_color); - //-------------------------------------------------------------------- - void remove_all(); - void add_color(double offset, const color_type& color); - bool build_lut(); - - // Size-index Interface. This class can be used directly as the - // ColorF in span_gradient. All it needs is two access methods - // size() and operator []. - //-------------------------------------------------------------------- - static unsigned size() - { - return color_lut_size; - } - const color_type& operator [] (unsigned i) const - { - return m_color_lut[i]; - } - - private: - //-------------------------------------------------------------------- - struct color_point - { - double offset; - color_type color; - - color_point() {} - color_point(double off, const color_type& c) : - offset(off), color(c) - { - if(offset < 0.0) offset = 0.0; - if(offset > 1.0) offset = 1.0; - } - }; - typedef agg::pod_bvector color_profile_type; - typedef agg::pod_array color_lut_type; - - static bool offset_less(const color_point& a, const color_point& b) - { - return a.offset < b.offset; - } - static bool offset_equal(const color_point& a, const color_point& b) - { - return a.offset == b.offset; - } - - //-------------------------------------------------------------------- - color_profile_type m_color_profile; - color_lut_type m_color_lut; - }; - - - - //------------------------------------------------------------------------ - template - void gradient_lut::remove_all() - { - m_color_profile.remove_all(); + ++r; + ++g; + ++b; + ++a; } - //------------------------------------------------------------------------ - template - void gradient_lut::add_color(double offset, const color_type& color) + color_type color() const { return color_type(r.y(), g.y(), b.y(), a.y()); } + + private: + agg::dda_line_interpolator<14> r, g, b, a; +}; + +//======================================================================== +// Fast specialization for gray8 +template<> +struct color_interpolator +{ + public: + typedef gray8 color_type; + + color_interpolator(const color_type& c1, const color_type& c2, unsigned len) + : v(c1.v, c2.v, len) + , a(c1.a, c2.a, len) + {} + + void operator++() { - m_color_profile.add(color_point(offset, color)); + ++v; + ++a; } - //------------------------------------------------------------------------ - template - bool gradient_lut::build_lut() + color_type color() const { return color_type(v.y(), a.y()); } + + private: + agg::dda_line_interpolator<14> v, a; +}; + +//============================================================gradient_lut +template +class gradient_lut +{ + public: + typedef ColorInterpolator interpolator_type; + typedef typename interpolator_type::color_type color_type; + enum { color_lut_size = ColorLutSize }; + + //-------------------------------------------------------------------- + gradient_lut() + : m_color_lut(color_lut_size) + {} + + // Build Gradient Lut + // First, call remove_all(), then add_color() at least twice, + // then build_lut(). Argument "offset" in add_color must be + // in range [0...1] and defines a color stop as it is described + // in SVG specification, section Gradients and Patterns. + // The simplest linear gradient is: + // gradient_lut.add_color(0.0, start_color); + // gradient_lut.add_color(1.0, end_color); + //-------------------------------------------------------------------- + void remove_all(); + void add_color(double offset, const color_type& color); + bool build_lut(); + + // Size-index Interface. This class can be used directly as the + // ColorF in span_gradient. All it needs is two access methods + // size() and operator []. + //-------------------------------------------------------------------- + static unsigned size() { return color_lut_size; } + const color_type& operator[](unsigned i) const { return m_color_lut[i]; } + + private: + //-------------------------------------------------------------------- + struct color_point { - quick_sort(m_color_profile, offset_less); - m_color_profile.cut_at(remove_duplicates(m_color_profile, offset_equal)); - if(m_color_profile.size() >= 2) + double offset; + color_type color; + + color_point() {} + color_point(double off, const color_type& c) + : offset(off) + , color(c) { - unsigned i; - unsigned start = uround(m_color_profile[0].offset * color_lut_size); - unsigned end = 0; - color_type c = m_color_profile[0].color; - for(i = 0; i < start; i++) - { - m_color_lut[i] = c; - } - for(i = 1; i < m_color_profile.size(); i++) - { - end = uround(m_color_profile[i].offset * color_lut_size); - interpolator_type ci(m_color_profile[i-1].color, - m_color_profile[i ].color, - end - start + 1); - while(start < end) - { - m_color_lut[start] = ci.color(); - ++ci; - ++start; - } - } - c = m_color_profile.last().color; - for(; end < m_color_lut.size(); end++) - { - m_color_lut[end] = c; - } - return true; + if (offset < 0.0) + offset = 0.0; + if (offset > 1.0) + offset = 1.0; } - return false; - } + }; + typedef agg::pod_bvector color_profile_type; + typedef agg::pod_array color_lut_type; + + static bool offset_less(const color_point& a, const color_point& b) { return a.offset < b.offset; } + static bool offset_equal(const color_point& a, const color_point& b) { return a.offset == b.offset; } + + //-------------------------------------------------------------------- + color_profile_type m_color_profile; + color_lut_type m_color_lut; +}; + +//------------------------------------------------------------------------ +template +void gradient_lut::remove_all() +{ + m_color_profile.remove_all(); } +//------------------------------------------------------------------------ +template +void gradient_lut::add_color(double offset, const color_type& color) +{ + m_color_profile.add(color_point(offset, color)); +} - +//------------------------------------------------------------------------ +template +bool gradient_lut::build_lut() +{ + quick_sort(m_color_profile, offset_less); + m_color_profile.cut_at(remove_duplicates(m_color_profile, offset_equal)); + if (m_color_profile.size() >= 2) + { + unsigned i; + unsigned start = uround(m_color_profile[0].offset * color_lut_size); + unsigned end = 0; + color_type c = m_color_profile[0].color; + for (i = 0; i < start; i++) + { + m_color_lut[i] = c; + } + for (i = 1; i < m_color_profile.size(); i++) + { + end = uround(m_color_profile[i].offset * color_lut_size); + interpolator_type ci(m_color_profile[i - 1].color, m_color_profile[i].color, end - start + 1); + while (start < end) + { + m_color_lut[start] = ci.color(); + ++ci; + ++start; + } + } + c = m_color_profile.last().color; + for (; end < m_color_lut.size(); end++) + { + m_color_lut[end] = c; + } + return true; + } + return false; +} +} // namespace agg #endif diff --git a/deps/agg/include/agg_gsv_text.h b/deps/agg/include/agg_gsv_text.h index 73e4ec888..b0a5d3ac1 100644 --- a/deps/agg/include/agg_gsv_text.h +++ b/deps/agg/include/agg_gsv_text.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -24,130 +24,107 @@ #include "agg_conv_stroke.h" #include "agg_conv_transform.h" -namespace agg +namespace agg { + +//---------------------------------------------------------------gsv_text +// +// See Implementation agg_gsv_text.cpp +// +class gsv_text { + enum status { initial, next_char, start_glyph, glyph }; + public: + gsv_text(); - //---------------------------------------------------------------gsv_text - // - // See Implementation agg_gsv_text.cpp - // - class gsv_text + void font(const void* font); + void flip(bool flip_y) { m_flip = flip_y; } + void load_font(const char* file); + void size(double height, double width = 0.0); + void space(double space); + void line_space(double line_space); + void start_point(double x, double y); + void text(const char* text); + + double text_width(); + + void rewind(unsigned path_id); + unsigned vertex(double* x, double* y); + + private: + // not supposed to be copied + gsv_text(const gsv_text&); + const gsv_text& operator=(const gsv_text&); + + int16u value(const int8u* p) const { - enum status + int16u v; + if (m_big_endian) { - initial, - next_char, - start_glyph, - glyph - }; - - public: - gsv_text(); - - void font(const void* font); - void flip(bool flip_y) { m_flip = flip_y; } - void load_font(const char* file); - void size(double height, double width=0.0); - void space(double space); - void line_space(double line_space); - void start_point(double x, double y); - void text(const char* text); - - double text_width(); - - void rewind(unsigned path_id); - unsigned vertex(double* x, double* y); - - private: - // not supposed to be copied - gsv_text(const gsv_text&); - const gsv_text& operator = (const gsv_text&); - - int16u value(const int8u* p) const - { - int16u v; - if(m_big_endian) - { - *(int8u*)&v = p[1]; - *((int8u*)&v + 1) = p[0]; - } - else - { - *(int8u*)&v = p[0]; - *((int8u*)&v + 1) = p[1]; - } - return v; + *(int8u*)&v = p[1]; + *((int8u*)&v + 1) = p[0]; } + else + { + *(int8u*)&v = p[0]; + *((int8u*)&v + 1) = p[1]; + } + return v; + } - private: - double m_x; - double m_y; - double m_start_x; - double m_width; - double m_height; - double m_space; - double m_line_space; - char m_chr[2]; - char* m_text; - pod_array m_text_buf; - char* m_cur_chr; - const void* m_font; - pod_array m_loaded_font; - status m_status; - bool m_big_endian; - bool m_flip; - int8u* m_indices; - int8* m_glyphs; - int8* m_bglyph; - int8* m_eglyph; - double m_w; - double m_h; - }; + private: + double m_x; + double m_y; + double m_start_x; + double m_width; + double m_height; + double m_space; + double m_line_space; + char m_chr[2]; + char* m_text; + pod_array m_text_buf; + char* m_cur_chr; + const void* m_font; + pod_array m_loaded_font; + status m_status; + bool m_big_endian; + bool m_flip; + int8u* m_indices; + int8* m_glyphs; + int8* m_bglyph; + int8* m_eglyph; + double m_w; + double m_h; +}; +//--------------------------------------------------------gsv_text_outline +template +class gsv_text_outline +{ + public: + gsv_text_outline(gsv_text& text, const Transformer& trans) + : m_polyline(text) + , m_trans(m_polyline, trans) + {} + void width(double w) { m_polyline.width(w); } + void transformer(const Transformer* trans) { m_trans->transformer(trans); } - //--------------------------------------------------------gsv_text_outline - template class gsv_text_outline + void rewind(unsigned path_id) { - public: - gsv_text_outline(gsv_text& text, const Transformer& trans) : - m_polyline(text), - m_trans(m_polyline, trans) - { - } + m_trans.rewind(path_id); + m_polyline.line_join(round_join); + m_polyline.line_cap(round_cap); + } - void width(double w) - { - m_polyline.width(w); - } + unsigned vertex(double* x, double* y) { return m_trans.vertex(x, y); } - void transformer(const Transformer* trans) - { - m_trans->transformer(trans); - } - - void rewind(unsigned path_id) - { - m_trans.rewind(path_id); - m_polyline.line_join(round_join); - m_polyline.line_cap(round_cap); - } - - unsigned vertex(double* x, double* y) - { - return m_trans.vertex(x, y); - } - - private: - conv_stroke m_polyline; - conv_transform, Transformer> m_trans; - }; - - - -} + private: + conv_stroke m_polyline; + conv_transform, Transformer> m_trans; +}; +} // namespace agg #endif diff --git a/deps/agg/include/agg_image_accessors.h b/deps/agg/include/agg_image_accessors.h index 7166df2f0..6bdcc7bfa 100644 --- a/deps/agg/include/agg_image_accessors.h +++ b/deps/agg/include/agg_image_accessors.h @@ -18,464 +18,439 @@ #include "agg_basics.h" -namespace agg +namespace agg { + +//-----------------------------------------------------image_accessor_clip +template +class image_accessor_clip { + public: + typedef PixFmt pixfmt_type; + typedef typename pixfmt_type::color_type color_type; + typedef typename pixfmt_type::order_type order_type; + typedef typename pixfmt_type::value_type value_type; + enum pix_width_e { pix_width = pixfmt_type::pix_width }; - //-----------------------------------------------------image_accessor_clip - template class image_accessor_clip + image_accessor_clip() {} + explicit image_accessor_clip(const pixfmt_type& pixf, const color_type& bk) + : m_pixf(&pixf) { - public: - typedef PixFmt pixfmt_type; - typedef typename pixfmt_type::color_type color_type; - typedef typename pixfmt_type::order_type order_type; - typedef typename pixfmt_type::value_type value_type; - enum pix_width_e { pix_width = pixfmt_type::pix_width }; + pixfmt_type::make_pix(m_bk_buf, bk); + } - image_accessor_clip() {} - explicit image_accessor_clip(const pixfmt_type& pixf, - const color_type& bk) : - m_pixf(&pixf) - { - pixfmt_type::make_pix(m_bk_buf, bk); - } + void attach(const pixfmt_type& pixf) { m_pixf = &pixf; } - void attach(const pixfmt_type& pixf) - { - m_pixf = &pixf; - } + void background_color(const color_type& bk) { pixfmt_type::make_pix(m_bk_buf, bk); } - void background_color(const color_type& bk) - { - pixfmt_type::make_pix(m_bk_buf, bk); - } - - private: - AGG_INLINE const int8u* pixel() const - { - if(m_y >= 0 && m_y < (int)m_pixf->height() && - m_x >= 0 && m_x < (int)m_pixf->width()) - { - return m_pixf->pix_ptr(m_x, m_y); - } - return m_bk_buf; - } - - public: - AGG_INLINE const int8u* span(int x, int y, unsigned len) - { - m_x = m_x0 = x; - m_y = y; - if(y >= 0 && y < (int)m_pixf->height() && - x >= 0 && x+(int)len <= (int)m_pixf->width()) - { - return m_pix_ptr = m_pixf->pix_ptr(x, y); - } - m_pix_ptr = 0; - return pixel(); - } - - AGG_INLINE const int8u* next_x() - { - if(m_pix_ptr) return m_pix_ptr += pix_width; - ++m_x; - return pixel(); - } - - AGG_INLINE const int8u* next_y() - { - ++m_y; - m_x = m_x0; - if(m_pix_ptr && - m_y >= 0 && m_y < (int)m_pixf->height()) - { - return m_pix_ptr = m_pixf->pix_ptr(m_x, m_y); - } - m_pix_ptr = 0; - return pixel(); - } - - private: - const pixfmt_type* m_pixf; - int8u m_bk_buf[4]; - int m_x, m_x0, m_y; - const int8u* m_pix_ptr; - }; - - - - - //--------------------------------------------------image_accessor_no_clip - template class image_accessor_no_clip + private: + AGG_INLINE const int8u* pixel() const { - public: - typedef PixFmt pixfmt_type; - typedef typename pixfmt_type::color_type color_type; - typedef typename pixfmt_type::order_type order_type; - typedef typename pixfmt_type::value_type value_type; - enum pix_width_e { pix_width = pixfmt_type::pix_width }; - - image_accessor_no_clip() {} - explicit image_accessor_no_clip(const pixfmt_type& pixf) : - m_pixf(&pixf) - {} - - void attach(const pixfmt_type& pixf) + if (m_y >= 0 && m_y < (int)m_pixf->height() && m_x >= 0 && m_x < (int)m_pixf->width()) { - m_pixf = &pixf; + return m_pixf->pix_ptr(m_x, m_y); } + return m_bk_buf; + } - AGG_INLINE const int8u* span(int x, int y, unsigned) + public: + AGG_INLINE const int8u* span(int x, int y, unsigned len) + { + m_x = m_x0 = x; + m_y = y; + if (y >= 0 && y < (int)m_pixf->height() && x >= 0 && x + (int)len <= (int)m_pixf->width()) { - m_x = x; - m_y = y; return m_pix_ptr = m_pixf->pix_ptr(x, y); } + m_pix_ptr = 0; + return pixel(); + } - AGG_INLINE const int8u* next_x() - { + AGG_INLINE const int8u* next_x() + { + if (m_pix_ptr) return m_pix_ptr += pix_width; - } + ++m_x; + return pixel(); + } - AGG_INLINE const int8u* next_y() + AGG_INLINE const int8u* next_y() + { + ++m_y; + m_x = m_x0; + if (m_pix_ptr && m_y >= 0 && m_y < (int)m_pixf->height()) { - ++m_y; return m_pix_ptr = m_pixf->pix_ptr(m_x, m_y); } + m_pix_ptr = 0; + return pixel(); + } - private: - const pixfmt_type* m_pixf; - int m_x, m_y; - const int8u* m_pix_ptr; - }; + private: + const pixfmt_type* m_pixf; + int8u m_bk_buf[4]; + int m_x, m_x0, m_y; + const int8u* m_pix_ptr; +}; +//--------------------------------------------------image_accessor_no_clip +template +class image_accessor_no_clip +{ + public: + typedef PixFmt pixfmt_type; + typedef typename pixfmt_type::color_type color_type; + typedef typename pixfmt_type::order_type order_type; + typedef typename pixfmt_type::value_type value_type; + enum pix_width_e { pix_width = pixfmt_type::pix_width }; + image_accessor_no_clip() {} + explicit image_accessor_no_clip(const pixfmt_type& pixf) + : m_pixf(&pixf) + {} + void attach(const pixfmt_type& pixf) { m_pixf = &pixf; } - //----------------------------------------------------image_accessor_clone - template class image_accessor_clone + AGG_INLINE const int8u* span(int x, int y, unsigned) { - public: - typedef PixFmt pixfmt_type; - typedef typename pixfmt_type::color_type color_type; - typedef typename pixfmt_type::order_type order_type; - typedef typename pixfmt_type::value_type value_type; - enum pix_width_e { pix_width = pixfmt_type::pix_width }; + m_x = x; + m_y = y; + return m_pix_ptr = m_pixf->pix_ptr(x, y); + } - image_accessor_clone() {} - explicit image_accessor_clone(const pixfmt_type& pixf) : - m_pixf(&pixf) - {} + AGG_INLINE const int8u* next_x() { return m_pix_ptr += pix_width; } - void attach(const pixfmt_type& pixf) - { - m_pixf = &pixf; - } - - private: - AGG_INLINE const int8u* pixel() const - { - int x = m_x; - int y = m_y; - if(x < 0) x = 0; - if(y < 0) y = 0; - if(x >= (int)m_pixf->width()) x = m_pixf->width() - 1; - if(y >= (int)m_pixf->height()) y = m_pixf->height() - 1; - return m_pixf->pix_ptr(x, y); - } - - public: - AGG_INLINE const int8u* span(int x, int y, unsigned len) - { - m_x = m_x0 = x; - m_y = y; - if(y >= 0 && y < (int)m_pixf->height() && - x >= 0 && x+(int)len <= (int)m_pixf->width()) - { - return m_pix_ptr = m_pixf->pix_ptr(x, y); - } - m_pix_ptr = 0; - return pixel(); - } - - AGG_INLINE const int8u* next_x() - { - if(m_pix_ptr) return m_pix_ptr += pix_width; - ++m_x; - return pixel(); - } - - AGG_INLINE const int8u* next_y() - { - ++m_y; - m_x = m_x0; - if(m_pix_ptr && - m_y >= 0 && m_y < (int)m_pixf->height()) - { - return m_pix_ptr = m_pixf->pix_ptr(m_x, m_y); - } - m_pix_ptr = 0; - return pixel(); - } - - private: - const pixfmt_type* m_pixf; - int m_x, m_x0, m_y; - const int8u* m_pix_ptr; - }; - - - - - - //-----------------------------------------------------image_accessor_wrap - template class image_accessor_wrap + AGG_INLINE const int8u* next_y() { - public: - typedef PixFmt pixfmt_type; - typedef typename pixfmt_type::color_type color_type; - typedef typename pixfmt_type::order_type order_type; - typedef typename pixfmt_type::value_type value_type; - enum pix_width_e { pix_width = pixfmt_type::pix_width }; + ++m_y; + return m_pix_ptr = m_pixf->pix_ptr(m_x, m_y); + } - image_accessor_wrap() {} - explicit image_accessor_wrap(const pixfmt_type& pixf) : - m_pixf(&pixf), - m_wrap_x(pixf.width()), - m_wrap_y(pixf.height()) - {} + private: + const pixfmt_type* m_pixf; + int m_x, m_y; + const int8u* m_pix_ptr; +}; - void attach(const pixfmt_type& pixf) - { - m_pixf = &pixf; - } +//----------------------------------------------------image_accessor_clone +template +class image_accessor_clone +{ + public: + typedef PixFmt pixfmt_type; + typedef typename pixfmt_type::color_type color_type; + typedef typename pixfmt_type::order_type order_type; + typedef typename pixfmt_type::value_type value_type; + enum pix_width_e { pix_width = pixfmt_type::pix_width }; - AGG_INLINE const int8u* span(int x, int y, unsigned) - { - m_x = x; - m_row_ptr = m_pixf->row_ptr(m_wrap_y(y)); - return m_row_ptr + m_wrap_x(x) * pix_width; - } + image_accessor_clone() {} + explicit image_accessor_clone(const pixfmt_type& pixf) + : m_pixf(&pixf) + {} - AGG_INLINE const int8u* next_x() - { - int x = ++m_wrap_x; - return m_row_ptr + x * pix_width; - } + void attach(const pixfmt_type& pixf) { m_pixf = &pixf; } - AGG_INLINE const int8u* next_y() - { - m_row_ptr = m_pixf->row_ptr(++m_wrap_y); - return m_row_ptr + m_wrap_x(m_x) * pix_width; - } - - private: - const pixfmt_type* m_pixf; - const int8u* m_row_ptr; - int m_x; - WrapX m_wrap_x; - WrapY m_wrap_y; - }; - - - - - //--------------------------------------------------------wrap_mode_repeat - class wrap_mode_repeat + private: + AGG_INLINE const int8u* pixel() const { - public: - wrap_mode_repeat() {} - wrap_mode_repeat(unsigned size) : - m_size(size), - m_add(size * (0x3FFFFFFF / size)), - m_value(0) - {} + int x = m_x; + int y = m_y; + if (x < 0) + x = 0; + if (y < 0) + y = 0; + if (x >= (int)m_pixf->width()) + x = m_pixf->width() - 1; + if (y >= (int)m_pixf->height()) + y = m_pixf->height() - 1; + return m_pixf->pix_ptr(x, y); + } - AGG_INLINE unsigned operator() (int v) - { - return m_value = (unsigned(v) + m_add) % m_size; - } - - AGG_INLINE unsigned operator++ () - { - ++m_value; - if(m_value >= m_size) m_value = 0; - return m_value; - } - private: - unsigned m_size; - unsigned m_add; - unsigned m_value; - }; - - - //---------------------------------------------------wrap_mode_repeat_pow2 - class wrap_mode_repeat_pow2 + public: + AGG_INLINE const int8u* span(int x, int y, unsigned len) { - public: - wrap_mode_repeat_pow2() {} - wrap_mode_repeat_pow2(unsigned size) : m_value(0) + m_x = m_x0 = x; + m_y = y; + if (y >= 0 && y < (int)m_pixf->height() && x >= 0 && x + (int)len <= (int)m_pixf->width()) { - m_mask = 1; - while(m_mask < size) m_mask = (m_mask << 1) | 1; - m_mask >>= 1; + return m_pix_ptr = m_pixf->pix_ptr(x, y); } - AGG_INLINE unsigned operator() (int v) + m_pix_ptr = 0; + return pixel(); + } + + AGG_INLINE const int8u* next_x() + { + if (m_pix_ptr) + return m_pix_ptr += pix_width; + ++m_x; + return pixel(); + } + + AGG_INLINE const int8u* next_y() + { + ++m_y; + m_x = m_x0; + if (m_pix_ptr && m_y >= 0 && m_y < (int)m_pixf->height()) { + return m_pix_ptr = m_pixf->pix_ptr(m_x, m_y); + } + m_pix_ptr = 0; + return pixel(); + } + + private: + const pixfmt_type* m_pixf; + int m_x, m_x0, m_y; + const int8u* m_pix_ptr; +}; + +//-----------------------------------------------------image_accessor_wrap +template +class image_accessor_wrap +{ + public: + typedef PixFmt pixfmt_type; + typedef typename pixfmt_type::color_type color_type; + typedef typename pixfmt_type::order_type order_type; + typedef typename pixfmt_type::value_type value_type; + enum pix_width_e { pix_width = pixfmt_type::pix_width }; + + image_accessor_wrap() {} + explicit image_accessor_wrap(const pixfmt_type& pixf) + : m_pixf(&pixf) + , m_wrap_x(pixf.width()) + , m_wrap_y(pixf.height()) + {} + + void attach(const pixfmt_type& pixf) { m_pixf = &pixf; } + + AGG_INLINE const int8u* span(int x, int y, unsigned) + { + m_x = x; + m_row_ptr = m_pixf->row_ptr(m_wrap_y(y)); + return m_row_ptr + m_wrap_x(x) * pix_width; + } + + AGG_INLINE const int8u* next_x() + { + int x = ++m_wrap_x; + return m_row_ptr + x * pix_width; + } + + AGG_INLINE const int8u* next_y() + { + m_row_ptr = m_pixf->row_ptr(++m_wrap_y); + return m_row_ptr + m_wrap_x(m_x) * pix_width; + } + + private: + const pixfmt_type* m_pixf; + const int8u* m_row_ptr; + int m_x; + WrapX m_wrap_x; + WrapY m_wrap_y; +}; + +//--------------------------------------------------------wrap_mode_repeat +class wrap_mode_repeat +{ + public: + wrap_mode_repeat() {} + wrap_mode_repeat(unsigned size) + : m_size(size) + , m_add(size * (0x3FFFFFFF / size)) + , m_value(0) + {} + + AGG_INLINE unsigned operator()(int v) { return m_value = (unsigned(v) + m_add) % m_size; } + + AGG_INLINE unsigned operator++() + { + ++m_value; + if (m_value >= m_size) + m_value = 0; + return m_value; + } + + private: + unsigned m_size; + unsigned m_add; + unsigned m_value; +}; + +//---------------------------------------------------wrap_mode_repeat_pow2 +class wrap_mode_repeat_pow2 +{ + public: + wrap_mode_repeat_pow2() {} + wrap_mode_repeat_pow2(unsigned size) + : m_value(0) + { + m_mask = 1; + while (m_mask < size) + m_mask = (m_mask << 1) | 1; + m_mask >>= 1; + } + AGG_INLINE unsigned operator()(int v) { return m_value = unsigned(v) & m_mask; } + AGG_INLINE unsigned operator++() + { + ++m_value; + if (m_value > m_mask) + m_value = 0; + return m_value; + } + + private: + unsigned m_mask; + unsigned m_value; +}; + +//----------------------------------------------wrap_mode_repeat_auto_pow2 +class wrap_mode_repeat_auto_pow2 +{ + public: + wrap_mode_repeat_auto_pow2() {} + wrap_mode_repeat_auto_pow2(unsigned size) + : m_size(size) + , m_add(size * (0x3FFFFFFF / size)) + , m_mask((m_size & (m_size - 1)) ? 0 : m_size - 1) + , m_value(0) + {} + + AGG_INLINE unsigned operator()(int v) + { + if (m_mask) return m_value = unsigned(v) & m_mask; - } - AGG_INLINE unsigned operator++ () - { - ++m_value; - if(m_value > m_mask) m_value = 0; - return m_value; - } - private: - unsigned m_mask; - unsigned m_value; - }; - - - //----------------------------------------------wrap_mode_repeat_auto_pow2 - class wrap_mode_repeat_auto_pow2 + return m_value = (unsigned(v) + m_add) % m_size; + } + AGG_INLINE unsigned operator++() { - public: - wrap_mode_repeat_auto_pow2() {} - wrap_mode_repeat_auto_pow2(unsigned size) : - m_size(size), - m_add(size * (0x3FFFFFFF / size)), - m_mask((m_size & (m_size-1)) ? 0 : m_size-1), - m_value(0) - {} + ++m_value; + if (m_value >= m_size) + m_value = 0; + return m_value; + } - AGG_INLINE unsigned operator() (int v) - { - if(m_mask) return m_value = unsigned(v) & m_mask; - return m_value = (unsigned(v) + m_add) % m_size; - } - AGG_INLINE unsigned operator++ () - { - ++m_value; - if(m_value >= m_size) m_value = 0; - return m_value; - } + private: + unsigned m_size; + unsigned m_add; + unsigned m_mask; + unsigned m_value; +}; - private: - unsigned m_size; - unsigned m_add; - unsigned m_mask; - unsigned m_value; - }; +//-------------------------------------------------------wrap_mode_reflect +class wrap_mode_reflect +{ + public: + wrap_mode_reflect() {} + wrap_mode_reflect(unsigned size) + : m_size(size) + , m_size2(size * 2) + , m_add(m_size2 * (0x3FFFFFFF / m_size2)) + , m_value(0) + {} - - //-------------------------------------------------------wrap_mode_reflect - class wrap_mode_reflect + AGG_INLINE unsigned operator()(int v) { - public: - wrap_mode_reflect() {} - wrap_mode_reflect(unsigned size) : - m_size(size), - m_size2(size * 2), - m_add(m_size2 * (0x3FFFFFFF / m_size2)), - m_value(0) - {} + m_value = (unsigned(v) + m_add) % m_size2; + if (m_value >= m_size) + return m_size2 - m_value - 1; + return m_value; + } - AGG_INLINE unsigned operator() (int v) - { - m_value = (unsigned(v) + m_add) % m_size2; - if(m_value >= m_size) return m_size2 - m_value - 1; - return m_value; - } - - AGG_INLINE unsigned operator++ () - { - ++m_value; - if(m_value >= m_size2) m_value = 0; - if(m_value >= m_size) return m_size2 - m_value - 1; - return m_value; - } - private: - unsigned m_size; - unsigned m_size2; - unsigned m_add; - unsigned m_value; - }; - - - - //--------------------------------------------------wrap_mode_reflect_pow2 - class wrap_mode_reflect_pow2 + AGG_INLINE unsigned operator++() { - public: - wrap_mode_reflect_pow2() {} - wrap_mode_reflect_pow2(unsigned size) : m_value(0) - { - m_mask = 1; - m_size = 1; - while(m_mask < size) - { - m_mask = (m_mask << 1) | 1; - m_size <<= 1; - } - } - AGG_INLINE unsigned operator() (int v) - { - m_value = unsigned(v) & m_mask; - if(m_value >= m_size) return m_mask - m_value; - return m_value; - } - AGG_INLINE unsigned operator++ () - { - ++m_value; - m_value &= m_mask; - if(m_value >= m_size) return m_mask - m_value; - return m_value; - } - private: - unsigned m_size; - unsigned m_mask; - unsigned m_value; - }; + ++m_value; + if (m_value >= m_size2) + m_value = 0; + if (m_value >= m_size) + return m_size2 - m_value - 1; + return m_value; + } + private: + unsigned m_size; + unsigned m_size2; + unsigned m_add; + unsigned m_value; +}; - - //---------------------------------------------wrap_mode_reflect_auto_pow2 - class wrap_mode_reflect_auto_pow2 +//--------------------------------------------------wrap_mode_reflect_pow2 +class wrap_mode_reflect_pow2 +{ + public: + wrap_mode_reflect_pow2() {} + wrap_mode_reflect_pow2(unsigned size) + : m_value(0) { - public: - wrap_mode_reflect_auto_pow2() {} - wrap_mode_reflect_auto_pow2(unsigned size) : - m_size(size), - m_size2(size * 2), - m_add(m_size2 * (0x3FFFFFFF / m_size2)), - m_mask((m_size2 & (m_size2-1)) ? 0 : m_size2-1), - m_value(0) - {} - - AGG_INLINE unsigned operator() (int v) + m_mask = 1; + m_size = 1; + while (m_mask < size) { - m_value = m_mask ? unsigned(v) & m_mask : - (unsigned(v) + m_add) % m_size2; - if(m_value >= m_size) return m_size2 - m_value - 1; - return m_value; - } - AGG_INLINE unsigned operator++ () - { - ++m_value; - if(m_value >= m_size2) m_value = 0; - if(m_value >= m_size) return m_size2 - m_value - 1; - return m_value; + m_mask = (m_mask << 1) | 1; + m_size <<= 1; } + } + AGG_INLINE unsigned operator()(int v) + { + m_value = unsigned(v) & m_mask; + if (m_value >= m_size) + return m_mask - m_value; + return m_value; + } + AGG_INLINE unsigned operator++() + { + ++m_value; + m_value &= m_mask; + if (m_value >= m_size) + return m_mask - m_value; + return m_value; + } - private: - unsigned m_size; - unsigned m_size2; - unsigned m_add; - unsigned m_mask; - unsigned m_value; - }; + private: + unsigned m_size; + unsigned m_mask; + unsigned m_value; +}; +//---------------------------------------------wrap_mode_reflect_auto_pow2 +class wrap_mode_reflect_auto_pow2 +{ + public: + wrap_mode_reflect_auto_pow2() {} + wrap_mode_reflect_auto_pow2(unsigned size) + : m_size(size) + , m_size2(size * 2) + , m_add(m_size2 * (0x3FFFFFFF / m_size2)) + , m_mask((m_size2 & (m_size2 - 1)) ? 0 : m_size2 - 1) + , m_value(0) + {} -} + AGG_INLINE unsigned operator()(int v) + { + m_value = m_mask ? unsigned(v) & m_mask : (unsigned(v) + m_add) % m_size2; + if (m_value >= m_size) + return m_size2 - m_value - 1; + return m_value; + } + AGG_INLINE unsigned operator++() + { + ++m_value; + if (m_value >= m_size2) + m_value = 0; + if (m_value >= m_size) + return m_size2 - m_value - 1; + return m_value; + } + private: + unsigned m_size; + unsigned m_size2; + unsigned m_add; + unsigned m_mask; + unsigned m_value; +}; + +} // namespace agg #endif diff --git a/deps/agg/include/agg_image_filters.h b/deps/agg/include/agg_image_filters.h index 2b84ddeb9..d8d53d0c3 100644 --- a/deps/agg/include/agg_image_filters.h +++ b/deps/agg/include/agg_image_filters.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -23,426 +23,499 @@ #include "agg_array.h" #include "agg_math.h" -namespace agg +namespace agg { + +// See Implementation agg_image_filters.cpp + +enum image_filter_scale_e { + image_filter_shift = 14, //----image_filter_shift + image_filter_scale = 1 << image_filter_shift, //----image_filter_scale + image_filter_mask = image_filter_scale - 1 //----image_filter_mask +}; + +enum image_subpixel_scale_e { + image_subpixel_shift = 8, //----image_subpixel_shift + image_subpixel_scale = 1 << image_subpixel_shift, //----image_subpixel_scale + image_subpixel_mask = image_subpixel_scale - 1 //----image_subpixel_mask +}; + +//-----------------------------------------------------image_filter_lut +class image_filter_lut { - - // See Implementation agg_image_filters.cpp - - enum image_filter_scale_e + public: + template + void calculate(const FilterF& filter, bool normalization = true) { - image_filter_shift = 14, //----image_filter_shift - image_filter_scale = 1 << image_filter_shift, //----image_filter_scale - image_filter_mask = image_filter_scale - 1 //----image_filter_mask - }; - - enum image_subpixel_scale_e - { - image_subpixel_shift = 8, //----image_subpixel_shift - image_subpixel_scale = 1 << image_subpixel_shift, //----image_subpixel_scale - image_subpixel_mask = image_subpixel_scale - 1 //----image_subpixel_mask - }; - - - //-----------------------------------------------------image_filter_lut - class image_filter_lut - { - public: - template void calculate(const FilterF& filter, - bool normalization=true) + double r = filter.radius(); + realloc_lut(r); + unsigned i; + unsigned pivot = diameter() << (image_subpixel_shift - 1); + for (i = 0; i < pivot; i++) { - double r = filter.radius(); - realloc_lut(r); - unsigned i; - unsigned pivot = diameter() << (image_subpixel_shift - 1); - for(i = 0; i < pivot; i++) - { - double x = double(i) / double(image_subpixel_scale); - double y = filter.calc_weight(x); - m_weight_array[pivot + i] = - m_weight_array[pivot - i] = (int16)iround(y * image_filter_scale); - } - unsigned end = (diameter() << image_subpixel_shift) - 1; - m_weight_array[0] = m_weight_array[end]; - if(normalization) - { - normalize(); - } + double x = double(i) / double(image_subpixel_scale); + double y = filter.calc_weight(x); + m_weight_array[pivot + i] = m_weight_array[pivot - i] = (int16)iround(y * image_filter_scale); } - - image_filter_lut() : m_radius(0), m_diameter(0), m_start(0) {} - - template image_filter_lut(const FilterF& filter, - bool normalization=true) + unsigned end = (diameter() << image_subpixel_shift) - 1; + m_weight_array[0] = m_weight_array[end]; + if (normalization) { - calculate(filter, normalization); + normalize(); } + } - double radius() const { return m_radius; } - unsigned diameter() const { return m_diameter; } - int start() const { return m_start; } - const int16* weight_array() const { return &m_weight_array[0]; } - void normalize(); + image_filter_lut() + : m_radius(0) + , m_diameter(0) + , m_start(0) + {} - private: - void realloc_lut(double radius); - image_filter_lut(const image_filter_lut&); - const image_filter_lut& operator = (const image_filter_lut&); - - double m_radius; - unsigned m_diameter; - int m_start; - pod_array m_weight_array; - }; - - - - //--------------------------------------------------------image_filter - template class image_filter : public image_filter_lut + template + image_filter_lut(const FilterF& filter, bool normalization = true) { - public: - image_filter() + calculate(filter, normalization); + } + + double radius() const { return m_radius; } + unsigned diameter() const { return m_diameter; } + int start() const { return m_start; } + const int16* weight_array() const { return &m_weight_array[0]; } + void normalize(); + + private: + void realloc_lut(double radius); + image_filter_lut(const image_filter_lut&); + const image_filter_lut& operator=(const image_filter_lut&); + + double m_radius; + unsigned m_diameter; + int m_start; + pod_array m_weight_array; +}; + +//--------------------------------------------------------image_filter +template +class image_filter : public image_filter_lut +{ + public: + image_filter() { calculate(m_filter_function); } + + private: + FilterF m_filter_function; +}; + +//-----------------------------------------------image_filter_bilinear +struct image_filter_bilinear +{ + static double radius() { return 1.0; } + static double calc_weight(double x) { return 1.0 - x; } +}; + +//-----------------------------------------------image_filter_hanning +struct image_filter_hanning +{ + static double radius() { return 1.0; } + static double calc_weight(double x) { return 0.5 + 0.5 * std::cos(pi * x); } +}; + +//-----------------------------------------------image_filter_hamming +struct image_filter_hamming +{ + static double radius() { return 1.0; } + static double calc_weight(double x) { return 0.54 + 0.46 * std::cos(pi * x); } +}; + +//-----------------------------------------------image_filter_hermite +struct image_filter_hermite +{ + static double radius() { return 1.0; } + static double calc_weight(double x) { return (2.0 * x - 3.0) * x * x + 1.0; } +}; + +//------------------------------------------------image_filter_quadric +struct image_filter_quadric +{ + static double radius() { return 1.5; } + static double calc_weight(double x) + { + double t; + if (x < 0.5) + return 0.75 - x * x; + if (x < 1.5) { - calculate(m_filter_function); + t = x - 1.5; + return 0.5 * t * t; } - private: - FilterF m_filter_function; - }; + return 0.0; + } +}; +//------------------------------------------------image_filter_bicubic +class image_filter_bicubic +{ + static double pow3(double x) { return (x <= 0.0) ? 0.0 : x * x * x; } - //-----------------------------------------------image_filter_bilinear - struct image_filter_bilinear + public: + static double radius() { return 2.0; } + static double calc_weight(double x) { - static double radius() { return 1.0; } - static double calc_weight(double x) + return (1.0 / 6.0) * (pow3(x + 2) - 4 * pow3(x + 1) + 6 * pow3(x) - 4 * pow3(x - 1)); + } +}; + +//-------------------------------------------------image_filter_kaiser +class image_filter_kaiser +{ + double a; + double i0a; + double epsilon; + + public: + image_filter_kaiser(double b = 6.33) + : a(b) + , epsilon(1e-12) + { + i0a = 1.0 / bessel_i0(b); + } + + static double radius() { return 1.0; } + double calc_weight(double x) const { return bessel_i0(a * sqrt(1. - x * x)) * i0a; } + + private: + double bessel_i0(double x) const + { + int i; + double sum, y, t; + + sum = 1.; + y = x * x / 4.; + t = y; + + for (i = 2; t > epsilon; i++) { - return 1.0 - x; + sum += t; + t *= (double)y / (i * i); } - }; + return sum; + } +}; - - //-----------------------------------------------image_filter_hanning - struct image_filter_hanning +//----------------------------------------------image_filter_catrom +struct image_filter_catrom +{ + static double radius() { return 2.0; } + static double calc_weight(double x) { - static double radius() { return 1.0; } - static double calc_weight(double x) + if (x < 1.0) + return 0.5 * (2.0 + x * x * (-5.0 + x * 3.0)); + if (x < 2.0) + return 0.5 * (4.0 + x * (-8.0 + x * (5.0 - x))); + return 0.; + } +}; + +//---------------------------------------------image_filter_mitchell +class image_filter_mitchell +{ + double p0, p2, p3; + double q0, q1, q2, q3; + + public: + image_filter_mitchell(double b = 1.0 / 3.0, double c = 1.0 / 3.0) + : p0((6.0 - 2.0 * b) / 6.0) + , p2((-18.0 + 12.0 * b + 6.0 * c) / 6.0) + , p3((12.0 - 9.0 * b - 6.0 * c) / 6.0) + , q0((8.0 * b + 24.0 * c) / 6.0) + , q1((-12.0 * b - 48.0 * c) / 6.0) + , q2((6.0 * b + 30.0 * c) / 6.0) + , q3((-b - 6.0 * c) / 6.0) + {} + + static double radius() { return 2.0; } + double calc_weight(double x) const + { + if (x < 1.0) + return p0 + x * x * (p2 + x * p3); + if (x < 2.0) + return q0 + x * (q1 + x * (q2 + x * q3)); + return 0.0; + } +}; + +//----------------------------------------------image_filter_spline16 +struct image_filter_spline16 +{ + static double radius() { return 2.0; } + static double calc_weight(double x) + { + if (x < 1.0) { - return 0.5 + 0.5 * std::cos(pi * x); + return ((x - 9.0 / 5.0) * x - 1.0 / 5.0) * x + 1.0; } - }; + return ((-1.0 / 3.0 * (x - 1) + 4.0 / 5.0) * (x - 1) - 7.0 / 15.0) * (x - 1); + } +}; - - //-----------------------------------------------image_filter_hamming - struct image_filter_hamming +//---------------------------------------------image_filter_spline36 +struct image_filter_spline36 +{ + static double radius() { return 3.0; } + static double calc_weight(double x) { - static double radius() { return 1.0; } - static double calc_weight(double x) + if (x < 1.0) { - return 0.54 + 0.46 * std::cos(pi * x); + return ((13.0 / 11.0 * x - 453.0 / 209.0) * x - 3.0 / 209.0) * x + 1.0; } - }; - - //-----------------------------------------------image_filter_hermite - struct image_filter_hermite - { - static double radius() { return 1.0; } - static double calc_weight(double x) + if (x < 2.0) { - return (2.0 * x - 3.0) * x * x + 1.0; + return ((-6.0 / 11.0 * (x - 1) + 270.0 / 209.0) * (x - 1) - 156.0 / 209.0) * (x - 1); } - }; - - //------------------------------------------------image_filter_quadric - struct image_filter_quadric + return ((1.0 / 11.0 * (x - 2) - 45.0 / 209.0) * (x - 2) + 26.0 / 209.0) * (x - 2); + } +}; + +//----------------------------------------------image_filter_gaussian +struct image_filter_gaussian +{ + static double radius() { return 2.0; } + static double calc_weight(double x) { return exp(-2.0 * x * x) * sqrt(2.0 / pi); } +}; + +//------------------------------------------------image_filter_bessel +struct image_filter_bessel +{ + static double radius() { return 3.2383; } + static double calc_weight(double x) { return (x == 0.0) ? pi / 4.0 : besj(pi * x, 1) / (2.0 * x); } +}; + +//-------------------------------------------------image_filter_sinc +class image_filter_sinc +{ + public: + image_filter_sinc(double r) + : m_radius(r < 2.0 ? 2.0 : r) + {} + double radius() const { return m_radius; } + double calc_weight(double x) const { - static double radius() { return 1.5; } - static double calc_weight(double x) - { - double t; - if(x < 0.5) return 0.75 - x * x; - if(x < 1.5) {t = x - 1.5; return 0.5 * t * t;} + if (x == 0.0) + return 1.0; + x *= pi; + return std::sin(x) / x; + } + + private: + double m_radius; +}; + +//-----------------------------------------------image_filter_lanczos +class image_filter_lanczos +{ + public: + image_filter_lanczos(double r) + : m_radius(r < 2.0 ? 2.0 : r) + {} + double radius() const { return m_radius; } + double calc_weight(double x) const + { + if (x == 0.0) + return 1.0; + if (x > m_radius) return 0.0; - } - }; + x *= pi; + double xr = x / m_radius; + return (std::sin(x) / x) * (std::sin(xr) / xr); + } - //------------------------------------------------image_filter_bicubic - class image_filter_bicubic + private: + double m_radius; +}; + +//----------------------------------------------image_filter_blackman +class image_filter_blackman +{ + public: + image_filter_blackman(double r) + : m_radius(r < 2.0 ? 2.0 : r) + {} + double radius() const { return m_radius; } + double calc_weight(double x) const { - static double pow3(double x) - { - return (x <= 0.0) ? 0.0 : x * x * x; - } - - public: - static double radius() { return 2.0; } - static double calc_weight(double x) - { - return - (1.0/6.0) * - (pow3(x + 2) - 4 * pow3(x + 1) + 6 * pow3(x) - 4 * pow3(x - 1)); - } - }; - - //-------------------------------------------------image_filter_kaiser - class image_filter_kaiser - { - double a; - double i0a; - double epsilon; - - public: - image_filter_kaiser(double b = 6.33) : - a(b), epsilon(1e-12) - { - i0a = 1.0 / bessel_i0(b); - } - - static double radius() { return 1.0; } - double calc_weight(double x) const - { - return bessel_i0(a * sqrt(1. - x * x)) * i0a; - } - - private: - double bessel_i0(double x) const - { - int i; - double sum, y, t; - - sum = 1.; - y = x * x / 4.; - t = y; - - for(i = 2; t > epsilon; i++) - { - sum += t; - t *= (double)y / (i * i); - } - return sum; - } - }; - - //----------------------------------------------image_filter_catrom - struct image_filter_catrom - { - static double radius() { return 2.0; } - static double calc_weight(double x) - { - if(x < 1.0) return 0.5 * (2.0 + x * x * (-5.0 + x * 3.0)); - if(x < 2.0) return 0.5 * (4.0 + x * (-8.0 + x * (5.0 - x))); - return 0.; - } - }; - - //---------------------------------------------image_filter_mitchell - class image_filter_mitchell - { - double p0, p2, p3; - double q0, q1, q2, q3; - - public: - image_filter_mitchell(double b = 1.0/3.0, double c = 1.0/3.0) : - p0((6.0 - 2.0 * b) / 6.0), - p2((-18.0 + 12.0 * b + 6.0 * c) / 6.0), - p3((12.0 - 9.0 * b - 6.0 * c) / 6.0), - q0((8.0 * b + 24.0 * c) / 6.0), - q1((-12.0 * b - 48.0 * c) / 6.0), - q2((6.0 * b + 30.0 * c) / 6.0), - q3((-b - 6.0 * c) / 6.0) - {} - - static double radius() { return 2.0; } - double calc_weight(double x) const - { - if(x < 1.0) return p0 + x * x * (p2 + x * p3); - if(x < 2.0) return q0 + x * (q1 + x * (q2 + x * q3)); + if (x == 0.0) + return 1.0; + if (x > m_radius) return 0.0; - } - }; + x *= pi; + double xr = x / m_radius; + return (std::sin(x) / x) * (0.42 + 0.5 * std::cos(xr) + 0.08 * std::cos(2 * xr)); + } + private: + double m_radius; +}; - //----------------------------------------------image_filter_spline16 - struct image_filter_spline16 - { - static double radius() { return 2.0; } - static double calc_weight(double x) - { - if(x < 1.0) - { - return ((x - 9.0/5.0 ) * x - 1.0/5.0 ) * x + 1.0; - } - return ((-1.0/3.0 * (x-1) + 4.0/5.0) * (x-1) - 7.0/15.0 ) * (x-1); - } - }; +//------------------------------------------------image_filter_sinc36 +class image_filter_sinc36 : public image_filter_sinc +{ + public: + image_filter_sinc36() + : image_filter_sinc(3.0) + {} +}; +//------------------------------------------------image_filter_sinc64 +class image_filter_sinc64 : public image_filter_sinc +{ + public: + image_filter_sinc64() + : image_filter_sinc(4.0) + {} +}; - //---------------------------------------------image_filter_spline36 - struct image_filter_spline36 - { - static double radius() { return 3.0; } - static double calc_weight(double x) - { - if(x < 1.0) - { - return ((13.0/11.0 * x - 453.0/209.0) * x - 3.0/209.0) * x + 1.0; - } - if(x < 2.0) - { - return ((-6.0/11.0 * (x-1) + 270.0/209.0) * (x-1) - 156.0/ 209.0) * (x-1); - } - return ((1.0/11.0 * (x-2) - 45.0/209.0) * (x-2) + 26.0/209.0) * (x-2); - } - }; +//-----------------------------------------------image_filter_sinc100 +class image_filter_sinc100 : public image_filter_sinc +{ + public: + image_filter_sinc100() + : image_filter_sinc(5.0) + {} +}; +//-----------------------------------------------image_filter_sinc144 +class image_filter_sinc144 : public image_filter_sinc +{ + public: + image_filter_sinc144() + : image_filter_sinc(6.0) + {} +}; - //----------------------------------------------image_filter_gaussian - struct image_filter_gaussian - { - static double radius() { return 2.0; } - static double calc_weight(double x) - { - return exp(-2.0 * x * x) * sqrt(2.0 / pi); - } - }; +//-----------------------------------------------image_filter_sinc196 +class image_filter_sinc196 : public image_filter_sinc +{ + public: + image_filter_sinc196() + : image_filter_sinc(7.0) + {} +}; +//-----------------------------------------------image_filter_sinc256 +class image_filter_sinc256 : public image_filter_sinc +{ + public: + image_filter_sinc256() + : image_filter_sinc(8.0) + {} +}; - //------------------------------------------------image_filter_bessel - struct image_filter_bessel - { - static double radius() { return 3.2383; } - static double calc_weight(double x) - { - return (x == 0.0) ? pi / 4.0 : besj(pi * x, 1) / (2.0 * x); - } - }; +//---------------------------------------------image_filter_lanczos36 +class image_filter_lanczos36 : public image_filter_lanczos +{ + public: + image_filter_lanczos36() + : image_filter_lanczos(3.0) + {} +}; +//---------------------------------------------image_filter_lanczos64 +class image_filter_lanczos64 : public image_filter_lanczos +{ + public: + image_filter_lanczos64() + : image_filter_lanczos(4.0) + {} +}; - //-------------------------------------------------image_filter_sinc - class image_filter_sinc - { - public: - image_filter_sinc(double r) : m_radius(r < 2.0 ? 2.0 : r) {} - double radius() const { return m_radius; } - double calc_weight(double x) const - { - if(x == 0.0) return 1.0; - x *= pi; - return std::sin(x) / x; - } - private: - double m_radius; - }; +//--------------------------------------------image_filter_lanczos100 +class image_filter_lanczos100 : public image_filter_lanczos +{ + public: + image_filter_lanczos100() + : image_filter_lanczos(5.0) + {} +}; +//--------------------------------------------image_filter_lanczos144 +class image_filter_lanczos144 : public image_filter_lanczos +{ + public: + image_filter_lanczos144() + : image_filter_lanczos(6.0) + {} +}; - //-----------------------------------------------image_filter_lanczos - class image_filter_lanczos - { - public: - image_filter_lanczos(double r) : m_radius(r < 2.0 ? 2.0 : r) {} - double radius() const { return m_radius; } - double calc_weight(double x) const - { - if(x == 0.0) return 1.0; - if(x > m_radius) return 0.0; - x *= pi; - double xr = x / m_radius; - return (std::sin(x) / x) * (std::sin(xr) / xr); - } - private: - double m_radius; - }; +//--------------------------------------------image_filter_lanczos196 +class image_filter_lanczos196 : public image_filter_lanczos +{ + public: + image_filter_lanczos196() + : image_filter_lanczos(7.0) + {} +}; +//--------------------------------------------image_filter_lanczos256 +class image_filter_lanczos256 : public image_filter_lanczos +{ + public: + image_filter_lanczos256() + : image_filter_lanczos(8.0) + {} +}; - //----------------------------------------------image_filter_blackman - class image_filter_blackman - { - public: - image_filter_blackman(double r) : m_radius(r < 2.0 ? 2.0 : r) {} - double radius() const { return m_radius; } - double calc_weight(double x) const - { - if(x == 0.0) return 1.0; - if(x > m_radius) return 0.0; - x *= pi; - double xr = x / m_radius; - return (std::sin(x) / x) * (0.42 + 0.5 * std::cos(xr) + 0.08 * std::cos(2*xr)); - } - private: - double m_radius; - }; +//--------------------------------------------image_filter_blackman36 +class image_filter_blackman36 : public image_filter_blackman +{ + public: + image_filter_blackman36() + : image_filter_blackman(3.0) + {} +}; - //------------------------------------------------image_filter_sinc36 - class image_filter_sinc36 : public image_filter_sinc - { public: image_filter_sinc36() : image_filter_sinc(3.0){} }; +//--------------------------------------------image_filter_blackman64 +class image_filter_blackman64 : public image_filter_blackman +{ + public: + image_filter_blackman64() + : image_filter_blackman(4.0) + {} +}; - //------------------------------------------------image_filter_sinc64 - class image_filter_sinc64 : public image_filter_sinc - { public: image_filter_sinc64() : image_filter_sinc(4.0){} }; +//-------------------------------------------image_filter_blackman100 +class image_filter_blackman100 : public image_filter_blackman +{ + public: + image_filter_blackman100() + : image_filter_blackman(5.0) + {} +}; - //-----------------------------------------------image_filter_sinc100 - class image_filter_sinc100 : public image_filter_sinc - { public: image_filter_sinc100() : image_filter_sinc(5.0){} }; +//-------------------------------------------image_filter_blackman144 +class image_filter_blackman144 : public image_filter_blackman +{ + public: + image_filter_blackman144() + : image_filter_blackman(6.0) + {} +}; - //-----------------------------------------------image_filter_sinc144 - class image_filter_sinc144 : public image_filter_sinc - { public: image_filter_sinc144() : image_filter_sinc(6.0){} }; +//-------------------------------------------image_filter_blackman196 +class image_filter_blackman196 : public image_filter_blackman +{ + public: + image_filter_blackman196() + : image_filter_blackman(7.0) + {} +}; - //-----------------------------------------------image_filter_sinc196 - class image_filter_sinc196 : public image_filter_sinc - { public: image_filter_sinc196() : image_filter_sinc(7.0){} }; +//-------------------------------------------image_filter_blackman256 +class image_filter_blackman256 : public image_filter_blackman +{ + public: + image_filter_blackman256() + : image_filter_blackman(8.0) + {} +}; - //-----------------------------------------------image_filter_sinc256 - class image_filter_sinc256 : public image_filter_sinc - { public: image_filter_sinc256() : image_filter_sinc(8.0){} }; - - //---------------------------------------------image_filter_lanczos36 - class image_filter_lanczos36 : public image_filter_lanczos - { public: image_filter_lanczos36() : image_filter_lanczos(3.0){} }; - - //---------------------------------------------image_filter_lanczos64 - class image_filter_lanczos64 : public image_filter_lanczos - { public: image_filter_lanczos64() : image_filter_lanczos(4.0){} }; - - //--------------------------------------------image_filter_lanczos100 - class image_filter_lanczos100 : public image_filter_lanczos - { public: image_filter_lanczos100() : image_filter_lanczos(5.0){} }; - - //--------------------------------------------image_filter_lanczos144 - class image_filter_lanczos144 : public image_filter_lanczos - { public: image_filter_lanczos144() : image_filter_lanczos(6.0){} }; - - //--------------------------------------------image_filter_lanczos196 - class image_filter_lanczos196 : public image_filter_lanczos - { public: image_filter_lanczos196() : image_filter_lanczos(7.0){} }; - - //--------------------------------------------image_filter_lanczos256 - class image_filter_lanczos256 : public image_filter_lanczos - { public: image_filter_lanczos256() : image_filter_lanczos(8.0){} }; - - //--------------------------------------------image_filter_blackman36 - class image_filter_blackman36 : public image_filter_blackman - { public: image_filter_blackman36() : image_filter_blackman(3.0){} }; - - //--------------------------------------------image_filter_blackman64 - class image_filter_blackman64 : public image_filter_blackman - { public: image_filter_blackman64() : image_filter_blackman(4.0){} }; - - //-------------------------------------------image_filter_blackman100 - class image_filter_blackman100 : public image_filter_blackman - { public: image_filter_blackman100() : image_filter_blackman(5.0){} }; - - //-------------------------------------------image_filter_blackman144 - class image_filter_blackman144 : public image_filter_blackman - { public: image_filter_blackman144() : image_filter_blackman(6.0){} }; - - //-------------------------------------------image_filter_blackman196 - class image_filter_blackman196 : public image_filter_blackman - { public: image_filter_blackman196() : image_filter_blackman(7.0){} }; - - //-------------------------------------------image_filter_blackman256 - class image_filter_blackman256 : public image_filter_blackman - { public: image_filter_blackman256() : image_filter_blackman(8.0){} }; - - -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_line_aa_basics.h b/deps/agg/include/agg_line_aa_basics.h index d22711d8c..94aab1f2f 100644 --- a/deps/agg/include/agg_line_aa_basics.h +++ b/deps/agg/include/agg_line_aa_basics.h @@ -18,172 +18,154 @@ #include #include "agg_basics.h" -namespace agg +namespace agg { + +// See Implementation agg_line_aa_basics.cpp + +//------------------------------------------------------------------------- +enum line_subpixel_scale_e { + line_subpixel_shift = 8, //----line_subpixel_shift + line_subpixel_scale = 1 << line_subpixel_shift, //----line_subpixel_scale + line_subpixel_mask = line_subpixel_scale - 1, //----line_subpixel_mask + line_max_coord = (1 << 28) - 1, //----line_max_coord + line_max_length = 1 << (line_subpixel_shift + 10) //----line_max_length +}; + +//------------------------------------------------------------------------- +enum line_mr_subpixel_scale_e { + line_mr_subpixel_shift = 4, //----line_mr_subpixel_shift + line_mr_subpixel_scale = 1 << line_mr_subpixel_shift, //----line_mr_subpixel_scale + line_mr_subpixel_mask = line_mr_subpixel_scale - 1 //----line_mr_subpixel_mask +}; + +//------------------------------------------------------------------line_mr +AGG_INLINE int line_mr(int x) { - - // See Implementation agg_line_aa_basics.cpp - - //------------------------------------------------------------------------- - enum line_subpixel_scale_e - { - line_subpixel_shift = 8, //----line_subpixel_shift - line_subpixel_scale = 1 << line_subpixel_shift, //----line_subpixel_scale - line_subpixel_mask = line_subpixel_scale - 1, //----line_subpixel_mask - line_max_coord = (1 << 28) - 1, //----line_max_coord - line_max_length = 1 << (line_subpixel_shift + 10) //----line_max_length - }; - - //------------------------------------------------------------------------- - enum line_mr_subpixel_scale_e - { - line_mr_subpixel_shift = 4, //----line_mr_subpixel_shift - line_mr_subpixel_scale = 1 << line_mr_subpixel_shift, //----line_mr_subpixel_scale - line_mr_subpixel_mask = line_mr_subpixel_scale - 1 //----line_mr_subpixel_mask - }; - - //------------------------------------------------------------------line_mr - AGG_INLINE int line_mr(int x) - { - return x >> (line_subpixel_shift - line_mr_subpixel_shift); - } - - //-------------------------------------------------------------------line_hr - AGG_INLINE int line_hr(int x) - { - return x << (line_subpixel_shift - line_mr_subpixel_shift); - } - - //---------------------------------------------------------------line_dbl_hr - AGG_INLINE int line_dbl_hr(int x) - { - return x * line_subpixel_scale; - } - - //---------------------------------------------------------------line_coord - struct line_coord - { - AGG_INLINE static int conv(double x) - { - return iround(x * line_subpixel_scale); - } - }; - - //-----------------------------------------------------------line_coord_sat - struct line_coord_sat - { - AGG_INLINE static int conv(double x) - { - return saturation::iround(x * line_subpixel_scale); - } - }; - - //==========================================================line_parameters - struct line_parameters - { - //--------------------------------------------------------------------- - line_parameters() {} - line_parameters(int x1_, int y1_, int x2_, int y2_, int len_) : - x1(x1_), y1(y1_), x2(x2_), y2(y2_), - dx(std::abs(x2_ - x1_)), - dy(std::abs(y2_ - y1_)), - sx((x2_ > x1_) ? 1 : -1), - sy((y2_ > y1_) ? 1 : -1), - vertical(dy >= dx), - inc(vertical ? sy : sx), - len(len_), - octant((sy & 4) | (sx & 2) | int(vertical)) - { - } - - //--------------------------------------------------------------------- - unsigned orthogonal_quadrant() const { return s_orthogonal_quadrant[octant]; } - unsigned diagonal_quadrant() const { return s_diagonal_quadrant[octant]; } - - //--------------------------------------------------------------------- - bool same_orthogonal_quadrant(const line_parameters& lp) const - { - return s_orthogonal_quadrant[octant] == s_orthogonal_quadrant[lp.octant]; - } - - //--------------------------------------------------------------------- - bool same_diagonal_quadrant(const line_parameters& lp) const - { - return s_diagonal_quadrant[octant] == s_diagonal_quadrant[lp.octant]; - } - - //--------------------------------------------------------------------- - void divide(line_parameters& lp1, line_parameters& lp2) const - { - int xmid = (x1 + x2) >> 1; - int ymid = (y1 + y2) >> 1; - int len2 = len >> 1; - - lp1 = *this; - lp2 = *this; - - lp1.x2 = xmid; - lp1.y2 = ymid; - lp1.len = len2; - lp1.dx = std::abs(lp1.x2 - lp1.x1); - lp1.dy = std::abs(lp1.y2 - lp1.y1); - - lp2.x1 = xmid; - lp2.y1 = ymid; - lp2.len = len2; - lp2.dx = std::abs(lp2.x2 - lp2.x1); - lp2.dy = std::abs(lp2.y2 - lp2.y1); - } - - //--------------------------------------------------------------------- - int x1, y1, x2, y2, dx, dy, sx, sy; - bool vertical; - int inc; - int len; - int octant; - - //--------------------------------------------------------------------- - static const int8u s_orthogonal_quadrant[8]; - static const int8u s_diagonal_quadrant[8]; - }; - - - - // See Implementation agg_line_aa_basics.cpp - - //----------------------------------------------------------------bisectrix - void bisectrix(const line_parameters& l1, - const line_parameters& l2, - int* x, int* y); - - - //-------------------------------------------fix_degenerate_bisectrix_start - void inline fix_degenerate_bisectrix_start(const line_parameters& lp, - int* x, int* y) - { - int d = iround((double(*x - lp.x2) * double(lp.y2 - lp.y1) - - double(*y - lp.y2) * double(lp.x2 - lp.x1)) / lp.len); - if(d < line_subpixel_scale/2) - { - *x = lp.x1 + (lp.y2 - lp.y1); - *y = lp.y1 - (lp.x2 - lp.x1); - } - } - - - //---------------------------------------------fix_degenerate_bisectrix_end - void inline fix_degenerate_bisectrix_end(const line_parameters& lp, - int* x, int* y) - { - int d = iround((double(*x - lp.x2) * double(lp.y2 - lp.y1) - - double(*y - lp.y2) * double(lp.x2 - lp.x1)) / lp.len); - if(d < line_subpixel_scale/2) - { - *x = lp.x2 + (lp.y2 - lp.y1); - *y = lp.y2 - (lp.x2 - lp.x1); - } - } - - + return x >> (line_subpixel_shift - line_mr_subpixel_shift); } +//-------------------------------------------------------------------line_hr +AGG_INLINE int line_hr(int x) +{ + return x << (line_subpixel_shift - line_mr_subpixel_shift); +} + +//---------------------------------------------------------------line_dbl_hr +AGG_INLINE int line_dbl_hr(int x) +{ + return x * line_subpixel_scale; +} + +//---------------------------------------------------------------line_coord +struct line_coord +{ + AGG_INLINE static int conv(double x) { return iround(x * line_subpixel_scale); } +}; + +//-----------------------------------------------------------line_coord_sat +struct line_coord_sat +{ + AGG_INLINE static int conv(double x) { return saturation::iround(x * line_subpixel_scale); } +}; + +//==========================================================line_parameters +struct line_parameters +{ + //--------------------------------------------------------------------- + line_parameters() {} + line_parameters(int x1_, int y1_, int x2_, int y2_, int len_) + : x1(x1_) + , y1(y1_) + , x2(x2_) + , y2(y2_) + , dx(std::abs(x2_ - x1_)) + , dy(std::abs(y2_ - y1_)) + , sx((x2_ > x1_) ? 1 : -1) + , sy((y2_ > y1_) ? 1 : -1) + , vertical(dy >= dx) + , inc(vertical ? sy : sx) + , len(len_) + , octant((sy & 4) | (sx & 2) | int(vertical)) + {} + + //--------------------------------------------------------------------- + unsigned orthogonal_quadrant() const { return s_orthogonal_quadrant[octant]; } + unsigned diagonal_quadrant() const { return s_diagonal_quadrant[octant]; } + + //--------------------------------------------------------------------- + bool same_orthogonal_quadrant(const line_parameters& lp) const + { + return s_orthogonal_quadrant[octant] == s_orthogonal_quadrant[lp.octant]; + } + + //--------------------------------------------------------------------- + bool same_diagonal_quadrant(const line_parameters& lp) const + { + return s_diagonal_quadrant[octant] == s_diagonal_quadrant[lp.octant]; + } + + //--------------------------------------------------------------------- + void divide(line_parameters& lp1, line_parameters& lp2) const + { + int xmid = (x1 + x2) >> 1; + int ymid = (y1 + y2) >> 1; + int len2 = len >> 1; + + lp1 = *this; + lp2 = *this; + + lp1.x2 = xmid; + lp1.y2 = ymid; + lp1.len = len2; + lp1.dx = std::abs(lp1.x2 - lp1.x1); + lp1.dy = std::abs(lp1.y2 - lp1.y1); + + lp2.x1 = xmid; + lp2.y1 = ymid; + lp2.len = len2; + lp2.dx = std::abs(lp2.x2 - lp2.x1); + lp2.dy = std::abs(lp2.y2 - lp2.y1); + } + + //--------------------------------------------------------------------- + int x1, y1, x2, y2, dx, dy, sx, sy; + bool vertical; + int inc; + int len; + int octant; + + //--------------------------------------------------------------------- + static const int8u s_orthogonal_quadrant[8]; + static const int8u s_diagonal_quadrant[8]; +}; + +// See Implementation agg_line_aa_basics.cpp + +//----------------------------------------------------------------bisectrix +void bisectrix(const line_parameters& l1, const line_parameters& l2, int* x, int* y); + +//-------------------------------------------fix_degenerate_bisectrix_start +void inline fix_degenerate_bisectrix_start(const line_parameters& lp, int* x, int* y) +{ + int d = iround((double(*x - lp.x2) * double(lp.y2 - lp.y1) - double(*y - lp.y2) * double(lp.x2 - lp.x1)) / lp.len); + if (d < line_subpixel_scale / 2) + { + *x = lp.x1 + (lp.y2 - lp.y1); + *y = lp.y1 - (lp.x2 - lp.x1); + } +} + +//---------------------------------------------fix_degenerate_bisectrix_end +void inline fix_degenerate_bisectrix_end(const line_parameters& lp, int* x, int* y) +{ + int d = iround((double(*x - lp.x2) * double(lp.y2 - lp.y1) - double(*y - lp.y2) * double(lp.x2 - lp.x1)) / lp.len); + if (d < line_subpixel_scale / 2) + { + *x = lp.x2 + (lp.y2 - lp.y1); + *y = lp.y2 - (lp.x2 - lp.x1); + } +} + +} // namespace agg + #endif diff --git a/deps/agg/include/agg_math.h b/deps/agg/include/agg_math.h index cc34d2375..ae3942b44 100644 --- a/deps/agg/include/agg_math.h +++ b/deps/agg/include/agg_math.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -12,7 +12,7 @@ // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- -// Bessel function (besj) was adapted for use in AGG library by Andy Wilk +// Bessel function (besj) was adapted for use in AGG library by Andy Wilk // Contact: castor.vulgaris@gmail.com //---------------------------------------------------------------------------- @@ -22,251 +22,236 @@ #include #include "agg_basics.h" -namespace agg +namespace agg { + +//------------------------------------------------------vertex_dist_epsilon +// Coinciding points maximal distance (Epsilon) +const double vertex_dist_epsilon = 1e-5; + +//-----------------------------------------------------intersection_epsilon +// See calc_intersection +const double intersection_epsilon = 1.0e-30; + +//------------------------------------------------------------cross_product +AGG_INLINE double cross_product(double x1, double y1, double x2, double y2, double x, double y) { + return (x - x2) * (y2 - y1) - (y - y2) * (x2 - x1); +} - //------------------------------------------------------vertex_dist_epsilon - // Coinciding points maximal distance (Epsilon) - const double vertex_dist_epsilon = 1e-5; +//--------------------------------------------------------point_in_triangle +AGG_INLINE bool point_in_triangle(double x1, double y1, double x2, double y2, double x3, double y3, double x, double y) +{ + bool cp1 = cross_product(x1, y1, x2, y2, x, y) < 0.0; + bool cp2 = cross_product(x2, y2, x3, y3, x, y) < 0.0; + bool cp3 = cross_product(x3, y3, x1, y1, x, y) < 0.0; + return cp1 == cp2 && cp2 == cp3 && cp3 == cp1; +} - //-----------------------------------------------------intersection_epsilon - // See calc_intersection - const double intersection_epsilon = 1.0e-30; +//-----------------------------------------------------------calc_distance +AGG_INLINE double calc_distance(double x1, double y1, double x2, double y2) +{ + double dx = x2 - x1; + double dy = y2 - y1; + return sqrt(dx * dx + dy * dy); +} - //------------------------------------------------------------cross_product - AGG_INLINE double cross_product(double x1, double y1, - double x2, double y2, - double x, double y) +//--------------------------------------------------------calc_sq_distance +AGG_INLINE double calc_sq_distance(double x1, double y1, double x2, double y2) +{ + double dx = x2 - x1; + double dy = y2 - y1; + return dx * dx + dy * dy; +} + +//------------------------------------------------calc_line_point_distance +AGG_INLINE double calc_line_point_distance(double x1, double y1, double x2, double y2, double x, double y) +{ + double dx = x2 - x1; + double dy = y2 - y1; + double d = sqrt(dx * dx + dy * dy); + if (d < vertex_dist_epsilon) { - return (x - x2) * (y2 - y1) - (y - y2) * (x2 - x1); + return calc_distance(x1, y1, x, y); + } + return ((x - x2) * dy - (y - y2) * dx) / d; +} + +//-------------------------------------------------------calc_line_point_u +AGG_INLINE double calc_segment_point_u(double x1, double y1, double x2, double y2, double x, double y) +{ + double dx = x2 - x1; + double dy = y2 - y1; + + if (dx == 0 && dy == 0) + { + return 0; } - //--------------------------------------------------------point_in_triangle - AGG_INLINE bool point_in_triangle(double x1, double y1, - double x2, double y2, - double x3, double y3, - double x, double y) - { - bool cp1 = cross_product(x1, y1, x2, y2, x, y) < 0.0; - bool cp2 = cross_product(x2, y2, x3, y3, x, y) < 0.0; - bool cp3 = cross_product(x3, y3, x1, y1, x, y) < 0.0; - return cp1 == cp2 && cp2 == cp3 && cp3 == cp1; - } + double pdx = x - x1; + double pdy = y - y1; - //-----------------------------------------------------------calc_distance - AGG_INLINE double calc_distance(double x1, double y1, double x2, double y2) - { - double dx = x2-x1; - double dy = y2-y1; - return sqrt(dx * dx + dy * dy); - } + return (pdx * dx + pdy * dy) / (dx * dx + dy * dy); +} - //--------------------------------------------------------calc_sq_distance - AGG_INLINE double calc_sq_distance(double x1, double y1, double x2, double y2) +//---------------------------------------------calc_line_point_sq_distance +AGG_INLINE double + calc_segment_point_sq_distance(double x1, double y1, double x2, double y2, double x, double y, double u) +{ + if (u <= 0) { - double dx = x2-x1; - double dy = y2-y1; - return dx * dx + dy * dy; + return calc_sq_distance(x, y, x1, y1); } - - //------------------------------------------------calc_line_point_distance - AGG_INLINE double calc_line_point_distance(double x1, double y1, - double x2, double y2, - double x, double y) + else if (u >= 1) { - double dx = x2-x1; - double dy = y2-y1; - double d = sqrt(dx * dx + dy * dy); - if(d < vertex_dist_epsilon) + return calc_sq_distance(x, y, x2, y2); + } + return calc_sq_distance(x, y, x1 + u * (x2 - x1), y1 + u * (y2 - y1)); +} + +//---------------------------------------------calc_line_point_sq_distance +AGG_INLINE double calc_segment_point_sq_distance(double x1, double y1, double x2, double y2, double x, double y) +{ + return calc_segment_point_sq_distance(x1, y1, x2, y2, x, y, calc_segment_point_u(x1, y1, x2, y2, x, y)); +} + +//-------------------------------------------------------calc_intersection +AGG_INLINE bool calc_intersection(double ax, + double ay, + double bx, + double by, + double cx, + double cy, + double dx, + double dy, + double* x, + double* y) +{ + double num = (ay - cy) * (dx - cx) - (ax - cx) * (dy - cy); + double den = (bx - ax) * (dy - cy) - (by - ay) * (dx - cx); + if (std::fabs(den) < intersection_epsilon) + return false; + double r = num / den; + *x = ax + r * (bx - ax); + *y = ay + r * (by - ay); + return true; +} + +//-----------------------------------------------------intersection_exists +AGG_INLINE bool + intersection_exists(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) +{ + // It's less expensive but you can't control the + // boundary conditions: Less or LessEqual + double dx1 = x2 - x1; + double dy1 = y2 - y1; + double dx2 = x4 - x3; + double dy2 = y4 - y3; + return ((x3 - x2) * dy1 - (y3 - y2) * dx1 < 0.0) != ((x4 - x2) * dy1 - (y4 - y2) * dx1 < 0.0) && + ((x1 - x4) * dy2 - (y1 - y4) * dx2 < 0.0) != ((x2 - x4) * dy2 - (y2 - y4) * dx2 < 0.0); + + // It's is more expensive but more flexible + // in terms of boundary conditions. + //-------------------- + // double den = (x2-x1) * (y4-y3) - (y2-y1) * (x4-x3); + // if(std::fabs(den) < intersection_epsilon) return false; + // double nom1 = (x4-x3) * (y1-y3) - (y4-y3) * (x1-x3); + // double nom2 = (x2-x1) * (y1-y3) - (y2-y1) * (x1-x3); + // double ua = nom1 / den; + // double ub = nom2 / den; + // return ua >= 0.0 && ua <= 1.0 && ub >= 0.0 && ub <= 1.0; +} + +//--------------------------------------------------------calc_orthogonal +AGG_INLINE void calc_orthogonal(double thickness, double x1, double y1, double x2, double y2, double* x, double* y) +{ + double dx = x2 - x1; + double dy = y2 - y1; + double d = sqrt(dx * dx + dy * dy); + *x = thickness * dy / d; + *y = -thickness * dx / d; +} + +//--------------------------------------------------------dilate_triangle +AGG_INLINE void + dilate_triangle(double x1, double y1, double x2, double y2, double x3, double y3, double* x, double* y, double d) +{ + double dx1 = 0.0; + double dy1 = 0.0; + double dx2 = 0.0; + double dy2 = 0.0; + double dx3 = 0.0; + double dy3 = 0.0; + double loc = cross_product(x1, y1, x2, y2, x3, y3); + if (std::fabs(loc) > intersection_epsilon) + { + if (cross_product(x1, y1, x2, y2, x3, y3) > 0.0) { - return calc_distance(x1, y1, x, y); + d = -d; } - return ((x - x2) * dy - (y - y2) * dx) / d; + calc_orthogonal(d, x1, y1, x2, y2, &dx1, &dy1); + calc_orthogonal(d, x2, y2, x3, y3, &dx2, &dy2); + calc_orthogonal(d, x3, y3, x1, y1, &dx3, &dy3); } + *x++ = x1 + dx1; + *y++ = y1 + dy1; + *x++ = x2 + dx1; + *y++ = y2 + dy1; + *x++ = x2 + dx2; + *y++ = y2 + dy2; + *x++ = x3 + dx2; + *y++ = y3 + dy2; + *x++ = x3 + dx3; + *y++ = y3 + dy3; + *x++ = x1 + dx3; + *y++ = y1 + dy3; +} - //-------------------------------------------------------calc_line_point_u - AGG_INLINE double calc_segment_point_u(double x1, double y1, - double x2, double y2, - double x, double y) +//------------------------------------------------------calc_triangle_area +AGG_INLINE double calc_triangle_area(double x1, double y1, double x2, double y2, double x3, double y3) +{ + return (x1 * y2 - x2 * y1 + x2 * y3 - x3 * y2 + x3 * y1 - x1 * y3) * 0.5; +} + +//-------------------------------------------------------calc_polygon_area +template +double calc_polygon_area(const Storage& st) +{ + unsigned i; + double sum = 0.0; + double x = st[0].x; + double y = st[0].y; + double xs = x; + double ys = y; + + for (i = 1; i < st.size(); i++) { - double dx = x2 - x1; - double dy = y2 - y1; - - if(dx == 0 && dy == 0) - { - return 0; - } - - double pdx = x - x1; - double pdy = y - y1; - - return (pdx * dx + pdy * dy) / (dx * dx + dy * dy); + const typename Storage::value_type& v = st[i]; + sum += x * v.y - y * v.x; + x = v.x; + y = v.y; } + return (sum + x * ys - y * xs) * 0.5; +} - //---------------------------------------------calc_line_point_sq_distance - AGG_INLINE double calc_segment_point_sq_distance(double x1, double y1, - double x2, double y2, - double x, double y, - double u) - { - if(u <= 0) - { - return calc_sq_distance(x, y, x1, y1); - } - else - if(u >= 1) - { - return calc_sq_distance(x, y, x2, y2); - } - return calc_sq_distance(x, y, x1 + u * (x2 - x1), y1 + u * (y2 - y1)); - } +//------------------------------------------------------------------------ +// Tables for fast sqrt +extern int16u g_sqrt_table[1024]; +extern int8 g_elder_bit_table[256]; - //---------------------------------------------calc_line_point_sq_distance - AGG_INLINE double calc_segment_point_sq_distance(double x1, double y1, - double x2, double y2, - double x, double y) - { - return - calc_segment_point_sq_distance( - x1, y1, x2, y2, x, y, - calc_segment_point_u(x1, y1, x2, y2, x, y)); - } - - //-------------------------------------------------------calc_intersection - AGG_INLINE bool calc_intersection(double ax, double ay, double bx, double by, - double cx, double cy, double dx, double dy, - double* x, double* y) - { - double num = (ay-cy) * (dx-cx) - (ax-cx) * (dy-cy); - double den = (bx-ax) * (dy-cy) - (by-ay) * (dx-cx); - if(std::fabs(den) < intersection_epsilon) return false; - double r = num / den; - *x = ax + r * (bx-ax); - *y = ay + r * (by-ay); - return true; - } - - //-----------------------------------------------------intersection_exists - AGG_INLINE bool intersection_exists(double x1, double y1, double x2, double y2, - double x3, double y3, double x4, double y4) - { - // It's less expensive but you can't control the - // boundary conditions: Less or LessEqual - double dx1 = x2 - x1; - double dy1 = y2 - y1; - double dx2 = x4 - x3; - double dy2 = y4 - y3; - return ((x3 - x2) * dy1 - (y3 - y2) * dx1 < 0.0) != - ((x4 - x2) * dy1 - (y4 - y2) * dx1 < 0.0) && - ((x1 - x4) * dy2 - (y1 - y4) * dx2 < 0.0) != - ((x2 - x4) * dy2 - (y2 - y4) * dx2 < 0.0); - - // It's is more expensive but more flexible - // in terms of boundary conditions. - //-------------------- - //double den = (x2-x1) * (y4-y3) - (y2-y1) * (x4-x3); - //if(std::fabs(den) < intersection_epsilon) return false; - //double nom1 = (x4-x3) * (y1-y3) - (y4-y3) * (x1-x3); - //double nom2 = (x2-x1) * (y1-y3) - (y2-y1) * (x1-x3); - //double ua = nom1 / den; - //double ub = nom2 / den; - //return ua >= 0.0 && ua <= 1.0 && ub >= 0.0 && ub <= 1.0; - } - - //--------------------------------------------------------calc_orthogonal - AGG_INLINE void calc_orthogonal(double thickness, - double x1, double y1, - double x2, double y2, - double* x, double* y) - { - double dx = x2 - x1; - double dy = y2 - y1; - double d = sqrt(dx*dx + dy*dy); - *x = thickness * dy / d; - *y = -thickness * dx / d; - } - - //--------------------------------------------------------dilate_triangle - AGG_INLINE void dilate_triangle(double x1, double y1, - double x2, double y2, - double x3, double y3, - double *x, double* y, - double d) - { - double dx1=0.0; - double dy1=0.0; - double dx2=0.0; - double dy2=0.0; - double dx3=0.0; - double dy3=0.0; - double loc = cross_product(x1, y1, x2, y2, x3, y3); - if(std::fabs(loc) > intersection_epsilon) - { - if(cross_product(x1, y1, x2, y2, x3, y3) > 0.0) - { - d = -d; - } - calc_orthogonal(d, x1, y1, x2, y2, &dx1, &dy1); - calc_orthogonal(d, x2, y2, x3, y3, &dx2, &dy2); - calc_orthogonal(d, x3, y3, x1, y1, &dx3, &dy3); - } - *x++ = x1 + dx1; *y++ = y1 + dy1; - *x++ = x2 + dx1; *y++ = y2 + dy1; - *x++ = x2 + dx2; *y++ = y2 + dy2; - *x++ = x3 + dx2; *y++ = y3 + dy2; - *x++ = x3 + dx3; *y++ = y3 + dy3; - *x++ = x1 + dx3; *y++ = y1 + dy3; - } - - //------------------------------------------------------calc_triangle_area - AGG_INLINE double calc_triangle_area(double x1, double y1, - double x2, double y2, - double x3, double y3) - { - return (x1*y2 - x2*y1 + x2*y3 - x3*y2 + x3*y1 - x1*y3) * 0.5; - } - - //-------------------------------------------------------calc_polygon_area - template double calc_polygon_area(const Storage& st) - { - unsigned i; - double sum = 0.0; - double x = st[0].x; - double y = st[0].y; - double xs = x; - double ys = y; - - for(i = 1; i < st.size(); i++) - { - const typename Storage::value_type& v = st[i]; - sum += x * v.y - y * v.x; - x = v.x; - y = v.y; - } - return (sum + x * ys - y * xs) * 0.5; - } - - //------------------------------------------------------------------------ - // Tables for fast sqrt - extern int16u g_sqrt_table[1024]; - extern int8 g_elder_bit_table[256]; - - - //---------------------------------------------------------------fast_sqrt - //Fast integer Sqrt - really fast: no cycles, divisions or multiplications - #if defined(_MSC_VER) - #pragma warning(push) - #pragma warning(disable : 4035) //Disable warning "no return value" - #endif - AGG_INLINE unsigned fast_sqrt(unsigned val) - { - #if defined(_M_IX86) && defined(_MSC_VER) && !defined(AGG_NO_ASM) - //For Ix86 family processors this assembler code is used. - //The key command here is bsr - determination the number of the most - //significant bit of the value. For other processors - //(and maybe compilers) the pure C "#else" section is used. - __asm - { +//---------------------------------------------------------------fast_sqrt +// Fast integer Sqrt - really fast: no cycles, divisions or multiplications +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable: 4035) // Disable warning "no return value" +#endif +AGG_INLINE unsigned fast_sqrt(unsigned val) +{ +#if defined(_M_IX86) && defined(_MSC_VER) && !defined(AGG_NO_ASM) + // For Ix86 family processors this assembler code is used. + // The key command here is bsr - determination the number of the most + // significant bit of the value. For other processors + //(and maybe compilers) the pure C "#else" section is used. + __asm { mov ebx, val mov edx, 11 bsr ecx, ebx @@ -282,156 +267,153 @@ namespace agg mov ax, g_sqrt_table[ebx*2] mov ecx, edx shr eax, cl - } - #else + } +#else - //This code is actually pure C and portable to most - //arcitectures including 64bit ones. - unsigned t = val; - int bit=0; - unsigned shift = 11; + // This code is actually pure C and portable to most + // arcitectures including 64bit ones. + unsigned t = val; + int bit = 0; + unsigned shift = 11; - //The following piece of code is just an emulation of the - //Ix86 assembler command "bsr" (see above). However on old - //Intels (like Intel MMX 233MHz) this code is about twice - //faster (sic!) then just one "bsr". On PIII and PIV the - //bsr is optimized quite well. - bit = t >> 24; - if(bit) + // The following piece of code is just an emulation of the + // Ix86 assembler command "bsr" (see above). However on old + // Intels (like Intel MMX 233MHz) this code is about twice + // faster (sic!) then just one "bsr". On PIII and PIV the + // bsr is optimized quite well. + bit = t >> 24; + if (bit) + { + bit = g_elder_bit_table[bit] + 24; + } + else + { + bit = (t >> 16) & 0xFF; + if (bit) { - bit = g_elder_bit_table[bit] + 24; + bit = g_elder_bit_table[bit] + 16; } else { - bit = (t >> 16) & 0xFF; - if(bit) + bit = (t >> 8) & 0xFF; + if (bit) { - bit = g_elder_bit_table[bit] + 16; + bit = g_elder_bit_table[bit] + 8; } else { - bit = (t >> 8) & 0xFF; - if(bit) - { - bit = g_elder_bit_table[bit] + 8; - } - else - { - bit = g_elder_bit_table[t]; - } + bit = g_elder_bit_table[t]; } } - - //This code calculates the sqrt. - bit -= 9; - if(bit > 0) - { - bit = (bit >> 1) + (bit & 1); - shift -= bit; - val >>= (bit << 1); - } - return g_sqrt_table[val] >> shift; - #endif } - #if defined(_MSC_VER) - #pragma warning(pop) - #endif - - - - //--------------------------------------------------------------------besj - // Function BESJ calculates Bessel function of first kind of order n - // Arguments: - // n - an integer (>=0), the order - // x - value at which the Bessel function is required - //-------------------- - // C++ Mathematical Library - // Convereted from equivalent FORTRAN library - // Converetd by Gareth Walker for use by course 392 computational project - // All functions tested and yield the same results as the corresponding - // FORTRAN versions. - // - // If you have any problems using these functions please report them to - // M.Muldoon@UMIST.ac.uk - // - // Documentation available on the web - // http://www.ma.umist.ac.uk/mrm/Teaching/392/libs/392.html - // Version 1.0 8/98 - // 29 October, 1999 - //-------------------- - // Adapted for use in AGG library by Andy Wilk (castor.vulgaris@gmail.com) - //------------------------------------------------------------------------ - inline double besj(double x, int n) + // This code calculates the sqrt. + bit -= 9; + if (bit > 0) { - if(n < 0) - { + bit = (bit >> 1) + (bit & 1); + shift -= bit; + val >>= (bit << 1); + } + return g_sqrt_table[val] >> shift; +#endif +} +#if defined(_MSC_VER) +#pragma warning(pop) +#endif + +//--------------------------------------------------------------------besj +// Function BESJ calculates Bessel function of first kind of order n +// Arguments: +// n - an integer (>=0), the order +// x - value at which the Bessel function is required +//-------------------- +// C++ Mathematical Library +// Convereted from equivalent FORTRAN library +// Converetd by Gareth Walker for use by course 392 computational project +// All functions tested and yield the same results as the corresponding +// FORTRAN versions. +// +// If you have any problems using these functions please report them to +// M.Muldoon@UMIST.ac.uk +// +// Documentation available on the web +// http://www.ma.umist.ac.uk/mrm/Teaching/392/libs/392.html +// Version 1.0 8/98 +// 29 October, 1999 +//-------------------- +// Adapted for use in AGG library by Andy Wilk (castor.vulgaris@gmail.com) +//------------------------------------------------------------------------ +inline double besj(double x, int n) +{ + if (n < 0) + { + return 0; + } + double d = 1E-6; + double b = 0; + if (std::fabs(x) <= d) + { + if (n != 0) return 0; - } - double d = 1E-6; - double b = 0; - if(std::fabs(x) <= d) + return 1; + } + double b1 = 0; // b1 is the value from the previous iteration + // Set up a starting order for recurrence + int m1 = (int)fabs(x) + 6; + if (std::fabs(x) > 5) + { + m1 = (int)(std::fabs(1.4 * x + 60 / x)); + } + int m2 = (int)(n + 2 + std::fabs(x) / 4); + if (m1 > m2) + { + m2 = m1; + } + + // Apply recurrence down from curent max order + for (;;) + { + double c3 = 0; + double c2 = 1E-30; + double c4 = 0; + int m8 = 1; + if (m2 / 2 * 2 == m2) { - if(n != 0) return 0; - return 1; + m8 = -1; } - double b1 = 0; // b1 is the value from the previous iteration - // Set up a starting order for recurrence - int m1 = (int)fabs(x) + 6; - if(std::fabs(x) > 5) + int imax = m2 - 2; + for (int i = 1; i <= imax; i++) { - m1 = (int)(std::fabs(1.4 * x + 60 / x)); - } - int m2 = (int)(n + 2 + std::fabs(x) / 4); - if (m1 > m2) - { - m2 = m1; - } - - // Apply recurrence down from curent max order - for(;;) - { - double c3 = 0; - double c2 = 1E-30; - double c4 = 0; - int m8 = 1; - if (m2 / 2 * 2 == m2) - { - m8 = -1; - } - int imax = m2 - 2; - for (int i = 1; i <= imax; i++) - { - double c6 = 2 * (m2 - i) * c2 / x - c3; - c3 = c2; - c2 = c6; - if(m2 - i - 1 == n) - { - b = c6; - } - m8 = -1 * m8; - if (m8 > 0) - { - c4 = c4 + 2 * c6; - } - } - double c6 = 2 * c2 / x - c3; - if(n == 0) + double c6 = 2 * (m2 - i) * c2 / x - c3; + c3 = c2; + c2 = c6; + if (m2 - i - 1 == n) { b = c6; } - c4 += c6; - b /= c4; - if(std::fabs(b - b1) < d) + m8 = -1 * m8; + if (m8 > 0) { - return b; + c4 = c4 + 2 * c6; } - b1 = b; - m2 += 3; } + double c6 = 2 * c2 / x - c3; + if (n == 0) + { + b = c6; + } + c4 += c6; + b /= c4; + if (std::fabs(b - b1) < d) + { + return b; + } + b1 = b; + m2 += 3; } - } +} // namespace agg #endif diff --git a/deps/agg/include/agg_math_stroke.h b/deps/agg/include/agg_math_stroke.h index 9014f5383..93ba1244e 100644 --- a/deps/agg/include/agg_math_stroke.h +++ b/deps/agg/include/agg_math_stroke.h @@ -23,254 +23,236 @@ #include "agg_math.h" #include "agg_vertex_sequence.h" -namespace agg +namespace agg { +//-------------------------------------------------------------line_cap_e +enum line_cap_e { butt_cap, square_cap, round_cap }; + +//------------------------------------------------------------line_join_e +enum line_join_e { miter_join = 0, miter_join_revert = 1, round_join = 2, bevel_join = 3, miter_join_round = 4 }; + +//-----------------------------------------------------------inner_join_e +enum inner_join_e { inner_bevel, inner_miter, inner_jag, inner_round }; + +//------------------------------------------------------------math_stroke +template +class math_stroke { - //-------------------------------------------------------------line_cap_e - enum line_cap_e - { - butt_cap, - square_cap, - round_cap - }; - - //------------------------------------------------------------line_join_e - enum line_join_e - { - miter_join = 0, - miter_join_revert = 1, - round_join = 2, - bevel_join = 3, - miter_join_round = 4 - }; - - - //-----------------------------------------------------------inner_join_e - enum inner_join_e - { - inner_bevel, - inner_miter, - inner_jag, - inner_round - }; - - //------------------------------------------------------------math_stroke - template class math_stroke - { - public: - typedef typename VertexConsumer::value_type coord_type; - - math_stroke(); - - void line_cap(line_cap_e lc) { m_line_cap = lc; } - void line_join(line_join_e lj) { m_line_join = lj; } - void inner_join(inner_join_e ij) { m_inner_join = ij; } - - line_cap_e line_cap() const { return m_line_cap; } - line_join_e line_join() const { return m_line_join; } - inner_join_e inner_join() const { return m_inner_join; } - - void width(double w); - void miter_limit(double ml) { m_miter_limit = ml; } - void miter_limit_theta(double t); - void inner_miter_limit(double ml) { m_inner_miter_limit = ml; } - void approximation_scale(double as) { m_approx_scale = as; } - - double width() const { return m_width * 2.0; } - double miter_limit() const { return m_miter_limit; } - double inner_miter_limit() const { return m_inner_miter_limit; } - double approximation_scale() const { return m_approx_scale; } - - void calc_cap(VertexConsumer& vc, - const vertex_dist& v0, - const vertex_dist& v1, - double len); - - void calc_join(VertexConsumer& vc, - const vertex_dist& v0, - const vertex_dist& v1, - const vertex_dist& v2, - double len1, - double len2); - - private: - AGG_INLINE void add_vertex(VertexConsumer& vc, double x, double y) - { - vc.add(coord_type(x, y)); - } - - void calc_arc(VertexConsumer& vc, - double x, double y, - double dx1, double dy1, - double dx2, double dy2); - - void calc_miter(VertexConsumer& vc, - const vertex_dist& v0, - const vertex_dist& v1, - const vertex_dist& v2, - double dx1, double dy1, - double dx2, double dy2, - line_join_e lj, - double mlimit, - double dbevel); - - double m_width; - double m_width_abs; - double m_width_eps; - int m_width_sign; - double m_miter_limit; - double m_inner_miter_limit; - double m_approx_scale; - line_cap_e m_line_cap; - line_join_e m_line_join; - inner_join_e m_inner_join; - }; - - //----------------------------------------------------------------------- - template math_stroke::math_stroke() : - m_width(0.5), - m_width_abs(0.5), - m_width_eps(0.5/1024.0), - m_width_sign(1), - m_miter_limit(4.0), - m_inner_miter_limit(1.01), - m_approx_scale(1.0), - m_line_cap(butt_cap), - m_line_join(miter_join), - m_inner_join(inner_miter) + public: + typedef typename VertexConsumer::value_type coord_type; + + math_stroke(); + + void line_cap(line_cap_e lc) { m_line_cap = lc; } + void line_join(line_join_e lj) { m_line_join = lj; } + void inner_join(inner_join_e ij) { m_inner_join = ij; } + + line_cap_e line_cap() const { return m_line_cap; } + line_join_e line_join() const { return m_line_join; } + inner_join_e inner_join() const { return m_inner_join; } + + void width(double w); + void miter_limit(double ml) { m_miter_limit = ml; } + void miter_limit_theta(double t); + void inner_miter_limit(double ml) { m_inner_miter_limit = ml; } + void approximation_scale(double as) { m_approx_scale = as; } + + double width() const { return m_width * 2.0; } + double miter_limit() const { return m_miter_limit; } + double inner_miter_limit() const { return m_inner_miter_limit; } + double approximation_scale() const { return m_approx_scale; } + + void calc_cap(VertexConsumer& vc, const vertex_dist& v0, const vertex_dist& v1, double len); + + void calc_join(VertexConsumer& vc, + const vertex_dist& v0, + const vertex_dist& v1, + const vertex_dist& v2, + double len1, + double len2); + + private: + AGG_INLINE void add_vertex(VertexConsumer& vc, double x, double y) { vc.add(coord_type(x, y)); } + + void calc_arc(VertexConsumer& vc, double x, double y, double dx1, double dy1, double dx2, double dy2); + + void calc_miter(VertexConsumer& vc, + const vertex_dist& v0, + const vertex_dist& v1, + const vertex_dist& v2, + double dx1, + double dy1, + double dx2, + double dy2, + line_join_e lj, + double mlimit, + double dbevel); + + double m_width; + double m_width_abs; + double m_width_eps; + int m_width_sign; + double m_miter_limit; + double m_inner_miter_limit; + double m_approx_scale; + line_cap_e m_line_cap; + line_join_e m_line_join; + inner_join_e m_inner_join; +}; + +//----------------------------------------------------------------------- +template +math_stroke::math_stroke() + : m_width(0.5) + , m_width_abs(0.5) + , m_width_eps(0.5 / 1024.0) + , m_width_sign(1) + , m_miter_limit(4.0) + , m_inner_miter_limit(1.01) + , m_approx_scale(1.0) + , m_line_cap(butt_cap) + , m_line_join(miter_join) + , m_inner_join(inner_miter) +{} + +//----------------------------------------------------------------------- +template +void math_stroke::width(double w) +{ + m_width = w * 0.5; + if (m_width < 0) { + m_width_abs = -m_width; + m_width_sign = -1; } - - //----------------------------------------------------------------------- - template void math_stroke::width(double w) + else { - m_width = w * 0.5; - if(m_width < 0) - { - m_width_abs = -m_width; - m_width_sign = -1; - } - else - { - m_width_abs = m_width; - m_width_sign = 1; - } - m_width_eps = m_width / 1024.0; + m_width_abs = m_width; + m_width_sign = 1; } + m_width_eps = m_width / 1024.0; +} - //----------------------------------------------------------------------- - template void math_stroke::miter_limit_theta(double t) +//----------------------------------------------------------------------- +template +void math_stroke::miter_limit_theta(double t) +{ + m_miter_limit = 1.0 / std::sin(t * 0.5); +} + +//----------------------------------------------------------------------- +template +void math_stroke::calc_arc(VC& vc, double x, double y, double dx1, double dy1, double dx2, double dy2) +{ + double a1 = std::atan2(dy1 * m_width_sign, dx1 * m_width_sign); + double a2 = std::atan2(dy2 * m_width_sign, dx2 * m_width_sign); + double da = a1 - a2; + int i, n; + + da = std::acos(m_width_abs / (m_width_abs + 0.125 / m_approx_scale)) * 2; + + add_vertex(vc, x + dx1, y + dy1); + if (m_width_sign > 0) { - m_miter_limit = 1.0 / std::sin(t * 0.5) ; - } - - //----------------------------------------------------------------------- - template - void math_stroke::calc_arc(VC& vc, - double x, double y, - double dx1, double dy1, - double dx2, double dy2) - { - double a1 = std::atan2(dy1 * m_width_sign, dx1 * m_width_sign); - double a2 = std::atan2(dy2 * m_width_sign, dx2 * m_width_sign); - double da = a1 - a2; - int i, n; - - da = std::acos(m_width_abs / (m_width_abs + 0.125 / m_approx_scale)) * 2; - - add_vertex(vc, x + dx1, y + dy1); - if(m_width_sign > 0) + if (a1 > a2) + a2 += 2 * pi; + n = int((a2 - a1) / da); + da = (a2 - a1) / (n + 1); + a1 += da; + for (i = 0; i < n; i++) { - if(a1 > a2) a2 += 2 * pi; - n = int((a2 - a1) / da); - da = (a2 - a1) / (n + 1); + add_vertex(vc, x + std::cos(a1) * m_width, y + std::sin(a1) * m_width); a1 += da; - for(i = 0; i < n; i++) - { - add_vertex(vc, x + std::cos(a1) * m_width, y + std::sin(a1) * m_width); - a1 += da; - } } - else + } + else + { + if (a1 < a2) + a2 -= 2 * pi; + n = int((a1 - a2) / da); + da = (a1 - a2) / (n + 1); + a1 -= da; + for (i = 0; i < n; i++) { - if(a1 < a2) a2 -= 2 * pi; - n = int((a1 - a2) / da); - da = (a1 - a2) / (n + 1); + add_vertex(vc, x + std::cos(a1) * m_width, y + std::sin(a1) * m_width); a1 -= da; - for(i = 0; i < n; i++) - { - add_vertex(vc, x + std::cos(a1) * m_width, y + std::sin(a1) * m_width); - a1 -= da; - } } - add_vertex(vc, x + dx2, y + dy2); + } + add_vertex(vc, x + dx2, y + dy2); +} + +//----------------------------------------------------------------------- +template +void math_stroke::calc_miter(VC& vc, + const vertex_dist& v0, + const vertex_dist& v1, + const vertex_dist& v2, + double dx1, + double dy1, + double dx2, + double dy2, + line_join_e lj, + double mlimit, + double dbevel) +{ + double xi = v1.x; + double yi = v1.y; + double di = 1; + double lim = m_width_abs * mlimit; + bool miter_limit_exceeded = true; // Assume the worst + bool intersection_failed = true; // Assume the worst + + if (calc_intersection(v0.x + dx1, + v0.y - dy1, + v1.x + dx1, + v1.y - dy1, + v1.x + dx2, + v1.y - dy2, + v2.x + dx2, + v2.y - dy2, + &xi, + &yi)) + { + // Calculation of the intersection succeeded + //--------------------- + di = calc_distance(v1.x, v1.y, xi, yi); + if (di <= lim) + { + // Inside the miter limit + //--------------------- + add_vertex(vc, xi, yi); + miter_limit_exceeded = false; + } + intersection_failed = false; + } + else + { + // Calculation of the intersection failed, most probably + // the three points lie one straight line. + // First check if v0 and v2 lie on the opposite sides of vector: + // (v1.x, v1.y) -> (v1.x+dx1, v1.y-dy1), that is, the perpendicular + // to the line determined by vertices v0 and v1. + // This condition determines whether the next line segments continues + // the previous one or goes back. + //---------------- + double x2 = v1.x + dx1; + double y2 = v1.y - dy1; + if ((cross_product(v0.x, v0.y, v1.x, v1.y, x2, y2) < 0.0) == + (cross_product(v1.x, v1.y, v2.x, v2.y, x2, y2) < 0.0)) + { + // This case means that the next segment continues + // the previous one (straight line) + //----------------- + add_vertex(vc, v1.x + dx1, v1.y - dy1); + miter_limit_exceeded = false; + } } - //----------------------------------------------------------------------- - template - void math_stroke::calc_miter(VC& vc, - const vertex_dist& v0, - const vertex_dist& v1, - const vertex_dist& v2, - double dx1, double dy1, - double dx2, double dy2, - line_join_e lj, - double mlimit, - double dbevel) + if (miter_limit_exceeded) { - double xi = v1.x; - double yi = v1.y; - double di = 1; - double lim = m_width_abs * mlimit; - bool miter_limit_exceeded = true; // Assume the worst - bool intersection_failed = true; // Assume the worst - - if(calc_intersection(v0.x + dx1, v0.y - dy1, - v1.x + dx1, v1.y - dy1, - v1.x + dx2, v1.y - dy2, - v2.x + dx2, v2.y - dy2, - &xi, &yi)) + // Miter limit exceeded + //------------------------ + switch (lj) { - // Calculation of the intersection succeeded - //--------------------- - di = calc_distance(v1.x, v1.y, xi, yi); - if(di <= lim) - { - // Inside the miter limit - //--------------------- - add_vertex(vc, xi, yi); - miter_limit_exceeded = false; - } - intersection_failed = false; - } - else - { - // Calculation of the intersection failed, most probably - // the three points lie one straight line. - // First check if v0 and v2 lie on the opposite sides of vector: - // (v1.x, v1.y) -> (v1.x+dx1, v1.y-dy1), that is, the perpendicular - // to the line determined by vertices v0 and v1. - // This condition determines whether the next line segments continues - // the previous one or goes back. - //---------------- - double x2 = v1.x + dx1; - double y2 = v1.y - dy1; - if((cross_product(v0.x, v0.y, v1.x, v1.y, x2, y2) < 0.0) == - (cross_product(v1.x, v1.y, v2.x, v2.y, x2, y2) < 0.0)) - { - // This case means that the next segment continues - // the previous one (straight line) - //----------------- - add_vertex(vc, v1.x + dx1, v1.y - dy1); - miter_limit_exceeded = false; - } - } - - if(miter_limit_exceeded) - { - // Miter limit exceeded - //------------------------ - switch(lj) - { case miter_join_revert: // For the compatibility with SVG, PDF, etc, // we use a simple bevel join instead of @@ -287,13 +269,11 @@ namespace agg default: // If no miter-revert, calculate new dx1, dy1, dx2, dy2 //---------------- - if(intersection_failed) + if (intersection_failed) { mlimit *= m_width_sign; - add_vertex(vc, v1.x + dx1 + dy1 * mlimit, - v1.y - dy1 + dx1 * mlimit); - add_vertex(vc, v1.x + dx2 - dy2 * mlimit, - v1.y - dy2 - dx2 * mlimit); + add_vertex(vc, v1.x + dx1 + dy1 * mlimit, v1.y - dy1 + dx1 * mlimit); + add_vertex(vc, v1.x + dx2 - dy2 * mlimit, v1.y - dy2 - dx2 * mlimit); } else { @@ -302,208 +282,196 @@ namespace agg double x2 = v1.x + dx2; double y2 = v1.y - dy2; di = (lim - dbevel) / (di - dbevel); - add_vertex(vc, x1 + (xi - x1) * di, - y1 + (yi - y1) * di); - add_vertex(vc, x2 + (xi - x2) * di, - y2 + (yi - y2) * di); + add_vertex(vc, x1 + (xi - x1) * di, y1 + (yi - y1) * di); + add_vertex(vc, x2 + (xi - x2) * di, y2 + (yi - y2) * di); } break; - } } } +} - //--------------------------------------------------------stroke_calc_cap - template - void math_stroke::calc_cap(VC& vc, - const vertex_dist& v0, - const vertex_dist& v1, - double len) +//--------------------------------------------------------stroke_calc_cap +template +void math_stroke::calc_cap(VC& vc, const vertex_dist& v0, const vertex_dist& v1, double len) +{ + vc.remove_all(); + + double dx1 = (v1.y - v0.y) / len; + double dy1 = (v1.x - v0.x) / len; + double dx2 = 0; + double dy2 = 0; + + dx1 *= m_width; + dy1 *= m_width; + + if (m_line_cap != round_cap) { - vc.remove_all(); - - double dx1 = (v1.y - v0.y) / len; - double dy1 = (v1.x - v0.x) / len; - double dx2 = 0; - double dy2 = 0; - - dx1 *= m_width; - dy1 *= m_width; - - if(m_line_cap != round_cap) + if (m_line_cap == square_cap) { - if(m_line_cap == square_cap) + dx2 = dy1 * m_width_sign; + dy2 = dx1 * m_width_sign; + } + add_vertex(vc, v0.x - dx1 - dx2, v0.y + dy1 - dy2); + add_vertex(vc, v0.x + dx1 - dx2, v0.y - dy1 - dy2); + } + else + { + double da = std::acos(m_width_abs / (m_width_abs + 0.125 / m_approx_scale)) * 2; + double a1; + int i; + int n = int(pi / da); + + da = pi / (n + 1); + add_vertex(vc, v0.x - dx1, v0.y + dy1); + if (m_width_sign > 0) + { + a1 = std::atan2(dy1, -dx1); + a1 += da; + for (i = 0; i < n; i++) { - dx2 = dy1 * m_width_sign; - dy2 = dx1 * m_width_sign; + add_vertex(vc, v0.x + std::cos(a1) * m_width, v0.y + std::sin(a1) * m_width); + a1 += da; } - add_vertex(vc, v0.x - dx1 - dx2, v0.y + dy1 - dy2); - add_vertex(vc, v0.x + dx1 - dx2, v0.y - dy1 - dy2); } else { - double da = std::acos(m_width_abs / (m_width_abs + 0.125 / m_approx_scale)) * 2; - double a1; - int i; - int n = int(pi / da); - - da = pi / (n + 1); - add_vertex(vc, v0.x - dx1, v0.y + dy1); - if(m_width_sign > 0) + a1 = std::atan2(-dy1, dx1); + a1 -= da; + for (i = 0; i < n; i++) { - a1 = std::atan2(dy1, -dx1); - a1 += da; - for(i = 0; i < n; i++) - { - add_vertex(vc, v0.x + std::cos(a1) * m_width, - v0.y + std::sin(a1) * m_width); - a1 += da; - } - } - else - { - a1 = std::atan2(-dy1, dx1); + add_vertex(vc, v0.x + std::cos(a1) * m_width, v0.y + std::sin(a1) * m_width); a1 -= da; - for(i = 0; i < n; i++) - { - add_vertex(vc, v0.x + std::cos(a1) * m_width, - v0.y + std::sin(a1) * m_width); - a1 -= da; - } } - add_vertex(vc, v0.x + dx1, v0.y - dy1); } + add_vertex(vc, v0.x + dx1, v0.y - dy1); } +} - //----------------------------------------------------------------------- - template - void math_stroke::calc_join(VC& vc, - const vertex_dist& v0, - const vertex_dist& v1, - const vertex_dist& v2, - double len1, - double len2) +//----------------------------------------------------------------------- +template +void math_stroke::calc_join(VC& vc, + const vertex_dist& v0, + const vertex_dist& v1, + const vertex_dist& v2, + double len1, + double len2) +{ + double dx1 = m_width * (v1.y - v0.y) / len1; + double dy1 = m_width * (v1.x - v0.x) / len1; + double dx2 = m_width * (v2.y - v1.y) / len2; + double dy2 = m_width * (v2.x - v1.x) / len2; + + vc.remove_all(); + + double cp = cross_product(v0.x, v0.y, v1.x, v1.y, v2.x, v2.y); + if (cp != 0 && (cp > 0) == (m_width > 0) && m_width_abs > 0) { - double dx1 = m_width * (v1.y - v0.y) / len1; - double dy1 = m_width * (v1.x - v0.x) / len1; - double dx2 = m_width * (v2.y - v1.y) / len2; - double dy2 = m_width * (v2.x - v1.x) / len2; - - vc.remove_all(); - - double cp = cross_product(v0.x, v0.y, v1.x, v1.y, v2.x, v2.y); - if (cp != 0 && (cp > 0) == (m_width > 0) && m_width_abs > 0) + // Inner join + //--------------- + double limit = ((len1 < len2) ? len1 : len2) / m_width_abs; + if (limit < m_inner_miter_limit) { - // Inner join - //--------------- - double limit = ((len1 < len2) ? len1 : len2) / m_width_abs; - if (limit < m_inner_miter_limit) - { - limit = m_inner_miter_limit; - } + limit = m_inner_miter_limit; + } - switch(m_inner_join) - { + switch (m_inner_join) + { default: // inner_bevel add_vertex(vc, v1.x + dx1, v1.y - dy1); add_vertex(vc, v1.x + dx2, v1.y - dy2); break; case inner_miter: - calc_miter(vc, - v0, v1, v2, dx1, dy1, dx2, dy2, - miter_join_revert, - limit, 0); + calc_miter(vc, v0, v1, v2, dx1, dy1, dx2, dy2, miter_join_revert, limit, 0); break; case inner_jag: case inner_round: - cp = (dx1-dx2) * (dx1-dx2) + (dy1-dy2) * (dy1-dy2); - if(cp < len1 * len1 && cp < len2 * len2) + cp = (dx1 - dx2) * (dx1 - dx2) + (dy1 - dy2) * (dy1 - dy2); + if (cp < len1 * len1 && cp < len2 * len2) { - calc_miter(vc, - v0, v1, v2, dx1, dy1, dx2, dy2, - miter_join_revert, - limit, 0); + calc_miter(vc, v0, v1, v2, dx1, dy1, dx2, dy2, miter_join_revert, limit, 0); } else { - if(m_inner_join == inner_jag) + if (m_inner_join == inner_jag) { add_vertex(vc, v1.x + dx1, v1.y - dy1); - add_vertex(vc, v1.x, v1.y ); + add_vertex(vc, v1.x, v1.y); add_vertex(vc, v1.x + dx2, v1.y - dy2); } else { add_vertex(vc, v1.x + dx1, v1.y - dy1); - add_vertex(vc, v1.x, v1.y ); + add_vertex(vc, v1.x, v1.y); calc_arc(vc, v1.x, v1.y, dx2, -dy2, dx1, -dy1); - add_vertex(vc, v1.x, v1.y ); + add_vertex(vc, v1.x, v1.y); add_vertex(vc, v1.x + dx2, v1.y - dy2); } } break; + } + } + else + { + // Outer join + //--------------- + + // Calculate the distance between v1 and + // the central point of the bevel line segment + //--------------- + double dx = (dx1 + dx2) / 2; + double dy = (dy1 + dy2) / 2; + double dbevel = sqrt(dx * dx + dy * dy); + + if (m_line_join == round_join || m_line_join == bevel_join) + { + // This is an optimization that reduces the number of points + // in cases of almost collinear segments. If there's no + // visible difference between bevel and miter joins we'd rather + // use miter join because it adds only one point instead of two. + // + // Here we calculate the middle point between the bevel points + // and then, the distance between v1 and this middle point. + // At outer joins this distance always less than stroke width, + // because it's actually the height of an isosceles triangle of + // v1 and its two bevel points. If the difference between this + // width and this value is small (no visible bevel) we can + // add just one point. + // + // The constant in the expression makes the result approximately + // the same as in round joins and caps. You can safely comment + // out this entire "if". + //------------------- + if (m_approx_scale * (m_width_abs - dbevel) < m_width_eps) + { + if (calc_intersection(v0.x + dx1, + v0.y - dy1, + v1.x + dx1, + v1.y - dy1, + v1.x + dx2, + v1.y - dy2, + v2.x + dx2, + v2.y - dy2, + &dx, + &dy)) + { + add_vertex(vc, dx, dy); + } + else + { + add_vertex(vc, v1.x + dx1, v1.y - dy1); + } + return; } } - else + + switch (m_line_join) { - // Outer join - //--------------- - - // Calculate the distance between v1 and - // the central point of the bevel line segment - //--------------- - double dx = (dx1 + dx2) / 2; - double dy = (dy1 + dy2) / 2; - double dbevel = sqrt(dx * dx + dy * dy); - - if(m_line_join == round_join || m_line_join == bevel_join) - { - // This is an optimization that reduces the number of points - // in cases of almost collinear segments. If there's no - // visible difference between bevel and miter joins we'd rather - // use miter join because it adds only one point instead of two. - // - // Here we calculate the middle point between the bevel points - // and then, the distance between v1 and this middle point. - // At outer joins this distance always less than stroke width, - // because it's actually the height of an isosceles triangle of - // v1 and its two bevel points. If the difference between this - // width and this value is small (no visible bevel) we can - // add just one point. - // - // The constant in the expression makes the result approximately - // the same as in round joins and caps. You can safely comment - // out this entire "if". - //------------------- - if(m_approx_scale * (m_width_abs - dbevel) < m_width_eps) - { - if(calc_intersection(v0.x + dx1, v0.y - dy1, - v1.x + dx1, v1.y - dy1, - v1.x + dx2, v1.y - dy2, - v2.x + dx2, v2.y - dy2, - &dx, &dy)) - { - add_vertex(vc, dx, dy); - } - else - { - add_vertex(vc, v1.x + dx1, v1.y - dy1); - } - return; - } - } - - switch(m_line_join) - { case miter_join: case miter_join_revert: case miter_join_round: - calc_miter(vc, - v0, v1, v2, dx1, dy1, dx2, dy2, - m_line_join, - m_miter_limit, - dbevel); + calc_miter(vc, v0, v1, v2, dx1, dy1, dx2, dy2, m_line_join, m_miter_limit, dbevel); break; case round_join: @@ -514,13 +482,10 @@ namespace agg add_vertex(vc, v1.x + dx1, v1.y - dy1); add_vertex(vc, v1.x + dx2, v1.y - dy2); break; - } } } - - - - } +} // namespace agg + #endif diff --git a/deps/agg/include/agg_path_length.h b/deps/agg/include/agg_path_length.h index 740ba31df..6081059f2 100644 --- a/deps/agg/include/agg_path_length.h +++ b/deps/agg/include/agg_path_length.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -17,49 +17,48 @@ #include "agg_math.h" -namespace agg +namespace agg { +template +double path_length(VertexSource& vs, unsigned path_id = 0) { - template - double path_length(VertexSource& vs, unsigned path_id = 0) - { - double len = 0.0; - double start_x = 0.0; - double start_y = 0.0; - double x1 = 0.0; - double y1 = 0.0; - double x2 = 0.0; - double y2 = 0.0; - bool first = true; + double len = 0.0; + double start_x = 0.0; + double start_y = 0.0; + double x1 = 0.0; + double y1 = 0.0; + double x2 = 0.0; + double y2 = 0.0; + bool first = true; - unsigned cmd; - vs.rewind(path_id); - while(!is_stop(cmd = vs.vertex(&x2, &y2))) + unsigned cmd; + vs.rewind(path_id); + while (!is_stop(cmd = vs.vertex(&x2, &y2))) + { + if (is_vertex(cmd)) { - if(is_vertex(cmd)) + if (first || is_move_to(cmd)) { - if(first || is_move_to(cmd)) - { - start_x = x2; - start_y = y2; - } - else - { - len += calc_distance(x1, y1, x2, y2); - } - x1 = x2; - y1 = y2; - first = false; + start_x = x2; + start_y = y2; } else { - if(is_close(cmd) && !first) - { - len += calc_distance(x1, y1, start_x, start_y); - } + len += calc_distance(x1, y1, x2, y2); + } + x1 = x2; + y1 = y2; + first = false; + } + else + { + if (is_close(cmd) && !first) + { + len += calc_distance(x1, y1, start_x, start_y); } } - return len; } + return len; } +} // namespace agg #endif diff --git a/deps/agg/include/agg_path_storage.h b/deps/agg/include/agg_path_storage.h index 3be5aa86c..552aebd07 100644 --- a/deps/agg/include/agg_path_storage.h +++ b/deps/agg/include/agg_path_storage.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -22,1534 +22,1449 @@ #include "agg_array.h" #include "agg_bezier_arc.h" -namespace agg +namespace agg { + +//----------------------------------------------------vertex_block_storage +template +class vertex_block_storage { - - - //----------------------------------------------------vertex_block_storage - template - class vertex_block_storage - { - public: - // Allocation parameters - enum block_scale_e - { - block_shift = BlockShift, - block_size = 1 << block_shift, - block_mask = block_size - 1, - block_pool = BlockPool - }; - - typedef T value_type; - typedef vertex_block_storage self_type; - - ~vertex_block_storage(); - vertex_block_storage(); - vertex_block_storage(const self_type& v); - const self_type& operator = (const self_type& ps); - - void remove_all(); - void free_all(); - - void add_vertex(double x, double y, unsigned cmd); - void modify_vertex(unsigned idx, double x, double y); - void modify_vertex(unsigned idx, double x, double y, unsigned cmd); - void modify_command(unsigned idx, unsigned cmd); - void swap_vertices(unsigned v1, unsigned v2); - - unsigned last_command() const; - unsigned last_vertex(double* x, double* y) const; - unsigned prev_vertex(double* x, double* y) const; - - double last_x() const; - double last_y() const; - - unsigned total_vertices() const; - unsigned vertex(unsigned idx, double* x, double* y) const; - unsigned command(unsigned idx) const; - - private: - void allocate_block(unsigned nb); - int8u* storage_ptrs(T** xy_ptr); - - private: - unsigned m_total_vertices; - unsigned m_total_blocks; - unsigned m_max_blocks; - T** m_coord_blocks; - int8u** m_cmd_blocks; + public: + // Allocation parameters + enum block_scale_e { + block_shift = BlockShift, + block_size = 1 << block_shift, + block_mask = block_size - 1, + block_pool = BlockPool }; + typedef T value_type; + typedef vertex_block_storage self_type; - //------------------------------------------------------------------------ - template - void vertex_block_storage::free_all() + ~vertex_block_storage(); + vertex_block_storage(); + vertex_block_storage(const self_type& v); + const self_type& operator=(const self_type& ps); + + void remove_all(); + void free_all(); + + void add_vertex(double x, double y, unsigned cmd); + void modify_vertex(unsigned idx, double x, double y); + void modify_vertex(unsigned idx, double x, double y, unsigned cmd); + void modify_command(unsigned idx, unsigned cmd); + void swap_vertices(unsigned v1, unsigned v2); + + unsigned last_command() const; + unsigned last_vertex(double* x, double* y) const; + unsigned prev_vertex(double* x, double* y) const; + + double last_x() const; + double last_y() const; + + unsigned total_vertices() const; + unsigned vertex(unsigned idx, double* x, double* y) const; + unsigned command(unsigned idx) const; + + private: + void allocate_block(unsigned nb); + int8u* storage_ptrs(T** xy_ptr); + + private: + unsigned m_total_vertices; + unsigned m_total_blocks; + unsigned m_max_blocks; + T** m_coord_blocks; + int8u** m_cmd_blocks; +}; + +//------------------------------------------------------------------------ +template +void vertex_block_storage::free_all() +{ + if (m_total_blocks) { - if(m_total_blocks) + T** coord_blk = m_coord_blocks + m_total_blocks - 1; + while (m_total_blocks--) { - T** coord_blk = m_coord_blocks + m_total_blocks - 1; - while(m_total_blocks--) - { - pod_allocator::deallocate( - *coord_blk, - block_size * 2 + - block_size / (sizeof(T) / sizeof(unsigned char))); - --coord_blk; - } - pod_allocator::deallocate(m_coord_blocks, m_max_blocks * 2); - m_total_blocks = 0; - m_max_blocks = 0; - m_coord_blocks = 0; - m_cmd_blocks = 0; - m_total_vertices = 0; + pod_allocator::deallocate(*coord_blk, block_size * 2 + block_size / (sizeof(T) / sizeof(unsigned char))); + --coord_blk; } - } - - //------------------------------------------------------------------------ - template - vertex_block_storage::~vertex_block_storage() - { - free_all(); - } - - //------------------------------------------------------------------------ - template - vertex_block_storage::vertex_block_storage() : - m_total_vertices(0), - m_total_blocks(0), - m_max_blocks(0), - m_coord_blocks(0), - m_cmd_blocks(0) - { - } - - //------------------------------------------------------------------------ - template - vertex_block_storage::vertex_block_storage(const vertex_block_storage& v) : - m_total_vertices(0), - m_total_blocks(0), - m_max_blocks(0), - m_coord_blocks(0), - m_cmd_blocks(0) - { - *this = v; - } - - //------------------------------------------------------------------------ - template - const vertex_block_storage& - vertex_block_storage::operator = (const vertex_block_storage& v) - { - remove_all(); - unsigned i; - for(i = 0; i < v.total_vertices(); i++) - { - double x, y; - unsigned cmd = v.vertex(i, &x, &y); - add_vertex(x, y, cmd); - } - return *this; - } - - //------------------------------------------------------------------------ - template - inline void vertex_block_storage::remove_all() - { + pod_allocator::deallocate(m_coord_blocks, m_max_blocks * 2); + m_total_blocks = 0; + m_max_blocks = 0; + m_coord_blocks = 0; + m_cmd_blocks = 0; m_total_vertices = 0; } +} - //------------------------------------------------------------------------ - template - inline void vertex_block_storage::add_vertex(double x, double y, - unsigned cmd) +//------------------------------------------------------------------------ +template +vertex_block_storage::~vertex_block_storage() +{ + free_all(); +} + +//------------------------------------------------------------------------ +template +vertex_block_storage::vertex_block_storage() + : m_total_vertices(0) + , m_total_blocks(0) + , m_max_blocks(0) + , m_coord_blocks(0) + , m_cmd_blocks(0) +{} + +//------------------------------------------------------------------------ +template +vertex_block_storage::vertex_block_storage(const vertex_block_storage& v) + : m_total_vertices(0) + , m_total_blocks(0) + , m_max_blocks(0) + , m_coord_blocks(0) + , m_cmd_blocks(0) +{ + *this = v; +} + +//------------------------------------------------------------------------ +template +const vertex_block_storage& vertex_block_storage::operator=(const vertex_block_storage& v) +{ + remove_all(); + unsigned i; + for (i = 0; i < v.total_vertices(); i++) { - T* coord_ptr = 0; - *storage_ptrs(&coord_ptr) = (int8u)cmd; - coord_ptr[0] = T(x); - coord_ptr[1] = T(y); - m_total_vertices++; + double x, y; + unsigned cmd = v.vertex(i, &x, &y); + add_vertex(x, y, cmd); + } + return *this; +} + +//------------------------------------------------------------------------ +template +inline void vertex_block_storage::remove_all() +{ + m_total_vertices = 0; +} + +//------------------------------------------------------------------------ +template +inline void vertex_block_storage::add_vertex(double x, double y, unsigned cmd) +{ + T* coord_ptr = 0; + *storage_ptrs(&coord_ptr) = (int8u)cmd; + coord_ptr[0] = T(x); + coord_ptr[1] = T(y); + m_total_vertices++; +} + +//------------------------------------------------------------------------ +template +inline void vertex_block_storage::modify_vertex(unsigned idx, double x, double y) +{ + T* pv = m_coord_blocks[idx >> block_shift] + ((idx & block_mask) << 1); + pv[0] = T(x); + pv[1] = T(y); +} + +//------------------------------------------------------------------------ +template +inline void vertex_block_storage::modify_vertex(unsigned idx, double x, double y, unsigned cmd) +{ + unsigned block = idx >> block_shift; + unsigned offset = idx & block_mask; + T* pv = m_coord_blocks[block] + (offset << 1); + pv[0] = T(x); + pv[1] = T(y); + m_cmd_blocks[block][offset] = (int8u)cmd; +} + +//------------------------------------------------------------------------ +template +inline void vertex_block_storage::modify_command(unsigned idx, unsigned cmd) +{ + m_cmd_blocks[idx >> block_shift][idx & block_mask] = (int8u)cmd; +} + +//------------------------------------------------------------------------ +template +inline void vertex_block_storage::swap_vertices(unsigned v1, unsigned v2) +{ + unsigned b1 = v1 >> block_shift; + unsigned b2 = v2 >> block_shift; + unsigned o1 = v1 & block_mask; + unsigned o2 = v2 & block_mask; + T* pv1 = m_coord_blocks[b1] + (o1 << 1); + T* pv2 = m_coord_blocks[b2] + (o2 << 1); + T val; + val = pv1[0]; + pv1[0] = pv2[0]; + pv2[0] = val; + val = pv1[1]; + pv1[1] = pv2[1]; + pv2[1] = val; + int8u cmd = m_cmd_blocks[b1][o1]; + m_cmd_blocks[b1][o1] = m_cmd_blocks[b2][o2]; + m_cmd_blocks[b2][o2] = cmd; +} + +//------------------------------------------------------------------------ +template +inline unsigned vertex_block_storage::last_command() const +{ + if (m_total_vertices) + return command(m_total_vertices - 1); + return path_cmd_stop; +} + +//------------------------------------------------------------------------ +template +inline unsigned vertex_block_storage::last_vertex(double* x, double* y) const +{ + if (m_total_vertices) + return vertex(m_total_vertices - 1, x, y); + return path_cmd_stop; +} + +//------------------------------------------------------------------------ +template +inline unsigned vertex_block_storage::prev_vertex(double* x, double* y) const +{ + if (m_total_vertices > 1) + return vertex(m_total_vertices - 2, x, y); + return path_cmd_stop; +} + +//------------------------------------------------------------------------ +template +inline double vertex_block_storage::last_x() const +{ + if (m_total_vertices) + { + unsigned idx = m_total_vertices - 1; + return m_coord_blocks[idx >> block_shift][(idx & block_mask) << 1]; + } + return 0.0; +} + +//------------------------------------------------------------------------ +template +inline double vertex_block_storage::last_y() const +{ + if (m_total_vertices) + { + unsigned idx = m_total_vertices - 1; + return m_coord_blocks[idx >> block_shift][((idx & block_mask) << 1) + 1]; + } + return 0.0; +} + +//------------------------------------------------------------------------ +template +inline unsigned vertex_block_storage::total_vertices() const +{ + return m_total_vertices; +} + +//------------------------------------------------------------------------ +template +inline unsigned vertex_block_storage::vertex(unsigned idx, double* x, double* y) const +{ + unsigned nb = idx >> block_shift; + const T* pv = m_coord_blocks[nb] + ((idx & block_mask) << 1); + *x = pv[0]; + *y = pv[1]; + return m_cmd_blocks[nb][idx & block_mask]; +} + +//------------------------------------------------------------------------ +template +inline unsigned vertex_block_storage::command(unsigned idx) const +{ + return m_cmd_blocks[idx >> block_shift][idx & block_mask]; +} + +//------------------------------------------------------------------------ +template +void vertex_block_storage::allocate_block(unsigned nb) +{ + if (nb >= m_max_blocks) + { + T** new_coords = pod_allocator::allocate((m_max_blocks + block_pool) * 2); + + unsigned char** new_cmds = (unsigned char**)(new_coords + m_max_blocks + block_pool); + + if (m_coord_blocks) + { + memcpy(new_coords, m_coord_blocks, m_max_blocks * sizeof(T*)); + + memcpy(new_cmds, m_cmd_blocks, m_max_blocks * sizeof(unsigned char*)); + + pod_allocator::deallocate(m_coord_blocks, m_max_blocks * 2); + } + m_coord_blocks = new_coords; + m_cmd_blocks = new_cmds; + m_max_blocks += block_pool; + } + m_coord_blocks[nb] = pod_allocator::allocate(block_size * 2 + block_size / (sizeof(T) / sizeof(unsigned char))); + + m_cmd_blocks[nb] = (unsigned char*)(m_coord_blocks[nb] + block_size * 2); + + m_total_blocks++; +} + +//------------------------------------------------------------------------ +template +int8u* vertex_block_storage::storage_ptrs(T** xy_ptr) +{ + unsigned nb = m_total_vertices >> block_shift; + if (nb >= m_total_blocks) + { + allocate_block(nb); + } + *xy_ptr = m_coord_blocks[nb] + ((m_total_vertices & block_mask) << 1); + return m_cmd_blocks[nb] + (m_total_vertices & block_mask); +} + +//-----------------------------------------------------poly_plain_adaptor +template +class poly_plain_adaptor +{ + public: + typedef T value_type; + + poly_plain_adaptor() + : m_data(0) + , m_ptr(0) + , m_end(0) + , m_closed(false) + , m_stop(false) + {} + + poly_plain_adaptor(const T* data, unsigned num_points, bool closed) + : m_data(data) + , m_ptr(data) + , m_end(data + num_points * 2) + , m_closed(closed) + , m_stop(false) + {} + + void init(const T* data, unsigned num_points, bool closed) + { + m_data = data; + m_ptr = data; + m_end = data + num_points * 2; + m_closed = closed; + m_stop = false; } - //------------------------------------------------------------------------ - template - inline void vertex_block_storage::modify_vertex(unsigned idx, - double x, double y) + void rewind(unsigned) { - T* pv = m_coord_blocks[idx >> block_shift] + ((idx & block_mask) << 1); - pv[0] = T(x); - pv[1] = T(y); + m_ptr = m_data; + m_stop = false; } - //------------------------------------------------------------------------ - template - inline void vertex_block_storage::modify_vertex(unsigned idx, - double x, double y, - unsigned cmd) + unsigned vertex(double* x, double* y) { - unsigned block = idx >> block_shift; - unsigned offset = idx & block_mask; - T* pv = m_coord_blocks[block] + (offset << 1); - pv[0] = T(x); - pv[1] = T(y); - m_cmd_blocks[block][offset] = (int8u)cmd; - } - - //------------------------------------------------------------------------ - template - inline void vertex_block_storage::modify_command(unsigned idx, - unsigned cmd) - { - m_cmd_blocks[idx >> block_shift][idx & block_mask] = (int8u)cmd; - } - - //------------------------------------------------------------------------ - template - inline void vertex_block_storage::swap_vertices(unsigned v1, unsigned v2) - { - unsigned b1 = v1 >> block_shift; - unsigned b2 = v2 >> block_shift; - unsigned o1 = v1 & block_mask; - unsigned o2 = v2 & block_mask; - T* pv1 = m_coord_blocks[b1] + (o1 << 1); - T* pv2 = m_coord_blocks[b2] + (o2 << 1); - T val; - val = pv1[0]; pv1[0] = pv2[0]; pv2[0] = val; - val = pv1[1]; pv1[1] = pv2[1]; pv2[1] = val; - int8u cmd = m_cmd_blocks[b1][o1]; - m_cmd_blocks[b1][o1] = m_cmd_blocks[b2][o2]; - m_cmd_blocks[b2][o2] = cmd; - } - - //------------------------------------------------------------------------ - template - inline unsigned vertex_block_storage::last_command() const - { - if(m_total_vertices) return command(m_total_vertices - 1); + if (m_ptr < m_end) + { + bool first = m_ptr == m_data; + *x = *m_ptr++; + *y = *m_ptr++; + return first ? path_cmd_move_to : path_cmd_line_to; + } + *x = *y = 0.0; + if (m_closed && !m_stop) + { + m_stop = true; + return path_cmd_end_poly | path_flags_close; + } return path_cmd_stop; } - //------------------------------------------------------------------------ - template - inline unsigned vertex_block_storage::last_vertex(double* x, double* y) const + private: + const T* m_data; + const T* m_ptr; + const T* m_end; + bool m_closed; + bool m_stop; +}; + +//-------------------------------------------------poly_container_adaptor +template +class poly_container_adaptor +{ + public: + typedef typename Container::value_type vertex_type; + + poly_container_adaptor() + : m_container(0) + , m_index(0) + , m_closed(false) + , m_stop(false) + {} + + poly_container_adaptor(const Container& data, bool closed) + : m_container(&data) + , m_index(0) + , m_closed(closed) + , m_stop(false) + {} + + void init(const Container& data, bool closed) { - if(m_total_vertices) return vertex(m_total_vertices - 1, x, y); + m_container = &data; + m_index = 0; + m_closed = closed; + m_stop = false; + } + + void rewind(unsigned) + { + m_index = 0; + m_stop = false; + } + + unsigned vertex(double* x, double* y) + { + if (m_index < m_container->size()) + { + bool first = m_index == 0; + const vertex_type& v = (*m_container)[m_index++]; + *x = v.x; + *y = v.y; + return first ? path_cmd_move_to : path_cmd_line_to; + } + *x = *y = 0.0; + if (m_closed && !m_stop) + { + m_stop = true; + return path_cmd_end_poly | path_flags_close; + } return path_cmd_stop; } - //------------------------------------------------------------------------ - template - inline unsigned vertex_block_storage::prev_vertex(double* x, double* y) const + private: + const Container* m_container; + unsigned m_index; + bool m_closed; + bool m_stop; +}; + +//-----------------------------------------poly_container_reverse_adaptor +template +class poly_container_reverse_adaptor +{ + public: + typedef typename Container::value_type vertex_type; + + poly_container_reverse_adaptor() + : m_container(0) + , m_index(-1) + , m_closed(false) + , m_stop(false) + {} + + poly_container_reverse_adaptor(const Container& data, bool closed) + : m_container(&data) + , m_index(-1) + , m_closed(closed) + , m_stop(false) + {} + + void init(const Container& data, bool closed) { - if(m_total_vertices > 1) return vertex(m_total_vertices - 2, x, y); + m_container = &data; + m_index = m_container->size() - 1; + m_closed = closed; + m_stop = false; + } + + void rewind(unsigned) + { + m_index = m_container->size() - 1; + m_stop = false; + } + + unsigned vertex(double* x, double* y) + { + if (m_index >= 0) + { + bool first = m_index == int(m_container->size() - 1); + const vertex_type& v = (*m_container)[m_index--]; + *x = v.x; + *y = v.y; + return first ? path_cmd_move_to : path_cmd_line_to; + } + *x = *y = 0.0; + if (m_closed && !m_stop) + { + m_stop = true; + return path_cmd_end_poly | path_flags_close; + } return path_cmd_stop; } - //------------------------------------------------------------------------ - template - inline double vertex_block_storage::last_x() const + private: + const Container* m_container; + int m_index; + bool m_closed; + bool m_stop; +}; + +//--------------------------------------------------------line_adaptor +class line_adaptor +{ + public: + typedef double value_type; + + line_adaptor() + : m_line(m_coord, 2, false) + {} + line_adaptor(double x1, double y1, double x2, double y2) + : m_line(m_coord, 2, false) { - if(m_total_vertices) - { - unsigned idx = m_total_vertices - 1; - return m_coord_blocks[idx >> block_shift][(idx & block_mask) << 1]; - } - return 0.0; + m_coord[0] = x1; + m_coord[1] = y1; + m_coord[2] = x2; + m_coord[3] = y2; } - //------------------------------------------------------------------------ - template - inline double vertex_block_storage::last_y() const + void init(double x1, double y1, double x2, double y2) { - if(m_total_vertices) - { - unsigned idx = m_total_vertices - 1; - return m_coord_blocks[idx >> block_shift][((idx & block_mask) << 1) + 1]; - } - return 0.0; + m_coord[0] = x1; + m_coord[1] = y1; + m_coord[2] = x2; + m_coord[3] = y2; + m_line.rewind(0); } - //------------------------------------------------------------------------ - template - inline unsigned vertex_block_storage::total_vertices() const + void rewind(unsigned) { m_line.rewind(0); } + + unsigned vertex(double* x, double* y) { return m_line.vertex(x, y); } + + private: + double m_coord[4]; + poly_plain_adaptor m_line; +}; + +//---------------------------------------------------------------path_base +// A container to store vertices with their flags. +// A path consists of a number of contours separated with "move_to" +// commands. The path storage can keep and maintain more than one +// path. +// 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 +// start_new_path() you need to store its return value somewhere else +// to navigate to the path afterwards. +// +// See also: vertex_source concept +//------------------------------------------------------------------------ +template +class path_base +{ + public: + typedef VertexContainer container_type; + typedef path_base self_type; + + //-------------------------------------------------------------------- + path_base() + : m_vertices() + , m_iterator(0) + {} + void remove_all() { - return m_total_vertices; + m_vertices.remove_all(); + m_iterator = 0; + } + void free_all() + { + m_vertices.free_all(); + m_iterator = 0; } - //------------------------------------------------------------------------ - template - inline unsigned vertex_block_storage::vertex(unsigned idx, - double* x, double* y) const + // Make path functions + //-------------------------------------------------------------------- + unsigned start_new_path(); + + void move_to(double x, double y); + void move_rel(double dx, double dy); + + void line_to(double x, double y); + void line_rel(double dx, double dy); + + void hline_to(double x); + void hline_rel(double dx); + + void vline_to(double y); + void vline_rel(double dy); + + void arc_to(double rx, double ry, double angle, bool large_arc_flag, bool sweep_flag, double x, double y); + + void arc_rel(double rx, double ry, double angle, bool large_arc_flag, bool sweep_flag, double dx, double dy); + + void curve3(double x_ctrl, double y_ctrl, double x_to, double y_to); + + void curve3_rel(double dx_ctrl, double dy_ctrl, double dx_to, double dy_to); + + void curve3(double x_to, double y_to); + + void curve3_rel(double dx_to, double dy_to); + + void curve4(double x_ctrl1, double y_ctrl1, double x_ctrl2, double y_ctrl2, double x_to, double y_to); + + void curve4_rel(double dx_ctrl1, double dy_ctrl1, double dx_ctrl2, double dy_ctrl2, double dx_to, double dy_to); + + void curve4(double x_ctrl2, double y_ctrl2, double x_to, double y_to); + + void curve4_rel(double x_ctrl2, double y_ctrl2, double x_to, double y_to); + + void end_poly(unsigned flags = path_flags_close); + void close_polygon(unsigned flags = path_flags_none); + + // Accessors + //-------------------------------------------------------------------- + const container_type& vertices() const { return m_vertices; } + container_type& vertices() { return m_vertices; } + + unsigned total_vertices() const; + + void rel_to_abs(double* x, double* y) const; + + unsigned last_vertex(double* x, double* y) const; + unsigned prev_vertex(double* x, double* y) const; + + double last_x() const; + double last_y() const; + + unsigned vertex(unsigned idx, double* x, double* y) const; + unsigned command(unsigned idx) const; + + void modify_vertex(unsigned idx, double x, double y); + void modify_vertex(unsigned idx, double x, double y, unsigned cmd); + void modify_command(unsigned idx, unsigned cmd); + + // VertexSource interface + //-------------------------------------------------------------------- + void rewind(unsigned path_id); + unsigned vertex(double* x, double* y); + + // Arrange the orientation of a polygon, all polygons in a path, + // or in all paths. After calling arrange_orientations() or + // arrange_orientations_all_paths(), all the polygons will have + // the same orientation, i.e. path_flags_cw or path_flags_ccw + //-------------------------------------------------------------------- + unsigned arrange_polygon_orientation(unsigned start, path_flags_e orientation); + unsigned arrange_orientations(unsigned path_id, path_flags_e orientation); + void arrange_orientations_all_paths(path_flags_e orientation); + void invert_polygon(unsigned start); + + // Flip all vertices horizontally or vertically, + // between x1 and x2, or between y1 and y2 respectively + //-------------------------------------------------------------------- + void flip_x(double x1, double x2); + void flip_y(double y1, double y2); + + // Concatenate path. The path is added as is. + //-------------------------------------------------------------------- + template + void concat_path(VertexSource& vs, unsigned path_id = 0) { - unsigned nb = idx >> block_shift; - const T* pv = m_coord_blocks[nb] + ((idx & block_mask) << 1); - *x = pv[0]; - *y = pv[1]; - return m_cmd_blocks[nb][idx & block_mask]; + double x = 0; + double y = 0; + unsigned cmd; + vs.rewind(path_id); + while (!is_stop(cmd = vs.vertex(&x, &y))) + { + m_vertices.add_vertex(x, y, cmd); + } } - //------------------------------------------------------------------------ - template - inline unsigned vertex_block_storage::command(unsigned idx) const + //-------------------------------------------------------------------- + // 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) + template + void join_path(VertexSource& vs, unsigned path_id = 0) { - return m_cmd_blocks[idx >> block_shift][idx & block_mask]; - } - - //------------------------------------------------------------------------ - template - void vertex_block_storage::allocate_block(unsigned nb) - { - if(nb >= m_max_blocks) + double x = 0.0, y = 0.0; + unsigned cmd; + vs.rewind(path_id); + cmd = vs.vertex(&x, &y); + if (!is_stop(cmd)) { - T** new_coords = - pod_allocator::allocate((m_max_blocks + block_pool) * 2); - - unsigned char** new_cmds = - (unsigned char**)(new_coords + m_max_blocks + block_pool); - - if(m_coord_blocks) + if (is_vertex(cmd)) { - memcpy(new_coords, - m_coord_blocks, - m_max_blocks * sizeof(T*)); - - memcpy(new_cmds, - m_cmd_blocks, - m_max_blocks * sizeof(unsigned char*)); - - pod_allocator::deallocate(m_coord_blocks, m_max_blocks * 2); - } - m_coord_blocks = new_coords; - m_cmd_blocks = new_cmds; - m_max_blocks += block_pool; - } - m_coord_blocks[nb] = - pod_allocator::allocate(block_size * 2 + - block_size / (sizeof(T) / sizeof(unsigned char))); - - m_cmd_blocks[nb] = - (unsigned char*)(m_coord_blocks[nb] + block_size * 2); - - m_total_blocks++; - } - - //------------------------------------------------------------------------ - template - int8u* vertex_block_storage::storage_ptrs(T** xy_ptr) - { - unsigned nb = m_total_vertices >> block_shift; - if(nb >= m_total_blocks) - { - allocate_block(nb); - } - *xy_ptr = m_coord_blocks[nb] + ((m_total_vertices & block_mask) << 1); - return m_cmd_blocks[nb] + (m_total_vertices & block_mask); - } - - - - - //-----------------------------------------------------poly_plain_adaptor - template class poly_plain_adaptor - { - public: - typedef T value_type; - - poly_plain_adaptor() : - m_data(0), - m_ptr(0), - m_end(0), - m_closed(false), - m_stop(false) - {} - - poly_plain_adaptor(const T* data, unsigned num_points, bool closed) : - m_data(data), - m_ptr(data), - m_end(data + num_points * 2), - m_closed(closed), - m_stop(false) - {} - - void init(const T* data, unsigned num_points, bool closed) - { - m_data = data; - m_ptr = data; - m_end = data + num_points * 2; - m_closed = closed; - m_stop = false; - } - - void rewind(unsigned) - { - m_ptr = m_data; - m_stop = false; - } - - unsigned vertex(double* x, double* y) - { - if(m_ptr < m_end) - { - bool first = m_ptr == m_data; - *x = *m_ptr++; - *y = *m_ptr++; - return first ? path_cmd_move_to : path_cmd_line_to; - } - *x = *y = 0.0; - if(m_closed && !m_stop) - { - m_stop = true; - return path_cmd_end_poly | path_flags_close; - } - return path_cmd_stop; - } - - private: - const T* m_data; - const T* m_ptr; - const T* m_end; - bool m_closed; - bool m_stop; - }; - - - - - - //-------------------------------------------------poly_container_adaptor - template class poly_container_adaptor - { - public: - typedef typename Container::value_type vertex_type; - - poly_container_adaptor() : - m_container(0), - m_index(0), - m_closed(false), - m_stop(false) - {} - - poly_container_adaptor(const Container& data, bool closed) : - m_container(&data), - m_index(0), - m_closed(closed), - m_stop(false) - {} - - void init(const Container& data, bool closed) - { - m_container = &data; - m_index = 0; - m_closed = closed; - m_stop = false; - } - - void rewind(unsigned) - { - m_index = 0; - m_stop = false; - } - - unsigned vertex(double* x, double* y) - { - if(m_index < m_container->size()) - { - bool first = m_index == 0; - const vertex_type& v = (*m_container)[m_index++]; - *x = v.x; - *y = v.y; - return first ? path_cmd_move_to : path_cmd_line_to; - } - *x = *y = 0.0; - if(m_closed && !m_stop) - { - m_stop = true; - return path_cmd_end_poly | path_flags_close; - } - return path_cmd_stop; - } - - private: - const Container* m_container; - unsigned m_index; - bool m_closed; - bool m_stop; - }; - - - - //-----------------------------------------poly_container_reverse_adaptor - template class poly_container_reverse_adaptor - { - public: - typedef typename Container::value_type vertex_type; - - poly_container_reverse_adaptor() : - m_container(0), - m_index(-1), - m_closed(false), - m_stop(false) - {} - - poly_container_reverse_adaptor(const Container& data, bool closed) : - m_container(&data), - m_index(-1), - m_closed(closed), - m_stop(false) - {} - - void init(const Container& data, bool closed) - { - m_container = &data; - m_index = m_container->size() - 1; - m_closed = closed; - m_stop = false; - } - - void rewind(unsigned) - { - m_index = m_container->size() - 1; - m_stop = false; - } - - unsigned vertex(double* x, double* y) - { - if(m_index >= 0) - { - bool first = m_index == int(m_container->size() - 1); - const vertex_type& v = (*m_container)[m_index--]; - *x = v.x; - *y = v.y; - return first ? path_cmd_move_to : path_cmd_line_to; - } - *x = *y = 0.0; - if(m_closed && !m_stop) - { - m_stop = true; - return path_cmd_end_poly | path_flags_close; - } - return path_cmd_stop; - } - - private: - const Container* m_container; - int m_index; - bool m_closed; - bool m_stop; - }; - - - - - - //--------------------------------------------------------line_adaptor - class line_adaptor - { - public: - typedef double value_type; - - line_adaptor() : m_line(m_coord, 2, false) {} - line_adaptor(double x1, double y1, double x2, double y2) : - m_line(m_coord, 2, false) - { - m_coord[0] = x1; - m_coord[1] = y1; - m_coord[2] = x2; - m_coord[3] = y2; - } - - void init(double x1, double y1, double x2, double y2) - { - m_coord[0] = x1; - m_coord[1] = y1; - m_coord[2] = x2; - m_coord[3] = y2; - m_line.rewind(0); - } - - void rewind(unsigned) - { - m_line.rewind(0); - } - - unsigned vertex(double* x, double* y) - { - return m_line.vertex(x, y); - } - - private: - double m_coord[4]; - poly_plain_adaptor m_line; - }; - - - - - - - - - - - - - - //---------------------------------------------------------------path_base - // A container to store vertices with their flags. - // A path consists of a number of contours separated with "move_to" - // commands. The path storage can keep and maintain more than one - // path. - // 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 - // start_new_path() you need to store its return value somewhere else - // to navigate to the path afterwards. - // - // See also: vertex_source concept - //------------------------------------------------------------------------ - template class path_base - { - public: - typedef VertexContainer container_type; - typedef path_base self_type; - - //-------------------------------------------------------------------- - path_base() : m_vertices(), m_iterator(0) {} - void remove_all() { m_vertices.remove_all(); m_iterator = 0; } - void free_all() { m_vertices.free_all(); m_iterator = 0; } - - // Make path functions - //-------------------------------------------------------------------- - unsigned start_new_path(); - - void move_to(double x, double y); - void move_rel(double dx, double dy); - - void line_to(double x, double y); - void line_rel(double dx, double dy); - - void hline_to(double x); - void hline_rel(double dx); - - void vline_to(double y); - void vline_rel(double dy); - - void arc_to(double rx, double ry, - double angle, - bool large_arc_flag, - bool sweep_flag, - double x, double y); - - void arc_rel(double rx, double ry, - double angle, - bool large_arc_flag, - bool sweep_flag, - double dx, double dy); - - void curve3(double x_ctrl, double y_ctrl, - double x_to, double y_to); - - void curve3_rel(double dx_ctrl, double dy_ctrl, - double dx_to, double dy_to); - - void curve3(double x_to, double y_to); - - void curve3_rel(double dx_to, double dy_to); - - void curve4(double x_ctrl1, double y_ctrl1, - double x_ctrl2, double y_ctrl2, - double x_to, double y_to); - - void curve4_rel(double dx_ctrl1, double dy_ctrl1, - double dx_ctrl2, double dy_ctrl2, - double dx_to, double dy_to); - - void curve4(double x_ctrl2, double y_ctrl2, - double x_to, double y_to); - - void curve4_rel(double x_ctrl2, double y_ctrl2, - double x_to, double y_to); - - - void end_poly(unsigned flags = path_flags_close); - void close_polygon(unsigned flags = path_flags_none); - - // Accessors - //-------------------------------------------------------------------- - const container_type& vertices() const { return m_vertices; } - container_type& vertices() { return m_vertices; } - - unsigned total_vertices() const; - - void rel_to_abs(double* x, double* y) const; - - unsigned last_vertex(double* x, double* y) const; - unsigned prev_vertex(double* x, double* y) const; - - double last_x() const; - double last_y() const; - - unsigned vertex(unsigned idx, double* x, double* y) const; - unsigned command(unsigned idx) const; - - void modify_vertex(unsigned idx, double x, double y); - void modify_vertex(unsigned idx, double x, double y, unsigned cmd); - void modify_command(unsigned idx, unsigned cmd); - - // VertexSource interface - //-------------------------------------------------------------------- - void rewind(unsigned path_id); - unsigned vertex(double* x, double* y); - - // Arrange the orientation of a polygon, all polygons in a path, - // or in all paths. After calling arrange_orientations() or - // arrange_orientations_all_paths(), all the polygons will have - // the same orientation, i.e. path_flags_cw or path_flags_ccw - //-------------------------------------------------------------------- - unsigned arrange_polygon_orientation(unsigned start, path_flags_e orientation); - unsigned arrange_orientations(unsigned path_id, path_flags_e orientation); - void arrange_orientations_all_paths(path_flags_e orientation); - void invert_polygon(unsigned start); - - // Flip all vertices horizontally or vertically, - // between x1 and x2, or between y1 and y2 respectively - //-------------------------------------------------------------------- - void flip_x(double x1, double x2); - void flip_y(double y1, double y2); - - // Concatenate path. The path is added as is. - //-------------------------------------------------------------------- - template - void concat_path(VertexSource& vs, unsigned path_id = 0) - { - double x=0; - double y=0; - unsigned cmd; - vs.rewind(path_id); - while(!is_stop(cmd = vs.vertex(&x, &y))) - { - m_vertices.add_vertex(x, y, cmd); - } - } - - //-------------------------------------------------------------------- - // 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) - template - void join_path(VertexSource& vs, unsigned path_id = 0) - { - double x=0.0, y=0.0; - unsigned cmd; - vs.rewind(path_id); - cmd = vs.vertex(&x, &y); - if(!is_stop(cmd)) - { - if(is_vertex(cmd)) + double x0, y0; + unsigned cmd0 = last_vertex(&x0, &y0); + if (is_vertex(cmd0)) { - double x0, y0; - unsigned cmd0 = last_vertex(&x0, &y0); - if(is_vertex(cmd0)) + if (calc_distance(x, y, x0, y0) > vertex_dist_epsilon) { - if(calc_distance(x, y, x0, y0) > vertex_dist_epsilon) - { - if(is_move_to(cmd)) cmd = path_cmd_line_to; - m_vertices.add_vertex(x, y, cmd); - } - } - else - { - if(is_stop(cmd0)) - { - cmd = path_cmd_move_to; - } - else - { - if(is_move_to(cmd)) cmd = path_cmd_line_to; - } + if (is_move_to(cmd)) + cmd = path_cmd_line_to; m_vertices.add_vertex(x, y, cmd); } } - while(!is_stop(cmd = vs.vertex(&x, &y))) + else { - m_vertices.add_vertex(x, y, is_move_to(cmd) ? - unsigned(path_cmd_line_to) : - cmd); + if (is_stop(cmd0)) + { + cmd = path_cmd_move_to; + } + else + { + if (is_move_to(cmd)) + cmd = path_cmd_line_to; + } + m_vertices.add_vertex(x, y, cmd); } } - } - - // Concatenate polygon/polyline. - //-------------------------------------------------------------------- - template void concat_poly(const T* data, - unsigned num_points, - bool closed) - { - poly_plain_adaptor poly(data, num_points, closed); - concat_path(poly); - } - - // Join polygon/polyline continuously. - //-------------------------------------------------------------------- - template void join_poly(const T* data, - unsigned num_points, - bool closed) - { - poly_plain_adaptor poly(data, num_points, closed); - join_path(poly); - } - - //-------------------------------------------------------------------- - void translate(double dx, double dy, unsigned path_id=0); - void translate_all_paths(double dx, double dy); - - //-------------------------------------------------------------------- - template - void transform(const Trans& trans, unsigned path_id=0) - { - unsigned num_ver = m_vertices.total_vertices(); - for(; path_id < num_ver; path_id++) + while (!is_stop(cmd = vs.vertex(&x, &y))) { - double x, y; - unsigned cmd = m_vertices.vertex(path_id, &x, &y); - if(is_stop(cmd)) break; - if(is_vertex(cmd)) - { - trans.transform(&x, &y); - m_vertices.modify_vertex(path_id, x, y); - } - } - } - - //-------------------------------------------------------------------- - template - void transform_all_paths(const Trans& trans) - { - unsigned idx; - unsigned num_ver = m_vertices.total_vertices(); - for(idx = 0; idx < num_ver; idx++) - { - double x, y; - if(is_vertex(m_vertices.vertex(idx, &x, &y))) - { - trans.transform(&x, &y); - m_vertices.modify_vertex(idx, x, y); - } - } - } - - - - private: - unsigned perceive_polygon_orientation(unsigned start, unsigned end); - void invert_polygon(unsigned start, unsigned end); - - VertexContainer m_vertices; - unsigned m_iterator; - }; - - //------------------------------------------------------------------------ - template - unsigned path_base::start_new_path() - { - if(!is_stop(m_vertices.last_command())) - { - m_vertices.add_vertex(0.0, 0.0, path_cmd_stop); - } - return m_vertices.total_vertices(); - } - - - //------------------------------------------------------------------------ - template - inline void path_base::rel_to_abs(double* x, double* y) const - { - if(m_vertices.total_vertices()) - { - double x2; - double y2; - if(is_vertex(m_vertices.last_vertex(&x2, &y2))) - { - *x += x2; - *y += y2; - } - else if (!is_stop(m_vertices.last_command()) && - is_vertex(m_vertices.prev_vertex(&x2, &y2))) - { - *x += x2; - *y += y2; + m_vertices.add_vertex(x, y, is_move_to(cmd) ? unsigned(path_cmd_line_to) : cmd); } } } - //------------------------------------------------------------------------ - template - inline void path_base::move_to(double x, double y) + // Concatenate polygon/polyline. + //-------------------------------------------------------------------- + template + void concat_poly(const T* data, unsigned num_points, bool closed) { - m_vertices.add_vertex(x, y, path_cmd_move_to); + poly_plain_adaptor poly(data, num_points, closed); + concat_path(poly); } - //------------------------------------------------------------------------ - template - inline void path_base::move_rel(double dx, double dy) + // Join polygon/polyline continuously. + //-------------------------------------------------------------------- + template + void join_poly(const T* data, unsigned num_points, bool closed) { - rel_to_abs(&dx, &dy); - m_vertices.add_vertex(dx, dy, path_cmd_move_to); + poly_plain_adaptor poly(data, num_points, closed); + join_path(poly); } - //------------------------------------------------------------------------ - template - inline void path_base::line_to(double x, double y) - { - m_vertices.add_vertex(x, y, path_cmd_line_to); - } + //-------------------------------------------------------------------- + void translate(double dx, double dy, unsigned path_id = 0); + void translate_all_paths(double dx, double dy); - //------------------------------------------------------------------------ - template - inline void path_base::line_rel(double dx, double dy) - { - rel_to_abs(&dx, &dy); - m_vertices.add_vertex(dx, dy, path_cmd_line_to); - } - - //------------------------------------------------------------------------ - template - inline void path_base::hline_to(double x) - { - m_vertices.add_vertex(x, last_y(), path_cmd_line_to); - } - - //------------------------------------------------------------------------ - template - inline void path_base::hline_rel(double dx) - { - double dy = 0; - rel_to_abs(&dx, &dy); - m_vertices.add_vertex(dx, dy, path_cmd_line_to); - } - - //------------------------------------------------------------------------ - template - inline void path_base::vline_to(double y) - { - m_vertices.add_vertex(last_x(), y, path_cmd_line_to); - } - - //------------------------------------------------------------------------ - template - inline void path_base::vline_rel(double dy) - { - double dx = 0; - rel_to_abs(&dx, &dy); - m_vertices.add_vertex(dx, dy, path_cmd_line_to); - } - - //------------------------------------------------------------------------ - template - void path_base::arc_to(double rx, double ry, - double angle, - bool large_arc_flag, - bool sweep_flag, - double x, double y) - { - if(m_vertices.total_vertices() && is_vertex(m_vertices.last_command())) - { - const double epsilon = 1e-30; - double x0 = 0.0; - double y0 = 0.0; - m_vertices.last_vertex(&x0, &y0); - - rx = std::fabs(rx); - ry = std::fabs(ry); - - // Ensure radii are valid - //------------------------- - if(rx < epsilon || ry < epsilon) - { - line_to(x, y); - return; - } - - if(calc_distance(x0, y0, x, y) < epsilon) - { - // If the endpoints (x, y) and (x0, y0) are identical, then this - // is equivalent to omitting the elliptical arc segment entirely. - return; - } - bezier_arc_svg a(x0, y0, rx, ry, angle, large_arc_flag, sweep_flag, x, y); - if(a.radii_ok()) - { - join_path(a); - } - else - { - line_to(x, y); - } - } - else - { - move_to(x, y); - } - } - - //------------------------------------------------------------------------ - template - void path_base::arc_rel(double rx, double ry, - double angle, - bool large_arc_flag, - bool sweep_flag, - double dx, double dy) - { - rel_to_abs(&dx, &dy); - arc_to(rx, ry, angle, large_arc_flag, sweep_flag, dx, dy); - } - - //------------------------------------------------------------------------ - template - void path_base::curve3(double x_ctrl, double y_ctrl, - double x_to, double y_to) - { - m_vertices.add_vertex(x_ctrl, y_ctrl, path_cmd_curve3); - m_vertices.add_vertex(x_to, y_to, path_cmd_curve3); - } - - //------------------------------------------------------------------------ - template - void path_base::curve3_rel(double dx_ctrl, double dy_ctrl, - double dx_to, double dy_to) - { - rel_to_abs(&dx_ctrl, &dy_ctrl); - rel_to_abs(&dx_to, &dy_to); - m_vertices.add_vertex(dx_ctrl, dy_ctrl, path_cmd_curve3); - m_vertices.add_vertex(dx_to, dy_to, path_cmd_curve3); - } - - //------------------------------------------------------------------------ - template - void path_base::curve3(double x_to, double y_to) - { - double x0; - double y0; - if(is_vertex(m_vertices.last_vertex(&x0, &y0))) - { - double x_ctrl; - double y_ctrl; - unsigned cmd = m_vertices.prev_vertex(&x_ctrl, &y_ctrl); - if(is_curve(cmd)) - { - x_ctrl = x0 + x0 - x_ctrl; - y_ctrl = y0 + y0 - y_ctrl; - } - else - { - x_ctrl = x0; - y_ctrl = y0; - } - curve3(x_ctrl, y_ctrl, x_to, y_to); - } - } - - //------------------------------------------------------------------------ - template - void path_base::curve3_rel(double dx_to, double dy_to) - { - rel_to_abs(&dx_to, &dy_to); - curve3(dx_to, dy_to); - } - - //------------------------------------------------------------------------ - template - void path_base::curve4(double x_ctrl1, double y_ctrl1, - double x_ctrl2, double y_ctrl2, - double x_to, double y_to) - { - m_vertices.add_vertex(x_ctrl1, y_ctrl1, path_cmd_curve4); - m_vertices.add_vertex(x_ctrl2, y_ctrl2, path_cmd_curve4); - m_vertices.add_vertex(x_to, y_to, path_cmd_curve4); - } - - //------------------------------------------------------------------------ - template - void path_base::curve4_rel(double dx_ctrl1, double dy_ctrl1, - double dx_ctrl2, double dy_ctrl2, - double dx_to, double dy_to) - { - rel_to_abs(&dx_ctrl1, &dy_ctrl1); - rel_to_abs(&dx_ctrl2, &dy_ctrl2); - rel_to_abs(&dx_to, &dy_to); - m_vertices.add_vertex(dx_ctrl1, dy_ctrl1, path_cmd_curve4); - m_vertices.add_vertex(dx_ctrl2, dy_ctrl2, path_cmd_curve4); - m_vertices.add_vertex(dx_to, dy_to, path_cmd_curve4); - } - - //------------------------------------------------------------------------ - template - void path_base::curve4(double x_ctrl2, double y_ctrl2, - double x_to, double y_to) - { - double x0; - double y0; - if(is_vertex(last_vertex(&x0, &y0))) - { - double x_ctrl1; - double y_ctrl1; - unsigned cmd = prev_vertex(&x_ctrl1, &y_ctrl1); - if(is_curve(cmd)) - { - x_ctrl1 = x0 + x0 - x_ctrl1; - y_ctrl1 = y0 + y0 - y_ctrl1; - } - else - { - x_ctrl1 = x0; - y_ctrl1 = y0; - } - curve4(x_ctrl1, y_ctrl1, x_ctrl2, y_ctrl2, x_to, y_to); - } - } - - //------------------------------------------------------------------------ - template - void path_base::curve4_rel(double dx_ctrl2, double dy_ctrl2, - double dx_to, double dy_to) - { - rel_to_abs(&dx_ctrl2, &dy_ctrl2); - rel_to_abs(&dx_to, &dy_to); - curve4(dx_ctrl2, dy_ctrl2, dx_to, dy_to); - } - - //------------------------------------------------------------------------ - template - inline void path_base::end_poly(unsigned flags) - { - if(is_vertex(m_vertices.last_command())) - { - m_vertices.add_vertex(0.0, 0.0, path_cmd_end_poly | flags); - } - } - - //------------------------------------------------------------------------ - template - inline void path_base::close_polygon(unsigned flags) - { - end_poly(path_flags_close | flags); - } - - //------------------------------------------------------------------------ - template - inline unsigned path_base::total_vertices() const - { - return m_vertices.total_vertices(); - } - - //------------------------------------------------------------------------ - template - inline unsigned path_base::last_vertex(double* x, double* y) const - { - return m_vertices.last_vertex(x, y); - } - - //------------------------------------------------------------------------ - template - inline unsigned path_base::prev_vertex(double* x, double* y) const - { - return m_vertices.prev_vertex(x, y); - } - - //------------------------------------------------------------------------ - template - inline double path_base::last_x() const - { - return m_vertices.last_x(); - } - - //------------------------------------------------------------------------ - template - inline double path_base::last_y() const - { - return m_vertices.last_y(); - } - - //------------------------------------------------------------------------ - template - inline unsigned path_base::vertex(unsigned idx, double* x, double* y) const - { - return m_vertices.vertex(idx, x, y); - } - - //------------------------------------------------------------------------ - template - inline unsigned path_base::command(unsigned idx) const - { - return m_vertices.command(idx); - } - - //------------------------------------------------------------------------ - template - void path_base::modify_vertex(unsigned idx, double x, double y) - { - m_vertices.modify_vertex(idx, x, y); - } - - //------------------------------------------------------------------------ - template - void path_base::modify_vertex(unsigned idx, double x, double y, unsigned cmd) - { - m_vertices.modify_vertex(idx, x, y, cmd); - } - - //------------------------------------------------------------------------ - template - void path_base::modify_command(unsigned idx, unsigned cmd) - { - m_vertices.modify_command(idx, cmd); - } - - //------------------------------------------------------------------------ - template - inline void path_base::rewind(unsigned path_id) - { - m_iterator = path_id; - } - - //------------------------------------------------------------------------ - template - inline unsigned path_base::vertex(double* x, double* y) - { - if(m_iterator >= m_vertices.total_vertices()) return path_cmd_stop; - return m_vertices.vertex(m_iterator++, x, y); - } - - //------------------------------------------------------------------------ - template - unsigned path_base::perceive_polygon_orientation(unsigned start, - unsigned end) - { - // Calculate signed area (double area to be exact) - //--------------------- - unsigned np = end - start; - double area = 0.0; - unsigned i; - for(i = 0; i < np; i++) - { - double x1, y1, x2, y2; - m_vertices.vertex(start + i, &x1, &y1); - m_vertices.vertex(start + (i + 1) % np, &x2, &y2); - area += x1 * y2 - y1 * x2; - } - return (area < 0.0) ? path_flags_cw : path_flags_ccw; - } - - //------------------------------------------------------------------------ - template - void path_base::invert_polygon(unsigned start, unsigned end) - { - unsigned i; - unsigned tmp_cmd = m_vertices.command(start); - - --end; // Make "end" inclusive - - // Shift all commands to one position - for(i = start; i < end; i++) - { - m_vertices.modify_command(i, m_vertices.command(i + 1)); - } - - // Assign starting command to the ending command - m_vertices.modify_command(end, tmp_cmd); - - // Reverse the polygon - while(end > start) - { - m_vertices.swap_vertices(start++, end--); - } - } - - //------------------------------------------------------------------------ - template - void path_base::invert_polygon(unsigned start) - { - // Skip all non-vertices at the beginning - while(start < m_vertices.total_vertices() && - !is_vertex(m_vertices.command(start))) ++start; - - // Skip all insignificant move_to - while(start+1 < m_vertices.total_vertices() && - is_move_to(m_vertices.command(start)) && - is_move_to(m_vertices.command(start+1))) ++start; - - // Find the last vertex - unsigned end = start + 1; - while(end < m_vertices.total_vertices() && - !is_next_poly(m_vertices.command(end))) ++end; - - invert_polygon(start, end); - } - - //------------------------------------------------------------------------ - template - unsigned path_base::arrange_polygon_orientation(unsigned start, - path_flags_e orientation) - { - if(orientation == path_flags_none) return start; - - // Skip all non-vertices at the beginning - while(start < m_vertices.total_vertices() && - !is_vertex(m_vertices.command(start))) ++start; - - // Skip all insignificant move_to - while(start+1 < m_vertices.total_vertices() && - is_move_to(m_vertices.command(start)) && - is_move_to(m_vertices.command(start+1))) ++start; - - // Find the last vertex - unsigned end = start + 1; - while(end < m_vertices.total_vertices() && - !is_next_poly(m_vertices.command(end))) ++end; - - if(end - start > 2) - { - if(perceive_polygon_orientation(start, end) != unsigned(orientation)) - { - // Invert polygon, set orientation flag, and skip all end_poly - invert_polygon(start, end); - unsigned cmd; - while(end < m_vertices.total_vertices() && - is_end_poly(cmd = m_vertices.command(end))) - { - m_vertices.modify_command(end++, set_orientation(cmd, orientation)); - } - } - } - return end; - } - - //------------------------------------------------------------------------ - template - unsigned path_base::arrange_orientations(unsigned start, - path_flags_e orientation) - { - if(orientation != path_flags_none) - { - while(start < m_vertices.total_vertices()) - { - start = arrange_polygon_orientation(start, orientation); - if(is_stop(m_vertices.command(start))) - { - ++start; - break; - } - } - } - return start; - } - - //------------------------------------------------------------------------ - template - void path_base::arrange_orientations_all_paths(path_flags_e orientation) - { - if(orientation != path_flags_none) - { - unsigned start = 0; - while(start < m_vertices.total_vertices()) - { - start = arrange_orientations(start, orientation); - } - } - } - - //------------------------------------------------------------------------ - template - void path_base::flip_x(double x1, double x2) - { - unsigned i; - double x, y; - for(i = 0; i < m_vertices.total_vertices(); i++) - { - unsigned cmd = m_vertices.vertex(i, &x, &y); - if(is_vertex(cmd)) - { - m_vertices.modify_vertex(i, x2 - x + x1, y); - } - } - } - - //------------------------------------------------------------------------ - template - void path_base::flip_y(double y1, double y2) - { - unsigned i; - double x, y; - for(i = 0; i < m_vertices.total_vertices(); i++) - { - unsigned cmd = m_vertices.vertex(i, &x, &y); - if(is_vertex(cmd)) - { - m_vertices.modify_vertex(i, x, y2 - y + y1); - } - } - } - - //------------------------------------------------------------------------ - template - void path_base::translate(double dx, double dy, unsigned path_id) + //-------------------------------------------------------------------- + template + void transform(const Trans& trans, unsigned path_id = 0) { unsigned num_ver = m_vertices.total_vertices(); - for(; path_id < num_ver; path_id++) + for (; path_id < num_ver; path_id++) { double x, y; unsigned cmd = m_vertices.vertex(path_id, &x, &y); - if(is_stop(cmd)) break; - if(is_vertex(cmd)) + if (is_stop(cmd)) + break; + if (is_vertex(cmd)) { - x += dx; - y += dy; + trans.transform(&x, &y); m_vertices.modify_vertex(path_id, x, y); } } } - //------------------------------------------------------------------------ - template - void path_base::translate_all_paths(double dx, double dy) + //-------------------------------------------------------------------- + template + void transform_all_paths(const Trans& trans) { unsigned idx; unsigned num_ver = m_vertices.total_vertices(); - for(idx = 0; idx < num_ver; idx++) + for (idx = 0; idx < num_ver; idx++) { double x, y; - if(is_vertex(m_vertices.vertex(idx, &x, &y))) + if (is_vertex(m_vertices.vertex(idx, &x, &y))) { - x += dx; - y += dy; + trans.transform(&x, &y); m_vertices.modify_vertex(idx, x, y); } } } -//////////////////////////////////////////////////////////////////////////////// + private: + unsigned perceive_polygon_orientation(unsigned start, unsigned end); + void invert_polygon(unsigned start, unsigned end); + VertexContainer m_vertices; + unsigned m_iterator; +}; - - //-----------------------------------------------------vertex_stl_storage - template class vertex_stl_storage +//------------------------------------------------------------------------ +template +unsigned path_base::start_new_path() +{ + if (!is_stop(m_vertices.last_command())) { - public: - typedef typename Container::value_type vertex_type; - typedef typename vertex_type::value_type value_type; - - void remove_all() { m_vertices.clear(); } - void free_all() { m_vertices.clear(); } - - void add_vertex(double x, double y, unsigned cmd) - { - m_vertices.push_back(vertex_type(value_type(x), - value_type(y), - int8u(cmd))); - } - - void modify_vertex(unsigned idx, double x, double y) - { - vertex_type& v = m_vertices[idx]; - v.x = value_type(x); - v.y = value_type(y); - } - - void modify_vertex(unsigned idx, double x, double y, unsigned cmd) - { - vertex_type& v = m_vertices[idx]; - v.x = value_type(x); - v.y = value_type(y); - v.cmd = int8u(cmd); - } - - void modify_command(unsigned idx, unsigned cmd) - { - m_vertices[idx].cmd = int8u(cmd); - } - - void swap_vertices(unsigned v1, unsigned v2) - { - vertex_type t = m_vertices[v1]; - m_vertices[v1] = m_vertices[v2]; - m_vertices[v2] = t; - } - - unsigned last_command() const - { - return m_vertices.size() ? - m_vertices[m_vertices.size() - 1].cmd : - path_cmd_stop; - } - - unsigned last_vertex(double* x, double* y) const - { - if(m_vertices.size() == 0) - { - *x = *y = 0.0; - return path_cmd_stop; - } - return vertex(m_vertices.size() - 1, x, y); - } - - unsigned prev_vertex(double* x, double* y) const - { - if(m_vertices.size() < 2) - { - *x = *y = 0.0; - return path_cmd_stop; - } - return vertex(m_vertices.size() - 2, x, y); - } - - double last_x() const - { - return m_vertices.size() ? m_vertices[m_vertices.size() - 1].x : 0.0; - } - - double last_y() const - { - return m_vertices.size() ? m_vertices[m_vertices.size() - 1].y : 0.0; - } - - unsigned total_vertices() const - { - return m_vertices.size(); - } - - unsigned vertex(unsigned idx, double* x, double* y) const - { - const vertex_type& v = m_vertices[idx]; - *x = v.x; - *y = v.y; - return v.cmd; - } - - unsigned command(unsigned idx) const - { - return m_vertices[idx].cmd; - } - - private: - Container m_vertices; - }; - - //-----------------------------------------------------------path_storage - typedef path_base > path_storage; - - // Example of declarations path_storage with pod_bvector as a container - //----------------------------------------------------------------------- - //typedef path_base > > path_storage; - + m_vertices.add_vertex(0.0, 0.0, path_cmd_stop); + } + return m_vertices.total_vertices(); } +//------------------------------------------------------------------------ +template +inline void path_base::rel_to_abs(double* x, double* y) const +{ + if (m_vertices.total_vertices()) + { + double x2; + double y2; + if (is_vertex(m_vertices.last_vertex(&x2, &y2))) + { + *x += x2; + *y += y2; + } + else if (!is_stop(m_vertices.last_command()) && is_vertex(m_vertices.prev_vertex(&x2, &y2))) + { + *x += x2; + *y += y2; + } + } +} +//------------------------------------------------------------------------ +template +inline void path_base::move_to(double x, double y) +{ + m_vertices.add_vertex(x, y, path_cmd_move_to); +} + +//------------------------------------------------------------------------ +template +inline void path_base::move_rel(double dx, double dy) +{ + rel_to_abs(&dx, &dy); + m_vertices.add_vertex(dx, dy, path_cmd_move_to); +} + +//------------------------------------------------------------------------ +template +inline void path_base::line_to(double x, double y) +{ + m_vertices.add_vertex(x, y, path_cmd_line_to); +} + +//------------------------------------------------------------------------ +template +inline void path_base::line_rel(double dx, double dy) +{ + rel_to_abs(&dx, &dy); + m_vertices.add_vertex(dx, dy, path_cmd_line_to); +} + +//------------------------------------------------------------------------ +template +inline void path_base::hline_to(double x) +{ + m_vertices.add_vertex(x, last_y(), path_cmd_line_to); +} + +//------------------------------------------------------------------------ +template +inline void path_base::hline_rel(double dx) +{ + double dy = 0; + rel_to_abs(&dx, &dy); + m_vertices.add_vertex(dx, dy, path_cmd_line_to); +} + +//------------------------------------------------------------------------ +template +inline void path_base::vline_to(double y) +{ + m_vertices.add_vertex(last_x(), y, path_cmd_line_to); +} + +//------------------------------------------------------------------------ +template +inline void path_base::vline_rel(double dy) +{ + double dx = 0; + rel_to_abs(&dx, &dy); + m_vertices.add_vertex(dx, dy, path_cmd_line_to); +} + +//------------------------------------------------------------------------ +template +void path_base::arc_to(double rx, double ry, double angle, bool large_arc_flag, bool sweep_flag, double x, double y) +{ + if (m_vertices.total_vertices() && is_vertex(m_vertices.last_command())) + { + const double epsilon = 1e-30; + double x0 = 0.0; + double y0 = 0.0; + m_vertices.last_vertex(&x0, &y0); + + rx = std::fabs(rx); + ry = std::fabs(ry); + + // Ensure radii are valid + //------------------------- + if (rx < epsilon || ry < epsilon) + { + line_to(x, y); + return; + } + + if (calc_distance(x0, y0, x, y) < epsilon) + { + // If the endpoints (x, y) and (x0, y0) are identical, then this + // is equivalent to omitting the elliptical arc segment entirely. + return; + } + bezier_arc_svg a(x0, y0, rx, ry, angle, large_arc_flag, sweep_flag, x, y); + if (a.radii_ok()) + { + join_path(a); + } + else + { + line_to(x, y); + } + } + else + { + move_to(x, y); + } +} + +//------------------------------------------------------------------------ +template +void path_base::arc_rel(double rx, + double ry, + double angle, + bool large_arc_flag, + bool sweep_flag, + double dx, + double dy) +{ + rel_to_abs(&dx, &dy); + arc_to(rx, ry, angle, large_arc_flag, sweep_flag, dx, dy); +} + +//------------------------------------------------------------------------ +template +void path_base::curve3(double x_ctrl, double y_ctrl, double x_to, double y_to) +{ + m_vertices.add_vertex(x_ctrl, y_ctrl, path_cmd_curve3); + m_vertices.add_vertex(x_to, y_to, path_cmd_curve3); +} + +//------------------------------------------------------------------------ +template +void path_base::curve3_rel(double dx_ctrl, double dy_ctrl, double dx_to, double dy_to) +{ + rel_to_abs(&dx_ctrl, &dy_ctrl); + rel_to_abs(&dx_to, &dy_to); + m_vertices.add_vertex(dx_ctrl, dy_ctrl, path_cmd_curve3); + m_vertices.add_vertex(dx_to, dy_to, path_cmd_curve3); +} + +//------------------------------------------------------------------------ +template +void path_base::curve3(double x_to, double y_to) +{ + double x0; + double y0; + if (is_vertex(m_vertices.last_vertex(&x0, &y0))) + { + double x_ctrl; + double y_ctrl; + unsigned cmd = m_vertices.prev_vertex(&x_ctrl, &y_ctrl); + if (is_curve(cmd)) + { + x_ctrl = x0 + x0 - x_ctrl; + y_ctrl = y0 + y0 - y_ctrl; + } + else + { + x_ctrl = x0; + y_ctrl = y0; + } + curve3(x_ctrl, y_ctrl, x_to, y_to); + } +} + +//------------------------------------------------------------------------ +template +void path_base::curve3_rel(double dx_to, double dy_to) +{ + rel_to_abs(&dx_to, &dy_to); + curve3(dx_to, dy_to); +} + +//------------------------------------------------------------------------ +template +void path_base::curve4(double x_ctrl1, double y_ctrl1, double x_ctrl2, double y_ctrl2, double x_to, double y_to) +{ + m_vertices.add_vertex(x_ctrl1, y_ctrl1, path_cmd_curve4); + m_vertices.add_vertex(x_ctrl2, y_ctrl2, path_cmd_curve4); + m_vertices.add_vertex(x_to, y_to, path_cmd_curve4); +} + +//------------------------------------------------------------------------ +template +void path_base::curve4_rel(double dx_ctrl1, + double dy_ctrl1, + double dx_ctrl2, + double dy_ctrl2, + double dx_to, + double dy_to) +{ + rel_to_abs(&dx_ctrl1, &dy_ctrl1); + rel_to_abs(&dx_ctrl2, &dy_ctrl2); + rel_to_abs(&dx_to, &dy_to); + m_vertices.add_vertex(dx_ctrl1, dy_ctrl1, path_cmd_curve4); + m_vertices.add_vertex(dx_ctrl2, dy_ctrl2, path_cmd_curve4); + m_vertices.add_vertex(dx_to, dy_to, path_cmd_curve4); +} + +//------------------------------------------------------------------------ +template +void path_base::curve4(double x_ctrl2, double y_ctrl2, double x_to, double y_to) +{ + double x0; + double y0; + if (is_vertex(last_vertex(&x0, &y0))) + { + double x_ctrl1; + double y_ctrl1; + unsigned cmd = prev_vertex(&x_ctrl1, &y_ctrl1); + if (is_curve(cmd)) + { + x_ctrl1 = x0 + x0 - x_ctrl1; + y_ctrl1 = y0 + y0 - y_ctrl1; + } + else + { + x_ctrl1 = x0; + y_ctrl1 = y0; + } + curve4(x_ctrl1, y_ctrl1, x_ctrl2, y_ctrl2, x_to, y_to); + } +} + +//------------------------------------------------------------------------ +template +void path_base::curve4_rel(double dx_ctrl2, double dy_ctrl2, double dx_to, double dy_to) +{ + rel_to_abs(&dx_ctrl2, &dy_ctrl2); + rel_to_abs(&dx_to, &dy_to); + curve4(dx_ctrl2, dy_ctrl2, dx_to, dy_to); +} + +//------------------------------------------------------------------------ +template +inline void path_base::end_poly(unsigned flags) +{ + if (is_vertex(m_vertices.last_command())) + { + m_vertices.add_vertex(0.0, 0.0, path_cmd_end_poly | flags); + } +} + +//------------------------------------------------------------------------ +template +inline void path_base::close_polygon(unsigned flags) +{ + end_poly(path_flags_close | flags); +} + +//------------------------------------------------------------------------ +template +inline unsigned path_base::total_vertices() const +{ + return m_vertices.total_vertices(); +} + +//------------------------------------------------------------------------ +template +inline unsigned path_base::last_vertex(double* x, double* y) const +{ + return m_vertices.last_vertex(x, y); +} + +//------------------------------------------------------------------------ +template +inline unsigned path_base::prev_vertex(double* x, double* y) const +{ + return m_vertices.prev_vertex(x, y); +} + +//------------------------------------------------------------------------ +template +inline double path_base::last_x() const +{ + return m_vertices.last_x(); +} + +//------------------------------------------------------------------------ +template +inline double path_base::last_y() const +{ + return m_vertices.last_y(); +} + +//------------------------------------------------------------------------ +template +inline unsigned path_base::vertex(unsigned idx, double* x, double* y) const +{ + return m_vertices.vertex(idx, x, y); +} + +//------------------------------------------------------------------------ +template +inline unsigned path_base::command(unsigned idx) const +{ + return m_vertices.command(idx); +} + +//------------------------------------------------------------------------ +template +void path_base::modify_vertex(unsigned idx, double x, double y) +{ + m_vertices.modify_vertex(idx, x, y); +} + +//------------------------------------------------------------------------ +template +void path_base::modify_vertex(unsigned idx, double x, double y, unsigned cmd) +{ + m_vertices.modify_vertex(idx, x, y, cmd); +} + +//------------------------------------------------------------------------ +template +void path_base::modify_command(unsigned idx, unsigned cmd) +{ + m_vertices.modify_command(idx, cmd); +} + +//------------------------------------------------------------------------ +template +inline void path_base::rewind(unsigned path_id) +{ + m_iterator = path_id; +} + +//------------------------------------------------------------------------ +template +inline unsigned path_base::vertex(double* x, double* y) +{ + if (m_iterator >= m_vertices.total_vertices()) + return path_cmd_stop; + return m_vertices.vertex(m_iterator++, x, y); +} + +//------------------------------------------------------------------------ +template +unsigned path_base::perceive_polygon_orientation(unsigned start, unsigned end) +{ + // Calculate signed area (double area to be exact) + //--------------------- + unsigned np = end - start; + double area = 0.0; + unsigned i; + for (i = 0; i < np; i++) + { + double x1, y1, x2, y2; + m_vertices.vertex(start + i, &x1, &y1); + m_vertices.vertex(start + (i + 1) % np, &x2, &y2); + area += x1 * y2 - y1 * x2; + } + return (area < 0.0) ? path_flags_cw : path_flags_ccw; +} + +//------------------------------------------------------------------------ +template +void path_base::invert_polygon(unsigned start, unsigned end) +{ + unsigned i; + unsigned tmp_cmd = m_vertices.command(start); + + --end; // Make "end" inclusive + + // Shift all commands to one position + for (i = start; i < end; i++) + { + m_vertices.modify_command(i, m_vertices.command(i + 1)); + } + + // Assign starting command to the ending command + m_vertices.modify_command(end, tmp_cmd); + + // Reverse the polygon + while (end > start) + { + m_vertices.swap_vertices(start++, end--); + } +} + +//------------------------------------------------------------------------ +template +void path_base::invert_polygon(unsigned start) +{ + // Skip all non-vertices at the beginning + while (start < m_vertices.total_vertices() && !is_vertex(m_vertices.command(start))) + ++start; + + // Skip all insignificant move_to + while (start + 1 < m_vertices.total_vertices() && is_move_to(m_vertices.command(start)) && + is_move_to(m_vertices.command(start + 1))) + ++start; + + // Find the last vertex + unsigned end = start + 1; + while (end < m_vertices.total_vertices() && !is_next_poly(m_vertices.command(end))) + ++end; + + invert_polygon(start, end); +} + +//------------------------------------------------------------------------ +template +unsigned path_base::arrange_polygon_orientation(unsigned start, path_flags_e orientation) +{ + if (orientation == path_flags_none) + return start; + + // Skip all non-vertices at the beginning + while (start < m_vertices.total_vertices() && !is_vertex(m_vertices.command(start))) + ++start; + + // Skip all insignificant move_to + while (start + 1 < m_vertices.total_vertices() && is_move_to(m_vertices.command(start)) && + is_move_to(m_vertices.command(start + 1))) + ++start; + + // Find the last vertex + unsigned end = start + 1; + while (end < m_vertices.total_vertices() && !is_next_poly(m_vertices.command(end))) + ++end; + + if (end - start > 2) + { + if (perceive_polygon_orientation(start, end) != unsigned(orientation)) + { + // Invert polygon, set orientation flag, and skip all end_poly + invert_polygon(start, end); + unsigned cmd; + while (end < m_vertices.total_vertices() && is_end_poly(cmd = m_vertices.command(end))) + { + m_vertices.modify_command(end++, set_orientation(cmd, orientation)); + } + } + } + return end; +} + +//------------------------------------------------------------------------ +template +unsigned path_base::arrange_orientations(unsigned start, path_flags_e orientation) +{ + if (orientation != path_flags_none) + { + while (start < m_vertices.total_vertices()) + { + start = arrange_polygon_orientation(start, orientation); + if (is_stop(m_vertices.command(start))) + { + ++start; + break; + } + } + } + return start; +} + +//------------------------------------------------------------------------ +template +void path_base::arrange_orientations_all_paths(path_flags_e orientation) +{ + if (orientation != path_flags_none) + { + unsigned start = 0; + while (start < m_vertices.total_vertices()) + { + start = arrange_orientations(start, orientation); + } + } +} + +//------------------------------------------------------------------------ +template +void path_base::flip_x(double x1, double x2) +{ + unsigned i; + double x, y; + for (i = 0; i < m_vertices.total_vertices(); i++) + { + unsigned cmd = m_vertices.vertex(i, &x, &y); + if (is_vertex(cmd)) + { + m_vertices.modify_vertex(i, x2 - x + x1, y); + } + } +} + +//------------------------------------------------------------------------ +template +void path_base::flip_y(double y1, double y2) +{ + unsigned i; + double x, y; + for (i = 0; i < m_vertices.total_vertices(); i++) + { + unsigned cmd = m_vertices.vertex(i, &x, &y); + if (is_vertex(cmd)) + { + m_vertices.modify_vertex(i, x, y2 - y + y1); + } + } +} + +//------------------------------------------------------------------------ +template +void path_base::translate(double dx, double dy, unsigned path_id) +{ + unsigned num_ver = m_vertices.total_vertices(); + for (; path_id < num_ver; path_id++) + { + double x, y; + unsigned cmd = m_vertices.vertex(path_id, &x, &y); + if (is_stop(cmd)) + break; + if (is_vertex(cmd)) + { + x += dx; + y += dy; + m_vertices.modify_vertex(path_id, x, y); + } + } +} + +//------------------------------------------------------------------------ +template +void path_base::translate_all_paths(double dx, double dy) +{ + unsigned idx; + unsigned num_ver = m_vertices.total_vertices(); + for (idx = 0; idx < num_ver; idx++) + { + double x, y; + if (is_vertex(m_vertices.vertex(idx, &x, &y))) + { + x += dx; + y += dy; + m_vertices.modify_vertex(idx, x, y); + } + } +} + +//////////////////////////////////////////////////////////////////////////////// + +//-----------------------------------------------------vertex_stl_storage +template +class vertex_stl_storage +{ + public: + typedef typename Container::value_type vertex_type; + typedef typename vertex_type::value_type value_type; + + void remove_all() { m_vertices.clear(); } + void free_all() { m_vertices.clear(); } + + void add_vertex(double x, double y, unsigned cmd) + { + m_vertices.push_back(vertex_type(value_type(x), value_type(y), int8u(cmd))); + } + + void modify_vertex(unsigned idx, double x, double y) + { + vertex_type& v = m_vertices[idx]; + v.x = value_type(x); + v.y = value_type(y); + } + + void modify_vertex(unsigned idx, double x, double y, unsigned cmd) + { + vertex_type& v = m_vertices[idx]; + v.x = value_type(x); + v.y = value_type(y); + v.cmd = int8u(cmd); + } + + void modify_command(unsigned idx, unsigned cmd) { m_vertices[idx].cmd = int8u(cmd); } + + void swap_vertices(unsigned v1, unsigned v2) + { + vertex_type t = m_vertices[v1]; + m_vertices[v1] = m_vertices[v2]; + m_vertices[v2] = t; + } + + unsigned last_command() const { return m_vertices.size() ? m_vertices[m_vertices.size() - 1].cmd : path_cmd_stop; } + + unsigned last_vertex(double* x, double* y) const + { + if (m_vertices.size() == 0) + { + *x = *y = 0.0; + return path_cmd_stop; + } + return vertex(m_vertices.size() - 1, x, y); + } + + unsigned prev_vertex(double* x, double* y) const + { + if (m_vertices.size() < 2) + { + *x = *y = 0.0; + return path_cmd_stop; + } + return vertex(m_vertices.size() - 2, x, y); + } + + double last_x() const { return m_vertices.size() ? m_vertices[m_vertices.size() - 1].x : 0.0; } + + double last_y() const { return m_vertices.size() ? m_vertices[m_vertices.size() - 1].y : 0.0; } + + unsigned total_vertices() const { return m_vertices.size(); } + + unsigned vertex(unsigned idx, double* x, double* y) const + { + const vertex_type& v = m_vertices[idx]; + *x = v.x; + *y = v.y; + return v.cmd; + } + + unsigned command(unsigned idx) const { return m_vertices[idx].cmd; } + + private: + Container m_vertices; +}; + +//-----------------------------------------------------------path_storage +typedef path_base> path_storage; + +// Example of declarations path_storage with pod_bvector as a container +//----------------------------------------------------------------------- +// typedef path_base > > path_storage; + +} // namespace agg // Example of declarations path_storage with std::vector as a container //--------------------------------------------------------------------------- -//#include -//namespace agg -//{ -// typedef path_base > > path_storage; -//} - +//#include +// namespace agg +//{ +// typedef path_base > > path_storage; +//} #endif diff --git a/deps/agg/include/agg_path_storage_integer.h b/deps/agg/include/agg_path_storage_integer.h index fff35bb89..ddb7b7ed7 100644 --- a/deps/agg/include/agg_path_storage_integer.h +++ b/deps/agg/include/agg_path_storage_integer.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -19,277 +19,259 @@ #include #include "agg_array.h" -namespace agg +namespace agg { +//---------------------------------------------------------vertex_integer +template +struct vertex_integer { - //---------------------------------------------------------vertex_integer - template struct vertex_integer + enum path_cmd { cmd_move_to = 0, cmd_line_to = 1, cmd_curve3 = 2, cmd_curve4 = 3 }; + + enum coord_scale_e { coord_shift = CoordShift, coord_scale = 1 << coord_shift }; + + T x, y; + vertex_integer() {} + vertex_integer(T x_, T y_, unsigned flag) + : x(((x_ << 1) & ~1) | (flag & 1)) + , y(((y_ << 1) & ~1) | (flag >> 1)) + {} + + unsigned vertex(double* x_, double* y_, double dx = 0, double dy = 0, double scale = 1.0) const { - enum path_cmd + *x_ = dx + (double(x >> 1) / coord_scale) * scale; + *y_ = dy + (double(y >> 1) / coord_scale) * scale; + switch (((y & 1) << 1) | (x & 1)) { - cmd_move_to = 0, - cmd_line_to = 1, - cmd_curve3 = 2, - cmd_curve4 = 3 - }; + case cmd_move_to: + return path_cmd_move_to; + case cmd_line_to: + return path_cmd_line_to; + case cmd_curve3: + return path_cmd_curve3; + case cmd_curve4: + return path_cmd_curve4; + } + return path_cmd_stop; + } +}; - enum coord_scale_e +//---------------------------------------------------path_storage_integer +template +class path_storage_integer +{ + public: + typedef T value_type; + typedef vertex_integer vertex_integer_type; + + //-------------------------------------------------------------------- + path_storage_integer() + : m_storage() + , m_vertex_idx(0) + , m_closed(true) + {} + + //-------------------------------------------------------------------- + void remove_all() { m_storage.remove_all(); } + + //-------------------------------------------------------------------- + void move_to(T x, T y) { m_storage.add(vertex_integer_type(x, y, vertex_integer_type::cmd_move_to)); } + + //-------------------------------------------------------------------- + void line_to(T x, T y) { m_storage.add(vertex_integer_type(x, y, vertex_integer_type::cmd_line_to)); } + + //-------------------------------------------------------------------- + void curve3(T x_ctrl, T y_ctrl, T x_to, T y_to) + { + m_storage.add(vertex_integer_type(x_ctrl, y_ctrl, vertex_integer_type::cmd_curve3)); + m_storage.add(vertex_integer_type(x_to, y_to, vertex_integer_type::cmd_curve3)); + } + + //-------------------------------------------------------------------- + void curve4(T x_ctrl1, T y_ctrl1, T x_ctrl2, T y_ctrl2, T x_to, T y_to) + { + m_storage.add(vertex_integer_type(x_ctrl1, y_ctrl1, vertex_integer_type::cmd_curve4)); + m_storage.add(vertex_integer_type(x_ctrl2, y_ctrl2, vertex_integer_type::cmd_curve4)); + m_storage.add(vertex_integer_type(x_to, y_to, vertex_integer_type::cmd_curve4)); + } + + //-------------------------------------------------------------------- + void close_polygon() {} + + //-------------------------------------------------------------------- + unsigned size() const { return m_storage.size(); } + unsigned vertex(unsigned idx, double* x, double* y) const { return m_storage[idx].vertex(x, y); } + + //-------------------------------------------------------------------- + unsigned byte_size() const { return m_storage.size() * sizeof(vertex_integer_type); } + void serialize(int8u* ptr) const + { + unsigned i; + for (i = 0; i < m_storage.size(); i++) { - coord_shift = CoordShift, - coord_scale = 1 << coord_shift - }; + memcpy(ptr, &m_storage[i], sizeof(vertex_integer_type)); + ptr += sizeof(vertex_integer_type); + } + } - T x,y; - vertex_integer() {} - vertex_integer(T x_, T y_, unsigned flag) : - x(((x_ << 1) & ~1) | (flag & 1)), - y(((y_ << 1) & ~1) | (flag >> 1)) {} + //-------------------------------------------------------------------- + void rewind(unsigned) + { + m_vertex_idx = 0; + m_closed = true; + } - unsigned vertex(double* x_, double* y_, - double dx=0, double dy=0, - double scale=1.0) const + //-------------------------------------------------------------------- + unsigned vertex(double* x, double* y) + { + if (m_storage.size() < 2 || m_vertex_idx > m_storage.size()) { - *x_ = dx + (double(x >> 1) / coord_scale) * scale; - *y_ = dy + (double(y >> 1) / coord_scale) * scale; - switch(((y & 1) << 1) | (x & 1)) - { - case cmd_move_to: return path_cmd_move_to; - case cmd_line_to: return path_cmd_line_to; - case cmd_curve3: return path_cmd_curve3; - case cmd_curve4: return path_cmd_curve4; - } + *x = 0; + *y = 0; return path_cmd_stop; } - }; + if (m_vertex_idx == m_storage.size()) + { + *x = 0; + *y = 0; + ++m_vertex_idx; + return path_cmd_end_poly | path_flags_close; + } + unsigned cmd = m_storage[m_vertex_idx].vertex(x, y); + if (is_move_to(cmd) && !m_closed) + { + *x = 0; + *y = 0; + m_closed = true; + return path_cmd_end_poly | path_flags_close; + } + m_closed = false; + ++m_vertex_idx; + return cmd; + } - - //---------------------------------------------------path_storage_integer - template class path_storage_integer + //-------------------------------------------------------------------- + rect_d bounding_rect() const { - public: - typedef T value_type; - typedef vertex_integer vertex_integer_type; - - //-------------------------------------------------------------------- - path_storage_integer() : m_storage(), m_vertex_idx(0), m_closed(true) {} - - //-------------------------------------------------------------------- - void remove_all() { m_storage.remove_all(); } - - //-------------------------------------------------------------------- - void move_to(T x, T y) + rect_d bounds(1e100, 1e100, -1e100, -1e100); + if (m_storage.size() == 0) { - m_storage.add(vertex_integer_type(x, y, vertex_integer_type::cmd_move_to)); + bounds.x1 = bounds.y1 = bounds.x2 = bounds.y2 = 0.0; } - - //-------------------------------------------------------------------- - void line_to(T x, T y) - { - m_storage.add(vertex_integer_type(x, y, vertex_integer_type::cmd_line_to)); - } - - //-------------------------------------------------------------------- - void curve3(T x_ctrl, T y_ctrl, - T x_to, T y_to) - { - m_storage.add(vertex_integer_type(x_ctrl, y_ctrl, vertex_integer_type::cmd_curve3)); - m_storage.add(vertex_integer_type(x_to, y_to, vertex_integer_type::cmd_curve3)); - } - - //-------------------------------------------------------------------- - void curve4(T x_ctrl1, T y_ctrl1, - T x_ctrl2, T y_ctrl2, - T x_to, T y_to) - { - m_storage.add(vertex_integer_type(x_ctrl1, y_ctrl1, vertex_integer_type::cmd_curve4)); - m_storage.add(vertex_integer_type(x_ctrl2, y_ctrl2, vertex_integer_type::cmd_curve4)); - m_storage.add(vertex_integer_type(x_to, y_to, vertex_integer_type::cmd_curve4)); - } - - //-------------------------------------------------------------------- - void close_polygon() {} - - //-------------------------------------------------------------------- - unsigned size() const { return m_storage.size(); } - unsigned vertex(unsigned idx, double* x, double* y) const - { - return m_storage[idx].vertex(x, y); - } - - //-------------------------------------------------------------------- - unsigned byte_size() const { return m_storage.size() * sizeof(vertex_integer_type); } - void serialize(int8u* ptr) const + else { unsigned i; - for(i = 0; i < m_storage.size(); i++) + for (i = 0; i < m_storage.size(); i++) { - memcpy(ptr, &m_storage[i], sizeof(vertex_integer_type)); - ptr += sizeof(vertex_integer_type); + double x, y; + m_storage[i].vertex(&x, &y); + if (x < bounds.x1) + bounds.x1 = x; + if (y < bounds.y1) + bounds.y1 = y; + if (x > bounds.x2) + bounds.x2 = x; + if (y > bounds.y2) + bounds.y2 = y; } } + return bounds; + } - //-------------------------------------------------------------------- - void rewind(unsigned) - { - m_vertex_idx = 0; - m_closed = true; - } + private: + pod_bvector m_storage; + unsigned m_vertex_idx; + bool m_closed; +}; - //-------------------------------------------------------------------- - unsigned vertex(double* x, double* y) - { - if(m_storage.size() < 2 || m_vertex_idx > m_storage.size()) - { - *x = 0; - *y = 0; - return path_cmd_stop; - } - if(m_vertex_idx == m_storage.size()) - { - *x = 0; - *y = 0; - ++m_vertex_idx; - return path_cmd_end_poly | path_flags_close; - } - unsigned cmd = m_storage[m_vertex_idx].vertex(x, y); - if(is_move_to(cmd) && !m_closed) - { - *x = 0; - *y = 0; - m_closed = true; - return path_cmd_end_poly | path_flags_close; - } - m_closed = false; - ++m_vertex_idx; - return cmd; - } +//-----------------------------------------serialized_integer_path_adaptor +template +class serialized_integer_path_adaptor +{ + public: + typedef vertex_integer vertex_integer_type; - //-------------------------------------------------------------------- - rect_d bounding_rect() const - { - rect_d bounds(1e100, 1e100, -1e100, -1e100); - if(m_storage.size() == 0) - { - bounds.x1 = bounds.y1 = bounds.x2 = bounds.y2 = 0.0; - } - else - { - unsigned i; - for(i = 0; i < m_storage.size(); i++) - { - double x, y; - m_storage[i].vertex(&x, &y); - if(x < bounds.x1) bounds.x1 = x; - if(y < bounds.y1) bounds.y1 = y; - if(x > bounds.x2) bounds.x2 = x; - if(y > bounds.y2) bounds.y2 = y; - } - } - return bounds; - } + //-------------------------------------------------------------------- + serialized_integer_path_adaptor() + : m_data(0) + , m_end(0) + , m_ptr(0) + , m_dx(0.0) + , m_dy(0.0) + , m_scale(1.0) + , m_vertices(0) + {} - private: - pod_bvector m_storage; - unsigned m_vertex_idx; - bool m_closed; - }; + //-------------------------------------------------------------------- + serialized_integer_path_adaptor(const int8u* data, unsigned size, double dx, double dy) + : m_data(data) + , m_end(data + size) + , m_ptr(data) + , m_dx(dx) + , m_dy(dy) + , m_vertices(0) + {} - - - - //-----------------------------------------serialized_integer_path_adaptor - template class serialized_integer_path_adaptor + //-------------------------------------------------------------------- + void init(const int8u* data, unsigned size, double dx, double dy, double scale = 1.0) { - public: - typedef vertex_integer vertex_integer_type; + m_data = data; + m_end = data + size; + m_ptr = data; + m_dx = dx; + m_dy = dy; + m_scale = scale; + m_vertices = 0; + } - //-------------------------------------------------------------------- - serialized_integer_path_adaptor() : - m_data(0), - m_end(0), - m_ptr(0), - m_dx(0.0), - m_dy(0.0), - m_scale(1.0), - m_vertices(0) - {} + //-------------------------------------------------------------------- + void rewind(unsigned) + { + m_ptr = m_data; + m_vertices = 0; + } - //-------------------------------------------------------------------- - serialized_integer_path_adaptor(const int8u* data, unsigned size, - double dx, double dy) : - m_data(data), - m_end(data + size), - m_ptr(data), - m_dx(dx), - m_dy(dy), - m_vertices(0) - {} - - //-------------------------------------------------------------------- - void init(const int8u* data, unsigned size, - double dx, double dy, double scale=1.0) + //-------------------------------------------------------------------- + unsigned vertex(double* x, double* y) + { + if (m_data == 0 || m_ptr > m_end) { - m_data = data; - m_end = data + size; - m_ptr = data; - m_dx = dx; - m_dy = dy; - m_scale = scale; - m_vertices = 0; + *x = 0; + *y = 0; + return path_cmd_stop; } - - //-------------------------------------------------------------------- - void rewind(unsigned) - { - m_ptr = m_data; - m_vertices = 0; - } - - //-------------------------------------------------------------------- - unsigned vertex(double* x, double* y) + if (m_ptr == m_end) { - if(m_data == 0 || m_ptr > m_end) - { - *x = 0; - *y = 0; - return path_cmd_stop; - } - - if(m_ptr == m_end) - { - *x = 0; - *y = 0; - m_ptr += sizeof(vertex_integer_type); - return path_cmd_end_poly | path_flags_close; - } - - vertex_integer_type v; - memcpy(&v, m_ptr, sizeof(vertex_integer_type)); - unsigned cmd = v.vertex(x, y, m_dx, m_dy, m_scale); - if(is_move_to(cmd) && m_vertices > 2) - { - *x = 0; - *y = 0; - m_vertices = 0; - return path_cmd_end_poly | path_flags_close; - } - ++m_vertices; + *x = 0; + *y = 0; m_ptr += sizeof(vertex_integer_type); - return cmd; + return path_cmd_end_poly | path_flags_close; } - private: - const int8u* m_data; - const int8u* m_end; - const int8u* m_ptr; - double m_dx; - double m_dy; - double m_scale; - unsigned m_vertices; - }; + vertex_integer_type v; + memcpy(&v, m_ptr, sizeof(vertex_integer_type)); + unsigned cmd = v.vertex(x, y, m_dx, m_dy, m_scale); + if (is_move_to(cmd) && m_vertices > 2) + { + *x = 0; + *y = 0; + m_vertices = 0; + return path_cmd_end_poly | path_flags_close; + } + ++m_vertices; + m_ptr += sizeof(vertex_integer_type); + return cmd; + } -} + private: + const int8u* m_data; + const int8u* m_end; + const int8u* m_ptr; + double m_dx; + double m_dy; + double m_scale; + unsigned m_vertices; +}; +} // namespace agg #endif - diff --git a/deps/agg/include/agg_pattern_filters_rgba.h b/deps/agg/include/agg_pattern_filters_rgba.h index 9fb8afa6c..b052745b9 100644 --- a/deps/agg/include/agg_pattern_filters_rgba.h +++ b/deps/agg/include/agg_pattern_filters_rgba.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -19,104 +19,90 @@ #include "agg_line_aa_basics.h" #include "agg_color_rgba.h" +namespace agg { -namespace agg +//=======================================================pattern_filter_nn +template +struct pattern_filter_nn { + typedef ColorT color_type; + static unsigned dilation() { return 0; } - //=======================================================pattern_filter_nn - template struct pattern_filter_nn + static void AGG_INLINE pixel_low_res(color_type const* const* buf, color_type* p, int x, int y) { *p = buf[y][x]; } + + static void AGG_INLINE pixel_high_res(color_type const* const* buf, color_type* p, int x, int y) { - typedef ColorT color_type; - static unsigned dilation() { return 0; } + *p = buf[y >> line_subpixel_shift][x >> line_subpixel_shift]; + } +}; - static void AGG_INLINE pixel_low_res(color_type const* const* buf, - color_type* p, int x, int y) - { - *p = buf[y][x]; - } +typedef pattern_filter_nn pattern_filter_nn_rgba8; +typedef pattern_filter_nn pattern_filter_nn_rgba16; - static void AGG_INLINE pixel_high_res(color_type const* const* buf, - color_type* p, int x, int y) - { - *p = buf[y >> line_subpixel_shift] - [x >> line_subpixel_shift]; - } - }; +//===========================================pattern_filter_bilinear_rgba +template +struct pattern_filter_bilinear_rgba +{ + typedef ColorT color_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; - typedef pattern_filter_nn pattern_filter_nn_rgba8; - typedef pattern_filter_nn pattern_filter_nn_rgba16; + static unsigned dilation() { return 1; } + static AGG_INLINE void pixel_low_res(color_type const* const* buf, color_type* p, int x, int y) { *p = buf[y][x]; } - //===========================================pattern_filter_bilinear_rgba - template struct pattern_filter_bilinear_rgba + static AGG_INLINE void pixel_high_res(color_type const* const* buf, color_type* p, int x, int y) { - typedef ColorT color_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; + calc_type r, g, b, a; + r = g = b = a = line_subpixel_scale * line_subpixel_scale / 2; + calc_type weight; + int x_lr = x >> line_subpixel_shift; + int y_lr = y >> line_subpixel_shift; - static unsigned dilation() { return 1; } + x &= line_subpixel_mask; + y &= line_subpixel_mask; + const color_type* ptr = buf[y_lr] + x_lr; - static AGG_INLINE void pixel_low_res(color_type const* const* buf, - color_type* p, int x, int y) - { - *p = buf[y][x]; - } + weight = (line_subpixel_scale - x) * (line_subpixel_scale - y); + r += weight * ptr->r; + g += weight * ptr->g; + b += weight * ptr->b; + a += weight * ptr->a; - static AGG_INLINE void pixel_high_res(color_type const* const* buf, - color_type* p, int x, int y) - { - calc_type r, g, b, a; - r = g = b = a = line_subpixel_scale * line_subpixel_scale / 2; + ++ptr; - calc_type weight; - int x_lr = x >> line_subpixel_shift; - int y_lr = y >> line_subpixel_shift; + weight = x * (line_subpixel_scale - y); + r += weight * ptr->r; + g += weight * ptr->g; + b += weight * ptr->b; + a += weight * ptr->a; - x &= line_subpixel_mask; - y &= line_subpixel_mask; - const color_type* ptr = buf[y_lr] + x_lr; + ptr = buf[y_lr + 1] + x_lr; - weight = (line_subpixel_scale - x) * - (line_subpixel_scale - y); - r += weight * ptr->r; - g += weight * ptr->g; - b += weight * ptr->b; - a += weight * ptr->a; + weight = (line_subpixel_scale - x) * y; + r += weight * ptr->r; + g += weight * ptr->g; + b += weight * ptr->b; + a += weight * ptr->a; - ++ptr; + ++ptr; - weight = x * (line_subpixel_scale - y); - r += weight * ptr->r; - g += weight * ptr->g; - b += weight * ptr->b; - a += weight * ptr->a; + weight = x * y; + r += weight * ptr->r; + g += weight * ptr->g; + b += weight * ptr->b; + a += weight * ptr->a; - ptr = buf[y_lr + 1] + x_lr; + p->r = (value_type)(r >> line_subpixel_shift * 2); + p->g = (value_type)(g >> line_subpixel_shift * 2); + p->b = (value_type)(b >> line_subpixel_shift * 2); + p->a = (value_type)(a >> line_subpixel_shift * 2); + } +}; - weight = (line_subpixel_scale - x) * y; - r += weight * ptr->r; - g += weight * ptr->g; - b += weight * ptr->b; - a += weight * ptr->a; - - ++ptr; - - weight = x * y; - r += weight * ptr->r; - g += weight * ptr->g; - b += weight * ptr->b; - a += weight * ptr->a; - - p->r = (value_type)(r >> line_subpixel_shift * 2); - p->g = (value_type)(g >> line_subpixel_shift * 2); - p->b = (value_type)(b >> line_subpixel_shift * 2); - p->a = (value_type)(a >> line_subpixel_shift * 2); - } - }; - - typedef pattern_filter_bilinear_rgba pattern_filter_bilinear_rgba8; - typedef pattern_filter_bilinear_rgba pattern_filter_bilinear_rgba16; -} +typedef pattern_filter_bilinear_rgba pattern_filter_bilinear_rgba8; +typedef pattern_filter_bilinear_rgba pattern_filter_bilinear_rgba16; +} // namespace agg #endif diff --git a/deps/agg/include/agg_pixfmt_amask_adaptor.h b/deps/agg/include/agg_pixfmt_amask_adaptor.h index 1e6f75355..0868d3469 100644 --- a/deps/agg/include/agg_pixfmt_amask_adaptor.h +++ b/deps/agg/include/agg_pixfmt_amask_adaptor.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -16,225 +16,196 @@ #ifndef AGG_PIXFMT_AMASK_ADAPTOR_INCLUDED #define AGG_PIXFMT_AMASK_ADAPTOR_INCLUDED - #include #include "agg_array.h" #include "agg_rendering_buffer.h" - -namespace agg +namespace agg { +//==================================================pixfmt_amask_adaptor +template +class pixfmt_amask_adaptor { - //==================================================pixfmt_amask_adaptor - template class pixfmt_amask_adaptor + public: + typedef PixFmt pixfmt_type; + typedef typename pixfmt_type::color_type color_type; + typedef typename pixfmt_type::row_data row_data; + typedef AlphaMask amask_type; + typedef typename amask_type::cover_type cover_type; + + private: + enum span_extra_tail_e { span_extra_tail = 256 }; + + void realloc_span(unsigned len) { - public: - typedef PixFmt pixfmt_type; - typedef typename pixfmt_type::color_type color_type; - typedef typename pixfmt_type::row_data row_data; - typedef AlphaMask amask_type; - typedef typename amask_type::cover_type cover_type; - - private: - enum span_extra_tail_e { span_extra_tail = 256 }; - - void realloc_span(unsigned len) + if (len > m_span.size()) { - if(len > m_span.size()) - { - m_span.resize(len + span_extra_tail); - } + m_span.resize(len + span_extra_tail); } + } - void init_span(unsigned len) - { - realloc_span(len); - memset(&m_span[0], amask_type::cover_full, len * sizeof(cover_type)); - } + void init_span(unsigned len) + { + realloc_span(len); + memset(&m_span[0], amask_type::cover_full, len * sizeof(cover_type)); + } - void init_span(unsigned len, const cover_type* covers) - { - realloc_span(len); - memcpy(&m_span[0], covers, len * sizeof(cover_type)); - } + void init_span(unsigned len, const cover_type* covers) + { + realloc_span(len); + memcpy(&m_span[0], covers, len * sizeof(cover_type)); + } + public: + pixfmt_amask_adaptor(pixfmt_type& pixf, const amask_type& mask) + : m_pixf(&pixf) + , m_mask(&mask) + , m_span() + {} - public: - pixfmt_amask_adaptor(pixfmt_type& pixf, const amask_type& mask) : - m_pixf(&pixf), m_mask(&mask), m_span() - {} + void attach_pixfmt(pixfmt_type& pixf) { m_pixf = &pixf; } + void attach_alpha_mask(const amask_type& mask) { m_mask = &mask; } - void attach_pixfmt(pixfmt_type& pixf) { m_pixf = &pixf; } - void attach_alpha_mask(const amask_type& mask) { m_mask = &mask; } + //-------------------------------------------------------------------- + template + bool attach_pixfmt(PixFmt2& pixf, int x1, int y1, int x2, int y2) + { + return m_pixf->attach(pixf, x1, y1, x2, y2); + } - //-------------------------------------------------------------------- - template - bool attach_pixfmt(PixFmt2& pixf, int x1, int y1, int x2, int y2) - { - return m_pixf->attach(pixf, x1, y1, x2, y2); - } + //-------------------------------------------------------------------- + unsigned width() const { return m_pixf->width(); } + unsigned height() const { return m_pixf->height(); } - //-------------------------------------------------------------------- - unsigned width() const { return m_pixf->width(); } - unsigned height() const { return m_pixf->height(); } + //-------------------------------------------------------------------- + color_type pixel(int x, int y) { return m_pixf->pixel(x, y); } - //-------------------------------------------------------------------- - color_type pixel(int x, int y) - { - return m_pixf->pixel(x, y); - } + //-------------------------------------------------------------------- + void copy_pixel(int x, int y, const color_type& c) { m_pixf->blend_pixel(x, y, c, m_mask->pixel(x, y)); } - //-------------------------------------------------------------------- - void copy_pixel(int x, int y, const color_type& c) - { - m_pixf->blend_pixel(x, y, c, m_mask->pixel(x, y)); - } + //-------------------------------------------------------------------- + void blend_pixel(int x, int y, const color_type& c, cover_type cover) + { + m_pixf->blend_pixel(x, y, c, m_mask->combine_pixel(x, y, cover)); + } - //-------------------------------------------------------------------- - void blend_pixel(int x, int y, const color_type& c, cover_type cover) - { - m_pixf->blend_pixel(x, y, c, m_mask->combine_pixel(x, y, cover)); - } + //-------------------------------------------------------------------- + void copy_hline(int x, int y, unsigned len, const color_type& c) + { + realloc_span(len); + m_mask->fill_hspan(x, y, &m_span[0], len); + m_pixf->blend_solid_hspan(x, y, len, c, &m_span[0]); + } - //-------------------------------------------------------------------- - void copy_hline(int x, int y, - unsigned len, - const color_type& c) - { - realloc_span(len); - m_mask->fill_hspan(x, y, &m_span[0], len); - m_pixf->blend_solid_hspan(x, y, len, c, &m_span[0]); - } + //-------------------------------------------------------------------- + void blend_hline(int x, int y, unsigned len, const color_type& c, cover_type cover) + { + init_span(len); + m_mask->combine_hspan(x, y, &m_span[0], len); + m_pixf->blend_solid_hspan(x, y, len, c, &m_span[0]); + } - //-------------------------------------------------------------------- - void blend_hline(int x, int y, - unsigned len, - const color_type& c, - cover_type cover) - { - init_span(len); - m_mask->combine_hspan(x, y, &m_span[0], len); - m_pixf->blend_solid_hspan(x, y, len, c, &m_span[0]); - } + //-------------------------------------------------------------------- + void copy_vline(int x, int y, unsigned len, const color_type& c) + { + realloc_span(len); + m_mask->fill_vspan(x, y, &m_span[0], len); + m_pixf->blend_solid_vspan(x, y, len, c, &m_span[0]); + } - //-------------------------------------------------------------------- - void copy_vline(int x, int y, - unsigned len, - const color_type& c) - { - realloc_span(len); - m_mask->fill_vspan(x, y, &m_span[0], len); - m_pixf->blend_solid_vspan(x, y, len, c, &m_span[0]); - } + //-------------------------------------------------------------------- + void blend_vline(int x, int y, unsigned len, const color_type& c, cover_type cover) + { + init_span(len); + m_mask->combine_vspan(x, y, &m_span[0], len); + m_pixf->blend_solid_vspan(x, y, len, c, &m_span[0]); + } - //-------------------------------------------------------------------- - void blend_vline(int x, int y, - unsigned len, - const color_type& c, - cover_type cover) - { - init_span(len); - m_mask->combine_vspan(x, y, &m_span[0], len); - m_pixf->blend_solid_vspan(x, y, len, c, &m_span[0]); - } + //-------------------------------------------------------------------- + void copy_from(const rendering_buffer& from, int xdst, int ydst, int xsrc, int ysrc, unsigned len) + { + m_pixf->copy_from(from, xdst, ydst, xsrc, ysrc, len); + } - //-------------------------------------------------------------------- - void copy_from(const rendering_buffer& from, - int xdst, int ydst, - int xsrc, int ysrc, - unsigned len) - { - m_pixf->copy_from(from, xdst, ydst, xsrc, ysrc, len); - } + //-------------------------------------------------------------------- + void blend_solid_hspan(int x, int y, unsigned len, const color_type& c, const cover_type* covers) + { + init_span(len, covers); + m_mask->combine_hspan(x, y, &m_span[0], len); + m_pixf->blend_solid_hspan(x, y, len, c, &m_span[0]); + } + //-------------------------------------------------------------------- + void blend_solid_vspan(int x, int y, unsigned len, const color_type& c, const cover_type* covers) + { + init_span(len, covers); + m_mask->combine_vspan(x, y, &m_span[0], len); + m_pixf->blend_solid_vspan(x, y, len, c, &m_span[0]); + } - //-------------------------------------------------------------------- - void blend_solid_hspan(int x, int y, - unsigned len, - const color_type& c, - const cover_type* covers) + //-------------------------------------------------------------------- + void copy_color_hspan(int x, int y, unsigned len, const color_type* colors) + { + realloc_span(len); + m_mask->fill_hspan(x, y, &m_span[0], len); + m_pixf->blend_color_hspan(x, y, len, colors, &m_span[0], cover_full); + } + + //-------------------------------------------------------------------- + void copy_color_vspan(int x, int y, unsigned len, const color_type* colors) + { + realloc_span(len); + m_mask->fill_vspan(x, y, &m_span[0], len); + m_pixf->blend_color_vspan(x, y, len, colors, &m_span[0], cover_full); + } + + //-------------------------------------------------------------------- + void blend_color_hspan(int x, + int y, + unsigned len, + const color_type* colors, + const cover_type* covers, + cover_type cover = cover_full) + { + if (covers) { init_span(len, covers); m_mask->combine_hspan(x, y, &m_span[0], len); - m_pixf->blend_solid_hspan(x, y, len, c, &m_span[0]); } - - - //-------------------------------------------------------------------- - void blend_solid_vspan(int x, int y, - unsigned len, - const color_type& c, - const cover_type* covers) - { - init_span(len, covers); - m_mask->combine_vspan(x, y, &m_span[0], len); - m_pixf->blend_solid_vspan(x, y, len, c, &m_span[0]); - } - - - //-------------------------------------------------------------------- - void copy_color_hspan(int x, int y, unsigned len, const color_type* colors) + else { realloc_span(len); m_mask->fill_hspan(x, y, &m_span[0], len); - m_pixf->blend_color_hspan(x, y, len, colors, &m_span[0], cover_full); } + m_pixf->blend_color_hspan(x, y, len, colors, &m_span[0], cover); + } - //-------------------------------------------------------------------- - void copy_color_vspan(int x, int y, unsigned len, const color_type* colors) + //-------------------------------------------------------------------- + void blend_color_vspan(int x, + int y, + unsigned len, + const color_type* colors, + const cover_type* covers, + cover_type cover = cover_full) + { + if (covers) + { + init_span(len, covers); + m_mask->combine_vspan(x, y, &m_span[0], len); + } + else { realloc_span(len); m_mask->fill_vspan(x, y, &m_span[0], len); - m_pixf->blend_color_vspan(x, y, len, colors, &m_span[0], cover_full); } + m_pixf->blend_color_vspan(x, y, len, colors, &m_span[0], cover); + } - //-------------------------------------------------------------------- - void blend_color_hspan(int x, int y, - unsigned len, - const color_type* colors, - const cover_type* covers, - cover_type cover = cover_full) - { - if(covers) - { - init_span(len, covers); - m_mask->combine_hspan(x, y, &m_span[0], len); - } - else - { - realloc_span(len); - m_mask->fill_hspan(x, y, &m_span[0], len); - } - m_pixf->blend_color_hspan(x, y, len, colors, &m_span[0], cover); - } + private: + pixfmt_type* m_pixf; + const amask_type* m_mask; + pod_array m_span; +}; - - //-------------------------------------------------------------------- - void blend_color_vspan(int x, int y, - unsigned len, - const color_type* colors, - const cover_type* covers, - cover_type cover = cover_full) - { - if(covers) - { - init_span(len, covers); - m_mask->combine_vspan(x, y, &m_span[0], len); - } - else - { - realloc_span(len); - m_mask->fill_vspan(x, y, &m_span[0], len); - } - m_pixf->blend_color_vspan(x, y, len, colors, &m_span[0], cover); - } - - private: - pixfmt_type* m_pixf; - const amask_type* m_mask; - pod_array m_span; - }; - -} +} // namespace agg #endif - diff --git a/deps/agg/include/agg_pixfmt_base.h b/deps/agg/include/agg_pixfmt_base.h index 57ae19cfe..f787a4013 100644 --- a/deps/agg/include/agg_pixfmt_base.h +++ b/deps/agg/include/agg_pixfmt_base.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -20,78 +20,69 @@ #include "agg_color_gray.h" #include "agg_color_rgba.h" -namespace agg +namespace agg { +struct pixfmt_gray_tag +{}; + +struct pixfmt_rgb_tag +{}; + +struct pixfmt_rgba_tag +{}; + +//--------------------------------------------------------------blender_base +template +struct blender_base { - struct pixfmt_gray_tag - { - }; + typedef ColorT color_type; + typedef Order order_type; + typedef typename color_type::value_type value_type; - struct pixfmt_rgb_tag + static rgba get(value_type r, value_type g, value_type b, value_type a, cover_type cover = cover_full) { - }; - - struct pixfmt_rgba_tag - { - }; - - //--------------------------------------------------------------blender_base - template - struct blender_base - { - typedef ColorT color_type; - typedef Order order_type; - typedef typename color_type::value_type value_type; - - static rgba get(value_type r, value_type g, value_type b, value_type a, cover_type cover = cover_full) + if (cover > cover_none) { - if (cover > cover_none) + rgba c(color_type::to_double(r), + color_type::to_double(g), + color_type::to_double(b), + color_type::to_double(a)); + + if (cover < cover_full) { - rgba c( - color_type::to_double(r), - color_type::to_double(g), - color_type::to_double(b), - color_type::to_double(a)); - - if (cover < cover_full) - { - double x = double(cover) / cover_full; - c.r *= x; - c.g *= x; - c.b *= x; - c.a *= x; - } - - return c; + double x = double(cover) / cover_full; + c.r *= x; + c.g *= x; + c.b *= x; + c.a *= x; } - else return rgba::no_color(); - } - static rgba get(const value_type* p, cover_type cover = cover_full) - { - return get( - p[order_type::R], - p[order_type::G], - p[order_type::B], - p[order_type::A], - cover); + return c; } + else + return rgba::no_color(); + } - static void set(value_type* p, value_type r, value_type g, value_type b, value_type a) - { - p[order_type::R] = r; - p[order_type::G] = g; - p[order_type::B] = b; - p[order_type::A] = a; - } + static rgba get(const value_type* p, cover_type cover = cover_full) + { + return get(p[order_type::R], p[order_type::G], p[order_type::B], p[order_type::A], cover); + } - static void set(value_type* p, const rgba& c) - { - p[order_type::R] = color_type::from_double(c.r); - p[order_type::G] = color_type::from_double(c.g); - p[order_type::B] = color_type::from_double(c.b); - p[order_type::A] = color_type::from_double(c.a); - } - }; -} + static void set(value_type* p, value_type r, value_type g, value_type b, value_type a) + { + p[order_type::R] = r; + p[order_type::G] = g; + p[order_type::B] = b; + p[order_type::A] = a; + } + + static void set(value_type* p, const rgba& c) + { + p[order_type::R] = color_type::from_double(c.r); + p[order_type::G] = color_type::from_double(c.g); + p[order_type::B] = color_type::from_double(c.b); + p[order_type::A] = color_type::from_double(c.a); + } +}; +} // namespace agg #endif diff --git a/deps/agg/include/agg_pixfmt_gray.h b/deps/agg/include/agg_pixfmt_gray.h index a303bd3a7..46419c2f9 100644 --- a/deps/agg/include/agg_pixfmt_gray.h +++ b/deps/agg/include/agg_pixfmt_gray.h @@ -28,710 +28,598 @@ #include "agg_pixfmt_base.h" #include "agg_rendering_buffer.h" -namespace agg +namespace agg { + +//============================================================blender_gray +template +struct blender_gray { + typedef ColorT color_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; + typedef typename color_type::long_type long_type; - //============================================================blender_gray - template struct blender_gray + // Blend pixels using the non-premultiplied form of Alvy-Ray Smith's + // compositing function. Since the render buffer is opaque we skip the + // initial premultiply and final demultiply. + + static AGG_INLINE void blend_pix(value_type* p, value_type cv, value_type alpha, cover_type cover) { - typedef ColorT color_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; - typedef typename color_type::long_type long_type; + blend_pix(p, cv, color_type::mult_cover(alpha, cover)); + } - // Blend pixels using the non-premultiplied form of Alvy-Ray Smith's - // compositing function. Since the render buffer is opaque we skip the - // initial premultiply and final demultiply. + static AGG_INLINE void blend_pix(value_type* p, value_type cv, value_type alpha) + { + *p = color_type::lerp(*p, cv, alpha); + } +}; - static AGG_INLINE void blend_pix(value_type* p, - value_type cv, value_type alpha, cover_type cover) - { - blend_pix(p, cv, color_type::mult_cover(alpha, cover)); - } +//======================================================blender_gray_pre +template +struct blender_gray_pre +{ + typedef ColorT color_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; + typedef typename color_type::long_type long_type; - static AGG_INLINE void blend_pix(value_type* p, - value_type cv, value_type alpha) - { - *p = color_type::lerp(*p, cv, alpha); - } + // Blend pixels using the premultiplied form of Alvy-Ray Smith's + // compositing function. + + static AGG_INLINE void blend_pix(value_type* p, value_type cv, value_type alpha, cover_type cover) + { + blend_pix(p, color_type::mult_cover(cv, cover), color_type::mult_cover(alpha, cover)); + } + + static AGG_INLINE void blend_pix(value_type* p, value_type cv, value_type alpha) + { + *p = color_type::prelerp(*p, cv, alpha); + } +}; + +//=====================================================apply_gamma_dir_gray +template +class apply_gamma_dir_gray +{ + public: + typedef typename ColorT::value_type value_type; + + apply_gamma_dir_gray(const GammaLut& gamma) + : m_gamma(gamma) + {} + + AGG_INLINE void operator()(value_type* p) { *p = m_gamma.dir(*p); } + + private: + const GammaLut& m_gamma; +}; + +//=====================================================apply_gamma_inv_gray +template +class apply_gamma_inv_gray +{ + public: + typedef typename ColorT::value_type value_type; + + apply_gamma_inv_gray(const GammaLut& gamma) + : m_gamma(gamma) + {} + + AGG_INLINE void operator()(value_type* p) { *p = m_gamma.inv(*p); } + + private: + const GammaLut& m_gamma; +}; + +//=================================================pixfmt_alpha_blend_gray +template +class pixfmt_alpha_blend_gray +{ + public: + typedef pixfmt_gray_tag pixfmt_category; + typedef RenBuf rbuf_type; + typedef typename rbuf_type::row_data row_data; + typedef Blender blender_type; + typedef typename blender_type::color_type color_type; + typedef int order_type; // A fake one + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; + enum { + num_components = 1, + pix_width = sizeof(value_type) * Step, + pix_step = Step, + pix_offset = Offset, + }; + struct pixel_type + { + value_type c[num_components]; + + void set(value_type v) { c[0] = v; } + + void set(const color_type& color) { set(color.v); } + + void get(value_type& v) const { v = c[0]; } + + color_type get() const { return color_type(c[0]); } + + pixel_type* next() { return (pixel_type*)(c + pix_step); } + + const pixel_type* next() const { return (const pixel_type*)(c + pix_step); } + + pixel_type* advance(int n) { return (pixel_type*)(c + n * pix_step); } + + const pixel_type* advance(int n) const { return (const pixel_type*)(c + n * pix_step); } }; - - //======================================================blender_gray_pre - template struct blender_gray_pre + private: + //-------------------------------------------------------------------- + AGG_INLINE void blend_pix(pixel_type* p, value_type v, value_type a, unsigned cover) { - typedef ColorT color_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; - typedef typename color_type::long_type long_type; + blender_type::blend_pix(p->c, v, a, cover); + } - // Blend pixels using the premultiplied form of Alvy-Ray Smith's - // compositing function. + //-------------------------------------------------------------------- + AGG_INLINE void blend_pix(pixel_type* p, value_type v, value_type a) { blender_type::blend_pix(p->c, v, a); } - static AGG_INLINE void blend_pix(value_type* p, - value_type cv, value_type alpha, cover_type cover) - { - blend_pix(p, color_type::mult_cover(cv, cover), color_type::mult_cover(alpha, cover)); - } - - static AGG_INLINE void blend_pix(value_type* p, - value_type cv, value_type alpha) - { - *p = color_type::prelerp(*p, cv, alpha); - } - }; - - - - //=====================================================apply_gamma_dir_gray - template class apply_gamma_dir_gray + //-------------------------------------------------------------------- + AGG_INLINE void blend_pix(pixel_type* p, const color_type& c, unsigned cover) { - public: - typedef typename ColorT::value_type value_type; + blender_type::blend_pix(p->c, c.v, c.a, cover); + } - apply_gamma_dir_gray(const GammaLut& gamma) : m_gamma(gamma) {} + //-------------------------------------------------------------------- + AGG_INLINE void blend_pix(pixel_type* p, const color_type& c) { blender_type::blend_pix(p->c, c.v, c.a); } - AGG_INLINE void operator () (value_type* p) - { - *p = m_gamma.dir(*p); - } - - private: - const GammaLut& m_gamma; - }; - - - - //=====================================================apply_gamma_inv_gray - template class apply_gamma_inv_gray + //-------------------------------------------------------------------- + AGG_INLINE void copy_or_blend_pix(pixel_type* p, const color_type& c, unsigned cover) { - public: - typedef typename ColorT::value_type value_type; - - apply_gamma_inv_gray(const GammaLut& gamma) : m_gamma(gamma) {} - - AGG_INLINE void operator () (value_type* p) + if (!c.is_transparent()) { - *p = m_gamma.inv(*p); - } - - private: - const GammaLut& m_gamma; - }; - - - - //=================================================pixfmt_alpha_blend_gray - template - class pixfmt_alpha_blend_gray - { - public: - typedef pixfmt_gray_tag pixfmt_category; - typedef RenBuf rbuf_type; - typedef typename rbuf_type::row_data row_data; - typedef Blender blender_type; - typedef typename blender_type::color_type color_type; - typedef int order_type; // A fake one - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; - enum - { - num_components = 1, - pix_width = sizeof(value_type) * Step, - pix_step = Step, - pix_offset = Offset, - }; - struct pixel_type - { - value_type c[num_components]; - - void set(value_type v) - { - c[0] = v; - } - - void set(const color_type& color) - { - set(color.v); - } - - void get(value_type& v) const - { - v = c[0]; - } - - color_type get() const - { - return color_type(c[0]); - } - - pixel_type* next() - { - return (pixel_type*)(c + pix_step); - } - - const pixel_type* next() const - { - return (const pixel_type*)(c + pix_step); - } - - pixel_type* advance(int n) - { - return (pixel_type*)(c + n * pix_step); - } - - const pixel_type* advance(int n) const - { - return (const pixel_type*)(c + n * pix_step); - } - }; - - private: - //-------------------------------------------------------------------- - AGG_INLINE void blend_pix(pixel_type* p, - value_type v, value_type a, - unsigned cover) - { - blender_type::blend_pix(p->c, v, a, cover); - } - - //-------------------------------------------------------------------- - AGG_INLINE void blend_pix(pixel_type* p, value_type v, value_type a) - { - blender_type::blend_pix(p->c, v, a); - } - - //-------------------------------------------------------------------- - AGG_INLINE void blend_pix(pixel_type* p, const color_type& c, unsigned cover) - { - blender_type::blend_pix(p->c, c.v, c.a, cover); - } - - //-------------------------------------------------------------------- - AGG_INLINE void blend_pix(pixel_type* p, const color_type& c) - { - blender_type::blend_pix(p->c, c.v, c.a); - } - - //-------------------------------------------------------------------- - AGG_INLINE void copy_or_blend_pix(pixel_type* p, const color_type& c, unsigned cover) - { - if (!c.is_transparent()) - { - if (c.is_opaque() && cover == cover_mask) - { - p->set(c); - } - else - { - blend_pix(p, c, cover); - } - } - } - - //-------------------------------------------------------------------- - AGG_INLINE void copy_or_blend_pix(pixel_type* p, const color_type& c) - { - if (!c.is_transparent()) - { - if (c.is_opaque()) - { - p->set(c); - } - else - { - blend_pix(p, c); - } - } - } - - public: - //-------------------------------------------------------------------- - explicit pixfmt_alpha_blend_gray(rbuf_type& rb) : - m_rbuf(&rb) - {} - void attach(rbuf_type& rb) { m_rbuf = &rb; } - //-------------------------------------------------------------------- - - template - bool attach(PixFmt& pixf, int x1, int y1, int x2, int y2) - { - rect_i r(x1, y1, x2, y2); - if (r.clip(rect_i(0, 0, pixf.width()-1, pixf.height()-1))) - { - int stride = pixf.stride(); - m_rbuf->attach(pixf.pix_ptr(r.x1, stride < 0 ? r.y2 : r.y1), - (r.x2 - r.x1) + 1, - (r.y2 - r.y1) + 1, - stride); - return true; - } - return false; - } - - //-------------------------------------------------------------------- - AGG_INLINE unsigned width() const { return m_rbuf->width(); } - AGG_INLINE unsigned height() const { return m_rbuf->height(); } - AGG_INLINE int stride() const { return m_rbuf->stride(); } - - //-------------------------------------------------------------------- - int8u* row_ptr(int y) { return m_rbuf->row_ptr(y); } - const int8u* row_ptr(int y) const { return m_rbuf->row_ptr(y); } - row_data row(int y) const { return m_rbuf->row(y); } - - //-------------------------------------------------------------------- - AGG_INLINE int8u* pix_ptr(int x, int y) - { - return m_rbuf->row_ptr(y) + sizeof(value_type) * (x * pix_step + pix_offset); - } - - AGG_INLINE const int8u* pix_ptr(int x, int y) const - { - return m_rbuf->row_ptr(y) + sizeof(value_type) * (x * pix_step + pix_offset); - } - - // Return pointer to pixel value, forcing row to be allocated. - AGG_INLINE pixel_type* pix_value_ptr(int x, int y, unsigned len) - { - return (pixel_type*)(m_rbuf->row_ptr(x, y, len) + sizeof(value_type) * (x * pix_step + pix_offset)); - } - - // Return pointer to pixel value, or null if row not allocated. - AGG_INLINE const pixel_type* pix_value_ptr(int x, int y) const - { - int8u* p = m_rbuf->row_ptr(y); - return p ? (pixel_type*)(p + sizeof(value_type) * (x * pix_step + pix_offset)) : 0; - } - - // Get pixel pointer from raw buffer pointer. - AGG_INLINE static pixel_type* pix_value_ptr(void* p) - { - return (pixel_type*)((value_type*)p + pix_offset); - } - - // Get pixel pointer from raw buffer pointer. - AGG_INLINE static const pixel_type* pix_value_ptr(const void* p) - { - return (const pixel_type*)((const value_type*)p + pix_offset); - } - - //-------------------------------------------------------------------- - AGG_INLINE static void write_plain_color(void* p, color_type c) - { - // Grayscale formats are implicitly premultiplied. - c.premultiply(); - pix_value_ptr(p)->set(c); - } - - //-------------------------------------------------------------------- - AGG_INLINE static color_type read_plain_color(const void* p) - { - return pix_value_ptr(p)->get(); - } - - //-------------------------------------------------------------------- - AGG_INLINE static void make_pix(int8u* p, const color_type& c) - { - ((pixel_type*)p)->set(c); - } - - //-------------------------------------------------------------------- - AGG_INLINE color_type pixel(int x, int y) const - { - if (const pixel_type* p = pix_value_ptr(x, y)) - { - return p->get(); - } - return color_type::no_color(); - } - - //-------------------------------------------------------------------- - AGG_INLINE void copy_pixel(int x, int y, const color_type& c) - { - pix_value_ptr(x, y, 1)->set(c); - } - - //-------------------------------------------------------------------- - AGG_INLINE void blend_pixel(int x, int y, const color_type& c, int8u cover) - { - copy_or_blend_pix(pix_value_ptr(x, y, 1), c, cover); - } - - //-------------------------------------------------------------------- - AGG_INLINE void copy_hline(int x, int y, - unsigned len, - const color_type& c) - { - pixel_type* p = pix_value_ptr(x, y, len); - do + if (c.is_opaque() && cover == cover_mask) { p->set(c); - p = p->next(); } - while(--len); - } - - - //-------------------------------------------------------------------- - AGG_INLINE void copy_vline(int x, int y, - unsigned len, - const color_type& c) - { - do + else { - pix_value_ptr(x, y++, 1)->set(c); - } - while (--len); - } - - - //-------------------------------------------------------------------- - void blend_hline(int x, int y, - unsigned len, - const color_type& c, - int8u cover) - { - if (!c.is_transparent()) - { - pixel_type* p = pix_value_ptr(x, y, len); - - if (c.is_opaque() && cover == cover_mask) - { - do - { - p->set(c); - p = p->next(); - } - while (--len); - } - else - { - do - { - blend_pix(p, c, cover); - p = p->next(); - } - while (--len); - } + blend_pix(p, c, cover); } } + } - - //-------------------------------------------------------------------- - void blend_vline(int x, int y, - unsigned len, - const color_type& c, - int8u cover) + //-------------------------------------------------------------------- + AGG_INLINE void copy_or_blend_pix(pixel_type* p, const color_type& c) + { + if (!c.is_transparent()) { - if (!c.is_transparent()) + if (c.is_opaque()) { - if (c.is_opaque() && cover == cover_mask) - { - do - { - pix_value_ptr(x, y++, 1)->set(c); - } - while (--len); - } - else - { - do - { - blend_pix(pix_value_ptr(x, y++, 1), c, cover); - } - while (--len); - } + p->set(c); + } + else + { + blend_pix(p, c); } } + } + public: + //-------------------------------------------------------------------- + explicit pixfmt_alpha_blend_gray(rbuf_type& rb) + : m_rbuf(&rb) + {} + void attach(rbuf_type& rb) { m_rbuf = &rb; } + //-------------------------------------------------------------------- - //-------------------------------------------------------------------- - void blend_solid_hspan(int x, int y, - unsigned len, - const color_type& c, - const int8u* covers) + template + bool attach(PixFmt& pixf, int x1, int y1, int x2, int y2) + { + rect_i r(x1, y1, x2, y2); + if (r.clip(rect_i(0, 0, pixf.width() - 1, pixf.height() - 1))) { - if (!c.is_transparent()) - { - pixel_type* p = pix_value_ptr(x, y, len); + int stride = pixf.stride(); + m_rbuf->attach(pixf.pix_ptr(r.x1, stride < 0 ? r.y2 : r.y1), (r.x2 - r.x1) + 1, (r.y2 - r.y1) + 1, stride); + return true; + } + return false; + } + //-------------------------------------------------------------------- + AGG_INLINE unsigned width() const { return m_rbuf->width(); } + AGG_INLINE unsigned height() const { return m_rbuf->height(); } + AGG_INLINE int stride() const { return m_rbuf->stride(); } + + //-------------------------------------------------------------------- + int8u* row_ptr(int y) { return m_rbuf->row_ptr(y); } + const int8u* row_ptr(int y) const { return m_rbuf->row_ptr(y); } + row_data row(int y) const { return m_rbuf->row(y); } + + //-------------------------------------------------------------------- + AGG_INLINE int8u* pix_ptr(int x, int y) + { + return m_rbuf->row_ptr(y) + sizeof(value_type) * (x * pix_step + pix_offset); + } + + AGG_INLINE const int8u* pix_ptr(int x, int y) const + { + return m_rbuf->row_ptr(y) + sizeof(value_type) * (x * pix_step + pix_offset); + } + + // Return pointer to pixel value, forcing row to be allocated. + AGG_INLINE pixel_type* pix_value_ptr(int x, int y, unsigned len) + { + return (pixel_type*)(m_rbuf->row_ptr(x, y, len) + sizeof(value_type) * (x * pix_step + pix_offset)); + } + + // Return pointer to pixel value, or null if row not allocated. + AGG_INLINE const pixel_type* pix_value_ptr(int x, int y) const + { + int8u* p = m_rbuf->row_ptr(y); + return p ? (pixel_type*)(p + sizeof(value_type) * (x * pix_step + pix_offset)) : 0; + } + + // Get pixel pointer from raw buffer pointer. + AGG_INLINE static pixel_type* pix_value_ptr(void* p) { return (pixel_type*)((value_type*)p + pix_offset); } + + // Get pixel pointer from raw buffer pointer. + AGG_INLINE static const pixel_type* pix_value_ptr(const void* p) + { + return (const pixel_type*)((const value_type*)p + pix_offset); + } + + //-------------------------------------------------------------------- + AGG_INLINE static void write_plain_color(void* p, color_type c) + { + // Grayscale formats are implicitly premultiplied. + c.premultiply(); + pix_value_ptr(p)->set(c); + } + + //-------------------------------------------------------------------- + AGG_INLINE static color_type read_plain_color(const void* p) { return pix_value_ptr(p)->get(); } + + //-------------------------------------------------------------------- + AGG_INLINE static void make_pix(int8u* p, const color_type& c) { ((pixel_type*)p)->set(c); } + + //-------------------------------------------------------------------- + AGG_INLINE color_type pixel(int x, int y) const + { + if (const pixel_type* p = pix_value_ptr(x, y)) + { + return p->get(); + } + return color_type::no_color(); + } + + //-------------------------------------------------------------------- + AGG_INLINE void copy_pixel(int x, int y, const color_type& c) { pix_value_ptr(x, y, 1)->set(c); } + + //-------------------------------------------------------------------- + AGG_INLINE void blend_pixel(int x, int y, const color_type& c, int8u cover) + { + copy_or_blend_pix(pix_value_ptr(x, y, 1), c, cover); + } + + //-------------------------------------------------------------------- + AGG_INLINE void copy_hline(int x, int y, unsigned len, const color_type& c) + { + pixel_type* p = pix_value_ptr(x, y, len); + do + { + p->set(c); + p = p->next(); + } while (--len); + } + + //-------------------------------------------------------------------- + AGG_INLINE void copy_vline(int x, int y, unsigned len, const color_type& c) + { + do + { + pix_value_ptr(x, y++, 1)->set(c); + } while (--len); + } + + //-------------------------------------------------------------------- + void blend_hline(int x, int y, unsigned len, const color_type& c, int8u cover) + { + if (!c.is_transparent()) + { + pixel_type* p = pix_value_ptr(x, y, len); + + if (c.is_opaque() && cover == cover_mask) + { do { - if (c.is_opaque() && *covers == cover_mask) - { - p->set(c); - } - else - { - blend_pix(p, c, *covers); - } + p->set(c); p = p->next(); - ++covers; - } - while (--len); + } while (--len); } - } - - - //-------------------------------------------------------------------- - void blend_solid_vspan(int x, int y, - unsigned len, - const color_type& c, - const int8u* covers) - { - if (!c.is_transparent()) + else { do { - pixel_type* p = pix_value_ptr(x, y++, 1); - - if (c.is_opaque() && *covers == cover_mask) - { - p->set(c); - } - else - { - blend_pix(p, c, *covers); - } - ++covers; - } - while (--len); + blend_pix(p, c, cover); + p = p->next(); + } while (--len); } } + } + //-------------------------------------------------------------------- + void blend_vline(int x, int y, unsigned len, const color_type& c, int8u cover) + { + if (!c.is_transparent()) + { + if (c.is_opaque() && cover == cover_mask) + { + do + { + pix_value_ptr(x, y++, 1)->set(c); + } while (--len); + } + else + { + do + { + blend_pix(pix_value_ptr(x, y++, 1), c, cover); + } while (--len); + } + } + } - //-------------------------------------------------------------------- - void copy_color_hspan(int x, int y, - unsigned len, - const color_type* colors) + //-------------------------------------------------------------------- + void blend_solid_hspan(int x, int y, unsigned len, const color_type& c, const int8u* covers) + { + if (!c.is_transparent()) { pixel_type* p = pix_value_ptr(x, y, len); do { - p->set(*colors++); + if (c.is_opaque() && *covers == cover_mask) + { + p->set(c); + } + else + { + blend_pix(p, c, *covers); + } p = p->next(); - } - while (--len); + ++covers; + } while (--len); } + } - - //-------------------------------------------------------------------- - void copy_color_vspan(int x, int y, - unsigned len, - const color_type* colors) + //-------------------------------------------------------------------- + void blend_solid_vspan(int x, int y, unsigned len, const color_type& c, const int8u* covers) + { + if (!c.is_transparent()) { do { - pix_value_ptr(x, y++, 1)->set(*colors++); - } - while (--len); + pixel_type* p = pix_value_ptr(x, y++, 1); + + if (c.is_opaque() && *covers == cover_mask) + { + p->set(c); + } + else + { + blend_pix(p, c, *covers); + } + ++covers; + } while (--len); } + } + //-------------------------------------------------------------------- + void copy_color_hspan(int x, int y, unsigned len, const color_type* colors) + { + pixel_type* p = pix_value_ptr(x, y, len); - //-------------------------------------------------------------------- - void blend_color_hspan(int x, int y, - unsigned len, - const color_type* colors, - const int8u* covers, - int8u cover) + do { - pixel_type* p = pix_value_ptr(x, y, len); + p->set(*colors++); + p = p->next(); + } while (--len); + } - if (covers) + //-------------------------------------------------------------------- + void copy_color_vspan(int x, int y, unsigned len, const color_type* colors) + { + do + { + pix_value_ptr(x, y++, 1)->set(*colors++); + } while (--len); + } + + //-------------------------------------------------------------------- + void blend_color_hspan(int x, int y, unsigned len, const color_type* colors, const int8u* covers, int8u cover) + { + pixel_type* p = pix_value_ptr(x, y, len); + + if (covers) + { + do + { + copy_or_blend_pix(p, *colors++, *covers++); + p = p->next(); + } while (--len); + } + else + { + if (cover == cover_mask) { do { - copy_or_blend_pix(p, *colors++, *covers++); + copy_or_blend_pix(p, *colors++); p = p->next(); - } - while (--len); + } while (--len); } else { - if (cover == cover_mask) + do { - do - { - copy_or_blend_pix(p, *colors++); - p = p->next(); - } - while (--len); - } - else - { - do - { - copy_or_blend_pix(p, *colors++, cover); - p = p->next(); - } - while (--len); - } + copy_or_blend_pix(p, *colors++, cover); + p = p->next(); + } while (--len); } } + } - - //-------------------------------------------------------------------- - void blend_color_vspan(int x, int y, - unsigned len, - const color_type* colors, - const int8u* covers, - int8u cover) + //-------------------------------------------------------------------- + void blend_color_vspan(int x, int y, unsigned len, const color_type* colors, const int8u* covers, int8u cover) + { + if (covers) { - if (covers) + do + { + copy_or_blend_pix(pix_value_ptr(x, y++, 1), *colors++, *covers++); + } while (--len); + } + else + { + if (cover == cover_mask) { do { - copy_or_blend_pix(pix_value_ptr(x, y++, 1), *colors++, *covers++); - } - while (--len); + copy_or_blend_pix(pix_value_ptr(x, y++, 1), *colors++); + } while (--len); } else { - if (cover == cover_mask) - { - do - { - copy_or_blend_pix(pix_value_ptr(x, y++, 1), *colors++); - } - while (--len); - } - else - { - do - { - copy_or_blend_pix(pix_value_ptr(x, y++, 1), *colors++, cover); - } - while (--len); - } - } - } - - //-------------------------------------------------------------------- - template void for_each_pixel(Function f) - { - unsigned y; - for (y = 0; y < height(); ++y) - { - row_data r = m_rbuf->row(y); - if (r.ptr) - { - unsigned len = r.x2 - r.x1 + 1; - pixel_type* p = pix_value_ptr(r.x1, y, len); - do - { - f(p->c); - p = p->next(); - } - while (--len); - } - } - } - - //-------------------------------------------------------------------- - template void apply_gamma_dir(const GammaLut& g) - { - for_each_pixel(apply_gamma_dir_gray(g)); - } - - //-------------------------------------------------------------------- - template void apply_gamma_inv(const GammaLut& g) - { - for_each_pixel(apply_gamma_inv_gray(g)); - } - - //-------------------------------------------------------------------- - template - void copy_from(const RenBuf2& from, - int xdst, int ydst, - int xsrc, int ysrc, - unsigned len) - { - if (const int8u* p = from.row_ptr(ysrc)) - { - memmove(m_rbuf->row_ptr(xdst, ydst, len) + xdst * pix_width, - p + xsrc * pix_width, - len * pix_width); - } - } - - //-------------------------------------------------------------------- - // Blend from single color, using grayscale surface as alpha channel. - template - void blend_from_color(const SrcPixelFormatRenderer& from, - const color_type& color, - int xdst, int ydst, - int xsrc, int ysrc, - unsigned len, - int8u cover) - { - typedef typename SrcPixelFormatRenderer::pixel_type src_pixel_type; - typedef typename SrcPixelFormatRenderer::color_type src_color_type; - - if (const src_pixel_type* psrc = from.pix_value_ptr(xsrc, ysrc)) - { - pixel_type* pdst = pix_value_ptr(xdst, ydst, len); - do { - copy_or_blend_pix(pdst, color, src_color_type::scale_cover(cover, psrc->c[0])); - psrc = psrc->next(); - pdst = pdst->next(); - } - while (--len); + copy_or_blend_pix(pix_value_ptr(x, y++, 1), *colors++, cover); + } while (--len); } } + } - //-------------------------------------------------------------------- - // Blend from color table, using grayscale surface as indexes into table. - // Obviously, this only works for integer value types. - template - void blend_from_lut(const SrcPixelFormatRenderer& from, - const color_type* color_lut, - int xdst, int ydst, - int xsrc, int ysrc, - unsigned len, - int8u cover) + //-------------------------------------------------------------------- + template + void for_each_pixel(Function f) + { + unsigned y; + for (y = 0; y < height(); ++y) { - typedef typename SrcPixelFormatRenderer::pixel_type src_pixel_type; - - if (const src_pixel_type* psrc = from.pix_value_ptr(xsrc, ysrc)) + row_data r = m_rbuf->row(y); + if (r.ptr) { - pixel_type* pdst = pix_value_ptr(xdst, ydst, len); - + unsigned len = r.x2 - r.x1 + 1; + pixel_type* p = pix_value_ptr(r.x1, y, len); do { - copy_or_blend_pix(pdst, color_lut[psrc->c[0]], cover); - psrc = psrc->next(); - pdst = pdst->next(); - } - while (--len); + f(p->c); + p = p->next(); + } while (--len); } } + } - private: - rbuf_type* m_rbuf; - }; + //-------------------------------------------------------------------- + template + void apply_gamma_dir(const GammaLut& g) + { + for_each_pixel(apply_gamma_dir_gray(g)); + } - typedef blender_gray blender_gray8; - typedef blender_gray blender_sgray8; - typedef blender_gray blender_gray16; - typedef blender_gray blender_gray32; + //-------------------------------------------------------------------- + template + void apply_gamma_inv(const GammaLut& g) + { + for_each_pixel(apply_gamma_inv_gray(g)); + } - typedef blender_gray_pre blender_gray8_pre; - typedef blender_gray_pre blender_sgray8_pre; - typedef blender_gray_pre blender_gray16_pre; - typedef blender_gray_pre blender_gray32_pre; + //-------------------------------------------------------------------- + template + void copy_from(const RenBuf2& from, int xdst, int ydst, int xsrc, int ysrc, unsigned len) + { + if (const int8u* p = from.row_ptr(ysrc)) + { + memmove(m_rbuf->row_ptr(xdst, ydst, len) + xdst * pix_width, p + xsrc * pix_width, len * pix_width); + } + } - typedef pixfmt_alpha_blend_gray pixfmt_gray8; - typedef pixfmt_alpha_blend_gray pixfmt_sgray8; - typedef pixfmt_alpha_blend_gray pixfmt_gray16; - typedef pixfmt_alpha_blend_gray pixfmt_gray32; + //-------------------------------------------------------------------- + // Blend from single color, using grayscale surface as alpha channel. + template + void blend_from_color(const SrcPixelFormatRenderer& from, + const color_type& color, + int xdst, + int ydst, + int xsrc, + int ysrc, + unsigned len, + int8u cover) + { + typedef typename SrcPixelFormatRenderer::pixel_type src_pixel_type; + typedef typename SrcPixelFormatRenderer::color_type src_color_type; - typedef pixfmt_alpha_blend_gray pixfmt_gray8_pre; - typedef pixfmt_alpha_blend_gray pixfmt_sgray8_pre; - typedef pixfmt_alpha_blend_gray pixfmt_gray16_pre; - typedef pixfmt_alpha_blend_gray pixfmt_gray32_pre; -} + if (const src_pixel_type* psrc = from.pix_value_ptr(xsrc, ysrc)) + { + pixel_type* pdst = pix_value_ptr(xdst, ydst, len); + + do + { + copy_or_blend_pix(pdst, color, src_color_type::scale_cover(cover, psrc->c[0])); + psrc = psrc->next(); + pdst = pdst->next(); + } while (--len); + } + } + + //-------------------------------------------------------------------- + // Blend from color table, using grayscale surface as indexes into table. + // Obviously, this only works for integer value types. + template + void blend_from_lut(const SrcPixelFormatRenderer& from, + const color_type* color_lut, + int xdst, + int ydst, + int xsrc, + int ysrc, + unsigned len, + int8u cover) + { + typedef typename SrcPixelFormatRenderer::pixel_type src_pixel_type; + + if (const src_pixel_type* psrc = from.pix_value_ptr(xsrc, ysrc)) + { + pixel_type* pdst = pix_value_ptr(xdst, ydst, len); + + do + { + copy_or_blend_pix(pdst, color_lut[psrc->c[0]], cover); + psrc = psrc->next(); + pdst = pdst->next(); + } while (--len); + } + } + + private: + rbuf_type* m_rbuf; +}; + +typedef blender_gray blender_gray8; +typedef blender_gray blender_sgray8; +typedef blender_gray blender_gray16; +typedef blender_gray blender_gray32; + +typedef blender_gray_pre blender_gray8_pre; +typedef blender_gray_pre blender_sgray8_pre; +typedef blender_gray_pre blender_gray16_pre; +typedef blender_gray_pre blender_gray32_pre; + +typedef pixfmt_alpha_blend_gray pixfmt_gray8; +typedef pixfmt_alpha_blend_gray pixfmt_sgray8; +typedef pixfmt_alpha_blend_gray pixfmt_gray16; +typedef pixfmt_alpha_blend_gray pixfmt_gray32; + +typedef pixfmt_alpha_blend_gray pixfmt_gray8_pre; +typedef pixfmt_alpha_blend_gray pixfmt_sgray8_pre; +typedef pixfmt_alpha_blend_gray pixfmt_gray16_pre; +typedef pixfmt_alpha_blend_gray pixfmt_gray32_pre; +} // namespace agg #endif diff --git a/deps/agg/include/agg_pixfmt_rgb.h b/deps/agg/include/agg_pixfmt_rgb.h index 470dd856d..48379ed97 100644 --- a/deps/agg/include/agg_pixfmt_rgb.h +++ b/deps/agg/include/agg_pixfmt_rgb.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -13,12 +13,12 @@ // http://www.antigrain.com //---------------------------------------------------------------------------- // -// Adaptation for high precision colors has been sponsored by +// Adaptation for high precision colors has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. -// +// //---------------------------------------------------------------------------- #ifndef AGG_PIXFMT_RGB_INCLUDED @@ -29,832 +29,728 @@ #include "agg_color_rgba.h" #include "agg_rendering_buffer.h" -namespace agg +namespace agg { + +//=====================================================apply_gamma_dir_rgb +template +class apply_gamma_dir_rgb { + public: + typedef typename ColorT::value_type value_type; - //=====================================================apply_gamma_dir_rgb - template class apply_gamma_dir_rgb + apply_gamma_dir_rgb(const GammaLut& gamma) + : m_gamma(gamma) + {} + + AGG_INLINE void operator()(value_type* p) { - public: - typedef typename ColorT::value_type value_type; + p[Order::R] = m_gamma.dir(p[Order::R]); + p[Order::G] = m_gamma.dir(p[Order::G]); + p[Order::B] = m_gamma.dir(p[Order::B]); + } - apply_gamma_dir_rgb(const GammaLut& gamma) : m_gamma(gamma) {} + private: + const GammaLut& m_gamma; +}; - AGG_INLINE void operator () (value_type* p) - { - p[Order::R] = m_gamma.dir(p[Order::R]); - p[Order::G] = m_gamma.dir(p[Order::G]); - p[Order::B] = m_gamma.dir(p[Order::B]); - } +//=====================================================apply_gamma_inv_rgb +template +class apply_gamma_inv_rgb +{ + public: + typedef typename ColorT::value_type value_type; - private: - const GammaLut& m_gamma; + apply_gamma_inv_rgb(const GammaLut& gamma) + : m_gamma(gamma) + {} + + AGG_INLINE void operator()(value_type* p) + { + p[Order::R] = m_gamma.inv(p[Order::R]); + p[Order::G] = m_gamma.inv(p[Order::G]); + p[Order::B] = m_gamma.inv(p[Order::B]); + } + + private: + const GammaLut& m_gamma; +}; + +//=========================================================blender_rgb +template +struct blender_rgb +{ + typedef ColorT color_type; + typedef Order order_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; + enum base_scale_e { base_shift = color_type::base_shift }; + + //-------------------------------------------------------------------- + static AGG_INLINE void + blend_pix(value_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned cover = 0) + { + p[Order::R] += (value_type)(((cr - p[Order::R]) * alpha) >> base_shift); + p[Order::G] += (value_type)(((cg - p[Order::G]) * alpha) >> base_shift); + p[Order::B] += (value_type)(((cb - p[Order::B]) * alpha) >> base_shift); + } +}; + +//======================================================blender_rgb_pre +template +struct blender_rgb_pre +{ + typedef ColorT color_type; + typedef Order order_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; + enum base_scale_e { base_shift = color_type::base_shift }; + + //-------------------------------------------------------------------- + static AGG_INLINE void + blend_pix(value_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned cover) + { + alpha = color_type::base_mask - alpha; + cover = (cover + 1) << (base_shift - 8); + p[Order::R] = (value_type)((p[Order::R] * alpha + cr * cover) >> base_shift); + p[Order::G] = (value_type)((p[Order::G] * alpha + cg * cover) >> base_shift); + p[Order::B] = (value_type)((p[Order::B] * alpha + cb * cover) >> base_shift); + } + + //-------------------------------------------------------------------- + static AGG_INLINE void blend_pix(value_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha) + { + alpha = color_type::base_mask - alpha; + p[Order::R] = (value_type)(((p[Order::R] * alpha) >> base_shift) + cr); + p[Order::G] = (value_type)(((p[Order::G] * alpha) >> base_shift) + cg); + p[Order::B] = (value_type)(((p[Order::B] * alpha) >> base_shift) + cb); + } +}; + +//===================================================blender_rgb_gamma +template +class blender_rgb_gamma +{ + public: + typedef ColorT color_type; + typedef Order order_type; + typedef Gamma gamma_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; + enum base_scale_e { base_shift = color_type::base_shift }; + + //-------------------------------------------------------------------- + blender_rgb_gamma() + : m_gamma(0) + {} + void gamma(const gamma_type& g) { m_gamma = &g; } + + //-------------------------------------------------------------------- + AGG_INLINE void blend_pix(value_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned cover = 0) + { + calc_type r = m_gamma->dir(p[Order::R]); + calc_type g = m_gamma->dir(p[Order::G]); + calc_type b = m_gamma->dir(p[Order::B]); + p[Order::R] = m_gamma->inv((((m_gamma->dir(cr) - r) * alpha) >> base_shift) + r); + p[Order::G] = m_gamma->inv((((m_gamma->dir(cg) - g) * alpha) >> base_shift) + g); + p[Order::B] = m_gamma->inv((((m_gamma->dir(cb) - b) * alpha) >> base_shift) + b); + } + + private: + const gamma_type* m_gamma; +}; + +//==================================================pixfmt_alpha_blend_rgb +template +class pixfmt_alpha_blend_rgb +{ + public: + typedef RenBuf rbuf_type; + typedef Blender blender_type; + typedef typename rbuf_type::row_data row_data; + typedef typename blender_type::color_type color_type; + typedef typename blender_type::order_type order_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; + enum base_scale_e { + base_shift = color_type::base_shift, + base_scale = color_type::base_scale, + base_mask = color_type::base_mask, + pix_width = sizeof(value_type) * 3 }; - - - //=====================================================apply_gamma_inv_rgb - template class apply_gamma_inv_rgb + private: + //-------------------------------------------------------------------- + AGG_INLINE void copy_or_blend_pix(value_type* p, const color_type& c, unsigned cover) { - public: - typedef typename ColorT::value_type value_type; - - apply_gamma_inv_rgb(const GammaLut& gamma) : m_gamma(gamma) {} - - AGG_INLINE void operator () (value_type* p) + if (c.a) { - p[Order::R] = m_gamma.inv(p[Order::R]); - p[Order::G] = m_gamma.inv(p[Order::G]); - p[Order::B] = m_gamma.inv(p[Order::B]); - } - - private: - const GammaLut& m_gamma; - }; - - - //=========================================================blender_rgb - template struct blender_rgb - { - typedef ColorT color_type; - typedef Order order_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; - enum base_scale_e { base_shift = color_type::base_shift }; - - //-------------------------------------------------------------------- - static AGG_INLINE void blend_pix(value_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha, - unsigned cover=0) - { - p[Order::R] += (value_type)(((cr - p[Order::R]) * alpha) >> base_shift); - p[Order::G] += (value_type)(((cg - p[Order::G]) * alpha) >> base_shift); - p[Order::B] += (value_type)(((cb - p[Order::B]) * alpha) >> base_shift); - } - }; - - - //======================================================blender_rgb_pre - template struct blender_rgb_pre - { - typedef ColorT color_type; - typedef Order order_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; - enum base_scale_e { base_shift = color_type::base_shift }; - - //-------------------------------------------------------------------- - static AGG_INLINE void blend_pix(value_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha, - unsigned cover) - { - alpha = color_type::base_mask - alpha; - cover = (cover + 1) << (base_shift - 8); - p[Order::R] = (value_type)((p[Order::R] * alpha + cr * cover) >> base_shift); - p[Order::G] = (value_type)((p[Order::G] * alpha + cg * cover) >> base_shift); - p[Order::B] = (value_type)((p[Order::B] * alpha + cb * cover) >> base_shift); - } - - //-------------------------------------------------------------------- - static AGG_INLINE void blend_pix(value_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha) - { - alpha = color_type::base_mask - alpha; - p[Order::R] = (value_type)(((p[Order::R] * alpha) >> base_shift) + cr); - p[Order::G] = (value_type)(((p[Order::G] * alpha) >> base_shift) + cg); - p[Order::B] = (value_type)(((p[Order::B] * alpha) >> base_shift) + cb); - } - - }; - - - - //===================================================blender_rgb_gamma - template class blender_rgb_gamma - { - public: - typedef ColorT color_type; - typedef Order order_type; - typedef Gamma gamma_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; - enum base_scale_e { base_shift = color_type::base_shift }; - - //-------------------------------------------------------------------- - blender_rgb_gamma() : m_gamma(0) {} - void gamma(const gamma_type& g) { m_gamma = &g; } - - //-------------------------------------------------------------------- - AGG_INLINE void blend_pix(value_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha, - unsigned cover=0) - { - calc_type r = m_gamma->dir(p[Order::R]); - calc_type g = m_gamma->dir(p[Order::G]); - calc_type b = m_gamma->dir(p[Order::B]); - p[Order::R] = m_gamma->inv((((m_gamma->dir(cr) - r) * alpha) >> base_shift) + r); - p[Order::G] = m_gamma->inv((((m_gamma->dir(cg) - g) * alpha) >> base_shift) + g); - p[Order::B] = m_gamma->inv((((m_gamma->dir(cb) - b) * alpha) >> base_shift) + b); - } - - private: - const gamma_type* m_gamma; - }; - - - - - //==================================================pixfmt_alpha_blend_rgb - template class pixfmt_alpha_blend_rgb - { - public: - typedef RenBuf rbuf_type; - typedef Blender blender_type; - typedef typename rbuf_type::row_data row_data; - typedef typename blender_type::color_type color_type; - typedef typename blender_type::order_type order_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_scale = color_type::base_scale, - base_mask = color_type::base_mask, - pix_width = sizeof(value_type) * 3 - }; - - private: - //-------------------------------------------------------------------- - AGG_INLINE void copy_or_blend_pix(value_type* p, - const color_type& c, - unsigned cover) - { - if (c.a) + calc_type alpha = (calc_type(c.a) * (cover + 1)) >> 8; + if (alpha == base_mask) { - calc_type alpha = (calc_type(c.a) * (cover + 1)) >> 8; - if(alpha == base_mask) - { - p[order_type::R] = c.r; - p[order_type::G] = c.g; - p[order_type::B] = c.b; - } - else - { - m_blender.blend_pix(p, c.r, c.g, c.b, alpha, cover); - } + p[order_type::R] = c.r; + p[order_type::G] = c.g; + p[order_type::B] = c.b; + } + else + { + m_blender.blend_pix(p, c.r, c.g, c.b, alpha, cover); } } + } - //-------------------------------------------------------------------- - AGG_INLINE void copy_or_blend_pix(value_type* p, - const color_type& c) + //-------------------------------------------------------------------- + AGG_INLINE void copy_or_blend_pix(value_type* p, const color_type& c) + { + if (c.a) { - if (c.a) + if (c.a == base_mask) { - if(c.a == base_mask) - { - p[order_type::R] = c.r; - p[order_type::G] = c.g; - p[order_type::B] = c.b; - } - else - { - m_blender.blend_pix(p, c.r, c.g, c.b, c.a); - } + p[order_type::R] = c.r; + p[order_type::G] = c.g; + p[order_type::B] = c.b; + } + else + { + m_blender.blend_pix(p, c.r, c.g, c.b, c.a); } } + } + public: + //-------------------------------------------------------------------- + explicit pixfmt_alpha_blend_rgb(rbuf_type& rb) + : m_rbuf(&rb) + {} + void attach(rbuf_type& rb) { m_rbuf = &rb; } - public: - //-------------------------------------------------------------------- - explicit pixfmt_alpha_blend_rgb(rbuf_type& rb) : - m_rbuf(&rb) - {} - void attach(rbuf_type& rb) { m_rbuf = &rb; } - - //-------------------------------------------------------------------- - template - bool attach(PixFmt& pixf, int x1, int y1, int x2, int y2) + //-------------------------------------------------------------------- + template + bool attach(PixFmt& pixf, int x1, int y1, int x2, int y2) + { + rect_i r(x1, y1, x2, y2); + if (r.clip(rect_i(0, 0, pixf.width() - 1, pixf.height() - 1))) { - rect_i r(x1, y1, x2, y2); - if(r.clip(rect_i(0, 0, pixf.width()-1, pixf.height()-1))) - { - int stride = pixf.stride(); - m_rbuf->attach(pixf.pix_ptr(r.x1, stride < 0 ? r.y2 : r.y1), - (r.x2 - r.x1) + 1, - (r.y2 - r.y1) + 1, - stride); - return true; - } - return false; + int stride = pixf.stride(); + m_rbuf->attach(pixf.pix_ptr(r.x1, stride < 0 ? r.y2 : r.y1), (r.x2 - r.x1) + 1, (r.y2 - r.y1) + 1, stride); + return true; } + return false; + } - //-------------------------------------------------------------------- - Blender& blender() { return m_blender; } + //-------------------------------------------------------------------- + Blender& blender() { return m_blender; } - //-------------------------------------------------------------------- - AGG_INLINE unsigned width() const { return m_rbuf->width(); } - AGG_INLINE unsigned height() const { return m_rbuf->height(); } - AGG_INLINE int stride() const { return m_rbuf->stride(); } + //-------------------------------------------------------------------- + AGG_INLINE unsigned width() const { return m_rbuf->width(); } + AGG_INLINE unsigned height() const { return m_rbuf->height(); } + AGG_INLINE int stride() const { return m_rbuf->stride(); } - //-------------------------------------------------------------------- - AGG_INLINE int8u* row_ptr(int y) { return m_rbuf->row_ptr(y); } - AGG_INLINE const int8u* row_ptr(int y) const { return m_rbuf->row_ptr(y); } - AGG_INLINE row_data row(int y) const { return m_rbuf->row(y); } + //-------------------------------------------------------------------- + AGG_INLINE int8u* row_ptr(int y) { return m_rbuf->row_ptr(y); } + AGG_INLINE const int8u* row_ptr(int y) const { return m_rbuf->row_ptr(y); } + AGG_INLINE row_data row(int y) const { return m_rbuf->row(y); } - //-------------------------------------------------------------------- - AGG_INLINE int8u* pix_ptr(int x, int y) - { - return m_rbuf->row_ptr(y) + x * pix_width; - } + //-------------------------------------------------------------------- + AGG_INLINE int8u* pix_ptr(int x, int y) { return m_rbuf->row_ptr(y) + x * pix_width; } - AGG_INLINE const int8u* pix_ptr(int x, int y) const - { - return m_rbuf->row_ptr(y) + x * pix_width; - } + AGG_INLINE const int8u* pix_ptr(int x, int y) const { return m_rbuf->row_ptr(y) + x * pix_width; } - //-------------------------------------------------------------------- - AGG_INLINE static void make_pix(int8u* p, const color_type& c) + //-------------------------------------------------------------------- + AGG_INLINE static void make_pix(int8u* p, const color_type& c) + { + ((value_type*)p)[order_type::R] = c.r; + ((value_type*)p)[order_type::G] = c.g; + ((value_type*)p)[order_type::B] = c.b; + } + + //-------------------------------------------------------------------- + AGG_INLINE color_type pixel(int x, int y) const + { + value_type* p = (value_type*)m_rbuf->row_ptr(y) + x + x + x; + return color_type(p[order_type::R], p[order_type::G], p[order_type::B]); + } + + //-------------------------------------------------------------------- + AGG_INLINE void copy_pixel(int x, int y, const color_type& c) + { + value_type* p = (value_type*)m_rbuf->row_ptr(x, y, 1) + x + x + x; + p[order_type::R] = c.r; + p[order_type::G] = c.g; + p[order_type::B] = c.b; + } + + //-------------------------------------------------------------------- + AGG_INLINE void blend_pixel(int x, int y, const color_type& c, int8u cover) + { + copy_or_blend_pix((value_type*)m_rbuf->row_ptr(x, y, 1) + x + x + x, c, cover); + } + + //-------------------------------------------------------------------- + AGG_INLINE void copy_hline(int x, int y, unsigned len, const color_type& c) + { + value_type* p = (value_type*)m_rbuf->row_ptr(x, y, len) + x + x + x; + do { - ((value_type*)p)[order_type::R] = c.r; - ((value_type*)p)[order_type::G] = c.g; - ((value_type*)p)[order_type::B] = c.b; - } - - //-------------------------------------------------------------------- - AGG_INLINE color_type pixel(int x, int y) const - { - value_type* p = (value_type*)m_rbuf->row_ptr(y) + x + x + x; - return color_type(p[order_type::R], - p[order_type::G], - p[order_type::B]); - } - - //-------------------------------------------------------------------- - AGG_INLINE void copy_pixel(int x, int y, const color_type& c) - { - value_type* p = (value_type*)m_rbuf->row_ptr(x, y, 1) + x + x + x; p[order_type::R] = c.r; p[order_type::G] = c.g; p[order_type::B] = c.b; - } + p += 3; + } while (--len); + } - //-------------------------------------------------------------------- - AGG_INLINE void blend_pixel(int x, int y, const color_type& c, int8u cover) + //-------------------------------------------------------------------- + AGG_INLINE void copy_vline(int x, int y, unsigned len, const color_type& c) + { + do { - copy_or_blend_pix((value_type*)m_rbuf->row_ptr(x, y, 1) + x + x + x, c, cover); - } + value_type* p = (value_type*)m_rbuf->row_ptr(x, y++, 1) + x + x + x; + p[order_type::R] = c.r; + p[order_type::G] = c.g; + p[order_type::B] = c.b; + } while (--len); + } - - //-------------------------------------------------------------------- - AGG_INLINE void copy_hline(int x, int y, - unsigned len, - const color_type& c) + //-------------------------------------------------------------------- + void blend_hline(int x, int y, unsigned len, const color_type& c, int8u cover) + { + if (c.a) { value_type* p = (value_type*)m_rbuf->row_ptr(x, y, len) + x + x + x; - do + + calc_type alpha = (calc_type(c.a) * (calc_type(cover) + 1)) >> 8; + if (alpha == base_mask) { - p[order_type::R] = c.r; - p[order_type::G] = c.g; - p[order_type::B] = c.b; - p += 3; - } - while(--len); - } - - - //-------------------------------------------------------------------- - AGG_INLINE void copy_vline(int x, int y, - unsigned len, - const color_type& c) - { - do - { - value_type* p = (value_type*) - m_rbuf->row_ptr(x, y++, 1) + x + x + x; - p[order_type::R] = c.r; - p[order_type::G] = c.g; - p[order_type::B] = c.b; - } - while(--len); - } - - - //-------------------------------------------------------------------- - void blend_hline(int x, int y, - unsigned len, - const color_type& c, - int8u cover) - { - if (c.a) - { - value_type* p = (value_type*) - m_rbuf->row_ptr(x, y, len) + x + x + x; - - calc_type alpha = (calc_type(c.a) * (calc_type(cover) + 1)) >> 8; - if(alpha == base_mask) + do { - do - { - p[order_type::R] = c.r; - p[order_type::G] = c.g; - p[order_type::B] = c.b; - p += 3; - } - while(--len); - } - else - { - do - { - m_blender.blend_pix(p, c.r, c.g, c.b, alpha, cover); - p += 3; - } - while(--len); - } - } - } - - - //-------------------------------------------------------------------- - void blend_vline(int x, int y, - unsigned len, - const color_type& c, - int8u cover) - { - if (c.a) - { - value_type* p; - calc_type alpha = (calc_type(c.a) * (cover + 1)) >> 8; - if(alpha == base_mask) - { - do - { - p = (value_type*) - m_rbuf->row_ptr(x, y++, 1) + x + x + x; - - p[order_type::R] = c.r; - p[order_type::G] = c.g; - p[order_type::B] = c.b; - } - while(--len); - } - else - { - do - { - p = (value_type*) - m_rbuf->row_ptr(x, y++, 1) + x + x + x; - - m_blender.blend_pix(p, c.r, c.g, c.b, alpha, cover); - } - while(--len); - } - } - } - - - //-------------------------------------------------------------------- - void blend_solid_hspan(int x, int y, - unsigned len, - const color_type& c, - const int8u* covers) - { - if (c.a) - { - value_type* p = (value_type*) - m_rbuf->row_ptr(x, y, len) + x + x + x; - - do - { - calc_type alpha = (calc_type(c.a) * (calc_type(*covers) + 1)) >> 8; - if(alpha == base_mask) - { - p[order_type::R] = c.r; - p[order_type::G] = c.g; - p[order_type::B] = c.b; - } - else - { - m_blender.blend_pix(p, c.r, c.g, c.b, alpha, *covers); - } + p[order_type::R] = c.r; + p[order_type::G] = c.g; + p[order_type::B] = c.b; p += 3; - ++covers; - } - while(--len); - } - } - - - //-------------------------------------------------------------------- - void blend_solid_vspan(int x, int y, - unsigned len, - const color_type& c, - const int8u* covers) - { - if (c.a) - { - do - { - value_type* p = (value_type*) - m_rbuf->row_ptr(x, y++, 1) + x + x + x; - - calc_type alpha = (calc_type(c.a) * (calc_type(*covers) + 1)) >> 8; - if(alpha == base_mask) - { - p[order_type::R] = c.r; - p[order_type::G] = c.g; - p[order_type::B] = c.b; - } - else - { - m_blender.blend_pix(p, c.r, c.g, c.b, alpha, *covers); - } - ++covers; - } - while(--len); - } - } - - - //-------------------------------------------------------------------- - void copy_color_hspan(int x, int y, - unsigned len, - const color_type* colors) - { - value_type* p = (value_type*) - m_rbuf->row_ptr(x, y, len) + x + x + x; - - do - { - p[order_type::R] = colors->r; - p[order_type::G] = colors->g; - p[order_type::B] = colors->b; - ++colors; - p += 3; - } - while(--len); - } - - - //-------------------------------------------------------------------- - void copy_color_vspan(int x, int y, - unsigned len, - const color_type* colors) - { - do - { - value_type* p = (value_type*) - m_rbuf->row_ptr(x, y++, 1) + x + x + x; - p[order_type::R] = colors->r; - p[order_type::G] = colors->g; - p[order_type::B] = colors->b; - ++colors; - } - while(--len); - } - - - //-------------------------------------------------------------------- - void blend_color_hspan(int x, int y, - unsigned len, - const color_type* colors, - const int8u* covers, - int8u cover) - { - value_type* p = (value_type*) - m_rbuf->row_ptr(x, y, len) + x + x + x; - - if(covers) - { - do - { - copy_or_blend_pix(p, *colors++, *covers++); - p += 3; - } - while(--len); + } while (--len); } else { - if(cover == 255) + do { - do - { - copy_or_blend_pix(p, *colors++); - p += 3; - } - while(--len); - } - else - { - do - { - copy_or_blend_pix(p, *colors++, cover); - p += 3; - } - while(--len); - } + m_blender.blend_pix(p, c.r, c.g, c.b, alpha, cover); + p += 3; + } while (--len); } } + } - - - //-------------------------------------------------------------------- - void blend_color_vspan(int x, int y, - unsigned len, - const color_type* colors, - const int8u* covers, - int8u cover) + //-------------------------------------------------------------------- + void blend_vline(int x, int y, unsigned len, const color_type& c, int8u cover) + { + if (c.a) { value_type* p; - if(covers) + calc_type alpha = (calc_type(c.a) * (cover + 1)) >> 8; + if (alpha == base_mask) { - do + do { - p = (value_type*) - m_rbuf->row_ptr(x, y++, 1) + x + x + x; + p = (value_type*)m_rbuf->row_ptr(x, y++, 1) + x + x + x; - copy_or_blend_pix(p, *colors++, *covers++); - } - while(--len); + p[order_type::R] = c.r; + p[order_type::G] = c.g; + p[order_type::B] = c.b; + } while (--len); } else { - if(cover == 255) + do { - do - { - p = (value_type*) - m_rbuf->row_ptr(x, y++, 1) + x + x + x; + p = (value_type*)m_rbuf->row_ptr(x, y++, 1) + x + x + x; - copy_or_blend_pix(p, *colors++); - } - while(--len); + m_blender.blend_pix(p, c.r, c.g, c.b, alpha, cover); + } while (--len); + } + } + } + + //-------------------------------------------------------------------- + void blend_solid_hspan(int x, int y, unsigned len, const color_type& c, const int8u* covers) + { + if (c.a) + { + value_type* p = (value_type*)m_rbuf->row_ptr(x, y, len) + x + x + x; + + do + { + calc_type alpha = (calc_type(c.a) * (calc_type(*covers) + 1)) >> 8; + if (alpha == base_mask) + { + p[order_type::R] = c.r; + p[order_type::G] = c.g; + p[order_type::B] = c.b; } else { - do - { - p = (value_type*) - m_rbuf->row_ptr(x, y++, 1) + x + x + x; - - copy_or_blend_pix(p, *colors++, cover); - } - while(--len); + m_blender.blend_pix(p, c.r, c.g, c.b, alpha, *covers); } - } + p += 3; + ++covers; + } while (--len); } + } - //-------------------------------------------------------------------- - template void for_each_pixel(Function f) + //-------------------------------------------------------------------- + void blend_solid_vspan(int x, int y, unsigned len, const color_type& c, const int8u* covers) + { + if (c.a) { - unsigned y; - for(y = 0; y < height(); ++y) + do { - row_data r = m_rbuf->row(y); - if(r.ptr) + value_type* p = (value_type*)m_rbuf->row_ptr(x, y++, 1) + x + x + x; + + calc_type alpha = (calc_type(c.a) * (calc_type(*covers) + 1)) >> 8; + if (alpha == base_mask) { - unsigned len = r.x2 - r.x1 + 1; - value_type* p = (value_type*) - m_rbuf->row_ptr(r.x1, y, len) + r.x1 * 3; - do - { - f(p); - p += 3; - } - while(--len); + p[order_type::R] = c.r; + p[order_type::G] = c.g; + p[order_type::B] = c.b; } - } + else + { + m_blender.blend_pix(p, c.r, c.g, c.b, alpha, *covers); + } + ++covers; + } while (--len); } + } - //-------------------------------------------------------------------- - template void apply_gamma_dir(const GammaLut& g) - { - for_each_pixel(apply_gamma_dir_rgb(g)); - } + //-------------------------------------------------------------------- + void copy_color_hspan(int x, int y, unsigned len, const color_type* colors) + { + value_type* p = (value_type*)m_rbuf->row_ptr(x, y, len) + x + x + x; - //-------------------------------------------------------------------- - template void apply_gamma_inv(const GammaLut& g) + do { - for_each_pixel(apply_gamma_inv_rgb(g)); - } + p[order_type::R] = colors->r; + p[order_type::G] = colors->g; + p[order_type::B] = colors->b; + ++colors; + p += 3; + } while (--len); + } - //-------------------------------------------------------------------- - template - void copy_from(const RenBuf2& from, - int xdst, int ydst, - int xsrc, int ysrc, - unsigned len) + //-------------------------------------------------------------------- + void copy_color_vspan(int x, int y, unsigned len, const color_type* colors) + { + do { - const int8u* p = from.row_ptr(ysrc); - if(p) + value_type* p = (value_type*)m_rbuf->row_ptr(x, y++, 1) + x + x + x; + p[order_type::R] = colors->r; + p[order_type::G] = colors->g; + p[order_type::B] = colors->b; + ++colors; + } while (--len); + } + + //-------------------------------------------------------------------- + void blend_color_hspan(int x, int y, unsigned len, const color_type* colors, const int8u* covers, int8u cover) + { + value_type* p = (value_type*)m_rbuf->row_ptr(x, y, len) + x + x + x; + + if (covers) + { + do { - memmove(m_rbuf->row_ptr(xdst, ydst, len) + xdst * pix_width, - p + xsrc * pix_width, - len * pix_width); + copy_or_blend_pix(p, *colors++, *covers++); + p += 3; + } while (--len); + } + else + { + if (cover == 255) + { + do + { + copy_or_blend_pix(p, *colors++); + p += 3; + } while (--len); + } + else + { + do + { + copy_or_blend_pix(p, *colors++, cover); + p += 3; + } while (--len); } } + } + //-------------------------------------------------------------------- + void blend_color_vspan(int x, int y, unsigned len, const color_type* colors, const int8u* covers, int8u cover) + { + value_type* p; + if (covers) + { + do + { + p = (value_type*)m_rbuf->row_ptr(x, y++, 1) + x + x + x; - //-------------------------------------------------------------------- - template - void blend_from(const SrcPixelFormatRenderer& from, - int xdst, int ydst, - int xsrc, int ysrc, + copy_or_blend_pix(p, *colors++, *covers++); + } while (--len); + } + else + { + if (cover == 255) + { + do + { + p = (value_type*)m_rbuf->row_ptr(x, y++, 1) + x + x + x; + + copy_or_blend_pix(p, *colors++); + } while (--len); + } + else + { + do + { + p = (value_type*)m_rbuf->row_ptr(x, y++, 1) + x + x + x; + + copy_or_blend_pix(p, *colors++, cover); + } while (--len); + } + } + } + + //-------------------------------------------------------------------- + template + void for_each_pixel(Function f) + { + unsigned y; + for (y = 0; y < height(); ++y) + { + row_data r = m_rbuf->row(y); + if (r.ptr) + { + unsigned len = r.x2 - r.x1 + 1; + value_type* p = (value_type*)m_rbuf->row_ptr(r.x1, y, len) + r.x1 * 3; + do + { + f(p); + p += 3; + } while (--len); + } + } + } + + //-------------------------------------------------------------------- + template + void apply_gamma_dir(const GammaLut& g) + { + for_each_pixel(apply_gamma_dir_rgb(g)); + } + + //-------------------------------------------------------------------- + template + void apply_gamma_inv(const GammaLut& g) + { + for_each_pixel(apply_gamma_inv_rgb(g)); + } + + //-------------------------------------------------------------------- + template + void copy_from(const RenBuf2& from, int xdst, int ydst, int xsrc, int ysrc, unsigned len) + { + const int8u* p = from.row_ptr(ysrc); + if (p) + { + memmove(m_rbuf->row_ptr(xdst, ydst, len) + xdst * pix_width, p + xsrc * pix_width, len * pix_width); + } + } + + //-------------------------------------------------------------------- + template + void + blend_from(const SrcPixelFormatRenderer& from, int xdst, int ydst, int xsrc, int ysrc, unsigned len, int8u cover) + { + typedef typename SrcPixelFormatRenderer::order_type src_order; + + const value_type* psrc = (const value_type*)from.row_ptr(ysrc); + if (psrc) + { + psrc += xsrc * 4; + value_type* pdst = (value_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst * 3; + + if (cover == 255) + { + do + { + value_type alpha = psrc[src_order::A]; + if (alpha) + { + if (alpha == base_mask) + { + pdst[order_type::R] = psrc[src_order::R]; + pdst[order_type::G] = psrc[src_order::G]; + pdst[order_type::B] = psrc[src_order::B]; + } + else + { + m_blender.blend_pix(pdst, + psrc[src_order::R], + psrc[src_order::G], + psrc[src_order::B], + alpha); + } + } + psrc += 4; + pdst += 3; + } while (--len); + } + else + { + color_type color; + do + { + color.r = psrc[src_order::R]; + color.g = psrc[src_order::G]; + color.b = psrc[src_order::B]; + color.a = psrc[src_order::A]; + copy_or_blend_pix(pdst, color, cover); + psrc += 4; + pdst += 3; + } while (--len); + } + } + } + + //-------------------------------------------------------------------- + template + void blend_from_color(const SrcPixelFormatRenderer& from, + const color_type& color, + int xdst, + int ydst, + int xsrc, + int ysrc, + unsigned len, + int8u cover) + { + typedef typename SrcPixelFormatRenderer::value_type src_value_type; + const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc); + if (psrc) + { + value_type* pdst = (value_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst * 3; + do + { + copy_or_blend_pix(pdst, color, (*psrc * cover + base_mask) >> base_shift); + ++psrc; + pdst += 3; + } while (--len); + } + } + + //-------------------------------------------------------------------- + template + void blend_from_lut(const SrcPixelFormatRenderer& from, + const color_type* color_lut, + int xdst, + int ydst, + int xsrc, + int ysrc, unsigned len, int8u cover) + { + typedef typename SrcPixelFormatRenderer::value_type src_value_type; + const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc); + if (psrc) { - typedef typename SrcPixelFormatRenderer::order_type src_order; + value_type* pdst = (value_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst * 3; - const value_type* psrc = (const value_type*)from.row_ptr(ysrc); - if(psrc) + if (cover == 255) { - psrc += xsrc * 4; - value_type* pdst = - (value_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst * 3; - - if(cover == 255) + do { - do - { - value_type alpha = psrc[src_order::A]; - if(alpha) - { - if(alpha == base_mask) - { - pdst[order_type::R] = psrc[src_order::R]; - pdst[order_type::G] = psrc[src_order::G]; - pdst[order_type::B] = psrc[src_order::B]; - } - else - { - m_blender.blend_pix(pdst, - psrc[src_order::R], - psrc[src_order::G], - psrc[src_order::B], - alpha); - } - } - psrc += 4; - pdst += 3; - } - while(--len); - } - else - { - color_type color; - do - { - color.r = psrc[src_order::R]; - color.g = psrc[src_order::G]; - color.b = psrc[src_order::B]; - color.a = psrc[src_order::A]; - copy_or_blend_pix(pdst, color, cover); - psrc += 4; - pdst += 3; - } - while(--len); - } - } - } - - //-------------------------------------------------------------------- - template - void blend_from_color(const SrcPixelFormatRenderer& from, - const color_type& color, - int xdst, int ydst, - int xsrc, int ysrc, - unsigned len, - int8u cover) - { - typedef typename SrcPixelFormatRenderer::value_type src_value_type; - const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc); - if(psrc) - { - value_type* pdst = - (value_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst * 3; - do - { - copy_or_blend_pix(pdst, - color, - (*psrc * cover + base_mask) >> base_shift); + const color_type& color = color_lut[*psrc]; + m_blender.blend_pix(pdst, color.r, color.g, color.b, color.a); ++psrc; pdst += 3; - } - while(--len); + } while (--len); } - } - - //-------------------------------------------------------------------- - template - void blend_from_lut(const SrcPixelFormatRenderer& from, - const color_type* color_lut, - int xdst, int ydst, - int xsrc, int ysrc, - unsigned len, - int8u cover) - { - typedef typename SrcPixelFormatRenderer::value_type src_value_type; - const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc); - if(psrc) + else { - value_type* pdst = - (value_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst * 3; - - if(cover == 255) + do { - do - { - const color_type& color = color_lut[*psrc]; - m_blender.blend_pix(pdst, - color.r, color.g, color.b, color.a); - ++psrc; - pdst += 3; - } - while(--len); - } - else - { - do - { - copy_or_blend_pix(pdst, color_lut[*psrc], cover); - ++psrc; - pdst += 3; - } - while(--len); - } + copy_or_blend_pix(pdst, color_lut[*psrc], cover); + ++psrc; + pdst += 3; + } while (--len); } } + } - private: - rbuf_type* m_rbuf; - Blender m_blender; - }; + private: + rbuf_type* m_rbuf; + Blender m_blender; +}; - typedef pixfmt_alpha_blend_rgb, rendering_buffer> pixfmt_rgb24; //----pixfmt_rgb24 - typedef pixfmt_alpha_blend_rgb, rendering_buffer> pixfmt_bgr24; //----pixfmt_bgr24 - typedef pixfmt_alpha_blend_rgb, rendering_buffer> pixfmt_rgb48; //----pixfmt_rgb48 - typedef pixfmt_alpha_blend_rgb, rendering_buffer> pixfmt_bgr48; //----pixfmt_bgr48 +typedef pixfmt_alpha_blend_rgb, rendering_buffer> pixfmt_rgb24; //----pixfmt_rgb24 +typedef pixfmt_alpha_blend_rgb, rendering_buffer> pixfmt_bgr24; //----pixfmt_bgr24 +typedef pixfmt_alpha_blend_rgb, rendering_buffer> pixfmt_rgb48; //----pixfmt_rgb48 +typedef pixfmt_alpha_blend_rgb, rendering_buffer> pixfmt_bgr48; //----pixfmt_bgr48 - typedef pixfmt_alpha_blend_rgb, rendering_buffer> pixfmt_rgb24_pre; //----pixfmt_rgb24_pre - typedef pixfmt_alpha_blend_rgb, rendering_buffer> pixfmt_bgr24_pre; //----pixfmt_bgr24_pre - typedef pixfmt_alpha_blend_rgb, rendering_buffer> pixfmt_rgb48_pre; //----pixfmt_rgb48_pre - typedef pixfmt_alpha_blend_rgb, rendering_buffer> pixfmt_bgr48_pre; //----pixfmt_bgr48_pre +typedef pixfmt_alpha_blend_rgb, rendering_buffer> + pixfmt_rgb24_pre; //----pixfmt_rgb24_pre +typedef pixfmt_alpha_blend_rgb, rendering_buffer> + pixfmt_bgr24_pre; //----pixfmt_bgr24_pre +typedef pixfmt_alpha_blend_rgb, rendering_buffer> + pixfmt_rgb48_pre; //----pixfmt_rgb48_pre +typedef pixfmt_alpha_blend_rgb, rendering_buffer> + pixfmt_bgr48_pre; //----pixfmt_bgr48_pre - //-----------------------------------------------------pixfmt_rgb24_gamma - template class pixfmt_rgb24_gamma : - public pixfmt_alpha_blend_rgb, rendering_buffer> +//-----------------------------------------------------pixfmt_rgb24_gamma +template +class pixfmt_rgb24_gamma : public pixfmt_alpha_blend_rgb, rendering_buffer> +{ + public: + pixfmt_rgb24_gamma(rendering_buffer& rb, const Gamma& g) + : pixfmt_alpha_blend_rgb, rendering_buffer>(rb) { - public: - pixfmt_rgb24_gamma(rendering_buffer& rb, const Gamma& g) : - pixfmt_alpha_blend_rgb, rendering_buffer>(rb) - { - this->blender().gamma(g); - } - }; - - //-----------------------------------------------------pixfmt_bgr24_gamma - template class pixfmt_bgr24_gamma : - public pixfmt_alpha_blend_rgb, rendering_buffer> - { - public: - pixfmt_bgr24_gamma(rendering_buffer& rb, const Gamma& g) : - pixfmt_alpha_blend_rgb, rendering_buffer>(rb) - { - this->blender().gamma(g); - } - }; + this->blender().gamma(g); + } +}; - //-----------------------------------------------------pixfmt_rgb48_gamma - template class pixfmt_rgb48_gamma : - public pixfmt_alpha_blend_rgb, rendering_buffer> +//-----------------------------------------------------pixfmt_bgr24_gamma +template +class pixfmt_bgr24_gamma : public pixfmt_alpha_blend_rgb, rendering_buffer> +{ + public: + pixfmt_bgr24_gamma(rendering_buffer& rb, const Gamma& g) + : pixfmt_alpha_blend_rgb, rendering_buffer>(rb) { - public: - pixfmt_rgb48_gamma(rendering_buffer& rb, const Gamma& g) : - pixfmt_alpha_blend_rgb, rendering_buffer>(rb) - { - this->blender().gamma(g); - } - }; - - //-----------------------------------------------------pixfmt_bgr48_gamma - template class pixfmt_bgr48_gamma : - public pixfmt_alpha_blend_rgb, rendering_buffer> + this->blender().gamma(g); + } +}; + +//-----------------------------------------------------pixfmt_rgb48_gamma +template +class pixfmt_rgb48_gamma : public pixfmt_alpha_blend_rgb, rendering_buffer> +{ + public: + pixfmt_rgb48_gamma(rendering_buffer& rb, const Gamma& g) + : pixfmt_alpha_blend_rgb, rendering_buffer>(rb) { - public: - pixfmt_bgr48_gamma(rendering_buffer& rb, const Gamma& g) : - pixfmt_alpha_blend_rgb, rendering_buffer>(rb) - { - this->blender().gamma(g); - } - }; + this->blender().gamma(g); + } +}; +//-----------------------------------------------------pixfmt_bgr48_gamma +template +class pixfmt_bgr48_gamma : public pixfmt_alpha_blend_rgb, rendering_buffer> +{ + public: + pixfmt_bgr48_gamma(rendering_buffer& rb, const Gamma& g) + : pixfmt_alpha_blend_rgb, rendering_buffer>(rb) + { + this->blender().gamma(g); + } +}; -} +} // namespace agg #endif - diff --git a/deps/agg/include/agg_pixfmt_rgb_packed.h b/deps/agg/include/agg_pixfmt_rgb_packed.h index 82ce9c605..9f8451854 100644 --- a/deps/agg/include/agg_pixfmt_rgb_packed.h +++ b/deps/agg/include/agg_pixfmt_rgb_packed.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -13,12 +13,12 @@ // http://www.antigrain.com //---------------------------------------------------------------------------- // -// Adaptation for high precision colors has been sponsored by +// Adaptation for high precision colors has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. -// +// //---------------------------------------------------------------------------- #ifndef AGG_PIXFMT_RGB_PACKED_INCLUDED @@ -29,1281 +29,1044 @@ #include "agg_color_rgba.h" #include "agg_rendering_buffer.h" -namespace agg +namespace agg { +//=========================================================blender_rgb555 +struct blender_rgb555 { - //=========================================================blender_rgb555 - struct blender_rgb555 + typedef rgba8 color_type; + typedef color_type::value_type value_type; + typedef color_type::calc_type calc_type; + typedef int16u pixel_type; + + static AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned) { - typedef rgba8 color_type; - typedef color_type::value_type value_type; - typedef color_type::calc_type calc_type; - typedef int16u pixel_type; + pixel_type rgb = *p; + calc_type r = (rgb >> 7) & 0xF8; + calc_type g = (rgb >> 2) & 0xF8; + calc_type b = (rgb << 3) & 0xF8; + *p = (pixel_type)(((((cr - r) * alpha + (r << 8)) >> 1) & 0x7C00) | + ((((cg - g) * alpha + (g << 8)) >> 6) & 0x03E0) | (((cb - b) * alpha + (b << 8)) >> 11) | + 0x8000); + } - static AGG_INLINE void blend_pix(pixel_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha, - unsigned) - { - pixel_type rgb = *p; - calc_type r = (rgb >> 7) & 0xF8; - calc_type g = (rgb >> 2) & 0xF8; - calc_type b = (rgb << 3) & 0xF8; - *p = (pixel_type) - (((((cr - r) * alpha + (r << 8)) >> 1) & 0x7C00) | - ((((cg - g) * alpha + (g << 8)) >> 6) & 0x03E0) | - (((cb - b) * alpha + (b << 8)) >> 11) | 0x8000); - } + static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) + { + return (pixel_type)(((r & 0xF8) << 7) | ((g & 0xF8) << 2) | (b >> 3) | 0x8000); + } - static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) - { - return (pixel_type)(((r & 0xF8) << 7) | - ((g & 0xF8) << 2) | - (b >> 3) | 0x8000); - } + static AGG_INLINE color_type make_color(pixel_type p) + { + return color_type((p >> 7) & 0xF8, (p >> 2) & 0xF8, (p << 3) & 0xF8); + } +}; - static AGG_INLINE color_type make_color(pixel_type p) - { - return color_type((p >> 7) & 0xF8, - (p >> 2) & 0xF8, - (p << 3) & 0xF8); - } +//=====================================================blender_rgb555_pre +struct blender_rgb555_pre +{ + typedef rgba8 color_type; + typedef color_type::value_type value_type; + typedef color_type::calc_type calc_type; + typedef int16u pixel_type; + + static AGG_INLINE void + blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned cover) + { + alpha = color_type::base_mask - alpha; + pixel_type rgb = *p; + calc_type r = (rgb >> 7) & 0xF8; + calc_type g = (rgb >> 2) & 0xF8; + calc_type b = (rgb << 3) & 0xF8; + *p = (pixel_type)((((r * alpha + cr * cover) >> 1) & 0x7C00) | (((g * alpha + cg * cover) >> 6) & 0x03E0) | + ((b * alpha + cb * cover) >> 11) | 0x8000); + } + + static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) + { + return (pixel_type)(((r & 0xF8) << 7) | ((g & 0xF8) << 2) | (b >> 3) | 0x8000); + } + + static AGG_INLINE color_type make_color(pixel_type p) + { + return color_type((p >> 7) & 0xF8, (p >> 2) & 0xF8, (p << 3) & 0xF8); + } +}; + +//=====================================================blender_rgb555_gamma +template +class blender_rgb555_gamma +{ + public: + typedef rgba8 color_type; + typedef color_type::value_type value_type; + typedef color_type::calc_type calc_type; + typedef int16u pixel_type; + typedef Gamma gamma_type; + + blender_rgb555_gamma() + : m_gamma(0) + {} + void gamma(const gamma_type& g) { m_gamma = &g; } + + AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned) + { + pixel_type rgb = *p; + calc_type r = m_gamma->dir((rgb >> 7) & 0xF8); + calc_type g = m_gamma->dir((rgb >> 2) & 0xF8); + calc_type b = m_gamma->dir((rgb << 3) & 0xF8); + *p = (pixel_type)(((m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 8)) >> 8) << 7) & 0x7C00) | + ((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 8)) >> 8) << 2) & 0x03E0) | + (m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 8)) >> 8) >> 3) | 0x8000); + } + + static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) + { + return (pixel_type)(((r & 0xF8) << 7) | ((g & 0xF8) << 2) | (b >> 3) | 0x8000); + } + + static AGG_INLINE color_type make_color(pixel_type p) + { + return color_type((p >> 7) & 0xF8, (p >> 2) & 0xF8, (p << 3) & 0xF8); + } + + private: + const Gamma* m_gamma; +}; + +//=========================================================blender_rgb565 +struct blender_rgb565 +{ + typedef rgba8 color_type; + typedef color_type::value_type value_type; + typedef color_type::calc_type calc_type; + typedef int16u pixel_type; + + static AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned) + { + pixel_type rgb = *p; + calc_type r = (rgb >> 8) & 0xF8; + calc_type g = (rgb >> 3) & 0xFC; + calc_type b = (rgb << 3) & 0xF8; + *p = (pixel_type)(((((cr - r) * alpha + (r << 8))) & 0xF800) | ((((cg - g) * alpha + (g << 8)) >> 5) & 0x07E0) | + (((cb - b) * alpha + (b << 8)) >> 11)); + } + + static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) + { + return (pixel_type)(((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3)); + } + + static AGG_INLINE color_type make_color(pixel_type p) + { + return color_type((p >> 8) & 0xF8, (p >> 3) & 0xFC, (p << 3) & 0xF8); + } +}; + +//=====================================================blender_rgb565_pre +struct blender_rgb565_pre +{ + typedef rgba8 color_type; + typedef color_type::value_type value_type; + typedef color_type::calc_type calc_type; + typedef int16u pixel_type; + + static AGG_INLINE void + blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned cover) + { + alpha = color_type::base_mask - alpha; + pixel_type rgb = *p; + calc_type r = (rgb >> 8) & 0xF8; + calc_type g = (rgb >> 3) & 0xFC; + calc_type b = (rgb << 3) & 0xF8; + *p = (pixel_type)((((r * alpha + cr * cover)) & 0xF800) | (((g * alpha + cg * cover) >> 5) & 0x07E0) | + ((b * alpha + cb * cover) >> 11)); + } + + static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) + { + return (pixel_type)(((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3)); + } + + static AGG_INLINE color_type make_color(pixel_type p) + { + return color_type((p >> 8) & 0xF8, (p >> 3) & 0xFC, (p << 3) & 0xF8); + } +}; + +//=====================================================blender_rgb565_gamma +template +class blender_rgb565_gamma +{ + public: + typedef rgba8 color_type; + typedef color_type::value_type value_type; + typedef color_type::calc_type calc_type; + typedef int16u pixel_type; + typedef Gamma gamma_type; + + blender_rgb565_gamma() + : m_gamma(0) + {} + void gamma(const gamma_type& g) { m_gamma = &g; } + + AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned) + { + pixel_type rgb = *p; + calc_type r = m_gamma->dir((rgb >> 8) & 0xF8); + calc_type g = m_gamma->dir((rgb >> 3) & 0xFC); + calc_type b = m_gamma->dir((rgb << 3) & 0xF8); + *p = (pixel_type)(((m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 8)) >> 8) << 8) & 0xF800) | + ((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 8)) >> 8) << 3) & 0x07E0) | + (m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 8)) >> 8) >> 3)); + } + + static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) + { + return (pixel_type)(((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3)); + } + + static AGG_INLINE color_type make_color(pixel_type p) + { + return color_type((p >> 8) & 0xF8, (p >> 3) & 0xFC, (p << 3) & 0xF8); + } + + private: + const Gamma* m_gamma; +}; + +//=====================================================blender_rgbAAA +struct blender_rgbAAA +{ + typedef rgba16 color_type; + typedef color_type::value_type value_type; + typedef color_type::calc_type calc_type; + typedef int32u pixel_type; + + static AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned) + { + pixel_type rgb = *p; + calc_type r = (rgb >> 14) & 0xFFC0; + calc_type g = (rgb >> 4) & 0xFFC0; + calc_type b = (rgb << 6) & 0xFFC0; + *p = (pixel_type)(((((cr - r) * alpha + (r << 16)) >> 2) & 0x3FF00000) | + ((((cg - g) * alpha + (g << 16)) >> 12) & 0x000FFC00) | + (((cb - b) * alpha + (b << 16)) >> 22) | 0xC0000000); + } + + static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) + { + return (pixel_type)(((r & 0xFFC0) << 14) | ((g & 0xFFC0) << 4) | (b >> 6) | 0xC0000000); + } + + static AGG_INLINE color_type make_color(pixel_type p) + { + return color_type((p >> 14) & 0xFFC0, (p >> 4) & 0xFFC0, (p << 6) & 0xFFC0); + } +}; + +//==================================================blender_rgbAAA_pre +struct blender_rgbAAA_pre +{ + typedef rgba16 color_type; + typedef color_type::value_type value_type; + typedef color_type::calc_type calc_type; + typedef int32u pixel_type; + + static AGG_INLINE void + blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned cover) + { + alpha = color_type::base_mask - alpha; + cover = (cover + 1) << (color_type::base_shift - 8); + pixel_type rgb = *p; + calc_type r = (rgb >> 14) & 0xFFC0; + calc_type g = (rgb >> 4) & 0xFFC0; + calc_type b = (rgb << 6) & 0xFFC0; + *p = + (pixel_type)((((r * alpha + cr * cover) >> 2) & 0x3FF00000) | + (((g * alpha + cg * cover) >> 12) & 0x000FFC00) | ((b * alpha + cb * cover) >> 22) | 0xC0000000); + } + + static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) + { + return (pixel_type)(((r & 0xFFC0) << 14) | ((g & 0xFFC0) << 4) | (b >> 6) | 0xC0000000); + } + + static AGG_INLINE color_type make_color(pixel_type p) + { + return color_type((p >> 14) & 0xFFC0, (p >> 4) & 0xFFC0, (p << 6) & 0xFFC0); + } +}; + +//=================================================blender_rgbAAA_gamma +template +class blender_rgbAAA_gamma +{ + public: + typedef rgba16 color_type; + typedef color_type::value_type value_type; + typedef color_type::calc_type calc_type; + typedef int32u pixel_type; + typedef Gamma gamma_type; + + blender_rgbAAA_gamma() + : m_gamma(0) + {} + void gamma(const gamma_type& g) { m_gamma = &g; } + + AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned) + { + pixel_type rgb = *p; + calc_type r = m_gamma->dir((rgb >> 14) & 0xFFC0); + calc_type g = m_gamma->dir((rgb >> 4) & 0xFFC0); + calc_type b = m_gamma->dir((rgb << 6) & 0xFFC0); + *p = (pixel_type)(((m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 16)) >> 16) << 14) & 0x3FF00000) | + ((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 16)) >> 16) << 4) & 0x000FFC00) | + (m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 16)) >> 16) >> 6) | 0xC0000000); + } + + static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) + { + return (pixel_type)(((r & 0xFFC0) << 14) | ((g & 0xFFC0) << 4) | (b >> 6) | 0xC0000000); + } + + static AGG_INLINE color_type make_color(pixel_type p) + { + return color_type((p >> 14) & 0xFFC0, (p >> 4) & 0xFFC0, (p << 6) & 0xFFC0); + } + + private: + const Gamma* m_gamma; +}; + +//=====================================================blender_bgrAAA +struct blender_bgrAAA +{ + typedef rgba16 color_type; + typedef color_type::value_type value_type; + typedef color_type::calc_type calc_type; + typedef int32u pixel_type; + + static AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned) + { + pixel_type bgr = *p; + calc_type b = (bgr >> 14) & 0xFFC0; + calc_type g = (bgr >> 4) & 0xFFC0; + calc_type r = (bgr << 6) & 0xFFC0; + *p = (pixel_type)(((((cb - b) * alpha + (b << 16)) >> 2) & 0x3FF00000) | + ((((cg - g) * alpha + (g << 16)) >> 12) & 0x000FFC00) | + (((cr - r) * alpha + (r << 16)) >> 22) | 0xC0000000); + } + + static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) + { + return (pixel_type)(((b & 0xFFC0) << 14) | ((g & 0xFFC0) << 4) | (r >> 6) | 0xC0000000); + } + + static AGG_INLINE color_type make_color(pixel_type p) + { + return color_type((p << 6) & 0xFFC0, (p >> 4) & 0xFFC0, (p >> 14) & 0xFFC0); + } +}; + +//=================================================blender_bgrAAA_pre +struct blender_bgrAAA_pre +{ + typedef rgba16 color_type; + typedef color_type::value_type value_type; + typedef color_type::calc_type calc_type; + typedef int32u pixel_type; + + static AGG_INLINE void + blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned cover) + { + alpha = color_type::base_mask - alpha; + cover = (cover + 1) << (color_type::base_shift - 8); + pixel_type bgr = *p; + calc_type b = (bgr >> 14) & 0xFFC0; + calc_type g = (bgr >> 4) & 0xFFC0; + calc_type r = (bgr << 6) & 0xFFC0; + *p = + (pixel_type)((((b * alpha + cb * cover) >> 2) & 0x3FF00000) | + (((g * alpha + cg * cover) >> 12) & 0x000FFC00) | ((r * alpha + cr * cover) >> 22) | 0xC0000000); + } + + static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) + { + return (pixel_type)(((b & 0xFFC0) << 14) | ((g & 0xFFC0) << 4) | (r >> 6) | 0xC0000000); + } + + static AGG_INLINE color_type make_color(pixel_type p) + { + return color_type((p << 6) & 0xFFC0, (p >> 4) & 0xFFC0, (p >> 14) & 0xFFC0); + } +}; + +//=================================================blender_bgrAAA_gamma +template +class blender_bgrAAA_gamma +{ + public: + typedef rgba16 color_type; + typedef color_type::value_type value_type; + typedef color_type::calc_type calc_type; + typedef int32u pixel_type; + typedef Gamma gamma_type; + + blender_bgrAAA_gamma() + : m_gamma(0) + {} + void gamma(const gamma_type& g) { m_gamma = &g; } + + AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned) + { + pixel_type bgr = *p; + calc_type b = m_gamma->dir((bgr >> 14) & 0xFFC0); + calc_type g = m_gamma->dir((bgr >> 4) & 0xFFC0); + calc_type r = m_gamma->dir((bgr << 6) & 0xFFC0); + *p = (pixel_type)(((m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 16)) >> 16) << 14) & 0x3FF00000) | + ((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 16)) >> 16) << 4) & 0x000FFC00) | + (m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 16)) >> 16) >> 6) | 0xC0000000); + } + + static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) + { + return (pixel_type)(((b & 0xFFC0) << 14) | ((g & 0xFFC0) << 4) | (r >> 6) | 0xC0000000); + } + + static AGG_INLINE color_type make_color(pixel_type p) + { + return color_type((p << 6) & 0xFFC0, (p >> 4) & 0xFFC0, (p >> 14) & 0xFFC0); + } + + private: + const Gamma* m_gamma; +}; + +//=====================================================blender_rgbBBA +struct blender_rgbBBA +{ + typedef rgba16 color_type; + typedef color_type::value_type value_type; + typedef color_type::calc_type calc_type; + typedef int32u pixel_type; + + static AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned) + { + pixel_type rgb = *p; + calc_type r = (rgb >> 16) & 0xFFE0; + calc_type g = (rgb >> 5) & 0xFFE0; + calc_type b = (rgb << 6) & 0xFFC0; + *p = + (pixel_type)(((((cr - r) * alpha + (r << 16))) & 0xFFE00000) | + ((((cg - g) * alpha + (g << 16)) >> 11) & 0x001FFC00) | (((cb - b) * alpha + (b << 16)) >> 22)); + } + + static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) + { + return (pixel_type)(((r & 0xFFE0) << 16) | ((g & 0xFFE0) << 5) | (b >> 6)); + } + + static AGG_INLINE color_type make_color(pixel_type p) + { + return color_type((p >> 16) & 0xFFE0, (p >> 5) & 0xFFE0, (p << 6) & 0xFFC0); + } +}; + +//=================================================blender_rgbBBA_pre +struct blender_rgbBBA_pre +{ + typedef rgba16 color_type; + typedef color_type::value_type value_type; + typedef color_type::calc_type calc_type; + typedef int32u pixel_type; + + static AGG_INLINE void + blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned cover) + { + alpha = color_type::base_mask - alpha; + cover = (cover + 1) << (color_type::base_shift - 8); + pixel_type rgb = *p; + calc_type r = (rgb >> 16) & 0xFFE0; + calc_type g = (rgb >> 5) & 0xFFE0; + calc_type b = (rgb << 6) & 0xFFC0; + *p = (pixel_type)((((r * alpha + cr * cover)) & 0xFFE00000) | (((g * alpha + cg * cover) >> 11) & 0x001FFC00) | + ((b * alpha + cb * cover) >> 22)); + } + + static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) + { + return (pixel_type)(((r & 0xFFE0) << 16) | ((g & 0xFFE0) << 5) | (b >> 6)); + } + + static AGG_INLINE color_type make_color(pixel_type p) + { + return color_type((p >> 16) & 0xFFE0, (p >> 5) & 0xFFE0, (p << 6) & 0xFFC0); + } +}; + +//=================================================blender_rgbBBA_gamma +template +class blender_rgbBBA_gamma +{ + public: + typedef rgba16 color_type; + typedef color_type::value_type value_type; + typedef color_type::calc_type calc_type; + typedef int32u pixel_type; + typedef Gamma gamma_type; + + blender_rgbBBA_gamma() + : m_gamma(0) + {} + void gamma(const gamma_type& g) { m_gamma = &g; } + + AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned) + { + pixel_type rgb = *p; + calc_type r = m_gamma->dir((rgb >> 16) & 0xFFE0); + calc_type g = m_gamma->dir((rgb >> 5) & 0xFFE0); + calc_type b = m_gamma->dir((rgb << 6) & 0xFFC0); + *p = (pixel_type)(((m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 16)) >> 16) << 16) & 0xFFE00000) | + ((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 16)) >> 16) << 5) & 0x001FFC00) | + (m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 16)) >> 16) >> 6)); + } + + static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) + { + return (pixel_type)(((r & 0xFFE0) << 16) | ((g & 0xFFE0) << 5) | (b >> 6)); + } + + static AGG_INLINE color_type make_color(pixel_type p) + { + return color_type((p >> 16) & 0xFFE0, (p >> 5) & 0xFFE0, (p << 6) & 0xFFC0); + } + + private: + const Gamma* m_gamma; +}; + +//=====================================================blender_bgrABB +struct blender_bgrABB +{ + typedef rgba16 color_type; + typedef color_type::value_type value_type; + typedef color_type::calc_type calc_type; + typedef int32u pixel_type; + + static AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned) + { + pixel_type bgr = *p; + calc_type b = (bgr >> 16) & 0xFFC0; + calc_type g = (bgr >> 6) & 0xFFE0; + calc_type r = (bgr << 5) & 0xFFE0; + *p = + (pixel_type)(((((cb - b) * alpha + (b << 16))) & 0xFFC00000) | + ((((cg - g) * alpha + (g << 16)) >> 10) & 0x003FF800) | (((cr - r) * alpha + (r << 16)) >> 21)); + } + + static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) + { + return (pixel_type)(((b & 0xFFC0) << 16) | ((g & 0xFFE0) << 6) | (r >> 5)); + } + + static AGG_INLINE color_type make_color(pixel_type p) + { + return color_type((p << 5) & 0xFFE0, (p >> 6) & 0xFFE0, (p >> 16) & 0xFFC0); + } +}; + +//=================================================blender_bgrABB_pre +struct blender_bgrABB_pre +{ + typedef rgba16 color_type; + typedef color_type::value_type value_type; + typedef color_type::calc_type calc_type; + typedef int32u pixel_type; + + static AGG_INLINE void + blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned cover) + { + alpha = color_type::base_mask - alpha; + cover = (cover + 1) << (color_type::base_shift - 8); + pixel_type bgr = *p; + calc_type b = (bgr >> 16) & 0xFFC0; + calc_type g = (bgr >> 6) & 0xFFE0; + calc_type r = (bgr << 5) & 0xFFE0; + *p = (pixel_type)((((b * alpha + cb * cover)) & 0xFFC00000) | (((g * alpha + cg * cover) >> 10) & 0x003FF800) | + ((r * alpha + cr * cover) >> 21)); + } + + static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) + { + return (pixel_type)(((b & 0xFFC0) << 16) | ((g & 0xFFE0) << 6) | (r >> 5)); + } + + static AGG_INLINE color_type make_color(pixel_type p) + { + return color_type((p << 5) & 0xFFE0, (p >> 6) & 0xFFE0, (p >> 16) & 0xFFC0); + } +}; + +//=================================================blender_bgrABB_gamma +template +class blender_bgrABB_gamma +{ + public: + typedef rgba16 color_type; + typedef color_type::value_type value_type; + typedef color_type::calc_type calc_type; + typedef int32u pixel_type; + typedef Gamma gamma_type; + + blender_bgrABB_gamma() + : m_gamma(0) + {} + void gamma(const gamma_type& g) { m_gamma = &g; } + + AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned) + { + pixel_type bgr = *p; + calc_type b = m_gamma->dir((bgr >> 16) & 0xFFC0); + calc_type g = m_gamma->dir((bgr >> 6) & 0xFFE0); + calc_type r = m_gamma->dir((bgr << 5) & 0xFFE0); + *p = (pixel_type)(((m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 16)) >> 16) << 16) & 0xFFC00000) | + ((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 16)) >> 16) << 6) & 0x003FF800) | + (m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 16)) >> 16) >> 5)); + } + + static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) + { + return (pixel_type)(((b & 0xFFC0) << 16) | ((g & 0xFFE0) << 6) | (r >> 5)); + } + + static AGG_INLINE color_type make_color(pixel_type p) + { + return color_type((p << 5) & 0xFFE0, (p >> 6) & 0xFFE0, (p >> 16) & 0xFFC0); + } + + private: + const Gamma* m_gamma; +}; + +//===========================================pixfmt_alpha_blend_rgb_packed +template +class pixfmt_alpha_blend_rgb_packed +{ + public: + typedef RenBuf rbuf_type; + typedef typename rbuf_type::row_data row_data; + typedef Blender blender_type; + typedef typename blender_type::color_type color_type; + typedef typename blender_type::pixel_type pixel_type; + typedef int order_type; // A fake one + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; + enum base_scale_e { + base_shift = color_type::base_shift, + base_scale = color_type::base_scale, + base_mask = color_type::base_mask, + pix_width = sizeof(pixel_type) }; - - //=====================================================blender_rgb555_pre - struct blender_rgb555_pre + private: + //-------------------------------------------------------------------- + AGG_INLINE void copy_or_blend_pix(pixel_type* p, const color_type& c, unsigned cover) { - typedef rgba8 color_type; - typedef color_type::value_type value_type; - typedef color_type::calc_type calc_type; - typedef int16u pixel_type; - - static AGG_INLINE void blend_pix(pixel_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha, - unsigned cover) + if (c.a) { - alpha = color_type::base_mask - alpha; - pixel_type rgb = *p; - calc_type r = (rgb >> 7) & 0xF8; - calc_type g = (rgb >> 2) & 0xF8; - calc_type b = (rgb << 3) & 0xF8; - *p = (pixel_type) - ((((r * alpha + cr * cover) >> 1) & 0x7C00) | - (((g * alpha + cg * cover) >> 6) & 0x03E0) | - ((b * alpha + cb * cover) >> 11) | 0x8000); - } - - static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) - { - return (pixel_type)(((r & 0xF8) << 7) | - ((g & 0xF8) << 2) | - (b >> 3) | 0x8000); - } - - static AGG_INLINE color_type make_color(pixel_type p) - { - return color_type((p >> 7) & 0xF8, - (p >> 2) & 0xF8, - (p << 3) & 0xF8); - } - }; - - - - - //=====================================================blender_rgb555_gamma - template class blender_rgb555_gamma - { - public: - typedef rgba8 color_type; - typedef color_type::value_type value_type; - typedef color_type::calc_type calc_type; - typedef int16u pixel_type; - typedef Gamma gamma_type; - - blender_rgb555_gamma() : m_gamma(0) {} - void gamma(const gamma_type& g) { m_gamma = &g; } - - AGG_INLINE void blend_pix(pixel_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha, - unsigned) - { - pixel_type rgb = *p; - calc_type r = m_gamma->dir((rgb >> 7) & 0xF8); - calc_type g = m_gamma->dir((rgb >> 2) & 0xF8); - calc_type b = m_gamma->dir((rgb << 3) & 0xF8); - *p = (pixel_type) - (((m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 8)) >> 8) << 7) & 0x7C00) | - ((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 8)) >> 8) << 2) & 0x03E0) | - (m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 8)) >> 8) >> 3) | 0x8000); - } - - static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) - { - return (pixel_type)(((r & 0xF8) << 7) | - ((g & 0xF8) << 2) | - (b >> 3) | 0x8000); - } - - static AGG_INLINE color_type make_color(pixel_type p) - { - return color_type((p >> 7) & 0xF8, - (p >> 2) & 0xF8, - (p << 3) & 0xF8); - } - - private: - const Gamma* m_gamma; - }; - - - - - - //=========================================================blender_rgb565 - struct blender_rgb565 - { - typedef rgba8 color_type; - typedef color_type::value_type value_type; - typedef color_type::calc_type calc_type; - typedef int16u pixel_type; - - static AGG_INLINE void blend_pix(pixel_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha, - unsigned) - { - pixel_type rgb = *p; - calc_type r = (rgb >> 8) & 0xF8; - calc_type g = (rgb >> 3) & 0xFC; - calc_type b = (rgb << 3) & 0xF8; - *p = (pixel_type) - (((((cr - r) * alpha + (r << 8)) ) & 0xF800) | - ((((cg - g) * alpha + (g << 8)) >> 5) & 0x07E0) | - (((cb - b) * alpha + (b << 8)) >> 11)); - } - - static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) - { - return (pixel_type)(((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3)); - } - - static AGG_INLINE color_type make_color(pixel_type p) - { - return color_type((p >> 8) & 0xF8, - (p >> 3) & 0xFC, - (p << 3) & 0xF8); - } - }; - - - - //=====================================================blender_rgb565_pre - struct blender_rgb565_pre - { - typedef rgba8 color_type; - typedef color_type::value_type value_type; - typedef color_type::calc_type calc_type; - typedef int16u pixel_type; - - static AGG_INLINE void blend_pix(pixel_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha, - unsigned cover) - { - alpha = color_type::base_mask - alpha; - pixel_type rgb = *p; - calc_type r = (rgb >> 8) & 0xF8; - calc_type g = (rgb >> 3) & 0xFC; - calc_type b = (rgb << 3) & 0xF8; - *p = (pixel_type) - ((((r * alpha + cr * cover) ) & 0xF800) | - (((g * alpha + cg * cover) >> 5 ) & 0x07E0) | - ((b * alpha + cb * cover) >> 11)); - } - - static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) - { - return (pixel_type)(((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3)); - } - - static AGG_INLINE color_type make_color(pixel_type p) - { - return color_type((p >> 8) & 0xF8, - (p >> 3) & 0xFC, - (p << 3) & 0xF8); - } - }; - - - - //=====================================================blender_rgb565_gamma - template class blender_rgb565_gamma - { - public: - typedef rgba8 color_type; - typedef color_type::value_type value_type; - typedef color_type::calc_type calc_type; - typedef int16u pixel_type; - typedef Gamma gamma_type; - - blender_rgb565_gamma() : m_gamma(0) {} - void gamma(const gamma_type& g) { m_gamma = &g; } - - AGG_INLINE void blend_pix(pixel_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha, - unsigned) - { - pixel_type rgb = *p; - calc_type r = m_gamma->dir((rgb >> 8) & 0xF8); - calc_type g = m_gamma->dir((rgb >> 3) & 0xFC); - calc_type b = m_gamma->dir((rgb << 3) & 0xF8); - *p = (pixel_type) - (((m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 8)) >> 8) << 8) & 0xF800) | - ((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 8)) >> 8) << 3) & 0x07E0) | - (m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 8)) >> 8) >> 3)); - } - - static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) - { - return (pixel_type)(((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3)); - } - - static AGG_INLINE color_type make_color(pixel_type p) - { - return color_type((p >> 8) & 0xF8, - (p >> 3) & 0xFC, - (p << 3) & 0xF8); - } - - private: - const Gamma* m_gamma; - }; - - - - //=====================================================blender_rgbAAA - struct blender_rgbAAA - { - typedef rgba16 color_type; - typedef color_type::value_type value_type; - typedef color_type::calc_type calc_type; - typedef int32u pixel_type; - - static AGG_INLINE void blend_pix(pixel_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha, - unsigned) - { - pixel_type rgb = *p; - calc_type r = (rgb >> 14) & 0xFFC0; - calc_type g = (rgb >> 4) & 0xFFC0; - calc_type b = (rgb << 6) & 0xFFC0; - *p = (pixel_type) - (((((cr - r) * alpha + (r << 16)) >> 2) & 0x3FF00000) | - ((((cg - g) * alpha + (g << 16)) >> 12) & 0x000FFC00) | - (((cb - b) * alpha + (b << 16)) >> 22) | 0xC0000000); - } - - static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) - { - return (pixel_type)(((r & 0xFFC0) << 14) | - ((g & 0xFFC0) << 4) | - (b >> 6) | 0xC0000000); - } - - static AGG_INLINE color_type make_color(pixel_type p) - { - return color_type((p >> 14) & 0xFFC0, - (p >> 4) & 0xFFC0, - (p << 6) & 0xFFC0); - } - }; - - - - //==================================================blender_rgbAAA_pre - struct blender_rgbAAA_pre - { - typedef rgba16 color_type; - typedef color_type::value_type value_type; - typedef color_type::calc_type calc_type; - typedef int32u pixel_type; - - static AGG_INLINE void blend_pix(pixel_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha, - unsigned cover) - { - alpha = color_type::base_mask - alpha; - cover = (cover + 1) << (color_type::base_shift - 8); - pixel_type rgb = *p; - calc_type r = (rgb >> 14) & 0xFFC0; - calc_type g = (rgb >> 4) & 0xFFC0; - calc_type b = (rgb << 6) & 0xFFC0; - *p = (pixel_type) - ((((r * alpha + cr * cover) >> 2) & 0x3FF00000) | - (((g * alpha + cg * cover) >> 12) & 0x000FFC00) | - ((b * alpha + cb * cover) >> 22) | 0xC0000000); - } - - static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) - { - return (pixel_type)(((r & 0xFFC0) << 14) | - ((g & 0xFFC0) << 4) | - (b >> 6) | 0xC0000000); - } - - static AGG_INLINE color_type make_color(pixel_type p) - { - return color_type((p >> 14) & 0xFFC0, - (p >> 4) & 0xFFC0, - (p << 6) & 0xFFC0); - } - }; - - - - //=================================================blender_rgbAAA_gamma - template class blender_rgbAAA_gamma - { - public: - typedef rgba16 color_type; - typedef color_type::value_type value_type; - typedef color_type::calc_type calc_type; - typedef int32u pixel_type; - typedef Gamma gamma_type; - - blender_rgbAAA_gamma() : m_gamma(0) {} - void gamma(const gamma_type& g) { m_gamma = &g; } - - AGG_INLINE void blend_pix(pixel_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha, - unsigned) - { - pixel_type rgb = *p; - calc_type r = m_gamma->dir((rgb >> 14) & 0xFFC0); - calc_type g = m_gamma->dir((rgb >> 4) & 0xFFC0); - calc_type b = m_gamma->dir((rgb << 6) & 0xFFC0); - *p = (pixel_type) - (((m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 16)) >> 16) << 14) & 0x3FF00000) | - ((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 16)) >> 16) << 4 ) & 0x000FFC00) | - (m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 16)) >> 16) >> 6 ) | 0xC0000000); - } - - static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) - { - return (pixel_type)(((r & 0xFFC0) << 14) | - ((g & 0xFFC0) << 4) | - (b >> 6) | 0xC0000000); - } - - static AGG_INLINE color_type make_color(pixel_type p) - { - return color_type((p >> 14) & 0xFFC0, - (p >> 4) & 0xFFC0, - (p << 6) & 0xFFC0); - } - private: - const Gamma* m_gamma; - }; - - - //=====================================================blender_bgrAAA - struct blender_bgrAAA - { - typedef rgba16 color_type; - typedef color_type::value_type value_type; - typedef color_type::calc_type calc_type; - typedef int32u pixel_type; - - static AGG_INLINE void blend_pix(pixel_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha, - unsigned) - { - pixel_type bgr = *p; - calc_type b = (bgr >> 14) & 0xFFC0; - calc_type g = (bgr >> 4) & 0xFFC0; - calc_type r = (bgr << 6) & 0xFFC0; - *p = (pixel_type) - (((((cb - b) * alpha + (b << 16)) >> 2) & 0x3FF00000) | - ((((cg - g) * alpha + (g << 16)) >> 12) & 0x000FFC00) | - (((cr - r) * alpha + (r << 16)) >> 22) | 0xC0000000); - } - - static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) - { - return (pixel_type)(((b & 0xFFC0) << 14) | - ((g & 0xFFC0) << 4) | - (r >> 6) | 0xC0000000); - } - - static AGG_INLINE color_type make_color(pixel_type p) - { - return color_type((p << 6) & 0xFFC0, - (p >> 4) & 0xFFC0, - (p >> 14) & 0xFFC0); - } - }; - - - - //=================================================blender_bgrAAA_pre - struct blender_bgrAAA_pre - { - typedef rgba16 color_type; - typedef color_type::value_type value_type; - typedef color_type::calc_type calc_type; - typedef int32u pixel_type; - - static AGG_INLINE void blend_pix(pixel_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha, - unsigned cover) - { - alpha = color_type::base_mask - alpha; - cover = (cover + 1) << (color_type::base_shift - 8); - pixel_type bgr = *p; - calc_type b = (bgr >> 14) & 0xFFC0; - calc_type g = (bgr >> 4) & 0xFFC0; - calc_type r = (bgr << 6) & 0xFFC0; - *p = (pixel_type) - ((((b * alpha + cb * cover) >> 2) & 0x3FF00000) | - (((g * alpha + cg * cover) >> 12) & 0x000FFC00) | - ((r * alpha + cr * cover) >> 22) | 0xC0000000); - } - - static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) - { - return (pixel_type)(((b & 0xFFC0) << 14) | - ((g & 0xFFC0) << 4) | - (r >> 6) | 0xC0000000); - } - - static AGG_INLINE color_type make_color(pixel_type p) - { - return color_type((p << 6) & 0xFFC0, - (p >> 4) & 0xFFC0, - (p >> 14) & 0xFFC0); - } - }; - - - - //=================================================blender_bgrAAA_gamma - template class blender_bgrAAA_gamma - { - public: - typedef rgba16 color_type; - typedef color_type::value_type value_type; - typedef color_type::calc_type calc_type; - typedef int32u pixel_type; - typedef Gamma gamma_type; - - blender_bgrAAA_gamma() : m_gamma(0) {} - void gamma(const gamma_type& g) { m_gamma = &g; } - - AGG_INLINE void blend_pix(pixel_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha, - unsigned) - { - pixel_type bgr = *p; - calc_type b = m_gamma->dir((bgr >> 14) & 0xFFC0); - calc_type g = m_gamma->dir((bgr >> 4) & 0xFFC0); - calc_type r = m_gamma->dir((bgr << 6) & 0xFFC0); - *p = (pixel_type) - (((m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 16)) >> 16) << 14) & 0x3FF00000) | - ((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 16)) >> 16) << 4 ) & 0x000FFC00) | - (m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 16)) >> 16) >> 6 ) | 0xC0000000); - } - - static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) - { - return (pixel_type)(((b & 0xFFC0) << 14) | - ((g & 0xFFC0) << 4) | - (r >> 6) | 0xC0000000); - } - - static AGG_INLINE color_type make_color(pixel_type p) - { - return color_type((p << 6) & 0xFFC0, - (p >> 4) & 0xFFC0, - (p >> 14) & 0xFFC0); - } - - private: - const Gamma* m_gamma; - }; - - - - //=====================================================blender_rgbBBA - struct blender_rgbBBA - { - typedef rgba16 color_type; - typedef color_type::value_type value_type; - typedef color_type::calc_type calc_type; - typedef int32u pixel_type; - - static AGG_INLINE void blend_pix(pixel_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha, - unsigned) - { - pixel_type rgb = *p; - calc_type r = (rgb >> 16) & 0xFFE0; - calc_type g = (rgb >> 5) & 0xFFE0; - calc_type b = (rgb << 6) & 0xFFC0; - *p = (pixel_type) - (((((cr - r) * alpha + (r << 16)) ) & 0xFFE00000) | - ((((cg - g) * alpha + (g << 16)) >> 11) & 0x001FFC00) | - (((cb - b) * alpha + (b << 16)) >> 22)); - } - - static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) - { - return (pixel_type)(((r & 0xFFE0) << 16) | ((g & 0xFFE0) << 5) | (b >> 6)); - } - - static AGG_INLINE color_type make_color(pixel_type p) - { - return color_type((p >> 16) & 0xFFE0, - (p >> 5) & 0xFFE0, - (p << 6) & 0xFFC0); - } - }; - - - //=================================================blender_rgbBBA_pre - struct blender_rgbBBA_pre - { - typedef rgba16 color_type; - typedef color_type::value_type value_type; - typedef color_type::calc_type calc_type; - typedef int32u pixel_type; - - static AGG_INLINE void blend_pix(pixel_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha, - unsigned cover) - { - alpha = color_type::base_mask - alpha; - cover = (cover + 1) << (color_type::base_shift - 8); - pixel_type rgb = *p; - calc_type r = (rgb >> 16) & 0xFFE0; - calc_type g = (rgb >> 5) & 0xFFE0; - calc_type b = (rgb << 6) & 0xFFC0; - *p = (pixel_type) - ((((r * alpha + cr * cover) ) & 0xFFE00000) | - (((g * alpha + cg * cover) >> 11) & 0x001FFC00) | - ((b * alpha + cb * cover) >> 22)); - } - - static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) - { - return (pixel_type)(((r & 0xFFE0) << 16) | ((g & 0xFFE0) << 5) | (b >> 6)); - } - - static AGG_INLINE color_type make_color(pixel_type p) - { - return color_type((p >> 16) & 0xFFE0, - (p >> 5) & 0xFFE0, - (p << 6) & 0xFFC0); - } - }; - - - - //=================================================blender_rgbBBA_gamma - template class blender_rgbBBA_gamma - { - public: - typedef rgba16 color_type; - typedef color_type::value_type value_type; - typedef color_type::calc_type calc_type; - typedef int32u pixel_type; - typedef Gamma gamma_type; - - blender_rgbBBA_gamma() : m_gamma(0) {} - void gamma(const gamma_type& g) { m_gamma = &g; } - - AGG_INLINE void blend_pix(pixel_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha, - unsigned) - { - pixel_type rgb = *p; - calc_type r = m_gamma->dir((rgb >> 16) & 0xFFE0); - calc_type g = m_gamma->dir((rgb >> 5) & 0xFFE0); - calc_type b = m_gamma->dir((rgb << 6) & 0xFFC0); - *p = (pixel_type) - (((m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 16)) >> 16) << 16) & 0xFFE00000) | - ((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 16)) >> 16) << 5 ) & 0x001FFC00) | - (m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 16)) >> 16) >> 6 )); - } - - static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) - { - return (pixel_type)(((r & 0xFFE0) << 16) | ((g & 0xFFE0) << 5) | (b >> 6)); - } - - static AGG_INLINE color_type make_color(pixel_type p) - { - return color_type((p >> 16) & 0xFFE0, - (p >> 5) & 0xFFE0, - (p << 6) & 0xFFC0); - } - - private: - const Gamma* m_gamma; - }; - - - //=====================================================blender_bgrABB - struct blender_bgrABB - { - typedef rgba16 color_type; - typedef color_type::value_type value_type; - typedef color_type::calc_type calc_type; - typedef int32u pixel_type; - - static AGG_INLINE void blend_pix(pixel_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha, - unsigned) - { - pixel_type bgr = *p; - calc_type b = (bgr >> 16) & 0xFFC0; - calc_type g = (bgr >> 6) & 0xFFE0; - calc_type r = (bgr << 5) & 0xFFE0; - *p = (pixel_type) - (((((cb - b) * alpha + (b << 16)) ) & 0xFFC00000) | - ((((cg - g) * alpha + (g << 16)) >> 10) & 0x003FF800) | - (((cr - r) * alpha + (r << 16)) >> 21)); - } - - static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) - { - return (pixel_type)(((b & 0xFFC0) << 16) | ((g & 0xFFE0) << 6) | (r >> 5)); - } - - static AGG_INLINE color_type make_color(pixel_type p) - { - return color_type((p << 5) & 0xFFE0, - (p >> 6) & 0xFFE0, - (p >> 16) & 0xFFC0); - } - }; - - - //=================================================blender_bgrABB_pre - struct blender_bgrABB_pre - { - typedef rgba16 color_type; - typedef color_type::value_type value_type; - typedef color_type::calc_type calc_type; - typedef int32u pixel_type; - - static AGG_INLINE void blend_pix(pixel_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha, - unsigned cover) - { - alpha = color_type::base_mask - alpha; - cover = (cover + 1) << (color_type::base_shift - 8); - pixel_type bgr = *p; - calc_type b = (bgr >> 16) & 0xFFC0; - calc_type g = (bgr >> 6) & 0xFFE0; - calc_type r = (bgr << 5) & 0xFFE0; - *p = (pixel_type) - ((((b * alpha + cb * cover) ) & 0xFFC00000) | - (((g * alpha + cg * cover) >> 10) & 0x003FF800) | - ((r * alpha + cr * cover) >> 21)); - } - - static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) - { - return (pixel_type)(((b & 0xFFC0) << 16) | ((g & 0xFFE0) << 6) | (r >> 5)); - } - - static AGG_INLINE color_type make_color(pixel_type p) - { - return color_type((p << 5) & 0xFFE0, - (p >> 6) & 0xFFE0, - (p >> 16) & 0xFFC0); - } - }; - - - - //=================================================blender_bgrABB_gamma - template class blender_bgrABB_gamma - { - public: - typedef rgba16 color_type; - typedef color_type::value_type value_type; - typedef color_type::calc_type calc_type; - typedef int32u pixel_type; - typedef Gamma gamma_type; - - blender_bgrABB_gamma() : m_gamma(0) {} - void gamma(const gamma_type& g) { m_gamma = &g; } - - AGG_INLINE void blend_pix(pixel_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha, - unsigned) - { - pixel_type bgr = *p; - calc_type b = m_gamma->dir((bgr >> 16) & 0xFFC0); - calc_type g = m_gamma->dir((bgr >> 6) & 0xFFE0); - calc_type r = m_gamma->dir((bgr << 5) & 0xFFE0); - *p = (pixel_type) - (((m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 16)) >> 16) << 16) & 0xFFC00000) | - ((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 16)) >> 16) << 6 ) & 0x003FF800) | - (m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 16)) >> 16) >> 5 )); - } - - static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) - { - return (pixel_type)(((b & 0xFFC0) << 16) | ((g & 0xFFE0) << 6) | (r >> 5)); - } - - static AGG_INLINE color_type make_color(pixel_type p) - { - return color_type((p << 5) & 0xFFE0, - (p >> 6) & 0xFFE0, - (p >> 16) & 0xFFC0); - } - - private: - const Gamma* m_gamma; - }; - - - - //===========================================pixfmt_alpha_blend_rgb_packed - template class pixfmt_alpha_blend_rgb_packed - { - public: - typedef RenBuf rbuf_type; - typedef typename rbuf_type::row_data row_data; - typedef Blender blender_type; - typedef typename blender_type::color_type color_type; - typedef typename blender_type::pixel_type pixel_type; - typedef int order_type; // A fake one - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_scale = color_type::base_scale, - base_mask = color_type::base_mask, - pix_width = sizeof(pixel_type) - }; - - private: - //-------------------------------------------------------------------- - AGG_INLINE void copy_or_blend_pix(pixel_type* p, const color_type& c, unsigned cover) - { - if (c.a) + calc_type alpha = (calc_type(c.a) * (cover + 1)) >> 8; + if (alpha == base_mask) { - calc_type alpha = (calc_type(c.a) * (cover + 1)) >> 8; - if(alpha == base_mask) + *p = m_blender.make_pix(c.r, c.g, c.b); + } + else + { + m_blender.blend_pix(p, c.r, c.g, c.b, alpha, cover); + } + } + } + + public: + //-------------------------------------------------------------------- + explicit pixfmt_alpha_blend_rgb_packed(rbuf_type& rb) + : m_rbuf(&rb) + {} + void attach(rbuf_type& rb) { m_rbuf = &rb; } + + //-------------------------------------------------------------------- + template + bool attach(PixFmt& pixf, int x1, int y1, int x2, int y2) + { + rect_i r(x1, y1, x2, y2); + if (r.clip(rect_i(0, 0, pixf.width() - 1, pixf.height() - 1))) + { + int stride = pixf.stride(); + m_rbuf->attach(pixf.pix_ptr(r.x1, stride < 0 ? r.y2 : r.y1), (r.x2 - r.x1) + 1, (r.y2 - r.y1) + 1, stride); + return true; + } + return false; + } + + Blender& blender() { return m_blender; } + + //-------------------------------------------------------------------- + AGG_INLINE unsigned width() const { return m_rbuf->width(); } + AGG_INLINE unsigned height() const { return m_rbuf->height(); } + AGG_INLINE int stride() const { return m_rbuf->stride(); } + + //-------------------------------------------------------------------- + AGG_INLINE int8u* row_ptr(int y) { return m_rbuf->row_ptr(y); } + AGG_INLINE const int8u* row_ptr(int y) const { return m_rbuf->row_ptr(y); } + AGG_INLINE row_data row(int y) const { return m_rbuf->row(y); } + + //-------------------------------------------------------------------- + AGG_INLINE int8u* pix_ptr(int x, int y) { return m_rbuf->row_ptr(y) + x * pix_width; } + + AGG_INLINE const int8u* pix_ptr(int x, int y) const { return m_rbuf->row_ptr(y) + x * pix_width; } + + //-------------------------------------------------------------------- + AGG_INLINE void make_pix(int8u* p, const color_type& c) { *(pixel_type*)p = m_blender.make_pix(c.r, c.g, c.b); } + + //-------------------------------------------------------------------- + AGG_INLINE color_type pixel(int x, int y) const + { + return m_blender.make_color(((pixel_type*)m_rbuf->row_ptr(y))[x]); + } + + //-------------------------------------------------------------------- + AGG_INLINE void copy_pixel(int x, int y, const color_type& c) + { + ((pixel_type*)m_rbuf->row_ptr(x, y, 1))[x] = m_blender.make_pix(c.r, c.g, c.b); + } + + //-------------------------------------------------------------------- + AGG_INLINE void blend_pixel(int x, int y, const color_type& c, int8u cover) + { + copy_or_blend_pix((pixel_type*)m_rbuf->row_ptr(x, y, 1) + x, c, cover); + } + + //-------------------------------------------------------------------- + AGG_INLINE void copy_hline(int x, int y, unsigned len, const color_type& c) + { + pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y, len) + x; + pixel_type v = m_blender.make_pix(c.r, c.g, c.b); + do + { + *p++ = v; + } while (--len); + } + + //-------------------------------------------------------------------- + AGG_INLINE void copy_vline(int x, int y, unsigned len, const color_type& c) + { + pixel_type v = m_blender.make_pix(c.r, c.g, c.b); + do + { + pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y++, 1) + x; + *p = v; + } while (--len); + } + + //-------------------------------------------------------------------- + void blend_hline(int x, int y, unsigned len, const color_type& c, int8u cover) + { + if (c.a) + { + pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y, len) + x; + calc_type alpha = (calc_type(c.a) * (cover + 1)) >> 8; + if (alpha == base_mask) + { + pixel_type v = m_blender.make_pix(c.r, c.g, c.b); + do { - *p = m_blender.make_pix(c.r, c.g, c.b); - } - else + *p++ = v; + } while (--len); + } + else + { + do { m_blender.blend_pix(p, c.r, c.g, c.b, alpha, cover); - } + ++p; + } while (--len); } } + } - public: - //-------------------------------------------------------------------- - explicit pixfmt_alpha_blend_rgb_packed(rbuf_type& rb) : m_rbuf(&rb) {} - void attach(rbuf_type& rb) { m_rbuf = &rb; } - - //-------------------------------------------------------------------- - template - bool attach(PixFmt& pixf, int x1, int y1, int x2, int y2) + //-------------------------------------------------------------------- + void blend_vline(int x, int y, unsigned len, const color_type& c, int8u cover) + { + if (c.a) { - rect_i r(x1, y1, x2, y2); - if(r.clip(rect_i(0, 0, pixf.width()-1, pixf.height()-1))) + calc_type alpha = (calc_type(c.a) * (cover + 1)) >> 8; + if (alpha == base_mask) { - int stride = pixf.stride(); - m_rbuf->attach(pixf.pix_ptr(r.x1, stride < 0 ? r.y2 : r.y1), - (r.x2 - r.x1) + 1, - (r.y2 - r.y1) + 1, - stride); - return true; + pixel_type v = m_blender.make_pix(c.r, c.g, c.b); + do + { + ((pixel_type*)m_rbuf->row_ptr(x, y++, 1))[x] = v; + } while (--len); + } + else + { + do + { + m_blender.blend_pix((pixel_type*)m_rbuf->row_ptr(x, y++, 1), c.r, c.g, c.b, alpha, cover); + } while (--len); } - return false; } + } - Blender& blender() { return m_blender; } - - //-------------------------------------------------------------------- - AGG_INLINE unsigned width() const { return m_rbuf->width(); } - AGG_INLINE unsigned height() const { return m_rbuf->height(); } - AGG_INLINE int stride() const { return m_rbuf->stride(); } - - //-------------------------------------------------------------------- - AGG_INLINE int8u* row_ptr(int y) { return m_rbuf->row_ptr(y); } - AGG_INLINE const int8u* row_ptr(int y) const { return m_rbuf->row_ptr(y); } - AGG_INLINE row_data row(int y) const { return m_rbuf->row(y); } - - //-------------------------------------------------------------------- - AGG_INLINE int8u* pix_ptr(int x, int y) + //-------------------------------------------------------------------- + void blend_solid_hspan(int x, int y, unsigned len, const color_type& c, const int8u* covers) + { + pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y, len) + x; + do { - return m_rbuf->row_ptr(y) + x * pix_width; + copy_or_blend_pix(p, c, *covers++); + ++p; + } while (--len); + } + + //-------------------------------------------------------------------- + void blend_solid_vspan(int x, int y, unsigned len, const color_type& c, const int8u* covers) + { + do + { + copy_or_blend_pix((pixel_type*)m_rbuf->row_ptr(x, y++, 1) + x, c, *covers++); + } while (--len); + } + + //-------------------------------------------------------------------- + void copy_color_hspan(int x, int y, unsigned len, const color_type* colors) + { + pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y, len) + x; + do + { + *p++ = m_blender.make_pix(colors->r, colors->g, colors->b); + ++colors; + } while (--len); + } + + //-------------------------------------------------------------------- + void copy_color_vspan(int x, int y, unsigned len, const color_type* colors) + { + do + { + pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y++, 1) + x; + *p = m_blender.make_pix(colors->r, colors->g, colors->b); + ++colors; + } while (--len); + } + + //-------------------------------------------------------------------- + void blend_color_hspan(int x, int y, unsigned len, const color_type* colors, const int8u* covers, int8u cover) + { + pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y, len) + x; + do + { + copy_or_blend_pix(p++, *colors++, covers ? *covers++ : cover); + } while (--len); + } + + //-------------------------------------------------------------------- + void blend_color_vspan(int x, int y, unsigned len, const color_type* colors, const int8u* covers, int8u cover) + { + do + { + copy_or_blend_pix((pixel_type*)m_rbuf->row_ptr(x, y++, 1) + x, *colors++, covers ? *covers++ : cover); + } while (--len); + } + + //-------------------------------------------------------------------- + template + void copy_from(const RenBuf2& from, int xdst, int ydst, int xsrc, int ysrc, unsigned len) + { + const int8u* p = from.row_ptr(ysrc); + if (p) + { + memmove(m_rbuf->row_ptr(xdst, ydst, len) + xdst * pix_width, p + xsrc * pix_width, len * pix_width); } + } - AGG_INLINE const int8u* pix_ptr(int x, int y) const - { - return m_rbuf->row_ptr(y) + x * pix_width; - } + //-------------------------------------------------------------------- + template + void + blend_from(const SrcPixelFormatRenderer& from, int xdst, int ydst, int xsrc, int ysrc, unsigned len, int8u cover) + { + typedef typename SrcPixelFormatRenderer::order_type src_order; - //-------------------------------------------------------------------- - AGG_INLINE void make_pix(int8u* p, const color_type& c) + const value_type* psrc = (const value_type*)from.row_ptr(ysrc); + if (psrc) { - *(pixel_type*)p = m_blender.make_pix(c.r, c.g, c.b); - } - - //-------------------------------------------------------------------- - AGG_INLINE color_type pixel(int x, int y) const - { - return m_blender.make_color(((pixel_type*)m_rbuf->row_ptr(y))[x]); - } - - //-------------------------------------------------------------------- - AGG_INLINE void copy_pixel(int x, int y, const color_type& c) - { - ((pixel_type*) - m_rbuf->row_ptr(x, y, 1))[x] = - m_blender.make_pix(c.r, c.g, c.b); - } - - //-------------------------------------------------------------------- - AGG_INLINE void blend_pixel(int x, int y, const color_type& c, int8u cover) - { - copy_or_blend_pix((pixel_type*)m_rbuf->row_ptr(x, y, 1) + x, c, cover); - } - - //-------------------------------------------------------------------- - AGG_INLINE void copy_hline(int x, int y, - unsigned len, - const color_type& c) - { - pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y, len) + x; - pixel_type v = m_blender.make_pix(c.r, c.g, c.b); + psrc += xsrc * 4; + pixel_type* pdst = (pixel_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst; do { - *p++ = v; - } - while(--len); + value_type alpha = psrc[src_order::A]; + if (alpha) + { + if (alpha == base_mask && cover == 255) + { + *pdst = m_blender.make_pix(psrc[src_order::R], psrc[src_order::G], psrc[src_order::B]); + } + else + { + m_blender + .blend_pix(pdst, psrc[src_order::R], psrc[src_order::G], psrc[src_order::B], alpha, cover); + } + } + psrc += 4; + ++pdst; + } while (--len); } + } - //-------------------------------------------------------------------- - AGG_INLINE void copy_vline(int x, int y, - unsigned len, - const color_type& c) + //-------------------------------------------------------------------- + template + void blend_from_color(const SrcPixelFormatRenderer& from, + const color_type& color, + int xdst, + int ydst, + int xsrc, + int ysrc, + unsigned len, + int8u cover) + { + typedef typename SrcPixelFormatRenderer::value_type src_value_type; + const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc); + if (psrc) { - pixel_type v = m_blender.make_pix(c.r, c.g, c.b); + pixel_type* pdst = (pixel_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst; + do { - pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y++, 1) + x; - *p = v; - } - while(--len); + m_blender.blend_pix(pdst, color.r, color.g, color.b, color.a, cover); + ++psrc; + ++pdst; + } while (--len); } + } - //-------------------------------------------------------------------- - void blend_hline(int x, int y, - unsigned len, - const color_type& c, - int8u cover) - { - if (c.a) - { - pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y, len) + x; - calc_type alpha = (calc_type(c.a) * (cover + 1)) >> 8; - if(alpha == base_mask) - { - pixel_type v = m_blender.make_pix(c.r, c.g, c.b); - do - { - *p++ = v; - } - while(--len); - } - else - { - do - { - m_blender.blend_pix(p, c.r, c.g, c.b, alpha, cover); - ++p; - } - while(--len); - } - } - } - - //-------------------------------------------------------------------- - void blend_vline(int x, int y, - unsigned len, - const color_type& c, - int8u cover) - { - if (c.a) - { - calc_type alpha = (calc_type(c.a) * (cover + 1)) >> 8; - if(alpha == base_mask) - { - pixel_type v = m_blender.make_pix(c.r, c.g, c.b); - do - { - ((pixel_type*)m_rbuf->row_ptr(x, y++, 1))[x] = v; - } - while(--len); - } - else - { - do - { - m_blender.blend_pix( - (pixel_type*)m_rbuf->row_ptr(x, y++, 1), - c.r, c.g, c.b, alpha, cover); - } - while(--len); - } - } - } - - //-------------------------------------------------------------------- - void blend_solid_hspan(int x, int y, - unsigned len, - const color_type& c, - const int8u* covers) - { - pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y, len) + x; - do - { - copy_or_blend_pix(p, c, *covers++); - ++p; - } - while(--len); - } - - //-------------------------------------------------------------------- - void blend_solid_vspan(int x, int y, - unsigned len, - const color_type& c, - const int8u* covers) - { - do - { - copy_or_blend_pix((pixel_type*)m_rbuf->row_ptr(x, y++, 1) + x, - c, *covers++); - } - while(--len); - } - - //-------------------------------------------------------------------- - void copy_color_hspan(int x, int y, - unsigned len, - const color_type* colors) - { - pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y, len) + x; - do - { - *p++ = m_blender.make_pix(colors->r, colors->g, colors->b); - ++colors; - } - while(--len); - } - - //-------------------------------------------------------------------- - void copy_color_vspan(int x, int y, - unsigned len, - const color_type* colors) - { - do - { - pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y++, 1) + x; - *p = m_blender.make_pix(colors->r, colors->g, colors->b); - ++colors; - } - while(--len); - } - - //-------------------------------------------------------------------- - void blend_color_hspan(int x, int y, - unsigned len, - const color_type* colors, - const int8u* covers, - int8u cover) - { - pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y, len) + x; - do - { - copy_or_blend_pix(p++, *colors++, covers ? *covers++ : cover); - } - while(--len); - } - - //-------------------------------------------------------------------- - void blend_color_vspan(int x, int y, - unsigned len, - const color_type* colors, - const int8u* covers, - int8u cover) - { - do - { - copy_or_blend_pix((pixel_type*)m_rbuf->row_ptr(x, y++, 1) + x, - *colors++, covers ? *covers++ : cover); - } - while(--len); - } - - //-------------------------------------------------------------------- - template - void copy_from(const RenBuf2& from, - int xdst, int ydst, - int xsrc, int ysrc, - unsigned len) - { - const int8u* p = from.row_ptr(ysrc); - if(p) - { - memmove(m_rbuf->row_ptr(xdst, ydst, len) + xdst * pix_width, - p + xsrc * pix_width, - len * pix_width); - } - } - - //-------------------------------------------------------------------- - template - void blend_from(const SrcPixelFormatRenderer& from, - int xdst, int ydst, - int xsrc, int ysrc, + //-------------------------------------------------------------------- + template + void blend_from_lut(const SrcPixelFormatRenderer& from, + const color_type* color_lut, + int xdst, + int ydst, + int xsrc, + int ysrc, unsigned len, int8u cover) + { + typedef typename SrcPixelFormatRenderer::value_type src_value_type; + const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc); + if (psrc) { - typedef typename SrcPixelFormatRenderer::order_type src_order; + pixel_type* pdst = (pixel_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst; - const value_type* psrc = (const value_type*)from.row_ptr(ysrc); - if(psrc) + do { - psrc += xsrc * 4; - pixel_type* pdst = - (pixel_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst; - do - { - value_type alpha = psrc[src_order::A]; - if(alpha) - { - if(alpha == base_mask && cover == 255) - { - *pdst = m_blender.make_pix(psrc[src_order::R], - psrc[src_order::G], - psrc[src_order::B]); - } - else - { - m_blender.blend_pix(pdst, - psrc[src_order::R], - psrc[src_order::G], - psrc[src_order::B], - alpha, - cover); - } - } - psrc += 4; - ++pdst; - } - while(--len); - } + const color_type& color = color_lut[*psrc]; + m_blender.blend_pix(pdst, color.r, color.g, color.b, color.a, cover); + ++psrc; + ++pdst; + } while (--len); } + } - //-------------------------------------------------------------------- - template - void blend_from_color(const SrcPixelFormatRenderer& from, - const color_type& color, - int xdst, int ydst, - int xsrc, int ysrc, - unsigned len, - int8u cover) - { - typedef typename SrcPixelFormatRenderer::value_type src_value_type; - const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc); - if(psrc) - { - pixel_type* pdst = - (pixel_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst; + private: + rbuf_type* m_rbuf; + Blender m_blender; +}; - do - { - m_blender.blend_pix(pdst, - color.r, color.g, color.b, color.a, - cover); - ++psrc; - ++pdst; - } - while(--len); - } - } +typedef pixfmt_alpha_blend_rgb_packed pixfmt_rgb555; //----pixfmt_rgb555 +typedef pixfmt_alpha_blend_rgb_packed pixfmt_rgb565; //----pixfmt_rgb565 - //-------------------------------------------------------------------- - template - void blend_from_lut(const SrcPixelFormatRenderer& from, - const color_type* color_lut, - int xdst, int ydst, - int xsrc, int ysrc, - unsigned len, - int8u cover) - { - typedef typename SrcPixelFormatRenderer::value_type src_value_type; - const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc); - if(psrc) - { - pixel_type* pdst = - (pixel_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst; +typedef pixfmt_alpha_blend_rgb_packed pixfmt_rgb555_pre; //----pixfmt_rgb555_pre +typedef pixfmt_alpha_blend_rgb_packed pixfmt_rgb565_pre; //----pixfmt_rgb565_pre - do - { - const color_type& color = color_lut[*psrc]; - m_blender.blend_pix(pdst, - color.r, color.g, color.b, color.a, - cover); - ++psrc; - ++pdst; - } - while(--len); - } - } +typedef pixfmt_alpha_blend_rgb_packed pixfmt_rgbAAA; //----pixfmt_rgbAAA +typedef pixfmt_alpha_blend_rgb_packed pixfmt_bgrAAA; //----pixfmt_bgrAAA +typedef pixfmt_alpha_blend_rgb_packed pixfmt_rgbBBA; //----pixfmt_rgbBBA +typedef pixfmt_alpha_blend_rgb_packed pixfmt_bgrABB; //----pixfmt_bgrABB +typedef pixfmt_alpha_blend_rgb_packed pixfmt_rgbAAA_pre; //----pixfmt_rgbAAA_pre +typedef pixfmt_alpha_blend_rgb_packed pixfmt_bgrAAA_pre; //----pixfmt_bgrAAA_pre +typedef pixfmt_alpha_blend_rgb_packed pixfmt_rgbBBA_pre; //----pixfmt_rgbBBA_pre +typedef pixfmt_alpha_blend_rgb_packed pixfmt_bgrABB_pre; //----pixfmt_bgrABB_pre - - private: - rbuf_type* m_rbuf; - Blender m_blender; - }; - - typedef pixfmt_alpha_blend_rgb_packed pixfmt_rgb555; //----pixfmt_rgb555 - typedef pixfmt_alpha_blend_rgb_packed pixfmt_rgb565; //----pixfmt_rgb565 - - typedef pixfmt_alpha_blend_rgb_packed pixfmt_rgb555_pre; //----pixfmt_rgb555_pre - typedef pixfmt_alpha_blend_rgb_packed pixfmt_rgb565_pre; //----pixfmt_rgb565_pre - - typedef pixfmt_alpha_blend_rgb_packed pixfmt_rgbAAA; //----pixfmt_rgbAAA - typedef pixfmt_alpha_blend_rgb_packed pixfmt_bgrAAA; //----pixfmt_bgrAAA - typedef pixfmt_alpha_blend_rgb_packed pixfmt_rgbBBA; //----pixfmt_rgbBBA - typedef pixfmt_alpha_blend_rgb_packed pixfmt_bgrABB; //----pixfmt_bgrABB - - typedef pixfmt_alpha_blend_rgb_packed pixfmt_rgbAAA_pre; //----pixfmt_rgbAAA_pre - typedef pixfmt_alpha_blend_rgb_packed pixfmt_bgrAAA_pre; //----pixfmt_bgrAAA_pre - typedef pixfmt_alpha_blend_rgb_packed pixfmt_rgbBBA_pre; //----pixfmt_rgbBBA_pre - typedef pixfmt_alpha_blend_rgb_packed pixfmt_bgrABB_pre; //----pixfmt_bgrABB_pre - - - //-----------------------------------------------------pixfmt_rgb555_gamma - template class pixfmt_rgb555_gamma : - public pixfmt_alpha_blend_rgb_packed, - rendering_buffer> +//-----------------------------------------------------pixfmt_rgb555_gamma +template +class pixfmt_rgb555_gamma : public pixfmt_alpha_blend_rgb_packed, rendering_buffer> +{ + public: + pixfmt_rgb555_gamma(rendering_buffer& rb, const Gamma& g) + : pixfmt_alpha_blend_rgb_packed, rendering_buffer>(rb) { - public: - pixfmt_rgb555_gamma(rendering_buffer& rb, const Gamma& g) : - pixfmt_alpha_blend_rgb_packed, - rendering_buffer>(rb) - { - this->blender().gamma(g); - } - }; + this->blender().gamma(g); + } +}; - - //-----------------------------------------------------pixfmt_rgb565_gamma - template class pixfmt_rgb565_gamma : - public pixfmt_alpha_blend_rgb_packed, rendering_buffer> +//-----------------------------------------------------pixfmt_rgb565_gamma +template +class pixfmt_rgb565_gamma : public pixfmt_alpha_blend_rgb_packed, rendering_buffer> +{ + public: + pixfmt_rgb565_gamma(rendering_buffer& rb, const Gamma& g) + : pixfmt_alpha_blend_rgb_packed, rendering_buffer>(rb) { - public: - pixfmt_rgb565_gamma(rendering_buffer& rb, const Gamma& g) : - pixfmt_alpha_blend_rgb_packed, rendering_buffer>(rb) - { - this->blender().gamma(g); - } - }; + this->blender().gamma(g); + } +}; - - //-----------------------------------------------------pixfmt_rgbAAA_gamma - template class pixfmt_rgbAAA_gamma : - public pixfmt_alpha_blend_rgb_packed, - rendering_buffer> +//-----------------------------------------------------pixfmt_rgbAAA_gamma +template +class pixfmt_rgbAAA_gamma : public pixfmt_alpha_blend_rgb_packed, rendering_buffer> +{ + public: + pixfmt_rgbAAA_gamma(rendering_buffer& rb, const Gamma& g) + : pixfmt_alpha_blend_rgb_packed, rendering_buffer>(rb) { - public: - pixfmt_rgbAAA_gamma(rendering_buffer& rb, const Gamma& g) : - pixfmt_alpha_blend_rgb_packed, - rendering_buffer>(rb) - { - this->blender().gamma(g); - } - }; + this->blender().gamma(g); + } +}; - - //-----------------------------------------------------pixfmt_bgrAAA_gamma - template class pixfmt_bgrAAA_gamma : - public pixfmt_alpha_blend_rgb_packed, - rendering_buffer> +//-----------------------------------------------------pixfmt_bgrAAA_gamma +template +class pixfmt_bgrAAA_gamma : public pixfmt_alpha_blend_rgb_packed, rendering_buffer> +{ + public: + pixfmt_bgrAAA_gamma(rendering_buffer& rb, const Gamma& g) + : pixfmt_alpha_blend_rgb_packed, rendering_buffer>(rb) { - public: - pixfmt_bgrAAA_gamma(rendering_buffer& rb, const Gamma& g) : - pixfmt_alpha_blend_rgb_packed, - rendering_buffer>(rb) - { - this->blender().gamma(g); - } - }; + this->blender().gamma(g); + } +}; - - //-----------------------------------------------------pixfmt_rgbBBA_gamma - template class pixfmt_rgbBBA_gamma : - public pixfmt_alpha_blend_rgb_packed, - rendering_buffer> +//-----------------------------------------------------pixfmt_rgbBBA_gamma +template +class pixfmt_rgbBBA_gamma : public pixfmt_alpha_blend_rgb_packed, rendering_buffer> +{ + public: + pixfmt_rgbBBA_gamma(rendering_buffer& rb, const Gamma& g) + : pixfmt_alpha_blend_rgb_packed, rendering_buffer>(rb) { - public: - pixfmt_rgbBBA_gamma(rendering_buffer& rb, const Gamma& g) : - pixfmt_alpha_blend_rgb_packed, - rendering_buffer>(rb) - { - this->blender().gamma(g); - } - }; + this->blender().gamma(g); + } +}; - - //-----------------------------------------------------pixfmt_bgrABB_gamma - template class pixfmt_bgrABB_gamma : - public pixfmt_alpha_blend_rgb_packed, - rendering_buffer> +//-----------------------------------------------------pixfmt_bgrABB_gamma +template +class pixfmt_bgrABB_gamma : public pixfmt_alpha_blend_rgb_packed, rendering_buffer> +{ + public: + pixfmt_bgrABB_gamma(rendering_buffer& rb, const Gamma& g) + : pixfmt_alpha_blend_rgb_packed, rendering_buffer>(rb) { - public: - pixfmt_bgrABB_gamma(rendering_buffer& rb, const Gamma& g) : - pixfmt_alpha_blend_rgb_packed, - rendering_buffer>(rb) - { - this->blender().gamma(g); - } - }; + this->blender().gamma(g); + } +}; - -} +} // namespace agg #endif - diff --git a/deps/agg/include/agg_pixfmt_rgba.h b/deps/agg/include/agg_pixfmt_rgba.h index 40ddf6a07..66cb0a2b6 100644 --- a/deps/agg/include/agg_pixfmt_rgba.h +++ b/deps/agg/include/agg_pixfmt_rgba.h @@ -30,11 +30,11 @@ #include "agg_color_rgba.h" #include "agg_rendering_buffer.h" -namespace agg -{ +namespace agg { //=========================================================multiplier_rgba -template struct multiplier_rgba +template +struct multiplier_rgba { typedef typename ColorT::value_type value_type; typedef typename ColorT::calc_type calc_type; @@ -43,9 +43,9 @@ template struct multiplier_rgba static AGG_INLINE void premultiply(value_type* p) { calc_type a = p[Order::A]; - if(a < ColorT::base_mask) + if (a < ColorT::base_mask) { - if(a == 0) + if (a == 0) { p[Order::R] = p[Order::G] = p[Order::B] = 0; return; @@ -56,14 +56,13 @@ template struct multiplier_rgba } } - //-------------------------------------------------------------------- static AGG_INLINE void demultiply(value_type* p) { calc_type a = p[Order::A]; - if(a < ColorT::base_mask) + if (a < ColorT::base_mask) { - if(a == 0) + if (a == 0) { p[Order::R] = p[Order::G] = p[Order::B] = 0; return; @@ -79,61 +78,62 @@ template struct multiplier_rgba }; //=====================================================apply_gamma_dir_rgba -template class apply_gamma_dir_rgba +template +class apply_gamma_dir_rgba { -public: + public: typedef typename ColorT::value_type value_type; - apply_gamma_dir_rgba(const GammaLut& gamma) : m_gamma(gamma) {} + apply_gamma_dir_rgba(const GammaLut& gamma) + : m_gamma(gamma) + {} - AGG_INLINE void operator () (value_type* p) + AGG_INLINE void operator()(value_type* p) { p[Order::R] = m_gamma.dir(p[Order::R]); p[Order::G] = m_gamma.dir(p[Order::G]); p[Order::B] = m_gamma.dir(p[Order::B]); } -private: + private: const GammaLut& m_gamma; }; //=====================================================apply_gamma_inv_rgba -template class apply_gamma_inv_rgba +template +class apply_gamma_inv_rgba { -public: + public: typedef typename ColorT::value_type value_type; - apply_gamma_inv_rgba(const GammaLut& gamma) : m_gamma(gamma) {} + apply_gamma_inv_rgba(const GammaLut& gamma) + : m_gamma(gamma) + {} - AGG_INLINE void operator () (value_type* p) + AGG_INLINE void operator()(value_type* p) { p[Order::R] = m_gamma.inv(p[Order::R]); p[Order::G] = m_gamma.inv(p[Order::G]); p[Order::B] = m_gamma.inv(p[Order::B]); } -private: + private: const GammaLut& m_gamma; }; //=============================================================blender_rgba -template struct blender_rgba +template +struct blender_rgba { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; //-------------------------------------------------------------------- - static AGG_INLINE void blend_pix(value_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha, - unsigned /*cover*/=0) + static AGG_INLINE void + blend_pix(value_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned /*cover*/ = 0) { calc_type r = p[Order::R]; calc_type g = p[Order::G]; @@ -147,23 +147,18 @@ template struct blender_rgba }; //=========================================================blender_rgba_pre -template struct blender_rgba_pre +template +struct blender_rgba_pre { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; //-------------------------------------------------------------------- - static AGG_INLINE void blend_pix(value_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha, - unsigned cover) + static AGG_INLINE void + blend_pix(value_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned cover) { alpha = color_type::base_mask - alpha; cover = (cover + 1) << (base_shift - 8); @@ -174,9 +169,7 @@ template struct blender_rgba_pre } //-------------------------------------------------------------------- - static AGG_INLINE void blend_pix(value_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha) + static AGG_INLINE void blend_pix(value_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha) { alpha = color_type::base_mask - alpha; p[Order::R] = (value_type)(((p[Order::R] * alpha) >> base_shift) + cr); @@ -187,7 +180,8 @@ template struct blender_rgba_pre }; //======================================================blender_rgba_plain -template struct blender_rgba_plain +template +struct blender_rgba_plain { typedef ColorT color_type; typedef Order order_type; @@ -196,12 +190,11 @@ template struct blender_rgba_plain enum base_scale_e { base_shift = color_type::base_shift }; //-------------------------------------------------------------------- - static AGG_INLINE void blend_pix(value_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha, - unsigned /*cover*/=0) + static AGG_INLINE void + blend_pix(value_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned /*cover*/ = 0) { - if(alpha == 0) return; + if (alpha == 0) + return; calc_type a = p[Order::A]; calc_type r = p[Order::R] * a; calc_type g = p[Order::G] * a; @@ -214,33 +207,18 @@ template struct blender_rgba_plain } }; - - - - - - - - - - //=========================================================comp_op_rgba_clear -template struct comp_op_rgba_clear +template +struct comp_op_rgba_clear { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; - static AGG_INLINE void blend_pix(value_type* p, - unsigned, unsigned, unsigned, unsigned, - unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned, unsigned, unsigned, unsigned, unsigned cover) { - if(cover < 255) + if (cover < 255) { cover = 255 - cover; p[Order::R] = (value_type)((p[Order::R] * cover + 255) >> 8); @@ -256,17 +234,16 @@ template struct comp_op_rgba_clear }; //===========================================================comp_op_rgba_src -template struct comp_op_rgba_src +template +struct comp_op_rgba_src { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; - static AGG_INLINE void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { - if(cover < 255) + if (cover < 255) { unsigned alpha = 255 - cover; p[Order::R] = (value_type)(((p[Order::R] * alpha + 255) >> 8) + ((sr * cover + 255) >> 8)); @@ -285,39 +262,31 @@ template struct comp_op_rgba_src }; //===========================================================comp_op_rgba_dst -template struct comp_op_rgba_dst +template +struct comp_op_rgba_dst { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; - static AGG_INLINE void blend_pix(value_type*, - unsigned, unsigned, unsigned, - unsigned, unsigned) - { - } + static AGG_INLINE void blend_pix(value_type*, unsigned, unsigned, unsigned, unsigned, unsigned) {} }; //======================================================comp_op_rgba_src_over -template struct comp_op_rgba_src_over +template +struct comp_op_rgba_src_over { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; // Dca' = Sca + Dca.(1 - Sa) // Da' = Sa + Da - Sa.Da - static AGG_INLINE void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { - if(cover < 255) + if (cover < 255) { sr = (sr * cover + 255) >> 8; sg = (sg * cover + 255) >> 8; @@ -333,25 +302,20 @@ template struct comp_op_rgba_src_over }; //======================================================comp_op_rgba_dst_over -template struct comp_op_rgba_dst_over +template +struct comp_op_rgba_dst_over { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; // Dca' = Dca + Sca.(1 - Da) // Da' = Sa + Da - Sa.Da - static AGG_INLINE void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { - if(cover < 255) + if (cover < 255) { sr = (sr * cover + 255) >> 8; sg = (sg * cover + 255) >> 8; @@ -367,32 +331,31 @@ template struct comp_op_rgba_dst_over }; //======================================================comp_op_rgba_src_in -template struct comp_op_rgba_src_in +template +struct comp_op_rgba_src_in { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; // Dca' = Sca.Da // Da' = Sa.Da - static AGG_INLINE void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { calc_type da = p[Order::A]; - if(cover < 255) + if (cover < 255) { unsigned alpha = 255 - cover; - p[Order::R] = (value_type)(((p[Order::R] * alpha + 255) >> 8) + ((((sr * da + base_mask) >> base_shift) * cover + 255) >> 8)); - p[Order::G] = (value_type)(((p[Order::G] * alpha + 255) >> 8) + ((((sg * da + base_mask) >> base_shift) * cover + 255) >> 8)); - p[Order::B] = (value_type)(((p[Order::B] * alpha + 255) >> 8) + ((((sb * da + base_mask) >> base_shift) * cover + 255) >> 8)); - p[Order::A] = (value_type)(((p[Order::A] * alpha + 255) >> 8) + ((((sa * da + base_mask) >> base_shift) * cover + 255) >> 8)); + p[Order::R] = (value_type)(((p[Order::R] * alpha + 255) >> 8) + + ((((sr * da + base_mask) >> base_shift) * cover + 255) >> 8)); + p[Order::G] = (value_type)(((p[Order::G] * alpha + 255) >> 8) + + ((((sg * da + base_mask) >> base_shift) * cover + 255) >> 8)); + p[Order::B] = (value_type)(((p[Order::B] * alpha + 255) >> 8) + + ((((sb * da + base_mask) >> base_shift) * cover + 255) >> 8)); + p[Order::A] = (value_type)(((p[Order::A] * alpha + 255) >> 8) + + ((((sa * da + base_mask) >> base_shift) * cover + 255) >> 8)); } else { @@ -405,25 +368,20 @@ template struct comp_op_rgba_src_in }; //======================================================comp_op_rgba_dst_in -template struct comp_op_rgba_dst_in +template +struct comp_op_rgba_dst_in { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; // Dca' = Dca.Sa // Da' = Sa.Da - static AGG_INLINE void blend_pix(value_type* p, - unsigned, unsigned, unsigned, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned, unsigned, unsigned, unsigned sa, unsigned cover) { - if(cover < 255) + if (cover < 255) { sa = base_mask - ((cover * (base_mask - sa) + 255) >> 8); } @@ -435,32 +393,31 @@ template struct comp_op_rgba_dst_in }; //======================================================comp_op_rgba_src_out -template struct comp_op_rgba_src_out +template +struct comp_op_rgba_src_out { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; // Dca' = Sca.(1 - Da) // Da' = Sa.(1 - Da) - static AGG_INLINE void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { calc_type da = base_mask - p[Order::A]; - if(cover < 255) + if (cover < 255) { unsigned alpha = 255 - cover; - p[Order::R] = (value_type)(((p[Order::R] * alpha + 255) >> 8) + ((((sr * da + base_mask) >> base_shift) * cover + 255) >> 8)); - p[Order::G] = (value_type)(((p[Order::G] * alpha + 255) >> 8) + ((((sg * da + base_mask) >> base_shift) * cover + 255) >> 8)); - p[Order::B] = (value_type)(((p[Order::B] * alpha + 255) >> 8) + ((((sb * da + base_mask) >> base_shift) * cover + 255) >> 8)); - p[Order::A] = (value_type)(((p[Order::A] * alpha + 255) >> 8) + ((((sa * da + base_mask) >> base_shift) * cover + 255) >> 8)); + p[Order::R] = (value_type)(((p[Order::R] * alpha + 255) >> 8) + + ((((sr * da + base_mask) >> base_shift) * cover + 255) >> 8)); + p[Order::G] = (value_type)(((p[Order::G] * alpha + 255) >> 8) + + ((((sg * da + base_mask) >> base_shift) * cover + 255) >> 8)); + p[Order::B] = (value_type)(((p[Order::B] * alpha + 255) >> 8) + + ((((sb * da + base_mask) >> base_shift) * cover + 255) >> 8)); + p[Order::A] = (value_type)(((p[Order::A] * alpha + 255) >> 8) + + ((((sa * da + base_mask) >> base_shift) * cover + 255) >> 8)); } else { @@ -473,25 +430,20 @@ template struct comp_op_rgba_src_out }; //======================================================comp_op_rgba_dst_out -template struct comp_op_rgba_dst_out +template +struct comp_op_rgba_dst_out { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; // Dca' = Dca.(1 - Sa) // Da' = Da.(1 - Sa) - static AGG_INLINE void blend_pix(value_type* p, - unsigned, unsigned, unsigned, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned, unsigned, unsigned, unsigned sa, unsigned cover) { - if(cover < 255) + if (cover < 255) { sa = (sa * cover + 255) >> 8; } @@ -504,25 +456,20 @@ template struct comp_op_rgba_dst_out }; //=====================================================comp_op_rgba_src_atop -template struct comp_op_rgba_src_atop +template +struct comp_op_rgba_src_atop { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; // Dca' = Sca.Da + Dca.(1 - Sa) // Da' = Da - static AGG_INLINE void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { - if(cover < 255) + if (cover < 255) { sr = (sr * cover + 255) >> 8; sg = (sg * cover + 255) >> 8; @@ -538,26 +485,21 @@ template struct comp_op_rgba_src_atop }; //=====================================================comp_op_rgba_dst_atop -template struct comp_op_rgba_dst_atop +template +struct comp_op_rgba_dst_atop { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; // Dca' = Dca.Sa + Sca.(1 - Da) // Da' = Sa - static AGG_INLINE void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { calc_type da = base_mask - p[Order::A]; - if(cover < 255) + if (cover < 255) { unsigned alpha = 255 - cover; sr = (p[Order::R] * sa + sr * da + base_mask) >> base_shift; @@ -567,7 +509,6 @@ template struct comp_op_rgba_dst_atop p[Order::G] = (value_type)(((p[Order::G] * alpha + 255) >> 8) + ((sg * cover + 255) >> 8)); p[Order::B] = (value_type)(((p[Order::B] * alpha + 255) >> 8) + ((sb * cover + 255) >> 8)); p[Order::A] = (value_type)(((p[Order::A] * alpha + 255) >> 8) + ((sa * cover + 255) >> 8)); - } else { @@ -580,70 +521,60 @@ template struct comp_op_rgba_dst_atop }; //=========================================================comp_op_rgba_xor -template struct comp_op_rgba_xor +template +struct comp_op_rgba_xor { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; // Dca' = Sca.(1 - Da) + Dca.(1 - Sa) // Da' = Sa + Da - 2.Sa.Da - static AGG_INLINE void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { - if(cover < 255) + if (cover < 255) { sr = (sr * cover + 255) >> 8; sg = (sg * cover + 255) >> 8; sb = (sb * cover + 255) >> 8; sa = (sa * cover + 255) >> 8; } - if(sa) + if (sa) { calc_type s1a = base_mask - sa; calc_type d1a = base_mask - p[Order::A]; p[Order::R] = (value_type)((p[Order::R] * s1a + sr * d1a + base_mask) >> base_shift); p[Order::G] = (value_type)((p[Order::G] * s1a + sg * d1a + base_mask) >> base_shift); p[Order::B] = (value_type)((p[Order::B] * s1a + sb * d1a + base_mask) >> base_shift); - p[Order::A] = (value_type)(sa + p[Order::A] - ((sa * p[Order::A] + base_mask/2) >> (base_shift - 1))); + p[Order::A] = (value_type)(sa + p[Order::A] - ((sa * p[Order::A] + base_mask / 2) >> (base_shift - 1))); } } }; //=========================================================comp_op_rgba_plus -template struct comp_op_rgba_plus +template +struct comp_op_rgba_plus { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; // Dca' = Sca + Dca // Da' = Sa + Da - static AGG_INLINE void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { - if(cover < 255) + if (cover < 255) { sr = (sr * cover + 255) >> 8; sg = (sg * cover + 255) >> 8; sb = (sb * cover + 255) >> 8; sa = (sa * cover + 255) >> 8; } - if(sa) + if (sa) { calc_type dr = p[Order::R] + sr; calc_type dg = p[Order::G] + sg; @@ -658,32 +589,27 @@ template struct comp_op_rgba_plus }; //========================================================comp_op_rgba_minus -template struct comp_op_rgba_minus +template +struct comp_op_rgba_minus { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; // Dca' = Dca - Sca // Da' = 1 - (1 - Sa).(1 - Da) - static AGG_INLINE void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { - if(cover < 255) + if (cover < 255) { sr = (sr * cover + 255) >> 8; sg = (sg * cover + 255) >> 8; sb = (sb * cover + 255) >> 8; sa = (sa * cover + 255) >> 8; } - if(sa) + if (sa) { calc_type dr = (sr > p[Order::R]) ? 0 : p[Order::R] - sr; calc_type dg = (sg > p[Order::G]) ? 0 : p[Order::G] - sg; @@ -692,38 +618,34 @@ template struct comp_op_rgba_minus p[Order::G] = (dg > base_mask) ? 0 : dg; p[Order::B] = (db > base_mask) ? 0 : db; p[Order::A] = (value_type)(sa + p[Order::A] - ((sa * p[Order::A] + base_mask) >> base_shift)); - //p[Order::A] = (value_type)(base_mask - (((base_mask - sa) * (base_mask - p[Order::A]) + base_mask) >> base_shift)); + // p[Order::A] = (value_type)(base_mask - (((base_mask - sa) * (base_mask - p[Order::A]) + base_mask) >> + // base_shift)); } } }; //=====================================================comp_op_rgba_multiply -template struct comp_op_rgba_multiply +template +struct comp_op_rgba_multiply { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; // Dca' = Sca.Dca + Sca.(1 - Da) + Dca.(1 - Sa) // Da' = Sa + Da - Sa.Da - static AGG_INLINE void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { - if(cover < 255) + if (cover < 255) { sr = (sr * cover + 255) >> 8; sg = (sg * cover + 255) >> 8; sb = (sb * cover + 255) >> 8; sa = (sa * cover + 255) >> 8; } - if(sa) + if (sa) { calc_type s1a = base_mask - sa; calc_type d1a = base_mask - p[Order::A]; @@ -739,32 +661,27 @@ template struct comp_op_rgba_multiply }; //=====================================================comp_op_rgba_screen -template struct comp_op_rgba_screen +template +struct comp_op_rgba_screen { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; // Dca' = Sca + Dca - Sca.Dca // Da' = Sa + Da - Sa.Da - static AGG_INLINE void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { - if(cover < 255) + if (cover < 255) { sr = (sr * cover + 255) >> 8; sg = (sg * cover + 255) >> 8; sb = (sb * cover + 255) >> 8; sa = (sa * cover + 255) >> 8; } - if(sa) + if (sa) { calc_type dr = p[Order::R]; calc_type dg = p[Order::G]; @@ -779,17 +696,14 @@ template struct comp_op_rgba_screen }; //=====================================================comp_op_rgba_overlay -template struct comp_op_rgba_overlay +template +struct comp_op_rgba_overlay { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; // if 2.Dca < Da // Dca' = 2.Sca.Dca + Sca.(1 - Da) + Dca.(1 - Sa) @@ -797,82 +711,85 @@ template struct comp_op_rgba_overlay // Dca' = Sa.Da - 2.(Da - Dca).(Sa - Sca) + Sca.(1 - Da) + Dca.(1 - Sa) // // Da' = Sa + Da - Sa.Da - static AGG_INLINE void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { - if(cover < 255) + if (cover < 255) { sr = (sr * cover + 255) >> 8; sg = (sg * cover + 255) >> 8; sb = (sb * cover + 255) >> 8; sa = (sa * cover + 255) >> 8; } - if(sa) + if (sa) { - calc_type d1a = base_mask - p[Order::A]; - calc_type s1a = base_mask - sa; - calc_type dr = p[Order::R]; - calc_type dg = p[Order::G]; - calc_type db = p[Order::B]; - calc_type da = p[Order::A]; + calc_type d1a = base_mask - p[Order::A]; + calc_type s1a = base_mask - sa; + calc_type dr = p[Order::R]; + calc_type dg = p[Order::G]; + calc_type db = p[Order::B]; + calc_type da = p[Order::A]; calc_type sada = sa * p[Order::A]; - p[Order::R] = (value_type)(((2*dr < da) ? - 2*sr*dr + sr*d1a + dr*s1a : - sada - 2*(da - dr)*(sa - sr) + sr*d1a + dr*s1a + base_mask) >> base_shift); + p[Order::R] = + (value_type)(((2 * dr < da) ? 2 * sr * dr + sr * d1a + dr * s1a + : sada - 2 * (da - dr) * (sa - sr) + sr * d1a + dr * s1a + base_mask) >> + base_shift); - p[Order::G] = (value_type)(((2*dg < da) ? - 2*sg*dg + sg*d1a + dg*s1a : - sada - 2*(da - dg)*(sa - sg) + sg*d1a + dg*s1a + base_mask) >> base_shift); + p[Order::G] = + (value_type)(((2 * dg < da) ? 2 * sg * dg + sg * d1a + dg * s1a + : sada - 2 * (da - dg) * (sa - sg) + sg * d1a + dg * s1a + base_mask) >> + base_shift); - p[Order::B] = (value_type)(((2*db < da) ? - 2*sb*db + sb*d1a + db*s1a : - sada - 2*(da - db)*(sa - sb) + sb*d1a + db*s1a + base_mask) >> base_shift); + p[Order::B] = + (value_type)(((2 * db < da) ? 2 * sb * db + sb * d1a + db * s1a + : sada - 2 * (da - db) * (sa - sb) + sb * d1a + db * s1a + base_mask) >> + base_shift); p[Order::A] = (value_type)(sa + da - ((sa * da + base_mask) >> base_shift)); } } }; - -template inline T sd_min(T a, T b) { return (a < b) ? a : b; } -template inline T sd_max(T a, T b) { return (a > b) ? a : b; } +template +inline T sd_min(T a, T b) +{ + return (a < b) ? a : b; +} +template +inline T sd_max(T a, T b) +{ + return (a > b) ? a : b; +} //=====================================================comp_op_rgba_darken -template struct comp_op_rgba_darken +template +struct comp_op_rgba_darken { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; // Dca' = min(Sca.Da, Dca.Sa) + Sca.(1 - Da) + Dca.(1 - Sa) // Da' = Sa + Da - Sa.Da - static AGG_INLINE void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { - if(cover < 255) + if (cover < 255) { sr = (sr * cover + 255) >> 8; sg = (sg * cover + 255) >> 8; sb = (sb * cover + 255) >> 8; sa = (sa * cover + 255) >> 8; } - if(sa) + if (sa) { calc_type d1a = base_mask - p[Order::A]; calc_type s1a = base_mask - sa; - calc_type dr = p[Order::R]; - calc_type dg = p[Order::G]; - calc_type db = p[Order::B]; - calc_type da = p[Order::A]; + calc_type dr = p[Order::R]; + calc_type dg = p[Order::G]; + calc_type db = p[Order::B]; + calc_type da = p[Order::A]; p[Order::R] = (value_type)((sd_min(sr * da, dr * sa) + sr * d1a + dr * s1a + base_mask) >> base_shift); p[Order::G] = (value_type)((sd_min(sg * da, dg * sa) + sg * d1a + dg * s1a + base_mask) >> base_shift); @@ -883,39 +800,34 @@ template struct comp_op_rgba_darken }; //=====================================================comp_op_rgba_lighten -template struct comp_op_rgba_lighten +template +struct comp_op_rgba_lighten { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; // Dca' = max(Sca.Da, Dca.Sa) + Sca.(1 - Da) + Dca.(1 - Sa) // Da' = Sa + Da - Sa.Da - static AGG_INLINE void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { - if(cover < 255) + if (cover < 255) { sr = (sr * cover + 255) >> 8; sg = (sg * cover + 255) >> 8; sb = (sb * cover + 255) >> 8; sa = (sa * cover + 255) >> 8; } - if(sa) + if (sa) { calc_type d1a = base_mask - p[Order::A]; calc_type s1a = base_mask - sa; - calc_type dr = p[Order::R]; - calc_type dg = p[Order::G]; - calc_type db = p[Order::B]; - calc_type da = p[Order::A]; + calc_type dr = p[Order::R]; + calc_type dg = p[Order::G]; + calc_type db = p[Order::B]; + calc_type da = p[Order::A]; p[Order::R] = (value_type)((sd_max(sr * da, dr * sa) + sr * d1a + dr * s1a + base_mask) >> base_shift); p[Order::G] = (value_type)((sd_max(sg * da, dg * sa) + sg * d1a + dg * s1a + base_mask) >> base_shift); @@ -926,18 +838,15 @@ template struct comp_op_rgba_lighten }; //=====================================================comp_op_rgba_color_dodge -template struct comp_op_rgba_color_dodge +template +struct comp_op_rgba_color_dodge { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; // if Sca.Da + Dca.Sa >= Sa.Da // Dca' = Sa.Da + Sca.(1 - Da) + Dca.(1 - Sa) @@ -945,25 +854,23 @@ template struct comp_op_rgba_color_dodge // Dca' = Dca.Sa/(1-Sca/Sa) + Sca.(1 - Da) + Dca.(1 - Sa) // // Da' = Sa + Da - Sa.Da - static AGG_INLINE void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { - if(cover < 255) + if (cover < 255) { sr = (sr * cover + 255) >> 8; sg = (sg * cover + 255) >> 8; sb = (sb * cover + 255) >> 8; sa = (sa * cover + 255) >> 8; } - if(sa) + if (sa) { - calc_type d1a = base_mask - p[Order::A]; - calc_type s1a = base_mask - sa; - calc_type dr = p[Order::R]; - calc_type dg = p[Order::G]; - calc_type db = p[Order::B]; - calc_type da = p[Order::A]; + calc_type d1a = base_mask - p[Order::A]; + calc_type s1a = base_mask - sa; + calc_type dr = p[Order::R]; + calc_type dg = p[Order::G]; + calc_type db = p[Order::B]; + calc_type da = p[Order::A]; long_type drsa = dr * sa; long_type dgsa = dg * sa; long_type dbsa = db * sa; @@ -972,17 +879,17 @@ template struct comp_op_rgba_color_dodge long_type sbda = sb * da; long_type sada = sa * da; - p[Order::R] = (value_type)((srda + drsa >= sada) ? - (sada + sr * d1a + dr * s1a + base_mask) >> base_shift : - drsa / (base_mask - (sr << base_shift) / sa) + ((sr * d1a + dr * s1a + base_mask) >> base_shift)); + p[Order::R] = (value_type)((srda + drsa >= sada) ? (sada + sr * d1a + dr * s1a + base_mask) >> base_shift + : drsa / (base_mask - (sr << base_shift) / sa) + + ((sr * d1a + dr * s1a + base_mask) >> base_shift)); - p[Order::G] = (value_type)((sgda + dgsa >= sada) ? - (sada + sg * d1a + dg * s1a + base_mask) >> base_shift : - dgsa / (base_mask - (sg << base_shift) / sa) + ((sg * d1a + dg * s1a + base_mask) >> base_shift)); + p[Order::G] = (value_type)((sgda + dgsa >= sada) ? (sada + sg * d1a + dg * s1a + base_mask) >> base_shift + : dgsa / (base_mask - (sg << base_shift) / sa) + + ((sg * d1a + dg * s1a + base_mask) >> base_shift)); - p[Order::B] = (value_type)((sbda + dbsa >= sada) ? - (sada + sb * d1a + db * s1a + base_mask) >> base_shift : - dbsa / (base_mask - (sb << base_shift) / sa) + ((sb * d1a + db * s1a + base_mask) >> base_shift)); + p[Order::B] = (value_type)((sbda + dbsa >= sada) ? (sada + sb * d1a + db * s1a + base_mask) >> base_shift + : dbsa / (base_mask - (sb << base_shift) / sa) + + ((sb * d1a + db * s1a + base_mask) >> base_shift)); p[Order::A] = (value_type)(sa + da - ((sa * da + base_mask) >> base_shift)); } @@ -990,18 +897,15 @@ template struct comp_op_rgba_color_dodge }; //=====================================================comp_op_rgba_color_burn -template struct comp_op_rgba_color_burn +template +struct comp_op_rgba_color_burn { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; // if Sca.Da + Dca.Sa <= Sa.Da // Dca' = Sca.(1 - Da) + Dca.(1 - Sa) @@ -1010,7 +914,6 @@ template struct comp_op_rgba_color_burn // // Da' = Sa + Da - Sa.Da - // http://www.w3.org/TR/SVGCompositing/ // if Sca == 0 and Dca == Da // Dca' = Sa × Da + Sca × (1 - Da) + Dca × (1 - Sa) @@ -1024,9 +927,7 @@ template struct comp_op_rgba_color_burn // = Sa × Da × (1 - min(1, (1 - Dca/Da) × Sa/Sca)) + Sca × (1 - Da) + Dca × (1 - Sa) // sa * da * (255 - std::min(255, (255 - p[0]/da)*(sa/(sc*sa)) + - static AGG_INLINE void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { if (cover < 255) { @@ -1038,12 +939,12 @@ template struct comp_op_rgba_color_burn if (sa) { - calc_type d1a = base_mask - p[Order::A]; - calc_type s1a = base_mask - sa; - calc_type dr = p[Order::R]; - calc_type dg = p[Order::G]; - calc_type db = p[Order::B]; - calc_type da = p[Order::A]; + calc_type d1a = base_mask - p[Order::A]; + calc_type s1a = base_mask - sa; + calc_type dr = p[Order::R]; + calc_type dg = p[Order::G]; + calc_type db = p[Order::B]; + calc_type da = p[Order::A]; long_type drsa = dr * sa; long_type dgsa = dg * sa; long_type dbsa = db * sa; @@ -1052,17 +953,23 @@ template struct comp_op_rgba_color_burn long_type sbda = sb * da; long_type sada = sa * da; - p[Order::R] = (value_type)(((srda + drsa <= sada) ? - sr * d1a + dr * s1a : - (sr > 0 ? sa * (srda + drsa - sada) / sr + sr * d1a + dr * s1a + base_mask : 0)) >> base_shift); + p[Order::R] = + (value_type)(((srda + drsa <= sada) + ? sr * d1a + dr * s1a + : (sr > 0 ? sa * (srda + drsa - sada) / sr + sr * d1a + dr * s1a + base_mask : 0)) >> + base_shift); - p[Order::G] = (value_type)(((sgda + dgsa <= sada) ? - sg * d1a + dg * s1a : - (sg > 0 ? sa * (sgda + dgsa - sada) / sg + sg * d1a + dg * s1a + base_mask : 0)) >> base_shift); + p[Order::G] = + (value_type)(((sgda + dgsa <= sada) + ? sg * d1a + dg * s1a + : (sg > 0 ? sa * (sgda + dgsa - sada) / sg + sg * d1a + dg * s1a + base_mask : 0)) >> + base_shift); - p[Order::B] = (value_type)(((sbda + dbsa <= sada) ? - sb * d1a + db * s1a : - (sb > 0 ? sa * (sbda + dbsa - sada) / sb + sb * d1a + db * s1a + base_mask : 0)) >> base_shift); + p[Order::B] = + (value_type)(((sbda + dbsa <= sada) + ? sb * d1a + db * s1a + : (sb > 0 ? sa * (sbda + dbsa - sada) / sb + sb * d1a + db * s1a + base_mask : 0)) >> + base_shift); p[Order::A] = (value_type)(sa + da - ((sa * da + base_mask) >> base_shift)); } @@ -1070,18 +977,15 @@ template struct comp_op_rgba_color_burn }; //=====================================================comp_op_rgba_hard_light -template struct comp_op_rgba_hard_light +template +struct comp_op_rgba_hard_light { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; // if 2.Sca < Sa // Dca' = 2.Sca.Dca + Sca.(1 - Da) + Dca.(1 - Sa) @@ -1089,38 +993,39 @@ template struct comp_op_rgba_hard_light // Dca' = Sa.Da - 2.(Da - Dca).(Sa - Sca) + Sca.(1 - Da) + Dca.(1 - Sa) // // Da' = Sa + Da - Sa.Da - static AGG_INLINE void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { - if(cover < 255) + if (cover < 255) { sr = (sr * cover + 255) >> 8; sg = (sg * cover + 255) >> 8; sb = (sb * cover + 255) >> 8; sa = (sa * cover + 255) >> 8; } - if(sa) + if (sa) { - calc_type d1a = base_mask - p[Order::A]; - calc_type s1a = base_mask - sa; - calc_type dr = p[Order::R]; - calc_type dg = p[Order::G]; - calc_type db = p[Order::B]; - calc_type da = p[Order::A]; + calc_type d1a = base_mask - p[Order::A]; + calc_type s1a = base_mask - sa; + calc_type dr = p[Order::R]; + calc_type dg = p[Order::G]; + calc_type db = p[Order::B]; + calc_type da = p[Order::A]; calc_type sada = sa * da; - p[Order::R] = (value_type)(((2*sr < sa) ? - 2*sr*dr + sr*d1a + dr*s1a : - sada - 2*(da - dr)*(sa - sr) + sr*d1a + dr*s1a + base_mask) >> base_shift); + p[Order::R] = + (value_type)(((2 * sr < sa) ? 2 * sr * dr + sr * d1a + dr * s1a + : sada - 2 * (da - dr) * (sa - sr) + sr * d1a + dr * s1a + base_mask) >> + base_shift); - p[Order::G] = (value_type)(((2*sg < sa) ? - 2*sg*dg + sg*d1a + dg*s1a : - sada - 2*(da - dg)*(sa - sg) + sg*d1a + dg*s1a + base_mask) >> base_shift); + p[Order::G] = + (value_type)(((2 * sg < sa) ? 2 * sg * dg + sg * d1a + dg * s1a + : sada - 2 * (da - dg) * (sa - sg) + sg * d1a + dg * s1a + base_mask) >> + base_shift); - p[Order::B] = (value_type)(((2*sb < sa) ? - 2*sb*db + sb*d1a + db*s1a : - sada - 2*(da - db)*(sa - sb) + sb*d1a + db*s1a + base_mask) >> base_shift); + p[Order::B] = + (value_type)(((2 * sb < sa) ? 2 * sb * db + sb * d1a + db * s1a + : sada - 2 * (da - db) * (sa - sb) + sb * d1a + db * s1a + base_mask) >> + base_shift); p[Order::A] = (value_type)(sa + da - ((sa * da + base_mask) >> base_shift)); } @@ -1128,18 +1033,15 @@ template struct comp_op_rgba_hard_light }; //=====================================================comp_op_rgba_soft_light -template struct comp_op_rgba_soft_light +template +struct comp_op_rgba_soft_light { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; // if 2.Sca < Sa // Dca' = Dca.(Sa + (1 - Dca/Da).(2.Sca - Sa)) + Sca.(1 - Da) + Dca.(1 - Sa) @@ -1150,36 +1052,43 @@ template struct comp_op_rgba_soft_light // // Da' = Sa + Da - Sa.Da - static AGG_INLINE void blend_pix(value_type* p, - unsigned r, unsigned g, unsigned b, - unsigned a, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned r, unsigned g, unsigned b, unsigned a, unsigned cover) { double sr = double(r * cover) / (base_mask * 255); double sg = double(g * cover) / (base_mask * 255); double sb = double(b * cover) / (base_mask * 255); double sa = double(a * cover) / (base_mask * 255); - if(sa > 0) + if (sa > 0) { double dr = double(p[Order::R]) / base_mask; double dg = double(p[Order::G]) / base_mask; double db = double(p[Order::B]) / base_mask; double da = double(p[Order::A] ? p[Order::A] : 1) / base_mask; - if(cover < 255) + if (cover < 255) { a = (a * cover + 255) >> 8; } - if(2*sr < sa) dr = dr*(sa + (1 - dr/da)*(2*sr - sa)) + sr*(1 - da) + dr*(1 - sa); - else if(8*dr <= da) dr = dr*(sa + (1 - dr/da)*(2*sr - sa)*(3 - 8*dr/da)) + sr*(1 - da) + dr*(1 - sa); - else dr = (dr*sa + (sqrt(dr/da)*da - dr)*(2*sr - sa)) + sr*(1 - da) + dr*(1 - sa); + if (2 * sr < sa) + dr = dr * (sa + (1 - dr / da) * (2 * sr - sa)) + sr * (1 - da) + dr * (1 - sa); + else if (8 * dr <= da) + dr = dr * (sa + (1 - dr / da) * (2 * sr - sa) * (3 - 8 * dr / da)) + sr * (1 - da) + dr * (1 - sa); + else + dr = (dr * sa + (sqrt(dr / da) * da - dr) * (2 * sr - sa)) + sr * (1 - da) + dr * (1 - sa); - if(2*sg < sa) dg = dg*(sa + (1 - dg/da)*(2*sg - sa)) + sg*(1 - da) + dg*(1 - sa); - else if(8*dg <= da) dg = dg*(sa + (1 - dg/da)*(2*sg - sa)*(3 - 8*dg/da)) + sg*(1 - da) + dg*(1 - sa); - else dg = (dg*sa + (sqrt(dg/da)*da - dg)*(2*sg - sa)) + sg*(1 - da) + dg*(1 - sa); + if (2 * sg < sa) + dg = dg * (sa + (1 - dg / da) * (2 * sg - sa)) + sg * (1 - da) + dg * (1 - sa); + else if (8 * dg <= da) + dg = dg * (sa + (1 - dg / da) * (2 * sg - sa) * (3 - 8 * dg / da)) + sg * (1 - da) + dg * (1 - sa); + else + dg = (dg * sa + (sqrt(dg / da) * da - dg) * (2 * sg - sa)) + sg * (1 - da) + dg * (1 - sa); - if(2*sb < sa) db = db*(sa + (1 - db/da)*(2*sb - sa)) + sb*(1 - da) + db*(1 - sa); - else if(8*db <= da) db = db*(sa + (1 - db/da)*(2*sb - sa)*(3 - 8*db/da)) + sb*(1 - da) + db*(1 - sa); - else db = (db*sa + (sqrt(db/da)*da - db)*(2*sb - sa)) + sb*(1 - da) + db*(1 - sa); + if (2 * sb < sa) + db = db * (sa + (1 - db / da) * (2 * sb - sa)) + sb * (1 - da) + db * (1 - sa); + else if (8 * db <= da) + db = db * (sa + (1 - db / da) * (2 * sb - sa) * (3 - 8 * db / da)) + sb * (1 - da) + db * (1 - sa); + else + db = (db * sa + (sqrt(db / da) * da - db) * (2 * sb - sa)) + sb * (1 - da) + db * (1 - sa); p[Order::R] = (value_type)uround(dr * base_mask); p[Order::G] = (value_type)uround(dg * base_mask); @@ -1190,75 +1099,68 @@ template struct comp_op_rgba_soft_light }; //=====================================================comp_op_rgba_difference -template struct comp_op_rgba_difference +template +struct comp_op_rgba_difference { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; - enum base_scale_e - { + enum base_scale_e { base_shift = color_type::base_shift, base_scale = color_type::base_scale, - base_mask = color_type::base_mask + base_mask = color_type::base_mask }; // Dca' = Sca + Dca - 2.min(Sca.Da, Dca.Sa) // Da' = Sa + Da - Sa.Da - static AGG_INLINE void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { - if(cover < 255) + if (cover < 255) { sr = (sr * cover + 255) >> 8; sg = (sg * cover + 255) >> 8; sb = (sb * cover + 255) >> 8; sa = (sa * cover + 255) >> 8; } - if(sa) + if (sa) { calc_type dr = p[Order::R]; calc_type dg = p[Order::G]; calc_type db = p[Order::B]; calc_type da = p[Order::A]; - p[Order::R] = (value_type)(sr + dr - ((2 * sd_min(sr*da, dr*sa) + base_mask) >> base_shift)); - p[Order::G] = (value_type)(sg + dg - ((2 * sd_min(sg*da, dg*sa) + base_mask) >> base_shift)); - p[Order::B] = (value_type)(sb + db - ((2 * sd_min(sb*da, db*sa) + base_mask) >> base_shift)); + p[Order::R] = (value_type)(sr + dr - ((2 * sd_min(sr * da, dr * sa) + base_mask) >> base_shift)); + p[Order::G] = (value_type)(sg + dg - ((2 * sd_min(sg * da, dg * sa) + base_mask) >> base_shift)); + p[Order::B] = (value_type)(sb + db - ((2 * sd_min(sb * da, db * sa) + base_mask) >> base_shift)); p[Order::A] = (value_type)(sa + da - ((sa * da + base_mask) >> base_shift)); } } }; //=====================================================comp_op_rgba_exclusion -template struct comp_op_rgba_exclusion +template +struct comp_op_rgba_exclusion { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; // Dca' = (Sca.Da + Dca.Sa - 2.Sca.Dca) + Sca.(1 - Da) + Dca.(1 - Sa) // Da' = Sa + Da - Sa.Da - static AGG_INLINE void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { - if(cover < 255) + if (cover < 255) { sr = (sr * cover + 255) >> 8; sg = (sg * cover + 255) >> 8; sb = (sb * cover + 255) >> 8; sa = (sa * cover + 255) >> 8; } - if(sa) + if (sa) { calc_type d1a = base_mask - p[Order::A]; calc_type s1a = base_mask - sa; @@ -1266,34 +1168,31 @@ template struct comp_op_rgba_exclusion calc_type dg = p[Order::G]; calc_type db = p[Order::B]; calc_type da = p[Order::A]; - p[Order::R] = (value_type)((sr*da + dr*sa - 2*sr*dr + sr*d1a + dr*s1a + base_mask) >> base_shift); - p[Order::G] = (value_type)((sg*da + dg*sa - 2*sg*dg + sg*d1a + dg*s1a + base_mask) >> base_shift); - p[Order::B] = (value_type)((sb*da + db*sa - 2*sb*db + sb*d1a + db*s1a + base_mask) >> base_shift); + p[Order::R] = + (value_type)((sr * da + dr * sa - 2 * sr * dr + sr * d1a + dr * s1a + base_mask) >> base_shift); + p[Order::G] = + (value_type)((sg * da + dg * sa - 2 * sg * dg + sg * d1a + dg * s1a + base_mask) >> base_shift); + p[Order::B] = + (value_type)((sb * da + db * sa - 2 * sb * db + sb * d1a + db * s1a + base_mask) >> base_shift); p[Order::A] = (value_type)(sa + da - ((sa * da + base_mask) >> base_shift)); } } }; //=====================================================comp_op_rgba_contrast -template struct comp_op_rgba_contrast +template +struct comp_op_rgba_contrast { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; - - static AGG_INLINE void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { - if(cover < 255) + if (cover < 255) { sr = (sr * cover + 255) >> 8; sg = (sg * cover + 255) >> 8; @@ -1303,13 +1202,13 @@ template struct comp_op_rgba_contrast long_type dr = p[Order::R]; long_type dg = p[Order::G]; long_type db = p[Order::B]; - int da = p[Order::A]; + int da = p[Order::A]; long_type d2a = da >> 1; unsigned s2a = sa >> 1; - int r = (int)((((dr - d2a) * int((sr - s2a)*2 + base_mask)) >> base_shift) + d2a); - int g = (int)((((dg - d2a) * int((sg - s2a)*2 + base_mask)) >> base_shift) + d2a); - int b = (int)((((db - d2a) * int((sb - s2a)*2 + base_mask)) >> base_shift) + d2a); + int r = (int)((((dr - d2a) * int((sr - s2a) * 2 + base_mask)) >> base_shift) + d2a); + int g = (int)((((dg - d2a) * int((sg - s2a) * 2 + base_mask)) >> base_shift) + d2a); + int b = (int)((((db - d2a) * int((sb - s2a) * 2 + base_mask)) >> base_shift) + d2a); r = (r < 0) ? 0 : r; g = (g < 0) ? 0 : g; @@ -1322,27 +1221,23 @@ template struct comp_op_rgba_contrast }; //=====================================================comp_op_rgba_invert -template struct comp_op_rgba_invert +template +struct comp_op_rgba_invert { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; // Dca' = (Da - Dca) * Sa + Dca.(1 - Sa) // Da' = Sa + Da - Sa.Da - static AGG_INLINE void blend_pix(value_type* p, - unsigned /*sr*/, unsigned /*sg*/, unsigned /*sb*/, - unsigned sa, unsigned cover) + static AGG_INLINE void + blend_pix(value_type* p, unsigned /*sr*/, unsigned /*sg*/, unsigned /*sb*/, unsigned sa, unsigned cover) { sa = (sa * cover + 255) >> 8; - if(sa) + if (sa) { calc_type da = p[Order::A]; calc_type dr = ((da - p[Order::R]) * sa + base_mask) >> base_shift; @@ -1358,33 +1253,28 @@ template struct comp_op_rgba_invert }; //=================================================comp_op_rgba_invert_rgb -template struct comp_op_rgba_invert_rgb +template +struct comp_op_rgba_invert_rgb { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; // Dca' = (Da - Dca) * Sca + Dca.(1 - Sa) // Da' = Sa + Da - Sa.Da - static AGG_INLINE void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { - if(cover < 255) + if (cover < 255) { sr = (sr * cover + 255) >> 8; sg = (sg * cover + 255) >> 8; sb = (sb * cover + 255) >> 8; sa = (sa * cover + 255) >> 8; } - if(sa) + if (sa) { calc_type da = p[Order::A]; calc_type dr = ((da - p[Order::R]) * sr + base_mask) >> base_shift; @@ -1399,11 +1289,10 @@ template struct comp_op_rgba_invert_rgb } }; - // merge grain (GIMP) // E = I + M - 128 -template +template struct comp_op_rgba_grain_merge { typedef ColorT color_type; @@ -1411,17 +1300,10 @@ struct comp_op_rgba_grain_merge typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; - static AGG_INLINE void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { - if (cover < 255) { sr = (sr * cover + 255) >> 8; @@ -1446,7 +1328,7 @@ struct comp_op_rgba_grain_merge // grain extract (GIMP) // E = I - M + 128 // FIXME: https://github.com/mapnik/mapnik/issues/2067 -template +template struct comp_op_rgba_grain_extract { typedef ColorT color_type; @@ -1454,15 +1336,10 @@ struct comp_op_rgba_grain_extract typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; - static AGG_INLINE void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned /*cover*/) + static AGG_INLINE void + blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned /*cover*/) { calc_type da = (p[Order::A] * sa + 255) >> 8; @@ -1491,7 +1368,7 @@ struct comp_op_rgba_grain_extract } }; -template +template struct comp_op_rgba_hue { typedef ColorT color_type; @@ -1499,18 +1376,12 @@ struct comp_op_rgba_hue typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; - static void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover); + static void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover); }; -template +template struct comp_op_rgba_saturation { typedef ColorT color_type; @@ -1518,18 +1389,12 @@ struct comp_op_rgba_saturation typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; - static void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover); + static void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover); }; -template +template struct comp_op_rgba_color { typedef ColorT color_type; @@ -1537,19 +1402,12 @@ struct comp_op_rgba_color typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; - static void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover); + static void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover); }; - -template +template struct comp_op_rgba_value { typedef ColorT color_type; @@ -1557,19 +1415,13 @@ struct comp_op_rgba_value typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; - static void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover); + static void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover); }; // Linear dodge: Target + Blend -template +template struct comp_op_rgba_linear_dodge { typedef ColorT color_type; @@ -1577,15 +1429,9 @@ struct comp_op_rgba_linear_dodge typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; - static AGG_INLINE void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { if (cover < 255) { @@ -1606,22 +1452,16 @@ struct comp_op_rgba_linear_dodge }; // Linear burn: Target + Blend - 1 -template +template struct comp_op_rgba_linear_burn { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::long_type long_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; - static AGG_INLINE void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { if (cover < 255) { @@ -1642,22 +1482,16 @@ struct comp_op_rgba_linear_burn }; // Divide -template +template struct comp_op_rgba_divide { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::long_type long_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; - static AGG_INLINE void blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) + static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { if (cover < 255) { @@ -1671,9 +1505,9 @@ struct comp_op_rgba_divide float fg = (sg > 0) ? sg : 0.001; float fb = (sb > 0) ? sb : 0.001; - long_type dr = long_type(p[Order::R]/((fr + 1) / 256)); - long_type dg = long_type(p[Order::G]/((fg + 1) / 256)); - long_type db = long_type(p[Order::B]/((fb + 1) / 256)); + long_type dr = long_type(p[Order::R] / ((fr + 1) / 256)); + long_type dg = long_type(p[Order::G] / ((fg + 1) / 256)); + long_type db = long_type(p[Order::B] / ((fb + 1) / 256)); p[Order::R] = (dr > 255) ? 255 : dr; p[Order::G] = (dg > 255) ? 255 : dg; @@ -1683,70 +1517,61 @@ struct comp_op_rgba_divide } }; - //======================================================comp_op_table_rgba -template struct comp_op_table_rgba +template +struct comp_op_table_rgba { typedef typename ColorT::value_type value_type; - typedef void (*comp_op_func_type)(value_type* p, - unsigned cr, - unsigned cg, - unsigned cb, - unsigned ca, - unsigned cover); + typedef void ( + *comp_op_func_type)(value_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned ca, unsigned cover); static comp_op_func_type g_comp_op_func[]; }; //==========================================================g_comp_op_func template -typename comp_op_table_rgba::comp_op_func_type -comp_op_table_rgba::g_comp_op_func[] = -{ - comp_op_rgba_clear ::blend_pix, - comp_op_rgba_src ::blend_pix, - comp_op_rgba_dst ::blend_pix, - comp_op_rgba_src_over ::blend_pix, - comp_op_rgba_dst_over ::blend_pix, - comp_op_rgba_src_in ::blend_pix, - comp_op_rgba_dst_in ::blend_pix, - comp_op_rgba_src_out ::blend_pix, - comp_op_rgba_dst_out ::blend_pix, - comp_op_rgba_src_atop ::blend_pix, - comp_op_rgba_dst_atop ::blend_pix, - comp_op_rgba_xor ::blend_pix, - comp_op_rgba_plus ::blend_pix, - comp_op_rgba_minus ::blend_pix, - comp_op_rgba_multiply ::blend_pix, - comp_op_rgba_screen ::blend_pix, - comp_op_rgba_overlay ::blend_pix, - comp_op_rgba_darken ::blend_pix, - comp_op_rgba_lighten ::blend_pix, - comp_op_rgba_color_dodge::blend_pix, - comp_op_rgba_color_burn ::blend_pix, - comp_op_rgba_hard_light ::blend_pix, - comp_op_rgba_soft_light ::blend_pix, - comp_op_rgba_difference ::blend_pix, - comp_op_rgba_exclusion ::blend_pix, - comp_op_rgba_contrast ::blend_pix, - comp_op_rgba_invert ::blend_pix, - comp_op_rgba_invert_rgb ::blend_pix, - comp_op_rgba_grain_merge::blend_pix, - comp_op_rgba_grain_extract::blend_pix, - comp_op_rgba_hue::blend_pix, - comp_op_rgba_saturation::blend_pix, - comp_op_rgba_color::blend_pix, - comp_op_rgba_value::blend_pix, - comp_op_rgba_linear_dodge::blend_pix, - comp_op_rgba_linear_burn::blend_pix, - comp_op_rgba_divide::blend_pix, - //comp_op_rgba_colorize_alpha::blend_pix, - 0 -}; - +typename comp_op_table_rgba::comp_op_func_type comp_op_table_rgba::g_comp_op_func[] = { + comp_op_rgba_clear::blend_pix, + comp_op_rgba_src::blend_pix, + comp_op_rgba_dst::blend_pix, + comp_op_rgba_src_over::blend_pix, + comp_op_rgba_dst_over::blend_pix, + comp_op_rgba_src_in::blend_pix, + comp_op_rgba_dst_in::blend_pix, + comp_op_rgba_src_out::blend_pix, + comp_op_rgba_dst_out::blend_pix, + comp_op_rgba_src_atop::blend_pix, + comp_op_rgba_dst_atop::blend_pix, + comp_op_rgba_xor::blend_pix, + comp_op_rgba_plus::blend_pix, + comp_op_rgba_minus::blend_pix, + comp_op_rgba_multiply::blend_pix, + comp_op_rgba_screen::blend_pix, + comp_op_rgba_overlay::blend_pix, + comp_op_rgba_darken::blend_pix, + comp_op_rgba_lighten::blend_pix, + comp_op_rgba_color_dodge::blend_pix, + comp_op_rgba_color_burn::blend_pix, + comp_op_rgba_hard_light::blend_pix, + comp_op_rgba_soft_light::blend_pix, + comp_op_rgba_difference::blend_pix, + comp_op_rgba_exclusion::blend_pix, + comp_op_rgba_contrast::blend_pix, + comp_op_rgba_invert::blend_pix, + comp_op_rgba_invert_rgb::blend_pix, + comp_op_rgba_grain_merge::blend_pix, + comp_op_rgba_grain_extract::blend_pix, + comp_op_rgba_hue::blend_pix, + comp_op_rgba_saturation::blend_pix, + comp_op_rgba_color::blend_pix, + comp_op_rgba_value::blend_pix, + comp_op_rgba_linear_dodge::blend_pix, + comp_op_rgba_linear_burn::blend_pix, + comp_op_rgba_divide::blend_pix, + // comp_op_rgba_colorize_alpha::blend_pix, + 0}; //==============================================================comp_op_e -enum comp_op_e -{ +enum comp_op_e { comp_op_clear, //----comp_op_clear comp_op_src, //----comp_op_src comp_op_dst, //----comp_op_dst @@ -1781,157 +1606,129 @@ enum comp_op_e comp_op_saturation, //----comp_op_saturation comp_op_color, //----comp_op_color comp_op_value, //----comp_op_value - //comp_op_colorize_alpha,//----comp_op_colorize_alpha + // comp_op_colorize_alpha,//----comp_op_colorize_alpha comp_op_linear_dodge, // comp_op_linear_dodge - comp_op_linear_burn, // comp_op_linear_burn - comp_op_divide, // comp_op_divide + comp_op_linear_burn, // comp_op_linear_burn + comp_op_divide, // comp_op_divide end_of_comp_op_e }; //====================================================comp_op_adaptor_rgba -template struct comp_op_adaptor_rgba +template +struct comp_op_adaptor_rgba { - typedef Order order_type; + typedef Order order_type; typedef ColorT color_type; typedef typename color_type::value_type value_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; - static AGG_INLINE void blend_pix(unsigned op, value_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned ca, - unsigned cover) + static AGG_INLINE void + blend_pix(unsigned op, value_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned ca, unsigned cover) { - comp_op_table_rgba::g_comp_op_func[op] - (p, (cr * ca + base_mask) >> base_shift, - (cg * ca + base_mask) >> base_shift, - (cb * ca + base_mask) >> base_shift, - ca, cover); + comp_op_table_rgba::g_comp_op_func[op](p, + (cr * ca + base_mask) >> base_shift, + (cg * ca + base_mask) >> base_shift, + (cb * ca + base_mask) >> base_shift, + ca, + cover); } }; //=========================================comp_op_adaptor_clip_to_dst_rgba -template struct comp_op_adaptor_clip_to_dst_rgba +template +struct comp_op_adaptor_clip_to_dst_rgba { - typedef Order order_type; + typedef Order order_type; typedef ColorT color_type; typedef typename color_type::value_type value_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; - static AGG_INLINE void blend_pix(unsigned op, value_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned ca, - unsigned cover) + static AGG_INLINE void + blend_pix(unsigned op, value_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned ca, unsigned cover) { cr = (cr * ca + base_mask) >> base_shift; cg = (cg * ca + base_mask) >> base_shift; cb = (cb * ca + base_mask) >> base_shift; unsigned da = p[Order::A]; - comp_op_table_rgba::g_comp_op_func[op] - (p, (cr * da + base_mask) >> base_shift, - (cg * da + base_mask) >> base_shift, - (cb * da + base_mask) >> base_shift, - (ca * da + base_mask) >> base_shift, - cover); + comp_op_table_rgba::g_comp_op_func[op](p, + (cr * da + base_mask) >> base_shift, + (cg * da + base_mask) >> base_shift, + (cb * da + base_mask) >> base_shift, + (ca * da + base_mask) >> base_shift, + cover); } }; //================================================comp_op_adaptor_rgba_pre -template struct comp_op_adaptor_rgba_pre +template +struct comp_op_adaptor_rgba_pre { - typedef Order order_type; + typedef Order order_type; typedef ColorT color_type; typedef typename color_type::value_type value_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; - static AGG_INLINE void blend_pix(unsigned op, value_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned ca, - unsigned cover) + static AGG_INLINE void + blend_pix(unsigned op, value_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned ca, unsigned cover) { comp_op_table_rgba::g_comp_op_func[op](p, cr, cg, cb, ca, cover); } }; //=====================================comp_op_adaptor_clip_to_dst_rgba_pre -template struct comp_op_adaptor_clip_to_dst_rgba_pre +template +struct comp_op_adaptor_clip_to_dst_rgba_pre { - typedef Order order_type; + typedef Order order_type; typedef ColorT color_type; typedef typename color_type::value_type value_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; - static AGG_INLINE void blend_pix(unsigned op, value_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned ca, - unsigned cover) + static AGG_INLINE void + blend_pix(unsigned op, value_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned ca, unsigned cover) { unsigned da = p[Order::A]; - comp_op_table_rgba::g_comp_op_func[op] - (p, (cr * da + base_mask) >> base_shift, - (cg * da + base_mask) >> base_shift, - (cb * da + base_mask) >> base_shift, - (ca * da + base_mask) >> base_shift, - cover); + comp_op_table_rgba::g_comp_op_func[op](p, + (cr * da + base_mask) >> base_shift, + (cg * da + base_mask) >> base_shift, + (cb * da + base_mask) >> base_shift, + (ca * da + base_mask) >> base_shift, + cover); } }; //=======================================================comp_adaptor_rgba -template struct comp_adaptor_rgba +template +struct comp_adaptor_rgba { typedef typename BlenderPre::order_type order_type; typedef typename BlenderPre::color_type color_type; typedef typename color_type::value_type value_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; - static AGG_INLINE void blend_pix(unsigned /*op*/, value_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned ca, - unsigned cover) + static AGG_INLINE void + blend_pix(unsigned /*op*/, value_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned ca, unsigned cover) { BlenderPre::blend_pix(p, (cr * ca + base_mask) >> base_shift, (cg * ca + base_mask) >> base_shift, (cb * ca + base_mask) >> base_shift, - ca, cover); + ca, + cover); } }; //==========================================comp_adaptor_clip_to_dst_rgba -template struct comp_adaptor_clip_to_dst_rgba +template +struct comp_adaptor_clip_to_dst_rgba { typedef typename BlenderPre::order_type order_type; typedef typename BlenderPre::color_type color_type; typedef typename color_type::value_type value_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; - static AGG_INLINE void blend_pix(unsigned /*op*/, value_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned ca, - unsigned cover) + static AGG_INLINE void + blend_pix(unsigned /*op*/, value_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned ca, unsigned cover) { cr = (cr * ca + base_mask) >> base_shift; cg = (cg * ca + base_mask) >> base_shift; @@ -1947,21 +1744,16 @@ template struct comp_adaptor_clip_to_dst_rgba }; //======================================comp_adaptor_clip_to_dst_rgba_pre -template struct comp_adaptor_clip_to_dst_rgba_pre +template +struct comp_adaptor_clip_to_dst_rgba_pre { typedef typename BlenderPre::order_type order_type; typedef typename BlenderPre::color_type color_type; typedef typename color_type::value_type value_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; - static AGG_INLINE void blend_pix(unsigned /*op*/, value_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned ca, - unsigned cover) + static AGG_INLINE void + blend_pix(unsigned /*op*/, value_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned ca, unsigned cover) { unsigned da = p[order_type::A]; BlenderPre::blend_pix(p, @@ -1973,33 +1765,26 @@ template struct comp_adaptor_clip_to_dst_rgba_pre } }; - - - - - //===============================================copy_or_blend_rgba_wrapper -template struct copy_or_blend_rgba_wrapper +template +struct copy_or_blend_rgba_wrapper { typedef typename Blender::color_type color_type; typedef typename Blender::order_type order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; - enum base_scale_e - { + enum base_scale_e { base_shift = color_type::base_shift, base_scale = color_type::base_scale, - base_mask = color_type::base_mask + base_mask = color_type::base_mask }; //-------------------------------------------------------------------- - static AGG_INLINE void copy_or_blend_pix(value_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha) + static AGG_INLINE void copy_or_blend_pix(value_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha) { - if(alpha) + if (alpha) { - if(alpha == base_mask) + if (alpha == base_mask) { p[order_type::R] = cr; p[order_type::G] = cg; @@ -2014,21 +1799,19 @@ template struct copy_or_blend_rgba_wrapper } //-------------------------------------------------------------------- - static AGG_INLINE void copy_or_blend_pix(value_type* p, - unsigned cr, unsigned cg, unsigned cb, - unsigned alpha, - unsigned cover) + static AGG_INLINE void + copy_or_blend_pix(value_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned cover) { - if(cover == 255) + if (cover == 255) { copy_or_blend_pix(p, cr, cg, cb, alpha); } else { - if(alpha) + if (alpha) { alpha = (alpha * (cover + 1)) >> 8; - if(alpha == base_mask) + if (alpha == base_mask) { p[order_type::R] = cr; p[order_type::G] = cg; @@ -2044,36 +1827,34 @@ template struct copy_or_blend_rgba_wrapper } }; - - - - - //=================================================pixfmt_alpha_blend_rgba template class pixfmt_alpha_blend_rgba { -public: - typedef RenBuf rbuf_type; + public: + typedef RenBuf rbuf_type; typedef typename rbuf_type::row_data row_data; - typedef PixelT pixel_type; - typedef Blender blender_type; + typedef PixelT pixel_type; + typedef Blender blender_type; typedef typename blender_type::color_type color_type; typedef typename blender_type::order_type order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef copy_or_blend_rgba_wrapper cob_type; - enum base_scale_e - { + enum base_scale_e { base_shift = color_type::base_shift, base_scale = color_type::base_scale, - base_mask = color_type::base_mask, - pix_width = sizeof(pixel_type) + base_mask = color_type::base_mask, + pix_width = sizeof(pixel_type) }; //-------------------------------------------------------------------- - pixfmt_alpha_blend_rgba() : m_rbuf(0) {} - explicit pixfmt_alpha_blend_rgba(rbuf_type& rb) : m_rbuf(&rb) {} + pixfmt_alpha_blend_rgba() + : m_rbuf(0) + {} + explicit pixfmt_alpha_blend_rgba(rbuf_type& rb) + : m_rbuf(&rb) + {} void attach(rbuf_type& rb) { m_rbuf = &rb; } //-------------------------------------------------------------------- @@ -2081,39 +1862,29 @@ public: bool attach(PixFmt& pixf, int x1, int y1, int x2, int y2) { rect_i r(x1, y1, x2, y2); - if(r.clip(rect_i(0, 0, pixf.width()-1, pixf.height()-1))) + if (r.clip(rect_i(0, 0, pixf.width() - 1, pixf.height() - 1))) { int stride = pixf.stride(); - m_rbuf->attach(pixf.pix_ptr(r.x1, stride < 0 ? r.y2 : r.y1), - (r.x2 - r.x1) + 1, - (r.y2 - r.y1) + 1, - stride); + m_rbuf->attach(pixf.pix_ptr(r.x1, stride < 0 ? r.y2 : r.y1), (r.x2 - r.x1) + 1, (r.y2 - r.y1) + 1, stride); return true; } return false; } //-------------------------------------------------------------------- - AGG_INLINE unsigned width() const { return m_rbuf->width(); } + AGG_INLINE unsigned width() const { return m_rbuf->width(); } AGG_INLINE unsigned height() const { return m_rbuf->height(); } - AGG_INLINE int stride() const { return m_rbuf->stride(); } + AGG_INLINE int stride() const { return m_rbuf->stride(); } //-------------------------------------------------------------------- - AGG_INLINE int8u* row_ptr(int y) { return m_rbuf->row_ptr(y); } + AGG_INLINE int8u* row_ptr(int y) { return m_rbuf->row_ptr(y); } AGG_INLINE const int8u* row_ptr(int y) const { return m_rbuf->row_ptr(y); } - AGG_INLINE row_data row(int y) const { return m_rbuf->row(y); } + AGG_INLINE row_data row(int y) const { return m_rbuf->row(y); } //-------------------------------------------------------------------- - AGG_INLINE int8u* pix_ptr(int x, int y) - { - return m_rbuf->row_ptr(y) + x * pix_width; - } - - AGG_INLINE const int8u* pix_ptr(int x, int y) const - { - return m_rbuf->row_ptr(y) + x * pix_width; - } + AGG_INLINE int8u* pix_ptr(int x, int y) { return m_rbuf->row_ptr(y) + x * pix_width; } + AGG_INLINE const int8u* pix_ptr(int x, int y) const { return m_rbuf->row_ptr(y) + x * pix_width; } //-------------------------------------------------------------------- AGG_INLINE static void make_pix(int8u* p, const color_type& c) @@ -2128,13 +1899,10 @@ public: AGG_INLINE color_type pixel(int x, int y) const { const value_type* p = (const value_type*)m_rbuf->row_ptr(y); - if(p) + if (p) { p += x << 2; - return color_type(p[order_type::R], - p[order_type::G], - p[order_type::B], - p[order_type::A]); + return color_type(p[order_type::R], p[order_type::G], p[order_type::B], p[order_type::A]); } return color_type::no_color(); } @@ -2152,17 +1920,11 @@ public: //-------------------------------------------------------------------- AGG_INLINE void blend_pixel(int x, int y, const color_type& c, int8u cover) { - cob_type::copy_or_blend_pix( - (value_type*)m_rbuf->row_ptr(x, y, 1) + (x << 2), - c.r, c.g, c.b, c.a, - cover); + cob_type::copy_or_blend_pix((value_type*)m_rbuf->row_ptr(x, y, 1) + (x << 2), c.r, c.g, c.b, c.a, cover); } - //-------------------------------------------------------------------- - AGG_INLINE void copy_hline(int x, int y, - unsigned len, - const color_type& c) + AGG_INLINE void copy_hline(int x, int y, unsigned len, const color_type& c) { value_type* p = (value_type*)m_rbuf->row_ptr(x, y, len) + (x << 2); pixel_type v; @@ -2174,15 +1936,11 @@ public: { *(pixel_type*)p = v; p += 4; - } - while(--len); + } while (--len); } - //-------------------------------------------------------------------- - AGG_INLINE void copy_vline(int x, int y, - unsigned len, - const color_type& c) + AGG_INLINE void copy_vline(int x, int y, unsigned len, const color_type& c) { pixel_type v; ((value_type*)&v)[order_type::R] = c.r; @@ -2193,22 +1951,17 @@ public: { value_type* p = (value_type*)m_rbuf->row_ptr(x, y++, 1) + (x << 2); *(pixel_type*)p = v; - } - while(--len); + } while (--len); } - //-------------------------------------------------------------------- - void blend_hline(int x, int y, - unsigned len, - const color_type& c, - int8u cover) + void blend_hline(int x, int y, unsigned len, const color_type& c, int8u cover) { if (c.a) { value_type* p = (value_type*)m_rbuf->row_ptr(x, y, len) + (x << 2); calc_type alpha = (calc_type(c.a) * (cover + 1)) >> 8; - if(alpha == base_mask) + if (alpha == base_mask) { pixel_type v; ((value_type*)&v)[order_type::R] = c.r; @@ -2219,19 +1972,17 @@ public: { *(pixel_type*)p = v; p += 4; - } - while(--len); + } while (--len); } else { - if(cover == 255) + if (cover == 255) { do { blender_type::blend_pix(p, c.r, c.g, c.b, alpha); p += 4; - } - while(--len); + } while (--len); } else { @@ -2239,25 +1990,20 @@ public: { blender_type::blend_pix(p, c.r, c.g, c.b, alpha, cover); p += 4; - } - while(--len); + } while (--len); } } } } - //-------------------------------------------------------------------- - void blend_vline(int x, int y, - unsigned len, - const color_type& c, - int8u cover) + void blend_vline(int x, int y, unsigned len, const color_type& c, int8u cover) { if (c.a) { value_type* p; calc_type alpha = (calc_type(c.a) * (cover + 1)) >> 8; - if(alpha == base_mask) + if (alpha == base_mask) { pixel_type v; ((value_type*)&v)[order_type::R] = c.r; @@ -2268,19 +2014,17 @@ public: { p = (value_type*)m_rbuf->row_ptr(x, y++, 1) + (x << 2); *(pixel_type*)p = v; - } - while(--len); + } while (--len); } else { - if(cover == 255) + if (cover == 255) { do { p = (value_type*)m_rbuf->row_ptr(x, y++, 1) + (x << 2); blender_type::blend_pix(p, c.r, c.g, c.b, alpha); - } - while(--len); + } while (--len); } else { @@ -2288,19 +2032,14 @@ public: { p = (value_type*)m_rbuf->row_ptr(x, y++, 1) + (x << 2); blender_type::blend_pix(p, c.r, c.g, c.b, alpha, cover); - } - while(--len); + } while (--len); } } } } - //-------------------------------------------------------------------- - void blend_solid_hspan(int x, int y, - unsigned len, - const color_type& c, - const int8u* covers) + void blend_solid_hspan(int x, int y, unsigned len, const color_type& c, const int8u* covers) { if (c.a) { @@ -2308,7 +2047,7 @@ public: do { calc_type alpha = (calc_type(c.a) * (calc_type(*covers) + 1)) >> 8; - if(alpha == base_mask) + if (alpha == base_mask) { p[order_type::R] = c.r; p[order_type::G] = c.g; @@ -2321,17 +2060,12 @@ public: } p += 4; ++covers; - } - while(--len); + } while (--len); } } - //-------------------------------------------------------------------- - void blend_solid_vspan(int x, int y, - unsigned len, - const color_type& c, - const int8u* covers) + void blend_solid_vspan(int x, int y, unsigned len, const color_type& c, const int8u* covers) { if (c.a) { @@ -2339,7 +2073,7 @@ public: { value_type* p = (value_type*)m_rbuf->row_ptr(x, y++, 1) + (x << 2); calc_type alpha = (calc_type(c.a) * (calc_type(*covers) + 1)) >> 8; - if(alpha == base_mask) + if (alpha == base_mask) { p[order_type::R] = c.r; p[order_type::G] = c.g; @@ -2351,16 +2085,12 @@ public: blender_type::blend_pix(p, c.r, c.g, c.b, alpha, *covers); } ++covers; - } - while(--len); + } while (--len); } } - //-------------------------------------------------------------------- - void copy_color_hspan(int x, int y, - unsigned len, - const color_type* colors) + void copy_color_hspan(int x, int y, unsigned len, const color_type* colors) { value_type* p = (value_type*)m_rbuf->row_ptr(x, y, len) + (x << 2); do @@ -2371,15 +2101,11 @@ public: p[order_type::A] = colors->a; ++colors; p += 4; - } - while(--len); + } while (--len); } - //-------------------------------------------------------------------- - void copy_color_vspan(int x, int y, - unsigned len, - const color_type* colors) + void copy_color_vspan(int x, int y, unsigned len, const color_type* colors) { do { @@ -2389,212 +2115,153 @@ public: p[order_type::B] = colors->b; p[order_type::A] = colors->a; ++colors; - } - while(--len); + } while (--len); } - //-------------------------------------------------------------------- - void blend_color_hspan(int x, int y, - unsigned len, - const color_type* colors, - const int8u* covers, - int8u cover) + void blend_color_hspan(int x, int y, unsigned len, const color_type* colors, const int8u* covers, int8u cover) { value_type* p = (value_type*)m_rbuf->row_ptr(x, y, len) + (x << 2); - if(covers) + if (covers) { do { - cob_type::copy_or_blend_pix(p, - colors->r, - colors->g, - colors->b, - colors->a, - *covers++); + cob_type::copy_or_blend_pix(p, colors->r, colors->g, colors->b, colors->a, *covers++); p += 4; ++colors; - } - while(--len); + } while (--len); } else { - if(cover == 255) + if (cover == 255) { do { - cob_type::copy_or_blend_pix(p, - colors->r, - colors->g, - colors->b, - colors->a); + cob_type::copy_or_blend_pix(p, colors->r, colors->g, colors->b, colors->a); p += 4; ++colors; - } - while(--len); + } while (--len); } else { do { - cob_type::copy_or_blend_pix(p, - colors->r, - colors->g, - colors->b, - colors->a, - cover); + cob_type::copy_or_blend_pix(p, colors->r, colors->g, colors->b, colors->a, cover); p += 4; ++colors; - } - while(--len); + } while (--len); } } } - - //-------------------------------------------------------------------- - void blend_color_vspan(int x, int y, - unsigned len, - const color_type* colors, - const int8u* covers, - int8u cover) + void blend_color_vspan(int x, int y, unsigned len, const color_type* colors, const int8u* covers, int8u cover) { value_type* p; - if(covers) + if (covers) { do { p = (value_type*)m_rbuf->row_ptr(x, y++, 1) + (x << 2); - cob_type::copy_or_blend_pix(p, - colors->r, - colors->g, - colors->b, - colors->a, - *covers++); + cob_type::copy_or_blend_pix(p, colors->r, colors->g, colors->b, colors->a, *covers++); ++colors; - } - while(--len); + } while (--len); } else { - if(cover == 255) + if (cover == 255) { do { p = (value_type*)m_rbuf->row_ptr(x, y++, 1) + (x << 2); - cob_type::copy_or_blend_pix(p, - colors->r, - colors->g, - colors->b, - colors->a); + cob_type::copy_or_blend_pix(p, colors->r, colors->g, colors->b, colors->a); ++colors; - } - while(--len); + } while (--len); } else { do { p = (value_type*)m_rbuf->row_ptr(x, y++, 1) + (x << 2); - cob_type::copy_or_blend_pix(p, - colors->r, - colors->g, - colors->b, - colors->a, - cover); + cob_type::copy_or_blend_pix(p, colors->r, colors->g, colors->b, colors->a, cover); ++colors; - } - while(--len); + } while (--len); } } } //-------------------------------------------------------------------- - template void for_each_pixel(Function f) + template + void for_each_pixel(Function f) { unsigned y; - for(y = 0; y < height(); ++y) + for (y = 0; y < height(); ++y) { row_data r = m_rbuf->row(y); - if(r.ptr) + if (r.ptr) { unsigned len = r.x2 - r.x1 + 1; - value_type* p = - (value_type*)m_rbuf->row_ptr(r.x1, y, len) + (r.x1 << 2); + value_type* p = (value_type*)m_rbuf->row_ptr(r.x1, y, len) + (r.x1 << 2); do { f(p); p += 4; - } - while(--len); + } while (--len); } } } //-------------------------------------------------------------------- - void premultiply() - { - for_each_pixel(multiplier_rgba::premultiply); - } + void premultiply() { for_each_pixel(multiplier_rgba::premultiply); } //-------------------------------------------------------------------- - void demultiply() - { - for_each_pixel(multiplier_rgba::demultiply); - } + void demultiply() { for_each_pixel(multiplier_rgba::demultiply); } //-------------------------------------------------------------------- - template void apply_gamma_dir(const GammaLut& g) + template + void apply_gamma_dir(const GammaLut& g) { for_each_pixel(apply_gamma_dir_rgba(g)); } //-------------------------------------------------------------------- - template void apply_gamma_inv(const GammaLut& g) + template + void apply_gamma_inv(const GammaLut& g) { for_each_pixel(apply_gamma_inv_rgba(g)); } //-------------------------------------------------------------------- - template void copy_from(const RenBuf2& from, - int xdst, int ydst, - int xsrc, int ysrc, - unsigned len) + template + void copy_from(const RenBuf2& from, int xdst, int ydst, int xsrc, int ysrc, unsigned len) { const int8u* p = from.row_ptr(ysrc); - if(p) + if (p) { - memmove(m_rbuf->row_ptr(xdst, ydst, len) + xdst * pix_width, - p + xsrc * pix_width, - len * pix_width); + memmove(m_rbuf->row_ptr(xdst, ydst, len) + xdst * pix_width, p + xsrc * pix_width, len * pix_width); } } //-------------------------------------------------------------------- template - void blend_from(const SrcPixelFormatRenderer& from, - int xdst, int ydst, - int xsrc, int ysrc, - unsigned len, - int8u cover) + void + blend_from(const SrcPixelFormatRenderer& from, int xdst, int ydst, int xsrc, int ysrc, unsigned len, int8u cover) { typedef typename SrcPixelFormatRenderer::order_type src_order; const value_type* psrc = (value_type*)from.row_ptr(ysrc); - if(psrc) + if (psrc) { psrc += xsrc << 2; - value_type* pdst = - (value_type*)m_rbuf->row_ptr(xdst, ydst, len) + (xdst << 2); + value_type* pdst = (value_type*)m_rbuf->row_ptr(xdst, ydst, len) + (xdst << 2); int incp = 4; - if(xdst > xsrc) + if (xdst > xsrc) { - psrc += (len-1) << 2; - pdst += (len-1) << 2; + psrc += (len - 1) << 2; + pdst += (len - 1) << 2; incp = -4; } - if(cover == 255) + if (cover == 255) { do { @@ -2605,8 +2272,7 @@ public: psrc[src_order::A]); psrc += incp; pdst += incp; - } - while(--len); + } while (--len); } else { @@ -2620,8 +2286,7 @@ public: cover); psrc += incp; pdst += incp; - } - while(--len); + } while (--len); } } } @@ -2630,26 +2295,29 @@ public: template void blend_from_color(const SrcPixelFormatRenderer& from, const color_type& color, - int xdst, int ydst, - int /*xsrc*/, int ysrc, + int xdst, + int ydst, + int /*xsrc*/, + int ysrc, unsigned len, int8u cover) { typedef typename SrcPixelFormatRenderer::value_type src_value_type; const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc); - if(psrc) + if (psrc) { - value_type* pdst = - (value_type*)m_rbuf->row_ptr(xdst, ydst, len) + (xdst << 2); + value_type* pdst = (value_type*)m_rbuf->row_ptr(xdst, ydst, len) + (xdst << 2); do { cob_type::copy_or_blend_pix(pdst, - color.r, color.g, color.b, color.a, + color.r, + color.g, + color.b, + color.a, (*psrc * cover + base_mask) >> base_shift); ++psrc; pdst += 4; - } - while(--len); + } while (--len); } } @@ -2657,78 +2325,73 @@ public: template void blend_from_lut(const SrcPixelFormatRenderer& from, const color_type* color_lut, - int xdst, int ydst, - int /*xsrc*/, int ysrc, + int xdst, + int ydst, + int /*xsrc*/, + int ysrc, unsigned len, int8u cover) { typedef typename SrcPixelFormatRenderer::value_type src_value_type; const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc); - if(psrc) + if (psrc) { - value_type* pdst = - (value_type*)m_rbuf->row_ptr(xdst, ydst, len) + (xdst << 2); + value_type* pdst = (value_type*)m_rbuf->row_ptr(xdst, ydst, len) + (xdst << 2); - if(cover == 255) + if (cover == 255) { do { const color_type& color = color_lut[*psrc]; - cob_type::copy_or_blend_pix(pdst, - color.r, color.g, color.b, color.a); + cob_type::copy_or_blend_pix(pdst, color.r, color.g, color.b, color.a); ++psrc; pdst += 4; - } - while(--len); + } while (--len); } else { do { const color_type& color = color_lut[*psrc]; - cob_type::copy_or_blend_pix(pdst, - color.r, color.g, color.b, color.a, - cover); + cob_type::copy_or_blend_pix(pdst, color.r, color.g, color.b, color.a, cover); ++psrc; pdst += 4; - } - while(--len); + } while (--len); } } } -private: + private: rbuf_type* m_rbuf; }; - - - //================================================pixfmt_custom_blend_rgba -template class pixfmt_custom_blend_rgba +template +class pixfmt_custom_blend_rgba { -public: - typedef RenBuf rbuf_type; + public: + typedef RenBuf rbuf_type; typedef typename rbuf_type::row_data row_data; - typedef Blender blender_type; + typedef Blender blender_type; typedef typename blender_type::color_type color_type; typedef typename blender_type::order_type order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; - enum base_scale_e - { + enum base_scale_e { base_shift = color_type::base_shift, base_scale = color_type::base_scale, - base_mask = color_type::base_mask, - pix_width = sizeof(value_type) * 4 + base_mask = color_type::base_mask, + pix_width = sizeof(value_type) * 4 }; - //-------------------------------------------------------------------- - pixfmt_custom_blend_rgba() : m_rbuf(0), m_comp_op(3) {} - explicit pixfmt_custom_blend_rgba(rbuf_type& rb, unsigned comp_op=3) : - m_rbuf(&rb), - m_comp_op(comp_op) + pixfmt_custom_blend_rgba() + : m_rbuf(0) + , m_comp_op(3) + {} + explicit pixfmt_custom_blend_rgba(rbuf_type& rb, unsigned comp_op = 3) + : m_rbuf(&rb) + , m_comp_op(comp_op) {} void attach(rbuf_type& rb) { m_rbuf = &rb; } @@ -2737,42 +2400,33 @@ public: bool attach(PixFmt& pixf, int x1, int y1, int x2, int y2) { rect_i r(x1, y1, x2, y2); - if(r.clip(rect_i(0, 0, pixf.width()-1, pixf.height()-1))) + if (r.clip(rect_i(0, 0, pixf.width() - 1, pixf.height() - 1))) { int stride = pixf.stride(); - m_rbuf->attach(pixf.pix_ptr(r.x1, stride < 0 ? r.y2 : r.y1), - (r.x2 - r.x1) + 1, - (r.y2 - r.y1) + 1, - stride); + m_rbuf->attach(pixf.pix_ptr(r.x1, stride < 0 ? r.y2 : r.y1), (r.x2 - r.x1) + 1, (r.y2 - r.y1) + 1, stride); return true; } return false; } //-------------------------------------------------------------------- - AGG_INLINE unsigned width() const { return m_rbuf->width(); } + AGG_INLINE unsigned width() const { return m_rbuf->width(); } AGG_INLINE unsigned height() const { return m_rbuf->height(); } - AGG_INLINE int stride() const { return m_rbuf->stride(); } + AGG_INLINE int stride() const { return m_rbuf->stride(); } //-------------------------------------------------------------------- - AGG_INLINE int8u* row_ptr(int y) { return m_rbuf->row_ptr(y); } + AGG_INLINE int8u* row_ptr(int y) { return m_rbuf->row_ptr(y); } AGG_INLINE const int8u* row_ptr(int y) const { return m_rbuf->row_ptr(y); } - AGG_INLINE row_data row(int y) const { return m_rbuf->row(y); } + AGG_INLINE row_data row(int y) const { return m_rbuf->row(y); } //-------------------------------------------------------------------- - AGG_INLINE int8u* pix_ptr(int x, int y) - { - return m_rbuf->row_ptr(y) + x * pix_width; - } + AGG_INLINE int8u* pix_ptr(int x, int y) { return m_rbuf->row_ptr(y) + x * pix_width; } - AGG_INLINE const int8u* pix_ptr(int x, int y) const - { - return m_rbuf->row_ptr(y) + x * pix_width; - } + AGG_INLINE const int8u* pix_ptr(int x, int y) const { return m_rbuf->row_ptr(y) + x * pix_width; } //-------------------------------------------------------------------- void comp_op(unsigned op) { m_comp_op = op; } - unsigned comp_op() const { return m_comp_op; } + unsigned comp_op() const { return m_comp_op; } //-------------------------------------------------------------------- AGG_INLINE static void make_pix(int8u* p, const color_type& c) @@ -2787,41 +2441,31 @@ public: color_type pixel(int x, int y) const { const value_type* p = (value_type*)m_rbuf->row_ptr(y) + (x << 2); - return color_type(p[order_type::R], - p[order_type::G], - p[order_type::B], - p[order_type::A]); + return color_type(p[order_type::R], p[order_type::G], p[order_type::B], p[order_type::A]); } //-------------------------------------------------------------------- void copy_pixel(int x, int y, const color_type& c) { - blender_type::blend_pix( - m_comp_op, - (value_type*)m_rbuf->row_ptr(x, y, 1) + (x << 2), - c.r, c.g, c.b, c.a, 255); + blender_type::blend_pix(m_comp_op, (value_type*)m_rbuf->row_ptr(x, y, 1) + (x << 2), c.r, c.g, c.b, c.a, 255); } //-------------------------------------------------------------------- void blend_pixel(int x, int y, const color_type& c, int8u cover) { - blender_type::blend_pix( - m_comp_op, - (value_type*)m_rbuf->row_ptr(x, y, 1) + (x << 2), - c.r, c.g, c.b, c.a, - cover); + blender_type::blend_pix(m_comp_op, (value_type*)m_rbuf->row_ptr(x, y, 1) + (x << 2), c.r, c.g, c.b, c.a, cover); } //-------------------------------------------------------------------- void copy_hline(int x, int y, unsigned len, const color_type& c) { - value_type* p = (value_type*)m_rbuf->row_ptr(x, y, len) + (x << 2);; + value_type* p = (value_type*)m_rbuf->row_ptr(x, y, len) + (x << 2); + ; do { blender_type::blend_pix(m_comp_op, p, c.r, c.g, c.b, c.a, 255); p += 4; - } - while(--len); + } while (--len); } //-------------------------------------------------------------------- @@ -2829,80 +2473,71 @@ public: { do { - blender_type::blend_pix( - m_comp_op, - (value_type*)m_rbuf->row_ptr(x, y++, 1) + (x << 2), - c.r, c.g, c.b, c.a, 255); - } - while(--len); + blender_type::blend_pix(m_comp_op, + (value_type*)m_rbuf->row_ptr(x, y++, 1) + (x << 2), + c.r, + c.g, + c.b, + c.a, + 255); + } while (--len); } //-------------------------------------------------------------------- - void blend_hline(int x, int y, unsigned len, - const color_type& c, int8u cover) + void blend_hline(int x, int y, unsigned len, const color_type& c, int8u cover) { - value_type* p = (value_type*)m_rbuf->row_ptr(x, y, len) + (x << 2); do { blender_type::blend_pix(m_comp_op, p, c.r, c.g, c.b, c.a, cover); p += 4; - } - while(--len); + } while (--len); } //-------------------------------------------------------------------- - void blend_vline(int x, int y, unsigned len, - const color_type& c, int8u cover) + void blend_vline(int x, int y, unsigned len, const color_type& c, int8u cover) { - do { - blender_type::blend_pix( - m_comp_op, - (value_type*)m_rbuf->row_ptr(x, y++, 1) + (x << 2), - c.r, c.g, c.b, c.a, - cover); - } - while(--len); + blender_type::blend_pix(m_comp_op, + (value_type*)m_rbuf->row_ptr(x, y++, 1) + (x << 2), + c.r, + c.g, + c.b, + c.a, + cover); + } while (--len); } //-------------------------------------------------------------------- - void blend_solid_hspan(int x, int y, unsigned len, - const color_type& c, const int8u* covers) + void blend_solid_hspan(int x, int y, unsigned len, const color_type& c, const int8u* covers) { value_type* p = (value_type*)m_rbuf->row_ptr(x, y, len) + (x << 2); do { - blender_type::blend_pix(m_comp_op, - p, c.r, c.g, c.b, c.a, - *covers++); + blender_type::blend_pix(m_comp_op, p, c.r, c.g, c.b, c.a, *covers++); p += 4; - } - while(--len); + } while (--len); } //-------------------------------------------------------------------- - void blend_solid_vspan(int x, int y, unsigned len, - const color_type& c, const int8u* covers) + void blend_solid_vspan(int x, int y, unsigned len, const color_type& c, const int8u* covers) { do { - blender_type::blend_pix( - m_comp_op, - (value_type*)m_rbuf->row_ptr(x, y++, 1) + (x << 2), - c.r, c.g, c.b, c.a, - *covers++); - } - while(--len); + blender_type::blend_pix(m_comp_op, + (value_type*)m_rbuf->row_ptr(x, y++, 1) + (x << 2), + c.r, + c.g, + c.b, + c.a, + *covers++); + } while (--len); } //-------------------------------------------------------------------- - void copy_color_hspan(int x, int y, - unsigned len, - const color_type* colors) + void copy_color_hspan(int x, int y, unsigned len, const color_type* colors) { - value_type* p = (value_type*)m_rbuf->row_ptr(x, y, len) + (x << 2); do { @@ -2912,14 +2547,11 @@ public: p[order_type::A] = colors->a; ++colors; p += 4; - } - while(--len); + } while (--len); } //-------------------------------------------------------------------- - void copy_color_vspan(int x, int y, - unsigned len, - const color_type* colors) + void copy_color_vspan(int x, int y, unsigned len, const color_type* colors) { do { @@ -2929,15 +2561,11 @@ public: p[order_type::B] = colors->b; p[order_type::A] = colors->a; ++colors; - } - while(--len); + } while (--len); } //-------------------------------------------------------------------- - void blend_color_hspan(int x, int y, unsigned len, - const color_type* colors, - const int8u* covers, - int8u cover) + void blend_color_hspan(int x, int y, unsigned len, const color_type* colors, const int8u* covers, int8u cover) { value_type* p = (value_type*)m_rbuf->row_ptr(x, y, len) + (x << 2); do @@ -2951,12 +2579,13 @@ public: covers ? *covers++ : cover); p += 4; ++colors; - } - while(--len); + } while (--len); } //-------------------------------------------------------------------- - void blend_color_hspan_alpha(int x, int y, unsigned len, + void blend_color_hspan_alpha(int x, + int y, + unsigned len, const color_type* colors, value_type alpha, const int8u* covers, @@ -2974,115 +2603,94 @@ public: covers ? *covers++ : cover); p += 4; ++colors; - } - while(--len); + } while (--len); } - //-------------------------------------------------------------------- - void blend_color_vspan(int x, int y, unsigned len, - const color_type* colors, - const int8u* covers, - int8u cover) + void blend_color_vspan(int x, int y, unsigned len, const color_type* colors, const int8u* covers, int8u cover) { do { - blender_type::blend_pix( - m_comp_op, - (value_type*)m_rbuf->row_ptr(x, y++, 1) + (x << 2), - colors->r, - colors->g, - colors->b, - colors->a, - covers ? *covers++ : cover); + blender_type::blend_pix(m_comp_op, + (value_type*)m_rbuf->row_ptr(x, y++, 1) + (x << 2), + colors->r, + colors->g, + colors->b, + colors->a, + covers ? *covers++ : cover); ++colors; - } - while(--len); - + } while (--len); } //-------------------------------------------------------------------- - template void for_each_pixel(Function f) + template + void for_each_pixel(Function f) { unsigned y; - for(y = 0; y < height(); ++y) + for (y = 0; y < height(); ++y) { row_data r = m_rbuf->row(y); - if(r.ptr) + if (r.ptr) { unsigned len = r.x2 - r.x1 + 1; - value_type* p = - (value_type*)m_rbuf->row_ptr(r.x1, y, len) + (r.x1 << 2); + value_type* p = (value_type*)m_rbuf->row_ptr(r.x1, y, len) + (r.x1 << 2); do { f(p); p += 4; - } - while(--len); + } while (--len); } } } //-------------------------------------------------------------------- - void premultiply() - { - for_each_pixel(multiplier_rgba::premultiply); - } + void premultiply() { for_each_pixel(multiplier_rgba::premultiply); } //-------------------------------------------------------------------- - void demultiply() - { - for_each_pixel(multiplier_rgba::demultiply); - } + void demultiply() { for_each_pixel(multiplier_rgba::demultiply); } //-------------------------------------------------------------------- - template void apply_gamma_dir(const GammaLut& g) + template + void apply_gamma_dir(const GammaLut& g) { for_each_pixel(apply_gamma_dir_rgba(g)); } //-------------------------------------------------------------------- - template void apply_gamma_inv(const GammaLut& g) + template + void apply_gamma_inv(const GammaLut& g) { for_each_pixel(apply_gamma_inv_rgba(g)); } //-------------------------------------------------------------------- - template void copy_from(const RenBuf2& from, - int xdst, int ydst, - int xsrc, int ysrc, - unsigned len) + template + void copy_from(const RenBuf2& from, int xdst, int ydst, int xsrc, int ysrc, unsigned len) { const int8u* p = from.row_ptr(ysrc); - if(p) + if (p) { - memmove(m_rbuf->row_ptr(xdst, ydst, len) + xdst * pix_width, - p + xsrc * pix_width, - len * pix_width); + memmove(m_rbuf->row_ptr(xdst, ydst, len) + xdst * pix_width, p + xsrc * pix_width, len * pix_width); } } //-------------------------------------------------------------------- template - void blend_from(const SrcPixelFormatRenderer& from, - int xdst, int ydst, - int xsrc, int ysrc, - unsigned len, - int8u cover) + void + blend_from(const SrcPixelFormatRenderer& from, int xdst, int ydst, int xsrc, int ysrc, unsigned len, int8u cover) { typedef typename SrcPixelFormatRenderer::order_type src_order; const value_type* psrc = (const value_type*)from.row_ptr(ysrc); - if(psrc) + if (psrc) { psrc += xsrc << 2; - value_type* pdst = - (value_type*)m_rbuf->row_ptr(xdst, ydst, len) + (xdst << 2); + value_type* pdst = (value_type*)m_rbuf->row_ptr(xdst, ydst, len) + (xdst << 2); int incp = 4; - if(xdst > xsrc) + if (xdst > xsrc) { - psrc += (len-1) << 2; - pdst += (len-1) << 2; + psrc += (len - 1) << 2; + pdst += (len - 1) << 2; incp = -4; } @@ -3097,8 +2705,7 @@ public: cover); psrc += incp; pdst += incp; - } - while(--len); + } while (--len); } } @@ -3106,27 +2713,30 @@ public: template void blend_from_color(const SrcPixelFormatRenderer& from, const color_type& color, - int xdst, int ydst, - int /*xsrc*/, int ysrc, + int xdst, + int ydst, + int /*xsrc*/, + int ysrc, unsigned len, int8u cover) { typedef typename SrcPixelFormatRenderer::value_type src_value_type; const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc); - if(psrc) + if (psrc) { - value_type* pdst = - (value_type*)m_rbuf->row_ptr(xdst, ydst, len) + (xdst << 2); + value_type* pdst = (value_type*)m_rbuf->row_ptr(xdst, ydst, len) + (xdst << 2); do { blender_type::blend_pix(m_comp_op, pdst, - color.r, color.g, color.b, color.a, + color.r, + color.g, + color.b, + color.a, (*psrc * cover + base_mask) >> base_shift); ++psrc; pdst += 4; - } - while(--len); + } while (--len); } } @@ -3134,39 +2744,33 @@ public: template void blend_from_lut(const SrcPixelFormatRenderer& from, const color_type* color_lut, - int xdst, int ydst, - int /*xsrc*/, int ysrc, + int xdst, + int ydst, + int /*xsrc*/, + int ysrc, unsigned len, int8u cover) { typedef typename SrcPixelFormatRenderer::value_type src_value_type; const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc); - if(psrc) + if (psrc) { - value_type* pdst = - (value_type*)m_rbuf->row_ptr(xdst, ydst, len) + (xdst << 2); + value_type* pdst = (value_type*)m_rbuf->row_ptr(xdst, ydst, len) + (xdst << 2); do { const color_type& color = color_lut[*psrc]; - blender_type::blend_pix(m_comp_op, - pdst, - color.r, color.g, color.b, color.a, - cover); + blender_type::blend_pix(m_comp_op, pdst, color.r, color.g, color.b, color.a, cover); ++psrc; pdst += 4; - } - while(--len); + } while (--len); } } -private: + private: rbuf_type* m_rbuf; unsigned m_comp_op; }; - - - //----------------------------------------------------------------------- typedef blender_rgba blender_rgba32; //----blender_rgba32 typedef blender_rgba blender_argb32; //----blender_argb32 @@ -3193,7 +2797,6 @@ typedef blender_rgba_pre blender_argb64_pre; //----blender_a typedef blender_rgba_pre blender_abgr64_pre; //----blender_abgr64_pre typedef blender_rgba_pre blender_bgra64_pre; //----blender_bgra64_pre - //----------------------------------------------------------------------- typedef int32u pixel32_type; typedef pixfmt_alpha_blend_rgba pixfmt_rgba32; //----pixfmt_rgba32 @@ -3201,26 +2804,41 @@ typedef pixfmt_alpha_blend_rgba typedef pixfmt_alpha_blend_rgba pixfmt_abgr32; //----pixfmt_abgr32 typedef pixfmt_alpha_blend_rgba pixfmt_bgra32; //----pixfmt_bgra32 -typedef pixfmt_alpha_blend_rgba pixfmt_rgba32_pre; //----pixfmt_rgba32_pre -typedef pixfmt_alpha_blend_rgba pixfmt_argb32_pre; //----pixfmt_argb32_pre -typedef pixfmt_alpha_blend_rgba pixfmt_abgr32_pre; //----pixfmt_abgr32_pre -typedef pixfmt_alpha_blend_rgba pixfmt_bgra32_pre; //----pixfmt_bgra32_pre +typedef pixfmt_alpha_blend_rgba + pixfmt_rgba32_pre; //----pixfmt_rgba32_pre +typedef pixfmt_alpha_blend_rgba + pixfmt_argb32_pre; //----pixfmt_argb32_pre +typedef pixfmt_alpha_blend_rgba + pixfmt_abgr32_pre; //----pixfmt_abgr32_pre +typedef pixfmt_alpha_blend_rgba + pixfmt_bgra32_pre; //----pixfmt_bgra32_pre -typedef pixfmt_alpha_blend_rgba pixfmt_rgba32_plain; //----pixfmt_rgba32_plain -typedef pixfmt_alpha_blend_rgba pixfmt_argb32_plain; //----pixfmt_argb32_plain -typedef pixfmt_alpha_blend_rgba pixfmt_abgr32_plain; //----pixfmt_abgr32_plain -typedef pixfmt_alpha_blend_rgba pixfmt_bgra32_plain; //----pixfmt_bgra32_plain +typedef pixfmt_alpha_blend_rgba + pixfmt_rgba32_plain; //----pixfmt_rgba32_plain +typedef pixfmt_alpha_blend_rgba + pixfmt_argb32_plain; //----pixfmt_argb32_plain +typedef pixfmt_alpha_blend_rgba + pixfmt_abgr32_plain; //----pixfmt_abgr32_plain +typedef pixfmt_alpha_blend_rgba + pixfmt_bgra32_plain; //----pixfmt_bgra32_plain -struct pixel64_type { int16u c[4]; }; +struct pixel64_type +{ + int16u c[4]; +}; typedef pixfmt_alpha_blend_rgba pixfmt_rgba64; //----pixfmt_rgba64 typedef pixfmt_alpha_blend_rgba pixfmt_argb64; //----pixfmt_argb64 typedef pixfmt_alpha_blend_rgba pixfmt_abgr64; //----pixfmt_abgr64 typedef pixfmt_alpha_blend_rgba pixfmt_bgra64; //----pixfmt_bgra64 -typedef pixfmt_alpha_blend_rgba pixfmt_rgba64_pre; //----pixfmt_rgba64_pre -typedef pixfmt_alpha_blend_rgba pixfmt_argb64_pre; //----pixfmt_argb64_pre -typedef pixfmt_alpha_blend_rgba pixfmt_abgr64_pre; //----pixfmt_abgr64_pre -typedef pixfmt_alpha_blend_rgba pixfmt_bgra64_pre; //----pixfmt_bgra64_pre -} +typedef pixfmt_alpha_blend_rgba + pixfmt_rgba64_pre; //----pixfmt_rgba64_pre +typedef pixfmt_alpha_blend_rgba + pixfmt_argb64_pre; //----pixfmt_argb64_pre +typedef pixfmt_alpha_blend_rgba + pixfmt_abgr64_pre; //----pixfmt_abgr64_pre +typedef pixfmt_alpha_blend_rgba + pixfmt_bgra64_pre; //----pixfmt_bgra64_pre +} // namespace agg #endif diff --git a/deps/agg/include/agg_pixfmt_transposer.h b/deps/agg/include/agg_pixfmt_transposer.h index 64738b6c7..19cd92b3b 100644 --- a/deps/agg/include/agg_pixfmt_transposer.h +++ b/deps/agg/include/agg_pixfmt_transposer.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -18,140 +18,99 @@ #include "agg_basics.h" -namespace agg +namespace agg { +//=======================================================pixfmt_transposer +template +class pixfmt_transposer { - //=======================================================pixfmt_transposer - template class pixfmt_transposer + public: + typedef PixFmt pixfmt_type; + typedef typename pixfmt_type::color_type color_type; + typedef typename pixfmt_type::row_data row_data; + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; + + //-------------------------------------------------------------------- + pixfmt_transposer() + : m_pixf(0) + {} + explicit pixfmt_transposer(pixfmt_type& pixf) + : m_pixf(&pixf) + {} + void attach(pixfmt_type& pixf) { m_pixf = &pixf; } + + //-------------------------------------------------------------------- + AGG_INLINE unsigned width() const { return m_pixf->height(); } + AGG_INLINE unsigned height() const { return m_pixf->width(); } + + //-------------------------------------------------------------------- + AGG_INLINE color_type pixel(int x, int y) const { return m_pixf->pixel(y, x); } + + //-------------------------------------------------------------------- + AGG_INLINE void copy_pixel(int x, int y, const color_type& c) { m_pixf->copy_pixel(y, x, c); } + + //-------------------------------------------------------------------- + AGG_INLINE void blend_pixel(int x, int y, const color_type& c, int8u cover) { m_pixf->blend_pixel(y, x, c, cover); } + + //-------------------------------------------------------------------- + AGG_INLINE void copy_hline(int x, int y, unsigned len, const color_type& c) { m_pixf->copy_vline(y, x, len, c); } + + //-------------------------------------------------------------------- + AGG_INLINE void copy_vline(int x, int y, unsigned len, const color_type& c) { m_pixf->copy_hline(y, x, len, c); } + + //-------------------------------------------------------------------- + AGG_INLINE void blend_hline(int x, int y, unsigned len, const color_type& c, int8u cover) { - public: - typedef PixFmt pixfmt_type; - typedef typename pixfmt_type::color_type color_type; - typedef typename pixfmt_type::row_data row_data; - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; + m_pixf->blend_vline(y, x, len, c, cover); + } - //-------------------------------------------------------------------- - pixfmt_transposer() : m_pixf(0) {} - explicit pixfmt_transposer(pixfmt_type& pixf) : m_pixf(&pixf) {} - void attach(pixfmt_type& pixf) { m_pixf = &pixf; } + //-------------------------------------------------------------------- + AGG_INLINE void blend_vline(int x, int y, unsigned len, const color_type& c, int8u cover) + { + m_pixf->blend_hline(y, x, len, c, cover); + } - //-------------------------------------------------------------------- - AGG_INLINE unsigned width() const { return m_pixf->height(); } - AGG_INLINE unsigned height() const { return m_pixf->width(); } + //-------------------------------------------------------------------- + AGG_INLINE void blend_solid_hspan(int x, int y, unsigned len, const color_type& c, const int8u* covers) + { + m_pixf->blend_solid_vspan(y, x, len, c, covers); + } - //-------------------------------------------------------------------- - AGG_INLINE color_type pixel(int x, int y) const - { - return m_pixf->pixel(y, x); - } + //-------------------------------------------------------------------- + AGG_INLINE void blend_solid_vspan(int x, int y, unsigned len, const color_type& c, const int8u* covers) + { + m_pixf->blend_solid_hspan(y, x, len, c, covers); + } - //-------------------------------------------------------------------- - AGG_INLINE void copy_pixel(int x, int y, const color_type& c) - { - m_pixf->copy_pixel(y, x, c); - } + //-------------------------------------------------------------------- + AGG_INLINE void copy_color_hspan(int x, int y, unsigned len, const color_type* colors) + { + m_pixf->copy_color_vspan(y, x, len, colors); + } - //-------------------------------------------------------------------- - AGG_INLINE void blend_pixel(int x, int y, - const color_type& c, - int8u cover) - { - m_pixf->blend_pixel(y, x, c, cover); - } + //-------------------------------------------------------------------- + AGG_INLINE void copy_color_vspan(int x, int y, unsigned len, const color_type* colors) + { + m_pixf->copy_color_hspan(y, x, len, colors); + } - //-------------------------------------------------------------------- - AGG_INLINE void copy_hline(int x, int y, - unsigned len, - const color_type& c) - { - m_pixf->copy_vline(y, x, len, c); - } + //-------------------------------------------------------------------- + AGG_INLINE void + blend_color_hspan(int x, int y, unsigned len, const color_type* colors, const int8u* covers, int8u cover) + { + m_pixf->blend_color_vspan(y, x, len, colors, covers, cover); + } - //-------------------------------------------------------------------- - AGG_INLINE void copy_vline(int x, int y, - unsigned len, - const color_type& c) - { - m_pixf->copy_hline(y, x, len, c); - } + //-------------------------------------------------------------------- + AGG_INLINE void + blend_color_vspan(int x, int y, unsigned len, const color_type* colors, const int8u* covers, int8u cover) + { + m_pixf->blend_color_hspan(y, x, len, colors, covers, cover); + } - //-------------------------------------------------------------------- - AGG_INLINE void blend_hline(int x, int y, - unsigned len, - const color_type& c, - int8u cover) - { - m_pixf->blend_vline(y, x, len, c, cover); - } - - //-------------------------------------------------------------------- - AGG_INLINE void blend_vline(int x, int y, - unsigned len, - const color_type& c, - int8u cover) - { - m_pixf->blend_hline(y, x, len, c, cover); - } - - //-------------------------------------------------------------------- - AGG_INLINE void blend_solid_hspan(int x, int y, - unsigned len, - const color_type& c, - const int8u* covers) - { - m_pixf->blend_solid_vspan(y, x, len, c, covers); - } - - //-------------------------------------------------------------------- - AGG_INLINE void blend_solid_vspan(int x, int y, - unsigned len, - const color_type& c, - const int8u* covers) - { - m_pixf->blend_solid_hspan(y, x, len, c, covers); - } - - //-------------------------------------------------------------------- - AGG_INLINE void copy_color_hspan(int x, int y, - unsigned len, - const color_type* colors) - { - m_pixf->copy_color_vspan(y, x, len, colors); - } - - //-------------------------------------------------------------------- - AGG_INLINE void copy_color_vspan(int x, int y, - unsigned len, - const color_type* colors) - { - m_pixf->copy_color_hspan(y, x, len, colors); - } - - //-------------------------------------------------------------------- - AGG_INLINE void blend_color_hspan(int x, int y, - unsigned len, - const color_type* colors, - const int8u* covers, - int8u cover) - { - m_pixf->blend_color_vspan(y, x, len, colors, covers, cover); - } - - //-------------------------------------------------------------------- - AGG_INLINE void blend_color_vspan(int x, int y, - unsigned len, - const color_type* colors, - const int8u* covers, - int8u cover) - { - m_pixf->blend_color_hspan(y, x, len, colors, covers, cover); - } - - private: - pixfmt_type* m_pixf; - }; -} + private: + pixfmt_type* m_pixf; +}; +} // namespace agg #endif - - diff --git a/deps/agg/include/agg_rasterizer_cells_aa.h b/deps/agg/include/agg_rasterizer_cells_aa.h index 43be00cc9..6a112cc4b 100644 --- a/deps/agg/include/agg_rasterizer_cells_aa.h +++ b/deps/agg/include/agg_rasterizer_cells_aa.h @@ -2,15 +2,15 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // -// The author gratefully acknowleges the support of David Turner, -// Robert Wilhelm, and Werner Lemberg - the authors of the FreeType +// The author gratefully acknowleges the support of David Turner, +// Robert Wilhelm, and Werner Lemberg - the authors of the FreeType // libray - in producing this work. See http://www.freetype.org for details. // //---------------------------------------------------------------------------- @@ -19,12 +19,12 @@ // http://www.antigrain.com //---------------------------------------------------------------------------- // -// Adaptation for 32-bit screen coordinates has been sponsored by +// Adaptation for 32-bit screen coordinates has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. -// +// //---------------------------------------------------------------------------- #ifndef AGG_RASTERIZER_CELLS_AA_INCLUDED #define AGG_RASTERIZER_CELLS_AA_INCLUDED @@ -35,687 +35,667 @@ #include "agg_math.h" #include "agg_array.h" +namespace agg { -namespace agg +//-----------------------------------------------------rasterizer_cells_aa +// An internal class that implements the main rasterization algorithm. +// Used in the rasterizer. Should not be used direcly. +template +class rasterizer_cells_aa { - - //-----------------------------------------------------rasterizer_cells_aa - // An internal class that implements the main rasterization algorithm. - // Used in the rasterizer. Should not be used direcly. - template class rasterizer_cells_aa - { - enum cell_block_scale_e - { - cell_block_shift = 12, - cell_block_size = 1 << cell_block_shift, - cell_block_mask = cell_block_size - 1, - cell_block_pool = 256, - cell_block_limit = 1024 - }; - - struct sorted_y - { - unsigned start; - unsigned num; - }; - - public: - typedef Cell cell_type; - typedef rasterizer_cells_aa self_type; - - ~rasterizer_cells_aa(); - rasterizer_cells_aa(); - - void reset(); - void style(const cell_type& style_cell); - void line(int x1, int y1, int x2, int y2); - - int min_x() const { return m_min_x; } - int min_y() const { return m_min_y; } - int max_x() const { return m_max_x; } - int max_y() const { return m_max_y; } - - void sort_cells(); - - unsigned total_cells() const - { - return m_num_cells; - } - - unsigned scanline_num_cells(unsigned y) const - { - return m_sorted_y[y - m_min_y].num; - } - - const cell_type* const* scanline_cells(unsigned y) const - { - return m_sorted_cells.data() + m_sorted_y[y - m_min_y].start; - } - - bool sorted() const { return m_sorted; } - - private: - rasterizer_cells_aa(const self_type&); - const self_type& operator = (const self_type&); - - void set_curr_cell(int x, int y); - void add_curr_cell(); - void render_hline(int ey, int x1, int y1, int x2, int y2); - void allocate_block(); - - private: - unsigned m_num_blocks; - unsigned m_max_blocks; - unsigned m_curr_block; - unsigned m_num_cells; - cell_type** m_cells; - cell_type* m_curr_cell_ptr; - pod_vector m_sorted_cells; - pod_vector m_sorted_y; - cell_type m_curr_cell; - cell_type m_style_cell; - int m_min_x; - int m_min_y; - int m_max_x; - int m_max_y; - bool m_sorted; + enum cell_block_scale_e { + cell_block_shift = 12, + cell_block_size = 1 << cell_block_shift, + cell_block_mask = cell_block_size - 1, + cell_block_pool = 256, + cell_block_limit = 1024 }; - - - - //------------------------------------------------------------------------ - template - rasterizer_cells_aa::~rasterizer_cells_aa() + struct sorted_y { - if(m_num_blocks) - { - cell_type** ptr = m_cells + m_num_blocks - 1; - while(m_num_blocks > 0) - { - pod_allocator::deallocate(*ptr, cell_block_size); - ptr--; - --m_num_blocks; - } - pod_allocator::deallocate(m_cells, m_max_blocks); - } + unsigned start; + unsigned num; + }; + + public: + typedef Cell cell_type; + typedef rasterizer_cells_aa self_type; + + ~rasterizer_cells_aa(); + rasterizer_cells_aa(); + + void reset(); + void style(const cell_type& style_cell); + void line(int x1, int y1, int x2, int y2); + + int min_x() const { return m_min_x; } + int min_y() const { return m_min_y; } + int max_x() const { return m_max_x; } + int max_y() const { return m_max_y; } + + void sort_cells(); + + unsigned total_cells() const { return m_num_cells; } + + unsigned scanline_num_cells(unsigned y) const { return m_sorted_y[y - m_min_y].num; } + + const cell_type* const* scanline_cells(unsigned y) const + { + return m_sorted_cells.data() + m_sorted_y[y - m_min_y].start; } - //------------------------------------------------------------------------ - template - rasterizer_cells_aa::rasterizer_cells_aa() : - m_num_blocks(0), - m_max_blocks(0), - m_curr_block(0), - m_num_cells(0), - m_cells(0), - m_curr_cell_ptr(0), - m_sorted_cells(), - m_sorted_y(), - m_min_x(0x7FFFFFFF), - m_min_y(0x7FFFFFFF), - m_max_x(-0x7FFFFFFF), - m_max_y(-0x7FFFFFFF), - m_sorted(false) + bool sorted() const { return m_sorted; } + + private: + rasterizer_cells_aa(const self_type&); + const self_type& operator=(const self_type&); + + void set_curr_cell(int x, int y); + void add_curr_cell(); + void render_hline(int ey, int x1, int y1, int x2, int y2); + void allocate_block(); + + private: + unsigned m_num_blocks; + unsigned m_max_blocks; + unsigned m_curr_block; + unsigned m_num_cells; + cell_type** m_cells; + cell_type* m_curr_cell_ptr; + pod_vector m_sorted_cells; + pod_vector m_sorted_y; + cell_type m_curr_cell; + cell_type m_style_cell; + int m_min_x; + int m_min_y; + int m_max_x; + int m_max_y; + bool m_sorted; +}; + +//------------------------------------------------------------------------ +template +rasterizer_cells_aa::~rasterizer_cells_aa() +{ + if (m_num_blocks) { - m_style_cell.initial(); - m_curr_cell.initial(); + cell_type** ptr = m_cells + m_num_blocks - 1; + while (m_num_blocks > 0) + { + pod_allocator::deallocate(*ptr, cell_block_size); + ptr--; + --m_num_blocks; + } + pod_allocator::deallocate(m_cells, m_max_blocks); + } +} + +//------------------------------------------------------------------------ +template +rasterizer_cells_aa::rasterizer_cells_aa() + : m_num_blocks(0) + , m_max_blocks(0) + , m_curr_block(0) + , m_num_cells(0) + , m_cells(0) + , m_curr_cell_ptr(0) + , m_sorted_cells() + , m_sorted_y() + , m_min_x(0x7FFFFFFF) + , m_min_y(0x7FFFFFFF) + , m_max_x(-0x7FFFFFFF) + , m_max_y(-0x7FFFFFFF) + , m_sorted(false) +{ + m_style_cell.initial(); + m_curr_cell.initial(); +} + +//------------------------------------------------------------------------ +template +void rasterizer_cells_aa::reset() +{ + m_num_cells = 0; + m_curr_block = 0; + m_curr_cell.initial(); + m_style_cell.initial(); + m_sorted = false; + m_min_x = 0x7FFFFFFF; + m_min_y = 0x7FFFFFFF; + m_max_x = -0x7FFFFFFF; + m_max_y = -0x7FFFFFFF; +} + +//------------------------------------------------------------------------ +template +AGG_INLINE void rasterizer_cells_aa::add_curr_cell() +{ + if (m_curr_cell.area | m_curr_cell.cover) + { + if ((m_num_cells & cell_block_mask) == 0) + { + if (m_num_blocks >= cell_block_limit) + return; + allocate_block(); + } + *m_curr_cell_ptr++ = m_curr_cell; + ++m_num_cells; + } +} + +//------------------------------------------------------------------------ +template +AGG_INLINE void rasterizer_cells_aa::set_curr_cell(int x, int y) +{ + if (m_curr_cell.not_equal(x, y, m_style_cell)) + { + add_curr_cell(); + m_curr_cell.style(m_style_cell); + m_curr_cell.x = x; + m_curr_cell.y = y; + m_curr_cell.cover = 0; + m_curr_cell.area = 0; + } +} + +//------------------------------------------------------------------------ +template +AGG_INLINE void rasterizer_cells_aa::render_hline(int ey, int x1, int y1, int x2, int y2) +{ + int ex1 = x1 >> poly_subpixel_shift; + int ex2 = x2 >> poly_subpixel_shift; + int fx1 = x1 & poly_subpixel_mask; + int fx2 = x2 & poly_subpixel_mask; + + int delta, p, first, dx; + int incr, lift, mod, rem; + + // trivial case. Happens often + if (y1 == y2) + { + set_curr_cell(ex2, ey); + return; } - //------------------------------------------------------------------------ - template - void rasterizer_cells_aa::reset() + // everything is located in a single cell. That is easy! + if (ex1 == ex2) { - m_num_cells = 0; - m_curr_block = 0; - m_curr_cell.initial(); - m_style_cell.initial(); - m_sorted = false; - m_min_x = 0x7FFFFFFF; - m_min_y = 0x7FFFFFFF; - m_max_x = -0x7FFFFFFF; - m_max_y = -0x7FFFFFFF; - } - - //------------------------------------------------------------------------ - template - AGG_INLINE void rasterizer_cells_aa::add_curr_cell() - { - if(m_curr_cell.area | m_curr_cell.cover) - { - if((m_num_cells & cell_block_mask) == 0) - { - if(m_num_blocks >= cell_block_limit) return; - allocate_block(); - } - *m_curr_cell_ptr++ = m_curr_cell; - ++m_num_cells; - } - } - - //------------------------------------------------------------------------ - template - AGG_INLINE void rasterizer_cells_aa::set_curr_cell(int x, int y) - { - if(m_curr_cell.not_equal(x, y, m_style_cell)) - { - add_curr_cell(); - m_curr_cell.style(m_style_cell); - m_curr_cell.x = x; - m_curr_cell.y = y; - m_curr_cell.cover = 0; - m_curr_cell.area = 0; - } - } - - //------------------------------------------------------------------------ - template - AGG_INLINE void rasterizer_cells_aa::render_hline(int ey, - int x1, int y1, - int x2, int y2) - { - int ex1 = x1 >> poly_subpixel_shift; - int ex2 = x2 >> poly_subpixel_shift; - int fx1 = x1 & poly_subpixel_mask; - int fx2 = x2 & poly_subpixel_mask; - - int delta, p, first, dx; - int incr, lift, mod, rem; - - //trivial case. Happens often - if(y1 == y2) - { - set_curr_cell(ex2, ey); - return; - } - - //everything is located in a single cell. That is easy! - if(ex1 == ex2) - { - delta = y2 - y1; - m_curr_cell.cover += delta; - m_curr_cell.area += (fx1 + fx2) * delta; - return; - } - - //ok, we'll have to render a run of adjacent cells on the same - //hline... - p = (poly_subpixel_scale - fx1) * (y2 - y1); - first = poly_subpixel_scale; - incr = 1; - - dx = x2 - x1; - - if(dx < 0) - { - p = fx1 * (y2 - y1); - first = 0; - incr = -1; - dx = -dx; - } - - delta = p / dx; - mod = p % dx; - - if(mod < 0) - { - delta--; - mod += dx; - } - - m_curr_cell.cover += delta; - m_curr_cell.area += (fx1 + first) * delta; - - ex1 += incr; - set_curr_cell(ex1, ey); - y1 += delta; - - if(ex1 != ex2) - { - p = poly_subpixel_scale * (y2 - y1 + delta); - lift = p / dx; - rem = p % dx; - - if (rem < 0) - { - lift--; - rem += dx; - } - - mod -= dx; - - while (ex1 != ex2) - { - delta = lift; - mod += rem; - if(mod >= 0) - { - mod -= dx; - delta++; - } - - m_curr_cell.cover += delta; - m_curr_cell.area += poly_subpixel_scale * delta; - y1 += delta; - ex1 += incr; - set_curr_cell(ex1, ey); - } - } delta = y2 - y1; m_curr_cell.cover += delta; - m_curr_cell.area += (fx2 + poly_subpixel_scale - first) * delta; + m_curr_cell.area += (fx1 + fx2) * delta; + return; } - //------------------------------------------------------------------------ - template - AGG_INLINE void rasterizer_cells_aa::style(const cell_type& style_cell) - { - m_style_cell.style(style_cell); - } + // ok, we'll have to render a run of adjacent cells on the same + // hline... + p = (poly_subpixel_scale - fx1) * (y2 - y1); + first = poly_subpixel_scale; + incr = 1; - //------------------------------------------------------------------------ - template - void rasterizer_cells_aa::line(int x1, int y1, int x2, int y2) + dx = x2 - x1; + + if (dx < 0) { - enum dx_limit_e { dx_limit = 16384 << poly_subpixel_shift }; + p = fx1 * (y2 - y1); + first = 0; + incr = -1; + dx = -dx; + } - int dx = x2 - x1; + delta = p / dx; + mod = p % dx; - if(dx >= dx_limit || dx <= -dx_limit) + if (mod < 0) + { + delta--; + mod += dx; + } + + m_curr_cell.cover += delta; + m_curr_cell.area += (fx1 + first) * delta; + + ex1 += incr; + set_curr_cell(ex1, ey); + y1 += delta; + + if (ex1 != ex2) + { + p = poly_subpixel_scale * (y2 - y1 + delta); + lift = p / dx; + rem = p % dx; + + if (rem < 0) { - int cx = (x1 + x2) >> 1; - int cy = (y1 + y2) >> 1; - - // Bail if values are so large they are likely to wrap - if ((std::abs(x1) >= std::numeric_limits::max()/2) || (std::abs(y1) >= std::numeric_limits::max()/2) || - (std::abs(x2) >= std::numeric_limits::max()/2) || (std::abs(y2) >= std::numeric_limits::max()/2)) - return; - - line(x1, y1, cx, cy); - line(cx, cy, x2, y2); + lift--; + rem += dx; } - int dy = y2 - y1; - int ex1 = x1 >> poly_subpixel_shift; - int ex2 = x2 >> poly_subpixel_shift; - int ey1 = y1 >> poly_subpixel_shift; - int ey2 = y2 >> poly_subpixel_shift; - int fy1 = y1 & poly_subpixel_mask; - int fy2 = y2 & poly_subpixel_mask; + mod -= dx; - int x_from, x_to; - int p, rem, mod, lift, delta, first, incr; - - if(ex1 < m_min_x) m_min_x = ex1; - if(ex1 > m_max_x) m_max_x = ex1; - if(ey1 < m_min_y) m_min_y = ey1; - if(ey1 > m_max_y) m_max_y = ey1; - if(ex2 < m_min_x) m_min_x = ex2; - if(ex2 > m_max_x) m_max_x = ex2; - if(ey2 < m_min_y) m_min_y = ey2; - if(ey2 > m_max_y) m_max_y = ey2; - - set_curr_cell(ex1, ey1); - - //everything is on a single hline - if(ey1 == ey2) + while (ex1 != ex2) { - render_hline(ey1, x1, fy1, x2, fy2); - return; - } - - //Vertical line - we have to calculate start and end cells, - //and then - the common values of the area and coverage for - //all cells of the line. We know exactly there's only one - //cell, so, we don't have to call render_hline(). - incr = 1; - if(dx == 0) - { - int ex = x1 >> poly_subpixel_shift; - int two_fx = (x1 - (ex << poly_subpixel_shift)) << 1; - int area; - - first = poly_subpixel_scale; - if(dy < 0) + delta = lift; + mod += rem; + if (mod >= 0) { - first = 0; - incr = -1; + mod -= dx; + delta++; } - x_from = x1; - - //render_hline(ey1, x_from, fy1, x_from, first); - delta = first - fy1; m_curr_cell.cover += delta; - m_curr_cell.area += two_fx * delta; - - ey1 += incr; - set_curr_cell(ex, ey1); - - delta = first + first - poly_subpixel_scale; - area = two_fx * delta; - while(ey1 != ey2) - { - //render_hline(ey1, x_from, poly_subpixel_scale - first, x_from, first); - m_curr_cell.cover = delta; - m_curr_cell.area = area; - ey1 += incr; - set_curr_cell(ex, ey1); - } - //render_hline(ey1, x_from, poly_subpixel_scale - first, x_from, fy2); - delta = fy2 - poly_subpixel_scale + first; - m_curr_cell.cover += delta; - m_curr_cell.area += two_fx * delta; - return; + m_curr_cell.area += poly_subpixel_scale * delta; + y1 += delta; + ex1 += incr; + set_curr_cell(ex1, ey); } + } + delta = y2 - y1; + m_curr_cell.cover += delta; + m_curr_cell.area += (fx2 + poly_subpixel_scale - first) * delta; +} + +//------------------------------------------------------------------------ +template +AGG_INLINE void rasterizer_cells_aa::style(const cell_type& style_cell) +{ + m_style_cell.style(style_cell); +} + +//------------------------------------------------------------------------ +template +void rasterizer_cells_aa::line(int x1, int y1, int x2, int y2) +{ + enum dx_limit_e { dx_limit = 16384 << poly_subpixel_shift }; + + int dx = x2 - x1; + + if (dx >= dx_limit || dx <= -dx_limit) + { + int cx = (x1 + x2) >> 1; + int cy = (y1 + y2) >> 1; + + // Bail if values are so large they are likely to wrap + if ((std::abs(x1) >= std::numeric_limits::max() / 2) || + (std::abs(y1) >= std::numeric_limits::max() / 2) || + (std::abs(x2) >= std::numeric_limits::max() / 2) || + (std::abs(y2) >= std::numeric_limits::max() / 2)) + return; + + line(x1, y1, cx, cy); + line(cx, cy, x2, y2); + } + + int dy = y2 - y1; + int ex1 = x1 >> poly_subpixel_shift; + int ex2 = x2 >> poly_subpixel_shift; + int ey1 = y1 >> poly_subpixel_shift; + int ey2 = y2 >> poly_subpixel_shift; + int fy1 = y1 & poly_subpixel_mask; + int fy2 = y2 & poly_subpixel_mask; + + int x_from, x_to; + int p, rem, mod, lift, delta, first, incr; + + if (ex1 < m_min_x) + m_min_x = ex1; + if (ex1 > m_max_x) + m_max_x = ex1; + if (ey1 < m_min_y) + m_min_y = ey1; + if (ey1 > m_max_y) + m_max_y = ey1; + if (ex2 < m_min_x) + m_min_x = ex2; + if (ex2 > m_max_x) + m_max_x = ex2; + if (ey2 < m_min_y) + m_min_y = ey2; + if (ey2 > m_max_y) + m_max_y = ey2; + + set_curr_cell(ex1, ey1); + + // everything is on a single hline + if (ey1 == ey2) + { + render_hline(ey1, x1, fy1, x2, fy2); + return; + } + + // Vertical line - we have to calculate start and end cells, + // and then - the common values of the area and coverage for + // all cells of the line. We know exactly there's only one + // cell, so, we don't have to call render_hline(). + incr = 1; + if (dx == 0) + { + int ex = x1 >> poly_subpixel_shift; + int two_fx = (x1 - (ex << poly_subpixel_shift)) << 1; + int area; - //ok, we have to render several hlines - p = (poly_subpixel_scale - fy1) * dx; first = poly_subpixel_scale; - - if(dy < 0) + if (dy < 0) { - p = fy1 * dx; first = 0; - incr = -1; - dy = -dy; + incr = -1; } - delta = p / dy; - mod = p % dy; + x_from = x1; - if(mod < 0) - { - delta--; - mod += dy; - } - - x_from = x1 + delta; - render_hline(ey1, x1, fy1, x_from, first); + // render_hline(ey1, x_from, fy1, x_from, first); + delta = first - fy1; + m_curr_cell.cover += delta; + m_curr_cell.area += two_fx * delta; ey1 += incr; - set_curr_cell(x_from >> poly_subpixel_shift, ey1); + set_curr_cell(ex, ey1); - if(ey1 != ey2) + delta = first + first - poly_subpixel_scale; + area = two_fx * delta; + while (ey1 != ey2) { - p = poly_subpixel_scale * dx; - lift = p / dy; - rem = p % dy; - - if(rem < 0) - { - lift--; - rem += dy; - } - mod -= dy; - - while(ey1 != ey2) - { - delta = lift; - mod += rem; - if (mod >= 0) - { - mod -= dy; - delta++; - } - - x_to = x_from + delta; - render_hline(ey1, x_from, poly_subpixel_scale - first, x_to, first); - x_from = x_to; - - ey1 += incr; - set_curr_cell(x_from >> poly_subpixel_shift, ey1); - } + // render_hline(ey1, x_from, poly_subpixel_scale - first, x_from, first); + m_curr_cell.cover = delta; + m_curr_cell.area = area; + ey1 += incr; + set_curr_cell(ex, ey1); } - render_hline(ey1, x_from, poly_subpixel_scale - first, x2, fy2); + // render_hline(ey1, x_from, poly_subpixel_scale - first, x_from, fy2); + delta = fy2 - poly_subpixel_scale + first; + m_curr_cell.cover += delta; + m_curr_cell.area += two_fx * delta; + return; } - //------------------------------------------------------------------------ - template - void rasterizer_cells_aa::allocate_block() - { - if(m_curr_block >= m_num_blocks) - { - if(m_num_blocks >= m_max_blocks) - { - cell_type** new_cells = - pod_allocator::allocate(m_max_blocks + - cell_block_pool); + // ok, we have to render several hlines + p = (poly_subpixel_scale - fy1) * dx; + first = poly_subpixel_scale; - if(m_cells) - { - memcpy(new_cells, m_cells, m_max_blocks * sizeof(cell_type*)); - pod_allocator::deallocate(m_cells, m_max_blocks); - } - m_cells = new_cells; - m_max_blocks += cell_block_pool; + if (dy < 0) + { + p = fy1 * dx; + first = 0; + incr = -1; + dy = -dy; + } + + delta = p / dy; + mod = p % dy; + + if (mod < 0) + { + delta--; + mod += dy; + } + + x_from = x1 + delta; + render_hline(ey1, x1, fy1, x_from, first); + + ey1 += incr; + set_curr_cell(x_from >> poly_subpixel_shift, ey1); + + if (ey1 != ey2) + { + p = poly_subpixel_scale * dx; + lift = p / dy; + rem = p % dy; + + if (rem < 0) + { + lift--; + rem += dy; + } + mod -= dy; + + while (ey1 != ey2) + { + delta = lift; + mod += rem; + if (mod >= 0) + { + mod -= dy; + delta++; } - m_cells[m_num_blocks++] = - pod_allocator::allocate(cell_block_size); + x_to = x_from + delta; + render_hline(ey1, x_from, poly_subpixel_scale - first, x_to, first); + x_from = x_to; + ey1 += incr; + set_curr_cell(x_from >> poly_subpixel_shift, ey1); } - m_curr_cell_ptr = m_cells[m_curr_block++]; } + render_hline(ey1, x_from, poly_subpixel_scale - first, x2, fy2); +} - - - //------------------------------------------------------------------------ - template static AGG_INLINE void swap_cells(T* a, T* b) +//------------------------------------------------------------------------ +template +void rasterizer_cells_aa::allocate_block() +{ + if (m_curr_block >= m_num_blocks) { - T temp = *a; - *a = *b; - *b = temp; - } - - - //------------------------------------------------------------------------ - enum - { - qsort_threshold = 9 - }; - - - //------------------------------------------------------------------------ - template - void qsort_cells(Cell** start, unsigned num) - { - Cell** stack[80]; - Cell*** top; - Cell** limit; - Cell** base; - - limit = start + num; - base = start; - top = stack; - - for (;;) + if (m_num_blocks >= m_max_blocks) { - int len = int(limit - base); + cell_type** new_cells = pod_allocator::allocate(m_max_blocks + cell_block_pool); - Cell** i; - Cell** j; - Cell** pivot; - - if(len > qsort_threshold) + if (m_cells) { - // we use base + len/2 as the pivot - pivot = base + len / 2; - swap_cells(base, pivot); + memcpy(new_cells, m_cells, m_max_blocks * sizeof(cell_type*)); + pod_allocator::deallocate(m_cells, m_max_blocks); + } + m_cells = new_cells; + m_max_blocks += cell_block_pool; + } - i = base + 1; - j = limit - 1; + m_cells[m_num_blocks++] = pod_allocator::allocate(cell_block_size); + } + m_curr_cell_ptr = m_cells[m_curr_block++]; +} - // now ensure that *i <= *base <= *j - if((*j)->x < (*i)->x) - { - swap_cells(i, j); - } +//------------------------------------------------------------------------ +template +static AGG_INLINE void swap_cells(T* a, T* b) +{ + T temp = *a; + *a = *b; + *b = temp; +} - if((*base)->x < (*i)->x) - { - swap_cells(base, i); - } +//------------------------------------------------------------------------ +enum { qsort_threshold = 9 }; - if((*j)->x < (*base)->x) - { - swap_cells(base, j); - } +//------------------------------------------------------------------------ +template +void qsort_cells(Cell** start, unsigned num) +{ + Cell** stack[80]; + Cell*** top; + Cell** limit; + Cell** base; - for(;;) - { - int x = (*base)->x; - do i++; while( (*i)->x < x ); - do j--; while( x < (*j)->x ); + limit = start + num; + base = start; + top = stack; - if(i > j) - { - break; - } + for (;;) + { + int len = int(limit - base); - swap_cells(i, j); - } + Cell** i; + Cell** j; + Cell** pivot; + if (len > qsort_threshold) + { + // we use base + len/2 as the pivot + pivot = base + len / 2; + swap_cells(base, pivot); + + i = base + 1; + j = limit - 1; + + // now ensure that *i <= *base <= *j + if ((*j)->x < (*i)->x) + { + swap_cells(i, j); + } + + if ((*base)->x < (*i)->x) + { + swap_cells(base, i); + } + + if ((*j)->x < (*base)->x) + { swap_cells(base, j); - - // now, push the largest sub-array - if(j - base > limit - i) - { - top[0] = base; - top[1] = j; - base = i; - } - else - { - top[0] = i; - top[1] = limit; - limit = j; - } - top += 2; } - else + + for (;;) { - // the sub-array is small, perform insertion sort - j = base; - i = j + 1; + int x = (*base)->x; + do + i++; + while ((*i)->x < x); + do + j--; + while (x < (*j)->x); - for(; i < limit; j = i, i++) - { - for(; j[1]->x < (*j)->x; j--) - { - swap_cells(j + 1, j); - if (j == base) - { - break; - } - } - } - - if(top > stack) - { - top -= 2; - base = top[0]; - limit = top[1]; - } - else + if (i > j) { break; } + + swap_cells(i, j); + } + + swap_cells(base, j); + + // now, push the largest sub-array + if (j - base > limit - i) + { + top[0] = base; + top[1] = j; + base = i; + } + else + { + top[0] = i; + top[1] = limit; + limit = j; + } + top += 2; + } + else + { + // the sub-array is small, perform insertion sort + j = base; + i = j + 1; + + for (; i < limit; j = i, i++) + { + for (; j[1]->x < (*j)->x; j--) + { + swap_cells(j + 1, j); + if (j == base) + { + break; + } + } + } + + if (top > stack) + { + top -= 2; + base = top[0]; + limit = top[1]; + } + else + { + break; } } } +} +//------------------------------------------------------------------------ +template +void rasterizer_cells_aa::sort_cells() +{ + if (m_sorted) + return; // Perform sort only the first time. - //------------------------------------------------------------------------ - template - void rasterizer_cells_aa::sort_cells() + add_curr_cell(); + m_curr_cell.x = 0x7FFFFFFF; + m_curr_cell.y = 0x7FFFFFFF; + m_curr_cell.cover = 0; + m_curr_cell.area = 0; + + if (m_num_cells == 0) + return; + + // DBG: Check to see if min/max works well. + // for(unsigned nc = 0; nc < m_num_cells; nc++) + //{ + // cell_type* cell = m_cells[nc >> cell_block_shift] + (nc & cell_block_mask); + // if(cell->x < m_min_x || + // cell->y < m_min_y || + // cell->x > m_max_x || + // cell->y > m_max_y) + // { + // cell = cell; // Breakpoint here + // } + //} + // Allocate the array of cell pointers + m_sorted_cells.allocate(m_num_cells, 16); + + // Allocate and zero the Y array + m_sorted_y.allocate(m_max_y - m_min_y + 1, 16); + m_sorted_y.zero(); + + // Create the Y-histogram (count the numbers of cells for each Y) + cell_type** block_ptr = m_cells; + cell_type* cell_ptr; + unsigned nb = m_num_cells >> cell_block_shift; + unsigned i; + while (nb > 0) { - if(m_sorted) return; //Perform sort only the first time. - - add_curr_cell(); - m_curr_cell.x = 0x7FFFFFFF; - m_curr_cell.y = 0x7FFFFFFF; - m_curr_cell.cover = 0; - m_curr_cell.area = 0; - - if(m_num_cells == 0) return; - -// DBG: Check to see if min/max works well. -//for(unsigned nc = 0; nc < m_num_cells; nc++) -//{ -// cell_type* cell = m_cells[nc >> cell_block_shift] + (nc & cell_block_mask); -// if(cell->x < m_min_x || -// cell->y < m_min_y || -// cell->x > m_max_x || -// cell->y > m_max_y) -// { -// cell = cell; // Breakpoint here -// } -//} - // Allocate the array of cell pointers - m_sorted_cells.allocate(m_num_cells, 16); - - // Allocate and zero the Y array - m_sorted_y.allocate(m_max_y - m_min_y + 1, 16); - m_sorted_y.zero(); - - // Create the Y-histogram (count the numbers of cells for each Y) - cell_type** block_ptr = m_cells; - cell_type* cell_ptr; - unsigned nb = m_num_cells >> cell_block_shift; - unsigned i; - while(nb > 0) - { - cell_ptr = *block_ptr++; - i = cell_block_size; - while(i > 0) - { - m_sorted_y[cell_ptr->y - m_min_y].start++; - ++cell_ptr; - --i; - } - --nb; - } - cell_ptr = *block_ptr++; - i = m_num_cells & cell_block_mask; - while(i > 0) + i = cell_block_size; + while (i > 0) { m_sorted_y[cell_ptr->y - m_min_y].start++; ++cell_ptr; --i; } + --nb; + } - // Convert the Y-histogram into the array of starting indexes - unsigned start = 0; - for(i = 0; i < m_sorted_y.size(); i++) - { - unsigned v = m_sorted_y[i].start; - m_sorted_y[i].start = start; - start += v; - } + cell_ptr = *block_ptr++; + i = m_num_cells & cell_block_mask; + while (i > 0) + { + m_sorted_y[cell_ptr->y - m_min_y].start++; + ++cell_ptr; + --i; + } - // Fill the cell pointer array sorted by Y - block_ptr = m_cells; - nb = m_num_cells >> cell_block_shift; - while(nb > 0) - { - cell_ptr = *block_ptr++; - i = cell_block_size; - while(i > 0) - { - sorted_y& curr_y = m_sorted_y[cell_ptr->y - m_min_y]; - m_sorted_cells[curr_y.start + curr_y.num] = cell_ptr; - ++curr_y.num; - ++cell_ptr; - --i; - } - --nb; - } - + // Convert the Y-histogram into the array of starting indexes + unsigned start = 0; + for (i = 0; i < m_sorted_y.size(); i++) + { + unsigned v = m_sorted_y[i].start; + m_sorted_y[i].start = start; + start += v; + } + + // Fill the cell pointer array sorted by Y + block_ptr = m_cells; + nb = m_num_cells >> cell_block_shift; + while (nb > 0) + { cell_ptr = *block_ptr++; - i = m_num_cells & cell_block_mask; - while(i > 0) + i = cell_block_size; + while (i > 0) { sorted_y& curr_y = m_sorted_y[cell_ptr->y - m_min_y]; m_sorted_cells[curr_y.start + curr_y.num] = cell_ptr; @@ -723,46 +703,61 @@ namespace agg ++cell_ptr; --i; } - - // Finally arrange the X-arrays - for(i = 0; i < m_sorted_y.size(); i++) - { - const sorted_y& curr_y = m_sorted_y[i]; - if(curr_y.num) - { - qsort_cells(m_sorted_cells.data() + curr_y.start, curr_y.num); - } - } - m_sorted = true; + --nb; } - - - //------------------------------------------------------scanline_hit_test - class scanline_hit_test + cell_ptr = *block_ptr++; + i = m_num_cells & cell_block_mask; + while (i > 0) { - public: - scanline_hit_test(int x) : m_x(x), m_hit(false) {} + sorted_y& curr_y = m_sorted_y[cell_ptr->y - m_min_y]; + m_sorted_cells[curr_y.start + curr_y.num] = cell_ptr; + ++curr_y.num; + ++cell_ptr; + --i; + } - void reset_spans() {} - void finalize(int) {} - void add_cell(int x, int) + // Finally arrange the X-arrays + for (i = 0; i < m_sorted_y.size(); i++) + { + const sorted_y& curr_y = m_sorted_y[i]; + if (curr_y.num) { - if(m_x == x) m_hit = true; + qsort_cells(m_sorted_cells.data() + curr_y.start, curr_y.num); } - void add_span(int x, int len, int) - { - if(m_x >= x && m_x < x+len) m_hit = true; - } - unsigned num_spans() const { return 1; } - bool hit() const { return m_hit; } - - private: - int m_x; - bool m_hit; - }; - - + } + m_sorted = true; } +//------------------------------------------------------scanline_hit_test +class scanline_hit_test +{ + public: + scanline_hit_test(int x) + : m_x(x) + , m_hit(false) + {} + + void reset_spans() {} + void finalize(int) {} + void add_cell(int x, int) + { + if (m_x == x) + m_hit = true; + } + void add_span(int x, int len, int) + { + if (m_x >= x && m_x < x + len) + m_hit = true; + } + unsigned num_spans() const { return 1; } + bool hit() const { return m_hit; } + + private: + int m_x; + bool m_hit; +}; + +} // namespace agg + #endif diff --git a/deps/agg/include/agg_rasterizer_compound_aa.h b/deps/agg/include/agg_rasterizer_compound_aa.h index 15b88b545..c7ce7efff 100644 --- a/deps/agg/include/agg_rasterizer_compound_aa.h +++ b/deps/agg/include/agg_rasterizer_compound_aa.h @@ -2,15 +2,15 @@ // Anti-Grain Geometry - Version 2.3 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // -// The author gratefully acknowleges the support of David Turner, -// Robert Wilhelm, and Werner Lemberg - the authors of the FreeType +// The author gratefully acknowleges the support of David Turner, +// Robert Wilhelm, and Werner Lemberg - the authors of the FreeType // libray - in producing this work. See http://www.freetype.org for details. // //---------------------------------------------------------------------------- @@ -19,12 +19,12 @@ // http://www.antigrain.com //---------------------------------------------------------------------------- // -// Adaptation for 32-bit screen coordinates has been sponsored by +// Adaptation for 32-bit screen coordinates has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. -// +// //---------------------------------------------------------------------------- #ifndef AGG_RASTERIZER_COMPOUND_AA_INCLUDED #define AGG_RASTERIZER_COMPOUND_AA_INCLUDED @@ -32,667 +32,652 @@ #include "agg_rasterizer_cells_aa.h" #include "agg_rasterizer_sl_clip.h" -namespace agg +namespace agg { + +//-----------------------------------------------------------cell_style_aa +// A pixel cell. There're no constructors defined and it was done +// intentionally in order to avoid extra overhead when allocating an +// array of cells. +struct cell_style_aa { + int x; + int y; + int cover; + int area; + int16 left, right; - //-----------------------------------------------------------cell_style_aa - // A pixel cell. There're no constructors defined and it was done - // intentionally in order to avoid extra overhead when allocating an - // array of cells. - struct cell_style_aa + void initial() { - int x; - int y; - int cover; - int area; - int16 left, right; + x = 0x7FFFFFFF; + y = 0x7FFFFFFF; + cover = 0; + area = 0; + left = -1; + right = -1; + } - void initial() - { - x = 0x7FFFFFFF; - y = 0x7FFFFFFF; - cover = 0; - area = 0; - left = -1; - right = -1; - } + void style(const cell_style_aa& c) + { + left = c.left; + right = c.right; + } - void style(const cell_style_aa& c) - { - left = c.left; - right = c.right; - } + int not_equal(int ex, int ey, const cell_style_aa& c) const + { + return (ex - x) | (ey - y) | (left - c.left) | (right - c.right); + } +}; - int not_equal(int ex, int ey, const cell_style_aa& c) const - { - return (ex - x) | (ey - y) | (left - c.left) | (right - c.right); - } +//===========================================================layer_order_e +enum layer_order_e { + layer_unsorted, //------layer_unsorted + layer_direct, //------layer_direct + layer_inverse //------layer_inverse +}; + +//==================================================rasterizer_compound_aa +template +class rasterizer_compound_aa +{ + struct style_info + { + unsigned start_cell; + unsigned num_cells; + int last_x; }; - - //===========================================================layer_order_e - enum layer_order_e + struct cell_info { - layer_unsorted, //------layer_unsorted - layer_direct, //------layer_direct - layer_inverse //------layer_inverse + int x, area, cover; }; + public: + typedef Clip clip_type; + typedef typename Clip::conv_type conv_type; + typedef typename Clip::coord_type coord_type; - //==================================================rasterizer_compound_aa - template class rasterizer_compound_aa - { - struct style_info - { - unsigned start_cell; - unsigned num_cells; - int last_x; - }; - - struct cell_info - { - int x, area, cover; - }; - - public: - typedef Clip clip_type; - typedef typename Clip::conv_type conv_type; - typedef typename Clip::coord_type coord_type; - - enum aa_scale_e - { - aa_shift = 8, - aa_scale = 1 << aa_shift, - aa_mask = aa_scale - 1, - aa_scale2 = aa_scale * 2, - aa_mask2 = aa_scale2 - 1 - }; - - //-------------------------------------------------------------------- - rasterizer_compound_aa() : - m_outline(), - m_clipper(), - m_filling_rule(fill_non_zero), - m_layer_order(layer_direct), - m_styles(), // Active Styles - m_ast(), // Active Style Table (unique values) - m_asm(), // Active Style Mask - m_cells(), - m_cover_buf(), - m_master_alpha(), - m_min_style(0x7FFFFFFF), - m_max_style(-0x7FFFFFFF), - m_start_x(0), - m_start_y(0), - m_scan_y(0x7FFFFFFF), - m_sl_start(0), - m_sl_len(0) - {} - - //-------------------------------------------------------------------- - void reset(); - void reset_clipping(); - void clip_box(double x1, double y1, double x2, double y2); - void filling_rule(filling_rule_e filling_rule); - void layer_order(layer_order_e order); - void master_alpha(int style, double alpha); - - //-------------------------------------------------------------------- - void styles(int left, int right); - void move_to(int x, int y); - void line_to(int x, int y); - void move_to_d(double x, double y); - void line_to_d(double x, double y); - void add_vertex(double x, double y, unsigned cmd); - - void edge(int x1, int y1, int x2, int y2); - void edge_d(double x1, double y1, double x2, double y2); - - //------------------------------------------------------------------- - template - void add_path(VertexSource& vs, unsigned path_id=0) - { - double x; - double y; - - unsigned cmd; - vs.rewind(path_id); - if(m_outline.sorted()) reset(); - while(!is_stop(cmd = vs.vertex(&x, &y))) - { - add_vertex(x, y, cmd); - } - } - - - //-------------------------------------------------------------------- - int min_x() const { return m_outline.min_x(); } - int min_y() const { return m_outline.min_y(); } - int max_x() const { return m_outline.max_x(); } - int max_y() const { return m_outline.max_y(); } - int min_style() const { return m_min_style; } - int max_style() const { return m_max_style; } - - //-------------------------------------------------------------------- - void sort(); - bool rewind_scanlines(); - unsigned sweep_styles(); - int scanline_start() const { return m_sl_start; } - unsigned scanline_length() const { return m_sl_len; } - unsigned style(unsigned style_idx) const; - - cover_type* allocate_cover_buffer(unsigned len); - - //-------------------------------------------------------------------- - bool navigate_scanline(int y); - bool hit_test(int tx, int ty); - - //-------------------------------------------------------------------- - AGG_INLINE unsigned calculate_alpha(int area, unsigned master_alpha) const - { - int cover = area >> (poly_subpixel_shift*2 + 1 - aa_shift); - if(cover < 0) cover = -cover; - if(m_filling_rule == fill_even_odd) - { - cover &= aa_mask2; - if(cover > aa_scale) - { - cover = aa_scale2 - cover; - } - } - if(cover > aa_mask) cover = aa_mask; - return (cover * master_alpha + aa_mask) >> aa_shift; - } - - //-------------------------------------------------------------------- - // Sweeps one scanline with one style index. The style ID can be - // determined by calling style(). - template bool sweep_scanline(Scanline& sl, int style_idx) - { - int scan_y = m_scan_y - 1; - if(scan_y > m_outline.max_y()) return false; - - sl.reset_spans(); - - unsigned master_alpha = aa_mask; - - if(style_idx < 0) - { - style_idx = 0; - } - else - { - style_idx++; - master_alpha = m_master_alpha[m_ast[style_idx] + m_min_style - 1]; - } - - const style_info& st = m_styles[m_ast[style_idx]]; - - unsigned num_cells = st.num_cells; - cell_info* cell = &m_cells[st.start_cell]; - - int cover = 0; - while(num_cells--) - { - unsigned alpha; - int x = cell->x; - int area = cell->area; - - cover += cell->cover; - - ++cell; - - if(area) - { - alpha = calculate_alpha((cover << (poly_subpixel_shift + 1)) - area, - master_alpha); - sl.add_cell(x, alpha); - x++; - } - - if(num_cells && cell->x > x) - { - alpha = calculate_alpha(cover << (poly_subpixel_shift + 1), - master_alpha); - if(alpha) - { - sl.add_span(x, cell->x - x, alpha); - } - } - } - - if(sl.num_spans() == 0) return false; - sl.finalize(scan_y); - return true; - } - - private: - void add_style(int style_id); - void allocate_master_alpha(); - - //-------------------------------------------------------------------- - // Disable copying - rasterizer_compound_aa(const rasterizer_compound_aa&); - const rasterizer_compound_aa& - operator = (const rasterizer_compound_aa&); - - private: - rasterizer_cells_aa m_outline; - clip_type m_clipper; - filling_rule_e m_filling_rule; - layer_order_e m_layer_order; - pod_vector m_styles; // Active Styles - pod_vector m_ast; // Active Style Table (unique values) - pod_vector m_asm; // Active Style Mask - pod_vector m_cells; - pod_vector m_cover_buf; - pod_bvector m_master_alpha; - - int m_min_style; - int m_max_style; - coord_type m_start_x; - coord_type m_start_y; - int m_scan_y; - int m_sl_start; - unsigned m_sl_len; + enum aa_scale_e { + aa_shift = 8, + aa_scale = 1 << aa_shift, + aa_mask = aa_scale - 1, + aa_scale2 = aa_scale * 2, + aa_mask2 = aa_scale2 - 1 }; + //-------------------------------------------------------------------- + rasterizer_compound_aa() + : m_outline() + , m_clipper() + , m_filling_rule(fill_non_zero) + , m_layer_order(layer_direct) + , m_styles() + , // Active Styles + m_ast() + , // Active Style Table (unique values) + m_asm() + , // Active Style Mask + m_cells() + , m_cover_buf() + , m_master_alpha() + , m_min_style(0x7FFFFFFF) + , m_max_style(-0x7FFFFFFF) + , m_start_x(0) + , m_start_y(0) + , m_scan_y(0x7FFFFFFF) + , m_sl_start(0) + , m_sl_len(0) + {} + //-------------------------------------------------------------------- + void reset(); + void reset_clipping(); + void clip_box(double x1, double y1, double x2, double y2); + void filling_rule(filling_rule_e filling_rule); + void layer_order(layer_order_e order); + void master_alpha(int style, double alpha); + //-------------------------------------------------------------------- + void styles(int left, int right); + void move_to(int x, int y); + void line_to(int x, int y); + void move_to_d(double x, double y); + void line_to_d(double x, double y); + void add_vertex(double x, double y, unsigned cmd); + void edge(int x1, int y1, int x2, int y2); + void edge_d(double x1, double y1, double x2, double y2); - - - - - - //------------------------------------------------------------------------ - template - void rasterizer_compound_aa::reset() - { - m_outline.reset(); - m_min_style = 0x7FFFFFFF; - m_max_style = -0x7FFFFFFF; - m_scan_y = 0x7FFFFFFF; - m_sl_start = 0; - m_sl_len = 0; - } - - //------------------------------------------------------------------------ - template - void rasterizer_compound_aa::filling_rule(filling_rule_e filling_rule) - { - m_filling_rule = filling_rule; - } - - //------------------------------------------------------------------------ - template - void rasterizer_compound_aa::layer_order(layer_order_e order) + //------------------------------------------------------------------- + template + void add_path(VertexSource& vs, unsigned path_id = 0) { - m_layer_order = order; - } + double x; + double y; - //------------------------------------------------------------------------ - template - void rasterizer_compound_aa::clip_box(double x1, double y1, - double x2, double y2) - { - reset(); - m_clipper.clip_box(conv_type::upscale(x1), conv_type::upscale(y1), - conv_type::upscale(x2), conv_type::upscale(y2)); - } - - //------------------------------------------------------------------------ - template - void rasterizer_compound_aa::reset_clipping() - { - reset(); - m_clipper.reset_clipping(); - } - - //------------------------------------------------------------------------ - template - void rasterizer_compound_aa::styles(int left, int right) - { - cell_style_aa cell; - cell.initial(); - cell.left = (int16)left; - cell.right = (int16)right; - m_outline.style(cell); - if(left >= 0 && left < m_min_style) m_min_style = left; - if(left >= 0 && left > m_max_style) m_max_style = left; - if(right >= 0 && right < m_min_style) m_min_style = right; - if(right >= 0 && right > m_max_style) m_max_style = right; - } - - //------------------------------------------------------------------------ - template - void rasterizer_compound_aa::move_to(int x, int y) - { - if(m_outline.sorted()) reset(); - m_clipper.move_to(m_start_x = conv_type::downscale(x), - m_start_y = conv_type::downscale(y)); - } - - //------------------------------------------------------------------------ - template - void rasterizer_compound_aa::line_to(int x, int y) - { - m_clipper.line_to(m_outline, - conv_type::downscale(x), - conv_type::downscale(y)); - } - - //------------------------------------------------------------------------ - template - void rasterizer_compound_aa::move_to_d(double x, double y) - { - if(m_outline.sorted()) reset(); - m_clipper.move_to(m_start_x = conv_type::upscale(x), - m_start_y = conv_type::upscale(y)); - } - - //------------------------------------------------------------------------ - template - void rasterizer_compound_aa::line_to_d(double x, double y) - { - m_clipper.line_to(m_outline, - conv_type::upscale(x), - conv_type::upscale(y)); - } - - //------------------------------------------------------------------------ - template - void rasterizer_compound_aa::add_vertex(double x, double y, unsigned cmd) - { - if(is_move_to(cmd)) + unsigned cmd; + vs.rewind(path_id); + if (m_outline.sorted()) + reset(); + while (!is_stop(cmd = vs.vertex(&x, &y))) { - move_to_d(x, y); + add_vertex(x, y, cmd); } - else - if(is_vertex(cmd)) + } + + //-------------------------------------------------------------------- + int min_x() const { return m_outline.min_x(); } + int min_y() const { return m_outline.min_y(); } + int max_x() const { return m_outline.max_x(); } + int max_y() const { return m_outline.max_y(); } + int min_style() const { return m_min_style; } + int max_style() const { return m_max_style; } + + //-------------------------------------------------------------------- + void sort(); + bool rewind_scanlines(); + unsigned sweep_styles(); + int scanline_start() const { return m_sl_start; } + unsigned scanline_length() const { return m_sl_len; } + unsigned style(unsigned style_idx) const; + + cover_type* allocate_cover_buffer(unsigned len); + + //-------------------------------------------------------------------- + bool navigate_scanline(int y); + bool hit_test(int tx, int ty); + + //-------------------------------------------------------------------- + AGG_INLINE unsigned calculate_alpha(int area, unsigned master_alpha) const + { + int cover = area >> (poly_subpixel_shift * 2 + 1 - aa_shift); + if (cover < 0) + cover = -cover; + if (m_filling_rule == fill_even_odd) { - line_to_d(x, y); + cover &= aa_mask2; + if (cover > aa_scale) + { + cover = aa_scale2 - cover; + } + } + if (cover > aa_mask) + cover = aa_mask; + return (cover * master_alpha + aa_mask) >> aa_shift; + } + + //-------------------------------------------------------------------- + // Sweeps one scanline with one style index. The style ID can be + // determined by calling style(). + template + bool sweep_scanline(Scanline& sl, int style_idx) + { + int scan_y = m_scan_y - 1; + if (scan_y > m_outline.max_y()) + return false; + + sl.reset_spans(); + + unsigned master_alpha = aa_mask; + + if (style_idx < 0) + { + style_idx = 0; } else - if(is_close(cmd)) { - m_clipper.line_to(m_outline, m_start_x, m_start_y); + style_idx++; + master_alpha = m_master_alpha[m_ast[style_idx] + m_min_style - 1]; } - } - //------------------------------------------------------------------------ - template - void rasterizer_compound_aa::edge(int x1, int y1, int x2, int y2) - { - if(m_outline.sorted()) reset(); - m_clipper.move_to(conv_type::downscale(x1), conv_type::downscale(y1)); - m_clipper.line_to(m_outline, - conv_type::downscale(x2), - conv_type::downscale(y2)); - } - - //------------------------------------------------------------------------ - template - void rasterizer_compound_aa::edge_d(double x1, double y1, - double x2, double y2) - { - if(m_outline.sorted()) reset(); - m_clipper.move_to(conv_type::upscale(x1), conv_type::upscale(y1)); - m_clipper.line_to(m_outline, - conv_type::upscale(x2), - conv_type::upscale(y2)); - } + const style_info& st = m_styles[m_ast[style_idx]]; - //------------------------------------------------------------------------ - template - AGG_INLINE void rasterizer_compound_aa::sort() - { - m_outline.sort_cells(); - } + unsigned num_cells = st.num_cells; + cell_info* cell = &m_cells[st.start_cell]; - //------------------------------------------------------------------------ - template - AGG_INLINE bool rasterizer_compound_aa::rewind_scanlines() - { - m_outline.sort_cells(); - if(m_outline.total_cells() == 0) + int cover = 0; + while (num_cells--) { + unsigned alpha; + int x = cell->x; + int area = cell->area; + + cover += cell->cover; + + ++cell; + + if (area) + { + alpha = calculate_alpha((cover << (poly_subpixel_shift + 1)) - area, master_alpha); + sl.add_cell(x, alpha); + x++; + } + + if (num_cells && cell->x > x) + { + alpha = calculate_alpha(cover << (poly_subpixel_shift + 1), master_alpha); + if (alpha) + { + sl.add_span(x, cell->x - x, alpha); + } + } + } + + if (sl.num_spans() == 0) return false; - } - if(m_max_style < m_min_style) - { - return false; - } - m_scan_y = m_outline.min_y(); - m_styles.allocate(m_max_style - m_min_style + 2, 128); - allocate_master_alpha(); + sl.finalize(scan_y); return true; } - //------------------------------------------------------------------------ - template - AGG_INLINE void rasterizer_compound_aa::add_style(int style_id) + private: + void add_style(int style_id); + void allocate_master_alpha(); + + //-------------------------------------------------------------------- + // Disable copying + rasterizer_compound_aa(const rasterizer_compound_aa&); + const rasterizer_compound_aa& operator=(const rasterizer_compound_aa&); + + private: + rasterizer_cells_aa m_outline; + clip_type m_clipper; + filling_rule_e m_filling_rule; + layer_order_e m_layer_order; + pod_vector m_styles; // Active Styles + pod_vector m_ast; // Active Style Table (unique values) + pod_vector m_asm; // Active Style Mask + pod_vector m_cells; + pod_vector m_cover_buf; + pod_bvector m_master_alpha; + + int m_min_style; + int m_max_style; + coord_type m_start_x; + coord_type m_start_y; + int m_scan_y; + int m_sl_start; + unsigned m_sl_len; +}; + +//------------------------------------------------------------------------ +template +void rasterizer_compound_aa::reset() +{ + m_outline.reset(); + m_min_style = 0x7FFFFFFF; + m_max_style = -0x7FFFFFFF; + m_scan_y = 0x7FFFFFFF; + m_sl_start = 0; + m_sl_len = 0; +} + +//------------------------------------------------------------------------ +template +void rasterizer_compound_aa::filling_rule(filling_rule_e filling_rule) +{ + m_filling_rule = filling_rule; +} + +//------------------------------------------------------------------------ +template +void rasterizer_compound_aa::layer_order(layer_order_e order) +{ + m_layer_order = order; +} + +//------------------------------------------------------------------------ +template +void rasterizer_compound_aa::clip_box(double x1, double y1, double x2, double y2) +{ + reset(); + m_clipper.clip_box(conv_type::upscale(x1), conv_type::upscale(y1), conv_type::upscale(x2), conv_type::upscale(y2)); +} + +//------------------------------------------------------------------------ +template +void rasterizer_compound_aa::reset_clipping() +{ + reset(); + m_clipper.reset_clipping(); +} + +//------------------------------------------------------------------------ +template +void rasterizer_compound_aa::styles(int left, int right) +{ + cell_style_aa cell; + cell.initial(); + cell.left = (int16)left; + cell.right = (int16)right; + m_outline.style(cell); + if (left >= 0 && left < m_min_style) + m_min_style = left; + if (left >= 0 && left > m_max_style) + m_max_style = left; + if (right >= 0 && right < m_min_style) + m_min_style = right; + if (right >= 0 && right > m_max_style) + m_max_style = right; +} + +//------------------------------------------------------------------------ +template +void rasterizer_compound_aa::move_to(int x, int y) +{ + if (m_outline.sorted()) + reset(); + m_clipper.move_to(m_start_x = conv_type::downscale(x), m_start_y = conv_type::downscale(y)); +} + +//------------------------------------------------------------------------ +template +void rasterizer_compound_aa::line_to(int x, int y) +{ + m_clipper.line_to(m_outline, conv_type::downscale(x), conv_type::downscale(y)); +} + +//------------------------------------------------------------------------ +template +void rasterizer_compound_aa::move_to_d(double x, double y) +{ + if (m_outline.sorted()) + reset(); + m_clipper.move_to(m_start_x = conv_type::upscale(x), m_start_y = conv_type::upscale(y)); +} + +//------------------------------------------------------------------------ +template +void rasterizer_compound_aa::line_to_d(double x, double y) +{ + m_clipper.line_to(m_outline, conv_type::upscale(x), conv_type::upscale(y)); +} + +//------------------------------------------------------------------------ +template +void rasterizer_compound_aa::add_vertex(double x, double y, unsigned cmd) +{ + if (is_move_to(cmd)) { - if(style_id < 0) style_id = 0; - else style_id -= m_min_style - 1; + move_to_d(x, y); + } + else if (is_vertex(cmd)) + { + line_to_d(x, y); + } + else if (is_close(cmd)) + { + m_clipper.line_to(m_outline, m_start_x, m_start_y); + } +} - unsigned nbyte = style_id >> 3; - unsigned mask = 1 << (style_id & 7); +//------------------------------------------------------------------------ +template +void rasterizer_compound_aa::edge(int x1, int y1, int x2, int y2) +{ + if (m_outline.sorted()) + reset(); + m_clipper.move_to(conv_type::downscale(x1), conv_type::downscale(y1)); + m_clipper.line_to(m_outline, conv_type::downscale(x2), conv_type::downscale(y2)); +} - style_info* style = &m_styles[style_id]; - if((m_asm[nbyte] & mask) == 0) +//------------------------------------------------------------------------ +template +void rasterizer_compound_aa::edge_d(double x1, double y1, double x2, double y2) +{ + if (m_outline.sorted()) + reset(); + m_clipper.move_to(conv_type::upscale(x1), conv_type::upscale(y1)); + m_clipper.line_to(m_outline, conv_type::upscale(x2), conv_type::upscale(y2)); +} + +//------------------------------------------------------------------------ +template +AGG_INLINE void rasterizer_compound_aa::sort() +{ + m_outline.sort_cells(); +} + +//------------------------------------------------------------------------ +template +AGG_INLINE bool rasterizer_compound_aa::rewind_scanlines() +{ + m_outline.sort_cells(); + if (m_outline.total_cells() == 0) + { + return false; + } + if (m_max_style < m_min_style) + { + return false; + } + m_scan_y = m_outline.min_y(); + m_styles.allocate(m_max_style - m_min_style + 2, 128); + allocate_master_alpha(); + return true; +} + +//------------------------------------------------------------------------ +template +AGG_INLINE void rasterizer_compound_aa::add_style(int style_id) +{ + if (style_id < 0) + style_id = 0; + else + style_id -= m_min_style - 1; + + unsigned nbyte = style_id >> 3; + unsigned mask = 1 << (style_id & 7); + + style_info* style = &m_styles[style_id]; + if ((m_asm[nbyte] & mask) == 0) + { + m_ast.add(style_id); + m_asm[nbyte] |= mask; + style->start_cell = 0; + style->num_cells = 0; + style->last_x = -0x7FFFFFFF; + } + ++style->start_cell; +} + +//------------------------------------------------------------------------ +// Returns the number of styles +template +unsigned rasterizer_compound_aa::sweep_styles() +{ + for (;;) + { + if (m_scan_y > m_outline.max_y()) + return 0; + unsigned num_cells = m_outline.scanline_num_cells(m_scan_y); + const cell_style_aa* const* cells = m_outline.scanline_cells(m_scan_y); + unsigned num_styles = m_max_style - m_min_style + 2; + const cell_style_aa* curr_cell; + unsigned style_id; + style_info* style; + cell_info* cell; + + m_cells.allocate(num_cells * 2, 256); // Each cell can have two styles + m_ast.capacity(num_styles, 64); + m_asm.allocate((num_styles + 7) >> 3, 8); + m_asm.zero(); + + if (num_cells) { - m_ast.add(style_id); - m_asm[nbyte] |= mask; + // Pre-add zero (for no-fill style, that is, -1). + // We need that to ensure that the "-1 style" would go first. + m_asm[0] |= 1; + m_ast.add(0); + style = &m_styles[0]; style->start_cell = 0; style->num_cells = 0; style->last_x = -0x7FFFFFFF; - } - ++style->start_cell; - } - //------------------------------------------------------------------------ - // Returns the number of styles - template - unsigned rasterizer_compound_aa::sweep_styles() - { - for(;;) - { - if(m_scan_y > m_outline.max_y()) return 0; - unsigned num_cells = m_outline.scanline_num_cells(m_scan_y); - const cell_style_aa* const* cells = m_outline.scanline_cells(m_scan_y); - unsigned num_styles = m_max_style - m_min_style + 2; - const cell_style_aa* curr_cell; - unsigned style_id; - style_info* style; - cell_info* cell; - - m_cells.allocate(num_cells * 2, 256); // Each cell can have two styles - m_ast.capacity(num_styles, 64); - m_asm.allocate((num_styles + 7) >> 3, 8); - m_asm.zero(); - - if(num_cells) + m_sl_start = cells[0]->x; + m_sl_len = cells[num_cells - 1]->x - m_sl_start + 1; + while (num_cells--) { - // Pre-add zero (for no-fill style, that is, -1). - // We need that to ensure that the "-1 style" would go first. - m_asm[0] |= 1; - m_ast.add(0); - style = &m_styles[0]; - style->start_cell = 0; - style->num_cells = 0; - style->last_x = -0x7FFFFFFF; + curr_cell = *cells++; + add_style(curr_cell->left); + add_style(curr_cell->right); + } - m_sl_start = cells[0]->x; - m_sl_len = cells[num_cells-1]->x - m_sl_start + 1; - while(num_cells--) + // Convert the Y-histogram into the array of starting indexes + unsigned i; + unsigned start_cell = 0; + for (i = 0; i < m_ast.size(); i++) + { + style_info& st = m_styles[m_ast[i]]; + unsigned v = st.start_cell; + st.start_cell = start_cell; + start_cell += v; + } + + cells = m_outline.scanline_cells(m_scan_y); + num_cells = m_outline.scanline_num_cells(m_scan_y); + + while (num_cells--) + { + curr_cell = *cells++; + style_id = (curr_cell->left < 0) ? 0 : curr_cell->left - m_min_style + 1; + + style = &m_styles[style_id]; + if (curr_cell->x == style->last_x) { - curr_cell = *cells++; - add_style(curr_cell->left); - add_style(curr_cell->right); + cell = &m_cells[style->start_cell + style->num_cells - 1]; + cell->area += curr_cell->area; + cell->cover += curr_cell->cover; + } + else + { + cell = &m_cells[style->start_cell + style->num_cells]; + cell->x = curr_cell->x; + cell->area = curr_cell->area; + cell->cover = curr_cell->cover; + style->last_x = curr_cell->x; + style->num_cells++; } - // Convert the Y-histogram into the array of starting indexes - unsigned i; - unsigned start_cell = 0; - for(i = 0; i < m_ast.size(); i++) + style_id = (curr_cell->right < 0) ? 0 : curr_cell->right - m_min_style + 1; + + style = &m_styles[style_id]; + if (curr_cell->x == style->last_x) { - style_info& st = m_styles[m_ast[i]]; - unsigned v = st.start_cell; - st.start_cell = start_cell; - start_cell += v; + cell = &m_cells[style->start_cell + style->num_cells - 1]; + cell->area -= curr_cell->area; + cell->cover -= curr_cell->cover; } - - cells = m_outline.scanline_cells(m_scan_y); - num_cells = m_outline.scanline_num_cells(m_scan_y); - - while(num_cells--) + else { - curr_cell = *cells++; - style_id = (curr_cell->left < 0) ? 0 : - curr_cell->left - m_min_style + 1; - - style = &m_styles[style_id]; - if(curr_cell->x == style->last_x) - { - cell = &m_cells[style->start_cell + style->num_cells - 1]; - cell->area += curr_cell->area; - cell->cover += curr_cell->cover; - } - else - { - cell = &m_cells[style->start_cell + style->num_cells]; - cell->x = curr_cell->x; - cell->area = curr_cell->area; - cell->cover = curr_cell->cover; - style->last_x = curr_cell->x; - style->num_cells++; - } - - style_id = (curr_cell->right < 0) ? 0 : - curr_cell->right - m_min_style + 1; - - style = &m_styles[style_id]; - if(curr_cell->x == style->last_x) - { - cell = &m_cells[style->start_cell + style->num_cells - 1]; - cell->area -= curr_cell->area; - cell->cover -= curr_cell->cover; - } - else - { - cell = &m_cells[style->start_cell + style->num_cells]; - cell->x = curr_cell->x; - cell->area = -curr_cell->area; - cell->cover = -curr_cell->cover; - style->last_x = curr_cell->x; - style->num_cells++; - } + cell = &m_cells[style->start_cell + style->num_cells]; + cell->x = curr_cell->x; + cell->area = -curr_cell->area; + cell->cover = -curr_cell->cover; + style->last_x = curr_cell->x; + style->num_cells++; } } - if(m_ast.size() > 1) break; - ++m_scan_y; } + if (m_ast.size() > 1) + break; ++m_scan_y; + } + ++m_scan_y; - if(m_layer_order != layer_unsorted) - { - range_adaptor > ra(m_ast, 1, m_ast.size() - 1); - if(m_layer_order == layer_direct) quick_sort(ra, unsigned_greater); - else quick_sort(ra, unsigned_less); - } - - return m_ast.size() - 1; + if (m_layer_order != layer_unsorted) + { + range_adaptor> ra(m_ast, 1, m_ast.size() - 1); + if (m_layer_order == layer_direct) + quick_sort(ra, unsigned_greater); + else + quick_sort(ra, unsigned_less); } - //------------------------------------------------------------------------ - // Returns style ID depending of the existing style index - template - AGG_INLINE - unsigned rasterizer_compound_aa::style(unsigned style_idx) const + return m_ast.size() - 1; +} + +//------------------------------------------------------------------------ +// Returns style ID depending of the existing style index +template +AGG_INLINE unsigned rasterizer_compound_aa::style(unsigned style_idx) const +{ + return m_ast[style_idx + 1] + m_min_style - 1; +} + +//------------------------------------------------------------------------ +template +AGG_INLINE bool rasterizer_compound_aa::navigate_scanline(int y) +{ + m_outline.sort_cells(); + if (m_outline.total_cells() == 0) { - return m_ast[style_idx + 1] + m_min_style - 1; + return false; + } + if (m_max_style < m_min_style) + { + return false; + } + if (y < m_outline.min_y() || y > m_outline.max_y()) + { + return false; + } + m_scan_y = y; + m_styles.allocate(m_max_style - m_min_style + 2, 128); + allocate_master_alpha(); + return true; +} + +//------------------------------------------------------------------------ +template +bool rasterizer_compound_aa::hit_test(int tx, int ty) +{ + if (!navigate_scanline(ty)) + { + return false; } - //------------------------------------------------------------------------ - template - AGG_INLINE bool rasterizer_compound_aa::navigate_scanline(int y) + unsigned num_styles = sweep_styles(); + if (num_styles <= 0) { - m_outline.sort_cells(); - if(m_outline.total_cells() == 0) - { - return false; - } - if(m_max_style < m_min_style) - { - return false; - } - if(y < m_outline.min_y() || y > m_outline.max_y()) - { - return false; - } - m_scan_y = y; - m_styles.allocate(m_max_style - m_min_style + 2, 128); - allocate_master_alpha(); - return true; - } - - //------------------------------------------------------------------------ - template - bool rasterizer_compound_aa::hit_test(int tx, int ty) - { - if(!navigate_scanline(ty)) - { - return false; - } - - unsigned num_styles = sweep_styles(); - if(num_styles <= 0) - { - return false; - } - - scanline_hit_test sl(tx); - sweep_scanline(sl, -1); - return sl.hit(); + return false; } - //------------------------------------------------------------------------ - template - cover_type* rasterizer_compound_aa::allocate_cover_buffer(unsigned len) - { - m_cover_buf.allocate(len, 256); - return &m_cover_buf[0]; - } + scanline_hit_test sl(tx); + sweep_scanline(sl, -1); + return sl.hit(); +} - //------------------------------------------------------------------------ - template - void rasterizer_compound_aa::allocate_master_alpha() +//------------------------------------------------------------------------ +template +cover_type* rasterizer_compound_aa::allocate_cover_buffer(unsigned len) +{ + m_cover_buf.allocate(len, 256); + return &m_cover_buf[0]; +} + +//------------------------------------------------------------------------ +template +void rasterizer_compound_aa::allocate_master_alpha() +{ + while ((int)m_master_alpha.size() <= m_max_style) { - while((int)m_master_alpha.size() <= m_max_style) + m_master_alpha.add(aa_mask); + } +} + +//------------------------------------------------------------------------ +template +void rasterizer_compound_aa::master_alpha(int style, double alpha) +{ + if (style >= 0) + { + while ((int)m_master_alpha.size() <= style) { m_master_alpha.add(aa_mask); } + m_master_alpha[style] = uround(alpha * aa_mask); } - - //------------------------------------------------------------------------ - template - void rasterizer_compound_aa::master_alpha(int style, double alpha) - { - if(style >= 0) - { - while((int)m_master_alpha.size() <= style) - { - m_master_alpha.add(aa_mask); - } - m_master_alpha[style] = uround(alpha * aa_mask); - } - } - } - +} // namespace agg #endif - diff --git a/deps/agg/include/agg_rasterizer_outline.h b/deps/agg/include/agg_rasterizer_outline.h index 65203e34c..e6b63dbbf 100644 --- a/deps/agg/include/agg_rasterizer_outline.h +++ b/deps/agg/include/agg_rasterizer_outline.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -17,131 +17,116 @@ #include "agg_basics.h" -namespace agg +namespace agg { +//======================================================rasterizer_outline +template +class rasterizer_outline { - //======================================================rasterizer_outline - template class rasterizer_outline + public: + explicit rasterizer_outline(Renderer& ren) + : m_ren(&ren) + , m_start_x(0) + , m_start_y(0) + , m_vertices(0) + {} + void attach(Renderer& ren) { m_ren = &ren; } + + //-------------------------------------------------------------------- + void move_to(int x, int y) { - public: - explicit rasterizer_outline(Renderer& ren) : - m_ren(&ren), - m_start_x(0), - m_start_y(0), - m_vertices(0) - {} - void attach(Renderer& ren) { m_ren = &ren; } + m_vertices = 1; + m_ren->move_to(m_start_x = x, m_start_y = y); + } + //-------------------------------------------------------------------- + void line_to(int x, int y) + { + ++m_vertices; + m_ren->line_to(x, y); + } - //-------------------------------------------------------------------- - void move_to(int x, int y) + //-------------------------------------------------------------------- + void move_to_d(double x, double y) { move_to(m_ren->coord(x), m_ren->coord(y)); } + + //-------------------------------------------------------------------- + void line_to_d(double x, double y) { line_to(m_ren->coord(x), m_ren->coord(y)); } + + //-------------------------------------------------------------------- + void close() + { + if (m_vertices > 2) { - m_vertices = 1; - m_ren->move_to(m_start_x = x, m_start_y = y); + line_to(m_start_x, m_start_y); } + m_vertices = 0; + } - //-------------------------------------------------------------------- - void line_to(int x, int y) + //-------------------------------------------------------------------- + void add_vertex(double x, double y, unsigned cmd) + { + if (is_move_to(cmd)) { - ++m_vertices; - m_ren->line_to(x, y); + move_to_d(x, y); } - - //-------------------------------------------------------------------- - void move_to_d(double x, double y) + else { - move_to(m_ren->coord(x), m_ren->coord(y)); - } - - //-------------------------------------------------------------------- - void line_to_d(double x, double y) - { - line_to(m_ren->coord(x), m_ren->coord(y)); - } - - //-------------------------------------------------------------------- - void close() - { - if(m_vertices > 2) + if (is_end_poly(cmd)) { - line_to(m_start_x, m_start_y); + if (is_closed(cmd)) + close(); } - m_vertices = 0; - } - - //-------------------------------------------------------------------- - void add_vertex(double x, double y, unsigned cmd) - { - if(is_move_to(cmd)) + else { - move_to_d(x, y); - } - else - { - if(is_end_poly(cmd)) - { - if(is_closed(cmd)) close(); - } - else - { - line_to_d(x, y); - } + line_to_d(x, y); } } + } + //-------------------------------------------------------------------- + template + void add_path(VertexSource& vs, unsigned path_id = 0) + { + double x; + double y; - //-------------------------------------------------------------------- - template - void add_path(VertexSource& vs, unsigned path_id=0) + unsigned cmd; + vs.rewind(path_id); + while (!is_stop(cmd = vs.vertex(&x, &y))) { - double x; - double y; - - unsigned cmd; - vs.rewind(path_id); - while(!is_stop(cmd = vs.vertex(&x, &y))) - { - add_vertex(x, y, cmd); - } + add_vertex(x, y, cmd); } + } - - //-------------------------------------------------------------------- - template - void render_all_paths(VertexSource& vs, - const ColorStorage& colors, - const PathId& path_id, - unsigned num_paths) + //-------------------------------------------------------------------- + template + void render_all_paths(VertexSource& vs, const ColorStorage& colors, const PathId& path_id, unsigned num_paths) + { + for (unsigned i = 0; i < num_paths; i++) { - for(unsigned i = 0; i < num_paths; i++) - { - m_ren->line_color(colors[i]); - add_path(vs, path_id[i]); - } + m_ren->line_color(colors[i]); + add_path(vs, path_id[i]); } + } - - //-------------------------------------------------------------------- - template void render_ctrl(Ctrl& c) + //-------------------------------------------------------------------- + template + void render_ctrl(Ctrl& c) + { + unsigned i; + for (i = 0; i < c.num_paths(); i++) { - unsigned i; - for(i = 0; i < c.num_paths(); i++) - { - m_ren->line_color(c.color(i)); - add_path(c, i); - } + m_ren->line_color(c.color(i)); + add_path(c, i); } + } + private: + Renderer* m_ren; + int m_start_x; + int m_start_y; + unsigned m_vertices; +}; - private: - Renderer* m_ren; - int m_start_x; - int m_start_y; - unsigned m_vertices; - }; - - -} - +} // namespace agg #endif - diff --git a/deps/agg/include/agg_rasterizer_outline_aa.h b/deps/agg/include/agg_rasterizer_outline_aa.h index 538321c9d..8b458dd5d 100644 --- a/deps/agg/include/agg_rasterizer_outline_aa.h +++ b/deps/agg/include/agg_rasterizer_outline_aa.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -19,275 +19,254 @@ #include "agg_line_aa_basics.h" #include "agg_vertex_sequence.h" -namespace agg +namespace agg { + +//------------------------------------------------------------------------- +inline bool cmp_dist_start(int d) { + return d > 0; +} +inline bool cmp_dist_end(int d) +{ + return d <= 0; +} - //------------------------------------------------------------------------- - inline bool cmp_dist_start(int d) { return d > 0; } - inline bool cmp_dist_end(int d) { return d <= 0; } +//-----------------------------------------------------------line_aa_vertex +// Vertex (x, y) with the distance to the next one. The last vertex has +// the distance between the last and the first points +struct line_aa_vertex +{ + int x; + int y; + int len; + line_aa_vertex() {} + line_aa_vertex(int x_, int y_) + : x(x_) + , y(y_) + , len(0) + {} - - //-----------------------------------------------------------line_aa_vertex - // Vertex (x, y) with the distance to the next one. The last vertex has - // the distance between the last and the first points - struct line_aa_vertex + bool operator()(const line_aa_vertex& val) { - int x; - int y; - int len; + double dx = val.x - x; + double dy = val.y - y; + return (len = uround(sqrt(dx * dx + dy * dy))) > (line_subpixel_scale + line_subpixel_scale / 2); + } +}; - line_aa_vertex() {} - line_aa_vertex(int x_, int y_) : - x(x_), - y(y_), - len(0) - { - } +//----------------------------------------------------------outline_aa_join_e +enum outline_aa_join_e { + outline_no_join, //-----outline_no_join + outline_miter_join, //-----outline_miter_join + outline_round_join, //-----outline_round_join + outline_miter_accurate_join //-----outline_accurate_join +}; - bool operator () (const line_aa_vertex& val) - { - double dx = val.x - x; - double dy = val.y - y; - return (len = uround(sqrt(dx * dx + dy * dy))) > - (line_subpixel_scale + line_subpixel_scale / 2); - } +//=======================================================rasterizer_outline_aa +template +class rasterizer_outline_aa +{ + private: + //------------------------------------------------------------------------ + struct draw_vars + { + unsigned idx; + int x1, y1, x2, y2; + line_parameters curr, next; + int lcurr, lnext; + int xb1, yb1, xb2, yb2; + unsigned flags; }; + void draw(draw_vars& dv, unsigned start, unsigned end); - //----------------------------------------------------------outline_aa_join_e - enum outline_aa_join_e + public: + typedef line_aa_vertex vertex_type; + typedef vertex_sequence vertex_storage_type; + + explicit rasterizer_outline_aa(Renderer& ren) + : m_ren(&ren) + , m_line_join(ren.accurate_join_only() ? outline_miter_accurate_join : outline_round_join) + , m_round_cap(false) + , m_start_x(0) + , m_start_y(0) + {} + void attach(Renderer& ren) { m_ren = &ren; } + + //------------------------------------------------------------------------ + void line_join(outline_aa_join_e join) { - outline_no_join, //-----outline_no_join - outline_miter_join, //-----outline_miter_join - outline_round_join, //-----outline_round_join - outline_miter_accurate_join //-----outline_accurate_join - }; + m_line_join = m_ren->accurate_join_only() ? outline_miter_accurate_join : join; + } + bool line_join() const { return m_line_join; } - //=======================================================rasterizer_outline_aa - template class rasterizer_outline_aa + //------------------------------------------------------------------------ + void round_cap(bool v) { m_round_cap = v; } + bool round_cap() const { return m_round_cap; } + + //------------------------------------------------------------------------ + void move_to(int x, int y) { m_src_vertices.modify_last(vertex_type(m_start_x = x, m_start_y = y)); } + + //------------------------------------------------------------------------ + void line_to(int x, int y) { m_src_vertices.add(vertex_type(x, y)); } + + //------------------------------------------------------------------------ + void move_to_d(double x, double y) { move_to(Coord::conv(x), Coord::conv(y)); } + + //------------------------------------------------------------------------ + void line_to_d(double x, double y) { line_to(Coord::conv(x), Coord::conv(y)); } + + //------------------------------------------------------------------------ + void render(bool close_polygon); + + //------------------------------------------------------------------------ + void add_vertex(double x, double y, unsigned cmd) { - private: - //------------------------------------------------------------------------ - struct draw_vars + if (is_move_to(cmd)) { - unsigned idx; - int x1, y1, x2, y2; - line_parameters curr, next; - int lcurr, lnext; - int xb1, yb1, xb2, yb2; - unsigned flags; - }; - - void draw(draw_vars& dv, unsigned start, unsigned end); - - public: - typedef line_aa_vertex vertex_type; - typedef vertex_sequence vertex_storage_type; - - explicit rasterizer_outline_aa(Renderer& ren) : - m_ren(&ren), - m_line_join(ren.accurate_join_only() ? - outline_miter_accurate_join : - outline_round_join), - m_round_cap(false), - m_start_x(0), - m_start_y(0) - {} - void attach(Renderer& ren) { m_ren = &ren; } - - //------------------------------------------------------------------------ - void line_join(outline_aa_join_e join) - { - m_line_join = m_ren->accurate_join_only() ? - outline_miter_accurate_join : - join; - } - bool line_join() const { return m_line_join; } - - //------------------------------------------------------------------------ - void round_cap(bool v) { m_round_cap = v; } - bool round_cap() const { return m_round_cap; } - - //------------------------------------------------------------------------ - void move_to(int x, int y) - { - m_src_vertices.modify_last(vertex_type(m_start_x = x, m_start_y = y)); - } - - //------------------------------------------------------------------------ - void line_to(int x, int y) - { - m_src_vertices.add(vertex_type(x, y)); - } - - //------------------------------------------------------------------------ - void move_to_d(double x, double y) - { - move_to(Coord::conv(x), Coord::conv(y)); - } - - //------------------------------------------------------------------------ - void line_to_d(double x, double y) - { - line_to(Coord::conv(x), Coord::conv(y)); - } - - //------------------------------------------------------------------------ - void render(bool close_polygon); - - //------------------------------------------------------------------------ - void add_vertex(double x, double y, unsigned cmd) - { - if(is_move_to(cmd)) - { - render(false); - move_to_d(x, y); - } - else - { - if(is_end_poly(cmd)) - { - render(is_closed(cmd)); - if(is_closed(cmd)) - { - move_to(m_start_x, m_start_y); - } - } - else - { - line_to_d(x, y); - } - } - } - - //------------------------------------------------------------------------ - template - void add_path(VertexSource& vs, unsigned path_id=0) - { - double x; - double y; - - unsigned cmd; - vs.rewind(path_id); - while(!is_stop(cmd = vs.vertex(&x, &y))) - { - add_vertex(x, y, cmd); - } render(false); + move_to_d(x, y); } - - - //------------------------------------------------------------------------ - template - void render_all_paths(VertexSource& vs, - const ColorStorage& colors, - const PathId& path_id, - unsigned num_paths) + else { - for(unsigned i = 0; i < num_paths; i++) + if (is_end_poly(cmd)) { - m_ren->color(colors[i]); - add_path(vs, path_id[i]); + render(is_closed(cmd)); + if (is_closed(cmd)) + { + move_to(m_start_x, m_start_y); + } + } + else + { + line_to_d(x, y); } } + } + //------------------------------------------------------------------------ + template + void add_path(VertexSource& vs, unsigned path_id = 0) + { + double x; + double y; - //------------------------------------------------------------------------ - template void render_ctrl(Ctrl& c) + unsigned cmd; + vs.rewind(path_id); + while (!is_stop(cmd = vs.vertex(&x, &y))) { - unsigned i; - for(i = 0; i < c.num_paths(); i++) - { - m_ren->color(c.color(i)); - add_path(c, i); - } + add_vertex(x, y, cmd); } + render(false); + } - private: - rasterizer_outline_aa(const rasterizer_outline_aa&); - const rasterizer_outline_aa& operator = - (const rasterizer_outline_aa&); + //------------------------------------------------------------------------ + template + void render_all_paths(VertexSource& vs, const ColorStorage& colors, const PathId& path_id, unsigned num_paths) + { + for (unsigned i = 0; i < num_paths; i++) + { + m_ren->color(colors[i]); + add_path(vs, path_id[i]); + } + } - Renderer* m_ren; - vertex_storage_type m_src_vertices; - outline_aa_join_e m_line_join; - bool m_round_cap; - int m_start_x; - int m_start_y; - }; - - - - - - - - - //---------------------------------------------------------------------------- - template - void rasterizer_outline_aa::draw(draw_vars& dv, - unsigned start, - unsigned end) + //------------------------------------------------------------------------ + template + void render_ctrl(Ctrl& c) { unsigned i; - const vertex_storage_type::value_type* v; - - for(i = start; i < end; i++) + for (i = 0; i < c.num_paths(); i++) { - if(m_line_join == outline_round_join) - { - dv.xb1 = dv.curr.x1 + (dv.curr.y2 - dv.curr.y1); - dv.yb1 = dv.curr.y1 - (dv.curr.x2 - dv.curr.x1); - dv.xb2 = dv.curr.x2 + (dv.curr.y2 - dv.curr.y1); - dv.yb2 = dv.curr.y2 - (dv.curr.x2 - dv.curr.x1); - } + m_ren->color(c.color(i)); + add_path(c, i); + } + } - switch(dv.flags) - { - case 0: m_ren->line3(dv.curr, dv.xb1, dv.yb1, dv.xb2, dv.yb2); break; - case 1: m_ren->line2(dv.curr, dv.xb2, dv.yb2); break; - case 2: m_ren->line1(dv.curr, dv.xb1, dv.yb1); break; - case 3: m_ren->line0(dv.curr); break; - } + private: + rasterizer_outline_aa(const rasterizer_outline_aa&); + const rasterizer_outline_aa& operator=(const rasterizer_outline_aa&); - if(m_line_join == outline_round_join && (dv.flags & 2) == 0) - { - m_ren->pie(dv.curr.x2, dv.curr.y2, - dv.curr.x2 + (dv.curr.y2 - dv.curr.y1), - dv.curr.y2 - (dv.curr.x2 - dv.curr.x1), - dv.curr.x2 + (dv.next.y2 - dv.next.y1), - dv.curr.y2 - (dv.next.x2 - dv.next.x1)); - } + Renderer* m_ren; + vertex_storage_type m_src_vertices; + outline_aa_join_e m_line_join; + bool m_round_cap; + int m_start_x; + int m_start_y; +}; - dv.x1 = dv.x2; - dv.y1 = dv.y2; - dv.lcurr = dv.lnext; - dv.lnext = m_src_vertices[dv.idx].len; +//---------------------------------------------------------------------------- +template +void rasterizer_outline_aa::draw(draw_vars& dv, unsigned start, unsigned end) +{ + unsigned i; + const vertex_storage_type::value_type* v; - ++dv.idx; - if(dv.idx >= m_src_vertices.size()) dv.idx = 0; + for (i = start; i < end; i++) + { + if (m_line_join == outline_round_join) + { + dv.xb1 = dv.curr.x1 + (dv.curr.y2 - dv.curr.y1); + dv.yb1 = dv.curr.y1 - (dv.curr.x2 - dv.curr.x1); + dv.xb2 = dv.curr.x2 + (dv.curr.y2 - dv.curr.y1); + dv.yb2 = dv.curr.y2 - (dv.curr.x2 - dv.curr.x1); + } - v = &m_src_vertices[dv.idx]; - dv.x2 = v->x; - dv.y2 = v->y; + switch (dv.flags) + { + case 0: + m_ren->line3(dv.curr, dv.xb1, dv.yb1, dv.xb2, dv.yb2); + break; + case 1: + m_ren->line2(dv.curr, dv.xb2, dv.yb2); + break; + case 2: + m_ren->line1(dv.curr, dv.xb1, dv.yb1); + break; + case 3: + m_ren->line0(dv.curr); + break; + } - dv.curr = dv.next; - dv.next = line_parameters(dv.x1, dv.y1, dv.x2, dv.y2, dv.lnext); - dv.xb1 = dv.xb2; - dv.yb1 = dv.yb2; + if (m_line_join == outline_round_join && (dv.flags & 2) == 0) + { + m_ren->pie(dv.curr.x2, + dv.curr.y2, + dv.curr.x2 + (dv.curr.y2 - dv.curr.y1), + dv.curr.y2 - (dv.curr.x2 - dv.curr.x1), + dv.curr.x2 + (dv.next.y2 - dv.next.y1), + dv.curr.y2 - (dv.next.x2 - dv.next.x1)); + } - switch(m_line_join) - { + dv.x1 = dv.x2; + dv.y1 = dv.y2; + dv.lcurr = dv.lnext; + dv.lnext = m_src_vertices[dv.idx].len; + + ++dv.idx; + if (dv.idx >= m_src_vertices.size()) + dv.idx = 0; + + v = &m_src_vertices[dv.idx]; + dv.x2 = v->x; + dv.y2 = v->y; + + dv.curr = dv.next; + dv.next = line_parameters(dv.x1, dv.y1, dv.x2, dv.y2, dv.lnext); + dv.xb1 = dv.xb2; + dv.yb1 = dv.yb2; + + switch (m_line_join) + { case outline_no_join: dv.flags = 3; break; case outline_miter_join: dv.flags >>= 1; - dv.flags |= ((dv.curr.diagonal_quadrant() == - dv.next.diagonal_quadrant()) << 1); - if((dv.flags & 2) == 0) + dv.flags |= ((dv.curr.diagonal_quadrant() == dv.next.diagonal_quadrant()) << 1); + if ((dv.flags & 2) == 0) { bisectrix(dv.curr, dv.next, &dv.xb2, &dv.yb2); } @@ -295,302 +274,282 @@ namespace agg case outline_round_join: dv.flags >>= 1; - dv.flags |= ((dv.curr.diagonal_quadrant() == - dv.next.diagonal_quadrant()) << 1); + dv.flags |= ((dv.curr.diagonal_quadrant() == dv.next.diagonal_quadrant()) << 1); break; case outline_miter_accurate_join: dv.flags = 0; bisectrix(dv.curr, dv.next, &dv.xb2, &dv.yb2); break; - } } } +} +//---------------------------------------------------------------------------- +template +void rasterizer_outline_aa::render(bool close_polygon) +{ + m_src_vertices.close(close_polygon); + draw_vars dv; + const vertex_storage_type::value_type* v; + int x1; + int y1; + int x2; + int y2; + int lprev; - - - //---------------------------------------------------------------------------- - template - void rasterizer_outline_aa::render(bool close_polygon) + if (close_polygon && (m_src_vertices.size() >= 3)) { - m_src_vertices.close(close_polygon); - draw_vars dv; - const vertex_storage_type::value_type* v; - int x1; - int y1; - int x2; - int y2; - int lprev; + dv.idx = 2; - if(close_polygon && (m_src_vertices.size() >= 3)) + v = &m_src_vertices[m_src_vertices.size() - 1]; + x1 = v->x; + y1 = v->y; + lprev = v->len; + + v = &m_src_vertices[0]; + x2 = v->x; + y2 = v->y; + dv.lcurr = v->len; + line_parameters prev(x1, y1, x2, y2, lprev); + + v = &m_src_vertices[1]; + dv.x1 = v->x; + dv.y1 = v->y; + dv.lnext = v->len; + dv.curr = line_parameters(x2, y2, dv.x1, dv.y1, dv.lcurr); + + v = &m_src_vertices[dv.idx]; + dv.x2 = v->x; + dv.y2 = v->y; + dv.next = line_parameters(dv.x1, dv.y1, dv.x2, dv.y2, dv.lnext); + + dv.xb1 = 0; + dv.yb1 = 0; + dv.xb2 = 0; + dv.yb2 = 0; + + switch (m_line_join) { - dv.idx = 2; - - v = &m_src_vertices[m_src_vertices.size() - 1]; - x1 = v->x; - y1 = v->y; - lprev = v->len; - - v = &m_src_vertices[0]; - x2 = v->x; - y2 = v->y; - dv.lcurr = v->len; - line_parameters prev(x1, y1, x2, y2, lprev); - - v = &m_src_vertices[1]; - dv.x1 = v->x; - dv.y1 = v->y; - dv.lnext = v->len; - dv.curr = line_parameters(x2, y2, dv.x1, dv.y1, dv.lcurr); - - v = &m_src_vertices[dv.idx]; - dv.x2 = v->x; - dv.y2 = v->y; - dv.next = line_parameters(dv.x1, dv.y1, dv.x2, dv.y2, dv.lnext); - - dv.xb1 = 0; - dv.yb1 = 0; - dv.xb2 = 0; - dv.yb2 = 0; - - switch(m_line_join) - { case outline_no_join: dv.flags = 3; break; case outline_miter_join: case outline_round_join: - dv.flags = - (prev.diagonal_quadrant() == dv.curr.diagonal_quadrant()) | - ((dv.curr.diagonal_quadrant() == dv.next.diagonal_quadrant()) << 1); + dv.flags = (prev.diagonal_quadrant() == dv.curr.diagonal_quadrant()) | + ((dv.curr.diagonal_quadrant() == dv.next.diagonal_quadrant()) << 1); break; case outline_miter_accurate_join: dv.flags = 0; break; - } - - if((dv.flags & 1) == 0 && m_line_join != outline_round_join) - { - bisectrix(prev, dv.curr, &dv.xb1, &dv.yb1); - } - - if((dv.flags & 2) == 0 && m_line_join != outline_round_join) - { - bisectrix(dv.curr, dv.next, &dv.xb2, &dv.yb2); - } - draw(dv, 0, m_src_vertices.size()); } - else + + if ((dv.flags & 1) == 0 && m_line_join != outline_round_join) { - switch(m_src_vertices.size()) - { - case 0: - case 1: - break; + bisectrix(prev, dv.curr, &dv.xb1, &dv.yb1); + } - case 2: - { - v = &m_src_vertices[0]; - x1 = v->x; - y1 = v->y; - lprev = v->len; - v = &m_src_vertices[1]; - x2 = v->x; - y2 = v->y; - line_parameters lp(x1, y1, x2, y2, lprev); - if(m_round_cap) - { - m_ren->semidot(cmp_dist_start, x1, y1, x1 + (y2 - y1), y1 - (x2 - x1)); - } - m_ren->line3(lp, - x1 + (y2 - y1), - y1 - (x2 - x1), - x2 + (y2 - y1), - y2 - (x2 - x1)); - if(m_round_cap) - { - m_ren->semidot(cmp_dist_end, x2, y2, x2 + (y2 - y1), y2 - (x2 - x1)); - } - } + if ((dv.flags & 2) == 0 && m_line_join != outline_round_join) + { + bisectrix(dv.curr, dv.next, &dv.xb2, &dv.yb2); + } + draw(dv, 0, m_src_vertices.size()); + } + else + { + switch (m_src_vertices.size()) + { + case 0: + case 1: break; - case 3: + case 2: { + v = &m_src_vertices[0]; + x1 = v->x; + y1 = v->y; + lprev = v->len; + v = &m_src_vertices[1]; + x2 = v->x; + y2 = v->y; + line_parameters lp(x1, y1, x2, y2, lprev); + if (m_round_cap) { - int x3, y3; - int lnext; - v = &m_src_vertices[0]; - x1 = v->x; - y1 = v->y; - lprev = v->len; - v = &m_src_vertices[1]; - x2 = v->x; - y2 = v->y; - lnext = v->len; - v = &m_src_vertices[2]; - x3 = v->x; - y3 = v->y; - line_parameters lp1(x1, y1, x2, y2, lprev); - line_parameters lp2(x2, y2, x3, y3, lnext); - - if(m_round_cap) - { - m_ren->semidot(cmp_dist_start, x1, y1, x1 + (y2 - y1), y1 - (x2 - x1)); - } - - if(m_line_join == outline_round_join) - { - m_ren->line3(lp1, x1 + (y2 - y1), y1 - (x2 - x1), - x2 + (y2 - y1), y2 - (x2 - x1)); - - m_ren->pie(x2, y2, x2 + (y2 - y1), y2 - (x2 - x1), - x2 + (y3 - y2), y2 - (x3 - x2)); - - m_ren->line3(lp2, x2 + (y3 - y2), y2 - (x3 - x2), - x3 + (y3 - y2), y3 - (x3 - x2)); - } - else - { - bisectrix(lp1, lp2, &dv.xb1, &dv.yb1); - m_ren->line3(lp1, x1 + (y2 - y1), y1 - (x2 - x1), - dv.xb1, dv.yb1); - - m_ren->line3(lp2, dv.xb1, dv.yb1, - x3 + (y3 - y2), y3 - (x3 - x2)); - } - if(m_round_cap) - { - m_ren->semidot(cmp_dist_end, x3, y3, x3 + (y3 - y2), y3 - (x3 - x2)); - } + m_ren->semidot(cmp_dist_start, x1, y1, x1 + (y2 - y1), y1 - (x2 - x1)); } - break; - - default: + m_ren->line3(lp, x1 + (y2 - y1), y1 - (x2 - x1), x2 + (y2 - y1), y2 - (x2 - x1)); + if (m_round_cap) { - dv.idx = 3; + m_ren->semidot(cmp_dist_end, x2, y2, x2 + (y2 - y1), y2 - (x2 - x1)); + } + } + break; - v = &m_src_vertices[0]; - x1 = v->x; - y1 = v->y; - lprev = v->len; + case 3: { + int x3, y3; + int lnext; + v = &m_src_vertices[0]; + x1 = v->x; + y1 = v->y; + lprev = v->len; + v = &m_src_vertices[1]; + x2 = v->x; + y2 = v->y; + lnext = v->len; + v = &m_src_vertices[2]; + x3 = v->x; + y3 = v->y; + line_parameters lp1(x1, y1, x2, y2, lprev); + line_parameters lp2(x2, y2, x3, y3, lnext); - v = &m_src_vertices[1]; - x2 = v->x; - y2 = v->y; - dv.lcurr = v->len; - line_parameters prev(x1, y1, x2, y2, lprev); + if (m_round_cap) + { + m_ren->semidot(cmp_dist_start, x1, y1, x1 + (y2 - y1), y1 - (x2 - x1)); + } - v = &m_src_vertices[2]; - dv.x1 = v->x; - dv.y1 = v->y; - dv.lnext = v->len; - dv.curr = line_parameters(x2, y2, dv.x1, dv.y1, dv.lcurr); + if (m_line_join == outline_round_join) + { + m_ren->line3(lp1, x1 + (y2 - y1), y1 - (x2 - x1), x2 + (y2 - y1), y2 - (x2 - x1)); - v = &m_src_vertices[dv.idx]; - dv.x2 = v->x; - dv.y2 = v->y; - dv.next = line_parameters(dv.x1, dv.y1, dv.x2, dv.y2, dv.lnext); + m_ren->pie(x2, y2, x2 + (y2 - y1), y2 - (x2 - x1), x2 + (y3 - y2), y2 - (x3 - x2)); - dv.xb1 = 0; - dv.yb1 = 0; - dv.xb2 = 0; - dv.yb2 = 0; + m_ren->line3(lp2, x2 + (y3 - y2), y2 - (x3 - x2), x3 + (y3 - y2), y3 - (x3 - x2)); + } + else + { + bisectrix(lp1, lp2, &dv.xb1, &dv.yb1); + m_ren->line3(lp1, x1 + (y2 - y1), y1 - (x2 - x1), dv.xb1, dv.yb1); - switch(m_line_join) - { + m_ren->line3(lp2, dv.xb1, dv.yb1, x3 + (y3 - y2), y3 - (x3 - x2)); + } + if (m_round_cap) + { + m_ren->semidot(cmp_dist_end, x3, y3, x3 + (y3 - y2), y3 - (x3 - x2)); + } + } + break; + + default: { + dv.idx = 3; + + v = &m_src_vertices[0]; + x1 = v->x; + y1 = v->y; + lprev = v->len; + + v = &m_src_vertices[1]; + x2 = v->x; + y2 = v->y; + dv.lcurr = v->len; + line_parameters prev(x1, y1, x2, y2, lprev); + + v = &m_src_vertices[2]; + dv.x1 = v->x; + dv.y1 = v->y; + dv.lnext = v->len; + dv.curr = line_parameters(x2, y2, dv.x1, dv.y1, dv.lcurr); + + v = &m_src_vertices[dv.idx]; + dv.x2 = v->x; + dv.y2 = v->y; + dv.next = line_parameters(dv.x1, dv.y1, dv.x2, dv.y2, dv.lnext); + + dv.xb1 = 0; + dv.yb1 = 0; + dv.xb2 = 0; + dv.yb2 = 0; + + switch (m_line_join) + { case outline_no_join: dv.flags = 3; break; case outline_miter_join: case outline_round_join: - dv.flags = - (prev.diagonal_quadrant() == dv.curr.diagonal_quadrant()) | - ((dv.curr.diagonal_quadrant() == dv.next.diagonal_quadrant()) << 1); + dv.flags = (prev.diagonal_quadrant() == dv.curr.diagonal_quadrant()) | + ((dv.curr.diagonal_quadrant() == dv.next.diagonal_quadrant()) << 1); break; case outline_miter_accurate_join: dv.flags = 0; break; - } + } - if(m_round_cap) + if (m_round_cap) + { + m_ren->semidot(cmp_dist_start, x1, y1, x1 + (y2 - y1), y1 - (x2 - x1)); + } + if ((dv.flags & 1) == 0) + { + if (m_line_join == outline_round_join) { - m_ren->semidot(cmp_dist_start, x1, y1, x1 + (y2 - y1), y1 - (x2 - x1)); - } - if((dv.flags & 1) == 0) - { - if(m_line_join == outline_round_join) - { - m_ren->line3(prev, x1 + (y2 - y1), y1 - (x2 - x1), - x2 + (y2 - y1), y2 - (x2 - x1)); - m_ren->pie(prev.x2, prev.y2, - x2 + (y2 - y1), y2 - (x2 - x1), - dv.curr.x1 + (dv.curr.y2 - dv.curr.y1), - dv.curr.y1 - (dv.curr.x2 - dv.curr.x1)); - } - else - { - bisectrix(prev, dv.curr, &dv.xb1, &dv.yb1); - m_ren->line3(prev, x1 + (y2 - y1), y1 - (x2 - x1), - dv.xb1, dv.yb1); - } + m_ren->line3(prev, x1 + (y2 - y1), y1 - (x2 - x1), x2 + (y2 - y1), y2 - (x2 - x1)); + m_ren->pie(prev.x2, + prev.y2, + x2 + (y2 - y1), + y2 - (x2 - x1), + dv.curr.x1 + (dv.curr.y2 - dv.curr.y1), + dv.curr.y1 - (dv.curr.x2 - dv.curr.x1)); } else { - m_ren->line1(prev, - x1 + (y2 - y1), - y1 - (x2 - x1)); - } - if((dv.flags & 2) == 0 && m_line_join != outline_round_join) - { - bisectrix(dv.curr, dv.next, &dv.xb2, &dv.yb2); + bisectrix(prev, dv.curr, &dv.xb1, &dv.yb1); + m_ren->line3(prev, x1 + (y2 - y1), y1 - (x2 - x1), dv.xb1, dv.yb1); } + } + else + { + m_ren->line1(prev, x1 + (y2 - y1), y1 - (x2 - x1)); + } + if ((dv.flags & 2) == 0 && m_line_join != outline_round_join) + { + bisectrix(dv.curr, dv.next, &dv.xb2, &dv.yb2); + } - draw(dv, 1, m_src_vertices.size() - 2); + draw(dv, 1, m_src_vertices.size() - 2); - if((dv.flags & 1) == 0) + if ((dv.flags & 1) == 0) + { + if (m_line_join == outline_round_join) { - if(m_line_join == outline_round_join) - { - m_ren->line3(dv.curr, - dv.curr.x1 + (dv.curr.y2 - dv.curr.y1), - dv.curr.y1 - (dv.curr.x2 - dv.curr.x1), - dv.curr.x2 + (dv.curr.y2 - dv.curr.y1), - dv.curr.y2 - (dv.curr.x2 - dv.curr.x1)); - } - else - { - m_ren->line3(dv.curr, dv.xb1, dv.yb1, - dv.curr.x2 + (dv.curr.y2 - dv.curr.y1), - dv.curr.y2 - (dv.curr.x2 - dv.curr.x1)); - } - } - else - { - m_ren->line2(dv.curr, - dv.curr.x2 + (dv.curr.y2 - dv.curr.y1), + m_ren->line3(dv.curr, + dv.curr.x1 + (dv.curr.y2 - dv.curr.y1), + dv.curr.y1 - (dv.curr.x2 - dv.curr.x1), + dv.curr.x2 + (dv.curr.y2 - dv.curr.y1), dv.curr.y2 - (dv.curr.x2 - dv.curr.x1)); } - if(m_round_cap) + else { - m_ren->semidot(cmp_dist_end, dv.curr.x2, dv.curr.y2, - dv.curr.x2 + (dv.curr.y2 - dv.curr.y1), - dv.curr.y2 - (dv.curr.x2 - dv.curr.x1)); + m_ren->line3(dv.curr, + dv.xb1, + dv.yb1, + dv.curr.x2 + (dv.curr.y2 - dv.curr.y1), + dv.curr.y2 - (dv.curr.x2 - dv.curr.x1)); } - } - break; + else + { + m_ren->line2(dv.curr, + dv.curr.x2 + (dv.curr.y2 - dv.curr.y1), + dv.curr.y2 - (dv.curr.x2 - dv.curr.x1)); + } + if (m_round_cap) + { + m_ren->semidot(cmp_dist_end, + dv.curr.x2, + dv.curr.y2, + dv.curr.x2 + (dv.curr.y2 - dv.curr.y1), + dv.curr.y2 - (dv.curr.x2 - dv.curr.x1)); + } } + break; } - m_src_vertices.remove_all(); } - - + m_src_vertices.remove_all(); } +} // namespace agg #endif - diff --git a/deps/agg/include/agg_rasterizer_scanline_aa.h b/deps/agg/include/agg_rasterizer_scanline_aa.h index b2d4e3e12..3ed8dacae 100644 --- a/deps/agg/include/agg_rasterizer_scanline_aa.h +++ b/deps/agg/include/agg_rasterizer_scanline_aa.h @@ -33,477 +33,445 @@ #include "agg_rasterizer_sl_clip.h" #include "agg_gamma_functions.h" +namespace agg { -namespace agg +//-----------------------------------------------------------------cell_aa +// A pixel cell. There're no constructors defined and it was done +// intentionally in order to avoid extra overhead when allocating an +// array of cells. +struct cell_aa { + int x; + int y; + int cover; + int area; - - //-----------------------------------------------------------------cell_aa - // A pixel cell. There're no constructors defined and it was done - // intentionally in order to avoid extra overhead when allocating an - // array of cells. - struct cell_aa + void initial() { - int x; - int y; - int cover; - int area; + x = 0x7FFFFFFF; + y = 0x7FFFFFFF; + cover = 0; + area = 0; + } - void initial() - { - x = 0x7FFFFFFF; - y = 0x7FFFFFFF; - cover = 0; - area = 0; - } + void style(const cell_aa&) {} - void style(const cell_aa&) {} + int not_equal(int ex, int ey, const cell_aa&) const { return (ex - x) | (ey - y); } +}; - int not_equal(int ex, int ey, const cell_aa&) const - { - return (ex - x) | (ey - y); - } +//==================================================rasterizer_scanline_aa +// Polygon rasterizer that is used to render filled polygons with +// high-quality Anti-Aliasing. Internally, by default, the class uses +// integer coordinates in format 24.8, i.e. 24 bits for integer part +// and 8 bits for fractional - see poly_subpixel_shift. This class can be +// used in the following way: +// +// 1. filling_rule(filling_rule_e ft) - optional. +// +// 2. gamma() - optional. +// +// 3. reset() +// +// 4. move_to(x, y) / line_to(x, y) - make the polygon. One can create +// more than one contour, but each contour must consist of at least 3 +// vertices, i.e. move_to(x1, y1); line_to(x2, y2); line_to(x3, y3); +// is the absolute minimum of vertices that define a triangle. +// The algorithm does not check either the number of vertices nor +// coincidence of their coordinates, but in the worst case it just +// won't draw anything. +// The orger of the vertices (clockwise or counterclockwise) +// is important when using the non-zero filling rule (fill_non_zero). +// In this case the vertex order of all the contours must be the same +// if you want your intersecting polygons to be without "holes". +// You actually can use different vertices order. If the contours do not +// intersect each other the order is not important anyway. If they do, +// contours with the same vertex order will be rendered without "holes" +// while the intersecting contours with different orders will have "holes". +// +// filling_rule() and gamma() can be called anytime before "sweeping". +//------------------------------------------------------------------------ +template +class rasterizer_scanline_aa +{ + enum status { status_initial, status_move_to, status_line_to, status_closed }; + + public: + typedef Clip clip_type; + typedef typename Clip::conv_type conv_type; + typedef typename Clip::coord_type coord_type; + + enum aa_scale_e { + aa_shift = 8, + aa_scale = 1 << aa_shift, + aa_mask = aa_scale - 1, + aa_scale2 = aa_scale * 2, + aa_mask2 = aa_scale2 - 1 }; - - //==================================================rasterizer_scanline_aa - // Polygon rasterizer that is used to render filled polygons with - // high-quality Anti-Aliasing. Internally, by default, the class uses - // integer coordinates in format 24.8, i.e. 24 bits for integer part - // and 8 bits for fractional - see poly_subpixel_shift. This class can be - // used in the following way: - // - // 1. filling_rule(filling_rule_e ft) - optional. - // - // 2. gamma() - optional. - // - // 3. reset() - // - // 4. move_to(x, y) / line_to(x, y) - make the polygon. One can create - // more than one contour, but each contour must consist of at least 3 - // vertices, i.e. move_to(x1, y1); line_to(x2, y2); line_to(x3, y3); - // is the absolute minimum of vertices that define a triangle. - // The algorithm does not check either the number of vertices nor - // coincidence of their coordinates, but in the worst case it just - // won't draw anything. - // The orger of the vertices (clockwise or counterclockwise) - // is important when using the non-zero filling rule (fill_non_zero). - // In this case the vertex order of all the contours must be the same - // if you want your intersecting polygons to be without "holes". - // You actually can use different vertices order. If the contours do not - // intersect each other the order is not important anyway. If they do, - // contours with the same vertex order will be rendered without "holes" - // while the intersecting contours with different orders will have "holes". - // - // filling_rule() and gamma() can be called anytime before "sweeping". - //------------------------------------------------------------------------ - template class rasterizer_scanline_aa + //-------------------------------------------------------------------- + rasterizer_scanline_aa() + : m_outline() + , m_clipper() + , m_filling_rule(fill_non_zero) + , m_auto_close(true) + , m_start_x(0) + , m_start_y(0) + , m_status(status_initial) { - enum status - { - status_initial, - status_move_to, - status_line_to, - status_closed - }; + int i; + for (i = 0; i < aa_scale; i++) + m_gamma[i] = i; + } - public: - typedef Clip clip_type; - typedef typename Clip::conv_type conv_type; - typedef typename Clip::coord_type coord_type; + //-------------------------------------------------------------------- + template + rasterizer_scanline_aa(const GammaF& gamma_function) + : m_outline() + , m_clipper(m_outline) + , m_filling_rule(fill_non_zero) + , m_auto_close(true) + , m_start_x(0) + , m_start_y(0) + , m_status(status_initial) + { + gamma(gamma_function); + } - enum aa_scale_e - { - aa_shift = 8, - aa_scale = 1 << aa_shift, - aa_mask = aa_scale - 1, - aa_scale2 = aa_scale * 2, - aa_mask2 = aa_scale2 - 1 - }; + //-------------------------------------------------------------------- + void reset(); + void reset_clipping(); + void clip_box(double x1, double y1, double x2, double y2); + void filling_rule(filling_rule_e filling_rule); + void auto_close(bool flag) { m_auto_close = flag; } - //-------------------------------------------------------------------- - rasterizer_scanline_aa() : - m_outline(), - m_clipper(), - m_filling_rule(fill_non_zero), - m_auto_close(true), - m_start_x(0), - m_start_y(0), - m_status(status_initial) + //-------------------------------------------------------------------- + template + void gamma(const GammaF& gamma_function) + { + int i; + for (i = 0; i < aa_scale; i++) { - int i; - for(i = 0; i < aa_scale; i++) m_gamma[i] = i; + m_gamma[i] = uround(gamma_function(double(i) / aa_mask) * aa_mask); } + } - //-------------------------------------------------------------------- - template - rasterizer_scanline_aa(const GammaF& gamma_function) : - m_outline(), - m_clipper(m_outline), - m_filling_rule(fill_non_zero), - m_auto_close(true), - m_start_x(0), - m_start_y(0), - m_status(status_initial) + //-------------------------------------------------------------------- + unsigned apply_gamma(unsigned cover) const { return m_gamma[cover]; } + + //-------------------------------------------------------------------- + void move_to(int x, int y); + void line_to(int x, int y); + void move_to_d(double x, double y); + void line_to_d(double x, double y); + void close_polygon(); + void add_vertex(double x, double y, unsigned cmd); + + void edge(int x1, int y1, int x2, int y2); + void edge_d(double x1, double y1, double x2, double y2); + + //------------------------------------------------------------------- + template + void add_path(VertexSource& vs, unsigned path_id = 0) + { + double x; + double y; + + unsigned cmd; + vs.rewind(path_id); + if (m_outline.sorted()) + reset(); + while (!is_stop(cmd = vs.vertex(&x, &y))) { - gamma(gamma_function); + add_vertex(x, y, cmd); } + } - //-------------------------------------------------------------------- - void reset(); - void reset_clipping(); - void clip_box(double x1, double y1, double x2, double y2); - void filling_rule(filling_rule_e filling_rule); - void auto_close(bool flag) { m_auto_close = flag; } + //-------------------------------------------------------------------- + int min_x() const { return m_outline.min_x(); } + int min_y() const { return m_outline.min_y(); } + int max_x() const { return m_outline.max_x(); } + int max_y() const { return m_outline.max_y(); } - //-------------------------------------------------------------------- - template void gamma(const GammaF& gamma_function) + //-------------------------------------------------------------------- + void sort(); + bool rewind_scanlines(); + bool navigate_scanline(int y); + + //-------------------------------------------------------------------- + AGG_INLINE unsigned calculate_alpha(int area) const + { + int cover = area >> (poly_subpixel_shift * 2 + 1 - aa_shift); + + if (cover < 0) + cover = -cover; + if (m_filling_rule == fill_even_odd) { - int i; - for(i = 0; i < aa_scale; i++) + cover &= aa_mask2; + if (cover > aa_scale) { - m_gamma[i] = uround(gamma_function(double(i) / aa_mask) * aa_mask); + cover = aa_scale2 - cover; } } + if (cover > aa_mask) + cover = aa_mask; + return m_gamma[cover]; + } - //-------------------------------------------------------------------- - unsigned apply_gamma(unsigned cover) const + //-------------------------------------------------------------------- + template + bool sweep_scanline(Scanline& sl) + { + for (;;) { - return m_gamma[cover]; - } + if (m_scan_y > m_outline.max_y()) + return false; + sl.reset_spans(); + unsigned num_cells = m_outline.scanline_num_cells(m_scan_y); + const cell_aa* const* cells = m_outline.scanline_cells(m_scan_y); + unsigned cover = 0; - //-------------------------------------------------------------------- - void move_to(int x, int y); - void line_to(int x, int y); - void move_to_d(double x, double y); - void line_to_d(double x, double y); - void close_polygon(); - void add_vertex(double x, double y, unsigned cmd); - - void edge(int x1, int y1, int x2, int y2); - void edge_d(double x1, double y1, double x2, double y2); - - //------------------------------------------------------------------- - template - void add_path(VertexSource& vs, unsigned path_id=0) - { - double x; - double y; - - unsigned cmd; - vs.rewind(path_id); - if(m_outline.sorted()) reset(); - while(!is_stop(cmd = vs.vertex(&x, &y))) + while (num_cells) { - add_vertex(x, y, cmd); - } - } + const cell_aa* cur_cell = *cells; + int x = cur_cell->x; + int area = cur_cell->area; + unsigned alpha; - //-------------------------------------------------------------------- - int min_x() const { return m_outline.min_x(); } - int min_y() const { return m_outline.min_y(); } - int max_x() const { return m_outline.max_x(); } - int max_y() const { return m_outline.max_y(); } + cover += cur_cell->cover; - //-------------------------------------------------------------------- - void sort(); - bool rewind_scanlines(); - bool navigate_scanline(int y); - - //-------------------------------------------------------------------- - AGG_INLINE unsigned calculate_alpha(int area) const - { - int cover = area >> (poly_subpixel_shift*2 + 1 - aa_shift); - - if(cover < 0) cover = -cover; - if(m_filling_rule == fill_even_odd) - { - cover &= aa_mask2; - if(cover > aa_scale) + // accumulate all cells with the same X + while (--num_cells) { - cover = aa_scale2 - cover; - } - } - if(cover > aa_mask) cover = aa_mask; - return m_gamma[cover]; - } - - //-------------------------------------------------------------------- - template bool sweep_scanline(Scanline& sl) - { - for(;;) - { - if(m_scan_y > m_outline.max_y()) return false; - sl.reset_spans(); - unsigned num_cells = m_outline.scanline_num_cells(m_scan_y); - const cell_aa* const* cells = m_outline.scanline_cells(m_scan_y); - unsigned cover = 0; - - while(num_cells) - { - const cell_aa* cur_cell = *cells; - int x = cur_cell->x; - int area = cur_cell->area; - unsigned alpha; - + cur_cell = *++cells; + if (cur_cell->x != x) + break; + area += cur_cell->area; cover += cur_cell->cover; - - //accumulate all cells with the same X - while(--num_cells) - { - cur_cell = *++cells; - if(cur_cell->x != x) break; - area += cur_cell->area; - cover += cur_cell->cover; - } - - if(area) - { - alpha = calculate_alpha((cover << (poly_subpixel_shift + 1)) - area); - if(alpha) - { - sl.add_cell(x, alpha); - } - x++; - } - - if(num_cells && cur_cell->x > x) - { - alpha = calculate_alpha(cover << (poly_subpixel_shift + 1)); - if(alpha) - { - sl.add_span(x, cur_cell->x - x, alpha); - } - } } - if(sl.num_spans()) break; - ++m_scan_y; + if (area) + { + alpha = calculate_alpha((cover << (poly_subpixel_shift + 1)) - area); + if (alpha) + { + sl.add_cell(x, alpha); + } + x++; + } + + if (num_cells && cur_cell->x > x) + { + alpha = calculate_alpha(cover << (poly_subpixel_shift + 1)); + if (alpha) + { + sl.add_span(x, cur_cell->x - x, alpha); + } + } } - sl.finalize(m_scan_y); + if (sl.num_spans()) + break; ++m_scan_y; - return true; } - //-------------------------------------------------------------------- - bool hit_test(int tx, int ty); - - - private: - //-------------------------------------------------------------------- - // Disable copying - rasterizer_scanline_aa(const rasterizer_scanline_aa&); - const rasterizer_scanline_aa& - operator = (const rasterizer_scanline_aa&); - - private: - rasterizer_cells_aa m_outline; - clip_type m_clipper; - int m_gamma[aa_scale]; - filling_rule_e m_filling_rule; - bool m_auto_close; - coord_type m_start_x; - coord_type m_start_y; - unsigned m_status; - int m_scan_y; - }; - - - - - - - - - - - - - //------------------------------------------------------------------------ - template - void rasterizer_scanline_aa::reset() - { - m_outline.reset(); - m_status = status_initial; - } - - //------------------------------------------------------------------------ - template - void rasterizer_scanline_aa::filling_rule(filling_rule_e filling_rule) - { - m_filling_rule = filling_rule; - } - - //------------------------------------------------------------------------ - template - void rasterizer_scanline_aa::clip_box(double x1, double y1, - double x2, double y2) - { - reset(); - m_clipper.clip_box(conv_type::upscale(x1), conv_type::upscale(y1), - conv_type::upscale(x2), conv_type::upscale(y2)); - } - - //------------------------------------------------------------------------ - template - void rasterizer_scanline_aa::reset_clipping() - { - reset(); - m_clipper.reset_clipping(); - } - - //------------------------------------------------------------------------ - template - void rasterizer_scanline_aa::close_polygon() - { - if(m_status == status_line_to) - { - m_clipper.line_to(m_outline, m_start_x, m_start_y); - m_status = status_closed; - } - } - - //------------------------------------------------------------------------ - template - void rasterizer_scanline_aa::move_to(int x, int y) - { - if(m_outline.sorted()) reset(); - if(m_auto_close) close_polygon(); - m_clipper.move_to(m_start_x = conv_type::downscale(x), - m_start_y = conv_type::downscale(y)); - m_status = status_move_to; - } - - //------------------------------------------------------------------------ - template - void rasterizer_scanline_aa::line_to(int x, int y) - { - m_clipper.line_to(m_outline, - conv_type::downscale(x), - conv_type::downscale(y)); - m_status = status_line_to; - } - - //------------------------------------------------------------------------ - template - void rasterizer_scanline_aa::move_to_d(double x, double y) - { - if(m_outline.sorted()) reset(); - if(m_auto_close) close_polygon(); - m_clipper.move_to(m_start_x = conv_type::upscale(x), - m_start_y = conv_type::upscale(y)); - m_status = status_move_to; - } - - //------------------------------------------------------------------------ - template - void rasterizer_scanline_aa::line_to_d(double x, double y) - { - m_clipper.line_to(m_outline, - conv_type::upscale(x), - conv_type::upscale(y)); - m_status = status_line_to; - } - - //------------------------------------------------------------------------ - template - void rasterizer_scanline_aa::add_vertex(double x, double y, unsigned cmd) - { - if(is_move_to(cmd)) - { - move_to_d(x, y); - } - else - if(is_vertex(cmd)) - { - line_to_d(x, y); - } - else - if(is_close(cmd)) - { - close_polygon(); - } - } - - //------------------------------------------------------------------------ - template - void rasterizer_scanline_aa::edge(int x1, int y1, int x2, int y2) - { - if(m_outline.sorted()) reset(); - m_clipper.move_to(conv_type::downscale(x1), conv_type::downscale(y1)); - m_clipper.line_to(m_outline, - conv_type::downscale(x2), - conv_type::downscale(y2)); - m_status = status_move_to; - } - - //------------------------------------------------------------------------ - template - void rasterizer_scanline_aa::edge_d(double x1, double y1, - double x2, double y2) - { - if(m_outline.sorted()) reset(); - m_clipper.move_to(conv_type::upscale(x1), conv_type::upscale(y1)); - m_clipper.line_to(m_outline, - conv_type::upscale(x2), - conv_type::upscale(y2)); - m_status = status_move_to; - } - - //------------------------------------------------------------------------ - template - void rasterizer_scanline_aa::sort() - { - if(m_auto_close) close_polygon(); - m_outline.sort_cells(); - } - - //------------------------------------------------------------------------ - template - AGG_INLINE bool rasterizer_scanline_aa::rewind_scanlines() - { - if(m_auto_close) close_polygon(); - m_outline.sort_cells(); - if(m_outline.total_cells() == 0) - { - return false; - } - m_scan_y = m_outline.min_y(); + sl.finalize(m_scan_y); + ++m_scan_y; return true; } + //-------------------------------------------------------------------- + bool hit_test(int tx, int ty); - //------------------------------------------------------------------------ - template - AGG_INLINE bool rasterizer_scanline_aa::navigate_scanline(int y) - { - if(m_auto_close) close_polygon(); - m_outline.sort_cells(); - if(m_outline.total_cells() == 0 || - y < m_outline.min_y() || - y > m_outline.max_y()) - { - return false; - } - m_scan_y = y; - return true; - } - - //------------------------------------------------------------------------ - template - bool rasterizer_scanline_aa::hit_test(int tx, int ty) - { - if(!navigate_scanline(ty)) return false; - scanline_hit_test sl(tx); - sweep_scanline(sl); - return sl.hit(); - } - + private: + //-------------------------------------------------------------------- + // Disable copying + rasterizer_scanline_aa(const rasterizer_scanline_aa&); + const rasterizer_scanline_aa& operator=(const rasterizer_scanline_aa&); + private: + rasterizer_cells_aa m_outline; + clip_type m_clipper; + int m_gamma[aa_scale]; + filling_rule_e m_filling_rule; + bool m_auto_close; + coord_type m_start_x; + coord_type m_start_y; + unsigned m_status; + int m_scan_y; +}; +//------------------------------------------------------------------------ +template +void rasterizer_scanline_aa::reset() +{ + m_outline.reset(); + m_status = status_initial; } +//------------------------------------------------------------------------ +template +void rasterizer_scanline_aa::filling_rule(filling_rule_e filling_rule) +{ + m_filling_rule = filling_rule; +} +//------------------------------------------------------------------------ +template +void rasterizer_scanline_aa::clip_box(double x1, double y1, double x2, double y2) +{ + reset(); + m_clipper.clip_box(conv_type::upscale(x1), conv_type::upscale(y1), conv_type::upscale(x2), conv_type::upscale(y2)); +} + +//------------------------------------------------------------------------ +template +void rasterizer_scanline_aa::reset_clipping() +{ + reset(); + m_clipper.reset_clipping(); +} + +//------------------------------------------------------------------------ +template +void rasterizer_scanline_aa::close_polygon() +{ + if (m_status == status_line_to) + { + m_clipper.line_to(m_outline, m_start_x, m_start_y); + m_status = status_closed; + } +} + +//------------------------------------------------------------------------ +template +void rasterizer_scanline_aa::move_to(int x, int y) +{ + if (m_outline.sorted()) + reset(); + if (m_auto_close) + close_polygon(); + m_clipper.move_to(m_start_x = conv_type::downscale(x), m_start_y = conv_type::downscale(y)); + m_status = status_move_to; +} + +//------------------------------------------------------------------------ +template +void rasterizer_scanline_aa::line_to(int x, int y) +{ + m_clipper.line_to(m_outline, conv_type::downscale(x), conv_type::downscale(y)); + m_status = status_line_to; +} + +//------------------------------------------------------------------------ +template +void rasterizer_scanline_aa::move_to_d(double x, double y) +{ + if (m_outline.sorted()) + reset(); + if (m_auto_close) + close_polygon(); + m_clipper.move_to(m_start_x = conv_type::upscale(x), m_start_y = conv_type::upscale(y)); + m_status = status_move_to; +} + +//------------------------------------------------------------------------ +template +void rasterizer_scanline_aa::line_to_d(double x, double y) +{ + m_clipper.line_to(m_outline, conv_type::upscale(x), conv_type::upscale(y)); + m_status = status_line_to; +} + +//------------------------------------------------------------------------ +template +void rasterizer_scanline_aa::add_vertex(double x, double y, unsigned cmd) +{ + if (is_move_to(cmd)) + { + move_to_d(x, y); + } + else if (is_vertex(cmd)) + { + line_to_d(x, y); + } + else if (is_close(cmd)) + { + close_polygon(); + } +} + +//------------------------------------------------------------------------ +template +void rasterizer_scanline_aa::edge(int x1, int y1, int x2, int y2) +{ + if (m_outline.sorted()) + reset(); + m_clipper.move_to(conv_type::downscale(x1), conv_type::downscale(y1)); + m_clipper.line_to(m_outline, conv_type::downscale(x2), conv_type::downscale(y2)); + m_status = status_move_to; +} + +//------------------------------------------------------------------------ +template +void rasterizer_scanline_aa::edge_d(double x1, double y1, double x2, double y2) +{ + if (m_outline.sorted()) + reset(); + m_clipper.move_to(conv_type::upscale(x1), conv_type::upscale(y1)); + m_clipper.line_to(m_outline, conv_type::upscale(x2), conv_type::upscale(y2)); + m_status = status_move_to; +} + +//------------------------------------------------------------------------ +template +void rasterizer_scanline_aa::sort() +{ + if (m_auto_close) + close_polygon(); + m_outline.sort_cells(); +} + +//------------------------------------------------------------------------ +template +AGG_INLINE bool rasterizer_scanline_aa::rewind_scanlines() +{ + if (m_auto_close) + close_polygon(); + m_outline.sort_cells(); + if (m_outline.total_cells() == 0) + { + return false; + } + m_scan_y = m_outline.min_y(); + return true; +} + +//------------------------------------------------------------------------ +template +AGG_INLINE bool rasterizer_scanline_aa::navigate_scanline(int y) +{ + if (m_auto_close) + close_polygon(); + m_outline.sort_cells(); + if (m_outline.total_cells() == 0 || y < m_outline.min_y() || y > m_outline.max_y()) + { + return false; + } + m_scan_y = y; + return true; +} + +//------------------------------------------------------------------------ +template +bool rasterizer_scanline_aa::hit_test(int tx, int ty) +{ + if (!navigate_scanline(ty)) + return false; + scanline_hit_test sl(tx); + sweep_scanline(sl); + return sl.hit(); +} + +} // namespace agg #endif diff --git a/deps/agg/include/agg_rasterizer_sl_clip.h b/deps/agg/include/agg_rasterizer_sl_clip.h index a3c5867fb..99fda3d39 100644 --- a/deps/agg/include/agg_rasterizer_sl_clip.h +++ b/deps/agg/include/agg_rasterizer_sl_clip.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -17,226 +17,201 @@ #include "agg_clip_liang_barsky.h" -namespace agg +namespace agg { +//--------------------------------------------------------poly_max_coord_e +enum poly_max_coord_e { + poly_max_coord = (1 << 30) - 1 //----poly_max_coord +}; + +//------------------------------------------------------------ras_conv_int +struct ras_conv_int { - //--------------------------------------------------------poly_max_coord_e - enum poly_max_coord_e + typedef int coord_type; + static AGG_INLINE int mul_div(double a, double b, double c) { return iround(a * b / c); } + static int xi(int v) { return v; } + static int yi(int v) { return v; } + static int upscale(double v) { return iround(v * poly_subpixel_scale); } + static int downscale(int v) { return v; } +}; + +//--------------------------------------------------------ras_conv_int_sat +struct ras_conv_int_sat +{ + typedef int coord_type; + static AGG_INLINE int mul_div(double a, double b, double c) { - poly_max_coord = (1 << 30) - 1 //----poly_max_coord - }; - - //------------------------------------------------------------ras_conv_int - struct ras_conv_int + return saturation::iround(a * b / c); + } + static int xi(int v) { return v; } + static int yi(int v) { return v; } + static int upscale(double v) { return saturation::iround(v * poly_subpixel_scale); } + static int downscale(int v) { return v; } +}; + +//---------------------------------------------------------ras_conv_int_3x +struct ras_conv_int_3x +{ + typedef int coord_type; + static AGG_INLINE int mul_div(double a, double b, double c) { return iround(a * b / c); } + static int xi(int v) { return v * 3; } + static int yi(int v) { return v; } + static int upscale(double v) { return iround(v * poly_subpixel_scale); } + static int downscale(int v) { return v; } +}; + +//-----------------------------------------------------------ras_conv_dbl +struct ras_conv_dbl +{ + typedef double coord_type; + static AGG_INLINE double mul_div(double a, double b, double c) { return a * b / c; } + static int xi(double v) { return iround(v * poly_subpixel_scale); } + static int yi(double v) { return iround(v * poly_subpixel_scale); } + static double upscale(double v) { return v; } + static double downscale(int v) { return v / double(poly_subpixel_scale); } +}; + +//--------------------------------------------------------ras_conv_dbl_3x +struct ras_conv_dbl_3x +{ + typedef double coord_type; + static AGG_INLINE double mul_div(double a, double b, double c) { return a * b / c; } + static int xi(double v) { return iround(v * poly_subpixel_scale * 3); } + static int yi(double v) { return iround(v * poly_subpixel_scale); } + static double upscale(double v) { return v; } + static double downscale(int v) { return v / double(poly_subpixel_scale); } +}; + +//------------------------------------------------------rasterizer_sl_clip +template +class rasterizer_sl_clip +{ + public: + typedef Conv conv_type; + typedef typename Conv::coord_type coord_type; + typedef rect_base rect_type; + + //-------------------------------------------------------------------- + rasterizer_sl_clip() + : m_clip_box(0, 0, 0, 0) + , m_x1(0) + , m_y1(0) + , m_f1(0) + , m_clipping(false) + {} + + //-------------------------------------------------------------------- + void reset_clipping() { m_clipping = false; } + + //-------------------------------------------------------------------- + void clip_box(coord_type x1, coord_type y1, coord_type x2, coord_type y2) { - typedef int coord_type; - static AGG_INLINE int mul_div(double a, double b, double c) - { - return iround(a * b / c); - } - static int xi(int v) { return v; } - static int yi(int v) { return v; } - static int upscale(double v) { return iround(v * poly_subpixel_scale); } - static int downscale(int v) { return v; } - }; + m_clip_box = rect_type(x1, y1, x2, y2); + m_clip_box.normalize(); + m_clipping = true; + } - //--------------------------------------------------------ras_conv_int_sat - struct ras_conv_int_sat + //-------------------------------------------------------------------- + void move_to(coord_type x1, coord_type y1) { - typedef int coord_type; - static AGG_INLINE int mul_div(double a, double b, double c) - { - return saturation::iround(a * b / c); - } - static int xi(int v) { return v; } - static int yi(int v) { return v; } - static int upscale(double v) - { - return saturation::iround(v * poly_subpixel_scale); - } - static int downscale(int v) { return v; } - }; + m_x1 = x1; + m_y1 = y1; + if (m_clipping) + m_f1 = clipping_flags(x1, y1, m_clip_box); + } - //---------------------------------------------------------ras_conv_int_3x - struct ras_conv_int_3x + private: + //------------------------------------------------------------------------ + template + AGG_INLINE void + line_clip_y(Rasterizer& ras, coord_type x1, coord_type y1, coord_type x2, coord_type y2, unsigned f1, unsigned f2) + const { - typedef int coord_type; - static AGG_INLINE int mul_div(double a, double b, double c) + f1 &= 10; + f2 &= 10; + if ((f1 | f2) == 0) { - return iround(a * b / c); + // Fully visible + ras.line(Conv::xi(x1), Conv::yi(y1), Conv::xi(x2), Conv::yi(y2)); } - static int xi(int v) { return v * 3; } - static int yi(int v) { return v; } - static int upscale(double v) { return iround(v * poly_subpixel_scale); } - static int downscale(int v) { return v; } - }; - - //-----------------------------------------------------------ras_conv_dbl - struct ras_conv_dbl - { - typedef double coord_type; - static AGG_INLINE double mul_div(double a, double b, double c) + else { - return a * b / c; - } - static int xi(double v) { return iround(v * poly_subpixel_scale); } - static int yi(double v) { return iround(v * poly_subpixel_scale); } - static double upscale(double v) { return v; } - static double downscale(int v) { return v / double(poly_subpixel_scale); } - }; - - //--------------------------------------------------------ras_conv_dbl_3x - struct ras_conv_dbl_3x - { - typedef double coord_type; - static AGG_INLINE double mul_div(double a, double b, double c) - { - return a * b / c; - } - static int xi(double v) { return iround(v * poly_subpixel_scale * 3); } - static int yi(double v) { return iround(v * poly_subpixel_scale); } - static double upscale(double v) { return v; } - static double downscale(int v) { return v / double(poly_subpixel_scale); } - }; - - - - - - //------------------------------------------------------rasterizer_sl_clip - template class rasterizer_sl_clip - { - public: - typedef Conv conv_type; - typedef typename Conv::coord_type coord_type; - typedef rect_base rect_type; - - //-------------------------------------------------------------------- - rasterizer_sl_clip() : - m_clip_box(0,0,0,0), - m_x1(0), - m_y1(0), - m_f1(0), - m_clipping(false) - {} - - //-------------------------------------------------------------------- - void reset_clipping() - { - m_clipping = false; - } - - //-------------------------------------------------------------------- - void clip_box(coord_type x1, coord_type y1, coord_type x2, coord_type y2) - { - m_clip_box = rect_type(x1, y1, x2, y2); - m_clip_box.normalize(); - m_clipping = true; - } - - //-------------------------------------------------------------------- - void move_to(coord_type x1, coord_type y1) - { - m_x1 = x1; - m_y1 = y1; - if(m_clipping) m_f1 = clipping_flags(x1, y1, m_clip_box); - } - - private: - //------------------------------------------------------------------------ - template - AGG_INLINE void line_clip_y(Rasterizer& ras, - coord_type x1, coord_type y1, - coord_type x2, coord_type y2, - unsigned f1, unsigned f2) const - { - f1 &= 10; - f2 &= 10; - if((f1 | f2) == 0) + if (f1 == f2) { - // Fully visible - ras.line(Conv::xi(x1), Conv::yi(y1), Conv::xi(x2), Conv::yi(y2)); + // Invisible by Y + return; } - else + + coord_type tx1 = x1; + coord_type ty1 = y1; + coord_type tx2 = x2; + coord_type ty2 = y2; + + if (f1 & 8) // y1 < clip.y1 { - if(f1 == f2) - { - // Invisible by Y - return; - } - - coord_type tx1 = x1; - coord_type ty1 = y1; - coord_type tx2 = x2; - coord_type ty2 = y2; - - if(f1 & 8) // y1 < clip.y1 - { - tx1 = x1 + Conv::mul_div(m_clip_box.y1-y1, x2-x1, y2-y1); - ty1 = m_clip_box.y1; - } - - if(f1 & 2) // y1 > clip.y2 - { - tx1 = x1 + Conv::mul_div(m_clip_box.y2-y1, x2-x1, y2-y1); - ty1 = m_clip_box.y2; - } - - if(f2 & 8) // y2 < clip.y1 - { - tx2 = x1 + Conv::mul_div(m_clip_box.y1-y1, x2-x1, y2-y1); - ty2 = m_clip_box.y1; - } - - if(f2 & 2) // y2 > clip.y2 - { - tx2 = x1 + Conv::mul_div(m_clip_box.y2-y1, x2-x1, y2-y1); - ty2 = m_clip_box.y2; - } - ras.line(Conv::xi(tx1), Conv::yi(ty1), - Conv::xi(tx2), Conv::yi(ty2)); + tx1 = x1 + Conv::mul_div(m_clip_box.y1 - y1, x2 - x1, y2 - y1); + ty1 = m_clip_box.y1; } - } - - public: - //-------------------------------------------------------------------- - template - void line_to(Rasterizer& ras, coord_type x2, coord_type y2) - { - if(m_clipping) + if (f1 & 2) // y1 > clip.y2 { - unsigned f2 = clipping_flags(x2, y2, m_clip_box); + tx1 = x1 + Conv::mul_div(m_clip_box.y2 - y1, x2 - x1, y2 - y1); + ty1 = m_clip_box.y2; + } - if((m_f1 & 10) == (f2 & 10) && (m_f1 & 10) != 0) - { - // Invisible by Y - m_x1 = x2; - m_y1 = y2; - m_f1 = f2; - return; - } + if (f2 & 8) // y2 < clip.y1 + { + tx2 = x1 + Conv::mul_div(m_clip_box.y1 - y1, x2 - x1, y2 - y1); + ty2 = m_clip_box.y1; + } - coord_type x1 = m_x1; - coord_type y1 = m_y1; - unsigned f1 = m_f1; - coord_type y3, y4; - unsigned f3, f4; + if (f2 & 2) // y2 > clip.y2 + { + tx2 = x1 + Conv::mul_div(m_clip_box.y2 - y1, x2 - x1, y2 - y1); + ty2 = m_clip_box.y2; + } + ras.line(Conv::xi(tx1), Conv::yi(ty1), Conv::xi(tx2), Conv::yi(ty2)); + } + } - switch(((f1 & 5) << 1) | (f2 & 5)) - { + public: + //-------------------------------------------------------------------- + template + void line_to(Rasterizer& ras, coord_type x2, coord_type y2) + { + if (m_clipping) + { + unsigned f2 = clipping_flags(x2, y2, m_clip_box); + + if ((m_f1 & 10) == (f2 & 10) && (m_f1 & 10) != 0) + { + // Invisible by Y + m_x1 = x2; + m_y1 = y2; + m_f1 = f2; + return; + } + + coord_type x1 = m_x1; + coord_type y1 = m_y1; + unsigned f1 = m_f1; + coord_type y3, y4; + unsigned f3, f4; + + switch (((f1 & 5) << 1) | (f2 & 5)) + { case 0: // Visible by X line_clip_y(ras, x1, y1, x2, y2, f1, f2); break; case 1: // x2 > clip.x2 - y3 = y1 + Conv::mul_div(m_clip_box.x2-x1, y2-y1, x2-x1); + y3 = y1 + Conv::mul_div(m_clip_box.x2 - x1, y2 - y1, x2 - x1); f3 = clipping_flags_y(y3, m_clip_box); line_clip_y(ras, x1, y1, m_clip_box.x2, y3, f1, f3); line_clip_y(ras, m_clip_box.x2, y3, m_clip_box.x2, y2, f3, f2); break; case 2: // x1 > clip.x2 - y3 = y1 + Conv::mul_div(m_clip_box.x2-x1, y2-y1, x2-x1); + y3 = y1 + Conv::mul_div(m_clip_box.x2 - x1, y2 - y1, x2 - x1); f3 = clipping_flags_y(y3, m_clip_box); line_clip_y(ras, m_clip_box.x2, y1, m_clip_box.x2, y3, f1, f3); line_clip_y(ras, m_clip_box.x2, y3, x2, y2, f3, f2); @@ -247,15 +222,15 @@ namespace agg break; case 4: // x2 < clip.x1 - y3 = y1 + Conv::mul_div(m_clip_box.x1-x1, y2-y1, x2-x1); + y3 = y1 + Conv::mul_div(m_clip_box.x1 - x1, y2 - y1, x2 - x1); f3 = clipping_flags_y(y3, m_clip_box); line_clip_y(ras, x1, y1, m_clip_box.x1, y3, f1, f3); line_clip_y(ras, m_clip_box.x1, y3, m_clip_box.x1, y2, f3, f2); break; case 6: // x1 > clip.x2 && x2 < clip.x1 - y3 = y1 + Conv::mul_div(m_clip_box.x2-x1, y2-y1, x2-x1); - y4 = y1 + Conv::mul_div(m_clip_box.x1-x1, y2-y1, x2-x1); + y3 = y1 + Conv::mul_div(m_clip_box.x2 - x1, y2 - y1, x2 - x1); + y4 = y1 + Conv::mul_div(m_clip_box.x1 - x1, y2 - y1, x2 - x1); f3 = clipping_flags_y(y3, m_clip_box); f4 = clipping_flags_y(y4, m_clip_box); line_clip_y(ras, m_clip_box.x2, y1, m_clip_box.x2, y3, f1, f3); @@ -264,15 +239,15 @@ namespace agg break; case 8: // x1 < clip.x1 - y3 = y1 + Conv::mul_div(m_clip_box.x1-x1, y2-y1, x2-x1); + y3 = y1 + Conv::mul_div(m_clip_box.x1 - x1, y2 - y1, x2 - x1); f3 = clipping_flags_y(y3, m_clip_box); line_clip_y(ras, m_clip_box.x1, y1, m_clip_box.x1, y3, f1, f3); line_clip_y(ras, m_clip_box.x1, y3, x2, y2, f3, f2); break; - case 9: // x1 < clip.x1 && x2 > clip.x2 - y3 = y1 + Conv::mul_div(m_clip_box.x1-x1, y2-y1, x2-x1); - y4 = y1 + Conv::mul_div(m_clip_box.x2-x1, y2-y1, x2-x1); + case 9: // x1 < clip.x1 && x2 > clip.x2 + y3 = y1 + Conv::mul_div(m_clip_box.x1 - x1, y2 - y1, x2 - x1); + y4 = y1 + Conv::mul_div(m_clip_box.x2 - x1, y2 - y1, x2 - x1); f3 = clipping_flags_y(y3, m_clip_box); f4 = clipping_flags_y(y4, m_clip_box); line_clip_y(ras, m_clip_box.x1, y1, m_clip_box.x1, y3, f1, f3); @@ -283,69 +258,69 @@ namespace agg case 12: // x1 < clip.x1 && x2 < clip.x1 line_clip_y(ras, m_clip_box.x1, y1, m_clip_box.x1, y2, f1, f2); break; - } - m_f1 = f2; } - else - { - ras.line(Conv::xi(m_x1), Conv::yi(m_y1), - Conv::xi(x2), Conv::yi(y2)); - } - m_x1 = x2; - m_y1 = y2; + m_f1 = f2; } + else + { + ras.line(Conv::xi(m_x1), Conv::yi(m_y1), Conv::xi(x2), Conv::yi(y2)); + } + m_x1 = x2; + m_y1 = y2; + } + private: + rect_type m_clip_box; + coord_type m_x1; + coord_type m_y1; + unsigned m_f1; + bool m_clipping; +}; - private: - rect_type m_clip_box; - coord_type m_x1; - coord_type m_y1; - unsigned m_f1; - bool m_clipping; - }; +//---------------------------------------------------rasterizer_sl_no_clip +class rasterizer_sl_no_clip +{ + public: + typedef ras_conv_int conv_type; + typedef int coord_type; + rasterizer_sl_no_clip() + : m_x1(0) + , m_y1(0) + {} - - - //---------------------------------------------------rasterizer_sl_no_clip - class rasterizer_sl_no_clip + void reset_clipping() {} + void clip_box(coord_type /*x1*/, coord_type /*y1*/, coord_type /*x2*/, coord_type /*y2*/) {} + void move_to(coord_type x1, coord_type y1) { - public: - typedef ras_conv_int conv_type; - typedef int coord_type; + m_x1 = x1; + m_y1 = y1; + } - rasterizer_sl_no_clip() : m_x1(0), m_y1(0) {} + template + void line_to(Rasterizer& ras, coord_type x2, coord_type y2) + { + ras.line(m_x1, m_y1, x2, y2); + m_x1 = x2; + m_y1 = y2; + } - void reset_clipping() {} - void clip_box(coord_type /*x1*/, coord_type /*y1*/, coord_type /*x2*/, coord_type /*y2*/) {} - void move_to(coord_type x1, coord_type y1) { m_x1 = x1; m_y1 = y1; } + private: + int m_x1, m_y1; +}; - template - void line_to(Rasterizer& ras, coord_type x2, coord_type y2) - { - ras.line(m_x1, m_y1, x2, y2); - m_x1 = x2; - m_y1 = y2; - } +// -----rasterizer_sl_clip_int +// -----rasterizer_sl_clip_int_sat +// -----rasterizer_sl_clip_int_3x +// -----rasterizer_sl_clip_dbl +// -----rasterizer_sl_clip_dbl_3x +//------------------------------------------------------------------------ +typedef rasterizer_sl_clip rasterizer_sl_clip_int; +typedef rasterizer_sl_clip rasterizer_sl_clip_int_sat; +typedef rasterizer_sl_clip rasterizer_sl_clip_int_3x; +typedef rasterizer_sl_clip rasterizer_sl_clip_dbl; +typedef rasterizer_sl_clip rasterizer_sl_clip_dbl_3x; - private: - int m_x1, m_y1; - }; - - - // -----rasterizer_sl_clip_int - // -----rasterizer_sl_clip_int_sat - // -----rasterizer_sl_clip_int_3x - // -----rasterizer_sl_clip_dbl - // -----rasterizer_sl_clip_dbl_3x - //------------------------------------------------------------------------ - typedef rasterizer_sl_clip rasterizer_sl_clip_int; - typedef rasterizer_sl_clip rasterizer_sl_clip_int_sat; - typedef rasterizer_sl_clip rasterizer_sl_clip_int_3x; - typedef rasterizer_sl_clip rasterizer_sl_clip_dbl; - typedef rasterizer_sl_clip rasterizer_sl_clip_dbl_3x; - - -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_renderer_base.h b/deps/agg/include/agg_renderer_base.h index 26ae98551..4c4159dd0 100644 --- a/deps/agg/include/agg_renderer_base.h +++ b/deps/agg/include/agg_renderer_base.h @@ -23,724 +23,771 @@ #include "agg_basics.h" #include "agg_rendering_buffer.h" -namespace agg +namespace agg { + +//-----------------------------------------------------------renderer_base +template +class renderer_base { + public: + typedef PixelFormat pixfmt_type; + typedef typename pixfmt_type::color_type color_type; + typedef typename pixfmt_type::color_type::value_type value_type; + typedef typename pixfmt_type::row_data row_data; - //-----------------------------------------------------------renderer_base - template class renderer_base + //-------------------------------------------------------------------- + renderer_base() + : m_ren(0) + , m_clip_box(1, 1, 0, 0) + {} + explicit renderer_base(pixfmt_type& ren) + : m_ren(&ren) + , m_clip_box(0, 0, ren.width() - 1, ren.height() - 1) + {} + void attach(pixfmt_type& ren) { - public: - typedef PixelFormat pixfmt_type; - typedef typename pixfmt_type::color_type color_type; - typedef typename pixfmt_type::color_type::value_type value_type; - typedef typename pixfmt_type::row_data row_data; + m_ren = &ren; + m_clip_box = rect_i(0, 0, ren.width() - 1, ren.height() - 1); + } - //-------------------------------------------------------------------- - renderer_base() : m_ren(0), m_clip_box(1, 1, 0, 0) {} - explicit renderer_base(pixfmt_type& ren) : - m_ren(&ren), - m_clip_box(0, 0, ren.width() - 1, ren.height() - 1) - {} - void attach(pixfmt_type& ren) + //-------------------------------------------------------------------- + const pixfmt_type& ren() const { return *m_ren; } + pixfmt_type& ren() { return *m_ren; } + + //-------------------------------------------------------------------- + unsigned width() const { return m_ren->width(); } + unsigned height() const { return m_ren->height(); } + + //-------------------------------------------------------------------- + bool clip_box(int x1, int y1, int x2, int y2) + { + rect_i cb(x1, y1, x2, y2); + cb.normalize(); + if (cb.clip(rect_i(0, 0, width() - 1, height() - 1))) { - m_ren = &ren; - m_clip_box = rect_i(0, 0, ren.width() - 1, ren.height() - 1); + m_clip_box = cb; + return true; } + m_clip_box.x1 = 1; + m_clip_box.y1 = 1; + m_clip_box.x2 = 0; + m_clip_box.y2 = 0; + return false; + } - //-------------------------------------------------------------------- - const pixfmt_type& ren() const { return *m_ren; } - pixfmt_type& ren() { return *m_ren; } - - //-------------------------------------------------------------------- - unsigned width() const { return m_ren->width(); } - unsigned height() const { return m_ren->height(); } - - //-------------------------------------------------------------------- - bool clip_box(int x1, int y1, int x2, int y2) + //-------------------------------------------------------------------- + void reset_clipping(bool visibility) + { + if (visibility) + { + m_clip_box.x1 = 0; + m_clip_box.y1 = 0; + m_clip_box.x2 = width() - 1; + m_clip_box.y2 = height() - 1; + } + else { - rect_i cb(x1, y1, x2, y2); - cb.normalize(); - if(cb.clip(rect_i(0, 0, width() - 1, height() - 1))) - { - m_clip_box = cb; - return true; - } m_clip_box.x1 = 1; m_clip_box.y1 = 1; m_clip_box.x2 = 0; m_clip_box.y2 = 0; - return false; } + } - //-------------------------------------------------------------------- - void reset_clipping(bool visibility) + //-------------------------------------------------------------------- + void clip_box_naked(int x1, int y1, int x2, int y2) + { + m_clip_box.x1 = x1; + m_clip_box.y1 = y1; + m_clip_box.x2 = x2; + m_clip_box.y2 = y2; + } + + //-------------------------------------------------------------------- + bool inbox(int x, int y) const + { + return x >= m_clip_box.x1 && y >= m_clip_box.y1 && x <= m_clip_box.x2 && y <= m_clip_box.y2; + } + + //-------------------------------------------------------------------- + const rect_i& clip_box() const { return m_clip_box; } + int xmin() const { return m_clip_box.x1; } + int ymin() const { return m_clip_box.y1; } + int xmax() const { return m_clip_box.x2; } + int ymax() const { return m_clip_box.y2; } + + //-------------------------------------------------------------------- + const rect_i& bounding_clip_box() const { return m_clip_box; } + int bounding_xmin() const { return m_clip_box.x1; } + int bounding_ymin() const { return m_clip_box.y1; } + int bounding_xmax() const { return m_clip_box.x2; } + int bounding_ymax() const { return m_clip_box.y2; } + + //-------------------------------------------------------------------- + void clear(const color_type& c) + { + unsigned y; + if (width()) { - if(visibility) + for (y = 0; y < height(); y++) { - m_clip_box.x1 = 0; - m_clip_box.y1 = 0; - m_clip_box.x2 = width() - 1; - m_clip_box.y2 = height() - 1; - } - else - { - m_clip_box.x1 = 1; - m_clip_box.y1 = 1; - m_clip_box.x2 = 0; - m_clip_box.y2 = 0; + m_ren->copy_hline(0, y, width(), c); } } + } - //-------------------------------------------------------------------- - void clip_box_naked(int x1, int y1, int x2, int y2) + //-------------------------------------------------------------------- + void copy_pixel(int x, int y, const color_type& c) + { + if (inbox(x, y)) { - m_clip_box.x1 = x1; - m_clip_box.y1 = y1; - m_clip_box.x2 = x2; - m_clip_box.y2 = y2; + m_ren->copy_pixel(x, y, c); } + } - //-------------------------------------------------------------------- - bool inbox(int x, int y) const + //-------------------------------------------------------------------- + void blend_pixel(int x, int y, const color_type& c, cover_type cover) + { + if (inbox(x, y)) { - return x >= m_clip_box.x1 && y >= m_clip_box.y1 && - x <= m_clip_box.x2 && y <= m_clip_box.y2; + m_ren->blend_pixel(x, y, c, cover); } + } - //-------------------------------------------------------------------- - const rect_i& clip_box() const { return m_clip_box; } - int xmin() const { return m_clip_box.x1; } - int ymin() const { return m_clip_box.y1; } - int xmax() const { return m_clip_box.x2; } - int ymax() const { return m_clip_box.y2; } + //-------------------------------------------------------------------- + color_type pixel(int x, int y) const { return inbox(x, y) ? m_ren->pixel(x, y) : color_type::no_color(); } - //-------------------------------------------------------------------- - const rect_i& bounding_clip_box() const { return m_clip_box; } - int bounding_xmin() const { return m_clip_box.x1; } - int bounding_ymin() const { return m_clip_box.y1; } - int bounding_xmax() const { return m_clip_box.x2; } - int bounding_ymax() const { return m_clip_box.y2; } - - //-------------------------------------------------------------------- - void clear(const color_type& c) + //-------------------------------------------------------------------- + void copy_hline(int x1, int y, int x2, const color_type& c) + { + if (x1 > x2) { - unsigned y; - if(width()) + int t = x2; + x2 = x1; + x1 = t; + } + if (y > ymax()) + return; + if (y < ymin()) + return; + if (x1 > xmax()) + return; + if (x2 < xmin()) + return; + + if (x1 < xmin()) + x1 = xmin(); + if (x2 > xmax()) + x2 = xmax(); + + m_ren->copy_hline(x1, y, x2 - x1 + 1, c); + } + + //-------------------------------------------------------------------- + void copy_vline(int x, int y1, int y2, const color_type& c) + { + if (y1 > y2) + { + int t = y2; + y2 = y1; + y1 = t; + } + if (x > xmax()) + return; + if (x < xmin()) + return; + if (y1 > ymax()) + return; + if (y2 < ymin()) + return; + + if (y1 < ymin()) + y1 = ymin(); + if (y2 > ymax()) + y2 = ymax(); + + m_ren->copy_vline(x, y1, y2 - y1 + 1, c); + } + + //-------------------------------------------------------------------- + void blend_hline(int x1, int y, int x2, const color_type& c, cover_type cover) + { + if (x1 > x2) + { + int t = x2; + x2 = x1; + x1 = t; + } + if (y > ymax()) + return; + if (y < ymin()) + return; + if (x1 > xmax()) + return; + if (x2 < xmin()) + return; + + if (x1 < xmin()) + x1 = xmin(); + if (x2 > xmax()) + x2 = xmax(); + + m_ren->blend_hline(x1, y, x2 - x1 + 1, c, cover); + } + + //-------------------------------------------------------------------- + void blend_vline(int x, int y1, int y2, const color_type& c, cover_type cover) + { + if (y1 > y2) + { + int t = y2; + y2 = y1; + y1 = t; + } + if (x > xmax()) + return; + if (x < xmin()) + return; + if (y1 > ymax()) + return; + if (y2 < ymin()) + return; + + if (y1 < ymin()) + y1 = ymin(); + if (y2 > ymax()) + y2 = ymax(); + + m_ren->blend_vline(x, y1, y2 - y1 + 1, c, cover); + } + + //-------------------------------------------------------------------- + void copy_bar(int x1, int y1, int x2, int y2, const color_type& c) + { + rect_i rc(x1, y1, x2, y2); + rc.normalize(); + if (rc.clip(clip_box())) + { + int y; + for (y = rc.y1; y <= rc.y2; y++) { - for(y = 0; y < height(); y++) + m_ren->copy_hline(rc.x1, y, unsigned(rc.x2 - rc.x1 + 1), c); + } + } + } + + //-------------------------------------------------------------------- + void blend_bar(int x1, int y1, int x2, int y2, const color_type& c, cover_type cover) + { + rect_i rc(x1, y1, x2, y2); + rc.normalize(); + if (rc.clip(clip_box())) + { + int y; + for (y = rc.y1; y <= rc.y2; y++) + { + m_ren->blend_hline(rc.x1, y, unsigned(rc.x2 - rc.x1 + 1), c, cover); + } + } + } + + //-------------------------------------------------------------------- + void blend_solid_hspan(int x, int y, int len, const color_type& c, const cover_type* covers) + { + if (y > ymax()) + return; + if (y < ymin()) + return; + + if (x < xmin()) + { + len -= xmin() - x; + if (len <= 0) + return; + covers += xmin() - x; + x = xmin(); + } + if (x + len > xmax()) + { + len = xmax() - x + 1; + if (len <= 0) + return; + } + m_ren->blend_solid_hspan(x, y, len, c, covers); + } + + //-------------------------------------------------------------------- + void blend_solid_vspan(int x, int y, int len, const color_type& c, const cover_type* covers) + { + if (x > xmax()) + return; + if (x < xmin()) + return; + + if (y < ymin()) + { + len -= ymin() - y; + if (len <= 0) + return; + covers += ymin() - y; + y = ymin(); + } + if (y + len > ymax()) + { + len = ymax() - y + 1; + if (len <= 0) + return; + } + m_ren->blend_solid_vspan(x, y, len, c, covers); + } + + //-------------------------------------------------------------------- + void copy_color_hspan(int x, int y, int len, const color_type* colors) + { + if (y > ymax()) + return; + if (y < ymin()) + return; + + if (x < xmin()) + { + int d = xmin() - x; + len -= d; + if (len <= 0) + return; + colors += d; + x = xmin(); + } + if (x + len > xmax()) + { + len = xmax() - x + 1; + if (len <= 0) + return; + } + m_ren->copy_color_hspan(x, y, len, colors); + } + + //-------------------------------------------------------------------- + void copy_color_vspan(int x, int y, int len, const color_type* colors) + { + if (x > xmax()) + return; + if (x < xmin()) + return; + + if (y < ymin()) + { + int d = ymin() - y; + len -= d; + if (len <= 0) + return; + colors += d; + y = ymin(); + } + if (y + len > ymax()) + { + len = ymax() - y + 1; + if (len <= 0) + return; + } + m_ren->copy_color_vspan(x, y, len, colors); + } + + //-------------------------------------------------------------------- + void blend_color_hspan(int x, + int y, + int len, + const color_type* colors, + const cover_type* covers, + cover_type cover = agg::cover_full) + { + if (y > ymax()) + return; + if (y < ymin()) + return; + + if (x < xmin()) + { + int d = xmin() - x; + len -= d; + if (len <= 0) + return; + if (covers) + covers += d; + colors += d; + x = xmin(); + } + if (x + len > xmax()) + { + len = xmax() - x + 1; + if (len <= 0) + return; + } + m_ren->blend_color_hspan(x, y, len, colors, covers, cover); + } + + //-------------------------------------------------------------------- + void blend_color_hspan_alpha(int x, + int y, + int len, + const color_type* colors, + value_type alpha, + const cover_type* covers, + cover_type cover = agg::cover_full) + { + if (y > ymax()) + return; + if (y < ymin()) + return; + + if (x < xmin()) + { + int d = xmin() - x; + len -= d; + if (len <= 0) + return; + if (covers) + covers += d; + colors += d; + x = xmin(); + } + if (x + len > xmax()) + { + len = xmax() - x + 1; + if (len <= 0) + return; + } + m_ren->blend_color_hspan_alpha(x, y, len, colors, alpha, covers, cover); + } + + //-------------------------------------------------------------------- + void blend_color_vspan(int x, + int y, + int len, + const color_type* colors, + const cover_type* covers, + cover_type cover = agg::cover_full) + { + if (x > xmax()) + return; + if (x < xmin()) + return; + + if (y < ymin()) + { + int d = ymin() - y; + len -= d; + if (len <= 0) + return; + if (covers) + covers += d; + colors += d; + y = ymin(); + } + if (y + len > ymax()) + { + len = ymax() - y + 1; + if (len <= 0) + return; + } + m_ren->blend_color_vspan(x, y, len, colors, covers, cover); + } + + //-------------------------------------------------------------------- + rect_i clip_rect_area(rect_i& dst, rect_i& src, int wsrc, int hsrc) const + { + rect_i rc(0, 0, 0, 0); + rect_i cb = clip_box(); + ++cb.x2; + ++cb.y2; + + if (src.x1 < 0) + { + dst.x1 -= src.x1; + src.x1 = 0; + } + if (src.y1 < 0) + { + dst.y1 -= src.y1; + src.y1 = 0; + } + + if (src.x2 > wsrc) + src.x2 = wsrc; + if (src.y2 > hsrc) + src.y2 = hsrc; + + if (dst.x1 < cb.x1) + { + src.x1 += cb.x1 - dst.x1; + dst.x1 = cb.x1; + } + if (dst.y1 < cb.y1) + { + src.y1 += cb.y1 - dst.y1; + dst.y1 = cb.y1; + } + + if (dst.x2 > cb.x2) + dst.x2 = cb.x2; + if (dst.y2 > cb.y2) + dst.y2 = cb.y2; + + rc.x2 = dst.x2 - dst.x1; + rc.y2 = dst.y2 - dst.y1; + + if (rc.x2 > src.x2 - src.x1) + rc.x2 = src.x2 - src.x1; + if (rc.y2 > src.y2 - src.y1) + rc.y2 = src.y2 - src.y1; + return rc; + } + + //-------------------------------------------------------------------- + template + void copy_from(const RenBuf& src, const rect_i* rect_src_ptr = 0, int dx = 0, int dy = 0) + { + rect_i rsrc(0, 0, src.width(), src.height()); + if (rect_src_ptr) + { + rsrc.x1 = rect_src_ptr->x1; + rsrc.y1 = rect_src_ptr->y1; + rsrc.x2 = rect_src_ptr->x2 + 1; + rsrc.y2 = rect_src_ptr->y2 + 1; + } + + // Version with xdst, ydst (absolute positioning) + // rect_i rdst(xdst, ydst, xdst + rsrc.x2 - rsrc.x1, ydst + rsrc.y2 - rsrc.y1); + + // Version with dx, dy (relative positioning) + rect_i rdst(rsrc.x1 + dx, rsrc.y1 + dy, rsrc.x2 + dx, rsrc.y2 + dy); + + rect_i rc = clip_rect_area(rdst, rsrc, src.width(), src.height()); + + if (rc.x2 > 0) + { + int incy = 1; + if (rdst.y1 > rsrc.y1) + { + rsrc.y1 += rc.y2 - 1; + rdst.y1 += rc.y2 - 1; + incy = -1; + } + while (rc.y2 > 0) + { + m_ren->copy_from(src, rdst.x1, rdst.y1, rsrc.x1, rsrc.y1, rc.x2); + rdst.y1 += incy; + rsrc.y1 += incy; + --rc.y2; + } + } + } + + //-------------------------------------------------------------------- + template + void blend_from(const SrcPixelFormatRenderer& src, + const rect_i* rect_src_ptr = 0, + int dx = 0, + int dy = 0, + cover_type cover = agg::cover_full) + { + rect_i rsrc(0, 0, src.width(), src.height()); + if (rect_src_ptr) + { + rsrc.x1 = rect_src_ptr->x1; + rsrc.y1 = rect_src_ptr->y1; + rsrc.x2 = rect_src_ptr->x2 + 1; + rsrc.y2 = rect_src_ptr->y2 + 1; + } + + // Version with xdst, ydst (absolute positioning) + // rect_i rdst(xdst, ydst, xdst + rsrc.x2 - rsrc.x1, ydst + rsrc.y2 - rsrc.y1); + + // Version with dx, dy (relative positioning) + rect_i rdst(rsrc.x1 + dx, rsrc.y1 + dy, rsrc.x2 + dx, rsrc.y2 + dy); + rect_i rc = clip_rect_area(rdst, rsrc, src.width(), src.height()); + + if (rc.x2 > 0) + { + int incy = 1; + if (rdst.y1 > rsrc.y1) + { + rsrc.y1 += rc.y2 - 1; + rdst.y1 += rc.y2 - 1; + incy = -1; + } + while (rc.y2 > 0) + { + typename SrcPixelFormatRenderer::row_data rw = src.row(rsrc.y1); + if (rw.ptr) { - m_ren->copy_hline(0, y, width(), c); + int x1src = rsrc.x1; + int x1dst = rdst.x1; + int len = rc.x2; + if (rw.x1 > x1src) + { + x1dst += rw.x1 - x1src; + len -= rw.x1 - x1src; + x1src = rw.x1; + } + if (len > 0) + { + if (x1src + len - 1 > rw.x2) + { + len -= x1src + len - rw.x2 - 1; + } + if (len > 0) + { + m_ren->blend_from(src, x1dst, rdst.y1, x1src, rsrc.y1, len, cover); + } + } } + rdst.y1 += incy; + rsrc.y1 += incy; + --rc.y2; } } + } - - //-------------------------------------------------------------------- - void copy_pixel(int x, int y, const color_type& c) + //-------------------------------------------------------------------- + template + void blend_from_color(const SrcPixelFormatRenderer& src, + const color_type& color, + const rect_i* rect_src_ptr = 0, + int dx = 0, + int dy = 0, + cover_type cover = agg::cover_full) + { + rect_i rsrc(0, 0, src.width(), src.height()); + if (rect_src_ptr) { - if(inbox(x, y)) + rsrc.x1 = rect_src_ptr->x1; + rsrc.y1 = rect_src_ptr->y1; + rsrc.x2 = rect_src_ptr->x2 + 1; + rsrc.y2 = rect_src_ptr->y2 + 1; + } + + // Version with xdst, ydst (absolute positioning) + // rect_i rdst(xdst, ydst, xdst + rsrc.x2 - rsrc.x1, ydst + rsrc.y2 - rsrc.y1); + + // Version with dx, dy (relative positioning) + rect_i rdst(rsrc.x1 + dx, rsrc.y1 + dy, rsrc.x2 + dx, rsrc.y2 + dy); + rect_i rc = clip_rect_area(rdst, rsrc, src.width(), src.height()); + + if (rc.x2 > 0) + { + int incy = 1; + if (rdst.y1 > rsrc.y1) { - m_ren->copy_pixel(x, y, c); + rsrc.y1 += rc.y2 - 1; + rdst.y1 += rc.y2 - 1; + incy = -1; } - } - - //-------------------------------------------------------------------- - void blend_pixel(int x, int y, const color_type& c, cover_type cover) - { - if(inbox(x, y)) + while (rc.y2 > 0) { - m_ren->blend_pixel(x, y, c, cover); - } - } - - //-------------------------------------------------------------------- - color_type pixel(int x, int y) const - { - return inbox(x, y) ? - m_ren->pixel(x, y) : - color_type::no_color(); - } - - //-------------------------------------------------------------------- - void copy_hline(int x1, int y, int x2, const color_type& c) - { - if(x1 > x2) { int t = x2; x2 = x1; x1 = t; } - if(y > ymax()) return; - if(y < ymin()) return; - if(x1 > xmax()) return; - if(x2 < xmin()) return; - - if(x1 < xmin()) x1 = xmin(); - if(x2 > xmax()) x2 = xmax(); - - m_ren->copy_hline(x1, y, x2 - x1 + 1, c); - } - - //-------------------------------------------------------------------- - void copy_vline(int x, int y1, int y2, const color_type& c) - { - if(y1 > y2) { int t = y2; y2 = y1; y1 = t; } - if(x > xmax()) return; - if(x < xmin()) return; - if(y1 > ymax()) return; - if(y2 < ymin()) return; - - if(y1 < ymin()) y1 = ymin(); - if(y2 > ymax()) y2 = ymax(); - - m_ren->copy_vline(x, y1, y2 - y1 + 1, c); - } - - //-------------------------------------------------------------------- - void blend_hline(int x1, int y, int x2, - const color_type& c, cover_type cover) - { - if(x1 > x2) { int t = x2; x2 = x1; x1 = t; } - if(y > ymax()) return; - if(y < ymin()) return; - if(x1 > xmax()) return; - if(x2 < xmin()) return; - - if(x1 < xmin()) x1 = xmin(); - if(x2 > xmax()) x2 = xmax(); - - m_ren->blend_hline(x1, y, x2 - x1 + 1, c, cover); - } - - //-------------------------------------------------------------------- - void blend_vline(int x, int y1, int y2, - const color_type& c, cover_type cover) - { - if(y1 > y2) { int t = y2; y2 = y1; y1 = t; } - if(x > xmax()) return; - if(x < xmin()) return; - if(y1 > ymax()) return; - if(y2 < ymin()) return; - - if(y1 < ymin()) y1 = ymin(); - if(y2 > ymax()) y2 = ymax(); - - m_ren->blend_vline(x, y1, y2 - y1 + 1, c, cover); - } - - - //-------------------------------------------------------------------- - void copy_bar(int x1, int y1, int x2, int y2, const color_type& c) - { - rect_i rc(x1, y1, x2, y2); - rc.normalize(); - if(rc.clip(clip_box())) - { - int y; - for(y = rc.y1; y <= rc.y2; y++) + typename SrcPixelFormatRenderer::row_data rw = src.row(rsrc.y1); + if (rw.ptr) { - m_ren->copy_hline(rc.x1, y, unsigned(rc.x2 - rc.x1 + 1), c); + int x1src = rsrc.x1; + int x1dst = rdst.x1; + int len = rc.x2; + if (rw.x1 > x1src) + { + x1dst += rw.x1 - x1src; + len -= rw.x1 - x1src; + x1src = rw.x1; + } + if (len > 0) + { + if (x1src + len - 1 > rw.x2) + { + len -= x1src + len - rw.x2 - 1; + } + if (len > 0) + { + m_ren->blend_from_color(src, color, x1dst, rdst.y1, x1src, rsrc.y1, len, cover); + } + } } + rdst.y1 += incy; + rsrc.y1 += incy; + --rc.y2; } } + } - //-------------------------------------------------------------------- - void blend_bar(int x1, int y1, int x2, int y2, - const color_type& c, cover_type cover) - { - rect_i rc(x1, y1, x2, y2); - rc.normalize(); - if(rc.clip(clip_box())) - { - int y; - for(y = rc.y1; y <= rc.y2; y++) - { - m_ren->blend_hline(rc.x1, - y, - unsigned(rc.x2 - rc.x1 + 1), - c, - cover); - } - } - } - - //-------------------------------------------------------------------- - void blend_solid_hspan(int x, int y, int len, - const color_type& c, - const cover_type* covers) - { - if(y > ymax()) return; - if(y < ymin()) return; - - if(x < xmin()) - { - len -= xmin() - x; - if(len <= 0) return; - covers += xmin() - x; - x = xmin(); - } - if(x + len > xmax()) - { - len = xmax() - x + 1; - if(len <= 0) return; - } - m_ren->blend_solid_hspan(x, y, len, c, covers); - } - - //-------------------------------------------------------------------- - void blend_solid_vspan(int x, int y, int len, - const color_type& c, - const cover_type* covers) - { - if(x > xmax()) return; - if(x < xmin()) return; - - if(y < ymin()) - { - len -= ymin() - y; - if(len <= 0) return; - covers += ymin() - y; - y = ymin(); - } - if(y + len > ymax()) - { - len = ymax() - y + 1; - if(len <= 0) return; - } - m_ren->blend_solid_vspan(x, y, len, c, covers); - } - - - //-------------------------------------------------------------------- - void copy_color_hspan(int x, int y, int len, const color_type* colors) - { - if(y > ymax()) return; - if(y < ymin()) return; - - if(x < xmin()) - { - int d = xmin() - x; - len -= d; - if(len <= 0) return; - colors += d; - x = xmin(); - } - if(x + len > xmax()) - { - len = xmax() - x + 1; - if(len <= 0) return; - } - m_ren->copy_color_hspan(x, y, len, colors); - } - - - //-------------------------------------------------------------------- - void copy_color_vspan(int x, int y, int len, const color_type* colors) - { - if(x > xmax()) return; - if(x < xmin()) return; - - if(y < ymin()) - { - int d = ymin() - y; - len -= d; - if(len <= 0) return; - colors += d; - y = ymin(); - } - if(y + len > ymax()) - { - len = ymax() - y + 1; - if(len <= 0) return; - } - m_ren->copy_color_vspan(x, y, len, colors); - } - - - //-------------------------------------------------------------------- - void blend_color_hspan(int x, int y, int len, - const color_type* colors, - const cover_type* covers, - cover_type cover = agg::cover_full) - { - if(y > ymax()) return; - if(y < ymin()) return; - - if(x < xmin()) - { - int d = xmin() - x; - len -= d; - if(len <= 0) return; - if(covers) covers += d; - colors += d; - x = xmin(); - } - if(x + len > xmax()) - { - len = xmax() - x + 1; - if(len <= 0) return; - } - m_ren->blend_color_hspan(x, y, len, colors, covers, cover); - } - - //-------------------------------------------------------------------- - void blend_color_hspan_alpha(int x, int y, int len, - const color_type* colors, - value_type alpha, - const cover_type* covers, - cover_type cover = agg::cover_full) - { - if(y > ymax()) return; - if(y < ymin()) return; - - if(x < xmin()) - { - int d = xmin() - x; - len -= d; - if(len <= 0) return; - if(covers) covers += d; - colors += d; - x = xmin(); - } - if(x + len > xmax()) - { - len = xmax() - x + 1; - if(len <= 0) return; - } - m_ren->blend_color_hspan_alpha(x, y, len, colors, alpha, covers, cover); - } - - //-------------------------------------------------------------------- - void blend_color_vspan(int x, int y, int len, - const color_type* colors, - const cover_type* covers, - cover_type cover = agg::cover_full) - { - if(x > xmax()) return; - if(x < xmin()) return; - - if(y < ymin()) - { - int d = ymin() - y; - len -= d; - if(len <= 0) return; - if(covers) covers += d; - colors += d; - y = ymin(); - } - if(y + len > ymax()) - { - len = ymax() - y + 1; - if(len <= 0) return; - } - m_ren->blend_color_vspan(x, y, len, colors, covers, cover); - } - - //-------------------------------------------------------------------- - rect_i clip_rect_area(rect_i& dst, rect_i& src, int wsrc, int hsrc) const - { - rect_i rc(0,0,0,0); - rect_i cb = clip_box(); - ++cb.x2; - ++cb.y2; - - if(src.x1 < 0) - { - dst.x1 -= src.x1; - src.x1 = 0; - } - if(src.y1 < 0) - { - dst.y1 -= src.y1; - src.y1 = 0; - } - - if(src.x2 > wsrc) src.x2 = wsrc; - if(src.y2 > hsrc) src.y2 = hsrc; - - if(dst.x1 < cb.x1) - { - src.x1 += cb.x1 - dst.x1; - dst.x1 = cb.x1; - } - if(dst.y1 < cb.y1) - { - src.y1 += cb.y1 - dst.y1; - dst.y1 = cb.y1; - } - - if(dst.x2 > cb.x2) dst.x2 = cb.x2; - if(dst.y2 > cb.y2) dst.y2 = cb.y2; - - rc.x2 = dst.x2 - dst.x1; - rc.y2 = dst.y2 - dst.y1; - - if(rc.x2 > src.x2 - src.x1) rc.x2 = src.x2 - src.x1; - if(rc.y2 > src.y2 - src.y1) rc.y2 = src.y2 - src.y1; - return rc; - } - - //-------------------------------------------------------------------- - template - void copy_from(const RenBuf& src, - const rect_i* rect_src_ptr = 0, - int dx = 0, - int dy = 0) - { - rect_i rsrc(0, 0, src.width(), src.height()); - if(rect_src_ptr) - { - rsrc.x1 = rect_src_ptr->x1; - rsrc.y1 = rect_src_ptr->y1; - rsrc.x2 = rect_src_ptr->x2 + 1; - rsrc.y2 = rect_src_ptr->y2 + 1; - } - - // Version with xdst, ydst (absolute positioning) - //rect_i rdst(xdst, ydst, xdst + rsrc.x2 - rsrc.x1, ydst + rsrc.y2 - rsrc.y1); - - // Version with dx, dy (relative positioning) - rect_i rdst(rsrc.x1 + dx, rsrc.y1 + dy, rsrc.x2 + dx, rsrc.y2 + dy); - - rect_i rc = clip_rect_area(rdst, rsrc, src.width(), src.height()); - - if(rc.x2 > 0) - { - int incy = 1; - if(rdst.y1 > rsrc.y1) - { - rsrc.y1 += rc.y2 - 1; - rdst.y1 += rc.y2 - 1; - incy = -1; - } - while(rc.y2 > 0) - { - m_ren->copy_from(src, - rdst.x1, rdst.y1, - rsrc.x1, rsrc.y1, - rc.x2); - rdst.y1 += incy; - rsrc.y1 += incy; - --rc.y2; - } - } - } - - //-------------------------------------------------------------------- - template - void blend_from(const SrcPixelFormatRenderer& src, + //-------------------------------------------------------------------- + template + void blend_from_lut(const SrcPixelFormatRenderer& src, + const color_type* color_lut, const rect_i* rect_src_ptr = 0, int dx = 0, int dy = 0, cover_type cover = agg::cover_full) + { + rect_i rsrc(0, 0, src.width(), src.height()); + if (rect_src_ptr) { - rect_i rsrc(0, 0, src.width(), src.height()); - if(rect_src_ptr) - { - rsrc.x1 = rect_src_ptr->x1; - rsrc.y1 = rect_src_ptr->y1; - rsrc.x2 = rect_src_ptr->x2 + 1; - rsrc.y2 = rect_src_ptr->y2 + 1; - } - - // Version with xdst, ydst (absolute positioning) - //rect_i rdst(xdst, ydst, xdst + rsrc.x2 - rsrc.x1, ydst + rsrc.y2 - rsrc.y1); - - // Version with dx, dy (relative positioning) - rect_i rdst(rsrc.x1 + dx, rsrc.y1 + dy, rsrc.x2 + dx, rsrc.y2 + dy); - rect_i rc = clip_rect_area(rdst, rsrc, src.width(), src.height()); - - if(rc.x2 > 0) - { - int incy = 1; - if(rdst.y1 > rsrc.y1) - { - rsrc.y1 += rc.y2 - 1; - rdst.y1 += rc.y2 - 1; - incy = -1; - } - while(rc.y2 > 0) - { - typename SrcPixelFormatRenderer::row_data rw = src.row(rsrc.y1); - if(rw.ptr) - { - int x1src = rsrc.x1; - int x1dst = rdst.x1; - int len = rc.x2; - if(rw.x1 > x1src) - { - x1dst += rw.x1 - x1src; - len -= rw.x1 - x1src; - x1src = rw.x1; - } - if(len > 0) - { - if(x1src + len-1 > rw.x2) - { - len -= x1src + len - rw.x2 - 1; - } - if(len > 0) - { - m_ren->blend_from(src, - x1dst, rdst.y1, - x1src, rsrc.y1, - len, - cover); - } - } - } - rdst.y1 += incy; - rsrc.y1 += incy; - --rc.y2; - } - } + rsrc.x1 = rect_src_ptr->x1; + rsrc.y1 = rect_src_ptr->y1; + rsrc.x2 = rect_src_ptr->x2 + 1; + rsrc.y2 = rect_src_ptr->y2 + 1; } - //-------------------------------------------------------------------- - template - void blend_from_color(const SrcPixelFormatRenderer& src, - const color_type& color, - const rect_i* rect_src_ptr = 0, - int dx = 0, - int dy = 0, - cover_type cover = agg::cover_full) + // Version with xdst, ydst (absolute positioning) + // rect_i rdst(xdst, ydst, xdst + rsrc.x2 - rsrc.x1, ydst + rsrc.y2 - rsrc.y1); + + // Version with dx, dy (relative positioning) + rect_i rdst(rsrc.x1 + dx, rsrc.y1 + dy, rsrc.x2 + dx, rsrc.y2 + dy); + rect_i rc = clip_rect_area(rdst, rsrc, src.width(), src.height()); + + if (rc.x2 > 0) { - rect_i rsrc(0, 0, src.width(), src.height()); - if(rect_src_ptr) + int incy = 1; + if (rdst.y1 > rsrc.y1) { - rsrc.x1 = rect_src_ptr->x1; - rsrc.y1 = rect_src_ptr->y1; - rsrc.x2 = rect_src_ptr->x2 + 1; - rsrc.y2 = rect_src_ptr->y2 + 1; + rsrc.y1 += rc.y2 - 1; + rdst.y1 += rc.y2 - 1; + incy = -1; } - - // Version with xdst, ydst (absolute positioning) - //rect_i rdst(xdst, ydst, xdst + rsrc.x2 - rsrc.x1, ydst + rsrc.y2 - rsrc.y1); - - // Version with dx, dy (relative positioning) - rect_i rdst(rsrc.x1 + dx, rsrc.y1 + dy, rsrc.x2 + dx, rsrc.y2 + dy); - rect_i rc = clip_rect_area(rdst, rsrc, src.width(), src.height()); - - if(rc.x2 > 0) + while (rc.y2 > 0) { - int incy = 1; - if(rdst.y1 > rsrc.y1) + typename SrcPixelFormatRenderer::row_data rw = src.row(rsrc.y1); + if (rw.ptr) { - rsrc.y1 += rc.y2 - 1; - rdst.y1 += rc.y2 - 1; - incy = -1; - } - while(rc.y2 > 0) - { - typename SrcPixelFormatRenderer::row_data rw = src.row(rsrc.y1); - if(rw.ptr) + int x1src = rsrc.x1; + int x1dst = rdst.x1; + int len = rc.x2; + if (rw.x1 > x1src) { - int x1src = rsrc.x1; - int x1dst = rdst.x1; - int len = rc.x2; - if(rw.x1 > x1src) + x1dst += rw.x1 - x1src; + len -= rw.x1 - x1src; + x1src = rw.x1; + } + if (len > 0) + { + if (x1src + len - 1 > rw.x2) { - x1dst += rw.x1 - x1src; - len -= rw.x1 - x1src; - x1src = rw.x1; + len -= x1src + len - rw.x2 - 1; } - if(len > 0) + if (len > 0) { - if(x1src + len-1 > rw.x2) - { - len -= x1src + len - rw.x2 - 1; - } - if(len > 0) - { - m_ren->blend_from_color(src, - color, - x1dst, rdst.y1, - x1src, rsrc.y1, - len, - cover); - } + m_ren->blend_from_lut(src, color_lut, x1dst, rdst.y1, x1src, rsrc.y1, len, cover); } } - rdst.y1 += incy; - rsrc.y1 += incy; - --rc.y2; } + rdst.y1 += incy; + rsrc.y1 += incy; + --rc.y2; } } + } - //-------------------------------------------------------------------- - template - void blend_from_lut(const SrcPixelFormatRenderer& src, - const color_type* color_lut, - const rect_i* rect_src_ptr = 0, - int dx = 0, - int dy = 0, - cover_type cover = agg::cover_full) - { - rect_i rsrc(0, 0, src.width(), src.height()); - if(rect_src_ptr) - { - rsrc.x1 = rect_src_ptr->x1; - rsrc.y1 = rect_src_ptr->y1; - rsrc.x2 = rect_src_ptr->x2 + 1; - rsrc.y2 = rect_src_ptr->y2 + 1; - } + private: + pixfmt_type* m_ren; + rect_i m_clip_box; +}; - // Version with xdst, ydst (absolute positioning) - //rect_i rdst(xdst, ydst, xdst + rsrc.x2 - rsrc.x1, ydst + rsrc.y2 - rsrc.y1); - - // Version with dx, dy (relative positioning) - rect_i rdst(rsrc.x1 + dx, rsrc.y1 + dy, rsrc.x2 + dx, rsrc.y2 + dy); - rect_i rc = clip_rect_area(rdst, rsrc, src.width(), src.height()); - - if(rc.x2 > 0) - { - int incy = 1; - if(rdst.y1 > rsrc.y1) - { - rsrc.y1 += rc.y2 - 1; - rdst.y1 += rc.y2 - 1; - incy = -1; - } - while(rc.y2 > 0) - { - typename SrcPixelFormatRenderer::row_data rw = src.row(rsrc.y1); - if(rw.ptr) - { - int x1src = rsrc.x1; - int x1dst = rdst.x1; - int len = rc.x2; - if(rw.x1 > x1src) - { - x1dst += rw.x1 - x1src; - len -= rw.x1 - x1src; - x1src = rw.x1; - } - if(len > 0) - { - if(x1src + len-1 > rw.x2) - { - len -= x1src + len - rw.x2 - 1; - } - if(len > 0) - { - m_ren->blend_from_lut(src, - color_lut, - x1dst, rdst.y1, - x1src, rsrc.y1, - len, - cover); - } - } - } - rdst.y1 += incy; - rsrc.y1 += incy; - --rc.y2; - } - } - } - - private: - pixfmt_type* m_ren; - rect_i m_clip_box; - }; - - -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_renderer_markers.h b/deps/agg/include/agg_renderer_markers.h index 820f75307..96d0c31d9 100644 --- a/deps/agg/include/agg_renderer_markers.h +++ b/deps/agg/include/agg_renderer_markers.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -23,684 +23,1420 @@ #include "agg_basics.h" #include "agg_renderer_primitives.h" -namespace agg +namespace agg { + +//---------------------------------------------------------------marker_e +enum marker_e { + marker_square, + marker_diamond, + marker_circle, + marker_crossed_circle, + marker_semiellipse_left, + marker_semiellipse_right, + marker_semiellipse_up, + marker_semiellipse_down, + marker_triangle_left, + marker_triangle_right, + marker_triangle_up, + marker_triangle_down, + marker_four_rays, + marker_cross, + marker_x, + marker_dash, + marker_dot, + marker_pixel, + + end_of_markers +}; + +//--------------------------------------------------------renderer_markers +template +class renderer_markers : public renderer_primitives { + public: + typedef renderer_primitives base_type; + typedef BaseRenderer base_ren_type; + typedef typename base_ren_type::color_type color_type; - //---------------------------------------------------------------marker_e - enum marker_e + //-------------------------------------------------------------------- + renderer_markers(base_ren_type& rbuf) + : base_type(rbuf) + {} + + //-------------------------------------------------------------------- + bool visible(int x, int y, int r) const { - marker_square, - marker_diamond, - marker_circle, - marker_crossed_circle, - marker_semiellipse_left, - marker_semiellipse_right, - marker_semiellipse_up, - marker_semiellipse_down, - marker_triangle_left, - marker_triangle_right, - marker_triangle_up, - marker_triangle_down, - marker_four_rays, - marker_cross, - marker_x, - marker_dash, - marker_dot, - marker_pixel, - - end_of_markers - }; + rect_i rc(x - r, y - r, x + y, y + r); + return rc.clip(base_type::ren().bounding_clip_box()); + } - - - //--------------------------------------------------------renderer_markers - template class renderer_markers : - public renderer_primitives + //-------------------------------------------------------------------- + void square(int x, int y, int r) { - public: - typedef renderer_primitives base_type; - typedef BaseRenderer base_ren_type; - typedef typename base_ren_type::color_type color_type; - - //-------------------------------------------------------------------- - renderer_markers(base_ren_type& rbuf) : - base_type(rbuf) - {} - - //-------------------------------------------------------------------- - bool visible(int x, int y, int r) const + if (visible(x, y, r)) { - rect_i rc(x-r, y-r, x+y, y+r); - return rc.clip(base_type::ren().bounding_clip_box()); + if (r) + base_type::outlined_rectangle(x - r, y - r, x + r, y + r); + else + base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); } + } - //-------------------------------------------------------------------- - void square(int x, int y, int r) + //-------------------------------------------------------------------- + void diamond(int x, int y, int r) + { + if (visible(x, y, r)) { - if(visible(x, y, r)) - { - if(r) base_type::outlined_rectangle(x-r, y-r, x+r, y+r); - else base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); - } - } - - //-------------------------------------------------------------------- - void diamond(int x, int y, int r) - { - if(visible(x, y, r)) + if (r) { - if(r) + int dy = -r; + int dx = 0; + do { - int dy = -r; - int dx = 0; - do + base_type::ren().blend_pixel(x - dx, y + dy, base_type::line_color(), cover_full); + base_type::ren().blend_pixel(x + dx, y + dy, base_type::line_color(), cover_full); + base_type::ren().blend_pixel(x - dx, y - dy, base_type::line_color(), cover_full); + base_type::ren().blend_pixel(x + dx, y - dy, base_type::line_color(), cover_full); + + if (dx) { - base_type::ren().blend_pixel(x - dx, y + dy, base_type::line_color(), cover_full); - base_type::ren().blend_pixel(x + dx, y + dy, base_type::line_color(), cover_full); - base_type::ren().blend_pixel(x - dx, y - dy, base_type::line_color(), cover_full); - base_type::ren().blend_pixel(x + dx, y - dy, base_type::line_color(), cover_full); - - if(dx) - { - base_type::ren().blend_hline(x-dx+1, y+dy, x+dx-1, base_type::fill_color(), cover_full); - base_type::ren().blend_hline(x-dx+1, y-dy, x+dx-1, base_type::fill_color(), cover_full); - } - ++dy; - ++dx; + base_type::ren().blend_hline(x - dx + 1, + y + dy, + x + dx - 1, + base_type::fill_color(), + cover_full); + base_type::ren().blend_hline(x - dx + 1, + y - dy, + x + dx - 1, + base_type::fill_color(), + cover_full); } - while(dy <= 0); - } - else - { - base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); - } + ++dy; + ++dx; + } while (dy <= 0); } - } - - //-------------------------------------------------------------------- - void circle(int x, int y, int r) - { - if(visible(x, y, r)) + else { - if(r) base_type::outlined_ellipse(x, y, r, r); - else base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); - } - } - - - - //-------------------------------------------------------------------- - void crossed_circle(int x, int y, int r) - { - if(visible(x, y, r)) - { - if(r) - { - base_type::outlined_ellipse(x, y, r, r); - int r6 = r + (r >> 1); - if(r <= 2) r6++; - r >>= 1; - base_type::ren().blend_hline(x-r6, y, x-r, base_type::line_color(), cover_full); - base_type::ren().blend_hline(x+r, y, x+r6, base_type::line_color(), cover_full); - base_type::ren().blend_vline(x, y-r6, y-r, base_type::line_color(), cover_full); - base_type::ren().blend_vline(x, y+r, y+r6, base_type::line_color(), cover_full); - } - else - { - base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); - } - } - } - - - //------------------------------------------------------------------------ - void semiellipse_left(int x, int y, int r) - { - if(visible(x, y, r)) - { - if(r) - { - int r8 = r * 4 / 5; - int dy = -r; - int dx = 0; - ellipse_bresenham_interpolator ei(r * 3 / 5, r+r8); - do - { - dx += ei.dx(); - dy += ei.dy(); - - base_type::ren().blend_pixel(x + dy, y + dx, base_type::line_color(), cover_full); - base_type::ren().blend_pixel(x + dy, y - dx, base_type::line_color(), cover_full); - - if(ei.dy() && dx) - { - base_type::ren().blend_vline(x+dy, y-dx+1, y+dx-1, base_type::fill_color(), cover_full); - } - ++ei; - } - while(dy < r8); - base_type::ren().blend_vline(x+dy, y-dx, y+dx, base_type::line_color(), cover_full); - } - else - { - base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); - } - } - } - - - //-------------------------------------------------------------------- - void semiellipse_right(int x, int y, int r) - { - if(visible(x, y, r)) - { - if(r) - { - int r8 = r * 4 / 5; - int dy = -r; - int dx = 0; - ellipse_bresenham_interpolator ei(r * 3 / 5, r+r8); - do - { - dx += ei.dx(); - dy += ei.dy(); - - base_type::ren().blend_pixel(x - dy, y + dx, base_type::line_color(), cover_full); - base_type::ren().blend_pixel(x - dy, y - dx, base_type::line_color(), cover_full); - - if(ei.dy() && dx) - { - base_type::ren().blend_vline(x-dy, y-dx+1, y+dx-1, base_type::fill_color(), cover_full); - } - ++ei; - } - while(dy < r8); - base_type::ren().blend_vline(x-dy, y-dx, y+dx, base_type::line_color(), cover_full); - } - else - { - base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); - } - } - } - - - //-------------------------------------------------------------------- - void semiellipse_up(int x, int y, int r) - { - if(visible(x, y, r)) - { - if(r) - { - int r8 = r * 4 / 5; - int dy = -r; - int dx = 0; - ellipse_bresenham_interpolator ei(r * 3 / 5, r+r8); - do - { - dx += ei.dx(); - dy += ei.dy(); - - base_type::ren().blend_pixel(x + dx, y - dy, base_type::line_color(), cover_full); - base_type::ren().blend_pixel(x - dx, y - dy, base_type::line_color(), cover_full); - - if(ei.dy() && dx) - { - base_type::ren().blend_hline(x-dx+1, y-dy, x+dx-1, base_type::fill_color(), cover_full); - } - ++ei; - } - while(dy < r8); - base_type::ren().blend_hline(x-dx, y-dy-1, x+dx, base_type::line_color(), cover_full); - } - else - { - base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); - } - } - } - - - //-------------------------------------------------------------------- - void semiellipse_down(int x, int y, int r) - { - if(visible(x, y, r)) - { - if(r) - { - int r8 = r * 4 / 5; - int dy = -r; - int dx = 0; - ellipse_bresenham_interpolator ei(r * 3 / 5, r+r8); - do - { - dx += ei.dx(); - dy += ei.dy(); - - base_type::ren().blend_pixel(x + dx, y + dy, base_type::line_color(), cover_full); - base_type::ren().blend_pixel(x - dx, y + dy, base_type::line_color(), cover_full); - - if(ei.dy() && dx) - { - base_type::ren().blend_hline(x-dx+1, y+dy, x+dx-1, base_type::fill_color(), cover_full); - } - ++ei; - } - while(dy < r8); - base_type::ren().blend_hline(x-dx, y+dy+1, x+dx, base_type::line_color(), cover_full); - } - else - { - base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); - } - } - } - - - //-------------------------------------------------------------------- - void triangle_left(int x, int y, int r) - { - if(visible(x, y, r)) - { - if(r) - { - int dy = -r; - int dx = 0; - int flip = 0; - int r6 = r * 3 / 5; - do - { - base_type::ren().blend_pixel(x + dy, y - dx, base_type::line_color(), cover_full); - base_type::ren().blend_pixel(x + dy, y + dx, base_type::line_color(), cover_full); - - if(dx) - { - base_type::ren().blend_vline(x+dy, y-dx+1, y+dx-1, base_type::fill_color(), cover_full); - } - ++dy; - dx += flip; - flip ^= 1; - } - while(dy < r6); - base_type::ren().blend_vline(x+dy, y-dx, y+dx, base_type::line_color(), cover_full); - } - else - { - base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); - } - } - } - - - //-------------------------------------------------------------------- - void triangle_right(int x, int y, int r) - { - if(visible(x, y, r)) - { - if(r) - { - int dy = -r; - int dx = 0; - int flip = 0; - int r6 = r * 3 / 5; - do - { - base_type::ren().blend_pixel(x - dy, y - dx, base_type::line_color(), cover_full); - base_type::ren().blend_pixel(x - dy, y + dx, base_type::line_color(), cover_full); - - if(dx) - { - base_type::ren().blend_vline(x-dy, y-dx+1, y+dx-1, base_type::fill_color(), cover_full); - } - ++dy; - dx += flip; - flip ^= 1; - } - while(dy < r6); - base_type::ren().blend_vline(x-dy, y-dx, y+dx, base_type::line_color(), cover_full); - } - else - { - base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); - } - } - } - - - //-------------------------------------------------------------------- - void triangle_up(int x, int y, int r) - { - if(visible(x, y, r)) - { - if(r) - { - int dy = -r; - int dx = 0; - int flip = 0; - int r6 = r * 3 / 5; - do - { - base_type::ren().blend_pixel(x - dx, y - dy, base_type::line_color(), cover_full); - base_type::ren().blend_pixel(x + dx, y - dy, base_type::line_color(), cover_full); - - if(dx) - { - base_type::ren().blend_hline(x-dx+1, y-dy, x+dx-1, base_type::fill_color(), cover_full); - } - ++dy; - dx += flip; - flip ^= 1; - } - while(dy < r6); - base_type::ren().blend_hline(x-dx, y-dy, x+dx, base_type::line_color(), cover_full); - } - else - { - base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); - } - } - } - - - //-------------------------------------------------------------------- - void triangle_down(int x, int y, int r) - { - if(visible(x, y, r)) - { - if(r) - { - int dy = -r; - int dx = 0; - int flip = 0; - int r6 = r * 3 / 5; - do - { - base_type::ren().blend_pixel(x - dx, y + dy, base_type::line_color(), cover_full); - base_type::ren().blend_pixel(x + dx, y + dy, base_type::line_color(), cover_full); - - if(dx) - { - base_type::ren().blend_hline(x-dx+1, y+dy, x+dx-1, base_type::fill_color(), cover_full); - } - ++dy; - dx += flip; - flip ^= 1; - } - while(dy < r6); - base_type::ren().blend_hline(x-dx, y+dy, x+dx, base_type::line_color(), cover_full); - } - else - { - base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); - } - } - } - - - //-------------------------------------------------------------------- - void four_rays(int x, int y, int r) - { - if(visible(x, y, r)) - { - if(r) - { - int dy = -r; - int dx = 0; - int flip = 0; - int r3 = -(r / 3); - do - { - base_type::ren().blend_pixel(x - dx, y + dy, base_type::line_color(), cover_full); - base_type::ren().blend_pixel(x + dx, y + dy, base_type::line_color(), cover_full); - base_type::ren().blend_pixel(x - dx, y - dy, base_type::line_color(), cover_full); - base_type::ren().blend_pixel(x + dx, y - dy, base_type::line_color(), cover_full); - base_type::ren().blend_pixel(x + dy, y - dx, base_type::line_color(), cover_full); - base_type::ren().blend_pixel(x + dy, y + dx, base_type::line_color(), cover_full); - base_type::ren().blend_pixel(x - dy, y - dx, base_type::line_color(), cover_full); - base_type::ren().blend_pixel(x - dy, y + dx, base_type::line_color(), cover_full); - - if(dx) - { - base_type::ren().blend_hline(x-dx+1, y+dy, x+dx-1, base_type::fill_color(), cover_full); - base_type::ren().blend_hline(x-dx+1, y-dy, x+dx-1, base_type::fill_color(), cover_full); - base_type::ren().blend_vline(x+dy, y-dx+1, y+dx-1, base_type::fill_color(), cover_full); - base_type::ren().blend_vline(x-dy, y-dx+1, y+dx-1, base_type::fill_color(), cover_full); - } - ++dy; - dx += flip; - flip ^= 1; - } - while(dy <= r3); - base_type::solid_rectangle(x+r3+1, y+r3+1, x-r3-1, y-r3-1); - } - else - { - base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); - } - } - } - - - //-------------------------------------------------------------------- - void cross(int x, int y, int r) - { - if(visible(x, y, r)) - { - if(r) - { - base_type::ren().blend_vline(x, y-r, y+r, base_type::line_color(), cover_full); - base_type::ren().blend_hline(x-r, y, x+r, base_type::line_color(), cover_full); - } - else - { - base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); - } - } - } - - - //-------------------------------------------------------------------- - void xing(int x, int y, int r) - { - if(visible(x, y, r)) - { - if(r) - { - int dy = -r * 7 / 10; - do - { - base_type::ren().blend_pixel(x + dy, y + dy, base_type::line_color(), cover_full); - base_type::ren().blend_pixel(x - dy, y + dy, base_type::line_color(), cover_full); - base_type::ren().blend_pixel(x + dy, y - dy, base_type::line_color(), cover_full); - base_type::ren().blend_pixel(x - dy, y - dy, base_type::line_color(), cover_full); - ++dy; - } - while(dy < 0); - } base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); } } - - - //-------------------------------------------------------------------- - void dash(int x, int y, int r) - { - if(visible(x, y, r)) - { - if(r) base_type::ren().blend_hline(x-r, y, x+r, base_type::line_color(), cover_full); - else base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); - } - } - - - //-------------------------------------------------------------------- - void dot(int x, int y, int r) - { - if(visible(x, y, r)) - { - if(r) base_type::solid_ellipse(x, y, r, r); - else base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); - } - } - - //-------------------------------------------------------------------- - void pixel(int x, int y, int) - { - base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); - } - - //-------------------------------------------------------------------- - void marker(int x, int y, int r, marker_e type) - { - switch(type) - { - case marker_square: square(x, y, r); break; - case marker_diamond: diamond(x, y, r); break; - case marker_circle: circle(x, y, r); break; - case marker_crossed_circle: crossed_circle(x, y, r); break; - case marker_semiellipse_left: semiellipse_left(x, y, r); break; - case marker_semiellipse_right: semiellipse_right(x, y, r); break; - case marker_semiellipse_up: semiellipse_up(x, y, r); break; - case marker_semiellipse_down: semiellipse_down(x, y, r); break; - case marker_triangle_left: triangle_left(x, y, r); break; - case marker_triangle_right: triangle_right(x, y, r); break; - case marker_triangle_up: triangle_up(x, y, r); break; - case marker_triangle_down: triangle_down(x, y, r); break; - case marker_four_rays: four_rays(x, y, r); break; - case marker_cross: cross(x, y, r); break; - case marker_x: xing(x, y, r); break; - case marker_dash: dash(x, y, r); break; - case marker_dot: dot(x, y, r); break; - case marker_pixel: pixel(x, y, r); break; - } - } + } - - //-------------------------------------------------------------------- - template - void markers(int n, const T* x, const T* y, T r, marker_e type) + //-------------------------------------------------------------------- + void circle(int x, int y, int r) + { + if (visible(x, y, r)) { - if(n <= 0) return; - if(r == 0) + if (r) + base_type::outlined_ellipse(x, y, r, r); + else + base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); + } + } + + //-------------------------------------------------------------------- + void crossed_circle(int x, int y, int r) + { + if (visible(x, y, r)) + { + if (r) { + base_type::outlined_ellipse(x, y, r, r); + int r6 = r + (r >> 1); + if (r <= 2) + r6++; + r >>= 1; + base_type::ren().blend_hline(x - r6, y, x - r, base_type::line_color(), cover_full); + base_type::ren().blend_hline(x + r, y, x + r6, base_type::line_color(), cover_full); + base_type::ren().blend_vline(x, y - r6, y - r, base_type::line_color(), cover_full); + base_type::ren().blend_vline(x, y + r, y + r6, base_type::line_color(), cover_full); + } + else + { + base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); + } + } + } + + //------------------------------------------------------------------------ + void semiellipse_left(int x, int y, int r) + { + if (visible(x, y, r)) + { + if (r) + { + int r8 = r * 4 / 5; + int dy = -r; + int dx = 0; + ellipse_bresenham_interpolator ei(r * 3 / 5, r + r8); do { - base_type::ren().blend_pixel(int(*x), int(*y), base_type::fill_color(), cover_full); + dx += ei.dx(); + dy += ei.dy(); + + base_type::ren().blend_pixel(x + dy, y + dx, base_type::line_color(), cover_full); + base_type::ren().blend_pixel(x + dy, y - dx, base_type::line_color(), cover_full); + + if (ei.dy() && dx) + { + base_type::ren().blend_vline(x + dy, + y - dx + 1, + y + dx - 1, + base_type::fill_color(), + cover_full); + } + ++ei; + } while (dy < r8); + base_type::ren().blend_vline(x + dy, y - dx, y + dx, base_type::line_color(), cover_full); + } + else + { + base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); + } + } + } + + //-------------------------------------------------------------------- + void semiellipse_right(int x, int y, int r) + { + if (visible(x, y, r)) + { + if (r) + { + int r8 = r * 4 / 5; + int dy = -r; + int dx = 0; + ellipse_bresenham_interpolator ei(r * 3 / 5, r + r8); + do + { + dx += ei.dx(); + dy += ei.dy(); + + base_type::ren().blend_pixel(x - dy, y + dx, base_type::line_color(), cover_full); + base_type::ren().blend_pixel(x - dy, y - dx, base_type::line_color(), cover_full); + + if (ei.dy() && dx) + { + base_type::ren().blend_vline(x - dy, + y - dx + 1, + y + dx - 1, + base_type::fill_color(), + cover_full); + } + ++ei; + } while (dy < r8); + base_type::ren().blend_vline(x - dy, y - dx, y + dx, base_type::line_color(), cover_full); + } + else + { + base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); + } + } + } + + //-------------------------------------------------------------------- + void semiellipse_up(int x, int y, int r) + { + if (visible(x, y, r)) + { + if (r) + { + int r8 = r * 4 / 5; + int dy = -r; + int dx = 0; + ellipse_bresenham_interpolator ei(r * 3 / 5, r + r8); + do + { + dx += ei.dx(); + dy += ei.dy(); + + base_type::ren().blend_pixel(x + dx, y - dy, base_type::line_color(), cover_full); + base_type::ren().blend_pixel(x - dx, y - dy, base_type::line_color(), cover_full); + + if (ei.dy() && dx) + { + base_type::ren().blend_hline(x - dx + 1, + y - dy, + x + dx - 1, + base_type::fill_color(), + cover_full); + } + ++ei; + } while (dy < r8); + base_type::ren().blend_hline(x - dx, y - dy - 1, x + dx, base_type::line_color(), cover_full); + } + else + { + base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); + } + } + } + + //-------------------------------------------------------------------- + void semiellipse_down(int x, int y, int r) + { + if (visible(x, y, r)) + { + if (r) + { + int r8 = r * 4 / 5; + int dy = -r; + int dx = 0; + ellipse_bresenham_interpolator ei(r * 3 / 5, r + r8); + do + { + dx += ei.dx(); + dy += ei.dy(); + + base_type::ren().blend_pixel(x + dx, y + dy, base_type::line_color(), cover_full); + base_type::ren().blend_pixel(x - dx, y + dy, base_type::line_color(), cover_full); + + if (ei.dy() && dx) + { + base_type::ren().blend_hline(x - dx + 1, + y + dy, + x + dx - 1, + base_type::fill_color(), + cover_full); + } + ++ei; + } while (dy < r8); + base_type::ren().blend_hline(x - dx, y + dy + 1, x + dx, base_type::line_color(), cover_full); + } + else + { + base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); + } + } + } + + //-------------------------------------------------------------------- + void triangle_left(int x, int y, int r) + { + if (visible(x, y, r)) + { + if (r) + { + int dy = -r; + int dx = 0; + int flip = 0; + int r6 = r * 3 / 5; + do + { + base_type::ren().blend_pixel(x + dy, y - dx, base_type::line_color(), cover_full); + base_type::ren().blend_pixel(x + dy, y + dx, base_type::line_color(), cover_full); + + if (dx) + { + base_type::ren().blend_vline(x + dy, + y - dx + 1, + y + dx - 1, + base_type::fill_color(), + cover_full); + } + ++dy; + dx += flip; + flip ^= 1; + } while (dy < r6); + base_type::ren().blend_vline(x + dy, y - dx, y + dx, base_type::line_color(), cover_full); + } + else + { + base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); + } + } + } + + //-------------------------------------------------------------------- + void triangle_right(int x, int y, int r) + { + if (visible(x, y, r)) + { + if (r) + { + int dy = -r; + int dx = 0; + int flip = 0; + int r6 = r * 3 / 5; + do + { + base_type::ren().blend_pixel(x - dy, y - dx, base_type::line_color(), cover_full); + base_type::ren().blend_pixel(x - dy, y + dx, base_type::line_color(), cover_full); + + if (dx) + { + base_type::ren().blend_vline(x - dy, + y - dx + 1, + y + dx - 1, + base_type::fill_color(), + cover_full); + } + ++dy; + dx += flip; + flip ^= 1; + } while (dy < r6); + base_type::ren().blend_vline(x - dy, y - dx, y + dx, base_type::line_color(), cover_full); + } + else + { + base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); + } + } + } + + //-------------------------------------------------------------------- + void triangle_up(int x, int y, int r) + { + if (visible(x, y, r)) + { + if (r) + { + int dy = -r; + int dx = 0; + int flip = 0; + int r6 = r * 3 / 5; + do + { + base_type::ren().blend_pixel(x - dx, y - dy, base_type::line_color(), cover_full); + base_type::ren().blend_pixel(x + dx, y - dy, base_type::line_color(), cover_full); + + if (dx) + { + base_type::ren().blend_hline(x - dx + 1, + y - dy, + x + dx - 1, + base_type::fill_color(), + cover_full); + } + ++dy; + dx += flip; + flip ^= 1; + } while (dy < r6); + base_type::ren().blend_hline(x - dx, y - dy, x + dx, base_type::line_color(), cover_full); + } + else + { + base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); + } + } + } + + //-------------------------------------------------------------------- + void triangle_down(int x, int y, int r) + { + if (visible(x, y, r)) + { + if (r) + { + int dy = -r; + int dx = 0; + int flip = 0; + int r6 = r * 3 / 5; + do + { + base_type::ren().blend_pixel(x - dx, y + dy, base_type::line_color(), cover_full); + base_type::ren().blend_pixel(x + dx, y + dy, base_type::line_color(), cover_full); + + if (dx) + { + base_type::ren().blend_hline(x - dx + 1, + y + dy, + x + dx - 1, + base_type::fill_color(), + cover_full); + } + ++dy; + dx += flip; + flip ^= 1; + } while (dy < r6); + base_type::ren().blend_hline(x - dx, y + dy, x + dx, base_type::line_color(), cover_full); + } + else + { + base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); + } + } + } + + //-------------------------------------------------------------------- + void four_rays(int x, int y, int r) + { + if (visible(x, y, r)) + { + if (r) + { + int dy = -r; + int dx = 0; + int flip = 0; + int r3 = -(r / 3); + do + { + base_type::ren().blend_pixel(x - dx, y + dy, base_type::line_color(), cover_full); + base_type::ren().blend_pixel(x + dx, y + dy, base_type::line_color(), cover_full); + base_type::ren().blend_pixel(x - dx, y - dy, base_type::line_color(), cover_full); + base_type::ren().blend_pixel(x + dx, y - dy, base_type::line_color(), cover_full); + base_type::ren().blend_pixel(x + dy, y - dx, base_type::line_color(), cover_full); + base_type::ren().blend_pixel(x + dy, y + dx, base_type::line_color(), cover_full); + base_type::ren().blend_pixel(x - dy, y - dx, base_type::line_color(), cover_full); + base_type::ren().blend_pixel(x - dy, y + dx, base_type::line_color(), cover_full); + + if (dx) + { + base_type::ren().blend_hline(x - dx + 1, + y + dy, + x + dx - 1, + base_type::fill_color(), + cover_full); + base_type::ren().blend_hline(x - dx + 1, + y - dy, + x + dx - 1, + base_type::fill_color(), + cover_full); + base_type::ren().blend_vline(x + dy, + y - dx + 1, + y + dx - 1, + base_type::fill_color(), + cover_full); + base_type::ren().blend_vline(x - dy, + y - dx + 1, + y + dx - 1, + base_type::fill_color(), + cover_full); + } + ++dy; + dx += flip; + flip ^= 1; + } while (dy <= r3); + base_type::solid_rectangle(x + r3 + 1, y + r3 + 1, x - r3 - 1, y - r3 - 1); + } + else + { + base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); + } + } + } + + //-------------------------------------------------------------------- + void cross(int x, int y, int r) + { + if (visible(x, y, r)) + { + if (r) + { + base_type::ren().blend_vline(x, y - r, y + r, base_type::line_color(), cover_full); + base_type::ren().blend_hline(x - r, y, x + r, base_type::line_color(), cover_full); + } + else + { + base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); + } + } + } + + //-------------------------------------------------------------------- + void xing(int x, int y, int r) + { + if (visible(x, y, r)) + { + if (r) + { + int dy = -r * 7 / 10; + do + { + base_type::ren().blend_pixel(x + dy, y + dy, base_type::line_color(), cover_full); + base_type::ren().blend_pixel(x - dy, y + dy, base_type::line_color(), cover_full); + base_type::ren().blend_pixel(x + dy, y - dy, base_type::line_color(), cover_full); + base_type::ren().blend_pixel(x - dy, y - dy, base_type::line_color(), cover_full); + ++dy; + } while (dy < 0); + } + base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); + } + } + + //-------------------------------------------------------------------- + void dash(int x, int y, int r) + { + if (visible(x, y, r)) + { + if (r) + base_type::ren().blend_hline(x - r, y, x + r, base_type::line_color(), cover_full); + else + base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); + } + } + + //-------------------------------------------------------------------- + void dot(int x, int y, int r) + { + if (visible(x, y, r)) + { + if (r) + base_type::solid_ellipse(x, y, r, r); + else + base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); + } + } + + //-------------------------------------------------------------------- + void pixel(int x, int y, int) { base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); } + + //-------------------------------------------------------------------- + void marker(int x, int y, int r, marker_e type) + { + switch (type) + { + case marker_square: + square(x, y, r); + break; + case marker_diamond: + diamond(x, y, r); + break; + case marker_circle: + circle(x, y, r); + break; + case marker_crossed_circle: + crossed_circle(x, y, r); + break; + case marker_semiellipse_left: + semiellipse_left(x, y, r); + break; + case marker_semiellipse_right: + semiellipse_right(x, y, r); + break; + case marker_semiellipse_up: + semiellipse_up(x, y, r); + break; + case marker_semiellipse_down: + semiellipse_down(x, y, r); + break; + case marker_triangle_left: + triangle_left(x, y, r); + break; + case marker_triangle_right: + triangle_right(x, y, r); + break; + case marker_triangle_up: + triangle_up(x, y, r); + break; + case marker_triangle_down: + triangle_down(x, y, r); + break; + case marker_four_rays: + four_rays(x, y, r); + break; + case marker_cross: + cross(x, y, r); + break; + case marker_x: + xing(x, y, r); + break; + case marker_dash: + dash(x, y, r); + break; + case marker_dot: + dot(x, y, r); + break; + case marker_pixel: + pixel(x, y, r); + break; + } + } + + //-------------------------------------------------------------------- + template + void markers(int n, const T* x, const T* y, T r, marker_e type) + { + if (n <= 0) + return; + if (r == 0) + { + do + { + base_type::ren().blend_pixel(int(*x), int(*y), base_type::fill_color(), cover_full); + ++x; + ++y; + } while (--n); + return; + } + + switch (type) + { + case marker_square: + do + { + square(int(*x), int(*y), int(r)); ++x; ++y; - } - while(--n); - return; - } - - switch(type) - { - case marker_square: do { square (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; - case marker_diamond: do { diamond (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; - case marker_circle: do { circle (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; - case marker_crossed_circle: do { crossed_circle (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; - case marker_semiellipse_left: do { semiellipse_left (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; - case marker_semiellipse_right: do { semiellipse_right(int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; - case marker_semiellipse_up: do { semiellipse_up (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; - case marker_semiellipse_down: do { semiellipse_down (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; - case marker_triangle_left: do { triangle_left (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; - case marker_triangle_right: do { triangle_right (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; - case marker_triangle_up: do { triangle_up (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; - case marker_triangle_down: do { triangle_down (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; - case marker_four_rays: do { four_rays (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; - case marker_cross: do { cross (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; - case marker_x: do { xing (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; - case marker_dash: do { dash (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; - case marker_dot: do { dot (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; - case marker_pixel: do { pixel (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; - } + } while (--n); + break; + case marker_diamond: + do + { + diamond(int(*x), int(*y), int(r)); + ++x; + ++y; + } while (--n); + break; + case marker_circle: + do + { + circle(int(*x), int(*y), int(r)); + ++x; + ++y; + } while (--n); + break; + case marker_crossed_circle: + do + { + crossed_circle(int(*x), int(*y), int(r)); + ++x; + ++y; + } while (--n); + break; + case marker_semiellipse_left: + do + { + semiellipse_left(int(*x), int(*y), int(r)); + ++x; + ++y; + } while (--n); + break; + case marker_semiellipse_right: + do + { + semiellipse_right(int(*x), int(*y), int(r)); + ++x; + ++y; + } while (--n); + break; + case marker_semiellipse_up: + do + { + semiellipse_up(int(*x), int(*y), int(r)); + ++x; + ++y; + } while (--n); + break; + case marker_semiellipse_down: + do + { + semiellipse_down(int(*x), int(*y), int(r)); + ++x; + ++y; + } while (--n); + break; + case marker_triangle_left: + do + { + triangle_left(int(*x), int(*y), int(r)); + ++x; + ++y; + } while (--n); + break; + case marker_triangle_right: + do + { + triangle_right(int(*x), int(*y), int(r)); + ++x; + ++y; + } while (--n); + break; + case marker_triangle_up: + do + { + triangle_up(int(*x), int(*y), int(r)); + ++x; + ++y; + } while (--n); + break; + case marker_triangle_down: + do + { + triangle_down(int(*x), int(*y), int(r)); + ++x; + ++y; + } while (--n); + break; + case marker_four_rays: + do + { + four_rays(int(*x), int(*y), int(r)); + ++x; + ++y; + } while (--n); + break; + case marker_cross: + do + { + cross(int(*x), int(*y), int(r)); + ++x; + ++y; + } while (--n); + break; + case marker_x: + do + { + xing(int(*x), int(*y), int(r)); + ++x; + ++y; + } while (--n); + break; + case marker_dash: + do + { + dash(int(*x), int(*y), int(r)); + ++x; + ++y; + } while (--n); + break; + case marker_dot: + do + { + dot(int(*x), int(*y), int(r)); + ++x; + ++y; + } while (--n); + break; + case marker_pixel: + do + { + pixel(int(*x), int(*y), int(r)); + ++x; + ++y; + } while (--n); + break; } - - //-------------------------------------------------------------------- - template - void markers(int n, const T* x, const T* y, const T* r, marker_e type) - { - if(n <= 0) return; - switch(type) - { - case marker_square: do { square (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; - case marker_diamond: do { diamond (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; - case marker_circle: do { circle (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; - case marker_crossed_circle: do { crossed_circle (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; - case marker_semiellipse_left: do { semiellipse_left (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; - case marker_semiellipse_right: do { semiellipse_right(int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; - case marker_semiellipse_up: do { semiellipse_up (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; - case marker_semiellipse_down: do { semiellipse_down (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; - case marker_triangle_left: do { triangle_left (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; - case marker_triangle_right: do { triangle_right (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; - case marker_triangle_up: do { triangle_up (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; - case marker_triangle_down: do { triangle_down (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; - case marker_four_rays: do { four_rays (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; - case marker_cross: do { cross (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; - case marker_x: do { xing (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; - case marker_dash: do { dash (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; - case marker_dot: do { dot (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; - case marker_pixel: do { pixel (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; - } - } - - //-------------------------------------------------------------------- - template - void markers(int n, const T* x, const T* y, const T* r, const color_type* fc, marker_e type) - { - if(n <= 0) return; - switch(type) - { - case marker_square: do { base_type::fill_color(*fc); square (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; - case marker_diamond: do { base_type::fill_color(*fc); diamond (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; - case marker_circle: do { base_type::fill_color(*fc); circle (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; - case marker_crossed_circle: do { base_type::fill_color(*fc); crossed_circle (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; - case marker_semiellipse_left: do { base_type::fill_color(*fc); semiellipse_left (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; - case marker_semiellipse_right: do { base_type::fill_color(*fc); semiellipse_right(int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; - case marker_semiellipse_up: do { base_type::fill_color(*fc); semiellipse_up (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; - case marker_semiellipse_down: do { base_type::fill_color(*fc); semiellipse_down (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; - case marker_triangle_left: do { base_type::fill_color(*fc); triangle_left (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; - case marker_triangle_right: do { base_type::fill_color(*fc); triangle_right (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; - case marker_triangle_up: do { base_type::fill_color(*fc); triangle_up (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; - case marker_triangle_down: do { base_type::fill_color(*fc); triangle_down (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; - case marker_four_rays: do { base_type::fill_color(*fc); four_rays (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; - case marker_cross: do { base_type::fill_color(*fc); cross (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; - case marker_x: do { base_type::fill_color(*fc); xing (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; - case marker_dash: do { base_type::fill_color(*fc); dash (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; - case marker_dot: do { base_type::fill_color(*fc); dot (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; - case marker_pixel: do { base_type::fill_color(*fc); pixel (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; - } - } - - //-------------------------------------------------------------------- - template - void markers(int n, const T* x, const T* y, const T* r, const color_type* fc, const color_type* lc, marker_e type) - { - if(n <= 0) return; - switch(type) - { - case marker_square: do { base_type::fill_color(*fc); base_type::line_color(*lc); square (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; - case marker_diamond: do { base_type::fill_color(*fc); base_type::line_color(*lc); diamond (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; - case marker_circle: do { base_type::fill_color(*fc); base_type::line_color(*lc); circle (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; - case marker_crossed_circle: do { base_type::fill_color(*fc); base_type::line_color(*lc); crossed_circle (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; - case marker_semiellipse_left: do { base_type::fill_color(*fc); base_type::line_color(*lc); semiellipse_left (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; - case marker_semiellipse_right: do { base_type::fill_color(*fc); base_type::line_color(*lc); semiellipse_right(int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; - case marker_semiellipse_up: do { base_type::fill_color(*fc); base_type::line_color(*lc); semiellipse_up (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; - case marker_semiellipse_down: do { base_type::fill_color(*fc); base_type::line_color(*lc); semiellipse_down (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; - case marker_triangle_left: do { base_type::fill_color(*fc); base_type::line_color(*lc); triangle_left (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; - case marker_triangle_right: do { base_type::fill_color(*fc); base_type::line_color(*lc); triangle_right (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; - case marker_triangle_up: do { base_type::fill_color(*fc); base_type::line_color(*lc); triangle_up (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; - case marker_triangle_down: do { base_type::fill_color(*fc); base_type::line_color(*lc); triangle_down (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; - case marker_four_rays: do { base_type::fill_color(*fc); base_type::line_color(*lc); four_rays (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; - case marker_cross: do { base_type::fill_color(*fc); base_type::line_color(*lc); cross (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; - case marker_x: do { base_type::fill_color(*fc); base_type::line_color(*lc); xing (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; - case marker_dash: do { base_type::fill_color(*fc); base_type::line_color(*lc); dash (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; - case marker_dot: do { base_type::fill_color(*fc); base_type::line_color(*lc); dot (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; - case marker_pixel: do { base_type::fill_color(*fc); base_type::line_color(*lc); pixel (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; - } - } - }; + } -} + //-------------------------------------------------------------------- + template + void markers(int n, const T* x, const T* y, const T* r, marker_e type) + { + if (n <= 0) + return; + switch (type) + { + case marker_square: + do + { + square(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + } while (--n); + break; + case marker_diamond: + do + { + diamond(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + } while (--n); + break; + case marker_circle: + do + { + circle(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + } while (--n); + break; + case marker_crossed_circle: + do + { + crossed_circle(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + } while (--n); + break; + case marker_semiellipse_left: + do + { + semiellipse_left(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + } while (--n); + break; + case marker_semiellipse_right: + do + { + semiellipse_right(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + } while (--n); + break; + case marker_semiellipse_up: + do + { + semiellipse_up(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + } while (--n); + break; + case marker_semiellipse_down: + do + { + semiellipse_down(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + } while (--n); + break; + case marker_triangle_left: + do + { + triangle_left(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + } while (--n); + break; + case marker_triangle_right: + do + { + triangle_right(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + } while (--n); + break; + case marker_triangle_up: + do + { + triangle_up(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + } while (--n); + break; + case marker_triangle_down: + do + { + triangle_down(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + } while (--n); + break; + case marker_four_rays: + do + { + four_rays(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + } while (--n); + break; + case marker_cross: + do + { + cross(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + } while (--n); + break; + case marker_x: + do + { + xing(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + } while (--n); + break; + case marker_dash: + do + { + dash(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + } while (--n); + break; + case marker_dot: + do + { + dot(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + } while (--n); + break; + case marker_pixel: + do + { + pixel(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + } while (--n); + break; + } + } + + //-------------------------------------------------------------------- + template + void markers(int n, const T* x, const T* y, const T* r, const color_type* fc, marker_e type) + { + if (n <= 0) + return; + switch (type) + { + case marker_square: + do + { + base_type::fill_color(*fc); + square(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + } while (--n); + break; + case marker_diamond: + do + { + base_type::fill_color(*fc); + diamond(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + } while (--n); + break; + case marker_circle: + do + { + base_type::fill_color(*fc); + circle(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + } while (--n); + break; + case marker_crossed_circle: + do + { + base_type::fill_color(*fc); + crossed_circle(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + } while (--n); + break; + case marker_semiellipse_left: + do + { + base_type::fill_color(*fc); + semiellipse_left(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + } while (--n); + break; + case marker_semiellipse_right: + do + { + base_type::fill_color(*fc); + semiellipse_right(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + } while (--n); + break; + case marker_semiellipse_up: + do + { + base_type::fill_color(*fc); + semiellipse_up(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + } while (--n); + break; + case marker_semiellipse_down: + do + { + base_type::fill_color(*fc); + semiellipse_down(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + } while (--n); + break; + case marker_triangle_left: + do + { + base_type::fill_color(*fc); + triangle_left(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + } while (--n); + break; + case marker_triangle_right: + do + { + base_type::fill_color(*fc); + triangle_right(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + } while (--n); + break; + case marker_triangle_up: + do + { + base_type::fill_color(*fc); + triangle_up(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + } while (--n); + break; + case marker_triangle_down: + do + { + base_type::fill_color(*fc); + triangle_down(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + } while (--n); + break; + case marker_four_rays: + do + { + base_type::fill_color(*fc); + four_rays(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + } while (--n); + break; + case marker_cross: + do + { + base_type::fill_color(*fc); + cross(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + } while (--n); + break; + case marker_x: + do + { + base_type::fill_color(*fc); + xing(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + } while (--n); + break; + case marker_dash: + do + { + base_type::fill_color(*fc); + dash(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + } while (--n); + break; + case marker_dot: + do + { + base_type::fill_color(*fc); + dot(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + } while (--n); + break; + case marker_pixel: + do + { + base_type::fill_color(*fc); + pixel(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + } while (--n); + break; + } + } + + //-------------------------------------------------------------------- + template + void markers(int n, const T* x, const T* y, const T* r, const color_type* fc, const color_type* lc, marker_e type) + { + if (n <= 0) + return; + switch (type) + { + case marker_square: + do + { + base_type::fill_color(*fc); + base_type::line_color(*lc); + square(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + ++lc; + } while (--n); + break; + case marker_diamond: + do + { + base_type::fill_color(*fc); + base_type::line_color(*lc); + diamond(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + ++lc; + } while (--n); + break; + case marker_circle: + do + { + base_type::fill_color(*fc); + base_type::line_color(*lc); + circle(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + ++lc; + } while (--n); + break; + case marker_crossed_circle: + do + { + base_type::fill_color(*fc); + base_type::line_color(*lc); + crossed_circle(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + ++lc; + } while (--n); + break; + case marker_semiellipse_left: + do + { + base_type::fill_color(*fc); + base_type::line_color(*lc); + semiellipse_left(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + ++lc; + } while (--n); + break; + case marker_semiellipse_right: + do + { + base_type::fill_color(*fc); + base_type::line_color(*lc); + semiellipse_right(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + ++lc; + } while (--n); + break; + case marker_semiellipse_up: + do + { + base_type::fill_color(*fc); + base_type::line_color(*lc); + semiellipse_up(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + ++lc; + } while (--n); + break; + case marker_semiellipse_down: + do + { + base_type::fill_color(*fc); + base_type::line_color(*lc); + semiellipse_down(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + ++lc; + } while (--n); + break; + case marker_triangle_left: + do + { + base_type::fill_color(*fc); + base_type::line_color(*lc); + triangle_left(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + ++lc; + } while (--n); + break; + case marker_triangle_right: + do + { + base_type::fill_color(*fc); + base_type::line_color(*lc); + triangle_right(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + ++lc; + } while (--n); + break; + case marker_triangle_up: + do + { + base_type::fill_color(*fc); + base_type::line_color(*lc); + triangle_up(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + ++lc; + } while (--n); + break; + case marker_triangle_down: + do + { + base_type::fill_color(*fc); + base_type::line_color(*lc); + triangle_down(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + ++lc; + } while (--n); + break; + case marker_four_rays: + do + { + base_type::fill_color(*fc); + base_type::line_color(*lc); + four_rays(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + ++lc; + } while (--n); + break; + case marker_cross: + do + { + base_type::fill_color(*fc); + base_type::line_color(*lc); + cross(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + ++lc; + } while (--n); + break; + case marker_x: + do + { + base_type::fill_color(*fc); + base_type::line_color(*lc); + xing(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + ++lc; + } while (--n); + break; + case marker_dash: + do + { + base_type::fill_color(*fc); + base_type::line_color(*lc); + dash(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + ++lc; + } while (--n); + break; + case marker_dot: + do + { + base_type::fill_color(*fc); + base_type::line_color(*lc); + dot(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + ++lc; + } while (--n); + break; + case marker_pixel: + do + { + base_type::fill_color(*fc); + base_type::line_color(*lc); + pixel(int(*x), int(*y), int(*r)); + ++x; + ++y; + ++r; + ++fc; + ++lc; + } while (--n); + break; + } + } +}; + +} // namespace agg #endif diff --git a/deps/agg/include/agg_renderer_mclip.h b/deps/agg/include/agg_renderer_mclip.h index 96a7d4e09..d6fcabc42 100644 --- a/deps/agg/include/agg_renderer_mclip.h +++ b/deps/agg/include/agg_renderer_mclip.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -24,326 +24,303 @@ #include "agg_array.h" #include "agg_renderer_base.h" -namespace agg +namespace agg { + +//----------------------------------------------------------renderer_mclip +template +class renderer_mclip { + public: + typedef PixelFormat pixfmt_type; + typedef typename pixfmt_type::color_type color_type; + typedef typename pixfmt_type::row_data row_data; + typedef renderer_base base_ren_type; - //----------------------------------------------------------renderer_mclip - template class renderer_mclip + //-------------------------------------------------------------------- + explicit renderer_mclip(pixfmt_type& pixf) + : m_ren(pixf) + , m_curr_cb(0) + , m_bounds(m_ren.xmin(), m_ren.ymin(), m_ren.xmax(), m_ren.ymax()) + {} + void attach(pixfmt_type& pixf) { - public: - typedef PixelFormat pixfmt_type; - typedef typename pixfmt_type::color_type color_type; - typedef typename pixfmt_type::row_data row_data; - typedef renderer_base base_ren_type; + m_ren.attach(pixf); + reset_clipping(true); + } - //-------------------------------------------------------------------- - explicit renderer_mclip(pixfmt_type& pixf) : - m_ren(pixf), - m_curr_cb(0), - m_bounds(m_ren.xmin(), m_ren.ymin(), m_ren.xmax(), m_ren.ymax()) - {} - void attach(pixfmt_type& pixf) + //-------------------------------------------------------------------- + const pixfmt_type& ren() const { return m_ren.ren(); } + pixfmt_type& ren() { return m_ren.ren(); } + + //-------------------------------------------------------------------- + unsigned width() const { return m_ren.width(); } + unsigned height() const { return m_ren.height(); } + + //-------------------------------------------------------------------- + const rect_i& clip_box() const { return m_ren.clip_box(); } + int xmin() const { return m_ren.xmin(); } + int ymin() const { return m_ren.ymin(); } + int xmax() const { return m_ren.xmax(); } + int ymax() const { return m_ren.ymax(); } + + //-------------------------------------------------------------------- + const rect_i& bounding_clip_box() const { return m_bounds; } + int bounding_xmin() const { return m_bounds.x1; } + int bounding_ymin() const { return m_bounds.y1; } + int bounding_xmax() const { return m_bounds.x2; } + int bounding_ymax() const { return m_bounds.y2; } + + //-------------------------------------------------------------------- + void first_clip_box() + { + m_curr_cb = 0; + if (m_clip.size()) { - m_ren.attach(pixf); - reset_clipping(true); + const rect_i& cb = m_clip[0]; + m_ren.clip_box_naked(cb.x1, cb.y1, cb.x2, cb.y2); } - - //-------------------------------------------------------------------- - const pixfmt_type& ren() const { return m_ren.ren(); } - pixfmt_type& ren() { return m_ren.ren(); } + } - //-------------------------------------------------------------------- - unsigned width() const { return m_ren.width(); } - unsigned height() const { return m_ren.height(); } - - //-------------------------------------------------------------------- - const rect_i& clip_box() const { return m_ren.clip_box(); } - int xmin() const { return m_ren.xmin(); } - int ymin() const { return m_ren.ymin(); } - int xmax() const { return m_ren.xmax(); } - int ymax() const { return m_ren.ymax(); } - - //-------------------------------------------------------------------- - const rect_i& bounding_clip_box() const { return m_bounds; } - int bounding_xmin() const { return m_bounds.x1; } - int bounding_ymin() const { return m_bounds.y1; } - int bounding_xmax() const { return m_bounds.x2; } - int bounding_ymax() const { return m_bounds.y2; } - - //-------------------------------------------------------------------- - void first_clip_box() + //-------------------------------------------------------------------- + bool next_clip_box() + { + if (++m_curr_cb < m_clip.size()) { - m_curr_cb = 0; - if(m_clip.size()) + const rect_i& cb = m_clip[m_curr_cb]; + m_ren.clip_box_naked(cb.x1, cb.y1, cb.x2, cb.y2); + return true; + } + return false; + } + + //-------------------------------------------------------------------- + void reset_clipping(bool visibility) + { + m_ren.reset_clipping(visibility); + m_clip.remove_all(); + m_curr_cb = 0; + m_bounds = m_ren.clip_box(); + } + + //-------------------------------------------------------------------- + void add_clip_box(int x1, int y1, int x2, int y2) + { + rect_i cb(x1, y1, x2, y2); + cb.normalize(); + if (cb.clip(rect_i(0, 0, width() - 1, height() - 1))) + { + m_clip.add(cb); + if (cb.x1 < m_bounds.x1) + m_bounds.x1 = cb.x1; + if (cb.y1 < m_bounds.y1) + m_bounds.y1 = cb.y1; + if (cb.x2 > m_bounds.x2) + m_bounds.x2 = cb.x2; + if (cb.y2 > m_bounds.y2) + m_bounds.y2 = cb.y2; + } + } + + //-------------------------------------------------------------------- + void clear(const color_type& c) { m_ren.clear(c); } + + //-------------------------------------------------------------------- + void copy_pixel(int x, int y, const color_type& c) + { + first_clip_box(); + do + { + if (m_ren.inbox(x, y)) { - const rect_i& cb = m_clip[0]; - m_ren.clip_box_naked(cb.x1, cb.y1, cb.x2, cb.y2); + m_ren.ren().copy_pixel(x, y, c); + break; } - } + } while (next_clip_box()); + } - //-------------------------------------------------------------------- - bool next_clip_box() - { - if(++m_curr_cb < m_clip.size()) + //-------------------------------------------------------------------- + void blend_pixel(int x, int y, const color_type& c, cover_type cover) + { + first_clip_box(); + do + { + if (m_ren.inbox(x, y)) { - const rect_i& cb = m_clip[m_curr_cb]; - m_ren.clip_box_naked(cb.x1, cb.y1, cb.x2, cb.y2); - return true; + m_ren.ren().blend_pixel(x, y, c, cover); + break; } - return false; - } + } while (next_clip_box()); + } - //-------------------------------------------------------------------- - void reset_clipping(bool visibility) + //-------------------------------------------------------------------- + color_type pixel(int x, int y) const + { + first_clip_box(); + do { - m_ren.reset_clipping(visibility); - m_clip.remove_all(); - m_curr_cb = 0; - m_bounds = m_ren.clip_box(); - } - - //-------------------------------------------------------------------- - void add_clip_box(int x1, int y1, int x2, int y2) - { - rect_i cb(x1, y1, x2, y2); - cb.normalize(); - if(cb.clip(rect_i(0, 0, width() - 1, height() - 1))) + if (m_ren.inbox(x, y)) { - m_clip.add(cb); - if(cb.x1 < m_bounds.x1) m_bounds.x1 = cb.x1; - if(cb.y1 < m_bounds.y1) m_bounds.y1 = cb.y1; - if(cb.x2 > m_bounds.x2) m_bounds.x2 = cb.x2; - if(cb.y2 > m_bounds.y2) m_bounds.y2 = cb.y2; + return m_ren.ren().pixel(x, y); } - } + } while (next_clip_box()); + return color_type::no_color(); + } - //-------------------------------------------------------------------- - void clear(const color_type& c) + //-------------------------------------------------------------------- + void copy_hline(int x1, int y, int x2, const color_type& c) + { + first_clip_box(); + do { - m_ren.clear(c); - } - - //-------------------------------------------------------------------- - void copy_pixel(int x, int y, const color_type& c) + m_ren.copy_hline(x1, y, x2, c); + } while (next_clip_box()); + } + + //-------------------------------------------------------------------- + void copy_vline(int x, int y1, int y2, const color_type& c) + { + first_clip_box(); + do { - first_clip_box(); - do - { - if(m_ren.inbox(x, y)) - { - m_ren.ren().copy_pixel(x, y, c); - break; - } - } - while(next_clip_box()); - } + m_ren.copy_vline(x, y1, y2, c); + } while (next_clip_box()); + } - //-------------------------------------------------------------------- - void blend_pixel(int x, int y, const color_type& c, cover_type cover) + //-------------------------------------------------------------------- + void blend_hline(int x1, int y, int x2, const color_type& c, cover_type cover) + { + first_clip_box(); + do { - first_clip_box(); - do - { - if(m_ren.inbox(x, y)) - { - m_ren.ren().blend_pixel(x, y, c, cover); - break; - } - } - while(next_clip_box()); - } + m_ren.blend_hline(x1, y, x2, c, cover); + } while (next_clip_box()); + } - //-------------------------------------------------------------------- - color_type pixel(int x, int y) const + //-------------------------------------------------------------------- + void blend_vline(int x, int y1, int y2, const color_type& c, cover_type cover) + { + first_clip_box(); + do { - first_clip_box(); - do - { - if(m_ren.inbox(x, y)) - { - return m_ren.ren().pixel(x, y); - } - } - while(next_clip_box()); - return color_type::no_color(); - } + m_ren.blend_vline(x, y1, y2, c, cover); + } while (next_clip_box()); + } - //-------------------------------------------------------------------- - void copy_hline(int x1, int y, int x2, const color_type& c) + //-------------------------------------------------------------------- + void copy_bar(int x1, int y1, int x2, int y2, const color_type& c) + { + first_clip_box(); + do { - first_clip_box(); - do - { - m_ren.copy_hline(x1, y, x2, c); - } - while(next_clip_box()); - } + m_ren.copy_bar(x1, y1, x2, y2, c); + } while (next_clip_box()); + } - //-------------------------------------------------------------------- - void copy_vline(int x, int y1, int y2, const color_type& c) + //-------------------------------------------------------------------- + void blend_bar(int x1, int y1, int x2, int y2, const color_type& c, cover_type cover) + { + first_clip_box(); + do { - first_clip_box(); - do - { - m_ren.copy_vline(x, y1, y2, c); - } - while(next_clip_box()); - } + m_ren.blend_bar(x1, y1, x2, y2, c, cover); + } while (next_clip_box()); + } - //-------------------------------------------------------------------- - void blend_hline(int x1, int y, int x2, - const color_type& c, cover_type cover) + //-------------------------------------------------------------------- + void blend_solid_hspan(int x, int y, int len, const color_type& c, const cover_type* covers) + { + first_clip_box(); + do { - first_clip_box(); - do - { - m_ren.blend_hline(x1, y, x2, c, cover); - } - while(next_clip_box()); - } + m_ren.blend_solid_hspan(x, y, len, c, covers); + } while (next_clip_box()); + } - //-------------------------------------------------------------------- - void blend_vline(int x, int y1, int y2, - const color_type& c, cover_type cover) + //-------------------------------------------------------------------- + void blend_solid_vspan(int x, int y, int len, const color_type& c, const cover_type* covers) + { + first_clip_box(); + do { - first_clip_box(); - do - { - m_ren.blend_vline(x, y1, y2, c, cover); - } - while(next_clip_box()); - } + m_ren.blend_solid_vspan(x, y, len, c, covers); + } while (next_clip_box()); + } - //-------------------------------------------------------------------- - void copy_bar(int x1, int y1, int x2, int y2, const color_type& c) + //-------------------------------------------------------------------- + void copy_color_hspan(int x, int y, int len, const color_type* colors) + { + first_clip_box(); + do { - first_clip_box(); - do - { - m_ren.copy_bar(x1, y1, x2, y2, c); - } - while(next_clip_box()); - } + m_ren.copy_color_hspan(x, y, len, colors); + } while (next_clip_box()); + } - //-------------------------------------------------------------------- - void blend_bar(int x1, int y1, int x2, int y2, - const color_type& c, cover_type cover) + //-------------------------------------------------------------------- + void blend_color_hspan(int x, + int y, + int len, + const color_type* colors, + const cover_type* covers, + cover_type cover = cover_full) + { + first_clip_box(); + do { - first_clip_box(); - do - { - m_ren.blend_bar(x1, y1, x2, y2, c, cover); - } - while(next_clip_box()); - } + m_ren.blend_color_hspan(x, y, len, colors, covers, cover); + } while (next_clip_box()); + } - //-------------------------------------------------------------------- - void blend_solid_hspan(int x, int y, int len, - const color_type& c, const cover_type* covers) + //-------------------------------------------------------------------- + void blend_color_vspan(int x, + int y, + int len, + const color_type* colors, + const cover_type* covers, + cover_type cover = cover_full) + { + first_clip_box(); + do { - first_clip_box(); - do - { - m_ren.blend_solid_hspan(x, y, len, c, covers); - } - while(next_clip_box()); - } + m_ren.blend_color_vspan(x, y, len, colors, covers, cover); + } while (next_clip_box()); + } - //-------------------------------------------------------------------- - void blend_solid_vspan(int x, int y, int len, - const color_type& c, const cover_type* covers) + //-------------------------------------------------------------------- + void copy_from(const rendering_buffer& from, const rect_i* rc = 0, int x_to = 0, int y_to = 0) + { + first_clip_box(); + do { - first_clip_box(); - do - { - m_ren.blend_solid_vspan(x, y, len, c, covers); - } - while(next_clip_box()); - } + m_ren.copy_from(from, rc, x_to, y_to); + } while (next_clip_box()); + } - - //-------------------------------------------------------------------- - void copy_color_hspan(int x, int y, int len, const color_type* colors) + //-------------------------------------------------------------------- + template + void blend_from(const SrcPixelFormatRenderer& src, + const rect_i* rect_src_ptr = 0, + int dx = 0, + int dy = 0, + cover_type cover = cover_full) + { + first_clip_box(); + do { - first_clip_box(); - do - { - m_ren.copy_color_hspan(x, y, len, colors); - } - while(next_clip_box()); - } + m_ren.blend_from(src, rect_src_ptr, dx, dy, cover); + } while (next_clip_box()); + } - //-------------------------------------------------------------------- - void blend_color_hspan(int x, int y, int len, - const color_type* colors, - const cover_type* covers, - cover_type cover = cover_full) - { - first_clip_box(); - do - { - m_ren.blend_color_hspan(x, y, len, colors, covers, cover); - } - while(next_clip_box()); - } + private: + renderer_mclip(const renderer_mclip&); + const renderer_mclip& operator=(const renderer_mclip&); - //-------------------------------------------------------------------- - void blend_color_vspan(int x, int y, int len, - const color_type* colors, - const cover_type* covers, - cover_type cover = cover_full) - { - first_clip_box(); - do - { - m_ren.blend_color_vspan(x, y, len, colors, covers, cover); - } - while(next_clip_box()); - } + base_ren_type m_ren; + pod_bvector m_clip; + unsigned m_curr_cb; + rect_i m_bounds; +}; - //-------------------------------------------------------------------- - void copy_from(const rendering_buffer& from, - const rect_i* rc=0, - int x_to=0, - int y_to=0) - { - first_clip_box(); - do - { - m_ren.copy_from(from, rc, x_to, y_to); - } - while(next_clip_box()); - } - - //-------------------------------------------------------------------- - template - void blend_from(const SrcPixelFormatRenderer& src, - const rect_i* rect_src_ptr = 0, - int dx = 0, - int dy = 0, - cover_type cover = cover_full) - { - first_clip_box(); - do - { - m_ren.blend_from(src, rect_src_ptr, dx, dy, cover); - } - while(next_clip_box()); - } - - - private: - renderer_mclip(const renderer_mclip&); - const renderer_mclip& - operator = (const renderer_mclip&); - - base_ren_type m_ren; - pod_bvector m_clip; - unsigned m_curr_cb; - rect_i m_bounds; - }; - - -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_renderer_outline_aa.h b/deps/agg/include/agg_renderer_outline_aa.h index b2d3dd42b..aa4c23b4c 100644 --- a/deps/agg/include/agg_renderer_outline_aa.h +++ b/deps/agg/include/agg_renderer_outline_aa.h @@ -24,1817 +24,1777 @@ #include "agg_gamma_functions.h" #include "agg_clip_liang_barsky.h" -namespace agg +namespace agg { + +//===================================================distance_interpolator0 +class distance_interpolator0 { - - //===================================================distance_interpolator0 - class distance_interpolator0 + public: + //--------------------------------------------------------------------- + distance_interpolator0() {} + distance_interpolator0(int x1, int y1, int x2, int y2, int x, int y) + : m_dx(line_mr(x2) - line_mr(x1)) + , m_dy(line_mr(y2) - line_mr(y1)) + , m_dist((line_mr(x + line_subpixel_scale / 2) - line_mr(x2)) * m_dy - + (line_mr(y + line_subpixel_scale / 2) - line_mr(y2)) * m_dx) { - public: - //--------------------------------------------------------------------- - distance_interpolator0() {} - distance_interpolator0(int x1, int y1, int x2, int y2, int x, int y) : - m_dx(line_mr(x2) - line_mr(x1)), - m_dy(line_mr(y2) - line_mr(y1)), - m_dist((line_mr(x + line_subpixel_scale/2) - line_mr(x2)) * m_dy - - (line_mr(y + line_subpixel_scale/2) - line_mr(y2)) * m_dx) - { - m_dx *= line_mr_subpixel_scale; - m_dy *= line_mr_subpixel_scale; - } + m_dx *= line_mr_subpixel_scale; + m_dy *= line_mr_subpixel_scale; + } - //--------------------------------------------------------------------- - void inc_x() { m_dist += m_dy; } - int dist() const { return m_dist; } + //--------------------------------------------------------------------- + void inc_x() { m_dist += m_dy; } + int dist() const { return m_dist; } - private: - //--------------------------------------------------------------------- - int m_dx; - int m_dy; - int m_dist; - }; + private: + //--------------------------------------------------------------------- + int m_dx; + int m_dy; + int m_dist; +}; - //==================================================distance_interpolator00 - class distance_interpolator00 +//==================================================distance_interpolator00 +class distance_interpolator00 +{ + public: + //--------------------------------------------------------------------- + distance_interpolator00() {} + distance_interpolator00(int xc, int yc, int x1, int y1, int x2, int y2, int x, int y) + : m_dx1(line_mr(x1) - line_mr(xc)) + , m_dy1(line_mr(y1) - line_mr(yc)) + , m_dx2(line_mr(x2) - line_mr(xc)) + , m_dy2(line_mr(y2) - line_mr(yc)) + , m_dist1((line_mr(x + line_subpixel_scale / 2) - line_mr(x1)) * m_dy1 - + (line_mr(y + line_subpixel_scale / 2) - line_mr(y1)) * m_dx1) + , m_dist2((line_mr(x + line_subpixel_scale / 2) - line_mr(x2)) * m_dy2 - + (line_mr(y + line_subpixel_scale / 2) - line_mr(y2)) * m_dx2) { - public: - //--------------------------------------------------------------------- - distance_interpolator00() {} - distance_interpolator00(int xc, int yc, - int x1, int y1, int x2, int y2, - int x, int y) : - m_dx1(line_mr(x1) - line_mr(xc)), - m_dy1(line_mr(y1) - line_mr(yc)), - m_dx2(line_mr(x2) - line_mr(xc)), - m_dy2(line_mr(y2) - line_mr(yc)), - m_dist1((line_mr(x + line_subpixel_scale/2) - line_mr(x1)) * m_dy1 - - (line_mr(y + line_subpixel_scale/2) - line_mr(y1)) * m_dx1), - m_dist2((line_mr(x + line_subpixel_scale/2) - line_mr(x2)) * m_dy2 - - (line_mr(y + line_subpixel_scale/2) - line_mr(y2)) * m_dx2) - { - m_dx1 *= line_mr_subpixel_scale; - m_dy1 *= line_mr_subpixel_scale; - m_dx2 *= line_mr_subpixel_scale; - m_dy2 *= line_mr_subpixel_scale; - } + m_dx1 *= line_mr_subpixel_scale; + m_dy1 *= line_mr_subpixel_scale; + m_dx2 *= line_mr_subpixel_scale; + m_dy2 *= line_mr_subpixel_scale; + } - //--------------------------------------------------------------------- - void inc_x() { m_dist1 += m_dy1; m_dist2 += m_dy2; } - int dist1() const { return m_dist1; } - int dist2() const { return m_dist2; } - - private: - //--------------------------------------------------------------------- - int m_dx1; - int m_dy1; - int m_dx2; - int m_dy2; - int m_dist1; - int m_dist2; - }; - - //===================================================distance_interpolator1 - class distance_interpolator1 + //--------------------------------------------------------------------- + void inc_x() { - public: - //--------------------------------------------------------------------- - distance_interpolator1() {} - distance_interpolator1(int x1, int y1, int x2, int y2, int x, int y) : - m_dx(x2 - x1), - m_dy(y2 - y1), - m_dist(iround(double(x + line_subpixel_scale/2 - x2) * double(m_dy) - - double(y + line_subpixel_scale/2 - y2) * double(m_dx))) - { - m_dx *= line_subpixel_scale; - m_dy *= line_subpixel_scale; - } + m_dist1 += m_dy1; + m_dist2 += m_dy2; + } + int dist1() const { return m_dist1; } + int dist2() const { return m_dist2; } - //--------------------------------------------------------------------- - void inc_x() { m_dist += m_dy; } - void dec_x() { m_dist -= m_dy; } - void inc_y() { m_dist -= m_dx; } - void dec_y() { m_dist += m_dx; } + private: + //--------------------------------------------------------------------- + int m_dx1; + int m_dy1; + int m_dx2; + int m_dy2; + int m_dist1; + int m_dist2; +}; - //--------------------------------------------------------------------- - void inc_x(int dy) - { +//===================================================distance_interpolator1 +class distance_interpolator1 +{ + public: + //--------------------------------------------------------------------- + distance_interpolator1() {} + distance_interpolator1(int x1, int y1, int x2, int y2, int x, int y) + : m_dx(x2 - x1) + , m_dy(y2 - y1) + , m_dist(iround(double(x + line_subpixel_scale / 2 - x2) * double(m_dy) - + double(y + line_subpixel_scale / 2 - y2) * double(m_dx))) + { + m_dx *= line_subpixel_scale; + m_dy *= line_subpixel_scale; + } + + //--------------------------------------------------------------------- + void inc_x() { m_dist += m_dy; } + void dec_x() { m_dist -= m_dy; } + void inc_y() { m_dist -= m_dx; } + void dec_y() { m_dist += m_dx; } + + //--------------------------------------------------------------------- + void inc_x(int dy) + { + m_dist += m_dy; + if (dy > 0) + m_dist -= m_dx; + if (dy < 0) + m_dist += m_dx; + } + + //--------------------------------------------------------------------- + void dec_x(int dy) + { + m_dist -= m_dy; + if (dy > 0) + m_dist -= m_dx; + if (dy < 0) + m_dist += m_dx; + } + + //--------------------------------------------------------------------- + void inc_y(int dx) + { + m_dist -= m_dx; + if (dx > 0) m_dist += m_dy; - if(dy > 0) m_dist -= m_dx; - if(dy < 0) m_dist += m_dx; - } - - //--------------------------------------------------------------------- - void dec_x(int dy) - { + if (dx < 0) m_dist -= m_dy; - if(dy > 0) m_dist -= m_dx; - if(dy < 0) m_dist += m_dx; - } + } - //--------------------------------------------------------------------- - void inc_y(int dx) + void dec_y(int dx) + //--------------------------------------------------------------------- + { + m_dist += m_dx; + if (dx > 0) + m_dist += m_dy; + if (dx < 0) + m_dist -= m_dy; + } + + //--------------------------------------------------------------------- + int dist() const { return m_dist; } + int dx() const { return m_dx; } + int dy() const { return m_dy; } + + private: + //--------------------------------------------------------------------- + int m_dx; + int m_dy; + int m_dist; +}; + +//===================================================distance_interpolator2 +class distance_interpolator2 +{ + public: + //--------------------------------------------------------------------- + distance_interpolator2() {} + distance_interpolator2(int x1, int y1, int x2, int y2, int sx, int sy, int x, int y) + : m_dx(x2 - x1) + , m_dy(y2 - y1) + , m_dx_start(line_mr(sx) - line_mr(x1)) + , m_dy_start(line_mr(sy) - line_mr(y1)) + , + + m_dist(iround(double(x + line_subpixel_scale / 2 - x2) * double(m_dy) - + double(y + line_subpixel_scale / 2 - y2) * double(m_dx))) + , + + m_dist_start((line_mr(x + line_subpixel_scale / 2) - line_mr(sx)) * m_dy_start - + (line_mr(y + line_subpixel_scale / 2) - line_mr(sy)) * m_dx_start) + { + m_dx *= line_subpixel_scale; + m_dy *= line_subpixel_scale; + m_dx_start *= line_mr_subpixel_scale; + m_dy_start *= line_mr_subpixel_scale; + } + + distance_interpolator2(int x1, int y1, int x2, int y2, int ex, int ey, int x, int y, int) + : m_dx(x2 - x1) + , m_dy(y2 - y1) + , m_dx_start(line_mr(ex) - line_mr(x2)) + , m_dy_start(line_mr(ey) - line_mr(y2)) + , + + m_dist(iround(double(x + line_subpixel_scale / 2 - x2) * double(m_dy) - + double(y + line_subpixel_scale / 2 - y2) * double(m_dx))) + , + + m_dist_start((line_mr(x + line_subpixel_scale / 2) - line_mr(ex)) * m_dy_start - + (line_mr(y + line_subpixel_scale / 2) - line_mr(ey)) * m_dx_start) + { + m_dx *= line_subpixel_scale; + m_dy *= line_subpixel_scale; + m_dx_start *= line_mr_subpixel_scale; + m_dy_start *= line_mr_subpixel_scale; + } + + //--------------------------------------------------------------------- + void inc_x() + { + m_dist += m_dy; + m_dist_start += m_dy_start; + } + void dec_x() + { + m_dist -= m_dy; + m_dist_start -= m_dy_start; + } + void inc_y() + { + m_dist -= m_dx; + m_dist_start -= m_dx_start; + } + void dec_y() + { + m_dist += m_dx; + m_dist_start += m_dx_start; + } + + //--------------------------------------------------------------------- + void inc_x(int dy) + { + m_dist += m_dy; + m_dist_start += m_dy_start; + if (dy > 0) { m_dist -= m_dx; - if(dx > 0) m_dist += m_dy; - if(dx < 0) m_dist -= m_dy; + m_dist_start -= m_dx_start; } - - void dec_y(int dx) - //--------------------------------------------------------------------- + if (dy < 0) { m_dist += m_dx; - if(dx > 0) m_dist += m_dy; - if(dx < 0) m_dist -= m_dy; - } - - //--------------------------------------------------------------------- - int dist() const { return m_dist; } - int dx() const { return m_dx; } - int dy() const { return m_dy; } - - private: - //--------------------------------------------------------------------- - int m_dx; - int m_dy; - int m_dist; - }; - - - - - - //===================================================distance_interpolator2 - class distance_interpolator2 - { - public: - //--------------------------------------------------------------------- - distance_interpolator2() {} - distance_interpolator2(int x1, int y1, int x2, int y2, - int sx, int sy, int x, int y) : - m_dx(x2 - x1), - m_dy(y2 - y1), - m_dx_start(line_mr(sx) - line_mr(x1)), - m_dy_start(line_mr(sy) - line_mr(y1)), - - m_dist(iround(double(x + line_subpixel_scale/2 - x2) * double(m_dy) - - double(y + line_subpixel_scale/2 - y2) * double(m_dx))), - - m_dist_start((line_mr(x + line_subpixel_scale/2) - line_mr(sx)) * m_dy_start - - (line_mr(y + line_subpixel_scale/2) - line_mr(sy)) * m_dx_start) - { - m_dx *= line_subpixel_scale; - m_dy *= line_subpixel_scale; - m_dx_start *= line_mr_subpixel_scale; - m_dy_start *= line_mr_subpixel_scale; - } - - distance_interpolator2(int x1, int y1, int x2, int y2, - int ex, int ey, int x, int y, int) : - m_dx(x2 - x1), - m_dy(y2 - y1), - m_dx_start(line_mr(ex) - line_mr(x2)), - m_dy_start(line_mr(ey) - line_mr(y2)), - - m_dist(iround(double(x + line_subpixel_scale/2 - x2) * double(m_dy) - - double(y + line_subpixel_scale/2 - y2) * double(m_dx))), - - m_dist_start((line_mr(x + line_subpixel_scale/2) - line_mr(ex)) * m_dy_start - - (line_mr(y + line_subpixel_scale/2) - line_mr(ey)) * m_dx_start) - { - m_dx *= line_subpixel_scale; - m_dy *= line_subpixel_scale; - m_dx_start *= line_mr_subpixel_scale; - m_dy_start *= line_mr_subpixel_scale; - } - - - //--------------------------------------------------------------------- - void inc_x() { m_dist += m_dy; m_dist_start += m_dy_start; } - void dec_x() { m_dist -= m_dy; m_dist_start -= m_dy_start; } - void inc_y() { m_dist -= m_dx; m_dist_start -= m_dx_start; } - void dec_y() { m_dist += m_dx; m_dist_start += m_dx_start; } - - //--------------------------------------------------------------------- - void inc_x(int dy) - { - m_dist += m_dy; - m_dist_start += m_dy_start; - if(dy > 0) - { - m_dist -= m_dx; - m_dist_start -= m_dx_start; - } - if(dy < 0) - { - m_dist += m_dx; - m_dist_start += m_dx_start; - } - } - - //--------------------------------------------------------------------- - void dec_x(int dy) - { - m_dist -= m_dy; - m_dist_start -= m_dy_start; - if(dy > 0) - { - m_dist -= m_dx; - m_dist_start -= m_dx_start; - } - if(dy < 0) - { - m_dist += m_dx; - m_dist_start += m_dx_start; - } - } - - //--------------------------------------------------------------------- - void inc_y(int dx) - { - m_dist -= m_dx; - m_dist_start -= m_dx_start; - if(dx > 0) - { - m_dist += m_dy; - m_dist_start += m_dy_start; - } - if(dx < 0) - { - m_dist -= m_dy; - m_dist_start -= m_dy_start; - } - } - - //--------------------------------------------------------------------- - void dec_y(int dx) - { - m_dist += m_dx; m_dist_start += m_dx_start; - if(dx > 0) - { - m_dist += m_dy; - m_dist_start += m_dy_start; - } - if(dx < 0) - { - m_dist -= m_dy; - m_dist_start -= m_dy_start; - } } + } - //--------------------------------------------------------------------- - int dist() const { return m_dist; } - int dist_start() const { return m_dist_start; } - int dist_end() const { return m_dist_start; } - - //--------------------------------------------------------------------- - int dx() const { return m_dx; } - int dy() const { return m_dy; } - int dx_start() const { return m_dx_start; } - int dy_start() const { return m_dy_start; } - int dx_end() const { return m_dx_start; } - int dy_end() const { return m_dy_start; } - - private: - //--------------------------------------------------------------------- - int m_dx; - int m_dy; - int m_dx_start; - int m_dy_start; - - int m_dist; - int m_dist_start; - }; - - - - - - //===================================================distance_interpolator3 - class distance_interpolator3 + //--------------------------------------------------------------------- + void dec_x(int dy) { - public: - //--------------------------------------------------------------------- - distance_interpolator3() {} - distance_interpolator3(int x1, int y1, int x2, int y2, - int sx, int sy, int ex, int ey, - int x, int y) : - m_dx(x2 - x1), - m_dy(y2 - y1), - m_dx_start(line_mr(sx) - line_mr(x1)), - m_dy_start(line_mr(sy) - line_mr(y1)), - m_dx_end(line_mr(ex) - line_mr(x2)), - m_dy_end(line_mr(ey) - line_mr(y2)), - - m_dist(iround(double(x + line_subpixel_scale/2 - x2) * double(m_dy) - - double(y + line_subpixel_scale/2 - y2) * double(m_dx))), - - m_dist_start((line_mr(x + line_subpixel_scale/2) - line_mr(sx)) * m_dy_start - - (line_mr(y + line_subpixel_scale/2) - line_mr(sy)) * m_dx_start), - - m_dist_end((line_mr(x + line_subpixel_scale/2) - line_mr(ex)) * m_dy_end - - (line_mr(y + line_subpixel_scale/2) - line_mr(ey)) * m_dx_end) + m_dist -= m_dy; + m_dist_start -= m_dy_start; + if (dy > 0) { - m_dx *= line_subpixel_scale; - m_dy *= line_subpixel_scale; - m_dx_start *= line_mr_subpixel_scale; - m_dy_start *= line_mr_subpixel_scale; - m_dx_end *= line_mr_subpixel_scale; - m_dy_end *= line_mr_subpixel_scale; - } - - //--------------------------------------------------------------------- - void inc_x() { m_dist += m_dy; m_dist_start += m_dy_start; m_dist_end += m_dy_end; } - void dec_x() { m_dist -= m_dy; m_dist_start -= m_dy_start; m_dist_end -= m_dy_end; } - void inc_y() { m_dist -= m_dx; m_dist_start -= m_dx_start; m_dist_end -= m_dx_end; } - void dec_y() { m_dist += m_dx; m_dist_start += m_dx_start; m_dist_end += m_dx_end; } - - //--------------------------------------------------------------------- - void inc_x(int dy) - { - m_dist += m_dy; - m_dist_start += m_dy_start; - m_dist_end += m_dy_end; - if(dy > 0) - { - m_dist -= m_dx; - m_dist_start -= m_dx_start; - m_dist_end -= m_dx_end; - } - if(dy < 0) - { - m_dist += m_dx; - m_dist_start += m_dx_start; - m_dist_end += m_dx_end; - } - } - - //--------------------------------------------------------------------- - void dec_x(int dy) - { - m_dist -= m_dy; - m_dist_start -= m_dy_start; - m_dist_end -= m_dy_end; - if(dy > 0) - { - m_dist -= m_dx; - m_dist_start -= m_dx_start; - m_dist_end -= m_dx_end; - } - if(dy < 0) - { - m_dist += m_dx; - m_dist_start += m_dx_start; - m_dist_end += m_dx_end; - } - } - - //--------------------------------------------------------------------- - void inc_y(int dx) - { - m_dist -= m_dx; + m_dist -= m_dx; m_dist_start -= m_dx_start; - m_dist_end -= m_dx_end; - if(dx > 0) - { - m_dist += m_dy; - m_dist_start += m_dy_start; - m_dist_end += m_dy_end; - } - if(dx < 0) - { - m_dist -= m_dy; - m_dist_start -= m_dy_start; - m_dist_end -= m_dy_end; - } } - - //--------------------------------------------------------------------- - void dec_y(int dx) + if (dy < 0) { - m_dist += m_dx; + m_dist += m_dx; m_dist_start += m_dx_start; - m_dist_end += m_dx_end; - if(dx > 0) - { - m_dist += m_dy; - m_dist_start += m_dy_start; - m_dist_end += m_dy_end; - } - if(dx < 0) - { - m_dist -= m_dy; - m_dist_start -= m_dy_start; - m_dist_end -= m_dy_end; - } } + } - //--------------------------------------------------------------------- - int dist() const { return m_dist; } - int dist_start() const { return m_dist_start; } - int dist_end() const { return m_dist_end; } - - //--------------------------------------------------------------------- - int dx() const { return m_dx; } - int dy() const { return m_dy; } - int dx_start() const { return m_dx_start; } - int dy_start() const { return m_dy_start; } - int dx_end() const { return m_dx_end; } - int dy_end() const { return m_dy_end; } - - private: - //--------------------------------------------------------------------- - int m_dx; - int m_dy; - int m_dx_start; - int m_dy_start; - int m_dx_end; - int m_dy_end; - - int m_dist; - int m_dist_start; - int m_dist_end; - }; - - - - - - //================================================line_interpolator_aa_base - template class line_interpolator_aa_base + //--------------------------------------------------------------------- + void inc_y(int dx) { - public: - typedef Renderer renderer_type; - typedef typename Renderer::color_type color_type; - - //--------------------------------------------------------------------- - enum max_half_width_e + m_dist -= m_dx; + m_dist_start -= m_dx_start; + if (dx > 0) { - max_half_width = 64 - }; - - //--------------------------------------------------------------------- - line_interpolator_aa_base(renderer_type& ren, const line_parameters& lp) : - m_lp(&lp), - m_li(lp.vertical ? line_dbl_hr(lp.x2 - lp.x1) : - line_dbl_hr(lp.y2 - lp.y1), - lp.vertical ? std::abs(lp.y2 - lp.y1) : - std::abs(lp.x2 - lp.x1) + 1), - m_ren(ren), - m_len((lp.vertical == (lp.inc > 0)) ? -lp.len : lp.len), - m_x(lp.x1 >> line_subpixel_shift), - m_y(lp.y1 >> line_subpixel_shift), - m_old_x(m_x), - m_old_y(m_y), - m_count((lp.vertical ? std::abs((lp.y2 >> line_subpixel_shift) - m_y) : - std::abs((lp.x2 >> line_subpixel_shift) - m_x))), - m_width(ren.subpixel_width()), - //m_max_extent(m_width >> (line_subpixel_shift - 2)), - m_max_extent((m_width + line_subpixel_mask) >> line_subpixel_shift), - m_step(0) - { - agg::dda2_line_interpolator li(0, lp.vertical ? - (lp.dy * agg::line_subpixel_scale) : - (lp.dx * agg::line_subpixel_scale), - lp.len); - - unsigned i; - int stop = m_width + line_subpixel_scale * 2; - for(i = 0; i < max_half_width; ++i) - { - m_dist[i] = li.y(); - if(m_dist[i] >= stop) break; - ++li; - } - m_dist[i++] = 0x7FFF0000; + m_dist += m_dy; + m_dist_start += m_dy_start; } - - //--------------------------------------------------------------------- - template int step_hor_base(DI& di) + if (dx < 0) { - ++m_li; - m_x += m_lp->inc; - m_y = (m_lp->y1 + m_li.y()) >> line_subpixel_shift; - - if(m_lp->inc > 0) di.inc_x(m_y - m_old_y); - else di.dec_x(m_y - m_old_y); - - m_old_y = m_y; - - return di.dist() / m_len; + m_dist -= m_dy; + m_dist_start -= m_dy_start; } + } - //--------------------------------------------------------------------- - template int step_ver_base(DI& di) - { - ++m_li; - m_y += m_lp->inc; - m_x = (m_lp->x1 + m_li.y()) >> line_subpixel_shift; - - if(m_lp->inc > 0) di.inc_y(m_x - m_old_x); - else di.dec_y(m_x - m_old_x); - - m_old_x = m_x; - - return di.dist() / m_len; - } - - //--------------------------------------------------------------------- - bool vertical() const { return m_lp->vertical; } - int width() const { return m_width; } - int count() const { return m_count; } - - private: - line_interpolator_aa_base(const line_interpolator_aa_base&); - const line_interpolator_aa_base& - operator = (const line_interpolator_aa_base&); - - protected: - const line_parameters* m_lp; - dda2_line_interpolator m_li; - renderer_type& m_ren; - int m_len; - int m_x; - int m_y; - int m_old_x; - int m_old_y; - int m_count; - int m_width; - int m_max_extent; - int m_step; - int m_dist[max_half_width + 1]; - cover_type m_covers[max_half_width * 2 + 4]; - }; - - - - - - - - //====================================================line_interpolator_aa0 - template class line_interpolator_aa0 : - public line_interpolator_aa_base + //--------------------------------------------------------------------- + void dec_y(int dx) { - public: - typedef Renderer renderer_type; - typedef typename Renderer::color_type color_type; - typedef line_interpolator_aa_base base_type; - - //--------------------------------------------------------------------- - line_interpolator_aa0(renderer_type& ren, const line_parameters& lp) : - line_interpolator_aa_base(ren, lp), - m_di(lp.x1, lp.y1, lp.x2, lp.y2, - lp.x1 & ~line_subpixel_mask, lp.y1 & ~line_subpixel_mask) + m_dist += m_dx; + m_dist_start += m_dx_start; + if (dx > 0) { - base_type::m_li.adjust_forward(); + m_dist += m_dy; + m_dist_start += m_dy_start; } - - //--------------------------------------------------------------------- - bool step_hor() + if (dx < 0) { - int dist; - int dy; - int s1 = base_type::step_hor_base(m_di); - cover_type* p0 = base_type::m_covers + base_type::max_half_width + 2; - cover_type* p1 = p0; - - *p1++ = (cover_type)base_type::m_ren.cover(s1); - - dy = 1; - while((dist = base_type::m_dist[dy] - s1) <= base_type::m_width) - { - *p1++ = (cover_type)base_type::m_ren.cover(dist); - ++dy; - } - - dy = 1; - while((dist = base_type::m_dist[dy] + s1) <= base_type::m_width) - { - *--p0 = (cover_type)base_type::m_ren.cover(dist); - ++dy; - } - base_type::m_ren.blend_solid_vspan(base_type::m_x, - base_type::m_y - dy + 1, - unsigned(p1 - p0), - p0); - return ++base_type::m_step < base_type::m_count; + m_dist -= m_dy; + m_dist_start -= m_dy_start; } + } - //--------------------------------------------------------------------- - bool step_ver() - { - int dist; - int dx; - int s1 = base_type::step_ver_base(m_di); - cover_type* p0 = base_type::m_covers + base_type::max_half_width + 2; - cover_type* p1 = p0; + //--------------------------------------------------------------------- + int dist() const { return m_dist; } + int dist_start() const { return m_dist_start; } + int dist_end() const { return m_dist_start; } - *p1++ = (cover_type)base_type::m_ren.cover(s1); + //--------------------------------------------------------------------- + int dx() const { return m_dx; } + int dy() const { return m_dy; } + int dx_start() const { return m_dx_start; } + int dy_start() const { return m_dy_start; } + int dx_end() const { return m_dx_start; } + int dy_end() const { return m_dy_start; } - dx = 1; - while((dist = base_type::m_dist[dx] - s1) <= base_type::m_width) - { - *p1++ = (cover_type)base_type::m_ren.cover(dist); - ++dx; - } + private: + //--------------------------------------------------------------------- + int m_dx; + int m_dy; + int m_dx_start; + int m_dy_start; - dx = 1; - while((dist = base_type::m_dist[dx] + s1) <= base_type::m_width) - { - *--p0 = (cover_type)base_type::m_ren.cover(dist); - ++dx; - } - base_type::m_ren.blend_solid_hspan(base_type::m_x - dx + 1, - base_type::m_y, - unsigned(p1 - p0), - p0); - return ++base_type::m_step < base_type::m_count; - } + int m_dist; + int m_dist_start; +}; - private: - line_interpolator_aa0(const line_interpolator_aa0&); - const line_interpolator_aa0& - operator = (const line_interpolator_aa0&); +//===================================================distance_interpolator3 +class distance_interpolator3 +{ + public: + //--------------------------------------------------------------------- + distance_interpolator3() {} + distance_interpolator3(int x1, int y1, int x2, int y2, int sx, int sy, int ex, int ey, int x, int y) + : m_dx(x2 - x1) + , m_dy(y2 - y1) + , m_dx_start(line_mr(sx) - line_mr(x1)) + , m_dy_start(line_mr(sy) - line_mr(y1)) + , m_dx_end(line_mr(ex) - line_mr(x2)) + , m_dy_end(line_mr(ey) - line_mr(y2)) + , - //--------------------------------------------------------------------- - distance_interpolator1 m_di; - }; + m_dist(iround(double(x + line_subpixel_scale / 2 - x2) * double(m_dy) - + double(y + line_subpixel_scale / 2 - y2) * double(m_dx))) + , + m_dist_start((line_mr(x + line_subpixel_scale / 2) - line_mr(sx)) * m_dy_start - + (line_mr(y + line_subpixel_scale / 2) - line_mr(sy)) * m_dx_start) + , - - - - - //====================================================line_interpolator_aa1 - template class line_interpolator_aa1 : - public line_interpolator_aa_base + m_dist_end((line_mr(x + line_subpixel_scale / 2) - line_mr(ex)) * m_dy_end - + (line_mr(y + line_subpixel_scale / 2) - line_mr(ey)) * m_dx_end) { - public: - typedef Renderer renderer_type; - typedef typename Renderer::color_type color_type; - typedef line_interpolator_aa_base base_type; + m_dx *= line_subpixel_scale; + m_dy *= line_subpixel_scale; + m_dx_start *= line_mr_subpixel_scale; + m_dy_start *= line_mr_subpixel_scale; + m_dx_end *= line_mr_subpixel_scale; + m_dy_end *= line_mr_subpixel_scale; + } - //--------------------------------------------------------------------- - line_interpolator_aa1(renderer_type& ren, const line_parameters& lp, - int sx, int sy) : - line_interpolator_aa_base(ren, lp), - m_di(lp.x1, lp.y1, lp.x2, lp.y2, sx, sy, - lp.x1 & ~line_subpixel_mask, lp.y1 & ~line_subpixel_mask) + //--------------------------------------------------------------------- + void inc_x() + { + m_dist += m_dy; + m_dist_start += m_dy_start; + m_dist_end += m_dy_end; + } + void dec_x() + { + m_dist -= m_dy; + m_dist_start -= m_dy_start; + m_dist_end -= m_dy_end; + } + void inc_y() + { + m_dist -= m_dx; + m_dist_start -= m_dx_start; + m_dist_end -= m_dx_end; + } + void dec_y() + { + m_dist += m_dx; + m_dist_start += m_dx_start; + m_dist_end += m_dx_end; + } + + //--------------------------------------------------------------------- + void inc_x(int dy) + { + m_dist += m_dy; + m_dist_start += m_dy_start; + m_dist_end += m_dy_end; + if (dy > 0) { - int dist1_start; - int dist2_start; + m_dist -= m_dx; + m_dist_start -= m_dx_start; + m_dist_end -= m_dx_end; + } + if (dy < 0) + { + m_dist += m_dx; + m_dist_start += m_dx_start; + m_dist_end += m_dx_end; + } + } - int npix = 1; + //--------------------------------------------------------------------- + void dec_x(int dy) + { + m_dist -= m_dy; + m_dist_start -= m_dy_start; + m_dist_end -= m_dy_end; + if (dy > 0) + { + m_dist -= m_dx; + m_dist_start -= m_dx_start; + m_dist_end -= m_dx_end; + } + if (dy < 0) + { + m_dist += m_dx; + m_dist_start += m_dx_start; + m_dist_end += m_dx_end; + } + } - if(lp.vertical) + //--------------------------------------------------------------------- + void inc_y(int dx) + { + m_dist -= m_dx; + m_dist_start -= m_dx_start; + m_dist_end -= m_dx_end; + if (dx > 0) + { + m_dist += m_dy; + m_dist_start += m_dy_start; + m_dist_end += m_dy_end; + } + if (dx < 0) + { + m_dist -= m_dy; + m_dist_start -= m_dy_start; + m_dist_end -= m_dy_end; + } + } + + //--------------------------------------------------------------------- + void dec_y(int dx) + { + m_dist += m_dx; + m_dist_start += m_dx_start; + m_dist_end += m_dx_end; + if (dx > 0) + { + m_dist += m_dy; + m_dist_start += m_dy_start; + m_dist_end += m_dy_end; + } + if (dx < 0) + { + m_dist -= m_dy; + m_dist_start -= m_dy_start; + m_dist_end -= m_dy_end; + } + } + + //--------------------------------------------------------------------- + int dist() const { return m_dist; } + int dist_start() const { return m_dist_start; } + int dist_end() const { return m_dist_end; } + + //--------------------------------------------------------------------- + int dx() const { return m_dx; } + int dy() const { return m_dy; } + int dx_start() const { return m_dx_start; } + int dy_start() const { return m_dy_start; } + int dx_end() const { return m_dx_end; } + int dy_end() const { return m_dy_end; } + + private: + //--------------------------------------------------------------------- + int m_dx; + int m_dy; + int m_dx_start; + int m_dy_start; + int m_dx_end; + int m_dy_end; + + int m_dist; + int m_dist_start; + int m_dist_end; +}; + +//================================================line_interpolator_aa_base +template +class line_interpolator_aa_base +{ + public: + typedef Renderer renderer_type; + typedef typename Renderer::color_type color_type; + + //--------------------------------------------------------------------- + enum max_half_width_e { max_half_width = 64 }; + + //--------------------------------------------------------------------- + line_interpolator_aa_base(renderer_type& ren, const line_parameters& lp) + : m_lp(&lp) + , m_li(lp.vertical ? line_dbl_hr(lp.x2 - lp.x1) : line_dbl_hr(lp.y2 - lp.y1), + lp.vertical ? std::abs(lp.y2 - lp.y1) : std::abs(lp.x2 - lp.x1) + 1) + , m_ren(ren) + , m_len((lp.vertical == (lp.inc > 0)) ? -lp.len : lp.len) + , m_x(lp.x1 >> line_subpixel_shift) + , m_y(lp.y1 >> line_subpixel_shift) + , m_old_x(m_x) + , m_old_y(m_y) + , m_count((lp.vertical ? std::abs((lp.y2 >> line_subpixel_shift) - m_y) + : std::abs((lp.x2 >> line_subpixel_shift) - m_x))) + , m_width(ren.subpixel_width()) + , + // m_max_extent(m_width >> (line_subpixel_shift - 2)), + m_max_extent((m_width + line_subpixel_mask) >> line_subpixel_shift) + , m_step(0) + { + agg::dda2_line_interpolator li(0, + lp.vertical ? (lp.dy * agg::line_subpixel_scale) + : (lp.dx * agg::line_subpixel_scale), + lp.len); + + unsigned i; + int stop = m_width + line_subpixel_scale * 2; + for (i = 0; i < max_half_width; ++i) + { + m_dist[i] = li.y(); + if (m_dist[i] >= stop) + break; + ++li; + } + m_dist[i++] = 0x7FFF0000; + } + + //--------------------------------------------------------------------- + template + int step_hor_base(DI& di) + { + ++m_li; + m_x += m_lp->inc; + m_y = (m_lp->y1 + m_li.y()) >> line_subpixel_shift; + + if (m_lp->inc > 0) + di.inc_x(m_y - m_old_y); + else + di.dec_x(m_y - m_old_y); + + m_old_y = m_y; + + return di.dist() / m_len; + } + + //--------------------------------------------------------------------- + template + int step_ver_base(DI& di) + { + ++m_li; + m_y += m_lp->inc; + m_x = (m_lp->x1 + m_li.y()) >> line_subpixel_shift; + + if (m_lp->inc > 0) + di.inc_y(m_x - m_old_x); + else + di.dec_y(m_x - m_old_x); + + m_old_x = m_x; + + return di.dist() / m_len; + } + + //--------------------------------------------------------------------- + bool vertical() const { return m_lp->vertical; } + int width() const { return m_width; } + int count() const { return m_count; } + + private: + line_interpolator_aa_base(const line_interpolator_aa_base&); + const line_interpolator_aa_base& operator=(const line_interpolator_aa_base&); + + protected: + const line_parameters* m_lp; + dda2_line_interpolator m_li; + renderer_type& m_ren; + int m_len; + int m_x; + int m_y; + int m_old_x; + int m_old_y; + int m_count; + int m_width; + int m_max_extent; + int m_step; + int m_dist[max_half_width + 1]; + cover_type m_covers[max_half_width * 2 + 4]; +}; + +//====================================================line_interpolator_aa0 +template +class line_interpolator_aa0 : public line_interpolator_aa_base +{ + public: + typedef Renderer renderer_type; + typedef typename Renderer::color_type color_type; + typedef line_interpolator_aa_base base_type; + + //--------------------------------------------------------------------- + line_interpolator_aa0(renderer_type& ren, const line_parameters& lp) + : line_interpolator_aa_base(ren, lp) + , m_di(lp.x1, lp.y1, lp.x2, lp.y2, lp.x1 & ~line_subpixel_mask, lp.y1 & ~line_subpixel_mask) + { + base_type::m_li.adjust_forward(); + } + + //--------------------------------------------------------------------- + bool step_hor() + { + int dist; + int dy; + int s1 = base_type::step_hor_base(m_di); + cover_type* p0 = base_type::m_covers + base_type::max_half_width + 2; + cover_type* p1 = p0; + + *p1++ = (cover_type)base_type::m_ren.cover(s1); + + dy = 1; + while ((dist = base_type::m_dist[dy] - s1) <= base_type::m_width) + { + *p1++ = (cover_type)base_type::m_ren.cover(dist); + ++dy; + } + + dy = 1; + while ((dist = base_type::m_dist[dy] + s1) <= base_type::m_width) + { + *--p0 = (cover_type)base_type::m_ren.cover(dist); + ++dy; + } + base_type::m_ren.blend_solid_vspan(base_type::m_x, base_type::m_y - dy + 1, unsigned(p1 - p0), p0); + return ++base_type::m_step < base_type::m_count; + } + + //--------------------------------------------------------------------- + bool step_ver() + { + int dist; + int dx; + int s1 = base_type::step_ver_base(m_di); + cover_type* p0 = base_type::m_covers + base_type::max_half_width + 2; + cover_type* p1 = p0; + + *p1++ = (cover_type)base_type::m_ren.cover(s1); + + dx = 1; + while ((dist = base_type::m_dist[dx] - s1) <= base_type::m_width) + { + *p1++ = (cover_type)base_type::m_ren.cover(dist); + ++dx; + } + + dx = 1; + while ((dist = base_type::m_dist[dx] + s1) <= base_type::m_width) + { + *--p0 = (cover_type)base_type::m_ren.cover(dist); + ++dx; + } + base_type::m_ren.blend_solid_hspan(base_type::m_x - dx + 1, base_type::m_y, unsigned(p1 - p0), p0); + return ++base_type::m_step < base_type::m_count; + } + + private: + line_interpolator_aa0(const line_interpolator_aa0&); + const line_interpolator_aa0& operator=(const line_interpolator_aa0&); + + //--------------------------------------------------------------------- + distance_interpolator1 m_di; +}; + +//====================================================line_interpolator_aa1 +template +class line_interpolator_aa1 : public line_interpolator_aa_base +{ + public: + typedef Renderer renderer_type; + typedef typename Renderer::color_type color_type; + typedef line_interpolator_aa_base base_type; + + //--------------------------------------------------------------------- + line_interpolator_aa1(renderer_type& ren, const line_parameters& lp, int sx, int sy) + : line_interpolator_aa_base(ren, lp) + , m_di(lp.x1, lp.y1, lp.x2, lp.y2, sx, sy, lp.x1 & ~line_subpixel_mask, lp.y1 & ~line_subpixel_mask) + { + int dist1_start; + int dist2_start; + + int npix = 1; + + if (lp.vertical) + { + do { + --base_type::m_li; + base_type::m_y -= lp.inc; + base_type::m_x = (base_type::m_lp->x1 + base_type::m_li.y()) >> line_subpixel_shift; + + if (lp.inc > 0) + m_di.dec_y(base_type::m_x - base_type::m_old_x); + else + m_di.inc_y(base_type::m_x - base_type::m_old_x); + + base_type::m_old_x = base_type::m_x; + + dist1_start = dist2_start = m_di.dist_start(); + + int dx = 0; + if (dist1_start < 0) + ++npix; do { - --base_type::m_li; - base_type::m_y -= lp.inc; - base_type::m_x = (base_type::m_lp->x1 + base_type::m_li.y()) >> line_subpixel_shift; + dist1_start += m_di.dy_start(); + dist2_start -= m_di.dy_start(); + if (dist1_start < 0) + ++npix; + if (dist2_start < 0) + ++npix; + ++dx; + } while (base_type::m_dist[dx] <= base_type::m_width); + --base_type::m_step; + if (npix == 0) + break; + npix = 0; + } while (base_type::m_step >= -base_type::m_max_extent); + } + else + { + do + { + --base_type::m_li; + base_type::m_x -= lp.inc; + base_type::m_y = (base_type::m_lp->y1 + base_type::m_li.y()) >> line_subpixel_shift; - if(lp.inc > 0) m_di.dec_y(base_type::m_x - base_type::m_old_x); - else m_di.inc_y(base_type::m_x - base_type::m_old_x); + if (lp.inc > 0) + m_di.dec_x(base_type::m_y - base_type::m_old_y); + else + m_di.inc_x(base_type::m_y - base_type::m_old_y); - base_type::m_old_x = base_type::m_x; + base_type::m_old_y = base_type::m_y; - dist1_start = dist2_start = m_di.dist_start(); + dist1_start = dist2_start = m_di.dist_start(); - int dx = 0; - if(dist1_start < 0) ++npix; - do - { - dist1_start += m_di.dy_start(); - dist2_start -= m_di.dy_start(); - if(dist1_start < 0) ++npix; - if(dist2_start < 0) ++npix; - ++dx; - } - while(base_type::m_dist[dx] <= base_type::m_width); - --base_type::m_step; - if(npix == 0) break; - npix = 0; - } - while(base_type::m_step >= -base_type::m_max_extent); + int dy = 0; + if (dist1_start < 0) + ++npix; + do + { + dist1_start -= m_di.dx_start(); + dist2_start += m_di.dx_start(); + if (dist1_start < 0) + ++npix; + if (dist2_start < 0) + ++npix; + ++dy; + } while (base_type::m_dist[dy] <= base_type::m_width); + --base_type::m_step; + if (npix == 0) + break; + npix = 0; + } while (base_type::m_step >= -base_type::m_max_extent); + } + base_type::m_li.adjust_forward(); + } + + //--------------------------------------------------------------------- + bool step_hor() + { + int dist_start; + int dist; + int dy; + int s1 = base_type::step_hor_base(m_di); + + dist_start = m_di.dist_start(); + cover_type* p0 = base_type::m_covers + base_type::max_half_width + 2; + cover_type* p1 = p0; + + *p1 = 0; + if (dist_start <= 0) + { + *p1 = (cover_type)base_type::m_ren.cover(s1); + } + ++p1; + + dy = 1; + while ((dist = base_type::m_dist[dy] - s1) <= base_type::m_width) + { + dist_start -= m_di.dx_start(); + *p1 = 0; + if (dist_start <= 0) + { + *p1 = (cover_type)base_type::m_ren.cover(dist); + } + ++p1; + ++dy; + } + + dy = 1; + dist_start = m_di.dist_start(); + while ((dist = base_type::m_dist[dy] + s1) <= base_type::m_width) + { + dist_start += m_di.dx_start(); + *--p0 = 0; + if (dist_start <= 0) + { + *p0 = (cover_type)base_type::m_ren.cover(dist); + } + ++dy; + } + + base_type::m_ren.blend_solid_vspan(base_type::m_x, base_type::m_y - dy + 1, unsigned(p1 - p0), p0); + return ++base_type::m_step < base_type::m_count; + } + + //--------------------------------------------------------------------- + bool step_ver() + { + int dist_start; + int dist; + int dx; + int s1 = base_type::step_ver_base(m_di); + cover_type* p0 = base_type::m_covers + base_type::max_half_width + 2; + cover_type* p1 = p0; + + dist_start = m_di.dist_start(); + + *p1 = 0; + if (dist_start <= 0) + { + *p1 = (cover_type)base_type::m_ren.cover(s1); + } + ++p1; + + dx = 1; + while ((dist = base_type::m_dist[dx] - s1) <= base_type::m_width) + { + dist_start += m_di.dy_start(); + *p1 = 0; + if (dist_start <= 0) + { + *p1 = (cover_type)base_type::m_ren.cover(dist); + } + ++p1; + ++dx; + } + + dx = 1; + dist_start = m_di.dist_start(); + while ((dist = base_type::m_dist[dx] + s1) <= base_type::m_width) + { + dist_start -= m_di.dy_start(); + *--p0 = 0; + if (dist_start <= 0) + { + *p0 = (cover_type)base_type::m_ren.cover(dist); + } + ++dx; + } + base_type::m_ren.blend_solid_hspan(base_type::m_x - dx + 1, base_type::m_y, unsigned(p1 - p0), p0); + return ++base_type::m_step < base_type::m_count; + } + + private: + line_interpolator_aa1(const line_interpolator_aa1&); + const line_interpolator_aa1& operator=(const line_interpolator_aa1&); + + //--------------------------------------------------------------------- + distance_interpolator2 m_di; +}; + +//====================================================line_interpolator_aa2 +template +class line_interpolator_aa2 : public line_interpolator_aa_base +{ + public: + typedef Renderer renderer_type; + typedef typename Renderer::color_type color_type; + typedef line_interpolator_aa_base base_type; + + //--------------------------------------------------------------------- + line_interpolator_aa2(renderer_type& ren, const line_parameters& lp, int ex, int ey) + : line_interpolator_aa_base(ren, lp) + , m_di(lp.x1, lp.y1, lp.x2, lp.y2, ex, ey, lp.x1 & ~line_subpixel_mask, lp.y1 & ~line_subpixel_mask, 0) + { + base_type::m_li.adjust_forward(); + base_type::m_step -= base_type::m_max_extent; + } + + //--------------------------------------------------------------------- + bool step_hor() + { + int dist_end; + int dist; + int dy; + int s1 = base_type::step_hor_base(m_di); + cover_type* p0 = base_type::m_covers + base_type::max_half_width + 2; + cover_type* p1 = p0; + + dist_end = m_di.dist_end(); + + int npix = 0; + *p1 = 0; + if (dist_end > 0) + { + *p1 = (cover_type)base_type::m_ren.cover(s1); + ++npix; + } + ++p1; + + dy = 1; + while ((dist = base_type::m_dist[dy] - s1) <= base_type::m_width) + { + dist_end -= m_di.dx_end(); + *p1 = 0; + if (dist_end > 0) + { + *p1 = (cover_type)base_type::m_ren.cover(dist); + ++npix; + } + ++p1; + ++dy; + } + + dy = 1; + dist_end = m_di.dist_end(); + while ((dist = base_type::m_dist[dy] + s1) <= base_type::m_width) + { + dist_end += m_di.dx_end(); + *--p0 = 0; + if (dist_end > 0) + { + *p0 = (cover_type)base_type::m_ren.cover(dist); + ++npix; + } + ++dy; + } + base_type::m_ren.blend_solid_vspan(base_type::m_x, base_type::m_y - dy + 1, unsigned(p1 - p0), p0); + return npix && ++base_type::m_step < base_type::m_count; + } + + //--------------------------------------------------------------------- + bool step_ver() + { + int dist_end; + int dist; + int dx; + int s1 = base_type::step_ver_base(m_di); + cover_type* p0 = base_type::m_covers + base_type::max_half_width + 2; + cover_type* p1 = p0; + + dist_end = m_di.dist_end(); + + int npix = 0; + *p1 = 0; + if (dist_end > 0) + { + *p1 = (cover_type)base_type::m_ren.cover(s1); + ++npix; + } + ++p1; + + dx = 1; + while ((dist = base_type::m_dist[dx] - s1) <= base_type::m_width) + { + dist_end += m_di.dy_end(); + *p1 = 0; + if (dist_end > 0) + { + *p1 = (cover_type)base_type::m_ren.cover(dist); + ++npix; + } + ++p1; + ++dx; + } + + dx = 1; + dist_end = m_di.dist_end(); + while ((dist = base_type::m_dist[dx] + s1) <= base_type::m_width) + { + dist_end -= m_di.dy_end(); + *--p0 = 0; + if (dist_end > 0) + { + *p0 = (cover_type)base_type::m_ren.cover(dist); + ++npix; + } + ++dx; + } + base_type::m_ren.blend_solid_hspan(base_type::m_x - dx + 1, base_type::m_y, unsigned(p1 - p0), p0); + return npix && ++base_type::m_step < base_type::m_count; + } + + private: + line_interpolator_aa2(const line_interpolator_aa2&); + const line_interpolator_aa2& operator=(const line_interpolator_aa2&); + + //--------------------------------------------------------------------- + distance_interpolator2 m_di; +}; + +//====================================================line_interpolator_aa3 +template +class line_interpolator_aa3 : public line_interpolator_aa_base +{ + public: + typedef Renderer renderer_type; + typedef typename Renderer::color_type color_type; + typedef line_interpolator_aa_base base_type; + + //--------------------------------------------------------------------- + line_interpolator_aa3(renderer_type& ren, const line_parameters& lp, int sx, int sy, int ex, int ey) + : line_interpolator_aa_base(ren, lp) + , m_di(lp.x1, lp.y1, lp.x2, lp.y2, sx, sy, ex, ey, lp.x1 & ~line_subpixel_mask, lp.y1 & ~line_subpixel_mask) + { + int dist1_start; + int dist2_start; + int npix = 1; + if (lp.vertical) + { + do + { + --base_type::m_li; + base_type::m_y -= lp.inc; + base_type::m_x = (base_type::m_lp->x1 + base_type::m_li.y()) >> line_subpixel_shift; + + if (lp.inc > 0) + m_di.dec_y(base_type::m_x - base_type::m_old_x); + else + m_di.inc_y(base_type::m_x - base_type::m_old_x); + + base_type::m_old_x = base_type::m_x; + + dist1_start = dist2_start = m_di.dist_start(); + + int dx = 0; + if (dist1_start < 0) + ++npix; + do + { + dist1_start += m_di.dy_start(); + dist2_start -= m_di.dy_start(); + if (dist1_start < 0) + ++npix; + if (dist2_start < 0) + ++npix; + ++dx; + } while (base_type::m_dist[dx] <= base_type::m_width); + if (npix == 0) + break; + npix = 0; + } while (--base_type::m_step >= -base_type::m_max_extent); + } + else + { + do + { + --base_type::m_li; + base_type::m_x -= lp.inc; + base_type::m_y = (base_type::m_lp->y1 + base_type::m_li.y()) >> line_subpixel_shift; + + if (lp.inc > 0) + m_di.dec_x(base_type::m_y - base_type::m_old_y); + else + m_di.inc_x(base_type::m_y - base_type::m_old_y); + + base_type::m_old_y = base_type::m_y; + + dist1_start = dist2_start = m_di.dist_start(); + + int dy = 0; + if (dist1_start < 0) + ++npix; + do + { + dist1_start -= m_di.dx_start(); + dist2_start += m_di.dx_start(); + if (dist1_start < 0) + ++npix; + if (dist2_start < 0) + ++npix; + ++dy; + } while (base_type::m_dist[dy] <= base_type::m_width); + if (npix == 0) + break; + npix = 0; + } while (--base_type::m_step >= -base_type::m_max_extent); + } + base_type::m_li.adjust_forward(); + base_type::m_step -= base_type::m_max_extent; + } + + //--------------------------------------------------------------------- + bool step_hor() + { + int dist_start; + int dist_end; + int dist; + int dy; + int s1 = base_type::step_hor_base(m_di); + cover_type* p0 = base_type::m_covers + base_type::max_half_width + 2; + cover_type* p1 = p0; + + dist_start = m_di.dist_start(); + dist_end = m_di.dist_end(); + + int npix = 0; + *p1 = 0; + if (dist_end > 0) + { + if (dist_start <= 0) + { + *p1 = (cover_type)base_type::m_ren.cover(s1); + } + ++npix; + } + ++p1; + + dy = 1; + while ((dist = base_type::m_dist[dy] - s1) <= base_type::m_width) + { + dist_start -= m_di.dx_start(); + dist_end -= m_di.dx_end(); + *p1 = 0; + if (dist_end > 0 && dist_start <= 0) + { + *p1 = (cover_type)base_type::m_ren.cover(dist); + ++npix; + } + ++p1; + ++dy; + } + + dy = 1; + dist_start = m_di.dist_start(); + dist_end = m_di.dist_end(); + while ((dist = base_type::m_dist[dy] + s1) <= base_type::m_width) + { + dist_start += m_di.dx_start(); + dist_end += m_di.dx_end(); + *--p0 = 0; + if (dist_end > 0 && dist_start <= 0) + { + *p0 = (cover_type)base_type::m_ren.cover(dist); + ++npix; + } + ++dy; + } + base_type::m_ren.blend_solid_vspan(base_type::m_x, base_type::m_y - dy + 1, unsigned(p1 - p0), p0); + return npix && ++base_type::m_step < base_type::m_count; + } + + //--------------------------------------------------------------------- + bool step_ver() + { + int dist_start; + int dist_end; + int dist; + int dx; + int s1 = base_type::step_ver_base(m_di); + cover_type* p0 = base_type::m_covers + base_type::max_half_width + 2; + cover_type* p1 = p0; + + dist_start = m_di.dist_start(); + dist_end = m_di.dist_end(); + + int npix = 0; + *p1 = 0; + if (dist_end > 0) + { + if (dist_start <= 0) + { + *p1 = (cover_type)base_type::m_ren.cover(s1); + } + ++npix; + } + ++p1; + + dx = 1; + while ((dist = base_type::m_dist[dx] - s1) <= base_type::m_width) + { + dist_start += m_di.dy_start(); + dist_end += m_di.dy_end(); + *p1 = 0; + if (dist_end > 0 && dist_start <= 0) + { + *p1 = (cover_type)base_type::m_ren.cover(dist); + ++npix; + } + ++p1; + ++dx; + } + + dx = 1; + dist_start = m_di.dist_start(); + dist_end = m_di.dist_end(); + while ((dist = base_type::m_dist[dx] + s1) <= base_type::m_width) + { + dist_start -= m_di.dy_start(); + dist_end -= m_di.dy_end(); + *--p0 = 0; + if (dist_end > 0 && dist_start <= 0) + { + *p0 = (cover_type)base_type::m_ren.cover(dist); + ++npix; + } + ++dx; + } + base_type::m_ren.blend_solid_hspan(base_type::m_x - dx + 1, base_type::m_y, unsigned(p1 - p0), p0); + return npix && ++base_type::m_step < base_type::m_count; + } + + private: + line_interpolator_aa3(const line_interpolator_aa3&); + const line_interpolator_aa3& operator=(const line_interpolator_aa3&); + + //--------------------------------------------------------------------- + distance_interpolator3 m_di; +}; + +//==========================================================line_profile_aa +// +// See Implementation agg_line_profile_aa.cpp +// +class line_profile_aa +{ + public: + //--------------------------------------------------------------------- + typedef int8u value_type; + enum subpixel_scale_e { + subpixel_shift = line_subpixel_shift, + subpixel_scale = 1 << subpixel_shift, + subpixel_mask = subpixel_scale - 1 + }; + + enum aa_scale_e { aa_shift = 8, aa_scale = 1 << aa_shift, aa_mask = aa_scale - 1 }; + + //--------------------------------------------------------------------- + line_profile_aa() + : m_subpixel_width(0) + , m_min_width(1.0) + , m_smoother_width(1.0) + { + int i; + for (i = 0; i < aa_scale; i++) + m_gamma[i] = (value_type)i; + } + + //--------------------------------------------------------------------- + template + line_profile_aa(double w, const GammaF& gamma_function) + : m_subpixel_width(0) + , m_min_width(1.0) + , m_smoother_width(1.0) + { + gamma(gamma_function); + width(w); + } + + //--------------------------------------------------------------------- + void min_width(double w) { m_min_width = w; } + void smoother_width(double w) { m_smoother_width = w; } + + //--------------------------------------------------------------------- + template + void gamma(const GammaF& gamma_function) + { + int i; + for (i = 0; i < aa_scale; i++) + { + m_gamma[i] = value_type(uround(gamma_function(double(i) / aa_mask) * aa_mask)); + } + } + + void width(double w); + + unsigned profile_size() const { return m_profile.size(); } + int subpixel_width() const { return m_subpixel_width; } + + //--------------------------------------------------------------------- + double min_width() const { return m_min_width; } + double smoother_width() const { return m_smoother_width; } + + //--------------------------------------------------------------------- + value_type value(int dist) const { return m_profile[dist + subpixel_scale * 2]; } + + private: + line_profile_aa(const line_profile_aa&); + const line_profile_aa& operator=(const line_profile_aa&); + + value_type* profile(double w); + void set(double center_width, double smoother_width); + + //--------------------------------------------------------------------- + pod_array m_profile; + value_type m_gamma[aa_scale]; + int m_subpixel_width; + double m_min_width; + double m_smoother_width; +}; + +//======================================================renderer_outline_aa +template +class renderer_outline_aa +{ + public: + //--------------------------------------------------------------------- + typedef BaseRenderer base_ren_type; + typedef renderer_outline_aa self_type; + typedef typename base_ren_type::color_type color_type; + + //--------------------------------------------------------------------- + renderer_outline_aa(base_ren_type& ren, const line_profile_aa& prof) + : m_ren(&ren) + , m_profile(&prof) + , m_clip_box(0, 0, 0, 0) + , m_clipping(false) + {} + void attach(base_ren_type& ren) { m_ren = &ren; } + + //--------------------------------------------------------------------- + void color(const color_type& c) { m_color = c; } + const color_type& color() const { return m_color; } + + //--------------------------------------------------------------------- + void profile(const line_profile_aa& prof) { m_profile = &prof; } + const line_profile_aa& profile() const { return *m_profile; } + + // clang error: binding of reference to type 'agg::line_profile_aa' to a value of type + // 'const agg::line_profile_aa' drops qualifiers + // line_profile_aa& profile() { return *m_profile; } + + //--------------------------------------------------------------------- + int subpixel_width() const { return m_profile->subpixel_width(); } + + //--------------------------------------------------------------------- + void reset_clipping() { m_clipping = false; } + void clip_box(double x1, double y1, double x2, double y2) + { + m_clip_box.x1 = line_coord_sat::conv(x1); + m_clip_box.y1 = line_coord_sat::conv(y1); + m_clip_box.x2 = line_coord_sat::conv(x2); + m_clip_box.y2 = line_coord_sat::conv(y2); + m_clipping = true; + } + + //--------------------------------------------------------------------- + int cover(int d) const { return m_profile->value(d); } + + //------------------------------------------------------------------------- + void blend_solid_hspan(int x, int y, unsigned len, const cover_type* covers) + { + m_ren->blend_solid_hspan(x, y, len, m_color, covers); + } + + //------------------------------------------------------------------------- + void blend_solid_vspan(int x, int y, unsigned len, const cover_type* covers) + { + m_ren->blend_solid_vspan(x, y, len, m_color, covers); + } + + //------------------------------------------------------------------------- + static bool accurate_join_only() { return false; } + + //------------------------------------------------------------------------- + template + void semidot_hline(Cmp cmp, int xc1, int yc1, int xc2, int yc2, int x1, int y1, int x2) + { + cover_type covers[line_interpolator_aa_base::max_half_width * 2 + 4]; + cover_type* p0 = covers; + cover_type* p1 = covers; + int x = x1 * line_subpixel_scale; + int y = y1 * line_subpixel_scale; + int w = subpixel_width(); + distance_interpolator0 di(xc1, yc1, xc2, yc2, x, y); + x += line_subpixel_scale / 2; + y += line_subpixel_scale / 2; + + int x0 = x1; + int dx = x - xc1; + int dy = y - yc1; + do + { + int d = int(fast_sqrt(dx * dx + dy * dy)); + *p1 = 0; + if (cmp(di.dist()) && d <= w) + { + *p1 = (cover_type)cover(d); + } + ++p1; + dx += line_subpixel_scale; + di.inc_x(); + } while (++x1 <= x2); + m_ren->blend_solid_hspan(x0, y1, unsigned(p1 - p0), color(), p0); + } + + //------------------------------------------------------------------------- + template + void semidot(Cmp cmp, int xc1, int yc1, int xc2, int yc2) + { + if (m_clipping && clipping_flags(xc1, yc1, m_clip_box)) + return; + + int r = ((subpixel_width() + line_subpixel_mask) >> line_subpixel_shift); + if (r < 1) + r = 1; + ellipse_bresenham_interpolator ei(r, r); + int dx = 0; + int dy = -r; + int dy0 = dy; + int dx0 = dx; + int x = xc1 >> line_subpixel_shift; + int y = yc1 >> line_subpixel_shift; + + do + { + dx += ei.dx(); + dy += ei.dy(); + + if (dy != dy0) + { + semidot_hline(cmp, xc1, yc1, xc2, yc2, x - dx0, y + dy0, x + dx0); + semidot_hline(cmp, xc1, yc1, xc2, yc2, x - dx0, y - dy0, x + dx0); + } + dx0 = dx; + dy0 = dy; + ++ei; + } while (dy < 0); + semidot_hline(cmp, xc1, yc1, xc2, yc2, x - dx0, y + dy0, x + dx0); + } + + //------------------------------------------------------------------------- + void pie_hline(int xc, int yc, int xp1, int yp1, int xp2, int yp2, int xh1, int yh1, int xh2) + { + if (m_clipping && clipping_flags(xc, yc, m_clip_box)) + return; + + cover_type covers[line_interpolator_aa_base::max_half_width * 2 + 4]; + cover_type* p0 = covers; + cover_type* p1 = covers; + int x = xh1 * line_subpixel_scale; + int y = yh1 * line_subpixel_scale; + int w = subpixel_width(); + + distance_interpolator00 di(xc, yc, xp1, yp1, xp2, yp2, x, y); + x += line_subpixel_scale / 2; + y += line_subpixel_scale / 2; + + int xh0 = xh1; + int dx = x - xc; + int dy = y - yc; + do + { + int d = int(fast_sqrt(dx * dx + dy * dy)); + *p1 = 0; + if (di.dist1() <= 0 && di.dist2() > 0 && d <= w) + { + *p1 = (cover_type)cover(d); + } + ++p1; + dx += line_subpixel_scale; + di.inc_x(); + } while (++xh1 <= xh2); + m_ren->blend_solid_hspan(xh0, yh1, unsigned(p1 - p0), color(), p0); + } + + //------------------------------------------------------------------------- + void pie(int xc, int yc, int x1, int y1, int x2, int y2) + { + int r = ((subpixel_width() + line_subpixel_mask) >> line_subpixel_shift); + if (r < 1) + r = 1; + ellipse_bresenham_interpolator ei(r, r); + int dx = 0; + int dy = -r; + int dy0 = dy; + int dx0 = dx; + int x = xc >> line_subpixel_shift; + int y = yc >> line_subpixel_shift; + + do + { + dx += ei.dx(); + dy += ei.dy(); + + if (dy != dy0) + { + pie_hline(xc, yc, x1, y1, x2, y2, x - dx0, y + dy0, x + dx0); + pie_hline(xc, yc, x1, y1, x2, y2, x - dx0, y - dy0, x + dx0); + } + dx0 = dx; + dy0 = dy; + ++ei; + } while (dy < 0); + pie_hline(xc, yc, x1, y1, x2, y2, x - dx0, y + dy0, x + dx0); + } + + //------------------------------------------------------------------------- + void line0_no_clip(const line_parameters& lp) + { + if (lp.len > line_max_length) + { + line_parameters lp1, lp2; + lp.divide(lp1, lp2); + line0_no_clip(lp1); + line0_no_clip(lp2); + return; + } + + line_interpolator_aa0 li(*this, lp); + if (li.count()) + { + if (li.vertical()) + { + while (li.step_ver()) + ; } else { - do - { - --base_type::m_li; - base_type::m_x -= lp.inc; - base_type::m_y = (base_type::m_lp->y1 + base_type::m_li.y()) >> line_subpixel_shift; - - if(lp.inc > 0) m_di.dec_x(base_type::m_y - base_type::m_old_y); - else m_di.inc_x(base_type::m_y - base_type::m_old_y); - - base_type::m_old_y = base_type::m_y; - - dist1_start = dist2_start = m_di.dist_start(); - - int dy = 0; - if(dist1_start < 0) ++npix; - do - { - dist1_start -= m_di.dx_start(); - dist2_start += m_di.dx_start(); - if(dist1_start < 0) ++npix; - if(dist2_start < 0) ++npix; - ++dy; - } - while(base_type::m_dist[dy] <= base_type::m_width); - --base_type::m_step; - if(npix == 0) break; - npix = 0; - } - while(base_type::m_step >= -base_type::m_max_extent); + while (li.step_hor()) + ; } - base_type::m_li.adjust_forward(); } + } - //--------------------------------------------------------------------- - bool step_hor() - { - int dist_start; - int dist; - int dy; - int s1 = base_type::step_hor_base(m_di); - - dist_start = m_di.dist_start(); - cover_type* p0 = base_type::m_covers + base_type::max_half_width + 2; - cover_type* p1 = p0; - - *p1 = 0; - if(dist_start <= 0) - { - *p1 = (cover_type)base_type::m_ren.cover(s1); - } - ++p1; - - dy = 1; - while((dist = base_type::m_dist[dy] - s1) <= base_type::m_width) - { - dist_start -= m_di.dx_start(); - *p1 = 0; - if(dist_start <= 0) - { - *p1 = (cover_type)base_type::m_ren.cover(dist); - } - ++p1; - ++dy; - } - - dy = 1; - dist_start = m_di.dist_start(); - while((dist = base_type::m_dist[dy] + s1) <= base_type::m_width) - { - dist_start += m_di.dx_start(); - *--p0 = 0; - if(dist_start <= 0) - { - *p0 = (cover_type)base_type::m_ren.cover(dist); - } - ++dy; - } - - base_type::m_ren.blend_solid_vspan(base_type::m_x, - base_type::m_y - dy + 1, - unsigned(p1 - p0), - p0); - return ++base_type::m_step < base_type::m_count; - } - - //--------------------------------------------------------------------- - bool step_ver() - { - int dist_start; - int dist; - int dx; - int s1 = base_type::step_ver_base(m_di); - cover_type* p0 = base_type::m_covers + base_type::max_half_width + 2; - cover_type* p1 = p0; - - dist_start = m_di.dist_start(); - - *p1 = 0; - if(dist_start <= 0) - { - *p1 = (cover_type)base_type::m_ren.cover(s1); - } - ++p1; - - dx = 1; - while((dist = base_type::m_dist[dx] - s1) <= base_type::m_width) - { - dist_start += m_di.dy_start(); - *p1 = 0; - if(dist_start <= 0) - { - *p1 = (cover_type)base_type::m_ren.cover(dist); - } - ++p1; - ++dx; - } - - dx = 1; - dist_start = m_di.dist_start(); - while((dist = base_type::m_dist[dx] + s1) <= base_type::m_width) - { - dist_start -= m_di.dy_start(); - *--p0 = 0; - if(dist_start <= 0) - { - *p0 = (cover_type)base_type::m_ren.cover(dist); - } - ++dx; - } - base_type::m_ren.blend_solid_hspan(base_type::m_x - dx + 1, - base_type::m_y, - unsigned(p1 - p0), - p0); - return ++base_type::m_step < base_type::m_count; - } - - private: - line_interpolator_aa1(const line_interpolator_aa1&); - const line_interpolator_aa1& - operator = (const line_interpolator_aa1&); - - //--------------------------------------------------------------------- - distance_interpolator2 m_di; - }; - - - - - - - - - - - - - //====================================================line_interpolator_aa2 - template class line_interpolator_aa2 : - public line_interpolator_aa_base + //------------------------------------------------------------------------- + void line0(const line_parameters& lp) { - public: - typedef Renderer renderer_type; - typedef typename Renderer::color_type color_type; - typedef line_interpolator_aa_base base_type; - - //--------------------------------------------------------------------- - line_interpolator_aa2(renderer_type& ren, const line_parameters& lp, - int ex, int ey) : - line_interpolator_aa_base(ren, lp), - m_di(lp.x1, lp.y1, lp.x2, lp.y2, ex, ey, - lp.x1 & ~line_subpixel_mask, lp.y1 & ~line_subpixel_mask, - 0) + if (m_clipping) { - base_type::m_li.adjust_forward(); - base_type::m_step -= base_type::m_max_extent; - } - - //--------------------------------------------------------------------- - bool step_hor() - { - int dist_end; - int dist; - int dy; - int s1 = base_type::step_hor_base(m_di); - cover_type* p0 = base_type::m_covers + base_type::max_half_width + 2; - cover_type* p1 = p0; - - dist_end = m_di.dist_end(); - - int npix = 0; - *p1 = 0; - if(dist_end > 0) + int x1 = lp.x1; + int y1 = lp.y1; + int x2 = lp.x2; + int y2 = lp.y2; + unsigned flags = clip_line_segment(&x1, &y1, &x2, &y2, m_clip_box); + if ((flags & 4) == 0) { - *p1 = (cover_type)base_type::m_ren.cover(s1); - ++npix; - } - ++p1; - - dy = 1; - while((dist = base_type::m_dist[dy] - s1) <= base_type::m_width) - { - dist_end -= m_di.dx_end(); - *p1 = 0; - if(dist_end > 0) + if (flags) { - *p1 = (cover_type)base_type::m_ren.cover(dist); - ++npix; - } - ++p1; - ++dy; - } - - dy = 1; - dist_end = m_di.dist_end(); - while((dist = base_type::m_dist[dy] + s1) <= base_type::m_width) - { - dist_end += m_di.dx_end(); - *--p0 = 0; - if(dist_end > 0) - { - *p0 = (cover_type)base_type::m_ren.cover(dist); - ++npix; - } - ++dy; - } - base_type::m_ren.blend_solid_vspan(base_type::m_x, - base_type::m_y - dy + 1, - unsigned(p1 - p0), - p0); - return npix && ++base_type::m_step < base_type::m_count; - } - - //--------------------------------------------------------------------- - bool step_ver() - { - int dist_end; - int dist; - int dx; - int s1 = base_type::step_ver_base(m_di); - cover_type* p0 = base_type::m_covers + base_type::max_half_width + 2; - cover_type* p1 = p0; - - dist_end = m_di.dist_end(); - - int npix = 0; - *p1 = 0; - if(dist_end > 0) - { - *p1 = (cover_type)base_type::m_ren.cover(s1); - ++npix; - } - ++p1; - - dx = 1; - while((dist = base_type::m_dist[dx] - s1) <= base_type::m_width) - { - dist_end += m_di.dy_end(); - *p1 = 0; - if(dist_end > 0) - { - *p1 = (cover_type)base_type::m_ren.cover(dist); - ++npix; - } - ++p1; - ++dx; - } - - dx = 1; - dist_end = m_di.dist_end(); - while((dist = base_type::m_dist[dx] + s1) <= base_type::m_width) - { - dist_end -= m_di.dy_end(); - *--p0 = 0; - if(dist_end > 0) - { - *p0 = (cover_type)base_type::m_ren.cover(dist); - ++npix; - } - ++dx; - } - base_type::m_ren.blend_solid_hspan(base_type::m_x - dx + 1, - base_type::m_y, - unsigned(p1 - p0), - p0); - return npix && ++base_type::m_step < base_type::m_count; - } - - private: - line_interpolator_aa2(const line_interpolator_aa2&); - const line_interpolator_aa2& - operator = (const line_interpolator_aa2&); - - //--------------------------------------------------------------------- - distance_interpolator2 m_di; - }; - - - - - - - - - - - //====================================================line_interpolator_aa3 - template class line_interpolator_aa3 : - public line_interpolator_aa_base - { - public: - typedef Renderer renderer_type; - typedef typename Renderer::color_type color_type; - typedef line_interpolator_aa_base base_type; - - //--------------------------------------------------------------------- - line_interpolator_aa3(renderer_type& ren, const line_parameters& lp, - int sx, int sy, int ex, int ey) : - line_interpolator_aa_base(ren, lp), - m_di(lp.x1, lp.y1, lp.x2, lp.y2, sx, sy, ex, ey, - lp.x1 & ~line_subpixel_mask, lp.y1 & ~line_subpixel_mask) - { - int dist1_start; - int dist2_start; - int npix = 1; - if(lp.vertical) - { - do - { - --base_type::m_li; - base_type::m_y -= lp.inc; - base_type::m_x = (base_type::m_lp->x1 + base_type::m_li.y()) >> line_subpixel_shift; - - if(lp.inc > 0) m_di.dec_y(base_type::m_x - base_type::m_old_x); - else m_di.inc_y(base_type::m_x - base_type::m_old_x); - - base_type::m_old_x = base_type::m_x; - - dist1_start = dist2_start = m_di.dist_start(); - - int dx = 0; - if(dist1_start < 0) ++npix; - do - { - dist1_start += m_di.dy_start(); - dist2_start -= m_di.dy_start(); - if(dist1_start < 0) ++npix; - if(dist2_start < 0) ++npix; - ++dx; - } - while(base_type::m_dist[dx] <= base_type::m_width); - if(npix == 0) break; - npix = 0; - } - while(--base_type::m_step >= -base_type::m_max_extent); - } - else - { - do - { - --base_type::m_li; - base_type::m_x -= lp.inc; - base_type::m_y = (base_type::m_lp->y1 + base_type::m_li.y()) >> line_subpixel_shift; - - if(lp.inc > 0) m_di.dec_x(base_type::m_y - base_type::m_old_y); - else m_di.inc_x(base_type::m_y - base_type::m_old_y); - - base_type::m_old_y = base_type::m_y; - - dist1_start = dist2_start = m_di.dist_start(); - - int dy = 0; - if(dist1_start < 0) ++npix; - do - { - dist1_start -= m_di.dx_start(); - dist2_start += m_di.dx_start(); - if(dist1_start < 0) ++npix; - if(dist2_start < 0) ++npix; - ++dy; - } - while(base_type::m_dist[dy] <= base_type::m_width); - if(npix == 0) break; - npix = 0; - } - while(--base_type::m_step >= -base_type::m_max_extent); - } - base_type::m_li.adjust_forward(); - base_type::m_step -= base_type::m_max_extent; - } - - - //--------------------------------------------------------------------- - bool step_hor() - { - int dist_start; - int dist_end; - int dist; - int dy; - int s1 = base_type::step_hor_base(m_di); - cover_type* p0 = base_type::m_covers + base_type::max_half_width + 2; - cover_type* p1 = p0; - - dist_start = m_di.dist_start(); - dist_end = m_di.dist_end(); - - int npix = 0; - *p1 = 0; - if(dist_end > 0) - { - if(dist_start <= 0) - { - *p1 = (cover_type)base_type::m_ren.cover(s1); - } - ++npix; - } - ++p1; - - dy = 1; - while((dist = base_type::m_dist[dy] - s1) <= base_type::m_width) - { - dist_start -= m_di.dx_start(); - dist_end -= m_di.dx_end(); - *p1 = 0; - if(dist_end > 0 && dist_start <= 0) - { - *p1 = (cover_type)base_type::m_ren.cover(dist); - ++npix; - } - ++p1; - ++dy; - } - - dy = 1; - dist_start = m_di.dist_start(); - dist_end = m_di.dist_end(); - while((dist = base_type::m_dist[dy] + s1) <= base_type::m_width) - { - dist_start += m_di.dx_start(); - dist_end += m_di.dx_end(); - *--p0 = 0; - if(dist_end > 0 && dist_start <= 0) - { - *p0 = (cover_type)base_type::m_ren.cover(dist); - ++npix; - } - ++dy; - } - base_type::m_ren.blend_solid_vspan(base_type::m_x, - base_type::m_y - dy + 1, - unsigned(p1 - p0), - p0); - return npix && ++base_type::m_step < base_type::m_count; - } - - //--------------------------------------------------------------------- - bool step_ver() - { - int dist_start; - int dist_end; - int dist; - int dx; - int s1 = base_type::step_ver_base(m_di); - cover_type* p0 = base_type::m_covers + base_type::max_half_width + 2; - cover_type* p1 = p0; - - dist_start = m_di.dist_start(); - dist_end = m_di.dist_end(); - - int npix = 0; - *p1 = 0; - if(dist_end > 0) - { - if(dist_start <= 0) - { - *p1 = (cover_type)base_type::m_ren.cover(s1); - } - ++npix; - } - ++p1; - - dx = 1; - while((dist = base_type::m_dist[dx] - s1) <= base_type::m_width) - { - dist_start += m_di.dy_start(); - dist_end += m_di.dy_end(); - *p1 = 0; - if(dist_end > 0 && dist_start <= 0) - { - *p1 = (cover_type)base_type::m_ren.cover(dist); - ++npix; - } - ++p1; - ++dx; - } - - dx = 1; - dist_start = m_di.dist_start(); - dist_end = m_di.dist_end(); - while((dist = base_type::m_dist[dx] + s1) <= base_type::m_width) - { - dist_start -= m_di.dy_start(); - dist_end -= m_di.dy_end(); - *--p0 = 0; - if(dist_end > 0 && dist_start <= 0) - { - *p0 = (cover_type)base_type::m_ren.cover(dist); - ++npix; - } - ++dx; - } - base_type::m_ren.blend_solid_hspan(base_type::m_x - dx + 1, - base_type::m_y, - unsigned(p1 - p0), - p0); - return npix && ++base_type::m_step < base_type::m_count; - } - - private: - line_interpolator_aa3(const line_interpolator_aa3&); - const line_interpolator_aa3& - operator = (const line_interpolator_aa3&); - - //--------------------------------------------------------------------- - distance_interpolator3 m_di; - }; - - - - - //==========================================================line_profile_aa - // - // See Implementation agg_line_profile_aa.cpp - // - class line_profile_aa - { - public: - //--------------------------------------------------------------------- - typedef int8u value_type; - enum subpixel_scale_e - { - subpixel_shift = line_subpixel_shift, - subpixel_scale = 1 << subpixel_shift, - subpixel_mask = subpixel_scale - 1 - }; - - enum aa_scale_e - { - aa_shift = 8, - aa_scale = 1 << aa_shift, - aa_mask = aa_scale - 1 - }; - - //--------------------------------------------------------------------- - line_profile_aa() : - m_subpixel_width(0), - m_min_width(1.0), - m_smoother_width(1.0) - { - int i; - for(i = 0; i < aa_scale; i++) m_gamma[i] = (value_type)i; - } - - //--------------------------------------------------------------------- - template - line_profile_aa(double w, const GammaF& gamma_function) : - m_subpixel_width(0), - m_min_width(1.0), - m_smoother_width(1.0) - { - gamma(gamma_function); - width(w); - } - - //--------------------------------------------------------------------- - void min_width(double w) { m_min_width = w; } - void smoother_width(double w) { m_smoother_width = w; } - - //--------------------------------------------------------------------- - template void gamma(const GammaF& gamma_function) - { - int i; - for(i = 0; i < aa_scale; i++) - { - m_gamma[i] = value_type( - uround(gamma_function(double(i) / aa_mask) * aa_mask)); - } - } - - void width(double w); - - unsigned profile_size() const { return m_profile.size(); } - int subpixel_width() const { return m_subpixel_width; } - - //--------------------------------------------------------------------- - double min_width() const { return m_min_width; } - double smoother_width() const { return m_smoother_width; } - - //--------------------------------------------------------------------- - value_type value(int dist) const - { - return m_profile[dist + subpixel_scale*2]; - } - - private: - line_profile_aa(const line_profile_aa&); - const line_profile_aa& operator = (const line_profile_aa&); - - value_type* profile(double w); - void set(double center_width, double smoother_width); - - //--------------------------------------------------------------------- - pod_array m_profile; - value_type m_gamma[aa_scale]; - int m_subpixel_width; - double m_min_width; - double m_smoother_width; - }; - - - //======================================================renderer_outline_aa - template class renderer_outline_aa - { - public: - //--------------------------------------------------------------------- - typedef BaseRenderer base_ren_type; - typedef renderer_outline_aa self_type; - typedef typename base_ren_type::color_type color_type; - - //--------------------------------------------------------------------- - renderer_outline_aa(base_ren_type& ren, const line_profile_aa& prof) : - m_ren(&ren), - m_profile(&prof), - m_clip_box(0,0,0,0), - m_clipping(false) - {} - void attach(base_ren_type& ren) { m_ren = &ren; } - - //--------------------------------------------------------------------- - void color(const color_type& c) { m_color = c; } - const color_type& color() const { return m_color; } - - //--------------------------------------------------------------------- - void profile(const line_profile_aa& prof) { m_profile = &prof; } - const line_profile_aa& profile() const { return *m_profile; } - - // clang error: binding of reference to type 'agg::line_profile_aa' to a value of type - // 'const agg::line_profile_aa' drops qualifiers - //line_profile_aa& profile() { return *m_profile; } - - //--------------------------------------------------------------------- - int subpixel_width() const { return m_profile->subpixel_width(); } - - //--------------------------------------------------------------------- - void reset_clipping() { m_clipping = false; } - void clip_box(double x1, double y1, double x2, double y2) - { - m_clip_box.x1 = line_coord_sat::conv(x1); - m_clip_box.y1 = line_coord_sat::conv(y1); - m_clip_box.x2 = line_coord_sat::conv(x2); - m_clip_box.y2 = line_coord_sat::conv(y2); - m_clipping = true; - } - - //--------------------------------------------------------------------- - int cover(int d) const - { - return m_profile->value(d); - } - - //------------------------------------------------------------------------- - void blend_solid_hspan(int x, int y, unsigned len, const cover_type* covers) - { - m_ren->blend_solid_hspan(x, y, len, m_color, covers); - } - - //------------------------------------------------------------------------- - void blend_solid_vspan(int x, int y, unsigned len, const cover_type* covers) - { - m_ren->blend_solid_vspan(x, y, len, m_color, covers); - } - - //------------------------------------------------------------------------- - static bool accurate_join_only() { return false; } - - //------------------------------------------------------------------------- - template - void semidot_hline(Cmp cmp, - int xc1, int yc1, int xc2, int yc2, - int x1, int y1, int x2) - { - cover_type covers[line_interpolator_aa_base::max_half_width * 2 + 4]; - cover_type* p0 = covers; - cover_type* p1 = covers; - int x = x1 * line_subpixel_scale; - int y = y1 * line_subpixel_scale; - int w = subpixel_width(); - distance_interpolator0 di(xc1, yc1, xc2, yc2, x, y); - x += line_subpixel_scale/2; - y += line_subpixel_scale/2; - - int x0 = x1; - int dx = x - xc1; - int dy = y - yc1; - do - { - int d = int(fast_sqrt(dx*dx + dy*dy)); - *p1 = 0; - if(cmp(di.dist()) && d <= w) - { - *p1 = (cover_type)cover(d); - } - ++p1; - dx += line_subpixel_scale; - di.inc_x(); - } - while(++x1 <= x2); - m_ren->blend_solid_hspan(x0, y1, - unsigned(p1 - p0), - color(), - p0); - } - - //------------------------------------------------------------------------- - template - void semidot(Cmp cmp, int xc1, int yc1, int xc2, int yc2) - { - if(m_clipping && clipping_flags(xc1, yc1, m_clip_box)) return; - - int r = ((subpixel_width() + line_subpixel_mask) >> line_subpixel_shift); - if(r < 1) r = 1; - ellipse_bresenham_interpolator ei(r, r); - int dx = 0; - int dy = -r; - int dy0 = dy; - int dx0 = dx; - int x = xc1 >> line_subpixel_shift; - int y = yc1 >> line_subpixel_shift; - - do - { - dx += ei.dx(); - dy += ei.dy(); - - if(dy != dy0) - { - semidot_hline(cmp, xc1, yc1, xc2, yc2, x-dx0, y+dy0, x+dx0); - semidot_hline(cmp, xc1, yc1, xc2, yc2, x-dx0, y-dy0, x+dx0); - } - dx0 = dx; - dy0 = dy; - ++ei; - } - while(dy < 0); - semidot_hline(cmp, xc1, yc1, xc2, yc2, x-dx0, y+dy0, x+dx0); - } - - //------------------------------------------------------------------------- - void pie_hline(int xc, int yc, int xp1, int yp1, int xp2, int yp2, - int xh1, int yh1, int xh2) - { - if(m_clipping && clipping_flags(xc, yc, m_clip_box)) return; - - cover_type covers[line_interpolator_aa_base::max_half_width * 2 + 4]; - cover_type* p0 = covers; - cover_type* p1 = covers; - int x = xh1 * line_subpixel_scale; - int y = yh1 * line_subpixel_scale; - int w = subpixel_width(); - - distance_interpolator00 di(xc, yc, xp1, yp1, xp2, yp2, x, y); - x += line_subpixel_scale/2; - y += line_subpixel_scale/2; - - int xh0 = xh1; - int dx = x - xc; - int dy = y - yc; - do - { - int d = int(fast_sqrt(dx*dx + dy*dy)); - *p1 = 0; - if(di.dist1() <= 0 && di.dist2() > 0 && d <= w) - { - *p1 = (cover_type)cover(d); - } - ++p1; - dx += line_subpixel_scale; - di.inc_x(); - } - while(++xh1 <= xh2); - m_ren->blend_solid_hspan(xh0, yh1, - unsigned(p1 - p0), - color(), - p0); - } - - - //------------------------------------------------------------------------- - void pie(int xc, int yc, int x1, int y1, int x2, int y2) - { - int r = ((subpixel_width() + line_subpixel_mask) >> line_subpixel_shift); - if(r < 1) r = 1; - ellipse_bresenham_interpolator ei(r, r); - int dx = 0; - int dy = -r; - int dy0 = dy; - int dx0 = dx; - int x = xc >> line_subpixel_shift; - int y = yc >> line_subpixel_shift; - - do - { - dx += ei.dx(); - dy += ei.dy(); - - if(dy != dy0) - { - pie_hline(xc, yc, x1, y1, x2, y2, x-dx0, y+dy0, x+dx0); - pie_hline(xc, yc, x1, y1, x2, y2, x-dx0, y-dy0, x+dx0); - } - dx0 = dx; - dy0 = dy; - ++ei; - } - while(dy < 0); - pie_hline(xc, yc, x1, y1, x2, y2, x-dx0, y+dy0, x+dx0); - } - - //------------------------------------------------------------------------- - void line0_no_clip(const line_parameters& lp) - { - if(lp.len > line_max_length) - { - line_parameters lp1, lp2; - lp.divide(lp1, lp2); - line0_no_clip(lp1); - line0_no_clip(lp2); - return; - } - - line_interpolator_aa0 li(*this, lp); - if(li.count()) - { - if(li.vertical()) - { - while(li.step_ver()) ; + line_parameters lp2(x1, y1, x2, y2, uround(calc_distance(x1, y1, x2, y2))); + line0_no_clip(lp2); } else { - while(li.step_hor()) ; + line0_no_clip(lp); } } } - - //------------------------------------------------------------------------- - void line0(const line_parameters& lp) + else { - if(m_clipping) + line0_no_clip(lp); + } + } + + //------------------------------------------------------------------------- + void line1_no_clip(const line_parameters& lp, int sx, int sy) + { + if (lp.len > line_max_length) + { + line_parameters lp1, lp2; + lp.divide(lp1, lp2); + line1_no_clip(lp1, (lp.x1 + sx) >> 1, (lp.y1 + sy) >> 1); + line1_no_clip(lp2, lp1.x2 + (lp1.y2 - lp1.y1), lp1.y2 - (lp1.x2 - lp1.x1)); + return; + } + + fix_degenerate_bisectrix_start(lp, &sx, &sy); + line_interpolator_aa1 li(*this, lp, sx, sy); + if (li.vertical()) + { + while (li.step_ver()) + ; + } + else + { + while (li.step_hor()) + ; + } + } + + //------------------------------------------------------------------------- + void line1(const line_parameters& lp, int sx, int sy) + { + if (m_clipping) + { + int x1 = lp.x1; + int y1 = lp.y1; + int x2 = lp.x2; + int y2 = lp.y2; + unsigned flags = clip_line_segment(&x1, &y1, &x2, &y2, m_clip_box); + if ((flags & 4) == 0) { - int x1 = lp.x1; - int y1 = lp.y1; - int x2 = lp.x2; - int y2 = lp.y2; - unsigned flags = clip_line_segment(&x1, &y1, &x2, &y2, m_clip_box); - if((flags & 4) == 0) + if (flags) { - if(flags) + line_parameters lp2(x1, y1, x2, y2, uround(calc_distance(x1, y1, x2, y2))); + if (flags & 1) { - line_parameters lp2(x1, y1, x2, y2, - uround(calc_distance(x1, y1, x2, y2))); - line0_no_clip(lp2); + sx = x1 + (y2 - y1); + sy = y1 - (x2 - x1); } else { - line0_no_clip(lp); + while (std::abs(sx - lp.x1) + std::abs(sy - lp.y1) > 1 + lp2.len) + { + sx = (lp.x1 + sx) >> 1; + sy = (lp.y1 + sy) >> 1; + } } + line1_no_clip(lp2, sx, sy); + } + else + { + line1_no_clip(lp, sx, sy); } } - else - { - line0_no_clip(lp); - } + } + else + { + line1_no_clip(lp, sx, sy); + } + } + + //------------------------------------------------------------------------- + void line2_no_clip(const line_parameters& lp, int ex, int ey) + { + if (lp.len > line_max_length) + { + line_parameters lp1, lp2; + lp.divide(lp1, lp2); + line2_no_clip(lp1, lp1.x2 + (lp1.y2 - lp1.y1), lp1.y2 - (lp1.x2 - lp1.x1)); + line2_no_clip(lp2, (lp.x2 + ex) >> 1, (lp.y2 + ey) >> 1); + return; } - //------------------------------------------------------------------------- - void line1_no_clip(const line_parameters& lp, int sx, int sy) + fix_degenerate_bisectrix_end(lp, &ex, &ey); + line_interpolator_aa2 li(*this, lp, ex, ey); + if (li.vertical()) { - if(lp.len > line_max_length) - { - line_parameters lp1, lp2; - lp.divide(lp1, lp2); - line1_no_clip(lp1, (lp.x1 + sx) >> 1, (lp.y1 + sy) >> 1); - line1_no_clip(lp2, lp1.x2 + (lp1.y2 - lp1.y1), lp1.y2 - (lp1.x2 - lp1.x1)); - return; - } - - fix_degenerate_bisectrix_start(lp, &sx, &sy); - line_interpolator_aa1 li(*this, lp, sx, sy); - if(li.vertical()) - { - while(li.step_ver()) ; - } - else - { - while(li.step_hor()) ; - } + while (li.step_ver()) + ; } - - - //------------------------------------------------------------------------- - void line1(const line_parameters& lp, int sx, int sy) + else { - if(m_clipping) + while (li.step_hor()) + ; + } + } + + //------------------------------------------------------------------------- + void line2(const line_parameters& lp, int ex, int ey) + { + if (m_clipping) + { + int x1 = lp.x1; + int y1 = lp.y1; + int x2 = lp.x2; + int y2 = lp.y2; + unsigned flags = clip_line_segment(&x1, &y1, &x2, &y2, m_clip_box); + if ((flags & 4) == 0) { - int x1 = lp.x1; - int y1 = lp.y1; - int x2 = lp.x2; - int y2 = lp.y2; - unsigned flags = clip_line_segment(&x1, &y1, &x2, &y2, m_clip_box); - if((flags & 4) == 0) + if (flags) { - if(flags) + line_parameters lp2(x1, y1, x2, y2, uround(calc_distance(x1, y1, x2, y2))); + if (flags & 2) { - line_parameters lp2(x1, y1, x2, y2, - uround(calc_distance(x1, y1, x2, y2))); - if(flags & 1) - { - sx = x1 + (y2 - y1); - sy = y1 - (x2 - x1); - } - else - { - while(std::abs(sx - lp.x1) + std::abs(sy - lp.y1) > 1 + lp2.len) - { - sx = (lp.x1 + sx) >> 1; - sy = (lp.y1 + sy) >> 1; - } - } - line1_no_clip(lp2, sx, sy); + ex = x2 + (y2 - y1); + ey = y2 - (x2 - x1); } else { - line1_no_clip(lp, sx, sy); + while (std::abs(ex - lp.x2) + std::abs(ey - lp.y2) > 1 + lp2.len) + { + ex = (lp.x2 + ex) >> 1; + ey = (lp.y2 + ey) >> 1; + } } + line2_no_clip(lp2, ex, ey); + } + else + { + line2_no_clip(lp, ex, ey); } } - else - { - line1_no_clip(lp, sx, sy); - } + } + else + { + line2_no_clip(lp, ex, ey); + } + } + + //------------------------------------------------------------------------- + void line3_no_clip(const line_parameters& lp, int sx, int sy, int ex, int ey) + { + if (lp.len > line_max_length) + { + line_parameters lp1, lp2; + lp.divide(lp1, lp2); + int mx = lp1.x2 + (lp1.y2 - lp1.y1); + int my = lp1.y2 - (lp1.x2 - lp1.x1); + line3_no_clip(lp1, (lp.x1 + sx) >> 1, (lp.y1 + sy) >> 1, mx, my); + line3_no_clip(lp2, mx, my, (lp.x2 + ex) >> 1, (lp.y2 + ey) >> 1); + return; } - //------------------------------------------------------------------------- - void line2_no_clip(const line_parameters& lp, int ex, int ey) + fix_degenerate_bisectrix_start(lp, &sx, &sy); + fix_degenerate_bisectrix_end(lp, &ex, &ey); + line_interpolator_aa3 li(*this, lp, sx, sy, ex, ey); + if (li.vertical()) { - if(lp.len > line_max_length) - { - line_parameters lp1, lp2; - lp.divide(lp1, lp2); - line2_no_clip(lp1, lp1.x2 + (lp1.y2 - lp1.y1), lp1.y2 - (lp1.x2 - lp1.x1)); - line2_no_clip(lp2, (lp.x2 + ex) >> 1, (lp.y2 + ey) >> 1); - return; - } - - fix_degenerate_bisectrix_end(lp, &ex, &ey); - line_interpolator_aa2 li(*this, lp, ex, ey); - if(li.vertical()) - { - while(li.step_ver()) ; - } - else - { - while(li.step_hor()) ; - } + while (li.step_ver()) + ; } - - //------------------------------------------------------------------------- - void line2(const line_parameters& lp, int ex, int ey) + else { - if(m_clipping) + while (li.step_hor()) + ; + } + } + + //------------------------------------------------------------------------- + void line3(const line_parameters& lp, int sx, int sy, int ex, int ey) + { + if (m_clipping) + { + int x1 = lp.x1; + int y1 = lp.y1; + int x2 = lp.x2; + int y2 = lp.y2; + unsigned flags = clip_line_segment(&x1, &y1, &x2, &y2, m_clip_box); + if ((flags & 4) == 0) { - int x1 = lp.x1; - int y1 = lp.y1; - int x2 = lp.x2; - int y2 = lp.y2; - unsigned flags = clip_line_segment(&x1, &y1, &x2, &y2, m_clip_box); - if((flags & 4) == 0) + if (flags) { - if(flags) + line_parameters lp2(x1, y1, x2, y2, uround(calc_distance(x1, y1, x2, y2))); + if (flags & 1) { - line_parameters lp2(x1, y1, x2, y2, - uround(calc_distance(x1, y1, x2, y2))); - if(flags & 2) - { - ex = x2 + (y2 - y1); - ey = y2 - (x2 - x1); - } - else - { - while(std::abs(ex - lp.x2) + std::abs(ey - lp.y2) > 1 + lp2.len) - { - ex = (lp.x2 + ex) >> 1; - ey = (lp.y2 + ey) >> 1; - } - } - line2_no_clip(lp2, ex, ey); + sx = x1 + (y2 - y1); + sy = y1 - (x2 - x1); } else { - line2_no_clip(lp, ex, ey); + while (std::abs(sx - lp.x1) + std::abs(sy - lp.y1) > 1 + lp2.len) + { + sx = (lp.x1 + sx) >> 1; + sy = (lp.y1 + sy) >> 1; + } } - } - } - else - { - line2_no_clip(lp, ex, ey); - } - } - - //------------------------------------------------------------------------- - void line3_no_clip(const line_parameters& lp, - int sx, int sy, int ex, int ey) - { - if(lp.len > line_max_length) - { - line_parameters lp1, lp2; - lp.divide(lp1, lp2); - int mx = lp1.x2 + (lp1.y2 - lp1.y1); - int my = lp1.y2 - (lp1.x2 - lp1.x1); - line3_no_clip(lp1, (lp.x1 + sx) >> 1, (lp.y1 + sy) >> 1, mx, my); - line3_no_clip(lp2, mx, my, (lp.x2 + ex) >> 1, (lp.y2 + ey) >> 1); - return; - } - - fix_degenerate_bisectrix_start(lp, &sx, &sy); - fix_degenerate_bisectrix_end(lp, &ex, &ey); - line_interpolator_aa3 li(*this, lp, sx, sy, ex, ey); - if(li.vertical()) - { - while(li.step_ver()) ; - } - else - { - while(li.step_hor()) ; - } - } - - //------------------------------------------------------------------------- - void line3(const line_parameters& lp, - int sx, int sy, int ex, int ey) - { - if(m_clipping) - { - int x1 = lp.x1; - int y1 = lp.y1; - int x2 = lp.x2; - int y2 = lp.y2; - unsigned flags = clip_line_segment(&x1, &y1, &x2, &y2, m_clip_box); - if((flags & 4) == 0) - { - if(flags) + if (flags & 2) { - line_parameters lp2(x1, y1, x2, y2, - uround(calc_distance(x1, y1, x2, y2))); - if(flags & 1) - { - sx = x1 + (y2 - y1); - sy = y1 - (x2 - x1); - } - else - { - while(std::abs(sx - lp.x1) + std::abs(sy - lp.y1) > 1 + lp2.len) - { - sx = (lp.x1 + sx) >> 1; - sy = (lp.y1 + sy) >> 1; - } - } - if(flags & 2) - { - ex = x2 + (y2 - y1); - ey = y2 - (x2 - x1); - } - else - { - while(std::abs(ex - lp.x2) + std::abs(ey - lp.y2) > 1 + lp2.len) - { - ex = (lp.x2 + ex) >> 1; - ey = (lp.y2 + ey) >> 1; - } - } - line3_no_clip(lp2, sx, sy, ex, ey); + ex = x2 + (y2 - y1); + ey = y2 - (x2 - x1); } else { - line3_no_clip(lp, sx, sy, ex, ey); + while (std::abs(ex - lp.x2) + std::abs(ey - lp.y2) > 1 + lp2.len) + { + ex = (lp.x2 + ex) >> 1; + ey = (lp.y2 + ey) >> 1; + } } + line3_no_clip(lp2, sx, sy, ex, ey); + } + else + { + line3_no_clip(lp, sx, sy, ex, ey); } } - else - { - line3_no_clip(lp, sx, sy, ex, ey); - } } + else + { + line3_no_clip(lp, sx, sy, ex, ey); + } + } + private: + base_ren_type* m_ren; + const line_profile_aa* m_profile; + color_type m_color; + rect_i m_clip_box; + bool m_clipping; +}; - private: - base_ren_type* m_ren; - const line_profile_aa* m_profile; - color_type m_color; - rect_i m_clip_box; - bool m_clipping; - }; - - - -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_renderer_outline_image.h b/deps/agg/include/agg_renderer_outline_image.h index 6b4673977..b7e88484d 100644 --- a/deps/agg/include/agg_renderer_outline_image.h +++ b/deps/agg/include/agg_renderer_outline_image.h @@ -22,991 +22,973 @@ #include "agg_rendering_buffer.h" #include "agg_clip_liang_barsky.h" - -namespace agg +namespace agg { +//========================================================line_image_scale +template +class line_image_scale { - //========================================================line_image_scale - template class line_image_scale + public: + typedef typename Source::color_type color_type; + + line_image_scale(const Source& src, double height) + : m_source(src) + , m_height(height) + , m_scale(src.height() / height) + {} + + double width() const { return m_source.width(); } + double height() const { return m_height; } + + color_type pixel(int x, int y) const { - public: - typedef typename Source::color_type color_type; + double src_y = (y + 0.5) * m_scale - 0.5; + int h = m_source.height() - 1; + int y1 = ufloor(src_y); + int y2 = y1 + 1; + color_type pix1 = (y1 < 0) ? color_type::no_color() : m_source.pixel(x, y1); + color_type pix2 = (y2 > h) ? color_type::no_color() : m_source.pixel(x, y2); + return pix1.gradient(pix2, src_y - y1); + } - line_image_scale(const Source& src, double height) : - m_source(src), - m_height(height), - m_scale(src.height() / height) - { - } + private: + line_image_scale(const line_image_scale&); + const line_image_scale& operator=(const line_image_scale&); - double width() const { return m_source.width(); } - double height() const { return m_height; } + const Source& m_source; + double m_height; + double m_scale; +}; - color_type pixel(int x, int y) const - { - double src_y = (y + 0.5) * m_scale - 0.5; - int h = m_source.height() - 1; - int y1 = ufloor(src_y); - int y2 = y1 + 1; - color_type pix1 = (y1 < 0) ? color_type::no_color() : m_source.pixel(x, y1); - color_type pix2 = (y2 > h) ? color_type::no_color() : m_source.pixel(x, y2); - return pix1.gradient(pix2, src_y - y1); - } +//======================================================line_image_pattern +template +class line_image_pattern +{ + public: + typedef Filter filter_type; + typedef typename filter_type::color_type color_type; - private: - line_image_scale(const line_image_scale&); - const line_image_scale& operator = (const line_image_scale&); + //-------------------------------------------------------------------- + line_image_pattern(const Filter& filter) + : m_filter(&filter) + , m_dilation(filter.dilation() + 1) + , m_dilation_hr(m_dilation * line_subpixel_scale) + , m_data() + , m_width(0) + , m_height(0) + , m_width_hr(0) + , m_half_height_hr(0) + , m_offset_y_hr(0) + {} - const Source& m_source; - double m_height; - double m_scale; - }; - - - - //======================================================line_image_pattern - template class line_image_pattern + // Create + //-------------------------------------------------------------------- + template + line_image_pattern(const Filter& filter, const Source& src) + : m_filter(&filter) + , m_dilation(filter.dilation() + 1) + , m_dilation_hr(m_dilation * line_subpixel_scale) + , m_data() + , m_width(0) + , m_height(0) + , m_width_hr(0) + , m_half_height_hr(0) + , m_offset_y_hr(0) { - public: - typedef Filter filter_type; - typedef typename filter_type::color_type color_type; + create(src); + } - //-------------------------------------------------------------------- - line_image_pattern(const Filter& filter) : - m_filter(&filter), - m_dilation(filter.dilation() + 1), - m_dilation_hr(m_dilation * line_subpixel_scale), - m_data(), - m_width(0), - m_height(0), - m_width_hr(0), - m_half_height_hr(0), - m_offset_y_hr(0) + // Create + //-------------------------------------------------------------------- + template + void create(const Source& src) + { + m_height = uceil(src.height()); + m_width = uceil(src.width()); + m_width_hr = uround(src.width() * line_subpixel_scale); + m_half_height_hr = uround(src.height() * line_subpixel_scale / 2); + m_offset_y_hr = m_dilation_hr + m_half_height_hr - line_subpixel_scale / 2; + m_half_height_hr += line_subpixel_scale / 2; + + m_data.resize((m_width + m_dilation * 2) * (m_height + m_dilation * 2)); + + m_buf.attach(&m_data[0], m_width + m_dilation * 2, m_height + m_dilation * 2, m_width + m_dilation * 2); + unsigned x, y; + color_type* d1; + color_type* d2; + for (y = 0; y < m_height; y++) { - } - - // Create - //-------------------------------------------------------------------- - template - line_image_pattern(const Filter& filter, const Source& src) : - m_filter(&filter), - m_dilation(filter.dilation() + 1), - m_dilation_hr(m_dilation * line_subpixel_scale), - m_data(), - m_width(0), - m_height(0), - m_width_hr(0), - m_half_height_hr(0), - m_offset_y_hr(0) - { - create(src); - } - - // Create - //-------------------------------------------------------------------- - template void create(const Source& src) - { - m_height = uceil(src.height()); - m_width = uceil(src.width()); - m_width_hr = uround(src.width() * line_subpixel_scale); - m_half_height_hr = uround(src.height() * line_subpixel_scale/2); - m_offset_y_hr = m_dilation_hr + m_half_height_hr - line_subpixel_scale/2; - m_half_height_hr += line_subpixel_scale/2; - - m_data.resize((m_width + m_dilation * 2) * (m_height + m_dilation * 2)); - - m_buf.attach(&m_data[0], m_width + m_dilation * 2, - m_height + m_dilation * 2, - m_width + m_dilation * 2); - unsigned x, y; - color_type* d1; - color_type* d2; - for(y = 0; y < m_height; y++) + d1 = m_buf.row_ptr(y + m_dilation) + m_dilation; + for (x = 0; x < m_width; x++) { - d1 = m_buf.row_ptr(y + m_dilation) + m_dilation; - for(x = 0; x < m_width; x++) - { - *d1++ = src.pixel(x, y); - } - } - - const color_type* s1; - const color_type* s2; - for(y = 0; y < m_dilation; y++) - { - //s1 = m_buf.row_ptr(m_height + m_dilation - 1) + m_dilation; - //s2 = m_buf.row_ptr(m_dilation) + m_dilation; - d1 = m_buf.row_ptr(m_dilation + m_height + y) + m_dilation; - d2 = m_buf.row_ptr(m_dilation - y - 1) + m_dilation; - for(x = 0; x < m_width; x++) - { - //*d1++ = color_type(*s1++, 0); - //*d2++ = color_type(*s2++, 0); - *d1++ = color_type::no_color(); - *d2++ = color_type::no_color(); - } - } - - unsigned h = m_height + m_dilation * 2; - for(y = 0; y < h; y++) - { - s1 = m_buf.row_ptr(y) + m_dilation; - s2 = m_buf.row_ptr(y) + m_dilation + m_width; - d1 = m_buf.row_ptr(y) + m_dilation + m_width; - d2 = m_buf.row_ptr(y) + m_dilation; - - for(x = 0; x < m_dilation; x++) - { - *d1++ = *s1++; - *--d2 = *--s2; - } + *d1++ = src.pixel(x, y); } } - //-------------------------------------------------------------------- - int pattern_width() const { return m_width_hr; } - int line_width() const { return m_half_height_hr; } - double width() const { return m_height; } - - //-------------------------------------------------------------------- - void pixel(color_type* p, int x, int y) const + const color_type* s1; + const color_type* s2; + for (y = 0; y < m_dilation; y++) { - m_filter->pixel_high_res(m_buf.rows(), - p, - x % m_width_hr + m_dilation_hr, - y + m_offset_y_hr); - } - - //-------------------------------------------------------------------- - const filter_type& filter() const { return *m_filter; } - - private: - line_image_pattern(const line_image_pattern&); - const line_image_pattern& - operator = (const line_image_pattern&); - - protected: - row_ptr_cache m_buf; - const filter_type* m_filter; - unsigned m_dilation; - int m_dilation_hr; - pod_array m_data; - unsigned m_width; - unsigned m_height; - int m_width_hr; - int m_half_height_hr; - int m_offset_y_hr; - }; - - - - - - - //=================================================line_image_pattern_pow2 - template class line_image_pattern_pow2 : - public line_image_pattern - { - public: - typedef Filter filter_type; - typedef typename filter_type::color_type color_type; - typedef line_image_pattern base_type; - - //-------------------------------------------------------------------- - line_image_pattern_pow2(const Filter& filter) : - line_image_pattern(filter), m_mask(line_subpixel_mask) {} - - //-------------------------------------------------------------------- - template - line_image_pattern_pow2(const Filter& filter, const Source& src) : - line_image_pattern(filter), m_mask(line_subpixel_mask) - { - create(src); - } - - //-------------------------------------------------------------------- - template void create(const Source& src) - { - line_image_pattern::create(src); - m_mask = 1; - while(m_mask < base_type::m_width) + // s1 = m_buf.row_ptr(m_height + m_dilation - 1) + m_dilation; + // s2 = m_buf.row_ptr(m_dilation) + m_dilation; + d1 = m_buf.row_ptr(m_dilation + m_height + y) + m_dilation; + d2 = m_buf.row_ptr(m_dilation - y - 1) + m_dilation; + for (x = 0; x < m_width; x++) { - m_mask <<= 1; - m_mask |= 1; + //*d1++ = color_type(*s1++, 0); + //*d2++ = color_type(*s2++, 0); + *d1++ = color_type::no_color(); + *d2++ = color_type::no_color(); } - m_mask <<= line_subpixel_shift - 1; - m_mask |= line_subpixel_mask; - base_type::m_width_hr = m_mask + 1; } - //-------------------------------------------------------------------- - void pixel(color_type* p, int x, int y) const + unsigned h = m_height + m_dilation * 2; + for (y = 0; y < h; y++) { - base_type::m_filter->pixel_high_res( - base_type::m_buf.rows(), - p, - (x & m_mask) + base_type::m_dilation_hr, - y + base_type::m_offset_y_hr); + s1 = m_buf.row_ptr(y) + m_dilation; + s2 = m_buf.row_ptr(y) + m_dilation + m_width; + d1 = m_buf.row_ptr(y) + m_dilation + m_width; + d2 = m_buf.row_ptr(y) + m_dilation; + + for (x = 0; x < m_dilation; x++) + { + *d1++ = *s1++; + *--d2 = *--s2; + } } - private: - unsigned m_mask; - }; + } + //-------------------------------------------------------------------- + int pattern_width() const { return m_width_hr; } + int line_width() const { return m_half_height_hr; } + double width() const { return m_height; } - - - - - - //===================================================distance_interpolator4 - class distance_interpolator4 + //-------------------------------------------------------------------- + void pixel(color_type* p, int x, int y) const { - public: - //--------------------------------------------------------------------- - distance_interpolator4() {} - distance_interpolator4(int x1, int y1, int x2, int y2, - int sx, int sy, int ex, int ey, - int len, double scale, int x, int y) : - m_dx(x2 - x1), - m_dy(y2 - y1), - m_dx_start(line_mr(sx) - line_mr(x1)), - m_dy_start(line_mr(sy) - line_mr(y1)), - m_dx_end(line_mr(ex) - line_mr(x2)), - m_dy_end(line_mr(ey) - line_mr(y2)), + m_filter->pixel_high_res(m_buf.rows(), p, x % m_width_hr + m_dilation_hr, y + m_offset_y_hr); + } - m_dist(iround(double(x + line_subpixel_scale/2 - x2) * double(m_dy) - - double(y + line_subpixel_scale/2 - y2) * double(m_dx))), + //-------------------------------------------------------------------- + const filter_type& filter() const { return *m_filter; } - m_dist_start((line_mr(x + line_subpixel_scale/2) - line_mr(sx)) * m_dy_start - - (line_mr(y + line_subpixel_scale/2) - line_mr(sy)) * m_dx_start), + private: + line_image_pattern(const line_image_pattern&); + const line_image_pattern& operator=(const line_image_pattern&); - m_dist_end((line_mr(x + line_subpixel_scale/2) - line_mr(ex)) * m_dy_end - - (line_mr(y + line_subpixel_scale/2) - line_mr(ey)) * m_dx_end), - m_len(uround(len / scale)) + protected: + row_ptr_cache m_buf; + const filter_type* m_filter; + unsigned m_dilation; + int m_dilation_hr; + pod_array m_data; + unsigned m_width; + unsigned m_height; + int m_width_hr; + int m_half_height_hr; + int m_offset_y_hr; +}; + +//=================================================line_image_pattern_pow2 +template +class line_image_pattern_pow2 : public line_image_pattern +{ + public: + typedef Filter filter_type; + typedef typename filter_type::color_type color_type; + typedef line_image_pattern base_type; + + //-------------------------------------------------------------------- + line_image_pattern_pow2(const Filter& filter) + : line_image_pattern(filter) + , m_mask(line_subpixel_mask) + {} + + //-------------------------------------------------------------------- + template + line_image_pattern_pow2(const Filter& filter, const Source& src) + : line_image_pattern(filter) + , m_mask(line_subpixel_mask) + { + create(src); + } + + //-------------------------------------------------------------------- + template + void create(const Source& src) + { + line_image_pattern::create(src); + m_mask = 1; + while (m_mask < base_type::m_width) { - double d = len * scale; - int dx = iround(((x2 - x1) * line_subpixel_scale) / d); - int dy = iround(((y2 - y1) * line_subpixel_scale) / d); - m_dx_pict = -dy; - m_dy_pict = dx; - m_dist_pict = ((x + line_subpixel_scale/2 - (x1 - dy)) * m_dy_pict - - (y + line_subpixel_scale/2 - (y1 + dx)) * m_dx_pict) >> - line_subpixel_shift; - - m_dx *= line_subpixel_scale; - m_dy *= line_subpixel_scale; - m_dx_start *= line_mr_subpixel_scale; - m_dy_start *= line_mr_subpixel_scale; - m_dx_end *= line_mr_subpixel_scale; - m_dy_end *= line_mr_subpixel_scale; + m_mask <<= 1; + m_mask |= 1; } + m_mask <<= line_subpixel_shift - 1; + m_mask |= line_subpixel_mask; + base_type::m_width_hr = m_mask + 1; + } - //--------------------------------------------------------------------- - void inc_x() - { - m_dist += m_dy; - m_dist_start += m_dy_start; - m_dist_pict += m_dy_pict; - m_dist_end += m_dy_end; - } + //-------------------------------------------------------------------- + void pixel(color_type* p, int x, int y) const + { + base_type::m_filter->pixel_high_res(base_type::m_buf.rows(), + p, + (x & m_mask) + base_type::m_dilation_hr, + y + base_type::m_offset_y_hr); + } - //--------------------------------------------------------------------- - void dec_x() - { - m_dist -= m_dy; - m_dist_start -= m_dy_start; - m_dist_pict -= m_dy_pict; - m_dist_end -= m_dy_end; - } + private: + unsigned m_mask; +}; - //--------------------------------------------------------------------- - void inc_y() +//===================================================distance_interpolator4 +class distance_interpolator4 +{ + public: + //--------------------------------------------------------------------- + distance_interpolator4() {} + distance_interpolator4(int x1, + int y1, + int x2, + int y2, + int sx, + int sy, + int ex, + int ey, + int len, + double scale, + int x, + int y) + : m_dx(x2 - x1) + , m_dy(y2 - y1) + , m_dx_start(line_mr(sx) - line_mr(x1)) + , m_dy_start(line_mr(sy) - line_mr(y1)) + , m_dx_end(line_mr(ex) - line_mr(x2)) + , m_dy_end(line_mr(ey) - line_mr(y2)) + , + + m_dist(iround(double(x + line_subpixel_scale / 2 - x2) * double(m_dy) - + double(y + line_subpixel_scale / 2 - y2) * double(m_dx))) + , + + m_dist_start((line_mr(x + line_subpixel_scale / 2) - line_mr(sx)) * m_dy_start - + (line_mr(y + line_subpixel_scale / 2) - line_mr(sy)) * m_dx_start) + , + + m_dist_end((line_mr(x + line_subpixel_scale / 2) - line_mr(ex)) * m_dy_end - + (line_mr(y + line_subpixel_scale / 2) - line_mr(ey)) * m_dx_end) + , m_len(uround(len / scale)) + { + double d = len * scale; + int dx = iround(((x2 - x1) * line_subpixel_scale) / d); + int dy = iround(((y2 - y1) * line_subpixel_scale) / d); + m_dx_pict = -dy; + m_dy_pict = dx; + m_dist_pict = ((x + line_subpixel_scale / 2 - (x1 - dy)) * m_dy_pict - + (y + line_subpixel_scale / 2 - (y1 + dx)) * m_dx_pict) >> + line_subpixel_shift; + + m_dx *= line_subpixel_scale; + m_dy *= line_subpixel_scale; + m_dx_start *= line_mr_subpixel_scale; + m_dy_start *= line_mr_subpixel_scale; + m_dx_end *= line_mr_subpixel_scale; + m_dy_end *= line_mr_subpixel_scale; + } + + //--------------------------------------------------------------------- + void inc_x() + { + m_dist += m_dy; + m_dist_start += m_dy_start; + m_dist_pict += m_dy_pict; + m_dist_end += m_dy_end; + } + + //--------------------------------------------------------------------- + void dec_x() + { + m_dist -= m_dy; + m_dist_start -= m_dy_start; + m_dist_pict -= m_dy_pict; + m_dist_end -= m_dy_end; + } + + //--------------------------------------------------------------------- + void inc_y() + { + m_dist -= m_dx; + m_dist_start -= m_dx_start; + m_dist_pict -= m_dx_pict; + m_dist_end -= m_dx_end; + } + + //--------------------------------------------------------------------- + void dec_y() + { + m_dist += m_dx; + m_dist_start += m_dx_start; + m_dist_pict += m_dx_pict; + m_dist_end += m_dx_end; + } + + //--------------------------------------------------------------------- + void inc_x(int dy) + { + m_dist += m_dy; + m_dist_start += m_dy_start; + m_dist_pict += m_dy_pict; + m_dist_end += m_dy_end; + if (dy > 0) { m_dist -= m_dx; m_dist_start -= m_dx_start; m_dist_pict -= m_dx_pict; m_dist_end -= m_dx_end; } - - //--------------------------------------------------------------------- - void dec_y() + if (dy < 0) { m_dist += m_dx; m_dist_start += m_dx_start; m_dist_pict += m_dx_pict; m_dist_end += m_dx_end; } + } - //--------------------------------------------------------------------- - void inc_x(int dy) + //--------------------------------------------------------------------- + void dec_x(int dy) + { + m_dist -= m_dy; + m_dist_start -= m_dy_start; + m_dist_pict -= m_dy_pict; + m_dist_end -= m_dy_end; + if (dy > 0) { - m_dist += m_dy; - m_dist_start += m_dy_start; - m_dist_pict += m_dy_pict; - m_dist_end += m_dy_end; - if(dy > 0) - { - m_dist -= m_dx; - m_dist_start -= m_dx_start; - m_dist_pict -= m_dx_pict; - m_dist_end -= m_dx_end; - } - if(dy < 0) - { - m_dist += m_dx; - m_dist_start += m_dx_start; - m_dist_pict += m_dx_pict; - m_dist_end += m_dx_end; - } - } - - //--------------------------------------------------------------------- - void dec_x(int dy) - { - m_dist -= m_dy; - m_dist_start -= m_dy_start; - m_dist_pict -= m_dy_pict; - m_dist_end -= m_dy_end; - if(dy > 0) - { - m_dist -= m_dx; - m_dist_start -= m_dx_start; - m_dist_pict -= m_dx_pict; - m_dist_end -= m_dx_end; - } - if(dy < 0) - { - m_dist += m_dx; - m_dist_start += m_dx_start; - m_dist_pict += m_dx_pict; - m_dist_end += m_dx_end; - } - } - - //--------------------------------------------------------------------- - void inc_y(int dx) - { - m_dist -= m_dx; + m_dist -= m_dx; m_dist_start -= m_dx_start; - m_dist_pict -= m_dx_pict; - m_dist_end -= m_dx_end; - if(dx > 0) - { - m_dist += m_dy; - m_dist_start += m_dy_start; - m_dist_pict += m_dy_pict; - m_dist_end += m_dy_end; - } - if(dx < 0) - { - m_dist -= m_dy; - m_dist_start -= m_dy_start; - m_dist_pict -= m_dy_pict; - m_dist_end -= m_dy_end; - } + m_dist_pict -= m_dx_pict; + m_dist_end -= m_dx_end; } - - //--------------------------------------------------------------------- - void dec_y(int dx) + if (dy < 0) { - m_dist += m_dx; + m_dist += m_dx; m_dist_start += m_dx_start; - m_dist_pict += m_dx_pict; - m_dist_end += m_dx_end; - if(dx > 0) - { - m_dist += m_dy; - m_dist_start += m_dy_start; - m_dist_pict += m_dy_pict; - m_dist_end += m_dy_end; - } - if(dx < 0) - { - m_dist -= m_dy; - m_dist_start -= m_dy_start; - m_dist_pict -= m_dy_pict; - m_dist_end -= m_dy_end; - } + m_dist_pict += m_dx_pict; + m_dist_end += m_dx_end; } + } - //--------------------------------------------------------------------- - int dist() const { return m_dist; } - int dist_start() const { return m_dist_start; } - int dist_pict() const { return m_dist_pict; } - int dist_end() const { return m_dist_end; } - - //--------------------------------------------------------------------- - int dx() const { return m_dx; } - int dy() const { return m_dy; } - int dx_start() const { return m_dx_start; } - int dy_start() const { return m_dy_start; } - int dx_pict() const { return m_dx_pict; } - int dy_pict() const { return m_dy_pict; } - int dx_end() const { return m_dx_end; } - int dy_end() const { return m_dy_end; } - int len() const { return m_len; } - - private: - //--------------------------------------------------------------------- - int m_dx; - int m_dy; - int m_dx_start; - int m_dy_start; - int m_dx_pict; - int m_dy_pict; - int m_dx_end; - int m_dy_end; - - int m_dist; - int m_dist_start; - int m_dist_pict; - int m_dist_end; - int m_len; - }; - - - - - - //==================================================line_interpolator_image - template class line_interpolator_image + //--------------------------------------------------------------------- + void inc_y(int dx) { - public: - typedef Renderer renderer_type; - typedef typename Renderer::color_type color_type; - - //--------------------------------------------------------------------- - enum max_half_width_e + m_dist -= m_dx; + m_dist_start -= m_dx_start; + m_dist_pict -= m_dx_pict; + m_dist_end -= m_dx_end; + if (dx > 0) { - max_half_width = 64 - }; - - //--------------------------------------------------------------------- - line_interpolator_image(renderer_type& ren, const line_parameters& lp, - int sx, int sy, int ex, int ey, - int pattern_start, - double scale_x) : - m_lp(lp), - m_li(lp.vertical ? line_dbl_hr(lp.x2 - lp.x1) : - line_dbl_hr(lp.y2 - lp.y1), - lp.vertical ? lp.dy : lp.dx + 1), - m_di(lp.x1, lp.y1, lp.x2, lp.y2, sx, sy, ex, ey, lp.len, scale_x, - lp.x1 & ~line_subpixel_mask, lp.y1 & ~line_subpixel_mask), - m_ren(ren), - m_x(lp.x1 >> line_subpixel_shift), - m_y(lp.y1 >> line_subpixel_shift), - m_old_x(m_x), - m_old_y(m_y), - m_count((lp.vertical ? std::abs((lp.y2 >> line_subpixel_shift) - m_y) : - std::abs((lp.x2 >> line_subpixel_shift) - m_x))), - m_width(ren.subpixel_width()), - //m_max_extent(m_width >> (line_subpixel_shift - 2)), - m_max_extent((m_width + line_subpixel_scale) >> line_subpixel_shift), - m_start(pattern_start + (m_max_extent + 2) * ren.pattern_width()), - m_step(0) - { - agg::dda2_line_interpolator li(0, lp.vertical ? - (lp.dy * agg::line_subpixel_scale) : - (lp.dx * agg::line_subpixel_scale), - lp.len); - - unsigned i; - int stop = m_width + line_subpixel_scale * 2; - for(i = 0; i < max_half_width; ++i) - { - m_dist_pos[i] = li.y(); - if(m_dist_pos[i] >= stop) break; - ++li; - } - m_dist_pos[i] = 0x7FFF0000; - - int dist1_start; - int dist2_start; - int npix = 1; - - if(lp.vertical) - { - do - { - --m_li; - m_y -= lp.inc; - m_x = (m_lp.x1 + m_li.y()) >> line_subpixel_shift; - - if(lp.inc > 0) m_di.dec_y(m_x - m_old_x); - else m_di.inc_y(m_x - m_old_x); - - m_old_x = m_x; - - dist1_start = dist2_start = m_di.dist_start(); - - int dx = 0; - if(dist1_start < 0) ++npix; - do - { - dist1_start += m_di.dy_start(); - dist2_start -= m_di.dy_start(); - if(dist1_start < 0) ++npix; - if(dist2_start < 0) ++npix; - ++dx; - } - while(m_dist_pos[dx] <= m_width); - if(npix == 0) break; - - npix = 0; - } - while(--m_step >= -m_max_extent); - } - else - { - do - { - --m_li; - - m_x -= lp.inc; - m_y = (m_lp.y1 + m_li.y()) >> line_subpixel_shift; - - if(lp.inc > 0) m_di.dec_x(m_y - m_old_y); - else m_di.inc_x(m_y - m_old_y); - - m_old_y = m_y; - - dist1_start = dist2_start = m_di.dist_start(); - - int dy = 0; - if(dist1_start < 0) ++npix; - do - { - dist1_start -= m_di.dx_start(); - dist2_start += m_di.dx_start(); - if(dist1_start < 0) ++npix; - if(dist2_start < 0) ++npix; - ++dy; - } - while(m_dist_pos[dy] <= m_width); - if(npix == 0) break; - - npix = 0; - } - while(--m_step >= -m_max_extent); - } - m_li.adjust_forward(); - m_step -= m_max_extent; + m_dist += m_dy; + m_dist_start += m_dy_start; + m_dist_pict += m_dy_pict; + m_dist_end += m_dy_end; } - - //--------------------------------------------------------------------- - bool step_hor() + if (dx < 0) { - ++m_li; - m_x += m_lp.inc; - m_y = (m_lp.y1 + m_li.y()) >> line_subpixel_shift; + m_dist -= m_dy; + m_dist_start -= m_dy_start; + m_dist_pict -= m_dy_pict; + m_dist_end -= m_dy_end; + } + } - if(m_lp.inc > 0) m_di.inc_x(m_y - m_old_y); - else m_di.dec_x(m_y - m_old_y); + //--------------------------------------------------------------------- + void dec_y(int dx) + { + m_dist += m_dx; + m_dist_start += m_dx_start; + m_dist_pict += m_dx_pict; + m_dist_end += m_dx_end; + if (dx > 0) + { + m_dist += m_dy; + m_dist_start += m_dy_start; + m_dist_pict += m_dy_pict; + m_dist_end += m_dy_end; + } + if (dx < 0) + { + m_dist -= m_dy; + m_dist_start -= m_dy_start; + m_dist_pict -= m_dy_pict; + m_dist_end -= m_dy_end; + } + } - m_old_y = m_y; + //--------------------------------------------------------------------- + int dist() const { return m_dist; } + int dist_start() const { return m_dist_start; } + int dist_pict() const { return m_dist_pict; } + int dist_end() const { return m_dist_end; } - int s1 = m_di.dist() / m_lp.len; - int s2 = -s1; + //--------------------------------------------------------------------- + int dx() const { return m_dx; } + int dy() const { return m_dy; } + int dx_start() const { return m_dx_start; } + int dy_start() const { return m_dy_start; } + int dx_pict() const { return m_dx_pict; } + int dy_pict() const { return m_dy_pict; } + int dx_end() const { return m_dx_end; } + int dy_end() const { return m_dy_end; } + int len() const { return m_len; } - if(m_lp.inc < 0) s1 = -s1; + private: + //--------------------------------------------------------------------- + int m_dx; + int m_dy; + int m_dx_start; + int m_dy_start; + int m_dx_pict; + int m_dy_pict; + int m_dx_end; + int m_dy_end; - int dist_start; - int dist_pict; - int dist_end; - int dy; - int dist; + int m_dist; + int m_dist_start; + int m_dist_pict; + int m_dist_end; + int m_len; +}; - dist_start = m_di.dist_start(); - dist_pict = m_di.dist_pict() + m_start; - dist_end = m_di.dist_end(); - color_type* p0 = m_colors + max_half_width + 2; - color_type* p1 = p0; +//==================================================line_interpolator_image +template +class line_interpolator_image +{ + public: + typedef Renderer renderer_type; + typedef typename Renderer::color_type color_type; - int npix = 0; - p1->clear(); - if(dist_end > 0) + //--------------------------------------------------------------------- + enum max_half_width_e { max_half_width = 64 }; + + //--------------------------------------------------------------------- + line_interpolator_image(renderer_type& ren, + const line_parameters& lp, + int sx, + int sy, + int ex, + int ey, + int pattern_start, + double scale_x) + : m_lp(lp) + , m_li(lp.vertical ? line_dbl_hr(lp.x2 - lp.x1) : line_dbl_hr(lp.y2 - lp.y1), lp.vertical ? lp.dy : lp.dx + 1) + , m_di(lp.x1, + lp.y1, + lp.x2, + lp.y2, + sx, + sy, + ex, + ey, + lp.len, + scale_x, + lp.x1 & ~line_subpixel_mask, + lp.y1 & ~line_subpixel_mask) + , m_ren(ren) + , m_x(lp.x1 >> line_subpixel_shift) + , m_y(lp.y1 >> line_subpixel_shift) + , m_old_x(m_x) + , m_old_y(m_y) + , m_count((lp.vertical ? std::abs((lp.y2 >> line_subpixel_shift) - m_y) + : std::abs((lp.x2 >> line_subpixel_shift) - m_x))) + , m_width(ren.subpixel_width()) + , + // m_max_extent(m_width >> (line_subpixel_shift - 2)), + m_max_extent((m_width + line_subpixel_scale) >> line_subpixel_shift) + , m_start(pattern_start + (m_max_extent + 2) * ren.pattern_width()) + , m_step(0) + { + agg::dda2_line_interpolator li(0, + lp.vertical ? (lp.dy * agg::line_subpixel_scale) + : (lp.dx * agg::line_subpixel_scale), + lp.len); + + unsigned i; + int stop = m_width + line_subpixel_scale * 2; + for (i = 0; i < max_half_width; ++i) + { + m_dist_pos[i] = li.y(); + if (m_dist_pos[i] >= stop) + break; + ++li; + } + m_dist_pos[i] = 0x7FFF0000; + + int dist1_start; + int dist2_start; + int npix = 1; + + if (lp.vertical) + { + do { - if(dist_start <= 0) + --m_li; + m_y -= lp.inc; + m_x = (m_lp.x1 + m_li.y()) >> line_subpixel_shift; + + if (lp.inc > 0) + m_di.dec_y(m_x - m_old_x); + else + m_di.inc_y(m_x - m_old_x); + + m_old_x = m_x; + + dist1_start = dist2_start = m_di.dist_start(); + + int dx = 0; + if (dist1_start < 0) + ++npix; + do { - m_ren.pixel(p1, dist_pict, s2); - } + dist1_start += m_di.dy_start(); + dist2_start -= m_di.dy_start(); + if (dist1_start < 0) + ++npix; + if (dist2_start < 0) + ++npix; + ++dx; + } while (m_dist_pos[dx] <= m_width); + if (npix == 0) + break; + + npix = 0; + } while (--m_step >= -m_max_extent); + } + else + { + do + { + --m_li; + + m_x -= lp.inc; + m_y = (m_lp.y1 + m_li.y()) >> line_subpixel_shift; + + if (lp.inc > 0) + m_di.dec_x(m_y - m_old_y); + else + m_di.inc_x(m_y - m_old_y); + + m_old_y = m_y; + + dist1_start = dist2_start = m_di.dist_start(); + + int dy = 0; + if (dist1_start < 0) + ++npix; + do + { + dist1_start -= m_di.dx_start(); + dist2_start += m_di.dx_start(); + if (dist1_start < 0) + ++npix; + if (dist2_start < 0) + ++npix; + ++dy; + } while (m_dist_pos[dy] <= m_width); + if (npix == 0) + break; + + npix = 0; + } while (--m_step >= -m_max_extent); + } + m_li.adjust_forward(); + m_step -= m_max_extent; + } + + //--------------------------------------------------------------------- + bool step_hor() + { + ++m_li; + m_x += m_lp.inc; + m_y = (m_lp.y1 + m_li.y()) >> line_subpixel_shift; + + if (m_lp.inc > 0) + m_di.inc_x(m_y - m_old_y); + else + m_di.dec_x(m_y - m_old_y); + + m_old_y = m_y; + + int s1 = m_di.dist() / m_lp.len; + int s2 = -s1; + + if (m_lp.inc < 0) + s1 = -s1; + + int dist_start; + int dist_pict; + int dist_end; + int dy; + int dist; + + dist_start = m_di.dist_start(); + dist_pict = m_di.dist_pict() + m_start; + dist_end = m_di.dist_end(); + color_type* p0 = m_colors + max_half_width + 2; + color_type* p1 = p0; + + int npix = 0; + p1->clear(); + if (dist_end > 0) + { + if (dist_start <= 0) + { + m_ren.pixel(p1, dist_pict, s2); + } + ++npix; + } + ++p1; + + dy = 1; + while ((dist = m_dist_pos[dy]) - s1 <= m_width) + { + dist_start -= m_di.dx_start(); + dist_pict -= m_di.dx_pict(); + dist_end -= m_di.dx_end(); + p1->clear(); + if (dist_end > 0 && dist_start <= 0) + { + if (m_lp.inc > 0) + dist = -dist; + m_ren.pixel(p1, dist_pict, s2 - dist); ++npix; } ++p1; - - dy = 1; - while((dist = m_dist_pos[dy]) - s1 <= m_width) - { - dist_start -= m_di.dx_start(); - dist_pict -= m_di.dx_pict(); - dist_end -= m_di.dx_end(); - p1->clear(); - if(dist_end > 0 && dist_start <= 0) - { - if(m_lp.inc > 0) dist = -dist; - m_ren.pixel(p1, dist_pict, s2 - dist); - ++npix; - } - ++p1; - ++dy; - } - - dy = 1; - dist_start = m_di.dist_start(); - dist_pict = m_di.dist_pict() + m_start; - dist_end = m_di.dist_end(); - while((dist = m_dist_pos[dy]) + s1 <= m_width) - { - dist_start += m_di.dx_start(); - dist_pict += m_di.dx_pict(); - dist_end += m_di.dx_end(); - --p0; - p0->clear(); - if(dist_end > 0 && dist_start <= 0) - { - if(m_lp.inc > 0) dist = -dist; - m_ren.pixel(p0, dist_pict, s2 + dist); - ++npix; - } - ++dy; - } - m_ren.blend_color_vspan(m_x, - m_y - dy + 1, - unsigned(p1 - p0), - p0); - return npix && ++m_step < m_count; + ++dy; } - - - //--------------------------------------------------------------------- - bool step_ver() + dy = 1; + dist_start = m_di.dist_start(); + dist_pict = m_di.dist_pict() + m_start; + dist_end = m_di.dist_end(); + while ((dist = m_dist_pos[dy]) + s1 <= m_width) { - ++m_li; - m_y += m_lp.inc; - m_x = (m_lp.x1 + m_li.y()) >> line_subpixel_shift; - - if(m_lp.inc > 0) m_di.inc_y(m_x - m_old_x); - else m_di.dec_y(m_x - m_old_x); - - m_old_x = m_x; - - int s1 = m_di.dist() / m_lp.len; - int s2 = -s1; - - if(m_lp.inc > 0) s1 = -s1; - - int dist_start; - int dist_pict; - int dist_end; - int dist; - int dx; - - dist_start = m_di.dist_start(); - dist_pict = m_di.dist_pict() + m_start; - dist_end = m_di.dist_end(); - color_type* p0 = m_colors + max_half_width + 2; - color_type* p1 = p0; - - int npix = 0; - p1->clear(); - if(dist_end > 0) + dist_start += m_di.dx_start(); + dist_pict += m_di.dx_pict(); + dist_end += m_di.dx_end(); + --p0; + p0->clear(); + if (dist_end > 0 && dist_start <= 0) { - if(dist_start <= 0) - { - m_ren.pixel(p1, dist_pict, s2); - } + if (m_lp.inc > 0) + dist = -dist; + m_ren.pixel(p0, dist_pict, s2 + dist); + ++npix; + } + ++dy; + } + m_ren.blend_color_vspan(m_x, m_y - dy + 1, unsigned(p1 - p0), p0); + return npix && ++m_step < m_count; + } + + //--------------------------------------------------------------------- + bool step_ver() + { + ++m_li; + m_y += m_lp.inc; + m_x = (m_lp.x1 + m_li.y()) >> line_subpixel_shift; + + if (m_lp.inc > 0) + m_di.inc_y(m_x - m_old_x); + else + m_di.dec_y(m_x - m_old_x); + + m_old_x = m_x; + + int s1 = m_di.dist() / m_lp.len; + int s2 = -s1; + + if (m_lp.inc > 0) + s1 = -s1; + + int dist_start; + int dist_pict; + int dist_end; + int dist; + int dx; + + dist_start = m_di.dist_start(); + dist_pict = m_di.dist_pict() + m_start; + dist_end = m_di.dist_end(); + color_type* p0 = m_colors + max_half_width + 2; + color_type* p1 = p0; + + int npix = 0; + p1->clear(); + if (dist_end > 0) + { + if (dist_start <= 0) + { + m_ren.pixel(p1, dist_pict, s2); + } + ++npix; + } + ++p1; + + dx = 1; + while ((dist = m_dist_pos[dx]) - s1 <= m_width) + { + dist_start += m_di.dy_start(); + dist_pict += m_di.dy_pict(); + dist_end += m_di.dy_end(); + p1->clear(); + if (dist_end > 0 && dist_start <= 0) + { + if (m_lp.inc > 0) + dist = -dist; + m_ren.pixel(p1, dist_pict, s2 + dist); ++npix; } ++p1; - - dx = 1; - while((dist = m_dist_pos[dx]) - s1 <= m_width) - { - dist_start += m_di.dy_start(); - dist_pict += m_di.dy_pict(); - dist_end += m_di.dy_end(); - p1->clear(); - if(dist_end > 0 && dist_start <= 0) - { - if(m_lp.inc > 0) dist = -dist; - m_ren.pixel(p1, dist_pict, s2 + dist); - ++npix; - } - ++p1; - ++dx; - } - - dx = 1; - dist_start = m_di.dist_start(); - dist_pict = m_di.dist_pict() + m_start; - dist_end = m_di.dist_end(); - while((dist = m_dist_pos[dx]) + s1 <= m_width) - { - dist_start -= m_di.dy_start(); - dist_pict -= m_di.dy_pict(); - dist_end -= m_di.dy_end(); - --p0; - p0->clear(); - if(dist_end > 0 && dist_start <= 0) - { - if(m_lp.inc > 0) dist = -dist; - m_ren.pixel(p0, dist_pict, s2 - dist); - ++npix; - } - ++dx; - } - m_ren.blend_color_hspan(m_x - dx + 1, - m_y, - unsigned(p1 - p0), - p0); - return npix && ++m_step < m_count; + ++dx; } + dx = 1; + dist_start = m_di.dist_start(); + dist_pict = m_di.dist_pict() + m_start; + dist_end = m_di.dist_end(); + while ((dist = m_dist_pos[dx]) + s1 <= m_width) + { + dist_start -= m_di.dy_start(); + dist_pict -= m_di.dy_pict(); + dist_end -= m_di.dy_end(); + --p0; + p0->clear(); + if (dist_end > 0 && dist_start <= 0) + { + if (m_lp.inc > 0) + dist = -dist; + m_ren.pixel(p0, dist_pict, s2 - dist); + ++npix; + } + ++dx; + } + m_ren.blend_color_hspan(m_x - dx + 1, m_y, unsigned(p1 - p0), p0); + return npix && ++m_step < m_count; + } - //--------------------------------------------------------------------- - int pattern_end() const { return m_start + m_di.len(); } + //--------------------------------------------------------------------- + int pattern_end() const { return m_start + m_di.len(); } - //--------------------------------------------------------------------- - bool vertical() const { return m_lp.vertical; } - int width() const { return m_width; } - int count() const { return m_count; } + //--------------------------------------------------------------------- + bool vertical() const { return m_lp.vertical; } + int width() const { return m_width; } + int count() const { return m_count; } - private: - line_interpolator_image(const line_interpolator_image&); - const line_interpolator_image& - operator = (const line_interpolator_image&); + private: + line_interpolator_image(const line_interpolator_image&); + const line_interpolator_image& operator=(const line_interpolator_image&); - protected: - const line_parameters& m_lp; - dda2_line_interpolator m_li; - distance_interpolator4 m_di; - renderer_type& m_ren; - int m_plen; - int m_x; - int m_y; - int m_old_x; - int m_old_y; - int m_count; - int m_width; - int m_max_extent; - int m_start; - int m_step; - int m_dist_pos[max_half_width + 1]; - color_type m_colors[max_half_width * 2 + 4]; - }; + protected: + const line_parameters& m_lp; + dda2_line_interpolator m_li; + distance_interpolator4 m_di; + renderer_type& m_ren; + int m_plen; + int m_x; + int m_y; + int m_old_x; + int m_old_y; + int m_count; + int m_width; + int m_max_extent; + int m_start; + int m_step; + int m_dist_pos[max_half_width + 1]; + color_type m_colors[max_half_width * 2 + 4]; +}; +//===================================================renderer_outline_image +template +class renderer_outline_image +{ + public: + //--------------------------------------------------------------------- + typedef BaseRenderer base_ren_type; + typedef renderer_outline_image self_type; + typedef typename base_ren_type::color_type color_type; + typedef ImagePattern pattern_type; + //--------------------------------------------------------------------- + renderer_outline_image(base_ren_type& ren, const pattern_type& patt) + : m_ren(&ren) + , m_pattern(&patt) + , m_start(0) + , m_scale_x(1.0) + , m_clip_box(0, 0, 0, 0) + , m_clipping(false) + {} + void attach(base_ren_type& ren) { m_ren = &ren; } + //--------------------------------------------------------------------- + void pattern(const pattern_type& p) { m_pattern = &p; } + const pattern_type& pattern() const { return *m_pattern; } - - - - - //===================================================renderer_outline_image - template - class renderer_outline_image + //--------------------------------------------------------------------- + void reset_clipping() { m_clipping = false; } + void clip_box(double x1, double y1, double x2, double y2) { - public: - //--------------------------------------------------------------------- - typedef BaseRenderer base_ren_type; - typedef renderer_outline_image self_type; - typedef typename base_ren_type::color_type color_type; - typedef ImagePattern pattern_type; + m_clip_box.x1 = line_coord_sat::conv(x1); + m_clip_box.y1 = line_coord_sat::conv(y1); + m_clip_box.x2 = line_coord_sat::conv(x2); + m_clip_box.y2 = line_coord_sat::conv(y2); + m_clipping = true; + } + //--------------------------------------------------------------------- + void scale_x(double s) { m_scale_x = s; } + double scale_x() const { return m_scale_x; } - //--------------------------------------------------------------------- - renderer_outline_image(base_ren_type& ren, const pattern_type& patt) : - m_ren(&ren), - m_pattern(&patt), - m_start(0), - m_scale_x(1.0), - m_clip_box(0,0,0,0), - m_clipping(false) - {} - void attach(base_ren_type& ren) { m_ren = &ren; } + //--------------------------------------------------------------------- + void start_x(double s) { m_start = iround(s * line_subpixel_scale); } + double start_x() const { return double(m_start) / line_subpixel_scale; } - //--------------------------------------------------------------------- - void pattern(const pattern_type& p) { m_pattern = &p; } - const pattern_type& pattern() const { return *m_pattern; } + //--------------------------------------------------------------------- + int subpixel_width() const { return m_pattern->line_width(); } + int pattern_width() const { return m_pattern->pattern_width(); } + double width() const { return double(subpixel_width()) / line_subpixel_scale; } - //--------------------------------------------------------------------- - void reset_clipping() { m_clipping = false; } - void clip_box(double x1, double y1, double x2, double y2) + //------------------------------------------------------------------------- + void pixel(color_type* p, int x, int y) const { m_pattern->pixel(p, x, y); } + + //------------------------------------------------------------------------- + void blend_color_hspan(int x, int y, unsigned len, const color_type* colors) + { + m_ren->blend_color_hspan(x, y, len, colors, 0); + } + + //------------------------------------------------------------------------- + void blend_color_vspan(int x, int y, unsigned len, const color_type* colors) + { + m_ren->blend_color_vspan(x, y, len, colors, 0); + } + + //------------------------------------------------------------------------- + static bool accurate_join_only() { return true; } + + //------------------------------------------------------------------------- + template + void semidot(Cmp, int, int, int, int) + {} + + //------------------------------------------------------------------------- + void pie(int, int, int, int, int, int) {} + + //------------------------------------------------------------------------- + void line0(const line_parameters&) {} + + //------------------------------------------------------------------------- + void line1(const line_parameters&, int, int) {} + + //------------------------------------------------------------------------- + void line2(const line_parameters&, int, int) {} + + //------------------------------------------------------------------------- + void line3_no_clip(const line_parameters& lp, int sx, int sy, int ex, int ey) + { + if (lp.len > line_max_length) { - m_clip_box.x1 = line_coord_sat::conv(x1); - m_clip_box.y1 = line_coord_sat::conv(y1); - m_clip_box.x2 = line_coord_sat::conv(x2); - m_clip_box.y2 = line_coord_sat::conv(y2); - m_clipping = true; + line_parameters lp1, lp2; + lp.divide(lp1, lp2); + int mx = lp1.x2 + (lp1.y2 - lp1.y1); + int my = lp1.y2 - (lp1.x2 - lp1.x1); + line3_no_clip(lp1, (lp.x1 + sx) >> 1, (lp.y1 + sy) >> 1, mx, my); + line3_no_clip(lp2, mx, my, (lp.x2 + ex) >> 1, (lp.y2 + ey) >> 1); + return; } - //--------------------------------------------------------------------- - void scale_x(double s) { m_scale_x = s; } - double scale_x() const { return m_scale_x; } - - //--------------------------------------------------------------------- - void start_x(double s) { m_start = iround(s * line_subpixel_scale); } - double start_x() const { return double(m_start) / line_subpixel_scale; } - - //--------------------------------------------------------------------- - int subpixel_width() const { return m_pattern->line_width(); } - int pattern_width() const { return m_pattern->pattern_width(); } - double width() const { return double(subpixel_width()) / line_subpixel_scale; } - - //------------------------------------------------------------------------- - void pixel(color_type* p, int x, int y) const + fix_degenerate_bisectrix_start(lp, &sx, &sy); + fix_degenerate_bisectrix_end(lp, &ex, &ey); + line_interpolator_image li(*this, lp, sx, sy, ex, ey, m_start, m_scale_x); + if (li.vertical()) { - m_pattern->pixel(p, x, y); + while (li.step_ver()) + ; } - - //------------------------------------------------------------------------- - void blend_color_hspan(int x, int y, unsigned len, const color_type* colors) + else { - m_ren->blend_color_hspan(x, y, len, colors, 0); + while (li.step_hor()) + ; } + m_start += uround(lp.len / m_scale_x); + } - //------------------------------------------------------------------------- - void blend_color_vspan(int x, int y, unsigned len, const color_type* colors) + //------------------------------------------------------------------------- + void line3(const line_parameters& lp, int sx, int sy, int ex, int ey) + { + if (m_clipping) { - m_ren->blend_color_vspan(x, y, len, colors, 0); - } - - //------------------------------------------------------------------------- - static bool accurate_join_only() { return true; } - - //------------------------------------------------------------------------- - template - void semidot(Cmp, int, int, int, int) - { - } - - //------------------------------------------------------------------------- - void pie(int, int, int, int, int, int) - { - } - - //------------------------------------------------------------------------- - void line0(const line_parameters&) - { - } - - //------------------------------------------------------------------------- - void line1(const line_parameters&, int, int) - { - } - - //------------------------------------------------------------------------- - void line2(const line_parameters&, int, int) - { - } - - //------------------------------------------------------------------------- - void line3_no_clip(const line_parameters& lp, - int sx, int sy, int ex, int ey) - { - if(lp.len > line_max_length) + int x1 = lp.x1; + int y1 = lp.y1; + int x2 = lp.x2; + int y2 = lp.y2; + unsigned flags = clip_line_segment(&x1, &y1, &x2, &y2, m_clip_box); + int start = m_start; + if ((flags & 4) == 0) { - line_parameters lp1, lp2; - lp.divide(lp1, lp2); - int mx = lp1.x2 + (lp1.y2 - lp1.y1); - int my = lp1.y2 - (lp1.x2 - lp1.x1); - line3_no_clip(lp1, (lp.x1 + sx) >> 1, (lp.y1 + sy) >> 1, mx, my); - line3_no_clip(lp2, mx, my, (lp.x2 + ex) >> 1, (lp.y2 + ey) >> 1); - return; - } - - fix_degenerate_bisectrix_start(lp, &sx, &sy); - fix_degenerate_bisectrix_end(lp, &ex, &ey); - line_interpolator_image li(*this, lp, - sx, sy, - ex, ey, - m_start, m_scale_x); - if(li.vertical()) - { - while(li.step_ver()) ; - } - else - { - while(li.step_hor()) ; - } - m_start += uround(lp.len / m_scale_x); - } - - //------------------------------------------------------------------------- - void line3(const line_parameters& lp, - int sx, int sy, int ex, int ey) - { - if(m_clipping) - { - int x1 = lp.x1; - int y1 = lp.y1; - int x2 = lp.x2; - int y2 = lp.y2; - unsigned flags = clip_line_segment(&x1, &y1, &x2, &y2, m_clip_box); - int start = m_start; - if((flags & 4) == 0) + if (flags) { - if(flags) + line_parameters lp2(x1, y1, x2, y2, uround(calc_distance(x1, y1, x2, y2))); + if (flags & 1) { - line_parameters lp2(x1, y1, x2, y2, - uround(calc_distance(x1, y1, x2, y2))); - if(flags & 1) - { - m_start += uround(calc_distance(lp.x1, lp.y1, x1, y1) / m_scale_x); - sx = x1 + (y2 - y1); - sy = y1 - (x2 - x1); - } - else - { - while(std::abs(sx - lp.x1) + std::abs(sy - lp.y1) > 1 + lp2.len) - { - sx = (lp.x1 + sx) >> 1; - sy = (lp.y1 + sy) >> 1; - } - } - if(flags & 2) - { - ex = x2 + (y2 - y1); - ey = y2 - (x2 - x1); - } - else - { - while(std::abs(ex - lp.x2) + std::abs(ey - lp.y2) > 1 + lp2.len) - { - ex = (lp.x2 + ex) >> 1; - ey = (lp.y2 + ey) >> 1; - } - } - line3_no_clip(lp2, sx, sy, ex, ey); + m_start += uround(calc_distance(lp.x1, lp.y1, x1, y1) / m_scale_x); + sx = x1 + (y2 - y1); + sy = y1 - (x2 - x1); } else { - line3_no_clip(lp, sx, sy, ex, ey); + while (std::abs(sx - lp.x1) + std::abs(sy - lp.y1) > 1 + lp2.len) + { + sx = (lp.x1 + sx) >> 1; + sy = (lp.y1 + sy) >> 1; + } } + if (flags & 2) + { + ex = x2 + (y2 - y1); + ey = y2 - (x2 - x1); + } + else + { + while (std::abs(ex - lp.x2) + std::abs(ey - lp.y2) > 1 + lp2.len) + { + ex = (lp.x2 + ex) >> 1; + ey = (lp.y2 + ey) >> 1; + } + } + line3_no_clip(lp2, sx, sy, ex, ey); + } + else + { + line3_no_clip(lp, sx, sy, ex, ey); } - m_start = start + uround(lp.len / m_scale_x); - } - else - { - line3_no_clip(lp, sx, sy, ex, ey); } + m_start = start + uround(lp.len / m_scale_x); } + else + { + line3_no_clip(lp, sx, sy, ex, ey); + } + } - private: - base_ren_type* m_ren; - const pattern_type* m_pattern; - int m_start; - double m_scale_x; - rect_i m_clip_box; - bool m_clipping; - }; - - - - - -} - + private: + base_ren_type* m_ren; + const pattern_type* m_pattern; + int m_start; + double m_scale_x; + rect_i m_clip_box; + bool m_clipping; +}; +} // namespace agg #endif diff --git a/deps/agg/include/agg_renderer_primitives.h b/deps/agg/include/agg_renderer_primitives.h index f008db7c9..35110aa24 100644 --- a/deps/agg/include/agg_renderer_primitives.h +++ b/deps/agg/include/agg_renderer_primitives.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -25,200 +25,190 @@ #include "agg_dda_line.h" #include "agg_ellipse_bresenham.h" -namespace agg +namespace agg { +//-----------------------------------------------------renderer_primitives +template +class renderer_primitives { - //-----------------------------------------------------renderer_primitives - template class renderer_primitives + public: + typedef BaseRenderer base_ren_type; + typedef typename base_ren_type::color_type color_type; + + //-------------------------------------------------------------------- + explicit renderer_primitives(base_ren_type& ren) + : m_ren(&ren) + , m_fill_color() + , m_line_color() + , m_curr_x(0) + , m_curr_y(0) + {} + void attach(base_ren_type& ren) { m_ren = &ren; } + + //-------------------------------------------------------------------- + static int coord(double c) { return iround(c * line_bresenham_interpolator::subpixel_scale); } + + //-------------------------------------------------------------------- + void fill_color(const color_type& c) { m_fill_color = c; } + void line_color(const color_type& c) { m_line_color = c; } + const color_type& fill_color() const { return m_fill_color; } + const color_type& line_color() const { return m_line_color; } + + //-------------------------------------------------------------------- + void rectangle(int x1, int y1, int x2, int y2) { - public: - typedef BaseRenderer base_ren_type; - typedef typename base_ren_type::color_type color_type; + m_ren->blend_hline(x1, y1, x2 - 1, m_line_color, cover_full); + m_ren->blend_vline(x2, y1, y2 - 1, m_line_color, cover_full); + m_ren->blend_hline(x1 + 1, y2, x2, m_line_color, cover_full); + m_ren->blend_vline(x1, y1 + 1, y2, m_line_color, cover_full); + } - //-------------------------------------------------------------------- - explicit renderer_primitives(base_ren_type& ren) : - m_ren(&ren), - m_fill_color(), - m_line_color(), - m_curr_x(0), - m_curr_y(0) - {} - void attach(base_ren_type& ren) { m_ren = &ren; } + //-------------------------------------------------------------------- + void solid_rectangle(int x1, int y1, int x2, int y2) { m_ren->blend_bar(x1, y1, x2, y2, m_fill_color, cover_full); } - //-------------------------------------------------------------------- - static int coord(double c) - { - return iround(c * line_bresenham_interpolator::subpixel_scale); + //-------------------------------------------------------------------- + void outlined_rectangle(int x1, int y1, int x2, int y2) + { + rectangle(x1, y1, x2, y2); + m_ren->blend_bar(x1 + 1, y1 + 1, x2 - 1, y2 - 1, m_fill_color, cover_full); + } + + //-------------------------------------------------------------------- + void ellipse(int x, int y, int rx, int ry) + { + ellipse_bresenham_interpolator ei(rx, ry); + int dx = 0; + int dy = -ry; + do + { + dx += ei.dx(); + dy += ei.dy(); + m_ren->blend_pixel(x + dx, y + dy, m_line_color, cover_full); + m_ren->blend_pixel(x + dx, y - dy, m_line_color, cover_full); + m_ren->blend_pixel(x - dx, y - dy, m_line_color, cover_full); + m_ren->blend_pixel(x - dx, y + dy, m_line_color, cover_full); + ++ei; + } while (dy < 0); + } + + //-------------------------------------------------------------------- + void solid_ellipse(int x, int y, int rx, int ry) + { + ellipse_bresenham_interpolator ei(rx, ry); + int dx = 0; + int dy = -ry; + int dy0 = dy; + int dx0 = dx; + + do + { + dx += ei.dx(); + dy += ei.dy(); + + if (dy != dy0) + { + m_ren->blend_hline(x - dx0, y + dy0, x + dx0, m_fill_color, cover_full); + m_ren->blend_hline(x - dx0, y - dy0, x + dx0, m_fill_color, cover_full); + } + dx0 = dx; + dy0 = dy; + ++ei; + } while (dy < 0); + m_ren->blend_hline(x - dx0, y + dy0, x + dx0, m_fill_color, cover_full); + } + + //-------------------------------------------------------------------- + void outlined_ellipse(int x, int y, int rx, int ry) + { + ellipse_bresenham_interpolator ei(rx, ry); + int dx = 0; + int dy = -ry; + + do + { + dx += ei.dx(); + dy += ei.dy(); + + m_ren->blend_pixel(x + dx, y + dy, m_line_color, cover_full); + m_ren->blend_pixel(x + dx, y - dy, m_line_color, cover_full); + m_ren->blend_pixel(x - dx, y - dy, m_line_color, cover_full); + m_ren->blend_pixel(x - dx, y + dy, m_line_color, cover_full); + + if (ei.dy() && dx) + { + m_ren->blend_hline(x - dx + 1, y + dy, x + dx - 1, m_fill_color, cover_full); + m_ren->blend_hline(x - dx + 1, y - dy, x + dx - 1, m_fill_color, cover_full); + } + ++ei; + } while (dy < 0); + } + + //-------------------------------------------------------------------- + void line(int x1, int y1, int x2, int y2, bool last = false) + { + line_bresenham_interpolator li(x1, y1, x2, y2); + + unsigned len = li.len(); + if (len == 0) + { + if (last) + { + m_ren->blend_pixel(li.line_lr(x1), li.line_lr(y1), m_line_color, cover_full); + } + return; } - //-------------------------------------------------------------------- - void fill_color(const color_type& c) { m_fill_color = c; } - void line_color(const color_type& c) { m_line_color = c; } - const color_type& fill_color() const { return m_fill_color; } - const color_type& line_color() const { return m_line_color; } + if (last) + ++len; - //-------------------------------------------------------------------- - void rectangle(int x1, int y1, int x2, int y2) + if (li.is_ver()) { - m_ren->blend_hline(x1, y1, x2-1, m_line_color, cover_full); - m_ren->blend_vline(x2, y1, y2-1, m_line_color, cover_full); - m_ren->blend_hline(x1+1, y2, x2, m_line_color, cover_full); - m_ren->blend_vline(x1, y1+1, y2, m_line_color, cover_full); - } - - //-------------------------------------------------------------------- - void solid_rectangle(int x1, int y1, int x2, int y2) - { - m_ren->blend_bar(x1, y1, x2, y2, m_fill_color, cover_full); - } - - //-------------------------------------------------------------------- - void outlined_rectangle(int x1, int y1, int x2, int y2) - { - rectangle(x1, y1, x2, y2); - m_ren->blend_bar(x1+1, y1+1, x2-1, y2-1, m_fill_color, cover_full); - } - - //-------------------------------------------------------------------- - void ellipse(int x, int y, int rx, int ry) - { - ellipse_bresenham_interpolator ei(rx, ry); - int dx = 0; - int dy = -ry; do { - dx += ei.dx(); - dy += ei.dy(); - m_ren->blend_pixel(x + dx, y + dy, m_line_color, cover_full); - m_ren->blend_pixel(x + dx, y - dy, m_line_color, cover_full); - m_ren->blend_pixel(x - dx, y - dy, m_line_color, cover_full); - m_ren->blend_pixel(x - dx, y + dy, m_line_color, cover_full); - ++ei; - } - while(dy < 0); + m_ren->blend_pixel(li.x2(), li.y1(), m_line_color, cover_full); + li.vstep(); + } while (--len); } - - //-------------------------------------------------------------------- - void solid_ellipse(int x, int y, int rx, int ry) + else { - ellipse_bresenham_interpolator ei(rx, ry); - int dx = 0; - int dy = -ry; - int dy0 = dy; - int dx0 = dx; - do { - dx += ei.dx(); - dy += ei.dy(); - - if(dy != dy0) - { - m_ren->blend_hline(x-dx0, y+dy0, x+dx0, m_fill_color, cover_full); - m_ren->blend_hline(x-dx0, y-dy0, x+dx0, m_fill_color, cover_full); - } - dx0 = dx; - dy0 = dy; - ++ei; - } - while(dy < 0); - m_ren->blend_hline(x-dx0, y+dy0, x+dx0, m_fill_color, cover_full); + m_ren->blend_pixel(li.x1(), li.y2(), m_line_color, cover_full); + li.hstep(); + } while (--len); } + } - //-------------------------------------------------------------------- - void outlined_ellipse(int x, int y, int rx, int ry) - { - ellipse_bresenham_interpolator ei(rx, ry); - int dx = 0; - int dy = -ry; + //-------------------------------------------------------------------- + void move_to(int x, int y) + { + m_curr_x = x; + m_curr_y = y; + } - do - { - dx += ei.dx(); - dy += ei.dy(); + //-------------------------------------------------------------------- + void line_to(int x, int y, bool last = false) + { + line(m_curr_x, m_curr_y, x, y, last); + m_curr_x = x; + m_curr_y = y; + } - m_ren->blend_pixel(x + dx, y + dy, m_line_color, cover_full); - m_ren->blend_pixel(x + dx, y - dy, m_line_color, cover_full); - m_ren->blend_pixel(x - dx, y - dy, m_line_color, cover_full); - m_ren->blend_pixel(x - dx, y + dy, m_line_color, cover_full); + //-------------------------------------------------------------------- + const base_ren_type& ren() const { return *m_ren; } + base_ren_type& ren() { return *m_ren; } - if(ei.dy() && dx) - { - m_ren->blend_hline(x-dx+1, y+dy, x+dx-1, m_fill_color, cover_full); - m_ren->blend_hline(x-dx+1, y-dy, x+dx-1, m_fill_color, cover_full); - } - ++ei; - } - while(dy < 0); - } + //-------------------------------------------------------------------- + const rendering_buffer& rbuf() const { return m_ren->rbuf(); } + rendering_buffer& rbuf() { return m_ren->rbuf(); } - //-------------------------------------------------------------------- - void line(int x1, int y1, int x2, int y2, bool last=false) - { - line_bresenham_interpolator li(x1, y1, x2, y2); + private: + base_ren_type* m_ren; + color_type m_fill_color; + color_type m_line_color; + int m_curr_x; + int m_curr_y; +}; - unsigned len = li.len(); - if(len == 0) - { - if(last) - { - m_ren->blend_pixel(li.line_lr(x1), li.line_lr(y1), m_line_color, cover_full); - } - return; - } - - if(last) ++len; - - if(li.is_ver()) - { - do - { - m_ren->blend_pixel(li.x2(), li.y1(), m_line_color, cover_full); - li.vstep(); - } - while(--len); - } - else - { - do - { - m_ren->blend_pixel(li.x1(), li.y2(), m_line_color, cover_full); - li.hstep(); - } - while(--len); - } - } - - //-------------------------------------------------------------------- - void move_to(int x, int y) - { - m_curr_x = x; - m_curr_y = y; - } - - //-------------------------------------------------------------------- - void line_to(int x, int y, bool last=false) - { - line(m_curr_x, m_curr_y, x, y, last); - m_curr_x = x; - m_curr_y = y; - } - - //-------------------------------------------------------------------- - const base_ren_type& ren() const { return *m_ren; } - base_ren_type& ren() { return *m_ren; } - - //-------------------------------------------------------------------- - const rendering_buffer& rbuf() const { return m_ren->rbuf(); } - rendering_buffer& rbuf() { return m_ren->rbuf(); } - - private: - base_ren_type* m_ren; - color_type m_fill_color; - color_type m_line_color; - int m_curr_x; - int m_curr_y; - }; - -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_renderer_raster_text.h b/deps/agg/include/agg_renderer_raster_text.h index 87b43f960..f23a3242e 100644 --- a/deps/agg/include/agg_renderer_raster_text.h +++ b/deps/agg/include/agg_renderer_raster_text.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -18,247 +18,215 @@ #include "agg_basics.h" -namespace agg +namespace agg { + +//==============================================renderer_raster_htext_solid +template +class renderer_raster_htext_solid { + public: + typedef BaseRenderer ren_type; + typedef GlyphGenerator glyph_gen_type; + typedef typename glyph_gen_type::glyph_rect glyph_rect; + typedef typename ren_type::color_type color_type; - //==============================================renderer_raster_htext_solid - template - class renderer_raster_htext_solid + renderer_raster_htext_solid(ren_type& ren, glyph_gen_type& glyph) + : m_ren(&ren) + , m_glyph(&glyph) + {} + void attach(ren_type& ren) { m_ren = &ren; } + + //-------------------------------------------------------------------- + void color(const color_type& c) { m_color = c; } + const color_type& color() const { return m_color; } + + //-------------------------------------------------------------------- + template + void render_text(double x, double y, const CharT* str, bool flip = false) { - public: - typedef BaseRenderer ren_type; - typedef GlyphGenerator glyph_gen_type; - typedef typename glyph_gen_type::glyph_rect glyph_rect; - typedef typename ren_type::color_type color_type; - - renderer_raster_htext_solid(ren_type& ren, glyph_gen_type& glyph) : - m_ren(&ren), - m_glyph(&glyph) - {} - void attach(ren_type& ren) { m_ren = &ren; } - - //-------------------------------------------------------------------- - void color(const color_type& c) { m_color = c; } - const color_type& color() const { return m_color; } - - //-------------------------------------------------------------------- - template - void render_text(double x, double y, const CharT* str, bool flip=false) + glyph_rect r; + while (*str) { - glyph_rect r; - while(*str) + m_glyph->prepare(&r, x, y, *str, flip); + if (r.x2 >= r.x1) { - m_glyph->prepare(&r, x, y, *str, flip); - if(r.x2 >= r.x1) + int i; + if (flip) { - int i; - if(flip) + for (i = r.y1; i <= r.y2; i++) { - for(i = r.y1; i <= r.y2; i++) - { - m_ren->blend_solid_hspan(r.x1, i, (r.x2 - r.x1 + 1), - m_color, - m_glyph->span(r.y2 - i)); - } - } - else - { - for(i = r.y1; i <= r.y2; i++) - { - m_ren->blend_solid_hspan(r.x1, i, (r.x2 - r.x1 + 1), - m_color, - m_glyph->span(i - r.y1)); - } + m_ren->blend_solid_hspan(r.x1, i, (r.x2 - r.x1 + 1), m_color, m_glyph->span(r.y2 - i)); } } - x += r.dx; - y += r.dy; - ++str; - } - } - - private: - ren_type* m_ren; - glyph_gen_type* m_glyph; - color_type m_color; - }; - - - - //=============================================renderer_raster_vtext_solid - template - class renderer_raster_vtext_solid - { - public: - typedef BaseRenderer ren_type; - typedef GlyphGenerator glyph_gen_type; - typedef typename glyph_gen_type::glyph_rect glyph_rect; - typedef typename ren_type::color_type color_type; - - renderer_raster_vtext_solid(ren_type& ren, glyph_gen_type& glyph) : - m_ren(&ren), - m_glyph(&glyph) - { - } - - //-------------------------------------------------------------------- - void color(const color_type& c) { m_color = c; } - const color_type& color() const { return m_color; } - - //-------------------------------------------------------------------- - template - void render_text(double x, double y, const CharT* str, bool flip=false) - { - glyph_rect r; - while(*str) - { - m_glyph->prepare(&r, x, y, *str, !flip); - if(r.x2 >= r.x1) + else { - int i; - if(flip) + for (i = r.y1; i <= r.y2; i++) { - for(i = r.y1; i <= r.y2; i++) - { - m_ren->blend_solid_vspan(i, r.x1, (r.x2 - r.x1 + 1), - m_color, - m_glyph->span(i - r.y1)); - } - } - else - { - for(i = r.y1; i <= r.y2; i++) - { - m_ren->blend_solid_vspan(i, r.x1, (r.x2 - r.x1 + 1), - m_color, - m_glyph->span(r.y2 - i)); - } + m_ren->blend_solid_hspan(r.x1, i, (r.x2 - r.x1 + 1), m_color, m_glyph->span(i - r.y1)); } } - x += r.dx; - y += r.dy; - ++str; } + x += r.dx; + y += r.dy; + ++str; } + } - private: - ren_type* m_ren; - glyph_gen_type* m_glyph; - color_type m_color; - }; + private: + ren_type* m_ren; + glyph_gen_type* m_glyph; + color_type m_color; +}; +//=============================================renderer_raster_vtext_solid +template +class renderer_raster_vtext_solid +{ + public: + typedef BaseRenderer ren_type; + typedef GlyphGenerator glyph_gen_type; + typedef typename glyph_gen_type::glyph_rect glyph_rect; + typedef typename ren_type::color_type color_type; + renderer_raster_vtext_solid(ren_type& ren, glyph_gen_type& glyph) + : m_ren(&ren) + , m_glyph(&glyph) + {} + //-------------------------------------------------------------------- + void color(const color_type& c) { m_color = c; } + const color_type& color() const { return m_color; } - - - //===================================================renderer_raster_htext - template - class renderer_raster_htext + //-------------------------------------------------------------------- + template + void render_text(double x, double y, const CharT* str, bool flip = false) { - public: - typedef ScanlineRenderer ren_type; - typedef GlyphGenerator glyph_gen_type; - typedef typename glyph_gen_type::glyph_rect glyph_rect; - - class scanline_single_span + glyph_rect r; + while (*str) { - public: - typedef agg::cover_type cover_type; - - //---------------------------------------------------------------- - struct const_span + m_glyph->prepare(&r, x, y, *str, !flip); + if (r.x2 >= r.x1) { - int x; - unsigned len; - const cover_type* covers; + int i; + if (flip) + { + for (i = r.y1; i <= r.y2; i++) + { + m_ren->blend_solid_vspan(i, r.x1, (r.x2 - r.x1 + 1), m_color, m_glyph->span(i - r.y1)); + } + } + else + { + for (i = r.y1; i <= r.y2; i++) + { + m_ren->blend_solid_vspan(i, r.x1, (r.x2 - r.x1 + 1), m_color, m_glyph->span(r.y2 - i)); + } + } + } + x += r.dx; + y += r.dy; + ++str; + } + } - const_span() {} - const_span(int x_, unsigned len_, const cover_type* covers_) : - x(x_), len(len_), covers(covers_) - {} - }; + private: + ren_type* m_ren; + glyph_gen_type* m_glyph; + color_type m_color; +}; - typedef const const_span* const_iterator; +//===================================================renderer_raster_htext +template +class renderer_raster_htext +{ + public: + typedef ScanlineRenderer ren_type; + typedef GlyphGenerator glyph_gen_type; + typedef typename glyph_gen_type::glyph_rect glyph_rect; - //---------------------------------------------------------------- - scanline_single_span(int x, int y, unsigned len, - const cover_type* covers) : - m_y(y), - m_span(x, len, covers) + class scanline_single_span + { + public: + typedef agg::cover_type cover_type; + + //---------------------------------------------------------------- + struct const_span + { + int x; + unsigned len; + const cover_type* covers; + + const_span() {} + const_span(int x_, unsigned len_, const cover_type* covers_) + : x(x_) + , len(len_) + , covers(covers_) {} - - //---------------------------------------------------------------- - int y() const { return m_y; } - unsigned num_spans() const { return 1; } - const_iterator begin() const { return &m_span; } - - private: - //---------------------------------------------------------------- - int m_y; - const_span m_span; }; + typedef const const_span* const_iterator; + //---------------------------------------------------------------- + scanline_single_span(int x, int y, unsigned len, const cover_type* covers) + : m_y(y) + , m_span(x, len, covers) + {} - //-------------------------------------------------------------------- - renderer_raster_htext(ren_type& ren, glyph_gen_type& glyph) : - m_ren(&ren), - m_glyph(&glyph) - { - } + //---------------------------------------------------------------- + int y() const { return m_y; } + unsigned num_spans() const { return 1; } + const_iterator begin() const { return &m_span; } - - //-------------------------------------------------------------------- - template - void render_text(double x, double y, const CharT* str, bool flip=false) - { - glyph_rect r; - while(*str) - { - m_glyph->prepare(&r, x, y, *str, flip); - if(r.x2 >= r.x1) - { - m_ren->prepare(); - int i; - if(flip) - { - for(i = r.y1; i <= r.y2; i++) - { - m_ren->render( - scanline_single_span(r.x1, - i, - (r.x2 - r.x1 + 1), - m_glyph->span(r.y2 - i))); - } - } - else - { - for(i = r.y1; i <= r.y2; i++) - { - m_ren->render( - scanline_single_span(r.x1, - i, - (r.x2 - r.x1 + 1), - m_glyph->span(i - r.y1))); - } - } - } - x += r.dx; - y += r.dy; - ++str; - } - } - - private: - ren_type* m_ren; - glyph_gen_type* m_glyph; + private: + //---------------------------------------------------------------- + int m_y; + const_span m_span; }; + //-------------------------------------------------------------------- + renderer_raster_htext(ren_type& ren, glyph_gen_type& glyph) + : m_ren(&ren) + , m_glyph(&glyph) + {} + //-------------------------------------------------------------------- + template + void render_text(double x, double y, const CharT* str, bool flip = false) + { + glyph_rect r; + while (*str) + { + m_glyph->prepare(&r, x, y, *str, flip); + if (r.x2 >= r.x1) + { + m_ren->prepare(); + int i; + if (flip) + { + for (i = r.y1; i <= r.y2; i++) + { + m_ren->render(scanline_single_span(r.x1, i, (r.x2 - r.x1 + 1), m_glyph->span(r.y2 - i))); + } + } + else + { + for (i = r.y1; i <= r.y2; i++) + { + m_ren->render(scanline_single_span(r.x1, i, (r.x2 - r.x1 + 1), m_glyph->span(i - r.y1))); + } + } + } + x += r.dx; + y += r.dy; + ++str; + } + } + private: + ren_type* m_ren; + glyph_gen_type* m_glyph; +}; -} +} // namespace agg #endif - diff --git a/deps/agg/include/agg_renderer_scanline.h b/deps/agg/include/agg_renderer_scanline.h index 49012d539..1c4255213 100644 --- a/deps/agg/include/agg_renderer_scanline.h +++ b/deps/agg/include/agg_renderer_scanline.h @@ -19,859 +19,801 @@ #include "agg_basics.h" #include "agg_renderer_base.h" -namespace agg +namespace agg { + +//================================================render_scanline_aa_solid +template +void render_scanline_aa_solid(const Scanline& sl, BaseRenderer& ren, const ColorT& color) { + int y = sl.y(); + unsigned num_spans = sl.num_spans(); + typename Scanline::const_iterator span = sl.begin(); - //================================================render_scanline_aa_solid - template - void render_scanline_aa_solid(const Scanline& sl, - BaseRenderer& ren, - const ColorT& color) + for (;;) { - int y = sl.y(); - unsigned num_spans = sl.num_spans(); - typename Scanline::const_iterator span = sl.begin(); - - for(;;) + int x = span->x; + if (span->len > 0) { - int x = span->x; - if(span->len > 0) + ren.blend_solid_hspan(x, y, (unsigned)span->len, color, span->covers); + } + else + { + ren.blend_hline(x, y, (unsigned)(x - span->len - 1), color, *(span->covers)); + } + if (--num_spans == 0) + break; + ++span; + } +} + +//===============================================render_scanlines_aa_solid +template +void render_scanlines_aa_solid(Rasterizer& ras, Scanline& sl, BaseRenderer& ren, const ColorT& color) +{ + if (ras.rewind_scanlines()) + { + // Explicitly convert "color" to the BaseRenderer color type. + // For example, it can be called with color type "rgba", while + // "rgba8" is needed. Otherwise it will be implicitly + // converted in the loop many times. + //---------------------- + typename BaseRenderer::color_type ren_color(color); + + sl.reset(ras.min_x(), ras.max_x()); + while (ras.sweep_scanline(sl)) + { + render_scanline_aa_solid(sl, ren, ren_color); + } + } +} + +//==============================================renderer_scanline_aa_solid +template +class renderer_scanline_aa_solid +{ + public: + typedef BaseRenderer base_ren_type; + typedef typename base_ren_type::color_type color_type; + + //-------------------------------------------------------------------- + renderer_scanline_aa_solid() + : m_ren(0) + {} + explicit renderer_scanline_aa_solid(base_ren_type& ren) + : m_ren(&ren) + {} + void attach(base_ren_type& ren) { m_ren = &ren; } + + //-------------------------------------------------------------------- + void color(const color_type& c) { m_color = c; } + const color_type& color() const { return m_color; } + + //-------------------------------------------------------------------- + void prepare() {} + + //-------------------------------------------------------------------- + template + void render(const Scanline& sl) + { + render_scanline_aa_solid(sl, *m_ren, m_color); + } + + private: + base_ren_type* m_ren; + color_type m_color; +}; + +//======================================================render_scanline_aa +template +void render_scanline_aa(const Scanline& sl, BaseRenderer& ren, SpanAllocator& alloc, SpanGenerator& span_gen) +{ + int y = sl.y(); + + unsigned num_spans = sl.num_spans(); + typename Scanline::const_iterator span = sl.begin(); + for (;;) + { + int x = span->x; + int len = span->len; + const typename Scanline::cover_type* covers = span->covers; + + if (len < 0) + len = -len; + typename BaseRenderer::color_type* colors = alloc.allocate(len); + span_gen.generate(colors, x, y, len); + ren.blend_color_hspan(x, y, len, colors, (span->len < 0) ? 0 : covers, *covers); + + if (--num_spans == 0) + break; + ++span; + } +} + +//======================================================render_scanline_aa_alpha +template +void render_scanline_aa_alpha(const Scanline& sl, + BaseRenderer& ren, + SpanAllocator& alloc, + SpanGenerator& span_gen, + unsigned alpha) +{ + int y = sl.y(); + + unsigned num_spans = sl.num_spans(); + typename Scanline::const_iterator span = sl.begin(); + for (;;) + { + int x = span->x; + int len = span->len; + const typename Scanline::cover_type* covers = span->covers; + + if (len < 0) + len = -len; + typename BaseRenderer::color_type* colors = alloc.allocate(len); + span_gen.generate(colors, x, y, len); + ren.blend_color_hspan_alpha(x, y, len, colors, alpha, (span->len < 0) ? 0 : covers, *covers); + + if (--num_spans == 0) + break; + ++span; + } +} + +//=====================================================render_scanlines_aa +template +void render_scanlines_aa(Rasterizer& ras, + Scanline& sl, + BaseRenderer& ren, + SpanAllocator& alloc, + SpanGenerator& span_gen) +{ + if (ras.rewind_scanlines()) + { + sl.reset(ras.min_x(), ras.max_x()); + span_gen.prepare(); + while (ras.sweep_scanline(sl)) + { + render_scanline_aa(sl, ren, alloc, span_gen); + } + } +} + +//====================================================renderer_scanline_aa +template +class renderer_scanline_aa +{ + public: + typedef BaseRenderer base_ren_type; + typedef SpanAllocator alloc_type; + typedef SpanGenerator span_gen_type; + + //-------------------------------------------------------------------- + renderer_scanline_aa() + : m_ren(0) + , m_alloc(0) + , m_span_gen(0) + {} + renderer_scanline_aa(base_ren_type& ren, alloc_type& alloc, span_gen_type& span_gen) + : m_ren(&ren) + , m_alloc(&alloc) + , m_span_gen(&span_gen) + {} + void attach(base_ren_type& ren, alloc_type& alloc, span_gen_type& span_gen) + { + m_ren = &ren; + m_alloc = &alloc; + m_span_gen = &span_gen; + } + + //-------------------------------------------------------------------- + void prepare() { m_span_gen->prepare(); } + + //-------------------------------------------------------------------- + template + void render(const Scanline& sl) + { + render_scanline_aa(sl, *m_ren, *m_alloc, *m_span_gen); + } + + private: + base_ren_type* m_ren; + alloc_type* m_alloc; + span_gen_type* m_span_gen; +}; + +//====================================================renderer_scanline_aa +template +class renderer_scanline_aa_alpha +{ + public: + typedef BaseRenderer base_ren_type; + typedef SpanAllocator alloc_type; + typedef SpanGenerator span_gen_type; + + //-------------------------------------------------------------------- + renderer_scanline_aa_alpha() + : m_ren(0) + , m_alloc(0) + , m_span_gen(0) + , m_alpha(1.0) + {} + renderer_scanline_aa_alpha(base_ren_type& ren, alloc_type& alloc, span_gen_type& span_gen, unsigned alpha) + : m_ren(&ren) + , m_alloc(&alloc) + , m_span_gen(&span_gen) + , m_alpha(alpha) + {} + void attach(base_ren_type& ren, alloc_type& alloc, span_gen_type& span_gen) + { + m_ren = &ren; + m_alloc = &alloc; + m_span_gen = &span_gen; + } + + //-------------------------------------------------------------------- + void prepare() { m_span_gen->prepare(); } + + //-------------------------------------------------------------------- + template + void render(const Scanline& sl) + { + render_scanline_aa_alpha(sl, *m_ren, *m_alloc, *m_span_gen, m_alpha); + } + + private: + base_ren_type* m_ren; + alloc_type* m_alloc; + span_gen_type* m_span_gen; + unsigned m_alpha; +}; + +//===============================================render_scanline_bin_solid +template +void render_scanline_bin_solid(const Scanline& sl, BaseRenderer& ren, const ColorT& color) +{ + unsigned num_spans = sl.num_spans(); + typename Scanline::const_iterator span = sl.begin(); + for (;;) + { + ren.blend_hline(span->x, sl.y(), span->x - 1 + ((span->len < 0) ? -span->len : span->len), color, cover_full); + if (--num_spans == 0) + break; + ++span; + } +} + +//==============================================render_scanlines_bin_solid +template +void render_scanlines_bin_solid(Rasterizer& ras, Scanline& sl, BaseRenderer& ren, const ColorT& color) +{ + if (ras.rewind_scanlines()) + { + // Explicitly convert "color" to the BaseRenderer color type. + // For example, it can be called with color type "rgba", while + // "rgba8" is needed. Otherwise it will be implicitly + // converted in the loop many times. + //---------------------- + typename BaseRenderer::color_type ren_color(color); + + sl.reset(ras.min_x(), ras.max_x()); + while (ras.sweep_scanline(sl)) + { + // render_scanline_bin_solid(sl, ren, ren_color); + + // This code is equivalent to the above call (copy/paste). + // It's just a "manual" optimization for old compilers, + // like Microsoft Visual C++ v6.0 + //------------------------------- + unsigned num_spans = sl.num_spans(); + typename Scanline::const_iterator span = sl.begin(); + for (;;) { - ren.blend_solid_hspan(x, y, (unsigned)span->len, - color, - span->covers); + ren.blend_hline(span->x, + sl.y(), + span->x - 1 + ((span->len < 0) ? -span->len : span->len), + ren_color, + cover_full); + if (--num_spans == 0) + break; + ++span; + } + } + } +} + +//=============================================renderer_scanline_bin_solid +template +class renderer_scanline_bin_solid +{ + public: + typedef BaseRenderer base_ren_type; + typedef typename base_ren_type::color_type color_type; + + //-------------------------------------------------------------------- + renderer_scanline_bin_solid() + : m_ren(0) + {} + explicit renderer_scanline_bin_solid(base_ren_type& ren) + : m_ren(&ren) + {} + void attach(base_ren_type& ren) { m_ren = &ren; } + + //-------------------------------------------------------------------- + void color(const color_type& c) { m_color = c; } + const color_type& color() const { return m_color; } + + //-------------------------------------------------------------------- + void prepare() {} + + //-------------------------------------------------------------------- + template + void render(const Scanline& sl) + { + render_scanline_bin_solid(sl, *m_ren, m_color); + } + + private: + base_ren_type* m_ren; + color_type m_color; +}; + +//======================================================render_scanline_bin +template +void render_scanline_bin(const Scanline& sl, BaseRenderer& ren, SpanAllocator& alloc, SpanGenerator& span_gen) +{ + int y = sl.y(); + + unsigned num_spans = sl.num_spans(); + typename Scanline::const_iterator span = sl.begin(); + for (;;) + { + int x = span->x; + int len = span->len; + if (len < 0) + len = -len; + typename BaseRenderer::color_type* colors = alloc.allocate(len); + span_gen.generate(colors, x, y, len); + ren.blend_color_hspan(x, y, len, colors, 0, cover_full); + if (--num_spans == 0) + break; + ++span; + } +} + +//=====================================================render_scanlines_bin +template +void render_scanlines_bin(Rasterizer& ras, + Scanline& sl, + BaseRenderer& ren, + SpanAllocator& alloc, + SpanGenerator& span_gen) +{ + if (ras.rewind_scanlines()) + { + sl.reset(ras.min_x(), ras.max_x()); + span_gen.prepare(); + while (ras.sweep_scanline(sl)) + { + render_scanline_bin(sl, ren, alloc, span_gen); + } + } +} + +//====================================================renderer_scanline_bin +template +class renderer_scanline_bin +{ + public: + typedef BaseRenderer base_ren_type; + typedef SpanAllocator alloc_type; + typedef SpanGenerator span_gen_type; + + //-------------------------------------------------------------------- + renderer_scanline_bin() + : m_ren(0) + , m_alloc(0) + , m_span_gen(0) + {} + renderer_scanline_bin(base_ren_type& ren, alloc_type& alloc, span_gen_type& span_gen) + : m_ren(&ren) + , m_alloc(&alloc) + , m_span_gen(&span_gen) + {} + void attach(base_ren_type& ren, alloc_type& alloc, span_gen_type& span_gen) + { + m_ren = &ren; + m_alloc = &alloc; + m_span_gen = &span_gen; + } + + //-------------------------------------------------------------------- + void prepare() { m_span_gen->prepare(); } + + //-------------------------------------------------------------------- + template + void render(const Scanline& sl) + { + render_scanline_bin(sl, *m_ren, *m_alloc, *m_span_gen); + } + + private: + base_ren_type* m_ren; + alloc_type* m_alloc; + span_gen_type* m_span_gen; +}; + +//========================================================render_scanlines +template +void render_scanlines(Rasterizer& ras, Scanline& sl, Renderer& ren) +{ + if (ras.rewind_scanlines()) + { + sl.reset(ras.min_x(), ras.max_x()); + ren.prepare(); + while (ras.sweep_scanline(sl)) + { + ren.render(sl); + } + } +} + +//========================================================render_all_paths +template +void render_all_paths(Rasterizer& ras, + Scanline& sl, + Renderer& r, + VertexSource& vs, + const ColorStorage& as, + const PathId& path_id, + unsigned num_paths) +{ + for (unsigned i = 0; i < num_paths; i++) + { + ras.reset(); + ras.add_path(vs, path_id[i]); + r.color(as[i]); + render_scanlines(ras, sl, r); + } +} + +//=============================================render_scanlines_compound +template +void render_scanlines_compound(Rasterizer& ras, + ScanlineAA& sl_aa, + ScanlineBin& sl_bin, + BaseRenderer& ren, + SpanAllocator& alloc, + StyleHandler& sh) +{ + if (ras.rewind_scanlines()) + { + int min_x = ras.min_x(); + int len = ras.max_x() - min_x + 2; + sl_aa.reset(min_x, ras.max_x()); + sl_bin.reset(min_x, ras.max_x()); + + typedef typename BaseRenderer::color_type color_type; + color_type* color_span = alloc.allocate(len * 2); + color_type* mix_buffer = color_span + len; + unsigned num_spans; + + unsigned num_styles; + unsigned style; + bool solid; + while ((num_styles = ras.sweep_styles()) > 0) + { + typename ScanlineAA::const_iterator span_aa; + if (num_styles == 1) + { + // Optimization for a single style. Happens often + //------------------------- + if (ras.sweep_scanline(sl_aa, 0)) + { + style = ras.style(0); + if (sh.is_solid(style)) + { + // Just solid fill + //----------------------- + render_scanline_aa_solid(sl_aa, ren, sh.color(style)); + } + else + { + // Arbitrary span generator + //----------------------- + span_aa = sl_aa.begin(); + num_spans = sl_aa.num_spans(); + for (;;) + { + len = span_aa->len; + sh.generate_span(color_span, span_aa->x, sl_aa.y(), len, style); + + ren.blend_color_hspan(span_aa->x, sl_aa.y(), span_aa->len, color_span, span_aa->covers); + if (--num_spans == 0) + break; + ++span_aa; + } + } + } } else { - ren.blend_hline(x, y, (unsigned)(x - span->len - 1), - color, - *(span->covers)); - } - if(--num_spans == 0) break; - ++span; - } - } - - //===============================================render_scanlines_aa_solid - template - void render_scanlines_aa_solid(Rasterizer& ras, Scanline& sl, - BaseRenderer& ren, const ColorT& color) - { - if(ras.rewind_scanlines()) - { - // Explicitly convert "color" to the BaseRenderer color type. - // For example, it can be called with color type "rgba", while - // "rgba8" is needed. Otherwise it will be implicitly - // converted in the loop many times. - //---------------------- - typename BaseRenderer::color_type ren_color(color); - - sl.reset(ras.min_x(), ras.max_x()); - while(ras.sweep_scanline(sl)) - { - render_scanline_aa_solid(sl, ren, ren_color); - } - } - } - - //==============================================renderer_scanline_aa_solid - template class renderer_scanline_aa_solid - { - public: - typedef BaseRenderer base_ren_type; - typedef typename base_ren_type::color_type color_type; - - //-------------------------------------------------------------------- - renderer_scanline_aa_solid() : m_ren(0) {} - explicit renderer_scanline_aa_solid(base_ren_type& ren) : m_ren(&ren) {} - void attach(base_ren_type& ren) - { - m_ren = &ren; - } - - //-------------------------------------------------------------------- - void color(const color_type& c) { m_color = c; } - const color_type& color() const { return m_color; } - - //-------------------------------------------------------------------- - void prepare() {} - - //-------------------------------------------------------------------- - template void render(const Scanline& sl) - { - render_scanline_aa_solid(sl, *m_ren, m_color); - } - - private: - base_ren_type* m_ren; - color_type m_color; - }; - - - //======================================================render_scanline_aa - template - void render_scanline_aa(const Scanline& sl, BaseRenderer& ren, - SpanAllocator& alloc, SpanGenerator& span_gen) - { - int y = sl.y(); - - unsigned num_spans = sl.num_spans(); - typename Scanline::const_iterator span = sl.begin(); - for(;;) - { - int x = span->x; - int len = span->len; - const typename Scanline::cover_type* covers = span->covers; - - if(len < 0) len = -len; - typename BaseRenderer::color_type* colors = alloc.allocate(len); - span_gen.generate(colors, x, y, len); - ren.blend_color_hspan(x, y, len, colors, - (span->len < 0) ? 0 : covers, *covers); - - if(--num_spans == 0) break; - ++span; - } - } - - //======================================================render_scanline_aa_alpha - template - void render_scanline_aa_alpha(const Scanline& sl, BaseRenderer& ren, - SpanAllocator& alloc, SpanGenerator& span_gen, unsigned alpha) - { - int y = sl.y(); - - unsigned num_spans = sl.num_spans(); - typename Scanline::const_iterator span = sl.begin(); - for(;;) - { - int x = span->x; - int len = span->len; - const typename Scanline::cover_type* covers = span->covers; - - if(len < 0) len = -len; - typename BaseRenderer::color_type* colors = alloc.allocate(len); - span_gen.generate(colors, x, y, len); - ren.blend_color_hspan_alpha(x, y, len, colors, alpha, - (span->len < 0) ? 0 : covers, *covers); - - if(--num_spans == 0) break; - ++span; - } - } - - - //=====================================================render_scanlines_aa - template - void render_scanlines_aa(Rasterizer& ras, Scanline& sl, BaseRenderer& ren, - SpanAllocator& alloc, SpanGenerator& span_gen) - { - if(ras.rewind_scanlines()) - { - sl.reset(ras.min_x(), ras.max_x()); - span_gen.prepare(); - while(ras.sweep_scanline(sl)) - { - render_scanline_aa(sl, ren, alloc, span_gen); - } - } - } - - //====================================================renderer_scanline_aa - template - class renderer_scanline_aa - { - public: - typedef BaseRenderer base_ren_type; - typedef SpanAllocator alloc_type; - typedef SpanGenerator span_gen_type; - - //-------------------------------------------------------------------- - renderer_scanline_aa() : m_ren(0), m_alloc(0), m_span_gen(0) {} - renderer_scanline_aa(base_ren_type& ren, - alloc_type& alloc, - span_gen_type& span_gen) : - m_ren(&ren), - m_alloc(&alloc), - m_span_gen(&span_gen) - {} - void attach(base_ren_type& ren, - alloc_type& alloc, - span_gen_type& span_gen) - { - m_ren = &ren; - m_alloc = &alloc; - m_span_gen = &span_gen; - } - - //-------------------------------------------------------------------- - void prepare() { m_span_gen->prepare(); } - - //-------------------------------------------------------------------- - template void render(const Scanline& sl) - { - render_scanline_aa(sl, *m_ren, *m_alloc, *m_span_gen); - } - - private: - base_ren_type* m_ren; - alloc_type* m_alloc; - span_gen_type* m_span_gen; - }; - - -//====================================================renderer_scanline_aa - template - class renderer_scanline_aa_alpha - { - public: - typedef BaseRenderer base_ren_type; - typedef SpanAllocator alloc_type; - typedef SpanGenerator span_gen_type; - - //-------------------------------------------------------------------- - renderer_scanline_aa_alpha() : m_ren(0), m_alloc(0), m_span_gen(0), m_alpha(1.0) {} - renderer_scanline_aa_alpha(base_ren_type& ren, - alloc_type& alloc, - span_gen_type& span_gen, - unsigned alpha) : - m_ren(&ren), - m_alloc(&alloc), - m_span_gen(&span_gen), - m_alpha(alpha) - {} - void attach(base_ren_type& ren, - alloc_type& alloc, - span_gen_type& span_gen) - { - m_ren = &ren; - m_alloc = &alloc; - m_span_gen = &span_gen; - } - - //-------------------------------------------------------------------- - void prepare() { m_span_gen->prepare(); } - - //-------------------------------------------------------------------- - template void render(const Scanline& sl) - { - render_scanline_aa_alpha(sl, *m_ren, *m_alloc, *m_span_gen, m_alpha); - } - - private: - base_ren_type* m_ren; - alloc_type* m_alloc; - span_gen_type* m_span_gen; - unsigned m_alpha; - }; - - - //===============================================render_scanline_bin_solid - template - void render_scanline_bin_solid(const Scanline& sl, - BaseRenderer& ren, - const ColorT& color) - { - unsigned num_spans = sl.num_spans(); - typename Scanline::const_iterator span = sl.begin(); - for(;;) - { - ren.blend_hline(span->x, - sl.y(), - span->x - 1 + ((span->len < 0) ? - -span->len : - span->len), - color, - cover_full); - if(--num_spans == 0) break; - ++span; - } - } - - //==============================================render_scanlines_bin_solid - template - void render_scanlines_bin_solid(Rasterizer& ras, Scanline& sl, - BaseRenderer& ren, const ColorT& color) - { - if(ras.rewind_scanlines()) - { - // Explicitly convert "color" to the BaseRenderer color type. - // For example, it can be called with color type "rgba", while - // "rgba8" is needed. Otherwise it will be implicitly - // converted in the loop many times. - //---------------------- - typename BaseRenderer::color_type ren_color(color); - - sl.reset(ras.min_x(), ras.max_x()); - while(ras.sweep_scanline(sl)) - { - //render_scanline_bin_solid(sl, ren, ren_color); - - // This code is equivalent to the above call (copy/paste). - // It's just a "manual" optimization for old compilers, - // like Microsoft Visual C++ v6.0 - //------------------------------- - unsigned num_spans = sl.num_spans(); - typename Scanline::const_iterator span = sl.begin(); - for(;;) + if (ras.sweep_scanline(sl_bin, -1)) { - ren.blend_hline(span->x, - sl.y(), - span->x - 1 + ((span->len < 0) ? - -span->len : - span->len), - ren_color, - cover_full); - if(--num_spans == 0) break; - ++span; - } - } - } - } - - //=============================================renderer_scanline_bin_solid - template class renderer_scanline_bin_solid - { - public: - typedef BaseRenderer base_ren_type; - typedef typename base_ren_type::color_type color_type; - - //-------------------------------------------------------------------- - renderer_scanline_bin_solid() : m_ren(0) {} - explicit renderer_scanline_bin_solid(base_ren_type& ren) : m_ren(&ren) {} - void attach(base_ren_type& ren) - { - m_ren = &ren; - } - - //-------------------------------------------------------------------- - void color(const color_type& c) { m_color = c; } - const color_type& color() const { return m_color; } - - //-------------------------------------------------------------------- - void prepare() {} - - //-------------------------------------------------------------------- - template void render(const Scanline& sl) - { - render_scanline_bin_solid(sl, *m_ren, m_color); - } - - private: - base_ren_type* m_ren; - color_type m_color; - }; - - - - - - - - - //======================================================render_scanline_bin - template - void render_scanline_bin(const Scanline& sl, BaseRenderer& ren, - SpanAllocator& alloc, SpanGenerator& span_gen) - { - int y = sl.y(); - - unsigned num_spans = sl.num_spans(); - typename Scanline::const_iterator span = sl.begin(); - for(;;) - { - int x = span->x; - int len = span->len; - if(len < 0) len = -len; - typename BaseRenderer::color_type* colors = alloc.allocate(len); - span_gen.generate(colors, x, y, len); - ren.blend_color_hspan(x, y, len, colors, 0, cover_full); - if(--num_spans == 0) break; - ++span; - } - } - - //=====================================================render_scanlines_bin - template - void render_scanlines_bin(Rasterizer& ras, Scanline& sl, BaseRenderer& ren, - SpanAllocator& alloc, SpanGenerator& span_gen) - { - if(ras.rewind_scanlines()) - { - sl.reset(ras.min_x(), ras.max_x()); - span_gen.prepare(); - while(ras.sweep_scanline(sl)) - { - render_scanline_bin(sl, ren, alloc, span_gen); - } - } - } - - //====================================================renderer_scanline_bin - template - class renderer_scanline_bin - { - public: - typedef BaseRenderer base_ren_type; - typedef SpanAllocator alloc_type; - typedef SpanGenerator span_gen_type; - - //-------------------------------------------------------------------- - renderer_scanline_bin() : m_ren(0), m_alloc(0), m_span_gen(0) {} - renderer_scanline_bin(base_ren_type& ren, - alloc_type& alloc, - span_gen_type& span_gen) : - m_ren(&ren), - m_alloc(&alloc), - m_span_gen(&span_gen) - {} - void attach(base_ren_type& ren, - alloc_type& alloc, - span_gen_type& span_gen) - { - m_ren = &ren; - m_alloc = &alloc; - m_span_gen = &span_gen; - } - - //-------------------------------------------------------------------- - void prepare() { m_span_gen->prepare(); } - - //-------------------------------------------------------------------- - template void render(const Scanline& sl) - { - render_scanline_bin(sl, *m_ren, *m_alloc, *m_span_gen); - } - - private: - base_ren_type* m_ren; - alloc_type* m_alloc; - span_gen_type* m_span_gen; - }; - - - //========================================================render_scanlines - template - void render_scanlines(Rasterizer& ras, Scanline& sl, Renderer& ren) - { - if(ras.rewind_scanlines()) - { - sl.reset(ras.min_x(), ras.max_x()); - ren.prepare(); - while(ras.sweep_scanline(sl)) - { - ren.render(sl); - } - } - } - - - //========================================================render_all_paths - template - void render_all_paths(Rasterizer& ras, - Scanline& sl, - Renderer& r, - VertexSource& vs, - const ColorStorage& as, - const PathId& path_id, - unsigned num_paths) - { - for(unsigned i = 0; i < num_paths; i++) - { - ras.reset(); - ras.add_path(vs, path_id[i]); - r.color(as[i]); - render_scanlines(ras, sl, r); - } - } - - - - - - - //=============================================render_scanlines_compound - template - void render_scanlines_compound(Rasterizer& ras, - ScanlineAA& sl_aa, - ScanlineBin& sl_bin, - BaseRenderer& ren, - SpanAllocator& alloc, - StyleHandler& sh) - { - if(ras.rewind_scanlines()) - { - int min_x = ras.min_x(); - int len = ras.max_x() - min_x + 2; - sl_aa.reset(min_x, ras.max_x()); - sl_bin.reset(min_x, ras.max_x()); - - typedef typename BaseRenderer::color_type color_type; - color_type* color_span = alloc.allocate(len * 2); - color_type* mix_buffer = color_span + len; - unsigned num_spans; - - unsigned num_styles; - unsigned style; - bool solid; - while((num_styles = ras.sweep_styles()) > 0) - { - typename ScanlineAA::const_iterator span_aa; - if(num_styles == 1) - { - // Optimization for a single style. Happens often - //------------------------- - if(ras.sweep_scanline(sl_aa, 0)) + // Clear the spans of the mix_buffer + //-------------------- + typename ScanlineBin::const_iterator span_bin = sl_bin.begin(); + num_spans = sl_bin.num_spans(); + for (;;) { - style = ras.style(0); - if(sh.is_solid(style)) - { - // Just solid fill - //----------------------- - render_scanline_aa_solid(sl_aa, ren, sh.color(style)); - } - else - { - // Arbitrary span generator - //----------------------- - span_aa = sl_aa.begin(); - num_spans = sl_aa.num_spans(); - for(;;) - { - len = span_aa->len; - sh.generate_span(color_span, - span_aa->x, - sl_aa.y(), - len, - style); + memset(mix_buffer + span_bin->x - min_x, 0, span_bin->len * sizeof(color_type)); - ren.blend_color_hspan(span_aa->x, - sl_aa.y(), - span_aa->len, - color_span, - span_aa->covers); - if(--num_spans == 0) break; - ++span_aa; + if (--num_spans == 0) + break; + ++span_bin; + } + + unsigned i; + for (i = 0; i < num_styles; i++) + { + style = ras.style(i); + solid = sh.is_solid(style); + + if (ras.sweep_scanline(sl_aa, i)) + { + color_type* colors; + color_type* cspan; + typename ScanlineAA::cover_type* covers; + span_aa = sl_aa.begin(); + num_spans = sl_aa.num_spans(); + if (solid) + { + // Just solid fill + //----------------------- + for (;;) + { + color_type c = sh.color(style); + len = span_aa->len; + colors = mix_buffer + span_aa->x - min_x; + covers = span_aa->covers; + do + { + if (*covers == cover_full) + { + *colors = c; + } + else + { + colors->add(c, *covers); + } + ++colors; + ++covers; + } while (--len); + if (--num_spans == 0) + break; + ++span_aa; + } + } + else + { + // Arbitrary span generator + //----------------------- + for (;;) + { + len = span_aa->len; + colors = mix_buffer + span_aa->x - min_x; + cspan = color_span; + sh.generate_span(cspan, span_aa->x, sl_aa.y(), len, style); + covers = span_aa->covers; + do + { + if (*covers == cover_full) + { + *colors = *cspan; + } + else + { + colors->add(*cspan, *covers); + } + ++cspan; + ++colors; + ++covers; + } while (--len); + if (--num_spans == 0) + break; + ++span_aa; + } } } } - } - else - { - if(ras.sweep_scanline(sl_bin, -1)) - { - // Clear the spans of the mix_buffer - //-------------------- - typename ScanlineBin::const_iterator span_bin = sl_bin.begin(); - num_spans = sl_bin.num_spans(); - for(;;) - { - memset(mix_buffer + span_bin->x - min_x, - 0, - span_bin->len * sizeof(color_type)); - if(--num_spans == 0) break; - ++span_bin; - } - - unsigned i; - for(i = 0; i < num_styles; i++) - { - style = ras.style(i); - solid = sh.is_solid(style); - - if(ras.sweep_scanline(sl_aa, i)) - { - color_type* colors; - color_type* cspan; - typename ScanlineAA::cover_type* covers; - span_aa = sl_aa.begin(); - num_spans = sl_aa.num_spans(); - if(solid) - { - // Just solid fill - //----------------------- - for(;;) - { - color_type c = sh.color(style); - len = span_aa->len; - colors = mix_buffer + span_aa->x - min_x; - covers = span_aa->covers; - do - { - if(*covers == cover_full) - { - *colors = c; - } - else - { - colors->add(c, *covers); - } - ++colors; - ++covers; - } - while(--len); - if(--num_spans == 0) break; - ++span_aa; - } - } - else - { - // Arbitrary span generator - //----------------------- - for(;;) - { - len = span_aa->len; - colors = mix_buffer + span_aa->x - min_x; - cspan = color_span; - sh.generate_span(cspan, - span_aa->x, - sl_aa.y(), - len, - style); - covers = span_aa->covers; - do - { - if(*covers == cover_full) - { - *colors = *cspan; - } - else - { - colors->add(*cspan, *covers); - } - ++cspan; - ++colors; - ++covers; - } - while(--len); - if(--num_spans == 0) break; - ++span_aa; - } - } - } - } - - // Emit the blended result as a color hspan - //------------------------- - span_bin = sl_bin.begin(); - num_spans = sl_bin.num_spans(); - for(;;) - { - ren.blend_color_hspan(span_bin->x, - sl_bin.y(), - span_bin->len, - mix_buffer + span_bin->x - min_x, - 0, - cover_full); - if(--num_spans == 0) break; - ++span_bin; - } - } // if(ras.sweep_scanline(sl_bin, -1)) - } // if(num_styles == 1) ... else - } // while((num_styles = ras.sweep_styles()) > 0) - } // if(ras.rewind_scanlines()) - } - - //=======================================render_scanlines_compound_layered - template - void render_scanlines_compound_layered(Rasterizer& ras, - ScanlineAA& sl_aa, - BaseRenderer& ren, - SpanAllocator& alloc, - StyleHandler& sh) - { - if(ras.rewind_scanlines()) - { - int min_x = ras.min_x(); - int len = ras.max_x() - min_x + 2; - sl_aa.reset(min_x, ras.max_x()); - - typedef typename BaseRenderer::color_type color_type; - color_type* color_span = alloc.allocate(len * 2); - color_type* mix_buffer = color_span + len; - cover_type* cover_buffer = ras.allocate_cover_buffer(len); - unsigned num_spans; - - unsigned num_styles; - unsigned style; - bool solid; - while((num_styles = ras.sweep_styles()) > 0) - { - typename ScanlineAA::const_iterator span_aa; - if(num_styles == 1) - { - // Optimization for a single style. Happens often + // Emit the blended result as a color hspan //------------------------- - if(ras.sweep_scanline(sl_aa, 0)) + span_bin = sl_bin.begin(); + num_spans = sl_bin.num_spans(); + for (;;) { - style = ras.style(0); - if(sh.is_solid(style)) - { - // Just solid fill - //----------------------- - render_scanline_aa_solid(sl_aa, ren, sh.color(style)); - } - else - { - // Arbitrary span generator - //----------------------- - span_aa = sl_aa.begin(); - num_spans = sl_aa.num_spans(); - for(;;) - { - len = span_aa->len; - sh.generate_span(color_span, - span_aa->x, - sl_aa.y(), - len, - style); - - ren.blend_color_hspan(span_aa->x, - sl_aa.y(), - span_aa->len, - color_span, - span_aa->covers); - if(--num_spans == 0) break; - ++span_aa; - } - } - } - } - else - { - int sl_start = ras.scanline_start(); - unsigned sl_len = ras.scanline_length(); - - if(sl_len) - { - memset(mix_buffer + sl_start - min_x, - 0, - sl_len * sizeof(color_type)); - - memset(cover_buffer + sl_start - min_x, - 0, - sl_len * sizeof(cover_type)); - - int sl_y = 0x7FFFFFFF; - unsigned i; - for(i = 0; i < num_styles; i++) - { - style = ras.style(i); - solid = sh.is_solid(style); - - if(ras.sweep_scanline(sl_aa, i)) - { - unsigned cover; - color_type* colors; - color_type* cspan; - cover_type* src_covers; - cover_type* dst_covers; - span_aa = sl_aa.begin(); - num_spans = sl_aa.num_spans(); - sl_y = sl_aa.y(); - if(solid) - { - // Just solid fill - //----------------------- - for(;;) - { - color_type c = sh.color(style); - len = span_aa->len; - colors = mix_buffer + span_aa->x - min_x; - src_covers = span_aa->covers; - dst_covers = cover_buffer + span_aa->x - min_x; - do - { - cover = *src_covers; - if(*dst_covers + cover > cover_full) - { - cover = cover_full - *dst_covers; - } - if(cover) - { - colors->add(c, cover); - *dst_covers += cover; - } - ++colors; - ++src_covers; - ++dst_covers; - } - while(--len); - if(--num_spans == 0) break; - ++span_aa; - } - } - else - { - // Arbitrary span generator - //----------------------- - for(;;) - { - len = span_aa->len; - colors = mix_buffer + span_aa->x - min_x; - cspan = color_span; - sh.generate_span(cspan, - span_aa->x, - sl_aa.y(), - len, - style); - src_covers = span_aa->covers; - dst_covers = cover_buffer + span_aa->x - min_x; - do - { - cover = *src_covers; - if(*dst_covers + cover > cover_full) - { - cover = cover_full - *dst_covers; - } - if(cover) - { - colors->add(*cspan, cover); - *dst_covers += cover; - } - ++cspan; - ++colors; - ++src_covers; - ++dst_covers; - } - while(--len); - if(--num_spans == 0) break; - ++span_aa; - } - } - } - } - ren.blend_color_hspan(sl_start, - sl_y, - sl_len, - mix_buffer + sl_start - min_x, + ren.blend_color_hspan(span_bin->x, + sl_bin.y(), + span_bin->len, + mix_buffer + span_bin->x - min_x, 0, cover_full); - } //if(sl_len) - } //if(num_styles == 1) ... else - } //while((num_styles = ras.sweep_styles()) > 0) - } //if(ras.rewind_scanlines()) - } - - + if (--num_spans == 0) + break; + ++span_bin; + } + } // if(ras.sweep_scanline(sl_bin, -1)) + } // if(num_styles == 1) ... else + } // while((num_styles = ras.sweep_styles()) > 0) + } // if(ras.rewind_scanlines()) } +//=======================================render_scanlines_compound_layered +template +void render_scanlines_compound_layered(Rasterizer& ras, + ScanlineAA& sl_aa, + BaseRenderer& ren, + SpanAllocator& alloc, + StyleHandler& sh) +{ + if (ras.rewind_scanlines()) + { + int min_x = ras.min_x(); + int len = ras.max_x() - min_x + 2; + sl_aa.reset(min_x, ras.max_x()); + + typedef typename BaseRenderer::color_type color_type; + color_type* color_span = alloc.allocate(len * 2); + color_type* mix_buffer = color_span + len; + cover_type* cover_buffer = ras.allocate_cover_buffer(len); + unsigned num_spans; + + unsigned num_styles; + unsigned style; + bool solid; + while ((num_styles = ras.sweep_styles()) > 0) + { + typename ScanlineAA::const_iterator span_aa; + if (num_styles == 1) + { + // Optimization for a single style. Happens often + //------------------------- + if (ras.sweep_scanline(sl_aa, 0)) + { + style = ras.style(0); + if (sh.is_solid(style)) + { + // Just solid fill + //----------------------- + render_scanline_aa_solid(sl_aa, ren, sh.color(style)); + } + else + { + // Arbitrary span generator + //----------------------- + span_aa = sl_aa.begin(); + num_spans = sl_aa.num_spans(); + for (;;) + { + len = span_aa->len; + sh.generate_span(color_span, span_aa->x, sl_aa.y(), len, style); + + ren.blend_color_hspan(span_aa->x, sl_aa.y(), span_aa->len, color_span, span_aa->covers); + if (--num_spans == 0) + break; + ++span_aa; + } + } + } + } + else + { + int sl_start = ras.scanline_start(); + unsigned sl_len = ras.scanline_length(); + + if (sl_len) + { + memset(mix_buffer + sl_start - min_x, 0, sl_len * sizeof(color_type)); + + memset(cover_buffer + sl_start - min_x, 0, sl_len * sizeof(cover_type)); + + int sl_y = 0x7FFFFFFF; + unsigned i; + for (i = 0; i < num_styles; i++) + { + style = ras.style(i); + solid = sh.is_solid(style); + + if (ras.sweep_scanline(sl_aa, i)) + { + unsigned cover; + color_type* colors; + color_type* cspan; + cover_type* src_covers; + cover_type* dst_covers; + span_aa = sl_aa.begin(); + num_spans = sl_aa.num_spans(); + sl_y = sl_aa.y(); + if (solid) + { + // Just solid fill + //----------------------- + for (;;) + { + color_type c = sh.color(style); + len = span_aa->len; + colors = mix_buffer + span_aa->x - min_x; + src_covers = span_aa->covers; + dst_covers = cover_buffer + span_aa->x - min_x; + do + { + cover = *src_covers; + if (*dst_covers + cover > cover_full) + { + cover = cover_full - *dst_covers; + } + if (cover) + { + colors->add(c, cover); + *dst_covers += cover; + } + ++colors; + ++src_covers; + ++dst_covers; + } while (--len); + if (--num_spans == 0) + break; + ++span_aa; + } + } + else + { + // Arbitrary span generator + //----------------------- + for (;;) + { + len = span_aa->len; + colors = mix_buffer + span_aa->x - min_x; + cspan = color_span; + sh.generate_span(cspan, span_aa->x, sl_aa.y(), len, style); + src_covers = span_aa->covers; + dst_covers = cover_buffer + span_aa->x - min_x; + do + { + cover = *src_covers; + if (*dst_covers + cover > cover_full) + { + cover = cover_full - *dst_covers; + } + if (cover) + { + colors->add(*cspan, cover); + *dst_covers += cover; + } + ++cspan; + ++colors; + ++src_covers; + ++dst_covers; + } while (--len); + if (--num_spans == 0) + break; + ++span_aa; + } + } + } + } + ren.blend_color_hspan(sl_start, sl_y, sl_len, mix_buffer + sl_start - min_x, 0, cover_full); + } // if(sl_len) + } // if(num_styles == 1) ... else + } // while((num_styles = ras.sweep_styles()) > 0) + } // if(ras.rewind_scanlines()) +} + +} // namespace agg + #endif diff --git a/deps/agg/include/agg_rendering_buffer.h b/deps/agg/include/agg_rendering_buffer.h index 2bb32e903..adf013f39 100644 --- a/deps/agg/include/agg_rendering_buffer.h +++ b/deps/agg/include/agg_rendering_buffer.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -22,284 +22,261 @@ #include "agg_array.h" -namespace agg +namespace agg { + +//===========================================================row_accessor +template +class row_accessor { + public: + typedef const_row_info row_data; - //===========================================================row_accessor - template class row_accessor + //------------------------------------------------------------------- + row_accessor() + : m_buf(0) + , m_start(0) + , m_width(0) + , m_height(0) + , m_stride(0) + {} + + //-------------------------------------------------------------------- + row_accessor(T* buf, unsigned width, unsigned height, int stride) + : m_buf(0) + , m_start(0) + , m_width(0) + , m_height(0) + , m_stride(0) { - public: - typedef const_row_info row_data; + attach(buf, width, height, stride); + } - //------------------------------------------------------------------- - row_accessor() : - m_buf(0), - m_start(0), - m_width(0), - m_height(0), - m_stride(0) - { - } - - //-------------------------------------------------------------------- - row_accessor(T* buf, unsigned width, unsigned height, int stride) : - m_buf(0), - m_start(0), - m_width(0), - m_height(0), - m_stride(0) - { - attach(buf, width, height, stride); - } - - - //-------------------------------------------------------------------- - void attach(T* buf, unsigned width, unsigned height, int stride) - { - m_buf = m_start = buf; - m_width = width; - m_height = height; - m_stride = stride; - if(stride < 0) - { - m_start = m_buf - int(height - 1) * stride; - } - } - - //-------------------------------------------------------------------- - AGG_INLINE T* buf() { return m_buf; } - AGG_INLINE const T* buf() const { return m_buf; } - AGG_INLINE unsigned width() const { return m_width; } - AGG_INLINE unsigned height() const { return m_height; } - AGG_INLINE int stride() const { return m_stride; } - AGG_INLINE unsigned stride_abs() const - { - return (m_stride < 0) ? unsigned(-m_stride) : unsigned(m_stride); - } - - //-------------------------------------------------------------------- - AGG_INLINE T* row_ptr(int, int y, unsigned) - { - return m_start + y * m_stride; - } - AGG_INLINE T* row_ptr(int y) { return m_start + y * m_stride; } - AGG_INLINE const T* row_ptr(int y) const { return m_start + y * m_stride; } - AGG_INLINE row_data row (int y) const - { - return row_data(0, m_width-1, row_ptr(y)); - } - - //-------------------------------------------------------------------- - template - void copy_from(const RenBuf& src) - { - unsigned h = height(); - if(src.height() < h) h = src.height(); - - unsigned l = stride_abs(); - if(src.stride_abs() < l) l = src.stride_abs(); - - l *= sizeof(T); - - unsigned y; - unsigned w = width(); - for (y = 0; y < h; y++) - { - memcpy(row_ptr(0, y, w), src.row_ptr(y), l); - } - } - - //-------------------------------------------------------------------- - void clear(T value) - { - unsigned y; - unsigned w = width(); - unsigned stride = stride_abs(); - for(y = 0; y < height(); y++) - { - T* p = row_ptr(0, y, w); - unsigned x; - for(x = 0; x < stride; x++) - { - *p++ = value; - } - } - } - - private: - //-------------------------------------------------------------------- - T* m_buf; // Pointer to rendering buffer - T* m_start; // Pointer to first pixel depending on stride - unsigned m_width; // Width in pixels - unsigned m_height; // Height in pixels - int m_stride; // Number of bytes per row. Can be < 0 - }; - - - - - //==========================================================row_ptr_cache - template class row_ptr_cache + //-------------------------------------------------------------------- + void attach(T* buf, unsigned width, unsigned height, int stride) { - public: - typedef const_row_info row_data; - - //------------------------------------------------------------------- - row_ptr_cache() : - m_buf(0), - m_rows(), - m_width(0), - m_height(0), - m_stride(0) + m_buf = m_start = buf; + m_width = width; + m_height = height; + m_stride = stride; + if (stride < 0) { + m_start = m_buf - int(height - 1) * stride; } + } - //-------------------------------------------------------------------- - row_ptr_cache(T* buf, unsigned width, unsigned height, int stride) : - m_buf(0), - m_rows(), - m_width(0), - m_height(0), - m_stride(0) + //-------------------------------------------------------------------- + AGG_INLINE T* buf() { return m_buf; } + AGG_INLINE const T* buf() const { return m_buf; } + AGG_INLINE unsigned width() const { return m_width; } + AGG_INLINE unsigned height() const { return m_height; } + AGG_INLINE int stride() const { return m_stride; } + AGG_INLINE unsigned stride_abs() const { return (m_stride < 0) ? unsigned(-m_stride) : unsigned(m_stride); } + + //-------------------------------------------------------------------- + AGG_INLINE T* row_ptr(int, int y, unsigned) { return m_start + y * m_stride; } + AGG_INLINE T* row_ptr(int y) { return m_start + y * m_stride; } + AGG_INLINE const T* row_ptr(int y) const { return m_start + y * m_stride; } + AGG_INLINE row_data row(int y) const { return row_data(0, m_width - 1, row_ptr(y)); } + + //-------------------------------------------------------------------- + template + void copy_from(const RenBuf& src) + { + unsigned h = height(); + if (src.height() < h) + h = src.height(); + + unsigned l = stride_abs(); + if (src.stride_abs() < l) + l = src.stride_abs(); + + l *= sizeof(T); + + unsigned y; + unsigned w = width(); + for (y = 0; y < h; y++) { - attach(buf, width, height, stride); + memcpy(row_ptr(0, y, w), src.row_ptr(y), l); } + } - //-------------------------------------------------------------------- - void attach(T* buf, unsigned width, unsigned height, int stride) + //-------------------------------------------------------------------- + void clear(T value) + { + unsigned y; + unsigned w = width(); + unsigned stride = stride_abs(); + for (y = 0; y < height(); y++) { - m_buf = buf; - m_width = width; - m_height = height; - m_stride = stride; - if(height > m_rows.size()) + T* p = row_ptr(0, y, w); + unsigned x; + for (x = 0; x < stride; x++) { - m_rows.resize(height); - } - else if(height == 0) - { - return; - } - - T* row_ptr = m_buf; - - if(stride < 0) - { - row_ptr = m_buf - int(height - 1) * stride; - } - - T** rows = &m_rows[0]; - - while(height > 0) - { - *rows++ = row_ptr; - row_ptr += stride; - --height; + *p++ = value; } } + } - //-------------------------------------------------------------------- - AGG_INLINE T* buf() { return m_buf; } - AGG_INLINE const T* buf() const { return m_buf; } - AGG_INLINE unsigned width() const { return m_width; } - AGG_INLINE unsigned height() const { return m_height; } - AGG_INLINE int stride() const { return m_stride; } - AGG_INLINE unsigned stride_abs() const + private: + //-------------------------------------------------------------------- + T* m_buf; // Pointer to rendering buffer + T* m_start; // Pointer to first pixel depending on stride + unsigned m_width; // Width in pixels + unsigned m_height; // Height in pixels + int m_stride; // Number of bytes per row. Can be < 0 +}; + +//==========================================================row_ptr_cache +template +class row_ptr_cache +{ + public: + typedef const_row_info row_data; + + //------------------------------------------------------------------- + row_ptr_cache() + : m_buf(0) + , m_rows() + , m_width(0) + , m_height(0) + , m_stride(0) + {} + + //-------------------------------------------------------------------- + row_ptr_cache(T* buf, unsigned width, unsigned height, int stride) + : m_buf(0) + , m_rows() + , m_width(0) + , m_height(0) + , m_stride(0) + { + attach(buf, width, height, stride); + } + + //-------------------------------------------------------------------- + void attach(T* buf, unsigned width, unsigned height, int stride) + { + m_buf = buf; + m_width = width; + m_height = height; + m_stride = stride; + if (height > m_rows.size()) { - return (m_stride < 0) ? unsigned(-m_stride) : unsigned(m_stride); + m_rows.resize(height); } - - //-------------------------------------------------------------------- - AGG_INLINE T* row_ptr(int, int y, unsigned) - { - return m_rows[y]; - } - AGG_INLINE T* row_ptr(int y) { return m_rows[y]; } - AGG_INLINE const T* row_ptr(int y) const { return m_rows[y]; } - AGG_INLINE row_data row (int y) const - { - return row_data(0, m_width-1, m_rows[y]); - } - - //-------------------------------------------------------------------- - T const* const* rows() const { return &m_rows[0]; } - - //-------------------------------------------------------------------- - template - void copy_from(const RenBuf& src) + else if (height == 0) { - unsigned h = height(); - if(src.height() < h) h = src.height(); - - unsigned l = stride_abs(); - if(src.stride_abs() < l) l = src.stride_abs(); - - l *= sizeof(T); + return; + } - unsigned y; - unsigned w = width(); - for (y = 0; y < h; y++) + T* row_ptr = m_buf; + + if (stride < 0) + { + row_ptr = m_buf - int(height - 1) * stride; + } + + T** rows = &m_rows[0]; + + while (height > 0) + { + *rows++ = row_ptr; + row_ptr += stride; + --height; + } + } + + //-------------------------------------------------------------------- + AGG_INLINE T* buf() { return m_buf; } + AGG_INLINE const T* buf() const { return m_buf; } + AGG_INLINE unsigned width() const { return m_width; } + AGG_INLINE unsigned height() const { return m_height; } + AGG_INLINE int stride() const { return m_stride; } + AGG_INLINE unsigned stride_abs() const { return (m_stride < 0) ? unsigned(-m_stride) : unsigned(m_stride); } + + //-------------------------------------------------------------------- + AGG_INLINE T* row_ptr(int, int y, unsigned) { return m_rows[y]; } + AGG_INLINE T* row_ptr(int y) { return m_rows[y]; } + AGG_INLINE const T* row_ptr(int y) const { return m_rows[y]; } + AGG_INLINE row_data row(int y) const { return row_data(0, m_width - 1, m_rows[y]); } + + //-------------------------------------------------------------------- + T const* const* rows() const { return &m_rows[0]; } + + //-------------------------------------------------------------------- + template + void copy_from(const RenBuf& src) + { + unsigned h = height(); + if (src.height() < h) + h = src.height(); + + unsigned l = stride_abs(); + if (src.stride_abs() < l) + l = src.stride_abs(); + + l *= sizeof(T); + + unsigned y; + unsigned w = width(); + for (y = 0; y < h; y++) + { + memcpy(row_ptr(0, y, w), src.row_ptr(y), l); + } + } + + //-------------------------------------------------------------------- + void clear(T value) + { + unsigned y; + unsigned w = width(); + unsigned stride = stride_abs(); + for (y = 0; y < height(); y++) + { + T* p = row_ptr(0, y, w); + unsigned x; + for (x = 0; x < stride; x++) { - memcpy(row_ptr(0, y, w), src.row_ptr(y), l); + *p++ = value; } } + } - //-------------------------------------------------------------------- - void clear(T value) - { - unsigned y; - unsigned w = width(); - unsigned stride = stride_abs(); - for(y = 0; y < height(); y++) - { - T* p = row_ptr(0, y, w); - unsigned x; - for(x = 0; x < stride; x++) - { - *p++ = value; - } - } - } + private: + //-------------------------------------------------------------------- + T* m_buf; // Pointer to rendering buffer + pod_array m_rows; // Pointers to each row of the buffer + unsigned m_width; // Width in pixels + unsigned m_height; // Height in pixels + int m_stride; // Number of bytes per row. Can be < 0 +}; - private: - //-------------------------------------------------------------------- - T* m_buf; // Pointer to rendering buffer - pod_array m_rows; // Pointers to each row of the buffer - unsigned m_width; // Width in pixels - unsigned m_height; // Height in pixels - int m_stride; // Number of bytes per row. Can be < 0 - }; - - - - - //========================================================rendering_buffer - // - // The definition of the main type for accessing the rows in the frame - // buffer. It provides functionality to navigate to the rows in a - // rectangular matrix, from top to bottom or from bottom to top depending - // on stride. - // - // row_accessor is cheap to create/destroy, but performs one multiplication - // when calling row_ptr(). - // - // row_ptr_cache creates an array of pointers to rows, so, the access - // via row_ptr() may be faster. But it requires memory allocation - // when creating. For example, on typical Intel Pentium hardware - // row_ptr_cache speeds span_image_filter_rgb_nn up to 10% - // - // It's used only in short hand typedefs like pixfmt_rgba32 and can be - // redefined in agg_config.h - // In real applications you can use both, depending on your needs - //------------------------------------------------------------------------ +//========================================================rendering_buffer +// +// The definition of the main type for accessing the rows in the frame +// buffer. It provides functionality to navigate to the rows in a +// rectangular matrix, from top to bottom or from bottom to top depending +// on stride. +// +// row_accessor is cheap to create/destroy, but performs one multiplication +// when calling row_ptr(). +// +// row_ptr_cache creates an array of pointers to rows, so, the access +// via row_ptr() may be faster. But it requires memory allocation +// when creating. For example, on typical Intel Pentium hardware +// row_ptr_cache speeds span_image_filter_rgb_nn up to 10% +// +// It's used only in short hand typedefs like pixfmt_rgba32 and can be +// redefined in agg_config.h +// In real applications you can use both, depending on your needs +//------------------------------------------------------------------------ #ifdef AGG_RENDERING_BUFFER - typedef AGG_RENDERING_BUFFER rendering_buffer; +typedef AGG_RENDERING_BUFFER rendering_buffer; #else - typedef row_ptr_cache rendering_buffer; - //typedef row_accessor rendering_buffer; +typedef row_ptr_cache rendering_buffer; +// typedef row_accessor rendering_buffer; #endif -} - +} // namespace agg #endif diff --git a/deps/agg/include/agg_rendering_buffer_dynarow.h b/deps/agg/include/agg_rendering_buffer_dynarow.h index 188746f3d..05611ba9f 100644 --- a/deps/agg/include/agg_rendering_buffer_dynarow.h +++ b/deps/agg/include/agg_rendering_buffer_dynarow.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -22,116 +22,114 @@ #include "agg_array.h" -namespace agg +namespace agg { + +//===============================================rendering_buffer_dynarow +// Rendering buffer class with dynamic allocation of the rows. +// The rows are allocated as needed when requesting for span_ptr(). +// The class automatically calculates min_x and max_x for each row. +// Generally it's more efficient to use this class as a temporary buffer +// for rendering a few lines and then to blend it with another buffer. +// +class rendering_buffer_dynarow { + public: + typedef row_info row_data; - //===============================================rendering_buffer_dynarow - // Rendering buffer class with dynamic allocation of the rows. - // The rows are allocated as needed when requesting for span_ptr(). - // The class automatically calculates min_x and max_x for each row. - // Generally it's more efficient to use this class as a temporary buffer - // for rendering a few lines and then to blend it with another buffer. - // - class rendering_buffer_dynarow + //------------------------------------------------------------------- + ~rendering_buffer_dynarow() { init(0, 0, 0); } + + //------------------------------------------------------------------- + rendering_buffer_dynarow() + : m_rows() + , m_width(0) + , m_height(0) + , m_byte_width(0) + {} + + // Allocate and clear the buffer + //-------------------------------------------------------------------- + rendering_buffer_dynarow(unsigned width, unsigned height, unsigned byte_width) + : m_rows(height) + , m_width(width) + , m_height(height) + , m_byte_width(byte_width) { - public: - typedef row_info row_data; + memset(&m_rows[0], 0, sizeof(row_data) * height); + } - //------------------------------------------------------------------- - ~rendering_buffer_dynarow() + // Allocate and clear the buffer + //-------------------------------------------------------------------- + void init(unsigned width, unsigned height, unsigned byte_width) + { + unsigned i; + for (i = 0; i < m_height; ++i) { - init(0,0,0); + pod_allocator::deallocate((int8u*)m_rows[i].ptr, m_byte_width); } - - //------------------------------------------------------------------- - rendering_buffer_dynarow() : - m_rows(), - m_width(0), - m_height(0), - m_byte_width(0) - { - } - - // Allocate and clear the buffer - //-------------------------------------------------------------------- - rendering_buffer_dynarow(unsigned width, unsigned height, - unsigned byte_width) : - m_rows(height), - m_width(width), - m_height(height), - m_byte_width(byte_width) + if (width && height) { + m_width = width; + m_height = height; + m_byte_width = byte_width; + m_rows.resize(height); memset(&m_rows[0], 0, sizeof(row_data) * height); } + } - // Allocate and clear the buffer - //-------------------------------------------------------------------- - void init(unsigned width, unsigned height, unsigned byte_width) + //-------------------------------------------------------------------- + unsigned width() const { return m_width; } + unsigned height() const { return m_height; } + unsigned byte_width() const { return m_byte_width; } + + // The main function used for rendering. Returns pointer to the + // pre-allocated span. Memory for the row is allocated as needed. + //-------------------------------------------------------------------- + int8u* row_ptr(int x, int y, unsigned len) + { + row_data* r = &m_rows[y]; + int x2 = x + len - 1; + if (r->ptr) { - unsigned i; - for(i = 0; i < m_height; ++i) + if (x < r->x1) { - pod_allocator::deallocate((int8u*)m_rows[i].ptr, m_byte_width); + r->x1 = x; } - if(width && height) + if (x2 > r->x2) { - m_width = width; - m_height = height; - m_byte_width = byte_width; - m_rows.resize(height); - memset(&m_rows[0], 0, sizeof(row_data) * height); + r->x2 = x2; } } - - //-------------------------------------------------------------------- - unsigned width() const { return m_width; } - unsigned height() const { return m_height; } - unsigned byte_width() const { return m_byte_width; } - - // The main function used for rendering. Returns pointer to the - // pre-allocated span. Memory for the row is allocated as needed. - //-------------------------------------------------------------------- - int8u* row_ptr(int x, int y, unsigned len) + else { - row_data* r = &m_rows[y]; - int x2 = x + len - 1; - if(r->ptr) - { - if(x < r->x1) { r->x1 = x; } - if(x2 > r->x2) { r->x2 = x2; } - } - else - { - int8u* p = pod_allocator::allocate(m_byte_width); - r->ptr = p; - r->x1 = x; - r->x2 = x2; - memset(p, 0, m_byte_width); - } - return (int8u*)r->ptr; + int8u* p = pod_allocator::allocate(m_byte_width); + r->ptr = p; + r->x1 = x; + r->x2 = x2; + memset(p, 0, m_byte_width); } + return (int8u*)r->ptr; + } - //-------------------------------------------------------------------- - const int8u* row_ptr(int y) const { return m_rows[y].ptr; } - int8u* row_ptr(int y) { return row_ptr(0, y, m_width); } - row_data row (int y) const { return m_rows[y]; } + //-------------------------------------------------------------------- + const int8u* row_ptr(int y) const { return m_rows[y].ptr; } + int8u* row_ptr(int y) { return row_ptr(0, y, m_width); } + row_data row(int y) const { return m_rows[y]; } - private: - //-------------------------------------------------------------------- - // Prohibit copying - rendering_buffer_dynarow(const rendering_buffer_dynarow&); - const rendering_buffer_dynarow& operator = (const rendering_buffer_dynarow&); + private: + //-------------------------------------------------------------------- + // Prohibit copying + rendering_buffer_dynarow(const rendering_buffer_dynarow&); + const rendering_buffer_dynarow& operator=(const rendering_buffer_dynarow&); - private: - //-------------------------------------------------------------------- - pod_array m_rows; // Pointers to each row of the buffer - unsigned m_width; // Width in pixels - unsigned m_height; // Height in pixels - unsigned m_byte_width; // Width in bytes - }; - - -} + private: + //-------------------------------------------------------------------- + pod_array m_rows; // Pointers to each row of the buffer + unsigned m_width; // Width in pixels + unsigned m_height; // Height in pixels + unsigned m_byte_width; // Width in bytes +}; +} // namespace agg #endif diff --git a/deps/agg/include/agg_rounded_rect.h b/deps/agg/include/agg_rounded_rect.h index fe8d26f71..b12de65d4 100644 --- a/deps/agg/include/agg_rounded_rect.h +++ b/deps/agg/include/agg_rounded_rect.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -23,50 +23,47 @@ #include "agg_basics.h" #include "agg_arc.h" -namespace agg +namespace agg { +//------------------------------------------------------------rounded_rect +// +// See Implemantation agg_rounded_rect.cpp +// +class rounded_rect { - //------------------------------------------------------------rounded_rect - // - // See Implemantation agg_rounded_rect.cpp - // - class rounded_rect - { - public: - rounded_rect() {} - rounded_rect(double x1, double y1, double x2, double y2, double r); + public: + rounded_rect() {} + rounded_rect(double x1, double y1, double x2, double y2, double r); - void rect(double x1, double y1, double x2, double y2); - void radius(double r); - void radius(double rx, double ry); - void radius(double rx_bottom, double ry_bottom, double rx_top, double ry_top); - void radius(double rx1, double ry1, double rx2, double ry2, - double rx3, double ry3, double rx4, double ry4); - void normalize_radius(); + void rect(double x1, double y1, double x2, double y2); + void radius(double r); + void radius(double rx, double ry); + void radius(double rx_bottom, double ry_bottom, double rx_top, double ry_top); + void radius(double rx1, double ry1, double rx2, double ry2, double rx3, double ry3, double rx4, double ry4); + void normalize_radius(); - void approximation_scale(double s) { m_arc.approximation_scale(s); } - double approximation_scale() const { return m_arc.approximation_scale(); } + void approximation_scale(double s) { m_arc.approximation_scale(s); } + double approximation_scale() const { return m_arc.approximation_scale(); } - void rewind(unsigned); - unsigned vertex(double* x, double* y); + void rewind(unsigned); + unsigned vertex(double* x, double* y); - private: - double m_x1; - double m_y1; - double m_x2; - double m_y2; - double m_rx1; - double m_ry1; - double m_rx2; - double m_ry2; - double m_rx3; - double m_ry3; - double m_rx4; - double m_ry4; - unsigned m_status; - arc m_arc; - }; + private: + double m_x1; + double m_y1; + double m_x2; + double m_y2; + double m_rx1; + double m_ry1; + double m_rx2; + double m_ry2; + double m_rx3; + double m_ry3; + double m_rx4; + double m_ry4; + unsigned m_status; + arc m_arc; +}; -} +} // namespace agg #endif - diff --git a/deps/agg/include/agg_scanline_bin.h b/deps/agg/include/agg_scanline_bin.h index 6f9f41e8e..24c0019a4 100644 --- a/deps/agg/include/agg_scanline_bin.h +++ b/deps/agg/include/agg_scanline_bin.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -17,12 +17,12 @@ // //---------------------------------------------------------------------------- // -// Adaptation for 32-bit screen coordinates (scanline32_bin) has been sponsored by +// Adaptation for 32-bit screen coordinates (scanline32_bin) has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. -// +// //---------------------------------------------------------------------------- #ifndef AGG_SCANLINE_BIN_INCLUDED @@ -30,235 +30,215 @@ #include "agg_array.h" -namespace agg +namespace agg { + +//=============================================================scanline_bin +// +// This is binary scaline container which supports the interface +// used in the rasterizer::render(). See description of agg_scanline_u8 +// for details. +// +//------------------------------------------------------------------------ +class scanline_bin { + public: + typedef int32 coord_type; - //=============================================================scanline_bin - // - // This is binary scaline container which supports the interface - // used in the rasterizer::render(). See description of agg_scanline_u8 - // for details. - // - //------------------------------------------------------------------------ - class scanline_bin + struct span { - public: - typedef int32 coord_type; - - struct span - { - int16 x; - int16 len; - }; - - typedef const span* const_iterator; - - //-------------------------------------------------------------------- - scanline_bin() : - m_last_x(0x7FFFFFF0), - m_spans(), - m_cur_span(0) - { - } - - //-------------------------------------------------------------------- - void reset(int min_x, int max_x) - { - unsigned max_len = max_x - min_x + 3; - if(max_len > m_spans.size()) - { - m_spans.resize(max_len); - } - m_last_x = 0x7FFFFFF0; - m_cur_span = &m_spans[0]; - } - - //-------------------------------------------------------------------- - void add_cell(int x, unsigned) - { - if(x == m_last_x+1) - { - m_cur_span->len++; - } - else - { - ++m_cur_span; - m_cur_span->x = (int16)x; - m_cur_span->len = 1; - } - m_last_x = x; - } - - //-------------------------------------------------------------------- - void add_span(int x, unsigned len, unsigned) - { - if(x == m_last_x+1) - { - m_cur_span->len = (int16)(m_cur_span->len + len); - } - else - { - ++m_cur_span; - m_cur_span->x = (int16)x; - m_cur_span->len = (int16)len; - } - m_last_x = x + len - 1; - } - - //-------------------------------------------------------------------- - void add_cells(int x, unsigned len, const void*) - { - add_span(x, len, 0); - } - - //-------------------------------------------------------------------- - void finalize(int y) - { - m_y = y; - } - - //-------------------------------------------------------------------- - void reset_spans() - { - m_last_x = 0x7FFFFFF0; - m_cur_span = &m_spans[0]; - } - - //-------------------------------------------------------------------- - int y() const { return m_y; } - unsigned num_spans() const { return unsigned(m_cur_span - &m_spans[0]); } - const_iterator begin() const { return &m_spans[1]; } - - private: - scanline_bin(const scanline_bin&); - const scanline_bin operator = (const scanline_bin&); - - int m_last_x; - int m_y; - pod_array m_spans; - span* m_cur_span; + int16 x; + int16 len; }; + typedef const span* const_iterator; + //-------------------------------------------------------------------- + scanline_bin() + : m_last_x(0x7FFFFFF0) + , m_spans() + , m_cur_span(0) + {} - - - - //===========================================================scanline32_bin - class scanline32_bin + //-------------------------------------------------------------------- + void reset(int min_x, int max_x) { - public: - typedef int32 coord_type; - - //-------------------------------------------------------------------- - struct span + unsigned max_len = max_x - min_x + 3; + if (max_len > m_spans.size()) { - span() {} - span(coord_type x_, coord_type len_) : x(x_), len(len_) {} - - coord_type x; - coord_type len; - }; - typedef pod_bvector span_array_type; - - - //-------------------------------------------------------------------- - class const_iterator - { - public: - const_iterator(const span_array_type& spans) : - m_spans(spans), - m_span_idx(0) - {} - - const span& operator*() const { return m_spans[m_span_idx]; } - const span* operator->() const { return &m_spans[m_span_idx]; } - - void operator ++ () { ++m_span_idx; } - - private: - const span_array_type& m_spans; - unsigned m_span_idx; - }; - - - //-------------------------------------------------------------------- - scanline32_bin() : m_max_len(0), m_last_x(0x7FFFFFF0) {} - - //-------------------------------------------------------------------- - void reset(int, int) - { - m_last_x = 0x7FFFFFF0; - m_spans.remove_all(); + m_spans.resize(max_len); } + m_last_x = 0x7FFFFFF0; + m_cur_span = &m_spans[0]; + } - //-------------------------------------------------------------------- - void add_cell(int x, unsigned) + //-------------------------------------------------------------------- + void add_cell(int x, unsigned) + { + if (x == m_last_x + 1) { - if(x == m_last_x+1) - { - m_spans.last().len++; - } - else - { - m_spans.add(span(coord_type(x), 1)); - } - m_last_x = x; + m_cur_span->len++; } - - //-------------------------------------------------------------------- - void add_span(int x, unsigned len, unsigned) + else { - if(x == m_last_x+1) - { - m_spans.last().len += coord_type(len); - } - else - { - m_spans.add(span(coord_type(x), coord_type(len))); - } - m_last_x = x + len - 1; + ++m_cur_span; + m_cur_span->x = (int16)x; + m_cur_span->len = 1; } + m_last_x = x; + } - //-------------------------------------------------------------------- - void add_cells(int x, unsigned len, const void*) + //-------------------------------------------------------------------- + void add_span(int x, unsigned len, unsigned) + { + if (x == m_last_x + 1) { - add_span(x, len, 0); + m_cur_span->len = (int16)(m_cur_span->len + len); } - - //-------------------------------------------------------------------- - void finalize(int y) - { - m_y = y; - } - - //-------------------------------------------------------------------- - void reset_spans() + else { - m_last_x = 0x7FFFFFF0; - m_spans.remove_all(); + ++m_cur_span; + m_cur_span->x = (int16)x; + m_cur_span->len = (int16)len; } + m_last_x = x + len - 1; + } - //-------------------------------------------------------------------- - int y() const { return m_y; } - unsigned num_spans() const { return m_spans.size(); } - const_iterator begin() const { return const_iterator(m_spans); } + //-------------------------------------------------------------------- + void add_cells(int x, unsigned len, const void*) { add_span(x, len, 0); } - private: - scanline32_bin(const scanline32_bin&); - const scanline32_bin operator = (const scanline32_bin&); + //-------------------------------------------------------------------- + void finalize(int y) { m_y = y; } - unsigned m_max_len; - int m_last_x; - int m_y; - span_array_type m_spans; + //-------------------------------------------------------------------- + void reset_spans() + { + m_last_x = 0x7FFFFFF0; + m_cur_span = &m_spans[0]; + } + + //-------------------------------------------------------------------- + int y() const { return m_y; } + unsigned num_spans() const { return unsigned(m_cur_span - &m_spans[0]); } + const_iterator begin() const { return &m_spans[1]; } + + private: + scanline_bin(const scanline_bin&); + const scanline_bin operator=(const scanline_bin&); + + int m_last_x; + int m_y; + pod_array m_spans; + span* m_cur_span; +}; + +//===========================================================scanline32_bin +class scanline32_bin +{ + public: + typedef int32 coord_type; + + //-------------------------------------------------------------------- + struct span + { + span() {} + span(coord_type x_, coord_type len_) + : x(x_) + , len(len_) + {} + + coord_type x; + coord_type len; + }; + typedef pod_bvector span_array_type; + + //-------------------------------------------------------------------- + class const_iterator + { + public: + const_iterator(const span_array_type& spans) + : m_spans(spans) + , m_span_idx(0) + {} + + const span& operator*() const { return m_spans[m_span_idx]; } + const span* operator->() const { return &m_spans[m_span_idx]; } + + void operator++() { ++m_span_idx; } + + private: + const span_array_type& m_spans; + unsigned m_span_idx; }; + //-------------------------------------------------------------------- + scanline32_bin() + : m_max_len(0) + , m_last_x(0x7FFFFFF0) + {} + //-------------------------------------------------------------------- + void reset(int, int) + { + m_last_x = 0x7FFFFFF0; + m_spans.remove_all(); + } + //-------------------------------------------------------------------- + void add_cell(int x, unsigned) + { + if (x == m_last_x + 1) + { + m_spans.last().len++; + } + else + { + m_spans.add(span(coord_type(x), 1)); + } + m_last_x = x; + } + //-------------------------------------------------------------------- + void add_span(int x, unsigned len, unsigned) + { + if (x == m_last_x + 1) + { + m_spans.last().len += coord_type(len); + } + else + { + m_spans.add(span(coord_type(x), coord_type(len))); + } + m_last_x = x + len - 1; + } -} + //-------------------------------------------------------------------- + void add_cells(int x, unsigned len, const void*) { add_span(x, len, 0); } + //-------------------------------------------------------------------- + void finalize(int y) { m_y = y; } + + //-------------------------------------------------------------------- + void reset_spans() + { + m_last_x = 0x7FFFFFF0; + m_spans.remove_all(); + } + + //-------------------------------------------------------------------- + int y() const { return m_y; } + unsigned num_spans() const { return m_spans.size(); } + const_iterator begin() const { return const_iterator(m_spans); } + + private: + scanline32_bin(const scanline32_bin&); + const scanline32_bin operator=(const scanline32_bin&); + + unsigned m_max_len; + int m_last_x; + int m_y; + span_array_type m_spans; +}; + +} // namespace agg #endif diff --git a/deps/agg/include/agg_scanline_boolean_algebra.h b/deps/agg/include/agg_scanline_boolean_algebra.h index aa3d4a1f4..86ff1a436 100644 --- a/deps/agg/include/agg_scanline_boolean_algebra.h +++ b/deps/agg/include/agg_scanline_boolean_algebra.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -20,174 +20,144 @@ #include #include "agg_basics.h" +namespace agg { -namespace agg +//-----------------------------------------------sbool_combine_spans_bin +// Functor. +// Combine two binary encoded spans, i.e., when we don't have any +// anti-aliasing information, but only X and Length. The function +// is compatible with any type of scanlines. +//---------------- +template +struct sbool_combine_spans_bin { - - //-----------------------------------------------sbool_combine_spans_bin - // Functor. - // Combine two binary encoded spans, i.e., when we don't have any - // anti-aliasing information, but only X and Length. The function - // is compatible with any type of scanlines. - //---------------- - template - struct sbool_combine_spans_bin + void operator()(const typename Scanline1::const_iterator&, + const typename Scanline2::const_iterator&, + int x, + unsigned len, + Scanline& sl) const { - void operator () (const typename Scanline1::const_iterator&, - const typename Scanline2::const_iterator&, - int x, unsigned len, - Scanline& sl) const + sl.add_span(x, len, cover_full); + } +}; + +//---------------------------------------------sbool_combine_spans_empty +// Functor. +// Combine two spans as empty ones. The functor does nothing +// and is used to XOR binary spans. +//---------------- +template +struct sbool_combine_spans_empty +{ + void operator()(const typename Scanline1::const_iterator&, + const typename Scanline2::const_iterator&, + int, + unsigned, + Scanline&) const + {} +}; + +//--------------------------------------------------sbool_add_span_empty +// Functor. +// Add nothing. Used in conbine_shapes_sub +//---------------- +template +struct sbool_add_span_empty +{ + void operator()(const typename Scanline1::const_iterator&, int, unsigned, Scanline&) const {} +}; + +//----------------------------------------------------sbool_add_span_bin +// Functor. +// Add a binary span +//---------------- +template +struct sbool_add_span_bin +{ + void operator()(const typename Scanline1::const_iterator&, int x, unsigned len, Scanline& sl) const + { + sl.add_span(x, len, cover_full); + } +}; + +//-----------------------------------------------------sbool_add_span_aa +// Functor. +// Add an anti-aliased span +// anti-aliasing information, but only X and Length. The function +// is compatible with any type of scanlines. +//---------------- +template +struct sbool_add_span_aa +{ + void operator()(const typename Scanline1::const_iterator& span, int x, unsigned len, Scanline& sl) const + { + if (span->len < 0) { - sl.add_span(x, len, cover_full); + sl.add_span(x, len, *span->covers); } - }; - - - - //---------------------------------------------sbool_combine_spans_empty - // Functor. - // Combine two spans as empty ones. The functor does nothing - // and is used to XOR binary spans. - //---------------- - template - struct sbool_combine_spans_empty - { - void operator () (const typename Scanline1::const_iterator&, - const typename Scanline2::const_iterator&, - int, unsigned, - Scanline&) const - {} - }; - - - - //--------------------------------------------------sbool_add_span_empty - // Functor. - // Add nothing. Used in conbine_shapes_sub - //---------------- - template - struct sbool_add_span_empty - { - void operator () (const typename Scanline1::const_iterator&, - int, unsigned, - Scanline&) const - {} - }; - - - //----------------------------------------------------sbool_add_span_bin - // Functor. - // Add a binary span - //---------------- - template - struct sbool_add_span_bin - { - void operator () (const typename Scanline1::const_iterator&, - int x, unsigned len, - Scanline& sl) const + else if (span->len > 0) { - sl.add_span(x, len, cover_full); + const typename Scanline1::cover_type* covers = span->covers; + if (span->x < x) + covers += x - span->x; + sl.add_cells(x, len, covers); } + } +}; + +//----------------------------------------------sbool_intersect_spans_aa +// Functor. +// Intersect two spans preserving the anti-aliasing information. +// The result is added to the "sl" scanline. +//------------------ +template +struct sbool_intersect_spans_aa +{ + enum cover_scale_e { + cover_shift = CoverShift, + cover_size = 1 << cover_shift, + cover_mask = cover_size - 1, + cover_full = cover_mask }; - - - - //-----------------------------------------------------sbool_add_span_aa - // Functor. - // Add an anti-aliased span - // anti-aliasing information, but only X and Length. The function - // is compatible with any type of scanlines. - //---------------- - template - struct sbool_add_span_aa + void operator()(const typename Scanline1::const_iterator& span1, + const typename Scanline2::const_iterator& span2, + int x, + unsigned len, + Scanline& sl) const { - void operator () (const typename Scanline1::const_iterator& span, - int x, unsigned len, - Scanline& sl) const + unsigned cover; + const typename Scanline1::cover_type* covers1; + const typename Scanline2::cover_type* covers2; + + // Calculate the operation code and choose the + // proper combination algorithm. + // 0 = Both spans are of AA type + // 1 = span1 is solid, span2 is AA + // 2 = span1 is AA, span2 is solid + // 3 = Both spans are of solid type + //----------------- + switch ((span1->len < 0) | ((span2->len < 0) << 1)) { - if(span->len < 0) - { - sl.add_span(x, len, *span->covers); - } - else - if(span->len > 0) - { - const typename Scanline1::cover_type* covers = span->covers; - if(span->x < x) covers += x - span->x; - sl.add_cells(x, len, covers); - } - } - }; - - - - - //----------------------------------------------sbool_intersect_spans_aa - // Functor. - // Intersect two spans preserving the anti-aliasing information. - // The result is added to the "sl" scanline. - //------------------ - template - struct sbool_intersect_spans_aa - { - enum cover_scale_e - { - cover_shift = CoverShift, - cover_size = 1 << cover_shift, - cover_mask = cover_size - 1, - cover_full = cover_mask - }; - - - void operator () (const typename Scanline1::const_iterator& span1, - const typename Scanline2::const_iterator& span2, - int x, unsigned len, - Scanline& sl) const - { - unsigned cover; - const typename Scanline1::cover_type* covers1; - const typename Scanline2::cover_type* covers2; - - // Calculate the operation code and choose the - // proper combination algorithm. - // 0 = Both spans are of AA type - // 1 = span1 is solid, span2 is AA - // 2 = span1 is AA, span2 is solid - // 3 = Both spans are of solid type - //----------------- - switch((span1->len < 0) | ((span2->len < 0) << 1)) - { - case 0: // Both are AA spans + case 0: // Both are AA spans covers1 = span1->covers; covers2 = span2->covers; - if(span1->x < x) covers1 += x - span1->x; - if(span2->x < x) covers2 += x - span2->x; + if (span1->x < x) + covers1 += x - span1->x; + if (span2->x < x) + covers2 += x - span2->x; do { cover = *covers1++ * *covers2++; - sl.add_cell(x++, - (cover == cover_full * cover_full) ? - cover_full : - (cover >> cover_shift)); - } - while(--len); + sl.add_cell(x++, (cover == cover_full * cover_full) ? cover_full : (cover >> cover_shift)); + } while (--len); break; - case 1: // span1 is solid, span2 is AA + case 1: // span1 is solid, span2 is AA covers2 = span2->covers; - if(span2->x < x) covers2 += x - span2->x; - if(*(span1->covers) == cover_full) + if (span2->x < x) + covers2 += x - span2->x; + if (*(span1->covers) == cover_full) { sl.add_cells(x, len, covers2); } @@ -196,19 +166,16 @@ namespace agg do { cover = *(span1->covers) * *covers2++; - sl.add_cell(x++, - (cover == cover_full * cover_full) ? - cover_full : - (cover >> cover_shift)); - } - while(--len); + sl.add_cell(x++, (cover == cover_full * cover_full) ? cover_full : (cover >> cover_shift)); + } while (--len); } break; - case 2: // span1 is AA, span2 is solid + case 2: // span1 is AA, span2 is solid covers1 = span1->covers; - if(span1->x < x) covers1 += x - span1->x; - if(*(span2->covers) == cover_full) + if (span1->x < x) + covers1 += x - span1->x; + if (*(span2->covers) == cover_full) { sl.add_cells(x, len, covers1); } @@ -217,91 +184,72 @@ namespace agg do { cover = *covers1++ * *(span2->covers); - sl.add_cell(x++, - (cover == cover_full * cover_full) ? - cover_full : - (cover >> cover_shift)); - } - while(--len); + sl.add_cell(x++, (cover == cover_full * cover_full) ? cover_full : (cover >> cover_shift)); + } while (--len); } break; - case 3: // Both are solid spans + case 3: // Both are solid spans cover = *(span1->covers) * *(span2->covers); - sl.add_span(x, len, - (cover == cover_full * cover_full) ? - cover_full : - (cover >> cover_shift)); + sl.add_span(x, len, (cover == cover_full * cover_full) ? cover_full : (cover >> cover_shift)); break; - } } + } +}; + +//--------------------------------------------------sbool_unite_spans_aa +// Functor. +// Unite two spans preserving the anti-aliasing information. +// The result is added to the "sl" scanline. +//------------------ +template +struct sbool_unite_spans_aa +{ + enum cover_scale_e { + cover_shift = CoverShift, + cover_size = 1 << cover_shift, + cover_mask = cover_size - 1, + cover_full = cover_mask }; - - - - - - //--------------------------------------------------sbool_unite_spans_aa - // Functor. - // Unite two spans preserving the anti-aliasing information. - // The result is added to the "sl" scanline. - //------------------ - template - struct sbool_unite_spans_aa + void operator()(const typename Scanline1::const_iterator& span1, + const typename Scanline2::const_iterator& span2, + int x, + unsigned len, + Scanline& sl) const { - enum cover_scale_e - { - cover_shift = CoverShift, - cover_size = 1 << cover_shift, - cover_mask = cover_size - 1, - cover_full = cover_mask - }; - + unsigned cover; + const typename Scanline1::cover_type* covers1; + const typename Scanline2::cover_type* covers2; - void operator () (const typename Scanline1::const_iterator& span1, - const typename Scanline2::const_iterator& span2, - int x, unsigned len, - Scanline& sl) const + // Calculate the operation code and choose the + // proper combination algorithm. + // 0 = Both spans are of AA type + // 1 = span1 is solid, span2 is AA + // 2 = span1 is AA, span2 is solid + // 3 = Both spans are of solid type + //----------------- + switch ((span1->len < 0) | ((span2->len < 0) << 1)) { - unsigned cover; - const typename Scanline1::cover_type* covers1; - const typename Scanline2::cover_type* covers2; - - // Calculate the operation code and choose the - // proper combination algorithm. - // 0 = Both spans are of AA type - // 1 = span1 is solid, span2 is AA - // 2 = span1 is AA, span2 is solid - // 3 = Both spans are of solid type - //----------------- - switch((span1->len < 0) | ((span2->len < 0) << 1)) - { - case 0: // Both are AA spans + case 0: // Both are AA spans covers1 = span1->covers; covers2 = span2->covers; - if(span1->x < x) covers1 += x - span1->x; - if(span2->x < x) covers2 += x - span2->x; + if (span1->x < x) + covers1 += x - span1->x; + if (span2->x < x) + covers2 += x - span2->x; do { - cover = cover_mask * cover_mask - - (cover_mask - *covers1++) * - (cover_mask - *covers2++); - sl.add_cell(x++, - (cover == cover_full * cover_full) ? - cover_full : - (cover >> cover_shift)); - } - while(--len); + cover = cover_mask * cover_mask - (cover_mask - *covers1++) * (cover_mask - *covers2++); + sl.add_cell(x++, (cover == cover_full * cover_full) ? cover_full : (cover >> cover_shift)); + } while (--len); break; - case 1: // span1 is solid, span2 is AA + case 1: // span1 is solid, span2 is AA covers2 = span2->covers; - if(span2->x < x) covers2 += x - span2->x; - if(*(span1->covers) == cover_full) + if (span2->x < x) + covers2 += x - span2->x; + if (*(span1->covers) == cover_full) { sl.add_span(x, len, cover_full); } @@ -309,22 +257,17 @@ namespace agg { do { - cover = cover_mask * cover_mask - - (cover_mask - *(span1->covers)) * - (cover_mask - *covers2++); - sl.add_cell(x++, - (cover == cover_full * cover_full) ? - cover_full : - (cover >> cover_shift)); - } - while(--len); + cover = cover_mask * cover_mask - (cover_mask - *(span1->covers)) * (cover_mask - *covers2++); + sl.add_cell(x++, (cover == cover_full * cover_full) ? cover_full : (cover >> cover_shift)); + } while (--len); } break; - case 2: // span1 is AA, span2 is solid + case 2: // span1 is AA, span2 is solid covers1 = span1->covers; - if(span1->x < x) covers1 += x - span1->x; - if(*(span2->covers) == cover_full) + if (span1->x < x) + covers1 += x - span1->x; + if (*(span2->covers) == cover_full) { sl.add_span(x, len, cover_full); } @@ -332,1236 +275,1102 @@ namespace agg { do { - cover = cover_mask * cover_mask - - (cover_mask - *covers1++) * - (cover_mask - *(span2->covers)); - sl.add_cell(x++, - (cover == cover_full * cover_full) ? - cover_full : - (cover >> cover_shift)); - } - while(--len); + cover = cover_mask * cover_mask - (cover_mask - *covers1++) * (cover_mask - *(span2->covers)); + sl.add_cell(x++, (cover == cover_full * cover_full) ? cover_full : (cover >> cover_shift)); + } while (--len); } break; - case 3: // Both are solid spans - cover = cover_mask * cover_mask - - (cover_mask - *(span1->covers)) * - (cover_mask - *(span2->covers)); - sl.add_span(x, len, - (cover == cover_full * cover_full) ? - cover_full : - (cover >> cover_shift)); + case 3: // Both are solid spans + cover = cover_mask * cover_mask - (cover_mask - *(span1->covers)) * (cover_mask - *(span2->covers)); + sl.add_span(x, len, (cover == cover_full * cover_full) ? cover_full : (cover >> cover_shift)); break; - } } + } +}; + +//---------------------------------------------sbool_xor_formula_linear +template +struct sbool_xor_formula_linear +{ + enum cover_scale_e { cover_shift = CoverShift, cover_size = 1 << cover_shift, cover_mask = cover_size - 1 }; + + static AGG_INLINE unsigned calculate(unsigned a, unsigned b) + { + unsigned cover = a + b; + if (cover > cover_mask) + cover = cover_mask + cover_mask - cover; + return cover; + } +}; + +//---------------------------------------------sbool_xor_formula_saddle +template +struct sbool_xor_formula_saddle +{ + enum cover_scale_e { cover_shift = CoverShift, cover_size = 1 << cover_shift, cover_mask = cover_size - 1 }; + + static AGG_INLINE unsigned calculate(unsigned a, unsigned b) + { + unsigned k = a * b; + if (k == cover_mask * cover_mask) + return 0; + + a = (cover_mask * cover_mask - (a << cover_shift) + k) >> cover_shift; + b = (cover_mask * cover_mask - (b << cover_shift) + k) >> cover_shift; + return cover_mask - ((a * b) >> cover_shift); + } +}; + +//-------------------------------------------sbool_xor_formula_abs_diff +struct sbool_xor_formula_abs_diff +{ + static AGG_INLINE unsigned calculate(unsigned a, unsigned b) { return unsigned(std::abs(int(a) - int(b))); } +}; + +//----------------------------------------------------sbool_xor_spans_aa +// Functor. +// XOR two spans preserving the anti-aliasing information. +// The result is added to the "sl" scanline. +//------------------ +template +struct sbool_xor_spans_aa +{ + enum cover_scale_e { + cover_shift = CoverShift, + cover_size = 1 << cover_shift, + cover_mask = cover_size - 1, + cover_full = cover_mask }; - - //---------------------------------------------sbool_xor_formula_linear - template - struct sbool_xor_formula_linear + void operator()(const typename Scanline1::const_iterator& span1, + const typename Scanline2::const_iterator& span2, + int x, + unsigned len, + Scanline& sl) const { - enum cover_scale_e + unsigned cover; + const typename Scanline1::cover_type* covers1; + const typename Scanline2::cover_type* covers2; + + // Calculate the operation code and choose the + // proper combination algorithm. + // 0 = Both spans are of AA type + // 1 = span1 is solid, span2 is AA + // 2 = span1 is AA, span2 is solid + // 3 = Both spans are of solid type + //----------------- + switch ((span1->len < 0) | ((span2->len < 0) << 1)) { - cover_shift = CoverShift, - cover_size = 1 << cover_shift, - cover_mask = cover_size - 1 - }; - - static AGG_INLINE unsigned calculate(unsigned a, unsigned b) - { - unsigned cover = a + b; - if(cover > cover_mask) cover = cover_mask + cover_mask - cover; - return cover; - } - }; - - - //---------------------------------------------sbool_xor_formula_saddle - template - struct sbool_xor_formula_saddle - { - enum cover_scale_e - { - cover_shift = CoverShift, - cover_size = 1 << cover_shift, - cover_mask = cover_size - 1 - }; - - static AGG_INLINE unsigned calculate(unsigned a, unsigned b) - { - unsigned k = a * b; - if(k == cover_mask * cover_mask) return 0; - - a = (cover_mask * cover_mask - (a << cover_shift) + k) >> cover_shift; - b = (cover_mask * cover_mask - (b << cover_shift) + k) >> cover_shift; - return cover_mask - ((a * b) >> cover_shift); - } - }; - - - //-------------------------------------------sbool_xor_formula_abs_diff - struct sbool_xor_formula_abs_diff - { - static AGG_INLINE unsigned calculate(unsigned a, unsigned b) - { - return unsigned(std::abs(int(a) - int(b))); - } - }; - - - - //----------------------------------------------------sbool_xor_spans_aa - // Functor. - // XOR two spans preserving the anti-aliasing information. - // The result is added to the "sl" scanline. - //------------------ - template - struct sbool_xor_spans_aa - { - enum cover_scale_e - { - cover_shift = CoverShift, - cover_size = 1 << cover_shift, - cover_mask = cover_size - 1, - cover_full = cover_mask - }; - - - void operator () (const typename Scanline1::const_iterator& span1, - const typename Scanline2::const_iterator& span2, - int x, unsigned len, - Scanline& sl) const - { - unsigned cover; - const typename Scanline1::cover_type* covers1; - const typename Scanline2::cover_type* covers2; - - // Calculate the operation code and choose the - // proper combination algorithm. - // 0 = Both spans are of AA type - // 1 = span1 is solid, span2 is AA - // 2 = span1 is AA, span2 is solid - // 3 = Both spans are of solid type - //----------------- - switch((span1->len < 0) | ((span2->len < 0) << 1)) - { - case 0: // Both are AA spans + case 0: // Both are AA spans covers1 = span1->covers; covers2 = span2->covers; - if(span1->x < x) covers1 += x - span1->x; - if(span2->x < x) covers2 += x - span2->x; + if (span1->x < x) + covers1 += x - span1->x; + if (span2->x < x) + covers2 += x - span2->x; do { cover = XorFormula::calculate(*covers1++, *covers2++); - if(cover) sl.add_cell(x, cover); + if (cover) + sl.add_cell(x, cover); ++x; - } - while(--len); + } while (--len); break; - case 1: // span1 is solid, span2 is AA + case 1: // span1 is solid, span2 is AA covers2 = span2->covers; - if(span2->x < x) covers2 += x - span2->x; + if (span2->x < x) + covers2 += x - span2->x; do { cover = XorFormula::calculate(*(span1->covers), *covers2++); - if(cover) sl.add_cell(x, cover); + if (cover) + sl.add_cell(x, cover); ++x; - } - while(--len); + } while (--len); break; - case 2: // span1 is AA, span2 is solid + case 2: // span1 is AA, span2 is solid covers1 = span1->covers; - if(span1->x < x) covers1 += x - span1->x; + if (span1->x < x) + covers1 += x - span1->x; do { cover = XorFormula::calculate(*covers1++, *(span2->covers)); - if(cover) sl.add_cell(x, cover); + if (cover) + sl.add_cell(x, cover); ++x; - } - while(--len); + } while (--len); break; - case 3: // Both are solid spans + case 3: // Both are solid spans cover = XorFormula::calculate(*(span1->covers), *(span2->covers)); - if(cover) sl.add_span(x, len, cover); + if (cover) + sl.add_span(x, len, cover); break; - - } } + } +}; + +//-----------------------------------------------sbool_subtract_spans_aa +// Functor. +// Unite two spans preserving the anti-aliasing information. +// The result is added to the "sl" scanline. +//------------------ +template +struct sbool_subtract_spans_aa +{ + enum cover_scale_e { + cover_shift = CoverShift, + cover_size = 1 << cover_shift, + cover_mask = cover_size - 1, + cover_full = cover_mask }; - - - - - //-----------------------------------------------sbool_subtract_spans_aa - // Functor. - // Unite two spans preserving the anti-aliasing information. - // The result is added to the "sl" scanline. - //------------------ - template - struct sbool_subtract_spans_aa + void operator()(const typename Scanline1::const_iterator& span1, + const typename Scanline2::const_iterator& span2, + int x, + unsigned len, + Scanline& sl) const { - enum cover_scale_e - { - cover_shift = CoverShift, - cover_size = 1 << cover_shift, - cover_mask = cover_size - 1, - cover_full = cover_mask - }; - + unsigned cover; + const typename Scanline1::cover_type* covers1; + const typename Scanline2::cover_type* covers2; - void operator () (const typename Scanline1::const_iterator& span1, - const typename Scanline2::const_iterator& span2, - int x, unsigned len, - Scanline& sl) const + // Calculate the operation code and choose the + // proper combination algorithm. + // 0 = Both spans are of AA type + // 1 = span1 is solid, span2 is AA + // 2 = span1 is AA, span2 is solid + // 3 = Both spans are of solid type + //----------------- + switch ((span1->len < 0) | ((span2->len < 0) << 1)) { - unsigned cover; - const typename Scanline1::cover_type* covers1; - const typename Scanline2::cover_type* covers2; - - // Calculate the operation code and choose the - // proper combination algorithm. - // 0 = Both spans are of AA type - // 1 = span1 is solid, span2 is AA - // 2 = span1 is AA, span2 is solid - // 3 = Both spans are of solid type - //----------------- - switch((span1->len < 0) | ((span2->len < 0) << 1)) - { - case 0: // Both are AA spans + case 0: // Both are AA spans covers1 = span1->covers; covers2 = span2->covers; - if(span1->x < x) covers1 += x - span1->x; - if(span2->x < x) covers2 += x - span2->x; + if (span1->x < x) + covers1 += x - span1->x; + if (span2->x < x) + covers2 += x - span2->x; do { cover = *covers1++ * (cover_mask - *covers2++); - if(cover) + if (cover) { - sl.add_cell(x, - (cover == cover_full * cover_full) ? - cover_full : - (cover >> cover_shift)); + sl.add_cell(x, (cover == cover_full * cover_full) ? cover_full : (cover >> cover_shift)); } ++x; - } - while(--len); + } while (--len); break; - case 1: // span1 is solid, span2 is AA + case 1: // span1 is solid, span2 is AA covers2 = span2->covers; - if(span2->x < x) covers2 += x - span2->x; + if (span2->x < x) + covers2 += x - span2->x; do { cover = *(span1->covers) * (cover_mask - *covers2++); - if(cover) + if (cover) { - sl.add_cell(x, - (cover == cover_full * cover_full) ? - cover_full : - (cover >> cover_shift)); + sl.add_cell(x, (cover == cover_full * cover_full) ? cover_full : (cover >> cover_shift)); } ++x; - } - while(--len); + } while (--len); break; - case 2: // span1 is AA, span2 is solid + case 2: // span1 is AA, span2 is solid covers1 = span1->covers; - if(span1->x < x) covers1 += x - span1->x; - if(*(span2->covers) != cover_full) + if (span1->x < x) + covers1 += x - span1->x; + if (*(span2->covers) != cover_full) { do { cover = *covers1++ * (cover_mask - *(span2->covers)); - if(cover) + if (cover) { - sl.add_cell(x, - (cover == cover_full * cover_full) ? - cover_full : - (cover >> cover_shift)); + sl.add_cell(x, (cover == cover_full * cover_full) ? cover_full : (cover >> cover_shift)); } ++x; - } - while(--len); + } while (--len); } break; - case 3: // Both are solid spans + case 3: // Both are solid spans cover = *(span1->covers) * (cover_mask - *(span2->covers)); - if(cover) + if (cover) { - sl.add_span(x, len, - (cover == cover_full * cover_full) ? - cover_full : - (cover >> cover_shift)); + sl.add_span(x, len, (cover == cover_full * cover_full) ? cover_full : (cover >> cover_shift)); } break; - } } - }; - - - - - - - //--------------------------------------------sbool_add_spans_and_render - template - void sbool_add_spans_and_render(const Scanline1& sl1, - Scanline& sl, - Renderer& ren, - AddSpanFunctor add_span) - { - sl.reset_spans(); - typename Scanline1::const_iterator span = sl1.begin(); - unsigned num_spans = sl1.num_spans(); - for(;;) - { - add_span(span, span->x, std::abs((int)span->len), sl); - if(--num_spans == 0) break; - ++span; - } - sl.finalize(sl1.y()); - ren.render(sl); } +}; - - - - - - - //---------------------------------------------sbool_intersect_scanlines - // Intersect two scanlines, "sl1" and "sl2" and generate a new "sl" one. - // The combine_spans functor can be of type sbool_combine_spans_bin or - // sbool_intersect_spans_aa. First is a general functor to combine - // two spans without Anti-Aliasing, the second preserves the AA - // information, but works slower - // - template - void sbool_intersect_scanlines(const Scanline1& sl1, - const Scanline2& sl2, - Scanline& sl, - CombineSpansFunctor combine_spans) +//--------------------------------------------sbool_add_spans_and_render +template +void sbool_add_spans_and_render(const Scanline1& sl1, Scanline& sl, Renderer& ren, AddSpanFunctor add_span) +{ + sl.reset_spans(); + typename Scanline1::const_iterator span = sl1.begin(); + unsigned num_spans = sl1.num_spans(); + for (;;) { - sl.reset_spans(); + add_span(span, span->x, std::abs((int)span->len), sl); + if (--num_spans == 0) + break; + ++span; + } + sl.finalize(sl1.y()); + ren.render(sl); +} - unsigned num1 = sl1.num_spans(); - if(num1 == 0) return; +//---------------------------------------------sbool_intersect_scanlines +// Intersect two scanlines, "sl1" and "sl2" and generate a new "sl" one. +// The combine_spans functor can be of type sbool_combine_spans_bin or +// sbool_intersect_spans_aa. First is a general functor to combine +// two spans without Anti-Aliasing, the second preserves the AA +// information, but works slower +// +template +void sbool_intersect_scanlines(const Scanline1& sl1, + const Scanline2& sl2, + Scanline& sl, + CombineSpansFunctor combine_spans) +{ + sl.reset_spans(); - unsigned num2 = sl2.num_spans(); - if(num2 == 0) return; + unsigned num1 = sl1.num_spans(); + if (num1 == 0) + return; - typename Scanline1::const_iterator span1 = sl1.begin(); - typename Scanline2::const_iterator span2 = sl2.begin(); + unsigned num2 = sl2.num_spans(); + if (num2 == 0) + return; - while(num1 && num2) + typename Scanline1::const_iterator span1 = sl1.begin(); + typename Scanline2::const_iterator span2 = sl2.begin(); + + while (num1 && num2) + { + int xb1 = span1->x; + int xb2 = span2->x; + int xe1 = xb1 + std::abs((int)span1->len) - 1; + int xe2 = xb2 + std::abs((int)span2->len) - 1; + + // Determine what spans we should advance in the next step + // The span with the least ending X should be advanced + // advance_both is just an optimization when we ending + // coordinates are the same and we can advance both + //-------------- + bool advance_span1 = xe1 < xe2; + bool advance_both = xe1 == xe2; + + // Find the intersection of the spans + // and check if they intersect + //-------------- + if (xb1 < xb2) + xb1 = xb2; + if (xe1 > xe2) + xe1 = xe2; + if (xb1 <= xe1) { - int xb1 = span1->x; - int xb2 = span2->x; - int xe1 = xb1 + std::abs((int)span1->len) - 1; - int xe2 = xb2 + std::abs((int)span2->len) - 1; + combine_spans(span1, span2, xb1, xe1 - xb1 + 1, sl); + } - // Determine what spans we should advance in the next step - // The span with the least ending X should be advanced - // advance_both is just an optimization when we ending - // coordinates are the same and we can advance both - //-------------- - bool advance_span1 = xe1 < xe2; - bool advance_both = xe1 == xe2; - - // Find the intersection of the spans - // and check if they intersect - //-------------- - if(xb1 < xb2) xb1 = xb2; - if(xe1 > xe2) xe1 = xe2; - if(xb1 <= xe1) - { - combine_spans(span1, span2, xb1, xe1 - xb1 + 1, sl); - } - - // Advance the spans - //-------------- - if(advance_both) + // Advance the spans + //-------------- + if (advance_both) + { + --num1; + --num2; + if (num1) + ++span1; + if (num2) + ++span2; + } + else + { + if (advance_span1) { --num1; - --num2; - if(num1) ++span1; - if(num2) ++span2; + if (num1) + ++span1; } else { - if(advance_span1) - { - --num1; - if(num1) ++span1; - } - else - { - --num2; - if(num2) ++span2; - } + --num2; + if (num2) + ++span2; } } } +} +//------------------------------------------------sbool_intersect_shapes +// Intersect the scanline shapes. Here the "Scanline Generator" +// abstraction is used. ScanlineGen1 and ScanlineGen2 are +// the generators, and can be of type rasterizer_scanline_aa<>. +// There function requires three scanline containers that can be of +// different types. +// "sl1" and "sl2" are used to retrieve scanlines from the generators, +// "sl" is ised as the resulting scanline to render it. +// The external "sl1" and "sl2" are used only for the sake of +// optimization and reusing of the scanline objects. +// the function calls sbool_intersect_scanlines with CombineSpansFunctor +// as the last argument. See sbool_intersect_scanlines for details. +//---------- +template +void sbool_intersect_shapes(ScanlineGen1& sg1, + ScanlineGen2& sg2, + Scanline1& sl1, + Scanline2& sl2, + Scanline& sl, + Renderer& ren, + CombineSpansFunctor combine_spans) +{ + // Prepare the scanline generators. + // If anyone of them doesn't contain + // any scanlines, then return. + //----------------- + if (!sg1.rewind_scanlines()) + return; + if (!sg2.rewind_scanlines()) + return; + // Get the bounding boxes + //---------------- + rect_i r1(sg1.min_x(), sg1.min_y(), sg1.max_x(), sg1.max_y()); + rect_i r2(sg2.min_x(), sg2.min_y(), sg2.max_x(), sg2.max_y()); + // Calculate the intersection of the bounding + // boxes and return if they don't intersect. + //----------------- + rect_i ir = intersect_rectangles(r1, r2); + if (!ir.is_valid()) + return; + // Reset the scanlines and get two first ones + //----------------- + sl.reset(ir.x1, ir.x2); + sl1.reset(sg1.min_x(), sg1.max_x()); + sl2.reset(sg2.min_x(), sg2.max_x()); + if (!sg1.sweep_scanline(sl1)) + return; + if (!sg2.sweep_scanline(sl2)) + return; + ren.prepare(); - - - //------------------------------------------------sbool_intersect_shapes - // Intersect the scanline shapes. Here the "Scanline Generator" - // abstraction is used. ScanlineGen1 and ScanlineGen2 are - // the generators, and can be of type rasterizer_scanline_aa<>. - // There function requires three scanline containers that can be of - // different types. - // "sl1" and "sl2" are used to retrieve scanlines from the generators, - // "sl" is ised as the resulting scanline to render it. - // The external "sl1" and "sl2" are used only for the sake of - // optimization and reusing of the scanline objects. - // the function calls sbool_intersect_scanlines with CombineSpansFunctor - // as the last argument. See sbool_intersect_scanlines for details. - //---------- - template - void sbool_intersect_shapes(ScanlineGen1& sg1, ScanlineGen2& sg2, - Scanline1& sl1, Scanline2& sl2, - Scanline& sl, Renderer& ren, - CombineSpansFunctor combine_spans) + // The main loop + // Here we synchronize the scanlines with + // the same Y coordinate, ignoring all other ones. + // Only scanlines having the same Y-coordinate + // are to be combined. + //----------------- + for (;;) { - // Prepare the scanline generators. - // If anyone of them doesn't contain - // any scanlines, then return. - //----------------- - if(!sg1.rewind_scanlines()) return; - if(!sg2.rewind_scanlines()) return; - - // Get the bounding boxes - //---------------- - rect_i r1(sg1.min_x(), sg1.min_y(), sg1.max_x(), sg1.max_y()); - rect_i r2(sg2.min_x(), sg2.min_y(), sg2.max_x(), sg2.max_y()); - - // Calculate the intersection of the bounding - // boxes and return if they don't intersect. - //----------------- - rect_i ir = intersect_rectangles(r1, r2); - if(!ir.is_valid()) return; - - // Reset the scanlines and get two first ones - //----------------- - sl.reset(ir.x1, ir.x2); - sl1.reset(sg1.min_x(), sg1.max_x()); - sl2.reset(sg2.min_x(), sg2.max_x()); - if(!sg1.sweep_scanline(sl1)) return; - if(!sg2.sweep_scanline(sl2)) return; - - ren.prepare(); - - // The main loop - // Here we synchronize the scanlines with - // the same Y coordinate, ignoring all other ones. - // Only scanlines having the same Y-coordinate - // are to be combined. - //----------------- - for(;;) + while (sl1.y() < sl2.y()) { - while(sl1.y() < sl2.y()) + if (!sg1.sweep_scanline(sl1)) + return; + } + while (sl2.y() < sl1.y()) + { + if (!sg2.sweep_scanline(sl2)) + return; + } + + if (sl1.y() == sl2.y()) + { + // The Y coordinates are the same. + // Combine the scanlines, render if they contain any spans, + // and advance both generators to the next scanlines + //---------------------- + sbool_intersect_scanlines(sl1, sl2, sl, combine_spans); + if (sl.num_spans()) { - if(!sg1.sweep_scanline(sl1)) return; + sl.finalize(sl1.y()); + ren.render(sl); } - while(sl2.y() < sl1.y()) + if (!sg1.sweep_scanline(sl1)) + return; + if (!sg2.sweep_scanline(sl2)) + return; + } + } +} + +//-------------------------------------------------sbool_unite_scanlines +// Unite two scanlines, "sl1" and "sl2" and generate a new "sl" one. +// The combine_spans functor can be of type sbool_combine_spans_bin or +// sbool_intersect_spans_aa. First is a general functor to combine +// two spans without Anti-Aliasing, the second preserves the AA +// information, but works slower +// +template +void sbool_unite_scanlines(const Scanline1& sl1, + const Scanline2& sl2, + Scanline& sl, + AddSpanFunctor1 add_span1, + AddSpanFunctor2 add_span2, + CombineSpansFunctor combine_spans) +{ + sl.reset_spans(); + + unsigned num1 = sl1.num_spans(); + unsigned num2 = sl2.num_spans(); + + typename Scanline1::const_iterator span1; // = sl1.begin(); + typename Scanline2::const_iterator span2; // = sl2.begin(); + + enum invalidation_e { invalid_b = 0xFFFFFFF, invalid_e = invalid_b - 1 }; + + // Initialize the spans as invalid + //--------------- + int xb1 = invalid_b; + int xb2 = invalid_b; + int xe1 = invalid_e; + int xe2 = invalid_e; + + // Initialize span1 if there are spans + //--------------- + if (num1) + { + span1 = sl1.begin(); + xb1 = span1->x; + xe1 = xb1 + std::abs((int)span1->len) - 1; + --num1; + } + + // Initialize span2 if there are spans + //--------------- + if (num2) + { + span2 = sl2.begin(); + xb2 = span2->x; + xe2 = xb2 + std::abs((int)span2->len) - 1; + --num2; + } + + for (;;) + { + // Retrieve a new span1 if it's invalid + //---------------- + if (num1 && xb1 > xe1) + { + --num1; + ++span1; + xb1 = span1->x; + xe1 = xb1 + std::abs((int)span1->len) - 1; + } + + // Retrieve a new span2 if it's invalid + //---------------- + if (num2 && xb2 > xe2) + { + --num2; + ++span2; + xb2 = span2->x; + xe2 = xb2 + std::abs((int)span2->len) - 1; + } + + if (xb1 > xe1 && xb2 > xe2) + break; + + // Calculate the intersection + //---------------- + int xb = xb1; + int xe = xe1; + if (xb < xb2) + xb = xb2; + if (xe > xe2) + xe = xe2; + int len = xe - xb + 1; // The length of the intersection + if (len > 0) + { + // The spans intersect, + // add the beginning of the span + //---------------- + if (xb1 < xb2) { - if(!sg2.sweep_scanline(sl2)) return; + add_span1(span1, xb1, xb2 - xb1, sl); + xb1 = xb2; + } + else if (xb2 < xb1) + { + add_span2(span2, xb2, xb1 - xb2, sl); + xb2 = xb1; } - if(sl1.y() == sl2.y()) + // Add the combination part of the spans + //---------------- + combine_spans(span1, span2, xb, len, sl); + + // Invalidate the fully processed span or both + //---------------- + if (xe1 < xe2) + { + // Invalidate span1 and eat + // the processed part of span2 + //-------------- + xb1 = invalid_b; + xe1 = invalid_e; + xb2 += len; + } + else if (xe2 < xe1) + { + // Invalidate span2 and eat + // the processed part of span1 + //-------------- + xb2 = invalid_b; + xe2 = invalid_e; + xb1 += len; + } + else + { + xb1 = invalid_b; // Invalidate both + xb2 = invalid_b; + xe1 = invalid_e; + xe2 = invalid_e; + } + } + else + { + // The spans do not intersect + //-------------- + if (xb1 < xb2) + { + // Advance span1 + //--------------- + if (xb1 <= xe1) + { + add_span1(span1, xb1, xe1 - xb1 + 1, sl); + } + xb1 = invalid_b; // Invalidate + xe1 = invalid_e; + } + else + { + // Advance span2 + //--------------- + if (xb2 <= xe2) + { + add_span2(span2, xb2, xe2 - xb2 + 1, sl); + } + xb2 = invalid_b; // Invalidate + xe2 = invalid_e; + } + } + } +} + +//----------------------------------------------------sbool_unite_shapes +// Unite the scanline shapes. Here the "Scanline Generator" +// abstraction is used. ScanlineGen1 and ScanlineGen2 are +// the generators, and can be of type rasterizer_scanline_aa<>. +// There function requires three scanline containers that can be +// of different type. +// "sl1" and "sl2" are used to retrieve scanlines from the generators, +// "sl" is ised as the resulting scanline to render it. +// The external "sl1" and "sl2" are used only for the sake of +// optimization and reusing of the scanline objects. +// the function calls sbool_unite_scanlines with CombineSpansFunctor +// as the last argument. See sbool_unite_scanlines for details. +//---------- +template +void sbool_unite_shapes(ScanlineGen1& sg1, + ScanlineGen2& sg2, + Scanline1& sl1, + Scanline2& sl2, + Scanline& sl, + Renderer& ren, + AddSpanFunctor1 add_span1, + AddSpanFunctor2 add_span2, + CombineSpansFunctor combine_spans) +{ + // Prepare the scanline generators. + // If anyone of them doesn't contain + // any scanlines, then return. + //----------------- + bool flag1 = sg1.rewind_scanlines(); + bool flag2 = sg2.rewind_scanlines(); + if (!flag1 && !flag2) + return; + + // Get the bounding boxes + //---------------- + rect_i r1(sg1.min_x(), sg1.min_y(), sg1.max_x(), sg1.max_y()); + rect_i r2(sg2.min_x(), sg2.min_y(), sg2.max_x(), sg2.max_y()); + + // Calculate the union of the bounding boxes + //----------------- + rect_i ur(1, 1, 0, 0); + if (flag1 && flag2) + ur = unite_rectangles(r1, r2); + else if (flag1) + ur = r1; + else if (flag2) + ur = r2; + + if (!ur.is_valid()) + return; + + ren.prepare(); + + // Reset the scanlines and get two first ones + //----------------- + sl.reset(ur.x1, ur.x2); + if (flag1) + { + sl1.reset(sg1.min_x(), sg1.max_x()); + flag1 = sg1.sweep_scanline(sl1); + } + + if (flag2) + { + sl2.reset(sg2.min_x(), sg2.max_x()); + flag2 = sg2.sweep_scanline(sl2); + } + + // The main loop + // Here we synchronize the scanlines with + // the same Y coordinate. + //----------------- + while (flag1 || flag2) + { + if (flag1 && flag2) + { + if (sl1.y() == sl2.y()) { // The Y coordinates are the same. // Combine the scanlines, render if they contain any spans, // and advance both generators to the next scanlines //---------------------- - sbool_intersect_scanlines(sl1, sl2, sl, combine_spans); - if(sl.num_spans()) + sbool_unite_scanlines(sl1, sl2, sl, add_span1, add_span2, combine_spans); + if (sl.num_spans()) { sl.finalize(sl1.y()); ren.render(sl); } - if(!sg1.sweep_scanline(sl1)) return; - if(!sg2.sweep_scanline(sl2)) return; - } - } - } - - - - - - - - //-------------------------------------------------sbool_unite_scanlines - // Unite two scanlines, "sl1" and "sl2" and generate a new "sl" one. - // The combine_spans functor can be of type sbool_combine_spans_bin or - // sbool_intersect_spans_aa. First is a general functor to combine - // two spans without Anti-Aliasing, the second preserves the AA - // information, but works slower - // - template - void sbool_unite_scanlines(const Scanline1& sl1, - const Scanline2& sl2, - Scanline& sl, - AddSpanFunctor1 add_span1, - AddSpanFunctor2 add_span2, - CombineSpansFunctor combine_spans) - { - sl.reset_spans(); - - unsigned num1 = sl1.num_spans(); - unsigned num2 = sl2.num_spans(); - - typename Scanline1::const_iterator span1;// = sl1.begin(); - typename Scanline2::const_iterator span2;// = sl2.begin(); - - enum invalidation_e - { - invalid_b = 0xFFFFFFF, - invalid_e = invalid_b - 1 - }; - - // Initialize the spans as invalid - //--------------- - int xb1 = invalid_b; - int xb2 = invalid_b; - int xe1 = invalid_e; - int xe2 = invalid_e; - - // Initialize span1 if there are spans - //--------------- - if(num1) - { - span1 = sl1.begin(); - xb1 = span1->x; - xe1 = xb1 + std::abs((int)span1->len) - 1; - --num1; - } - - // Initialize span2 if there are spans - //--------------- - if(num2) - { - span2 = sl2.begin(); - xb2 = span2->x; - xe2 = xb2 + std::abs((int)span2->len) - 1; - --num2; - } - - - for(;;) - { - // Retrieve a new span1 if it's invalid - //---------------- - if(num1 && xb1 > xe1) - { - --num1; - ++span1; - xb1 = span1->x; - xe1 = xb1 + std::abs((int)span1->len) - 1; - } - - // Retrieve a new span2 if it's invalid - //---------------- - if(num2 && xb2 > xe2) - { - --num2; - ++span2; - xb2 = span2->x; - xe2 = xb2 + std::abs((int)span2->len) - 1; - } - - if(xb1 > xe1 && xb2 > xe2) break; - - // Calculate the intersection - //---------------- - int xb = xb1; - int xe = xe1; - if(xb < xb2) xb = xb2; - if(xe > xe2) xe = xe2; - int len = xe - xb + 1; // The length of the intersection - if(len > 0) - { - // The spans intersect, - // add the beginning of the span - //---------------- - if(xb1 < xb2) - { - add_span1(span1, xb1, xb2 - xb1, sl); - xb1 = xb2; - } - else - if(xb2 < xb1) - { - add_span2(span2, xb2, xb1 - xb2, sl); - xb2 = xb1; - } - - // Add the combination part of the spans - //---------------- - combine_spans(span1, span2, xb, len, sl); - - - // Invalidate the fully processed span or both - //---------------- - if(xe1 < xe2) - { - // Invalidate span1 and eat - // the processed part of span2 - //-------------- - xb1 = invalid_b; - xe1 = invalid_e; - xb2 += len; - } - else - if(xe2 < xe1) - { - // Invalidate span2 and eat - // the processed part of span1 - //-------------- - xb2 = invalid_b; - xe2 = invalid_e; - xb1 += len; - } - else - { - xb1 = invalid_b; // Invalidate both - xb2 = invalid_b; - xe1 = invalid_e; - xe2 = invalid_e; - } + flag1 = sg1.sweep_scanline(sl1); + flag2 = sg2.sweep_scanline(sl2); } else { - // The spans do not intersect - //-------------- - if(xb1 < xb2) - { - // Advance span1 - //--------------- - if(xb1 <= xe1) - { - add_span1(span1, xb1, xe1 - xb1 + 1, sl); - } - xb1 = invalid_b; // Invalidate - xe1 = invalid_e; - } - else - { - // Advance span2 - //--------------- - if(xb2 <= xe2) - { - add_span2(span2, xb2, xe2 - xb2 + 1, sl); - } - xb2 = invalid_b; // Invalidate - xe2 = invalid_e; - } - } - } - } - - - - - //----------------------------------------------------sbool_unite_shapes - // Unite the scanline shapes. Here the "Scanline Generator" - // abstraction is used. ScanlineGen1 and ScanlineGen2 are - // the generators, and can be of type rasterizer_scanline_aa<>. - // There function requires three scanline containers that can be - // of different type. - // "sl1" and "sl2" are used to retrieve scanlines from the generators, - // "sl" is ised as the resulting scanline to render it. - // The external "sl1" and "sl2" are used only for the sake of - // optimization and reusing of the scanline objects. - // the function calls sbool_unite_scanlines with CombineSpansFunctor - // as the last argument. See sbool_unite_scanlines for details. - //---------- - template - void sbool_unite_shapes(ScanlineGen1& sg1, ScanlineGen2& sg2, - Scanline1& sl1, Scanline2& sl2, - Scanline& sl, Renderer& ren, - AddSpanFunctor1 add_span1, - AddSpanFunctor2 add_span2, - CombineSpansFunctor combine_spans) - { - // Prepare the scanline generators. - // If anyone of them doesn't contain - // any scanlines, then return. - //----------------- - bool flag1 = sg1.rewind_scanlines(); - bool flag2 = sg2.rewind_scanlines(); - if(!flag1 && !flag2) return; - - // Get the bounding boxes - //---------------- - rect_i r1(sg1.min_x(), sg1.min_y(), sg1.max_x(), sg1.max_y()); - rect_i r2(sg2.min_x(), sg2.min_y(), sg2.max_x(), sg2.max_y()); - - // Calculate the union of the bounding boxes - //----------------- - rect_i ur(1,1,0,0); - if(flag1 && flag2) ur = unite_rectangles(r1, r2); - else if(flag1) ur = r1; - else if(flag2) ur = r2; - - if(!ur.is_valid()) return; - - ren.prepare(); - - // Reset the scanlines and get two first ones - //----------------- - sl.reset(ur.x1, ur.x2); - if(flag1) - { - sl1.reset(sg1.min_x(), sg1.max_x()); - flag1 = sg1.sweep_scanline(sl1); - } - - if(flag2) - { - sl2.reset(sg2.min_x(), sg2.max_x()); - flag2 = sg2.sweep_scanline(sl2); - } - - // The main loop - // Here we synchronize the scanlines with - // the same Y coordinate. - //----------------- - while(flag1 || flag2) - { - if(flag1 && flag2) - { - if(sl1.y() == sl2.y()) - { - // The Y coordinates are the same. - // Combine the scanlines, render if they contain any spans, - // and advance both generators to the next scanlines - //---------------------- - sbool_unite_scanlines(sl1, sl2, sl, - add_span1, add_span2, combine_spans); - if(sl.num_spans()) - { - sl.finalize(sl1.y()); - ren.render(sl); - } - flag1 = sg1.sweep_scanline(sl1); - flag2 = sg2.sweep_scanline(sl2); - } - else - { - if(sl1.y() < sl2.y()) - { - sbool_add_spans_and_render(sl1, sl, ren, add_span1); - flag1 = sg1.sweep_scanline(sl1); - } - else - { - sbool_add_spans_and_render(sl2, sl, ren, add_span2); - flag2 = sg2.sweep_scanline(sl2); - } - } - } - else - { - if(flag1) + if (sl1.y() < sl2.y()) { sbool_add_spans_and_render(sl1, sl, ren, add_span1); flag1 = sg1.sweep_scanline(sl1); } - if(flag2) + else { sbool_add_spans_and_render(sl2, sl, ren, add_span2); flag2 = sg2.sweep_scanline(sl2); } } } - } - - - - - - - - - //-------------------------------------------------sbool_subtract_shapes - // Subtract the scanline shapes, "sg1-sg2". Here the "Scanline Generator" - // abstraction is used. ScanlineGen1 and ScanlineGen2 are - // the generators, and can be of type rasterizer_scanline_aa<>. - // There function requires three scanline containers that can be of - // different types. - // "sl1" and "sl2" are used to retrieve scanlines from the generators, - // "sl" is ised as the resulting scanline to render it. - // The external "sl1" and "sl2" are used only for the sake of - // optimization and reusing of the scanline objects. - // the function calls sbool_intersect_scanlines with CombineSpansFunctor - // as the last argument. See combine_scanlines_sub for details. - //---------- - template - void sbool_subtract_shapes(ScanlineGen1& sg1, ScanlineGen2& sg2, - Scanline1& sl1, Scanline2& sl2, - Scanline& sl, Renderer& ren, - AddSpanFunctor1 add_span1, - CombineSpansFunctor combine_spans) - { - // Prepare the scanline generators. - // Here "sg1" is master, "sg2" is slave. - //----------------- - if(!sg1.rewind_scanlines()) return; - bool flag2 = sg2.rewind_scanlines(); - - // Get the bounding box - //---------------- - rect_i r1(sg1.min_x(), sg1.min_y(), sg1.max_x(), sg1.max_y()); - - // Reset the scanlines and get two first ones - //----------------- - sl.reset(sg1.min_x(), sg1.max_x()); - sl1.reset(sg1.min_x(), sg1.max_x()); - sl2.reset(sg2.min_x(), sg2.max_x()); - if(!sg1.sweep_scanline(sl1)) return; - - if(flag2) flag2 = sg2.sweep_scanline(sl2); - - ren.prepare(); - - // A fake span2 processor - sbool_add_span_empty add_span2; - - // The main loop - // Here we synchronize the scanlines with - // the same Y coordinate, ignoring all other ones. - // Only scanlines having the same Y-coordinate - // are to be combined. - //----------------- - bool flag1 = true; - do + else { - // Synchronize "slave" with "master" - //----------------- - while(flag2 && sl2.y() < sl1.y()) - { - flag2 = sg2.sweep_scanline(sl2); - } - - - if(flag2 && sl2.y() == sl1.y()) - { - // The Y coordinates are the same. - // Combine the scanlines and render if they contain any spans. - //---------------------- - sbool_unite_scanlines(sl1, sl2, sl, add_span1, add_span2, combine_spans); - if(sl.num_spans()) - { - sl.finalize(sl1.y()); - ren.render(sl); - } - } - else + if (flag1) { sbool_add_spans_and_render(sl1, sl, ren, add_span1); + flag1 = sg1.sweep_scanline(sl1); + } + if (flag2) + { + sbool_add_spans_and_render(sl2, sl, ren, add_span2); + flag2 = sg2.sweep_scanline(sl2); } - - // Advance the "master" - flag1 = sg1.sweep_scanline(sl1); - } - while(flag1); - } - - - - - - - - //---------------------------------------------sbool_intersect_shapes_aa - // Intersect two anti-aliased scanline shapes. - // Here the "Scanline Generator" abstraction is used. - // ScanlineGen1 and ScanlineGen2 are the generators, and can be of - // type rasterizer_scanline_aa<>. There function requires three - // scanline containers that can be of different types. - // "sl1" and "sl2" are used to retrieve scanlines from the generators, - // "sl" is ised as the resulting scanline to render it. - // The external "sl1" and "sl2" are used only for the sake of - // optimization and reusing of the scanline objects. - //---------- - template - void sbool_intersect_shapes_aa(ScanlineGen1& sg1, ScanlineGen2& sg2, - Scanline1& sl1, Scanline2& sl2, - Scanline& sl, Renderer& ren) - { - sbool_intersect_spans_aa combine_functor; - sbool_intersect_shapes(sg1, sg2, sl1, sl2, sl, ren, combine_functor); - } - - - - - - //--------------------------------------------sbool_intersect_shapes_bin - // Intersect two binary scanline shapes (without anti-aliasing). - // See intersect_shapes_aa for more comments - //---------- - template - void sbool_intersect_shapes_bin(ScanlineGen1& sg1, ScanlineGen2& sg2, - Scanline1& sl1, Scanline2& sl2, - Scanline& sl, Renderer& ren) - { - sbool_combine_spans_bin combine_functor; - sbool_intersect_shapes(sg1, sg2, sl1, sl2, sl, ren, combine_functor); - } - - - - - - //-------------------------------------------------sbool_unite_shapes_aa - // Unite two anti-aliased scanline shapes - // See intersect_shapes_aa for more comments - //---------- - template - void sbool_unite_shapes_aa(ScanlineGen1& sg1, ScanlineGen2& sg2, - Scanline1& sl1, Scanline2& sl2, - Scanline& sl, Renderer& ren) - { - sbool_add_span_aa add_functor1; - sbool_add_span_aa add_functor2; - sbool_unite_spans_aa combine_functor; - sbool_unite_shapes(sg1, sg2, sl1, sl2, sl, ren, - add_functor1, add_functor2, combine_functor); - } - - - - - - //------------------------------------------------sbool_unite_shapes_bin - // Unite two binary scanline shapes (without anti-aliasing). - // See intersect_shapes_aa for more comments - //---------- - template - void sbool_unite_shapes_bin(ScanlineGen1& sg1, ScanlineGen2& sg2, - Scanline1& sl1, Scanline2& sl2, - Scanline& sl, Renderer& ren) - { - sbool_add_span_bin add_functor1; - sbool_add_span_bin add_functor2; - sbool_combine_spans_bin combine_functor; - sbool_unite_shapes(sg1, sg2, sl1, sl2, sl, ren, - add_functor1, add_functor2, combine_functor); - } - - - - - - - - - - //---------------------------------------------------sbool_xor_shapes_aa - // Apply eXclusive OR to two anti-aliased scanline shapes. There's - // a modified "Linear" XOR used instead of classical "Saddle" one. - // The reason is to have the result absolutely conststent with what - // the scanline rasterizer produces. - // See intersect_shapes_aa for more comments - //---------- - template - void sbool_xor_shapes_aa(ScanlineGen1& sg1, ScanlineGen2& sg2, - Scanline1& sl1, Scanline2& sl2, - Scanline& sl, Renderer& ren) - { - sbool_add_span_aa add_functor1; - sbool_add_span_aa add_functor2; - sbool_xor_spans_aa > combine_functor; - sbool_unite_shapes(sg1, sg2, sl1, sl2, sl, ren, - add_functor1, add_functor2, combine_functor); - } - - - - //------------------------------------------sbool_xor_shapes_saddle_aa - // Apply eXclusive OR to two anti-aliased scanline shapes. - // There's the classical "Saddle" used to calculate the - // Anti-Aliasing values, that is: - // a XOR b : 1-((1-a+a*b)*(1-b+a*b)) - // See intersect_shapes_aa for more comments - //---------- - template - void sbool_xor_shapes_saddle_aa(ScanlineGen1& sg1, ScanlineGen2& sg2, - Scanline1& sl1, Scanline2& sl2, - Scanline& sl, Renderer& ren) - { - sbool_add_span_aa add_functor1; - sbool_add_span_aa add_functor2; - sbool_xor_spans_aa > combine_functor; - sbool_unite_shapes(sg1, sg2, sl1, sl2, sl, ren, - add_functor1, add_functor2, combine_functor); - } - - - //--------------------------------------sbool_xor_shapes_abs_diff_aa - // Apply eXclusive OR to two anti-aliased scanline shapes. - // There's the absolute difference used to calculate - // Anti-Aliasing values, that is: - // a XOR b : std::abs(a-b) - // See intersect_shapes_aa for more comments - //---------- - template - void sbool_xor_shapes_abs_diff_aa(ScanlineGen1& sg1, ScanlineGen2& sg2, - Scanline1& sl1, Scanline2& sl2, - Scanline& sl, Renderer& ren) - { - sbool_add_span_aa add_functor1; - sbool_add_span_aa add_functor2; - sbool_xor_spans_aa combine_functor; - sbool_unite_shapes(sg1, sg2, sl1, sl2, sl, ren, - add_functor1, add_functor2, combine_functor); - } - - - - //--------------------------------------------------sbool_xor_shapes_bin - // Apply eXclusive OR to two binary scanline shapes (without anti-aliasing). - // See intersect_shapes_aa for more comments - //---------- - template - void sbool_xor_shapes_bin(ScanlineGen1& sg1, ScanlineGen2& sg2, - Scanline1& sl1, Scanline2& sl2, - Scanline& sl, Renderer& ren) - { - sbool_add_span_bin add_functor1; - sbool_add_span_bin add_functor2; - sbool_combine_spans_empty combine_functor; - sbool_unite_shapes(sg1, sg2, sl1, sl2, sl, ren, - add_functor1, add_functor2, combine_functor); - } - - - - - - - //----------------------------------------------sbool_subtract_shapes_aa - // Subtract shapes "sg1-sg2" with anti-aliasing - // See intersect_shapes_aa for more comments - //---------- - template - void sbool_subtract_shapes_aa(ScanlineGen1& sg1, ScanlineGen2& sg2, - Scanline1& sl1, Scanline2& sl2, - Scanline& sl, Renderer& ren) - { - sbool_add_span_aa add_functor; - sbool_subtract_spans_aa combine_functor; - sbool_subtract_shapes(sg1, sg2, sl1, sl2, sl, ren, - add_functor, combine_functor); - } - - - - - - //---------------------------------------------sbool_subtract_shapes_bin - // Subtract binary shapes "sg1-sg2" without anti-aliasing - // See intersect_shapes_aa for more comments - //---------- - template - void sbool_subtract_shapes_bin(ScanlineGen1& sg1, ScanlineGen2& sg2, - Scanline1& sl1, Scanline2& sl2, - Scanline& sl, Renderer& ren) - { - sbool_add_span_bin add_functor; - sbool_combine_spans_empty combine_functor; - sbool_subtract_shapes(sg1, sg2, sl1, sl2, sl, ren, - add_functor, combine_functor); - } - - - - - - - //------------------------------------------------------------sbool_op_e - enum sbool_op_e - { - sbool_or, //----sbool_or - sbool_and, //----sbool_and - sbool_xor, //----sbool_xor - sbool_xor_saddle, //----sbool_xor_saddle - sbool_xor_abs_diff, //----sbool_xor_abs_diff - sbool_a_minus_b, //----sbool_a_minus_b - sbool_b_minus_a //----sbool_b_minus_a - }; - - - - - - - //----------------------------------------------sbool_combine_shapes_bin - template - void sbool_combine_shapes_bin(sbool_op_e op, - ScanlineGen1& sg1, ScanlineGen2& sg2, - Scanline1& sl1, Scanline2& sl2, - Scanline& sl, Renderer& ren) - { - switch(op) - { - case sbool_or : sbool_unite_shapes_bin (sg1, sg2, sl1, sl2, sl, ren); break; - case sbool_and : sbool_intersect_shapes_bin(sg1, sg2, sl1, sl2, sl, ren); break; - case sbool_xor : - case sbool_xor_saddle : - case sbool_xor_abs_diff: sbool_xor_shapes_bin (sg1, sg2, sl1, sl2, sl, ren); break; - case sbool_a_minus_b : sbool_subtract_shapes_bin (sg1, sg2, sl1, sl2, sl, ren); break; - case sbool_b_minus_a : sbool_subtract_shapes_bin (sg2, sg1, sl2, sl1, sl, ren); break; } } - - - - - //-----------------------------------------------sbool_combine_shapes_aa - template - void sbool_combine_shapes_aa(sbool_op_e op, - ScanlineGen1& sg1, ScanlineGen2& sg2, - Scanline1& sl1, Scanline2& sl2, - Scanline& sl, Renderer& ren) - { - switch(op) - { - case sbool_or : sbool_unite_shapes_aa (sg1, sg2, sl1, sl2, sl, ren); break; - case sbool_and : sbool_intersect_shapes_aa (sg1, sg2, sl1, sl2, sl, ren); break; - case sbool_xor : sbool_xor_shapes_aa (sg1, sg2, sl1, sl2, sl, ren); break; - case sbool_xor_saddle : sbool_xor_shapes_saddle_aa (sg1, sg2, sl1, sl2, sl, ren); break; - case sbool_xor_abs_diff: sbool_xor_shapes_abs_diff_aa(sg1, sg2, sl1, sl2, sl, ren); break; - case sbool_a_minus_b : sbool_subtract_shapes_aa (sg1, sg2, sl1, sl2, sl, ren); break; - case sbool_b_minus_a : sbool_subtract_shapes_aa (sg2, sg1, sl2, sl1, sl, ren); break; - } - } - } +//-------------------------------------------------sbool_subtract_shapes +// Subtract the scanline shapes, "sg1-sg2". Here the "Scanline Generator" +// abstraction is used. ScanlineGen1 and ScanlineGen2 are +// the generators, and can be of type rasterizer_scanline_aa<>. +// There function requires three scanline containers that can be of +// different types. +// "sl1" and "sl2" are used to retrieve scanlines from the generators, +// "sl" is ised as the resulting scanline to render it. +// The external "sl1" and "sl2" are used only for the sake of +// optimization and reusing of the scanline objects. +// the function calls sbool_intersect_scanlines with CombineSpansFunctor +// as the last argument. See combine_scanlines_sub for details. +//---------- +template +void sbool_subtract_shapes(ScanlineGen1& sg1, + ScanlineGen2& sg2, + Scanline1& sl1, + Scanline2& sl2, + Scanline& sl, + Renderer& ren, + AddSpanFunctor1 add_span1, + CombineSpansFunctor combine_spans) +{ + // Prepare the scanline generators. + // Here "sg1" is master, "sg2" is slave. + //----------------- + if (!sg1.rewind_scanlines()) + return; + bool flag2 = sg2.rewind_scanlines(); + + // Get the bounding box + //---------------- + rect_i r1(sg1.min_x(), sg1.min_y(), sg1.max_x(), sg1.max_y()); + + // Reset the scanlines and get two first ones + //----------------- + sl.reset(sg1.min_x(), sg1.max_x()); + sl1.reset(sg1.min_x(), sg1.max_x()); + sl2.reset(sg2.min_x(), sg2.max_x()); + if (!sg1.sweep_scanline(sl1)) + return; + + if (flag2) + flag2 = sg2.sweep_scanline(sl2); + + ren.prepare(); + + // A fake span2 processor + sbool_add_span_empty add_span2; + + // The main loop + // Here we synchronize the scanlines with + // the same Y coordinate, ignoring all other ones. + // Only scanlines having the same Y-coordinate + // are to be combined. + //----------------- + bool flag1 = true; + do + { + // Synchronize "slave" with "master" + //----------------- + while (flag2 && sl2.y() < sl1.y()) + { + flag2 = sg2.sweep_scanline(sl2); + } + + if (flag2 && sl2.y() == sl1.y()) + { + // The Y coordinates are the same. + // Combine the scanlines and render if they contain any spans. + //---------------------- + sbool_unite_scanlines(sl1, sl2, sl, add_span1, add_span2, combine_spans); + if (sl.num_spans()) + { + sl.finalize(sl1.y()); + ren.render(sl); + } + } + else + { + sbool_add_spans_and_render(sl1, sl, ren, add_span1); + } + + // Advance the "master" + flag1 = sg1.sweep_scanline(sl1); + } while (flag1); +} + +//---------------------------------------------sbool_intersect_shapes_aa +// Intersect two anti-aliased scanline shapes. +// Here the "Scanline Generator" abstraction is used. +// ScanlineGen1 and ScanlineGen2 are the generators, and can be of +// type rasterizer_scanline_aa<>. There function requires three +// scanline containers that can be of different types. +// "sl1" and "sl2" are used to retrieve scanlines from the generators, +// "sl" is ised as the resulting scanline to render it. +// The external "sl1" and "sl2" are used only for the sake of +// optimization and reusing of the scanline objects. +//---------- +template +void sbool_intersect_shapes_aa(ScanlineGen1& sg1, + ScanlineGen2& sg2, + Scanline1& sl1, + Scanline2& sl2, + Scanline& sl, + Renderer& ren) +{ + sbool_intersect_spans_aa combine_functor; + sbool_intersect_shapes(sg1, sg2, sl1, sl2, sl, ren, combine_functor); +} + +//--------------------------------------------sbool_intersect_shapes_bin +// Intersect two binary scanline shapes (without anti-aliasing). +// See intersect_shapes_aa for more comments +//---------- +template +void sbool_intersect_shapes_bin(ScanlineGen1& sg1, + ScanlineGen2& sg2, + Scanline1& sl1, + Scanline2& sl2, + Scanline& sl, + Renderer& ren) +{ + sbool_combine_spans_bin combine_functor; + sbool_intersect_shapes(sg1, sg2, sl1, sl2, sl, ren, combine_functor); +} + +//-------------------------------------------------sbool_unite_shapes_aa +// Unite two anti-aliased scanline shapes +// See intersect_shapes_aa for more comments +//---------- +template +void sbool_unite_shapes_aa(ScanlineGen1& sg1, + ScanlineGen2& sg2, + Scanline1& sl1, + Scanline2& sl2, + Scanline& sl, + Renderer& ren) +{ + sbool_add_span_aa add_functor1; + sbool_add_span_aa add_functor2; + sbool_unite_spans_aa combine_functor; + sbool_unite_shapes(sg1, sg2, sl1, sl2, sl, ren, add_functor1, add_functor2, combine_functor); +} + +//------------------------------------------------sbool_unite_shapes_bin +// Unite two binary scanline shapes (without anti-aliasing). +// See intersect_shapes_aa for more comments +//---------- +template +void sbool_unite_shapes_bin(ScanlineGen1& sg1, + ScanlineGen2& sg2, + Scanline1& sl1, + Scanline2& sl2, + Scanline& sl, + Renderer& ren) +{ + sbool_add_span_bin add_functor1; + sbool_add_span_bin add_functor2; + sbool_combine_spans_bin combine_functor; + sbool_unite_shapes(sg1, sg2, sl1, sl2, sl, ren, add_functor1, add_functor2, combine_functor); +} + +//---------------------------------------------------sbool_xor_shapes_aa +// Apply eXclusive OR to two anti-aliased scanline shapes. There's +// a modified "Linear" XOR used instead of classical "Saddle" one. +// The reason is to have the result absolutely conststent with what +// the scanline rasterizer produces. +// See intersect_shapes_aa for more comments +//---------- +template +void sbool_xor_shapes_aa(ScanlineGen1& sg1, + ScanlineGen2& sg2, + Scanline1& sl1, + Scanline2& sl2, + Scanline& sl, + Renderer& ren) +{ + sbool_add_span_aa add_functor1; + sbool_add_span_aa add_functor2; + sbool_xor_spans_aa> combine_functor; + sbool_unite_shapes(sg1, sg2, sl1, sl2, sl, ren, add_functor1, add_functor2, combine_functor); +} + +//------------------------------------------sbool_xor_shapes_saddle_aa +// Apply eXclusive OR to two anti-aliased scanline shapes. +// There's the classical "Saddle" used to calculate the +// Anti-Aliasing values, that is: +// a XOR b : 1-((1-a+a*b)*(1-b+a*b)) +// See intersect_shapes_aa for more comments +//---------- +template +void sbool_xor_shapes_saddle_aa(ScanlineGen1& sg1, + ScanlineGen2& sg2, + Scanline1& sl1, + Scanline2& sl2, + Scanline& sl, + Renderer& ren) +{ + sbool_add_span_aa add_functor1; + sbool_add_span_aa add_functor2; + sbool_xor_spans_aa> combine_functor; + sbool_unite_shapes(sg1, sg2, sl1, sl2, sl, ren, add_functor1, add_functor2, combine_functor); +} + +//--------------------------------------sbool_xor_shapes_abs_diff_aa +// Apply eXclusive OR to two anti-aliased scanline shapes. +// There's the absolute difference used to calculate +// Anti-Aliasing values, that is: +// a XOR b : std::abs(a-b) +// See intersect_shapes_aa for more comments +//---------- +template +void sbool_xor_shapes_abs_diff_aa(ScanlineGen1& sg1, + ScanlineGen2& sg2, + Scanline1& sl1, + Scanline2& sl2, + Scanline& sl, + Renderer& ren) +{ + sbool_add_span_aa add_functor1; + sbool_add_span_aa add_functor2; + sbool_xor_spans_aa combine_functor; + sbool_unite_shapes(sg1, sg2, sl1, sl2, sl, ren, add_functor1, add_functor2, combine_functor); +} + +//--------------------------------------------------sbool_xor_shapes_bin +// Apply eXclusive OR to two binary scanline shapes (without anti-aliasing). +// See intersect_shapes_aa for more comments +//---------- +template +void sbool_xor_shapes_bin(ScanlineGen1& sg1, + ScanlineGen2& sg2, + Scanline1& sl1, + Scanline2& sl2, + Scanline& sl, + Renderer& ren) +{ + sbool_add_span_bin add_functor1; + sbool_add_span_bin add_functor2; + sbool_combine_spans_empty combine_functor; + sbool_unite_shapes(sg1, sg2, sl1, sl2, sl, ren, add_functor1, add_functor2, combine_functor); +} + +//----------------------------------------------sbool_subtract_shapes_aa +// Subtract shapes "sg1-sg2" with anti-aliasing +// See intersect_shapes_aa for more comments +//---------- +template +void sbool_subtract_shapes_aa(ScanlineGen1& sg1, + ScanlineGen2& sg2, + Scanline1& sl1, + Scanline2& sl2, + Scanline& sl, + Renderer& ren) +{ + sbool_add_span_aa add_functor; + sbool_subtract_spans_aa combine_functor; + sbool_subtract_shapes(sg1, sg2, sl1, sl2, sl, ren, add_functor, combine_functor); +} + +//---------------------------------------------sbool_subtract_shapes_bin +// Subtract binary shapes "sg1-sg2" without anti-aliasing +// See intersect_shapes_aa for more comments +//---------- +template +void sbool_subtract_shapes_bin(ScanlineGen1& sg1, + ScanlineGen2& sg2, + Scanline1& sl1, + Scanline2& sl2, + Scanline& sl, + Renderer& ren) +{ + sbool_add_span_bin add_functor; + sbool_combine_spans_empty combine_functor; + sbool_subtract_shapes(sg1, sg2, sl1, sl2, sl, ren, add_functor, combine_functor); +} + +//------------------------------------------------------------sbool_op_e +enum sbool_op_e { + sbool_or, //----sbool_or + sbool_and, //----sbool_and + sbool_xor, //----sbool_xor + sbool_xor_saddle, //----sbool_xor_saddle + sbool_xor_abs_diff, //----sbool_xor_abs_diff + sbool_a_minus_b, //----sbool_a_minus_b + sbool_b_minus_a //----sbool_b_minus_a +}; + +//----------------------------------------------sbool_combine_shapes_bin +template +void sbool_combine_shapes_bin(sbool_op_e op, + ScanlineGen1& sg1, + ScanlineGen2& sg2, + Scanline1& sl1, + Scanline2& sl2, + Scanline& sl, + Renderer& ren) +{ + switch (op) + { + case sbool_or: + sbool_unite_shapes_bin(sg1, sg2, sl1, sl2, sl, ren); + break; + case sbool_and: + sbool_intersect_shapes_bin(sg1, sg2, sl1, sl2, sl, ren); + break; + case sbool_xor: + case sbool_xor_saddle: + case sbool_xor_abs_diff: + sbool_xor_shapes_bin(sg1, sg2, sl1, sl2, sl, ren); + break; + case sbool_a_minus_b: + sbool_subtract_shapes_bin(sg1, sg2, sl1, sl2, sl, ren); + break; + case sbool_b_minus_a: + sbool_subtract_shapes_bin(sg2, sg1, sl2, sl1, sl, ren); + break; + } +} + +//-----------------------------------------------sbool_combine_shapes_aa +template +void sbool_combine_shapes_aa(sbool_op_e op, + ScanlineGen1& sg1, + ScanlineGen2& sg2, + Scanline1& sl1, + Scanline2& sl2, + Scanline& sl, + Renderer& ren) +{ + switch (op) + { + case sbool_or: + sbool_unite_shapes_aa(sg1, sg2, sl1, sl2, sl, ren); + break; + case sbool_and: + sbool_intersect_shapes_aa(sg1, sg2, sl1, sl2, sl, ren); + break; + case sbool_xor: + sbool_xor_shapes_aa(sg1, sg2, sl1, sl2, sl, ren); + break; + case sbool_xor_saddle: + sbool_xor_shapes_saddle_aa(sg1, sg2, sl1, sl2, sl, ren); + break; + case sbool_xor_abs_diff: + sbool_xor_shapes_abs_diff_aa(sg1, sg2, sl1, sl2, sl, ren); + break; + case sbool_a_minus_b: + sbool_subtract_shapes_aa(sg1, sg2, sl1, sl2, sl, ren); + break; + case sbool_b_minus_a: + sbool_subtract_shapes_aa(sg2, sg1, sl2, sl1, sl, ren); + break; + } +} + +} // namespace agg #endif - diff --git a/deps/agg/include/agg_scanline_p.h b/deps/agg/include/agg_scanline_p.h index 1d1cbe72f..6c9f62b02 100644 --- a/deps/agg/include/agg_scanline_p.h +++ b/deps/agg/include/agg_scanline_p.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -17,313 +17,291 @@ // //---------------------------------------------------------------------------- // -// Adaptation for 32-bit screen coordinates (scanline32_p) has been sponsored by +// Adaptation for 32-bit screen coordinates (scanline32_p) has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. -// +// //---------------------------------------------------------------------------- #ifndef AGG_SCANLINE_P_INCLUDED #define AGG_SCANLINE_P_INCLUDED #include "agg_array.h" -namespace agg +namespace agg { + +//=============================================================scanline_p8 +// +// This is a general purpose scaline container which supports the interface +// used in the rasterizer::render(). See description of scanline_u8 +// for details. +// +//------------------------------------------------------------------------ +class scanline_p8 { + public: + typedef scanline_p8 self_type; + typedef int8u cover_type; + typedef int16 coord_type; - //=============================================================scanline_p8 - // - // This is a general purpose scaline container which supports the interface - // used in the rasterizer::render(). See description of scanline_u8 - // for details. - // - //------------------------------------------------------------------------ - class scanline_p8 + //-------------------------------------------------------------------- + struct span { - public: - typedef scanline_p8 self_type; - typedef int8u cover_type; - typedef int16 coord_type; + coord_type x; + coord_type len; // If negative, it's a solid span, covers is valid + const cover_type* covers; + }; - //-------------------------------------------------------------------- - struct span - { - coord_type x; - coord_type len; // If negative, it's a solid span, covers is valid - const cover_type* covers; - }; - - typedef span* iterator; - typedef const span* const_iterator; - - scanline_p8() : - m_last_x(0x7FFFFFF0), - m_covers(), - m_cover_ptr(0), - m_spans(), - m_cur_span(0) + typedef span* iterator; + typedef const span* const_iterator; + + scanline_p8() + : m_last_x(0x7FFFFFF0) + , m_covers() + , m_cover_ptr(0) + , m_spans() + , m_cur_span(0) + {} + + //-------------------------------------------------------------------- + void reset(int min_x, int max_x) + { + unsigned max_len = max_x - min_x + 3; + if (max_len > m_spans.size()) { + m_spans.resize(max_len); + m_covers.resize(max_len); } + m_last_x = 0x7FFFFFF0; + m_cover_ptr = &m_covers[0]; + m_cur_span = &m_spans[0]; + m_cur_span->len = 0; + } - //-------------------------------------------------------------------- - void reset(int min_x, int max_x) + //-------------------------------------------------------------------- + void add_cell(int x, unsigned cover) + { + *m_cover_ptr = (cover_type)cover; + if (x == m_last_x + 1 && m_cur_span->len > 0) { - unsigned max_len = max_x - min_x + 3; - if(max_len > m_spans.size()) - { - m_spans.resize(max_len); - m_covers.resize(max_len); - } - m_last_x = 0x7FFFFFF0; - m_cover_ptr = &m_covers[0]; - m_cur_span = &m_spans[0]; - m_cur_span->len = 0; + m_cur_span->len++; } + else + { + m_cur_span++; + m_cur_span->covers = m_cover_ptr; + m_cur_span->x = (int16)x; + m_cur_span->len = 1; + } + m_last_x = x; + m_cover_ptr++; + } - //-------------------------------------------------------------------- - void add_cell(int x, unsigned cover) + //-------------------------------------------------------------------- + void add_cells(int x, unsigned len, const cover_type* covers) + { + memcpy(m_cover_ptr, covers, len * sizeof(cover_type)); + if (x == m_last_x + 1 && m_cur_span->len > 0) + { + m_cur_span->len += (int16)len; + } + else + { + m_cur_span++; + m_cur_span->covers = m_cover_ptr; + m_cur_span->x = (int16)x; + m_cur_span->len = (int16)len; + } + m_cover_ptr += len; + m_last_x = x + len - 1; + } + + //-------------------------------------------------------------------- + void add_span(int x, unsigned len, unsigned cover) + { + if (x == m_last_x + 1 && m_cur_span->len < 0 && cover == *m_cur_span->covers) + { + m_cur_span->len -= (int16)len; + } + else { *m_cover_ptr = (cover_type)cover; - if(x == m_last_x+1 && m_cur_span->len > 0) - { - m_cur_span->len++; - } - else - { - m_cur_span++; - m_cur_span->covers = m_cover_ptr; - m_cur_span->x = (int16)x; - m_cur_span->len = 1; - } - m_last_x = x; - m_cover_ptr++; + m_cur_span++; + m_cur_span->covers = m_cover_ptr++; + m_cur_span->x = (int16)x; + m_cur_span->len = (int16)(-int(len)); } + m_last_x = x + len - 1; + } - //-------------------------------------------------------------------- - void add_cells(int x, unsigned len, const cover_type* covers) - { - memcpy(m_cover_ptr, covers, len * sizeof(cover_type)); - if(x == m_last_x+1 && m_cur_span->len > 0) - { - m_cur_span->len += (int16)len; - } - else - { - m_cur_span++; - m_cur_span->covers = m_cover_ptr; - m_cur_span->x = (int16)x; - m_cur_span->len = (int16)len; - } - m_cover_ptr += len; - m_last_x = x + len - 1; - } + //-------------------------------------------------------------------- + void finalize(int y) { m_y = y; } - //-------------------------------------------------------------------- - void add_span(int x, unsigned len, unsigned cover) - { - if(x == m_last_x+1 && - m_cur_span->len < 0 && - cover == *m_cur_span->covers) - { - m_cur_span->len -= (int16)len; - } - else - { - *m_cover_ptr = (cover_type)cover; - m_cur_span++; - m_cur_span->covers = m_cover_ptr++; - m_cur_span->x = (int16)x; - m_cur_span->len = (int16)(-int(len)); - } - m_last_x = x + len - 1; - } + //-------------------------------------------------------------------- + void reset_spans() + { + m_last_x = 0x7FFFFFF0; + m_cover_ptr = &m_covers[0]; + m_cur_span = &m_spans[0]; + m_cur_span->len = 0; + } - //-------------------------------------------------------------------- - void finalize(int y) - { - m_y = y; - } + //-------------------------------------------------------------------- + int y() const { return m_y; } + unsigned num_spans() const { return unsigned(m_cur_span - &m_spans[0]); } + const_iterator begin() const { return &m_spans[1]; } - //-------------------------------------------------------------------- - void reset_spans() - { - m_last_x = 0x7FFFFFF0; - m_cover_ptr = &m_covers[0]; - m_cur_span = &m_spans[0]; - m_cur_span->len = 0; - } + private: + scanline_p8(const self_type&); + const self_type& operator=(const self_type&); - //-------------------------------------------------------------------- - int y() const { return m_y; } - unsigned num_spans() const { return unsigned(m_cur_span - &m_spans[0]); } - const_iterator begin() const { return &m_spans[1]; } + int m_last_x; + int m_y; + pod_array m_covers; + cover_type* m_cover_ptr; + pod_array m_spans; + span* m_cur_span; +}; - private: - scanline_p8(const self_type&); - const self_type& operator = (const self_type&); +//==========================================================scanline32_p8 +class scanline32_p8 +{ + public: + typedef scanline32_p8 self_type; + typedef int8u cover_type; + typedef int32 coord_type; - int m_last_x; - int m_y; - pod_array m_covers; - cover_type* m_cover_ptr; - pod_array m_spans; - span* m_cur_span; + struct span + { + span() {} + span(coord_type x_, coord_type len_, const cover_type* covers_) + : x(x_) + , len(len_) + , covers(covers_) + {} + + coord_type x; + coord_type len; // If negative, it's a solid span, covers is valid + const cover_type* covers; + }; + typedef pod_bvector span_array_type; + + //-------------------------------------------------------------------- + class const_iterator + { + public: + const_iterator(const span_array_type& spans) + : m_spans(spans) + , m_span_idx(0) + {} + + const span& operator*() const { return m_spans[m_span_idx]; } + const span* operator->() const { return &m_spans[m_span_idx]; } + + void operator++() { ++m_span_idx; } + + private: + const span_array_type& m_spans; + unsigned m_span_idx; }; + //-------------------------------------------------------------------- + scanline32_p8() + : m_max_len(0) + , m_last_x(0x7FFFFFF0) + , m_covers() + , m_cover_ptr(0) + {} - - - - - - - //==========================================================scanline32_p8 - class scanline32_p8 + //-------------------------------------------------------------------- + void reset(int min_x, int max_x) { - public: - typedef scanline32_p8 self_type; - typedef int8u cover_type; - typedef int32 coord_type; - - struct span - { - span() {} - span(coord_type x_, coord_type len_, const cover_type* covers_) : - x(x_), len(len_), covers(covers_) {} - - coord_type x; - coord_type len; // If negative, it's a solid span, covers is valid - const cover_type* covers; - }; - typedef pod_bvector span_array_type; - - - //-------------------------------------------------------------------- - class const_iterator - { - public: - const_iterator(const span_array_type& spans) : - m_spans(spans), - m_span_idx(0) - {} - - const span& operator*() const { return m_spans[m_span_idx]; } - const span* operator->() const { return &m_spans[m_span_idx]; } - - void operator ++ () { ++m_span_idx; } - - private: - const span_array_type& m_spans; - unsigned m_span_idx; - }; - - //-------------------------------------------------------------------- - scanline32_p8() : - m_max_len(0), - m_last_x(0x7FFFFFF0), - m_covers(), - m_cover_ptr(0) + unsigned max_len = max_x - min_x + 3; + if (max_len > m_covers.size()) { + m_covers.resize(max_len); } + m_last_x = 0x7FFFFFF0; + m_cover_ptr = &m_covers[0]; + m_spans.remove_all(); + } - //-------------------------------------------------------------------- - void reset(int min_x, int max_x) + //-------------------------------------------------------------------- + void add_cell(int x, unsigned cover) + { + *m_cover_ptr = cover_type(cover); + if (x == m_last_x + 1 && m_spans.size() && m_spans.last().len > 0) { - unsigned max_len = max_x - min_x + 3; - if(max_len > m_covers.size()) - { - m_covers.resize(max_len); - } - m_last_x = 0x7FFFFFF0; - m_cover_ptr = &m_covers[0]; - m_spans.remove_all(); + m_spans.last().len++; } + else + { + m_spans.add(span(coord_type(x), 1, m_cover_ptr)); + } + m_last_x = x; + m_cover_ptr++; + } - //-------------------------------------------------------------------- - void add_cell(int x, unsigned cover) + //-------------------------------------------------------------------- + void add_cells(int x, unsigned len, const cover_type* covers) + { + memcpy(m_cover_ptr, covers, len * sizeof(cover_type)); + if (x == m_last_x + 1 && m_spans.size() && m_spans.last().len > 0) + { + m_spans.last().len += coord_type(len); + } + else + { + m_spans.add(span(coord_type(x), coord_type(len), m_cover_ptr)); + } + m_cover_ptr += len; + m_last_x = x + len - 1; + } + + //-------------------------------------------------------------------- + void add_span(int x, unsigned len, unsigned cover) + { + if (x == m_last_x + 1 && m_spans.size() && m_spans.last().len < 0 && cover == *m_spans.last().covers) + { + m_spans.last().len -= coord_type(len); + } + else { *m_cover_ptr = cover_type(cover); - if(x == m_last_x+1 && m_spans.size() && m_spans.last().len > 0) - { - m_spans.last().len++; - } - else - { - m_spans.add(span(coord_type(x), 1, m_cover_ptr)); - } - m_last_x = x; - m_cover_ptr++; + m_spans.add(span(coord_type(x), -coord_type(len), m_cover_ptr++)); } + m_last_x = x + len - 1; + } - //-------------------------------------------------------------------- - void add_cells(int x, unsigned len, const cover_type* covers) - { - memcpy(m_cover_ptr, covers, len * sizeof(cover_type)); - if(x == m_last_x+1 && m_spans.size() && m_spans.last().len > 0) - { - m_spans.last().len += coord_type(len); - } - else - { - m_spans.add(span(coord_type(x), coord_type(len), m_cover_ptr)); - } - m_cover_ptr += len; - m_last_x = x + len - 1; - } + //-------------------------------------------------------------------- + void finalize(int y) { m_y = y; } - //-------------------------------------------------------------------- - void add_span(int x, unsigned len, unsigned cover) - { - if(x == m_last_x+1 && - m_spans.size() && - m_spans.last().len < 0 && - cover == *m_spans.last().covers) - { - m_spans.last().len -= coord_type(len); - } - else - { - *m_cover_ptr = cover_type(cover); - m_spans.add(span(coord_type(x), -coord_type(len), m_cover_ptr++)); - } - m_last_x = x + len - 1; - } + //-------------------------------------------------------------------- + void reset_spans() + { + m_last_x = 0x7FFFFFF0; + m_cover_ptr = &m_covers[0]; + m_spans.remove_all(); + } - //-------------------------------------------------------------------- - void finalize(int y) - { - m_y = y; - } + //-------------------------------------------------------------------- + int y() const { return m_y; } + unsigned num_spans() const { return m_spans.size(); } + const_iterator begin() const { return const_iterator(m_spans); } - //-------------------------------------------------------------------- - void reset_spans() - { - m_last_x = 0x7FFFFFF0; - m_cover_ptr = &m_covers[0]; - m_spans.remove_all(); - } + private: + scanline32_p8(const self_type&); + const self_type& operator=(const self_type&); - //-------------------------------------------------------------------- - int y() const { return m_y; } - unsigned num_spans() const { return m_spans.size(); } - const_iterator begin() const { return const_iterator(m_spans); } - - private: - scanline32_p8(const self_type&); - const self_type& operator = (const self_type&); - - unsigned m_max_len; - int m_last_x; - int m_y; - pod_array m_covers; - cover_type* m_cover_ptr; - span_array_type m_spans; - }; - - -} + unsigned m_max_len; + int m_last_x; + int m_y; + pod_array m_covers; + cover_type* m_cover_ptr; + span_array_type m_spans; +}; +} // namespace agg #endif - diff --git a/deps/agg/include/agg_scanline_storage_aa.h b/deps/agg/include/agg_scanline_storage_aa.h index 68c1f970b..8afb56ef3 100644 --- a/deps/agg/include/agg_scanline_storage_aa.h +++ b/deps/agg/include/agg_scanline_storage_aa.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -13,12 +13,12 @@ // http://www.antigrain.com //---------------------------------------------------------------------------- // -// Adaptation for 32-bit screen coordinates has been sponsored by +// Adaptation for 32-bit screen coordinates has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. -// +// //---------------------------------------------------------------------------- #ifndef AGG_SCANLINE_STORAGE_AA_INCLUDED @@ -29,595 +29,541 @@ #include #include "agg_array.h" +namespace agg { -namespace agg +//----------------------------------------------scanline_cell_storage +template +class scanline_cell_storage { - - //----------------------------------------------scanline_cell_storage - template class scanline_cell_storage + struct extra_span { - struct extra_span - { - unsigned len; - T* ptr; - }; - - public: - typedef T value_type; - - //--------------------------------------------------------------- - ~scanline_cell_storage() - { - remove_all(); - } - - //--------------------------------------------------------------- - scanline_cell_storage() : - m_cells(128-2), - m_extra_storage() - {} - - - // Copying - //--------------------------------------------------------------- - scanline_cell_storage(const scanline_cell_storage& v) : - m_cells(v.m_cells), - m_extra_storage() - { - copy_extra_storage(v); - } - - //--------------------------------------------------------------- - const scanline_cell_storage& - operator = (const scanline_cell_storage& v) - { - remove_all(); - m_cells = v.m_cells; - copy_extra_storage(v); - return *this; - } - - //--------------------------------------------------------------- - void remove_all() - { - int i; - for(i = m_extra_storage.size()-1; i >= 0; --i) - { - pod_allocator::deallocate(m_extra_storage[i].ptr, - m_extra_storage[i].len); - } - m_extra_storage.remove_all(); - m_cells.remove_all(); - } - - //--------------------------------------------------------------- - int add_cells(const T* cells, unsigned num_cells) - { - int idx = m_cells.allocate_continuous_block(num_cells); - if(idx >= 0) - { - T* ptr = &m_cells[idx]; - memcpy(ptr, cells, sizeof(T) * num_cells); - return idx; - } - extra_span s; - s.len = num_cells; - s.ptr = pod_allocator::allocate(num_cells); - memcpy(s.ptr, cells, sizeof(T) * num_cells); - m_extra_storage.add(s); - return -int(m_extra_storage.size()); - } - - //--------------------------------------------------------------- - const T* operator [] (int idx) const - { - if(idx >= 0) - { - if((unsigned)idx >= m_cells.size()) return 0; - return &m_cells[(unsigned)idx]; - } - unsigned i = unsigned(-idx - 1); - if(i >= m_extra_storage.size()) return 0; - return m_extra_storage[i].ptr; - } - - //--------------------------------------------------------------- - T* operator [] (int idx) - { - if(idx >= 0) - { - if((unsigned)idx >= m_cells.size()) return 0; - return &m_cells[(unsigned)idx]; - } - unsigned i = unsigned(-idx - 1); - if(i >= m_extra_storage.size()) return 0; - return m_extra_storage[i].ptr; - } - - private: - void copy_extra_storage(const scanline_cell_storage& v) - { - unsigned i; - for(i = 0; i < v.m_extra_storage.size(); ++i) - { - const extra_span& src = v.m_extra_storage[i]; - extra_span dst; - dst.len = src.len; - dst.ptr = pod_allocator::allocate(dst.len); - memcpy(dst.ptr, src.ptr, dst.len * sizeof(T)); - m_extra_storage.add(dst); - } - } - - pod_bvector m_cells; - pod_bvector m_extra_storage; + unsigned len; + T* ptr; }; + public: + typedef T value_type; + //--------------------------------------------------------------- + ~scanline_cell_storage() { remove_all(); } + //--------------------------------------------------------------- + scanline_cell_storage() + : m_cells(128 - 2) + , m_extra_storage() + {} - - - //-----------------------------------------------scanline_storage_aa - template class scanline_storage_aa + // Copying + //--------------------------------------------------------------- + scanline_cell_storage(const scanline_cell_storage& v) + : m_cells(v.m_cells) + , m_extra_storage() { - public: - typedef T cover_type; + copy_extra_storage(v); + } - //--------------------------------------------------------------- - struct span_data + //--------------------------------------------------------------- + const scanline_cell_storage& operator=(const scanline_cell_storage& v) + { + remove_all(); + m_cells = v.m_cells; + copy_extra_storage(v); + return *this; + } + + //--------------------------------------------------------------- + void remove_all() + { + int i; + for (i = m_extra_storage.size() - 1; i >= 0; --i) { - int32 x; - int32 len; // If negative, it's a solid span, covers is valid - int covers_id; // The index of the cells in the scanline_cell_storage - }; + pod_allocator::deallocate(m_extra_storage[i].ptr, m_extra_storage[i].len); + } + m_extra_storage.remove_all(); + m_cells.remove_all(); + } - //--------------------------------------------------------------- - struct scanline_data + //--------------------------------------------------------------- + int add_cells(const T* cells, unsigned num_cells) + { + int idx = m_cells.allocate_continuous_block(num_cells); + if (idx >= 0) { - int y; - unsigned num_spans; - unsigned start_span; - }; + T* ptr = &m_cells[idx]; + memcpy(ptr, cells, sizeof(T) * num_cells); + return idx; + } + extra_span s; + s.len = num_cells; + s.ptr = pod_allocator::allocate(num_cells); + memcpy(s.ptr, cells, sizeof(T) * num_cells); + m_extra_storage.add(s); + return -int(m_extra_storage.size()); + } - - //--------------------------------------------------------------- - class embedded_scanline + //--------------------------------------------------------------- + const T* operator[](int idx) const + { + if (idx >= 0) { - public: + if ((unsigned)idx >= m_cells.size()) + return 0; + return &m_cells[(unsigned)idx]; + } + unsigned i = unsigned(-idx - 1); + if (i >= m_extra_storage.size()) + return 0; + return m_extra_storage[i].ptr; + } - //----------------------------------------------------------- - class const_iterator + //--------------------------------------------------------------- + T* operator[](int idx) + { + if (idx >= 0) + { + if ((unsigned)idx >= m_cells.size()) + return 0; + return &m_cells[(unsigned)idx]; + } + unsigned i = unsigned(-idx - 1); + if (i >= m_extra_storage.size()) + return 0; + return m_extra_storage[i].ptr; + } + + private: + void copy_extra_storage(const scanline_cell_storage& v) + { + unsigned i; + for (i = 0; i < v.m_extra_storage.size(); ++i) + { + const extra_span& src = v.m_extra_storage[i]; + extra_span dst; + dst.len = src.len; + dst.ptr = pod_allocator::allocate(dst.len); + memcpy(dst.ptr, src.ptr, dst.len * sizeof(T)); + m_extra_storage.add(dst); + } + } + + pod_bvector m_cells; + pod_bvector m_extra_storage; +}; + +//-----------------------------------------------scanline_storage_aa +template +class scanline_storage_aa +{ + public: + typedef T cover_type; + + //--------------------------------------------------------------- + struct span_data + { + int32 x; + int32 len; // If negative, it's a solid span, covers is valid + int covers_id; // The index of the cells in the scanline_cell_storage + }; + + //--------------------------------------------------------------- + struct scanline_data + { + int y; + unsigned num_spans; + unsigned start_span; + }; + + //--------------------------------------------------------------- + class embedded_scanline + { + public: + + //----------------------------------------------------------- + class const_iterator + { + public: + struct span { - public: - struct span - { - int32 x; - int32 len; // If negative, it's a solid span, covers is valid - const T* covers; - }; - - const_iterator() : m_storage(0) {} - const_iterator(const embedded_scanline& sl) : - m_storage(sl.m_storage), - m_span_idx(sl.m_scanline.start_span) - { - init_span(); - } - - const span& operator*() const { return m_span; } - const span* operator->() const { return &m_span; } - - void operator ++ () - { - ++m_span_idx; - init_span(); - } - - private: - void init_span() - { - const span_data& s = m_storage->span_by_index(m_span_idx); - m_span.x = s.x; - m_span.len = s.len; - m_span.covers = m_storage->covers_by_index(s.covers_id); - } - - const scanline_storage_aa* m_storage; - unsigned m_span_idx; - span m_span; + int32 x; + int32 len; // If negative, it's a solid span, covers is valid + const T* covers; }; - friend class const_iterator; - - - //----------------------------------------------------------- - embedded_scanline(const scanline_storage_aa& storage) : - m_storage(&storage) + const_iterator() + : m_storage(0) + {} + const_iterator(const embedded_scanline& sl) + : m_storage(sl.m_storage) + , m_span_idx(sl.m_scanline.start_span) { - init(0); + init_span(); } - //----------------------------------------------------------- - void reset(int, int) {} - unsigned num_spans() const { return m_scanline.num_spans; } - int y() const { return m_scanline.y; } - const_iterator begin() const { return const_iterator(*this); } + const span& operator*() const { return m_span; } + const span* operator->() const { return &m_span; } - //----------------------------------------------------------- - void init(unsigned scanline_idx) + void operator++() { - m_scanline_idx = scanline_idx; - m_scanline = m_storage->scanline_by_index(m_scanline_idx); + ++m_span_idx; + init_span(); + } + + private: + void init_span() + { + const span_data& s = m_storage->span_by_index(m_span_idx); + m_span.x = s.x; + m_span.len = s.len; + m_span.covers = m_storage->covers_by_index(s.covers_id); } - private: const scanline_storage_aa* m_storage; - scanline_data m_scanline; - unsigned m_scanline_idx; + unsigned m_span_idx; + span m_span; }; + friend class const_iterator; - //--------------------------------------------------------------- - scanline_storage_aa() : - m_covers(), - m_spans(256-2), // Block increment size - m_scanlines(), - m_min_x( 0x7FFFFFFF), - m_min_y( 0x7FFFFFFF), - m_max_x(-0x7FFFFFFF), - m_max_y(-0x7FFFFFFF), - m_cur_scanline(0) + //----------------------------------------------------------- + embedded_scanline(const scanline_storage_aa& storage) + : m_storage(&storage) { - m_fake_scanline.y = 0; - m_fake_scanline.num_spans = 0; - m_fake_scanline.start_span = 0; - m_fake_span.x = 0; - m_fake_span.len = 0; - m_fake_span.covers_id = 0; + init(0); } - // Renderer Interface - //--------------------------------------------------------------- - void prepare() + //----------------------------------------------------------- + void reset(int, int) {} + unsigned num_spans() const { return m_scanline.num_spans; } + int y() const { return m_scanline.y; } + const_iterator begin() const { return const_iterator(*this); } + + //----------------------------------------------------------- + void init(unsigned scanline_idx) { - m_covers.remove_all(); - m_scanlines.remove_all(); - m_spans.remove_all(); - m_min_x = 0x7FFFFFFF; - m_min_y = 0x7FFFFFFF; - m_max_x = -0x7FFFFFFF; - m_max_y = -0x7FFFFFFF; - m_cur_scanline = 0; + m_scanline_idx = scanline_idx; + m_scanline = m_storage->scanline_by_index(m_scanline_idx); } - //--------------------------------------------------------------- - template void render(const Scanline& sl) + private: + const scanline_storage_aa* m_storage; + scanline_data m_scanline; + unsigned m_scanline_idx; + }; + + //--------------------------------------------------------------- + scanline_storage_aa() + : m_covers() + , m_spans(256 - 2) + , // Block increment size + m_scanlines() + , m_min_x(0x7FFFFFFF) + , m_min_y(0x7FFFFFFF) + , m_max_x(-0x7FFFFFFF) + , m_max_y(-0x7FFFFFFF) + , m_cur_scanline(0) + { + m_fake_scanline.y = 0; + m_fake_scanline.num_spans = 0; + m_fake_scanline.start_span = 0; + m_fake_span.x = 0; + m_fake_span.len = 0; + m_fake_span.covers_id = 0; + } + + // Renderer Interface + //--------------------------------------------------------------- + void prepare() + { + m_covers.remove_all(); + m_scanlines.remove_all(); + m_spans.remove_all(); + m_min_x = 0x7FFFFFFF; + m_min_y = 0x7FFFFFFF; + m_max_x = -0x7FFFFFFF; + m_max_y = -0x7FFFFFFF; + m_cur_scanline = 0; + } + + //--------------------------------------------------------------- + template + void render(const Scanline& sl) + { + scanline_data sl_this; + + int y = sl.y(); + if (y < m_min_y) + m_min_y = y; + if (y > m_max_y) + m_max_y = y; + + sl_this.y = y; + sl_this.num_spans = sl.num_spans(); + sl_this.start_span = m_spans.size(); + typename Scanline::const_iterator span_iterator = sl.begin(); + + unsigned num_spans = sl_this.num_spans; + for (;;) { - scanline_data sl_this; + span_data sp; - int y = sl.y(); - if(y < m_min_y) m_min_y = y; - if(y > m_max_y) m_max_y = y; + sp.x = span_iterator->x; + sp.len = span_iterator->len; + int len = std::abs(int(sp.len)); + sp.covers_id = m_covers.add_cells(span_iterator->covers, unsigned(len)); + m_spans.add(sp); + int x1 = sp.x; + int x2 = sp.x + len - 1; + if (x1 < m_min_x) + m_min_x = x1; + if (x2 > m_max_x) + m_max_x = x2; + if (--num_spans == 0) + break; + ++span_iterator; + } + m_scanlines.add(sl_this); + } - sl_this.y = y; - sl_this.num_spans = sl.num_spans(); - sl_this.start_span = m_spans.size(); - typename Scanline::const_iterator span_iterator = sl.begin(); + //--------------------------------------------------------------- + // Iterate scanlines interface + int min_x() const { return m_min_x; } + int min_y() const { return m_min_y; } + int max_x() const { return m_max_x; } + int max_y() const { return m_max_y; } + + //--------------------------------------------------------------- + bool rewind_scanlines() + { + m_cur_scanline = 0; + return m_scanlines.size() > 0; + } + + //--------------------------------------------------------------- + template + bool sweep_scanline(Scanline& sl) + { + sl.reset_spans(); + for (;;) + { + if (m_cur_scanline >= m_scanlines.size()) + return false; + const scanline_data& sl_this = m_scanlines[m_cur_scanline]; unsigned num_spans = sl_this.num_spans; - for(;;) - { - span_data sp; - - sp.x = span_iterator->x; - sp.len = span_iterator->len; - int len = std::abs(int(sp.len)); - sp.covers_id = - m_covers.add_cells(span_iterator->covers, - unsigned(len)); - m_spans.add(sp); - int x1 = sp.x; - int x2 = sp.x + len - 1; - if(x1 < m_min_x) m_min_x = x1; - if(x2 > m_max_x) m_max_x = x2; - if(--num_spans == 0) break; - ++span_iterator; - } - m_scanlines.add(sl_this); - } - - - //--------------------------------------------------------------- - // Iterate scanlines interface - int min_x() const { return m_min_x; } - int min_y() const { return m_min_y; } - int max_x() const { return m_max_x; } - int max_y() const { return m_max_y; } - - //--------------------------------------------------------------- - bool rewind_scanlines() - { - m_cur_scanline = 0; - return m_scanlines.size() > 0; - } - - - //--------------------------------------------------------------- - template bool sweep_scanline(Scanline& sl) - { - sl.reset_spans(); - for(;;) - { - if(m_cur_scanline >= m_scanlines.size()) return false; - const scanline_data& sl_this = m_scanlines[m_cur_scanline]; - - unsigned num_spans = sl_this.num_spans; - unsigned span_idx = sl_this.start_span; - do - { - const span_data& sp = m_spans[span_idx++]; - const T* covers = covers_by_index(sp.covers_id); - if(sp.len < 0) - { - sl.add_span(sp.x, unsigned(-sp.len), *covers); - } - else - { - sl.add_cells(sp.x, sp.len, covers); - } - } - while(--num_spans); - ++m_cur_scanline; - if(sl.num_spans()) - { - sl.finalize(sl_this.y); - break; - } - } - return true; - } - - - //--------------------------------------------------------------- - // Specialization for embedded_scanline - bool sweep_scanline(embedded_scanline& sl) - { + unsigned span_idx = sl_this.start_span; do { - if(m_cur_scanline >= m_scanlines.size()) return false; - sl.init(m_cur_scanline); - ++m_cur_scanline; - } - while(sl.num_spans() == 0); - return true; - } - - //--------------------------------------------------------------- - unsigned byte_size() const - { - unsigned i; - unsigned size = sizeof(int32) * 4; // min_x, min_y, max_x, max_y - - for(i = 0; i < m_scanlines.size(); ++i) - { - size += sizeof(int32) * 3; // scanline size in bytes, Y, num_spans - - const scanline_data& sl_this = m_scanlines[i]; - - unsigned num_spans = sl_this.num_spans; - unsigned span_idx = sl_this.start_span; - do + const span_data& sp = m_spans[span_idx++]; + const T* covers = covers_by_index(sp.covers_id); + if (sp.len < 0) { - const span_data& sp = m_spans[span_idx++]; - - size += sizeof(int32) * 2; // X, span_len - if(sp.len < 0) - { - size += sizeof(T); // cover - } - else - { - size += sizeof(T) * unsigned(sp.len); // covers - } + sl.add_span(sp.x, unsigned(-sp.len), *covers); } - while(--num_spans); - } - return size; - } - - - //--------------------------------------------------------------- - static void write_int32(int8u* dst, int32 val) - { - dst[0] = ((const int8u*)&val)[0]; - dst[1] = ((const int8u*)&val)[1]; - dst[2] = ((const int8u*)&val)[2]; - dst[3] = ((const int8u*)&val)[3]; - } - - - //--------------------------------------------------------------- - void serialize(int8u* data) const - { - unsigned i; - - write_int32(data, min_x()); // min_x - data += sizeof(int32); - write_int32(data, min_y()); // min_y - data += sizeof(int32); - write_int32(data, max_x()); // max_x - data += sizeof(int32); - write_int32(data, max_y()); // max_y - data += sizeof(int32); - - for(i = 0; i < m_scanlines.size(); ++i) - { - const scanline_data& sl_this = m_scanlines[i]; - - int8u* size_ptr = data; - data += sizeof(int32); // Reserve space for scanline size in bytes - - write_int32(data, sl_this.y); // Y - data += sizeof(int32); - - write_int32(data, sl_this.num_spans); // num_spans - data += sizeof(int32); - - unsigned num_spans = sl_this.num_spans; - unsigned span_idx = sl_this.start_span; - do + else { - const span_data& sp = m_spans[span_idx++]; - const T* covers = covers_by_index(sp.covers_id); - - write_int32(data, sp.x); // X - data += sizeof(int32); - - write_int32(data, sp.len); // span_len - data += sizeof(int32); - - if(sp.len < 0) - { - memcpy(data, covers, sizeof(T)); - data += sizeof(T); - } - else - { - memcpy(data, covers, unsigned(sp.len) * sizeof(T)); - data += sizeof(T) * unsigned(sp.len); - } + sl.add_cells(sp.x, sp.len, covers); } - while(--num_spans); - write_int32(size_ptr, int32(unsigned(data - size_ptr))); + } while (--num_spans); + ++m_cur_scanline; + if (sl.num_spans()) + { + sl.finalize(sl_this.y); + break; } } + return true; + } - - //--------------------------------------------------------------- - const scanline_data& scanline_by_index(unsigned i) const - { - return (i < m_scanlines.size()) ? m_scanlines[i] : m_fake_scanline; - } - - //--------------------------------------------------------------- - const span_data& span_by_index(unsigned i) const - { - return (i < m_spans.size()) ? m_spans[i] : m_fake_span; - } - - //--------------------------------------------------------------- - const T* covers_by_index(int i) const - { - return m_covers[i]; - } - - private: - scanline_cell_storage m_covers; - pod_bvector m_spans; - pod_bvector m_scanlines; - span_data m_fake_span; - scanline_data m_fake_scanline; - int m_min_x; - int m_min_y; - int m_max_x; - int m_max_y; - unsigned m_cur_scanline; - }; - - - typedef scanline_storage_aa scanline_storage_aa8; //--------scanline_storage_aa8 - typedef scanline_storage_aa scanline_storage_aa16; //--------scanline_storage_aa16 - typedef scanline_storage_aa scanline_storage_aa32; //--------scanline_storage_aa32 - - - - - //------------------------------------------serialized_scanlines_adaptor_aa - template class serialized_scanlines_adaptor_aa + //--------------------------------------------------------------- + // Specialization for embedded_scanline + bool sweep_scanline(embedded_scanline& sl) { - public: + do + { + if (m_cur_scanline >= m_scanlines.size()) + return false; + sl.init(m_cur_scanline); + ++m_cur_scanline; + } while (sl.num_spans() == 0); + return true; + } + + //--------------------------------------------------------------- + unsigned byte_size() const + { + unsigned i; + unsigned size = sizeof(int32) * 4; // min_x, min_y, max_x, max_y + + for (i = 0; i < m_scanlines.size(); ++i) + { + size += sizeof(int32) * 3; // scanline size in bytes, Y, num_spans + + const scanline_data& sl_this = m_scanlines[i]; + + unsigned num_spans = sl_this.num_spans; + unsigned span_idx = sl_this.start_span; + do + { + const span_data& sp = m_spans[span_idx++]; + + size += sizeof(int32) * 2; // X, span_len + if (sp.len < 0) + { + size += sizeof(T); // cover + } + else + { + size += sizeof(T) * unsigned(sp.len); // covers + } + } while (--num_spans); + } + return size; + } + + //--------------------------------------------------------------- + static void write_int32(int8u* dst, int32 val) + { + dst[0] = ((const int8u*)&val)[0]; + dst[1] = ((const int8u*)&val)[1]; + dst[2] = ((const int8u*)&val)[2]; + dst[3] = ((const int8u*)&val)[3]; + } + + //--------------------------------------------------------------- + void serialize(int8u* data) const + { + unsigned i; + + write_int32(data, min_x()); // min_x + data += sizeof(int32); + write_int32(data, min_y()); // min_y + data += sizeof(int32); + write_int32(data, max_x()); // max_x + data += sizeof(int32); + write_int32(data, max_y()); // max_y + data += sizeof(int32); + + for (i = 0; i < m_scanlines.size(); ++i) + { + const scanline_data& sl_this = m_scanlines[i]; + + int8u* size_ptr = data; + data += sizeof(int32); // Reserve space for scanline size in bytes + + write_int32(data, sl_this.y); // Y + data += sizeof(int32); + + write_int32(data, sl_this.num_spans); // num_spans + data += sizeof(int32); + + unsigned num_spans = sl_this.num_spans; + unsigned span_idx = sl_this.start_span; + do + { + const span_data& sp = m_spans[span_idx++]; + const T* covers = covers_by_index(sp.covers_id); + + write_int32(data, sp.x); // X + data += sizeof(int32); + + write_int32(data, sp.len); // span_len + data += sizeof(int32); + + if (sp.len < 0) + { + memcpy(data, covers, sizeof(T)); + data += sizeof(T); + } + else + { + memcpy(data, covers, unsigned(sp.len) * sizeof(T)); + data += sizeof(T) * unsigned(sp.len); + } + } while (--num_spans); + write_int32(size_ptr, int32(unsigned(data - size_ptr))); + } + } + + //--------------------------------------------------------------- + const scanline_data& scanline_by_index(unsigned i) const + { + return (i < m_scanlines.size()) ? m_scanlines[i] : m_fake_scanline; + } + + //--------------------------------------------------------------- + const span_data& span_by_index(unsigned i) const { return (i < m_spans.size()) ? m_spans[i] : m_fake_span; } + + //--------------------------------------------------------------- + const T* covers_by_index(int i) const { return m_covers[i]; } + + private: + scanline_cell_storage m_covers; + pod_bvector m_spans; + pod_bvector m_scanlines; + span_data m_fake_span; + scanline_data m_fake_scanline; + int m_min_x; + int m_min_y; + int m_max_x; + int m_max_y; + unsigned m_cur_scanline; +}; + +typedef scanline_storage_aa scanline_storage_aa8; //--------scanline_storage_aa8 +typedef scanline_storage_aa scanline_storage_aa16; //--------scanline_storage_aa16 +typedef scanline_storage_aa scanline_storage_aa32; //--------scanline_storage_aa32 + +//------------------------------------------serialized_scanlines_adaptor_aa +template +class serialized_scanlines_adaptor_aa +{ + public: + typedef T cover_type; + + //--------------------------------------------------------------------- + class embedded_scanline + { + public: typedef T cover_type; - //--------------------------------------------------------------------- - class embedded_scanline + //----------------------------------------------------------------- + class const_iterator { - public: - typedef T cover_type; - - //----------------------------------------------------------------- - class const_iterator + public: + struct span { - public: - struct span - { - int32 x; - int32 len; // If negative, it's a solid span, "covers" is valid - const T* covers; - }; - - const_iterator() : m_ptr(0) {} - const_iterator(const embedded_scanline& sl) : - m_ptr(sl.m_ptr), - m_dx(sl.m_dx) - { - init_span(); - } - - const span& operator*() const { return m_span; } - const span* operator->() const { return &m_span; } - - void operator ++ () - { - if(m_span.len < 0) - { - m_ptr += sizeof(T); - } - else - { - m_ptr += m_span.len * sizeof(T); - } - init_span(); - } - - private: - int read_int32() - { - int32 val; - ((int8u*)&val)[0] = *m_ptr++; - ((int8u*)&val)[1] = *m_ptr++; - ((int8u*)&val)[2] = *m_ptr++; - ((int8u*)&val)[3] = *m_ptr++; - return val; - } - - void init_span() - { - m_span.x = read_int32() + m_dx; - m_span.len = read_int32(); - m_span.covers = m_ptr; - } - - const int8u* m_ptr; - span m_span; - int m_dx; + int32 x; + int32 len; // If negative, it's a solid span, "covers" is valid + const T* covers; }; - friend class const_iterator; + const_iterator() + : m_ptr(0) + {} + const_iterator(const embedded_scanline& sl) + : m_ptr(sl.m_ptr) + , m_dx(sl.m_dx) + { + init_span(); + } + const span& operator*() const { return m_span; } + const span* operator->() const { return &m_span; } - //----------------------------------------------------------------- - embedded_scanline() : m_ptr(0), m_y(0), m_num_spans(0) {} + void operator++() + { + if (m_span.len < 0) + { + m_ptr += sizeof(T); + } + else + { + m_ptr += m_span.len * sizeof(T); + } + init_span(); + } - //----------------------------------------------------------------- - void reset(int, int) {} - unsigned num_spans() const { return m_num_spans; } - int y() const { return m_y; } - const_iterator begin() const { return const_iterator(*this); } - - - private: - //----------------------------------------------------------------- + private: int read_int32() { int32 val; @@ -628,69 +574,35 @@ namespace agg return val; } - public: - //----------------------------------------------------------------- - void init(const int8u* ptr, int dx, int dy) + void init_span() { - m_ptr = ptr; - m_y = read_int32() + dy; - m_num_spans = unsigned(read_int32()); - m_dx = dx; + m_span.x = read_int32() + m_dx; + m_span.len = read_int32(); + m_span.covers = m_ptr; } - private: const int8u* m_ptr; - int m_y; - unsigned m_num_spans; - int m_dx; + span m_span; + int m_dx; }; + friend class const_iterator; - - public: - //-------------------------------------------------------------------- - serialized_scanlines_adaptor_aa() : - m_data(0), - m_end(0), - m_ptr(0), - m_dx(0), - m_dy(0), - m_min_x(0x7FFFFFFF), - m_min_y(0x7FFFFFFF), - m_max_x(-0x7FFFFFFF), - m_max_y(-0x7FFFFFFF) + //----------------------------------------------------------------- + embedded_scanline() + : m_ptr(0) + , m_y(0) + , m_num_spans(0) {} - //-------------------------------------------------------------------- - serialized_scanlines_adaptor_aa(const int8u* data, unsigned size, - double dx, double dy) : - m_data(data), - m_end(data + size), - m_ptr(data), - m_dx(iround(dx)), - m_dy(iround(dy)), - m_min_x(0x7FFFFFFF), - m_min_y(0x7FFFFFFF), - m_max_x(-0x7FFFFFFF), - m_max_y(-0x7FFFFFFF) - {} + //----------------------------------------------------------------- + void reset(int, int) {} + unsigned num_spans() const { return m_num_spans; } + int y() const { return m_y; } + const_iterator begin() const { return const_iterator(*this); } - //-------------------------------------------------------------------- - void init(const int8u* data, unsigned size, double dx, double dy) - { - m_data = data; - m_end = data + size; - m_ptr = data; - m_dx = iround(dx); - m_dy = iround(dy); - m_min_x = 0x7FFFFFFF; - m_min_y = 0x7FFFFFFF; - m_max_x = -0x7FFFFFFF; - m_max_y = -0x7FFFFFFF; - } - - private: - //-------------------------------------------------------------------- + private: + //----------------------------------------------------------------- int read_int32() { int32 val; @@ -701,115 +613,183 @@ namespace agg return val; } - //-------------------------------------------------------------------- - unsigned read_int32u() + public: + //----------------------------------------------------------------- + void init(const int8u* ptr, int dx, int dy) { - int32u val; - ((int8u*)&val)[0] = *m_ptr++; - ((int8u*)&val)[1] = *m_ptr++; - ((int8u*)&val)[2] = *m_ptr++; - ((int8u*)&val)[3] = *m_ptr++; - return val; - } - - public: - // Iterate scanlines interface - //-------------------------------------------------------------------- - bool rewind_scanlines() - { - m_ptr = m_data; - if(m_ptr < m_end) - { - m_min_x = read_int32() + m_dx; - m_min_y = read_int32() + m_dy; - m_max_x = read_int32() + m_dx; - m_max_y = read_int32() + m_dy; - } - return m_ptr < m_end; + m_ptr = ptr; + m_y = read_int32() + dy; + m_num_spans = unsigned(read_int32()); + m_dx = dx; } - //-------------------------------------------------------------------- - int min_x() const { return m_min_x; } - int min_y() const { return m_min_y; } - int max_x() const { return m_max_x; } - int max_y() const { return m_max_y; } - - //-------------------------------------------------------------------- - template bool sweep_scanline(Scanline& sl) - { - sl.reset_spans(); - for(;;) - { - if(m_ptr >= m_end) return false; - - read_int32(); // Skip scanline size in bytes - int y = read_int32() + m_dy; - unsigned num_spans = read_int32(); - - do - { - int x = read_int32() + m_dx; - int len = read_int32(); - - if(len < 0) - { - sl.add_span(x, unsigned(-len), *m_ptr); - m_ptr += sizeof(T); - } - else - { - sl.add_cells(x, len, m_ptr); - m_ptr += len * sizeof(T); - } - } - while(--num_spans); - - if(sl.num_spans()) - { - sl.finalize(y); - break; - } - } - return true; - } - - - //-------------------------------------------------------------------- - // Specialization for embedded_scanline - bool sweep_scanline(embedded_scanline& sl) - { - do - { - if(m_ptr >= m_end) return false; - - unsigned byte_size = read_int32u(); - sl.init(m_ptr, m_dx, m_dy); - m_ptr += byte_size - sizeof(int32); - } - while(sl.num_spans() == 0); - return true; - } - - private: - const int8u* m_data; - const int8u* m_end; + private: const int8u* m_ptr; - int m_dx; - int m_dy; - int m_min_x; - int m_min_y; - int m_max_x; - int m_max_y; + int m_y; + unsigned m_num_spans; + int m_dx; }; + public: + //-------------------------------------------------------------------- + serialized_scanlines_adaptor_aa() + : m_data(0) + , m_end(0) + , m_ptr(0) + , m_dx(0) + , m_dy(0) + , m_min_x(0x7FFFFFFF) + , m_min_y(0x7FFFFFFF) + , m_max_x(-0x7FFFFFFF) + , m_max_y(-0x7FFFFFFF) + {} + //-------------------------------------------------------------------- + serialized_scanlines_adaptor_aa(const int8u* data, unsigned size, double dx, double dy) + : m_data(data) + , m_end(data + size) + , m_ptr(data) + , m_dx(iround(dx)) + , m_dy(iround(dy)) + , m_min_x(0x7FFFFFFF) + , m_min_y(0x7FFFFFFF) + , m_max_x(-0x7FFFFFFF) + , m_max_y(-0x7FFFFFFF) + {} - typedef serialized_scanlines_adaptor_aa serialized_scanlines_adaptor_aa8; //----serialized_scanlines_adaptor_aa8 - typedef serialized_scanlines_adaptor_aa serialized_scanlines_adaptor_aa16; //----serialized_scanlines_adaptor_aa16 - typedef serialized_scanlines_adaptor_aa serialized_scanlines_adaptor_aa32; //----serialized_scanlines_adaptor_aa32 + //-------------------------------------------------------------------- + void init(const int8u* data, unsigned size, double dx, double dy) + { + m_data = data; + m_end = data + size; + m_ptr = data; + m_dx = iround(dx); + m_dy = iround(dy); + m_min_x = 0x7FFFFFFF; + m_min_y = 0x7FFFFFFF; + m_max_x = -0x7FFFFFFF; + m_max_y = -0x7FFFFFFF; + } -} + private: + //-------------------------------------------------------------------- + int read_int32() + { + int32 val; + ((int8u*)&val)[0] = *m_ptr++; + ((int8u*)&val)[1] = *m_ptr++; + ((int8u*)&val)[2] = *m_ptr++; + ((int8u*)&val)[3] = *m_ptr++; + return val; + } + //-------------------------------------------------------------------- + unsigned read_int32u() + { + int32u val; + ((int8u*)&val)[0] = *m_ptr++; + ((int8u*)&val)[1] = *m_ptr++; + ((int8u*)&val)[2] = *m_ptr++; + ((int8u*)&val)[3] = *m_ptr++; + return val; + } + + public: + // Iterate scanlines interface + //-------------------------------------------------------------------- + bool rewind_scanlines() + { + m_ptr = m_data; + if (m_ptr < m_end) + { + m_min_x = read_int32() + m_dx; + m_min_y = read_int32() + m_dy; + m_max_x = read_int32() + m_dx; + m_max_y = read_int32() + m_dy; + } + return m_ptr < m_end; + } + + //-------------------------------------------------------------------- + int min_x() const { return m_min_x; } + int min_y() const { return m_min_y; } + int max_x() const { return m_max_x; } + int max_y() const { return m_max_y; } + + //-------------------------------------------------------------------- + template + bool sweep_scanline(Scanline& sl) + { + sl.reset_spans(); + for (;;) + { + if (m_ptr >= m_end) + return false; + + read_int32(); // Skip scanline size in bytes + int y = read_int32() + m_dy; + unsigned num_spans = read_int32(); + + do + { + int x = read_int32() + m_dx; + int len = read_int32(); + + if (len < 0) + { + sl.add_span(x, unsigned(-len), *m_ptr); + m_ptr += sizeof(T); + } + else + { + sl.add_cells(x, len, m_ptr); + m_ptr += len * sizeof(T); + } + } while (--num_spans); + + if (sl.num_spans()) + { + sl.finalize(y); + break; + } + } + return true; + } + + //-------------------------------------------------------------------- + // Specialization for embedded_scanline + bool sweep_scanline(embedded_scanline& sl) + { + do + { + if (m_ptr >= m_end) + return false; + + unsigned byte_size = read_int32u(); + sl.init(m_ptr, m_dx, m_dy); + m_ptr += byte_size - sizeof(int32); + } while (sl.num_spans() == 0); + return true; + } + + private: + const int8u* m_data; + const int8u* m_end; + const int8u* m_ptr; + int m_dx; + int m_dy; + int m_min_x; + int m_min_y; + int m_max_x; + int m_max_y; +}; + +typedef serialized_scanlines_adaptor_aa serialized_scanlines_adaptor_aa8; //----serialized_scanlines_adaptor_aa8 +typedef serialized_scanlines_adaptor_aa + serialized_scanlines_adaptor_aa16; //----serialized_scanlines_adaptor_aa16 +typedef serialized_scanlines_adaptor_aa + serialized_scanlines_adaptor_aa32; //----serialized_scanlines_adaptor_aa32 + +} // namespace agg #endif - diff --git a/deps/agg/include/agg_scanline_storage_bin.h b/deps/agg/include/agg_scanline_storage_bin.h index 88589a785..1c7e9aebf 100644 --- a/deps/agg/include/agg_scanline_storage_bin.h +++ b/deps/agg/include/agg_scanline_storage_bin.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -13,15 +13,14 @@ // http://www.antigrain.com //---------------------------------------------------------------------------- // -// Adaptation for 32-bit screen coordinates has been sponsored by +// Adaptation for 32-bit screen coordinates has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. -// +// //---------------------------------------------------------------------------- - #ifndef AGG_SCANLINE_STORAGE_BIN_INCLUDED #define AGG_SCANLINE_STORAGE_BIN_INCLUDED @@ -30,386 +29,339 @@ #include #include "agg_array.h" +namespace agg { -namespace agg +//-----------------------------------------------scanline_storage_bin +class scanline_storage_bin { - - //-----------------------------------------------scanline_storage_bin - class scanline_storage_bin + public: + //--------------------------------------------------------------- + struct span_data { - public: - //--------------------------------------------------------------- - struct span_data - { - int32 x; - int32 len; - }; - - //--------------------------------------------------------------- - struct scanline_data - { - int y; - unsigned num_spans; - unsigned start_span; - }; - - - //--------------------------------------------------------------- - class embedded_scanline - { - public: - - //----------------------------------------------------------- - class const_iterator - { - public: - const_iterator() : m_storage(0) {} - const_iterator(const embedded_scanline& sl) : - m_storage(sl.m_storage), - m_span_idx(sl.m_scanline.start_span) - { - m_span = m_storage->span_by_index(m_span_idx); - } - - const span_data& operator*() const { return m_span; } - const span_data* operator->() const { return &m_span; } - - void operator ++ () - { - ++m_span_idx; - m_span = m_storage->span_by_index(m_span_idx); - } - - private: - const scanline_storage_bin* m_storage; - unsigned m_span_idx; - span_data m_span; - }; - - friend class const_iterator; - - - //----------------------------------------------------------- - embedded_scanline(const scanline_storage_bin& storage) : - m_storage(&storage) - { - setup(0); - } - - //----------------------------------------------------------- - void reset(int, int) {} - unsigned num_spans() const { return m_scanline.num_spans; } - int y() const { return m_scanline.y; } - const_iterator begin() const { return const_iterator(*this); } - - //----------------------------------------------------------- - void setup(unsigned scanline_idx) - { - m_scanline_idx = scanline_idx; - m_scanline = m_storage->scanline_by_index(m_scanline_idx); - } - - private: - const scanline_storage_bin* m_storage; - scanline_data m_scanline; - unsigned m_scanline_idx; - }; - - - //--------------------------------------------------------------- - scanline_storage_bin() : - m_spans(256-2), // Block increment size - m_scanlines(), - m_min_x( 0x7FFFFFFF), - m_min_y( 0x7FFFFFFF), - m_max_x(-0x7FFFFFFF), - m_max_y(-0x7FFFFFFF), - m_cur_scanline(0) - { - m_fake_scanline.y = 0; - m_fake_scanline.num_spans = 0; - m_fake_scanline.start_span = 0; - m_fake_span.x = 0; - m_fake_span.len = 0; - } - - // Renderer Interface - //--------------------------------------------------------------- - void prepare() - { - m_scanlines.remove_all(); - m_spans.remove_all(); - m_min_x = 0x7FFFFFFF; - m_min_y = 0x7FFFFFFF; - m_max_x = -0x7FFFFFFF; - m_max_y = -0x7FFFFFFF; - m_cur_scanline = 0; - } - - //--------------------------------------------------------------- - template void render(const Scanline& sl) - { - scanline_data sl_this; - - int y = sl.y(); - if(y < m_min_y) m_min_y = y; - if(y > m_max_y) m_max_y = y; - - sl_this.y = y; - sl_this.num_spans = sl.num_spans(); - sl_this.start_span = m_spans.size(); - typename Scanline::const_iterator span_iterator = sl.begin(); - - unsigned num_spans = sl_this.num_spans; - for(;;) - { - span_data sp; - sp.x = span_iterator->x; - sp.len = (int32)abs((int)(span_iterator->len)); - m_spans.add(sp); - int x1 = sp.x; - int x2 = sp.x + sp.len - 1; - if(x1 < m_min_x) m_min_x = x1; - if(x2 > m_max_x) m_max_x = x2; - if(--num_spans == 0) break; - ++span_iterator; - } - m_scanlines.add(sl_this); - } - - - //--------------------------------------------------------------- - // Iterate scanlines interface - int min_x() const { return m_min_x; } - int min_y() const { return m_min_y; } - int max_x() const { return m_max_x; } - int max_y() const { return m_max_y; } - - //--------------------------------------------------------------- - bool rewind_scanlines() - { - m_cur_scanline = 0; - return m_scanlines.size() > 0; - } - - - //--------------------------------------------------------------- - template bool sweep_scanline(Scanline& sl) - { - sl.reset_spans(); - for(;;) - { - if(m_cur_scanline >= m_scanlines.size()) return false; - const scanline_data& sl_this = m_scanlines[m_cur_scanline]; - - unsigned num_spans = sl_this.num_spans; - unsigned span_idx = sl_this.start_span; - do - { - const span_data& sp = m_spans[span_idx++]; - sl.add_span(sp.x, sp.len, cover_full); - } - while(--num_spans); - - ++m_cur_scanline; - if(sl.num_spans()) - { - sl.finalize(sl_this.y); - break; - } - } - return true; - } - - - //--------------------------------------------------------------- - // Specialization for embedded_scanline - bool sweep_scanline(embedded_scanline& sl) - { - do - { - if(m_cur_scanline >= m_scanlines.size()) return false; - sl.setup(m_cur_scanline); - ++m_cur_scanline; - } - while(sl.num_spans() == 0); - return true; - } - - - //--------------------------------------------------------------- - unsigned byte_size() const - { - unsigned i; - unsigned size = sizeof(int32) * 4; // min_x, min_y, max_x, max_y - - for(i = 0; i < m_scanlines.size(); ++i) - { - size += sizeof(int32) * 2 + // Y, num_spans - unsigned(m_scanlines[i].num_spans) * sizeof(int32) * 2; // X, span_len - } - return size; - } - - - //--------------------------------------------------------------- - static void write_int32(int8u* dst, int32 val) - { - dst[0] = ((const int8u*)&val)[0]; - dst[1] = ((const int8u*)&val)[1]; - dst[2] = ((const int8u*)&val)[2]; - dst[3] = ((const int8u*)&val)[3]; - } - - - //--------------------------------------------------------------- - void serialize(int8u* data) const - { - unsigned i; - - write_int32(data, min_x()); // min_x - data += sizeof(int32); - write_int32(data, min_y()); // min_y - data += sizeof(int32); - write_int32(data, max_x()); // max_x - data += sizeof(int32); - write_int32(data, max_y()); // max_y - data += sizeof(int32); - - for(i = 0; i < m_scanlines.size(); ++i) - { - const scanline_data& sl_this = m_scanlines[i]; - - write_int32(data, sl_this.y); // Y - data += sizeof(int32); - - write_int32(data, sl_this.num_spans); // num_spans - data += sizeof(int32); - - unsigned num_spans = sl_this.num_spans; - unsigned span_idx = sl_this.start_span; - do - { - const span_data& sp = m_spans[span_idx++]; - - write_int32(data, sp.x); // X - data += sizeof(int32); - - write_int32(data, sp.len); // len - data += sizeof(int32); - } - while(--num_spans); - } - } - - - //--------------------------------------------------------------- - const scanline_data& scanline_by_index(unsigned i) const - { - return (i < m_scanlines.size()) ? m_scanlines[i] : m_fake_scanline; - } - - //--------------------------------------------------------------- - const span_data& span_by_index(unsigned i) const - { - return (i < m_spans.size()) ? m_spans[i] : m_fake_span; - } - - - private: - pod_bvector m_spans; - pod_bvector m_scanlines; - span_data m_fake_span; - scanline_data m_fake_scanline; - int m_min_x; - int m_min_y; - int m_max_x; - int m_max_y; - unsigned m_cur_scanline; + int32 x; + int32 len; }; - - - - - - - - - - - - - //---------------------------------------serialized_scanlines_adaptor_bin - class serialized_scanlines_adaptor_bin + //--------------------------------------------------------------- + struct scanline_data { - public: - typedef bool cover_type; + int y; + unsigned num_spans; + unsigned start_span; + }; - //-------------------------------------------------------------------- - class embedded_scanline + //--------------------------------------------------------------- + class embedded_scanline + { + public: + + //----------------------------------------------------------- + class const_iterator { - public: - - //---------------------------------------------------------------- - class const_iterator + public: + const_iterator() + : m_storage(0) + {} + const_iterator(const embedded_scanline& sl) + : m_storage(sl.m_storage) + , m_span_idx(sl.m_scanline.start_span) { - public: - struct span - { - int32 x; - int32 len; - }; + m_span = m_storage->span_by_index(m_span_idx); + } - const_iterator() : m_ptr(0) {} - const_iterator(const embedded_scanline& sl) : - m_ptr(sl.m_ptr), - m_dx(sl.m_dx) - { - m_span.x = read_int32() + m_dx; - m_span.len = read_int32(); - } + const span_data& operator*() const { return m_span; } + const span_data* operator->() const { return &m_span; } - const span& operator*() const { return m_span; } - const span* operator->() const { return &m_span; } + void operator++() + { + ++m_span_idx; + m_span = m_storage->span_by_index(m_span_idx); + } - void operator ++ () - { - m_span.x = read_int32() + m_dx; - m_span.len = read_int32(); - } + private: + const scanline_storage_bin* m_storage; + unsigned m_span_idx; + span_data m_span; + }; - private: - int read_int32() - { - int32 val; - ((int8u*)&val)[0] = *m_ptr++; - ((int8u*)&val)[1] = *m_ptr++; - ((int8u*)&val)[2] = *m_ptr++; - ((int8u*)&val)[3] = *m_ptr++; - return val; - } + friend class const_iterator; - const int8u* m_ptr; - span m_span; - int m_dx; + //----------------------------------------------------------- + embedded_scanline(const scanline_storage_bin& storage) + : m_storage(&storage) + { + setup(0); + } + + //----------------------------------------------------------- + void reset(int, int) {} + unsigned num_spans() const { return m_scanline.num_spans; } + int y() const { return m_scanline.y; } + const_iterator begin() const { return const_iterator(*this); } + + //----------------------------------------------------------- + void setup(unsigned scanline_idx) + { + m_scanline_idx = scanline_idx; + m_scanline = m_storage->scanline_by_index(m_scanline_idx); + } + + private: + const scanline_storage_bin* m_storage; + scanline_data m_scanline; + unsigned m_scanline_idx; + }; + + //--------------------------------------------------------------- + scanline_storage_bin() + : m_spans(256 - 2) + , // Block increment size + m_scanlines() + , m_min_x(0x7FFFFFFF) + , m_min_y(0x7FFFFFFF) + , m_max_x(-0x7FFFFFFF) + , m_max_y(-0x7FFFFFFF) + , m_cur_scanline(0) + { + m_fake_scanline.y = 0; + m_fake_scanline.num_spans = 0; + m_fake_scanline.start_span = 0; + m_fake_span.x = 0; + m_fake_span.len = 0; + } + + // Renderer Interface + //--------------------------------------------------------------- + void prepare() + { + m_scanlines.remove_all(); + m_spans.remove_all(); + m_min_x = 0x7FFFFFFF; + m_min_y = 0x7FFFFFFF; + m_max_x = -0x7FFFFFFF; + m_max_y = -0x7FFFFFFF; + m_cur_scanline = 0; + } + + //--------------------------------------------------------------- + template + void render(const Scanline& sl) + { + scanline_data sl_this; + + int y = sl.y(); + if (y < m_min_y) + m_min_y = y; + if (y > m_max_y) + m_max_y = y; + + sl_this.y = y; + sl_this.num_spans = sl.num_spans(); + sl_this.start_span = m_spans.size(); + typename Scanline::const_iterator span_iterator = sl.begin(); + + unsigned num_spans = sl_this.num_spans; + for (;;) + { + span_data sp; + sp.x = span_iterator->x; + sp.len = (int32)abs((int)(span_iterator->len)); + m_spans.add(sp); + int x1 = sp.x; + int x2 = sp.x + sp.len - 1; + if (x1 < m_min_x) + m_min_x = x1; + if (x2 > m_max_x) + m_max_x = x2; + if (--num_spans == 0) + break; + ++span_iterator; + } + m_scanlines.add(sl_this); + } + + //--------------------------------------------------------------- + // Iterate scanlines interface + int min_x() const { return m_min_x; } + int min_y() const { return m_min_y; } + int max_x() const { return m_max_x; } + int max_y() const { return m_max_y; } + + //--------------------------------------------------------------- + bool rewind_scanlines() + { + m_cur_scanline = 0; + return m_scanlines.size() > 0; + } + + //--------------------------------------------------------------- + template + bool sweep_scanline(Scanline& sl) + { + sl.reset_spans(); + for (;;) + { + if (m_cur_scanline >= m_scanlines.size()) + return false; + const scanline_data& sl_this = m_scanlines[m_cur_scanline]; + + unsigned num_spans = sl_this.num_spans; + unsigned span_idx = sl_this.start_span; + do + { + const span_data& sp = m_spans[span_idx++]; + sl.add_span(sp.x, sp.len, cover_full); + } while (--num_spans); + + ++m_cur_scanline; + if (sl.num_spans()) + { + sl.finalize(sl_this.y); + break; + } + } + return true; + } + + //--------------------------------------------------------------- + // Specialization for embedded_scanline + bool sweep_scanline(embedded_scanline& sl) + { + do + { + if (m_cur_scanline >= m_scanlines.size()) + return false; + sl.setup(m_cur_scanline); + ++m_cur_scanline; + } while (sl.num_spans() == 0); + return true; + } + + //--------------------------------------------------------------- + unsigned byte_size() const + { + unsigned i; + unsigned size = sizeof(int32) * 4; // min_x, min_y, max_x, max_y + + for (i = 0; i < m_scanlines.size(); ++i) + { + size += sizeof(int32) * 2 + // Y, num_spans + unsigned(m_scanlines[i].num_spans) * sizeof(int32) * 2; // X, span_len + } + return size; + } + + //--------------------------------------------------------------- + static void write_int32(int8u* dst, int32 val) + { + dst[0] = ((const int8u*)&val)[0]; + dst[1] = ((const int8u*)&val)[1]; + dst[2] = ((const int8u*)&val)[2]; + dst[3] = ((const int8u*)&val)[3]; + } + + //--------------------------------------------------------------- + void serialize(int8u* data) const + { + unsigned i; + + write_int32(data, min_x()); // min_x + data += sizeof(int32); + write_int32(data, min_y()); // min_y + data += sizeof(int32); + write_int32(data, max_x()); // max_x + data += sizeof(int32); + write_int32(data, max_y()); // max_y + data += sizeof(int32); + + for (i = 0; i < m_scanlines.size(); ++i) + { + const scanline_data& sl_this = m_scanlines[i]; + + write_int32(data, sl_this.y); // Y + data += sizeof(int32); + + write_int32(data, sl_this.num_spans); // num_spans + data += sizeof(int32); + + unsigned num_spans = sl_this.num_spans; + unsigned span_idx = sl_this.start_span; + do + { + const span_data& sp = m_spans[span_idx++]; + + write_int32(data, sp.x); // X + data += sizeof(int32); + + write_int32(data, sp.len); // len + data += sizeof(int32); + } while (--num_spans); + } + } + + //--------------------------------------------------------------- + const scanline_data& scanline_by_index(unsigned i) const + { + return (i < m_scanlines.size()) ? m_scanlines[i] : m_fake_scanline; + } + + //--------------------------------------------------------------- + const span_data& span_by_index(unsigned i) const { return (i < m_spans.size()) ? m_spans[i] : m_fake_span; } + + private: + pod_bvector m_spans; + pod_bvector m_scanlines; + span_data m_fake_span; + scanline_data m_fake_scanline; + int m_min_x; + int m_min_y; + int m_max_x; + int m_max_y; + unsigned m_cur_scanline; +}; + +//---------------------------------------serialized_scanlines_adaptor_bin +class serialized_scanlines_adaptor_bin +{ + public: + typedef bool cover_type; + + //-------------------------------------------------------------------- + class embedded_scanline + { + public: + + //---------------------------------------------------------------- + class const_iterator + { + public: + struct span + { + int32 x; + int32 len; }; - friend class const_iterator; + const_iterator() + : m_ptr(0) + {} + const_iterator(const embedded_scanline& sl) + : m_ptr(sl.m_ptr) + , m_dx(sl.m_dx) + { + m_span.x = read_int32() + m_dx; + m_span.len = read_int32(); + } + const span& operator*() const { return m_span; } + const span* operator->() const { return &m_span; } - //---------------------------------------------------------------- - embedded_scanline() : m_ptr(0), m_y(0), m_num_spans(0) {} + void operator++() + { + m_span.x = read_int32() + m_dx; + m_span.len = read_int32(); + } - //---------------------------------------------------------------- - void reset(int, int) {} - unsigned num_spans() const { return m_num_spans; } - int y() const { return m_y; } - const_iterator begin() const { return const_iterator(*this); } - - - private: - //---------------------------------------------------------------- + private: int read_int32() { int32 val; @@ -420,69 +372,28 @@ namespace agg return val; } - public: - //---------------------------------------------------------------- - void init(const int8u* ptr, int dx, int dy) - { - m_ptr = ptr; - m_y = read_int32() + dy; - m_num_spans = unsigned(read_int32()); - m_dx = dx; - } - - private: const int8u* m_ptr; - int m_y; - unsigned m_num_spans; - int m_dx; + span m_span; + int m_dx; }; + friend class const_iterator; - - public: - //-------------------------------------------------------------------- - serialized_scanlines_adaptor_bin() : - m_data(0), - m_end(0), - m_ptr(0), - m_dx(0), - m_dy(0), - m_min_x(0x7FFFFFFF), - m_min_y(0x7FFFFFFF), - m_max_x(-0x7FFFFFFF), - m_max_y(-0x7FFFFFFF) + //---------------------------------------------------------------- + embedded_scanline() + : m_ptr(0) + , m_y(0) + , m_num_spans(0) {} - //-------------------------------------------------------------------- - serialized_scanlines_adaptor_bin(const int8u* data, unsigned size, - double dx, double dy) : - m_data(data), - m_end(data + size), - m_ptr(data), - m_dx(iround(dx)), - m_dy(iround(dy)), - m_min_x(0x7FFFFFFF), - m_min_y(0x7FFFFFFF), - m_max_x(-0x7FFFFFFF), - m_max_y(-0x7FFFFFFF) - {} + //---------------------------------------------------------------- + void reset(int, int) {} + unsigned num_spans() const { return m_num_spans; } + int y() const { return m_y; } + const_iterator begin() const { return const_iterator(*this); } - //-------------------------------------------------------------------- - void init(const int8u* data, unsigned size, double dx, double dy) - { - m_data = data; - m_end = data + size; - m_ptr = data; - m_dx = iround(dx); - m_dy = iround(dy); - m_min_x = 0x7FFFFFFF; - m_min_y = 0x7FFFFFFF; - m_max_x = -0x7FFFFFFF; - m_max_y = -0x7FFFFFFF; - } - - private: - //-------------------------------------------------------------------- + private: + //---------------------------------------------------------------- int read_int32() { int32 val; @@ -492,95 +403,163 @@ namespace agg ((int8u*)&val)[3] = *m_ptr++; return val; } - - public: - // Iterate scanlines interface - //-------------------------------------------------------------------- - bool rewind_scanlines() + + public: + //---------------------------------------------------------------- + void init(const int8u* ptr, int dx, int dy) { - m_ptr = m_data; - if(m_ptr < m_end) - { - m_min_x = read_int32() + m_dx; - m_min_y = read_int32() + m_dy; - m_max_x = read_int32() + m_dx; - m_max_y = read_int32() + m_dy; - } - return m_ptr < m_end; + m_ptr = ptr; + m_y = read_int32() + dy; + m_num_spans = unsigned(read_int32()); + m_dx = dx; } - //-------------------------------------------------------------------- - int min_x() const { return m_min_x; } - int min_y() const { return m_min_y; } - int max_x() const { return m_max_x; } - int max_y() const { return m_max_y; } - - //-------------------------------------------------------------------- - template bool sweep_scanline(Scanline& sl) - { - sl.reset_spans(); - for(;;) - { - if(m_ptr >= m_end) return false; - - int y = read_int32() + m_dy; - unsigned num_spans = read_int32(); - - do - { - int x = read_int32() + m_dx; - int len = read_int32(); - - if(len < 0) len = -len; - sl.add_span(x, unsigned(len), cover_full); - } - while(--num_spans); - - if(sl.num_spans()) - { - sl.finalize(y); - break; - } - } - return true; - } - - - //-------------------------------------------------------------------- - // Specialization for embedded_scanline - bool sweep_scanline(embedded_scanline& sl) - { - do - { - if(m_ptr >= m_end) return false; - - sl.init(m_ptr, m_dx, m_dy); - - // Jump to the next scanline - //-------------------------- - read_int32(); // Y - int num_spans = read_int32(); // num_spans - m_ptr += num_spans * sizeof(int32) * 2; - } - while(sl.num_spans() == 0); - return true; - } - - private: - const int8u* m_data; - const int8u* m_end; + private: const int8u* m_ptr; - int m_dx; - int m_dy; - int m_min_x; - int m_min_y; - int m_max_x; - int m_max_y; + int m_y; + unsigned m_num_spans; + int m_dx; }; + public: + //-------------------------------------------------------------------- + serialized_scanlines_adaptor_bin() + : m_data(0) + , m_end(0) + , m_ptr(0) + , m_dx(0) + , m_dy(0) + , m_min_x(0x7FFFFFFF) + , m_min_y(0x7FFFFFFF) + , m_max_x(-0x7FFFFFFF) + , m_max_y(-0x7FFFFFFF) + {} + //-------------------------------------------------------------------- + serialized_scanlines_adaptor_bin(const int8u* data, unsigned size, double dx, double dy) + : m_data(data) + , m_end(data + size) + , m_ptr(data) + , m_dx(iround(dx)) + , m_dy(iround(dy)) + , m_min_x(0x7FFFFFFF) + , m_min_y(0x7FFFFFFF) + , m_max_x(-0x7FFFFFFF) + , m_max_y(-0x7FFFFFFF) + {} -} + //-------------------------------------------------------------------- + void init(const int8u* data, unsigned size, double dx, double dy) + { + m_data = data; + m_end = data + size; + m_ptr = data; + m_dx = iround(dx); + m_dy = iround(dy); + m_min_x = 0x7FFFFFFF; + m_min_y = 0x7FFFFFFF; + m_max_x = -0x7FFFFFFF; + m_max_y = -0x7FFFFFFF; + } + + private: + //-------------------------------------------------------------------- + int read_int32() + { + int32 val; + ((int8u*)&val)[0] = *m_ptr++; + ((int8u*)&val)[1] = *m_ptr++; + ((int8u*)&val)[2] = *m_ptr++; + ((int8u*)&val)[3] = *m_ptr++; + return val; + } + + public: + // Iterate scanlines interface + //-------------------------------------------------------------------- + bool rewind_scanlines() + { + m_ptr = m_data; + if (m_ptr < m_end) + { + m_min_x = read_int32() + m_dx; + m_min_y = read_int32() + m_dy; + m_max_x = read_int32() + m_dx; + m_max_y = read_int32() + m_dy; + } + return m_ptr < m_end; + } + + //-------------------------------------------------------------------- + int min_x() const { return m_min_x; } + int min_y() const { return m_min_y; } + int max_x() const { return m_max_x; } + int max_y() const { return m_max_y; } + + //-------------------------------------------------------------------- + template + bool sweep_scanline(Scanline& sl) + { + sl.reset_spans(); + for (;;) + { + if (m_ptr >= m_end) + return false; + + int y = read_int32() + m_dy; + unsigned num_spans = read_int32(); + + do + { + int x = read_int32() + m_dx; + int len = read_int32(); + + if (len < 0) + len = -len; + sl.add_span(x, unsigned(len), cover_full); + } while (--num_spans); + + if (sl.num_spans()) + { + sl.finalize(y); + break; + } + } + return true; + } + + //-------------------------------------------------------------------- + // Specialization for embedded_scanline + bool sweep_scanline(embedded_scanline& sl) + { + do + { + if (m_ptr >= m_end) + return false; + + sl.init(m_ptr, m_dx, m_dy); + + // Jump to the next scanline + //-------------------------- + read_int32(); // Y + int num_spans = read_int32(); // num_spans + m_ptr += num_spans * sizeof(int32) * 2; + } while (sl.num_spans() == 0); + return true; + } + + private: + const int8u* m_data; + const int8u* m_end; + const int8u* m_ptr; + int m_dx; + int m_dy; + int m_min_x; + int m_min_y; + int m_max_x; + int m_max_y; +}; + +} // namespace agg #endif - diff --git a/deps/agg/include/agg_scanline_u.h b/deps/agg/include/agg_scanline_u.h index 2a84d465c..439e44e44 100644 --- a/deps/agg/include/agg_scanline_u.h +++ b/deps/agg/include/agg_scanline_u.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -13,12 +13,12 @@ // http://www.antigrain.com //---------------------------------------------------------------------------- // -// Adaptation for 32-bit screen coordinates (scanline32_u) has been sponsored by +// Adaptation for 32-bit screen coordinates (scanline32_u) has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. -// +// //---------------------------------------------------------------------------- #ifndef AGG_SCANLINE_U_INCLUDED @@ -26,475 +26,456 @@ #include "agg_array.h" -namespace agg +namespace agg { +//=============================================================scanline_u8 +// +// Unpacked scanline container class +// +// This class is used to transfer data from a scanline rasterizer +// to the rendering buffer. It's organized very simple. The class stores +// information of horizontal spans to render it into a pixel-map buffer. +// Each span has staring X, length, and an array of bytes that determine the +// cover-values for each pixel. +// Before using this class you should know the minimal and maximal pixel +// coordinates of your scanline. The protocol of using is: +// 1. reset(min_x, max_x) +// 2. add_cell() / add_span() - accumulate scanline. +// When forming one scanline the next X coordinate must be always greater +// than the last stored one, i.e. it works only with ordered coordinates. +// 3. Call finalize(y) and render the scanline. +// 3. Call reset_spans() to prepare for the new scanline. +// +// 4. Rendering: +// +// Scanline provides an iterator class that allows you to extract +// the spans and the cover values for each pixel. Be aware that clipping +// has not been done yet, so you should perform it yourself. +// Use scanline_u8::iterator to render spans: +//------------------------------------------------------------------------- +// +// int y = sl.y(); // Y-coordinate of the scanline +// +// ************************************ +// ...Perform vertical clipping here... +// ************************************ +// +// scanline_u8::const_iterator span = sl.begin(); +// +// unsigned char* row = m_rbuf->row(y); // The the address of the beginning +// // of the current row +// +// unsigned num_spans = sl.num_spans(); // Number of spans. It's guaranteed that +// // num_spans is always greater than 0. +// +// do +// { +// const scanline_u8::cover_type* covers = +// span->covers; // The array of the cover values +// +// int num_pix = span->len; // Number of pixels of the span. +// // Always greater than 0, still it's +// // better to use "int" instead of +// // "unsigned" because it's more +// // convenient for clipping +// int x = span->x; +// +// ************************************** +// ...Perform horizontal clipping here... +// ...you have x, covers, and pix_count.. +// ************************************** +// +// unsigned char* dst = row + x; // Calculate the start address of the row. +// // In this case we assume a simple +// // grayscale image 1-byte per pixel. +// do +// { +// *dst++ = *covers++; // Hypotetical rendering. +// } +// while(--num_pix); +// +// ++span; +// } +// while(--num_spans); // num_spans cannot be 0, so this loop is quite safe +//------------------------------------------------------------------------ +// +// The question is: why should we accumulate the whole scanline when we +// could render just separate spans when they're ready? +// That's because using the scanline is generally faster. When is consists +// of more than one span the conditions for the processor cash system +// are better, because switching between two different areas of memory +// (that can be very large) occurs less frequently. +//------------------------------------------------------------------------ +class scanline_u8 { - //=============================================================scanline_u8 - // - // Unpacked scanline container class - // - // This class is used to transfer data from a scanline rasterizer - // to the rendering buffer. It's organized very simple. The class stores - // information of horizontal spans to render it into a pixel-map buffer. - // Each span has staring X, length, and an array of bytes that determine the - // cover-values for each pixel. - // Before using this class you should know the minimal and maximal pixel - // coordinates of your scanline. The protocol of using is: - // 1. reset(min_x, max_x) - // 2. add_cell() / add_span() - accumulate scanline. - // When forming one scanline the next X coordinate must be always greater - // than the last stored one, i.e. it works only with ordered coordinates. - // 3. Call finalize(y) and render the scanline. - // 3. Call reset_spans() to prepare for the new scanline. - // - // 4. Rendering: - // - // Scanline provides an iterator class that allows you to extract - // the spans and the cover values for each pixel. Be aware that clipping - // has not been done yet, so you should perform it yourself. - // Use scanline_u8::iterator to render spans: - //------------------------------------------------------------------------- - // - // int y = sl.y(); // Y-coordinate of the scanline - // - // ************************************ - // ...Perform vertical clipping here... - // ************************************ - // - // scanline_u8::const_iterator span = sl.begin(); - // - // unsigned char* row = m_rbuf->row(y); // The the address of the beginning - // // of the current row - // - // unsigned num_spans = sl.num_spans(); // Number of spans. It's guaranteed that - // // num_spans is always greater than 0. - // - // do - // { - // const scanline_u8::cover_type* covers = - // span->covers; // The array of the cover values - // - // int num_pix = span->len; // Number of pixels of the span. - // // Always greater than 0, still it's - // // better to use "int" instead of - // // "unsigned" because it's more - // // convenient for clipping - // int x = span->x; - // - // ************************************** - // ...Perform horizontal clipping here... - // ...you have x, covers, and pix_count.. - // ************************************** - // - // unsigned char* dst = row + x; // Calculate the start address of the row. - // // In this case we assume a simple - // // grayscale image 1-byte per pixel. - // do - // { - // *dst++ = *covers++; // Hypotetical rendering. - // } - // while(--num_pix); - // - // ++span; - // } - // while(--num_spans); // num_spans cannot be 0, so this loop is quite safe - //------------------------------------------------------------------------ - // - // The question is: why should we accumulate the whole scanline when we - // could render just separate spans when they're ready? - // That's because using the scanline is generally faster. When is consists - // of more than one span the conditions for the processor cash system - // are better, because switching between two different areas of memory - // (that can be very large) occurs less frequently. - //------------------------------------------------------------------------ - class scanline_u8 + public: + typedef scanline_u8 self_type; + typedef int8u cover_type; + typedef int16 coord_type; + + //-------------------------------------------------------------------- + struct span { - public: - typedef scanline_u8 self_type; - typedef int8u cover_type; - typedef int16 coord_type; + coord_type x; + coord_type len; + cover_type* covers; + }; - //-------------------------------------------------------------------- - struct span + typedef span* iterator; + typedef const span* const_iterator; + + //-------------------------------------------------------------------- + scanline_u8() + : m_min_x(0) + , m_last_x(0x7FFFFFF0) + , m_cur_span(0) + {} + + //-------------------------------------------------------------------- + void reset(int min_x, int max_x) + { + unsigned max_len = max_x - min_x + 2; + if (max_len > m_spans.size()) { - coord_type x; - coord_type len; - cover_type* covers; - }; + m_spans.resize(max_len); + m_covers.resize(max_len); + } + m_last_x = 0x7FFFFFF0; + m_min_x = min_x; + m_cur_span = &m_spans[0]; + } - typedef span* iterator; - typedef const span* const_iterator; + //-------------------------------------------------------------------- + void add_cell(int x, unsigned cover) + { + x -= m_min_x; + m_covers[x] = (cover_type)cover; + if (x == m_last_x + 1) + { + m_cur_span->len++; + } + else + { + m_cur_span++; + m_cur_span->x = (coord_type)(x + m_min_x); + m_cur_span->len = 1; + m_cur_span->covers = &m_covers[x]; + } + m_last_x = x; + } - //-------------------------------------------------------------------- - scanline_u8() : - m_min_x(0), - m_last_x(0x7FFFFFF0), - m_cur_span(0) + //-------------------------------------------------------------------- + void add_cells(int x, unsigned len, const cover_type* covers) + { + x -= m_min_x; + memcpy(&m_covers[x], covers, len * sizeof(cover_type)); + if (x == m_last_x + 1) + { + m_cur_span->len += (coord_type)len; + } + else + { + m_cur_span++; + m_cur_span->x = (coord_type)(x + m_min_x); + m_cur_span->len = (coord_type)len; + m_cur_span->covers = &m_covers[x]; + } + m_last_x = x + len - 1; + } + + //-------------------------------------------------------------------- + void add_span(int x, unsigned len, unsigned cover) + { + x -= m_min_x; + memset(&m_covers[x], cover, len); + if (x == m_last_x + 1) + { + m_cur_span->len += (coord_type)len; + } + else + { + m_cur_span++; + m_cur_span->x = (coord_type)(x + m_min_x); + m_cur_span->len = (coord_type)len; + m_cur_span->covers = &m_covers[x]; + } + m_last_x = x + len - 1; + } + + //-------------------------------------------------------------------- + void finalize(int y) { m_y = y; } + + //-------------------------------------------------------------------- + void reset_spans() + { + m_last_x = 0x7FFFFFF0; + m_cur_span = &m_spans[0]; + } + + //-------------------------------------------------------------------- + int y() const { return m_y; } + unsigned num_spans() const { return unsigned(m_cur_span - &m_spans[0]); } + const_iterator begin() const { return &m_spans[1]; } + iterator begin() { return &m_spans[1]; } + + private: + scanline_u8(const self_type&); + const self_type& operator=(const self_type&); + + private: + int m_min_x; + int m_last_x; + int m_y; + pod_array m_covers; + pod_array m_spans; + span* m_cur_span; +}; + +//==========================================================scanline_u8_am +// +// The scanline container with alpha-masking +// +//------------------------------------------------------------------------ +template +class scanline_u8_am : public scanline_u8 +{ + public: + typedef scanline_u8 base_type; + typedef AlphaMask alpha_mask_type; + typedef base_type::cover_type cover_type; + typedef base_type::coord_type coord_type; + + scanline_u8_am() + : base_type() + , m_alpha_mask(0) + {} + scanline_u8_am(const AlphaMask& am) + : base_type() + , m_alpha_mask(&am) + {} + + //-------------------------------------------------------------------- + void finalize(int span_y) + { + base_type::finalize(span_y); + if (m_alpha_mask) + { + typename base_type::iterator span = base_type::begin(); + unsigned count = base_type::num_spans(); + do + { + m_alpha_mask->combine_hspan(span->x, base_type::y(), span->covers, span->len); + ++span; + } while (--count); + } + } + + private: + const AlphaMask* m_alpha_mask; +}; + +//===========================================================scanline32_u8 +class scanline32_u8 +{ + public: + typedef scanline32_u8 self_type; + typedef int8u cover_type; + typedef int32 coord_type; + + //-------------------------------------------------------------------- + struct span + { + span() {} + span(coord_type x_, coord_type len_, cover_type* covers_) + : x(x_) + , len(len_) + , covers(covers_) {} - //-------------------------------------------------------------------- - void reset(int min_x, int max_x) - { - unsigned max_len = max_x - min_x + 2; - if(max_len > m_spans.size()) - { - m_spans.resize(max_len); - m_covers.resize(max_len); - } - m_last_x = 0x7FFFFFF0; - m_min_x = min_x; - m_cur_span = &m_spans[0]; - } - - //-------------------------------------------------------------------- - void add_cell(int x, unsigned cover) - { - x -= m_min_x; - m_covers[x] = (cover_type)cover; - if(x == m_last_x+1) - { - m_cur_span->len++; - } - else - { - m_cur_span++; - m_cur_span->x = (coord_type)(x + m_min_x); - m_cur_span->len = 1; - m_cur_span->covers = &m_covers[x]; - } - m_last_x = x; - } - - //-------------------------------------------------------------------- - void add_cells(int x, unsigned len, const cover_type* covers) - { - x -= m_min_x; - memcpy(&m_covers[x], covers, len * sizeof(cover_type)); - if(x == m_last_x+1) - { - m_cur_span->len += (coord_type)len; - } - else - { - m_cur_span++; - m_cur_span->x = (coord_type)(x + m_min_x); - m_cur_span->len = (coord_type)len; - m_cur_span->covers = &m_covers[x]; - } - m_last_x = x + len - 1; - } - - //-------------------------------------------------------------------- - void add_span(int x, unsigned len, unsigned cover) - { - x -= m_min_x; - memset(&m_covers[x], cover, len); - if(x == m_last_x+1) - { - m_cur_span->len += (coord_type)len; - } - else - { - m_cur_span++; - m_cur_span->x = (coord_type)(x + m_min_x); - m_cur_span->len = (coord_type)len; - m_cur_span->covers = &m_covers[x]; - } - m_last_x = x + len - 1; - } - - //-------------------------------------------------------------------- - void finalize(int y) - { - m_y = y; - } - - //-------------------------------------------------------------------- - void reset_spans() - { - m_last_x = 0x7FFFFFF0; - m_cur_span = &m_spans[0]; - } - - //-------------------------------------------------------------------- - int y() const { return m_y; } - unsigned num_spans() const { return unsigned(m_cur_span - &m_spans[0]); } - const_iterator begin() const { return &m_spans[1]; } - iterator begin() { return &m_spans[1]; } - - private: - scanline_u8(const self_type&); - const self_type& operator = (const self_type&); - - private: - int m_min_x; - int m_last_x; - int m_y; - pod_array m_covers; - pod_array m_spans; - span* m_cur_span; + coord_type x; + coord_type len; + cover_type* covers; }; + typedef pod_bvector span_array_type; - - - //==========================================================scanline_u8_am - // - // The scanline container with alpha-masking - // - //------------------------------------------------------------------------ - template - class scanline_u8_am : public scanline_u8 + //-------------------------------------------------------------------- + class const_iterator { - public: - typedef scanline_u8 base_type; - typedef AlphaMask alpha_mask_type; - typedef base_type::cover_type cover_type; - typedef base_type::coord_type coord_type; - - scanline_u8_am() : base_type(), m_alpha_mask(0) {} - scanline_u8_am(const AlphaMask& am) : base_type(), m_alpha_mask(&am) {} - - //-------------------------------------------------------------------- - void finalize(int span_y) - { - base_type::finalize(span_y); - if(m_alpha_mask) - { - typename base_type::iterator span = base_type::begin(); - unsigned count = base_type::num_spans(); - do - { - m_alpha_mask->combine_hspan(span->x, - base_type::y(), - span->covers, - span->len); - ++span; - } - while(--count); - } - } - - private: - const AlphaMask* m_alpha_mask; - }; - - - - - //===========================================================scanline32_u8 - class scanline32_u8 - { - public: - typedef scanline32_u8 self_type; - typedef int8u cover_type; - typedef int32 coord_type; - - //-------------------------------------------------------------------- - struct span - { - span() {} - span(coord_type x_, coord_type len_, cover_type* covers_) : - x(x_), len(len_), covers(covers_) {} - - coord_type x; - coord_type len; - cover_type* covers; - }; - - typedef pod_bvector span_array_type; - - //-------------------------------------------------------------------- - class const_iterator - { - public: - const_iterator(const span_array_type& spans) : - m_spans(spans), - m_span_idx(0) - {} - - const span& operator*() const { return m_spans[m_span_idx]; } - const span* operator->() const { return &m_spans[m_span_idx]; } - - void operator ++ () { ++m_span_idx; } - - private: - const span_array_type& m_spans; - unsigned m_span_idx; - }; - - //-------------------------------------------------------------------- - class iterator - { - public: - iterator(span_array_type& spans) : - m_spans(spans), - m_span_idx(0) - {} - - span& operator*() { return m_spans[m_span_idx]; } - span* operator->() { return &m_spans[m_span_idx]; } - - void operator ++ () { ++m_span_idx; } - - private: - span_array_type& m_spans; - unsigned m_span_idx; - }; - - - - //-------------------------------------------------------------------- - scanline32_u8() : - m_min_x(0), - m_last_x(0x7FFFFFF0), - m_covers() + public: + const_iterator(const span_array_type& spans) + : m_spans(spans) + , m_span_idx(0) {} - //-------------------------------------------------------------------- - void reset(int min_x, int max_x) - { - unsigned max_len = max_x - min_x + 2; - if(max_len > m_covers.size()) - { - m_covers.resize(max_len); - } - m_last_x = 0x7FFFFFF0; - m_min_x = min_x; - m_spans.remove_all(); - } + const span& operator*() const { return m_spans[m_span_idx]; } + const span* operator->() const { return &m_spans[m_span_idx]; } - //-------------------------------------------------------------------- - void add_cell(int x, unsigned cover) - { - x -= m_min_x; - m_covers[x] = cover_type(cover); - if(x == m_last_x+1) - { - m_spans.last().len++; - } - else - { - m_spans.add(span(coord_type(x + m_min_x), 1, &m_covers[x])); - } - m_last_x = x; - } + void operator++() { ++m_span_idx; } - //-------------------------------------------------------------------- - void add_cells(int x, unsigned len, const cover_type* covers) - { - x -= m_min_x; - memcpy(&m_covers[x], covers, len * sizeof(cover_type)); - if(x == m_last_x+1) - { - m_spans.last().len += coord_type(len); - } - else - { - m_spans.add(span(coord_type(x + m_min_x), - coord_type(len), - &m_covers[x])); - } - m_last_x = x + len - 1; - } - - //-------------------------------------------------------------------- - void add_span(int x, unsigned len, unsigned cover) - { - x -= m_min_x; - memset(&m_covers[x], cover, len); - if(x == m_last_x+1) - { - m_spans.last().len += coord_type(len); - } - else - { - m_spans.add(span(coord_type(x + m_min_x), - coord_type(len), - &m_covers[x])); - } - m_last_x = x + len - 1; - } - - //-------------------------------------------------------------------- - void finalize(int y) - { - m_y = y; - } - - //-------------------------------------------------------------------- - void reset_spans() - { - m_last_x = 0x7FFFFFF0; - m_spans.remove_all(); - } - - //-------------------------------------------------------------------- - int y() const { return m_y; } - unsigned num_spans() const { return m_spans.size(); } - const_iterator begin() const { return const_iterator(m_spans); } - iterator begin() { return iterator(m_spans); } - - private: - scanline32_u8(const self_type&); - const self_type& operator = (const self_type&); - - private: - int m_min_x; - int m_last_x; - int m_y; - pod_array m_covers; - span_array_type m_spans; + private: + const span_array_type& m_spans; + unsigned m_span_idx; }; - - - - //========================================================scanline32_u8_am - // - // The scanline container with alpha-masking - // - //------------------------------------------------------------------------ - - template - class scanline32_u8_am : public scanline32_u8 + //-------------------------------------------------------------------- + class iterator { - public: - typedef scanline32_u8 base_type; - typedef AlphaMask alpha_mask_type; - typedef base_type::cover_type cover_type; - typedef base_type::coord_type coord_type; + public: + iterator(span_array_type& spans) + : m_spans(spans) + , m_span_idx(0) + {} + span& operator*() { return m_spans[m_span_idx]; } + span* operator->() { return &m_spans[m_span_idx]; } - scanline32_u8_am() : base_type(), m_alpha_mask(0) {} - scanline32_u8_am(const AlphaMask& am) : base_type(), m_alpha_mask(&am) {} + void operator++() { ++m_span_idx; } - //-------------------------------------------------------------------- - void finalize(int span_y) - { - base_type::finalize(span_y); - if(m_alpha_mask) - { - typename base_type::iterator span = base_type::begin(); - unsigned count = base_type::num_spans(); - do - { - m_alpha_mask->combine_hspan(span->x, - base_type::y(), - span->covers, - span->len); - ++span; - } - while(--count); - } - } - - private: - const AlphaMask* m_alpha_mask; + private: + span_array_type& m_spans; + unsigned m_span_idx; }; - + //-------------------------------------------------------------------- + scanline32_u8() + : m_min_x(0) + , m_last_x(0x7FFFFFF0) + , m_covers() + {} -} + //-------------------------------------------------------------------- + void reset(int min_x, int max_x) + { + unsigned max_len = max_x - min_x + 2; + if (max_len > m_covers.size()) + { + m_covers.resize(max_len); + } + m_last_x = 0x7FFFFFF0; + m_min_x = min_x; + m_spans.remove_all(); + } + + //-------------------------------------------------------------------- + void add_cell(int x, unsigned cover) + { + x -= m_min_x; + m_covers[x] = cover_type(cover); + if (x == m_last_x + 1) + { + m_spans.last().len++; + } + else + { + m_spans.add(span(coord_type(x + m_min_x), 1, &m_covers[x])); + } + m_last_x = x; + } + + //-------------------------------------------------------------------- + void add_cells(int x, unsigned len, const cover_type* covers) + { + x -= m_min_x; + memcpy(&m_covers[x], covers, len * sizeof(cover_type)); + if (x == m_last_x + 1) + { + m_spans.last().len += coord_type(len); + } + else + { + m_spans.add(span(coord_type(x + m_min_x), coord_type(len), &m_covers[x])); + } + m_last_x = x + len - 1; + } + + //-------------------------------------------------------------------- + void add_span(int x, unsigned len, unsigned cover) + { + x -= m_min_x; + memset(&m_covers[x], cover, len); + if (x == m_last_x + 1) + { + m_spans.last().len += coord_type(len); + } + else + { + m_spans.add(span(coord_type(x + m_min_x), coord_type(len), &m_covers[x])); + } + m_last_x = x + len - 1; + } + + //-------------------------------------------------------------------- + void finalize(int y) { m_y = y; } + + //-------------------------------------------------------------------- + void reset_spans() + { + m_last_x = 0x7FFFFFF0; + m_spans.remove_all(); + } + + //-------------------------------------------------------------------- + int y() const { return m_y; } + unsigned num_spans() const { return m_spans.size(); } + const_iterator begin() const { return const_iterator(m_spans); } + iterator begin() { return iterator(m_spans); } + + private: + scanline32_u8(const self_type&); + const self_type& operator=(const self_type&); + + private: + int m_min_x; + int m_last_x; + int m_y; + pod_array m_covers; + span_array_type m_spans; +}; + +//========================================================scanline32_u8_am +// +// The scanline container with alpha-masking +// +//------------------------------------------------------------------------ + +template +class scanline32_u8_am : public scanline32_u8 +{ + public: + typedef scanline32_u8 base_type; + typedef AlphaMask alpha_mask_type; + typedef base_type::cover_type cover_type; + typedef base_type::coord_type coord_type; + + scanline32_u8_am() + : base_type() + , m_alpha_mask(0) + {} + scanline32_u8_am(const AlphaMask& am) + : base_type() + , m_alpha_mask(&am) + {} + + //-------------------------------------------------------------------- + void finalize(int span_y) + { + base_type::finalize(span_y); + if (m_alpha_mask) + { + typename base_type::iterator span = base_type::begin(); + unsigned count = base_type::num_spans(); + do + { + m_alpha_mask->combine_hspan(span->x, base_type::y(), span->covers, span->len); + ++span; + } while (--count); + } + } + + private: + const AlphaMask* m_alpha_mask; +}; + +} // namespace agg #endif - diff --git a/deps/agg/include/agg_shorten_path.h b/deps/agg/include/agg_shorten_path.h index dd9929ff9..22237bc6e 100644 --- a/deps/agg/include/agg_shorten_path.h +++ b/deps/agg/include/agg_shorten_path.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -19,48 +19,48 @@ #include "agg_basics.h" #include "agg_vertex_sequence.h" -namespace agg +namespace agg { + +//===========================================================shorten_path +template +void shorten_path(VertexSequence& vs, double s, unsigned closed = 0) { + typedef typename VertexSequence::value_type vertex_type; - //===========================================================shorten_path - template - void shorten_path(VertexSequence& vs, double s, unsigned closed = 0) + if (s > 0.0 && vs.size() > 1) { - typedef typename VertexSequence::value_type vertex_type; - - if(s > 0.0 && vs.size() > 1) + double d; + int n = int(vs.size() - 2); + while (n) { - double d; - int n = int(vs.size() - 2); - while(n) - { - d = vs[n].dist; - if(d > s) break; + d = vs[n].dist; + if (d > s) + break; + vs.remove_last(); + s -= d; + --n; + } + if (vs.size() < 2) + { + vs.remove_all(); + } + else + { + n = vs.size() - 1; + vertex_type& prev = vs[n - 1]; + vertex_type& last = vs[n]; + d = (prev.dist - s) / prev.dist; + double x = prev.x + (last.x - prev.x) * d; + double y = prev.y + (last.y - prev.y) * d; + last.x = x; + last.y = y; + if (!prev(last)) vs.remove_last(); - s -= d; - --n; - } - if(vs.size() < 2) - { - vs.remove_all(); - } - else - { - n = vs.size() - 1; - vertex_type& prev = vs[n-1]; - vertex_type& last = vs[n]; - d = (prev.dist - s) / prev.dist; - double x = prev.x + (last.x - prev.x) * d; - double y = prev.y + (last.y - prev.y) * d; - last.x = x; - last.y = y; - if(!prev(last)) vs.remove_last(); - vs.close(closed != 0); - } + vs.close(closed != 0); } } - - } +} // namespace agg + #endif diff --git a/deps/agg/include/agg_simul_eq.h b/deps/agg/include/agg_simul_eq.h index f7bfafd51..21cf42bf3 100644 --- a/deps/agg/include/agg_simul_eq.h +++ b/deps/agg/include/agg_simul_eq.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -22,126 +22,119 @@ #include #include "agg_basics.h" -namespace agg +namespace agg { + +//=============================================================swap_arrays +template +void swap_arrays(T* a1, T* a2, unsigned n) { - - //=============================================================swap_arrays - template void swap_arrays(T* a1, T* a2, unsigned n) + unsigned i; + for (i = 0; i < n; i++) { - unsigned i; - for(i = 0; i < n; i++) - { - T tmp = *a1; - *a1++ = *a2; - *a2++ = tmp; - } + T tmp = *a1; + *a1++ = *a2; + *a2++ = tmp; } - - - //============================================================matrix_pivot - template - struct matrix_pivot - { - static int pivot(double m[Rows][Cols], unsigned row) - { - int k = int(row); - double max_val, tmp; - - max_val = -1.0; - unsigned i; - for(i = row; i < Rows; i++) - { - if((tmp = std::fabs(m[i][row])) > max_val && tmp != 0.0) - { - max_val = tmp; - k = i; - } - } - - if(m[k][row] == 0.0) - { - return -1; - } - - if(k != int(row)) - { - swap_arrays(m[k], m[row], Cols); - return k; - } - return 0; - } - }; - - - - //===============================================================simul_eq - template - struct simul_eq - { - static bool solve(const double left[Size][Size], - const double right[Size][RightCols], - double result[Size][RightCols]) - { - unsigned i, j, k; - double a1; - - double tmp[Size][Size + RightCols]; - - for(i = 0; i < Size; i++) - { - for(j = 0; j < Size; j++) - { - tmp[i][j] = left[i][j]; - } - for(j = 0; j < RightCols; j++) - { - tmp[i][Size + j] = right[i][j]; - } - } - - for(k = 0; k < Size; k++) - { - if(matrix_pivot::pivot(tmp, k) < 0) - { - return false; // Singularity.... - } - - a1 = tmp[k][k]; - - for(j = k; j < Size + RightCols; j++) - { - tmp[k][j] /= a1; - } - - for(i = k + 1; i < Size; i++) - { - a1 = tmp[i][k]; - for (j = k; j < Size + RightCols; j++) - { - tmp[i][j] -= a1 * tmp[k][j]; - } - } - } - - - for(k = 0; k < RightCols; k++) - { - int m; - for(m = int(Size - 1); m >= 0; m--) - { - result[m][k] = tmp[m][Size + k]; - for(j = m + 1; j < Size; j++) - { - result[m][k] -= tmp[m][j] * result[j][k]; - } - } - } - return true; - } - - }; - - } +//============================================================matrix_pivot +template +struct matrix_pivot +{ + static int pivot(double m[Rows][Cols], unsigned row) + { + int k = int(row); + double max_val, tmp; + + max_val = -1.0; + unsigned i; + for (i = row; i < Rows; i++) + { + if ((tmp = std::fabs(m[i][row])) > max_val && tmp != 0.0) + { + max_val = tmp; + k = i; + } + } + + if (m[k][row] == 0.0) + { + return -1; + } + + if (k != int(row)) + { + swap_arrays(m[k], m[row], Cols); + return k; + } + return 0; + } +}; + +//===============================================================simul_eq +template +struct simul_eq +{ + static bool + solve(const double left[Size][Size], const double right[Size][RightCols], double result[Size][RightCols]) + { + unsigned i, j, k; + double a1; + + double tmp[Size][Size + RightCols]; + + for (i = 0; i < Size; i++) + { + for (j = 0; j < Size; j++) + { + tmp[i][j] = left[i][j]; + } + for (j = 0; j < RightCols; j++) + { + tmp[i][Size + j] = right[i][j]; + } + } + + for (k = 0; k < Size; k++) + { + if (matrix_pivot::pivot(tmp, k) < 0) + { + return false; // Singularity.... + } + + a1 = tmp[k][k]; + + for (j = k; j < Size + RightCols; j++) + { + tmp[k][j] /= a1; + } + + for (i = k + 1; i < Size; i++) + { + a1 = tmp[i][k]; + for (j = k; j < Size + RightCols; j++) + { + tmp[i][j] -= a1 * tmp[k][j]; + } + } + } + + for (k = 0; k < RightCols; k++) + { + int m; + for (m = int(Size - 1); m >= 0; m--) + { + result[m][k] = tmp[m][Size + k]; + for (j = m + 1; j < Size; j++) + { + result[m][k] -= tmp[m][j] * result[j][k]; + } + } + } + return true; + } +}; + +} // namespace agg + #endif diff --git a/deps/agg/include/agg_span_allocator.h b/deps/agg/include/agg_span_allocator.h index 201b69bb0..ca1aa971b 100644 --- a/deps/agg/include/agg_span_allocator.h +++ b/deps/agg/include/agg_span_allocator.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -18,37 +18,34 @@ #include "agg_array.h" -namespace agg +namespace agg { +//----------------------------------------------------------span_allocator +template +class span_allocator { - //----------------------------------------------------------span_allocator - template class span_allocator + public: + typedef ColorT color_type; + + //-------------------------------------------------------------------- + AGG_INLINE color_type* allocate(unsigned span_len) { - public: - typedef ColorT color_type; - - //-------------------------------------------------------------------- - AGG_INLINE color_type* allocate(unsigned span_len) + if (span_len > m_span.size()) { - if(span_len > m_span.size()) - { - // To reduce the number of reallocs we align the - // span_len to 256 color elements. - // Well, I just like this number and it looks reasonable. - //----------------------- - m_span.resize(((span_len + 255) >> 8) << 8); - } - return &m_span[0]; + // To reduce the number of reallocs we align the + // span_len to 256 color elements. + // Well, I just like this number and it looks reasonable. + //----------------------- + m_span.resize(((span_len + 255) >> 8) << 8); } + return &m_span[0]; + } - AGG_INLINE color_type* span() { return &m_span[0]; } - AGG_INLINE unsigned max_span_len() const { return m_span.size(); } - - private: - pod_array m_span; - }; -} + AGG_INLINE color_type* span() { return &m_span[0]; } + AGG_INLINE unsigned max_span_len() const { return m_span.size(); } + private: + pod_array m_span; +}; +} // namespace agg #endif - - diff --git a/deps/agg/include/agg_span_converter.h b/deps/agg/include/agg_span_converter.h index 91d0f87c2..b2e950984 100644 --- a/deps/agg/include/agg_span_converter.h +++ b/deps/agg/include/agg_span_converter.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -18,39 +18,41 @@ #include "agg_basics.h" -namespace agg +namespace agg { +//----------------------------------------------------------span_converter +template +class span_converter { - //----------------------------------------------------------span_converter - template class span_converter + public: + typedef typename SpanGenerator::color_type color_type; + + span_converter(SpanGenerator& span_gen, SpanConverter& span_cnv) + : m_span_gen(&span_gen) + , m_span_cnv(&span_cnv) + {} + + void attach_generator(SpanGenerator& span_gen) { m_span_gen = &span_gen; } + void attach_converter(SpanConverter& span_cnv) { m_span_cnv = &span_cnv; } + + //-------------------------------------------------------------------- + void prepare() { - public: - typedef typename SpanGenerator::color_type color_type; + m_span_gen->prepare(); + m_span_cnv->prepare(); + } - span_converter(SpanGenerator& span_gen, SpanConverter& span_cnv) : - m_span_gen(&span_gen), m_span_cnv(&span_cnv) {} + //-------------------------------------------------------------------- + void generate(color_type* span, int x, int y, unsigned len) + { + m_span_gen->generate(span, x, y, len); + m_span_cnv->generate(span, x, y, len); + } - void attach_generator(SpanGenerator& span_gen) { m_span_gen = &span_gen; } - void attach_converter(SpanConverter& span_cnv) { m_span_cnv = &span_cnv; } + private: + SpanGenerator* m_span_gen; + SpanConverter* m_span_cnv; +}; - //-------------------------------------------------------------------- - void prepare() - { - m_span_gen->prepare(); - m_span_cnv->prepare(); - } - - //-------------------------------------------------------------------- - void generate(color_type* span, int x, int y, unsigned len) - { - m_span_gen->generate(span, x, y, len); - m_span_cnv->generate(span, x, y, len); - } - - private: - SpanGenerator* m_span_gen; - SpanConverter* m_span_cnv; - }; - -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_span_gouraud.h b/deps/agg/include/agg_span_gouraud.h index 2986c88fe..2d0fb79cf 100644 --- a/deps/agg/include/agg_span_gouraud.h +++ b/deps/agg/include/agg_span_gouraud.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -19,154 +19,176 @@ #include "agg_basics.h" #include "agg_math.h" -namespace agg +namespace agg { + +//============================================================span_gouraud +template +class span_gouraud { + public: + typedef ColorT color_type; - //============================================================span_gouraud - template class span_gouraud + struct coord_type { - public: - typedef ColorT color_type; - - struct coord_type - { - double x; - double y; - color_type color; - }; - - //-------------------------------------------------------------------- - span_gouraud() : - m_vertex(0) - { - m_cmd[0] = path_cmd_stop; - } - - //-------------------------------------------------------------------- - span_gouraud(const color_type& c1, - const color_type& c2, - const color_type& c3, - double x1, double y1, - double x2, double y2, - double x3, double y3, - double d) : - m_vertex(0) - { - colors(c1, c2, c3); - triangle(x1, y1, x2, y2, x3, y3, d); - } - - //-------------------------------------------------------------------- - void colors(ColorT c1, ColorT c2, ColorT c3) - { - m_coord[0].color = c1; - m_coord[1].color = c2; - m_coord[2].color = c3; - } - - //-------------------------------------------------------------------- - // Sets the triangle and dilates it if needed. - // The trick here is to calculate beveled joins in the vertices of the - // triangle and render it as a 6-vertex polygon. - // It's necessary to achieve numerical stability. - // However, the coordinates to interpolate colors are calculated - // as miter joins (calc_intersection). - void triangle(double x1, double y1, - double x2, double y2, - double x3, double y3, - double d) - { - m_coord[0].x = m_x[0] = x1; - m_coord[0].y = m_y[0] = y1; - m_coord[1].x = m_x[1] = x2; - m_coord[1].y = m_y[1] = y2; - m_coord[2].x = m_x[2] = x3; - m_coord[2].y = m_y[2] = y3; - m_cmd[0] = path_cmd_move_to; - m_cmd[1] = path_cmd_line_to; - m_cmd[2] = path_cmd_line_to; - m_cmd[3] = path_cmd_stop; - - if(d != 0.0) - { - dilate_triangle(m_coord[0].x, m_coord[0].y, - m_coord[1].x, m_coord[1].y, - m_coord[2].x, m_coord[2].y, - m_x, m_y, d); - - calc_intersection(m_x[4], m_y[4], m_x[5], m_y[5], - m_x[0], m_y[0], m_x[1], m_y[1], - &m_coord[0].x, &m_coord[0].y); - - calc_intersection(m_x[0], m_y[0], m_x[1], m_y[1], - m_x[2], m_y[2], m_x[3], m_y[3], - &m_coord[1].x, &m_coord[1].y); - - calc_intersection(m_x[2], m_y[2], m_x[3], m_y[3], - m_x[4], m_y[4], m_x[5], m_y[5], - &m_coord[2].x, &m_coord[2].y); - m_cmd[3] = path_cmd_line_to; - m_cmd[4] = path_cmd_line_to; - m_cmd[5] = path_cmd_line_to; - m_cmd[6] = path_cmd_stop; - } - } - - //-------------------------------------------------------------------- - // Vertex Source Interface to feed the coordinates to the rasterizer - void rewind(unsigned) - { - m_vertex = 0; - } - - //-------------------------------------------------------------------- - unsigned vertex(double* x, double* y) - { - *x = m_x[m_vertex]; - *y = m_y[m_vertex]; - return m_cmd[m_vertex++]; - } - - protected: - //-------------------------------------------------------------------- - void arrange_vertices(coord_type* coord) const - { - coord[0] = m_coord[0]; - coord[1] = m_coord[1]; - coord[2] = m_coord[2]; - - if(m_coord[0].y > m_coord[2].y) - { - coord[0] = m_coord[2]; - coord[2] = m_coord[0]; - } - - coord_type tmp; - if(coord[0].y > coord[1].y) - { - tmp = coord[1]; - coord[1] = coord[0]; - coord[0] = tmp; - } - - if(coord[1].y > coord[2].y) - { - tmp = coord[2]; - coord[2] = coord[1]; - coord[1] = tmp; - } - } - - private: - //-------------------------------------------------------------------- - coord_type m_coord[3]; - double m_x[8]; - double m_y[8]; - unsigned m_cmd[8]; - unsigned m_vertex; + double x; + double y; + color_type color; }; -} + //-------------------------------------------------------------------- + span_gouraud() + : m_vertex(0) + { + m_cmd[0] = path_cmd_stop; + } + + //-------------------------------------------------------------------- + span_gouraud(const color_type& c1, + const color_type& c2, + const color_type& c3, + double x1, + double y1, + double x2, + double y2, + double x3, + double y3, + double d) + : m_vertex(0) + { + colors(c1, c2, c3); + triangle(x1, y1, x2, y2, x3, y3, d); + } + + //-------------------------------------------------------------------- + void colors(ColorT c1, ColorT c2, ColorT c3) + { + m_coord[0].color = c1; + m_coord[1].color = c2; + m_coord[2].color = c3; + } + + //-------------------------------------------------------------------- + // Sets the triangle and dilates it if needed. + // The trick here is to calculate beveled joins in the vertices of the + // triangle and render it as a 6-vertex polygon. + // It's necessary to achieve numerical stability. + // However, the coordinates to interpolate colors are calculated + // as miter joins (calc_intersection). + void triangle(double x1, double y1, double x2, double y2, double x3, double y3, double d) + { + m_coord[0].x = m_x[0] = x1; + m_coord[0].y = m_y[0] = y1; + m_coord[1].x = m_x[1] = x2; + m_coord[1].y = m_y[1] = y2; + m_coord[2].x = m_x[2] = x3; + m_coord[2].y = m_y[2] = y3; + m_cmd[0] = path_cmd_move_to; + m_cmd[1] = path_cmd_line_to; + m_cmd[2] = path_cmd_line_to; + m_cmd[3] = path_cmd_stop; + + if (d != 0.0) + { + dilate_triangle(m_coord[0].x, + m_coord[0].y, + m_coord[1].x, + m_coord[1].y, + m_coord[2].x, + m_coord[2].y, + m_x, + m_y, + d); + + calc_intersection(m_x[4], + m_y[4], + m_x[5], + m_y[5], + m_x[0], + m_y[0], + m_x[1], + m_y[1], + &m_coord[0].x, + &m_coord[0].y); + + calc_intersection(m_x[0], + m_y[0], + m_x[1], + m_y[1], + m_x[2], + m_y[2], + m_x[3], + m_y[3], + &m_coord[1].x, + &m_coord[1].y); + + calc_intersection(m_x[2], + m_y[2], + m_x[3], + m_y[3], + m_x[4], + m_y[4], + m_x[5], + m_y[5], + &m_coord[2].x, + &m_coord[2].y); + m_cmd[3] = path_cmd_line_to; + m_cmd[4] = path_cmd_line_to; + m_cmd[5] = path_cmd_line_to; + m_cmd[6] = path_cmd_stop; + } + } + + //-------------------------------------------------------------------- + // Vertex Source Interface to feed the coordinates to the rasterizer + void rewind(unsigned) { m_vertex = 0; } + + //-------------------------------------------------------------------- + unsigned vertex(double* x, double* y) + { + *x = m_x[m_vertex]; + *y = m_y[m_vertex]; + return m_cmd[m_vertex++]; + } + + protected: + //-------------------------------------------------------------------- + void arrange_vertices(coord_type* coord) const + { + coord[0] = m_coord[0]; + coord[1] = m_coord[1]; + coord[2] = m_coord[2]; + + if (m_coord[0].y > m_coord[2].y) + { + coord[0] = m_coord[2]; + coord[2] = m_coord[0]; + } + + coord_type tmp; + if (coord[0].y > coord[1].y) + { + tmp = coord[1]; + coord[1] = coord[0]; + coord[0] = tmp; + } + + if (coord[1].y > coord[2].y) + { + tmp = coord[2]; + coord[2] = coord[1]; + coord[1] = tmp; + } + } + + private: + //-------------------------------------------------------------------- + coord_type m_coord[3]; + double m_x[8]; + double m_y[8]; + unsigned m_cmd[8]; + unsigned m_vertex; +}; + +} // namespace agg #endif - diff --git a/deps/agg/include/agg_span_gouraud_gray.h b/deps/agg/include/agg_span_gouraud_gray.h index ee1e81334..30962d5e6 100644 --- a/deps/agg/include/agg_span_gouraud_gray.h +++ b/deps/agg/include/agg_span_gouraud_gray.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -13,12 +13,12 @@ // http://www.antigrain.com //---------------------------------------------------------------------------- // -// Adaptation for high precision colors has been sponsored by +// Adaptation for high precision colors has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. -// +// //---------------------------------------------------------------------------- #ifndef AGG_SPAN_GOURAUD_GRAY_INCLUDED @@ -29,213 +29,222 @@ #include "agg_dda_line.h" #include "agg_span_gouraud.h" -namespace agg +namespace agg { + +//=======================================================span_gouraud_gray +template +class span_gouraud_gray : public span_gouraud { + public: + typedef ColorT color_type; + typedef typename color_type::value_type value_type; + typedef span_gouraud base_type; + typedef typename base_type::coord_type coord_type; + enum subpixel_scale_e { subpixel_shift = 4, subpixel_scale = 1 << subpixel_shift }; - //=======================================================span_gouraud_gray - template class span_gouraud_gray : public span_gouraud + private: + //-------------------------------------------------------------------- + struct gray_calc { - public: - typedef ColorT color_type; - typedef typename color_type::value_type value_type; - typedef span_gouraud base_type; - typedef typename base_type::coord_type coord_type; - enum subpixel_scale_e - { - subpixel_shift = 4, - subpixel_scale = 1 << subpixel_shift - }; - - private: - //-------------------------------------------------------------------- - struct gray_calc + void init(const coord_type& c1, const coord_type& c2) { - void init(const coord_type& c1, const coord_type& c2) - { - m_x1 = c1.x - 0.5; - m_y1 = c1.y - 0.5; - m_dx = c2.x - c1.x; - double dy = c2.y - c1.y; - m_1dy = (std::fabs(dy) < 1e-10) ? 1e10 : 1.0 / dy; - m_v1 = c1.color.v; - m_a1 = c1.color.a; - m_dv = c2.color.v - m_v1; - m_da = c2.color.a - m_a1; - } - - void calc(double y) - { - double k = (y - m_y1) * m_1dy; - if(k < 0.0) k = 0.0; - if(k > 1.0) k = 1.0; - m_v = m_v1 + iround(m_dv * k); - m_a = m_a1 + iround(m_da * k); - m_x = iround((m_x1 + m_dx * k) * subpixel_scale); - } - - double m_x1; - double m_y1; - double m_dx; - double m_1dy; - int m_v1; - int m_a1; - int m_dv; - int m_da; - int m_v; - int m_a; - int m_x; - }; - - - public: - //-------------------------------------------------------------------- - span_gouraud_gray() {} - span_gouraud_gray(const color_type& c1, - const color_type& c2, - const color_type& c3, - double x1, double y1, - double x2, double y2, - double x3, double y3, - double d = 0) : - base_type(c1, c2, c3, x1, y1, x2, y2, x3, y3, d) - {} - - //-------------------------------------------------------------------- - void prepare() - { - coord_type coord[3]; - base_type::arrange_vertices(coord); - - m_y2 = int(coord[1].y); - - m_swap = cross_product(coord[0].x, coord[0].y, - coord[2].x, coord[2].y, - coord[1].x, coord[1].y) < 0.0; - - m_c1.init(coord[0], coord[2]); - m_c2.init(coord[0], coord[1]); - m_c3.init(coord[1], coord[2]); + m_x1 = c1.x - 0.5; + m_y1 = c1.y - 0.5; + m_dx = c2.x - c1.x; + double dy = c2.y - c1.y; + m_1dy = (std::fabs(dy) < 1e-10) ? 1e10 : 1.0 / dy; + m_v1 = c1.color.v; + m_a1 = c1.color.a; + m_dv = c2.color.v - m_v1; + m_da = c2.color.a - m_a1; } - //-------------------------------------------------------------------- - void generate(color_type* span, int x, int y, unsigned len) + void calc(double y) { - m_c1.calc(y); - const gray_calc* pc1 = &m_c1; - const gray_calc* pc2 = &m_c2; - - if(y < m_y2) - { - // Bottom part of the triangle (first subtriangle) - //------------------------- - m_c2.calc(y + m_c2.m_1dy); - } - else - { - // Upper part (second subtriangle) - //------------------------- - m_c3.calc(y - m_c3.m_1dy); - pc2 = &m_c3; - } - - if(m_swap) - { - // It means that the triangle is oriented clockwise, - // so that we need to swap the controlling structures - //------------------------- - const gray_calc* t = pc2; - pc2 = pc1; - pc1 = t; - } - - // Get the horizontal length with subpixel accuracy - // and protect it from division by zero - //------------------------- - int nlen = std::abs(pc2->m_x - pc1->m_x); - if(nlen <= 0) nlen = 1; - - dda_line_interpolator<14> v(pc1->m_v, pc2->m_v, nlen); - dda_line_interpolator<14> a(pc1->m_a, pc2->m_a, nlen); - - // Calculate the starting point of the gradient with subpixel - // accuracy and correct (roll back) the interpolators. - // This operation will also clip the beginning of the span - // if necessary. - //------------------------- - int start = pc1->m_x - (x << subpixel_shift); - v -= start; - a -= start; - nlen += start; - - int vv, va; - enum lim_e { lim = color_type::base_mask }; - - // Beginning part of the span. Since we rolled back the - // interpolators, the color values may have overflow. - // So that, we render the beginning part with checking - // for overflow. It lasts until "start" is positive; - // typically it's 1-2 pixels, but may be more in some cases. - //------------------------- - while(len && start > 0) - { - vv = v.y(); - va = a.y(); - if(vv < 0) vv = 0; if(vv > lim) vv = lim; - if(va < 0) va = 0; if(va > lim) va = lim; - span->v = (value_type)vv; - span->a = (value_type)va; - v += subpixel_scale; - a += subpixel_scale; - nlen -= subpixel_scale; - start -= subpixel_scale; - ++span; - --len; - } - - // Middle part, no checking for overflow. - // Actual spans can be longer than the calculated length - // because of anti-aliasing, thus, the interpolators can - // overflow. But while "nlen" is positive we are safe. - //------------------------- - while(len && nlen > 0) - { - span->v = (value_type)v.y(); - span->a = (value_type)a.y(); - v += subpixel_scale; - a += subpixel_scale; - nlen -= subpixel_scale; - ++span; - --len; - } - - // Ending part; checking for overflow. - // Typically it's 1-2 pixels, but may be more in some cases. - //------------------------- - while(len) - { - vv = v.y(); - va = a.y(); - if(vv < 0) vv = 0; if(vv > lim) vv = lim; - if(va < 0) va = 0; if(va > lim) va = lim; - span->v = (value_type)vv; - span->a = (value_type)va; - v += subpixel_scale; - a += subpixel_scale; - ++span; - --len; - } + double k = (y - m_y1) * m_1dy; + if (k < 0.0) + k = 0.0; + if (k > 1.0) + k = 1.0; + m_v = m_v1 + iround(m_dv * k); + m_a = m_a1 + iround(m_da * k); + m_x = iround((m_x1 + m_dx * k) * subpixel_scale); } - - private: - bool m_swap; - int m_y2; - gray_calc m_c1; - gray_calc m_c2; - gray_calc m_c3; + double m_x1; + double m_y1; + double m_dx; + double m_1dy; + int m_v1; + int m_a1; + int m_dv; + int m_da; + int m_v; + int m_a; + int m_x; }; + public: + //-------------------------------------------------------------------- + span_gouraud_gray() {} + span_gouraud_gray(const color_type& c1, + const color_type& c2, + const color_type& c3, + double x1, + double y1, + double x2, + double y2, + double x3, + double y3, + double d = 0) + : base_type(c1, c2, c3, x1, y1, x2, y2, x3, y3, d) + {} -} + //-------------------------------------------------------------------- + void prepare() + { + coord_type coord[3]; + base_type::arrange_vertices(coord); + + m_y2 = int(coord[1].y); + + m_swap = cross_product(coord[0].x, coord[0].y, coord[2].x, coord[2].y, coord[1].x, coord[1].y) < 0.0; + + m_c1.init(coord[0], coord[2]); + m_c2.init(coord[0], coord[1]); + m_c3.init(coord[1], coord[2]); + } + + //-------------------------------------------------------------------- + void generate(color_type* span, int x, int y, unsigned len) + { + m_c1.calc(y); + const gray_calc* pc1 = &m_c1; + const gray_calc* pc2 = &m_c2; + + if (y < m_y2) + { + // Bottom part of the triangle (first subtriangle) + //------------------------- + m_c2.calc(y + m_c2.m_1dy); + } + else + { + // Upper part (second subtriangle) + //------------------------- + m_c3.calc(y - m_c3.m_1dy); + pc2 = &m_c3; + } + + if (m_swap) + { + // It means that the triangle is oriented clockwise, + // so that we need to swap the controlling structures + //------------------------- + const gray_calc* t = pc2; + pc2 = pc1; + pc1 = t; + } + + // Get the horizontal length with subpixel accuracy + // and protect it from division by zero + //------------------------- + int nlen = std::abs(pc2->m_x - pc1->m_x); + if (nlen <= 0) + nlen = 1; + + dda_line_interpolator<14> v(pc1->m_v, pc2->m_v, nlen); + dda_line_interpolator<14> a(pc1->m_a, pc2->m_a, nlen); + + // Calculate the starting point of the gradient with subpixel + // accuracy and correct (roll back) the interpolators. + // This operation will also clip the beginning of the span + // if necessary. + //------------------------- + int start = pc1->m_x - (x << subpixel_shift); + v -= start; + a -= start; + nlen += start; + + int vv, va; + enum lim_e { lim = color_type::base_mask }; + + // Beginning part of the span. Since we rolled back the + // interpolators, the color values may have overflow. + // So that, we render the beginning part with checking + // for overflow. It lasts until "start" is positive; + // typically it's 1-2 pixels, but may be more in some cases. + //------------------------- + while (len && start > 0) + { + vv = v.y(); + va = a.y(); + if (vv < 0) + vv = 0; + if (vv > lim) + vv = lim; + if (va < 0) + va = 0; + if (va > lim) + va = lim; + span->v = (value_type)vv; + span->a = (value_type)va; + v += subpixel_scale; + a += subpixel_scale; + nlen -= subpixel_scale; + start -= subpixel_scale; + ++span; + --len; + } + + // Middle part, no checking for overflow. + // Actual spans can be longer than the calculated length + // because of anti-aliasing, thus, the interpolators can + // overflow. But while "nlen" is positive we are safe. + //------------------------- + while (len && nlen > 0) + { + span->v = (value_type)v.y(); + span->a = (value_type)a.y(); + v += subpixel_scale; + a += subpixel_scale; + nlen -= subpixel_scale; + ++span; + --len; + } + + // Ending part; checking for overflow. + // Typically it's 1-2 pixels, but may be more in some cases. + //------------------------- + while (len) + { + vv = v.y(); + va = a.y(); + if (vv < 0) + vv = 0; + if (vv > lim) + vv = lim; + if (va < 0) + va = 0; + if (va > lim) + va = lim; + span->v = (value_type)vv; + span->a = (value_type)va; + v += subpixel_scale; + a += subpixel_scale; + ++span; + --len; + } + } + + private: + bool m_swap; + int m_y2; + gray_calc m_c1; + gray_calc m_c2; + gray_calc m_c3; +}; + +} // namespace agg #endif diff --git a/deps/agg/include/agg_span_gouraud_rgba.h b/deps/agg/include/agg_span_gouraud_rgba.h index 4c48383b5..394eac751 100644 --- a/deps/agg/include/agg_span_gouraud_rgba.h +++ b/deps/agg/include/agg_span_gouraud_rgba.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -13,12 +13,12 @@ // http://www.antigrain.com //---------------------------------------------------------------------------- // -// Adaptation for high precision colors has been sponsored by +// Adaptation for high precision colors has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. -// +// //---------------------------------------------------------------------------- #ifndef AGG_SPAN_GOURAUD_RGBA_INCLUDED @@ -29,249 +29,271 @@ #include "agg_dda_line.h" #include "agg_span_gouraud.h" -namespace agg +namespace agg { + +//=======================================================span_gouraud_rgba +template +class span_gouraud_rgba : public span_gouraud { + public: + typedef ColorT color_type; + typedef typename ColorT::value_type value_type; + typedef span_gouraud base_type; + typedef typename base_type::coord_type coord_type; + enum subpixel_scale_e { subpixel_shift = 4, subpixel_scale = 1 << subpixel_shift }; - //=======================================================span_gouraud_rgba - template class span_gouraud_rgba : public span_gouraud + private: + //-------------------------------------------------------------------- + struct rgba_calc { - public: - typedef ColorT color_type; - typedef typename ColorT::value_type value_type; - typedef span_gouraud base_type; - typedef typename base_type::coord_type coord_type; - enum subpixel_scale_e - { - subpixel_shift = 4, - subpixel_scale = 1 << subpixel_shift - }; - - private: - //-------------------------------------------------------------------- - struct rgba_calc + void init(const coord_type& c1, const coord_type& c2) { - void init(const coord_type& c1, const coord_type& c2) - { - m_x1 = c1.x - 0.5; - m_y1 = c1.y - 0.5; - m_dx = c2.x - c1.x; - double dy = c2.y - c1.y; - m_1dy = (dy < 1e-5) ? 1e5 : 1.0 / dy; - m_r1 = c1.color.r; - m_g1 = c1.color.g; - m_b1 = c1.color.b; - m_a1 = c1.color.a; - m_dr = c2.color.r - m_r1; - m_dg = c2.color.g - m_g1; - m_db = c2.color.b - m_b1; - m_da = c2.color.a - m_a1; - } - - void calc(double y) - { - double k = (y - m_y1) * m_1dy; - if(k < 0.0) k = 0.0; - if(k > 1.0) k = 1.0; - m_r = m_r1 + iround(m_dr * k); - m_g = m_g1 + iround(m_dg * k); - m_b = m_b1 + iround(m_db * k); - m_a = m_a1 + iround(m_da * k); - m_x = iround((m_x1 + m_dx * k) * subpixel_scale); - } - - double m_x1; - double m_y1; - double m_dx; - double m_1dy; - int m_r1; - int m_g1; - int m_b1; - int m_a1; - int m_dr; - int m_dg; - int m_db; - int m_da; - int m_r; - int m_g; - int m_b; - int m_a; - int m_x; - }; - - public: - - //-------------------------------------------------------------------- - span_gouraud_rgba() {} - span_gouraud_rgba(const color_type& c1, - const color_type& c2, - const color_type& c3, - double x1, double y1, - double x2, double y2, - double x3, double y3, - double d = 0) : - base_type(c1, c2, c3, x1, y1, x2, y2, x3, y3, d) - {} - - //-------------------------------------------------------------------- - void prepare() - { - coord_type coord[3]; - base_type::arrange_vertices(coord); - - m_y2 = int(coord[1].y); - - m_swap = cross_product(coord[0].x, coord[0].y, - coord[2].x, coord[2].y, - coord[1].x, coord[1].y) < 0.0; - - m_rgba1.init(coord[0], coord[2]); - m_rgba2.init(coord[0], coord[1]); - m_rgba3.init(coord[1], coord[2]); + m_x1 = c1.x - 0.5; + m_y1 = c1.y - 0.5; + m_dx = c2.x - c1.x; + double dy = c2.y - c1.y; + m_1dy = (dy < 1e-5) ? 1e5 : 1.0 / dy; + m_r1 = c1.color.r; + m_g1 = c1.color.g; + m_b1 = c1.color.b; + m_a1 = c1.color.a; + m_dr = c2.color.r - m_r1; + m_dg = c2.color.g - m_g1; + m_db = c2.color.b - m_b1; + m_da = c2.color.a - m_a1; } - //-------------------------------------------------------------------- - void generate(color_type* span, int x, int y, unsigned len) + void calc(double y) { - m_rgba1.calc(y);//(m_rgba1.m_1dy > 2) ? m_rgba1.m_y1 : y); - const rgba_calc* pc1 = &m_rgba1; - const rgba_calc* pc2 = &m_rgba2; - - if(y <= m_y2) - { - // Bottom part of the triangle (first subtriangle) - //------------------------- - m_rgba2.calc(y + m_rgba2.m_1dy); - } - else - { - // Upper part (second subtriangle) - m_rgba3.calc(y - m_rgba3.m_1dy); - //------------------------- - pc2 = &m_rgba3; - } - - if(m_swap) - { - // It means that the triangle is oriented clockwise, - // so that we need to swap the controlling structures - //------------------------- - const rgba_calc* t = pc2; - pc2 = pc1; - pc1 = t; - } - - // Get the horizontal length with subpixel accuracy - // and protect it from division by zero - //------------------------- - int nlen = std::abs(pc2->m_x - pc1->m_x); - if(nlen <= 0) nlen = 1; - - dda_line_interpolator<14> r(pc1->m_r, pc2->m_r, nlen); - dda_line_interpolator<14> g(pc1->m_g, pc2->m_g, nlen); - dda_line_interpolator<14> b(pc1->m_b, pc2->m_b, nlen); - dda_line_interpolator<14> a(pc1->m_a, pc2->m_a, nlen); - - // Calculate the starting point of the gradient with subpixel - // accuracy and correct (roll back) the interpolators. - // This operation will also clip the beginning of the span - // if necessary. - //------------------------- - int start = pc1->m_x - (x << subpixel_shift); - r -= start; - g -= start; - b -= start; - a -= start; - nlen += start; - - int vr, vg, vb, va; - enum lim_e { lim = color_type::base_mask }; - - // Beginning part of the span. Since we rolled back the - // interpolators, the color values may have overflow. - // So that, we render the beginning part with checking - // for overflow. It lasts until "start" is positive; - // typically it's 1-2 pixels, but may be more in some cases. - //------------------------- - while(len && start > 0) - { - vr = r.y(); - vg = g.y(); - vb = b.y(); - va = a.y(); - if(vr < 0) vr = 0; if(vr > lim) vr = lim; - if(vg < 0) vg = 0; if(vg > lim) vg = lim; - if(vb < 0) vb = 0; if(vb > lim) vb = lim; - if(va < 0) va = 0; if(va > lim) va = lim; - span->r = (value_type)vr; - span->g = (value_type)vg; - span->b = (value_type)vb; - span->a = (value_type)va; - r += subpixel_scale; - g += subpixel_scale; - b += subpixel_scale; - a += subpixel_scale; - nlen -= subpixel_scale; - start -= subpixel_scale; - ++span; - --len; - } - - // Middle part, no checking for overflow. - // Actual spans can be longer than the calculated length - // because of anti-aliasing, thus, the interpolators can - // overflow. But while "nlen" is positive we are safe. - //------------------------- - while(len && nlen > 0) - { - span->r = (value_type)r.y(); - span->g = (value_type)g.y(); - span->b = (value_type)b.y(); - span->a = (value_type)a.y(); - r += subpixel_scale; - g += subpixel_scale; - b += subpixel_scale; - a += subpixel_scale; - nlen -= subpixel_scale; - ++span; - --len; - } - - // Ending part; checking for overflow. - // Typically it's 1-2 pixels, but may be more in some cases. - //------------------------- - while(len) - { - vr = r.y(); - vg = g.y(); - vb = b.y(); - va = a.y(); - if(vr < 0) vr = 0; if(vr > lim) vr = lim; - if(vg < 0) vg = 0; if(vg > lim) vg = lim; - if(vb < 0) vb = 0; if(vb > lim) vb = lim; - if(va < 0) va = 0; if(va > lim) va = lim; - span->r = (value_type)vr; - span->g = (value_type)vg; - span->b = (value_type)vb; - span->a = (value_type)va; - r += subpixel_scale; - g += subpixel_scale; - b += subpixel_scale; - a += subpixel_scale; - ++span; - --len; - } + double k = (y - m_y1) * m_1dy; + if (k < 0.0) + k = 0.0; + if (k > 1.0) + k = 1.0; + m_r = m_r1 + iround(m_dr * k); + m_g = m_g1 + iround(m_dg * k); + m_b = m_b1 + iround(m_db * k); + m_a = m_a1 + iround(m_da * k); + m_x = iround((m_x1 + m_dx * k) * subpixel_scale); } - private: - bool m_swap; - int m_y2; - rgba_calc m_rgba1; - rgba_calc m_rgba2; - rgba_calc m_rgba3; + double m_x1; + double m_y1; + double m_dx; + double m_1dy; + int m_r1; + int m_g1; + int m_b1; + int m_a1; + int m_dr; + int m_dg; + int m_db; + int m_da; + int m_r; + int m_g; + int m_b; + int m_a; + int m_x; }; + public: + //-------------------------------------------------------------------- + span_gouraud_rgba() {} + span_gouraud_rgba(const color_type& c1, + const color_type& c2, + const color_type& c3, + double x1, + double y1, + double x2, + double y2, + double x3, + double y3, + double d = 0) + : base_type(c1, c2, c3, x1, y1, x2, y2, x3, y3, d) + {} -} + //-------------------------------------------------------------------- + void prepare() + { + coord_type coord[3]; + base_type::arrange_vertices(coord); + + m_y2 = int(coord[1].y); + + m_swap = cross_product(coord[0].x, coord[0].y, coord[2].x, coord[2].y, coord[1].x, coord[1].y) < 0.0; + + m_rgba1.init(coord[0], coord[2]); + m_rgba2.init(coord[0], coord[1]); + m_rgba3.init(coord[1], coord[2]); + } + + //-------------------------------------------------------------------- + void generate(color_type* span, int x, int y, unsigned len) + { + m_rgba1.calc(y); //(m_rgba1.m_1dy > 2) ? m_rgba1.m_y1 : y); + const rgba_calc* pc1 = &m_rgba1; + const rgba_calc* pc2 = &m_rgba2; + + if (y <= m_y2) + { + // Bottom part of the triangle (first subtriangle) + //------------------------- + m_rgba2.calc(y + m_rgba2.m_1dy); + } + else + { + // Upper part (second subtriangle) + m_rgba3.calc(y - m_rgba3.m_1dy); + //------------------------- + pc2 = &m_rgba3; + } + + if (m_swap) + { + // It means that the triangle is oriented clockwise, + // so that we need to swap the controlling structures + //------------------------- + const rgba_calc* t = pc2; + pc2 = pc1; + pc1 = t; + } + + // Get the horizontal length with subpixel accuracy + // and protect it from division by zero + //------------------------- + int nlen = std::abs(pc2->m_x - pc1->m_x); + if (nlen <= 0) + nlen = 1; + + dda_line_interpolator<14> r(pc1->m_r, pc2->m_r, nlen); + dda_line_interpolator<14> g(pc1->m_g, pc2->m_g, nlen); + dda_line_interpolator<14> b(pc1->m_b, pc2->m_b, nlen); + dda_line_interpolator<14> a(pc1->m_a, pc2->m_a, nlen); + + // Calculate the starting point of the gradient with subpixel + // accuracy and correct (roll back) the interpolators. + // This operation will also clip the beginning of the span + // if necessary. + //------------------------- + int start = pc1->m_x - (x << subpixel_shift); + r -= start; + g -= start; + b -= start; + a -= start; + nlen += start; + + int vr, vg, vb, va; + enum lim_e { lim = color_type::base_mask }; + + // Beginning part of the span. Since we rolled back the + // interpolators, the color values may have overflow. + // So that, we render the beginning part with checking + // for overflow. It lasts until "start" is positive; + // typically it's 1-2 pixels, but may be more in some cases. + //------------------------- + while (len && start > 0) + { + vr = r.y(); + vg = g.y(); + vb = b.y(); + va = a.y(); + if (vr < 0) + vr = 0; + if (vr > lim) + vr = lim; + if (vg < 0) + vg = 0; + if (vg > lim) + vg = lim; + if (vb < 0) + vb = 0; + if (vb > lim) + vb = lim; + if (va < 0) + va = 0; + if (va > lim) + va = lim; + span->r = (value_type)vr; + span->g = (value_type)vg; + span->b = (value_type)vb; + span->a = (value_type)va; + r += subpixel_scale; + g += subpixel_scale; + b += subpixel_scale; + a += subpixel_scale; + nlen -= subpixel_scale; + start -= subpixel_scale; + ++span; + --len; + } + + // Middle part, no checking for overflow. + // Actual spans can be longer than the calculated length + // because of anti-aliasing, thus, the interpolators can + // overflow. But while "nlen" is positive we are safe. + //------------------------- + while (len && nlen > 0) + { + span->r = (value_type)r.y(); + span->g = (value_type)g.y(); + span->b = (value_type)b.y(); + span->a = (value_type)a.y(); + r += subpixel_scale; + g += subpixel_scale; + b += subpixel_scale; + a += subpixel_scale; + nlen -= subpixel_scale; + ++span; + --len; + } + + // Ending part; checking for overflow. + // Typically it's 1-2 pixels, but may be more in some cases. + //------------------------- + while (len) + { + vr = r.y(); + vg = g.y(); + vb = b.y(); + va = a.y(); + if (vr < 0) + vr = 0; + if (vr > lim) + vr = lim; + if (vg < 0) + vg = 0; + if (vg > lim) + vg = lim; + if (vb < 0) + vb = 0; + if (vb > lim) + vb = lim; + if (va < 0) + va = 0; + if (va > lim) + va = lim; + span->r = (value_type)vr; + span->g = (value_type)vg; + span->b = (value_type)vb; + span->a = (value_type)va; + r += subpixel_scale; + g += subpixel_scale; + b += subpixel_scale; + a += subpixel_scale; + ++span; + --len; + } + } + + private: + bool m_swap; + int m_y2; + rgba_calc m_rgba1; + rgba_calc m_rgba2; + rgba_calc m_rgba3; +}; + +} // namespace agg #endif diff --git a/deps/agg/include/agg_span_gradient.h b/deps/agg/include/agg_span_gradient.h index b39bcdb74..e380367dd 100644 --- a/deps/agg/include/agg_span_gradient.h +++ b/deps/agg/include/agg_span_gradient.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -23,342 +23,326 @@ #include "agg_math.h" #include "agg_array.h" +namespace agg { -namespace agg +enum gradient_subpixel_scale_e { + gradient_subpixel_shift = 4, //-----gradient_subpixel_shift + gradient_subpixel_scale = 1 << gradient_subpixel_shift, //-----gradient_subpixel_scale + gradient_subpixel_mask = gradient_subpixel_scale - 1 //-----gradient_subpixel_mask +}; + +//==========================================================span_gradient +template +class span_gradient { + public: + typedef Interpolator interpolator_type; + typedef ColorT color_type; - enum gradient_subpixel_scale_e + enum downscale_shift_e { downscale_shift = interpolator_type::subpixel_shift - gradient_subpixel_shift }; + + //-------------------------------------------------------------------- + span_gradient() {} + + //-------------------------------------------------------------------- + span_gradient(interpolator_type& inter, + const GradientF& gradient_function, + const ColorF& color_function, + double d1, + double d2) + : m_interpolator(&inter) + , m_gradient_function(&gradient_function) + , m_color_function(&color_function) + , m_d1(iround(d1 * gradient_subpixel_scale)) + , m_d2(iround(d2 * gradient_subpixel_scale)) + {} + + //-------------------------------------------------------------------- + interpolator_type& interpolator() { return *m_interpolator; } + const GradientF& gradient_function() const { return *m_gradient_function; } + const ColorF& color_function() const { return *m_color_function; } + double d1() const { return double(m_d1) / gradient_subpixel_scale; } + double d2() const { return double(m_d2) / gradient_subpixel_scale; } + + //-------------------------------------------------------------------- + void interpolator(interpolator_type& i) { m_interpolator = &i; } + void gradient_function(const GradientF& gf) { m_gradient_function = &gf; } + void color_function(const ColorF& cf) { m_color_function = &cf; } + void d1(double v) { m_d1 = iround(v * gradient_subpixel_scale); } + void d2(double v) { m_d2 = iround(v * gradient_subpixel_scale); } + + //-------------------------------------------------------------------- + void prepare() {} + + //-------------------------------------------------------------------- + void generate(color_type* span, int x, int y, unsigned len) { - gradient_subpixel_shift = 4, //-----gradient_subpixel_shift - gradient_subpixel_scale = 1 << gradient_subpixel_shift, //-----gradient_subpixel_scale - gradient_subpixel_mask = gradient_subpixel_scale - 1 //-----gradient_subpixel_mask - }; - - - - //==========================================================span_gradient - template - class span_gradient - { - public: - typedef Interpolator interpolator_type; - typedef ColorT color_type; - - enum downscale_shift_e + int dd = m_d2 - m_d1; + if (dd < 1) + dd = 1; + m_interpolator->begin(x + 0.5, y + 0.5, len); + do { - downscale_shift = interpolator_type::subpixel_shift - - gradient_subpixel_shift - }; + m_interpolator->coordinates(&x, &y); + int d = m_gradient_function->calculate(x >> downscale_shift, y >> downscale_shift, m_d2); + d = ((d - m_d1) * (int)m_color_function->size()) / dd; + if (d < 0) + d = 0; + if (d >= (int)m_color_function->size()) + d = m_color_function->size() - 1; + *span++ = (*m_color_function)[d]; + ++(*m_interpolator); + } while (--len); + } - //-------------------------------------------------------------------- - span_gradient() {} + private: + interpolator_type* m_interpolator; + const GradientF* m_gradient_function; + const ColorF* m_color_function; + int m_d1; + int m_d2; +}; - //-------------------------------------------------------------------- - span_gradient(interpolator_type& inter, - const GradientF& gradient_function, - const ColorF& color_function, - double d1, double d2) : - m_interpolator(&inter), - m_gradient_function(&gradient_function), - m_color_function(&color_function), - m_d1(iround(d1 * gradient_subpixel_scale)), - m_d2(iround(d2 * gradient_subpixel_scale)) - {} +//=====================================================gradient_linear_color +template +struct gradient_linear_color +{ + typedef ColorT color_type; - //-------------------------------------------------------------------- - interpolator_type& interpolator() { return *m_interpolator; } - const GradientF& gradient_function() const { return *m_gradient_function; } - const ColorF& color_function() const { return *m_color_function; } - double d1() const { return double(m_d1) / gradient_subpixel_scale; } - double d2() const { return double(m_d2) / gradient_subpixel_scale; } + gradient_linear_color() {} + gradient_linear_color(const color_type& c1, const color_type& c2, unsigned size = 256) + : m_c1(c1) + , m_c2(c2) + , m_size(size) + {} - //-------------------------------------------------------------------- - void interpolator(interpolator_type& i) { m_interpolator = &i; } - void gradient_function(const GradientF& gf) { m_gradient_function = &gf; } - void color_function(const ColorF& cf) { m_color_function = &cf; } - void d1(double v) { m_d1 = iround(v * gradient_subpixel_scale); } - void d2(double v) { m_d2 = iround(v * gradient_subpixel_scale); } + unsigned size() const { return m_size; } + color_type operator[](unsigned v) const { return m_c1.gradient(m_c2, double(v) / double(m_size - 1)); } - //-------------------------------------------------------------------- - void prepare() {} + void colors(const color_type& c1, const color_type& c2, unsigned size = 256) + { + m_c1 = c1; + m_c2 = c2; + m_size = size; + } - //-------------------------------------------------------------------- - void generate(color_type* span, int x, int y, unsigned len) - { - int dd = m_d2 - m_d1; - if(dd < 1) dd = 1; - m_interpolator->begin(x+0.5, y+0.5, len); - do + color_type m_c1; + color_type m_c2; + unsigned m_size; +}; + +//==========================================================gradient_circle +class gradient_circle +{ + // Actually the same as radial. Just for compatibility + public: + static AGG_INLINE int calculate(int x, int y, int) { return int(fast_sqrt(x * x + y * y)); } +}; + +//==========================================================gradient_radial +class gradient_radial +{ + public: + static AGG_INLINE int calculate(int x, int y, int) { return int(fast_sqrt(x * x + y * y)); } +}; + +//========================================================gradient_radial_d +class gradient_radial_d +{ + public: + static AGG_INLINE int calculate(int x, int y, int) + { + return uround(sqrt(double(x) * double(x) + double(y) * double(y))); + } +}; + +//====================================================gradient_radial_focus +class gradient_radial_focus +{ + public: + //--------------------------------------------------------------------- + gradient_radial_focus() + : m_r(100 * gradient_subpixel_scale) + , m_fx(0) + , m_fy(0) + { + update_values(); + } + + //--------------------------------------------------------------------- + gradient_radial_focus(double r, double fx, double fy) + : m_r(iround(r * gradient_subpixel_scale)) + , m_fx(iround(fx * gradient_subpixel_scale)) + , m_fy(iround(fy * gradient_subpixel_scale)) + { + update_values(); + } + + //--------------------------------------------------------------------- + void init(double r, double fx, double fy) + { + m_r = iround(r * gradient_subpixel_scale); + m_fx = iround(fx * gradient_subpixel_scale); + m_fy = iround(fy * gradient_subpixel_scale); + update_values(); + } + + //--------------------------------------------------------------------- + double radius() const { return double(m_r) / gradient_subpixel_scale; } + double focus_x() const { return double(m_fx) / gradient_subpixel_scale; } + double focus_y() const { return double(m_fy) / gradient_subpixel_scale; } + + //--------------------------------------------------------------------- + int calculate(int x, int y, int) const + { + double dx = x - m_fx; + double dy = y - m_fy; + double d2 = dx * m_fy - dy * m_fx; + double d3 = m_r2 * (dx * dx + dy * dy) - d2 * d2; + return iround((dx * m_fx + dy * m_fy + sqrt(std::fabs(d3))) * m_mul); + } + + private: + //--------------------------------------------------------------------- + void update_values() + { + // Calculate the invariant values. In case the focal center + // lies exactly on the gradient circle the divisor degenerates + // into zero. In this case we just move the focal center by + // one subpixel unit possibly in the direction to the origin (0,0) + // and calculate the values again. + //------------------------- + m_r2 = double(m_r) * double(m_r); + m_fx2 = double(m_fx) * double(m_fx); + m_fy2 = double(m_fy) * double(m_fy); + double d = (m_r2 - (m_fx2 + m_fy2)); + if (d == 0) + { + if (m_fx) { - m_interpolator->coordinates(&x, &y); - int d = m_gradient_function->calculate(x >> downscale_shift, - y >> downscale_shift, m_d2); - d = ((d - m_d1) * (int)m_color_function->size()) / dd; - if(d < 0) d = 0; - if(d >= (int)m_color_function->size()) d = m_color_function->size() - 1; - *span++ = (*m_color_function)[d]; - ++(*m_interpolator); + if (m_fx < 0) + ++m_fx; + else + --m_fx; + } + if (m_fy) + { + if (m_fy < 0) + ++m_fy; + else + --m_fy; } - while(--len); - } - - private: - interpolator_type* m_interpolator; - const GradientF* m_gradient_function; - const ColorF* m_color_function; - int m_d1; - int m_d2; - }; - - - - - //=====================================================gradient_linear_color - template - struct gradient_linear_color - { - typedef ColorT color_type; - - gradient_linear_color() {} - gradient_linear_color(const color_type& c1, const color_type& c2, - unsigned size = 256) : - m_c1(c1), m_c2(c2), m_size(size) {} - - unsigned size() const { return m_size; } - color_type operator [] (unsigned v) const - { - return m_c1.gradient(m_c2, double(v) / double(m_size - 1)); - } - - void colors(const color_type& c1, const color_type& c2, unsigned size = 256) - { - m_c1 = c1; - m_c2 = c2; - m_size = size; - } - - color_type m_c1; - color_type m_c2; - unsigned m_size; - }; - - - - - - - //==========================================================gradient_circle - class gradient_circle - { - // Actually the same as radial. Just for compatibility - public: - static AGG_INLINE int calculate(int x, int y, int) - { - return int(fast_sqrt(x*x + y*y)); - } - }; - - - //==========================================================gradient_radial - class gradient_radial - { - public: - static AGG_INLINE int calculate(int x, int y, int) - { - return int(fast_sqrt(x*x + y*y)); - } - }; - - //========================================================gradient_radial_d - class gradient_radial_d - { - public: - static AGG_INLINE int calculate(int x, int y, int) - { - return uround(sqrt(double(x)*double(x) + double(y)*double(y))); - } - }; - - //====================================================gradient_radial_focus - class gradient_radial_focus - { - public: - //--------------------------------------------------------------------- - gradient_radial_focus() : - m_r(100 * gradient_subpixel_scale), - m_fx(0), - m_fy(0) - { - update_values(); - } - - //--------------------------------------------------------------------- - gradient_radial_focus(double r, double fx, double fy) : - m_r (iround(r * gradient_subpixel_scale)), - m_fx(iround(fx * gradient_subpixel_scale)), - m_fy(iround(fy * gradient_subpixel_scale)) - { - update_values(); - } - - //--------------------------------------------------------------------- - void init(double r, double fx, double fy) - { - m_r = iround(r * gradient_subpixel_scale); - m_fx = iround(fx * gradient_subpixel_scale); - m_fy = iround(fy * gradient_subpixel_scale); - update_values(); - } - - //--------------------------------------------------------------------- - double radius() const { return double(m_r) / gradient_subpixel_scale; } - double focus_x() const { return double(m_fx) / gradient_subpixel_scale; } - double focus_y() const { return double(m_fy) / gradient_subpixel_scale; } - - //--------------------------------------------------------------------- - int calculate(int x, int y, int) const - { - double dx = x - m_fx; - double dy = y - m_fy; - double d2 = dx * m_fy - dy * m_fx; - double d3 = m_r2 * (dx * dx + dy * dy) - d2 * d2; - return iround((dx * m_fx + dy * m_fy + sqrt(std::fabs(d3))) * m_mul); - } - - private: - //--------------------------------------------------------------------- - void update_values() - { - // Calculate the invariant values. In case the focal center - // lies exactly on the gradient circle the divisor degenerates - // into zero. In this case we just move the focal center by - // one subpixel unit possibly in the direction to the origin (0,0) - // and calculate the values again. - //------------------------- - m_r2 = double(m_r) * double(m_r); m_fx2 = double(m_fx) * double(m_fx); m_fy2 = double(m_fy) * double(m_fy); - double d = (m_r2 - (m_fx2 + m_fy2)); - if(d == 0) - { - if(m_fx) { if(m_fx < 0) ++m_fx; else --m_fx; } - if(m_fy) { if(m_fy < 0) ++m_fy; else --m_fy; } - m_fx2 = double(m_fx) * double(m_fx); - m_fy2 = double(m_fy) * double(m_fy); - d = (m_r2 - (m_fx2 + m_fy2)); - } - m_mul = m_r / d; + d = (m_r2 - (m_fx2 + m_fy2)); } + m_mul = m_r / d; + } - int m_r; - int m_fx; - int m_fy; - double m_r2; - double m_fx2; - double m_fy2; - double m_mul; - }; + int m_r; + int m_fx; + int m_fy; + double m_r2; + double m_fx2; + double m_fy2; + double m_mul; +}; +//==============================================================gradient_x +class gradient_x +{ + public: + static int calculate(int x, int, int) { return x; } +}; - //==============================================================gradient_x - class gradient_x +//==============================================================gradient_y +class gradient_y +{ + public: + static int calculate(int, int y, int) { return y; } +}; + +//========================================================gradient_diamond +class gradient_diamond +{ + public: + static AGG_INLINE int calculate(int x, int y, int) { - public: - static int calculate(int x, int, int) { return x; } - }; + int ax = std::abs(x); + int ay = std::abs(y); + return ax > ay ? ax : ay; + } +}; +//=============================================================gradient_xy +class gradient_xy +{ + public: + static AGG_INLINE int calculate(int x, int y, int d) { return std::abs(x) * std::abs(y) / d; } +}; - //==============================================================gradient_y - class gradient_y +//========================================================gradient_sqrt_xy +class gradient_sqrt_xy +{ + public: + static AGG_INLINE int calculate(int x, int y, int) { return fast_sqrt(std::abs(x) * std::abs(y)); } +}; + +//==========================================================gradient_conic +class gradient_conic +{ + public: + static AGG_INLINE int calculate(int x, int y, int d) { - public: - static int calculate(int, int y, int) { return y; } - }; + return uround(std::fabs(std::atan2(double(y), double(x))) * double(d) / pi); + } +}; - //========================================================gradient_diamond - class gradient_diamond +//=================================================gradient_repeat_adaptor +template +class gradient_repeat_adaptor +{ + public: + gradient_repeat_adaptor(const GradientF& gradient) + : m_gradient(&gradient) + {} + + AGG_INLINE int calculate(int x, int y, int d) const { - public: - static AGG_INLINE int calculate(int x, int y, int) - { - int ax = std::abs(x); - int ay = std::abs(y); - return ax > ay ? ax : ay; - } - }; + int ret = m_gradient->calculate(x, y, d) % d; + if (ret < 0) + ret += d; + return ret; + } - //=============================================================gradient_xy - class gradient_xy + private: + const GradientF* m_gradient; +}; + +//================================================gradient_reflect_adaptor +template +class gradient_reflect_adaptor +{ + public: + gradient_reflect_adaptor(const GradientF& gradient) + : m_gradient(&gradient) + {} + + AGG_INLINE int calculate(int x, int y, int d) const { - public: - static AGG_INLINE int calculate(int x, int y, int d) - { - return std::abs(x) * std::abs(y) / d; - } - }; + int d2 = d << 1; + int ret = m_gradient->calculate(x, y, d) % d2; + if (ret < 0) + ret += d2; + if (ret >= d) + ret = d2 - ret; + return ret; + } - //========================================================gradient_sqrt_xy - class gradient_sqrt_xy - { - public: - static AGG_INLINE int calculate(int x, int y, int) - { - return fast_sqrt(std::abs(x) * std::abs(y)); - } - }; + private: + const GradientF* m_gradient; +}; - //==========================================================gradient_conic - class gradient_conic - { - public: - static AGG_INLINE int calculate(int x, int y, int d) - { - return uround(std::fabs(std::atan2(double(y), double(x))) * double(d) / pi); - } - }; - - //=================================================gradient_repeat_adaptor - template class gradient_repeat_adaptor - { - public: - gradient_repeat_adaptor(const GradientF& gradient) : - m_gradient(&gradient) {} - - AGG_INLINE int calculate(int x, int y, int d) const - { - int ret = m_gradient->calculate(x, y, d) % d; - if(ret < 0) ret += d; - return ret; - } - - private: - const GradientF* m_gradient; - }; - - //================================================gradient_reflect_adaptor - template class gradient_reflect_adaptor - { - public: - gradient_reflect_adaptor(const GradientF& gradient) : - m_gradient(&gradient) {} - - AGG_INLINE int calculate(int x, int y, int d) const - { - int d2 = d << 1; - int ret = m_gradient->calculate(x, y, d) % d2; - if(ret < 0) ret += d2; - if(ret >= d) ret = d2 - ret; - return ret; - } - - private: - const GradientF* m_gradient; - }; - - -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_span_gradient_alpha.h b/deps/agg/include/agg_span_gradient_alpha.h index e6ee21655..7ec228948 100644 --- a/deps/agg/include/agg_span_gradient_alpha.h +++ b/deps/agg/include/agg_span_gradient_alpha.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -18,109 +18,103 @@ #include "agg_span_gradient.h" -namespace agg +namespace agg { +//======================================================span_gradient_alpha +template +class span_gradient_alpha { - //======================================================span_gradient_alpha - template - class span_gradient_alpha - { - public: - typedef Interpolator interpolator_type; - typedef ColorT color_type; - typedef typename color_type::value_type alpha_type; + public: + typedef Interpolator interpolator_type; + typedef ColorT color_type; + typedef typename color_type::value_type alpha_type; - enum downscale_shift_e + enum downscale_shift_e { downscale_shift = interpolator_type::subpixel_shift - gradient_subpixel_shift }; + + //-------------------------------------------------------------------- + span_gradient_alpha() {} + + //-------------------------------------------------------------------- + span_gradient_alpha(interpolator_type& inter, + const GradientF& gradient_function, + const AlphaF& alpha_function, + double d1, + double d2) + : m_interpolator(&inter) + , m_gradient_function(&gradient_function) + , m_alpha_function(&alpha_function) + , m_d1(iround(d1 * gradient_subpixel_scale)) + , m_d2(iround(d2 * gradient_subpixel_scale)) + {} + + //-------------------------------------------------------------------- + interpolator_type& interpolator() { return *m_interpolator; } + const GradientF& gradient_function() const { return *m_gradient_function; } + const AlphaF& alpha_function() const { return *m_alpha_function; } + double d1() const { return double(m_d1) / gradient_subpixel_scale; } + double d2() const { return double(m_d2) / gradient_subpixel_scale; } + + //-------------------------------------------------------------------- + void interpolator(interpolator_type& i) { m_interpolator = &i; } + void gradient_function(const GradientF& gf) { m_gradient_function = &gf; } + void alpha_function(const AlphaF& af) { m_alpha_function = ⁡ } + void d1(double v) { m_d1 = iround(v * gradient_subpixel_scale); } + void d2(double v) { m_d2 = iround(v * gradient_subpixel_scale); } + + //-------------------------------------------------------------------- + void prepare() {} + + //-------------------------------------------------------------------- + void generate(color_type* span, int x, int y, unsigned len) + { + int dd = m_d2 - m_d1; + if (dd < 1) + dd = 1; + m_interpolator->begin(x + 0.5, y + 0.5, len); + do { - downscale_shift = interpolator_type::subpixel_shift - gradient_subpixel_shift - }; + m_interpolator->coordinates(&x, &y); + int d = m_gradient_function->calculate(x >> downscale_shift, y >> downscale_shift, m_d2); + d = ((d - m_d1) * (int)m_alpha_function->size()) / dd; + if (d < 0) + d = 0; + if (d >= (int)m_alpha_function->size()) + d = m_alpha_function->size() - 1; + span->a = (*m_alpha_function)[d]; + ++span; + ++(*m_interpolator); + } while (--len); + } + private: + interpolator_type* m_interpolator; + const GradientF* m_gradient_function; + const AlphaF* m_alpha_function; + int m_d1; + int m_d2; +}; - //-------------------------------------------------------------------- - span_gradient_alpha() {} +//=======================================================gradient_alpha_x +template +struct gradient_alpha_x +{ + typedef typename ColorT::value_type alpha_type; + alpha_type operator[](alpha_type x) const { return x; } +}; - //-------------------------------------------------------------------- - span_gradient_alpha(interpolator_type& inter, - const GradientF& gradient_function, - const AlphaF& alpha_function, - double d1, double d2) : - m_interpolator(&inter), - m_gradient_function(&gradient_function), - m_alpha_function(&alpha_function), - m_d1(iround(d1 * gradient_subpixel_scale)), - m_d2(iround(d2 * gradient_subpixel_scale)) - {} +//====================================================gradient_alpha_x_u8 +struct gradient_alpha_x_u8 +{ + typedef int8u alpha_type; + alpha_type operator[](alpha_type x) const { return x; } +}; - //-------------------------------------------------------------------- - interpolator_type& interpolator() { return *m_interpolator; } - const GradientF& gradient_function() const { return *m_gradient_function; } - const AlphaF& alpha_function() const { return *m_alpha_function; } - double d1() const { return double(m_d1) / gradient_subpixel_scale; } - double d2() const { return double(m_d2) / gradient_subpixel_scale; } +//==========================================gradient_alpha_one_munus_x_u8 +struct gradient_alpha_one_munus_x_u8 +{ + typedef int8u alpha_type; + alpha_type operator[](alpha_type x) const { return 255 - x; } +}; - //-------------------------------------------------------------------- - void interpolator(interpolator_type& i) { m_interpolator = &i; } - void gradient_function(const GradientF& gf) { m_gradient_function = &gf; } - void alpha_function(const AlphaF& af) { m_alpha_function = ⁡ } - void d1(double v) { m_d1 = iround(v * gradient_subpixel_scale); } - void d2(double v) { m_d2 = iround(v * gradient_subpixel_scale); } - - //-------------------------------------------------------------------- - void prepare() {} - - //-------------------------------------------------------------------- - void generate(color_type* span, int x, int y, unsigned len) - { - int dd = m_d2 - m_d1; - if(dd < 1) dd = 1; - m_interpolator->begin(x+0.5, y+0.5, len); - do - { - m_interpolator->coordinates(&x, &y); - int d = m_gradient_function->calculate(x >> downscale_shift, - y >> downscale_shift, m_d2); - d = ((d - m_d1) * (int)m_alpha_function->size()) / dd; - if(d < 0) d = 0; - if(d >= (int)m_alpha_function->size()) d = m_alpha_function->size() - 1; - span->a = (*m_alpha_function)[d]; - ++span; - ++(*m_interpolator); - } - while(--len); - } - - private: - interpolator_type* m_interpolator; - const GradientF* m_gradient_function; - const AlphaF* m_alpha_function; - int m_d1; - int m_d2; - }; - - - //=======================================================gradient_alpha_x - template struct gradient_alpha_x - { - typedef typename ColorT::value_type alpha_type; - alpha_type operator [] (alpha_type x) const { return x; } - }; - - //====================================================gradient_alpha_x_u8 - struct gradient_alpha_x_u8 - { - typedef int8u alpha_type; - alpha_type operator [] (alpha_type x) const { return x; } - }; - - //==========================================gradient_alpha_one_munus_x_u8 - struct gradient_alpha_one_munus_x_u8 - { - typedef int8u alpha_type; - alpha_type operator [] (alpha_type x) const { return 255-x; } - }; - -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_span_image_filter.h b/deps/agg/include/agg_span_image_filter.h index 47e2f44e3..199eb8f07 100644 --- a/deps/agg/include/agg_span_image_filter.h +++ b/deps/agg/include/agg_span_image_filter.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -23,224 +23,216 @@ #include "agg_image_filters.h" #include "agg_span_interpolator_linear.h" -namespace agg +namespace agg { + +//-------------------------------------------------------span_image_filter +template +class span_image_filter { + public: + typedef Source source_type; + typedef Interpolator interpolator_type; - //-------------------------------------------------------span_image_filter - template class span_image_filter + //-------------------------------------------------------------------- + span_image_filter() {} + span_image_filter(source_type& src, interpolator_type& interpolator, const image_filter_lut* filter) + : m_src(&src) + , m_interpolator(&interpolator) + , m_filter(filter) + , m_dx_dbl(0.5) + , m_dy_dbl(0.5) + , m_dx_int(image_subpixel_scale / 2) + , m_dy_int(image_subpixel_scale / 2) + {} + void attach(source_type& v) { m_src = &v; } + + //-------------------------------------------------------------------- + source_type& source() { return *m_src; } + const source_type& source() const { return *m_src; } + const image_filter_lut& filter() const { return *m_filter; } + int filter_dx_int() const { return m_dx_int; } + int filter_dy_int() const { return m_dy_int; } + double filter_dx_dbl() const { return m_dx_dbl; } + double filter_dy_dbl() const { return m_dy_dbl; } + + //-------------------------------------------------------------------- + void interpolator(interpolator_type& v) { m_interpolator = &v; } + void filter(const image_filter_lut& v) { m_filter = &v; } + void filter_offset(double dx, double dy) { - public: - typedef Source source_type; - typedef Interpolator interpolator_type; + m_dx_dbl = dx; + m_dy_dbl = dy; + m_dx_int = iround(dx * image_subpixel_scale); + m_dy_int = iround(dy * image_subpixel_scale); + } + void filter_offset(double d) { filter_offset(d, d); } - //-------------------------------------------------------------------- - span_image_filter() {} - span_image_filter(source_type& src, - interpolator_type& interpolator, - const image_filter_lut* filter) : - m_src(&src), - m_interpolator(&interpolator), - m_filter(filter), - m_dx_dbl(0.5), - m_dy_dbl(0.5), - m_dx_int(image_subpixel_scale / 2), - m_dy_int(image_subpixel_scale / 2) - {} - void attach(source_type& v) { m_src = &v; } + //-------------------------------------------------------------------- + interpolator_type& interpolator() { return *m_interpolator; } - //-------------------------------------------------------------------- - source_type& source() { return *m_src; } - const source_type& source() const { return *m_src; } - const image_filter_lut& filter() const { return *m_filter; } - int filter_dx_int() const { return m_dx_int; } - int filter_dy_int() const { return m_dy_int; } - double filter_dx_dbl() const { return m_dx_dbl; } - double filter_dy_dbl() const { return m_dy_dbl; } + //-------------------------------------------------------------------- + void prepare() {} - //-------------------------------------------------------------------- - void interpolator(interpolator_type& v) { m_interpolator = &v; } - void filter(const image_filter_lut& v) { m_filter = &v; } - void filter_offset(double dx, double dy) - { - m_dx_dbl = dx; - m_dy_dbl = dy; - m_dx_int = iround(dx * image_subpixel_scale); - m_dy_int = iround(dy * image_subpixel_scale); - } - void filter_offset(double d) { filter_offset(d, d); } + //-------------------------------------------------------------------- + private: + source_type* m_src; + interpolator_type* m_interpolator; + const image_filter_lut* m_filter; + double m_dx_dbl; + double m_dy_dbl; + unsigned m_dx_int; + unsigned m_dy_int; +}; - //-------------------------------------------------------------------- - interpolator_type& interpolator() { return *m_interpolator; } +//==============================================span_image_resample_affine +template +class span_image_resample_affine : public span_image_filter> +{ + public: + typedef Source source_type; + typedef span_interpolator_linear interpolator_type; + typedef span_image_filter base_type; - //-------------------------------------------------------------------- - void prepare() {} + //-------------------------------------------------------------------- + span_image_resample_affine() + : m_scale_limit(200.0) + , m_blur_x(1.0) + , m_blur_y(1.0) + {} - //-------------------------------------------------------------------- - private: - source_type* m_src; - interpolator_type* m_interpolator; - const image_filter_lut* m_filter; - double m_dx_dbl; - double m_dy_dbl; - unsigned m_dx_int; - unsigned m_dy_int; - }; + //-------------------------------------------------------------------- + span_image_resample_affine(source_type& src, interpolator_type& inter, const image_filter_lut& filter) + : base_type(src, inter, &filter) + , m_scale_limit(200.0) + , m_blur_x(1.0) + , m_blur_y(1.0) + {} + //-------------------------------------------------------------------- + int scale_limit() const { return uround(m_scale_limit); } + void scale_limit(int v) { m_scale_limit = v; } + //-------------------------------------------------------------------- + double blur_x() const { return m_blur_x; } + double blur_y() const { return m_blur_y; } + void blur_x(double v) { m_blur_x = v; } + void blur_y(double v) { m_blur_y = v; } + void blur(double v) { m_blur_x = m_blur_y = v; } - - //==============================================span_image_resample_affine - template - class span_image_resample_affine : - public span_image_filter > + //-------------------------------------------------------------------- + void prepare() { - public: - typedef Source source_type; - typedef span_interpolator_linear interpolator_type; - typedef span_image_filter base_type; + double scale_x; + double scale_y; - //-------------------------------------------------------------------- - span_image_resample_affine() : - m_scale_limit(200.0), - m_blur_x(1.0), - m_blur_y(1.0) - {} + base_type::interpolator().transformer().scaling_abs(&scale_x, &scale_y); - //-------------------------------------------------------------------- - span_image_resample_affine(source_type& src, - interpolator_type& inter, - const image_filter_lut& filter) : - base_type(src, inter, &filter), - m_scale_limit(200.0), - m_blur_x(1.0), - m_blur_y(1.0) - {} - - - //-------------------------------------------------------------------- - int scale_limit() const { return uround(m_scale_limit); } - void scale_limit(int v) { m_scale_limit = v; } - - //-------------------------------------------------------------------- - double blur_x() const { return m_blur_x; } - double blur_y() const { return m_blur_y; } - void blur_x(double v) { m_blur_x = v; } - void blur_y(double v) { m_blur_y = v; } - void blur(double v) { m_blur_x = m_blur_y = v; } - - //-------------------------------------------------------------------- - void prepare() + if (scale_x * scale_y > m_scale_limit) { - double scale_x; - double scale_y; - - base_type::interpolator().transformer().scaling_abs(&scale_x, &scale_y); - - if(scale_x * scale_y > m_scale_limit) - { - scale_x = scale_x * m_scale_limit / (scale_x * scale_y); - scale_y = scale_y * m_scale_limit / (scale_x * scale_y); - } - - if(scale_x < 1) scale_x = 1; - if(scale_y < 1) scale_y = 1; - - if(scale_x > m_scale_limit) scale_x = m_scale_limit; - if(scale_y > m_scale_limit) scale_y = m_scale_limit; - - scale_x *= m_blur_x; - scale_y *= m_blur_y; - - if(scale_x < 1) scale_x = 1; - if(scale_y < 1) scale_y = 1; - - m_rx = uround( scale_x * double(image_subpixel_scale)); - m_rx_inv = uround(1.0/scale_x * double(image_subpixel_scale)); - - m_ry = uround( scale_y * double(image_subpixel_scale)); - m_ry_inv = uround(1.0/scale_y * double(image_subpixel_scale)); + scale_x = scale_x * m_scale_limit / (scale_x * scale_y); + scale_y = scale_y * m_scale_limit / (scale_x * scale_y); } - protected: - int m_rx; - int m_ry; - int m_rx_inv; - int m_ry_inv; + if (scale_x < 1) + scale_x = 1; + if (scale_y < 1) + scale_y = 1; - private: - double m_scale_limit; - double m_blur_x; - double m_blur_y; - }; + if (scale_x > m_scale_limit) + scale_x = m_scale_limit; + if (scale_y > m_scale_limit) + scale_y = m_scale_limit; + scale_x *= m_blur_x; + scale_y *= m_blur_y; + if (scale_x < 1) + scale_x = 1; + if (scale_y < 1) + scale_y = 1; - //=====================================================span_image_resample - template - class span_image_resample : - public span_image_filter + m_rx = uround(scale_x * double(image_subpixel_scale)); + m_rx_inv = uround(1.0 / scale_x * double(image_subpixel_scale)); + + m_ry = uround(scale_y * double(image_subpixel_scale)); + m_ry_inv = uround(1.0 / scale_y * double(image_subpixel_scale)); + } + + protected: + int m_rx; + int m_ry; + int m_rx_inv; + int m_ry_inv; + + private: + double m_scale_limit; + double m_blur_x; + double m_blur_y; +}; + +//=====================================================span_image_resample +template +class span_image_resample : public span_image_filter +{ + public: + typedef Source source_type; + typedef Interpolator interpolator_type; + typedef span_image_filter base_type; + + //-------------------------------------------------------------------- + span_image_resample() + : m_scale_limit(20) + , m_blur_x(image_subpixel_scale) + , m_blur_y(image_subpixel_scale) + {} + + //-------------------------------------------------------------------- + span_image_resample(source_type& src, interpolator_type& inter, const image_filter_lut& filter) + : base_type(src, inter, &filter) + , m_scale_limit(20) + , m_blur_x(image_subpixel_scale) + , m_blur_y(image_subpixel_scale) + {} + + //-------------------------------------------------------------------- + int scale_limit() const { return m_scale_limit; } + void scale_limit(int v) { m_scale_limit = v; } + + //-------------------------------------------------------------------- + double blur_x() const { return double(m_blur_x) / double(image_subpixel_scale); } + double blur_y() const { return double(m_blur_y) / double(image_subpixel_scale); } + void blur_x(double v) { m_blur_x = uround(v * double(image_subpixel_scale)); } + void blur_y(double v) { m_blur_y = uround(v * double(image_subpixel_scale)); } + void blur(double v) { m_blur_x = m_blur_y = uround(v * double(image_subpixel_scale)); } + + protected: + AGG_INLINE void adjust_scale(int* rx, int* ry) { - public: - typedef Source source_type; - typedef Interpolator interpolator_type; - typedef span_image_filter base_type; - - //-------------------------------------------------------------------- - span_image_resample() : - m_scale_limit(20), - m_blur_x(image_subpixel_scale), - m_blur_y(image_subpixel_scale) - {} - - //-------------------------------------------------------------------- - span_image_resample(source_type& src, - interpolator_type& inter, - const image_filter_lut& filter) : - base_type(src, inter, &filter), - m_scale_limit(20), - m_blur_x(image_subpixel_scale), - m_blur_y(image_subpixel_scale) - {} - - //-------------------------------------------------------------------- - int scale_limit() const { return m_scale_limit; } - void scale_limit(int v) { m_scale_limit = v; } - - //-------------------------------------------------------------------- - double blur_x() const { return double(m_blur_x) / double(image_subpixel_scale); } - double blur_y() const { return double(m_blur_y) / double(image_subpixel_scale); } - void blur_x(double v) { m_blur_x = uround(v * double(image_subpixel_scale)); } - void blur_y(double v) { m_blur_y = uround(v * double(image_subpixel_scale)); } - void blur(double v) { m_blur_x = - m_blur_y = uround(v * double(image_subpixel_scale)); } - - protected: - AGG_INLINE void adjust_scale(int* rx, int* ry) + if (*rx < image_subpixel_scale) + *rx = image_subpixel_scale; + if (*ry < image_subpixel_scale) + *ry = image_subpixel_scale; + if (*rx > image_subpixel_scale * m_scale_limit) { - if(*rx < image_subpixel_scale) *rx = image_subpixel_scale; - if(*ry < image_subpixel_scale) *ry = image_subpixel_scale; - if(*rx > image_subpixel_scale * m_scale_limit) - { - *rx = image_subpixel_scale * m_scale_limit; - } - if(*ry > image_subpixel_scale * m_scale_limit) - { - *ry = image_subpixel_scale * m_scale_limit; - } - *rx = (*rx * m_blur_x) >> image_subpixel_shift; - *ry = (*ry * m_blur_y) >> image_subpixel_shift; - if(*rx < image_subpixel_scale) *rx = image_subpixel_scale; - if(*ry < image_subpixel_scale) *ry = image_subpixel_scale; + *rx = image_subpixel_scale * m_scale_limit; } + if (*ry > image_subpixel_scale * m_scale_limit) + { + *ry = image_subpixel_scale * m_scale_limit; + } + *rx = (*rx * m_blur_x) >> image_subpixel_shift; + *ry = (*ry * m_blur_y) >> image_subpixel_shift; + if (*rx < image_subpixel_scale) + *rx = image_subpixel_scale; + if (*ry < image_subpixel_scale) + *ry = image_subpixel_scale; + } - int m_scale_limit; - int m_blur_x; - int m_blur_y; - }; + int m_scale_limit; + int m_blur_x; + int m_blur_y; +}; - - - -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_span_image_filter_gray.h b/deps/agg/include/agg_span_image_filter_gray.h index 9f3ede78f..a4bfe162e 100644 --- a/deps/agg/include/agg_span_image_filter_gray.h +++ b/deps/agg/include/agg_span_image_filter_gray.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -13,12 +13,12 @@ // http://www.antigrain.com //---------------------------------------------------------------------------- // -// Adaptation for high precision colors has been sponsored by +// Adaptation for high precision colors has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. -// +// //---------------------------------------------------------------------------- #ifndef AGG_SPAN_IMAGE_FILTER_GRAY_INCLUDED #define AGG_SPAN_IMAGE_FILTER_GRAY_INCLUDED @@ -27,722 +27,623 @@ #include "agg_color_gray.h" #include "agg_span_image_filter.h" +namespace agg { -namespace agg +//==============================================span_image_filter_gray_nn +template +class span_image_filter_gray_nn : public span_image_filter { + public: + typedef Source source_type; + typedef typename source_type::color_type color_type; + typedef Interpolator interpolator_type; + typedef span_image_filter base_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; - //==============================================span_image_filter_gray_nn - template - class span_image_filter_gray_nn : - public span_image_filter + //-------------------------------------------------------------------- + span_image_filter_gray_nn() {} + span_image_filter_gray_nn(source_type& src, interpolator_type& inter) + : base_type(src, inter, 0) + {} + + //-------------------------------------------------------------------- + void generate(color_type* span, int x, int y, unsigned len) { - public: - typedef Source source_type; - typedef typename source_type::color_type color_type; - typedef Interpolator interpolator_type; - typedef span_image_filter base_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; - enum base_scale_e + base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); + do { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + base_type::interpolator().coordinates(&x, &y); + span->v = + *(const value_type*)base_type::source().span(x >> image_subpixel_shift, y >> image_subpixel_shift, 1); + span->a = base_mask; + ++span; + ++base_type::interpolator(); + } while (--len); + } +}; - //-------------------------------------------------------------------- - span_image_filter_gray_nn() {} - span_image_filter_gray_nn(source_type& src, - interpolator_type& inter) : - base_type(src, inter, 0) - {} +//=========================================span_image_filter_gray_bilinear +template +class span_image_filter_gray_bilinear : public span_image_filter +{ + public: + typedef Source source_type; + typedef typename source_type::color_type color_type; + typedef Interpolator interpolator_type; + typedef span_image_filter base_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; - //-------------------------------------------------------------------- - void generate(color_type* span, int x, int y, unsigned len) - { - base_type::interpolator().begin(x + base_type::filter_dx_dbl(), - y + base_type::filter_dy_dbl(), len); - do - { - base_type::interpolator().coordinates(&x, &y); - span->v = *(const value_type*) - base_type::source().span(x >> image_subpixel_shift, - y >> image_subpixel_shift, - 1); - span->a = base_mask; - ++span; - ++base_type::interpolator(); - } while(--len); - } - }; + //-------------------------------------------------------------------- + span_image_filter_gray_bilinear() {} + span_image_filter_gray_bilinear(source_type& src, interpolator_type& inter) + : base_type(src, inter, 0) + {} - - - //=========================================span_image_filter_gray_bilinear - template - class span_image_filter_gray_bilinear : - public span_image_filter + //-------------------------------------------------------------------- + void generate(color_type* span, int x, int y, unsigned len) { - public: - typedef Source source_type; - typedef typename source_type::color_type color_type; - typedef Interpolator interpolator_type; - typedef span_image_filter base_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; - enum base_scale_e + base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); + calc_type fg; + const value_type* fg_ptr; + do { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + int x_hr; + int y_hr; - //-------------------------------------------------------------------- - span_image_filter_gray_bilinear() {} - span_image_filter_gray_bilinear(source_type& src, - interpolator_type& inter) : - base_type(src, inter, 0) - {} + base_type::interpolator().coordinates(&x_hr, &y_hr); + x_hr -= base_type::filter_dx_int(); + y_hr -= base_type::filter_dy_int(); - //-------------------------------------------------------------------- - void generate(color_type* span, int x, int y, unsigned len) + int x_lr = x_hr >> image_subpixel_shift; + int y_lr = y_hr >> image_subpixel_shift; + + fg = image_subpixel_scale * image_subpixel_scale / 2; + + x_hr &= image_subpixel_mask; + y_hr &= image_subpixel_mask; + + fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, 2); + fg += *fg_ptr * (image_subpixel_scale - x_hr) * (image_subpixel_scale - y_hr); + + fg_ptr = (const value_type*)base_type::source().next_x(); + fg += *fg_ptr * x_hr * (image_subpixel_scale - y_hr); + + fg_ptr = (const value_type*)base_type::source().next_y(); + fg += *fg_ptr * (image_subpixel_scale - x_hr) * y_hr; + + fg_ptr = (const value_type*)base_type::source().next_x(); + fg += *fg_ptr * x_hr * y_hr; + + span->v = value_type(fg >> (image_subpixel_shift * 2)); + span->a = base_mask; + ++span; + ++base_type::interpolator(); + + } while (--len); + } +}; + +//====================================span_image_filter_gray_bilinear_clip +template +class span_image_filter_gray_bilinear_clip : public span_image_filter +{ + public: + typedef Source source_type; + typedef typename source_type::color_type color_type; + typedef Interpolator interpolator_type; + typedef span_image_filter base_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; + + //-------------------------------------------------------------------- + span_image_filter_gray_bilinear_clip() {} + span_image_filter_gray_bilinear_clip(source_type& src, const color_type& back_color, interpolator_type& inter) + : base_type(src, inter, 0) + , m_back_color(back_color) + {} + const color_type& background_color() const { return m_back_color; } + void background_color(const color_type& v) { m_back_color = v; } + + //-------------------------------------------------------------------- + void generate(color_type* span, int x, int y, unsigned len) + { + base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); + calc_type fg; + calc_type src_alpha; + value_type back_v = m_back_color.v; + value_type back_a = m_back_color.a; + + const value_type* fg_ptr; + + int maxx = base_type::source().width() - 1; + int maxy = base_type::source().height() - 1; + + do { - base_type::interpolator().begin(x + base_type::filter_dx_dbl(), - y + base_type::filter_dy_dbl(), len); - calc_type fg; - const value_type *fg_ptr; - do + int x_hr; + int y_hr; + + base_type::interpolator().coordinates(&x_hr, &y_hr); + + x_hr -= base_type::filter_dx_int(); + y_hr -= base_type::filter_dy_int(); + + int x_lr = x_hr >> image_subpixel_shift; + int y_lr = y_hr >> image_subpixel_shift; + + if (x_lr >= 0 && y_lr >= 0 && x_lr < maxx && y_lr < maxy) { - int x_hr; - int y_hr; - - base_type::interpolator().coordinates(&x_hr, &y_hr); - - x_hr -= base_type::filter_dx_int(); - y_hr -= base_type::filter_dy_int(); - - int x_lr = x_hr >> image_subpixel_shift; - int y_lr = y_hr >> image_subpixel_shift; - fg = image_subpixel_scale * image_subpixel_scale / 2; x_hr &= image_subpixel_mask; y_hr &= image_subpixel_mask; + fg_ptr = (const value_type*)base_type::source().row_ptr(y_lr) + x_lr; - fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, 2); - fg += *fg_ptr * (image_subpixel_scale - x_hr) * (image_subpixel_scale - y_hr); + fg += *fg_ptr++ * (image_subpixel_scale - x_hr) * (image_subpixel_scale - y_hr); + fg += *fg_ptr++ * (image_subpixel_scale - y_hr) * x_hr; - fg_ptr = (const value_type*)base_type::source().next_x(); - fg += *fg_ptr * x_hr * (image_subpixel_scale - y_hr); + ++y_lr; + fg_ptr = (const value_type*)base_type::source().row_ptr(y_lr) + x_lr; - fg_ptr = (const value_type*)base_type::source().next_y(); - fg += *fg_ptr * (image_subpixel_scale - x_hr) * y_hr; + fg += *fg_ptr++ * (image_subpixel_scale - x_hr) * y_hr; + fg += *fg_ptr++ * x_hr * y_hr; - fg_ptr = (const value_type*)base_type::source().next_x(); - fg += *fg_ptr * x_hr * y_hr; - - span->v = value_type(fg >> (image_subpixel_shift * 2)); - span->a = base_mask; - ++span; - ++base_type::interpolator(); - - } while(--len); - } - }; - - - //====================================span_image_filter_gray_bilinear_clip - template - class span_image_filter_gray_bilinear_clip : - public span_image_filter - { - public: - typedef Source source_type; - typedef typename source_type::color_type color_type; - typedef Interpolator interpolator_type; - typedef span_image_filter base_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; - - //-------------------------------------------------------------------- - span_image_filter_gray_bilinear_clip() {} - span_image_filter_gray_bilinear_clip(source_type& src, - const color_type& back_color, - interpolator_type& inter) : - base_type(src, inter, 0), - m_back_color(back_color) - {} - const color_type& background_color() const { return m_back_color; } - void background_color(const color_type& v) { m_back_color = v; } - - //-------------------------------------------------------------------- - void generate(color_type* span, int x, int y, unsigned len) - { - base_type::interpolator().begin(x + base_type::filter_dx_dbl(), - y + base_type::filter_dy_dbl(), len); - calc_type fg; - calc_type src_alpha; - value_type back_v = m_back_color.v; - value_type back_a = m_back_color.a; - - const value_type *fg_ptr; - - int maxx = base_type::source().width() - 1; - int maxy = base_type::source().height() - 1; - - do + fg >>= image_subpixel_shift * 2; + src_alpha = base_mask; + } + else { - int x_hr; - int y_hr; - - base_type::interpolator().coordinates(&x_hr, &y_hr); - - x_hr -= base_type::filter_dx_int(); - y_hr -= base_type::filter_dy_int(); - - int x_lr = x_hr >> image_subpixel_shift; - int y_lr = y_hr >> image_subpixel_shift; - - if(x_lr >= 0 && y_lr >= 0 && - x_lr < maxx && y_lr < maxy) + unsigned weight; + if (x_lr < -1 || y_lr < -1 || x_lr > maxx || y_lr > maxy) { - fg = image_subpixel_scale * image_subpixel_scale / 2; - - x_hr &= image_subpixel_mask; - y_hr &= image_subpixel_mask; - fg_ptr = (const value_type*)base_type::source().row_ptr(y_lr) + x_lr; - - fg += *fg_ptr++ * (image_subpixel_scale - x_hr) * (image_subpixel_scale - y_hr); - fg += *fg_ptr++ * (image_subpixel_scale - y_hr) * x_hr; - - ++y_lr; - fg_ptr = (const value_type*)base_type::source().row_ptr(y_lr) + x_lr; - - fg += *fg_ptr++ * (image_subpixel_scale - x_hr) * y_hr; - fg += *fg_ptr++ * x_hr * y_hr; - - fg >>= image_subpixel_shift * 2; - src_alpha = base_mask; + fg = back_v; + src_alpha = back_a; } else { - unsigned weight; - if(x_lr < -1 || y_lr < -1 || - x_lr > maxx || y_lr > maxy) + fg = src_alpha = image_subpixel_scale * image_subpixel_scale / 2; + + x_hr &= image_subpixel_mask; + y_hr &= image_subpixel_mask; + + weight = (image_subpixel_scale - x_hr) * (image_subpixel_scale - y_hr); + if (x_lr >= 0 && y_lr >= 0 && x_lr <= maxx && y_lr <= maxy) { - fg = back_v; - src_alpha = back_a; + fg += weight * *((const value_type*)base_type::source().row_ptr(y_lr) + x_lr); + src_alpha += weight * base_mask; } else { - fg = - src_alpha = image_subpixel_scale * image_subpixel_scale / 2; - - x_hr &= image_subpixel_mask; - y_hr &= image_subpixel_mask; - - weight = (image_subpixel_scale - x_hr) * - (image_subpixel_scale - y_hr); - if(x_lr >= 0 && y_lr >= 0 && - x_lr <= maxx && y_lr <= maxy) - { - fg += weight * - *((const value_type*)base_type::source().row_ptr(y_lr) + x_lr); - src_alpha += weight * base_mask; - } - else - { - fg += back_v * weight; - src_alpha += back_a * weight; - } - - x_lr++; - - weight = x_hr * (image_subpixel_scale - y_hr); - if(x_lr >= 0 && y_lr >= 0 && - x_lr <= maxx && y_lr <= maxy) - { - fg += weight * - *((const value_type*)base_type::source().row_ptr(y_lr) + x_lr); - src_alpha += weight * base_mask; - } - else - { - fg += back_v * weight; - src_alpha += back_a * weight; - } - - x_lr--; - y_lr++; - - weight = (image_subpixel_scale - x_hr) * y_hr; - if(x_lr >= 0 && y_lr >= 0 && - x_lr <= maxx && y_lr <= maxy) - { - fg += weight * - *((const value_type*)base_type::source().row_ptr(y_lr) + x_lr); - src_alpha += weight * base_mask; - } - else - { - fg += back_v * weight; - src_alpha += back_a * weight; - } - - x_lr++; - - weight = x_hr * y_hr; - if(x_lr >= 0 && y_lr >= 0 && - x_lr <= maxx && y_lr <= maxy) - { - fg += weight * - *((const value_type*)base_type::source().row_ptr(y_lr) + x_lr); - src_alpha += weight * base_mask; - } - else - { - fg += back_v * weight; - src_alpha += back_a * weight; - } - - fg >>= image_subpixel_shift * 2; - src_alpha >>= image_subpixel_shift * 2; + fg += back_v * weight; + src_alpha += back_a * weight; } + + x_lr++; + + weight = x_hr * (image_subpixel_scale - y_hr); + if (x_lr >= 0 && y_lr >= 0 && x_lr <= maxx && y_lr <= maxy) + { + fg += weight * *((const value_type*)base_type::source().row_ptr(y_lr) + x_lr); + src_alpha += weight * base_mask; + } + else + { + fg += back_v * weight; + src_alpha += back_a * weight; + } + + x_lr--; + y_lr++; + + weight = (image_subpixel_scale - x_hr) * y_hr; + if (x_lr >= 0 && y_lr >= 0 && x_lr <= maxx && y_lr <= maxy) + { + fg += weight * *((const value_type*)base_type::source().row_ptr(y_lr) + x_lr); + src_alpha += weight * base_mask; + } + else + { + fg += back_v * weight; + src_alpha += back_a * weight; + } + + x_lr++; + + weight = x_hr * y_hr; + if (x_lr >= 0 && y_lr >= 0 && x_lr <= maxx && y_lr <= maxy) + { + fg += weight * *((const value_type*)base_type::source().row_ptr(y_lr) + x_lr); + src_alpha += weight * base_mask; + } + else + { + fg += back_v * weight; + src_alpha += back_a * weight; + } + + fg >>= image_subpixel_shift * 2; + src_alpha >>= image_subpixel_shift * 2; + } + } + + span->v = (value_type)fg; + span->a = (value_type)src_alpha; + ++span; + ++base_type::interpolator(); + + } while (--len); + } + + private: + color_type m_back_color; +}; + +//==============================================span_image_filter_gray_2x2 +template +class span_image_filter_gray_2x2 : public span_image_filter +{ + public: + typedef Source source_type; + typedef typename source_type::color_type color_type; + typedef Interpolator interpolator_type; + typedef span_image_filter base_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; + + //-------------------------------------------------------------------- + span_image_filter_gray_2x2() {} + span_image_filter_gray_2x2(source_type& src, interpolator_type& inter, const image_filter_lut& filter) + : base_type(src, inter, &filter) + {} + + //-------------------------------------------------------------------- + void generate(color_type* span, int x, int y, unsigned len) + { + base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); + + calc_type fg; + + const value_type* fg_ptr; + const int16* weight_array = + base_type::filter().weight_array() + ((base_type::filter().diameter() / 2 - 1) << image_subpixel_shift); + do + { + int x_hr; + int y_hr; + + base_type::interpolator().coordinates(&x_hr, &y_hr); + + x_hr -= base_type::filter_dx_int(); + y_hr -= base_type::filter_dy_int(); + + int x_lr = x_hr >> image_subpixel_shift; + int y_lr = y_hr >> image_subpixel_shift; + + unsigned weight; + fg = image_filter_scale / 2; + + x_hr &= image_subpixel_mask; + y_hr &= image_subpixel_mask; + + fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, 2); + weight = (weight_array[x_hr + image_subpixel_scale] * weight_array[y_hr + image_subpixel_scale] + + image_filter_scale / 2) >> + image_filter_shift; + fg += weight * *fg_ptr; + + fg_ptr = (const value_type*)base_type::source().next_x(); + weight = (weight_array[x_hr] * weight_array[y_hr + image_subpixel_scale] + image_filter_scale / 2) >> + image_filter_shift; + fg += weight * *fg_ptr; + + fg_ptr = (const value_type*)base_type::source().next_y(); + weight = (weight_array[x_hr + image_subpixel_scale] * weight_array[y_hr] + image_filter_scale / 2) >> + image_filter_shift; + fg += weight * *fg_ptr; + + fg_ptr = (const value_type*)base_type::source().next_x(); + weight = (weight_array[x_hr] * weight_array[y_hr] + image_filter_scale / 2) >> image_filter_shift; + fg += weight * *fg_ptr; + + fg >>= image_filter_shift; + if (fg > base_mask) + fg = base_mask; + + span->v = (value_type)fg; + span->a = base_mask; + ++span; + ++base_type::interpolator(); + } while (--len); + } +}; + +//==================================================span_image_filter_gray +template +class span_image_filter_gray : public span_image_filter +{ + public: + typedef Source source_type; + typedef typename source_type::color_type color_type; + typedef Interpolator interpolator_type; + typedef span_image_filter base_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; + + //-------------------------------------------------------------------- + span_image_filter_gray() {} + span_image_filter_gray(source_type& src, interpolator_type& inter, const image_filter_lut& filter) + : base_type(src, inter, &filter) + {} + + //-------------------------------------------------------------------- + void generate(color_type* span, int x, int y, unsigned len) + { + base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); + + int fg; + const value_type* fg_ptr; + + unsigned diameter = base_type::filter().diameter(); + int start = base_type::filter().start(); + const int16* weight_array = base_type::filter().weight_array(); + + int x_count; + int weight_y; + + do + { + base_type::interpolator().coordinates(&x, &y); + + x -= base_type::filter_dx_int(); + y -= base_type::filter_dy_int(); + + int x_hr = x; + int y_hr = y; + + int x_lr = x_hr >> image_subpixel_shift; + int y_lr = y_hr >> image_subpixel_shift; + + fg = image_filter_scale / 2; + + int x_fract = x_hr & image_subpixel_mask; + unsigned y_count = diameter; + + y_hr = image_subpixel_mask - (y_hr & image_subpixel_mask); + fg_ptr = (const value_type*)base_type::source().span(x_lr + start, y_lr + start, diameter); + for (;;) + { + x_count = diameter; + weight_y = weight_array[y_hr]; + x_hr = image_subpixel_mask - x_fract; + for (;;) + { + fg += *fg_ptr * ((weight_y * weight_array[x_hr] + image_filter_scale / 2) >> image_filter_shift); + if (--x_count == 0) + break; + x_hr += image_subpixel_scale; + fg_ptr = (const value_type*)base_type::source().next_x(); } - span->v = (value_type)fg; - span->a = (value_type)src_alpha; - ++span; - ++base_type::interpolator(); - - } while(--len); - } - private: - color_type m_back_color; - }; - - - - //==============================================span_image_filter_gray_2x2 - template - class span_image_filter_gray_2x2 : - public span_image_filter - { - public: - typedef Source source_type; - typedef typename source_type::color_type color_type; - typedef Interpolator interpolator_type; - typedef span_image_filter base_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; - - //-------------------------------------------------------------------- - span_image_filter_gray_2x2() {} - span_image_filter_gray_2x2(source_type& src, - interpolator_type& inter, - const image_filter_lut& filter) : - base_type(src, inter, &filter) - {} - - - //-------------------------------------------------------------------- - void generate(color_type* span, int x, int y, unsigned len) - { - base_type::interpolator().begin(x + base_type::filter_dx_dbl(), - y + base_type::filter_dy_dbl(), len); - - calc_type fg; - - const value_type *fg_ptr; - const int16* weight_array = base_type::filter().weight_array() + - ((base_type::filter().diameter()/2 - 1) << - image_subpixel_shift); - do - { - int x_hr; - int y_hr; - - base_type::interpolator().coordinates(&x_hr, &y_hr); - - x_hr -= base_type::filter_dx_int(); - y_hr -= base_type::filter_dy_int(); - - int x_lr = x_hr >> image_subpixel_shift; - int y_lr = y_hr >> image_subpixel_shift; - - unsigned weight; - fg = image_filter_scale / 2; - - x_hr &= image_subpixel_mask; - y_hr &= image_subpixel_mask; - - fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, 2); - weight = (weight_array[x_hr + image_subpixel_scale] * - weight_array[y_hr + image_subpixel_scale] + - image_filter_scale / 2) >> - image_filter_shift; - fg += weight * *fg_ptr; - - fg_ptr = (const value_type*)base_type::source().next_x(); - weight = (weight_array[x_hr] * - weight_array[y_hr + image_subpixel_scale] + - image_filter_scale / 2) >> - image_filter_shift; - fg += weight * *fg_ptr; - + if (--y_count == 0) + break; + y_hr += image_subpixel_scale; fg_ptr = (const value_type*)base_type::source().next_y(); - weight = (weight_array[x_hr + image_subpixel_scale] * - weight_array[y_hr] + - image_filter_scale / 2) >> - image_filter_shift; - fg += weight * *fg_ptr; + } - fg_ptr = (const value_type*)base_type::source().next_x(); - weight = (weight_array[x_hr] * - weight_array[y_hr] + - image_filter_scale / 2) >> - image_filter_shift; - fg += weight * *fg_ptr; + fg >>= image_filter_shift; + if (fg < 0) + fg = 0; + if (fg > base_mask) + fg = base_mask; + span->v = (value_type)fg; + span->a = base_mask; - fg >>= image_filter_shift; - if(fg > base_mask) fg = base_mask; + ++span; + ++base_type::interpolator(); - span->v = (value_type)fg; - span->a = base_mask; - ++span; - ++base_type::interpolator(); - } while(--len); - } + } while (--len); + } +}; + +//=========================================span_image_resample_gray_affine +template +class span_image_resample_gray_affine : public span_image_resample_affine +{ + public: + typedef Source source_type; + typedef typename source_type::color_type color_type; + typedef span_image_resample_affine base_type; + typedef typename base_type::interpolator_type interpolator_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::long_type long_type; + enum base_scale_e { + base_shift = color_type::base_shift, + base_mask = color_type::base_mask, + downscale_shift = image_filter_shift }; + //-------------------------------------------------------------------- + span_image_resample_gray_affine() {} + span_image_resample_gray_affine(source_type& src, interpolator_type& inter, const image_filter_lut& filter) + : base_type(src, inter, filter) + {} - - //==================================================span_image_filter_gray - template - class span_image_filter_gray : - public span_image_filter + //-------------------------------------------------------------------- + void generate(color_type* span, int x, int y, unsigned len) { - public: - typedef Source source_type; - typedef typename source_type::color_type color_type; - typedef Interpolator interpolator_type; - typedef span_image_filter base_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; - enum base_scale_e + base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); + + long_type fg; + + int diameter = base_type::filter().diameter(); + int filter_scale = diameter << image_subpixel_shift; + int radius_x = (diameter * base_type::m_rx) >> 1; + int radius_y = (diameter * base_type::m_ry) >> 1; + int len_x_lr = (diameter * base_type::m_rx + image_subpixel_mask) >> image_subpixel_shift; + + const int16* weight_array = base_type::filter().weight_array(); + + do { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + base_type::interpolator().coordinates(&x, &y); - //-------------------------------------------------------------------- - span_image_filter_gray() {} - span_image_filter_gray(source_type& src, - interpolator_type& inter, - const image_filter_lut& filter) : - base_type(src, inter, &filter) - {} + x += base_type::filter_dx_int() - radius_x; + y += base_type::filter_dy_int() - radius_y; - //-------------------------------------------------------------------- - void generate(color_type* span, int x, int y, unsigned len) - { - base_type::interpolator().begin(x + base_type::filter_dx_dbl(), - y + base_type::filter_dy_dbl(), len); + fg = image_filter_scale / 2; - int fg; - const value_type *fg_ptr; + int y_lr = y >> image_subpixel_shift; + int y_hr = + ((image_subpixel_mask - (y & image_subpixel_mask)) * base_type::m_ry_inv) >> image_subpixel_shift; + int total_weight = 0; + int x_lr = x >> image_subpixel_shift; + int x_hr = + ((image_subpixel_mask - (x & image_subpixel_mask)) * base_type::m_rx_inv) >> image_subpixel_shift; - unsigned diameter = base_type::filter().diameter(); - int start = base_type::filter().start(); - const int16* weight_array = base_type::filter().weight_array(); - - int x_count; - int weight_y; - - do + int x_hr2 = x_hr; + const value_type* fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, len_x_lr); + for (;;) { - base_type::interpolator().coordinates(&x, &y); - - x -= base_type::filter_dx_int(); - y -= base_type::filter_dy_int(); - - int x_hr = x; - int y_hr = y; - - int x_lr = x_hr >> image_subpixel_shift; - int y_lr = y_hr >> image_subpixel_shift; - - fg = image_filter_scale / 2; - - int x_fract = x_hr & image_subpixel_mask; - unsigned y_count = diameter; - - y_hr = image_subpixel_mask - (y_hr & image_subpixel_mask); - fg_ptr = (const value_type*)base_type::source().span(x_lr + start, - y_lr + start, - diameter); - for(;;) + int weight_y = weight_array[y_hr]; + x_hr = x_hr2; + for (;;) { - x_count = diameter; - weight_y = weight_array[y_hr]; - x_hr = image_subpixel_mask - x_fract; - for(;;) - { - fg += *fg_ptr * - ((weight_y * weight_array[x_hr] + - image_filter_scale / 2) >> - image_filter_shift); - if(--x_count == 0) break; - x_hr += image_subpixel_scale; - fg_ptr = (const value_type*)base_type::source().next_x(); - } + int weight = (weight_y * weight_array[x_hr] + image_filter_scale / 2) >> downscale_shift; - if(--y_count == 0) break; - y_hr += image_subpixel_scale; - fg_ptr = (const value_type*)base_type::source().next_y(); + fg += *fg_ptr * weight; + total_weight += weight; + x_hr += base_type::m_rx_inv; + if (x_hr >= filter_scale) + break; + fg_ptr = (const value_type*)base_type::source().next_x(); } + y_hr += base_type::m_ry_inv; + if (y_hr >= filter_scale) + break; + fg_ptr = (const value_type*)base_type::source().next_y(); + } - fg >>= image_filter_shift; - if(fg < 0) fg = 0; - if(fg > base_mask) fg = base_mask; - span->v = (value_type)fg; - span->a = base_mask; + fg /= total_weight; + if (fg < 0) + fg = 0; + if (fg > base_mask) + fg = base_mask; - ++span; - ++base_type::interpolator(); + span->v = (value_type)fg; + span->a = base_mask; - } while(--len); - } + ++span; + ++base_type::interpolator(); + } while (--len); + } +}; + +//================================================span_image_resample_gray +template +class span_image_resample_gray : public span_image_resample +{ + public: + typedef Source source_type; + typedef typename source_type::color_type color_type; + typedef Interpolator interpolator_type; + typedef span_image_resample base_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::long_type long_type; + enum base_scale_e { + base_shift = color_type::base_shift, + base_mask = color_type::base_mask, + downscale_shift = image_filter_shift }; + //-------------------------------------------------------------------- + span_image_resample_gray() {} + span_image_resample_gray(source_type& src, interpolator_type& inter, const image_filter_lut& filter) + : base_type(src, inter, filter) + {} - - //=========================================span_image_resample_gray_affine - template - class span_image_resample_gray_affine : - public span_image_resample_affine + //-------------------------------------------------------------------- + void generate(color_type* span, int x, int y, unsigned len) { - public: - typedef Source source_type; - typedef typename source_type::color_type color_type; - typedef span_image_resample_affine base_type; - typedef typename base_type::interpolator_type interpolator_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::long_type long_type; - enum base_scale_e + base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); + long_type fg; + + int diameter = base_type::filter().diameter(); + int filter_scale = diameter << image_subpixel_shift; + + const int16* weight_array = base_type::filter().weight_array(); + do { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask, - downscale_shift = image_filter_shift - }; + int rx; + int ry; + int rx_inv = image_subpixel_scale; + int ry_inv = image_subpixel_scale; + base_type::interpolator().coordinates(&x, &y); + base_type::interpolator().local_scale(&rx, &ry); + base_type::adjust_scale(&rx, &ry); - //-------------------------------------------------------------------- - span_image_resample_gray_affine() {} - span_image_resample_gray_affine(source_type& src, - interpolator_type& inter, - const image_filter_lut& filter) : - base_type(src, inter, filter) - {} + rx_inv = image_subpixel_scale * image_subpixel_scale / rx; + ry_inv = image_subpixel_scale * image_subpixel_scale / ry; + int radius_x = (diameter * rx) >> 1; + int radius_y = (diameter * ry) >> 1; + int len_x_lr = (diameter * rx + image_subpixel_mask) >> image_subpixel_shift; - //-------------------------------------------------------------------- - void generate(color_type* span, int x, int y, unsigned len) - { - base_type::interpolator().begin(x + base_type::filter_dx_dbl(), - y + base_type::filter_dy_dbl(), len); + x += base_type::filter_dx_int() - radius_x; + y += base_type::filter_dy_int() - radius_y; - long_type fg; + fg = image_filter_scale / 2; - int diameter = base_type::filter().diameter(); - int filter_scale = diameter << image_subpixel_shift; - int radius_x = (diameter * base_type::m_rx) >> 1; - int radius_y = (diameter * base_type::m_ry) >> 1; - int len_x_lr = - (diameter * base_type::m_rx + image_subpixel_mask) >> - image_subpixel_shift; + int y_lr = y >> image_subpixel_shift; + int y_hr = ((image_subpixel_mask - (y & image_subpixel_mask)) * ry_inv) >> image_subpixel_shift; + int total_weight = 0; + int x_lr = x >> image_subpixel_shift; + int x_hr = ((image_subpixel_mask - (x & image_subpixel_mask)) * rx_inv) >> image_subpixel_shift; + int x_hr2 = x_hr; + const value_type* fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, len_x_lr); - const int16* weight_array = base_type::filter().weight_array(); - - do + for (;;) { - base_type::interpolator().coordinates(&x, &y); - - x += base_type::filter_dx_int() - radius_x; - y += base_type::filter_dy_int() - radius_y; - - fg = image_filter_scale / 2; - - int y_lr = y >> image_subpixel_shift; - int y_hr = ((image_subpixel_mask - (y & image_subpixel_mask)) * - base_type::m_ry_inv) >> - image_subpixel_shift; - int total_weight = 0; - int x_lr = x >> image_subpixel_shift; - int x_hr = ((image_subpixel_mask - (x & image_subpixel_mask)) * - base_type::m_rx_inv) >> - image_subpixel_shift; - - int x_hr2 = x_hr; - const value_type* fg_ptr = - (const value_type*)base_type::source().span(x_lr, y_lr, len_x_lr); - for(;;) + int weight_y = weight_array[y_hr]; + x_hr = x_hr2; + for (;;) { - int weight_y = weight_array[y_hr]; - x_hr = x_hr2; - for(;;) - { - int weight = (weight_y * weight_array[x_hr] + - image_filter_scale / 2) >> - downscale_shift; - - fg += *fg_ptr * weight; - total_weight += weight; - x_hr += base_type::m_rx_inv; - if(x_hr >= filter_scale) break; - fg_ptr = (const value_type*)base_type::source().next_x(); - } - y_hr += base_type::m_ry_inv; - if(y_hr >= filter_scale) break; - fg_ptr = (const value_type*)base_type::source().next_y(); + int weight = (weight_y * weight_array[x_hr] + image_filter_scale / 2) >> downscale_shift; + fg += *fg_ptr * weight; + total_weight += weight; + x_hr += rx_inv; + if (x_hr >= filter_scale) + break; + fg_ptr = (const value_type*)base_type::source().next_x(); } + y_hr += ry_inv; + if (y_hr >= filter_scale) + break; + fg_ptr = (const value_type*)base_type::source().next_y(); + } - fg /= total_weight; - if(fg < 0) fg = 0; - if(fg > base_mask) fg = base_mask; + fg /= total_weight; + if (fg < 0) + fg = 0; + if (fg > base_mask) + fg = base_mask; - span->v = (value_type)fg; - span->a = base_mask; + span->v = (value_type)fg; + span->a = base_mask; - ++span; - ++base_type::interpolator(); - } while(--len); - } - }; - - - - //================================================span_image_resample_gray - template - class span_image_resample_gray : - public span_image_resample - { - public: - typedef Source source_type; - typedef typename source_type::color_type color_type; - typedef Interpolator interpolator_type; - typedef span_image_resample base_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::long_type long_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask, - downscale_shift = image_filter_shift - }; - - //-------------------------------------------------------------------- - span_image_resample_gray() {} - span_image_resample_gray(source_type& src, - interpolator_type& inter, - const image_filter_lut& filter) : - base_type(src, inter, filter) - {} - - //-------------------------------------------------------------------- - void generate(color_type* span, int x, int y, unsigned len) - { - base_type::interpolator().begin(x + base_type::filter_dx_dbl(), - y + base_type::filter_dy_dbl(), len); - long_type fg; - - int diameter = base_type::filter().diameter(); - int filter_scale = diameter << image_subpixel_shift; - - const int16* weight_array = base_type::filter().weight_array(); - do - { - int rx; - int ry; - int rx_inv = image_subpixel_scale; - int ry_inv = image_subpixel_scale; - base_type::interpolator().coordinates(&x, &y); - base_type::interpolator().local_scale(&rx, &ry); - base_type::adjust_scale(&rx, &ry); - - rx_inv = image_subpixel_scale * image_subpixel_scale / rx; - ry_inv = image_subpixel_scale * image_subpixel_scale / ry; - - int radius_x = (diameter * rx) >> 1; - int radius_y = (diameter * ry) >> 1; - int len_x_lr = - (diameter * rx + image_subpixel_mask) >> - image_subpixel_shift; - - x += base_type::filter_dx_int() - radius_x; - y += base_type::filter_dy_int() - radius_y; - - fg = image_filter_scale / 2; - - int y_lr = y >> image_subpixel_shift; - int y_hr = ((image_subpixel_mask - (y & image_subpixel_mask)) * - ry_inv) >> - image_subpixel_shift; - int total_weight = 0; - int x_lr = x >> image_subpixel_shift; - int x_hr = ((image_subpixel_mask - (x & image_subpixel_mask)) * - rx_inv) >> - image_subpixel_shift; - int x_hr2 = x_hr; - const value_type* fg_ptr = - (const value_type*)base_type::source().span(x_lr, y_lr, len_x_lr); - - for(;;) - { - int weight_y = weight_array[y_hr]; - x_hr = x_hr2; - for(;;) - { - int weight = (weight_y * weight_array[x_hr] + - image_filter_scale / 2) >> - downscale_shift; - fg += *fg_ptr * weight; - total_weight += weight; - x_hr += rx_inv; - if(x_hr >= filter_scale) break; - fg_ptr = (const value_type*)base_type::source().next_x(); - } - y_hr += ry_inv; - if(y_hr >= filter_scale) break; - fg_ptr = (const value_type*)base_type::source().next_y(); - } - - fg /= total_weight; - if(fg < 0) fg = 0; - if(fg > base_mask) fg = base_mask; - - span->v = (value_type)fg; - span->a = base_mask; - - ++span; - ++base_type::interpolator(); - } while(--len); - } - }; - - -} + ++span; + ++base_type::interpolator(); + } while (--len); + } +}; +} // namespace agg #endif - - - diff --git a/deps/agg/include/agg_span_image_filter_rgb.h b/deps/agg/include/agg_span_image_filter_rgb.h index a72ffd240..a91b664dc 100644 --- a/deps/agg/include/agg_span_image_filter_rgb.h +++ b/deps/agg/include/agg_span_image_filter_rgb.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -13,12 +13,12 @@ // http://www.antigrain.com //---------------------------------------------------------------------------- // -// Adaptation for high precision colors has been sponsored by +// Adaptation for high precision colors has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. -// +// //---------------------------------------------------------------------------- #ifndef AGG_SPAN_IMAGE_FILTER_RGB_INCLUDED #define AGG_SPAN_IMAGE_FILTER_RGB_INCLUDED @@ -27,866 +27,771 @@ #include "agg_color_rgba.h" #include "agg_span_image_filter.h" +namespace agg { -namespace agg +//===============================================span_image_filter_rgb_nn +template +class span_image_filter_rgb_nn : public span_image_filter { + public: + typedef Source source_type; + typedef typename source_type::color_type color_type; + typedef typename source_type::order_type order_type; + typedef Interpolator interpolator_type; + typedef span_image_filter base_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; - //===============================================span_image_filter_rgb_nn - template - class span_image_filter_rgb_nn : - public span_image_filter + //-------------------------------------------------------------------- + span_image_filter_rgb_nn() {} + span_image_filter_rgb_nn(source_type& src, interpolator_type& inter) + : base_type(src, inter, 0) + {} + + //-------------------------------------------------------------------- + void generate(color_type* span, int x, int y, unsigned len) { - public: - typedef Source source_type; - typedef typename source_type::color_type color_type; - typedef typename source_type::order_type order_type; - typedef Interpolator interpolator_type; - typedef span_image_filter base_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; - enum base_scale_e + base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); + do { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + base_type::interpolator().coordinates(&x, &y); + const value_type* fg_ptr = + (const value_type*)base_type::source().span(x >> image_subpixel_shift, y >> image_subpixel_shift, 1); + span->r = fg_ptr[order_type::R]; + span->g = fg_ptr[order_type::G]; + span->b = fg_ptr[order_type::B]; + span->a = base_mask; + ++span; + ++base_type::interpolator(); - //-------------------------------------------------------------------- - span_image_filter_rgb_nn() {} - span_image_filter_rgb_nn(source_type& src, - interpolator_type& inter) : - base_type(src, inter, 0) - {} + } while (--len); + } +}; - //-------------------------------------------------------------------- - void generate(color_type* span, int x, int y, unsigned len) - { - base_type::interpolator().begin(x + base_type::filter_dx_dbl(), - y + base_type::filter_dy_dbl(), len); - do - { - base_type::interpolator().coordinates(&x, &y); - const value_type* fg_ptr = (const value_type*) - base_type::source().span(x >> image_subpixel_shift, - y >> image_subpixel_shift, - 1); - span->r = fg_ptr[order_type::R]; - span->g = fg_ptr[order_type::G]; - span->b = fg_ptr[order_type::B]; - span->a = base_mask; - ++span; - ++base_type::interpolator(); +//==========================================span_image_filter_rgb_bilinear +template +class span_image_filter_rgb_bilinear : public span_image_filter +{ + public: + typedef Source source_type; + typedef typename source_type::color_type color_type; + typedef typename source_type::order_type order_type; + typedef Interpolator interpolator_type; + typedef span_image_filter base_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; - } while(--len); - } - }; + //-------------------------------------------------------------------- + span_image_filter_rgb_bilinear() {} + span_image_filter_rgb_bilinear(source_type& src, interpolator_type& inter) + : base_type(src, inter, 0) + {} - - - //==========================================span_image_filter_rgb_bilinear - template - class span_image_filter_rgb_bilinear : - public span_image_filter + //-------------------------------------------------------------------- + void generate(color_type* span, int x, int y, unsigned len) { - public: - typedef Source source_type; - typedef typename source_type::color_type color_type; - typedef typename source_type::order_type order_type; - typedef Interpolator interpolator_type; - typedef span_image_filter base_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; - enum base_scale_e + base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); + calc_type fg[3]; + const value_type* fg_ptr; + do { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + int x_hr; + int y_hr; - //-------------------------------------------------------------------- - span_image_filter_rgb_bilinear() {} - span_image_filter_rgb_bilinear(source_type& src, - interpolator_type& inter) : - base_type(src, inter, 0) - {} + base_type::interpolator().coordinates(&x_hr, &y_hr); + x_hr -= base_type::filter_dx_int(); + y_hr -= base_type::filter_dy_int(); - //-------------------------------------------------------------------- - void generate(color_type* span, int x, int y, unsigned len) + int x_lr = x_hr >> image_subpixel_shift; + int y_lr = y_hr >> image_subpixel_shift; + + unsigned weight; + + fg[0] = fg[1] = fg[2] = image_subpixel_scale * image_subpixel_scale / 2; + + x_hr &= image_subpixel_mask; + y_hr &= image_subpixel_mask; + + fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, 2); + weight = (image_subpixel_scale - x_hr) * (image_subpixel_scale - y_hr); + fg[0] += weight * *fg_ptr++; + fg[1] += weight * *fg_ptr++; + fg[2] += weight * *fg_ptr; + + fg_ptr = (const value_type*)base_type::source().next_x(); + weight = x_hr * (image_subpixel_scale - y_hr); + fg[0] += weight * *fg_ptr++; + fg[1] += weight * *fg_ptr++; + fg[2] += weight * *fg_ptr; + + fg_ptr = (const value_type*)base_type::source().next_y(); + weight = (image_subpixel_scale - x_hr) * y_hr; + fg[0] += weight * *fg_ptr++; + fg[1] += weight * *fg_ptr++; + fg[2] += weight * *fg_ptr; + + fg_ptr = (const value_type*)base_type::source().next_x(); + weight = x_hr * y_hr; + fg[0] += weight * *fg_ptr++; + fg[1] += weight * *fg_ptr++; + fg[2] += weight * *fg_ptr; + + span->r = value_type(fg[order_type::R] >> (image_subpixel_shift * 2)); + span->g = value_type(fg[order_type::G] >> (image_subpixel_shift * 2)); + span->b = value_type(fg[order_type::B] >> (image_subpixel_shift * 2)); + span->a = base_mask; + + ++span; + ++base_type::interpolator(); + + } while (--len); + } +}; + +//=====================================span_image_filter_rgb_bilinear_clip +template +class span_image_filter_rgb_bilinear_clip : public span_image_filter +{ + public: + typedef Source source_type; + typedef typename source_type::color_type color_type; + typedef typename source_type::order_type order_type; + typedef Interpolator interpolator_type; + typedef span_image_filter base_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; + + //-------------------------------------------------------------------- + span_image_filter_rgb_bilinear_clip() {} + span_image_filter_rgb_bilinear_clip(source_type& src, const color_type& back_color, interpolator_type& inter) + : base_type(src, inter, 0) + , m_back_color(back_color) + {} + const color_type& background_color() const { return m_back_color; } + void background_color(const color_type& v) { m_back_color = v; } + + //-------------------------------------------------------------------- + void generate(color_type* span, int x, int y, unsigned len) + { + base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); + calc_type fg[3]; + calc_type src_alpha; + value_type back_r = m_back_color.r; + value_type back_g = m_back_color.g; + value_type back_b = m_back_color.b; + value_type back_a = m_back_color.a; + + const value_type* fg_ptr; + + int maxx = base_type::source().width() - 1; + int maxy = base_type::source().height() - 1; + + do { - base_type::interpolator().begin(x + base_type::filter_dx_dbl(), - y + base_type::filter_dy_dbl(), len); - calc_type fg[3]; - const value_type *fg_ptr; - do + int x_hr; + int y_hr; + + base_type::interpolator().coordinates(&x_hr, &y_hr); + + x_hr -= base_type::filter_dx_int(); + y_hr -= base_type::filter_dy_int(); + + int x_lr = x_hr >> image_subpixel_shift; + int y_lr = y_hr >> image_subpixel_shift; + unsigned weight; + + if (x_lr >= 0 && y_lr >= 0 && x_lr < maxx && y_lr < maxy) { - int x_hr; - int y_hr; - - base_type::interpolator().coordinates(&x_hr, &y_hr); - - x_hr -= base_type::filter_dx_int(); - y_hr -= base_type::filter_dy_int(); - - int x_lr = x_hr >> image_subpixel_shift; - int y_lr = y_hr >> image_subpixel_shift; - - unsigned weight; - - fg[0] = - fg[1] = - fg[2] = image_subpixel_scale * image_subpixel_scale / 2; + fg[0] = fg[1] = fg[2] = image_subpixel_scale * image_subpixel_scale / 2; x_hr &= image_subpixel_mask; y_hr &= image_subpixel_mask; - fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, 2); - weight = (image_subpixel_scale - x_hr) * - (image_subpixel_scale - y_hr); + fg_ptr = (const value_type*)base_type::source().row_ptr(y_lr) + x_lr + x_lr + x_lr; + + weight = (image_subpixel_scale - x_hr) * (image_subpixel_scale - y_hr); fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr; + fg[2] += weight * *fg_ptr++; - fg_ptr = (const value_type*)base_type::source().next_x(); weight = x_hr * (image_subpixel_scale - y_hr); fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr; + fg[2] += weight * *fg_ptr++; + + ++y_lr; + fg_ptr = (const value_type*)base_type::source().row_ptr(y_lr) + x_lr + x_lr + x_lr; - fg_ptr = (const value_type*)base_type::source().next_y(); weight = (image_subpixel_scale - x_hr) * y_hr; fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr; + fg[2] += weight * *fg_ptr++; - fg_ptr = (const value_type*)base_type::source().next_x(); weight = x_hr * y_hr; fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr; + fg[2] += weight * *fg_ptr++; - span->r = value_type(fg[order_type::R] >> (image_subpixel_shift * 2)); - span->g = value_type(fg[order_type::G] >> (image_subpixel_shift * 2)); - span->b = value_type(fg[order_type::B] >> (image_subpixel_shift * 2)); - span->a = base_mask; - - ++span; - ++base_type::interpolator(); - - } while(--len); - } - }; - - - - //=====================================span_image_filter_rgb_bilinear_clip - template - class span_image_filter_rgb_bilinear_clip : - public span_image_filter - { - public: - typedef Source source_type; - typedef typename source_type::color_type color_type; - typedef typename source_type::order_type order_type; - typedef Interpolator interpolator_type; - typedef span_image_filter base_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; - - //-------------------------------------------------------------------- - span_image_filter_rgb_bilinear_clip() {} - span_image_filter_rgb_bilinear_clip(source_type& src, - const color_type& back_color, - interpolator_type& inter) : - base_type(src, inter, 0), - m_back_color(back_color) - {} - const color_type& background_color() const { return m_back_color; } - void background_color(const color_type& v) { m_back_color = v; } - - //-------------------------------------------------------------------- - void generate(color_type* span, int x, int y, unsigned len) - { - base_type::interpolator().begin(x + base_type::filter_dx_dbl(), - y + base_type::filter_dy_dbl(), len); - calc_type fg[3]; - calc_type src_alpha; - value_type back_r = m_back_color.r; - value_type back_g = m_back_color.g; - value_type back_b = m_back_color.b; - value_type back_a = m_back_color.a; - - const value_type *fg_ptr; - - int maxx = base_type::source().width() - 1; - int maxy = base_type::source().height() - 1; - - do + fg[0] >>= image_subpixel_shift * 2; + fg[1] >>= image_subpixel_shift * 2; + fg[2] >>= image_subpixel_shift * 2; + src_alpha = base_mask; + } + else { - int x_hr; - int y_hr; - - base_type::interpolator().coordinates(&x_hr, &y_hr); - - x_hr -= base_type::filter_dx_int(); - y_hr -= base_type::filter_dy_int(); - - int x_lr = x_hr >> image_subpixel_shift; - int y_lr = y_hr >> image_subpixel_shift; - unsigned weight; - - if(x_lr >= 0 && y_lr >= 0 && - x_lr < maxx && y_lr < maxy) + if (x_lr < -1 || y_lr < -1 || x_lr > maxx || y_lr > maxy) { - fg[0] = - fg[1] = - fg[2] = image_subpixel_scale * image_subpixel_scale / 2; + fg[order_type::R] = back_r; + fg[order_type::G] = back_g; + fg[order_type::B] = back_b; + src_alpha = back_a; + } + else + { + fg[0] = fg[1] = fg[2] = src_alpha = image_subpixel_scale * image_subpixel_scale / 2; x_hr &= image_subpixel_mask; y_hr &= image_subpixel_mask; - fg_ptr = (const value_type*) - base_type::source().row_ptr(y_lr) + x_lr + x_lr + x_lr; + weight = (image_subpixel_scale - x_hr) * (image_subpixel_scale - y_hr); + if (x_lr >= 0 && y_lr >= 0 && x_lr <= maxx && y_lr <= maxy) + { + fg_ptr = (const value_type*)base_type::source().row_ptr(y_lr) + x_lr + x_lr + x_lr; - weight = (image_subpixel_scale - x_hr) * - (image_subpixel_scale - y_hr); - fg[0] += weight * *fg_ptr++; - fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr++; + fg[0] += weight * *fg_ptr++; + fg[1] += weight * *fg_ptr++; + fg[2] += weight * *fg_ptr++; + src_alpha += weight * base_mask; + } + else + { + fg[order_type::R] += back_r * weight; + fg[order_type::G] += back_g * weight; + fg[order_type::B] += back_b * weight; + src_alpha += back_a * weight; + } + + x_lr++; weight = x_hr * (image_subpixel_scale - y_hr); - fg[0] += weight * *fg_ptr++; - fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr++; + if (x_lr >= 0 && y_lr >= 0 && x_lr <= maxx && y_lr <= maxy) + { + fg_ptr = (const value_type*)base_type::source().row_ptr(y_lr) + x_lr + x_lr + x_lr; - ++y_lr; - fg_ptr = (const value_type*) - base_type::source().row_ptr(y_lr) + x_lr + x_lr + x_lr; + fg[0] += weight * *fg_ptr++; + fg[1] += weight * *fg_ptr++; + fg[2] += weight * *fg_ptr++; + src_alpha += weight * base_mask; + } + else + { + fg[order_type::R] += back_r * weight; + fg[order_type::G] += back_g * weight; + fg[order_type::B] += back_b * weight; + src_alpha += back_a * weight; + } + + x_lr--; + y_lr++; weight = (image_subpixel_scale - x_hr) * y_hr; - fg[0] += weight * *fg_ptr++; - fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr++; + if (x_lr >= 0 && y_lr >= 0 && x_lr <= maxx && y_lr <= maxy) + { + fg_ptr = (const value_type*)base_type::source().row_ptr(y_lr) + x_lr + x_lr + x_lr; + + fg[0] += weight * *fg_ptr++; + fg[1] += weight * *fg_ptr++; + fg[2] += weight * *fg_ptr++; + src_alpha += weight * base_mask; + } + else + { + fg[order_type::R] += back_r * weight; + fg[order_type::G] += back_g * weight; + fg[order_type::B] += back_b * weight; + src_alpha += back_a * weight; + } + + x_lr++; weight = x_hr * y_hr; - fg[0] += weight * *fg_ptr++; - fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr++; + if (x_lr >= 0 && y_lr >= 0 && x_lr <= maxx && y_lr <= maxy) + { + fg_ptr = (const value_type*)base_type::source().row_ptr(y_lr) + x_lr + x_lr + x_lr; + + fg[0] += weight * *fg_ptr++; + fg[1] += weight * *fg_ptr++; + fg[2] += weight * *fg_ptr++; + src_alpha += weight * base_mask; + } + else + { + fg[order_type::R] += back_r * weight; + fg[order_type::G] += back_g * weight; + fg[order_type::B] += back_b * weight; + src_alpha += back_a * weight; + } fg[0] >>= image_subpixel_shift * 2; fg[1] >>= image_subpixel_shift * 2; fg[2] >>= image_subpixel_shift * 2; - src_alpha = base_mask; + src_alpha >>= image_subpixel_shift * 2; } - else - { - if(x_lr < -1 || y_lr < -1 || - x_lr > maxx || y_lr > maxy) - { - fg[order_type::R] = back_r; - fg[order_type::G] = back_g; - fg[order_type::B] = back_b; - src_alpha = back_a; - } - else - { - fg[0] = - fg[1] = - fg[2] = - src_alpha = image_subpixel_scale * image_subpixel_scale / 2; + } - x_hr &= image_subpixel_mask; - y_hr &= image_subpixel_mask; + span->r = (value_type)fg[order_type::R]; + span->g = (value_type)fg[order_type::G]; + span->b = (value_type)fg[order_type::B]; + span->a = (value_type)src_alpha; + ++span; + ++base_type::interpolator(); - weight = (image_subpixel_scale - x_hr) * - (image_subpixel_scale - y_hr); - if(x_lr >= 0 && y_lr >= 0 && - x_lr <= maxx && y_lr <= maxy) - { - fg_ptr = (const value_type*) - base_type::source().row_ptr(y_lr) + x_lr + x_lr + x_lr; + } while (--len); + } - fg[0] += weight * *fg_ptr++; - fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr++; - src_alpha += weight * base_mask; - } - else - { - fg[order_type::R] += back_r * weight; - fg[order_type::G] += back_g * weight; - fg[order_type::B] += back_b * weight; - src_alpha += back_a * weight; - } + private: + color_type m_back_color; +}; - x_lr++; +//===============================================span_image_filter_rgb_2x2 +template +class span_image_filter_rgb_2x2 : public span_image_filter +{ + public: + typedef Source source_type; + typedef typename source_type::color_type color_type; + typedef typename source_type::order_type order_type; + typedef Interpolator interpolator_type; + typedef span_image_filter base_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; - weight = x_hr * (image_subpixel_scale - y_hr); - if(x_lr >= 0 && y_lr >= 0 && - x_lr <= maxx && y_lr <= maxy) - { - fg_ptr = (const value_type*) - base_type::source().row_ptr(y_lr) + x_lr + x_lr + x_lr; + //-------------------------------------------------------------------- + span_image_filter_rgb_2x2() {} + span_image_filter_rgb_2x2(source_type& src, interpolator_type& inter, const image_filter_lut& filter) + : base_type(src, inter, &filter) + {} - fg[0] += weight * *fg_ptr++; - fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr++; - src_alpha += weight * base_mask; - } - else - { - fg[order_type::R] += back_r * weight; - fg[order_type::G] += back_g * weight; - fg[order_type::B] += back_b * weight; - src_alpha += back_a * weight; - } - - x_lr--; - y_lr++; - - weight = (image_subpixel_scale - x_hr) * y_hr; - if(x_lr >= 0 && y_lr >= 0 && - x_lr <= maxx && y_lr <= maxy) - { - fg_ptr = (const value_type*) - base_type::source().row_ptr(y_lr) + x_lr + x_lr + x_lr; - - fg[0] += weight * *fg_ptr++; - fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr++; - src_alpha += weight * base_mask; - } - else - { - fg[order_type::R] += back_r * weight; - fg[order_type::G] += back_g * weight; - fg[order_type::B] += back_b * weight; - src_alpha += back_a * weight; - } - - x_lr++; - - weight = x_hr * y_hr; - if(x_lr >= 0 && y_lr >= 0 && - x_lr <= maxx && y_lr <= maxy) - { - fg_ptr = (const value_type*) - base_type::source().row_ptr(y_lr) + x_lr + x_lr + x_lr; - - fg[0] += weight * *fg_ptr++; - fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr++; - src_alpha += weight * base_mask; - } - else - { - fg[order_type::R] += back_r * weight; - fg[order_type::G] += back_g * weight; - fg[order_type::B] += back_b * weight; - src_alpha += back_a * weight; - } - - fg[0] >>= image_subpixel_shift * 2; - fg[1] >>= image_subpixel_shift * 2; - fg[2] >>= image_subpixel_shift * 2; - src_alpha >>= image_subpixel_shift * 2; - } - } - - span->r = (value_type)fg[order_type::R]; - span->g = (value_type)fg[order_type::G]; - span->b = (value_type)fg[order_type::B]; - span->a = (value_type)src_alpha; - ++span; - ++base_type::interpolator(); - - } while(--len); - } - private: - color_type m_back_color; - }; - - - - //===============================================span_image_filter_rgb_2x2 - template - class span_image_filter_rgb_2x2 : - public span_image_filter + //-------------------------------------------------------------------- + void generate(color_type* span, int x, int y, unsigned len) { - public: - typedef Source source_type; - typedef typename source_type::color_type color_type; - typedef typename source_type::order_type order_type; - typedef Interpolator interpolator_type; - typedef span_image_filter base_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; - enum base_scale_e + base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); + + calc_type fg[3]; + + const value_type* fg_ptr; + const int16* weight_array = + base_type::filter().weight_array() + ((base_type::filter().diameter() / 2 - 1) << image_subpixel_shift); + do { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + int x_hr; + int y_hr; - //-------------------------------------------------------------------- - span_image_filter_rgb_2x2() {} - span_image_filter_rgb_2x2(source_type& src, - interpolator_type& inter, - const image_filter_lut& filter) : - base_type(src, inter, &filter) - {} + base_type::interpolator().coordinates(&x_hr, &y_hr); + x_hr -= base_type::filter_dx_int(); + y_hr -= base_type::filter_dy_int(); - //-------------------------------------------------------------------- - void generate(color_type* span, int x, int y, unsigned len) + int x_lr = x_hr >> image_subpixel_shift; + int y_lr = y_hr >> image_subpixel_shift; + + unsigned weight; + fg[0] = fg[1] = fg[2] = image_filter_scale / 2; + + x_hr &= image_subpixel_mask; + y_hr &= image_subpixel_mask; + + fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, 2); + weight = (weight_array[x_hr + image_subpixel_scale] * weight_array[y_hr + image_subpixel_scale] + + image_filter_scale / 2) >> + image_filter_shift; + fg[0] += weight * *fg_ptr++; + fg[1] += weight * *fg_ptr++; + fg[2] += weight * *fg_ptr; + + fg_ptr = (const value_type*)base_type::source().next_x(); + weight = (weight_array[x_hr] * weight_array[y_hr + image_subpixel_scale] + image_filter_scale / 2) >> + image_filter_shift; + fg[0] += weight * *fg_ptr++; + fg[1] += weight * *fg_ptr++; + fg[2] += weight * *fg_ptr; + + fg_ptr = (const value_type*)base_type::source().next_y(); + weight = (weight_array[x_hr + image_subpixel_scale] * weight_array[y_hr] + image_filter_scale / 2) >> + image_filter_shift; + fg[0] += weight * *fg_ptr++; + fg[1] += weight * *fg_ptr++; + fg[2] += weight * *fg_ptr; + + fg_ptr = (const value_type*)base_type::source().next_x(); + weight = (weight_array[x_hr] * weight_array[y_hr] + image_filter_scale / 2) >> image_filter_shift; + fg[0] += weight * *fg_ptr++; + fg[1] += weight * *fg_ptr++; + fg[2] += weight * *fg_ptr; + + fg[0] >>= image_filter_shift; + fg[1] >>= image_filter_shift; + fg[2] >>= image_filter_shift; + + if (fg[order_type::R] > base_mask) + fg[order_type::R] = base_mask; + if (fg[order_type::G] > base_mask) + fg[order_type::G] = base_mask; + if (fg[order_type::B] > base_mask) + fg[order_type::B] = base_mask; + + span->r = (value_type)fg[order_type::R]; + span->g = (value_type)fg[order_type::G]; + span->b = (value_type)fg[order_type::B]; + span->a = base_mask; + + ++span; + ++base_type::interpolator(); + + } while (--len); + } +}; + +//===================================================span_image_filter_rgb +template +class span_image_filter_rgb : public span_image_filter +{ + public: + typedef Source source_type; + typedef typename source_type::color_type color_type; + typedef typename source_type::order_type order_type; + typedef Interpolator interpolator_type; + typedef span_image_filter base_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; + + //-------------------------------------------------------------------- + span_image_filter_rgb() {} + span_image_filter_rgb(source_type& src, interpolator_type& inter, const image_filter_lut& filter) + : base_type(src, inter, &filter) + {} + + //-------------------------------------------------------------------- + void generate(color_type* span, int x, int y, unsigned len) + { + base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); + + int fg[3]; + const value_type* fg_ptr; + + unsigned diameter = base_type::filter().diameter(); + int start = base_type::filter().start(); + const int16* weight_array = base_type::filter().weight_array(); + + int x_count; + int weight_y; + + do { - base_type::interpolator().begin(x + base_type::filter_dx_dbl(), - y + base_type::filter_dy_dbl(), len); + base_type::interpolator().coordinates(&x, &y); - calc_type fg[3]; + x -= base_type::filter_dx_int(); + y -= base_type::filter_dy_int(); - const value_type *fg_ptr; - const int16* weight_array = base_type::filter().weight_array() + - ((base_type::filter().diameter()/2 - 1) << - image_subpixel_shift); - do + int x_hr = x; + int y_hr = y; + + int x_lr = x_hr >> image_subpixel_shift; + int y_lr = y_hr >> image_subpixel_shift; + + fg[0] = fg[1] = fg[2] = image_filter_scale / 2; + + int x_fract = x_hr & image_subpixel_mask; + unsigned y_count = diameter; + + y_hr = image_subpixel_mask - (y_hr & image_subpixel_mask); + fg_ptr = (const value_type*)base_type::source().span(x_lr + start, y_lr + start, diameter); + for (;;) { - int x_hr; - int y_hr; + x_count = diameter; + weight_y = weight_array[y_hr]; + x_hr = image_subpixel_mask - x_fract; + for (;;) + { + int weight = (weight_y * weight_array[x_hr] + image_filter_scale / 2) >> image_filter_shift; - base_type::interpolator().coordinates(&x_hr, &y_hr); + fg[0] += weight * *fg_ptr++; + fg[1] += weight * *fg_ptr++; + fg[2] += weight * *fg_ptr; - x_hr -= base_type::filter_dx_int(); - y_hr -= base_type::filter_dy_int(); - - int x_lr = x_hr >> image_subpixel_shift; - int y_lr = y_hr >> image_subpixel_shift; - - unsigned weight; - fg[0] = fg[1] = fg[2] = image_filter_scale / 2; - - x_hr &= image_subpixel_mask; - y_hr &= image_subpixel_mask; - - fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, 2); - weight = (weight_array[x_hr + image_subpixel_scale] * - weight_array[y_hr + image_subpixel_scale] + - image_filter_scale / 2) >> - image_filter_shift; - fg[0] += weight * *fg_ptr++; - fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr; - - fg_ptr = (const value_type*)base_type::source().next_x(); - weight = (weight_array[x_hr] * - weight_array[y_hr + image_subpixel_scale] + - image_filter_scale / 2) >> - image_filter_shift; - fg[0] += weight * *fg_ptr++; - fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr; + if (--x_count == 0) + break; + x_hr += image_subpixel_scale; + fg_ptr = (const value_type*)base_type::source().next_x(); + } + if (--y_count == 0) + break; + y_hr += image_subpixel_scale; fg_ptr = (const value_type*)base_type::source().next_y(); - weight = (weight_array[x_hr + image_subpixel_scale] * - weight_array[y_hr] + - image_filter_scale / 2) >> - image_filter_shift; - fg[0] += weight * *fg_ptr++; - fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr; + } - fg_ptr = (const value_type*)base_type::source().next_x(); - weight = (weight_array[x_hr] * - weight_array[y_hr] + - image_filter_scale / 2) >> - image_filter_shift; - fg[0] += weight * *fg_ptr++; - fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr; + fg[0] >>= image_filter_shift; + fg[1] >>= image_filter_shift; + fg[2] >>= image_filter_shift; - fg[0] >>= image_filter_shift; - fg[1] >>= image_filter_shift; - fg[2] >>= image_filter_shift; + if (fg[0] < 0) + fg[0] = 0; + if (fg[1] < 0) + fg[1] = 0; + if (fg[2] < 0) + fg[2] = 0; - if(fg[order_type::R] > base_mask) fg[order_type::R] = base_mask; - if(fg[order_type::G] > base_mask) fg[order_type::G] = base_mask; - if(fg[order_type::B] > base_mask) fg[order_type::B] = base_mask; + if (fg[order_type::R] > base_mask) + fg[order_type::R] = base_mask; + if (fg[order_type::G] > base_mask) + fg[order_type::G] = base_mask; + if (fg[order_type::B] > base_mask) + fg[order_type::B] = base_mask; - span->r = (value_type)fg[order_type::R]; - span->g = (value_type)fg[order_type::G]; - span->b = (value_type)fg[order_type::B]; - span->a = base_mask; + span->r = (value_type)fg[order_type::R]; + span->g = (value_type)fg[order_type::G]; + span->b = (value_type)fg[order_type::B]; + span->a = base_mask; - ++span; - ++base_type::interpolator(); + ++span; + ++base_type::interpolator(); - } while(--len); - } + } while (--len); + } +}; + +//==========================================span_image_resample_rgb_affine +template +class span_image_resample_rgb_affine : public span_image_resample_affine +{ + public: + typedef Source source_type; + typedef typename source_type::color_type color_type; + typedef typename source_type::order_type order_type; + typedef span_image_resample_affine base_type; + typedef typename base_type::interpolator_type interpolator_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::long_type long_type; + enum base_scale_e { + base_shift = color_type::base_shift, + base_mask = color_type::base_mask, + downscale_shift = image_filter_shift }; + //-------------------------------------------------------------------- + span_image_resample_rgb_affine() {} + span_image_resample_rgb_affine(source_type& src, interpolator_type& inter, const image_filter_lut& filter) + : base_type(src, inter, filter) + {} - - //===================================================span_image_filter_rgb - template - class span_image_filter_rgb : - public span_image_filter + //-------------------------------------------------------------------- + void generate(color_type* span, int x, int y, unsigned len) { - public: - typedef Source source_type; - typedef typename source_type::color_type color_type; - typedef typename source_type::order_type order_type; - typedef Interpolator interpolator_type; - typedef span_image_filter base_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; - enum base_scale_e + base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); + + long_type fg[3]; + + int diameter = base_type::filter().diameter(); + int filter_scale = diameter << image_subpixel_shift; + int radius_x = (diameter * base_type::m_rx) >> 1; + int radius_y = (diameter * base_type::m_ry) >> 1; + int len_x_lr = (diameter * base_type::m_rx + image_subpixel_mask) >> image_subpixel_shift; + + const int16* weight_array = base_type::filter().weight_array(); + + do { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + base_type::interpolator().coordinates(&x, &y); - //-------------------------------------------------------------------- - span_image_filter_rgb() {} - span_image_filter_rgb(source_type& src, - interpolator_type& inter, - const image_filter_lut& filter) : - base_type(src, inter, &filter) - {} + x += base_type::filter_dx_int() - radius_x; + y += base_type::filter_dy_int() - radius_y; - //-------------------------------------------------------------------- - void generate(color_type* span, int x, int y, unsigned len) - { - base_type::interpolator().begin(x + base_type::filter_dx_dbl(), - y + base_type::filter_dy_dbl(), len); + fg[0] = fg[1] = fg[2] = image_filter_scale / 2; - int fg[3]; - const value_type *fg_ptr; + int y_lr = y >> image_subpixel_shift; + int y_hr = + ((image_subpixel_mask - (y & image_subpixel_mask)) * base_type::m_ry_inv) >> image_subpixel_shift; + int total_weight = 0; + int x_lr = x >> image_subpixel_shift; + int x_hr = + ((image_subpixel_mask - (x & image_subpixel_mask)) * base_type::m_rx_inv) >> image_subpixel_shift; - unsigned diameter = base_type::filter().diameter(); - int start = base_type::filter().start(); - const int16* weight_array = base_type::filter().weight_array(); - - int x_count; - int weight_y; - - do + int x_hr2 = x_hr; + const value_type* fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, len_x_lr); + for (;;) { - base_type::interpolator().coordinates(&x, &y); - - x -= base_type::filter_dx_int(); - y -= base_type::filter_dy_int(); - - int x_hr = x; - int y_hr = y; - - int x_lr = x_hr >> image_subpixel_shift; - int y_lr = y_hr >> image_subpixel_shift; - - fg[0] = fg[1] = fg[2] = image_filter_scale / 2; - - int x_fract = x_hr & image_subpixel_mask; - unsigned y_count = diameter; - - y_hr = image_subpixel_mask - (y_hr & image_subpixel_mask); - fg_ptr = (const value_type*)base_type::source().span(x_lr + start, - y_lr + start, - diameter); - for(;;) + int weight_y = weight_array[y_hr]; + x_hr = x_hr2; + for (;;) { - x_count = diameter; - weight_y = weight_array[y_hr]; - x_hr = image_subpixel_mask - x_fract; - for(;;) - { - int weight = (weight_y * weight_array[x_hr] + - image_filter_scale / 2) >> - image_filter_shift; + int weight = (weight_y * weight_array[x_hr] + image_filter_scale / 2) >> downscale_shift; - fg[0] += weight * *fg_ptr++; - fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr; - - if(--x_count == 0) break; - x_hr += image_subpixel_scale; - fg_ptr = (const value_type*)base_type::source().next_x(); - } - - if(--y_count == 0) break; - y_hr += image_subpixel_scale; - fg_ptr = (const value_type*)base_type::source().next_y(); + fg[0] += *fg_ptr++ * weight; + fg[1] += *fg_ptr++ * weight; + fg[2] += *fg_ptr * weight; + total_weight += weight; + x_hr += base_type::m_rx_inv; + if (x_hr >= filter_scale) + break; + fg_ptr = (const value_type*)base_type::source().next_x(); } + y_hr += base_type::m_ry_inv; + if (y_hr >= filter_scale) + break; + fg_ptr = (const value_type*)base_type::source().next_y(); + } - fg[0] >>= image_filter_shift; - fg[1] >>= image_filter_shift; - fg[2] >>= image_filter_shift; + fg[0] /= total_weight; + fg[1] /= total_weight; + fg[2] /= total_weight; - if(fg[0] < 0) fg[0] = 0; - if(fg[1] < 0) fg[1] = 0; - if(fg[2] < 0) fg[2] = 0; + if (fg[0] < 0) + fg[0] = 0; + if (fg[1] < 0) + fg[1] = 0; + if (fg[2] < 0) + fg[2] = 0; - if(fg[order_type::R] > base_mask) fg[order_type::R] = base_mask; - if(fg[order_type::G] > base_mask) fg[order_type::G] = base_mask; - if(fg[order_type::B] > base_mask) fg[order_type::B] = base_mask; + if (fg[order_type::R] > base_mask) + fg[order_type::R] = base_mask; + if (fg[order_type::G] > base_mask) + fg[order_type::G] = base_mask; + if (fg[order_type::B] > base_mask) + fg[order_type::B] = base_mask; - span->r = (value_type)fg[order_type::R]; - span->g = (value_type)fg[order_type::G]; - span->b = (value_type)fg[order_type::B]; - span->a = base_mask; + span->r = (value_type)fg[order_type::R]; + span->g = (value_type)fg[order_type::G]; + span->b = (value_type)fg[order_type::B]; + span->a = base_mask; - ++span; - ++base_type::interpolator(); + ++span; + ++base_type::interpolator(); + } while (--len); + } +}; - } while(--len); - } +//=================================================span_image_resample_rgb +template +class span_image_resample_rgb : public span_image_resample +{ + public: + typedef Source source_type; + typedef typename source_type::color_type color_type; + typedef typename source_type::order_type order_type; + typedef Interpolator interpolator_type; + typedef span_image_resample base_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::long_type long_type; + enum base_scale_e { + base_shift = color_type::base_shift, + base_mask = color_type::base_mask, + downscale_shift = image_filter_shift }; + //-------------------------------------------------------------------- + span_image_resample_rgb() {} + span_image_resample_rgb(source_type& src, interpolator_type& inter, const image_filter_lut& filter) + : base_type(src, inter, filter) + {} - - //==========================================span_image_resample_rgb_affine - template - class span_image_resample_rgb_affine : - public span_image_resample_affine + //-------------------------------------------------------------------- + void generate(color_type* span, int x, int y, unsigned len) { - public: - typedef Source source_type; - typedef typename source_type::color_type color_type; - typedef typename source_type::order_type order_type; - typedef span_image_resample_affine base_type; - typedef typename base_type::interpolator_type interpolator_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::long_type long_type; - enum base_scale_e + base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); + long_type fg[3]; + + int diameter = base_type::filter().diameter(); + int filter_scale = diameter << image_subpixel_shift; + + const int16* weight_array = base_type::filter().weight_array(); + do { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask, - downscale_shift = image_filter_shift - }; + int rx; + int ry; + int rx_inv = image_subpixel_scale; + int ry_inv = image_subpixel_scale; + base_type::interpolator().coordinates(&x, &y); + base_type::interpolator().local_scale(&rx, &ry); + base_type::adjust_scale(&rx, &ry); - //-------------------------------------------------------------------- - span_image_resample_rgb_affine() {} - span_image_resample_rgb_affine(source_type& src, - interpolator_type& inter, - const image_filter_lut& filter) : - base_type(src, inter, filter) - {} + rx_inv = image_subpixel_scale * image_subpixel_scale / rx; + ry_inv = image_subpixel_scale * image_subpixel_scale / ry; + int radius_x = (diameter * rx) >> 1; + int radius_y = (diameter * ry) >> 1; + int len_x_lr = (diameter * rx + image_subpixel_mask) >> image_subpixel_shift; - //-------------------------------------------------------------------- - void generate(color_type* span, int x, int y, unsigned len) - { - base_type::interpolator().begin(x + base_type::filter_dx_dbl(), - y + base_type::filter_dy_dbl(), len); + x += base_type::filter_dx_int() - radius_x; + y += base_type::filter_dy_int() - radius_y; - long_type fg[3]; + fg[0] = fg[1] = fg[2] = image_filter_scale / 2; - int diameter = base_type::filter().diameter(); - int filter_scale = diameter << image_subpixel_shift; - int radius_x = (diameter * base_type::m_rx) >> 1; - int radius_y = (diameter * base_type::m_ry) >> 1; - int len_x_lr = - (diameter * base_type::m_rx + image_subpixel_mask) >> - image_subpixel_shift; + int y_lr = y >> image_subpixel_shift; + int y_hr = ((image_subpixel_mask - (y & image_subpixel_mask)) * ry_inv) >> image_subpixel_shift; + int total_weight = 0; + int x_lr = x >> image_subpixel_shift; + int x_hr = ((image_subpixel_mask - (x & image_subpixel_mask)) * rx_inv) >> image_subpixel_shift; + int x_hr2 = x_hr; + const value_type* fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, len_x_lr); - const int16* weight_array = base_type::filter().weight_array(); - - do + for (;;) { - base_type::interpolator().coordinates(&x, &y); - - x += base_type::filter_dx_int() - radius_x; - y += base_type::filter_dy_int() - radius_y; - - fg[0] = fg[1] = fg[2] = image_filter_scale / 2; - - int y_lr = y >> image_subpixel_shift; - int y_hr = ((image_subpixel_mask - (y & image_subpixel_mask)) * - base_type::m_ry_inv) >> - image_subpixel_shift; - int total_weight = 0; - int x_lr = x >> image_subpixel_shift; - int x_hr = ((image_subpixel_mask - (x & image_subpixel_mask)) * - base_type::m_rx_inv) >> - image_subpixel_shift; - - int x_hr2 = x_hr; - const value_type* fg_ptr = - (const value_type*)base_type::source().span(x_lr, y_lr, len_x_lr); - for(;;) + int weight_y = weight_array[y_hr]; + x_hr = x_hr2; + for (;;) { - int weight_y = weight_array[y_hr]; - x_hr = x_hr2; - for(;;) - { - int weight = (weight_y * weight_array[x_hr] + - image_filter_scale / 2) >> - downscale_shift; - - fg[0] += *fg_ptr++ * weight; - fg[1] += *fg_ptr++ * weight; - fg[2] += *fg_ptr * weight; - total_weight += weight; - x_hr += base_type::m_rx_inv; - if(x_hr >= filter_scale) break; - fg_ptr = (const value_type*)base_type::source().next_x(); - } - y_hr += base_type::m_ry_inv; - if(y_hr >= filter_scale) break; - fg_ptr = (const value_type*)base_type::source().next_y(); + int weight = (weight_y * weight_array[x_hr] + image_filter_scale / 2) >> downscale_shift; + fg[0] += *fg_ptr++ * weight; + fg[1] += *fg_ptr++ * weight; + fg[2] += *fg_ptr * weight; + total_weight += weight; + x_hr += rx_inv; + if (x_hr >= filter_scale) + break; + fg_ptr = (const value_type*)base_type::source().next_x(); } + y_hr += ry_inv; + if (y_hr >= filter_scale) + break; + fg_ptr = (const value_type*)base_type::source().next_y(); + } - fg[0] /= total_weight; - fg[1] /= total_weight; - fg[2] /= total_weight; + fg[0] /= total_weight; + fg[1] /= total_weight; + fg[2] /= total_weight; - if(fg[0] < 0) fg[0] = 0; - if(fg[1] < 0) fg[1] = 0; - if(fg[2] < 0) fg[2] = 0; + if (fg[0] < 0) + fg[0] = 0; + if (fg[1] < 0) + fg[1] = 0; + if (fg[2] < 0) + fg[2] = 0; - if(fg[order_type::R] > base_mask) fg[order_type::R] = base_mask; - if(fg[order_type::G] > base_mask) fg[order_type::G] = base_mask; - if(fg[order_type::B] > base_mask) fg[order_type::B] = base_mask; + if (fg[order_type::R] > base_mask) + fg[order_type::R] = base_mask; + if (fg[order_type::G] > base_mask) + fg[order_type::G] = base_mask; + if (fg[order_type::B] > base_mask) + fg[order_type::B] = base_mask; - span->r = (value_type)fg[order_type::R]; - span->g = (value_type)fg[order_type::G]; - span->b = (value_type)fg[order_type::B]; - span->a = base_mask; + span->r = (value_type)fg[order_type::R]; + span->g = (value_type)fg[order_type::G]; + span->b = (value_type)fg[order_type::B]; + span->a = base_mask; - ++span; - ++base_type::interpolator(); - } while(--len); - } - }; - - - - //=================================================span_image_resample_rgb - template - class span_image_resample_rgb : - public span_image_resample - { - public: - typedef Source source_type; - typedef typename source_type::color_type color_type; - typedef typename source_type::order_type order_type; - typedef Interpolator interpolator_type; - typedef span_image_resample base_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::long_type long_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask, - downscale_shift = image_filter_shift - }; - - //-------------------------------------------------------------------- - span_image_resample_rgb() {} - span_image_resample_rgb(source_type& src, - interpolator_type& inter, - const image_filter_lut& filter) : - base_type(src, inter, filter) - {} - - //-------------------------------------------------------------------- - void generate(color_type* span, int x, int y, unsigned len) - { - base_type::interpolator().begin(x + base_type::filter_dx_dbl(), - y + base_type::filter_dy_dbl(), len); - long_type fg[3]; - - int diameter = base_type::filter().diameter(); - int filter_scale = diameter << image_subpixel_shift; - - const int16* weight_array = base_type::filter().weight_array(); - do - { - int rx; - int ry; - int rx_inv = image_subpixel_scale; - int ry_inv = image_subpixel_scale; - base_type::interpolator().coordinates(&x, &y); - base_type::interpolator().local_scale(&rx, &ry); - base_type::adjust_scale(&rx, &ry); - - rx_inv = image_subpixel_scale * image_subpixel_scale / rx; - ry_inv = image_subpixel_scale * image_subpixel_scale / ry; - - int radius_x = (diameter * rx) >> 1; - int radius_y = (diameter * ry) >> 1; - int len_x_lr = - (diameter * rx + image_subpixel_mask) >> - image_subpixel_shift; - - x += base_type::filter_dx_int() - radius_x; - y += base_type::filter_dy_int() - radius_y; - - fg[0] = fg[1] = fg[2] = image_filter_scale / 2; - - int y_lr = y >> image_subpixel_shift; - int y_hr = ((image_subpixel_mask - (y & image_subpixel_mask)) * - ry_inv) >> - image_subpixel_shift; - int total_weight = 0; - int x_lr = x >> image_subpixel_shift; - int x_hr = ((image_subpixel_mask - (x & image_subpixel_mask)) * - rx_inv) >> - image_subpixel_shift; - int x_hr2 = x_hr; - const value_type* fg_ptr = - (const value_type*)base_type::source().span(x_lr, y_lr, len_x_lr); - - for(;;) - { - int weight_y = weight_array[y_hr]; - x_hr = x_hr2; - for(;;) - { - int weight = (weight_y * weight_array[x_hr] + - image_filter_scale / 2) >> - downscale_shift; - fg[0] += *fg_ptr++ * weight; - fg[1] += *fg_ptr++ * weight; - fg[2] += *fg_ptr * weight; - total_weight += weight; - x_hr += rx_inv; - if(x_hr >= filter_scale) break; - fg_ptr = (const value_type*)base_type::source().next_x(); - } - y_hr += ry_inv; - if(y_hr >= filter_scale) break; - fg_ptr = (const value_type*)base_type::source().next_y(); - } - - fg[0] /= total_weight; - fg[1] /= total_weight; - fg[2] /= total_weight; - - if(fg[0] < 0) fg[0] = 0; - if(fg[1] < 0) fg[1] = 0; - if(fg[2] < 0) fg[2] = 0; - - if(fg[order_type::R] > base_mask) fg[order_type::R] = base_mask; - if(fg[order_type::G] > base_mask) fg[order_type::G] = base_mask; - if(fg[order_type::B] > base_mask) fg[order_type::B] = base_mask; - - span->r = (value_type)fg[order_type::R]; - span->g = (value_type)fg[order_type::G]; - span->b = (value_type)fg[order_type::B]; - span->a = base_mask; - - ++span; - ++base_type::interpolator(); - } while(--len); - } - }; - - -} + ++span; + ++base_type::interpolator(); + } while (--len); + } +}; +} // namespace agg #endif - - - diff --git a/deps/agg/include/agg_span_image_filter_rgba.h b/deps/agg/include/agg_span_image_filter_rgba.h index 4c19b2371..5f271172b 100644 --- a/deps/agg/include/agg_span_image_filter_rgba.h +++ b/deps/agg/include/agg_span_image_filter_rgba.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -13,12 +13,12 @@ // http://www.antigrain.com //---------------------------------------------------------------------------- // -// Adaptation for high precision colors has been sponsored by +// Adaptation for high precision colors has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. -// +// //---------------------------------------------------------------------------- #ifndef AGG_SPAN_IMAGE_FILTER_RGBA_INCLUDED #define AGG_SPAN_IMAGE_FILTER_RGBA_INCLUDED @@ -27,894 +27,805 @@ #include "agg_color_rgba.h" #include "agg_span_image_filter.h" +namespace agg { -namespace agg +//==============================================span_image_filter_rgba_nn +template +class span_image_filter_rgba_nn : public span_image_filter { + public: + typedef Source source_type; + typedef typename source_type::color_type color_type; + typedef typename source_type::order_type order_type; + typedef Interpolator interpolator_type; + typedef span_image_filter base_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; - //==============================================span_image_filter_rgba_nn - template - class span_image_filter_rgba_nn : - public span_image_filter + //-------------------------------------------------------------------- + span_image_filter_rgba_nn() {} + span_image_filter_rgba_nn(source_type& src, interpolator_type& inter) + : base_type(src, inter, 0) + {} + + //-------------------------------------------------------------------- + void generate(color_type* span, int x, int y, unsigned len) { - public: - typedef Source source_type; - typedef typename source_type::color_type color_type; - typedef typename source_type::order_type order_type; - typedef Interpolator interpolator_type; - typedef span_image_filter base_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; - enum base_scale_e + base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); + do { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + base_type::interpolator().coordinates(&x, &y); + const value_type* fg_ptr = + (const value_type*)base_type::source().span(x >> image_subpixel_shift, y >> image_subpixel_shift, 1); + span->r = fg_ptr[order_type::R]; + span->g = fg_ptr[order_type::G]; + span->b = fg_ptr[order_type::B]; + span->a = fg_ptr[order_type::A]; + ++span; + ++base_type::interpolator(); - //-------------------------------------------------------------------- - span_image_filter_rgba_nn() {} - span_image_filter_rgba_nn(source_type& src, - interpolator_type& inter) : - base_type(src, inter, 0) - {} + } while (--len); + } +}; - //-------------------------------------------------------------------- - void generate(color_type* span, int x, int y, unsigned len) - { - base_type::interpolator().begin(x + base_type::filter_dx_dbl(), - y + base_type::filter_dy_dbl(), len); - do - { - base_type::interpolator().coordinates(&x, &y); - const value_type* fg_ptr = (const value_type*) - base_type::source().span(x >> image_subpixel_shift, - y >> image_subpixel_shift, - 1); - span->r = fg_ptr[order_type::R]; - span->g = fg_ptr[order_type::G]; - span->b = fg_ptr[order_type::B]; - span->a = fg_ptr[order_type::A]; - ++span; - ++base_type::interpolator(); +//=========================================span_image_filter_rgba_bilinear +template +class span_image_filter_rgba_bilinear : public span_image_filter +{ + public: + typedef Source source_type; + typedef typename source_type::color_type color_type; + typedef typename source_type::order_type order_type; + typedef Interpolator interpolator_type; + typedef span_image_filter base_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; - } while(--len); - } - }; + //-------------------------------------------------------------------- + span_image_filter_rgba_bilinear() {} + span_image_filter_rgba_bilinear(source_type& src, interpolator_type& inter) + : base_type(src, inter, 0) + {} - - - //=========================================span_image_filter_rgba_bilinear - template - class span_image_filter_rgba_bilinear : - public span_image_filter + //-------------------------------------------------------------------- + void generate(color_type* span, int x, int y, unsigned len) { - public: - typedef Source source_type; - typedef typename source_type::color_type color_type; - typedef typename source_type::order_type order_type; - typedef Interpolator interpolator_type; - typedef span_image_filter base_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; - enum base_scale_e + base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); + + calc_type fg[4]; + const value_type* fg_ptr; + + do { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + int x_hr; + int y_hr; - //-------------------------------------------------------------------- - span_image_filter_rgba_bilinear() {} - span_image_filter_rgba_bilinear(source_type& src, - interpolator_type& inter) : - base_type(src, inter, 0) - {} + base_type::interpolator().coordinates(&x_hr, &y_hr); + x_hr -= base_type::filter_dx_int(); + y_hr -= base_type::filter_dy_int(); - //-------------------------------------------------------------------- - void generate(color_type* span, int x, int y, unsigned len) + int x_lr = x_hr >> image_subpixel_shift; + int y_lr = y_hr >> image_subpixel_shift; + + unsigned weight; + + fg[0] = fg[1] = fg[2] = fg[3] = image_subpixel_scale * image_subpixel_scale / 2; + + x_hr &= image_subpixel_mask; + y_hr &= image_subpixel_mask; + + fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, 2); + weight = (image_subpixel_scale - x_hr) * (image_subpixel_scale - y_hr); + fg[0] += weight * *fg_ptr++; + fg[1] += weight * *fg_ptr++; + fg[2] += weight * *fg_ptr++; + fg[3] += weight * *fg_ptr; + + fg_ptr = (const value_type*)base_type::source().next_x(); + weight = x_hr * (image_subpixel_scale - y_hr); + fg[0] += weight * *fg_ptr++; + fg[1] += weight * *fg_ptr++; + fg[2] += weight * *fg_ptr++; + fg[3] += weight * *fg_ptr; + + fg_ptr = (const value_type*)base_type::source().next_y(); + weight = (image_subpixel_scale - x_hr) * y_hr; + fg[0] += weight * *fg_ptr++; + fg[1] += weight * *fg_ptr++; + fg[2] += weight * *fg_ptr++; + fg[3] += weight * *fg_ptr; + + fg_ptr = (const value_type*)base_type::source().next_x(); + weight = x_hr * y_hr; + fg[0] += weight * *fg_ptr++; + fg[1] += weight * *fg_ptr++; + fg[2] += weight * *fg_ptr++; + fg[3] += weight * *fg_ptr; + + span->r = value_type(fg[order_type::R] >> (image_subpixel_shift * 2)); + span->g = value_type(fg[order_type::G] >> (image_subpixel_shift * 2)); + span->b = value_type(fg[order_type::B] >> (image_subpixel_shift * 2)); + span->a = value_type(fg[order_type::A] >> (image_subpixel_shift * 2)); + + ++span; + ++base_type::interpolator(); + + } while (--len); + } +}; + +//====================================span_image_filter_rgba_bilinear_clip +template +class span_image_filter_rgba_bilinear_clip : public span_image_filter +{ + public: + typedef Source source_type; + typedef typename source_type::color_type color_type; + typedef typename source_type::order_type order_type; + typedef Interpolator interpolator_type; + typedef span_image_filter base_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; + + //-------------------------------------------------------------------- + span_image_filter_rgba_bilinear_clip() {} + span_image_filter_rgba_bilinear_clip(source_type& src, const color_type& back_color, interpolator_type& inter) + : base_type(src, inter, 0) + , m_back_color(back_color) + {} + const color_type& background_color() const { return m_back_color; } + void background_color(const color_type& v) { m_back_color = v; } + + //-------------------------------------------------------------------- + void generate(color_type* span, int x, int y, unsigned len) + { + base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); + + calc_type fg[4]; + value_type back_r = m_back_color.r; + value_type back_g = m_back_color.g; + value_type back_b = m_back_color.b; + value_type back_a = m_back_color.a; + + const value_type* fg_ptr; + int maxx = base_type::source().width() - 1; + int maxy = base_type::source().height() - 1; + + do { - base_type::interpolator().begin(x + base_type::filter_dx_dbl(), - y + base_type::filter_dy_dbl(), len); + int x_hr; + int y_hr; - calc_type fg[4]; - const value_type *fg_ptr; + base_type::interpolator().coordinates(&x_hr, &y_hr); - do + x_hr -= base_type::filter_dx_int(); + y_hr -= base_type::filter_dy_int(); + + int x_lr = x_hr >> image_subpixel_shift; + int y_lr = y_hr >> image_subpixel_shift; + + unsigned weight; + + if (x_lr >= 0 && y_lr >= 0 && x_lr < maxx && y_lr < maxy) { - int x_hr; - int y_hr; - - base_type::interpolator().coordinates(&x_hr, &y_hr); - - x_hr -= base_type::filter_dx_int(); - y_hr -= base_type::filter_dy_int(); - - int x_lr = x_hr >> image_subpixel_shift; - int y_lr = y_hr >> image_subpixel_shift; - - unsigned weight; - - fg[0] = - fg[1] = - fg[2] = - fg[3] = image_subpixel_scale * image_subpixel_scale / 2; + fg[0] = fg[1] = fg[2] = fg[3] = image_subpixel_scale * image_subpixel_scale / 2; x_hr &= image_subpixel_mask; y_hr &= image_subpixel_mask; - fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, 2); - weight = (image_subpixel_scale - x_hr) * - (image_subpixel_scale - y_hr); + fg_ptr = (const value_type*)base_type::source().row_ptr(y_lr) + (x_lr << 2); + + weight = (image_subpixel_scale - x_hr) * (image_subpixel_scale - y_hr); fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; - fg[3] += weight * *fg_ptr; + fg[3] += weight * *fg_ptr++; - fg_ptr = (const value_type*)base_type::source().next_x(); weight = x_hr * (image_subpixel_scale - y_hr); fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; - fg[3] += weight * *fg_ptr; + fg[3] += weight * *fg_ptr++; + + ++y_lr; + fg_ptr = (const value_type*)base_type::source().row_ptr(y_lr) + (x_lr << 2); - fg_ptr = (const value_type*)base_type::source().next_y(); weight = (image_subpixel_scale - x_hr) * y_hr; fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; - fg[3] += weight * *fg_ptr; + fg[3] += weight * *fg_ptr++; - fg_ptr = (const value_type*)base_type::source().next_x(); weight = x_hr * y_hr; fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; - fg[3] += weight * *fg_ptr; + fg[3] += weight * *fg_ptr++; - span->r = value_type(fg[order_type::R] >> (image_subpixel_shift * 2)); - span->g = value_type(fg[order_type::G] >> (image_subpixel_shift * 2)); - span->b = value_type(fg[order_type::B] >> (image_subpixel_shift * 2)); - span->a = value_type(fg[order_type::A] >> (image_subpixel_shift * 2)); - - ++span; - ++base_type::interpolator(); - - } while(--len); - } - }; - - - //====================================span_image_filter_rgba_bilinear_clip - template - class span_image_filter_rgba_bilinear_clip : - public span_image_filter - { - public: - typedef Source source_type; - typedef typename source_type::color_type color_type; - typedef typename source_type::order_type order_type; - typedef Interpolator interpolator_type; - typedef span_image_filter base_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; - - //-------------------------------------------------------------------- - span_image_filter_rgba_bilinear_clip() {} - span_image_filter_rgba_bilinear_clip(source_type& src, - const color_type& back_color, - interpolator_type& inter) : - base_type(src, inter, 0), - m_back_color(back_color) - {} - const color_type& background_color() const { return m_back_color; } - void background_color(const color_type& v) { m_back_color = v; } - - - //-------------------------------------------------------------------- - void generate(color_type* span, int x, int y, unsigned len) - { - base_type::interpolator().begin(x + base_type::filter_dx_dbl(), - y + base_type::filter_dy_dbl(), len); - - calc_type fg[4]; - value_type back_r = m_back_color.r; - value_type back_g = m_back_color.g; - value_type back_b = m_back_color.b; - value_type back_a = m_back_color.a; - - const value_type *fg_ptr; - int maxx = base_type::source().width() - 1; - int maxy = base_type::source().height() - 1; - - do + fg[0] >>= image_subpixel_shift * 2; + fg[1] >>= image_subpixel_shift * 2; + fg[2] >>= image_subpixel_shift * 2; + fg[3] >>= image_subpixel_shift * 2; + } + else { - int x_hr; - int y_hr; - - base_type::interpolator().coordinates(&x_hr, &y_hr); - - x_hr -= base_type::filter_dx_int(); - y_hr -= base_type::filter_dy_int(); - - int x_lr = x_hr >> image_subpixel_shift; - int y_lr = y_hr >> image_subpixel_shift; - - unsigned weight; - - if(x_lr >= 0 && y_lr >= 0 && - x_lr < maxx && y_lr < maxy) + if (x_lr < -1 || y_lr < -1 || x_lr > maxx || y_lr > maxy) { - fg[0] = - fg[1] = - fg[2] = - fg[3] = image_subpixel_scale * image_subpixel_scale / 2; + fg[order_type::R] = back_r; + fg[order_type::G] = back_g; + fg[order_type::B] = back_b; + fg[order_type::A] = back_a; + } + else + { + fg[0] = fg[1] = fg[2] = fg[3] = image_subpixel_scale * image_subpixel_scale / 2; x_hr &= image_subpixel_mask; y_hr &= image_subpixel_mask; - fg_ptr = (const value_type*) - base_type::source().row_ptr(y_lr) + (x_lr << 2); + weight = (image_subpixel_scale - x_hr) * (image_subpixel_scale - y_hr); + if (x_lr >= 0 && y_lr >= 0 && x_lr <= maxx && y_lr <= maxy) + { + fg_ptr = (const value_type*)base_type::source().row_ptr(y_lr) + (x_lr << 2); - weight = (image_subpixel_scale - x_hr) * - (image_subpixel_scale - y_hr); - fg[0] += weight * *fg_ptr++; - fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr++; - fg[3] += weight * *fg_ptr++; + fg[0] += weight * *fg_ptr++; + fg[1] += weight * *fg_ptr++; + fg[2] += weight * *fg_ptr++; + fg[3] += weight * *fg_ptr++; + } + else + { + fg[order_type::R] += back_r * weight; + fg[order_type::G] += back_g * weight; + fg[order_type::B] += back_b * weight; + fg[order_type::A] += back_a * weight; + } + + x_lr++; weight = x_hr * (image_subpixel_scale - y_hr); - fg[0] += weight * *fg_ptr++; - fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr++; - fg[3] += weight * *fg_ptr++; + if (x_lr >= 0 && y_lr >= 0 && x_lr <= maxx && y_lr <= maxy) + { + fg_ptr = (const value_type*)base_type::source().row_ptr(y_lr) + (x_lr << 2); - ++y_lr; - fg_ptr = (const value_type*) - base_type::source().row_ptr(y_lr) + (x_lr << 2); + fg[0] += weight * *fg_ptr++; + fg[1] += weight * *fg_ptr++; + fg[2] += weight * *fg_ptr++; + fg[3] += weight * *fg_ptr++; + } + else + { + fg[order_type::R] += back_r * weight; + fg[order_type::G] += back_g * weight; + fg[order_type::B] += back_b * weight; + fg[order_type::A] += back_a * weight; + } + + x_lr--; + y_lr++; weight = (image_subpixel_scale - x_hr) * y_hr; - fg[0] += weight * *fg_ptr++; - fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr++; - fg[3] += weight * *fg_ptr++; + if (x_lr >= 0 && y_lr >= 0 && x_lr <= maxx && y_lr <= maxy) + { + fg_ptr = (const value_type*)base_type::source().row_ptr(y_lr) + (x_lr << 2); + + fg[0] += weight * *fg_ptr++; + fg[1] += weight * *fg_ptr++; + fg[2] += weight * *fg_ptr++; + fg[3] += weight * *fg_ptr++; + } + else + { + fg[order_type::R] += back_r * weight; + fg[order_type::G] += back_g * weight; + fg[order_type::B] += back_b * weight; + fg[order_type::A] += back_a * weight; + } + + x_lr++; weight = x_hr * y_hr; - fg[0] += weight * *fg_ptr++; - fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr++; - fg[3] += weight * *fg_ptr++; + if (x_lr >= 0 && y_lr >= 0 && x_lr <= maxx && y_lr <= maxy) + { + fg_ptr = (const value_type*)base_type::source().row_ptr(y_lr) + (x_lr << 2); + + fg[0] += weight * *fg_ptr++; + fg[1] += weight * *fg_ptr++; + fg[2] += weight * *fg_ptr++; + fg[3] += weight * *fg_ptr++; + } + else + { + fg[order_type::R] += back_r * weight; + fg[order_type::G] += back_g * weight; + fg[order_type::B] += back_b * weight; + fg[order_type::A] += back_a * weight; + } fg[0] >>= image_subpixel_shift * 2; fg[1] >>= image_subpixel_shift * 2; fg[2] >>= image_subpixel_shift * 2; fg[3] >>= image_subpixel_shift * 2; } - else + } + + span->r = (value_type)fg[order_type::R]; + span->g = (value_type)fg[order_type::G]; + span->b = (value_type)fg[order_type::B]; + span->a = (value_type)fg[order_type::A]; + ++span; + ++base_type::interpolator(); + + } while (--len); + } + + private: + color_type m_back_color; +}; + +//==============================================span_image_filter_rgba_2x2 +template +class span_image_filter_rgba_2x2 : public span_image_filter +{ + public: + typedef Source source_type; + typedef typename source_type::color_type color_type; + typedef typename source_type::order_type order_type; + typedef Interpolator interpolator_type; + typedef span_image_filter base_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; + + //-------------------------------------------------------------------- + span_image_filter_rgba_2x2() {} + span_image_filter_rgba_2x2(source_type& src, interpolator_type& inter, const image_filter_lut& filter) + : base_type(src, inter, &filter) + {} + + //-------------------------------------------------------------------- + void generate(color_type* span, int x, int y, unsigned len) + { + base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); + + calc_type fg[4]; + + const value_type* fg_ptr; + const int16* weight_array = + base_type::filter().weight_array() + ((base_type::filter().diameter() / 2 - 1) << image_subpixel_shift); + + do + { + int x_hr; + int y_hr; + + base_type::interpolator().coordinates(&x_hr, &y_hr); + + x_hr -= base_type::filter_dx_int(); + y_hr -= base_type::filter_dy_int(); + + int x_lr = x_hr >> image_subpixel_shift; + int y_lr = y_hr >> image_subpixel_shift; + + unsigned weight; + fg[0] = fg[1] = fg[2] = fg[3] = image_filter_scale / 2; + + x_hr &= image_subpixel_mask; + y_hr &= image_subpixel_mask; + + fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, 2); + weight = (weight_array[x_hr + image_subpixel_scale] * weight_array[y_hr + image_subpixel_scale] + + image_filter_scale / 2) >> + image_filter_shift; + fg[0] += weight * *fg_ptr++; + fg[1] += weight * *fg_ptr++; + fg[2] += weight * *fg_ptr++; + fg[3] += weight * *fg_ptr; + + fg_ptr = (const value_type*)base_type::source().next_x(); + weight = (weight_array[x_hr] * weight_array[y_hr + image_subpixel_scale] + image_filter_scale / 2) >> + image_filter_shift; + fg[0] += weight * *fg_ptr++; + fg[1] += weight * *fg_ptr++; + fg[2] += weight * *fg_ptr++; + fg[3] += weight * *fg_ptr; + + fg_ptr = (const value_type*)base_type::source().next_y(); + weight = (weight_array[x_hr + image_subpixel_scale] * weight_array[y_hr] + image_filter_scale / 2) >> + image_filter_shift; + fg[0] += weight * *fg_ptr++; + fg[1] += weight * *fg_ptr++; + fg[2] += weight * *fg_ptr++; + fg[3] += weight * *fg_ptr; + + fg_ptr = (const value_type*)base_type::source().next_x(); + weight = (weight_array[x_hr] * weight_array[y_hr] + image_filter_scale / 2) >> image_filter_shift; + fg[0] += weight * *fg_ptr++; + fg[1] += weight * *fg_ptr++; + fg[2] += weight * *fg_ptr++; + fg[3] += weight * *fg_ptr; + + fg[0] >>= image_filter_shift; + fg[1] >>= image_filter_shift; + fg[2] >>= image_filter_shift; + fg[3] >>= image_filter_shift; + + if (fg[order_type::A] > base_mask) + fg[order_type::A] = base_mask; + if (fg[order_type::R] > fg[order_type::A]) + fg[order_type::R] = fg[order_type::A]; + if (fg[order_type::G] > fg[order_type::A]) + fg[order_type::G] = fg[order_type::A]; + if (fg[order_type::B] > fg[order_type::A]) + fg[order_type::B] = fg[order_type::A]; + + span->r = (value_type)fg[order_type::R]; + span->g = (value_type)fg[order_type::G]; + span->b = (value_type)fg[order_type::B]; + span->a = (value_type)fg[order_type::A]; + ++span; + ++base_type::interpolator(); + + } while (--len); + } +}; + +//==================================================span_image_filter_rgba +template +class span_image_filter_rgba : public span_image_filter +{ + public: + typedef Source source_type; + typedef typename source_type::color_type color_type; + typedef typename source_type::order_type order_type; + typedef Interpolator interpolator_type; + typedef span_image_filter base_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; + enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; + + //-------------------------------------------------------------------- + span_image_filter_rgba() {} + span_image_filter_rgba(source_type& src, interpolator_type& inter, const image_filter_lut& filter) + : base_type(src, inter, &filter) + {} + + //-------------------------------------------------------------------- + void generate(color_type* span, int x, int y, unsigned len) + { + base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); + + int fg[4]; + const value_type* fg_ptr; + + unsigned diameter = base_type::filter().diameter(); + int start = base_type::filter().start(); + const int16* weight_array = base_type::filter().weight_array(); + + int x_count; + int weight_y; + + do + { + base_type::interpolator().coordinates(&x, &y); + + x -= base_type::filter_dx_int(); + y -= base_type::filter_dy_int(); + + int x_hr = x; + int y_hr = y; + + int x_lr = x_hr >> image_subpixel_shift; + int y_lr = y_hr >> image_subpixel_shift; + + fg[0] = fg[1] = fg[2] = fg[3] = image_filter_scale / 2; + + int x_fract = x_hr & image_subpixel_mask; + unsigned y_count = diameter; + + y_hr = image_subpixel_mask - (y_hr & image_subpixel_mask); + fg_ptr = (const value_type*)base_type::source().span(x_lr + start, y_lr + start, diameter); + for (;;) + { + x_count = diameter; + weight_y = weight_array[y_hr]; + x_hr = image_subpixel_mask - x_fract; + for (;;) { - if(x_lr < -1 || y_lr < -1 || - x_lr > maxx || y_lr > maxy) - { - fg[order_type::R] = back_r; - fg[order_type::G] = back_g; - fg[order_type::B] = back_b; - fg[order_type::A] = back_a; - } - else - { - fg[0] = - fg[1] = - fg[2] = - fg[3] = image_subpixel_scale * image_subpixel_scale / 2; + int weight = (weight_y * weight_array[x_hr] + image_filter_scale / 2) >> image_filter_shift; - x_hr &= image_subpixel_mask; - y_hr &= image_subpixel_mask; + fg[0] += weight * *fg_ptr++; + fg[1] += weight * *fg_ptr++; + fg[2] += weight * *fg_ptr++; + fg[3] += weight * *fg_ptr; - weight = (image_subpixel_scale - x_hr) * - (image_subpixel_scale - y_hr); - if(x_lr >= 0 && y_lr >= 0 && - x_lr <= maxx && y_lr <= maxy) - { - fg_ptr = (const value_type*) - base_type::source().row_ptr(y_lr) + (x_lr << 2); - - fg[0] += weight * *fg_ptr++; - fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr++; - fg[3] += weight * *fg_ptr++; - } - else - { - fg[order_type::R] += back_r * weight; - fg[order_type::G] += back_g * weight; - fg[order_type::B] += back_b * weight; - fg[order_type::A] += back_a * weight; - } - - x_lr++; - - weight = x_hr * (image_subpixel_scale - y_hr); - if(x_lr >= 0 && y_lr >= 0 && - x_lr <= maxx && y_lr <= maxy) - { - fg_ptr = (const value_type*) - base_type::source().row_ptr(y_lr) + (x_lr << 2); - - fg[0] += weight * *fg_ptr++; - fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr++; - fg[3] += weight * *fg_ptr++; - } - else - { - fg[order_type::R] += back_r * weight; - fg[order_type::G] += back_g * weight; - fg[order_type::B] += back_b * weight; - fg[order_type::A] += back_a * weight; - } - - x_lr--; - y_lr++; - - weight = (image_subpixel_scale - x_hr) * y_hr; - if(x_lr >= 0 && y_lr >= 0 && - x_lr <= maxx && y_lr <= maxy) - { - fg_ptr = (const value_type*) - base_type::source().row_ptr(y_lr) + (x_lr << 2); - - fg[0] += weight * *fg_ptr++; - fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr++; - fg[3] += weight * *fg_ptr++; - } - else - { - fg[order_type::R] += back_r * weight; - fg[order_type::G] += back_g * weight; - fg[order_type::B] += back_b * weight; - fg[order_type::A] += back_a * weight; - } - - x_lr++; - - weight = x_hr * y_hr; - if(x_lr >= 0 && y_lr >= 0 && - x_lr <= maxx && y_lr <= maxy) - { - fg_ptr = (const value_type*) - base_type::source().row_ptr(y_lr) + (x_lr << 2); - - fg[0] += weight * *fg_ptr++; - fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr++; - fg[3] += weight * *fg_ptr++; - } - else - { - fg[order_type::R] += back_r * weight; - fg[order_type::G] += back_g * weight; - fg[order_type::B] += back_b * weight; - fg[order_type::A] += back_a * weight; - } - - fg[0] >>= image_subpixel_shift * 2; - fg[1] >>= image_subpixel_shift * 2; - fg[2] >>= image_subpixel_shift * 2; - fg[3] >>= image_subpixel_shift * 2; - } + if (--x_count == 0) + break; + x_hr += image_subpixel_scale; + fg_ptr = (const value_type*)base_type::source().next_x(); } - span->r = (value_type)fg[order_type::R]; - span->g = (value_type)fg[order_type::G]; - span->b = (value_type)fg[order_type::B]; - span->a = (value_type)fg[order_type::A]; - ++span; - ++base_type::interpolator(); - - } while(--len); - } - private: - color_type m_back_color; - }; - - - //==============================================span_image_filter_rgba_2x2 - template - class span_image_filter_rgba_2x2 : - public span_image_filter - { - public: - typedef Source source_type; - typedef typename source_type::color_type color_type; - typedef typename source_type::order_type order_type; - typedef Interpolator interpolator_type; - typedef span_image_filter base_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; - - //-------------------------------------------------------------------- - span_image_filter_rgba_2x2() {} - span_image_filter_rgba_2x2(source_type& src, - interpolator_type& inter, - const image_filter_lut& filter) : - base_type(src, inter, &filter) - {} - - - //-------------------------------------------------------------------- - void generate(color_type* span, int x, int y, unsigned len) - { - base_type::interpolator().begin(x + base_type::filter_dx_dbl(), - y + base_type::filter_dy_dbl(), len); - - calc_type fg[4]; - - const value_type *fg_ptr; - const int16* weight_array = base_type::filter().weight_array() + - ((base_type::filter().diameter()/2 - 1) << - image_subpixel_shift); - - do - { - int x_hr; - int y_hr; - - base_type::interpolator().coordinates(&x_hr, &y_hr); - - x_hr -= base_type::filter_dx_int(); - y_hr -= base_type::filter_dy_int(); - - int x_lr = x_hr >> image_subpixel_shift; - int y_lr = y_hr >> image_subpixel_shift; - - unsigned weight; - fg[0] = fg[1] = fg[2] = fg[3] = image_filter_scale / 2; - - x_hr &= image_subpixel_mask; - y_hr &= image_subpixel_mask; - - fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, 2); - weight = (weight_array[x_hr + image_subpixel_scale] * - weight_array[y_hr + image_subpixel_scale] + - image_filter_scale / 2) >> - image_filter_shift; - fg[0] += weight * *fg_ptr++; - fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr++; - fg[3] += weight * *fg_ptr; - - fg_ptr = (const value_type*)base_type::source().next_x(); - weight = (weight_array[x_hr] * - weight_array[y_hr + image_subpixel_scale] + - image_filter_scale / 2) >> - image_filter_shift; - fg[0] += weight * *fg_ptr++; - fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr++; - fg[3] += weight * *fg_ptr; - + if (--y_count == 0) + break; + y_hr += image_subpixel_scale; fg_ptr = (const value_type*)base_type::source().next_y(); - weight = (weight_array[x_hr + image_subpixel_scale] * - weight_array[y_hr] + - image_filter_scale / 2) >> - image_filter_shift; - fg[0] += weight * *fg_ptr++; - fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr++; - fg[3] += weight * *fg_ptr; + } - fg_ptr = (const value_type*)base_type::source().next_x(); - weight = (weight_array[x_hr] * - weight_array[y_hr] + - image_filter_scale / 2) >> - image_filter_shift; - fg[0] += weight * *fg_ptr++; - fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr++; - fg[3] += weight * *fg_ptr; + fg[0] >>= image_filter_shift; + fg[1] >>= image_filter_shift; + fg[2] >>= image_filter_shift; + fg[3] >>= image_filter_shift; - fg[0] >>= image_filter_shift; - fg[1] >>= image_filter_shift; - fg[2] >>= image_filter_shift; - fg[3] >>= image_filter_shift; + if (fg[0] < 0) + fg[0] = 0; + if (fg[1] < 0) + fg[1] = 0; + if (fg[2] < 0) + fg[2] = 0; + if (fg[3] < 0) + fg[3] = 0; - if(fg[order_type::A] > base_mask) fg[order_type::A] = base_mask; - if(fg[order_type::R] > fg[order_type::A]) fg[order_type::R] = fg[order_type::A]; - if(fg[order_type::G] > fg[order_type::A]) fg[order_type::G] = fg[order_type::A]; - if(fg[order_type::B] > fg[order_type::A]) fg[order_type::B] = fg[order_type::A]; + if (fg[order_type::A] > base_mask) + fg[order_type::A] = base_mask; + if (fg[order_type::R] > fg[order_type::A]) + fg[order_type::R] = fg[order_type::A]; + if (fg[order_type::G] > fg[order_type::A]) + fg[order_type::G] = fg[order_type::A]; + if (fg[order_type::B] > fg[order_type::A]) + fg[order_type::B] = fg[order_type::A]; - span->r = (value_type)fg[order_type::R]; - span->g = (value_type)fg[order_type::G]; - span->b = (value_type)fg[order_type::B]; - span->a = (value_type)fg[order_type::A]; - ++span; - ++base_type::interpolator(); + span->r = (value_type)fg[order_type::R]; + span->g = (value_type)fg[order_type::G]; + span->b = (value_type)fg[order_type::B]; + span->a = (value_type)fg[order_type::A]; + ++span; + ++base_type::interpolator(); - } while(--len); - } + } while (--len); + } +}; + +//========================================span_image_resample_rgba_affine +template +class span_image_resample_rgba_affine : public span_image_resample_affine +{ + public: + typedef Source source_type; + typedef typename source_type::color_type color_type; + typedef typename source_type::order_type order_type; + typedef span_image_resample_affine base_type; + typedef typename base_type::interpolator_type interpolator_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::long_type long_type; + enum base_scale_e { + base_shift = color_type::base_shift, + base_mask = color_type::base_mask, + downscale_shift = image_filter_shift }; + //-------------------------------------------------------------------- + span_image_resample_rgba_affine() {} + span_image_resample_rgba_affine(source_type& src, interpolator_type& inter, const image_filter_lut& filter) + : base_type(src, inter, filter) + {} - - //==================================================span_image_filter_rgba - template - class span_image_filter_rgba : - public span_image_filter + //-------------------------------------------------------------------- + void generate(color_type* span, int x, int y, unsigned len) { - public: - typedef Source source_type; - typedef typename source_type::color_type color_type; - typedef typename source_type::order_type order_type; - typedef Interpolator interpolator_type; - typedef span_image_filter base_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; - enum base_scale_e + base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); + + long_type fg[4]; + + int diameter = base_type::filter().diameter(); + int filter_scale = diameter << image_subpixel_shift; + int radius_x = (diameter * base_type::m_rx) >> 1; + int radius_y = (diameter * base_type::m_ry) >> 1; + int len_x_lr = (diameter * base_type::m_rx + image_subpixel_mask) >> image_subpixel_shift; + + const int16* weight_array = base_type::filter().weight_array(); + + do { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask - }; + base_type::interpolator().coordinates(&x, &y); - //-------------------------------------------------------------------- - span_image_filter_rgba() {} - span_image_filter_rgba(source_type& src, - interpolator_type& inter, - const image_filter_lut& filter) : - base_type(src, inter, &filter) - {} + x += base_type::filter_dx_int() - radius_x; + y += base_type::filter_dy_int() - radius_y; - //-------------------------------------------------------------------- - void generate(color_type* span, int x, int y, unsigned len) - { - base_type::interpolator().begin(x + base_type::filter_dx_dbl(), - y + base_type::filter_dy_dbl(), len); + fg[0] = fg[1] = fg[2] = fg[3] = image_filter_scale / 2; - int fg[4]; - const value_type *fg_ptr; + int y_lr = y >> image_subpixel_shift; + int y_hr = + ((image_subpixel_mask - (y & image_subpixel_mask)) * base_type::m_ry_inv) >> image_subpixel_shift; + int total_weight = 0; + int x_lr = x >> image_subpixel_shift; + int x_hr = + ((image_subpixel_mask - (x & image_subpixel_mask)) * base_type::m_rx_inv) >> image_subpixel_shift; - unsigned diameter = base_type::filter().diameter(); - int start = base_type::filter().start(); - const int16* weight_array = base_type::filter().weight_array(); - - int x_count; - int weight_y; - - do + int x_hr2 = x_hr; + const value_type* fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, len_x_lr); + for (;;) { - base_type::interpolator().coordinates(&x, &y); - - x -= base_type::filter_dx_int(); - y -= base_type::filter_dy_int(); - - int x_hr = x; - int y_hr = y; - - int x_lr = x_hr >> image_subpixel_shift; - int y_lr = y_hr >> image_subpixel_shift; - - fg[0] = fg[1] = fg[2] = fg[3] = image_filter_scale / 2; - - int x_fract = x_hr & image_subpixel_mask; - unsigned y_count = diameter; - - y_hr = image_subpixel_mask - (y_hr & image_subpixel_mask); - fg_ptr = (const value_type*)base_type::source().span(x_lr + start, - y_lr + start, - diameter); - for(;;) + int weight_y = weight_array[y_hr]; + x_hr = x_hr2; + for (;;) { - x_count = diameter; - weight_y = weight_array[y_hr]; - x_hr = image_subpixel_mask - x_fract; - for(;;) - { - int weight = (weight_y * weight_array[x_hr] + - image_filter_scale / 2) >> - image_filter_shift; + int weight = (weight_y * weight_array[x_hr] + image_filter_scale / 2) >> downscale_shift; - fg[0] += weight * *fg_ptr++; - fg[1] += weight * *fg_ptr++; - fg[2] += weight * *fg_ptr++; - fg[3] += weight * *fg_ptr; - - if(--x_count == 0) break; - x_hr += image_subpixel_scale; - fg_ptr = (const value_type*)base_type::source().next_x(); - } - - if(--y_count == 0) break; - y_hr += image_subpixel_scale; - fg_ptr = (const value_type*)base_type::source().next_y(); + fg[0] += *fg_ptr++ * weight; + fg[1] += *fg_ptr++ * weight; + fg[2] += *fg_ptr++ * weight; + fg[3] += *fg_ptr++ * weight; + total_weight += weight; + x_hr += base_type::m_rx_inv; + if (x_hr >= filter_scale) + break; + fg_ptr = (const value_type*)base_type::source().next_x(); } + y_hr += base_type::m_ry_inv; + if (y_hr >= filter_scale) + break; + fg_ptr = (const value_type*)base_type::source().next_y(); + } - fg[0] >>= image_filter_shift; - fg[1] >>= image_filter_shift; - fg[2] >>= image_filter_shift; - fg[3] >>= image_filter_shift; + fg[0] /= total_weight; + fg[1] /= total_weight; + fg[2] /= total_weight; + fg[3] /= total_weight; - if(fg[0] < 0) fg[0] = 0; - if(fg[1] < 0) fg[1] = 0; - if(fg[2] < 0) fg[2] = 0; - if(fg[3] < 0) fg[3] = 0; + if (fg[0] < 0) + fg[0] = 0; + if (fg[1] < 0) + fg[1] = 0; + if (fg[2] < 0) + fg[2] = 0; + if (fg[3] < 0) + fg[3] = 0; - if(fg[order_type::A] > base_mask) fg[order_type::A] = base_mask; - if(fg[order_type::R] > fg[order_type::A]) fg[order_type::R] = fg[order_type::A]; - if(fg[order_type::G] > fg[order_type::A]) fg[order_type::G] = fg[order_type::A]; - if(fg[order_type::B] > fg[order_type::A]) fg[order_type::B] = fg[order_type::A]; + if (fg[order_type::A] > base_mask) + fg[order_type::A] = base_mask; + if (fg[order_type::R] > fg[order_type::A]) + fg[order_type::R] = fg[order_type::A]; + if (fg[order_type::G] > fg[order_type::A]) + fg[order_type::G] = fg[order_type::A]; + if (fg[order_type::B] > fg[order_type::A]) + fg[order_type::B] = fg[order_type::A]; - span->r = (value_type)fg[order_type::R]; - span->g = (value_type)fg[order_type::G]; - span->b = (value_type)fg[order_type::B]; - span->a = (value_type)fg[order_type::A]; - ++span; - ++base_type::interpolator(); + span->r = (value_type)fg[order_type::R]; + span->g = (value_type)fg[order_type::G]; + span->b = (value_type)fg[order_type::B]; + span->a = (value_type)fg[order_type::A]; - } while(--len); - } + ++span; + ++base_type::interpolator(); + } while (--len); + } +}; + +//==============================================span_image_resample_rgba +template +class span_image_resample_rgba : public span_image_resample +{ + public: + typedef Source source_type; + typedef typename source_type::color_type color_type; + typedef typename source_type::order_type order_type; + typedef Interpolator interpolator_type; + typedef span_image_resample base_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::long_type long_type; + enum base_scale_e { + base_shift = color_type::base_shift, + base_mask = color_type::base_mask, + downscale_shift = image_filter_shift }; + //-------------------------------------------------------------------- + span_image_resample_rgba() {} + span_image_resample_rgba(source_type& src, interpolator_type& inter, const image_filter_lut& filter) + : base_type(src, inter, filter) + {} - - //========================================span_image_resample_rgba_affine - template - class span_image_resample_rgba_affine : - public span_image_resample_affine + //-------------------------------------------------------------------- + void generate(color_type* span, int x, int y, unsigned len) { - public: - typedef Source source_type; - typedef typename source_type::color_type color_type; - typedef typename source_type::order_type order_type; - typedef span_image_resample_affine base_type; - typedef typename base_type::interpolator_type interpolator_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::long_type long_type; - enum base_scale_e + base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); + long_type fg[4]; + + int diameter = base_type::filter().diameter(); + int filter_scale = diameter << image_subpixel_shift; + + const int16* weight_array = base_type::filter().weight_array(); + do { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask, - downscale_shift = image_filter_shift - }; + int rx; + int ry; + int rx_inv = image_subpixel_scale; + int ry_inv = image_subpixel_scale; + base_type::interpolator().coordinates(&x, &y); + base_type::interpolator().local_scale(&rx, &ry); + base_type::adjust_scale(&rx, &ry); - //-------------------------------------------------------------------- - span_image_resample_rgba_affine() {} - span_image_resample_rgba_affine(source_type& src, - interpolator_type& inter, - const image_filter_lut& filter) : - base_type(src, inter, filter) - {} + rx_inv = image_subpixel_scale * image_subpixel_scale / rx; + ry_inv = image_subpixel_scale * image_subpixel_scale / ry; + int radius_x = (diameter * rx) >> 1; + int radius_y = (diameter * ry) >> 1; + int len_x_lr = (diameter * rx + image_subpixel_mask) >> image_subpixel_shift; - //-------------------------------------------------------------------- - void generate(color_type* span, int x, int y, unsigned len) - { - base_type::interpolator().begin(x + base_type::filter_dx_dbl(), - y + base_type::filter_dy_dbl(), len); + x += base_type::filter_dx_int() - radius_x; + y += base_type::filter_dy_int() - radius_y; - long_type fg[4]; + fg[0] = fg[1] = fg[2] = fg[3] = image_filter_scale / 2; - int diameter = base_type::filter().diameter(); - int filter_scale = diameter << image_subpixel_shift; - int radius_x = (diameter * base_type::m_rx) >> 1; - int radius_y = (diameter * base_type::m_ry) >> 1; - int len_x_lr = - (diameter * base_type::m_rx + image_subpixel_mask) >> - image_subpixel_shift; + int y_lr = y >> image_subpixel_shift; + int y_hr = ((image_subpixel_mask - (y & image_subpixel_mask)) * ry_inv) >> image_subpixel_shift; + int total_weight = 0; + int x_lr = x >> image_subpixel_shift; + int x_hr = ((image_subpixel_mask - (x & image_subpixel_mask)) * rx_inv) >> image_subpixel_shift; + int x_hr2 = x_hr; + const value_type* fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, len_x_lr); - const int16* weight_array = base_type::filter().weight_array(); - - do + for (;;) { - base_type::interpolator().coordinates(&x, &y); - - x += base_type::filter_dx_int() - radius_x; - y += base_type::filter_dy_int() - radius_y; - - fg[0] = fg[1] = fg[2] = fg[3] = image_filter_scale / 2; - - int y_lr = y >> image_subpixel_shift; - int y_hr = ((image_subpixel_mask - (y & image_subpixel_mask)) * - base_type::m_ry_inv) >> - image_subpixel_shift; - int total_weight = 0; - int x_lr = x >> image_subpixel_shift; - int x_hr = ((image_subpixel_mask - (x & image_subpixel_mask)) * - base_type::m_rx_inv) >> - image_subpixel_shift; - - int x_hr2 = x_hr; - const value_type* fg_ptr = - (const value_type*)base_type::source().span(x_lr, y_lr, len_x_lr); - for(;;) + int weight_y = weight_array[y_hr]; + x_hr = x_hr2; + for (;;) { - int weight_y = weight_array[y_hr]; - x_hr = x_hr2; - for(;;) - { - int weight = (weight_y * weight_array[x_hr] + - image_filter_scale / 2) >> - downscale_shift; - - fg[0] += *fg_ptr++ * weight; - fg[1] += *fg_ptr++ * weight; - fg[2] += *fg_ptr++ * weight; - fg[3] += *fg_ptr++ * weight; - total_weight += weight; - x_hr += base_type::m_rx_inv; - if(x_hr >= filter_scale) break; - fg_ptr = (const value_type*)base_type::source().next_x(); - } - y_hr += base_type::m_ry_inv; - if(y_hr >= filter_scale) break; - fg_ptr = (const value_type*)base_type::source().next_y(); + int weight = (weight_y * weight_array[x_hr] + image_filter_scale / 2) >> downscale_shift; + fg[0] += *fg_ptr++ * weight; + fg[1] += *fg_ptr++ * weight; + fg[2] += *fg_ptr++ * weight; + fg[3] += *fg_ptr++ * weight; + total_weight += weight; + x_hr += rx_inv; + if (x_hr >= filter_scale) + break; + fg_ptr = (const value_type*)base_type::source().next_x(); } + y_hr += ry_inv; + if (y_hr >= filter_scale) + break; + fg_ptr = (const value_type*)base_type::source().next_y(); + } - fg[0] /= total_weight; - fg[1] /= total_weight; - fg[2] /= total_weight; - fg[3] /= total_weight; + fg[0] /= total_weight; + fg[1] /= total_weight; + fg[2] /= total_weight; + fg[3] /= total_weight; - if(fg[0] < 0) fg[0] = 0; - if(fg[1] < 0) fg[1] = 0; - if(fg[2] < 0) fg[2] = 0; - if(fg[3] < 0) fg[3] = 0; + if (fg[0] < 0) + fg[0] = 0; + if (fg[1] < 0) + fg[1] = 0; + if (fg[2] < 0) + fg[2] = 0; + if (fg[3] < 0) + fg[3] = 0; - if(fg[order_type::A] > base_mask) fg[order_type::A] = base_mask; - if(fg[order_type::R] > fg[order_type::A]) fg[order_type::R] = fg[order_type::A]; - if(fg[order_type::G] > fg[order_type::A]) fg[order_type::G] = fg[order_type::A]; - if(fg[order_type::B] > fg[order_type::A]) fg[order_type::B] = fg[order_type::A]; + if (fg[order_type::A] > base_mask) + fg[order_type::A] = base_mask; + if (fg[order_type::R] > fg[order_type::A]) + fg[order_type::R] = fg[order_type::A]; + if (fg[order_type::G] > fg[order_type::A]) + fg[order_type::G] = fg[order_type::A]; + if (fg[order_type::B] > fg[order_type::A]) + fg[order_type::B] = fg[order_type::A]; - span->r = (value_type)fg[order_type::R]; - span->g = (value_type)fg[order_type::G]; - span->b = (value_type)fg[order_type::B]; - span->a = (value_type)fg[order_type::A]; + span->r = (value_type)fg[order_type::R]; + span->g = (value_type)fg[order_type::G]; + span->b = (value_type)fg[order_type::B]; + span->a = (value_type)fg[order_type::A]; - ++span; - ++base_type::interpolator(); - } while(--len); - } - }; - - - - //==============================================span_image_resample_rgba - template - class span_image_resample_rgba : - public span_image_resample - { - public: - typedef Source source_type; - typedef typename source_type::color_type color_type; - typedef typename source_type::order_type order_type; - typedef Interpolator interpolator_type; - typedef span_image_resample base_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::long_type long_type; - enum base_scale_e - { - base_shift = color_type::base_shift, - base_mask = color_type::base_mask, - downscale_shift = image_filter_shift - }; - - //-------------------------------------------------------------------- - span_image_resample_rgba() {} - span_image_resample_rgba(source_type& src, - interpolator_type& inter, - const image_filter_lut& filter) : - base_type(src, inter, filter) - {} - - //-------------------------------------------------------------------- - void generate(color_type* span, int x, int y, unsigned len) - { - base_type::interpolator().begin(x + base_type::filter_dx_dbl(), - y + base_type::filter_dy_dbl(), len); - long_type fg[4]; - - int diameter = base_type::filter().diameter(); - int filter_scale = diameter << image_subpixel_shift; - - const int16* weight_array = base_type::filter().weight_array(); - do - { - int rx; - int ry; - int rx_inv = image_subpixel_scale; - int ry_inv = image_subpixel_scale; - base_type::interpolator().coordinates(&x, &y); - base_type::interpolator().local_scale(&rx, &ry); - base_type::adjust_scale(&rx, &ry); - - rx_inv = image_subpixel_scale * image_subpixel_scale / rx; - ry_inv = image_subpixel_scale * image_subpixel_scale / ry; - - int radius_x = (diameter * rx) >> 1; - int radius_y = (diameter * ry) >> 1; - int len_x_lr = - (diameter * rx + image_subpixel_mask) >> - image_subpixel_shift; - - x += base_type::filter_dx_int() - radius_x; - y += base_type::filter_dy_int() - radius_y; - - fg[0] = fg[1] = fg[2] = fg[3] = image_filter_scale / 2; - - int y_lr = y >> image_subpixel_shift; - int y_hr = ((image_subpixel_mask - (y & image_subpixel_mask)) * - ry_inv) >> - image_subpixel_shift; - int total_weight = 0; - int x_lr = x >> image_subpixel_shift; - int x_hr = ((image_subpixel_mask - (x & image_subpixel_mask)) * - rx_inv) >> - image_subpixel_shift; - int x_hr2 = x_hr; - const value_type* fg_ptr = - (const value_type*)base_type::source().span(x_lr, y_lr, len_x_lr); - - for(;;) - { - int weight_y = weight_array[y_hr]; - x_hr = x_hr2; - for(;;) - { - int weight = (weight_y * weight_array[x_hr] + - image_filter_scale / 2) >> - downscale_shift; - fg[0] += *fg_ptr++ * weight; - fg[1] += *fg_ptr++ * weight; - fg[2] += *fg_ptr++ * weight; - fg[3] += *fg_ptr++ * weight; - total_weight += weight; - x_hr += rx_inv; - if(x_hr >= filter_scale) break; - fg_ptr = (const value_type*)base_type::source().next_x(); - } - y_hr += ry_inv; - if(y_hr >= filter_scale) break; - fg_ptr = (const value_type*)base_type::source().next_y(); - } - - fg[0] /= total_weight; - fg[1] /= total_weight; - fg[2] /= total_weight; - fg[3] /= total_weight; - - if(fg[0] < 0) fg[0] = 0; - if(fg[1] < 0) fg[1] = 0; - if(fg[2] < 0) fg[2] = 0; - if(fg[3] < 0) fg[3] = 0; - - if(fg[order_type::A] > base_mask) fg[order_type::A] = base_mask; - if(fg[order_type::R] > fg[order_type::A]) fg[order_type::R] = fg[order_type::A]; - if(fg[order_type::G] > fg[order_type::A]) fg[order_type::G] = fg[order_type::A]; - if(fg[order_type::B] > fg[order_type::A]) fg[order_type::B] = fg[order_type::A]; - - span->r = (value_type)fg[order_type::R]; - span->g = (value_type)fg[order_type::G]; - span->b = (value_type)fg[order_type::B]; - span->a = (value_type)fg[order_type::A]; - - ++span; - ++base_type::interpolator(); - } while(--len); - } - }; - - -} + ++span; + ++base_type::interpolator(); + } while (--len); + } +}; +} // namespace agg #endif - - - diff --git a/deps/agg/include/agg_span_interpolator_adaptor.h b/deps/agg/include/agg_span_interpolator_adaptor.h index 17ea71291..4aa835a94 100644 --- a/deps/agg/include/agg_span_interpolator_adaptor.h +++ b/deps/agg/include/agg_span_interpolator_adaptor.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -18,60 +18,47 @@ #include "agg_basics.h" -namespace agg +namespace agg { + +//===============================================span_interpolator_adaptor +template +class span_interpolator_adaptor : public Interpolator { + public: + typedef Interpolator base_type; + typedef typename base_type::trans_type trans_type; + typedef Distortion distortion_type; - //===============================================span_interpolator_adaptor - template - class span_interpolator_adaptor : public Interpolator + //-------------------------------------------------------------------- + span_interpolator_adaptor() {} + span_interpolator_adaptor(const trans_type& trans, const distortion_type& dist) + : base_type(trans) + , m_distortion(&dist) + {} + + //-------------------------------------------------------------------- + span_interpolator_adaptor(const trans_type& trans, const distortion_type& dist, double x, double y, unsigned len) + : base_type(trans, x, y, len) + , m_distortion(&dist) + {} + + //-------------------------------------------------------------------- + const distortion_type& distortion() const { return *m_distortion; } + + //-------------------------------------------------------------------- + void distortion(const distortion_type& dist) { m_distortion = dist; } + + //-------------------------------------------------------------------- + void coordinates(int* x, int* y) const { - public: - typedef Interpolator base_type; - typedef typename base_type::trans_type trans_type; - typedef Distortion distortion_type; - - //-------------------------------------------------------------------- - span_interpolator_adaptor() {} - span_interpolator_adaptor(const trans_type& trans, - const distortion_type& dist) : - base_type(trans), - m_distortion(&dist) - { - } - - //-------------------------------------------------------------------- - span_interpolator_adaptor(const trans_type& trans, - const distortion_type& dist, - double x, double y, unsigned len) : - base_type(trans, x, y, len), - m_distortion(&dist) - { - } - - //-------------------------------------------------------------------- - const distortion_type& distortion() const - { - return *m_distortion; - } - - //-------------------------------------------------------------------- - void distortion(const distortion_type& dist) - { - m_distortion = dist; - } - - //-------------------------------------------------------------------- - void coordinates(int* x, int* y) const - { - base_type::coordinates(x, y); - m_distortion->calculate(x, y); - } - - private: - //-------------------------------------------------------------------- - const distortion_type* m_distortion; - }; -} + base_type::coordinates(x, y); + m_distortion->calculate(x, y); + } + private: + //-------------------------------------------------------------------- + const distortion_type* m_distortion; +}; +} // namespace agg #endif diff --git a/deps/agg/include/agg_span_interpolator_linear.h b/deps/agg/include/agg_span_interpolator_linear.h index cbf3d1a41..673c03d73 100644 --- a/deps/agg/include/agg_span_interpolator_linear.h +++ b/deps/agg/include/agg_span_interpolator_linear.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -20,213 +20,199 @@ #include "agg_dda_line.h" #include "agg_trans_affine.h" -namespace agg +namespace agg { + +//================================================span_interpolator_linear +template +class span_interpolator_linear { + public: + typedef Transformer trans_type; - //================================================span_interpolator_linear - template - class span_interpolator_linear + enum subpixel_scale_e { subpixel_shift = SubpixelShift, subpixel_scale = 1 << subpixel_shift }; + + //-------------------------------------------------------------------- + span_interpolator_linear() {} + span_interpolator_linear(const trans_type& trans) + : m_trans(&trans) + {} + span_interpolator_linear(const trans_type& trans, double x, double y, unsigned len) + : m_trans(&trans) { - public: - typedef Transformer trans_type; + begin(x, y, len); + } - enum subpixel_scale_e - { - subpixel_shift = SubpixelShift, - subpixel_scale = 1 << subpixel_shift - }; + //---------------------------------------------------------------- + const trans_type& transformer() const { return *m_trans; } + void transformer(const trans_type& trans) { m_trans = &trans; } - //-------------------------------------------------------------------- - span_interpolator_linear() {} - span_interpolator_linear(const trans_type& trans) : m_trans(&trans) {} - span_interpolator_linear(const trans_type& trans, - double x, double y, unsigned len) : - m_trans(&trans) - { - begin(x, y, len); - } - - //---------------------------------------------------------------- - const trans_type& transformer() const { return *m_trans; } - void transformer(const trans_type& trans) { m_trans = &trans; } - - //---------------------------------------------------------------- - void begin(double x, double y, unsigned len) - { - double tx; - double ty; - - tx = x; - ty = y; - m_trans->transform(&tx, &ty); - int x1 = iround(tx * subpixel_scale); - int y1 = iround(ty * subpixel_scale); - - tx = x + len; - ty = y; - m_trans->transform(&tx, &ty); - int x2 = iround(tx * subpixel_scale); - int y2 = iround(ty * subpixel_scale); - - m_li_x = dda2_line_interpolator(x1, x2, len); - m_li_y = dda2_line_interpolator(y1, y2, len); - } - - //---------------------------------------------------------------- - void resynchronize(double xe, double ye, unsigned len) - { - m_trans->transform(&xe, &ye); - m_li_x = dda2_line_interpolator(m_li_x.y(), iround(xe * subpixel_scale), len); - m_li_y = dda2_line_interpolator(m_li_y.y(), iround(ye * subpixel_scale), len); - } - - //---------------------------------------------------------------- - void operator++() - { - ++m_li_x; - ++m_li_y; - } - - //---------------------------------------------------------------- - void coordinates(int* x, int* y) const - { - *x = m_li_x.y(); - *y = m_li_y.y(); - } - - private: - const trans_type* m_trans; - dda2_line_interpolator m_li_x; - dda2_line_interpolator m_li_y; - }; - - - - - - - //=====================================span_interpolator_linear_subdiv - template - class span_interpolator_linear_subdiv + //---------------------------------------------------------------- + void begin(double x, double y, unsigned len) { - public: - typedef Transformer trans_type; + double tx; + double ty; - enum subpixel_scale_e + tx = x; + ty = y; + m_trans->transform(&tx, &ty); + int x1 = iround(tx * subpixel_scale); + int y1 = iround(ty * subpixel_scale); + + tx = x + len; + ty = y; + m_trans->transform(&tx, &ty); + int x2 = iround(tx * subpixel_scale); + int y2 = iround(ty * subpixel_scale); + + m_li_x = dda2_line_interpolator(x1, x2, len); + m_li_y = dda2_line_interpolator(y1, y2, len); + } + + //---------------------------------------------------------------- + void resynchronize(double xe, double ye, unsigned len) + { + m_trans->transform(&xe, &ye); + m_li_x = dda2_line_interpolator(m_li_x.y(), iround(xe * subpixel_scale), len); + m_li_y = dda2_line_interpolator(m_li_y.y(), iround(ye * subpixel_scale), len); + } + + //---------------------------------------------------------------- + void operator++() + { + ++m_li_x; + ++m_li_y; + } + + //---------------------------------------------------------------- + void coordinates(int* x, int* y) const + { + *x = m_li_x.y(); + *y = m_li_y.y(); + } + + private: + const trans_type* m_trans; + dda2_line_interpolator m_li_x; + dda2_line_interpolator m_li_y; +}; + +//=====================================span_interpolator_linear_subdiv +template +class span_interpolator_linear_subdiv +{ + public: + typedef Transformer trans_type; + + enum subpixel_scale_e { subpixel_shift = SubpixelShift, subpixel_scale = 1 << subpixel_shift }; + + //---------------------------------------------------------------- + span_interpolator_linear_subdiv() + : m_subdiv_shift(4) + , m_subdiv_size(1 << m_subdiv_shift) + , m_subdiv_mask(m_subdiv_size - 1) + {} + + span_interpolator_linear_subdiv(const trans_type& trans, unsigned subdiv_shift = 4) + : m_subdiv_shift(subdiv_shift) + , m_subdiv_size(1 << m_subdiv_shift) + , m_subdiv_mask(m_subdiv_size - 1) + , m_trans(&trans) + {} + + span_interpolator_linear_subdiv(const trans_type& trans, + double x, + double y, + unsigned len, + unsigned subdiv_shift = 4) + : m_subdiv_shift(subdiv_shift) + , m_subdiv_size(1 << m_subdiv_shift) + , m_subdiv_mask(m_subdiv_size - 1) + , m_trans(&trans) + { + begin(x, y, len); + } + + //---------------------------------------------------------------- + const trans_type& transformer() const { return *m_trans; } + void transformer(const trans_type& trans) { m_trans = &trans; } + + //---------------------------------------------------------------- + unsigned subdiv_shift() const { return m_subdiv_shift; } + void subdiv_shift(unsigned shift) + { + m_subdiv_shift = shift; + m_subdiv_size = 1 << m_subdiv_shift; + m_subdiv_mask = m_subdiv_size - 1; + } + + //---------------------------------------------------------------- + void begin(double x, double y, unsigned len) + { + double tx; + double ty; + m_pos = 1; + m_src_x = iround(x * subpixel_scale) + subpixel_scale; + m_src_y = y; + m_len = len; + + if (len > m_subdiv_size) + len = m_subdiv_size; + tx = x; + ty = y; + m_trans->transform(&tx, &ty); + int x1 = iround(tx * subpixel_scale); + int y1 = iround(ty * subpixel_scale); + + tx = x + len; + ty = y; + m_trans->transform(&tx, &ty); + + m_li_x = dda2_line_interpolator(x1, iround(tx * subpixel_scale), len); + m_li_y = dda2_line_interpolator(y1, iround(ty * subpixel_scale), len); + } + + //---------------------------------------------------------------- + void operator++() + { + ++m_li_x; + ++m_li_y; + if (m_pos >= m_subdiv_size) { - subpixel_shift = SubpixelShift, - subpixel_scale = 1 << subpixel_shift - }; - - - //---------------------------------------------------------------- - span_interpolator_linear_subdiv() : - m_subdiv_shift(4), - m_subdiv_size(1 << m_subdiv_shift), - m_subdiv_mask(m_subdiv_size - 1) {} - - span_interpolator_linear_subdiv(const trans_type& trans, - unsigned subdiv_shift = 4) : - m_subdiv_shift(subdiv_shift), - m_subdiv_size(1 << m_subdiv_shift), - m_subdiv_mask(m_subdiv_size - 1), - m_trans(&trans) {} - - span_interpolator_linear_subdiv(const trans_type& trans, - double x, double y, unsigned len, - unsigned subdiv_shift = 4) : - m_subdiv_shift(subdiv_shift), - m_subdiv_size(1 << m_subdiv_shift), - m_subdiv_mask(m_subdiv_size - 1), - m_trans(&trans) - { - begin(x, y, len); - } - - //---------------------------------------------------------------- - const trans_type& transformer() const { return *m_trans; } - void transformer(const trans_type& trans) { m_trans = &trans; } - - //---------------------------------------------------------------- - unsigned subdiv_shift() const { return m_subdiv_shift; } - void subdiv_shift(unsigned shift) - { - m_subdiv_shift = shift; - m_subdiv_size = 1 << m_subdiv_shift; - m_subdiv_mask = m_subdiv_size - 1; - } - - //---------------------------------------------------------------- - void begin(double x, double y, unsigned len) - { - double tx; - double ty; - m_pos = 1; - m_src_x = iround(x * subpixel_scale) + subpixel_scale; - m_src_y = y; - m_len = len; - - if(len > m_subdiv_size) len = m_subdiv_size; - tx = x; - ty = y; + unsigned len = m_len; + if (len > m_subdiv_size) + len = m_subdiv_size; + double tx = double(m_src_x) / double(subpixel_scale) + len; + double ty = m_src_y; m_trans->transform(&tx, &ty); - int x1 = iround(tx * subpixel_scale); - int y1 = iround(ty * subpixel_scale); - - tx = x + len; - ty = y; - m_trans->transform(&tx, &ty); - - m_li_x = dda2_line_interpolator(x1, iround(tx * subpixel_scale), len); - m_li_y = dda2_line_interpolator(y1, iround(ty * subpixel_scale), len); + m_li_x = dda2_line_interpolator(m_li_x.y(), iround(tx * subpixel_scale), len); + m_li_y = dda2_line_interpolator(m_li_y.y(), iround(ty * subpixel_scale), len); + m_pos = 0; } + m_src_x += subpixel_scale; + ++m_pos; + --m_len; + } - //---------------------------------------------------------------- - void operator++() - { - ++m_li_x; - ++m_li_y; - if(m_pos >= m_subdiv_size) - { - unsigned len = m_len; - if(len > m_subdiv_size) len = m_subdiv_size; - double tx = double(m_src_x) / double(subpixel_scale) + len; - double ty = m_src_y; - m_trans->transform(&tx, &ty); - m_li_x = dda2_line_interpolator(m_li_x.y(), iround(tx * subpixel_scale), len); - m_li_y = dda2_line_interpolator(m_li_y.y(), iround(ty * subpixel_scale), len); - m_pos = 0; - } - m_src_x += subpixel_scale; - ++m_pos; - --m_len; - } - - //---------------------------------------------------------------- - void coordinates(int* x, int* y) const - { - *x = m_li_x.y(); - *y = m_li_y.y(); - } - - private: - unsigned m_subdiv_shift; - unsigned m_subdiv_size; - unsigned m_subdiv_mask; - const trans_type* m_trans; - dda2_line_interpolator m_li_x; - dda2_line_interpolator m_li_y; - int m_src_x; - double m_src_y; - unsigned m_pos; - unsigned m_len; - }; - - -} + //---------------------------------------------------------------- + void coordinates(int* x, int* y) const + { + *x = m_li_x.y(); + *y = m_li_y.y(); + } + private: + unsigned m_subdiv_shift; + unsigned m_subdiv_size; + unsigned m_subdiv_mask; + const trans_type* m_trans; + dda2_line_interpolator m_li_x; + dda2_line_interpolator m_li_y; + int m_src_x; + double m_src_y; + unsigned m_pos; + unsigned m_len; +}; +} // namespace agg #endif - - diff --git a/deps/agg/include/agg_span_interpolator_persp.h b/deps/agg/include/agg_span_interpolator_persp.h index cad437e04..700a18f0d 100644 --- a/deps/agg/include/agg_span_interpolator_persp.h +++ b/deps/agg/include/agg_span_interpolator_persp.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -18,445 +18,393 @@ #include "agg_trans_perspective.h" #include "agg_dda_line.h" -namespace agg +namespace agg { + +//===========================================span_interpolator_persp_exact +template +class span_interpolator_persp_exact { + public: + typedef trans_perspective trans_type; + typedef trans_perspective::iterator_x iterator_type; + enum subpixel_scale_e { subpixel_shift = SubpixelShift, subpixel_scale = 1 << subpixel_shift }; + //-------------------------------------------------------------------- + span_interpolator_persp_exact() {} + //-------------------------------------------------------------------- + // Arbitrary quadrangle transformations + span_interpolator_persp_exact(const double* src, const double* dst) { quad_to_quad(src, dst); } - //===========================================span_interpolator_persp_exact - template - class span_interpolator_persp_exact + //-------------------------------------------------------------------- + // Direct transformations + span_interpolator_persp_exact(double x1, double y1, double x2, double y2, const double* quad) { - public: - typedef trans_perspective trans_type; - typedef trans_perspective::iterator_x iterator_type; - enum subpixel_scale_e - { - subpixel_shift = SubpixelShift, - subpixel_scale = 1 << subpixel_shift - }; + rect_to_quad(x1, y1, x2, y2, quad); + } - //-------------------------------------------------------------------- - span_interpolator_persp_exact() {} - - //-------------------------------------------------------------------- - // Arbitrary quadrangle transformations - span_interpolator_persp_exact(const double* src, const double* dst) - { - quad_to_quad(src, dst); - } - - //-------------------------------------------------------------------- - // Direct transformations - span_interpolator_persp_exact(double x1, double y1, - double x2, double y2, - const double* quad) - { - rect_to_quad(x1, y1, x2, y2, quad); - } - - //-------------------------------------------------------------------- - // Reverse transformations - span_interpolator_persp_exact(const double* quad, - double x1, double y1, - double x2, double y2) - { - quad_to_rect(quad, x1, y1, x2, y2); - } - - //-------------------------------------------------------------------- - // Set the transformations using two arbitrary quadrangles. - void quad_to_quad(const double* src, const double* dst) - { - m_trans_dir.quad_to_quad(src, dst); - m_trans_inv.quad_to_quad(dst, src); - } - - //-------------------------------------------------------------------- - // Set the direct transformations, i.e., rectangle -> quadrangle - void rect_to_quad(double x1, double y1, double x2, double y2, - const double* quad) - { - double src[8]; - src[0] = src[6] = x1; - src[2] = src[4] = x2; - src[1] = src[3] = y1; - src[5] = src[7] = y2; - quad_to_quad(src, quad); - } - - - //-------------------------------------------------------------------- - // Set the reverse transformations, i.e., quadrangle -> rectangle - void quad_to_rect(const double* quad, - double x1, double y1, double x2, double y2) - { - double dst[8]; - dst[0] = dst[6] = x1; - dst[2] = dst[4] = x2; - dst[1] = dst[3] = y1; - dst[5] = dst[7] = y2; - quad_to_quad(quad, dst); - } - - //-------------------------------------------------------------------- - // Check if the equations were solved successfully - bool is_valid() const { return m_trans_dir.is_valid(); } - - //---------------------------------------------------------------- - void begin(double x, double y, unsigned len) - { - m_iterator = m_trans_dir.begin(x, y, 1.0); - double xt = m_iterator.x; - double yt = m_iterator.y; - - double dx; - double dy; - const double delta = 1/double(subpixel_scale); - dx = xt + delta; - dy = yt; - m_trans_inv.transform(&dx, &dy); - dx -= x; - dy -= y; - int sx1 = uround(subpixel_scale/sqrt(dx*dx + dy*dy)) >> subpixel_shift; - dx = xt; - dy = yt + delta; - m_trans_inv.transform(&dx, &dy); - dx -= x; - dy -= y; - int sy1 = uround(subpixel_scale/sqrt(dx*dx + dy*dy)) >> subpixel_shift; - - x += len; - xt = x; - yt = y; - m_trans_dir.transform(&xt, &yt); - - dx = xt + delta; - dy = yt; - m_trans_inv.transform(&dx, &dy); - dx -= x; - dy -= y; - int sx2 = uround(subpixel_scale/sqrt(dx*dx + dy*dy)) >> subpixel_shift; - dx = xt; - dy = yt + delta; - m_trans_inv.transform(&dx, &dy); - dx -= x; - dy -= y; - int sy2 = uround(subpixel_scale/sqrt(dx*dx + dy*dy)) >> subpixel_shift; - - m_scale_x = dda2_line_interpolator(sx1, sx2, len); - m_scale_y = dda2_line_interpolator(sy1, sy2, len); - } - - - //---------------------------------------------------------------- - void resynchronize(double xe, double ye, unsigned len) - { - // Assume x1,y1 are equal to the ones at the previous end point - int sx1 = m_scale_x.y(); - int sy1 = m_scale_y.y(); - - // Calculate transformed coordinates at x2,y2 - double xt = xe; - double yt = ye; - m_trans_dir.transform(&xt, &yt); - - const double delta = 1/double(subpixel_scale); - double dx; - double dy; - - // Calculate scale by X at x2,y2 - dx = xt + delta; - dy = yt; - m_trans_inv.transform(&dx, &dy); - dx -= xe; - dy -= ye; - int sx2 = uround(subpixel_scale/sqrt(dx*dx + dy*dy)) >> subpixel_shift; - - // Calculate scale by Y at x2,y2 - dx = xt; - dy = yt + delta; - m_trans_inv.transform(&dx, &dy); - dx -= xe; - dy -= ye; - int sy2 = uround(subpixel_scale/sqrt(dx*dx + dy*dy)) >> subpixel_shift; - - // Initialize the interpolators - m_scale_x = dda2_line_interpolator(sx1, sx2, len); - m_scale_y = dda2_line_interpolator(sy1, sy2, len); - } - - - - //---------------------------------------------------------------- - void operator++() - { - ++m_iterator; - ++m_scale_x; - ++m_scale_y; - } - - //---------------------------------------------------------------- - void coordinates(int* x, int* y) const - { - *x = iround(m_iterator.x * subpixel_scale); - *y = iround(m_iterator.y * subpixel_scale); - } - - //---------------------------------------------------------------- - void local_scale(int* x, int* y) - { - *x = m_scale_x.y(); - *y = m_scale_y.y(); - } - - //---------------------------------------------------------------- - void transform(double* x, double* y) const - { - m_trans_dir.transform(x, y); - } - - private: - trans_type m_trans_dir; - trans_type m_trans_inv; - iterator_type m_iterator; - dda2_line_interpolator m_scale_x; - dda2_line_interpolator m_scale_y; - }; - - - - - - - - - - - - //============================================span_interpolator_persp_lerp - template - class span_interpolator_persp_lerp + //-------------------------------------------------------------------- + // Reverse transformations + span_interpolator_persp_exact(const double* quad, double x1, double y1, double x2, double y2) { - public: - typedef trans_perspective trans_type; - enum subpixel_scale_e - { - subpixel_shift = SubpixelShift, - subpixel_scale = 1 << subpixel_shift - }; + quad_to_rect(quad, x1, y1, x2, y2); + } - //-------------------------------------------------------------------- - span_interpolator_persp_lerp() {} + //-------------------------------------------------------------------- + // Set the transformations using two arbitrary quadrangles. + void quad_to_quad(const double* src, const double* dst) + { + m_trans_dir.quad_to_quad(src, dst); + m_trans_inv.quad_to_quad(dst, src); + } - //-------------------------------------------------------------------- - // Arbitrary quadrangle transformations - span_interpolator_persp_lerp(const double* src, const double* dst) - { - quad_to_quad(src, dst); - } + //-------------------------------------------------------------------- + // Set the direct transformations, i.e., rectangle -> quadrangle + void rect_to_quad(double x1, double y1, double x2, double y2, const double* quad) + { + double src[8]; + src[0] = src[6] = x1; + src[2] = src[4] = x2; + src[1] = src[3] = y1; + src[5] = src[7] = y2; + quad_to_quad(src, quad); + } - //-------------------------------------------------------------------- - // Direct transformations - span_interpolator_persp_lerp(double x1, double y1, - double x2, double y2, - const double* quad) - { - rect_to_quad(x1, y1, x2, y2, quad); - } + //-------------------------------------------------------------------- + // Set the reverse transformations, i.e., quadrangle -> rectangle + void quad_to_rect(const double* quad, double x1, double y1, double x2, double y2) + { + double dst[8]; + dst[0] = dst[6] = x1; + dst[2] = dst[4] = x2; + dst[1] = dst[3] = y1; + dst[5] = dst[7] = y2; + quad_to_quad(quad, dst); + } - //-------------------------------------------------------------------- - // Reverse transformations - span_interpolator_persp_lerp(const double* quad, - double x1, double y1, - double x2, double y2) - { - quad_to_rect(quad, x1, y1, x2, y2); - } + //-------------------------------------------------------------------- + // Check if the equations were solved successfully + bool is_valid() const { return m_trans_dir.is_valid(); } - //-------------------------------------------------------------------- - // Set the transformations using two arbitrary quadrangles. - void quad_to_quad(const double* src, const double* dst) - { - m_trans_dir.quad_to_quad(src, dst); - m_trans_inv.quad_to_quad(dst, src); - } + //---------------------------------------------------------------- + void begin(double x, double y, unsigned len) + { + m_iterator = m_trans_dir.begin(x, y, 1.0); + double xt = m_iterator.x; + double yt = m_iterator.y; - //-------------------------------------------------------------------- - // Set the direct transformations, i.e., rectangle -> quadrangle - void rect_to_quad(double x1, double y1, double x2, double y2, - const double* quad) - { - double src[8]; - src[0] = src[6] = x1; - src[2] = src[4] = x2; - src[1] = src[3] = y1; - src[5] = src[7] = y2; - quad_to_quad(src, quad); - } + double dx; + double dy; + const double delta = 1 / double(subpixel_scale); + dx = xt + delta; + dy = yt; + m_trans_inv.transform(&dx, &dy); + dx -= x; + dy -= y; + int sx1 = uround(subpixel_scale / sqrt(dx * dx + dy * dy)) >> subpixel_shift; + dx = xt; + dy = yt + delta; + m_trans_inv.transform(&dx, &dy); + dx -= x; + dy -= y; + int sy1 = uround(subpixel_scale / sqrt(dx * dx + dy * dy)) >> subpixel_shift; + x += len; + xt = x; + yt = y; + m_trans_dir.transform(&xt, &yt); - //-------------------------------------------------------------------- - // Set the reverse transformations, i.e., quadrangle -> rectangle - void quad_to_rect(const double* quad, - double x1, double y1, double x2, double y2) - { - double dst[8]; - dst[0] = dst[6] = x1; - dst[2] = dst[4] = x2; - dst[1] = dst[3] = y1; - dst[5] = dst[7] = y2; - quad_to_quad(quad, dst); - } + dx = xt + delta; + dy = yt; + m_trans_inv.transform(&dx, &dy); + dx -= x; + dy -= y; + int sx2 = uround(subpixel_scale / sqrt(dx * dx + dy * dy)) >> subpixel_shift; + dx = xt; + dy = yt + delta; + m_trans_inv.transform(&dx, &dy); + dx -= x; + dy -= y; + int sy2 = uround(subpixel_scale / sqrt(dx * dx + dy * dy)) >> subpixel_shift; - //-------------------------------------------------------------------- - // Check if the equations were solved successfully - bool is_valid() const { return m_trans_dir.is_valid(); } + m_scale_x = dda2_line_interpolator(sx1, sx2, len); + m_scale_y = dda2_line_interpolator(sy1, sy2, len); + } - //---------------------------------------------------------------- - void begin(double x, double y, unsigned len) - { - // Calculate transformed coordinates at x1,y1 - double xt = x; - double yt = y; - m_trans_dir.transform(&xt, &yt); - int x1 = iround(xt * subpixel_scale); - int y1 = iround(yt * subpixel_scale); + //---------------------------------------------------------------- + void resynchronize(double xe, double ye, unsigned len) + { + // Assume x1,y1 are equal to the ones at the previous end point + int sx1 = m_scale_x.y(); + int sy1 = m_scale_y.y(); - double dx; - double dy; - const double delta = 1/double(subpixel_scale); + // Calculate transformed coordinates at x2,y2 + double xt = xe; + double yt = ye; + m_trans_dir.transform(&xt, &yt); - // Calculate scale by X at x1,y1 - dx = xt + delta; - dy = yt; - m_trans_inv.transform(&dx, &dy); - dx -= x; - dy -= y; - int sx1 = uround(subpixel_scale/sqrt(dx*dx + dy*dy)) >> subpixel_shift; + const double delta = 1 / double(subpixel_scale); + double dx; + double dy; - // Calculate scale by Y at x1,y1 - dx = xt; - dy = yt + delta; - m_trans_inv.transform(&dx, &dy); - dx -= x; - dy -= y; - int sy1 = uround(subpixel_scale/sqrt(dx*dx + dy*dy)) >> subpixel_shift; + // Calculate scale by X at x2,y2 + dx = xt + delta; + dy = yt; + m_trans_inv.transform(&dx, &dy); + dx -= xe; + dy -= ye; + int sx2 = uround(subpixel_scale / sqrt(dx * dx + dy * dy)) >> subpixel_shift; - // Calculate transformed coordinates at x2,y2 - x += len; - xt = x; - yt = y; - m_trans_dir.transform(&xt, &yt); - int x2 = iround(xt * subpixel_scale); - int y2 = iround(yt * subpixel_scale); + // Calculate scale by Y at x2,y2 + dx = xt; + dy = yt + delta; + m_trans_inv.transform(&dx, &dy); + dx -= xe; + dy -= ye; + int sy2 = uround(subpixel_scale / sqrt(dx * dx + dy * dy)) >> subpixel_shift; - // Calculate scale by X at x2,y2 - dx = xt + delta; - dy = yt; - m_trans_inv.transform(&dx, &dy); - dx -= x; - dy -= y; - int sx2 = uround(subpixel_scale/sqrt(dx*dx + dy*dy)) >> subpixel_shift; + // Initialize the interpolators + m_scale_x = dda2_line_interpolator(sx1, sx2, len); + m_scale_y = dda2_line_interpolator(sy1, sy2, len); + } - // Calculate scale by Y at x2,y2 - dx = xt; - dy = yt + delta; - m_trans_inv.transform(&dx, &dy); - dx -= x; - dy -= y; - int sy2 = uround(subpixel_scale/sqrt(dx*dx + dy*dy)) >> subpixel_shift; + //---------------------------------------------------------------- + void operator++() + { + ++m_iterator; + ++m_scale_x; + ++m_scale_y; + } - // Initialize the interpolators - m_coord_x = dda2_line_interpolator(x1, x2, len); - m_coord_y = dda2_line_interpolator(y1, y2, len); - m_scale_x = dda2_line_interpolator(sx1, sx2, len); - m_scale_y = dda2_line_interpolator(sy1, sy2, len); - } + //---------------------------------------------------------------- + void coordinates(int* x, int* y) const + { + *x = iround(m_iterator.x * subpixel_scale); + *y = iround(m_iterator.y * subpixel_scale); + } + //---------------------------------------------------------------- + void local_scale(int* x, int* y) + { + *x = m_scale_x.y(); + *y = m_scale_y.y(); + } - //---------------------------------------------------------------- - void resynchronize(double xe, double ye, unsigned len) - { - // Assume x1,y1 are equal to the ones at the previous end point - int x1 = m_coord_x.y(); - int y1 = m_coord_y.y(); - int sx1 = m_scale_x.y(); - int sy1 = m_scale_y.y(); + //---------------------------------------------------------------- + void transform(double* x, double* y) const { m_trans_dir.transform(x, y); } - // Calculate transformed coordinates at x2,y2 - double xt = xe; - double yt = ye; - m_trans_dir.transform(&xt, &yt); - int x2 = iround(xt * subpixel_scale); - int y2 = iround(yt * subpixel_scale); + private: + trans_type m_trans_dir; + trans_type m_trans_inv; + iterator_type m_iterator; + dda2_line_interpolator m_scale_x; + dda2_line_interpolator m_scale_y; +}; - const double delta = 1/double(subpixel_scale); - double dx; - double dy; +//============================================span_interpolator_persp_lerp +template +class span_interpolator_persp_lerp +{ + public: + typedef trans_perspective trans_type; + enum subpixel_scale_e { subpixel_shift = SubpixelShift, subpixel_scale = 1 << subpixel_shift }; - // Calculate scale by X at x2,y2 - dx = xt + delta; - dy = yt; - m_trans_inv.transform(&dx, &dy); - dx -= xe; - dy -= ye; - int sx2 = uround(subpixel_scale/sqrt(dx*dx + dy*dy)) >> subpixel_shift; + //-------------------------------------------------------------------- + span_interpolator_persp_lerp() {} - // Calculate scale by Y at x2,y2 - dx = xt; - dy = yt + delta; - m_trans_inv.transform(&dx, &dy); - dx -= xe; - dy -= ye; - int sy2 = uround(subpixel_scale/sqrt(dx*dx + dy*dy)) >> subpixel_shift; + //-------------------------------------------------------------------- + // Arbitrary quadrangle transformations + span_interpolator_persp_lerp(const double* src, const double* dst) { quad_to_quad(src, dst); } - // Initialize the interpolators - m_coord_x = dda2_line_interpolator(x1, x2, len); - m_coord_y = dda2_line_interpolator(y1, y2, len); - m_scale_x = dda2_line_interpolator(sx1, sx2, len); - m_scale_y = dda2_line_interpolator(sy1, sy2, len); - } + //-------------------------------------------------------------------- + // Direct transformations + span_interpolator_persp_lerp(double x1, double y1, double x2, double y2, const double* quad) + { + rect_to_quad(x1, y1, x2, y2, quad); + } + //-------------------------------------------------------------------- + // Reverse transformations + span_interpolator_persp_lerp(const double* quad, double x1, double y1, double x2, double y2) + { + quad_to_rect(quad, x1, y1, x2, y2); + } - //---------------------------------------------------------------- - void operator++() - { - ++m_coord_x; - ++m_coord_y; - ++m_scale_x; - ++m_scale_y; - } + //-------------------------------------------------------------------- + // Set the transformations using two arbitrary quadrangles. + void quad_to_quad(const double* src, const double* dst) + { + m_trans_dir.quad_to_quad(src, dst); + m_trans_inv.quad_to_quad(dst, src); + } - //---------------------------------------------------------------- - void coordinates(int* x, int* y) const - { - *x = m_coord_x.y(); - *y = m_coord_y.y(); - } + //-------------------------------------------------------------------- + // Set the direct transformations, i.e., rectangle -> quadrangle + void rect_to_quad(double x1, double y1, double x2, double y2, const double* quad) + { + double src[8]; + src[0] = src[6] = x1; + src[2] = src[4] = x2; + src[1] = src[3] = y1; + src[5] = src[7] = y2; + quad_to_quad(src, quad); + } - //---------------------------------------------------------------- - void local_scale(int* x, int* y) - { - *x = m_scale_x.y(); - *y = m_scale_y.y(); - } + //-------------------------------------------------------------------- + // Set the reverse transformations, i.e., quadrangle -> rectangle + void quad_to_rect(const double* quad, double x1, double y1, double x2, double y2) + { + double dst[8]; + dst[0] = dst[6] = x1; + dst[2] = dst[4] = x2; + dst[1] = dst[3] = y1; + dst[5] = dst[7] = y2; + quad_to_quad(quad, dst); + } - //---------------------------------------------------------------- - void transform(double* x, double* y) const - { - m_trans_dir.transform(x, y); - } - - private: - trans_type m_trans_dir; - trans_type m_trans_inv; - dda2_line_interpolator m_coord_x; - dda2_line_interpolator m_coord_y; - dda2_line_interpolator m_scale_x; - dda2_line_interpolator m_scale_y; - }; + //-------------------------------------------------------------------- + // Check if the equations were solved successfully + bool is_valid() const { return m_trans_dir.is_valid(); } -} + //---------------------------------------------------------------- + void begin(double x, double y, unsigned len) + { + // Calculate transformed coordinates at x1,y1 + double xt = x; + double yt = y; + m_trans_dir.transform(&xt, &yt); + int x1 = iround(xt * subpixel_scale); + int y1 = iround(yt * subpixel_scale); + + double dx; + double dy; + const double delta = 1 / double(subpixel_scale); + + // Calculate scale by X at x1,y1 + dx = xt + delta; + dy = yt; + m_trans_inv.transform(&dx, &dy); + dx -= x; + dy -= y; + int sx1 = uround(subpixel_scale / sqrt(dx * dx + dy * dy)) >> subpixel_shift; + + // Calculate scale by Y at x1,y1 + dx = xt; + dy = yt + delta; + m_trans_inv.transform(&dx, &dy); + dx -= x; + dy -= y; + int sy1 = uround(subpixel_scale / sqrt(dx * dx + dy * dy)) >> subpixel_shift; + + // Calculate transformed coordinates at x2,y2 + x += len; + xt = x; + yt = y; + m_trans_dir.transform(&xt, &yt); + int x2 = iround(xt * subpixel_scale); + int y2 = iround(yt * subpixel_scale); + + // Calculate scale by X at x2,y2 + dx = xt + delta; + dy = yt; + m_trans_inv.transform(&dx, &dy); + dx -= x; + dy -= y; + int sx2 = uround(subpixel_scale / sqrt(dx * dx + dy * dy)) >> subpixel_shift; + + // Calculate scale by Y at x2,y2 + dx = xt; + dy = yt + delta; + m_trans_inv.transform(&dx, &dy); + dx -= x; + dy -= y; + int sy2 = uround(subpixel_scale / sqrt(dx * dx + dy * dy)) >> subpixel_shift; + + // Initialize the interpolators + m_coord_x = dda2_line_interpolator(x1, x2, len); + m_coord_y = dda2_line_interpolator(y1, y2, len); + m_scale_x = dda2_line_interpolator(sx1, sx2, len); + m_scale_y = dda2_line_interpolator(sy1, sy2, len); + } + + //---------------------------------------------------------------- + void resynchronize(double xe, double ye, unsigned len) + { + // Assume x1,y1 are equal to the ones at the previous end point + int x1 = m_coord_x.y(); + int y1 = m_coord_y.y(); + int sx1 = m_scale_x.y(); + int sy1 = m_scale_y.y(); + + // Calculate transformed coordinates at x2,y2 + double xt = xe; + double yt = ye; + m_trans_dir.transform(&xt, &yt); + int x2 = iround(xt * subpixel_scale); + int y2 = iround(yt * subpixel_scale); + + const double delta = 1 / double(subpixel_scale); + double dx; + double dy; + + // Calculate scale by X at x2,y2 + dx = xt + delta; + dy = yt; + m_trans_inv.transform(&dx, &dy); + dx -= xe; + dy -= ye; + int sx2 = uround(subpixel_scale / sqrt(dx * dx + dy * dy)) >> subpixel_shift; + + // Calculate scale by Y at x2,y2 + dx = xt; + dy = yt + delta; + m_trans_inv.transform(&dx, &dy); + dx -= xe; + dy -= ye; + int sy2 = uround(subpixel_scale / sqrt(dx * dx + dy * dy)) >> subpixel_shift; + + // Initialize the interpolators + m_coord_x = dda2_line_interpolator(x1, x2, len); + m_coord_y = dda2_line_interpolator(y1, y2, len); + m_scale_x = dda2_line_interpolator(sx1, sx2, len); + m_scale_y = dda2_line_interpolator(sy1, sy2, len); + } + + //---------------------------------------------------------------- + void operator++() + { + ++m_coord_x; + ++m_coord_y; + ++m_scale_x; + ++m_scale_y; + } + + //---------------------------------------------------------------- + void coordinates(int* x, int* y) const + { + *x = m_coord_x.y(); + *y = m_coord_y.y(); + } + + //---------------------------------------------------------------- + void local_scale(int* x, int* y) + { + *x = m_scale_x.y(); + *y = m_scale_y.y(); + } + + //---------------------------------------------------------------- + void transform(double* x, double* y) const { m_trans_dir.transform(x, y); } + + private: + trans_type m_trans_dir; + trans_type m_trans_inv; + dda2_line_interpolator m_coord_x; + dda2_line_interpolator m_coord_y; + dda2_line_interpolator m_scale_x; + dda2_line_interpolator m_scale_y; +}; + +} // namespace agg #endif diff --git a/deps/agg/include/agg_span_interpolator_trans.h b/deps/agg/include/agg_span_interpolator_trans.h index 7c474742f..abdeaa499 100644 --- a/deps/agg/include/agg_span_interpolator_trans.h +++ b/deps/agg/include/agg_span_interpolator_trans.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -23,70 +23,66 @@ #include "agg_basics.h" -namespace agg +namespace agg { +//=================================================span_interpolator_trans +template +class span_interpolator_trans { - //=================================================span_interpolator_trans - template - class span_interpolator_trans + public: + typedef Transformer trans_type; + enum subpixel_scale_e { subpixel_shift = SubpixelShift, subpixel_scale = 1 << subpixel_shift }; + + //-------------------------------------------------------------------- + span_interpolator_trans() {} + span_interpolator_trans(const trans_type& trans) + : m_trans(&trans) + {} + span_interpolator_trans(const trans_type& trans, double x, double y, unsigned) + : m_trans(&trans) { - public: - typedef Transformer trans_type; - enum subpixel_scale_e - { - subpixel_shift = SubpixelShift, - subpixel_scale = 1 << subpixel_shift - }; + begin(x, y, 0); + } - //-------------------------------------------------------------------- - span_interpolator_trans() {} - span_interpolator_trans(const trans_type& trans) : m_trans(&trans) {} - span_interpolator_trans(const trans_type& trans, - double x, double y, unsigned) : - m_trans(&trans) - { - begin(x, y, 0); - } + //---------------------------------------------------------------- + const trans_type& transformer() const { return *m_trans; } + void transformer(const trans_type& trans) { m_trans = &trans; } - //---------------------------------------------------------------- - const trans_type& transformer() const { return *m_trans; } - void transformer(const trans_type& trans) { m_trans = &trans; } + //---------------------------------------------------------------- + void begin(double x, double y, unsigned) + { + m_x = x; + m_y = y; + m_trans->transform(&x, &y); + m_ix = iround(x * subpixel_scale); + m_iy = iround(y * subpixel_scale); + } - //---------------------------------------------------------------- - void begin(double x, double y, unsigned) - { - m_x = x; - m_y = y; - m_trans->transform(&x, &y); - m_ix = iround(x * subpixel_scale); - m_iy = iround(y * subpixel_scale); - } + //---------------------------------------------------------------- + void operator++() + { + m_x += 1.0; + double x = m_x; + double y = m_y; + m_trans->transform(&x, &y); + m_ix = iround(x * subpixel_scale); + m_iy = iround(y * subpixel_scale); + } - //---------------------------------------------------------------- - void operator++() - { - m_x += 1.0; - double x = m_x; - double y = m_y; - m_trans->transform(&x, &y); - m_ix = iround(x * subpixel_scale); - m_iy = iround(y * subpixel_scale); - } + //---------------------------------------------------------------- + void coordinates(int* x, int* y) const + { + *x = m_ix; + *y = m_iy; + } - //---------------------------------------------------------------- - void coordinates(int* x, int* y) const - { - *x = m_ix; - *y = m_iy; - } + private: + const trans_type* m_trans; + double m_x; + double m_y; + int m_ix; + int m_iy; +}; - private: - const trans_type* m_trans; - double m_x; - double m_y; - int m_ix; - int m_iy; - }; - -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_span_pattern_gray.h b/deps/agg/include/agg_span_pattern_gray.h index ae1a49f87..49ec3def4 100644 --- a/deps/agg/include/agg_span_pattern_gray.h +++ b/deps/agg/include/agg_span_pattern_gray.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -13,81 +13,76 @@ // http://www.antigrain.com //---------------------------------------------------------------------------- // -// Adaptation for high precision colors has been sponsored by +// Adaptation for high precision colors has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. -// +// //---------------------------------------------------------------------------- - #ifndef AGG_SPAN_PATTERN_GRAY_INCLUDED #define AGG_SPAN_PATTERN_GRAY_INCLUDED #include "agg_basics.h" -namespace agg +namespace agg { + +//=======================================================span_pattern_gray +template +class span_pattern_gray { + public: + typedef Source source_type; + typedef typename source_type::color_type color_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; - //=======================================================span_pattern_gray - template class span_pattern_gray + //-------------------------------------------------------------------- + span_pattern_gray() {} + span_pattern_gray(source_type& src, unsigned offset_x, unsigned offset_y) + : m_src(&src) + , m_offset_x(offset_x) + , m_offset_y(offset_y) + , m_alpha(color_type::base_mask) + {} + + //-------------------------------------------------------------------- + void attach(source_type& v) { m_src = &v; } + source_type& source() { return *m_src; } + const source_type& source() const { return *m_src; } + + //-------------------------------------------------------------------- + void offset_x(unsigned v) { m_offset_x = v; } + void offset_y(unsigned v) { m_offset_y = v; } + unsigned offset_x() const { return m_offset_x; } + unsigned offset_y() const { return m_offset_y; } + void alpha(value_type v) { m_alpha = v; } + value_type alpha() const { return m_alpha; } + + //-------------------------------------------------------------------- + void prepare() {} + void generate(color_type* span, int x, int y, unsigned len) { - public: - typedef Source source_type; - typedef typename source_type::color_type color_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; + x += m_offset_x; + y += m_offset_y; + const value_type* p = (const value_type*)m_src->span(x, y, len); + do + { + span->v = *p; + span->a = m_alpha; + p = m_src->next_x(); + ++span; + } while (--len); + } - //-------------------------------------------------------------------- - span_pattern_gray() {} - span_pattern_gray(source_type& src, - unsigned offset_x, unsigned offset_y) : - m_src(&src), - m_offset_x(offset_x), - m_offset_y(offset_y), - m_alpha(color_type::base_mask) - {} + private: + source_type* m_src; + unsigned m_offset_x; + unsigned m_offset_y; + value_type m_alpha; +}; - //-------------------------------------------------------------------- - void attach(source_type& v) { m_src = &v; } - source_type& source() { return *m_src; } - const source_type& source() const { return *m_src; } - - //-------------------------------------------------------------------- - void offset_x(unsigned v) { m_offset_x = v; } - void offset_y(unsigned v) { m_offset_y = v; } - unsigned offset_x() const { return m_offset_x; } - unsigned offset_y() const { return m_offset_y; } - void alpha(value_type v) { m_alpha = v; } - value_type alpha() const { return m_alpha; } - - //-------------------------------------------------------------------- - void prepare() {} - void generate(color_type* span, int x, int y, unsigned len) - { - x += m_offset_x; - y += m_offset_y; - const value_type* p = (const value_type*)m_src->span(x, y, len); - do - { - span->v = *p; - span->a = m_alpha; - p = m_src->next_x(); - ++span; - } - while(--len); - } - - private: - source_type* m_src; - unsigned m_offset_x; - unsigned m_offset_y; - value_type m_alpha; - - }; - -} +} // namespace agg #endif - diff --git a/deps/agg/include/agg_span_pattern_rgb.h b/deps/agg/include/agg_span_pattern_rgb.h index 4850508af..8436013e0 100644 --- a/deps/agg/include/agg_span_pattern_rgb.h +++ b/deps/agg/include/agg_span_pattern_rgb.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -13,84 +13,79 @@ // http://www.antigrain.com //---------------------------------------------------------------------------- // -// Adaptation for high precision colors has been sponsored by +// Adaptation for high precision colors has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. -// +// //---------------------------------------------------------------------------- - #ifndef AGG_SPAN_PATTERN_RGB_INCLUDED #define AGG_SPAN_PATTERN_RGB_INCLUDED #include "agg_basics.h" -namespace agg +namespace agg { + +//========================================================span_pattern_rgb +template +class span_pattern_rgb { + public: + typedef Source source_type; + typedef typename source_type::color_type color_type; + typedef typename source_type::order_type order_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; - //========================================================span_pattern_rgb - template class span_pattern_rgb + //-------------------------------------------------------------------- + span_pattern_rgb() {} + span_pattern_rgb(source_type& src, unsigned offset_x, unsigned offset_y) + : m_src(&src) + , m_offset_x(offset_x) + , m_offset_y(offset_y) + , m_alpha(color_type::base_mask) + {} + + //-------------------------------------------------------------------- + void attach(source_type& v) { m_src = &v; } + source_type& source() { return *m_src; } + const source_type& source() const { return *m_src; } + + //-------------------------------------------------------------------- + void offset_x(unsigned v) { m_offset_x = v; } + void offset_y(unsigned v) { m_offset_y = v; } + unsigned offset_x() const { return m_offset_x; } + unsigned offset_y() const { return m_offset_y; } + void alpha(value_type v) { m_alpha = v; } + value_type alpha() const { return m_alpha; } + + //-------------------------------------------------------------------- + void prepare() {} + void generate(color_type* span, int x, int y, unsigned len) { - public: - typedef Source source_type; - typedef typename source_type::color_type color_type; - typedef typename source_type::order_type order_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; + x += m_offset_x; + y += m_offset_y; + const value_type* p = (const value_type*)m_src->span(x, y, len); + do + { + span->r = p[order_type::R]; + span->g = p[order_type::G]; + span->b = p[order_type::B]; + span->a = m_alpha; + p = m_src->next_x(); + ++span; + } while (--len); + } - //-------------------------------------------------------------------- - span_pattern_rgb() {} - span_pattern_rgb(source_type& src, - unsigned offset_x, unsigned offset_y) : - m_src(&src), - m_offset_x(offset_x), - m_offset_y(offset_y), - m_alpha(color_type::base_mask) - {} + private: + source_type* m_src; + unsigned m_offset_x; + unsigned m_offset_y; + value_type m_alpha; +}; - //-------------------------------------------------------------------- - void attach(source_type& v) { m_src = &v; } - source_type& source() { return *m_src; } - const source_type& source() const { return *m_src; } - - //-------------------------------------------------------------------- - void offset_x(unsigned v) { m_offset_x = v; } - void offset_y(unsigned v) { m_offset_y = v; } - unsigned offset_x() const { return m_offset_x; } - unsigned offset_y() const { return m_offset_y; } - void alpha(value_type v) { m_alpha = v; } - value_type alpha() const { return m_alpha; } - - //-------------------------------------------------------------------- - void prepare() {} - void generate(color_type* span, int x, int y, unsigned len) - { - x += m_offset_x; - y += m_offset_y; - const value_type* p = (const value_type*)m_src->span(x, y, len); - do - { - span->r = p[order_type::R]; - span->g = p[order_type::G]; - span->b = p[order_type::B]; - span->a = m_alpha; - p = m_src->next_x(); - ++span; - } - while(--len); - } - - private: - source_type* m_src; - unsigned m_offset_x; - unsigned m_offset_y; - value_type m_alpha; - - }; - -} +} // namespace agg #endif - diff --git a/deps/agg/include/agg_span_pattern_rgba.h b/deps/agg/include/agg_span_pattern_rgba.h index d47d2a6c0..b1db08976 100644 --- a/deps/agg/include/agg_span_pattern_rgba.h +++ b/deps/agg/include/agg_span_pattern_rgba.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -13,82 +13,77 @@ // http://www.antigrain.com //---------------------------------------------------------------------------- // -// Adaptation for high precision colors has been sponsored by +// Adaptation for high precision colors has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. -// +// //---------------------------------------------------------------------------- - #ifndef AGG_SPAN_PATTERN_RGBA_INCLUDED #define AGG_SPAN_PATTERN_RGBA_INCLUDED #include "agg_basics.h" -namespace agg +namespace agg { + +//======================================================span_pattern_rgba +template +class span_pattern_rgba { + public: + typedef Source source_type; + typedef typename source_type::color_type color_type; + typedef typename source_type::order_type order_type; + typedef typename color_type::value_type value_type; + typedef typename color_type::calc_type calc_type; - //======================================================span_pattern_rgba - template class span_pattern_rgba + //-------------------------------------------------------------------- + span_pattern_rgba() {} + span_pattern_rgba(source_type& src, unsigned offset_x, unsigned offset_y) + : m_src(&src) + , m_offset_x(offset_x) + , m_offset_y(offset_y) + {} + + //-------------------------------------------------------------------- + void attach(source_type& v) { m_src = &v; } + source_type& source() { return *m_src; } + const source_type& source() const { return *m_src; } + + //-------------------------------------------------------------------- + void offset_x(unsigned v) { m_offset_x = v; } + void offset_y(unsigned v) { m_offset_y = v; } + unsigned offset_x() const { return m_offset_x; } + unsigned offset_y() const { return m_offset_y; } + void alpha(value_type) {} + value_type alpha() const { return 0; } + + //-------------------------------------------------------------------- + void prepare() {} + void generate(color_type* span, int x, int y, unsigned len) { - public: - typedef Source source_type; - typedef typename source_type::color_type color_type; - typedef typename source_type::order_type order_type; - typedef typename color_type::value_type value_type; - typedef typename color_type::calc_type calc_type; + x += m_offset_x; + y += m_offset_y; + const value_type* p = (const value_type*)m_src->span(x, y, len); + do + { + span->r = p[order_type::R]; + span->g = p[order_type::G]; + span->b = p[order_type::B]; + span->a = p[order_type::A]; + p = (const value_type*)m_src->next_x(); + ++span; + } while (--len); + } - //-------------------------------------------------------------------- - span_pattern_rgba() {} - span_pattern_rgba(source_type& src, - unsigned offset_x, unsigned offset_y) : - m_src(&src), - m_offset_x(offset_x), - m_offset_y(offset_y) - {} + private: + source_type* m_src; + unsigned m_offset_x; + unsigned m_offset_y; +}; - //-------------------------------------------------------------------- - void attach(source_type& v) { m_src = &v; } - source_type& source() { return *m_src; } - const source_type& source() const { return *m_src; } - - //-------------------------------------------------------------------- - void offset_x(unsigned v) { m_offset_x = v; } - void offset_y(unsigned v) { m_offset_y = v; } - unsigned offset_x() const { return m_offset_x; } - unsigned offset_y() const { return m_offset_y; } - void alpha(value_type) {} - value_type alpha() const { return 0; } - - //-------------------------------------------------------------------- - void prepare() {} - void generate(color_type* span, int x, int y, unsigned len) - { - x += m_offset_x; - y += m_offset_y; - const value_type* p = (const value_type*)m_src->span(x, y, len); - do - { - span->r = p[order_type::R]; - span->g = p[order_type::G]; - span->b = p[order_type::B]; - span->a = p[order_type::A]; - p = (const value_type*)m_src->next_x(); - ++span; - } - while(--len); - } - - private: - source_type* m_src; - unsigned m_offset_x; - unsigned m_offset_y; - - }; - -} +} // namespace agg #endif - diff --git a/deps/agg/include/agg_span_solid.h b/deps/agg/include/agg_span_solid.h index ee46df999..f1a582a2b 100644 --- a/deps/agg/include/agg_span_solid.h +++ b/deps/agg/include/agg_span_solid.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -22,32 +22,34 @@ #include "agg_basics.h" -namespace agg +namespace agg { +//--------------------------------------------------------------span_solid +template +class span_solid { - //--------------------------------------------------------------span_solid - template class span_solid + public: + typedef ColorT color_type; + + //-------------------------------------------------------------------- + void color(const color_type& c) { m_color = c; } + const color_type& color() const { return m_color; } + + //-------------------------------------------------------------------- + void prepare() {} + + //-------------------------------------------------------------------- + void generate(color_type* span, int x, int y, unsigned len) { - public: - typedef ColorT color_type; + do + { + *span++ = m_color; + } while (--len); + } - //-------------------------------------------------------------------- - void color(const color_type& c) { m_color = c; } - const color_type& color() const { return m_color; } + private: + color_type m_color; +}; - //-------------------------------------------------------------------- - void prepare() {} - - //-------------------------------------------------------------------- - void generate(color_type* span, int x, int y, unsigned len) - { - do { *span++ = m_color; } while(--len); - } - - private: - color_type m_color; - }; - - -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_span_subdiv_adaptor.h b/deps/agg/include/agg_span_subdiv_adaptor.h index b5b855ec9..5c7b3d0ef 100644 --- a/deps/agg/include/agg_span_subdiv_adaptor.h +++ b/deps/agg/include/agg_span_subdiv_adaptor.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -17,125 +17,104 @@ #include "agg_basics.h" -namespace agg +namespace agg { + +//=================================================span_subdiv_adaptor +template +class span_subdiv_adaptor { + public: + typedef Interpolator interpolator_type; + typedef typename interpolator_type::trans_type trans_type; - //=================================================span_subdiv_adaptor - template - class span_subdiv_adaptor + enum sublixel_scale_e { subpixel_shift = SubpixelShift, subpixel_scale = 1 << subpixel_shift }; + + //---------------------------------------------------------------- + span_subdiv_adaptor() + : m_subdiv_shift(4) + , m_subdiv_size(1 << m_subdiv_shift) + , m_subdiv_mask(m_subdiv_size - 1) + {} + + span_subdiv_adaptor(interpolator_type& interpolator, unsigned subdiv_shift = 4) + : m_subdiv_shift(subdiv_shift) + , m_subdiv_size(1 << m_subdiv_shift) + , m_subdiv_mask(m_subdiv_size - 1) + , m_interpolator(&interpolator) + {} + + span_subdiv_adaptor(interpolator_type& interpolator, double x, double y, unsigned len, unsigned subdiv_shift = 4) + : m_subdiv_shift(subdiv_shift) + , m_subdiv_size(1 << m_subdiv_shift) + , m_subdiv_mask(m_subdiv_size - 1) + , m_interpolator(&interpolator) { - public: - typedef Interpolator interpolator_type; - typedef typename interpolator_type::trans_type trans_type; + begin(x, y, len); + } - enum sublixel_scale_e + //---------------------------------------------------------------- + const interpolator_type& interpolator() const { return *m_interpolator; } + void interpolator(interpolator_type& intr) { m_interpolator = &intr; } + + //---------------------------------------------------------------- + const trans_type& transformer() const { return *m_interpolator->transformer(); } + void transformer(const trans_type& trans) { m_interpolator->transformer(trans); } + + //---------------------------------------------------------------- + unsigned subdiv_shift() const { return m_subdiv_shift; } + void subdiv_shift(unsigned shift) + { + m_subdiv_shift = shift; + m_subdiv_size = 1 << m_subdiv_shift; + m_subdiv_mask = m_subdiv_size - 1; + } + + //---------------------------------------------------------------- + void begin(double x, double y, unsigned len) + { + m_pos = 1; + m_src_x = iround(x * subpixel_scale) + subpixel_scale; + m_src_y = y; + m_len = len; + if (len > m_subdiv_size) + len = m_subdiv_size; + m_interpolator->begin(x, y, len); + } + + //---------------------------------------------------------------- + void operator++() + { + ++(*m_interpolator); + if (m_pos >= m_subdiv_size) { - subpixel_shift = SubpixelShift, - subpixel_scale = 1 << subpixel_shift - }; - - - //---------------------------------------------------------------- - span_subdiv_adaptor() : - m_subdiv_shift(4), - m_subdiv_size(1 << m_subdiv_shift), - m_subdiv_mask(m_subdiv_size - 1) {} - - span_subdiv_adaptor(interpolator_type& interpolator, - unsigned subdiv_shift = 4) : - m_subdiv_shift(subdiv_shift), - m_subdiv_size(1 << m_subdiv_shift), - m_subdiv_mask(m_subdiv_size - 1), - m_interpolator(&interpolator) {} - - span_subdiv_adaptor(interpolator_type& interpolator, - double x, double y, unsigned len, - unsigned subdiv_shift = 4) : - m_subdiv_shift(subdiv_shift), - m_subdiv_size(1 << m_subdiv_shift), - m_subdiv_mask(m_subdiv_size - 1), - m_interpolator(&interpolator) - { - begin(x, y, len); + unsigned len = m_len; + if (len > m_subdiv_size) + len = m_subdiv_size; + m_interpolator->resynchronize(double(m_src_x) / double(subpixel_scale) + len, m_src_y, len); + m_pos = 0; } + m_src_x += subpixel_scale; + ++m_pos; + --m_len; + } + //---------------------------------------------------------------- + void coordinates(int* x, int* y) const { m_interpolator->coordinates(x, y); } - //---------------------------------------------------------------- - const interpolator_type& interpolator() const { return *m_interpolator; } - void interpolator(interpolator_type& intr) { m_interpolator = &intr; } + //---------------------------------------------------------------- + void local_scale(int* x, int* y) const { m_interpolator->local_scale(x, y); } - //---------------------------------------------------------------- - const trans_type& transformer() const - { - return *m_interpolator->transformer(); - } - void transformer(const trans_type& trans) - { - m_interpolator->transformer(trans); - } + private: + unsigned m_subdiv_shift; + unsigned m_subdiv_size; + unsigned m_subdiv_mask; + interpolator_type* m_interpolator; + int m_src_x; + double m_src_y; + unsigned m_pos; + unsigned m_len; +}; - //---------------------------------------------------------------- - unsigned subdiv_shift() const { return m_subdiv_shift; } - void subdiv_shift(unsigned shift) - { - m_subdiv_shift = shift; - m_subdiv_size = 1 << m_subdiv_shift; - m_subdiv_mask = m_subdiv_size - 1; - } - - //---------------------------------------------------------------- - void begin(double x, double y, unsigned len) - { - m_pos = 1; - m_src_x = iround(x * subpixel_scale) + subpixel_scale; - m_src_y = y; - m_len = len; - if(len > m_subdiv_size) len = m_subdiv_size; - m_interpolator->begin(x, y, len); - } - - //---------------------------------------------------------------- - void operator++() - { - ++(*m_interpolator); - if(m_pos >= m_subdiv_size) - { - unsigned len = m_len; - if(len > m_subdiv_size) len = m_subdiv_size; - m_interpolator->resynchronize(double(m_src_x) / double(subpixel_scale) + len, - m_src_y, - len); - m_pos = 0; - } - m_src_x += subpixel_scale; - ++m_pos; - --m_len; - } - - //---------------------------------------------------------------- - void coordinates(int* x, int* y) const - { - m_interpolator->coordinates(x, y); - } - - //---------------------------------------------------------------- - void local_scale(int* x, int* y) const - { - m_interpolator->local_scale(x, y); - } - - - private: - unsigned m_subdiv_shift; - unsigned m_subdiv_size; - unsigned m_subdiv_mask; - interpolator_type* m_interpolator; - int m_src_x; - double m_src_y; - unsigned m_pos; - unsigned m_len; - }; - -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_trans_affine.h b/deps/agg/include/agg_trans_affine.h index cbb82a5e7..5175bf1d7 100644 --- a/deps/agg/include/agg_trans_affine.h +++ b/deps/agg/include/agg_trans_affine.h @@ -23,497 +23,469 @@ #include "agg_basics.h" #include -namespace agg +namespace agg { +const double affine_epsilon = 1e-14; + +//============================================================trans_affine +// +// See Implementation agg_trans_affine.cpp +// +// Affine transformation are linear transformations in Cartesian coordinates +// (strictly speaking not only in Cartesian, but for the beginning we will +// think so). They are rotation, scaling, translation and skewing. +// After any affine transformation a line segment remains a line segment +// and it will never become a curve. +// +// There will be no math about matrix calculations, since it has been +// described many times. Ask yourself a very simple question: +// "why do we need to understand and use some matrix stuff instead of just +// rotating, scaling and so on". The answers are: +// +// 1. Any combination of transformations can be done by only 4 multiplications +// and 4 additions in floating point. +// 2. One matrix transformation is equivalent to the number of consecutive +// discrete transformations, i.e. the matrix "accumulates" all transformations +// in the order of their settings. Suppose we have 4 transformations: +// * rotate by 30 degrees, +// * scale X to 2.0, +// * scale Y to 1.5, +// * move to (100, 100). +// The result will depend on the order of these transformations, +// and the advantage of matrix is that the sequence of discret calls: +// rotate(30), scaleX(2.0), scaleY(1.5), move(100,100) +// will have exactly the same result as the following matrix transformations: +// +// affine_matrix m; +// m *= rotate_matrix(30); +// m *= scaleX_matrix(2.0); +// m *= scaleY_matrix(1.5); +// m *= move_matrix(100,100); +// +// m.transform_my_point_at_last(x, y); +// +// What is the good of it? In real life we will set-up the matrix only once +// and then transform many points, let alone the convenience to set any +// combination of transformations. +// +// So, how to use it? Very easy - literally as it's shown above. Not quite, +// let us write a correct example: +// +// agg::trans_affine m; +// m *= agg::trans_affine_rotation(30.0 * 3.1415926 / 180.0); +// m *= agg::trans_affine_scaling(2.0, 1.5); +// m *= agg::trans_affine_translation(100.0, 100.0); +// m.transform(&x, &y); +// +// The affine matrix is all you need to perform any linear transformation, +// but all transformations have origin point (0,0). It means that we need to +// use 2 translations if we want to rotate someting around (100,100): +// +// m *= agg::trans_affine_translation(-100.0, -100.0); // move to (0,0) +// m *= agg::trans_affine_rotation(30.0 * 3.1415926 / 180.0); // rotate +// m *= agg::trans_affine_translation(100.0, 100.0); // move back to (100,100) +//---------------------------------------------------------------------- +struct MAPNIK_DECL trans_affine { - const double affine_epsilon = 1e-14; + static const trans_affine identity; + double sx, shy, shx, sy, tx, ty; - //============================================================trans_affine - // - // See Implementation agg_trans_affine.cpp - // - // Affine transformation are linear transformations in Cartesian coordinates - // (strictly speaking not only in Cartesian, but for the beginning we will - // think so). They are rotation, scaling, translation and skewing. - // After any affine transformation a line segment remains a line segment - // and it will never become a curve. - // - // There will be no math about matrix calculations, since it has been - // described many times. Ask yourself a very simple question: - // "why do we need to understand and use some matrix stuff instead of just - // rotating, scaling and so on". The answers are: - // - // 1. Any combination of transformations can be done by only 4 multiplications - // and 4 additions in floating point. - // 2. One matrix transformation is equivalent to the number of consecutive - // discrete transformations, i.e. the matrix "accumulates" all transformations - // in the order of their settings. Suppose we have 4 transformations: - // * rotate by 30 degrees, - // * scale X to 2.0, - // * scale Y to 1.5, - // * move to (100, 100). - // The result will depend on the order of these transformations, - // and the advantage of matrix is that the sequence of discret calls: - // rotate(30), scaleX(2.0), scaleY(1.5), move(100,100) - // will have exactly the same result as the following matrix transformations: - // - // affine_matrix m; - // m *= rotate_matrix(30); - // m *= scaleX_matrix(2.0); - // m *= scaleY_matrix(1.5); - // m *= move_matrix(100,100); - // - // m.transform_my_point_at_last(x, y); - // - // What is the good of it? In real life we will set-up the matrix only once - // and then transform many points, let alone the convenience to set any - // combination of transformations. - // - // So, how to use it? Very easy - literally as it's shown above. Not quite, - // let us write a correct example: - // - // agg::trans_affine m; - // m *= agg::trans_affine_rotation(30.0 * 3.1415926 / 180.0); - // m *= agg::trans_affine_scaling(2.0, 1.5); - // m *= agg::trans_affine_translation(100.0, 100.0); - // m.transform(&x, &y); - // - // The affine matrix is all you need to perform any linear transformation, - // but all transformations have origin point (0,0). It means that we need to - // use 2 translations if we want to rotate someting around (100,100): - // - // m *= agg::trans_affine_translation(-100.0, -100.0); // move to (0,0) - // m *= agg::trans_affine_rotation(30.0 * 3.1415926 / 180.0); // rotate - // m *= agg::trans_affine_translation(100.0, 100.0); // move back to (100,100) - //---------------------------------------------------------------------- - struct MAPNIK_DECL trans_affine + //------------------------------------------ Construction + // Identity matrix + trans_affine() + : sx(1.0) + , shy(0.0) + , shx(0.0) + , sy(1.0) + , tx(0.0) + , ty(0.0) + {} + + // Custom matrix. Usually used in derived classes + trans_affine(double v0, double v1, double v2, double v3, double v4, double v5) + : sx(v0) + , shy(v1) + , shx(v2) + , sy(v3) + , tx(v4) + , ty(v5) + {} + + // Custom matrix from m[6] + explicit trans_affine(const double* m) + : sx(m[0]) + , shy(m[1]) + , shx(m[2]) + , sy(m[3]) + , tx(m[4]) + , ty(m[5]) + {} + + // Rectangle to a parallelogram. + trans_affine(double x1, double y1, double x2, double y2, const double* parl) { rect_to_parl(x1, y1, x2, y2, parl); } + + // Parallelogram to a rectangle. + trans_affine(const double* parl, double x1, double y1, double x2, double y2) { parl_to_rect(parl, x1, y1, x2, y2); } + + // Arbitrary parallelogram transformation. + trans_affine(const double* src, const double* dst) { parl_to_parl(src, dst); } + + //---------------------------------- Parellelogram transformations + // transform a parallelogram to another one. Src and dst are + // pointers to arrays of three points (double[6], x1,y1,...) that + // identify three corners of the parallelograms assuming implicit + // fourth point. The arguments are arrays of double[6] mapped + // to x1,y1, x2,y2, x3,y3 where the coordinates are: + // *-----------------* + // / (x3,y3)/ + // / / + // /(x1,y1) (x2,y2)/ + // *-----------------* + const trans_affine& parl_to_parl(const double* src, const double* dst); + + const trans_affine& rect_to_parl(double x1, double y1, double x2, double y2, const double* parl); + + const trans_affine& parl_to_rect(const double* parl, double x1, double y1, double x2, double y2); + + //------------------------------------------ Operations + // Reset - load an identity matrix + const trans_affine& reset(); + + // Direct transformations operations + const trans_affine& translate(double x, double y); + const trans_affine& rotate(double a); + const trans_affine& scale(double s); + const trans_affine& scale(double x, double y); + + // Multiply matrix to another one + const trans_affine& multiply(const trans_affine& m); + + // Multiply "m" to "this" and assign the result to "this" + const trans_affine& premultiply(const trans_affine& m); + + // Multiply matrix to inverse of another one + const trans_affine& multiply_inv(const trans_affine& m); + + // Multiply inverse of "m" to "this" and assign the result to "this" + const trans_affine& premultiply_inv(const trans_affine& m); + + // Invert matrix. Do not try to invert degenerate matrices, + // there's no check for validity. If you set scale to 0 and + // then try to invert matrix, expect unpredictable result. + const trans_affine& invert(); + + // Mirroring around X + const trans_affine& flip_x(); + + // Mirroring around Y + const trans_affine& flip_y(); + + //------------------------------------------- Load/Store + // Store matrix to an array [6] of double + void store_to(double* m) const { - static const trans_affine identity; - double sx, shy, shx, sy, tx, ty; - - //------------------------------------------ Construction - // Identity matrix - trans_affine() : - sx(1.0), shy(0.0), shx(0.0), sy(1.0), tx(0.0), ty(0.0) - {} - - // Custom matrix. Usually used in derived classes - trans_affine(double v0, double v1, double v2, - double v3, double v4, double v5) : - sx(v0), shy(v1), shx(v2), sy(v3), tx(v4), ty(v5) - {} - - // Custom matrix from m[6] - explicit trans_affine(const double* m) : - sx(m[0]), shy(m[1]), shx(m[2]), sy(m[3]), tx(m[4]), ty(m[5]) - {} - - // Rectangle to a parallelogram. - trans_affine(double x1, double y1, double x2, double y2, - const double* parl) - { - rect_to_parl(x1, y1, x2, y2, parl); - } - - // Parallelogram to a rectangle. - trans_affine(const double* parl, - double x1, double y1, double x2, double y2) - { - parl_to_rect(parl, x1, y1, x2, y2); - } - - // Arbitrary parallelogram transformation. - trans_affine(const double* src, const double* dst) - { - parl_to_parl(src, dst); - } - - //---------------------------------- Parellelogram transformations - // transform a parallelogram to another one. Src and dst are - // pointers to arrays of three points (double[6], x1,y1,...) that - // identify three corners of the parallelograms assuming implicit - // fourth point. The arguments are arrays of double[6] mapped - // to x1,y1, x2,y2, x3,y3 where the coordinates are: - // *-----------------* - // / (x3,y3)/ - // / / - // /(x1,y1) (x2,y2)/ - // *-----------------* - const trans_affine& parl_to_parl(const double* src, - const double* dst); - - const trans_affine& rect_to_parl(double x1, double y1, - double x2, double y2, - const double* parl); - - const trans_affine& parl_to_rect(const double* parl, - double x1, double y1, - double x2, double y2); - - - //------------------------------------------ Operations - // Reset - load an identity matrix - const trans_affine& reset(); - - // Direct transformations operations - const trans_affine& translate(double x, double y); - const trans_affine& rotate(double a); - const trans_affine& scale(double s); - const trans_affine& scale(double x, double y); - - // Multiply matrix to another one - const trans_affine& multiply(const trans_affine& m); - - // Multiply "m" to "this" and assign the result to "this" - const trans_affine& premultiply(const trans_affine& m); - - // Multiply matrix to inverse of another one - const trans_affine& multiply_inv(const trans_affine& m); - - // Multiply inverse of "m" to "this" and assign the result to "this" - const trans_affine& premultiply_inv(const trans_affine& m); - - // Invert matrix. Do not try to invert degenerate matrices, - // there's no check for validity. If you set scale to 0 and - // then try to invert matrix, expect unpredictable result. - const trans_affine& invert(); - - // Mirroring around X - const trans_affine& flip_x(); - - // Mirroring around Y - const trans_affine& flip_y(); - - //------------------------------------------- Load/Store - // Store matrix to an array [6] of double - void store_to(double* m) const - { - *m++ = sx; *m++ = shy; *m++ = shx; *m++ = sy; *m++ = tx; *m++ = ty; - } - - // Load matrix from an array [6] of double - const trans_affine& load_from(const double* m) - { - sx = *m++; shy = *m++; shx = *m++; sy = *m++; tx = *m++; ty = *m++; - return *this; - } - - //------------------------------------------- Operators - - // Multiply the matrix by another one - const trans_affine& operator *= (const trans_affine& m) - { - return multiply(m); - } - - // Multiply the matrix by inverse of another one - const trans_affine& operator /= (const trans_affine& m) - { - return multiply_inv(m); - } - - // Multiply the matrix by another one and return - // the result in a separate matrix. - trans_affine operator * (const trans_affine& m) const - { - return trans_affine(*this).multiply(m); - } - - // Multiply the matrix by inverse of another one - // and return the result in a separate matrix. - trans_affine operator / (const trans_affine& m) const - { - return trans_affine(*this).multiply_inv(m); - } - - // Calculate and return the inverse matrix - trans_affine operator ~ () const - { - trans_affine ret = *this; - return ret.invert(); - } - - // Equal operator with default epsilon - bool operator == (const trans_affine& m) const - { - return is_equal(m, affine_epsilon); - } - - // Not Equal operator with default epsilon - bool operator != (const trans_affine& m) const - { - return !is_equal(m, affine_epsilon); - } - - //-------------------------------------------- Transformations - // Direct transformation of x and y - void transform(double* x, double* y) const; - - // Direct transformation of x and y, 2x2 matrix only, no translation - void transform_2x2(double* x, double* y) const; - - // Inverse transformation of x and y. It works slower than the - // direct transformation. For massive operations it's better to - // invert() the matrix and then use direct transformations. - void inverse_transform(double* x, double* y) const; - - //-------------------------------------------- Auxiliary - // Calculate the determinant of matrix - double determinant() const - { - return sx * sy - shy * shx; - } - - // Calculate the reciprocal of the determinant - double determinant_reciprocal() const - { - return 1.0 / (sx * sy - shy * shx); - } - - // Get the average scale (by X and Y). - // Basically used to calculate the approximation_scale when - // decomposinting curves into line segments. - double scale() const; - - // Check to see if the matrix is not degenerate - bool is_valid(double epsilon = affine_epsilon) const; - - // Check to see if it's an identity matrix - bool is_identity(double epsilon = affine_epsilon) const; - - // Check to see if two matrices are equal - bool is_equal(const trans_affine& m, double epsilon = affine_epsilon) const; - - // Determine the major parameters. Use with caution considering - // possible degenerate cases. - double rotation() const; - void translation(double* dx, double* dy) const; - void scaling(double* x, double* y) const; - void scaling_abs(double* x, double* y) const; - }; - - //------------------------------------------------------------------------ - inline void trans_affine::transform(double* x, double* y) const - { - double tmp = *x; - *x = tmp * sx + *y * shx + tx; - *y = tmp * shy + *y * sy + ty; + *m++ = sx; + *m++ = shy; + *m++ = shx; + *m++ = sy; + *m++ = tx; + *m++ = ty; } - //------------------------------------------------------------------------ - inline void trans_affine::transform_2x2(double* x, double* y) const + // Load matrix from an array [6] of double + const trans_affine& load_from(const double* m) { - double tmp = *x; - *x = tmp * sx + *y * shx; - *y = tmp * shy + *y * sy; - } - - //------------------------------------------------------------------------ - inline void trans_affine::inverse_transform(double* x, double* y) const - { - double d = determinant_reciprocal(); - double a = (*x - tx) * d; - double b = (*y - ty) * d; - *x = a * sy - b * shx; - *y = b * sx - a * shy; - } - - //------------------------------------------------------------------------ - inline double trans_affine::scale() const - { - double x = 0.707106781 * sx + 0.707106781 * shx; - double y = 0.707106781 * shy + 0.707106781 * sy; - return sqrt(x*x + y*y); - } - - //------------------------------------------------------------------------ - inline const trans_affine& trans_affine::translate(double x, double y) - { - tx += x; - ty += y; + sx = *m++; + shy = *m++; + shx = *m++; + sy = *m++; + tx = *m++; + ty = *m++; return *this; } - //------------------------------------------------------------------------ - inline const trans_affine& trans_affine::rotate(double a) + //------------------------------------------- Operators + + // Multiply the matrix by another one + const trans_affine& operator*=(const trans_affine& m) { return multiply(m); } + + // Multiply the matrix by inverse of another one + const trans_affine& operator/=(const trans_affine& m) { return multiply_inv(m); } + + // Multiply the matrix by another one and return + // the result in a separate matrix. + trans_affine operator*(const trans_affine& m) const { return trans_affine(*this).multiply(m); } + + // Multiply the matrix by inverse of another one + // and return the result in a separate matrix. + trans_affine operator/(const trans_affine& m) const { return trans_affine(*this).multiply_inv(m); } + + // Calculate and return the inverse matrix + trans_affine operator~() const { - double ca = std::cos(a); - double sa = std::sin(a); - double t0 = sx * ca - shy * sa; - double t2 = shx * ca - sy * sa; - double t4 = tx * ca - ty * sa; - shy = sx * sa + shy * ca; - sy = shx * sa + sy * ca; - ty = tx * sa + ty * ca; - sx = t0; - shx = t2; - tx = t4; - return *this; + trans_affine ret = *this; + return ret.invert(); } - //------------------------------------------------------------------------ - inline const trans_affine& trans_affine::scale(double x, double y) - { - double mm0 = x; // Possible hint for the optimizer - double mm3 = y; - sx *= mm0; - shx *= mm0; - tx *= mm0; - shy *= mm3; - sy *= mm3; - ty *= mm3; - return *this; - } + // Equal operator with default epsilon + bool operator==(const trans_affine& m) const { return is_equal(m, affine_epsilon); } - //------------------------------------------------------------------------ - inline const trans_affine& trans_affine::scale(double s) - { - double m = s; // Possible hint for the optimizer - sx *= m; - shx *= m; - tx *= m; - shy *= m; - sy *= m; - ty *= m; - return *this; - } + // Not Equal operator with default epsilon + bool operator!=(const trans_affine& m) const { return !is_equal(m, affine_epsilon); } - //------------------------------------------------------------------------ - inline const trans_affine& trans_affine::premultiply(const trans_affine& m) - { - trans_affine t = m; - return *this = t.multiply(*this); - } + //-------------------------------------------- Transformations + // Direct transformation of x and y + void transform(double* x, double* y) const; - //------------------------------------------------------------------------ - inline const trans_affine& trans_affine::multiply_inv(const trans_affine& m) - { - trans_affine t = m; - t.invert(); - return multiply(t); - } + // Direct transformation of x and y, 2x2 matrix only, no translation + void transform_2x2(double* x, double* y) const; - //------------------------------------------------------------------------ - inline const trans_affine& trans_affine::premultiply_inv(const trans_affine& m) - { - trans_affine t = m; - t.invert(); - return *this = t.multiply(*this); - } + // Inverse transformation of x and y. It works slower than the + // direct transformation. For massive operations it's better to + // invert() the matrix and then use direct transformations. + void inverse_transform(double* x, double* y) const; - //------------------------------------------------------------------------ - inline void trans_affine::scaling_abs(double* x, double* y) const - { - // Used to calculate scaling coefficients in image resampling. - // When there is considerable shear this method gives us much - // better estimation than just sx, sy. - *x = sqrt(sx * sx + shx * shx); - *y = sqrt(shy * shy + sy * sy); - } + //-------------------------------------------- Auxiliary + // Calculate the determinant of matrix + double determinant() const { return sx * sy - shy * shx; } - //====================================================trans_affine_rotation - // Rotation matrix. std::sin() and std::cos() are calculated twice for the same angle. - // There's no harm because the performance of std::sin()/cos() is very good on all - // modern processors. Besides, this operation is not going to be invoked too - // often. - class trans_affine_rotation : public trans_affine - { - public: - trans_affine_rotation(double a) : - trans_affine(std::cos(a), std::sin(a), -std::sin(a), std::cos(a), 0.0, 0.0) - {} - }; + // Calculate the reciprocal of the determinant + double determinant_reciprocal() const { return 1.0 / (sx * sy - shy * shx); } - //====================================================trans_affine_scaling - // Scaling matrix. x, y - scale coefficients by X and Y respectively - class trans_affine_scaling : public trans_affine - { - public: - trans_affine_scaling(double x, double y) : - trans_affine(x, 0.0, 0.0, y, 0.0, 0.0) - {} + // Get the average scale (by X and Y). + // Basically used to calculate the approximation_scale when + // decomposinting curves into line segments. + double scale() const; - trans_affine_scaling(double s) : - trans_affine(s, 0.0, 0.0, s, 0.0, 0.0) - {} - }; + // Check to see if the matrix is not degenerate + bool is_valid(double epsilon = affine_epsilon) const; - //================================================trans_affine_translation - // Translation matrix - class trans_affine_translation : public trans_affine - { - public: - trans_affine_translation(double x, double y) : - trans_affine(1.0, 0.0, 0.0, 1.0, x, y) - {} - }; + // Check to see if it's an identity matrix + bool is_identity(double epsilon = affine_epsilon) const; - //====================================================trans_affine_skewing - // Sckewing (shear) matrix - class trans_affine_skewing : public trans_affine - { - public: - trans_affine_skewing(double x, double y) : - trans_affine(1.0, std::tan(y), std::tan(x), 1.0, 0.0, 0.0) - {} - }; + // Check to see if two matrices are equal + bool is_equal(const trans_affine& m, double epsilon = affine_epsilon) const; + // Determine the major parameters. Use with caution considering + // possible degenerate cases. + double rotation() const; + void translation(double* dx, double* dy) const; + void scaling(double* x, double* y) const; + void scaling_abs(double* x, double* y) const; +}; - //===============================================trans_affine_line_segment - // Rotate, Scale and Translate, associating 0...dist with line segment - // x1,y1,x2,y2 - class trans_affine_line_segment : public trans_affine - { - public: - trans_affine_line_segment(double x1, double y1, double x2, double y2, - double dist) - { - double dx = x2 - x1; - double dy = y2 - y1; - if(dist > 0.0) - { - multiply(trans_affine_scaling(sqrt(dx * dx + dy * dy) / dist)); - } - multiply(trans_affine_rotation(std::atan2(dy, dx))); - multiply(trans_affine_translation(x1, y1)); - } - }; - - - //============================================trans_affine_reflection_unit - // Reflection matrix. Reflect coordinates across the line through - // the origin containing the unit vector (ux, uy). - // Contributed by John Horigan - class trans_affine_reflection_unit : public trans_affine - { - public: - trans_affine_reflection_unit(double ux, double uy) : - trans_affine(2.0 * ux * ux - 1.0, - 2.0 * ux * uy, - 2.0 * ux * uy, - 2.0 * uy * uy - 1.0, - 0.0, 0.0) - {} - }; - - - //=================================================trans_affine_reflection - // Reflection matrix. Reflect coordinates across the line through - // the origin at the angle a or containing the non-unit vector (x, y). - // Contributed by John Horigan - class trans_affine_reflection : public trans_affine_reflection_unit - { - public: - trans_affine_reflection(double a) : - trans_affine_reflection_unit(std::cos(a), std::sin(a)) - {} - - - trans_affine_reflection(double x, double y) : - trans_affine_reflection_unit(x / sqrt(x * x + y * y), y / sqrt(x * x + y * y)) - {} - }; - +//------------------------------------------------------------------------ +inline void trans_affine::transform(double* x, double* y) const +{ + double tmp = *x; + *x = tmp * sx + *y * shx + tx; + *y = tmp * shy + *y * sy + ty; } +//------------------------------------------------------------------------ +inline void trans_affine::transform_2x2(double* x, double* y) const +{ + double tmp = *x; + *x = tmp * sx + *y * shx; + *y = tmp * shy + *y * sy; +} + +//------------------------------------------------------------------------ +inline void trans_affine::inverse_transform(double* x, double* y) const +{ + double d = determinant_reciprocal(); + double a = (*x - tx) * d; + double b = (*y - ty) * d; + *x = a * sy - b * shx; + *y = b * sx - a * shy; +} + +//------------------------------------------------------------------------ +inline double trans_affine::scale() const +{ + double x = 0.707106781 * sx + 0.707106781 * shx; + double y = 0.707106781 * shy + 0.707106781 * sy; + return sqrt(x * x + y * y); +} + +//------------------------------------------------------------------------ +inline const trans_affine& trans_affine::translate(double x, double y) +{ + tx += x; + ty += y; + return *this; +} + +//------------------------------------------------------------------------ +inline const trans_affine& trans_affine::rotate(double a) +{ + double ca = std::cos(a); + double sa = std::sin(a); + double t0 = sx * ca - shy * sa; + double t2 = shx * ca - sy * sa; + double t4 = tx * ca - ty * sa; + shy = sx * sa + shy * ca; + sy = shx * sa + sy * ca; + ty = tx * sa + ty * ca; + sx = t0; + shx = t2; + tx = t4; + return *this; +} + +//------------------------------------------------------------------------ +inline const trans_affine& trans_affine::scale(double x, double y) +{ + double mm0 = x; // Possible hint for the optimizer + double mm3 = y; + sx *= mm0; + shx *= mm0; + tx *= mm0; + shy *= mm3; + sy *= mm3; + ty *= mm3; + return *this; +} + +//------------------------------------------------------------------------ +inline const trans_affine& trans_affine::scale(double s) +{ + double m = s; // Possible hint for the optimizer + sx *= m; + shx *= m; + tx *= m; + shy *= m; + sy *= m; + ty *= m; + return *this; +} + +//------------------------------------------------------------------------ +inline const trans_affine& trans_affine::premultiply(const trans_affine& m) +{ + trans_affine t = m; + return *this = t.multiply(*this); +} + +//------------------------------------------------------------------------ +inline const trans_affine& trans_affine::multiply_inv(const trans_affine& m) +{ + trans_affine t = m; + t.invert(); + return multiply(t); +} + +//------------------------------------------------------------------------ +inline const trans_affine& trans_affine::premultiply_inv(const trans_affine& m) +{ + trans_affine t = m; + t.invert(); + return *this = t.multiply(*this); +} + +//------------------------------------------------------------------------ +inline void trans_affine::scaling_abs(double* x, double* y) const +{ + // Used to calculate scaling coefficients in image resampling. + // When there is considerable shear this method gives us much + // better estimation than just sx, sy. + *x = sqrt(sx * sx + shx * shx); + *y = sqrt(shy * shy + sy * sy); +} + +//====================================================trans_affine_rotation +// Rotation matrix. std::sin() and std::cos() are calculated twice for the same angle. +// There's no harm because the performance of std::sin()/cos() is very good on all +// modern processors. Besides, this operation is not going to be invoked too +// often. +class trans_affine_rotation : public trans_affine +{ + public: + trans_affine_rotation(double a) + : trans_affine(std::cos(a), std::sin(a), -std::sin(a), std::cos(a), 0.0, 0.0) + {} +}; + +//====================================================trans_affine_scaling +// Scaling matrix. x, y - scale coefficients by X and Y respectively +class trans_affine_scaling : public trans_affine +{ + public: + trans_affine_scaling(double x, double y) + : trans_affine(x, 0.0, 0.0, y, 0.0, 0.0) + {} + + trans_affine_scaling(double s) + : trans_affine(s, 0.0, 0.0, s, 0.0, 0.0) + {} +}; + +//================================================trans_affine_translation +// Translation matrix +class trans_affine_translation : public trans_affine +{ + public: + trans_affine_translation(double x, double y) + : trans_affine(1.0, 0.0, 0.0, 1.0, x, y) + {} +}; + +//====================================================trans_affine_skewing +// Sckewing (shear) matrix +class trans_affine_skewing : public trans_affine +{ + public: + trans_affine_skewing(double x, double y) + : trans_affine(1.0, std::tan(y), std::tan(x), 1.0, 0.0, 0.0) + {} +}; + +//===============================================trans_affine_line_segment +// Rotate, Scale and Translate, associating 0...dist with line segment +// x1,y1,x2,y2 +class trans_affine_line_segment : public trans_affine +{ + public: + trans_affine_line_segment(double x1, double y1, double x2, double y2, double dist) + { + double dx = x2 - x1; + double dy = y2 - y1; + if (dist > 0.0) + { + multiply(trans_affine_scaling(sqrt(dx * dx + dy * dy) / dist)); + } + multiply(trans_affine_rotation(std::atan2(dy, dx))); + multiply(trans_affine_translation(x1, y1)); + } +}; + +//============================================trans_affine_reflection_unit +// Reflection matrix. Reflect coordinates across the line through +// the origin containing the unit vector (ux, uy). +// Contributed by John Horigan +class trans_affine_reflection_unit : public trans_affine +{ + public: + trans_affine_reflection_unit(double ux, double uy) + : trans_affine(2.0 * ux * ux - 1.0, 2.0 * ux * uy, 2.0 * ux * uy, 2.0 * uy * uy - 1.0, 0.0, 0.0) + {} +}; + +//=================================================trans_affine_reflection +// Reflection matrix. Reflect coordinates across the line through +// the origin at the angle a or containing the non-unit vector (x, y). +// Contributed by John Horigan +class trans_affine_reflection : public trans_affine_reflection_unit +{ + public: + trans_affine_reflection(double a) + : trans_affine_reflection_unit(std::cos(a), std::sin(a)) + {} + + trans_affine_reflection(double x, double y) + : trans_affine_reflection_unit(x / sqrt(x * x + y * y), y / sqrt(x * x + y * y)) + {} +}; + +} // namespace agg #endif diff --git a/deps/agg/include/agg_trans_bilinear.h b/deps/agg/include/agg_trans_bilinear.h index f3ab59647..82b04bd7b 100644 --- a/deps/agg/include/agg_trans_bilinear.h +++ b/deps/agg/include/agg_trans_bilinear.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -22,145 +22,129 @@ #include "agg_basics.h" #include "agg_simul_eq.h" -namespace agg +namespace agg { + +//==========================================================trans_bilinear +class trans_bilinear { + public: + //-------------------------------------------------------------------- + trans_bilinear() + : m_valid(false) + {} - //==========================================================trans_bilinear - class trans_bilinear + //-------------------------------------------------------------------- + // Arbitrary quadrangle transformations + trans_bilinear(const double* src, const double* dst) { quad_to_quad(src, dst); } + + //-------------------------------------------------------------------- + // Direct transformations + trans_bilinear(double x1, double y1, double x2, double y2, const double* quad) { - public: - //-------------------------------------------------------------------- - trans_bilinear() : m_valid(false) {} + rect_to_quad(x1, y1, x2, y2, quad); + } - //-------------------------------------------------------------------- - // Arbitrary quadrangle transformations - trans_bilinear(const double* src, const double* dst) + //-------------------------------------------------------------------- + // Reverse transformations + trans_bilinear(const double* quad, double x1, double y1, double x2, double y2) + { + quad_to_rect(quad, x1, y1, x2, y2); + } + + //-------------------------------------------------------------------- + // Set the transformations using two arbitrary quadrangles. + void quad_to_quad(const double* src, const double* dst) + { + double left[4][4]; + double right[4][2]; + + unsigned i; + for (i = 0; i < 4; i++) { - quad_to_quad(src, dst); + unsigned ix = i * 2; + unsigned iy = ix + 1; + left[i][0] = 1.0; + left[i][1] = src[ix] * src[iy]; + left[i][2] = src[ix]; + left[i][3] = src[iy]; + + right[i][0] = dst[ix]; + right[i][1] = dst[iy]; } + m_valid = simul_eq<4, 2>::solve(left, right, m_mtx); + } + //-------------------------------------------------------------------- + // Set the direct transformations, i.e., rectangle -> quadrangle + void rect_to_quad(double x1, double y1, double x2, double y2, const double* quad) + { + double src[8]; + src[0] = src[6] = x1; + src[2] = src[4] = x2; + src[1] = src[3] = y1; + src[5] = src[7] = y2; + quad_to_quad(src, quad); + } - //-------------------------------------------------------------------- - // Direct transformations - trans_bilinear(double x1, double y1, double x2, double y2, - const double* quad) + //-------------------------------------------------------------------- + // Set the reverse transformations, i.e., quadrangle -> rectangle + void quad_to_rect(const double* quad, double x1, double y1, double x2, double y2) + { + double dst[8]; + dst[0] = dst[6] = x1; + dst[2] = dst[4] = x2; + dst[1] = dst[3] = y1; + dst[5] = dst[7] = y2; + quad_to_quad(quad, dst); + } + + //-------------------------------------------------------------------- + // Check if the equations were solved successfully + bool is_valid() const { return m_valid; } + + //-------------------------------------------------------------------- + // Transform a point (x, y) + void transform(double* x, double* y) const + { + double tx = *x; + double ty = *y; + double xy = tx * ty; + *x = m_mtx[0][0] + m_mtx[1][0] * xy + m_mtx[2][0] * tx + m_mtx[3][0] * ty; + *y = m_mtx[0][1] + m_mtx[1][1] * xy + m_mtx[2][1] * tx + m_mtx[3][1] * ty; + } + + //-------------------------------------------------------------------- + class iterator_x + { + double inc_x; + double inc_y; + + public: + double x; + double y; + + iterator_x() {} + iterator_x(double tx, double ty, double step, const double m[4][2]) + : inc_x(m[1][0] * step * ty + m[2][0] * step) + , inc_y(m[1][1] * step * ty + m[2][1] * step) + , x(m[0][0] + m[1][0] * tx * ty + m[2][0] * tx + m[3][0] * ty) + , y(m[0][1] + m[1][1] * tx * ty + m[2][1] * tx + m[3][1] * ty) + {} + + void operator++() { - rect_to_quad(x1, y1, x2, y2, quad); + x += inc_x; + y += inc_y; } - - - //-------------------------------------------------------------------- - // Reverse transformations - trans_bilinear(const double* quad, - double x1, double y1, double x2, double y2) - { - quad_to_rect(quad, x1, y1, x2, y2); - } - - - //-------------------------------------------------------------------- - // Set the transformations using two arbitrary quadrangles. - void quad_to_quad(const double* src, const double* dst) - { - double left[4][4]; - double right[4][2]; - - unsigned i; - for(i = 0; i < 4; i++) - { - unsigned ix = i * 2; - unsigned iy = ix + 1; - left[i][0] = 1.0; - left[i][1] = src[ix] * src[iy]; - left[i][2] = src[ix]; - left[i][3] = src[iy]; - - right[i][0] = dst[ix]; - right[i][1] = dst[iy]; - } - m_valid = simul_eq<4, 2>::solve(left, right, m_mtx); - } - - - //-------------------------------------------------------------------- - // Set the direct transformations, i.e., rectangle -> quadrangle - void rect_to_quad(double x1, double y1, double x2, double y2, - const double* quad) - { - double src[8]; - src[0] = src[6] = x1; - src[2] = src[4] = x2; - src[1] = src[3] = y1; - src[5] = src[7] = y2; - quad_to_quad(src, quad); - } - - - //-------------------------------------------------------------------- - // Set the reverse transformations, i.e., quadrangle -> rectangle - void quad_to_rect(const double* quad, - double x1, double y1, double x2, double y2) - { - double dst[8]; - dst[0] = dst[6] = x1; - dst[2] = dst[4] = x2; - dst[1] = dst[3] = y1; - dst[5] = dst[7] = y2; - quad_to_quad(quad, dst); - } - - //-------------------------------------------------------------------- - // Check if the equations were solved successfully - bool is_valid() const { return m_valid; } - - //-------------------------------------------------------------------- - // Transform a point (x, y) - void transform(double* x, double* y) const - { - double tx = *x; - double ty = *y; - double xy = tx * ty; - *x = m_mtx[0][0] + m_mtx[1][0] * xy + m_mtx[2][0] * tx + m_mtx[3][0] * ty; - *y = m_mtx[0][1] + m_mtx[1][1] * xy + m_mtx[2][1] * tx + m_mtx[3][1] * ty; - } - - - //-------------------------------------------------------------------- - class iterator_x - { - double inc_x; - double inc_y; - - public: - double x; - double y; - - iterator_x() {} - iterator_x(double tx, double ty, double step, const double m[4][2]) : - inc_x(m[1][0] * step * ty + m[2][0] * step), - inc_y(m[1][1] * step * ty + m[2][1] * step), - x(m[0][0] + m[1][0] * tx * ty + m[2][0] * tx + m[3][0] * ty), - y(m[0][1] + m[1][1] * tx * ty + m[2][1] * tx + m[3][1] * ty) - { - } - - void operator ++ () - { - x += inc_x; - y += inc_y; - } - }; - - iterator_x begin(double x, double y, double step) const - { - return iterator_x(x, y, step, m_mtx); - } - - private: - double m_mtx[4][2]; - bool m_valid; }; -} + iterator_x begin(double x, double y, double step) const { return iterator_x(x, y, step, m_mtx); } + + private: + double m_mtx[4][2]; + bool m_valid; +}; + +} // namespace agg #endif diff --git a/deps/agg/include/agg_trans_double_path.h b/deps/agg/include/agg_trans_double_path.h index c645a7f86..6a4045de1 100644 --- a/deps/agg/include/agg_trans_double_path.h +++ b/deps/agg/include/agg_trans_double_path.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -19,113 +19,103 @@ #include "agg_basics.h" #include "agg_vertex_sequence.h" -namespace agg +namespace agg { + +// See also: agg_trans_double_path.cpp +// +//-------------------------------------------------------trans_double_path +class trans_double_path { - - // See also: agg_trans_double_path.cpp - // - //-------------------------------------------------------trans_double_path - class trans_double_path + enum status_e { initial, making_path, ready }; + + public: + typedef vertex_sequence vertex_storage; + + trans_double_path(); + + //-------------------------------------------------------------------- + void base_length(double v) { m_base_length = v; } + double base_length() const { return m_base_length; } + + //-------------------------------------------------------------------- + void base_height(double v) { m_base_height = v; } + double base_height() const { return m_base_height; } + + //-------------------------------------------------------------------- + void preserve_x_scale(bool f) { m_preserve_x_scale = f; } + bool preserve_x_scale() const { return m_preserve_x_scale; } + + //-------------------------------------------------------------------- + void reset(); + void move_to1(double x, double y); + void line_to1(double x, double y); + void move_to2(double x, double y); + void line_to2(double x, double y); + void finalize_paths(); + + //-------------------------------------------------------------------- + template + void add_paths(VertexSource1& vs1, VertexSource2& vs2, unsigned path1_id = 0, unsigned path2_id = 0) { - enum status_e + double x; + double y; + + unsigned cmd; + + vs1.rewind(path1_id); + while (!is_stop(cmd = vs1.vertex(&x, &y))) { - initial, - making_path, - ready - }; - - public: - typedef vertex_sequence vertex_storage; - - trans_double_path(); - - //-------------------------------------------------------------------- - void base_length(double v) { m_base_length = v; } - double base_length() const { return m_base_length; } - - //-------------------------------------------------------------------- - void base_height(double v) { m_base_height = v; } - double base_height() const { return m_base_height; } - - //-------------------------------------------------------------------- - void preserve_x_scale(bool f) { m_preserve_x_scale = f; } - bool preserve_x_scale() const { return m_preserve_x_scale; } - - //-------------------------------------------------------------------- - void reset(); - void move_to1(double x, double y); - void line_to1(double x, double y); - void move_to2(double x, double y); - void line_to2(double x, double y); - void finalize_paths(); - - //-------------------------------------------------------------------- - template - void add_paths(VertexSource1& vs1, VertexSource2& vs2, - unsigned path1_id=0, unsigned path2_id=0) - { - double x; - double y; - - unsigned cmd; - - vs1.rewind(path1_id); - while(!is_stop(cmd = vs1.vertex(&x, &y))) + if (is_move_to(cmd)) { - if(is_move_to(cmd)) + move_to1(x, y); + } + else + { + if (is_vertex(cmd)) { - move_to1(x, y); - } - else - { - if(is_vertex(cmd)) - { - line_to1(x, y); - } + line_to1(x, y); } } - - vs2.rewind(path2_id); - while(!is_stop(cmd = vs2.vertex(&x, &y))) - { - if(is_move_to(cmd)) - { - move_to2(x, y); - } - else - { - if(is_vertex(cmd)) - { - line_to2(x, y); - } - } - } - finalize_paths(); } - //-------------------------------------------------------------------- - double total_length1() const; - double total_length2() const; - void transform(double *x, double *y) const; + vs2.rewind(path2_id); + while (!is_stop(cmd = vs2.vertex(&x, &y))) + { + if (is_move_to(cmd)) + { + move_to2(x, y); + } + else + { + if (is_vertex(cmd)) + { + line_to2(x, y); + } + } + } + finalize_paths(); + } - private: - double finalize_path(vertex_storage& vertices); - void transform1(const vertex_storage& vertices, - double kindex, double kx, - double *x, double* y) const; + //-------------------------------------------------------------------- + double total_length1() const; + double total_length2() const; + void transform(double* x, double* y) const; - vertex_storage m_src_vertices1; - vertex_storage m_src_vertices2; - double m_base_length; - double m_base_height; - double m_kindex1; - double m_kindex2; - status_e m_status1; - status_e m_status2; - bool m_preserve_x_scale; - }; + private: + double finalize_path(vertex_storage& vertices); + void transform1(const vertex_storage& vertices, double kindex, double kx, double* x, double* y) const; -} + vertex_storage m_src_vertices1; + vertex_storage m_src_vertices2; + double m_base_length; + double m_base_height; + double m_kindex1; + double m_kindex2; + status_e m_status1; + status_e m_status2; + bool m_preserve_x_scale; +}; +} // namespace agg #endif diff --git a/deps/agg/include/agg_trans_lens.h b/deps/agg/include/agg_trans_lens.h index f80c090ba..1b5d700cf 100644 --- a/deps/agg/include/agg_trans_lens.h +++ b/deps/agg/include/agg_trans_lens.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.1 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -19,61 +19,65 @@ #include #include "agg_basics.h" +namespace agg { -namespace agg +class trans_warp_magnifier { + public: + trans_warp_magnifier() + : m_xc(0.0) + , m_yc(0.0) + , m_magn(1.0) + , m_radius(1.0) + , m_warp(false) + {} - class trans_warp_magnifier + void center(double x, double y) { - public: - trans_warp_magnifier() : m_xc(0.0), m_yc(0.0), m_magn(1.0), m_radius(1.0), m_warp(false) {} - - void center(double x, double y) { m_xc = x; m_yc = y; } - void magnification(double m) { m_magn = m; } - void radius(double r) { m_radius = r; } - void warp(bool w) { m_warp = w; } + m_xc = x; + m_yc = y; + } + void magnification(double m) { m_magn = m; } + void radius(double r) { m_radius = r; } + void warp(bool w) { m_warp = w; } - void transform(double* x, double* y) const + void transform(double* x, double* y) const + { + double dx = *x - m_xc; + double dy = *y - m_yc; + double r = sqrt(dx * dx + dy * dy); + double rm = m_radius / m_magn; + if (r < rm) { - double dx = *x - m_xc; - double dy = *y - m_yc; - double r = sqrt(dx * dx + dy * dy); - double rm = m_radius / m_magn; - if(r < rm) - { - *x = m_xc + dx * m_magn; - *y = m_yc + dy * m_magn; - return; - } - - if(m_warp) - { - double m = (r + rm * (m_magn - 1.0)) / r; - *x = m_xc + dx * m; - *y = m_yc + dy * m; - return; - } - - if(r < m_radius) - { - double m = m_radius / r; - *x = m_xc + dx * m; - *y = m_yc + dy * m; - } + *x = m_xc + dx * m_magn; + *y = m_yc + dy * m_magn; + return; } - private: - double m_xc; - double m_yc; - double m_magn; - double m_radius; - bool m_warp; - }; + if (m_warp) + { + double m = (r + rm * (m_magn - 1.0)) / r; + *x = m_xc + dx * m; + *y = m_yc + dy * m; + return; + } + if (r < m_radius) + { + double m = m_radius / r; + *x = m_xc + dx * m; + *y = m_yc + dy * m; + } + } + private: + double m_xc; + double m_yc; + double m_magn; + double m_radius; + bool m_warp; +}; -} - +} // namespace agg #endif - diff --git a/deps/agg/include/agg_trans_perspective.h b/deps/agg/include/agg_trans_perspective.h index 06a150c25..64dc64955 100644 --- a/deps/agg/include/agg_trans_perspective.h +++ b/deps/agg/include/agg_trans_perspective.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -21,711 +21,670 @@ #include "agg_trans_affine.h" -namespace agg +namespace agg { +//=======================================================trans_perspective +struct trans_perspective { - //=======================================================trans_perspective - struct trans_perspective + double sx, shy, w0, shx, sy, w1, tx, ty, w2; + + //------------------------------------------------------- Construction + // Identity matrix + trans_perspective() + : sx(1) + , shy(0) + , w0(0) + , shx(0) + , sy(1) + , w1(0) + , tx(0) + , ty(0) + , w2(1) + {} + + // Custom matrix + trans_perspective(double v0, double v1, double v2, double v3, double v4, double v5, double v6, double v7, double v8) + : sx(v0) + , shy(v1) + , w0(v2) + , shx(v3) + , sy(v4) + , w1(v5) + , tx(v6) + , ty(v7) + , w2(v8) + {} + + // Custom matrix from m[9] + explicit trans_perspective(const double* m) + : sx(m[0]) + , shy(m[1]) + , w0(m[2]) + , shx(m[3]) + , sy(m[4]) + , w1(m[5]) + , tx(m[6]) + , ty(m[7]) + , w2(m[8]) + {} + + // From affine + explicit trans_perspective(const trans_affine& a) + : sx(a.sx) + , shy(a.shy) + , w0(0) + , shx(a.shx) + , sy(a.sy) + , w1(0) + , tx(a.tx) + , ty(a.ty) + , w2(1) + {} + + // Rectangle to quadrilateral + trans_perspective(double x1, double y1, double x2, double y2, const double* quad); + + // Quadrilateral to rectangle + trans_perspective(const double* quad, double x1, double y1, double x2, double y2); + + // Arbitrary quadrilateral transformations + trans_perspective(const double* src, const double* dst); + + //-------------------------------------- Quadrilateral transformations + // The arguments are double[8] that are mapped to quadrilaterals: + // x1,y1, x2,y2, x3,y3, x4,y4 + bool quad_to_quad(const double* qs, const double* qd); + + bool rect_to_quad(double x1, double y1, double x2, double y2, const double* q); + + bool quad_to_rect(const double* q, double x1, double y1, double x2, double y2); + + // Map square (0,0,1,1) to the quadrilateral and vice versa + bool square_to_quad(const double* q); + bool quad_to_square(const double* q); + + //--------------------------------------------------------- Operations + // Reset - load an identity matrix + const trans_perspective& reset(); + + // Invert matrix. Returns false in degenerate case + bool invert(); + + // Direct transformations operations + const trans_perspective& translate(double x, double y); + const trans_perspective& rotate(double a); + const trans_perspective& scale(double s); + const trans_perspective& scale(double x, double y); + + // Multiply the matrix by another one + const trans_perspective& multiply(const trans_perspective& m); + + // Multiply "m" by "this" and assign the result to "this" + const trans_perspective& premultiply(const trans_perspective& m); + + // Multiply matrix to inverse of another one + const trans_perspective& multiply_inv(const trans_perspective& m); + + // Multiply inverse of "m" by "this" and assign the result to "this" + const trans_perspective& premultiply_inv(const trans_perspective& m); + + // Multiply the matrix by another one + const trans_perspective& multiply(const trans_affine& m); + + // Multiply "m" by "this" and assign the result to "this" + const trans_perspective& premultiply(const trans_affine& m); + + // Multiply the matrix by inverse of another one + const trans_perspective& multiply_inv(const trans_affine& m); + + // Multiply inverse of "m" by "this" and assign the result to "this" + const trans_perspective& premultiply_inv(const trans_affine& m); + + //--------------------------------------------------------- Load/Store + void store_to(double* m) const; + const trans_perspective& load_from(const double* m); + + //---------------------------------------------------------- Operators + // Multiply the matrix by another one + const trans_perspective& operator*=(const trans_perspective& m) { return multiply(m); } + const trans_perspective& operator*=(const trans_affine& m) { return multiply(m); } + + // Multiply the matrix by inverse of another one + const trans_perspective& operator/=(const trans_perspective& m) { return multiply_inv(m); } + const trans_perspective& operator/=(const trans_affine& m) { return multiply_inv(m); } + + // Multiply the matrix by another one and return + // the result in a separete matrix. + trans_perspective operator*(const trans_perspective& m) { return trans_perspective(*this).multiply(m); } + trans_perspective operator*(const trans_affine& m) { return trans_perspective(*this).multiply(m); } + + // Multiply the matrix by inverse of another one + // and return the result in a separete matrix. + trans_perspective operator/(const trans_perspective& m) { return trans_perspective(*this).multiply_inv(m); } + trans_perspective operator/(const trans_affine& m) { return trans_perspective(*this).multiply_inv(m); } + + // Calculate and return the inverse matrix + trans_perspective operator~() const { - double sx, shy, w0, shx, sy, w1, tx, ty, w2; + trans_perspective ret = *this; + ret.invert(); + return ret; + } - //------------------------------------------------------- Construction - // Identity matrix - trans_perspective() : - sx (1), shy(0), w0(0), - shx(0), sy (1), w1(0), - tx (0), ty (0), w2(1) {} + // Equal operator with default epsilon + bool operator==(const trans_perspective& m) const { return is_equal(m, affine_epsilon); } - // Custom matrix - trans_perspective(double v0, double v1, double v2, - double v3, double v4, double v5, - double v6, double v7, double v8) : - sx (v0), shy(v1), w0(v2), - shx(v3), sy (v4), w1(v5), - tx (v6), ty (v7), w2(v8) {} + // Not Equal operator with default epsilon + bool operator!=(const trans_perspective& m) const { return !is_equal(m, affine_epsilon); } - // Custom matrix from m[9] - explicit trans_perspective(const double* m) : - sx (m[0]), shy(m[1]), w0(m[2]), - shx(m[3]), sy (m[4]), w1(m[5]), - tx (m[6]), ty (m[7]), w2(m[8]) {} + //---------------------------------------------------- Transformations + // Direct transformation of x and y + void transform(double* x, double* y) const; - // From affine - explicit trans_perspective(const trans_affine& a) : - sx (a.sx ), shy(a.shy), w0(0), - shx(a.shx), sy (a.sy ), w1(0), - tx (a.tx ), ty (a.ty ), w2(1) {} + // Direct transformation of x and y, affine part only + void transform_affine(double* x, double* y) const; - // Rectangle to quadrilateral - trans_perspective(double x1, double y1, double x2, double y2, - const double* quad); + // Direct transformation of x and y, 2x2 matrix only, no translation + void transform_2x2(double* x, double* y) const; - // Quadrilateral to rectangle - trans_perspective(const double* quad, - double x1, double y1, double x2, double y2); + // Inverse transformation of x and y. It works slow because + // it explicitly inverts the matrix on every call. For massive + // operations it's better to invert() the matrix and then use + // direct transformations. + void inverse_transform(double* x, double* y) const; - // Arbitrary quadrilateral transformations - trans_perspective(const double* src, const double* dst); + //---------------------------------------------------------- Auxiliary + const trans_perspective& from_affine(const trans_affine& a); + double determinant() const; + double determinant_reciprocal() const; - //-------------------------------------- Quadrilateral transformations - // The arguments are double[8] that are mapped to quadrilaterals: - // x1,y1, x2,y2, x3,y3, x4,y4 - bool quad_to_quad(const double* qs, const double* qd); + bool is_valid(double epsilon = affine_epsilon) const; + bool is_identity(double epsilon = affine_epsilon) const; + bool is_equal(const trans_perspective& m, double epsilon = affine_epsilon) const; - bool rect_to_quad(double x1, double y1, - double x2, double y2, - const double* q); + // Determine the major affine parameters. Use with caution + // considering possible degenerate cases. + double scale() const; + double rotation() const; + void translation(double* dx, double* dy) const; + void scaling(double* x, double* y) const; + void scaling_abs(double* x, double* y) const; - bool quad_to_rect(const double* q, - double x1, double y1, - double x2, double y2); + //-------------------------------------------------------------------- + class iterator_x + { + double den; + double den_step; + double nom_x; + double nom_x_step; + double nom_y; + double nom_y_step; - // Map square (0,0,1,1) to the quadrilateral and vice versa - bool square_to_quad(const double* q); - bool quad_to_square(const double* q); + public: + double x; + double y; + iterator_x() {} + iterator_x(double px, double py, double step, const trans_perspective& m) + : den(px * m.w0 + py * m.w1 + m.w2) + , den_step(m.w0 * step) + , nom_x(px * m.sx + py * m.shx + m.tx) + , nom_x_step(step * m.sx) + , nom_y(px * m.shy + py * m.sy + m.ty) + , nom_y_step(step * m.shy) + , x(nom_x / den) + , y(nom_y / den) + {} - //--------------------------------------------------------- Operations - // Reset - load an identity matrix - const trans_perspective& reset(); - - // Invert matrix. Returns false in degenerate case - bool invert(); - - // Direct transformations operations - const trans_perspective& translate(double x, double y); - const trans_perspective& rotate(double a); - const trans_perspective& scale(double s); - const trans_perspective& scale(double x, double y); - - // Multiply the matrix by another one - const trans_perspective& multiply(const trans_perspective& m); - - // Multiply "m" by "this" and assign the result to "this" - const trans_perspective& premultiply(const trans_perspective& m); - - // Multiply matrix to inverse of another one - const trans_perspective& multiply_inv(const trans_perspective& m); - - // Multiply inverse of "m" by "this" and assign the result to "this" - const trans_perspective& premultiply_inv(const trans_perspective& m); - - // Multiply the matrix by another one - const trans_perspective& multiply(const trans_affine& m); - - // Multiply "m" by "this" and assign the result to "this" - const trans_perspective& premultiply(const trans_affine& m); - - // Multiply the matrix by inverse of another one - const trans_perspective& multiply_inv(const trans_affine& m); - - // Multiply inverse of "m" by "this" and assign the result to "this" - const trans_perspective& premultiply_inv(const trans_affine& m); - - //--------------------------------------------------------- Load/Store - void store_to(double* m) const; - const trans_perspective& load_from(const double* m); - - //---------------------------------------------------------- Operators - // Multiply the matrix by another one - const trans_perspective& operator *= (const trans_perspective& m) + void operator++() { - return multiply(m); - } - const trans_perspective& operator *= (const trans_affine& m) - { - return multiply(m); - } - - // Multiply the matrix by inverse of another one - const trans_perspective& operator /= (const trans_perspective& m) - { - return multiply_inv(m); - } - const trans_perspective& operator /= (const trans_affine& m) - { - return multiply_inv(m); - } - - // Multiply the matrix by another one and return - // the result in a separete matrix. - trans_perspective operator * (const trans_perspective& m) - { - return trans_perspective(*this).multiply(m); - } - trans_perspective operator * (const trans_affine& m) - { - return trans_perspective(*this).multiply(m); - } - - // Multiply the matrix by inverse of another one - // and return the result in a separete matrix. - trans_perspective operator / (const trans_perspective& m) - { - return trans_perspective(*this).multiply_inv(m); - } - trans_perspective operator / (const trans_affine& m) - { - return trans_perspective(*this).multiply_inv(m); - } - - // Calculate and return the inverse matrix - trans_perspective operator ~ () const - { - trans_perspective ret = *this; - ret.invert(); - return ret; - } - - // Equal operator with default epsilon - bool operator == (const trans_perspective& m) const - { - return is_equal(m, affine_epsilon); - } - - // Not Equal operator with default epsilon - bool operator != (const trans_perspective& m) const - { - return !is_equal(m, affine_epsilon); - } - - //---------------------------------------------------- Transformations - // Direct transformation of x and y - void transform(double* x, double* y) const; - - // Direct transformation of x and y, affine part only - void transform_affine(double* x, double* y) const; - - // Direct transformation of x and y, 2x2 matrix only, no translation - void transform_2x2(double* x, double* y) const; - - // Inverse transformation of x and y. It works slow because - // it explicitly inverts the matrix on every call. For massive - // operations it's better to invert() the matrix and then use - // direct transformations. - void inverse_transform(double* x, double* y) const; - - - //---------------------------------------------------------- Auxiliary - const trans_perspective& from_affine(const trans_affine& a); - double determinant() const; - double determinant_reciprocal() const; - - bool is_valid(double epsilon = affine_epsilon) const; - bool is_identity(double epsilon = affine_epsilon) const; - bool is_equal(const trans_perspective& m, - double epsilon = affine_epsilon) const; - - // Determine the major affine parameters. Use with caution - // considering possible degenerate cases. - double scale() const; - double rotation() const; - void translation(double* dx, double* dy) const; - void scaling(double* x, double* y) const; - void scaling_abs(double* x, double* y) const; - - - - //-------------------------------------------------------------------- - class iterator_x - { - double den; - double den_step; - double nom_x; - double nom_x_step; - double nom_y; - double nom_y_step; - - public: - double x; - double y; - - iterator_x() {} - iterator_x(double px, double py, double step, const trans_perspective& m) : - den(px * m.w0 + py * m.w1 + m.w2), - den_step(m.w0 * step), - nom_x(px * m.sx + py * m.shx + m.tx), - nom_x_step(step * m.sx), - nom_y(px * m.shy + py * m.sy + m.ty), - nom_y_step(step * m.shy), - x(nom_x / den), - y(nom_y / den) - {} - - void operator ++ () - { - den += den_step; - nom_x += nom_x_step; - nom_y += nom_y_step; - double d = 1.0 / den; - x = nom_x * d; - y = nom_y * d; - } - }; - - //-------------------------------------------------------------------- - iterator_x begin(double x, double y, double step) const - { - return iterator_x(x, y, step, *this); + den += den_step; + nom_x += nom_x_step; + nom_y += nom_y_step; + double d = 1.0 / den; + x = nom_x * d; + y = nom_y * d; } }; + //-------------------------------------------------------------------- + iterator_x begin(double x, double y, double step) const { return iterator_x(x, y, step, *this); } +}; - - - - - - - - - - - - - //------------------------------------------------------------------------ - inline bool trans_perspective::square_to_quad(const double* q) +//------------------------------------------------------------------------ +inline bool trans_perspective::square_to_quad(const double* q) +{ + double dx = q[0] - q[2] + q[4] - q[6]; + double dy = q[1] - q[3] + q[5] - q[7]; + if (dx == 0.0 && dy == 0.0) { - double dx = q[0] - q[2] + q[4] - q[6]; - double dy = q[1] - q[3] + q[5] - q[7]; - if(dx == 0.0 && dy == 0.0) - { - // Affine case (parallelogram) - //--------------- - sx = q[2] - q[0]; - shy = q[3] - q[1]; - w0 = 0.0; - shx = q[4] - q[2]; - sy = q[5] - q[3]; - w1 = 0.0; - tx = q[0]; - ty = q[1]; - w2 = 1.0; - } - else - { - double dx1 = q[2] - q[4]; - double dy1 = q[3] - q[5]; - double dx2 = q[6] - q[4]; - double dy2 = q[7] - q[5]; - double den = dx1 * dy2 - dx2 * dy1; - if(den == 0.0) - { - // Singular case - //--------------- - sx = shy = w0 = shx = sy = w1 = tx = ty = w2 = 0.0; - return false; - } - // General case - //--------------- - double u = (dx * dy2 - dy * dx2) / den; - double v = (dy * dx1 - dx * dy1) / den; - sx = q[2] - q[0] + u * q[2]; - shy = q[3] - q[1] + u * q[3]; - w0 = u; - shx = q[6] - q[0] + v * q[6]; - sy = q[7] - q[1] + v * q[7]; - w1 = v; - tx = q[0]; - ty = q[1]; - w2 = 1.0; - } - return true; + // Affine case (parallelogram) + //--------------- + sx = q[2] - q[0]; + shy = q[3] - q[1]; + w0 = 0.0; + shx = q[4] - q[2]; + sy = q[5] - q[3]; + w1 = 0.0; + tx = q[0]; + ty = q[1]; + w2 = 1.0; } - - //------------------------------------------------------------------------ - inline bool trans_perspective::invert() + else { - double d0 = sy * w2 - w1 * ty; - double d1 = w0 * ty - shy * w2; - double d2 = shy * w1 - w0 * sy; - double d = sx * d0 + shx * d1 + tx * d2; - if(d == 0.0) + double dx1 = q[2] - q[4]; + double dy1 = q[3] - q[5]; + double dx2 = q[6] - q[4]; + double dy2 = q[7] - q[5]; + double den = dx1 * dy2 - dx2 * dy1; + if (den == 0.0) { + // Singular case + //--------------- sx = shy = w0 = shx = sy = w1 = tx = ty = w2 = 0.0; return false; } - d = 1.0 / d; - trans_perspective a = *this; - sx = d * d0; - shy = d * d1; - w0 = d * d2; - shx = d * (a.w1 *a.tx - a.shx*a.w2); - sy = d * (a.sx *a.w2 - a.w0 *a.tx); - w1 = d * (a.w0 *a.shx - a.sx *a.w1); - tx = d * (a.shx*a.ty - a.sy *a.tx); - ty = d * (a.shy*a.tx - a.sx *a.ty); - w2 = d * (a.sx *a.sy - a.shy*a.shx); - return true; + // General case + //--------------- + double u = (dx * dy2 - dy * dx2) / den; + double v = (dy * dx1 - dx * dy1) / den; + sx = q[2] - q[0] + u * q[2]; + shy = q[3] - q[1] + u * q[3]; + w0 = u; + shx = q[6] - q[0] + v * q[6]; + sy = q[7] - q[1] + v * q[7]; + w1 = v; + tx = q[0]; + ty = q[1]; + w2 = 1.0; } - - //------------------------------------------------------------------------ - inline bool trans_perspective::quad_to_square(const double* q) - { - if(!square_to_quad(q)) return false; - invert(); - return true; - } - - //------------------------------------------------------------------------ - inline bool trans_perspective::quad_to_quad(const double* qs, - const double* qd) - { - trans_perspective p; - if(! quad_to_square(qs)) return false; - if(!p.square_to_quad(qd)) return false; - multiply(p); - return true; - } - - //------------------------------------------------------------------------ - inline bool trans_perspective::rect_to_quad(double x1, double y1, - double x2, double y2, - const double* q) - { - double r[8]; - r[0] = r[6] = x1; - r[2] = r[4] = x2; - r[1] = r[3] = y1; - r[5] = r[7] = y2; - return quad_to_quad(r, q); - } - - //------------------------------------------------------------------------ - inline bool trans_perspective::quad_to_rect(const double* q, - double x1, double y1, - double x2, double y2) - { - double r[8]; - r[0] = r[6] = x1; - r[2] = r[4] = x2; - r[1] = r[3] = y1; - r[5] = r[7] = y2; - return quad_to_quad(q, r); - } - - //------------------------------------------------------------------------ - inline trans_perspective::trans_perspective(double x1, double y1, - double x2, double y2, - const double* quad) - { - rect_to_quad(x1, y1, x2, y2, quad); - } - - //------------------------------------------------------------------------ - inline trans_perspective::trans_perspective(const double* quad, - double x1, double y1, - double x2, double y2) - { - quad_to_rect(quad, x1, y1, x2, y2); - } - - //------------------------------------------------------------------------ - inline trans_perspective::trans_perspective(const double* src, - const double* dst) - { - quad_to_quad(src, dst); - } - - //------------------------------------------------------------------------ - inline const trans_perspective& trans_perspective::reset() - { - sx = 1; shy = 0; w0 = 0; - shx = 0; sy = 1; w1 = 0; - tx = 0; ty = 0; w2 = 1; - return *this; - } - - //------------------------------------------------------------------------ - inline const trans_perspective& - trans_perspective::multiply(const trans_perspective& a) - { - trans_perspective b = *this; - sx = a.sx *b.sx + a.shx*b.shy + a.tx*b.w0; - shx = a.sx *b.shx + a.shx*b.sy + a.tx*b.w1; - tx = a.sx *b.tx + a.shx*b.ty + a.tx*b.w2; - shy = a.shy*b.sx + a.sy *b.shy + a.ty*b.w0; - sy = a.shy*b.shx + a.sy *b.sy + a.ty*b.w1; - ty = a.shy*b.tx + a.sy *b.ty + a.ty*b.w2; - w0 = a.w0 *b.sx + a.w1 *b.shy + a.w2*b.w0; - w1 = a.w0 *b.shx + a.w1 *b.sy + a.w2*b.w1; - w2 = a.w0 *b.tx + a.w1 *b.ty + a.w2*b.w2; - return *this; - } - - //------------------------------------------------------------------------ - inline const trans_perspective& - trans_perspective::multiply(const trans_affine& a) - { - trans_perspective b = *this; - sx = a.sx *b.sx + a.shx*b.shy + a.tx*b.w0; - shx = a.sx *b.shx + a.shx*b.sy + a.tx*b.w1; - tx = a.sx *b.tx + a.shx*b.ty + a.tx*b.w2; - shy = a.shy*b.sx + a.sy *b.shy + a.ty*b.w0; - sy = a.shy*b.shx + a.sy *b.sy + a.ty*b.w1; - ty = a.shy*b.tx + a.sy *b.ty + a.ty*b.w2; - return *this; - } - - //------------------------------------------------------------------------ - inline const trans_perspective& - trans_perspective::premultiply(const trans_perspective& b) - { - trans_perspective a = *this; - sx = a.sx *b.sx + a.shx*b.shy + a.tx*b.w0; - shx = a.sx *b.shx + a.shx*b.sy + a.tx*b.w1; - tx = a.sx *b.tx + a.shx*b.ty + a.tx*b.w2; - shy = a.shy*b.sx + a.sy *b.shy + a.ty*b.w0; - sy = a.shy*b.shx + a.sy *b.sy + a.ty*b.w1; - ty = a.shy*b.tx + a.sy *b.ty + a.ty*b.w2; - w0 = a.w0 *b.sx + a.w1 *b.shy + a.w2*b.w0; - w1 = a.w0 *b.shx + a.w1 *b.sy + a.w2*b.w1; - w2 = a.w0 *b.tx + a.w1 *b.ty + a.w2*b.w2; - return *this; - } - - //------------------------------------------------------------------------ - inline const trans_perspective& - trans_perspective::premultiply(const trans_affine& b) - { - trans_perspective a = *this; - sx = a.sx *b.sx + a.shx*b.shy; - shx = a.sx *b.shx + a.shx*b.sy; - tx = a.sx *b.tx + a.shx*b.ty + a.tx; - shy = a.shy*b.sx + a.sy *b.shy; - sy = a.shy*b.shx + a.sy *b.sy; - ty = a.shy*b.tx + a.sy *b.ty + a.ty; - w0 = a.w0 *b.sx + a.w1 *b.shy; - w1 = a.w0 *b.shx + a.w1 *b.sy; - w2 = a.w0 *b.tx + a.w1 *b.ty + a.w2; - return *this; - } - - //------------------------------------------------------------------------ - const trans_perspective& - trans_perspective::multiply_inv(const trans_perspective& m) - { - trans_perspective t = m; - t.invert(); - return multiply(t); - } - - //------------------------------------------------------------------------ - const trans_perspective& - trans_perspective::multiply_inv(const trans_affine& m) - { - trans_affine t = m; - t.invert(); - return multiply(t); - } - - //------------------------------------------------------------------------ - const trans_perspective& - trans_perspective::premultiply_inv(const trans_perspective& m) - { - trans_perspective t = m; - t.invert(); - return *this = t.multiply(*this); - } - - //------------------------------------------------------------------------ - const trans_perspective& - trans_perspective::premultiply_inv(const trans_affine& m) - { - trans_perspective t(m); - t.invert(); - return *this = t.multiply(*this); - } - - //------------------------------------------------------------------------ - inline const trans_perspective& - trans_perspective::translate(double x, double y) - { - tx += x; - ty += y; - return *this; - } - - //------------------------------------------------------------------------ - inline const trans_perspective& trans_perspective::rotate(double a) - { - multiply(trans_affine_rotation(a)); - return *this; - } - - //------------------------------------------------------------------------ - inline const trans_perspective& trans_perspective::scale(double s) - { - multiply(trans_affine_scaling(s)); - return *this; - } - - //------------------------------------------------------------------------ - inline const trans_perspective& trans_perspective::scale(double x, double y) - { - multiply(trans_affine_scaling(x, y)); - return *this; - } - - //------------------------------------------------------------------------ - inline void trans_perspective::transform(double* px, double* py) const - { - double x = *px; - double y = *py; - double m = 1.0 / (x*w0 + y*w1 + w2); - *px = m * (x*sx + y*shx + tx); - *py = m * (x*shy + y*sy + ty); - } - - //------------------------------------------------------------------------ - inline void trans_perspective::transform_affine(double* x, double* y) const - { - double tmp = *x; - *x = tmp * sx + *y * shx + tx; - *y = tmp * shy + *y * sy + ty; - } - - //------------------------------------------------------------------------ - inline void trans_perspective::transform_2x2(double* x, double* y) const - { - double tmp = *x; - *x = tmp * sx + *y * shx; - *y = tmp * shy + *y * sy; - } - - //------------------------------------------------------------------------ - inline void trans_perspective::inverse_transform(double* x, double* y) const - { - trans_perspective t(*this); - if(t.invert()) t.transform(x, y); - } - - //------------------------------------------------------------------------ - inline void trans_perspective::store_to(double* m) const - { - *m++ = sx; *m++ = shy; *m++ = w0; - *m++ = shx; *m++ = sy; *m++ = w1; - *m++ = tx; *m++ = ty; *m++ = w2; - } - - //------------------------------------------------------------------------ - inline const trans_perspective& trans_perspective::load_from(const double* m) - { - sx = *m++; shy = *m++; w0 = *m++; - shx = *m++; sy = *m++; w1 = *m++; - tx = *m++; ty = *m++; w2 = *m++; - return *this; - } - - //------------------------------------------------------------------------ - inline const trans_perspective& - trans_perspective::from_affine(const trans_affine& a) - { - sx = a.sx; shy = a.shy; w0 = 0; - shx = a.shx; sy = a.sy; w1 = 0; - tx = a.tx; ty = a.ty; w2 = 1; - return *this; - } - - //------------------------------------------------------------------------ - inline double trans_perspective::determinant() const - { - return sx * (sy * w2 - ty * w1) + - shx * (ty * w0 - shy * w2) + - tx * (shy * w1 - sy * w0); - } - - //------------------------------------------------------------------------ - inline double trans_perspective::determinant_reciprocal() const - { - return 1.0 / determinant(); - } - - //------------------------------------------------------------------------ - inline bool trans_perspective::is_valid(double epsilon) const - { - return std::fabs(sx) > epsilon && std::fabs(sy) > epsilon && std::fabs(w2) > epsilon; - } - - //------------------------------------------------------------------------ - inline bool trans_perspective::is_identity(double epsilon) const - { - return is_equal_eps(sx, 1.0, epsilon) && - is_equal_eps(shy, 0.0, epsilon) && - is_equal_eps(w0, 0.0, epsilon) && - is_equal_eps(shx, 0.0, epsilon) && - is_equal_eps(sy, 1.0, epsilon) && - is_equal_eps(w1, 0.0, epsilon) && - is_equal_eps(tx, 0.0, epsilon) && - is_equal_eps(ty, 0.0, epsilon) && - is_equal_eps(w2, 1.0, epsilon); - } - - //------------------------------------------------------------------------ - inline bool trans_perspective::is_equal(const trans_perspective& m, - double epsilon) const - { - return is_equal_eps(sx, m.sx, epsilon) && - is_equal_eps(shy, m.shy, epsilon) && - is_equal_eps(w0, m.w0, epsilon) && - is_equal_eps(shx, m.shx, epsilon) && - is_equal_eps(sy, m.sy, epsilon) && - is_equal_eps(w1, m.w1, epsilon) && - is_equal_eps(tx, m.tx, epsilon) && - is_equal_eps(ty, m.ty, epsilon) && - is_equal_eps(w2, m.w2, epsilon); - } - - //------------------------------------------------------------------------ - inline double trans_perspective::scale() const - { - double x = 0.707106781 * sx + 0.707106781 * shx; - double y = 0.707106781 * shy + 0.707106781 * sy; - return sqrt(x*x + y*y); - } - - //------------------------------------------------------------------------ - inline double trans_perspective::rotation() const - { - double x1 = 0.0; - double y1 = 0.0; - double x2 = 1.0; - double y2 = 0.0; - transform(&x1, &y1); - transform(&x2, &y2); - return std::atan2(y2-y1, x2-x1); - } - - //------------------------------------------------------------------------ - void trans_perspective::translation(double* dx, double* dy) const - { - *dx = tx; - *dy = ty; - } - - //------------------------------------------------------------------------ - void trans_perspective::scaling(double* x, double* y) const - { - double x1 = 0.0; - double y1 = 0.0; - double x2 = 1.0; - double y2 = 1.0; - trans_perspective t(*this); - t *= trans_affine_rotation(-rotation()); - t.transform(&x1, &y1); - t.transform(&x2, &y2); - *x = x2 - x1; - *y = y2 - y1; - } - - //------------------------------------------------------------------------ - void trans_perspective::scaling_abs(double* x, double* y) const - { - *x = sqrt(sx * sx + shx * shx); - *y = sqrt(shy * shy + sy * sy); - } - - + return true; } -#endif +//------------------------------------------------------------------------ +inline bool trans_perspective::invert() +{ + double d0 = sy * w2 - w1 * ty; + double d1 = w0 * ty - shy * w2; + double d2 = shy * w1 - w0 * sy; + double d = sx * d0 + shx * d1 + tx * d2; + if (d == 0.0) + { + sx = shy = w0 = shx = sy = w1 = tx = ty = w2 = 0.0; + return false; + } + d = 1.0 / d; + trans_perspective a = *this; + sx = d * d0; + shy = d * d1; + w0 = d * d2; + shx = d * (a.w1 * a.tx - a.shx * a.w2); + sy = d * (a.sx * a.w2 - a.w0 * a.tx); + w1 = d * (a.w0 * a.shx - a.sx * a.w1); + tx = d * (a.shx * a.ty - a.sy * a.tx); + ty = d * (a.shy * a.tx - a.sx * a.ty); + w2 = d * (a.sx * a.sy - a.shy * a.shx); + return true; +} +//------------------------------------------------------------------------ +inline bool trans_perspective::quad_to_square(const double* q) +{ + if (!square_to_quad(q)) + return false; + invert(); + return true; +} + +//------------------------------------------------------------------------ +inline bool trans_perspective::quad_to_quad(const double* qs, const double* qd) +{ + trans_perspective p; + if (!quad_to_square(qs)) + return false; + if (!p.square_to_quad(qd)) + return false; + multiply(p); + return true; +} + +//------------------------------------------------------------------------ +inline bool trans_perspective::rect_to_quad(double x1, double y1, double x2, double y2, const double* q) +{ + double r[8]; + r[0] = r[6] = x1; + r[2] = r[4] = x2; + r[1] = r[3] = y1; + r[5] = r[7] = y2; + return quad_to_quad(r, q); +} + +//------------------------------------------------------------------------ +inline bool trans_perspective::quad_to_rect(const double* q, double x1, double y1, double x2, double y2) +{ + double r[8]; + r[0] = r[6] = x1; + r[2] = r[4] = x2; + r[1] = r[3] = y1; + r[5] = r[7] = y2; + return quad_to_quad(q, r); +} + +//------------------------------------------------------------------------ +inline trans_perspective::trans_perspective(double x1, double y1, double x2, double y2, const double* quad) +{ + rect_to_quad(x1, y1, x2, y2, quad); +} + +//------------------------------------------------------------------------ +inline trans_perspective::trans_perspective(const double* quad, double x1, double y1, double x2, double y2) +{ + quad_to_rect(quad, x1, y1, x2, y2); +} + +//------------------------------------------------------------------------ +inline trans_perspective::trans_perspective(const double* src, const double* dst) +{ + quad_to_quad(src, dst); +} + +//------------------------------------------------------------------------ +inline const trans_perspective& trans_perspective::reset() +{ + sx = 1; + shy = 0; + w0 = 0; + shx = 0; + sy = 1; + w1 = 0; + tx = 0; + ty = 0; + w2 = 1; + return *this; +} + +//------------------------------------------------------------------------ +inline const trans_perspective& trans_perspective::multiply(const trans_perspective& a) +{ + trans_perspective b = *this; + sx = a.sx * b.sx + a.shx * b.shy + a.tx * b.w0; + shx = a.sx * b.shx + a.shx * b.sy + a.tx * b.w1; + tx = a.sx * b.tx + a.shx * b.ty + a.tx * b.w2; + shy = a.shy * b.sx + a.sy * b.shy + a.ty * b.w0; + sy = a.shy * b.shx + a.sy * b.sy + a.ty * b.w1; + ty = a.shy * b.tx + a.sy * b.ty + a.ty * b.w2; + w0 = a.w0 * b.sx + a.w1 * b.shy + a.w2 * b.w0; + w1 = a.w0 * b.shx + a.w1 * b.sy + a.w2 * b.w1; + w2 = a.w0 * b.tx + a.w1 * b.ty + a.w2 * b.w2; + return *this; +} + +//------------------------------------------------------------------------ +inline const trans_perspective& trans_perspective::multiply(const trans_affine& a) +{ + trans_perspective b = *this; + sx = a.sx * b.sx + a.shx * b.shy + a.tx * b.w0; + shx = a.sx * b.shx + a.shx * b.sy + a.tx * b.w1; + tx = a.sx * b.tx + a.shx * b.ty + a.tx * b.w2; + shy = a.shy * b.sx + a.sy * b.shy + a.ty * b.w0; + sy = a.shy * b.shx + a.sy * b.sy + a.ty * b.w1; + ty = a.shy * b.tx + a.sy * b.ty + a.ty * b.w2; + return *this; +} + +//------------------------------------------------------------------------ +inline const trans_perspective& trans_perspective::premultiply(const trans_perspective& b) +{ + trans_perspective a = *this; + sx = a.sx * b.sx + a.shx * b.shy + a.tx * b.w0; + shx = a.sx * b.shx + a.shx * b.sy + a.tx * b.w1; + tx = a.sx * b.tx + a.shx * b.ty + a.tx * b.w2; + shy = a.shy * b.sx + a.sy * b.shy + a.ty * b.w0; + sy = a.shy * b.shx + a.sy * b.sy + a.ty * b.w1; + ty = a.shy * b.tx + a.sy * b.ty + a.ty * b.w2; + w0 = a.w0 * b.sx + a.w1 * b.shy + a.w2 * b.w0; + w1 = a.w0 * b.shx + a.w1 * b.sy + a.w2 * b.w1; + w2 = a.w0 * b.tx + a.w1 * b.ty + a.w2 * b.w2; + return *this; +} + +//------------------------------------------------------------------------ +inline const trans_perspective& trans_perspective::premultiply(const trans_affine& b) +{ + trans_perspective a = *this; + sx = a.sx * b.sx + a.shx * b.shy; + shx = a.sx * b.shx + a.shx * b.sy; + tx = a.sx * b.tx + a.shx * b.ty + a.tx; + shy = a.shy * b.sx + a.sy * b.shy; + sy = a.shy * b.shx + a.sy * b.sy; + ty = a.shy * b.tx + a.sy * b.ty + a.ty; + w0 = a.w0 * b.sx + a.w1 * b.shy; + w1 = a.w0 * b.shx + a.w1 * b.sy; + w2 = a.w0 * b.tx + a.w1 * b.ty + a.w2; + return *this; +} + +//------------------------------------------------------------------------ +const trans_perspective& trans_perspective::multiply_inv(const trans_perspective& m) +{ + trans_perspective t = m; + t.invert(); + return multiply(t); +} + +//------------------------------------------------------------------------ +const trans_perspective& trans_perspective::multiply_inv(const trans_affine& m) +{ + trans_affine t = m; + t.invert(); + return multiply(t); +} + +//------------------------------------------------------------------------ +const trans_perspective& trans_perspective::premultiply_inv(const trans_perspective& m) +{ + trans_perspective t = m; + t.invert(); + return *this = t.multiply(*this); +} + +//------------------------------------------------------------------------ +const trans_perspective& trans_perspective::premultiply_inv(const trans_affine& m) +{ + trans_perspective t(m); + t.invert(); + return *this = t.multiply(*this); +} + +//------------------------------------------------------------------------ +inline const trans_perspective& trans_perspective::translate(double x, double y) +{ + tx += x; + ty += y; + return *this; +} + +//------------------------------------------------------------------------ +inline const trans_perspective& trans_perspective::rotate(double a) +{ + multiply(trans_affine_rotation(a)); + return *this; +} + +//------------------------------------------------------------------------ +inline const trans_perspective& trans_perspective::scale(double s) +{ + multiply(trans_affine_scaling(s)); + return *this; +} + +//------------------------------------------------------------------------ +inline const trans_perspective& trans_perspective::scale(double x, double y) +{ + multiply(trans_affine_scaling(x, y)); + return *this; +} + +//------------------------------------------------------------------------ +inline void trans_perspective::transform(double* px, double* py) const +{ + double x = *px; + double y = *py; + double m = 1.0 / (x * w0 + y * w1 + w2); + *px = m * (x * sx + y * shx + tx); + *py = m * (x * shy + y * sy + ty); +} + +//------------------------------------------------------------------------ +inline void trans_perspective::transform_affine(double* x, double* y) const +{ + double tmp = *x; + *x = tmp * sx + *y * shx + tx; + *y = tmp * shy + *y * sy + ty; +} + +//------------------------------------------------------------------------ +inline void trans_perspective::transform_2x2(double* x, double* y) const +{ + double tmp = *x; + *x = tmp * sx + *y * shx; + *y = tmp * shy + *y * sy; +} + +//------------------------------------------------------------------------ +inline void trans_perspective::inverse_transform(double* x, double* y) const +{ + trans_perspective t(*this); + if (t.invert()) + t.transform(x, y); +} + +//------------------------------------------------------------------------ +inline void trans_perspective::store_to(double* m) const +{ + *m++ = sx; + *m++ = shy; + *m++ = w0; + *m++ = shx; + *m++ = sy; + *m++ = w1; + *m++ = tx; + *m++ = ty; + *m++ = w2; +} + +//------------------------------------------------------------------------ +inline const trans_perspective& trans_perspective::load_from(const double* m) +{ + sx = *m++; + shy = *m++; + w0 = *m++; + shx = *m++; + sy = *m++; + w1 = *m++; + tx = *m++; + ty = *m++; + w2 = *m++; + return *this; +} + +//------------------------------------------------------------------------ +inline const trans_perspective& trans_perspective::from_affine(const trans_affine& a) +{ + sx = a.sx; + shy = a.shy; + w0 = 0; + shx = a.shx; + sy = a.sy; + w1 = 0; + tx = a.tx; + ty = a.ty; + w2 = 1; + return *this; +} + +//------------------------------------------------------------------------ +inline double trans_perspective::determinant() const +{ + return sx * (sy * w2 - ty * w1) + shx * (ty * w0 - shy * w2) + tx * (shy * w1 - sy * w0); +} + +//------------------------------------------------------------------------ +inline double trans_perspective::determinant_reciprocal() const +{ + return 1.0 / determinant(); +} + +//------------------------------------------------------------------------ +inline bool trans_perspective::is_valid(double epsilon) const +{ + return std::fabs(sx) > epsilon && std::fabs(sy) > epsilon && std::fabs(w2) > epsilon; +} + +//------------------------------------------------------------------------ +inline bool trans_perspective::is_identity(double epsilon) const +{ + return is_equal_eps(sx, 1.0, epsilon) && is_equal_eps(shy, 0.0, epsilon) && is_equal_eps(w0, 0.0, epsilon) && + is_equal_eps(shx, 0.0, epsilon) && is_equal_eps(sy, 1.0, epsilon) && is_equal_eps(w1, 0.0, epsilon) && + is_equal_eps(tx, 0.0, epsilon) && is_equal_eps(ty, 0.0, epsilon) && is_equal_eps(w2, 1.0, epsilon); +} + +//------------------------------------------------------------------------ +inline bool trans_perspective::is_equal(const trans_perspective& m, double epsilon) const +{ + return is_equal_eps(sx, m.sx, epsilon) && is_equal_eps(shy, m.shy, epsilon) && is_equal_eps(w0, m.w0, epsilon) && + is_equal_eps(shx, m.shx, epsilon) && is_equal_eps(sy, m.sy, epsilon) && is_equal_eps(w1, m.w1, epsilon) && + is_equal_eps(tx, m.tx, epsilon) && is_equal_eps(ty, m.ty, epsilon) && is_equal_eps(w2, m.w2, epsilon); +} + +//------------------------------------------------------------------------ +inline double trans_perspective::scale() const +{ + double x = 0.707106781 * sx + 0.707106781 * shx; + double y = 0.707106781 * shy + 0.707106781 * sy; + return sqrt(x * x + y * y); +} + +//------------------------------------------------------------------------ +inline double trans_perspective::rotation() const +{ + double x1 = 0.0; + double y1 = 0.0; + double x2 = 1.0; + double y2 = 0.0; + transform(&x1, &y1); + transform(&x2, &y2); + return std::atan2(y2 - y1, x2 - x1); +} + +//------------------------------------------------------------------------ +void trans_perspective::translation(double* dx, double* dy) const +{ + *dx = tx; + *dy = ty; +} + +//------------------------------------------------------------------------ +void trans_perspective::scaling(double* x, double* y) const +{ + double x1 = 0.0; + double y1 = 0.0; + double x2 = 1.0; + double y2 = 1.0; + trans_perspective t(*this); + t *= trans_affine_rotation(-rotation()); + t.transform(&x1, &y1); + t.transform(&x2, &y2); + *x = x2 - x1; + *y = y2 - y1; +} + +//------------------------------------------------------------------------ +void trans_perspective::scaling_abs(double* x, double* y) const +{ + *x = sqrt(sx * sx + shx * shx); + *y = sqrt(shy * shy + sy * sy); +} + +} // namespace agg + +#endif diff --git a/deps/agg/include/agg_trans_single_path.h b/deps/agg/include/agg_trans_single_path.h index 9f4bf53bd..6cf65421c 100644 --- a/deps/agg/include/agg_trans_single_path.h +++ b/deps/agg/include/agg_trans_single_path.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -19,79 +19,72 @@ #include "agg_basics.h" #include "agg_vertex_sequence.h" -namespace agg +namespace agg { + +// See also: agg_trans_single_path.cpp +// +//-------------------------------------------------------trans_single_path +class trans_single_path { + enum status_e { initial, making_path, ready }; - // See also: agg_trans_single_path.cpp - // - //-------------------------------------------------------trans_single_path - class trans_single_path + public: + typedef vertex_sequence vertex_storage; + + trans_single_path(); + + //-------------------------------------------------------------------- + void base_length(double v) { m_base_length = v; } + double base_length() const { return m_base_length; } + + //-------------------------------------------------------------------- + void preserve_x_scale(bool f) { m_preserve_x_scale = f; } + bool preserve_x_scale() const { return m_preserve_x_scale; } + + //-------------------------------------------------------------------- + void reset(); + void move_to(double x, double y); + void line_to(double x, double y); + void finalize_path(); + + //-------------------------------------------------------------------- + template + void add_path(VertexSource& vs, unsigned path_id = 0) { - enum status_e + double x; + double y; + + unsigned cmd; + vs.rewind(path_id); + while (!is_stop(cmd = vs.vertex(&x, &y))) { - initial, - making_path, - ready - }; - - public: - typedef vertex_sequence vertex_storage; - - trans_single_path(); - - //-------------------------------------------------------------------- - void base_length(double v) { m_base_length = v; } - double base_length() const { return m_base_length; } - - //-------------------------------------------------------------------- - void preserve_x_scale(bool f) { m_preserve_x_scale = f; } - bool preserve_x_scale() const { return m_preserve_x_scale; } - - //-------------------------------------------------------------------- - void reset(); - void move_to(double x, double y); - void line_to(double x, double y); - void finalize_path(); - - //-------------------------------------------------------------------- - template - void add_path(VertexSource& vs, unsigned path_id=0) - { - double x; - double y; - - unsigned cmd; - vs.rewind(path_id); - while(!is_stop(cmd = vs.vertex(&x, &y))) + if (is_move_to(cmd)) { - if(is_move_to(cmd)) + move_to(x, y); + } + else + { + if (is_vertex(cmd)) { - move_to(x, y); - } - else - { - if(is_vertex(cmd)) - { - line_to(x, y); - } + line_to(x, y); } } - finalize_path(); } + finalize_path(); + } - //-------------------------------------------------------------------- - double total_length() const; - void transform(double *x, double *y) const; + //-------------------------------------------------------------------- + double total_length() const; + void transform(double* x, double* y) const; - private: - vertex_storage m_src_vertices; - double m_base_length; - double m_kindex; - status_e m_status; - bool m_preserve_x_scale; - }; + private: + vertex_storage m_src_vertices; + double m_base_length; + double m_kindex; + status_e m_status; + bool m_preserve_x_scale; +}; - -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_trans_viewport.h b/deps/agg/include/agg_trans_viewport.h index c68f4803f..0044c28c0 100644 --- a/deps/agg/include/agg_trans_viewport.h +++ b/deps/agg/include/agg_trans_viewport.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -24,280 +24,242 @@ #include #include "agg_trans_affine.h" +namespace agg { -namespace agg +enum aspect_ratio_e { aspect_ratio_stretch, aspect_ratio_meet, aspect_ratio_slice }; + +//----------------------------------------------------------trans_viewport +class trans_viewport { + public: + //------------------------------------------------------------------- + trans_viewport() + : m_world_x1(0.0) + , m_world_y1(0.0) + , m_world_x2(1.0) + , m_world_y2(1.0) + , m_device_x1(0.0) + , m_device_y1(0.0) + , m_device_x2(1.0) + , m_device_y2(1.0) + , m_aspect(aspect_ratio_stretch) + , m_is_valid(true) + , m_align_x(0.5) + , m_align_y(0.5) + , m_wx1(0.0) + , m_wy1(0.0) + , m_wx2(1.0) + , m_wy2(1.0) + , m_dx1(0.0) + , m_dy1(0.0) + , m_kx(1.0) + , m_ky(1.0) + {} - enum aspect_ratio_e + //------------------------------------------------------------------- + void preserve_aspect_ratio(double alignx, double aligny, aspect_ratio_e aspect) { - aspect_ratio_stretch, - aspect_ratio_meet, - aspect_ratio_slice - }; - - - //----------------------------------------------------------trans_viewport - class trans_viewport - { - public: - //------------------------------------------------------------------- - trans_viewport() : - m_world_x1(0.0), - m_world_y1(0.0), - m_world_x2(1.0), - m_world_y2(1.0), - m_device_x1(0.0), - m_device_y1(0.0), - m_device_x2(1.0), - m_device_y2(1.0), - m_aspect(aspect_ratio_stretch), - m_is_valid(true), - m_align_x(0.5), - m_align_y(0.5), - m_wx1(0.0), - m_wy1(0.0), - m_wx2(1.0), - m_wy2(1.0), - m_dx1(0.0), - m_dy1(0.0), - m_kx(1.0), - m_ky(1.0) - {} - - //------------------------------------------------------------------- - void preserve_aspect_ratio(double alignx, - double aligny, - aspect_ratio_e aspect) - { - m_align_x = alignx; - m_align_y = aligny; - m_aspect = aspect; - update(); - } - - //------------------------------------------------------------------- - void device_viewport(double x1, double y1, double x2, double y2) - { - m_device_x1 = x1; - m_device_y1 = y1; - m_device_x2 = x2; - m_device_y2 = y2; - update(); - } - - //------------------------------------------------------------------- - void world_viewport(double x1, double y1, double x2, double y2) - { - m_world_x1 = x1; - m_world_y1 = y1; - m_world_x2 = x2; - m_world_y2 = y2; - update(); - } - - //------------------------------------------------------------------- - void device_viewport(double* x1, double* y1, double* x2, double* y2) const - { - *x1 = m_device_x1; - *y1 = m_device_y1; - *x2 = m_device_x2; - *y2 = m_device_y2; - } - - //------------------------------------------------------------------- - void world_viewport(double* x1, double* y1, double* x2, double* y2) const - { - *x1 = m_world_x1; - *y1 = m_world_y1; - *x2 = m_world_x2; - *y2 = m_world_y2; - } - - //------------------------------------------------------------------- - void world_viewport_actual(double* x1, double* y1, - double* x2, double* y2) const - { - *x1 = m_wx1; - *y1 = m_wy1; - *x2 = m_wx2; - *y2 = m_wy2; - } - - //------------------------------------------------------------------- - bool is_valid() const { return m_is_valid; } - double align_x() const { return m_align_x; } - double align_y() const { return m_align_y; } - aspect_ratio_e aspect_ratio() const { return m_aspect; } - - //------------------------------------------------------------------- - void transform(double* x, double* y) const - { - *x = (*x - m_wx1) * m_kx + m_dx1; - *y = (*y - m_wy1) * m_ky + m_dy1; - } - - //------------------------------------------------------------------- - void transform_scale_only(double* x, double* y) const - { - *x *= m_kx; - *y *= m_ky; - } - - //------------------------------------------------------------------- - void inverse_transform(double* x, double* y) const - { - *x = (*x - m_dx1) / m_kx + m_wx1; - *y = (*y - m_dy1) / m_ky + m_wy1; - } - - //------------------------------------------------------------------- - void inverse_transform_scale_only(double* x, double* y) const - { - *x /= m_kx; - *y /= m_ky; - } - - //------------------------------------------------------------------- - double device_dx() const { return m_dx1 - m_wx1 * m_kx; } - double device_dy() const { return m_dy1 - m_wy1 * m_ky; } - - //------------------------------------------------------------------- - double scale_x() const - { - return m_kx; - } - - //------------------------------------------------------------------- - double scale_y() const - { - return m_ky; - } - - //------------------------------------------------------------------- - double scale() const - { - return (m_kx + m_ky) * 0.5; - } - - //------------------------------------------------------------------- - trans_affine to_affine() const - { - trans_affine mtx = trans_affine_translation(-m_wx1, -m_wy1); - mtx *= trans_affine_scaling(m_kx, m_ky); - mtx *= trans_affine_translation(m_dx1, m_dy1); - return mtx; - } - - //------------------------------------------------------------------- - trans_affine to_affine_scale_only() const - { - return trans_affine_scaling(m_kx, m_ky); - } - - //------------------------------------------------------------------- - unsigned byte_size() const - { - return sizeof(*this); - } - - void serialize(int8u* ptr) const - { - memcpy(ptr, this, sizeof(*this)); - } - - void deserialize(const int8u* ptr) - { - memcpy(this, ptr, sizeof(*this)); - } - - private: - void update(); - - double m_world_x1; - double m_world_y1; - double m_world_x2; - double m_world_y2; - double m_device_x1; - double m_device_y1; - double m_device_x2; - double m_device_y2; - aspect_ratio_e m_aspect; - bool m_is_valid; - double m_align_x; - double m_align_y; - double m_wx1; - double m_wy1; - double m_wx2; - double m_wy2; - double m_dx1; - double m_dy1; - double m_kx; - double m_ky; - }; - - - - //----------------------------------------------------------------------- - inline void trans_viewport::update() - { - const double epsilon = 1e-30; - if(std::fabs(m_world_x1 - m_world_x2) < epsilon || - std::fabs(m_world_y1 - m_world_y2) < epsilon || - std::fabs(m_device_x1 - m_device_x2) < epsilon || - std::fabs(m_device_y1 - m_device_y2) < epsilon) - { - m_wx1 = m_world_x1; - m_wy1 = m_world_y1; - m_wx2 = m_world_x1 + 1.0; - m_wy2 = m_world_y2 + 1.0; - m_dx1 = m_device_x1; - m_dy1 = m_device_y1; - m_kx = 1.0; - m_ky = 1.0; - m_is_valid = false; - return; - } - - double world_x1 = m_world_x1; - double world_y1 = m_world_y1; - double world_x2 = m_world_x2; - double world_y2 = m_world_y2; - double device_x1 = m_device_x1; - double device_y1 = m_device_y1; - double device_x2 = m_device_x2; - double device_y2 = m_device_y2; - if(m_aspect != aspect_ratio_stretch) - { - double d; - m_kx = (device_x2 - device_x1) / (world_x2 - world_x1); - m_ky = (device_y2 - device_y1) / (world_y2 - world_y1); - - if((m_aspect == aspect_ratio_meet) == (m_kx < m_ky)) - { - d = (world_y2 - world_y1) * m_ky / m_kx; - world_y1 += (world_y2 - world_y1 - d) * m_align_y; - world_y2 = world_y1 + d; - } - else - { - d = (world_x2 - world_x1) * m_kx / m_ky; - world_x1 += (world_x2 - world_x1 - d) * m_align_x; - world_x2 = world_x1 + d; - } - } - m_wx1 = world_x1; - m_wy1 = world_y1; - m_wx2 = world_x2; - m_wy2 = world_y2; - m_dx1 = device_x1; - m_dy1 = device_y1; - m_kx = (device_x2 - device_x1) / (world_x2 - world_x1); - m_ky = (device_y2 - device_y1) / (world_y2 - world_y1); - m_is_valid = true; + m_align_x = alignx; + m_align_y = aligny; + m_aspect = aspect; + update(); } + //------------------------------------------------------------------- + void device_viewport(double x1, double y1, double x2, double y2) + { + m_device_x1 = x1; + m_device_y1 = y1; + m_device_x2 = x2; + m_device_y2 = y2; + update(); + } + //------------------------------------------------------------------- + void world_viewport(double x1, double y1, double x2, double y2) + { + m_world_x1 = x1; + m_world_y1 = y1; + m_world_x2 = x2; + m_world_y2 = y2; + update(); + } + + //------------------------------------------------------------------- + void device_viewport(double* x1, double* y1, double* x2, double* y2) const + { + *x1 = m_device_x1; + *y1 = m_device_y1; + *x2 = m_device_x2; + *y2 = m_device_y2; + } + + //------------------------------------------------------------------- + void world_viewport(double* x1, double* y1, double* x2, double* y2) const + { + *x1 = m_world_x1; + *y1 = m_world_y1; + *x2 = m_world_x2; + *y2 = m_world_y2; + } + + //------------------------------------------------------------------- + void world_viewport_actual(double* x1, double* y1, double* x2, double* y2) const + { + *x1 = m_wx1; + *y1 = m_wy1; + *x2 = m_wx2; + *y2 = m_wy2; + } + + //------------------------------------------------------------------- + bool is_valid() const { return m_is_valid; } + double align_x() const { return m_align_x; } + double align_y() const { return m_align_y; } + aspect_ratio_e aspect_ratio() const { return m_aspect; } + + //------------------------------------------------------------------- + void transform(double* x, double* y) const + { + *x = (*x - m_wx1) * m_kx + m_dx1; + *y = (*y - m_wy1) * m_ky + m_dy1; + } + + //------------------------------------------------------------------- + void transform_scale_only(double* x, double* y) const + { + *x *= m_kx; + *y *= m_ky; + } + + //------------------------------------------------------------------- + void inverse_transform(double* x, double* y) const + { + *x = (*x - m_dx1) / m_kx + m_wx1; + *y = (*y - m_dy1) / m_ky + m_wy1; + } + + //------------------------------------------------------------------- + void inverse_transform_scale_only(double* x, double* y) const + { + *x /= m_kx; + *y /= m_ky; + } + + //------------------------------------------------------------------- + double device_dx() const { return m_dx1 - m_wx1 * m_kx; } + double device_dy() const { return m_dy1 - m_wy1 * m_ky; } + + //------------------------------------------------------------------- + double scale_x() const { return m_kx; } + + //------------------------------------------------------------------- + double scale_y() const { return m_ky; } + + //------------------------------------------------------------------- + double scale() const { return (m_kx + m_ky) * 0.5; } + + //------------------------------------------------------------------- + trans_affine to_affine() const + { + trans_affine mtx = trans_affine_translation(-m_wx1, -m_wy1); + mtx *= trans_affine_scaling(m_kx, m_ky); + mtx *= trans_affine_translation(m_dx1, m_dy1); + return mtx; + } + + //------------------------------------------------------------------- + trans_affine to_affine_scale_only() const { return trans_affine_scaling(m_kx, m_ky); } + + //------------------------------------------------------------------- + unsigned byte_size() const { return sizeof(*this); } + + void serialize(int8u* ptr) const { memcpy(ptr, this, sizeof(*this)); } + + void deserialize(const int8u* ptr) { memcpy(this, ptr, sizeof(*this)); } + + private: + void update(); + + double m_world_x1; + double m_world_y1; + double m_world_x2; + double m_world_y2; + double m_device_x1; + double m_device_y1; + double m_device_x2; + double m_device_y2; + aspect_ratio_e m_aspect; + bool m_is_valid; + double m_align_x; + double m_align_y; + double m_wx1; + double m_wy1; + double m_wx2; + double m_wy2; + double m_dx1; + double m_dy1; + double m_kx; + double m_ky; +}; + +//----------------------------------------------------------------------- +inline void trans_viewport::update() +{ + const double epsilon = 1e-30; + if (std::fabs(m_world_x1 - m_world_x2) < epsilon || std::fabs(m_world_y1 - m_world_y2) < epsilon || + std::fabs(m_device_x1 - m_device_x2) < epsilon || std::fabs(m_device_y1 - m_device_y2) < epsilon) + { + m_wx1 = m_world_x1; + m_wy1 = m_world_y1; + m_wx2 = m_world_x1 + 1.0; + m_wy2 = m_world_y2 + 1.0; + m_dx1 = m_device_x1; + m_dy1 = m_device_y1; + m_kx = 1.0; + m_ky = 1.0; + m_is_valid = false; + return; + } + + double world_x1 = m_world_x1; + double world_y1 = m_world_y1; + double world_x2 = m_world_x2; + double world_y2 = m_world_y2; + double device_x1 = m_device_x1; + double device_y1 = m_device_y1; + double device_x2 = m_device_x2; + double device_y2 = m_device_y2; + if (m_aspect != aspect_ratio_stretch) + { + double d; + m_kx = (device_x2 - device_x1) / (world_x2 - world_x1); + m_ky = (device_y2 - device_y1) / (world_y2 - world_y1); + + if ((m_aspect == aspect_ratio_meet) == (m_kx < m_ky)) + { + d = (world_y2 - world_y1) * m_ky / m_kx; + world_y1 += (world_y2 - world_y1 - d) * m_align_y; + world_y2 = world_y1 + d; + } + else + { + d = (world_x2 - world_x1) * m_kx / m_ky; + world_x1 += (world_x2 - world_x1 - d) * m_align_x; + world_x2 = world_x1 + d; + } + } + m_wx1 = world_x1; + m_wy1 = world_y1; + m_wx2 = world_x2; + m_wy2 = world_y2; + m_dx1 = device_x1; + m_dy1 = device_y1; + m_kx = (device_x2 - device_x1) / (world_x2 - world_x1); + m_ky = (device_y2 - device_y1) / (world_y2 - world_y1); + m_is_valid = true; } +} // namespace agg #endif diff --git a/deps/agg/include/agg_trans_warp_magnifier.h b/deps/agg/include/agg_trans_warp_magnifier.h index 38a92dbec..cbc033058 100644 --- a/deps/agg/include/agg_trans_warp_magnifier.h +++ b/deps/agg/include/agg_trans_warp_magnifier.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -16,41 +16,45 @@ #ifndef AGG_WARP_MAGNIFIER_INCLUDED #define AGG_WARP_MAGNIFIER_INCLUDED +namespace agg { -namespace agg +//----------------------------------------------------trans_warp_magnifier +// +// See Inmplementation agg_trans_warp_magnifier.cpp +// +class trans_warp_magnifier { + public: + trans_warp_magnifier() + : m_xc(0.0) + , m_yc(0.0) + , m_magn(1.0) + , m_radius(1.0) + {} - //----------------------------------------------------trans_warp_magnifier - // - // See Inmplementation agg_trans_warp_magnifier.cpp - // - class trans_warp_magnifier + void center(double x, double y) { - public: - trans_warp_magnifier() : m_xc(0.0), m_yc(0.0), m_magn(1.0), m_radius(1.0) {} - - void center(double x, double y) { m_xc = x; m_yc = y; } - void magnification(double m) { m_magn = m; } - void radius(double r) { m_radius = r; } + m_xc = x; + m_yc = y; + } + void magnification(double m) { m_magn = m; } + void radius(double r) { m_radius = r; } - double xc() const { return m_xc; } - double yc() const { return m_yc; } - double magnification() const { return m_magn; } - double radius() const { return m_radius; } + double xc() const { return m_xc; } + double yc() const { return m_yc; } + double magnification() const { return m_magn; } + double radius() const { return m_radius; } - void transform(double* x, double* y) const; - void inverse_transform(double* x, double* y) const; + void transform(double* x, double* y) const; + void inverse_transform(double* x, double* y) const; - private: - double m_xc; - double m_yc; - double m_magn; - double m_radius; - }; - - -} + private: + double m_xc; + double m_yc; + double m_magn; + double m_radius; +}; +} // namespace agg #endif - diff --git a/deps/agg/include/agg_vcgen_bspline.h b/deps/agg/include/agg_vcgen_bspline.h index a2944548c..8777645d7 100644 --- a/deps/agg/include/agg_vcgen_bspline.h +++ b/deps/agg/include/agg_vcgen_bspline.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -20,55 +20,44 @@ #include "agg_array.h" #include "agg_bspline.h" +namespace agg { -namespace agg +//==========================================================vcgen_bspline +class vcgen_bspline { + enum status_e { initial, ready, polygon, end_poly, stop }; - //==========================================================vcgen_bspline - class vcgen_bspline - { - enum status_e - { - initial, - ready, - polygon, - end_poly, - stop - }; + public: + typedef pod_bvector vertex_storage; - public: - typedef pod_bvector vertex_storage; + vcgen_bspline(); - vcgen_bspline(); + void interpolation_step(double v) { m_interpolation_step = v; } + double interpolation_step() const { return m_interpolation_step; } - void interpolation_step(double v) { m_interpolation_step = v; } - double interpolation_step() const { return m_interpolation_step; } + // Vertex Generator Interface + void remove_all(); + void add_vertex(double x, double y, unsigned cmd); - // Vertex Generator Interface - void remove_all(); - void add_vertex(double x, double y, unsigned cmd); + // Vertex Source Interface + void rewind(unsigned path_id); + unsigned vertex(double* x, double* y); - // Vertex Source Interface - void rewind(unsigned path_id); - unsigned vertex(double* x, double* y); + private: + vcgen_bspline(const vcgen_bspline&); + const vcgen_bspline& operator=(const vcgen_bspline&); - private: - vcgen_bspline(const vcgen_bspline&); - const vcgen_bspline& operator = (const vcgen_bspline&); - - vertex_storage m_src_vertices; - bspline m_spline_x; - bspline m_spline_y; - double m_interpolation_step; - unsigned m_closed; - status_e m_status; - unsigned m_src_vertex; - double m_cur_abscissa; - double m_max_abscissa; - }; - -} + vertex_storage m_src_vertices; + bspline m_spline_x; + bspline m_spline_y; + double m_interpolation_step; + unsigned m_closed; + status_e m_status; + unsigned m_src_vertex; + double m_cur_abscissa; + double m_max_abscissa; +}; +} // namespace agg #endif - diff --git a/deps/agg/include/agg_vcgen_contour.h b/deps/agg/include/agg_vcgen_contour.h index 13318fd27..65da8c36b 100644 --- a/deps/agg/include/agg_vcgen_contour.h +++ b/deps/agg/include/agg_vcgen_contour.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -19,77 +19,68 @@ #include "agg_math_stroke.h" #include -namespace agg +namespace agg { + +//----------------------------------------------------------vcgen_contour +// +// See Implementation agg_vcgen_contour.cpp +// +class MAPNIK_DECL vcgen_contour { + enum status_e { initial, ready, outline, out_vertices, end_poly, stop }; - //----------------------------------------------------------vcgen_contour - // - // See Implementation agg_vcgen_contour.cpp - // - class MAPNIK_DECL vcgen_contour - { - enum status_e - { - initial, - ready, - outline, - out_vertices, - end_poly, - stop - }; + public: + typedef vertex_sequence vertex_storage; + typedef pod_bvector coord_storage; - public: - typedef vertex_sequence vertex_storage; - typedef pod_bvector coord_storage; + vcgen_contour(); - vcgen_contour(); + void line_cap(line_cap_e lc) { m_stroker.line_cap(lc); } + void line_join(line_join_e lj) { m_stroker.line_join(lj); } + void inner_join(inner_join_e ij) { m_stroker.inner_join(ij); } - void line_cap(line_cap_e lc) { m_stroker.line_cap(lc); } - void line_join(line_join_e lj) { m_stroker.line_join(lj); } - void inner_join(inner_join_e ij) { m_stroker.inner_join(ij); } + line_cap_e line_cap() const { return m_stroker.line_cap(); } + line_join_e line_join() const { return m_stroker.line_join(); } + inner_join_e inner_join() const { return m_stroker.inner_join(); } - line_cap_e line_cap() const { return m_stroker.line_cap(); } - line_join_e line_join() const { return m_stroker.line_join(); } - inner_join_e inner_join() const { return m_stroker.inner_join(); } + void width(double w) { m_stroker.width(m_width = w); } + void miter_limit(double ml) { m_stroker.miter_limit(ml); } + void miter_limit_theta(double t) { m_stroker.miter_limit_theta(t); } + void inner_miter_limit(double ml) { m_stroker.inner_miter_limit(ml); } + void approximation_scale(double as) { m_stroker.approximation_scale(as); } - void width(double w) { m_stroker.width(m_width = w); } - void miter_limit(double ml) { m_stroker.miter_limit(ml); } - void miter_limit_theta(double t) { m_stroker.miter_limit_theta(t); } - void inner_miter_limit(double ml) { m_stroker.inner_miter_limit(ml); } - void approximation_scale(double as) { m_stroker.approximation_scale(as); } + double width() const { return m_width; } + double miter_limit() const { return m_stroker.miter_limit(); } + double inner_miter_limit() const { return m_stroker.inner_miter_limit(); } + double approximation_scale() const { return m_stroker.approximation_scale(); } - double width() const { return m_width; } - double miter_limit() const { return m_stroker.miter_limit(); } - double inner_miter_limit() const { return m_stroker.inner_miter_limit(); } - double approximation_scale() const { return m_stroker.approximation_scale(); } + void auto_detect_orientation(bool v) { m_auto_detect = v; } + bool auto_detect_orientation() const { return m_auto_detect; } - void auto_detect_orientation(bool v) { m_auto_detect = v; } - bool auto_detect_orientation() const { return m_auto_detect; } + // Generator interface + void remove_all(); + void add_vertex(double x, double y, unsigned cmd); - // Generator interface - void remove_all(); - void add_vertex(double x, double y, unsigned cmd); + // Vertex Source Interface + void rewind(unsigned path_id); + unsigned vertex(double* x, double* y); - // Vertex Source Interface - void rewind(unsigned path_id); - unsigned vertex(double* x, double* y); + private: + vcgen_contour(const vcgen_contour&); + const vcgen_contour& operator=(const vcgen_contour&); - private: - vcgen_contour(const vcgen_contour&); - const vcgen_contour& operator = (const vcgen_contour&); + math_stroke m_stroker; + double m_width; + vertex_storage m_src_vertices; + coord_storage m_out_vertices; + status_e m_status; + unsigned m_src_vertex; + unsigned m_out_vertex; + unsigned m_closed; + unsigned m_orientation; + bool m_auto_detect; +}; - math_stroke m_stroker; - double m_width; - vertex_storage m_src_vertices; - coord_storage m_out_vertices; - status_e m_status; - unsigned m_src_vertex; - unsigned m_out_vertex; - unsigned m_closed; - unsigned m_orientation; - bool m_auto_detect; - }; - -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_vcgen_dash.h b/deps/agg/include/agg_vcgen_dash.h index f531013ba..a320c54a3 100644 --- a/deps/agg/include/agg_vcgen_dash.h +++ b/deps/agg/include/agg_vcgen_dash.h @@ -23,72 +23,61 @@ #include "agg_vertex_sequence.h" #include -namespace agg +namespace agg { + +//---------------------------------------------------------------vcgen_dash +// +// See Implementation agg_vcgen_dash.cpp +// +class MAPNIK_DECL vcgen_dash { + enum max_dashes_e { max_dashes = 32 }; - //---------------------------------------------------------------vcgen_dash - // - // See Implementation agg_vcgen_dash.cpp - // - class MAPNIK_DECL vcgen_dash - { - enum max_dashes_e - { - max_dashes = 32 - }; + enum status_e { initial, ready, polyline, stop }; - enum status_e - { - initial, - ready, - polyline, - stop - }; + public: + typedef vertex_sequence vertex_storage; - public: - typedef vertex_sequence vertex_storage; + vcgen_dash(); - vcgen_dash(); + void remove_all_dashes(); + void add_dash(double dash_len, double gap_len); + void dash_start(double ds); - void remove_all_dashes(); - void add_dash(double dash_len, double gap_len); - void dash_start(double ds); + void shorten(double s) { m_shorten = s; } + double shorten() const { return m_shorten; } - void shorten(double s) { m_shorten = s; } - double shorten() const { return m_shorten; } + // Vertex Generator Interface + void remove_all(); + void add_vertex(double x, double y, unsigned cmd); - // Vertex Generator Interface - void remove_all(); - void add_vertex(double x, double y, unsigned cmd); + // Vertex Source Interface + void rewind(unsigned path_id); + unsigned vertex(double* x, double* y); - // Vertex Source Interface - void rewind(unsigned path_id); - unsigned vertex(double* x, double* y); + private: + vcgen_dash(const vcgen_dash&); + const vcgen_dash& operator=(const vcgen_dash&); - private: - vcgen_dash(const vcgen_dash&); - const vcgen_dash& operator = (const vcgen_dash&); + void calc_dash_start(double ds); - void calc_dash_start(double ds); + double m_dashes[max_dashes]; + double m_total_dash_len; + unsigned m_num_dashes; + double m_dash_start; + double m_shorten; + double m_curr_dash_start; + unsigned m_curr_dash; + double m_curr_rest; + const vertex_dist* m_v1; + const vertex_dist* m_v2; - double m_dashes[max_dashes]; - double m_total_dash_len; - unsigned m_num_dashes; - double m_dash_start; - double m_shorten; - double m_curr_dash_start; - unsigned m_curr_dash; - double m_curr_rest; - const vertex_dist* m_v1; - const vertex_dist* m_v2; + vertex_storage m_src_vertices; + unsigned m_closed; + status_e m_status; + unsigned m_src_vertex; +}; - vertex_storage m_src_vertices; - unsigned m_closed; - status_e m_status; - unsigned m_src_vertex; - }; - - -} +} // namespace agg #endif diff --git a/deps/agg/include/agg_vcgen_markers_term.h b/deps/agg/include/agg_vcgen_markers_term.h index ee1e74e3e..66c7f444d 100644 --- a/deps/agg/include/agg_vcgen_markers_term.h +++ b/deps/agg/include/agg_vcgen_markers_term.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -19,48 +19,52 @@ #include "agg_basics.h" #include "agg_vertex_sequence.h" -namespace agg +namespace agg { + +//======================================================vcgen_markers_term +// +// See Implemantation agg_vcgen_markers_term.cpp +// Terminal markers generator (arrowhead/arrowtail) +// +//------------------------------------------------------------------------ +class vcgen_markers_term { + public: + vcgen_markers_term() + : m_curr_id(0) + , m_curr_idx(0) + {} - //======================================================vcgen_markers_term - // - // See Implemantation agg_vcgen_markers_term.cpp - // Terminal markers generator (arrowhead/arrowtail) - // - //------------------------------------------------------------------------ - class vcgen_markers_term + // Vertex Generator Interface + void remove_all(); + void add_vertex(double x, double y, unsigned cmd); + + // Vertex Source Interface + void rewind(unsigned path_id); + unsigned vertex(double* x, double* y); + + private: + vcgen_markers_term(const vcgen_markers_term&); + const vcgen_markers_term& operator=(const vcgen_markers_term&); + + struct coord_type { - public: - vcgen_markers_term() : m_curr_id(0), m_curr_idx(0) {} + double x, y; - // Vertex Generator Interface - void remove_all(); - void add_vertex(double x, double y, unsigned cmd); - - // Vertex Source Interface - void rewind(unsigned path_id); - unsigned vertex(double* x, double* y); - - private: - vcgen_markers_term(const vcgen_markers_term&); - const vcgen_markers_term& operator = (const vcgen_markers_term&); - - struct coord_type - { - double x, y; - - coord_type() {} - coord_type(double x_, double y_) : x(x_), y(y_) {} - }; - - typedef pod_bvector coord_storage; - - coord_storage m_markers; - unsigned m_curr_id; - unsigned m_curr_idx; + coord_type() {} + coord_type(double x_, double y_) + : x(x_) + , y(y_) + {} }; + typedef pod_bvector coord_storage; -} + coord_storage m_markers; + unsigned m_curr_id; + unsigned m_curr_idx; +}; + +} // namespace agg #endif diff --git a/deps/agg/include/agg_vcgen_smooth_poly1.h b/deps/agg/include/agg_vcgen_smooth_poly1.h index ad08a98de..fa8aea4cb 100644 --- a/deps/agg/include/agg_vcgen_smooth_poly1.h +++ b/deps/agg/include/agg_vcgen_smooth_poly1.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -19,109 +19,99 @@ #include "agg_basics.h" #include "agg_vertex_sequence.h" +namespace agg { -namespace agg +//======================================================vcgen_smooth +// +// Smooth polygon generator +// +//------------------------------------------------------------------------ +template +class vcgen_smooth { + enum status_e { initial, ready, polygon, ctrl_b, ctrl_e, ctrl1, ctrl2, end_poly, stop }; - //======================================================vcgen_smooth - // - // Smooth polygon generator - // - //------------------------------------------------------------------------ - template - class vcgen_smooth + public: + typedef vertex_sequence vertex_storage; + + vcgen_smooth() + : m_src_vertices() + , m_smooth_value(0.5) + , m_closed(0) + , m_status(initial) + , m_src_vertex(0) + {} + + vcgen_smooth(vcgen_smooth&&) = default; + + void smooth_value(double v) { m_smooth_value = v * 0.5; } + double smooth_value() const { return m_smooth_value * 2.0; } + + // Vertex Generator Interface + void remove_all() { - enum status_e + m_src_vertices.remove_all(); + m_closed = 0; + m_status = initial; + } + + void add_vertex(double x, double y, unsigned cmd) + { + m_status = initial; + if (is_move_to(cmd)) { - initial, - ready, - polygon, - ctrl_b, - ctrl_e, - ctrl1, - ctrl2, - end_poly, - stop - }; - - public: - typedef vertex_sequence vertex_storage; - - vcgen_smooth() : - m_src_vertices(), - m_smooth_value(0.5), - m_closed(0), - m_status(initial), - m_src_vertex(0) { } - - vcgen_smooth(vcgen_smooth &&) = default; - - void smooth_value(double v) { m_smooth_value = v * 0.5; } - double smooth_value() const { return m_smooth_value * 2.0; } - - // Vertex Generator Interface - void remove_all() - { - m_src_vertices.remove_all(); - m_closed = 0; - m_status = initial; + m_src_vertices.modify_last(vertex_dist(x, y)); } - - void add_vertex(double x, double y, unsigned cmd) + else { - m_status = initial; - if(is_move_to(cmd)) + if (is_vertex(cmd)) { - m_src_vertices.modify_last(vertex_dist(x, y)); + m_src_vertices.add(vertex_dist(x, y)); } else { - if(is_vertex(cmd)) - { - m_src_vertices.add(vertex_dist(x, y)); - } - else - { - m_closed = get_close_flag(cmd); - } + m_closed = get_close_flag(cmd); } } + } - // Vertex Source Interface - void rewind(unsigned) + // Vertex Source Interface + void rewind(unsigned) + { + if (m_status == initial) { - if(m_status == initial) - { - m_src_vertices.close(m_closed != 0); - } - m_status = ready; - m_src_vertex = 0; + m_src_vertices.close(m_closed != 0); } + m_status = ready; + m_src_vertex = 0; + } - unsigned vertex(double* x, double* y) + unsigned vertex(double* x, double* y) + { + unsigned cmd = path_cmd_line_to; + while (!is_stop(cmd)) { - unsigned cmd = path_cmd_line_to; - while(!is_stop(cmd)) + switch (m_status) { - switch(m_status) - { case initial: rewind(0); case ready: - if(m_src_vertices.size() < 2) + if (m_src_vertices.size() < 2) { cmd = path_cmd_stop; break; } - if(m_src_vertices.size() == 2) + if (m_src_vertices.size() == 2) { *x = m_src_vertices[m_src_vertex].x; *y = m_src_vertices[m_src_vertex].y; m_src_vertex++; - if(m_src_vertex == 1) return path_cmd_move_to; - if(m_src_vertex == 2) return path_cmd_line_to; + if (m_src_vertex == 1) + return path_cmd_move_to; + if (m_src_vertex == 2) + return path_cmd_line_to; cmd = path_cmd_stop; break; } @@ -131,9 +121,9 @@ namespace agg m_src_vertex = 0; case polygon: - if(m_closed) + if (m_closed) { - if(m_src_vertex >= m_src_vertices.size()) + if (m_src_vertex >= m_src_vertices.size()) { *x = m_src_vertices[0].x; *y = m_src_vertices[0].y; @@ -143,7 +133,7 @@ namespace agg } else { - if(m_src_vertex >= m_src_vertices.size() - 1) + if (m_src_vertex >= m_src_vertices.size() - 1) { *x = m_src_vertices[m_src_vertices.size() - 1].x; *y = m_src_vertices[m_src_vertices.size() - 1].y; @@ -152,32 +142,29 @@ namespace agg } } - std::tie(m_ctrl1, m_ctrl2) = Calculate::apply( - m_src_vertices.prev(m_src_vertex), - m_src_vertices.curr(m_src_vertex), - m_src_vertices.next(m_src_vertex), - m_src_vertices.next(m_src_vertex + 1), - m_smooth_value); + std::tie(m_ctrl1, m_ctrl2) = Calculate::apply(m_src_vertices.prev(m_src_vertex), + m_src_vertices.curr(m_src_vertex), + m_src_vertices.next(m_src_vertex), + m_src_vertices.next(m_src_vertex + 1), + m_smooth_value); *x = m_src_vertices[m_src_vertex].x; *y = m_src_vertices[m_src_vertex].y; m_src_vertex++; - if(m_closed) + if (m_closed) { m_status = ctrl1; - return ((m_src_vertex == 1) ? - path_cmd_move_to : - path_cmd_curve4); + return ((m_src_vertex == 1) ? path_cmd_move_to : path_cmd_curve4); } else { - if(m_src_vertex == 1) + if (m_src_vertex == 1) { m_status = ctrl_b; return path_cmd_move_to; } - if(m_src_vertex >= m_src_vertices.size() - 1) + if (m_src_vertex >= m_src_vertices.size() - 1) { m_status = ctrl_e; return path_cmd_curve3; @@ -217,55 +204,49 @@ namespace agg case stop: return path_cmd_stop; - } } - return cmd; } + return cmd; + } - private: - vcgen_smooth(const vcgen_smooth&); - const vcgen_smooth& operator = (const vcgen_smooth&); + private: + vcgen_smooth(const vcgen_smooth&); + const vcgen_smooth& operator=(const vcgen_smooth&); - vertex_storage m_src_vertices; - double m_smooth_value; - unsigned m_closed; - status_e m_status; - unsigned m_src_vertex; - point_d m_ctrl1; - point_d m_ctrl2; - }; + vertex_storage m_src_vertices; + double m_smooth_value; + unsigned m_closed; + status_e m_status; + unsigned m_src_vertex; + point_d m_ctrl1; + point_d m_ctrl2; +}; - struct calculate_poly1 +struct calculate_poly1 +{ + using result_type = std::pair; + + static result_type apply(const vertex_dist& v0, + const vertex_dist& v1, + const vertex_dist& v2, + const vertex_dist& v3, + double smooth_value) { - using result_type = std::pair; + double k1 = v0.dist / (v0.dist + v1.dist); + double k2 = v1.dist / (v1.dist + v2.dist); - static result_type apply(const vertex_dist& v0, - const vertex_dist& v1, - const vertex_dist& v2, - const vertex_dist& v3, - double smooth_value) - { - double k1 = v0.dist / (v0.dist + v1.dist); - double k2 = v1.dist / (v1.dist + v2.dist); + double xm1 = v0.x + (v2.x - v0.x) * k1; + double ym1 = v0.y + (v2.y - v0.y) * k1; + double xm2 = v1.x + (v3.x - v1.x) * k2; + double ym2 = v1.y + (v3.y - v1.y) * k2; - double xm1 = v0.x + (v2.x - v0.x) * k1; - double ym1 = v0.y + (v2.y - v0.y) * k1; - double xm2 = v1.x + (v3.x - v1.x) * k2; - double ym2 = v1.y + (v3.y - v1.y) * k2; + return {{v1.x + smooth_value * (v2.x - xm1), v1.y + smooth_value * (v2.y - ym1)}, + {v2.x + smooth_value * (v1.x - xm2), v2.y + smooth_value * (v1.y - ym2)}}; + } +}; - return { - {v1.x + smooth_value * (v2.x - xm1), - v1.y + smooth_value * (v2.y - ym1)}, - {v2.x + smooth_value * (v1.x - xm2), - v2.y + smooth_value * (v1.y - ym2)} - }; - } - }; - - using vcgen_smooth_poly1 = vcgen_smooth; - -} +using vcgen_smooth_poly1 = vcgen_smooth; +} // namespace agg #endif - diff --git a/deps/agg/include/agg_vcgen_stroke.h b/deps/agg/include/agg_vcgen_stroke.h index 0cd806b3d..f2cfc7c64 100644 --- a/deps/agg/include/agg_vcgen_stroke.h +++ b/deps/agg/include/agg_vcgen_stroke.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -19,84 +19,81 @@ #include "agg_math_stroke.h" #include -namespace agg +namespace agg { + +//============================================================vcgen_stroke +// +// See Implementation agg_vcgen_stroke.cpp +// Stroke generator +// +//------------------------------------------------------------------------ +class MAPNIK_DECL vcgen_stroke { - - //============================================================vcgen_stroke - // - // See Implementation agg_vcgen_stroke.cpp - // Stroke generator - // - //------------------------------------------------------------------------ - class MAPNIK_DECL vcgen_stroke - { - enum status_e - { - initial, - ready, - cap1, - cap2, - outline1, - close_first, - outline2, - out_vertices, - end_poly1, - end_poly2, - stop - }; - - public: - typedef vertex_sequence vertex_storage; - typedef pod_bvector coord_storage; - - vcgen_stroke(); - - void line_cap(line_cap_e lc) { m_stroker.line_cap(lc); } - void line_join(line_join_e lj) { m_stroker.line_join(lj); } - void inner_join(inner_join_e ij) { m_stroker.inner_join(ij); } - - line_cap_e line_cap() const { return m_stroker.line_cap(); } - line_join_e line_join() const { return m_stroker.line_join(); } - inner_join_e inner_join() const { return m_stroker.inner_join(); } - - void width(double w) { m_stroker.width(w); } - void miter_limit(double ml) { m_stroker.miter_limit(ml); } - void miter_limit_theta(double t) { m_stroker.miter_limit_theta(t); } - void inner_miter_limit(double ml) { m_stroker.inner_miter_limit(ml); } - void approximation_scale(double as) { m_stroker.approximation_scale(as); } - - double width() const { return m_stroker.width(); } - double miter_limit() const { return m_stroker.miter_limit(); } - double inner_miter_limit() const { return m_stroker.inner_miter_limit(); } - double approximation_scale() const { return m_stroker.approximation_scale(); } - - void shorten(double s) { m_shorten = s; } - double shorten() const { return m_shorten; } - - // Vertex Generator Interface - void remove_all(); - void add_vertex(double x, double y, unsigned cmd); - - // Vertex Source Interface - void rewind(unsigned path_id); - unsigned vertex(double* x, double* y); - - private: - vcgen_stroke(const vcgen_stroke&); - const vcgen_stroke& operator = (const vcgen_stroke&); - - math_stroke m_stroker; - vertex_storage m_src_vertices; - coord_storage m_out_vertices; - double m_shorten; - unsigned m_closed; - status_e m_status; - status_e m_prev_status; - unsigned m_src_vertex; - unsigned m_out_vertex; + enum status_e { + initial, + ready, + cap1, + cap2, + outline1, + close_first, + outline2, + out_vertices, + end_poly1, + end_poly2, + stop }; + public: + typedef vertex_sequence vertex_storage; + typedef pod_bvector coord_storage; -} + vcgen_stroke(); + + void line_cap(line_cap_e lc) { m_stroker.line_cap(lc); } + void line_join(line_join_e lj) { m_stroker.line_join(lj); } + void inner_join(inner_join_e ij) { m_stroker.inner_join(ij); } + + line_cap_e line_cap() const { return m_stroker.line_cap(); } + line_join_e line_join() const { return m_stroker.line_join(); } + inner_join_e inner_join() const { return m_stroker.inner_join(); } + + void width(double w) { m_stroker.width(w); } + void miter_limit(double ml) { m_stroker.miter_limit(ml); } + void miter_limit_theta(double t) { m_stroker.miter_limit_theta(t); } + void inner_miter_limit(double ml) { m_stroker.inner_miter_limit(ml); } + void approximation_scale(double as) { m_stroker.approximation_scale(as); } + + double width() const { return m_stroker.width(); } + double miter_limit() const { return m_stroker.miter_limit(); } + double inner_miter_limit() const { return m_stroker.inner_miter_limit(); } + double approximation_scale() const { return m_stroker.approximation_scale(); } + + void shorten(double s) { m_shorten = s; } + double shorten() const { return m_shorten; } + + // Vertex Generator Interface + void remove_all(); + void add_vertex(double x, double y, unsigned cmd); + + // Vertex Source Interface + void rewind(unsigned path_id); + unsigned vertex(double* x, double* y); + + private: + vcgen_stroke(const vcgen_stroke&); + const vcgen_stroke& operator=(const vcgen_stroke&); + + math_stroke m_stroker; + vertex_storage m_src_vertices; + coord_storage m_out_vertices; + double m_shorten; + unsigned m_closed; + status_e m_status; + status_e m_prev_status; + unsigned m_src_vertex; + unsigned m_out_vertex; +}; + +} // namespace agg #endif diff --git a/deps/agg/include/agg_vcgen_vertex_sequence.h b/deps/agg/include/agg_vcgen_vertex_sequence.h index 5adc67159..9baef90d9 100644 --- a/deps/agg/include/agg_vcgen_vertex_sequence.h +++ b/deps/agg/include/agg_vcgen_vertex_sequence.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -20,116 +20,111 @@ #include "agg_vertex_sequence.h" #include "agg_shorten_path.h" -namespace agg +namespace agg { + +//===================================================vcgen_vertex_sequence +class vcgen_vertex_sequence { + public: + typedef vertex_dist_cmd vertex_type; + typedef vertex_sequence vertex_storage; - //===================================================vcgen_vertex_sequence - class vcgen_vertex_sequence + vcgen_vertex_sequence() + : m_flags(0) + , m_cur_vertex(0) + , m_shorten(0.0) + , m_ready(false) + {} + + // Vertex Generator Interface + void remove_all(); + void add_vertex(double x, double y, unsigned cmd); + + // Vertex Source Interface + void rewind(unsigned path_id); + unsigned vertex(double* x, double* y); + + void shorten(double s) { m_shorten = s; } + double shorten() const { return m_shorten; } + + private: + vcgen_vertex_sequence(const vcgen_vertex_sequence&); + const vcgen_vertex_sequence& operator=(const vcgen_vertex_sequence&); + + vertex_storage m_src_vertices; + unsigned m_flags; + unsigned m_cur_vertex; + double m_shorten; + bool m_ready; +}; + +//------------------------------------------------------------------------ +inline void vcgen_vertex_sequence::remove_all() +{ + m_ready = false; + m_src_vertices.remove_all(); + m_cur_vertex = 0; + m_flags = 0; +} + +//------------------------------------------------------------------------ +inline void vcgen_vertex_sequence::add_vertex(double x, double y, unsigned cmd) +{ + m_ready = false; + if (is_move_to(cmd)) { - public: - typedef vertex_dist_cmd vertex_type; - typedef vertex_sequence vertex_storage; - - vcgen_vertex_sequence() : - m_flags(0), - m_cur_vertex(0), - m_shorten(0.0), - m_ready(false) - { - } - - // Vertex Generator Interface - void remove_all(); - void add_vertex(double x, double y, unsigned cmd); - - // Vertex Source Interface - void rewind(unsigned path_id); - unsigned vertex(double* x, double* y); - - void shorten(double s) { m_shorten = s; } - double shorten() const { return m_shorten; } - - private: - vcgen_vertex_sequence(const vcgen_vertex_sequence&); - const vcgen_vertex_sequence& operator = (const vcgen_vertex_sequence&); - - vertex_storage m_src_vertices; - unsigned m_flags; - unsigned m_cur_vertex; - double m_shorten; - bool m_ready; - }; - - - //------------------------------------------------------------------------ - inline void vcgen_vertex_sequence::remove_all() - { - m_ready = false; - m_src_vertices.remove_all(); - m_cur_vertex = 0; - m_flags = 0; + m_src_vertices.modify_last(vertex_dist_cmd(x, y, cmd)); } - - //------------------------------------------------------------------------ - inline void vcgen_vertex_sequence::add_vertex(double x, double y, unsigned cmd) + else { - m_ready = false; - if(is_move_to(cmd)) + if (is_vertex(cmd)) { - m_src_vertices.modify_last(vertex_dist_cmd(x, y, cmd)); + m_src_vertices.add(vertex_dist_cmd(x, y, cmd)); } else { - if(is_vertex(cmd)) - { - m_src_vertices.add(vertex_dist_cmd(x, y, cmd)); - } - else - { - m_flags = cmd & path_flags_mask; - } + m_flags = cmd & path_flags_mask; } } - - - //------------------------------------------------------------------------ - inline void vcgen_vertex_sequence::rewind(unsigned) - { - if(!m_ready) - { - m_src_vertices.close(is_closed(m_flags)); - shorten_path(m_src_vertices, m_shorten, get_close_flag(m_flags)); - } - m_ready = true; - m_cur_vertex = 0; - } - - //------------------------------------------------------------------------ - inline unsigned vcgen_vertex_sequence::vertex(double* x, double* y) - { - if(!m_ready) - { - rewind(0); - } - - if(m_cur_vertex == m_src_vertices.size()) - { - ++m_cur_vertex; - return path_cmd_end_poly | m_flags; - } - - if(m_cur_vertex > m_src_vertices.size()) - { - return path_cmd_stop; - } - - vertex_type& v = m_src_vertices[m_cur_vertex++]; - *x = v.x; - *y = v.y; - return v.cmd; - } - - } +//------------------------------------------------------------------------ +inline void vcgen_vertex_sequence::rewind(unsigned) +{ + if (!m_ready) + { + m_src_vertices.close(is_closed(m_flags)); + shorten_path(m_src_vertices, m_shorten, get_close_flag(m_flags)); + } + m_ready = true; + m_cur_vertex = 0; +} + +//------------------------------------------------------------------------ +inline unsigned vcgen_vertex_sequence::vertex(double* x, double* y) +{ + if (!m_ready) + { + rewind(0); + } + + if (m_cur_vertex == m_src_vertices.size()) + { + ++m_cur_vertex; + return path_cmd_end_poly | m_flags; + } + + if (m_cur_vertex > m_src_vertices.size()) + { + return path_cmd_stop; + } + + vertex_type& v = m_src_vertices[m_cur_vertex++]; + *x = v.x; + *y = v.y; + return v.cmd; +} + +} // namespace agg + #endif diff --git a/deps/agg/include/agg_vertex_sequence.h b/deps/agg/include/agg_vertex_sequence.h index 2ad0701b3..f0b56136d 100644 --- a/deps/agg/include/agg_vertex_sequence.h +++ b/deps/agg/include/agg_vertex_sequence.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -23,150 +23,141 @@ #include "agg_array.h" #include "agg_math.h" -namespace agg +namespace agg { + +//----------------------------------------------------------vertex_sequence +// Modified agg::pod_bvector. The data is interpreted as a sequence +// of vertices. It means that the type T must expose: +// +// bool T::operator() (const T& val) +// +// that is called every time new vertex is being added. The main purpose +// of this operator is the possibility to calculate some values during +// adding and to return true if the vertex fits some criteria or false if +// it doesn't. In the last case the new vertex is not added. +// +// The simple example is filtering coinciding vertices with calculation +// of the distance between the current and previous ones: +// +// struct vertex_dist +// { +// double x; +// double y; +// double dist; +// +// vertex_dist() {} +// vertex_dist(double x_, double y_) : +// x(x_), +// y(y_), +// dist(0.0) +// { +// } +// +// bool operator () (const vertex_dist& val) +// { +// return (dist = calc_distance(x, y, val.x, val.y)) > EPSILON; +// } +// }; +// +// Function close() calls this operator and removes the last vertex if +// necessary. +//------------------------------------------------------------------------ +template +class vertex_sequence : public pod_bvector { + public: + typedef pod_bvector base_type; - //----------------------------------------------------------vertex_sequence - // Modified agg::pod_bvector. The data is interpreted as a sequence - // of vertices. It means that the type T must expose: - // - // bool T::operator() (const T& val) - // - // that is called every time new vertex is being added. The main purpose - // of this operator is the possibility to calculate some values during - // adding and to return true if the vertex fits some criteria or false if - // it doesn't. In the last case the new vertex is not added. - // - // The simple example is filtering coinciding vertices with calculation - // of the distance between the current and previous ones: - // - // struct vertex_dist - // { - // double x; - // double y; - // double dist; - // - // vertex_dist() {} - // vertex_dist(double x_, double y_) : - // x(x_), - // y(y_), - // dist(0.0) - // { - // } - // - // bool operator () (const vertex_dist& val) - // { - // return (dist = calc_distance(x, y, val.x, val.y)) > EPSILON; - // } - // }; - // - // Function close() calls this operator and removes the last vertex if - // necessary. - //------------------------------------------------------------------------ - template - class vertex_sequence : public pod_bvector + void add(const T& val); + void modify_last(const T& val); + void close(bool remove_flag); +}; + +//------------------------------------------------------------------------ +template +void vertex_sequence::add(const T& val) +{ + if (base_type::size() > 1) { - public: - typedef pod_bvector base_type; - - void add(const T& val); - void modify_last(const T& val); - void close(bool remove_flag); - }; - - - - //------------------------------------------------------------------------ - template - void vertex_sequence::add(const T& val) - { - if(base_type::size() > 1) + if (!(*this)[base_type::size() - 2]((*this)[base_type::size() - 1])) { - if(!(*this)[base_type::size() - 2]((*this)[base_type::size() - 1])) - { - base_type::remove_last(); - } - } - base_type::add(val); - } - - - //------------------------------------------------------------------------ - template - void vertex_sequence::modify_last(const T& val) - { - base_type::remove_last(); - add(val); - } - - - - //------------------------------------------------------------------------ - template - void vertex_sequence::close(bool closed) - { - while(base_type::size() > 1) - { - if((*this)[base_type::size() - 2]((*this)[base_type::size() - 1])) break; - T t = (*this)[base_type::size() - 1]; base_type::remove_last(); - modify_last(t); - } - - if(closed) - { - while(base_type::size() > 1) - { - if((*this)[base_type::size() - 1]((*this)[0])) break; - base_type::remove_last(); - } } } - - - //-------------------------------------------------------------vertex_dist - // Vertex (x, y) with the distance to the next one. The last vertex has - // distance between the last and the first points if the polygon is closed - // and 0.0 if it's a polyline. - struct vertex_dist - { - double x; - double y; - double dist; - - vertex_dist() {} - vertex_dist(double x_, double y_) : - x(x_), - y(y_), - dist(0.0) - { - } - - bool operator () (const vertex_dist& val) - { - bool ret = (dist = calc_distance(x, y, val.x, val.y)) > vertex_dist_epsilon; - if(!ret) dist = 1.0 / vertex_dist_epsilon; - return ret; - } - }; - - - - //--------------------------------------------------------vertex_dist_cmd - // Save as the above but with additional "command" value - struct vertex_dist_cmd : public vertex_dist - { - unsigned cmd; - - vertex_dist_cmd() {} - vertex_dist_cmd(double x_, double y_, unsigned cmd_) : - vertex_dist(x_, y_), - cmd(cmd_) - { - } - }; - - + base_type::add(val); } +//------------------------------------------------------------------------ +template +void vertex_sequence::modify_last(const T& val) +{ + base_type::remove_last(); + add(val); +} + +//------------------------------------------------------------------------ +template +void vertex_sequence::close(bool closed) +{ + while (base_type::size() > 1) + { + if ((*this)[base_type::size() - 2]((*this)[base_type::size() - 1])) + break; + T t = (*this)[base_type::size() - 1]; + base_type::remove_last(); + modify_last(t); + } + + if (closed) + { + while (base_type::size() > 1) + { + if ((*this)[base_type::size() - 1]((*this)[0])) + break; + base_type::remove_last(); + } + } +} + +//-------------------------------------------------------------vertex_dist +// Vertex (x, y) with the distance to the next one. The last vertex has +// distance between the last and the first points if the polygon is closed +// and 0.0 if it's a polyline. +struct vertex_dist +{ + double x; + double y; + double dist; + + vertex_dist() {} + vertex_dist(double x_, double y_) + : x(x_) + , y(y_) + , dist(0.0) + {} + + bool operator()(const vertex_dist& val) + { + bool ret = (dist = calc_distance(x, y, val.x, val.y)) > vertex_dist_epsilon; + if (!ret) + dist = 1.0 / vertex_dist_epsilon; + return ret; + } +}; + +//--------------------------------------------------------vertex_dist_cmd +// Save as the above but with additional "command" value +struct vertex_dist_cmd : public vertex_dist +{ + unsigned cmd; + + vertex_dist_cmd() {} + vertex_dist_cmd(double x_, double y_, unsigned cmd_) + : vertex_dist(x_, y_) + , cmd(cmd_) + {} +}; + +} // namespace agg + #endif diff --git a/deps/agg/include/agg_vpgen_clip_polygon.h b/deps/agg/include/agg_vpgen_clip_polygon.h index 7f98538e3..36ef37469 100644 --- a/deps/agg/include/agg_vpgen_clip_polygon.h +++ b/deps/agg/include/agg_vpgen_clip_polygon.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -21,67 +21,63 @@ // https://github.com/mapnik/mapnik/issues/1860 #include -namespace agg +namespace agg { + +//======================================================vpgen_clip_polygon +// +// See Implementation agg_vpgen_clip_polygon.cpp +// + +class MAPNIK_DECL vpgen_clip_polygon { + public: + vpgen_clip_polygon() + : m_clip_box(0, 0, 1, 1) + , m_x1(0) + , m_y1(0) + , m_clip_flags(0) + , m_num_vertices(0) + , m_vertex(0) + , m_cmd(path_cmd_move_to) + {} - //======================================================vpgen_clip_polygon - // - // See Implementation agg_vpgen_clip_polygon.cpp - // - - class MAPNIK_DECL vpgen_clip_polygon + void clip_box(double _x1, double _y1, double _x2, double _y2) { - public: - vpgen_clip_polygon() : - m_clip_box(0, 0, 1, 1), - m_x1(0), - m_y1(0), - m_clip_flags(0), - m_num_vertices(0), - m_vertex(0), - m_cmd(path_cmd_move_to) - { - } + m_clip_box.x1 = _x1; + m_clip_box.y1 = _y1; + m_clip_box.x2 = _x2; + m_clip_box.y2 = _y2; + m_clip_box.normalize(); + } - void clip_box(double _x1, double _y1, double _x2, double _y2) - { - m_clip_box.x1 = _x1; - m_clip_box.y1 = _y1; - m_clip_box.x2 = _x2; - m_clip_box.y2 = _y2; - m_clip_box.normalize(); - } + double x1() const { return m_clip_box.x1; } + double y1() const { return m_clip_box.y1; } + double x2() const { return m_clip_box.x2; } + double y2() const { return m_clip_box.y2; } + static bool auto_close() { return true; } + static bool auto_unclose() { return false; } - double x1() const { return m_clip_box.x1; } - double y1() const { return m_clip_box.y1; } - double x2() const { return m_clip_box.x2; } - double y2() const { return m_clip_box.y2; } + void reset(); + void move_to(double x, double y); + void line_to(double x, double y); + unsigned vertex(double* x, double* y); - static bool auto_close() { return true; } - static bool auto_unclose() { return false; } + private: + unsigned clipping_flags(double x, double y); - void reset(); - void move_to(double x, double y); - void line_to(double x, double y); - unsigned vertex(double* x, double* y); - - private: - unsigned clipping_flags(double x, double y); - - private: - rect_d m_clip_box; - double m_x1; - double m_y1; - unsigned m_clip_flags; - double m_x[4]; - double m_y[4]; - unsigned m_num_vertices; - unsigned m_vertex; - unsigned m_cmd; - }; - -} + private: + rect_d m_clip_box; + double m_x1; + double m_y1; + unsigned m_clip_flags; + double m_x[4]; + double m_y[4]; + unsigned m_num_vertices; + unsigned m_vertex; + unsigned m_cmd; +}; +} // namespace agg #endif diff --git a/deps/agg/include/agg_vpgen_clip_polyline.h b/deps/agg/include/agg_vpgen_clip_polyline.h index c7b18c98a..48fd4d6d8 100644 --- a/deps/agg/include/agg_vpgen_clip_polyline.h +++ b/deps/agg/include/agg_vpgen_clip_polyline.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -21,61 +21,58 @@ // https://github.com/mapnik/mapnik/issues/1860 #include -namespace agg +namespace agg { + +//======================================================vpgen_clip_polyline +// +// See Implementation agg_vpgen_clip_polyline.cpp +// +class MAPNIK_DECL vpgen_clip_polyline { + public: + vpgen_clip_polyline() + : m_clip_box(0, 0, 1, 1) + , m_x1(0) + , m_y1(0) + , m_num_vertices(0) + , m_vertex(0) + , m_move_to(false) + {} - //======================================================vpgen_clip_polyline - // - // See Implementation agg_vpgen_clip_polyline.cpp - // - class MAPNIK_DECL vpgen_clip_polyline + void clip_box(double _x1, double _y1, double _x2, double _y2) { - public: - vpgen_clip_polyline() : - m_clip_box(0, 0, 1, 1), - m_x1(0), - m_y1(0), - m_num_vertices(0), - m_vertex(0), - m_move_to(false) - { - } + m_clip_box.x1 = _x1; + m_clip_box.y1 = _y1; + m_clip_box.x2 = _x2; + m_clip_box.y2 = _y2; + m_clip_box.normalize(); + } - void clip_box(double _x1, double _y1, double _x2, double _y2) - { - m_clip_box.x1 = _x1; - m_clip_box.y1 = _y1; - m_clip_box.x2 = _x2; - m_clip_box.y2 = _y2; - m_clip_box.normalize(); - } + double x1() const { return m_clip_box.x1; } + double y1() const { return m_clip_box.y1; } + double x2() const { return m_clip_box.x2; } + double y2() const { return m_clip_box.y2; } - double x1() const { return m_clip_box.x1; } - double y1() const { return m_clip_box.y1; } - double x2() const { return m_clip_box.x2; } - double y2() const { return m_clip_box.y2; } + static bool auto_close() { return false; } + static bool auto_unclose() { return true; } - static bool auto_close() { return false; } - static bool auto_unclose() { return true; } + void reset(); + void move_to(double x, double y); + void line_to(double x, double y); + unsigned vertex(double* x, double* y); - void reset(); - void move_to(double x, double y); - void line_to(double x, double y); - unsigned vertex(double* x, double* y); - - private: - rect_d m_clip_box; - double m_x1; - double m_y1; - double m_x[2]; - double m_y[2]; - unsigned m_cmd[2]; - unsigned m_num_vertices; - unsigned m_vertex; - bool m_move_to; - }; - -} + private: + rect_d m_clip_box; + double m_x1; + double m_y1; + double m_x[2]; + double m_y[2]; + unsigned m_cmd[2]; + unsigned m_num_vertices; + unsigned m_vertex; + bool m_move_to; +}; +} // namespace agg #endif diff --git a/deps/agg/include/agg_vpgen_segmentator.h b/deps/agg/include/agg_vpgen_segmentator.h index dc98865f7..1d836ec3e 100644 --- a/deps/agg/include/agg_vpgen_segmentator.h +++ b/deps/agg/include/agg_vpgen_segmentator.h @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -19,43 +19,41 @@ #include #include "agg_basics.h" -namespace agg +namespace agg { + +//=======================================================vpgen_segmentator +// +// See Implementation agg_vpgen_segmentator.cpp +// +class vpgen_segmentator { + public: + vpgen_segmentator() + : m_approximation_scale(1.0) + {} - //=======================================================vpgen_segmentator - // - // See Implementation agg_vpgen_segmentator.cpp - // - class vpgen_segmentator - { - public: - vpgen_segmentator() : m_approximation_scale(1.0) {} + void approximation_scale(double s) { m_approximation_scale = s; } + double approximation_scale() const { return m_approximation_scale; } - void approximation_scale(double s) { m_approximation_scale = s; } - double approximation_scale() const { return m_approximation_scale; } + static bool auto_close() { return false; } + static bool auto_unclose() { return false; } - static bool auto_close() { return false; } - static bool auto_unclose() { return false; } + void reset() { m_cmd = path_cmd_stop; } + void move_to(double x, double y); + void line_to(double x, double y); + unsigned vertex(double* x, double* y); - void reset() { m_cmd = path_cmd_stop; } - void move_to(double x, double y); - void line_to(double x, double y); - unsigned vertex(double* x, double* y); + private: + double m_approximation_scale; + double m_x1; + double m_y1; + double m_dx; + double m_dy; + double m_dl; + double m_ddl; + unsigned m_cmd; +}; - private: - double m_approximation_scale; - double m_x1; - double m_y1; - double m_dx; - double m_dy; - double m_dl; - double m_ddl; - unsigned m_cmd; - }; - - - -} +} // namespace agg #endif - diff --git a/deps/agg/src/agg_arc.cpp b/deps/agg/src/agg_arc.cpp index 778fdbeab..d617873b0 100644 --- a/deps/agg/src/agg_arc.cpp +++ b/deps/agg/src/agg_arc.cpp @@ -20,27 +20,25 @@ #include #include "agg_arc.h" - -namespace agg -{ +namespace agg { //------------------------------------------------------------------------ -arc::arc(double x, double y, - double rx, double ry, - double a1, double a2, - bool ccw) : - m_x(x), m_y(y), m_rx(rx), m_ry(ry), m_scale(1.0) +arc::arc(double x, double y, double rx, double ry, double a1, double a2, bool ccw) + : m_x(x) + , m_y(y) + , m_rx(rx) + , m_ry(ry) + , m_scale(1.0) { normalize(a1, a2, ccw); } //------------------------------------------------------------------------ -void arc::init(double x, double y, - double rx, double ry, - double a1, double a2, - bool ccw) +void arc::init(double x, double y, double rx, double ry, double a1, double a2, bool ccw) { - m_x = x; m_y = y; - m_rx = rx; m_ry = ry; + m_x = x; + m_y = y; + m_rx = rx; + m_ry = ry; normalize(a1, a2, ccw); } @@ -48,7 +46,7 @@ void arc::init(double x, double y, void arc::approximation_scale(double s) { m_scale = s; - if(m_initialized) + if (m_initialized) { normalize(m_start, m_end, m_ccw); } @@ -64,8 +62,9 @@ void arc::rewind(unsigned) //------------------------------------------------------------------------ unsigned arc::vertex(double* x, double* y) { - if(is_stop(m_path_cmd)) return path_cmd_stop; - if((m_angle < m_end - m_da/4) != m_ccw) + if (is_stop(m_path_cmd)) + return path_cmd_stop; + if ((m_angle < m_end - m_da / 4) != m_ccw) { *x = m_x + std::cos(m_end) * m_rx; *y = m_y + std::sin(m_end) * m_ry; @@ -88,19 +87,21 @@ void arc::normalize(double a1, double a2, bool ccw) { double ra = (std::fabs(m_rx) + std::fabs(m_ry)) / 2; m_da = std::acos(ra / (ra + 0.125 / m_scale)) * 2; - if(ccw) + if (ccw) { - while(a2 < a1) a2 += pi * 2.0; + while (a2 < a1) + a2 += pi * 2.0; } else { - while(a1 < a2) a1 += pi * 2.0; + while (a1 < a2) + a1 += pi * 2.0; m_da = -m_da; } - m_ccw = ccw; + m_ccw = ccw; m_start = a1; - m_end = a2; + m_end = a2; m_initialized = true; } -} +} // namespace agg diff --git a/deps/agg/src/agg_arrowhead.cpp b/deps/agg/src/agg_arrowhead.cpp index bbcfbba71..37f43688b 100644 --- a/deps/agg/src/agg_arrowhead.cpp +++ b/deps/agg/src/agg_arrowhead.cpp @@ -19,46 +19,48 @@ #include "agg_arrowhead.h" -namespace agg -{ +namespace agg { //------------------------------------------------------------------------ -arrowhead::arrowhead() : - m_head_d1(1.0), - m_head_d2(1.0), - m_head_d3(1.0), - m_head_d4(0.0), - m_tail_d1(1.0), - m_tail_d2(1.0), - m_tail_d3(1.0), - m_tail_d4(0.0), - m_head_flag(false), - m_tail_flag(false), - m_curr_id(0), - m_curr_coord(0) -{ -} - - +arrowhead::arrowhead() + : m_head_d1(1.0) + , m_head_d2(1.0) + , m_head_d3(1.0) + , m_head_d4(0.0) + , m_tail_d1(1.0) + , m_tail_d2(1.0) + , m_tail_d3(1.0) + , m_tail_d4(0.0) + , m_head_flag(false) + , m_tail_flag(false) + , m_curr_id(0) + , m_curr_coord(0) +{} //------------------------------------------------------------------------ void arrowhead::rewind(unsigned path_id) { m_curr_id = path_id; m_curr_coord = 0; - if(path_id == 0) + if (path_id == 0) { - if(!m_tail_flag) + if (!m_tail_flag) { m_cmd[0] = path_cmd_stop; return; } - m_coord[0] = m_tail_d1; m_coord[1] = 0.0; - m_coord[2] = m_tail_d1 - m_tail_d4; m_coord[3] = m_tail_d3; - m_coord[4] = -m_tail_d2 - m_tail_d4; m_coord[5] = m_tail_d3; - m_coord[6] = -m_tail_d2; m_coord[7] = 0.0; - m_coord[8] = -m_tail_d2 - m_tail_d4; m_coord[9] = -m_tail_d3; - m_coord[10] = m_tail_d1 - m_tail_d4; m_coord[11] = -m_tail_d3; + m_coord[0] = m_tail_d1; + m_coord[1] = 0.0; + m_coord[2] = m_tail_d1 - m_tail_d4; + m_coord[3] = m_tail_d3; + m_coord[4] = -m_tail_d2 - m_tail_d4; + m_coord[5] = m_tail_d3; + m_coord[6] = -m_tail_d2; + m_coord[7] = 0.0; + m_coord[8] = -m_tail_d2 - m_tail_d4; + m_coord[9] = -m_tail_d3; + m_coord[10] = m_tail_d1 - m_tail_d4; + m_coord[11] = -m_tail_d3; m_cmd[0] = path_cmd_move_to; m_cmd[1] = path_cmd_line_to; @@ -71,17 +73,21 @@ void arrowhead::rewind(unsigned path_id) return; } - if(path_id == 1) + if (path_id == 1) { - if(!m_head_flag) + if (!m_head_flag) { m_cmd[0] = path_cmd_stop; return; } - m_coord[0] = -m_head_d1; m_coord[1] = 0.0; - m_coord[2] = m_head_d2 + m_head_d4; m_coord[3] = -m_head_d3; - m_coord[4] = m_head_d2; m_coord[5] = 0.0; - m_coord[6] = m_head_d2 + m_head_d4; m_coord[7] = m_head_d3; + m_coord[0] = -m_head_d1; + m_coord[1] = 0.0; + m_coord[2] = m_head_d2 + m_head_d4; + m_coord[3] = -m_head_d3; + m_coord[4] = m_head_d2; + m_coord[5] = 0.0; + m_coord[6] = m_head_d2 + m_head_d4; + m_coord[7] = m_head_d3; m_cmd[0] = path_cmd_move_to; m_cmd[1] = path_cmd_line_to; @@ -93,11 +99,10 @@ void arrowhead::rewind(unsigned path_id) } } - //------------------------------------------------------------------------ unsigned arrowhead::vertex(double* x, double* y) { - if(m_curr_id < 2) + if (m_curr_id < 2) { unsigned curr_idx = m_curr_coord * 2; *x = m_coord[curr_idx]; @@ -107,4 +112,4 @@ unsigned arrowhead::vertex(double* x, double* y) return path_cmd_stop; } -} +} // namespace agg diff --git a/deps/agg/src/agg_bezier_arc.cpp b/deps/agg/src/agg_bezier_arc.cpp index 08ec67cd7..27c892693 100644 --- a/deps/agg/src/agg_bezier_arc.cpp +++ b/deps/agg/src/agg_bezier_arc.cpp @@ -18,12 +18,10 @@ // //---------------------------------------------------------------------------- - #include #include "agg_bezier_arc.h" -namespace agg -{ +namespace agg { // This epsilon is used to prevent us from adding degenerate curves // (converging to a single point). @@ -34,9 +32,7 @@ namespace agg const double bezier_arc_angle_epsilon = 0.01; //------------------------------------------------------------arc_to_bezier -void arc_to_bezier(double cx, double cy, double rx, double ry, - double start_angle, double sweep_angle, - double* curve) +void arc_to_bezier(double cx, double cy, double rx, double ry, double start_angle, double sweep_angle, double* curve) { double x0 = std::cos(sweep_angle / 2.0); double y0 = std::sin(sweep_angle / 2.0); @@ -44,39 +40,36 @@ void arc_to_bezier(double cx, double cy, double rx, double ry, double ty = y0 - tx * x0 / y0; double px[4]; double py[4]; - px[0] = x0; + px[0] = x0; py[0] = -y0; - px[1] = x0 + tx; + px[1] = x0 + tx; py[1] = -ty; - px[2] = x0 + tx; - py[2] = ty; - px[3] = x0; - py[3] = y0; + px[2] = x0 + tx; + py[2] = ty; + px[3] = x0; + py[3] = y0; double sn = std::sin(start_angle + sweep_angle / 2.0); double cs = std::cos(start_angle + sweep_angle / 2.0); unsigned i; - for(i = 0; i < 4; i++) + for (i = 0; i < 4; i++) { - curve[i * 2] = cx + rx * (px[i] * cs - py[i] * sn); + curve[i * 2] = cx + rx * (px[i] * cs - py[i] * sn); curve[i * 2 + 1] = cy + ry * (px[i] * sn + py[i] * cs); } } - - //------------------------------------------------------------------------ -void bezier_arc::init(double x, double y, - double rx, double ry, - double start_angle, - double sweep_angle) +void bezier_arc::init(double x, double y, double rx, double ry, double start_angle, double sweep_angle) { start_angle = fmod(start_angle, 2.0 * pi); - if(sweep_angle >= 2.0 * pi) sweep_angle = 2.0 * pi; - if(sweep_angle <= -2.0 * pi) sweep_angle = -2.0 * pi; + if (sweep_angle >= 2.0 * pi) + sweep_angle = 2.0 * pi; + if (sweep_angle <= -2.0 * pi) + sweep_angle = -2.0 * pi; - if(std::fabs(sweep_angle) < 1e-10) + if (std::fabs(sweep_angle) < 1e-10) { m_num_vertices = 4; m_cmd = path_cmd_line_to; @@ -95,12 +88,12 @@ void bezier_arc::init(double x, double y, bool done = false; do { - if(sweep_angle < 0.0) + if (sweep_angle < 0.0) { - prev_sweep = total_sweep; + prev_sweep = total_sweep; local_sweep = -pi * 0.5; total_sweep -= pi * 0.5; - if(total_sweep <= sweep_angle + bezier_arc_angle_epsilon) + if (total_sweep <= sweep_angle + bezier_arc_angle_epsilon) { local_sweep = sweep_angle - prev_sweep; done = true; @@ -108,42 +101,40 @@ void bezier_arc::init(double x, double y, } else { - prev_sweep = total_sweep; - local_sweep = pi * 0.5; + prev_sweep = total_sweep; + local_sweep = pi * 0.5; total_sweep += pi * 0.5; - if(total_sweep >= sweep_angle - bezier_arc_angle_epsilon) + if (total_sweep >= sweep_angle - bezier_arc_angle_epsilon) { local_sweep = sweep_angle - prev_sweep; done = true; } } - arc_to_bezier(x, y, rx, ry, - start_angle, - local_sweep, - m_vertices + m_num_vertices - 2); + arc_to_bezier(x, y, rx, ry, start_angle, local_sweep, m_vertices + m_num_vertices - 2); m_num_vertices += 6; start_angle += local_sweep; - } - while(!done && m_num_vertices < 26); + } while (!done && m_num_vertices < 26); } - - - //-------------------------------------------------------------------- -void bezier_arc_svg::init(double x0, double y0, - double rx, double ry, +void bezier_arc_svg::init(double x0, + double y0, + double rx, + double ry, double angle, bool large_arc_flag, bool sweep_flag, - double x2, double y2) + double x2, + double y2) { m_radii_ok = true; - if(rx < 0.0) rx = -rx; - if(ry < 0.0) ry = -ry; + if (rx < 0.0) + rx = -rx; + if (ry < 0.0) + ry = -ry; // Calculate the middle point between // the current and the final points @@ -156,7 +147,7 @@ void bezier_arc_svg::init(double x0, double y0, // Calculate (x1, y1) //------------------------ - double x1 = cos_a * dx2 + sin_a * dy2; + double x1 = cos_a * dx2 + sin_a * dy2; double y1 = -sin_a * dx2 + cos_a * dy2; // Ensure radii are large enough @@ -168,22 +159,23 @@ void bezier_arc_svg::init(double x0, double y0, // Check that radii are large enough //------------------------ - double radii_check = px1/prx + py1/pry; - if(radii_check > 1.0) + double radii_check = px1 / prx + py1 / pry; + if (radii_check > 1.0) { rx = sqrt(radii_check) * rx; ry = sqrt(radii_check) * ry; prx = rx * rx; pry = ry * ry; - if(radii_check > 10.0) m_radii_ok = false; + if (radii_check > 10.0) + m_radii_ok = false; } // Calculate (cx1, cy1) //------------------------ double sign = (large_arc_flag == sweep_flag) ? -1.0 : 1.0; - double sq = (prx*pry - prx*py1 - pry*px1) / (prx*py1 + pry*px1); + double sq = (prx * pry - prx * py1 - pry * px1) / (prx * py1 + pry * px1); double coef = sign * sqrt((sq < 0) ? 0 : sq); - double cx1 = coef * ((rx * y1) / ry); - double cy1 = coef * -((ry * x1) / rx); + double cx1 = coef * ((rx * y1) / ry); + double cy1 = coef * -((ry * x1) / rx); // // Calculate (cx, cy) from (cx1, cy1) @@ -195,33 +187,38 @@ void bezier_arc_svg::init(double x0, double y0, // Calculate the start_angle (angle1) and the sweep_angle (dangle) //------------------------ - double ux = (x1 - cx1) / rx; - double uy = (y1 - cy1) / ry; + double ux = (x1 - cx1) / rx; + double uy = (y1 - cy1) / ry; double vx = (-x1 - cx1) / rx; double vy = (-y1 - cy1) / ry; double p, n; // Calculate the angle start //------------------------ - n = sqrt(ux*ux + uy*uy); + n = sqrt(ux * ux + uy * uy); p = ux; // (1 * ux) + (0 * uy) sign = (uy < 0) ? -1.0 : 1.0; double v = p / n; - if(v < -1.0) v = -1.0; - if(v > 1.0) v = 1.0; + if (v < -1.0) + v = -1.0; + if (v > 1.0) + v = 1.0; double start_angle = sign * std::acos(v); // Calculate the sweep angle //------------------------ - n = sqrt((ux*ux + uy*uy) * (vx*vx + vy*vy)); + n = sqrt((ux * ux + uy * uy) * (vx * vx + vy * vy)); p = ux * vx + uy * vy; sign = (ux * vy - uy * vx < 0) ? -1.0 : 1.0; v = p / n; - if(v < -1.0) v = -1.0; - if(v > 1.0) v = 1.0; + if (v < -1.0) + v = -1.0; + if (v > 1.0) + v = 1.0; double sweep_angle = sign * std::acos(v); - if (std::fabs(sweep_angle) < pi * 1e-6) m_radii_ok = false; - if(!sweep_flag && sweep_angle > 0) + if (std::fabs(sweep_angle) < pi * 1e-6) + m_radii_ok = false; + if (!sweep_flag && sweep_angle > 0) { sweep_angle -= pi * 2.0; } @@ -236,7 +233,7 @@ void bezier_arc_svg::init(double x0, double y0, trans_affine mtx = trans_affine_rotation(angle); mtx *= trans_affine_translation(cx, cy); - for(unsigned i = 2; i < m_arc.num_vertices()-2; i += 2) + for (unsigned i = 2; i < m_arc.num_vertices() - 2; i += 2) { mtx.transform(m_arc.vertices() + i, m_arc.vertices() + i + 1); } @@ -245,12 +242,11 @@ void bezier_arc_svg::init(double x0, double y0, // exactly coincide with the initial (x0,y0) and (x2,y2) m_arc.vertices()[0] = x0; m_arc.vertices()[1] = y0; - if(m_arc.num_vertices() > 2) + if (m_arc.num_vertices() > 2) { m_arc.vertices()[m_arc.num_vertices() - 2] = x2; m_arc.vertices()[m_arc.num_vertices() - 1] = y2; } } - -} +} // namespace agg diff --git a/deps/agg/src/agg_bspline.cpp b/deps/agg/src/agg_bspline.cpp index 7caa4e521..86c96e63a 100644 --- a/deps/agg/src/agg_bspline.cpp +++ b/deps/agg/src/agg_bspline.cpp @@ -19,60 +19,56 @@ #include "agg_bspline.h" -namespace agg -{ +namespace agg { //------------------------------------------------------------------------ -bspline::bspline() : - m_max(0), - m_num(0), - m_x(0), - m_y(0), - m_last_idx(-1) -{ -} +bspline::bspline() + : m_max(0) + , m_num(0) + , m_x(0) + , m_y(0) + , m_last_idx(-1) +{} //------------------------------------------------------------------------ -bspline::bspline(int num) : - m_max(0), - m_num(0), - m_x(0), - m_y(0), - m_last_idx(-1) +bspline::bspline(int num) + : m_max(0) + , m_num(0) + , m_x(0) + , m_y(0) + , m_last_idx(-1) { init(num); } //------------------------------------------------------------------------ -bspline::bspline(int num, const double* x, const double* y) : - m_max(0), - m_num(0), - m_x(0), - m_y(0), - m_last_idx(-1) +bspline::bspline(int num, const double* x, const double* y) + : m_max(0) + , m_num(0) + , m_x(0) + , m_y(0) + , m_last_idx(-1) { init(num, x, y); } - //------------------------------------------------------------------------ void bspline::init(int max) { - if(max > 2 && max > m_max) + if (max > 2 && max > m_max) { m_am.resize(max * 3); m_max = max; - m_x = &m_am[m_max]; - m_y = &m_am[m_max * 2]; + m_x = &m_am[m_max]; + m_y = &m_am[m_max * 2]; } m_num = 0; m_last_idx = -1; } - //------------------------------------------------------------------------ void bspline::add_point(double x, double y) { - if(m_num < m_max) + if (m_num < m_max) { m_x[m_num] = x; m_y[m_num] = y; @@ -80,11 +76,10 @@ void bspline::add_point(double x, double y) } } - //------------------------------------------------------------------------ void bspline::prepare() { - if(m_num > 2) + if (m_num > 2) { int i, k, n1; double* temp; @@ -92,7 +87,7 @@ void bspline::prepare() double* s; double h, p, d, f, e; - for(k = 0; k < m_num; k++) + for (k = 0; k < m_num; k++) { m_am[k] = 0.0; } @@ -102,7 +97,7 @@ void bspline::prepare() pod_array al(n1); temp = &al[0]; - for(k = 0; k < n1; k++) + for (k = 0; k < n1; k++) { temp[k] = 0.0; } @@ -114,47 +109,45 @@ void bspline::prepare() d = m_x[1] - m_x[0]; e = (m_y[1] - m_y[0]) / d; - for(k = 1; k < n1; k++) + for (k = 1; k < n1; k++) { - h = d; - d = m_x[k + 1] - m_x[k]; - f = e; - e = (m_y[k + 1] - m_y[k]) / d; + h = d; + d = m_x[k + 1] - m_x[k]; + f = e; + e = (m_y[k + 1] - m_y[k]) / d; al[k] = d / (d + h); - r[k] = 1.0 - al[k]; - s[k] = 6.0 * (e - f) / (h + d); + r[k] = 1.0 - al[k]; + s[k] = 6.0 * (e - f) / (h + d); } - for(k = 1; k < n1; k++) + for (k = 1; k < n1; k++) { p = 1.0 / (r[k] * al[k - 1] + 2.0); al[k] *= -p; s[k] = (s[k] - r[k] * s[k - 1]) * p; } - m_am[n1] = 0.0; - al[n1 - 1] = s[n1 - 1]; + m_am[n1] = 0.0; + al[n1 - 1] = s[n1 - 1]; m_am[n1 - 1] = al[n1 - 1]; - for(k = n1 - 2, i = 0; i < m_num - 2; i++, k--) + for (k = n1 - 2, i = 0; i < m_num - 2; i++, k--) { - al[k] = al[k] * al[k + 1] + s[k]; + al[k] = al[k] * al[k + 1] + s[k]; m_am[k] = al[k]; } } m_last_idx = -1; } - - //------------------------------------------------------------------------ void bspline::init(int num, const double* x, const double* y) { - if(num > 2) + if (num > 2) { init(num); int i; - for(i = 0; i < num; i++) + for (i = 0; i < num; i++) { add_point(*x++, *y++); } @@ -163,22 +156,21 @@ void bspline::init(int num, const double* x, const double* y) m_last_idx = -1; } - //------------------------------------------------------------------------ -void bspline::bsearch(int n, const double *x, double x0, int *i) +void bspline::bsearch(int n, const double* x, double x0, int* i) { int j = n - 1; int k; - for(*i = 0; (j - *i) > 1; ) + for (*i = 0; (j - *i) > 1;) { - if(x0 < x[k = (*i + j) >> 1]) j = k; - else *i = k; + if (x0 < x[k = (*i + j) >> 1]) + j = k; + else + *i = k; } } - - //------------------------------------------------------------------------ double bspline::interpolation(double x, int i) const { @@ -188,40 +180,37 @@ double bspline::interpolation(double x, int i) const double r = m_x[i] - x; double p = d * d / 6.0; return (m_am[j] * r * r * r + m_am[i] * h * h * h) / 6.0 / d + - ((m_y[j] - m_am[j] * p) * r + (m_y[i] - m_am[i] * p) * h) / d; + ((m_y[j] - m_am[j] * p) * r + (m_y[i] - m_am[i] * p) * h) / d; } - //------------------------------------------------------------------------ double bspline::extrapolation_left(double x) const { double d = m_x[1] - m_x[0]; - return (-d * m_am[1] / 6 + (m_y[1] - m_y[0]) / d) * - (x - m_x[0]) + - m_y[0]; + return (-d * m_am[1] / 6 + (m_y[1] - m_y[0]) / d) * (x - m_x[0]) + m_y[0]; } //------------------------------------------------------------------------ double bspline::extrapolation_right(double x) const { double d = m_x[m_num - 1] - m_x[m_num - 2]; - return (d * m_am[m_num - 2] / 6 + (m_y[m_num - 1] - m_y[m_num - 2]) / d) * - (x - m_x[m_num - 1]) + - m_y[m_num - 1]; + return (d * m_am[m_num - 2] / 6 + (m_y[m_num - 1] - m_y[m_num - 2]) / d) * (x - m_x[m_num - 1]) + m_y[m_num - 1]; } //------------------------------------------------------------------------ double bspline::get(double x) const { - if(m_num > 2) + if (m_num > 2) { int i; // Extrapolation on the left - if(x < m_x[0]) return extrapolation_left(x); + if (x < m_x[0]) + return extrapolation_left(x); // Extrapolation on the right - if(x >= m_x[m_num - 1]) return extrapolation_right(x); + if (x >= m_x[m_num - 1]) + return extrapolation_right(x); // Interpolation bsearch(m_num, m_x, x, &i); @@ -230,43 +219,39 @@ double bspline::get(double x) const return 0.0; } - //------------------------------------------------------------------------ double bspline::get_stateful(double x) const { - if(m_num > 2) + if (m_num > 2) { // Extrapolation on the left - if(x < m_x[0]) return extrapolation_left(x); + if (x < m_x[0]) + return extrapolation_left(x); // Extrapolation on the right - if(x >= m_x[m_num - 1]) return extrapolation_right(x); + if (x >= m_x[m_num - 1]) + return extrapolation_right(x); - if(m_last_idx >= 0) + if (m_last_idx >= 0) { // Check if x is not in current range - if(x < m_x[m_last_idx] || x > m_x[m_last_idx + 1]) + if (x < m_x[m_last_idx] || x > m_x[m_last_idx + 1]) { // Check if x between next points (most probably) - if(m_last_idx < m_num - 2 && - x >= m_x[m_last_idx + 1] && - x <= m_x[m_last_idx + 2]) + if (m_last_idx < m_num - 2 && x >= m_x[m_last_idx + 1] && x <= m_x[m_last_idx + 2]) { ++m_last_idx; } + else if (m_last_idx > 0 && x >= m_x[m_last_idx - 1] && x <= m_x[m_last_idx]) + { + // x is between pevious points + --m_last_idx; + } else - if(m_last_idx > 0 && - x >= m_x[m_last_idx - 1] && - x <= m_x[m_last_idx]) - { - // x is between pevious points - --m_last_idx; - } - else - { - // Else perform full search - bsearch(m_num, m_x, x, &m_last_idx); - } + { + // Else perform full search + bsearch(m_num, m_x, x, &m_last_idx); + } } return interpolation(x, m_last_idx); } @@ -280,5 +265,4 @@ double bspline::get_stateful(double x) const return 0.0; } -} - +} // namespace agg diff --git a/deps/agg/src/agg_curves.cpp b/deps/agg/src/agg_curves.cpp index 007724828..6615195d9 100644 --- a/deps/agg/src/agg_curves.cpp +++ b/deps/agg/src/agg_curves.cpp @@ -17,17 +17,14 @@ #include "agg_curves.h" #include "agg_math.h" -namespace agg -{ +namespace agg { //------------------------------------------------------------------------ -//const double curve_distance_epsilon = 1e-30; -const double curve_collinearity_epsilon = 1e-30; -const double curve_angle_tolerance_epsilon = 0.01; +// const double curve_distance_epsilon = 1e-30; +const double curve_collinearity_epsilon = 1e-30; +const double curve_angle_tolerance_epsilon = 0.01; enum curve_recursion_limit_e { curve_recursion_limit = 32 }; - - //------------------------------------------------------------------------ void curve3_inc::approximation_scale(double s) { @@ -41,14 +38,12 @@ double curve3_inc::approximation_scale() const } //------------------------------------------------------------------------ -void curve3_inc::init(double x1, double y1, - double x2, double y2, - double x3, double y3) +void curve3_inc::init(double x1, double y1, double x2, double y2, double x3, double y3) { m_start_x = x1; m_start_y = y1; - m_end_x = x3; - m_end_y = y3; + m_end_x = x3; + m_end_y = y3; double dx1 = x2 - x1; double dy1 = y2 - y1; @@ -59,12 +54,12 @@ void curve3_inc::init(double x1, double y1, m_num_steps = uround(len * 0.25 * m_scale); - if(m_num_steps < 4) + if (m_num_steps < 4) { m_num_steps = 4; } - double subdivide_step = 1.0 / m_num_steps; + double subdivide_step = 1.0 / m_num_steps; double subdivide_step2 = subdivide_step * subdivide_step; double tmpx = (x1 - x2 * 2.0 + x3) * subdivide_step2; @@ -85,38 +80,39 @@ void curve3_inc::init(double x1, double y1, //------------------------------------------------------------------------ void curve3_inc::rewind(unsigned) { - if(m_num_steps == 0) + if (m_num_steps == 0) { m_step = -1; return; } m_step = m_num_steps; - m_fx = m_saved_fx; - m_fy = m_saved_fy; - m_dfx = m_saved_dfx; - m_dfy = m_saved_dfy; + m_fx = m_saved_fx; + m_fy = m_saved_fy; + m_dfx = m_saved_dfx; + m_dfy = m_saved_dfy; } //------------------------------------------------------------------------ unsigned curve3_inc::vertex(double* x, double* y) { - if(m_step < 0) return path_cmd_stop; - if(m_step == m_num_steps) + if (m_step < 0) + return path_cmd_stop; + if (m_step == m_num_steps) { *x = m_start_x; *y = m_start_y; --m_step; return path_cmd_move_to; } - if(m_step == 0) + if (m_step == 0) { *x = m_end_x; *y = m_end_y; --m_step; return path_cmd_line_to; } - m_fx += m_dfx; - m_fy += m_dfy; + m_fx += m_dfx; + m_fy += m_dfy; m_dfx += m_ddfx; m_dfy += m_ddfy; *x = m_fx; @@ -126,9 +122,7 @@ unsigned curve3_inc::vertex(double* x, double* y) } //------------------------------------------------------------------------ -void curve3_div::init(double x1, double y1, - double x2, double y2, - double x3, double y3) +void curve3_div::init(double x1, double y1, double x2, double y2, double x3, double y3) { m_points.remove_all(); m_distance_tolerance_square = 0.5 / m_approximation_scale; @@ -138,40 +132,37 @@ void curve3_div::init(double x1, double y1, } //------------------------------------------------------------------------ -void curve3_div::recursive_bezier(double x1, double y1, - double x2, double y2, - double x3, double y3, - unsigned level) +void curve3_div::recursive_bezier(double x1, double y1, double x2, double y2, double x3, double y3, unsigned level) { - if(level > curve_recursion_limit) + if (level > curve_recursion_limit) { return; } // Calculate all the mid-points of the line segments //---------------------- - double x12 = (x1 + x2) / 2; - double y12 = (y1 + y2) / 2; - double x23 = (x2 + x3) / 2; - double y23 = (y2 + y3) / 2; - double x123 = (x12 + x23) / 2; - double y123 = (y12 + y23) / 2; + double x12 = (x1 + x2) / 2; + double y12 = (y1 + y2) / 2; + double x23 = (x2 + x3) / 2; + double y23 = (y2 + y3) / 2; + double x123 = (x12 + x23) / 2; + double y123 = (y12 + y23) / 2; - double dx = x3-x1; - double dy = y3-y1; + double dx = x3 - x1; + double dy = y3 - y1; double d = std::fabs(((x2 - x3) * dy - (y2 - y3) * dx)); double da; - if(d > curve_collinearity_epsilon) + if (d > curve_collinearity_epsilon) { // Regular case //----------------- - if(d * d <= m_distance_tolerance_square * (dx*dx + dy*dy)) + if (d * d <= m_distance_tolerance_square * (dx * dx + dy * dy)) { // If the curvature doesn't exceed the distance_tolerance value // we tend to finish subdivisions. //---------------------- - if(m_angle_tolerance < curve_angle_tolerance_epsilon) + if (m_angle_tolerance < curve_angle_tolerance_epsilon) { m_points.add(point_d(x123, y123)); return; @@ -180,9 +171,10 @@ void curve3_div::recursive_bezier(double x1, double y1, // Angle & Cusp Condition //---------------------- da = std::fabs(std::atan2(y3 - y2, x3 - x2) - std::atan2(y2 - y1, x2 - x1)); - if(da >= pi) da = 2*pi - da; + if (da >= pi) + da = 2 * pi - da; - if(da < m_angle_tolerance) + if (da < m_angle_tolerance) { // Finally we can stop the recursion //---------------------- @@ -195,25 +187,28 @@ void curve3_div::recursive_bezier(double x1, double y1, { // Collinear case //------------------ - da = dx*dx + dy*dy; - if(da == 0) + da = dx * dx + dy * dy; + if (da == 0) { d = calc_sq_distance(x1, y1, x2, y2); } else { - d = ((x2 - x1)*dx + (y2 - y1)*dy) / da; - if(d > 0 && d < 1) + d = ((x2 - x1) * dx + (y2 - y1) * dy) / da; + if (d > 0 && d < 1) { // Simple collinear case, 1---2---3 // We can leave just two endpoints return; } - if(d <= 0) d = calc_sq_distance(x2, y2, x1, y1); - else if(d >= 1) d = calc_sq_distance(x2, y2, x3, y3); - else d = calc_sq_distance(x2, y2, x1 + d*dx, y1 + d*dy); + if (d <= 0) + d = calc_sq_distance(x2, y2, x1, y1); + else if (d >= 1) + d = calc_sq_distance(x2, y2, x3, y3); + else + d = calc_sq_distance(x2, y2, x1 + d * dx, y1 + d * dy); } - if(d < m_distance_tolerance_square) + if (d < m_distance_tolerance_square) { m_points.add(point_d(x2, y2)); return; @@ -227,19 +222,13 @@ void curve3_div::recursive_bezier(double x1, double y1, } //------------------------------------------------------------------------ -void curve3_div::bezier(double x1, double y1, - double x2, double y2, - double x3, double y3) +void curve3_div::bezier(double x1, double y1, double x2, double y2, double x3, double y3) { m_points.add(point_d(x1, y1)); recursive_bezier(x1, y1, x2, y2, x3, y3, 0); m_points.add(point_d(x3, y3)); } - - - - //------------------------------------------------------------------------ void curve4_inc::approximation_scale(double s) { @@ -254,19 +243,19 @@ double curve4_inc::approximation_scale() const #if defined(_MSC_VER) && _MSC_VER <= 1200 //------------------------------------------------------------------------ -static double MSC60_fix_ICE(double v) { return v; } +static double MSC60_fix_ICE(double v) +{ + return v; +} #endif //------------------------------------------------------------------------ -void curve4_inc::init(double x1, double y1, - double x2, double y2, - double x3, double y3, - double x4, double y4) +void curve4_inc::init(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) { m_start_x = x1; m_start_y = y1; - m_end_x = x4; - m_end_y = y4; + m_end_x = x4; + m_end_y = y4; double dx1 = x2 - x1; double dy1 = y2 - y1; @@ -275,9 +264,8 @@ void curve4_inc::init(double x1, double y1, double dx3 = x4 - x3; double dy3 = y4 - y3; - double len = (sqrt(dx1 * dx1 + dy1 * dy1) + - sqrt(dx2 * dx2 + dy2 * dy2) + - sqrt(dx3 * dx3 + dy3 * dy3)) * 0.25 * m_scale; + double len = + (sqrt(dx1 * dx1 + dy1 * dy1) + sqrt(dx2 * dx2 + dy2 * dy2) + sqrt(dx3 * dx3 + dy3 * dy3)) * 0.25 * m_scale; #if defined(_MSC_VER) && _MSC_VER <= 1200 m_num_steps = uround(MSC60_fix_ICE(len)); @@ -285,12 +273,12 @@ void curve4_inc::init(double x1, double y1, m_num_steps = uround(len); #endif - if(m_num_steps < 4) + if (m_num_steps < 4) { m_num_steps = 4; } - double subdivide_step = 1.0 / m_num_steps; + double subdivide_step = 1.0 / m_num_steps; double subdivide_step2 = subdivide_step * subdivide_step; double subdivide_step3 = subdivide_step * subdivide_step * subdivide_step; @@ -323,16 +311,16 @@ void curve4_inc::init(double x1, double y1, //------------------------------------------------------------------------ void curve4_inc::rewind(unsigned) { - if(m_num_steps == 0) + if (m_num_steps == 0) { m_step = -1; return; } m_step = m_num_steps; - m_fx = m_saved_fx; - m_fy = m_saved_fy; - m_dfx = m_saved_dfx; - m_dfy = m_saved_dfy; + m_fx = m_saved_fx; + m_fy = m_saved_fy; + m_dfx = m_saved_dfx; + m_dfy = m_saved_dfy; m_ddfx = m_saved_ddfx; m_ddfy = m_saved_ddfy; } @@ -340,8 +328,9 @@ void curve4_inc::rewind(unsigned) //------------------------------------------------------------------------ unsigned curve4_inc::vertex(double* x, double* y) { - if(m_step < 0) return path_cmd_stop; - if(m_step == m_num_steps) + if (m_step < 0) + return path_cmd_stop; + if (m_step == m_num_steps) { *x = m_start_x; *y = m_start_y; @@ -349,7 +338,7 @@ unsigned curve4_inc::vertex(double* x, double* y) return path_cmd_move_to; } - if(m_step == 0) + if (m_step == 0) { *x = m_end_x; *y = m_end_y; @@ -357,10 +346,10 @@ unsigned curve4_inc::vertex(double* x, double* y) return path_cmd_line_to; } - m_fx += m_dfx; - m_fy += m_dfy; - m_dfx += m_ddfx; - m_dfy += m_ddfy; + m_fx += m_dfx; + m_fy += m_dfy; + m_dfx += m_ddfx; + m_dfy += m_ddfy; m_ddfx += m_dddfx; m_ddfy += m_dddfy; @@ -370,14 +359,8 @@ unsigned curve4_inc::vertex(double* x, double* y) return path_cmd_line_to; } - - - //------------------------------------------------------------------------ -void curve4_div::init(double x1, double y1, - double x2, double y2, - double x3, double y3, - double x4, double y4) +void curve4_div::init(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) { m_points.remove_all(); m_distance_tolerance_square = 0.5 / m_approximation_scale; @@ -387,209 +370,221 @@ void curve4_div::init(double x1, double y1, } //------------------------------------------------------------------------ -void curve4_div::recursive_bezier(double x1, double y1, - double x2, double y2, - double x3, double y3, - double x4, double y4, +void curve4_div::recursive_bezier(double x1, + double y1, + double x2, + double y2, + double x3, + double y3, + double x4, + double y4, unsigned level) { - if(level > curve_recursion_limit) + if (level > curve_recursion_limit) { return; } // Calculate all the mid-points of the line segments //---------------------- - double x12 = (x1 + x2) / 2; - double y12 = (y1 + y2) / 2; - double x23 = (x2 + x3) / 2; - double y23 = (y2 + y3) / 2; - double x34 = (x3 + x4) / 2; - double y34 = (y3 + y4) / 2; - double x123 = (x12 + x23) / 2; - double y123 = (y12 + y23) / 2; - double x234 = (x23 + x34) / 2; - double y234 = (y23 + y34) / 2; + double x12 = (x1 + x2) / 2; + double y12 = (y1 + y2) / 2; + double x23 = (x2 + x3) / 2; + double y23 = (y2 + y3) / 2; + double x34 = (x3 + x4) / 2; + double y34 = (y3 + y4) / 2; + double x123 = (x12 + x23) / 2; + double y123 = (y12 + y23) / 2; + double x234 = (x23 + x34) / 2; + double y234 = (y23 + y34) / 2; double x1234 = (x123 + x234) / 2; double y1234 = (y123 + y234) / 2; - // Try to approximate the full cubic curve by a single straight line //------------------ - double dx = x4-x1; - double dy = y4-y1; + double dx = x4 - x1; + double dy = y4 - y1; double d2 = std::fabs(((x2 - x4) * dy - (y2 - y4) * dx)); double d3 = std::fabs(((x3 - x4) * dy - (y3 - y4) * dx)); double da1, da2, k; - switch((int(d2 > curve_collinearity_epsilon) << 1) + - int(d3 > curve_collinearity_epsilon)) + switch ((int(d2 > curve_collinearity_epsilon) << 1) + int(d3 > curve_collinearity_epsilon)) { - case 0: - // All collinear OR p1==p4 - //---------------------- - k = dx*dx + dy*dy; - if(k == 0) - { - d2 = calc_sq_distance(x1, y1, x2, y2); - d3 = calc_sq_distance(x4, y4, x3, y3); - } - else - { - k = 1 / k; - da1 = x2 - x1; - da2 = y2 - y1; - d2 = k * (da1*dx + da2*dy); - da1 = x3 - x1; - da2 = y3 - y1; - d3 = k * (da1*dx + da2*dy); - if(d2 > 0 && d2 < 1 && d3 > 0 && d3 < 1) - { - // Simple collinear case, 1---2---3---4 - // We can leave just two endpoints - return; - } - if(d2 <= 0) d2 = calc_sq_distance(x2, y2, x1, y1); - else if(d2 >= 1) d2 = calc_sq_distance(x2, y2, x4, y4); - else d2 = calc_sq_distance(x2, y2, x1 + d2*dx, y1 + d2*dy); - - if(d3 <= 0) d3 = calc_sq_distance(x3, y3, x1, y1); - else if(d3 >= 1) d3 = calc_sq_distance(x3, y3, x4, y4); - else d3 = calc_sq_distance(x3, y3, x1 + d3*dx, y1 + d3*dy); - } - if(d2 > d3) - { - if(d2 < m_distance_tolerance_square) - { - m_points.add(point_d(x2, y2)); - return; - } - } - else - { - if(d3 < m_distance_tolerance_square) - { - m_points.add(point_d(x3, y3)); - return; - } - } - break; - - case 1: - // p1,p2,p4 are collinear, p3 is significant - //---------------------- - if(d3 * d3 <= m_distance_tolerance_square * (dx*dx + dy*dy)) - { - if(m_angle_tolerance < curve_angle_tolerance_epsilon) - { - m_points.add(point_d(x23, y23)); - return; - } - - // Angle Condition + case 0: + // All collinear OR p1==p4 //---------------------- - da1 = std::fabs(std::atan2(y4 - y3, x4 - x3) - std::atan2(y3 - y2, x3 - x2)); - if(da1 >= pi) da1 = 2*pi - da1; - - if(da1 < m_angle_tolerance) + k = dx * dx + dy * dy; + if (k == 0) { - m_points.add(point_d(x2, y2)); - m_points.add(point_d(x3, y3)); - return; + d2 = calc_sq_distance(x1, y1, x2, y2); + d3 = calc_sq_distance(x4, y4, x3, y3); } - - if(m_cusp_limit != 0.0) + else { - if(da1 > m_cusp_limit) + k = 1 / k; + da1 = x2 - x1; + da2 = y2 - y1; + d2 = k * (da1 * dx + da2 * dy); + da1 = x3 - x1; + da2 = y3 - y1; + d3 = k * (da1 * dx + da2 * dy); + if (d2 > 0 && d2 < 1 && d3 > 0 && d3 < 1) { - m_points.add(point_d(x3, y3)); + // Simple collinear case, 1---2---3---4 + // We can leave just two endpoints return; } + if (d2 <= 0) + d2 = calc_sq_distance(x2, y2, x1, y1); + else if (d2 >= 1) + d2 = calc_sq_distance(x2, y2, x4, y4); + else + d2 = calc_sq_distance(x2, y2, x1 + d2 * dx, y1 + d2 * dy); + + if (d3 <= 0) + d3 = calc_sq_distance(x3, y3, x1, y1); + else if (d3 >= 1) + d3 = calc_sq_distance(x3, y3, x4, y4); + else + d3 = calc_sq_distance(x3, y3, x1 + d3 * dx, y1 + d3 * dy); } - } - break; - - case 2: - // p1,p3,p4 are collinear, p2 is significant - //---------------------- - if(d2 * d2 <= m_distance_tolerance_square * (dx*dx + dy*dy)) - { - if(m_angle_tolerance < curve_angle_tolerance_epsilon) + if (d2 > d3) { - m_points.add(point_d(x23, y23)); - return; - } - - // Angle Condition - //---------------------- - da1 = std::fabs(std::atan2(y3 - y2, x3 - x2) - std::atan2(y2 - y1, x2 - x1)); - if(da1 >= pi) da1 = 2*pi - da1; - - if(da1 < m_angle_tolerance) - { - m_points.add(point_d(x2, y2)); - m_points.add(point_d(x3, y3)); - return; - } - - if(m_cusp_limit != 0.0) - { - if(da1 > m_cusp_limit) + if (d2 < m_distance_tolerance_square) { m_points.add(point_d(x2, y2)); return; } } - } - break; - - case 3: - // Regular case - //----------------- - if((d2 + d3)*(d2 + d3) <= m_distance_tolerance_square * (dx*dx + dy*dy)) - { - // If the curvature doesn't exceed the distance_tolerance value - // we tend to finish subdivisions. - //---------------------- - if(m_angle_tolerance < curve_angle_tolerance_epsilon) + else { - m_points.add(point_d(x23, y23)); - return; + if (d3 < m_distance_tolerance_square) + { + m_points.add(point_d(x3, y3)); + return; + } } + break; - // Angle & Cusp Condition + case 1: + // p1,p2,p4 are collinear, p3 is significant //---------------------- - k = std::atan2(y3 - y2, x3 - x2); - da1 = std::fabs(k - std::atan2(y2 - y1, x2 - x1)); - da2 = std::fabs(std::atan2(y4 - y3, x4 - x3) - k); - if(da1 >= pi) da1 = 2*pi - da1; - if(da2 >= pi) da2 = 2*pi - da2; - - if(da1 + da2 < m_angle_tolerance) + if (d3 * d3 <= m_distance_tolerance_square * (dx * dx + dy * dy)) { - // Finally we can stop the recursion + if (m_angle_tolerance < curve_angle_tolerance_epsilon) + { + m_points.add(point_d(x23, y23)); + return; + } + + // Angle Condition //---------------------- - m_points.add(point_d(x23, y23)); - return; - } + da1 = std::fabs(std::atan2(y4 - y3, x4 - x3) - std::atan2(y3 - y2, x3 - x2)); + if (da1 >= pi) + da1 = 2 * pi - da1; - if(m_cusp_limit != 0.0) - { - if(da1 > m_cusp_limit) + if (da1 < m_angle_tolerance) { m_points.add(point_d(x2, y2)); - return; - } - - if(da2 > m_cusp_limit) - { m_points.add(point_d(x3, y3)); return; } + + if (m_cusp_limit != 0.0) + { + if (da1 > m_cusp_limit) + { + m_points.add(point_d(x3, y3)); + return; + } + } } - } - break; + break; + + case 2: + // p1,p3,p4 are collinear, p2 is significant + //---------------------- + if (d2 * d2 <= m_distance_tolerance_square * (dx * dx + dy * dy)) + { + if (m_angle_tolerance < curve_angle_tolerance_epsilon) + { + m_points.add(point_d(x23, y23)); + return; + } + + // Angle Condition + //---------------------- + da1 = std::fabs(std::atan2(y3 - y2, x3 - x2) - std::atan2(y2 - y1, x2 - x1)); + if (da1 >= pi) + da1 = 2 * pi - da1; + + if (da1 < m_angle_tolerance) + { + m_points.add(point_d(x2, y2)); + m_points.add(point_d(x3, y3)); + return; + } + + if (m_cusp_limit != 0.0) + { + if (da1 > m_cusp_limit) + { + m_points.add(point_d(x2, y2)); + return; + } + } + } + break; + + case 3: + // Regular case + //----------------- + if ((d2 + d3) * (d2 + d3) <= m_distance_tolerance_square * (dx * dx + dy * dy)) + { + // If the curvature doesn't exceed the distance_tolerance value + // we tend to finish subdivisions. + //---------------------- + if (m_angle_tolerance < curve_angle_tolerance_epsilon) + { + m_points.add(point_d(x23, y23)); + return; + } + + // Angle & Cusp Condition + //---------------------- + k = std::atan2(y3 - y2, x3 - x2); + da1 = std::fabs(k - std::atan2(y2 - y1, x2 - x1)); + da2 = std::fabs(std::atan2(y4 - y3, x4 - x3) - k); + if (da1 >= pi) + da1 = 2 * pi - da1; + if (da2 >= pi) + da2 = 2 * pi - da2; + + if (da1 + da2 < m_angle_tolerance) + { + // Finally we can stop the recursion + //---------------------- + m_points.add(point_d(x23, y23)); + return; + } + + if (m_cusp_limit != 0.0) + { + if (da1 > m_cusp_limit) + { + m_points.add(point_d(x2, y2)); + return; + } + + if (da2 > m_cusp_limit) + { + m_points.add(point_d(x3, y3)); + return; + } + } + } + break; } // Continue subdivision @@ -599,15 +594,11 @@ void curve4_div::recursive_bezier(double x1, double y1, } //------------------------------------------------------------------------ -void curve4_div::bezier(double x1, double y1, - double x2, double y2, - double x3, double y3, - double x4, double y4) +void curve4_div::bezier(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) { m_points.add(point_d(x1, y1)); recursive_bezier(x1, y1, x2, y2, x3, y3, x4, y4, 0); m_points.add(point_d(x4, y4)); } -} - +} // namespace agg diff --git a/deps/agg/src/agg_embedded_raster_fonts.cpp b/deps/agg/src/agg_embedded_raster_fonts.cpp index 525d0d550..f344b3d8a 100644 --- a/deps/agg/src/agg_embedded_raster_fonts.cpp +++ b/deps/agg/src/agg_embedded_raster_fonts.cpp @@ -15,10412 +15,10818 @@ #include "agg_embedded_raster_fonts.h" -namespace agg -{ +namespace agg { -const int8u gse4x6[] = -{ - 6, 0, 32, 128-32, +const int8u gse4x6[] = { + 6, 0, 32, 128 - 32, - 0x00,0x00,0x07,0x00,0x0e,0x00,0x15,0x00,0x1c,0x00,0x23,0x00,0x2a,0x00,0x31,0x00,0x38,0x00, - 0x3f,0x00,0x46,0x00,0x4d,0x00,0x54,0x00,0x5b,0x00,0x62,0x00,0x69,0x00,0x70,0x00,0x77,0x00, - 0x7e,0x00,0x85,0x00,0x8c,0x00,0x93,0x00,0x9a,0x00,0xa1,0x00,0xa8,0x00,0xaf,0x00,0xb6,0x00, - 0xbd,0x00,0xc4,0x00,0xcb,0x00,0xd2,0x00,0xd9,0x00,0xe0,0x00,0xe7,0x00,0xee,0x00,0xf5,0x00, - 0xfc,0x00,0x03,0x01,0x0a,0x01,0x11,0x01,0x18,0x01,0x1f,0x01,0x26,0x01,0x2d,0x01,0x34,0x01, - 0x3b,0x01,0x42,0x01,0x49,0x01,0x50,0x01,0x57,0x01,0x5e,0x01,0x65,0x01,0x6c,0x01,0x73,0x01, - 0x7a,0x01,0x81,0x01,0x88,0x01,0x8f,0x01,0x96,0x01,0x9d,0x01,0xa4,0x01,0xab,0x01,0xb2,0x01, - 0xb9,0x01,0xc0,0x01,0xc7,0x01,0xce,0x01,0xd5,0x01,0xdc,0x01,0xe3,0x01,0xea,0x01,0xf1,0x01, - 0xf8,0x01,0xff,0x01,0x06,0x02,0x0d,0x02,0x14,0x02,0x1b,0x02,0x22,0x02,0x29,0x02,0x30,0x02, - 0x37,0x02,0x3e,0x02,0x45,0x02,0x4c,0x02,0x53,0x02,0x5a,0x02,0x61,0x02,0x68,0x02,0x6f,0x02, - 0x76,0x02,0x7d,0x02,0x84,0x02,0x8b,0x02,0x92,0x02,0x99,0x02, + 0x00, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x15, 0x00, 0x1c, 0x00, 0x23, 0x00, 0x2a, 0x00, 0x31, 0x00, 0x38, 0x00, + 0x3f, 0x00, 0x46, 0x00, 0x4d, 0x00, 0x54, 0x00, 0x5b, 0x00, 0x62, 0x00, 0x69, 0x00, 0x70, 0x00, 0x77, 0x00, + 0x7e, 0x00, 0x85, 0x00, 0x8c, 0x00, 0x93, 0x00, 0x9a, 0x00, 0xa1, 0x00, 0xa8, 0x00, 0xaf, 0x00, 0xb6, 0x00, + 0xbd, 0x00, 0xc4, 0x00, 0xcb, 0x00, 0xd2, 0x00, 0xd9, 0x00, 0xe0, 0x00, 0xe7, 0x00, 0xee, 0x00, 0xf5, 0x00, + 0xfc, 0x00, 0x03, 0x01, 0x0a, 0x01, 0x11, 0x01, 0x18, 0x01, 0x1f, 0x01, 0x26, 0x01, 0x2d, 0x01, 0x34, 0x01, + 0x3b, 0x01, 0x42, 0x01, 0x49, 0x01, 0x50, 0x01, 0x57, 0x01, 0x5e, 0x01, 0x65, 0x01, 0x6c, 0x01, 0x73, 0x01, + 0x7a, 0x01, 0x81, 0x01, 0x88, 0x01, 0x8f, 0x01, 0x96, 0x01, 0x9d, 0x01, 0xa4, 0x01, 0xab, 0x01, 0xb2, 0x01, + 0xb9, 0x01, 0xc0, 0x01, 0xc7, 0x01, 0xce, 0x01, 0xd5, 0x01, 0xdc, 0x01, 0xe3, 0x01, 0xea, 0x01, 0xf1, 0x01, + 0xf8, 0x01, 0xff, 0x01, 0x06, 0x02, 0x0d, 0x02, 0x14, 0x02, 0x1b, 0x02, 0x22, 0x02, 0x29, 0x02, 0x30, 0x02, + 0x37, 0x02, 0x3e, 0x02, 0x45, 0x02, 0x4c, 0x02, 0x53, 0x02, 0x5a, 0x02, 0x61, 0x02, 0x68, 0x02, 0x6f, 0x02, + 0x76, 0x02, 0x7d, 0x02, 0x84, 0x02, 0x8b, 0x02, 0x92, 0x02, 0x99, 0x02, - 4, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x21 '!' - 0x40,0x40,0x40,0x00,0x40,0x00, + 4, // 0x21 '!' + 0x40, 0x40, 0x40, 0x00, 0x40, 0x00, - 4, // 0x22 '"' - 0xa0,0xa0,0x00,0x00,0x00,0x00, + 4, // 0x22 '"' + 0xa0, 0xa0, 0x00, 0x00, 0x00, 0x00, - 4, // 0x23 '#' - 0x60,0xf0,0x60,0xf0,0x60,0x00, + 4, // 0x23 '#' + 0x60, 0xf0, 0x60, 0xf0, 0x60, 0x00, - 4, // 0x24 '$' - 0x40,0x60,0xc0,0x60,0xc0,0x40, + 4, // 0x24 '$' + 0x40, 0x60, 0xc0, 0x60, 0xc0, 0x40, - 4, // 0x25 '%' - 0xa0,0x20,0x40,0x80,0xa0,0x00, + 4, // 0x25 '%' + 0xa0, 0x20, 0x40, 0x80, 0xa0, 0x00, - 4, // 0x26 '&' - 0xe0,0xa0,0x50,0xa0,0xd0,0x00, + 4, // 0x26 '&' + 0xe0, 0xa0, 0x50, 0xa0, 0xd0, 0x00, - 4, // 0x27 ''' - 0x40,0x40,0x00,0x00,0x00,0x00, + 4, // 0x27 ''' + 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, - 4, // 0x28 '(' - 0x20,0x40,0x40,0x40,0x20,0x00, + 4, // 0x28 '(' + 0x20, 0x40, 0x40, 0x40, 0x20, 0x00, - 4, // 0x29 ')' - 0x40,0x20,0x20,0x20,0x40,0x00, + 4, // 0x29 ')' + 0x40, 0x20, 0x20, 0x20, 0x40, 0x00, - 4, // 0x2a '*' - 0xa0,0x40,0xe0,0x40,0xa0,0x00, + 4, // 0x2a '*' + 0xa0, 0x40, 0xe0, 0x40, 0xa0, 0x00, - 4, // 0x2b '+' - 0x40,0x40,0xe0,0x40,0x40,0x00, + 4, // 0x2b '+' + 0x40, 0x40, 0xe0, 0x40, 0x40, 0x00, - 4, // 0x2c ',' - 0x00,0x00,0x00,0x40,0x40,0x80, + 4, // 0x2c ',' + 0x00, 0x00, 0x00, 0x40, 0x40, 0x80, - 4, // 0x2d '-' - 0x00,0x00,0xe0,0x00,0x00,0x00, + 4, // 0x2d '-' + 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, - 4, // 0x2e '.' - 0x00,0x00,0x00,0x00,0x40,0x00, + 4, // 0x2e '.' + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, - 4, // 0x2f '/' - 0x10,0x20,0x20,0x40,0x40,0x80, + 4, // 0x2f '/' + 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, - 4, // 0x30 '0' - 0xe0,0xa0,0xa0,0xa0,0xe0,0x00, + 4, // 0x30 '0' + 0xe0, 0xa0, 0xa0, 0xa0, 0xe0, 0x00, - 4, // 0x31 '1' - 0x40,0xc0,0x40,0x40,0xe0,0x00, + 4, // 0x31 '1' + 0x40, 0xc0, 0x40, 0x40, 0xe0, 0x00, - 4, // 0x32 '2' - 0xe0,0xa0,0x20,0x40,0xe0,0x00, + 4, // 0x32 '2' + 0xe0, 0xa0, 0x20, 0x40, 0xe0, 0x00, - 4, // 0x33 '3' - 0xe0,0x20,0x40,0x20,0xe0,0x00, + 4, // 0x33 '3' + 0xe0, 0x20, 0x40, 0x20, 0xe0, 0x00, - 4, // 0x34 '4' - 0xa0,0xa0,0xe0,0x20,0x20,0x00, + 4, // 0x34 '4' + 0xa0, 0xa0, 0xe0, 0x20, 0x20, 0x00, - 4, // 0x35 '5' - 0xe0,0x80,0xc0,0x20,0xc0,0x00, + 4, // 0x35 '5' + 0xe0, 0x80, 0xc0, 0x20, 0xc0, 0x00, - 4, // 0x36 '6' - 0x40,0x80,0xe0,0xa0,0xe0,0x00, + 4, // 0x36 '6' + 0x40, 0x80, 0xe0, 0xa0, 0xe0, 0x00, - 4, // 0x37 '7' - 0xe0,0xa0,0x20,0x40,0x40,0x00, + 4, // 0x37 '7' + 0xe0, 0xa0, 0x20, 0x40, 0x40, 0x00, - 4, // 0x38 '8' - 0xe0,0xa0,0x40,0xa0,0xe0,0x00, + 4, // 0x38 '8' + 0xe0, 0xa0, 0x40, 0xa0, 0xe0, 0x00, - 4, // 0x39 '9' - 0xe0,0xa0,0xe0,0x20,0xc0,0x00, + 4, // 0x39 '9' + 0xe0, 0xa0, 0xe0, 0x20, 0xc0, 0x00, - 4, // 0x3a ':' - 0x00,0x40,0x00,0x40,0x00,0x00, + 4, // 0x3a ':' + 0x00, 0x40, 0x00, 0x40, 0x00, 0x00, - 4, // 0x3b ';' - 0x00,0x40,0x00,0x40,0x40,0x80, + 4, // 0x3b ';' + 0x00, 0x40, 0x00, 0x40, 0x40, 0x80, - 4, // 0x3c '<' - 0x20,0x40,0x80,0x40,0x20,0x00, + 4, // 0x3c '<' + 0x20, 0x40, 0x80, 0x40, 0x20, 0x00, - 4, // 0x3d '=' - 0x00,0xe0,0x00,0xe0,0x00,0x00, + 4, // 0x3d '=' + 0x00, 0xe0, 0x00, 0xe0, 0x00, 0x00, - 4, // 0x3e '>' - 0x80,0x40,0x20,0x40,0x80,0x00, + 4, // 0x3e '>' + 0x80, 0x40, 0x20, 0x40, 0x80, 0x00, - 4, // 0x3f '?' - 0xc0,0x20,0x40,0x00,0x40,0x00, + 4, // 0x3f '?' + 0xc0, 0x20, 0x40, 0x00, 0x40, 0x00, - 4, // 0x40 '@' - 0x40,0xa0,0xe0,0xe0,0x80,0x60, + 4, // 0x40 '@' + 0x40, 0xa0, 0xe0, 0xe0, 0x80, 0x60, - 4, // 0x41 'A' - 0x40,0xa0,0xe0,0xa0,0xa0,0x00, + 4, // 0x41 'A' + 0x40, 0xa0, 0xe0, 0xa0, 0xa0, 0x00, - 4, // 0x42 'B' - 0xc0,0xa0,0xc0,0xa0,0xc0,0x00, + 4, // 0x42 'B' + 0xc0, 0xa0, 0xc0, 0xa0, 0xc0, 0x00, - 4, // 0x43 'C' - 0x60,0x80,0x80,0x80,0x60,0x00, + 4, // 0x43 'C' + 0x60, 0x80, 0x80, 0x80, 0x60, 0x00, - 4, // 0x44 'D' - 0xc0,0xa0,0xa0,0xa0,0xc0,0x00, + 4, // 0x44 'D' + 0xc0, 0xa0, 0xa0, 0xa0, 0xc0, 0x00, - 4, // 0x45 'E' - 0xe0,0x80,0xc0,0x80,0xe0,0x00, + 4, // 0x45 'E' + 0xe0, 0x80, 0xc0, 0x80, 0xe0, 0x00, - 4, // 0x46 'F' - 0xe0,0x80,0xc0,0x80,0x80,0x00, + 4, // 0x46 'F' + 0xe0, 0x80, 0xc0, 0x80, 0x80, 0x00, - 4, // 0x47 'G' - 0x60,0x80,0xa0,0xa0,0x40,0x00, + 4, // 0x47 'G' + 0x60, 0x80, 0xa0, 0xa0, 0x40, 0x00, - 4, // 0x48 'H' - 0xa0,0xa0,0xe0,0xa0,0xa0,0x00, + 4, // 0x48 'H' + 0xa0, 0xa0, 0xe0, 0xa0, 0xa0, 0x00, - 4, // 0x49 'I' - 0xe0,0x40,0x40,0x40,0xe0,0x00, + 4, // 0x49 'I' + 0xe0, 0x40, 0x40, 0x40, 0xe0, 0x00, - 4, // 0x4a 'J' - 0x20,0x20,0x20,0x20,0xa0,0x40, + 4, // 0x4a 'J' + 0x20, 0x20, 0x20, 0x20, 0xa0, 0x40, - 4, // 0x4b 'K' - 0xa0,0xa0,0xc0,0xc0,0xa0,0x00, + 4, // 0x4b 'K' + 0xa0, 0xa0, 0xc0, 0xc0, 0xa0, 0x00, - 4, // 0x4c 'L' - 0x80,0x80,0x80,0x80,0xe0,0x00, + 4, // 0x4c 'L' + 0x80, 0x80, 0x80, 0x80, 0xe0, 0x00, - 4, // 0x4d 'M' - 0xa0,0xe0,0xa0,0xa0,0xa0,0x00, + 4, // 0x4d 'M' + 0xa0, 0xe0, 0xa0, 0xa0, 0xa0, 0x00, - 4, // 0x4e 'N' - 0x90,0xd0,0xb0,0x90,0x90,0x00, + 4, // 0x4e 'N' + 0x90, 0xd0, 0xb0, 0x90, 0x90, 0x00, - 4, // 0x4f 'O' - 0x40,0xa0,0xa0,0xa0,0x40,0x00, + 4, // 0x4f 'O' + 0x40, 0xa0, 0xa0, 0xa0, 0x40, 0x00, - 4, // 0x50 'P' - 0xc0,0xa0,0xa0,0xc0,0x80,0x00, + 4, // 0x50 'P' + 0xc0, 0xa0, 0xa0, 0xc0, 0x80, 0x00, - 4, // 0x51 'Q' - 0x40,0xa0,0xa0,0xa0,0x60,0x00, + 4, // 0x51 'Q' + 0x40, 0xa0, 0xa0, 0xa0, 0x60, 0x00, - 4, // 0x52 'R' - 0xc0,0xa0,0xa0,0xc0,0xa0,0x00, + 4, // 0x52 'R' + 0xc0, 0xa0, 0xa0, 0xc0, 0xa0, 0x00, - 4, // 0x53 'S' - 0x60,0x80,0x40,0x20,0xc0,0x00, + 4, // 0x53 'S' + 0x60, 0x80, 0x40, 0x20, 0xc0, 0x00, - 4, // 0x54 'T' - 0xe0,0x40,0x40,0x40,0x40,0x00, + 4, // 0x54 'T' + 0xe0, 0x40, 0x40, 0x40, 0x40, 0x00, - 4, // 0x55 'U' - 0xa0,0xa0,0xa0,0xa0,0xe0,0x00, + 4, // 0x55 'U' + 0xa0, 0xa0, 0xa0, 0xa0, 0xe0, 0x00, - 4, // 0x56 'V' - 0xa0,0xa0,0xa0,0xa0,0x40,0x00, + 4, // 0x56 'V' + 0xa0, 0xa0, 0xa0, 0xa0, 0x40, 0x00, - 4, // 0x57 'W' - 0xa0,0xa0,0xa0,0xe0,0xa0,0x00, + 4, // 0x57 'W' + 0xa0, 0xa0, 0xa0, 0xe0, 0xa0, 0x00, - 4, // 0x58 'X' - 0xa0,0xa0,0x40,0xa0,0xa0,0x00, + 4, // 0x58 'X' + 0xa0, 0xa0, 0x40, 0xa0, 0xa0, 0x00, - 4, // 0x59 'Y' - 0xa0,0xa0,0x40,0x40,0x40,0x00, + 4, // 0x59 'Y' + 0xa0, 0xa0, 0x40, 0x40, 0x40, 0x00, - 4, // 0x5a 'Z' - 0xe0,0x20,0x40,0x80,0xe0,0x00, + 4, // 0x5a 'Z' + 0xe0, 0x20, 0x40, 0x80, 0xe0, 0x00, - 4, // 0x5b '[' - 0xc0,0x80,0x80,0x80,0xc0,0x00, + 4, // 0x5b '[' + 0xc0, 0x80, 0x80, 0x80, 0xc0, 0x00, - 4, // 0x5c '\' - 0x80,0x40,0x40,0x20,0x20,0x10, + 4, // 0x5c '\' + 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, - 4, // 0x5d ']' - 0xc0,0x40,0x40,0x40,0xc0,0x00, + 4, // 0x5d ']' + 0xc0, 0x40, 0x40, 0x40, 0xc0, 0x00, - 4, // 0x5e '^' - 0x40,0xa0,0x00,0x00,0x00,0x00, + 4, // 0x5e '^' + 0x40, 0xa0, 0x00, 0x00, 0x00, 0x00, - 4, // 0x5f '_' - 0x00,0x00,0x00,0x00,0x00,0xf0, + 4, // 0x5f '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, - 4, // 0x60 '`' - 0x40,0x20,0x00,0x00,0x00,0x00, + 4, // 0x60 '`' + 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, - 4, // 0x61 'a' - 0x00,0x60,0xa0,0xa0,0x70,0x00, + 4, // 0x61 'a' + 0x00, 0x60, 0xa0, 0xa0, 0x70, 0x00, - 4, // 0x62 'b' - 0x80,0x80,0xc0,0xa0,0xc0,0x00, + 4, // 0x62 'b' + 0x80, 0x80, 0xc0, 0xa0, 0xc0, 0x00, - 4, // 0x63 'c' - 0x00,0x60,0x80,0x80,0x60,0x00, + 4, // 0x63 'c' + 0x00, 0x60, 0x80, 0x80, 0x60, 0x00, - 4, // 0x64 'd' - 0x20,0x20,0x60,0xa0,0x60,0x00, + 4, // 0x64 'd' + 0x20, 0x20, 0x60, 0xa0, 0x60, 0x00, - 4, // 0x65 'e' - 0x00,0x40,0xe0,0x80,0x60,0x00, + 4, // 0x65 'e' + 0x00, 0x40, 0xe0, 0x80, 0x60, 0x00, - 4, // 0x66 'f' - 0x20,0x40,0xe0,0x40,0x40,0x00, + 4, // 0x66 'f' + 0x20, 0x40, 0xe0, 0x40, 0x40, 0x00, - 4, // 0x67 'g' - 0x00,0x60,0xa0,0x60,0x20,0xc0, + 4, // 0x67 'g' + 0x00, 0x60, 0xa0, 0x60, 0x20, 0xc0, - 4, // 0x68 'h' - 0x80,0x80,0xc0,0xa0,0xa0,0x00, + 4, // 0x68 'h' + 0x80, 0x80, 0xc0, 0xa0, 0xa0, 0x00, - 4, // 0x69 'i' - 0x40,0x00,0xc0,0x40,0xe0,0x00, + 4, // 0x69 'i' + 0x40, 0x00, 0xc0, 0x40, 0xe0, 0x00, - 4, // 0x6a 'j' - 0x40,0x00,0xc0,0x40,0x40,0x80, + 4, // 0x6a 'j' + 0x40, 0x00, 0xc0, 0x40, 0x40, 0x80, - 4, // 0x6b 'k' - 0x80,0x80,0xa0,0xc0,0xa0,0x00, + 4, // 0x6b 'k' + 0x80, 0x80, 0xa0, 0xc0, 0xa0, 0x00, - 4, // 0x6c 'l' - 0xc0,0x40,0x40,0x40,0xe0,0x00, + 4, // 0x6c 'l' + 0xc0, 0x40, 0x40, 0x40, 0xe0, 0x00, - 4, // 0x6d 'm' - 0x00,0xa0,0xf0,0xf0,0x90,0x00, + 4, // 0x6d 'm' + 0x00, 0xa0, 0xf0, 0xf0, 0x90, 0x00, - 4, // 0x6e 'n' - 0x00,0xc0,0xa0,0xa0,0xa0,0x00, + 4, // 0x6e 'n' + 0x00, 0xc0, 0xa0, 0xa0, 0xa0, 0x00, - 4, // 0x6f 'o' - 0x00,0x40,0xa0,0xa0,0x40,0x00, + 4, // 0x6f 'o' + 0x00, 0x40, 0xa0, 0xa0, 0x40, 0x00, - 4, // 0x70 'p' - 0x00,0xc0,0xa0,0xc0,0x80,0x80, + 4, // 0x70 'p' + 0x00, 0xc0, 0xa0, 0xc0, 0x80, 0x80, - 4, // 0x71 'q' - 0x00,0x60,0xa0,0x60,0x20,0x20, + 4, // 0x71 'q' + 0x00, 0x60, 0xa0, 0x60, 0x20, 0x20, - 4, // 0x72 'r' - 0x00,0xa0,0x50,0x40,0x40,0x00, + 4, // 0x72 'r' + 0x00, 0xa0, 0x50, 0x40, 0x40, 0x00, - 4, // 0x73 's' - 0x00,0x60,0xc0,0x20,0xc0,0x00, + 4, // 0x73 's' + 0x00, 0x60, 0xc0, 0x20, 0xc0, 0x00, - 4, // 0x74 't' - 0x40,0x40,0xe0,0x40,0x60,0x00, + 4, // 0x74 't' + 0x40, 0x40, 0xe0, 0x40, 0x60, 0x00, - 4, // 0x75 'u' - 0x00,0xa0,0xa0,0xa0,0x60,0x00, + 4, // 0x75 'u' + 0x00, 0xa0, 0xa0, 0xa0, 0x60, 0x00, - 4, // 0x76 'v' - 0x00,0xa0,0xa0,0xa0,0x40,0x00, + 4, // 0x76 'v' + 0x00, 0xa0, 0xa0, 0xa0, 0x40, 0x00, - 4, // 0x77 'w' - 0x00,0xa0,0xa0,0xe0,0xa0,0x00, + 4, // 0x77 'w' + 0x00, 0xa0, 0xa0, 0xe0, 0xa0, 0x00, - 4, // 0x78 'x' - 0x00,0xa0,0x40,0xa0,0xa0,0x00, + 4, // 0x78 'x' + 0x00, 0xa0, 0x40, 0xa0, 0xa0, 0x00, - 4, // 0x79 'y' - 0x00,0xa0,0xa0,0x60,0x20,0xc0, + 4, // 0x79 'y' + 0x00, 0xa0, 0xa0, 0x60, 0x20, 0xc0, - 4, // 0x7a 'z' - 0x00,0xe0,0x40,0x80,0xe0,0x00, + 4, // 0x7a 'z' + 0x00, 0xe0, 0x40, 0x80, 0xe0, 0x00, - 4, // 0x7b '{' - 0x30,0x20,0xc0,0x20,0x30,0x00, + 4, // 0x7b '{' + 0x30, 0x20, 0xc0, 0x20, 0x30, 0x00, - 4, // 0x7c '|' - 0x40,0x40,0x00,0x40,0x40,0x40, + 4, // 0x7c '|' + 0x40, 0x40, 0x00, 0x40, 0x40, 0x40, - 4, // 0x7d '}' - 0xc0,0x40,0x30,0x40,0xc0,0x00, + 4, // 0x7d '}' + 0xc0, 0x40, 0x30, 0x40, 0xc0, 0x00, - 4, // 0x7e '~' - 0x50,0xa0,0x00,0x00,0x00,0x00, + 4, // 0x7e '~' + 0x50, 0xa0, 0x00, 0x00, 0x00, 0x00, - 4, // 0x7f '' - 0x00,0x60,0x90,0xf0,0x00,0x00, - 0 -}; + 4, // 0x7f '' + 0x00, 0x60, 0x90, 0xf0, 0x00, 0x00, 0}; -const int8u gse4x8[] = -{ - 8, 0, 32, 128-32, +const int8u gse4x8[] = { + 8, 0, 32, 128 - 32, - 0x00,0x00,0x09,0x00,0x12,0x00,0x1b,0x00,0x24,0x00,0x2d,0x00,0x36,0x00,0x3f,0x00,0x48,0x00, - 0x51,0x00,0x5a,0x00,0x63,0x00,0x6c,0x00,0x75,0x00,0x7e,0x00,0x87,0x00,0x90,0x00,0x99,0x00, - 0xa2,0x00,0xab,0x00,0xb4,0x00,0xbd,0x00,0xc6,0x00,0xcf,0x00,0xd8,0x00,0xe1,0x00,0xea,0x00, - 0xf3,0x00,0xfc,0x00,0x05,0x01,0x0e,0x01,0x17,0x01,0x20,0x01,0x29,0x01,0x32,0x01,0x3b,0x01, - 0x44,0x01,0x4d,0x01,0x56,0x01,0x5f,0x01,0x68,0x01,0x71,0x01,0x7a,0x01,0x83,0x01,0x8c,0x01, - 0x95,0x01,0x9e,0x01,0xa7,0x01,0xb0,0x01,0xb9,0x01,0xc2,0x01,0xcb,0x01,0xd4,0x01,0xdd,0x01, - 0xe6,0x01,0xef,0x01,0xf8,0x01,0x01,0x02,0x0a,0x02,0x13,0x02,0x1c,0x02,0x25,0x02,0x2e,0x02, - 0x37,0x02,0x40,0x02,0x49,0x02,0x52,0x02,0x5b,0x02,0x64,0x02,0x6d,0x02,0x76,0x02,0x7f,0x02, - 0x88,0x02,0x91,0x02,0x9a,0x02,0xa3,0x02,0xac,0x02,0xb5,0x02,0xbe,0x02,0xc7,0x02,0xd0,0x02, - 0xd9,0x02,0xe2,0x02,0xeb,0x02,0xf4,0x02,0xfd,0x02,0x06,0x03,0x0f,0x03,0x18,0x03,0x21,0x03, - 0x2a,0x03,0x33,0x03,0x3c,0x03,0x45,0x03,0x4e,0x03,0x57,0x03, + 0x00, 0x00, 0x09, 0x00, 0x12, 0x00, 0x1b, 0x00, 0x24, 0x00, 0x2d, 0x00, 0x36, 0x00, 0x3f, 0x00, 0x48, 0x00, + 0x51, 0x00, 0x5a, 0x00, 0x63, 0x00, 0x6c, 0x00, 0x75, 0x00, 0x7e, 0x00, 0x87, 0x00, 0x90, 0x00, 0x99, 0x00, + 0xa2, 0x00, 0xab, 0x00, 0xb4, 0x00, 0xbd, 0x00, 0xc6, 0x00, 0xcf, 0x00, 0xd8, 0x00, 0xe1, 0x00, 0xea, 0x00, + 0xf3, 0x00, 0xfc, 0x00, 0x05, 0x01, 0x0e, 0x01, 0x17, 0x01, 0x20, 0x01, 0x29, 0x01, 0x32, 0x01, 0x3b, 0x01, + 0x44, 0x01, 0x4d, 0x01, 0x56, 0x01, 0x5f, 0x01, 0x68, 0x01, 0x71, 0x01, 0x7a, 0x01, 0x83, 0x01, 0x8c, 0x01, + 0x95, 0x01, 0x9e, 0x01, 0xa7, 0x01, 0xb0, 0x01, 0xb9, 0x01, 0xc2, 0x01, 0xcb, 0x01, 0xd4, 0x01, 0xdd, 0x01, + 0xe6, 0x01, 0xef, 0x01, 0xf8, 0x01, 0x01, 0x02, 0x0a, 0x02, 0x13, 0x02, 0x1c, 0x02, 0x25, 0x02, 0x2e, 0x02, + 0x37, 0x02, 0x40, 0x02, 0x49, 0x02, 0x52, 0x02, 0x5b, 0x02, 0x64, 0x02, 0x6d, 0x02, 0x76, 0x02, 0x7f, 0x02, + 0x88, 0x02, 0x91, 0x02, 0x9a, 0x02, 0xa3, 0x02, 0xac, 0x02, 0xb5, 0x02, 0xbe, 0x02, 0xc7, 0x02, 0xd0, 0x02, + 0xd9, 0x02, 0xe2, 0x02, 0xeb, 0x02, 0xf4, 0x02, 0xfd, 0x02, 0x06, 0x03, 0x0f, 0x03, 0x18, 0x03, 0x21, 0x03, + 0x2a, 0x03, 0x33, 0x03, 0x3c, 0x03, 0x45, 0x03, 0x4e, 0x03, 0x57, 0x03, - 4, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x21 '!' - 0x00,0x40,0x40,0x40,0x40,0x00,0x40,0x00, + 4, // 0x21 '!' + 0x00, 0x40, 0x40, 0x40, 0x40, 0x00, 0x40, 0x00, - 4, // 0x22 '"' - 0x00,0xa0,0xa0,0x00,0x00,0x00,0x00,0x00, + 4, // 0x22 '"' + 0x00, 0xa0, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x23 '#' - 0x60,0x60,0xf0,0x60,0x60,0xf0,0x60,0x60, + 4, // 0x23 '#' + 0x60, 0x60, 0xf0, 0x60, 0x60, 0xf0, 0x60, 0x60, - 4, // 0x24 '$' - 0x40,0x60,0xc0,0xc0,0x60,0x60,0xc0,0x40, + 4, // 0x24 '$' + 0x40, 0x60, 0xc0, 0xc0, 0x60, 0x60, 0xc0, 0x40, - 4, // 0x25 '%' - 0x00,0xa0,0x20,0x40,0x40,0x80,0xa0,0x00, + 4, // 0x25 '%' + 0x00, 0xa0, 0x20, 0x40, 0x40, 0x80, 0xa0, 0x00, - 4, // 0x26 '&' - 0x00,0x40,0xa0,0xa0,0x40,0xb0,0xa0,0x70, + 4, // 0x26 '&' + 0x00, 0x40, 0xa0, 0xa0, 0x40, 0xb0, 0xa0, 0x70, - 4, // 0x27 ''' - 0x00,0x40,0x40,0x00,0x00,0x00,0x00,0x00, + 4, // 0x27 ''' + 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x28 '(' - 0x20,0x40,0x80,0x80,0x80,0x80,0x40,0x20, + 4, // 0x28 '(' + 0x20, 0x40, 0x80, 0x80, 0x80, 0x80, 0x40, 0x20, - 4, // 0x29 ')' - 0x80,0x40,0x20,0x20,0x20,0x20,0x40,0x80, + 4, // 0x29 ')' + 0x80, 0x40, 0x20, 0x20, 0x20, 0x20, 0x40, 0x80, - 4, // 0x2a '*' - 0x00,0xa0,0x40,0xe0,0x40,0xa0,0x00,0x00, + 4, // 0x2a '*' + 0x00, 0xa0, 0x40, 0xe0, 0x40, 0xa0, 0x00, 0x00, - 4, // 0x2b '+' - 0x00,0x40,0x40,0xe0,0x40,0x40,0x00,0x00, + 4, // 0x2b '+' + 0x00, 0x40, 0x40, 0xe0, 0x40, 0x40, 0x00, 0x00, - 4, // 0x2c ',' - 0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x80, + 4, // 0x2c ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x80, - 4, // 0x2d '-' - 0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00, + 4, // 0x2d '-' + 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, - 4, // 0x2e '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00, + 4, // 0x2e '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, - 4, // 0x2f '/' - 0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80, + 4, // 0x2f '/' + 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, - 4, // 0x30 '0' - 0x00,0xe0,0xa0,0xa0,0xa0,0xa0,0xe0,0x00, + 4, // 0x30 '0' + 0x00, 0xe0, 0xa0, 0xa0, 0xa0, 0xa0, 0xe0, 0x00, - 4, // 0x31 '1' - 0x00,0x40,0xc0,0x40,0x40,0x40,0xe0,0x00, + 4, // 0x31 '1' + 0x00, 0x40, 0xc0, 0x40, 0x40, 0x40, 0xe0, 0x00, - 4, // 0x32 '2' - 0x00,0xe0,0xa0,0x20,0x40,0x80,0xe0,0x00, + 4, // 0x32 '2' + 0x00, 0xe0, 0xa0, 0x20, 0x40, 0x80, 0xe0, 0x00, - 4, // 0x33 '3' - 0x00,0xe0,0x20,0x40,0x20,0x20,0xe0,0x00, + 4, // 0x33 '3' + 0x00, 0xe0, 0x20, 0x40, 0x20, 0x20, 0xe0, 0x00, - 4, // 0x34 '4' - 0x00,0x60,0xa0,0xa0,0xf0,0x20,0x20,0x00, + 4, // 0x34 '4' + 0x00, 0x60, 0xa0, 0xa0, 0xf0, 0x20, 0x20, 0x00, - 4, // 0x35 '5' - 0x00,0xe0,0x80,0xc0,0x20,0x20,0xc0,0x00, + 4, // 0x35 '5' + 0x00, 0xe0, 0x80, 0xc0, 0x20, 0x20, 0xc0, 0x00, - 4, // 0x36 '6' - 0x00,0x40,0x80,0xe0,0xa0,0xa0,0xe0,0x00, + 4, // 0x36 '6' + 0x00, 0x40, 0x80, 0xe0, 0xa0, 0xa0, 0xe0, 0x00, - 4, // 0x37 '7' - 0x00,0xe0,0xa0,0x20,0x40,0x40,0x40,0x00, + 4, // 0x37 '7' + 0x00, 0xe0, 0xa0, 0x20, 0x40, 0x40, 0x40, 0x00, - 4, // 0x38 '8' - 0x00,0xe0,0xa0,0x40,0xa0,0xa0,0xe0,0x00, + 4, // 0x38 '8' + 0x00, 0xe0, 0xa0, 0x40, 0xa0, 0xa0, 0xe0, 0x00, - 4, // 0x39 '9' - 0x00,0xe0,0xa0,0xe0,0x20,0x20,0x40,0x00, + 4, // 0x39 '9' + 0x00, 0xe0, 0xa0, 0xe0, 0x20, 0x20, 0x40, 0x00, - 4, // 0x3a ':' - 0x00,0x00,0x40,0x00,0x00,0x40,0x00,0x00, + 4, // 0x3a ':' + 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, - 4, // 0x3b ';' - 0x00,0x00,0x40,0x00,0x00,0x40,0x40,0x80, + 4, // 0x3b ';' + 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x40, 0x80, - 4, // 0x3c '<' - 0x00,0x20,0x40,0x80,0x40,0x20,0x00,0x00, + 4, // 0x3c '<' + 0x00, 0x20, 0x40, 0x80, 0x40, 0x20, 0x00, 0x00, - 4, // 0x3d '=' - 0x00,0x00,0xe0,0x00,0xe0,0x00,0x00,0x00, + 4, // 0x3d '=' + 0x00, 0x00, 0xe0, 0x00, 0xe0, 0x00, 0x00, 0x00, - 4, // 0x3e '>' - 0x00,0x80,0x40,0x20,0x40,0x80,0x00,0x00, + 4, // 0x3e '>' + 0x00, 0x80, 0x40, 0x20, 0x40, 0x80, 0x00, 0x00, - 4, // 0x3f '?' - 0x00,0x40,0xa0,0x20,0x40,0x00,0x40,0x00, + 4, // 0x3f '?' + 0x00, 0x40, 0xa0, 0x20, 0x40, 0x00, 0x40, 0x00, - 4, // 0x40 '@' - 0x00,0x40,0xa0,0xe0,0xe0,0x80,0x60,0x00, + 4, // 0x40 '@' + 0x00, 0x40, 0xa0, 0xe0, 0xe0, 0x80, 0x60, 0x00, - 4, // 0x41 'A' - 0x00,0x40,0xa0,0xa0,0xe0,0xa0,0xa0,0x00, + 4, // 0x41 'A' + 0x00, 0x40, 0xa0, 0xa0, 0xe0, 0xa0, 0xa0, 0x00, - 4, // 0x42 'B' - 0x00,0xc0,0xa0,0xc0,0xa0,0xa0,0xc0,0x00, + 4, // 0x42 'B' + 0x00, 0xc0, 0xa0, 0xc0, 0xa0, 0xa0, 0xc0, 0x00, - 4, // 0x43 'C' - 0x00,0x40,0xa0,0x80,0x80,0xa0,0x40,0x00, + 4, // 0x43 'C' + 0x00, 0x40, 0xa0, 0x80, 0x80, 0xa0, 0x40, 0x00, - 4, // 0x44 'D' - 0x00,0xc0,0xa0,0xa0,0xa0,0xa0,0xc0,0x00, + 4, // 0x44 'D' + 0x00, 0xc0, 0xa0, 0xa0, 0xa0, 0xa0, 0xc0, 0x00, - 4, // 0x45 'E' - 0x00,0xe0,0x80,0xc0,0x80,0x80,0xe0,0x00, + 4, // 0x45 'E' + 0x00, 0xe0, 0x80, 0xc0, 0x80, 0x80, 0xe0, 0x00, - 4, // 0x46 'F' - 0x00,0xe0,0x80,0xc0,0x80,0x80,0x80,0x00, + 4, // 0x46 'F' + 0x00, 0xe0, 0x80, 0xc0, 0x80, 0x80, 0x80, 0x00, - 4, // 0x47 'G' - 0x00,0x60,0x80,0xa0,0xa0,0xa0,0x40,0x00, + 4, // 0x47 'G' + 0x00, 0x60, 0x80, 0xa0, 0xa0, 0xa0, 0x40, 0x00, - 4, // 0x48 'H' - 0x00,0xa0,0xa0,0xe0,0xa0,0xa0,0xa0,0x00, + 4, // 0x48 'H' + 0x00, 0xa0, 0xa0, 0xe0, 0xa0, 0xa0, 0xa0, 0x00, - 4, // 0x49 'I' - 0x00,0xe0,0x40,0x40,0x40,0x40,0xe0,0x00, + 4, // 0x49 'I' + 0x00, 0xe0, 0x40, 0x40, 0x40, 0x40, 0xe0, 0x00, - 4, // 0x4a 'J' - 0x00,0x20,0x20,0x20,0x20,0xa0,0x40,0x00, + 4, // 0x4a 'J' + 0x00, 0x20, 0x20, 0x20, 0x20, 0xa0, 0x40, 0x00, - 4, // 0x4b 'K' - 0x00,0xa0,0xa0,0xc0,0xc0,0xa0,0xa0,0x00, + 4, // 0x4b 'K' + 0x00, 0xa0, 0xa0, 0xc0, 0xc0, 0xa0, 0xa0, 0x00, - 4, // 0x4c 'L' - 0x00,0x80,0x80,0x80,0x80,0x80,0xe0,0x00, + 4, // 0x4c 'L' + 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0xe0, 0x00, - 4, // 0x4d 'M' - 0x00,0xa0,0xe0,0xa0,0xa0,0xa0,0xa0,0x00, + 4, // 0x4d 'M' + 0x00, 0xa0, 0xe0, 0xa0, 0xa0, 0xa0, 0xa0, 0x00, - 4, // 0x4e 'N' - 0x00,0x90,0x90,0xd0,0xb0,0x90,0x90,0x00, + 4, // 0x4e 'N' + 0x00, 0x90, 0x90, 0xd0, 0xb0, 0x90, 0x90, 0x00, - 4, // 0x4f 'O' - 0x00,0x40,0xa0,0xa0,0xa0,0xa0,0x40,0x00, + 4, // 0x4f 'O' + 0x00, 0x40, 0xa0, 0xa0, 0xa0, 0xa0, 0x40, 0x00, - 4, // 0x50 'P' - 0x00,0xc0,0xa0,0xa0,0xc0,0x80,0x80,0x00, + 4, // 0x50 'P' + 0x00, 0xc0, 0xa0, 0xa0, 0xc0, 0x80, 0x80, 0x00, - 4, // 0x51 'Q' - 0x00,0x40,0xa0,0xa0,0xa0,0xa0,0x60,0x00, + 4, // 0x51 'Q' + 0x00, 0x40, 0xa0, 0xa0, 0xa0, 0xa0, 0x60, 0x00, - 4, // 0x52 'R' - 0x00,0xc0,0xa0,0xa0,0xc0,0xc0,0xa0,0x00, + 4, // 0x52 'R' + 0x00, 0xc0, 0xa0, 0xa0, 0xc0, 0xc0, 0xa0, 0x00, - 4, // 0x53 'S' - 0x00,0x60,0x80,0x40,0x20,0x20,0xc0,0x00, + 4, // 0x53 'S' + 0x00, 0x60, 0x80, 0x40, 0x20, 0x20, 0xc0, 0x00, - 4, // 0x54 'T' - 0x00,0xe0,0x40,0x40,0x40,0x40,0x40,0x00, + 4, // 0x54 'T' + 0x00, 0xe0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, - 4, // 0x55 'U' - 0x00,0xa0,0xa0,0xa0,0xa0,0xa0,0x40,0x00, + 4, // 0x55 'U' + 0x00, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0x40, 0x00, - 4, // 0x56 'V' - 0x00,0xa0,0xa0,0xa0,0xa0,0x40,0x40,0x00, + 4, // 0x56 'V' + 0x00, 0xa0, 0xa0, 0xa0, 0xa0, 0x40, 0x40, 0x00, - 4, // 0x57 'W' - 0x00,0xa0,0xa0,0xa0,0xa0,0xe0,0xa0,0x00, + 4, // 0x57 'W' + 0x00, 0xa0, 0xa0, 0xa0, 0xa0, 0xe0, 0xa0, 0x00, - 4, // 0x58 'X' - 0x00,0xa0,0xa0,0x40,0xa0,0xa0,0xa0,0x00, + 4, // 0x58 'X' + 0x00, 0xa0, 0xa0, 0x40, 0xa0, 0xa0, 0xa0, 0x00, - 4, // 0x59 'Y' - 0x00,0xa0,0xa0,0x40,0x40,0x40,0x40,0x00, + 4, // 0x59 'Y' + 0x00, 0xa0, 0xa0, 0x40, 0x40, 0x40, 0x40, 0x00, - 4, // 0x5a 'Z' - 0x00,0xe0,0x20,0x40,0x40,0x80,0xe0,0x00, + 4, // 0x5a 'Z' + 0x00, 0xe0, 0x20, 0x40, 0x40, 0x80, 0xe0, 0x00, - 4, // 0x5b '[' - 0xc0,0x80,0x80,0x80,0x80,0x80,0x80,0xc0, + 4, // 0x5b '[' + 0xc0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, - 4, // 0x5c '\' - 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10, + 4, // 0x5c '\' + 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, - 4, // 0x5d ']' - 0xc0,0x40,0x40,0x40,0x40,0x40,0x40,0xc0, + 4, // 0x5d ']' + 0xc0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0, - 4, // 0x5e '^' - 0x00,0x40,0xa0,0x00,0x00,0x00,0x00,0x00, + 4, // 0x5e '^' + 0x00, 0x40, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x5f '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0, + 4, // 0x5f '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, - 4, // 0x60 '`' - 0x00,0x40,0x20,0x00,0x00,0x00,0x00,0x00, + 4, // 0x60 '`' + 0x00, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x61 'a' - 0x00,0x00,0x60,0xa0,0xa0,0xa0,0x70,0x00, + 4, // 0x61 'a' + 0x00, 0x00, 0x60, 0xa0, 0xa0, 0xa0, 0x70, 0x00, - 4, // 0x62 'b' - 0x00,0x80,0x80,0xc0,0xa0,0xa0,0xc0,0x00, + 4, // 0x62 'b' + 0x00, 0x80, 0x80, 0xc0, 0xa0, 0xa0, 0xc0, 0x00, - 4, // 0x63 'c' - 0x00,0x00,0x40,0xa0,0x80,0xa0,0x40,0x00, + 4, // 0x63 'c' + 0x00, 0x00, 0x40, 0xa0, 0x80, 0xa0, 0x40, 0x00, - 4, // 0x64 'd' - 0x00,0x20,0x20,0x60,0xa0,0xa0,0x60,0x00, + 4, // 0x64 'd' + 0x00, 0x20, 0x20, 0x60, 0xa0, 0xa0, 0x60, 0x00, - 4, // 0x65 'e' - 0x00,0x00,0x40,0xa0,0xe0,0x80,0x60,0x00, + 4, // 0x65 'e' + 0x00, 0x00, 0x40, 0xa0, 0xe0, 0x80, 0x60, 0x00, - 4, // 0x66 'f' - 0x00,0x20,0x40,0x40,0xe0,0x40,0x40,0x00, + 4, // 0x66 'f' + 0x00, 0x20, 0x40, 0x40, 0xe0, 0x40, 0x40, 0x00, - 4, // 0x67 'g' - 0x00,0x00,0x60,0xa0,0xa0,0x60,0x20,0xc0, + 4, // 0x67 'g' + 0x00, 0x00, 0x60, 0xa0, 0xa0, 0x60, 0x20, 0xc0, - 4, // 0x68 'h' - 0x00,0x80,0x80,0xc0,0xa0,0xa0,0xa0,0x00, + 4, // 0x68 'h' + 0x00, 0x80, 0x80, 0xc0, 0xa0, 0xa0, 0xa0, 0x00, - 4, // 0x69 'i' - 0x00,0x40,0x00,0xc0,0x40,0x40,0xe0,0x00, + 4, // 0x69 'i' + 0x00, 0x40, 0x00, 0xc0, 0x40, 0x40, 0xe0, 0x00, - 4, // 0x6a 'j' - 0x00,0x40,0x00,0xc0,0x40,0x40,0x40,0x80, + 4, // 0x6a 'j' + 0x00, 0x40, 0x00, 0xc0, 0x40, 0x40, 0x40, 0x80, - 4, // 0x6b 'k' - 0x00,0x80,0x80,0xa0,0xc0,0xc0,0xa0,0x00, + 4, // 0x6b 'k' + 0x00, 0x80, 0x80, 0xa0, 0xc0, 0xc0, 0xa0, 0x00, - 4, // 0x6c 'l' - 0x00,0xc0,0x40,0x40,0x40,0x40,0xe0,0x00, + 4, // 0x6c 'l' + 0x00, 0xc0, 0x40, 0x40, 0x40, 0x40, 0xe0, 0x00, - 4, // 0x6d 'm' - 0x00,0x00,0xa0,0xf0,0xf0,0xf0,0x90,0x00, + 4, // 0x6d 'm' + 0x00, 0x00, 0xa0, 0xf0, 0xf0, 0xf0, 0x90, 0x00, - 4, // 0x6e 'n' - 0x00,0x00,0xc0,0xa0,0xa0,0xa0,0xa0,0x00, + 4, // 0x6e 'n' + 0x00, 0x00, 0xc0, 0xa0, 0xa0, 0xa0, 0xa0, 0x00, - 4, // 0x6f 'o' - 0x00,0x00,0x40,0xa0,0xa0,0xa0,0x40,0x00, + 4, // 0x6f 'o' + 0x00, 0x00, 0x40, 0xa0, 0xa0, 0xa0, 0x40, 0x00, - 4, // 0x70 'p' - 0x00,0x00,0xc0,0xa0,0xa0,0xc0,0x80,0x80, + 4, // 0x70 'p' + 0x00, 0x00, 0xc0, 0xa0, 0xa0, 0xc0, 0x80, 0x80, - 4, // 0x71 'q' - 0x00,0x00,0x60,0xa0,0xa0,0x60,0x20,0x20, + 4, // 0x71 'q' + 0x00, 0x00, 0x60, 0xa0, 0xa0, 0x60, 0x20, 0x20, - 4, // 0x72 'r' - 0x00,0x00,0xa0,0x50,0x40,0x40,0x40,0x00, + 4, // 0x72 'r' + 0x00, 0x00, 0xa0, 0x50, 0x40, 0x40, 0x40, 0x00, - 4, // 0x73 's' - 0x00,0x00,0x60,0x80,0x40,0x20,0xc0,0x00, + 4, // 0x73 's' + 0x00, 0x00, 0x60, 0x80, 0x40, 0x20, 0xc0, 0x00, - 4, // 0x74 't' - 0x00,0x40,0x40,0xe0,0x40,0x40,0x20,0x00, + 4, // 0x74 't' + 0x00, 0x40, 0x40, 0xe0, 0x40, 0x40, 0x20, 0x00, - 4, // 0x75 'u' - 0x00,0x00,0xa0,0xa0,0xa0,0xa0,0x60,0x00, + 4, // 0x75 'u' + 0x00, 0x00, 0xa0, 0xa0, 0xa0, 0xa0, 0x60, 0x00, - 4, // 0x76 'v' - 0x00,0x00,0xa0,0xa0,0xa0,0x40,0x40,0x00, + 4, // 0x76 'v' + 0x00, 0x00, 0xa0, 0xa0, 0xa0, 0x40, 0x40, 0x00, - 4, // 0x77 'w' - 0x00,0x00,0xa0,0xa0,0xa0,0xe0,0xa0,0x00, + 4, // 0x77 'w' + 0x00, 0x00, 0xa0, 0xa0, 0xa0, 0xe0, 0xa0, 0x00, - 4, // 0x78 'x' - 0x00,0x00,0xa0,0xa0,0x40,0xa0,0xa0,0x00, + 4, // 0x78 'x' + 0x00, 0x00, 0xa0, 0xa0, 0x40, 0xa0, 0xa0, 0x00, - 4, // 0x79 'y' - 0x00,0x00,0xa0,0xa0,0xa0,0x60,0x20,0xc0, + 4, // 0x79 'y' + 0x00, 0x00, 0xa0, 0xa0, 0xa0, 0x60, 0x20, 0xc0, - 4, // 0x7a 'z' - 0x00,0x00,0xe0,0x20,0x40,0x80,0xe0,0x00, + 4, // 0x7a 'z' + 0x00, 0x00, 0xe0, 0x20, 0x40, 0x80, 0xe0, 0x00, - 4, // 0x7b '{' - 0x10,0x20,0x20,0xc0,0x20,0x20,0x10,0x00, + 4, // 0x7b '{' + 0x10, 0x20, 0x20, 0xc0, 0x20, 0x20, 0x10, 0x00, - 4, // 0x7c '|' - 0x00,0x40,0x40,0x40,0x00,0x40,0x40,0x40, + 4, // 0x7c '|' + 0x00, 0x40, 0x40, 0x40, 0x00, 0x40, 0x40, 0x40, - 4, // 0x7d '}' - 0x80,0x40,0x40,0x30,0x40,0x40,0x80,0x00, + 4, // 0x7d '}' + 0x80, 0x40, 0x40, 0x30, 0x40, 0x40, 0x80, 0x00, - 4, // 0x7e '~' - 0x00,0x50,0xa0,0x00,0x00,0x00,0x00,0x00, + 4, // 0x7e '~' + 0x00, 0x50, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x7f '' - 0x00,0x00,0x00,0x60,0x90,0xf0,0x00,0x00, - 0 -}; + 4, // 0x7f '' + 0x00, 0x00, 0x00, 0x60, 0x90, 0xf0, 0x00, 0x00, 0}; -const int8u gse5x7[] = -{ - 7, 0, 32, 128-32, +const int8u gse5x7[] = { + 7, 0, 32, 128 - 32, - 0x00,0x00,0x08,0x00,0x10,0x00,0x18,0x00,0x20,0x00,0x28,0x00,0x30,0x00,0x38,0x00,0x40,0x00, - 0x48,0x00,0x50,0x00,0x58,0x00,0x60,0x00,0x68,0x00,0x70,0x00,0x78,0x00,0x80,0x00,0x88,0x00, - 0x90,0x00,0x98,0x00,0xa0,0x00,0xa8,0x00,0xb0,0x00,0xb8,0x00,0xc0,0x00,0xc8,0x00,0xd0,0x00, - 0xd8,0x00,0xe0,0x00,0xe8,0x00,0xf0,0x00,0xf8,0x00,0x00,0x01,0x08,0x01,0x10,0x01,0x18,0x01, - 0x20,0x01,0x28,0x01,0x30,0x01,0x38,0x01,0x40,0x01,0x48,0x01,0x50,0x01,0x58,0x01,0x60,0x01, - 0x68,0x01,0x70,0x01,0x78,0x01,0x80,0x01,0x88,0x01,0x90,0x01,0x98,0x01,0xa0,0x01,0xa8,0x01, - 0xb0,0x01,0xb8,0x01,0xc0,0x01,0xc8,0x01,0xd0,0x01,0xd8,0x01,0xe0,0x01,0xe8,0x01,0xf0,0x01, - 0xf8,0x01,0x00,0x02,0x08,0x02,0x10,0x02,0x18,0x02,0x20,0x02,0x28,0x02,0x30,0x02,0x38,0x02, - 0x40,0x02,0x48,0x02,0x50,0x02,0x58,0x02,0x60,0x02,0x68,0x02,0x70,0x02,0x78,0x02,0x80,0x02, - 0x88,0x02,0x90,0x02,0x98,0x02,0xa0,0x02,0xa8,0x02,0xb0,0x02,0xb8,0x02,0xc0,0x02,0xc8,0x02, - 0xd0,0x02,0xd8,0x02,0xe0,0x02,0xe8,0x02,0xf0,0x02,0xf8,0x02, + 0x00, 0x00, 0x08, 0x00, 0x10, 0x00, 0x18, 0x00, 0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x40, 0x00, + 0x48, 0x00, 0x50, 0x00, 0x58, 0x00, 0x60, 0x00, 0x68, 0x00, 0x70, 0x00, 0x78, 0x00, 0x80, 0x00, 0x88, 0x00, + 0x90, 0x00, 0x98, 0x00, 0xa0, 0x00, 0xa8, 0x00, 0xb0, 0x00, 0xb8, 0x00, 0xc0, 0x00, 0xc8, 0x00, 0xd0, 0x00, + 0xd8, 0x00, 0xe0, 0x00, 0xe8, 0x00, 0xf0, 0x00, 0xf8, 0x00, 0x00, 0x01, 0x08, 0x01, 0x10, 0x01, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x01, 0x30, 0x01, 0x38, 0x01, 0x40, 0x01, 0x48, 0x01, 0x50, 0x01, 0x58, 0x01, 0x60, 0x01, + 0x68, 0x01, 0x70, 0x01, 0x78, 0x01, 0x80, 0x01, 0x88, 0x01, 0x90, 0x01, 0x98, 0x01, 0xa0, 0x01, 0xa8, 0x01, + 0xb0, 0x01, 0xb8, 0x01, 0xc0, 0x01, 0xc8, 0x01, 0xd0, 0x01, 0xd8, 0x01, 0xe0, 0x01, 0xe8, 0x01, 0xf0, 0x01, + 0xf8, 0x01, 0x00, 0x02, 0x08, 0x02, 0x10, 0x02, 0x18, 0x02, 0x20, 0x02, 0x28, 0x02, 0x30, 0x02, 0x38, 0x02, + 0x40, 0x02, 0x48, 0x02, 0x50, 0x02, 0x58, 0x02, 0x60, 0x02, 0x68, 0x02, 0x70, 0x02, 0x78, 0x02, 0x80, 0x02, + 0x88, 0x02, 0x90, 0x02, 0x98, 0x02, 0xa0, 0x02, 0xa8, 0x02, 0xb0, 0x02, 0xb8, 0x02, 0xc0, 0x02, 0xc8, 0x02, + 0xd0, 0x02, 0xd8, 0x02, 0xe0, 0x02, 0xe8, 0x02, 0xf0, 0x02, 0xf8, 0x02, - 5, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x21 '!' - 0x00,0x20,0x20,0x20,0x00,0x20,0x00, + 5, // 0x21 '!' + 0x00, 0x20, 0x20, 0x20, 0x00, 0x20, 0x00, - 5, // 0x22 '"' - 0x00,0x50,0x50,0x00,0x00,0x00,0x00, + 5, // 0x22 '"' + 0x00, 0x50, 0x50, 0x00, 0x00, 0x00, 0x00, - 5, // 0x23 '#' - 0x00,0x50,0xf8,0x50,0xf8,0x50,0x00, + 5, // 0x23 '#' + 0x00, 0x50, 0xf8, 0x50, 0xf8, 0x50, 0x00, - 5, // 0x24 '$' - 0x20,0x78,0xa0,0x70,0x28,0xf0,0x20, + 5, // 0x24 '$' + 0x20, 0x78, 0xa0, 0x70, 0x28, 0xf0, 0x20, - 5, // 0x25 '%' - 0x00,0x88,0x10,0x20,0x40,0x88,0x00, + 5, // 0x25 '%' + 0x00, 0x88, 0x10, 0x20, 0x40, 0x88, 0x00, - 5, // 0x26 '&' - 0x00,0x40,0xa0,0x68,0x90,0x68,0x00, + 5, // 0x26 '&' + 0x00, 0x40, 0xa0, 0x68, 0x90, 0x68, 0x00, - 5, // 0x27 ''' - 0x00,0x20,0x20,0x00,0x00,0x00,0x00, + 5, // 0x27 ''' + 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, - 5, // 0x28 '(' - 0x10,0x20,0x40,0x40,0x40,0x20,0x10, + 5, // 0x28 '(' + 0x10, 0x20, 0x40, 0x40, 0x40, 0x20, 0x10, - 5, // 0x29 ')' - 0x80,0x40,0x20,0x20,0x20,0x40,0x80, + 5, // 0x29 ')' + 0x80, 0x40, 0x20, 0x20, 0x20, 0x40, 0x80, - 5, // 0x2a '*' - 0x00,0x20,0xa8,0x70,0xa8,0x20,0x00, + 5, // 0x2a '*' + 0x00, 0x20, 0xa8, 0x70, 0xa8, 0x20, 0x00, - 5, // 0x2b '+' - 0x00,0x20,0x20,0xf8,0x20,0x20,0x00, + 5, // 0x2b '+' + 0x00, 0x20, 0x20, 0xf8, 0x20, 0x20, 0x00, - 5, // 0x2c ',' - 0x00,0x00,0x00,0x00,0x20,0x20,0x40, + 5, // 0x2c ',' + 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x40, - 5, // 0x2d '-' - 0x00,0x00,0x00,0xf0,0x00,0x00,0x00, + 5, // 0x2d '-' + 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, - 5, // 0x2e '.' - 0x00,0x00,0x00,0x00,0x00,0x40,0x00, + 5, // 0x2e '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, - 5, // 0x2f '/' - 0x00,0x08,0x10,0x20,0x40,0x80,0x00, + 5, // 0x2f '/' + 0x00, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, - 5, // 0x30 '0' - 0x00,0x60,0x90,0x90,0x90,0x60,0x00, + 5, // 0x30 '0' + 0x00, 0x60, 0x90, 0x90, 0x90, 0x60, 0x00, - 5, // 0x31 '1' - 0x00,0x20,0x60,0x20,0x20,0x70,0x00, + 5, // 0x31 '1' + 0x00, 0x20, 0x60, 0x20, 0x20, 0x70, 0x00, - 5, // 0x32 '2' - 0x00,0x60,0x90,0x20,0x40,0xf0,0x00, + 5, // 0x32 '2' + 0x00, 0x60, 0x90, 0x20, 0x40, 0xf0, 0x00, - 5, // 0x33 '3' - 0x00,0xf0,0x20,0x60,0x10,0xe0,0x00, + 5, // 0x33 '3' + 0x00, 0xf0, 0x20, 0x60, 0x10, 0xe0, 0x00, - 5, // 0x34 '4' - 0x00,0x30,0x50,0x90,0xf0,0x10,0x00, + 5, // 0x34 '4' + 0x00, 0x30, 0x50, 0x90, 0xf0, 0x10, 0x00, - 5, // 0x35 '5' - 0x00,0xf0,0x80,0xe0,0x10,0xe0,0x00, + 5, // 0x35 '5' + 0x00, 0xf0, 0x80, 0xe0, 0x10, 0xe0, 0x00, - 5, // 0x36 '6' - 0x00,0x60,0x80,0xe0,0x90,0x60,0x00, + 5, // 0x36 '6' + 0x00, 0x60, 0x80, 0xe0, 0x90, 0x60, 0x00, - 5, // 0x37 '7' - 0x00,0xf0,0x90,0x20,0x40,0x40,0x00, + 5, // 0x37 '7' + 0x00, 0xf0, 0x90, 0x20, 0x40, 0x40, 0x00, - 5, // 0x38 '8' - 0x00,0x60,0x90,0x60,0x90,0x60,0x00, + 5, // 0x38 '8' + 0x00, 0x60, 0x90, 0x60, 0x90, 0x60, 0x00, - 5, // 0x39 '9' - 0x00,0x60,0x90,0x70,0x10,0x60,0x00, + 5, // 0x39 '9' + 0x00, 0x60, 0x90, 0x70, 0x10, 0x60, 0x00, - 5, // 0x3a ':' - 0x00,0x00,0x20,0x00,0x20,0x00,0x00, + 5, // 0x3a ':' + 0x00, 0x00, 0x20, 0x00, 0x20, 0x00, 0x00, - 5, // 0x3b ';' - 0x00,0x00,0x20,0x00,0x20,0x20,0x40, + 5, // 0x3b ';' + 0x00, 0x00, 0x20, 0x00, 0x20, 0x20, 0x40, - 5, // 0x3c '<' - 0x00,0x10,0x20,0x40,0x20,0x10,0x00, + 5, // 0x3c '<' + 0x00, 0x10, 0x20, 0x40, 0x20, 0x10, 0x00, - 5, // 0x3d '=' - 0x00,0x00,0xf0,0x00,0xf0,0x00,0x00, + 5, // 0x3d '=' + 0x00, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0x00, - 5, // 0x3e '>' - 0x00,0x80,0x40,0x20,0x40,0x80,0x00, + 5, // 0x3e '>' + 0x00, 0x80, 0x40, 0x20, 0x40, 0x80, 0x00, - 5, // 0x3f '?' - 0x00,0x60,0x90,0x20,0x00,0x20,0x00, + 5, // 0x3f '?' + 0x00, 0x60, 0x90, 0x20, 0x00, 0x20, 0x00, - 5, // 0x40 '@' - 0x00,0x60,0x90,0xb0,0x80,0x70,0x00, + 5, // 0x40 '@' + 0x00, 0x60, 0x90, 0xb0, 0x80, 0x70, 0x00, - 5, // 0x41 'A' - 0x00,0x60,0x90,0xf0,0x90,0x90,0x00, + 5, // 0x41 'A' + 0x00, 0x60, 0x90, 0xf0, 0x90, 0x90, 0x00, - 5, // 0x42 'B' - 0x00,0xe0,0x90,0xe0,0x90,0xe0,0x00, + 5, // 0x42 'B' + 0x00, 0xe0, 0x90, 0xe0, 0x90, 0xe0, 0x00, - 5, // 0x43 'C' - 0x00,0x60,0x90,0x80,0x90,0x60,0x00, + 5, // 0x43 'C' + 0x00, 0x60, 0x90, 0x80, 0x90, 0x60, 0x00, - 5, // 0x44 'D' - 0x00,0xe0,0x90,0x90,0x90,0xe0,0x00, + 5, // 0x44 'D' + 0x00, 0xe0, 0x90, 0x90, 0x90, 0xe0, 0x00, - 5, // 0x45 'E' - 0x00,0xf0,0x80,0xe0,0x80,0xf0,0x00, + 5, // 0x45 'E' + 0x00, 0xf0, 0x80, 0xe0, 0x80, 0xf0, 0x00, - 5, // 0x46 'F' - 0x00,0xf0,0x80,0xe0,0x80,0x80,0x00, + 5, // 0x46 'F' + 0x00, 0xf0, 0x80, 0xe0, 0x80, 0x80, 0x00, - 5, // 0x47 'G' - 0x00,0x70,0x80,0xb0,0x90,0x60,0x00, + 5, // 0x47 'G' + 0x00, 0x70, 0x80, 0xb0, 0x90, 0x60, 0x00, - 5, // 0x48 'H' - 0x00,0x90,0x90,0xf0,0x90,0x90,0x00, + 5, // 0x48 'H' + 0x00, 0x90, 0x90, 0xf0, 0x90, 0x90, 0x00, - 5, // 0x49 'I' - 0x00,0x70,0x20,0x20,0x20,0x70,0x00, + 5, // 0x49 'I' + 0x00, 0x70, 0x20, 0x20, 0x20, 0x70, 0x00, - 5, // 0x4a 'J' - 0x00,0x70,0x20,0x20,0xa0,0x40,0x00, + 5, // 0x4a 'J' + 0x00, 0x70, 0x20, 0x20, 0xa0, 0x40, 0x00, - 5, // 0x4b 'K' - 0x00,0x90,0xa0,0xc0,0xa0,0x90,0x00, + 5, // 0x4b 'K' + 0x00, 0x90, 0xa0, 0xc0, 0xa0, 0x90, 0x00, - 5, // 0x4c 'L' - 0x00,0x80,0x80,0x80,0x80,0xf0,0x00, + 5, // 0x4c 'L' + 0x00, 0x80, 0x80, 0x80, 0x80, 0xf0, 0x00, - 5, // 0x4d 'M' - 0x00,0x90,0xf0,0x90,0x90,0x90,0x00, + 5, // 0x4d 'M' + 0x00, 0x90, 0xf0, 0x90, 0x90, 0x90, 0x00, - 5, // 0x4e 'N' - 0x00,0x90,0xd0,0xb0,0x90,0x90,0x00, + 5, // 0x4e 'N' + 0x00, 0x90, 0xd0, 0xb0, 0x90, 0x90, 0x00, - 5, // 0x4f 'O' - 0x00,0x60,0x90,0x90,0x90,0x60,0x00, + 5, // 0x4f 'O' + 0x00, 0x60, 0x90, 0x90, 0x90, 0x60, 0x00, - 5, // 0x50 'P' - 0x00,0xe0,0x90,0xe0,0x80,0x80,0x00, + 5, // 0x50 'P' + 0x00, 0xe0, 0x90, 0xe0, 0x80, 0x80, 0x00, - 5, // 0x51 'Q' - 0x00,0x60,0x90,0x90,0xa0,0x50,0x00, + 5, // 0x51 'Q' + 0x00, 0x60, 0x90, 0x90, 0xa0, 0x50, 0x00, - 5, // 0x52 'R' - 0x00,0xe0,0x90,0xe0,0xa0,0x90,0x00, + 5, // 0x52 'R' + 0x00, 0xe0, 0x90, 0xe0, 0xa0, 0x90, 0x00, - 5, // 0x53 'S' - 0x00,0x70,0x80,0x60,0x10,0xe0,0x00, + 5, // 0x53 'S' + 0x00, 0x70, 0x80, 0x60, 0x10, 0xe0, 0x00, - 5, // 0x54 'T' - 0x00,0x70,0x20,0x20,0x20,0x20,0x00, + 5, // 0x54 'T' + 0x00, 0x70, 0x20, 0x20, 0x20, 0x20, 0x00, - 5, // 0x55 'U' - 0x00,0x90,0x90,0x90,0x90,0x60,0x00, + 5, // 0x55 'U' + 0x00, 0x90, 0x90, 0x90, 0x90, 0x60, 0x00, - 5, // 0x56 'V' - 0x00,0x50,0x50,0x50,0x20,0x20,0x00, + 5, // 0x56 'V' + 0x00, 0x50, 0x50, 0x50, 0x20, 0x20, 0x00, - 5, // 0x57 'W' - 0x00,0x90,0x90,0x90,0xf0,0x90,0x00, + 5, // 0x57 'W' + 0x00, 0x90, 0x90, 0x90, 0xf0, 0x90, 0x00, - 5, // 0x58 'X' - 0x00,0x90,0x90,0x60,0x90,0x90,0x00, + 5, // 0x58 'X' + 0x00, 0x90, 0x90, 0x60, 0x90, 0x90, 0x00, - 5, // 0x59 'Y' - 0x00,0x50,0x50,0x20,0x20,0x20,0x00, + 5, // 0x59 'Y' + 0x00, 0x50, 0x50, 0x20, 0x20, 0x20, 0x00, - 5, // 0x5a 'Z' - 0x00,0xf0,0x10,0x20,0x40,0xf0,0x00, + 5, // 0x5a 'Z' + 0x00, 0xf0, 0x10, 0x20, 0x40, 0xf0, 0x00, - 5, // 0x5b '[' - 0x70,0x40,0x40,0x40,0x40,0x40,0x70, + 5, // 0x5b '[' + 0x70, 0x40, 0x40, 0x40, 0x40, 0x40, 0x70, - 5, // 0x5c '\' - 0x00,0x80,0x40,0x20,0x10,0x08,0x00, + 5, // 0x5c '\' + 0x00, 0x80, 0x40, 0x20, 0x10, 0x08, 0x00, - 5, // 0x5d ']' - 0xe0,0x20,0x20,0x20,0x20,0x20,0xe0, + 5, // 0x5d ']' + 0xe0, 0x20, 0x20, 0x20, 0x20, 0x20, 0xe0, - 5, // 0x5e '^' - 0x00,0x20,0x50,0x00,0x00,0x00,0x00, + 5, // 0x5e '^' + 0x00, 0x20, 0x50, 0x00, 0x00, 0x00, 0x00, - 5, // 0x5f '_' - 0x00,0x00,0x00,0x00,0x00,0xf8,0x00, + 5, // 0x5f '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, - 5, // 0x60 '`' - 0x00,0x40,0x20,0x00,0x00,0x00,0x00, + 5, // 0x60 '`' + 0x00, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, - 5, // 0x61 'a' - 0x00,0x00,0x60,0xa0,0xa0,0x50,0x00, + 5, // 0x61 'a' + 0x00, 0x00, 0x60, 0xa0, 0xa0, 0x50, 0x00, - 5, // 0x62 'b' - 0x00,0x80,0x80,0xe0,0x90,0xe0,0x00, + 5, // 0x62 'b' + 0x00, 0x80, 0x80, 0xe0, 0x90, 0xe0, 0x00, - 5, // 0x63 'c' - 0x00,0x00,0x70,0x80,0x80,0x70,0x00, + 5, // 0x63 'c' + 0x00, 0x00, 0x70, 0x80, 0x80, 0x70, 0x00, - 5, // 0x64 'd' - 0x00,0x10,0x10,0x70,0x90,0x70,0x00, + 5, // 0x64 'd' + 0x00, 0x10, 0x10, 0x70, 0x90, 0x70, 0x00, - 5, // 0x65 'e' - 0x00,0x00,0x60,0xf0,0x80,0x70,0x00, + 5, // 0x65 'e' + 0x00, 0x00, 0x60, 0xf0, 0x80, 0x70, 0x00, - 5, // 0x66 'f' - 0x00,0x30,0x40,0xe0,0x40,0x40,0x00, + 5, // 0x66 'f' + 0x00, 0x30, 0x40, 0xe0, 0x40, 0x40, 0x00, - 5, // 0x67 'g' - 0x00,0x00,0x70,0x90,0x70,0x10,0x60, + 5, // 0x67 'g' + 0x00, 0x00, 0x70, 0x90, 0x70, 0x10, 0x60, - 5, // 0x68 'h' - 0x00,0x80,0x80,0xe0,0x90,0x90,0x00, + 5, // 0x68 'h' + 0x00, 0x80, 0x80, 0xe0, 0x90, 0x90, 0x00, - 5, // 0x69 'i' - 0x20,0x00,0x60,0x20,0x20,0x70,0x00, + 5, // 0x69 'i' + 0x20, 0x00, 0x60, 0x20, 0x20, 0x70, 0x00, - 5, // 0x6a 'j' - 0x20,0x00,0x60,0x20,0x20,0xa0,0x40, + 5, // 0x6a 'j' + 0x20, 0x00, 0x60, 0x20, 0x20, 0xa0, 0x40, - 5, // 0x6b 'k' - 0x80,0x80,0x90,0xa0,0xe0,0x90,0x00, + 5, // 0x6b 'k' + 0x80, 0x80, 0x90, 0xa0, 0xe0, 0x90, 0x00, - 5, // 0x6c 'l' - 0x00,0x60,0x20,0x20,0x20,0x70,0x00, + 5, // 0x6c 'l' + 0x00, 0x60, 0x20, 0x20, 0x20, 0x70, 0x00, - 5, // 0x6d 'm' - 0x00,0x00,0xa0,0xf0,0xf0,0x90,0x00, + 5, // 0x6d 'm' + 0x00, 0x00, 0xa0, 0xf0, 0xf0, 0x90, 0x00, - 5, // 0x6e 'n' - 0x00,0x00,0xa0,0xd0,0x90,0x90,0x00, + 5, // 0x6e 'n' + 0x00, 0x00, 0xa0, 0xd0, 0x90, 0x90, 0x00, - 5, // 0x6f 'o' - 0x00,0x00,0x60,0x90,0x90,0x60,0x00, + 5, // 0x6f 'o' + 0x00, 0x00, 0x60, 0x90, 0x90, 0x60, 0x00, - 5, // 0x70 'p' - 0x00,0x00,0xe0,0x90,0xe0,0x80,0x80, + 5, // 0x70 'p' + 0x00, 0x00, 0xe0, 0x90, 0xe0, 0x80, 0x80, - 5, // 0x71 'q' - 0x00,0x00,0x70,0x90,0x70,0x10,0x10, + 5, // 0x71 'q' + 0x00, 0x00, 0x70, 0x90, 0x70, 0x10, 0x10, - 5, // 0x72 'r' - 0x00,0x00,0xe0,0x90,0x80,0x80,0x00, + 5, // 0x72 'r' + 0x00, 0x00, 0xe0, 0x90, 0x80, 0x80, 0x00, - 5, // 0x73 's' - 0x00,0x00,0x70,0xe0,0x10,0xe0,0x00, + 5, // 0x73 's' + 0x00, 0x00, 0x70, 0xe0, 0x10, 0xe0, 0x00, - 5, // 0x74 't' - 0x40,0x40,0xe0,0x40,0x40,0x70,0x00, + 5, // 0x74 't' + 0x40, 0x40, 0xe0, 0x40, 0x40, 0x70, 0x00, - 5, // 0x75 'u' - 0x00,0x00,0x90,0x90,0x90,0x70,0x00, + 5, // 0x75 'u' + 0x00, 0x00, 0x90, 0x90, 0x90, 0x70, 0x00, - 5, // 0x76 'v' - 0x00,0x00,0x50,0x50,0x50,0x20,0x00, + 5, // 0x76 'v' + 0x00, 0x00, 0x50, 0x50, 0x50, 0x20, 0x00, - 5, // 0x77 'w' - 0x00,0x00,0x90,0x90,0xf0,0x90,0x00, + 5, // 0x77 'w' + 0x00, 0x00, 0x90, 0x90, 0xf0, 0x90, 0x00, - 5, // 0x78 'x' - 0x00,0x00,0x90,0x60,0x60,0x90,0x00, + 5, // 0x78 'x' + 0x00, 0x00, 0x90, 0x60, 0x60, 0x90, 0x00, - 5, // 0x79 'y' - 0x00,0x00,0x90,0x90,0x70,0x10,0x60, + 5, // 0x79 'y' + 0x00, 0x00, 0x90, 0x90, 0x70, 0x10, 0x60, - 5, // 0x7a 'z' - 0x00,0x00,0xf0,0x20,0x40,0xf0,0x00, + 5, // 0x7a 'z' + 0x00, 0x00, 0xf0, 0x20, 0x40, 0xf0, 0x00, - 5, // 0x7b '{' - 0x10,0x20,0x20,0xc0,0x20,0x20,0x10, + 5, // 0x7b '{' + 0x10, 0x20, 0x20, 0xc0, 0x20, 0x20, 0x10, - 5, // 0x7c '|' - 0x20,0x20,0x20,0x00,0x20,0x20,0x20, + 5, // 0x7c '|' + 0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x20, - 5, // 0x7d '}' - 0x40,0x20,0x20,0x18,0x20,0x20,0x40, + 5, // 0x7d '}' + 0x40, 0x20, 0x20, 0x18, 0x20, 0x20, 0x40, - 5, // 0x7e '~' - 0x00,0x40,0xa8,0x10,0x00,0x00,0x00, + 5, // 0x7e '~' + 0x00, 0x40, 0xa8, 0x10, 0x00, 0x00, 0x00, - 5, // 0x7f '' - 0x00,0x00,0x20,0x50,0x88,0xf8,0x00, - 0 -}; + 5, // 0x7f '' + 0x00, 0x00, 0x20, 0x50, 0x88, 0xf8, 0x00, 0}; -const int8u gse5x9[] = -{ - 9, 0, 32, 128-32, +const int8u gse5x9[] = { + 9, 0, 32, 128 - 32, - 0x00,0x00,0x0a,0x00,0x14,0x00,0x1e,0x00,0x28,0x00,0x32,0x00,0x3c,0x00,0x46,0x00,0x50,0x00, - 0x5a,0x00,0x64,0x00,0x6e,0x00,0x78,0x00,0x82,0x00,0x8c,0x00,0x96,0x00,0xa0,0x00,0xaa,0x00, - 0xb4,0x00,0xbe,0x00,0xc8,0x00,0xd2,0x00,0xdc,0x00,0xe6,0x00,0xf0,0x00,0xfa,0x00,0x04,0x01, - 0x0e,0x01,0x18,0x01,0x22,0x01,0x2c,0x01,0x36,0x01,0x40,0x01,0x4a,0x01,0x54,0x01,0x5e,0x01, - 0x68,0x01,0x72,0x01,0x7c,0x01,0x86,0x01,0x90,0x01,0x9a,0x01,0xa4,0x01,0xae,0x01,0xb8,0x01, - 0xc2,0x01,0xcc,0x01,0xd6,0x01,0xe0,0x01,0xea,0x01,0xf4,0x01,0xfe,0x01,0x08,0x02,0x12,0x02, - 0x1c,0x02,0x26,0x02,0x30,0x02,0x3a,0x02,0x44,0x02,0x4e,0x02,0x58,0x02,0x62,0x02,0x6c,0x02, - 0x76,0x02,0x80,0x02,0x8a,0x02,0x94,0x02,0x9e,0x02,0xa8,0x02,0xb2,0x02,0xbc,0x02,0xc6,0x02, - 0xd0,0x02,0xda,0x02,0xe4,0x02,0xee,0x02,0xf8,0x02,0x02,0x03,0x0c,0x03,0x16,0x03,0x20,0x03, - 0x2a,0x03,0x34,0x03,0x3e,0x03,0x48,0x03,0x52,0x03,0x5c,0x03,0x66,0x03,0x70,0x03,0x7a,0x03, - 0x84,0x03,0x8e,0x03,0x98,0x03,0xa2,0x03,0xac,0x03,0xb6,0x03, + 0x00, 0x00, 0x0a, 0x00, 0x14, 0x00, 0x1e, 0x00, 0x28, 0x00, 0x32, 0x00, 0x3c, 0x00, 0x46, 0x00, 0x50, 0x00, + 0x5a, 0x00, 0x64, 0x00, 0x6e, 0x00, 0x78, 0x00, 0x82, 0x00, 0x8c, 0x00, 0x96, 0x00, 0xa0, 0x00, 0xaa, 0x00, + 0xb4, 0x00, 0xbe, 0x00, 0xc8, 0x00, 0xd2, 0x00, 0xdc, 0x00, 0xe6, 0x00, 0xf0, 0x00, 0xfa, 0x00, 0x04, 0x01, + 0x0e, 0x01, 0x18, 0x01, 0x22, 0x01, 0x2c, 0x01, 0x36, 0x01, 0x40, 0x01, 0x4a, 0x01, 0x54, 0x01, 0x5e, 0x01, + 0x68, 0x01, 0x72, 0x01, 0x7c, 0x01, 0x86, 0x01, 0x90, 0x01, 0x9a, 0x01, 0xa4, 0x01, 0xae, 0x01, 0xb8, 0x01, + 0xc2, 0x01, 0xcc, 0x01, 0xd6, 0x01, 0xe0, 0x01, 0xea, 0x01, 0xf4, 0x01, 0xfe, 0x01, 0x08, 0x02, 0x12, 0x02, + 0x1c, 0x02, 0x26, 0x02, 0x30, 0x02, 0x3a, 0x02, 0x44, 0x02, 0x4e, 0x02, 0x58, 0x02, 0x62, 0x02, 0x6c, 0x02, + 0x76, 0x02, 0x80, 0x02, 0x8a, 0x02, 0x94, 0x02, 0x9e, 0x02, 0xa8, 0x02, 0xb2, 0x02, 0xbc, 0x02, 0xc6, 0x02, + 0xd0, 0x02, 0xda, 0x02, 0xe4, 0x02, 0xee, 0x02, 0xf8, 0x02, 0x02, 0x03, 0x0c, 0x03, 0x16, 0x03, 0x20, 0x03, + 0x2a, 0x03, 0x34, 0x03, 0x3e, 0x03, 0x48, 0x03, 0x52, 0x03, 0x5c, 0x03, 0x66, 0x03, 0x70, 0x03, 0x7a, 0x03, + 0x84, 0x03, 0x8e, 0x03, 0x98, 0x03, 0xa2, 0x03, 0xac, 0x03, 0xb6, 0x03, - 5, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x21 '!' - 0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00, + 5, // 0x21 '!' + 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x00, - 5, // 0x22 '"' - 0x00,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x22 '"' + 0x00, 0x50, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x23 '#' - 0x00,0x50,0x50,0xf8,0x50,0xf8,0x50,0x50,0x00, + 5, // 0x23 '#' + 0x00, 0x50, 0x50, 0xf8, 0x50, 0xf8, 0x50, 0x50, 0x00, - 5, // 0x24 '$' - 0x00,0x20,0x78,0xa0,0x70,0x28,0xf0,0x20,0x00, + 5, // 0x24 '$' + 0x00, 0x20, 0x78, 0xa0, 0x70, 0x28, 0xf0, 0x20, 0x00, - 5, // 0x25 '%' - 0x00,0xc8,0xc8,0x10,0x20,0x40,0x98,0x98,0x00, + 5, // 0x25 '%' + 0x00, 0xc8, 0xc8, 0x10, 0x20, 0x40, 0x98, 0x98, 0x00, - 5, // 0x26 '&' - 0x00,0x40,0xa0,0xa0,0x40,0xa8,0x90,0x68,0x00, + 5, // 0x26 '&' + 0x00, 0x40, 0xa0, 0xa0, 0x40, 0xa8, 0x90, 0x68, 0x00, - 5, // 0x27 ''' - 0x00,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x27 ''' + 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x28 '(' - 0x10,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x10, + 5, // 0x28 '(' + 0x10, 0x20, 0x40, 0x40, 0x40, 0x40, 0x40, 0x20, 0x10, - 5, // 0x29 ')' - 0x80,0x40,0x20,0x20,0x20,0x20,0x20,0x40,0x80, + 5, // 0x29 ')' + 0x80, 0x40, 0x20, 0x20, 0x20, 0x20, 0x20, 0x40, 0x80, - 5, // 0x2a '*' - 0x00,0x00,0x20,0xa8,0x70,0xa8,0x20,0x00,0x00, + 5, // 0x2a '*' + 0x00, 0x00, 0x20, 0xa8, 0x70, 0xa8, 0x20, 0x00, 0x00, - 5, // 0x2b '+' - 0x00,0x00,0x20,0x20,0xf8,0x20,0x20,0x00,0x00, + 5, // 0x2b '+' + 0x00, 0x00, 0x20, 0x20, 0xf8, 0x20, 0x20, 0x00, 0x00, - 5, // 0x2c ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x40, + 5, // 0x2c ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x40, - 5, // 0x2d '-' - 0x00,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0x00, + 5, // 0x2d '-' + 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, - 5, // 0x2e '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00, + 5, // 0x2e '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, - 5, // 0x2f '/' - 0x00,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80, + 5, // 0x2f '/' + 0x00, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, - 5, // 0x30 '0' - 0x00,0x60,0x90,0xb0,0xd0,0x90,0x90,0x60,0x00, + 5, // 0x30 '0' + 0x00, 0x60, 0x90, 0xb0, 0xd0, 0x90, 0x90, 0x60, 0x00, - 5, // 0x31 '1' - 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x70,0x00, + 5, // 0x31 '1' + 0x00, 0x20, 0x60, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, - 5, // 0x32 '2' - 0x00,0x60,0x90,0x10,0x20,0x40,0x80,0xf0,0x00, + 5, // 0x32 '2' + 0x00, 0x60, 0x90, 0x10, 0x20, 0x40, 0x80, 0xf0, 0x00, - 5, // 0x33 '3' - 0x00,0xf0,0x10,0x20,0x60,0x10,0x90,0x60,0x00, + 5, // 0x33 '3' + 0x00, 0xf0, 0x10, 0x20, 0x60, 0x10, 0x90, 0x60, 0x00, - 5, // 0x34 '4' - 0x00,0x30,0x50,0x90,0x90,0xf8,0x10,0x10,0x00, + 5, // 0x34 '4' + 0x00, 0x30, 0x50, 0x90, 0x90, 0xf8, 0x10, 0x10, 0x00, - 5, // 0x35 '5' - 0x00,0xf0,0x80,0xe0,0x10,0x10,0x10,0xe0,0x00, + 5, // 0x35 '5' + 0x00, 0xf0, 0x80, 0xe0, 0x10, 0x10, 0x10, 0xe0, 0x00, - 5, // 0x36 '6' - 0x00,0x60,0x80,0xe0,0x90,0x90,0x90,0x60,0x00, + 5, // 0x36 '6' + 0x00, 0x60, 0x80, 0xe0, 0x90, 0x90, 0x90, 0x60, 0x00, - 5, // 0x37 '7' - 0x00,0xf0,0x90,0x10,0x20,0x40,0x40,0x40,0x00, + 5, // 0x37 '7' + 0x00, 0xf0, 0x90, 0x10, 0x20, 0x40, 0x40, 0x40, 0x00, - 5, // 0x38 '8' - 0x00,0x60,0x90,0x90,0x60,0x90,0x90,0x60,0x00, + 5, // 0x38 '8' + 0x00, 0x60, 0x90, 0x90, 0x60, 0x90, 0x90, 0x60, 0x00, - 5, // 0x39 '9' - 0x00,0x60,0x90,0x90,0x70,0x10,0x90,0x60,0x00, + 5, // 0x39 '9' + 0x00, 0x60, 0x90, 0x90, 0x70, 0x10, 0x90, 0x60, 0x00, - 5, // 0x3a ':' - 0x00,0x00,0x00,0x20,0x00,0x00,0x20,0x00,0x00, + 5, // 0x3a ':' + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x20, 0x00, 0x00, - 5, // 0x3b ';' - 0x00,0x00,0x00,0x20,0x00,0x00,0x20,0x20,0x40, + 5, // 0x3b ';' + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x20, 0x20, 0x40, - 5, // 0x3c '<' - 0x00,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x00, + 5, // 0x3c '<' + 0x00, 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, 0x10, 0x00, - 5, // 0x3d '=' - 0x00,0x00,0x00,0xf0,0x00,0xf0,0x00,0x00,0x00, + 5, // 0x3d '=' + 0x00, 0x00, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0x00, 0x00, - 5, // 0x3e '>' - 0x00,0x80,0x40,0x20,0x10,0x20,0x40,0x80,0x00, + 5, // 0x3e '>' + 0x00, 0x80, 0x40, 0x20, 0x10, 0x20, 0x40, 0x80, 0x00, - 5, // 0x3f '?' - 0x00,0x60,0x90,0x10,0x20,0x20,0x00,0x20,0x00, + 5, // 0x3f '?' + 0x00, 0x60, 0x90, 0x10, 0x20, 0x20, 0x00, 0x20, 0x00, - 5, // 0x40 '@' - 0x00,0x60,0x90,0xb0,0xb0,0xb0,0x80,0x70,0x00, + 5, // 0x40 '@' + 0x00, 0x60, 0x90, 0xb0, 0xb0, 0xb0, 0x80, 0x70, 0x00, - 5, // 0x41 'A' - 0x00,0x60,0x90,0x90,0xf0,0x90,0x90,0x90,0x00, + 5, // 0x41 'A' + 0x00, 0x60, 0x90, 0x90, 0xf0, 0x90, 0x90, 0x90, 0x00, - 5, // 0x42 'B' - 0x00,0xe0,0x90,0x90,0xe0,0x90,0x90,0xe0,0x00, + 5, // 0x42 'B' + 0x00, 0xe0, 0x90, 0x90, 0xe0, 0x90, 0x90, 0xe0, 0x00, - 5, // 0x43 'C' - 0x00,0x60,0x90,0x80,0x80,0x80,0x90,0x60,0x00, + 5, // 0x43 'C' + 0x00, 0x60, 0x90, 0x80, 0x80, 0x80, 0x90, 0x60, 0x00, - 5, // 0x44 'D' - 0x00,0xe0,0x90,0x90,0x90,0x90,0x90,0xe0,0x00, + 5, // 0x44 'D' + 0x00, 0xe0, 0x90, 0x90, 0x90, 0x90, 0x90, 0xe0, 0x00, - 5, // 0x45 'E' - 0x00,0xf0,0x80,0x80,0xe0,0x80,0x80,0xf0,0x00, + 5, // 0x45 'E' + 0x00, 0xf0, 0x80, 0x80, 0xe0, 0x80, 0x80, 0xf0, 0x00, - 5, // 0x46 'F' - 0x00,0xf0,0x80,0x80,0xe0,0x80,0x80,0x80,0x00, + 5, // 0x46 'F' + 0x00, 0xf0, 0x80, 0x80, 0xe0, 0x80, 0x80, 0x80, 0x00, - 5, // 0x47 'G' - 0x00,0x60,0x90,0x80,0xb0,0x90,0x90,0x60,0x00, + 5, // 0x47 'G' + 0x00, 0x60, 0x90, 0x80, 0xb0, 0x90, 0x90, 0x60, 0x00, - 5, // 0x48 'H' - 0x00,0x90,0x90,0x90,0xf0,0x90,0x90,0x90,0x00, + 5, // 0x48 'H' + 0x00, 0x90, 0x90, 0x90, 0xf0, 0x90, 0x90, 0x90, 0x00, - 5, // 0x49 'I' - 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x70,0x00, + 5, // 0x49 'I' + 0x00, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, - 5, // 0x4a 'J' - 0x00,0x70,0x20,0x20,0x20,0x20,0xa0,0x40,0x00, + 5, // 0x4a 'J' + 0x00, 0x70, 0x20, 0x20, 0x20, 0x20, 0xa0, 0x40, 0x00, - 5, // 0x4b 'K' - 0x00,0x90,0x90,0xa0,0xc0,0xa0,0x90,0x90,0x00, + 5, // 0x4b 'K' + 0x00, 0x90, 0x90, 0xa0, 0xc0, 0xa0, 0x90, 0x90, 0x00, - 5, // 0x4c 'L' - 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0xf0,0x00, + 5, // 0x4c 'L' + 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xf0, 0x00, - 5, // 0x4d 'M' - 0x00,0x90,0xf0,0x90,0x90,0x90,0x90,0x90,0x00, + 5, // 0x4d 'M' + 0x00, 0x90, 0xf0, 0x90, 0x90, 0x90, 0x90, 0x90, 0x00, - 5, // 0x4e 'N' - 0x00,0x90,0x90,0xd0,0xb0,0x90,0x90,0x90,0x00, + 5, // 0x4e 'N' + 0x00, 0x90, 0x90, 0xd0, 0xb0, 0x90, 0x90, 0x90, 0x00, - 5, // 0x4f 'O' - 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x60,0x00, + 5, // 0x4f 'O' + 0x00, 0x60, 0x90, 0x90, 0x90, 0x90, 0x90, 0x60, 0x00, - 5, // 0x50 'P' - 0x00,0xe0,0x90,0x90,0xe0,0x80,0x80,0x80,0x00, + 5, // 0x50 'P' + 0x00, 0xe0, 0x90, 0x90, 0xe0, 0x80, 0x80, 0x80, 0x00, - 5, // 0x51 'Q' - 0x00,0x60,0x90,0x90,0x90,0x90,0xa0,0x50,0x00, + 5, // 0x51 'Q' + 0x00, 0x60, 0x90, 0x90, 0x90, 0x90, 0xa0, 0x50, 0x00, - 5, // 0x52 'R' - 0x00,0xe0,0x90,0x90,0xe0,0xa0,0x90,0x90,0x00, + 5, // 0x52 'R' + 0x00, 0xe0, 0x90, 0x90, 0xe0, 0xa0, 0x90, 0x90, 0x00, - 5, // 0x53 'S' - 0x00,0x60,0x90,0x80,0x60,0x10,0x90,0x60,0x00, + 5, // 0x53 'S' + 0x00, 0x60, 0x90, 0x80, 0x60, 0x10, 0x90, 0x60, 0x00, - 5, // 0x54 'T' - 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x00, + 5, // 0x54 'T' + 0x00, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, - 5, // 0x55 'U' - 0x00,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00, + 5, // 0x55 'U' + 0x00, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x60, 0x00, - 5, // 0x56 'V' - 0x00,0x50,0x50,0x50,0x50,0x50,0x20,0x20,0x00, + 5, // 0x56 'V' + 0x00, 0x50, 0x50, 0x50, 0x50, 0x50, 0x20, 0x20, 0x00, - 5, // 0x57 'W' - 0x00,0x90,0x90,0x90,0x90,0x90,0xf0,0x90,0x00, + 5, // 0x57 'W' + 0x00, 0x90, 0x90, 0x90, 0x90, 0x90, 0xf0, 0x90, 0x00, - 5, // 0x58 'X' - 0x00,0x90,0x90,0x60,0x60,0x90,0x90,0x90,0x00, + 5, // 0x58 'X' + 0x00, 0x90, 0x90, 0x60, 0x60, 0x90, 0x90, 0x90, 0x00, - 5, // 0x59 'Y' - 0x00,0x50,0x50,0x50,0x20,0x20,0x20,0x20,0x00, + 5, // 0x59 'Y' + 0x00, 0x50, 0x50, 0x50, 0x20, 0x20, 0x20, 0x20, 0x00, - 5, // 0x5a 'Z' - 0x00,0xf0,0x10,0x10,0x20,0x40,0x80,0xf0,0x00, + 5, // 0x5a 'Z' + 0x00, 0xf0, 0x10, 0x10, 0x20, 0x40, 0x80, 0xf0, 0x00, - 5, // 0x5b '[' - 0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x70,0x00, + 5, // 0x5b '[' + 0x70, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x70, 0x00, - 5, // 0x5c '\' - 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x00, + 5, // 0x5c '\' + 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x00, - 5, // 0x5d ']' - 0xe0,0x20,0x20,0x20,0x20,0x20,0x20,0xe0,0x00, + 5, // 0x5d ']' + 0xe0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xe0, 0x00, - 5, // 0x5e '^' - 0x00,0x20,0x50,0x88,0x00,0x00,0x00,0x00,0x00, + 5, // 0x5e '^' + 0x00, 0x20, 0x50, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x5f '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x00, + 5, // 0x5f '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, - 5, // 0x60 '`' - 0x00,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x60 '`' + 0x00, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x61 'a' - 0x00,0x00,0x60,0x10,0x70,0x90,0x90,0x70,0x00, + 5, // 0x61 'a' + 0x00, 0x00, 0x60, 0x10, 0x70, 0x90, 0x90, 0x70, 0x00, - 5, // 0x62 'b' - 0x00,0x80,0x80,0xe0,0x90,0x90,0x90,0xe0,0x00, + 5, // 0x62 'b' + 0x00, 0x80, 0x80, 0xe0, 0x90, 0x90, 0x90, 0xe0, 0x00, - 5, // 0x63 'c' - 0x00,0x00,0x60,0x90,0x80,0x80,0x90,0x60,0x00, + 5, // 0x63 'c' + 0x00, 0x00, 0x60, 0x90, 0x80, 0x80, 0x90, 0x60, 0x00, - 5, // 0x64 'd' - 0x00,0x10,0x10,0x70,0x90,0x90,0x90,0x70,0x00, + 5, // 0x64 'd' + 0x00, 0x10, 0x10, 0x70, 0x90, 0x90, 0x90, 0x70, 0x00, - 5, // 0x65 'e' - 0x00,0x00,0x60,0x90,0xf0,0x80,0x80,0x70,0x00, + 5, // 0x65 'e' + 0x00, 0x00, 0x60, 0x90, 0xf0, 0x80, 0x80, 0x70, 0x00, - 5, // 0x66 'f' - 0x00,0x30,0x40,0x40,0xe0,0x40,0x40,0x40,0x00, + 5, // 0x66 'f' + 0x00, 0x30, 0x40, 0x40, 0xe0, 0x40, 0x40, 0x40, 0x00, - 5, // 0x67 'g' - 0x00,0x00,0x70,0x90,0x90,0x70,0x10,0x90,0x60, + 5, // 0x67 'g' + 0x00, 0x00, 0x70, 0x90, 0x90, 0x70, 0x10, 0x90, 0x60, - 5, // 0x68 'h' - 0x00,0x80,0x80,0xe0,0x90,0x90,0x90,0x90,0x00, + 5, // 0x68 'h' + 0x00, 0x80, 0x80, 0xe0, 0x90, 0x90, 0x90, 0x90, 0x00, - 5, // 0x69 'i' - 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0x70,0x00, + 5, // 0x69 'i' + 0x00, 0x20, 0x00, 0x60, 0x20, 0x20, 0x20, 0x70, 0x00, - 5, // 0x6a 'j' - 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0xa0,0x40, + 5, // 0x6a 'j' + 0x00, 0x20, 0x00, 0x60, 0x20, 0x20, 0x20, 0xa0, 0x40, - 5, // 0x6b 'k' - 0x00,0x80,0x80,0x90,0xa0,0xc0,0xa0,0x90,0x00, + 5, // 0x6b 'k' + 0x00, 0x80, 0x80, 0x90, 0xa0, 0xc0, 0xa0, 0x90, 0x00, - 5, // 0x6c 'l' - 0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00, + 5, // 0x6c 'l' + 0x00, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, - 5, // 0x6d 'm' - 0x00,0x00,0xa0,0xf0,0xf0,0xf0,0x90,0x90,0x00, + 5, // 0x6d 'm' + 0x00, 0x00, 0xa0, 0xf0, 0xf0, 0xf0, 0x90, 0x90, 0x00, - 5, // 0x6e 'n' - 0x00,0x00,0xa0,0xd0,0x90,0x90,0x90,0x90,0x00, + 5, // 0x6e 'n' + 0x00, 0x00, 0xa0, 0xd0, 0x90, 0x90, 0x90, 0x90, 0x00, - 5, // 0x6f 'o' - 0x00,0x00,0x60,0x90,0x90,0x90,0x90,0x60,0x00, + 5, // 0x6f 'o' + 0x00, 0x00, 0x60, 0x90, 0x90, 0x90, 0x90, 0x60, 0x00, - 5, // 0x70 'p' - 0x00,0x00,0xe0,0x90,0x90,0x90,0xe0,0x80,0x80, + 5, // 0x70 'p' + 0x00, 0x00, 0xe0, 0x90, 0x90, 0x90, 0xe0, 0x80, 0x80, - 5, // 0x71 'q' - 0x00,0x00,0x70,0x90,0x90,0x90,0x70,0x10,0x10, + 5, // 0x71 'q' + 0x00, 0x00, 0x70, 0x90, 0x90, 0x90, 0x70, 0x10, 0x10, - 5, // 0x72 'r' - 0x00,0x00,0xe0,0x90,0x80,0x80,0x80,0x80,0x00, + 5, // 0x72 'r' + 0x00, 0x00, 0xe0, 0x90, 0x80, 0x80, 0x80, 0x80, 0x00, - 5, // 0x73 's' - 0x00,0x00,0x60,0x90,0x40,0x20,0x90,0x60,0x00, + 5, // 0x73 's' + 0x00, 0x00, 0x60, 0x90, 0x40, 0x20, 0x90, 0x60, 0x00, - 5, // 0x74 't' - 0x00,0x40,0x40,0xe0,0x40,0x40,0x50,0x20,0x00, + 5, // 0x74 't' + 0x00, 0x40, 0x40, 0xe0, 0x40, 0x40, 0x50, 0x20, 0x00, - 5, // 0x75 'u' - 0x00,0x00,0x90,0x90,0x90,0x90,0x90,0x70,0x00, + 5, // 0x75 'u' + 0x00, 0x00, 0x90, 0x90, 0x90, 0x90, 0x90, 0x70, 0x00, - 5, // 0x76 'v' - 0x00,0x00,0x50,0x50,0x50,0x50,0x20,0x20,0x00, + 5, // 0x76 'v' + 0x00, 0x00, 0x50, 0x50, 0x50, 0x50, 0x20, 0x20, 0x00, - 5, // 0x77 'w' - 0x00,0x00,0x90,0x90,0x90,0x90,0xf0,0x90,0x00, + 5, // 0x77 'w' + 0x00, 0x00, 0x90, 0x90, 0x90, 0x90, 0xf0, 0x90, 0x00, - 5, // 0x78 'x' - 0x00,0x00,0x90,0x90,0x60,0x60,0x90,0x90,0x00, + 5, // 0x78 'x' + 0x00, 0x00, 0x90, 0x90, 0x60, 0x60, 0x90, 0x90, 0x00, - 5, // 0x79 'y' - 0x00,0x00,0x90,0x90,0x90,0x90,0x70,0x10,0xe0, + 5, // 0x79 'y' + 0x00, 0x00, 0x90, 0x90, 0x90, 0x90, 0x70, 0x10, 0xe0, - 5, // 0x7a 'z' - 0x00,0x00,0xf0,0x10,0x20,0x40,0x80,0xf0,0x00, + 5, // 0x7a 'z' + 0x00, 0x00, 0xf0, 0x10, 0x20, 0x40, 0x80, 0xf0, 0x00, - 5, // 0x7b '{' - 0x10,0x20,0x20,0x20,0xc0,0x20,0x20,0x20,0x10, + 5, // 0x7b '{' + 0x10, 0x20, 0x20, 0x20, 0xc0, 0x20, 0x20, 0x20, 0x10, - 5, // 0x7c '|' - 0x00,0x20,0x20,0x20,0x00,0x20,0x20,0x20,0x00, + 5, // 0x7c '|' + 0x00, 0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x20, 0x00, - 5, // 0x7d '}' - 0x80,0x40,0x40,0x40,0x30,0x40,0x40,0x40,0x80, + 5, // 0x7d '}' + 0x80, 0x40, 0x40, 0x40, 0x30, 0x40, 0x40, 0x40, 0x80, - 5, // 0x7e '~' - 0x00,0x40,0xa8,0x10,0x00,0x00,0x00,0x00,0x00, + 5, // 0x7e '~' + 0x00, 0x40, 0xa8, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x7f '' - 0x00,0x00,0x00,0x20,0x50,0x88,0xf8,0x00,0x00, - 0 -}; + 5, // 0x7f '' + 0x00, 0x00, 0x00, 0x20, 0x50, 0x88, 0xf8, 0x00, 0x00, 0}; -const int8u gse6x12[] = -{ - 12, 0, 32, 128-32, +const int8u gse6x12[] = { + 12, 0, 32, 128 - 32, - 0x00,0x00,0x0d,0x00,0x1a,0x00,0x27,0x00,0x34,0x00,0x41,0x00,0x4e,0x00,0x5b,0x00,0x68,0x00, - 0x75,0x00,0x82,0x00,0x8f,0x00,0x9c,0x00,0xa9,0x00,0xb6,0x00,0xc3,0x00,0xd0,0x00,0xdd,0x00, - 0xea,0x00,0xf7,0x00,0x04,0x01,0x11,0x01,0x1e,0x01,0x2b,0x01,0x38,0x01,0x45,0x01,0x52,0x01, - 0x5f,0x01,0x6c,0x01,0x79,0x01,0x86,0x01,0x93,0x01,0xa0,0x01,0xad,0x01,0xba,0x01,0xc7,0x01, - 0xd4,0x01,0xe1,0x01,0xee,0x01,0xfb,0x01,0x08,0x02,0x15,0x02,0x22,0x02,0x2f,0x02,0x3c,0x02, - 0x49,0x02,0x56,0x02,0x63,0x02,0x70,0x02,0x7d,0x02,0x8a,0x02,0x97,0x02,0xa4,0x02,0xb1,0x02, - 0xbe,0x02,0xcb,0x02,0xd8,0x02,0xe5,0x02,0xf2,0x02,0xff,0x02,0x0c,0x03,0x19,0x03,0x26,0x03, - 0x33,0x03,0x40,0x03,0x4d,0x03,0x5a,0x03,0x67,0x03,0x74,0x03,0x81,0x03,0x8e,0x03,0x9b,0x03, - 0xa8,0x03,0xb5,0x03,0xc2,0x03,0xcf,0x03,0xdc,0x03,0xe9,0x03,0xf6,0x03,0x03,0x04,0x10,0x04, - 0x1d,0x04,0x2a,0x04,0x37,0x04,0x44,0x04,0x51,0x04,0x5e,0x04,0x6b,0x04,0x78,0x04,0x85,0x04, - 0x92,0x04,0x9f,0x04,0xac,0x04,0xb9,0x04,0xc6,0x04,0xd3,0x04, + 0x00, 0x00, 0x0d, 0x00, 0x1a, 0x00, 0x27, 0x00, 0x34, 0x00, 0x41, 0x00, 0x4e, 0x00, 0x5b, 0x00, 0x68, 0x00, + 0x75, 0x00, 0x82, 0x00, 0x8f, 0x00, 0x9c, 0x00, 0xa9, 0x00, 0xb6, 0x00, 0xc3, 0x00, 0xd0, 0x00, 0xdd, 0x00, + 0xea, 0x00, 0xf7, 0x00, 0x04, 0x01, 0x11, 0x01, 0x1e, 0x01, 0x2b, 0x01, 0x38, 0x01, 0x45, 0x01, 0x52, 0x01, + 0x5f, 0x01, 0x6c, 0x01, 0x79, 0x01, 0x86, 0x01, 0x93, 0x01, 0xa0, 0x01, 0xad, 0x01, 0xba, 0x01, 0xc7, 0x01, + 0xd4, 0x01, 0xe1, 0x01, 0xee, 0x01, 0xfb, 0x01, 0x08, 0x02, 0x15, 0x02, 0x22, 0x02, 0x2f, 0x02, 0x3c, 0x02, + 0x49, 0x02, 0x56, 0x02, 0x63, 0x02, 0x70, 0x02, 0x7d, 0x02, 0x8a, 0x02, 0x97, 0x02, 0xa4, 0x02, 0xb1, 0x02, + 0xbe, 0x02, 0xcb, 0x02, 0xd8, 0x02, 0xe5, 0x02, 0xf2, 0x02, 0xff, 0x02, 0x0c, 0x03, 0x19, 0x03, 0x26, 0x03, + 0x33, 0x03, 0x40, 0x03, 0x4d, 0x03, 0x5a, 0x03, 0x67, 0x03, 0x74, 0x03, 0x81, 0x03, 0x8e, 0x03, 0x9b, 0x03, + 0xa8, 0x03, 0xb5, 0x03, 0xc2, 0x03, 0xcf, 0x03, 0xdc, 0x03, 0xe9, 0x03, 0xf6, 0x03, 0x03, 0x04, 0x10, 0x04, + 0x1d, 0x04, 0x2a, 0x04, 0x37, 0x04, 0x44, 0x04, 0x51, 0x04, 0x5e, 0x04, 0x6b, 0x04, 0x78, 0x04, 0x85, 0x04, + 0x92, 0x04, 0x9f, 0x04, 0xac, 0x04, 0xb9, 0x04, 0xc6, 0x04, 0xd3, 0x04, - 6, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x21 '!' - 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, + 6, // 0x21 '!' + 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x00, 0x00, - 6, // 0x22 '"' - 0x00,0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x22 '"' + 0x00, 0x50, 0x50, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x23 '#' - 0x00,0x50,0x50,0xf8,0x50,0x50,0x50,0xf8,0x50,0x50,0x00,0x00, + 6, // 0x23 '#' + 0x00, 0x50, 0x50, 0xf8, 0x50, 0x50, 0x50, 0xf8, 0x50, 0x50, 0x00, 0x00, - 6, // 0x24 '$' - 0x00,0x20,0x70,0xa8,0xa0,0x70,0x28,0xa8,0x70,0x20,0x00,0x00, + 6, // 0x24 '$' + 0x00, 0x20, 0x70, 0xa8, 0xa0, 0x70, 0x28, 0xa8, 0x70, 0x20, 0x00, 0x00, - 6, // 0x25 '%' - 0x00,0xc8,0xd8,0x10,0x30,0x20,0x60,0x40,0xd8,0x98,0x00,0x00, + 6, // 0x25 '%' + 0x00, 0xc8, 0xd8, 0x10, 0x30, 0x20, 0x60, 0x40, 0xd8, 0x98, 0x00, 0x00, - 6, // 0x26 '&' - 0x00,0x60,0x90,0x90,0x90,0x60,0xa8,0x90,0x90,0x68,0x00,0x00, + 6, // 0x26 '&' + 0x00, 0x60, 0x90, 0x90, 0x90, 0x60, 0xa8, 0x90, 0x90, 0x68, 0x00, 0x00, - 6, // 0x27 ''' - 0x00,0x20,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x27 ''' + 0x00, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x28 '(' - 0x00,0x10,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x10,0x00,0x00, + 6, // 0x28 '(' + 0x00, 0x10, 0x20, 0x40, 0x40, 0x40, 0x40, 0x40, 0x20, 0x10, 0x00, 0x00, - 6, // 0x29 ')' - 0x00,0x40,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x40,0x00,0x00, + 6, // 0x29 ')' + 0x00, 0x40, 0x20, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x40, 0x00, 0x00, - 6, // 0x2a '*' - 0x00,0x00,0x00,0x50,0x20,0xf8,0x20,0x50,0x00,0x00,0x00,0x00, + 6, // 0x2a '*' + 0x00, 0x00, 0x00, 0x50, 0x20, 0xf8, 0x20, 0x50, 0x00, 0x00, 0x00, 0x00, - 6, // 0x2b '+' - 0x00,0x00,0x20,0x20,0x20,0xf8,0x20,0x20,0x20,0x00,0x00,0x00, + 6, // 0x2b '+' + 0x00, 0x00, 0x20, 0x20, 0x20, 0xf8, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, - 6, // 0x2c ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40, + 6, // 0x2c ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x40, - 6, // 0x2d '-' - 0x00,0x00,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x2d '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x2e '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00, + 6, // 0x2e '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, - 6, // 0x2f '/' - 0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x00,0x00, + 6, // 0x2f '/' + 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, 0x00, 0x00, - 6, // 0x30 '0' - 0x00,0x70,0x88,0x88,0x98,0xa8,0xc8,0x88,0x88,0x70,0x00,0x00, + 6, // 0x30 '0' + 0x00, 0x70, 0x88, 0x88, 0x98, 0xa8, 0xc8, 0x88, 0x88, 0x70, 0x00, 0x00, - 6, // 0x31 '1' - 0x00,0x20,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 6, // 0x31 '1' + 0x00, 0x20, 0x20, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, - 6, // 0x32 '2' - 0x00,0x70,0x88,0x88,0x08,0x10,0x20,0x40,0x80,0xf8,0x00,0x00, + 6, // 0x32 '2' + 0x00, 0x70, 0x88, 0x88, 0x08, 0x10, 0x20, 0x40, 0x80, 0xf8, 0x00, 0x00, - 6, // 0x33 '3' - 0x00,0xf8,0x10,0x20,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00, + 6, // 0x33 '3' + 0x00, 0xf8, 0x10, 0x20, 0x70, 0x08, 0x08, 0x08, 0x88, 0x70, 0x00, 0x00, - 6, // 0x34 '4' - 0x00,0x10,0x20,0x40,0x90,0x90,0xf8,0x10,0x10,0x10,0x00,0x00, + 6, // 0x34 '4' + 0x00, 0x10, 0x20, 0x40, 0x90, 0x90, 0xf8, 0x10, 0x10, 0x10, 0x00, 0x00, - 6, // 0x35 '5' - 0x00,0xf8,0x80,0x80,0xf0,0x08,0x08,0x08,0x88,0x70,0x00,0x00, + 6, // 0x35 '5' + 0x00, 0xf8, 0x80, 0x80, 0xf0, 0x08, 0x08, 0x08, 0x88, 0x70, 0x00, 0x00, - 6, // 0x36 '6' - 0x00,0x70,0x88,0x80,0x80,0xf0,0x88,0x88,0x88,0x70,0x00,0x00, + 6, // 0x36 '6' + 0x00, 0x70, 0x88, 0x80, 0x80, 0xf0, 0x88, 0x88, 0x88, 0x70, 0x00, 0x00, - 6, // 0x37 '7' - 0x00,0xf8,0x88,0x08,0x08,0x10,0x20,0x20,0x20,0x20,0x00,0x00, + 6, // 0x37 '7' + 0x00, 0xf8, 0x88, 0x08, 0x08, 0x10, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, - 6, // 0x38 '8' - 0x00,0x70,0x88,0x88,0x88,0x70,0x88,0x88,0x88,0x70,0x00,0x00, + 6, // 0x38 '8' + 0x00, 0x70, 0x88, 0x88, 0x88, 0x70, 0x88, 0x88, 0x88, 0x70, 0x00, 0x00, - 6, // 0x39 '9' - 0x00,0x70,0x88,0x88,0x88,0x78,0x08,0x08,0x88,0x70,0x00,0x00, + 6, // 0x39 '9' + 0x00, 0x70, 0x88, 0x88, 0x88, 0x78, 0x08, 0x08, 0x88, 0x70, 0x00, 0x00, - 6, // 0x3a ':' - 0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00, + 6, // 0x3a ':' + 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 6, // 0x3b ';' - 0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x20,0x20,0x40, + 6, // 0x3b ';' + 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x40, - 6, // 0x3c '<' - 0x00,0x08,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x08,0x00,0x00, + 6, // 0x3c '<' + 0x00, 0x08, 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00, - 6, // 0x3d '=' - 0x00,0x00,0x00,0x00,0xf8,0x00,0xf8,0x00,0x00,0x00,0x00,0x00, + 6, // 0x3d '=' + 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x3e '>' - 0x00,0x80,0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x80,0x00,0x00, + 6, // 0x3e '>' + 0x00, 0x80, 0x40, 0x20, 0x10, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, - 6, // 0x3f '?' - 0x00,0x70,0x88,0x88,0x08,0x10,0x20,0x20,0x00,0x20,0x00,0x00, + 6, // 0x3f '?' + 0x00, 0x70, 0x88, 0x88, 0x08, 0x10, 0x20, 0x20, 0x00, 0x20, 0x00, 0x00, - 6, // 0x40 '@' - 0x00,0x70,0x88,0x88,0xb8,0xb8,0xb0,0x80,0x88,0x70,0x00,0x00, + 6, // 0x40 '@' + 0x00, 0x70, 0x88, 0x88, 0xb8, 0xb8, 0xb0, 0x80, 0x88, 0x70, 0x00, 0x00, - 6, // 0x41 'A' - 0x00,0x20,0x50,0x88,0x88,0x88,0xf8,0x88,0x88,0x88,0x00,0x00, + 6, // 0x41 'A' + 0x00, 0x20, 0x50, 0x88, 0x88, 0x88, 0xf8, 0x88, 0x88, 0x88, 0x00, 0x00, - 6, // 0x42 'B' - 0x00,0xf0,0x88,0x88,0x88,0xf0,0x88,0x88,0x88,0xf0,0x00,0x00, + 6, // 0x42 'B' + 0x00, 0xf0, 0x88, 0x88, 0x88, 0xf0, 0x88, 0x88, 0x88, 0xf0, 0x00, 0x00, - 6, // 0x43 'C' - 0x00,0x70,0x88,0x88,0x80,0x80,0x80,0x88,0x88,0x70,0x00,0x00, + 6, // 0x43 'C' + 0x00, 0x70, 0x88, 0x88, 0x80, 0x80, 0x80, 0x88, 0x88, 0x70, 0x00, 0x00, - 6, // 0x44 'D' - 0x00,0xe0,0x90,0x88,0x88,0x88,0x88,0x88,0x90,0xe0,0x00,0x00, + 6, // 0x44 'D' + 0x00, 0xe0, 0x90, 0x88, 0x88, 0x88, 0x88, 0x88, 0x90, 0xe0, 0x00, 0x00, - 6, // 0x45 'E' - 0x00,0xf8,0x80,0x80,0x80,0xf0,0x80,0x80,0x80,0xf8,0x00,0x00, + 6, // 0x45 'E' + 0x00, 0xf8, 0x80, 0x80, 0x80, 0xf0, 0x80, 0x80, 0x80, 0xf8, 0x00, 0x00, - 6, // 0x46 'F' - 0x00,0xf8,0x80,0x80,0x80,0xf0,0x80,0x80,0x80,0x80,0x00,0x00, + 6, // 0x46 'F' + 0x00, 0xf8, 0x80, 0x80, 0x80, 0xf0, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, - 6, // 0x47 'G' - 0x00,0x70,0x88,0x80,0x80,0xb8,0x88,0x88,0x88,0x70,0x00,0x00, + 6, // 0x47 'G' + 0x00, 0x70, 0x88, 0x80, 0x80, 0xb8, 0x88, 0x88, 0x88, 0x70, 0x00, 0x00, - 6, // 0x48 'H' - 0x00,0x88,0x88,0x88,0x88,0xf8,0x88,0x88,0x88,0x88,0x00,0x00, + 6, // 0x48 'H' + 0x00, 0x88, 0x88, 0x88, 0x88, 0xf8, 0x88, 0x88, 0x88, 0x88, 0x00, 0x00, - 6, // 0x49 'I' - 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 6, // 0x49 'I' + 0x00, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, - 6, // 0x4a 'J' - 0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x90,0x60,0x00,0x00, + 6, // 0x4a 'J' + 0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x90, 0x60, 0x00, 0x00, - 6, // 0x4b 'K' - 0x00,0x88,0x88,0x90,0xa0,0xc0,0xa0,0x90,0x88,0x88,0x00,0x00, + 6, // 0x4b 'K' + 0x00, 0x88, 0x88, 0x90, 0xa0, 0xc0, 0xa0, 0x90, 0x88, 0x88, 0x00, 0x00, - 6, // 0x4c 'L' - 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xf8,0x00,0x00, + 6, // 0x4c 'L' + 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xf8, 0x00, 0x00, - 6, // 0x4d 'M' - 0x00,0x88,0x88,0xd8,0xa8,0x88,0x88,0x88,0x88,0x88,0x00,0x00, + 6, // 0x4d 'M' + 0x00, 0x88, 0x88, 0xd8, 0xa8, 0x88, 0x88, 0x88, 0x88, 0x88, 0x00, 0x00, - 6, // 0x4e 'N' - 0x00,0x88,0x88,0xc8,0xa8,0x98,0x88,0x88,0x88,0x88,0x00,0x00, + 6, // 0x4e 'N' + 0x00, 0x88, 0x88, 0xc8, 0xa8, 0x98, 0x88, 0x88, 0x88, 0x88, 0x00, 0x00, - 6, // 0x4f 'O' - 0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, + 6, // 0x4f 'O' + 0x00, 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, 0x00, 0x00, - 6, // 0x50 'P' - 0x00,0xf0,0x88,0x88,0x88,0xf0,0x80,0x80,0x80,0x80,0x00,0x00, + 6, // 0x50 'P' + 0x00, 0xf0, 0x88, 0x88, 0x88, 0xf0, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, - 6, // 0x51 'Q' - 0x00,0x70,0x88,0x88,0x88,0x88,0x88,0xa8,0x90,0x68,0x00,0x00, + 6, // 0x51 'Q' + 0x00, 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0xa8, 0x90, 0x68, 0x00, 0x00, - 6, // 0x52 'R' - 0x00,0xf0,0x88,0x88,0x88,0x88,0xf0,0xa0,0x90,0x88,0x00,0x00, + 6, // 0x52 'R' + 0x00, 0xf0, 0x88, 0x88, 0x88, 0x88, 0xf0, 0xa0, 0x90, 0x88, 0x00, 0x00, - 6, // 0x53 'S' - 0x00,0x70,0x88,0x80,0x80,0x70,0x08,0x08,0x88,0x70,0x00,0x00, + 6, // 0x53 'S' + 0x00, 0x70, 0x88, 0x80, 0x80, 0x70, 0x08, 0x08, 0x88, 0x70, 0x00, 0x00, - 6, // 0x54 'T' - 0x00,0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00, + 6, // 0x54 'T' + 0x00, 0xf8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, - 6, // 0x55 'U' - 0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, + 6, // 0x55 'U' + 0x00, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, 0x00, 0x00, - 6, // 0x56 'V' - 0x00,0x88,0x88,0x88,0x88,0x88,0x50,0x50,0x20,0x20,0x00,0x00, + 6, // 0x56 'V' + 0x00, 0x88, 0x88, 0x88, 0x88, 0x88, 0x50, 0x50, 0x20, 0x20, 0x00, 0x00, - 6, // 0x57 'W' - 0x00,0x88,0x88,0x88,0x88,0x88,0xa8,0xa8,0xd8,0x88,0x00,0x00, + 6, // 0x57 'W' + 0x00, 0x88, 0x88, 0x88, 0x88, 0x88, 0xa8, 0xa8, 0xd8, 0x88, 0x00, 0x00, - 6, // 0x58 'X' - 0x00,0x88,0x88,0x88,0x50,0x20,0x50,0x88,0x88,0x88,0x00,0x00, + 6, // 0x58 'X' + 0x00, 0x88, 0x88, 0x88, 0x50, 0x20, 0x50, 0x88, 0x88, 0x88, 0x00, 0x00, - 6, // 0x59 'Y' - 0x00,0x88,0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x20,0x00,0x00, + 6, // 0x59 'Y' + 0x00, 0x88, 0x88, 0x88, 0x50, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, - 6, // 0x5a 'Z' - 0x00,0xf8,0x08,0x08,0x10,0x20,0x40,0x80,0x80,0xf8,0x00,0x00, + 6, // 0x5a 'Z' + 0x00, 0xf8, 0x08, 0x08, 0x10, 0x20, 0x40, 0x80, 0x80, 0xf8, 0x00, 0x00, - 6, // 0x5b '[' - 0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70,0x00, + 6, // 0x5b '[' + 0x70, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x70, 0x00, - 6, // 0x5c '\' - 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00,0x00, + 6, // 0x5c '\' + 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x00, 0x00, - 6, // 0x5d ']' - 0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70,0x00, + 6, // 0x5d ']' + 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x70, 0x00, - 6, // 0x5e '^' - 0x00,0x00,0x20,0x50,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x5e '^' + 0x00, 0x00, 0x20, 0x50, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x5f '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x00,0x00, + 6, // 0x5f '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, - 6, // 0x60 '`' - 0x00,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x60 '`' + 0x00, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x61 'a' - 0x00,0x00,0x00,0x70,0x88,0x08,0x78,0x88,0x88,0x78,0x00,0x00, + 6, // 0x61 'a' + 0x00, 0x00, 0x00, 0x70, 0x88, 0x08, 0x78, 0x88, 0x88, 0x78, 0x00, 0x00, - 6, // 0x62 'b' - 0x00,0x80,0x80,0x80,0xf0,0x88,0x88,0x88,0x88,0xf0,0x00,0x00, + 6, // 0x62 'b' + 0x00, 0x80, 0x80, 0x80, 0xf0, 0x88, 0x88, 0x88, 0x88, 0xf0, 0x00, 0x00, - 6, // 0x63 'c' - 0x00,0x00,0x00,0x70,0x88,0x80,0x80,0x80,0x88,0x70,0x00,0x00, + 6, // 0x63 'c' + 0x00, 0x00, 0x00, 0x70, 0x88, 0x80, 0x80, 0x80, 0x88, 0x70, 0x00, 0x00, - 6, // 0x64 'd' - 0x00,0x08,0x08,0x08,0x78,0x88,0x88,0x88,0x88,0x78,0x00,0x00, + 6, // 0x64 'd' + 0x00, 0x08, 0x08, 0x08, 0x78, 0x88, 0x88, 0x88, 0x88, 0x78, 0x00, 0x00, - 6, // 0x65 'e' - 0x00,0x00,0x00,0x70,0x88,0x88,0xf8,0x80,0x80,0x78,0x00,0x00, + 6, // 0x65 'e' + 0x00, 0x00, 0x00, 0x70, 0x88, 0x88, 0xf8, 0x80, 0x80, 0x78, 0x00, 0x00, - 6, // 0x66 'f' - 0x00,0x18,0x20,0x20,0xf8,0x20,0x20,0x20,0x20,0x20,0x00,0x00, + 6, // 0x66 'f' + 0x00, 0x18, 0x20, 0x20, 0xf8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, - 6, // 0x67 'g' - 0x00,0x00,0x00,0x78,0x88,0x88,0x88,0x88,0x78,0x08,0x08,0xf0, + 6, // 0x67 'g' + 0x00, 0x00, 0x00, 0x78, 0x88, 0x88, 0x88, 0x88, 0x78, 0x08, 0x08, 0xf0, - 6, // 0x68 'h' - 0x00,0x80,0x80,0x80,0xf0,0x88,0x88,0x88,0x88,0x88,0x00,0x00, + 6, // 0x68 'h' + 0x00, 0x80, 0x80, 0x80, 0xf0, 0x88, 0x88, 0x88, 0x88, 0x88, 0x00, 0x00, - 6, // 0x69 'i' - 0x00,0x20,0x00,0x00,0x60,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 6, // 0x69 'i' + 0x00, 0x20, 0x00, 0x00, 0x60, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, - 6, // 0x6a 'j' - 0x00,0x10,0x00,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x90,0x60, + 6, // 0x6a 'j' + 0x00, 0x10, 0x00, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x90, 0x60, - 6, // 0x6b 'k' - 0x00,0x80,0x80,0x80,0x88,0x90,0xa0,0xd0,0x88,0x88,0x00,0x00, + 6, // 0x6b 'k' + 0x00, 0x80, 0x80, 0x80, 0x88, 0x90, 0xa0, 0xd0, 0x88, 0x88, 0x00, 0x00, - 6, // 0x6c 'l' - 0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 6, // 0x6c 'l' + 0x00, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, - 6, // 0x6d 'm' - 0x00,0x00,0x00,0xd0,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0x00,0x00, + 6, // 0x6d 'm' + 0x00, 0x00, 0x00, 0xd0, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0x00, 0x00, - 6, // 0x6e 'n' - 0x00,0x00,0x00,0xb0,0xc8,0x88,0x88,0x88,0x88,0x88,0x00,0x00, + 6, // 0x6e 'n' + 0x00, 0x00, 0x00, 0xb0, 0xc8, 0x88, 0x88, 0x88, 0x88, 0x88, 0x00, 0x00, - 6, // 0x6f 'o' - 0x00,0x00,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, + 6, // 0x6f 'o' + 0x00, 0x00, 0x00, 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, 0x00, 0x00, - 6, // 0x70 'p' - 0x00,0x00,0x00,0xf0,0x88,0x88,0x88,0x88,0xf0,0x80,0x80,0x80, + 6, // 0x70 'p' + 0x00, 0x00, 0x00, 0xf0, 0x88, 0x88, 0x88, 0x88, 0xf0, 0x80, 0x80, 0x80, - 6, // 0x71 'q' - 0x00,0x00,0x00,0x78,0x88,0x88,0x88,0x88,0x78,0x08,0x08,0x08, + 6, // 0x71 'q' + 0x00, 0x00, 0x00, 0x78, 0x88, 0x88, 0x88, 0x88, 0x78, 0x08, 0x08, 0x08, - 6, // 0x72 'r' - 0x00,0x00,0x00,0xb0,0xc8,0x88,0x80,0x80,0x80,0x80,0x00,0x00, + 6, // 0x72 'r' + 0x00, 0x00, 0x00, 0xb0, 0xc8, 0x88, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, - 6, // 0x73 's' - 0x00,0x00,0x00,0x70,0x88,0x80,0x70,0x08,0x88,0x70,0x00,0x00, + 6, // 0x73 's' + 0x00, 0x00, 0x00, 0x70, 0x88, 0x80, 0x70, 0x08, 0x88, 0x70, 0x00, 0x00, - 6, // 0x74 't' - 0x00,0x40,0x40,0x40,0xe0,0x40,0x40,0x40,0x48,0x30,0x00,0x00, + 6, // 0x74 't' + 0x00, 0x40, 0x40, 0x40, 0xe0, 0x40, 0x40, 0x40, 0x48, 0x30, 0x00, 0x00, - 6, // 0x75 'u' - 0x00,0x00,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x78,0x00,0x00, + 6, // 0x75 'u' + 0x00, 0x00, 0x00, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x78, 0x00, 0x00, - 6, // 0x76 'v' - 0x00,0x00,0x00,0x88,0x88,0x88,0x50,0x50,0x20,0x20,0x00,0x00, + 6, // 0x76 'v' + 0x00, 0x00, 0x00, 0x88, 0x88, 0x88, 0x50, 0x50, 0x20, 0x20, 0x00, 0x00, - 6, // 0x77 'w' - 0x00,0x00,0x00,0x88,0x88,0x88,0xa8,0xa8,0xd8,0x88,0x00,0x00, + 6, // 0x77 'w' + 0x00, 0x00, 0x00, 0x88, 0x88, 0x88, 0xa8, 0xa8, 0xd8, 0x88, 0x00, 0x00, - 6, // 0x78 'x' - 0x00,0x00,0x00,0x88,0x88,0x50,0x20,0x50,0x88,0x88,0x00,0x00, + 6, // 0x78 'x' + 0x00, 0x00, 0x00, 0x88, 0x88, 0x50, 0x20, 0x50, 0x88, 0x88, 0x00, 0x00, - 6, // 0x79 'y' - 0x00,0x00,0x00,0x88,0x88,0x88,0x88,0x88,0x78,0x08,0x10,0xe0, + 6, // 0x79 'y' + 0x00, 0x00, 0x00, 0x88, 0x88, 0x88, 0x88, 0x88, 0x78, 0x08, 0x10, 0xe0, - 6, // 0x7a 'z' - 0x00,0x00,0x00,0xf8,0x08,0x10,0x20,0x40,0x80,0xf8,0x00,0x00, + 6, // 0x7a 'z' + 0x00, 0x00, 0x00, 0xf8, 0x08, 0x10, 0x20, 0x40, 0x80, 0xf8, 0x00, 0x00, - 6, // 0x7b '{' - 0x18,0x20,0x20,0x20,0x20,0xc0,0x20,0x20,0x20,0x20,0x18,0x00, + 6, // 0x7b '{' + 0x18, 0x20, 0x20, 0x20, 0x20, 0xc0, 0x20, 0x20, 0x20, 0x20, 0x18, 0x00, - 6, // 0x7c '|' - 0x00,0x20,0x20,0x20,0x20,0x00,0x20,0x20,0x20,0x20,0x00,0x00, + 6, // 0x7c '|' + 0x00, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, - 6, // 0x7d '}' - 0xc0,0x20,0x20,0x20,0x20,0x18,0x20,0x20,0x20,0x20,0xc0,0x00, + 6, // 0x7d '}' + 0xc0, 0x20, 0x20, 0x20, 0x20, 0x18, 0x20, 0x20, 0x20, 0x20, 0xc0, 0x00, - 6, // 0x7e '~' - 0x00,0x00,0x40,0xa8,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x7e '~' + 0x00, 0x00, 0x40, 0xa8, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x7f '' - 0x00,0x00,0x00,0x00,0x20,0x50,0x88,0xf8,0x00,0x00,0x00,0x00, - 0 -}; + 6, // 0x7f '' + 0x00, 0x00, 0x00, 0x00, 0x20, 0x50, 0x88, 0xf8, 0x00, 0x00, 0x00, 0x00, 0}; -const int8u gse6x9[] = -{ - 9, 0, 32, 128-32, +const int8u gse6x9[] = { + 9, 0, 32, 128 - 32, - 0x00,0x00,0x0a,0x00,0x14,0x00,0x1e,0x00,0x28,0x00,0x32,0x00,0x3c,0x00,0x46,0x00,0x50,0x00, - 0x5a,0x00,0x64,0x00,0x6e,0x00,0x78,0x00,0x82,0x00,0x8c,0x00,0x96,0x00,0xa0,0x00,0xaa,0x00, - 0xb4,0x00,0xbe,0x00,0xc8,0x00,0xd2,0x00,0xdc,0x00,0xe6,0x00,0xf0,0x00,0xfa,0x00,0x04,0x01, - 0x0e,0x01,0x18,0x01,0x22,0x01,0x2c,0x01,0x36,0x01,0x40,0x01,0x4a,0x01,0x54,0x01,0x5e,0x01, - 0x68,0x01,0x72,0x01,0x7c,0x01,0x86,0x01,0x90,0x01,0x9a,0x01,0xa4,0x01,0xae,0x01,0xb8,0x01, - 0xc2,0x01,0xcc,0x01,0xd6,0x01,0xe0,0x01,0xea,0x01,0xf4,0x01,0xfe,0x01,0x08,0x02,0x12,0x02, - 0x1c,0x02,0x26,0x02,0x30,0x02,0x3a,0x02,0x44,0x02,0x4e,0x02,0x58,0x02,0x62,0x02,0x6c,0x02, - 0x76,0x02,0x80,0x02,0x8a,0x02,0x94,0x02,0x9e,0x02,0xa8,0x02,0xb2,0x02,0xbc,0x02,0xc6,0x02, - 0xd0,0x02,0xda,0x02,0xe4,0x02,0xee,0x02,0xf8,0x02,0x02,0x03,0x0c,0x03,0x16,0x03,0x20,0x03, - 0x2a,0x03,0x34,0x03,0x3e,0x03,0x48,0x03,0x52,0x03,0x5c,0x03,0x66,0x03,0x70,0x03,0x7a,0x03, - 0x84,0x03,0x8e,0x03,0x98,0x03,0xa2,0x03,0xac,0x03,0xb6,0x03, + 0x00, 0x00, 0x0a, 0x00, 0x14, 0x00, 0x1e, 0x00, 0x28, 0x00, 0x32, 0x00, 0x3c, 0x00, 0x46, 0x00, 0x50, 0x00, + 0x5a, 0x00, 0x64, 0x00, 0x6e, 0x00, 0x78, 0x00, 0x82, 0x00, 0x8c, 0x00, 0x96, 0x00, 0xa0, 0x00, 0xaa, 0x00, + 0xb4, 0x00, 0xbe, 0x00, 0xc8, 0x00, 0xd2, 0x00, 0xdc, 0x00, 0xe6, 0x00, 0xf0, 0x00, 0xfa, 0x00, 0x04, 0x01, + 0x0e, 0x01, 0x18, 0x01, 0x22, 0x01, 0x2c, 0x01, 0x36, 0x01, 0x40, 0x01, 0x4a, 0x01, 0x54, 0x01, 0x5e, 0x01, + 0x68, 0x01, 0x72, 0x01, 0x7c, 0x01, 0x86, 0x01, 0x90, 0x01, 0x9a, 0x01, 0xa4, 0x01, 0xae, 0x01, 0xb8, 0x01, + 0xc2, 0x01, 0xcc, 0x01, 0xd6, 0x01, 0xe0, 0x01, 0xea, 0x01, 0xf4, 0x01, 0xfe, 0x01, 0x08, 0x02, 0x12, 0x02, + 0x1c, 0x02, 0x26, 0x02, 0x30, 0x02, 0x3a, 0x02, 0x44, 0x02, 0x4e, 0x02, 0x58, 0x02, 0x62, 0x02, 0x6c, 0x02, + 0x76, 0x02, 0x80, 0x02, 0x8a, 0x02, 0x94, 0x02, 0x9e, 0x02, 0xa8, 0x02, 0xb2, 0x02, 0xbc, 0x02, 0xc6, 0x02, + 0xd0, 0x02, 0xda, 0x02, 0xe4, 0x02, 0xee, 0x02, 0xf8, 0x02, 0x02, 0x03, 0x0c, 0x03, 0x16, 0x03, 0x20, 0x03, + 0x2a, 0x03, 0x34, 0x03, 0x3e, 0x03, 0x48, 0x03, 0x52, 0x03, 0x5c, 0x03, 0x66, 0x03, 0x70, 0x03, 0x7a, 0x03, + 0x84, 0x03, 0x8e, 0x03, 0x98, 0x03, 0xa2, 0x03, 0xac, 0x03, 0xb6, 0x03, - 6, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x21 '!' - 0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00, + 6, // 0x21 '!' + 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x00, - 6, // 0x22 '"' - 0x00,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x22 '"' + 0x00, 0x50, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x23 '#' - 0x00,0x50,0x50,0xf8,0x50,0xf8,0x50,0x50,0x00, + 6, // 0x23 '#' + 0x00, 0x50, 0x50, 0xf8, 0x50, 0xf8, 0x50, 0x50, 0x00, - 6, // 0x24 '$' - 0x00,0x70,0xa8,0xa0,0x70,0x28,0xa8,0x70,0x00, + 6, // 0x24 '$' + 0x00, 0x70, 0xa8, 0xa0, 0x70, 0x28, 0xa8, 0x70, 0x00, - 6, // 0x25 '%' - 0x00,0xc8,0xc8,0x10,0x20,0x40,0x98,0x98,0x00, + 6, // 0x25 '%' + 0x00, 0xc8, 0xc8, 0x10, 0x20, 0x40, 0x98, 0x98, 0x00, - 6, // 0x26 '&' - 0x00,0x60,0x90,0x90,0x60,0xa8,0x90,0x68,0x00, + 6, // 0x26 '&' + 0x00, 0x60, 0x90, 0x90, 0x60, 0xa8, 0x90, 0x68, 0x00, - 6, // 0x27 ''' - 0x00,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x27 ''' + 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x28 '(' - 0x10,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x10, + 6, // 0x28 '(' + 0x10, 0x20, 0x40, 0x40, 0x40, 0x40, 0x40, 0x20, 0x10, - 6, // 0x29 ')' - 0x40,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x40, + 6, // 0x29 ')' + 0x40, 0x20, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x40, - 6, // 0x2a '*' - 0x00,0x00,0x20,0xa8,0x70,0xa8,0x20,0x00,0x00, + 6, // 0x2a '*' + 0x00, 0x00, 0x20, 0xa8, 0x70, 0xa8, 0x20, 0x00, 0x00, - 6, // 0x2b '+' - 0x00,0x00,0x20,0x20,0xf8,0x20,0x20,0x00,0x00, + 6, // 0x2b '+' + 0x00, 0x00, 0x20, 0x20, 0xf8, 0x20, 0x20, 0x00, 0x00, - 6, // 0x2c ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x40, + 6, // 0x2c ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x40, - 6, // 0x2d '-' - 0x00,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x00, + 6, // 0x2d '-' + 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, - 6, // 0x2e '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00, + 6, // 0x2e '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, - 6, // 0x2f '/' - 0x00,0x08,0x08,0x10,0x20,0x40,0x80,0x80,0x00, + 6, // 0x2f '/' + 0x00, 0x08, 0x08, 0x10, 0x20, 0x40, 0x80, 0x80, 0x00, - 6, // 0x30 '0' - 0x00,0x70,0x88,0x98,0xa8,0xc8,0x88,0x70,0x00, + 6, // 0x30 '0' + 0x00, 0x70, 0x88, 0x98, 0xa8, 0xc8, 0x88, 0x70, 0x00, - 6, // 0x31 '1' - 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x70,0x00, + 6, // 0x31 '1' + 0x00, 0x20, 0x60, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, - 6, // 0x32 '2' - 0x00,0x70,0x88,0x08,0x10,0x20,0x40,0xf8,0x00, + 6, // 0x32 '2' + 0x00, 0x70, 0x88, 0x08, 0x10, 0x20, 0x40, 0xf8, 0x00, - 6, // 0x33 '3' - 0x00,0xf8,0x10,0x20,0x70,0x08,0x88,0x70,0x00, + 6, // 0x33 '3' + 0x00, 0xf8, 0x10, 0x20, 0x70, 0x08, 0x88, 0x70, 0x00, - 6, // 0x34 '4' - 0x00,0x10,0x20,0x40,0x90,0xf8,0x10,0x10,0x00, + 6, // 0x34 '4' + 0x00, 0x10, 0x20, 0x40, 0x90, 0xf8, 0x10, 0x10, 0x00, - 6, // 0x35 '5' - 0x00,0xf8,0x80,0xf0,0x08,0x08,0x88,0x70,0x00, + 6, // 0x35 '5' + 0x00, 0xf8, 0x80, 0xf0, 0x08, 0x08, 0x88, 0x70, 0x00, - 6, // 0x36 '6' - 0x00,0x70,0x88,0x80,0xf0,0x88,0x88,0x70,0x00, + 6, // 0x36 '6' + 0x00, 0x70, 0x88, 0x80, 0xf0, 0x88, 0x88, 0x70, 0x00, - 6, // 0x37 '7' - 0x00,0xf8,0x08,0x08,0x10,0x20,0x40,0x40,0x00, + 6, // 0x37 '7' + 0x00, 0xf8, 0x08, 0x08, 0x10, 0x20, 0x40, 0x40, 0x00, - 6, // 0x38 '8' - 0x00,0x70,0x88,0x88,0x70,0x88,0x88,0x70,0x00, + 6, // 0x38 '8' + 0x00, 0x70, 0x88, 0x88, 0x70, 0x88, 0x88, 0x70, 0x00, - 6, // 0x39 '9' - 0x00,0x70,0x88,0x88,0x78,0x08,0x88,0x70,0x00, + 6, // 0x39 '9' + 0x00, 0x70, 0x88, 0x88, 0x78, 0x08, 0x88, 0x70, 0x00, - 6, // 0x3a ':' - 0x00,0x00,0x00,0x20,0x00,0x00,0x20,0x00,0x00, + 6, // 0x3a ':' + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x20, 0x00, 0x00, - 6, // 0x3b ';' - 0x00,0x00,0x00,0x20,0x00,0x00,0x20,0x20,0x40, + 6, // 0x3b ';' + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x20, 0x20, 0x40, - 6, // 0x3c '<' - 0x00,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x00, + 6, // 0x3c '<' + 0x00, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x00, - 6, // 0x3d '=' - 0x00,0x00,0x00,0xf8,0x00,0xf8,0x00,0x00,0x00, + 6, // 0x3d '=' + 0x00, 0x00, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, 0x00, - 6, // 0x3e '>' - 0x00,0x80,0x40,0x20,0x10,0x20,0x40,0x80,0x00, + 6, // 0x3e '>' + 0x00, 0x80, 0x40, 0x20, 0x10, 0x20, 0x40, 0x80, 0x00, - 6, // 0x3f '?' - 0x00,0x70,0x88,0x08,0x10,0x20,0x00,0x20,0x00, + 6, // 0x3f '?' + 0x00, 0x70, 0x88, 0x08, 0x10, 0x20, 0x00, 0x20, 0x00, - 6, // 0x40 '@' - 0x00,0x70,0x88,0x88,0xb8,0xb8,0x80,0x70,0x00, + 6, // 0x40 '@' + 0x00, 0x70, 0x88, 0x88, 0xb8, 0xb8, 0x80, 0x70, 0x00, - 6, // 0x41 'A' - 0x00,0x20,0x50,0x88,0x88,0xf8,0x88,0x88,0x00, + 6, // 0x41 'A' + 0x00, 0x20, 0x50, 0x88, 0x88, 0xf8, 0x88, 0x88, 0x00, - 6, // 0x42 'B' - 0x00,0xf0,0x88,0x88,0xf0,0x88,0x88,0xf0,0x00, + 6, // 0x42 'B' + 0x00, 0xf0, 0x88, 0x88, 0xf0, 0x88, 0x88, 0xf0, 0x00, - 6, // 0x43 'C' - 0x00,0x70,0x88,0x80,0x80,0x80,0x88,0x70,0x00, + 6, // 0x43 'C' + 0x00, 0x70, 0x88, 0x80, 0x80, 0x80, 0x88, 0x70, 0x00, - 6, // 0x44 'D' - 0x00,0xe0,0x90,0x88,0x88,0x88,0x90,0xe0,0x00, + 6, // 0x44 'D' + 0x00, 0xe0, 0x90, 0x88, 0x88, 0x88, 0x90, 0xe0, 0x00, - 6, // 0x45 'E' - 0x00,0xf8,0x80,0x80,0xf0,0x80,0x80,0xf8,0x00, + 6, // 0x45 'E' + 0x00, 0xf8, 0x80, 0x80, 0xf0, 0x80, 0x80, 0xf8, 0x00, - 6, // 0x46 'F' - 0x00,0xf8,0x80,0x80,0xf0,0x80,0x80,0x80,0x00, + 6, // 0x46 'F' + 0x00, 0xf8, 0x80, 0x80, 0xf0, 0x80, 0x80, 0x80, 0x00, - 6, // 0x47 'G' - 0x00,0x70,0x88,0x80,0xb8,0x88,0x88,0x70,0x00, + 6, // 0x47 'G' + 0x00, 0x70, 0x88, 0x80, 0xb8, 0x88, 0x88, 0x70, 0x00, - 6, // 0x48 'H' - 0x00,0x88,0x88,0x88,0xf8,0x88,0x88,0x88,0x00, + 6, // 0x48 'H' + 0x00, 0x88, 0x88, 0x88, 0xf8, 0x88, 0x88, 0x88, 0x00, - 6, // 0x49 'I' - 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x70,0x00, + 6, // 0x49 'I' + 0x00, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, - 6, // 0x4a 'J' - 0x00,0x38,0x10,0x10,0x10,0x10,0x90,0x60,0x00, + 6, // 0x4a 'J' + 0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x90, 0x60, 0x00, - 6, // 0x4b 'K' - 0x00,0x88,0x90,0xa0,0xc0,0xa0,0x90,0x88,0x00, + 6, // 0x4b 'K' + 0x00, 0x88, 0x90, 0xa0, 0xc0, 0xa0, 0x90, 0x88, 0x00, - 6, // 0x4c 'L' - 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0xf8,0x00, + 6, // 0x4c 'L' + 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xf8, 0x00, - 6, // 0x4d 'M' - 0x00,0x88,0xd8,0xa8,0x88,0x88,0x88,0x88,0x00, + 6, // 0x4d 'M' + 0x00, 0x88, 0xd8, 0xa8, 0x88, 0x88, 0x88, 0x88, 0x00, - 6, // 0x4e 'N' - 0x00,0x88,0x88,0xc8,0xa8,0x98,0x88,0x88,0x00, + 6, // 0x4e 'N' + 0x00, 0x88, 0x88, 0xc8, 0xa8, 0x98, 0x88, 0x88, 0x00, - 6, // 0x4f 'O' - 0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00, + 6, // 0x4f 'O' + 0x00, 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, 0x00, - 6, // 0x50 'P' - 0x00,0xf0,0x88,0x88,0xf0,0x80,0x80,0x80,0x00, + 6, // 0x50 'P' + 0x00, 0xf0, 0x88, 0x88, 0xf0, 0x80, 0x80, 0x80, 0x00, - 6, // 0x51 'Q' - 0x00,0x70,0x88,0x88,0x88,0xa8,0x90,0x68,0x00, + 6, // 0x51 'Q' + 0x00, 0x70, 0x88, 0x88, 0x88, 0xa8, 0x90, 0x68, 0x00, - 6, // 0x52 'R' - 0x00,0xf0,0x88,0x88,0x88,0xf0,0x90,0x88,0x00, + 6, // 0x52 'R' + 0x00, 0xf0, 0x88, 0x88, 0x88, 0xf0, 0x90, 0x88, 0x00, - 6, // 0x53 'S' - 0x00,0x70,0x88,0x80,0x70,0x08,0x88,0x70,0x00, + 6, // 0x53 'S' + 0x00, 0x70, 0x88, 0x80, 0x70, 0x08, 0x88, 0x70, 0x00, - 6, // 0x54 'T' - 0x00,0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x00, + 6, // 0x54 'T' + 0x00, 0xf8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, - 6, // 0x55 'U' - 0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00, + 6, // 0x55 'U' + 0x00, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, 0x00, - 6, // 0x56 'V' - 0x00,0x88,0x88,0x88,0x50,0x50,0x20,0x20,0x00, + 6, // 0x56 'V' + 0x00, 0x88, 0x88, 0x88, 0x50, 0x50, 0x20, 0x20, 0x00, - 6, // 0x57 'W' - 0x00,0x88,0x88,0x88,0xa8,0xa8,0xd8,0x88,0x00, + 6, // 0x57 'W' + 0x00, 0x88, 0x88, 0x88, 0xa8, 0xa8, 0xd8, 0x88, 0x00, - 6, // 0x58 'X' - 0x00,0x88,0x88,0x50,0x20,0x50,0x88,0x88,0x00, + 6, // 0x58 'X' + 0x00, 0x88, 0x88, 0x50, 0x20, 0x50, 0x88, 0x88, 0x00, - 6, // 0x59 'Y' - 0x00,0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x00, + 6, // 0x59 'Y' + 0x00, 0x88, 0x88, 0x50, 0x20, 0x20, 0x20, 0x20, 0x00, - 6, // 0x5a 'Z' - 0x00,0xf8,0x08,0x10,0x20,0x40,0x80,0xf8,0x00, + 6, // 0x5a 'Z' + 0x00, 0xf8, 0x08, 0x10, 0x20, 0x40, 0x80, 0xf8, 0x00, - 6, // 0x5b '[' - 0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70, + 6, // 0x5b '[' + 0x70, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x70, - 6, // 0x5c '\' - 0x00,0x80,0x80,0x40,0x20,0x10,0x08,0x08,0x00, + 6, // 0x5c '\' + 0x00, 0x80, 0x80, 0x40, 0x20, 0x10, 0x08, 0x08, 0x00, - 6, // 0x5d ']' - 0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70, + 6, // 0x5d ']' + 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x70, - 6, // 0x5e '^' - 0x00,0x00,0x20,0x50,0x88,0x00,0x00,0x00,0x00, + 6, // 0x5e '^' + 0x00, 0x00, 0x20, 0x50, 0x88, 0x00, 0x00, 0x00, 0x00, - 6, // 0x5f '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x00, + 6, // 0x5f '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, - 6, // 0x60 '`' - 0x00,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x60 '`' + 0x00, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x61 'a' - 0x00,0x00,0x00,0x70,0x08,0x78,0x88,0x78,0x00, + 6, // 0x61 'a' + 0x00, 0x00, 0x00, 0x70, 0x08, 0x78, 0x88, 0x78, 0x00, - 6, // 0x62 'b' - 0x00,0x80,0x80,0xf0,0x88,0x88,0x88,0xf0,0x00, + 6, // 0x62 'b' + 0x00, 0x80, 0x80, 0xf0, 0x88, 0x88, 0x88, 0xf0, 0x00, - 6, // 0x63 'c' - 0x00,0x00,0x00,0x70,0x88,0x80,0x88,0x70,0x00, + 6, // 0x63 'c' + 0x00, 0x00, 0x00, 0x70, 0x88, 0x80, 0x88, 0x70, 0x00, - 6, // 0x64 'd' - 0x00,0x08,0x08,0x78,0x88,0x88,0x88,0x78,0x00, + 6, // 0x64 'd' + 0x00, 0x08, 0x08, 0x78, 0x88, 0x88, 0x88, 0x78, 0x00, - 6, // 0x65 'e' - 0x00,0x00,0x00,0x70,0x88,0xf8,0x80,0x78,0x00, + 6, // 0x65 'e' + 0x00, 0x00, 0x00, 0x70, 0x88, 0xf8, 0x80, 0x78, 0x00, - 6, // 0x66 'f' - 0x00,0x18,0x20,0x20,0xf8,0x20,0x20,0x20,0x00, + 6, // 0x66 'f' + 0x00, 0x18, 0x20, 0x20, 0xf8, 0x20, 0x20, 0x20, 0x00, - 6, // 0x67 'g' - 0x00,0x00,0x00,0x78,0x88,0x88,0x78,0x08,0x70, + 6, // 0x67 'g' + 0x00, 0x00, 0x00, 0x78, 0x88, 0x88, 0x78, 0x08, 0x70, - 6, // 0x68 'h' - 0x00,0x80,0x80,0xf0,0x88,0x88,0x88,0x88,0x00, + 6, // 0x68 'h' + 0x00, 0x80, 0x80, 0xf0, 0x88, 0x88, 0x88, 0x88, 0x00, - 6, // 0x69 'i' - 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0x70,0x00, + 6, // 0x69 'i' + 0x00, 0x20, 0x00, 0x60, 0x20, 0x20, 0x20, 0x70, 0x00, - 6, // 0x6a 'j' - 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x90,0x60, + 6, // 0x6a 'j' + 0x00, 0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x90, 0x60, - 6, // 0x6b 'k' - 0x00,0x00,0x80,0x88,0x90,0xa0,0xd0,0x88,0x00, + 6, // 0x6b 'k' + 0x00, 0x00, 0x80, 0x88, 0x90, 0xa0, 0xd0, 0x88, 0x00, - 6, // 0x6c 'l' - 0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00, + 6, // 0x6c 'l' + 0x00, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, - 6, // 0x6d 'm' - 0x00,0x00,0x00,0xd0,0xa8,0xa8,0xa8,0xa8,0x00, + 6, // 0x6d 'm' + 0x00, 0x00, 0x00, 0xd0, 0xa8, 0xa8, 0xa8, 0xa8, 0x00, - 6, // 0x6e 'n' - 0x00,0x00,0x00,0xb0,0xc8,0x88,0x88,0x88,0x00, + 6, // 0x6e 'n' + 0x00, 0x00, 0x00, 0xb0, 0xc8, 0x88, 0x88, 0x88, 0x00, - 6, // 0x6f 'o' - 0x00,0x00,0x00,0x70,0x88,0x88,0x88,0x70,0x00, + 6, // 0x6f 'o' + 0x00, 0x00, 0x00, 0x70, 0x88, 0x88, 0x88, 0x70, 0x00, - 6, // 0x70 'p' - 0x00,0x00,0x00,0xf0,0x88,0x88,0xf0,0x80,0x80, + 6, // 0x70 'p' + 0x00, 0x00, 0x00, 0xf0, 0x88, 0x88, 0xf0, 0x80, 0x80, - 6, // 0x71 'q' - 0x00,0x00,0x00,0x78,0x88,0x88,0x78,0x08,0x08, + 6, // 0x71 'q' + 0x00, 0x00, 0x00, 0x78, 0x88, 0x88, 0x78, 0x08, 0x08, - 6, // 0x72 'r' - 0x00,0x00,0x00,0xb8,0xc0,0x80,0x80,0x80,0x00, + 6, // 0x72 'r' + 0x00, 0x00, 0x00, 0xb8, 0xc0, 0x80, 0x80, 0x80, 0x00, - 6, // 0x73 's' - 0x00,0x00,0x00,0x78,0x80,0x70,0x08,0xf0,0x00, + 6, // 0x73 's' + 0x00, 0x00, 0x00, 0x78, 0x80, 0x70, 0x08, 0xf0, 0x00, - 6, // 0x74 't' - 0x00,0x40,0x40,0xe0,0x40,0x40,0x48,0x30,0x00, + 6, // 0x74 't' + 0x00, 0x40, 0x40, 0xe0, 0x40, 0x40, 0x48, 0x30, 0x00, - 6, // 0x75 'u' - 0x00,0x00,0x00,0x88,0x88,0x88,0x88,0x78,0x00, + 6, // 0x75 'u' + 0x00, 0x00, 0x00, 0x88, 0x88, 0x88, 0x88, 0x78, 0x00, - 6, // 0x76 'v' - 0x00,0x00,0x00,0x88,0x88,0x88,0x50,0x20,0x00, + 6, // 0x76 'v' + 0x00, 0x00, 0x00, 0x88, 0x88, 0x88, 0x50, 0x20, 0x00, - 6, // 0x77 'w' - 0x00,0x00,0x00,0x88,0x88,0xa8,0xd8,0x88,0x00, + 6, // 0x77 'w' + 0x00, 0x00, 0x00, 0x88, 0x88, 0xa8, 0xd8, 0x88, 0x00, - 6, // 0x78 'x' - 0x00,0x00,0x00,0x88,0x50,0x20,0x50,0x88,0x00, + 6, // 0x78 'x' + 0x00, 0x00, 0x00, 0x88, 0x50, 0x20, 0x50, 0x88, 0x00, - 6, // 0x79 'y' - 0x00,0x00,0x00,0x88,0x88,0x88,0x78,0x08,0x70, + 6, // 0x79 'y' + 0x00, 0x00, 0x00, 0x88, 0x88, 0x88, 0x78, 0x08, 0x70, - 6, // 0x7a 'z' - 0x00,0x00,0x00,0xf8,0x10,0x20,0x40,0xf8,0x00, + 6, // 0x7a 'z' + 0x00, 0x00, 0x00, 0xf8, 0x10, 0x20, 0x40, 0xf8, 0x00, - 6, // 0x7b '{' - 0x18,0x20,0x20,0x20,0xc0,0x20,0x20,0x20,0x18, + 6, // 0x7b '{' + 0x18, 0x20, 0x20, 0x20, 0xc0, 0x20, 0x20, 0x20, 0x18, - 6, // 0x7c '|' - 0x00,0x20,0x20,0x20,0x00,0x20,0x20,0x20,0x00, + 6, // 0x7c '|' + 0x00, 0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x20, 0x00, - 6, // 0x7d '}' - 0xc0,0x20,0x20,0x20,0x18,0x20,0x20,0x20,0xc0, + 6, // 0x7d '}' + 0xc0, 0x20, 0x20, 0x20, 0x18, 0x20, 0x20, 0x20, 0xc0, - 6, // 0x7e '~' - 0x00,0x40,0xa8,0x10,0x00,0x00,0x00,0x00,0x00, + 6, // 0x7e '~' + 0x00, 0x40, 0xa8, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x7f '' - 0x00,0x00,0x00,0x20,0x50,0x88,0xf8,0x00,0x00, - 0 -}; + 6, // 0x7f '' + 0x00, 0x00, 0x00, 0x20, 0x50, 0x88, 0xf8, 0x00, 0x00, 0}; -const int8u gse7x11[] = -{ - 11, 0, 32, 128-32, +const int8u gse7x11[] = { + 11, 0, 32, 128 - 32, - 0x00,0x00,0x0c,0x00,0x18,0x00,0x24,0x00,0x30,0x00,0x3c,0x00,0x48,0x00,0x54,0x00,0x60,0x00, - 0x6c,0x00,0x78,0x00,0x84,0x00,0x90,0x00,0x9c,0x00,0xa8,0x00,0xb4,0x00,0xc0,0x00,0xcc,0x00, - 0xd8,0x00,0xe4,0x00,0xf0,0x00,0xfc,0x00,0x08,0x01,0x14,0x01,0x20,0x01,0x2c,0x01,0x38,0x01, - 0x44,0x01,0x50,0x01,0x5c,0x01,0x68,0x01,0x74,0x01,0x80,0x01,0x8c,0x01,0x98,0x01,0xa4,0x01, - 0xb0,0x01,0xbc,0x01,0xc8,0x01,0xd4,0x01,0xe0,0x01,0xec,0x01,0xf8,0x01,0x04,0x02,0x10,0x02, - 0x1c,0x02,0x28,0x02,0x34,0x02,0x40,0x02,0x4c,0x02,0x58,0x02,0x64,0x02,0x70,0x02,0x7c,0x02, - 0x88,0x02,0x94,0x02,0xa0,0x02,0xac,0x02,0xb8,0x02,0xc4,0x02,0xd0,0x02,0xdc,0x02,0xe8,0x02, - 0xf4,0x02,0x00,0x03,0x0c,0x03,0x18,0x03,0x24,0x03,0x30,0x03,0x3c,0x03,0x48,0x03,0x54,0x03, - 0x60,0x03,0x6c,0x03,0x78,0x03,0x84,0x03,0x90,0x03,0x9c,0x03,0xa8,0x03,0xb4,0x03,0xc0,0x03, - 0xcc,0x03,0xd8,0x03,0xe4,0x03,0xf0,0x03,0xfc,0x03,0x08,0x04,0x14,0x04,0x20,0x04,0x2c,0x04, - 0x38,0x04,0x44,0x04,0x50,0x04,0x5c,0x04,0x68,0x04,0x74,0x04, + 0x00, 0x00, 0x0c, 0x00, 0x18, 0x00, 0x24, 0x00, 0x30, 0x00, 0x3c, 0x00, 0x48, 0x00, 0x54, 0x00, 0x60, 0x00, + 0x6c, 0x00, 0x78, 0x00, 0x84, 0x00, 0x90, 0x00, 0x9c, 0x00, 0xa8, 0x00, 0xb4, 0x00, 0xc0, 0x00, 0xcc, 0x00, + 0xd8, 0x00, 0xe4, 0x00, 0xf0, 0x00, 0xfc, 0x00, 0x08, 0x01, 0x14, 0x01, 0x20, 0x01, 0x2c, 0x01, 0x38, 0x01, + 0x44, 0x01, 0x50, 0x01, 0x5c, 0x01, 0x68, 0x01, 0x74, 0x01, 0x80, 0x01, 0x8c, 0x01, 0x98, 0x01, 0xa4, 0x01, + 0xb0, 0x01, 0xbc, 0x01, 0xc8, 0x01, 0xd4, 0x01, 0xe0, 0x01, 0xec, 0x01, 0xf8, 0x01, 0x04, 0x02, 0x10, 0x02, + 0x1c, 0x02, 0x28, 0x02, 0x34, 0x02, 0x40, 0x02, 0x4c, 0x02, 0x58, 0x02, 0x64, 0x02, 0x70, 0x02, 0x7c, 0x02, + 0x88, 0x02, 0x94, 0x02, 0xa0, 0x02, 0xac, 0x02, 0xb8, 0x02, 0xc4, 0x02, 0xd0, 0x02, 0xdc, 0x02, 0xe8, 0x02, + 0xf4, 0x02, 0x00, 0x03, 0x0c, 0x03, 0x18, 0x03, 0x24, 0x03, 0x30, 0x03, 0x3c, 0x03, 0x48, 0x03, 0x54, 0x03, + 0x60, 0x03, 0x6c, 0x03, 0x78, 0x03, 0x84, 0x03, 0x90, 0x03, 0x9c, 0x03, 0xa8, 0x03, 0xb4, 0x03, 0xc0, 0x03, + 0xcc, 0x03, 0xd8, 0x03, 0xe4, 0x03, 0xf0, 0x03, 0xfc, 0x03, 0x08, 0x04, 0x14, 0x04, 0x20, 0x04, 0x2c, 0x04, + 0x38, 0x04, 0x44, 0x04, 0x50, 0x04, 0x5c, 0x04, 0x68, 0x04, 0x74, 0x04, - 7, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x21 '!' - 0x00,0x10,0x38,0x38,0x38,0x10,0x10,0x00,0x10,0x00,0x00, + 7, // 0x21 '!' + 0x00, 0x10, 0x38, 0x38, 0x38, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, - 7, // 0x22 '"' - 0x00,0x00,0x24,0x24,0x24,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x22 '"' + 0x00, 0x00, 0x24, 0x24, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x23 '#' - 0x00,0x48,0x48,0xfc,0x48,0x48,0xfc,0x48,0x48,0x00,0x00, + 7, // 0x23 '#' + 0x00, 0x48, 0x48, 0xfc, 0x48, 0x48, 0xfc, 0x48, 0x48, 0x00, 0x00, - 7, // 0x24 '$' - 0x00,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x00, + 7, // 0x24 '$' + 0x00, 0x10, 0x38, 0x54, 0x50, 0x38, 0x14, 0x54, 0x38, 0x10, 0x00, - 7, // 0x25 '%' - 0x00,0x00,0x42,0xa4,0x48,0x10,0x24,0x4a,0x84,0x00,0x00, + 7, // 0x25 '%' + 0x00, 0x00, 0x42, 0xa4, 0x48, 0x10, 0x24, 0x4a, 0x84, 0x00, 0x00, - 7, // 0x26 '&' - 0x00,0x30,0x48,0x48,0x30,0x60,0x94,0x98,0x6c,0x00,0x00, + 7, // 0x26 '&' + 0x00, 0x30, 0x48, 0x48, 0x30, 0x60, 0x94, 0x98, 0x6c, 0x00, 0x00, - 7, // 0x27 ''' - 0x00,0x20,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x27 ''' + 0x00, 0x20, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x28 '(' - 0x00,0x04,0x08,0x10,0x10,0x10,0x10,0x08,0x04,0x00,0x00, + 7, // 0x28 '(' + 0x00, 0x04, 0x08, 0x10, 0x10, 0x10, 0x10, 0x08, 0x04, 0x00, 0x00, - 7, // 0x29 ')' - 0x00,0x40,0x20,0x10,0x10,0x10,0x10,0x20,0x40,0x00,0x00, + 7, // 0x29 ')' + 0x00, 0x40, 0x20, 0x10, 0x10, 0x10, 0x10, 0x20, 0x40, 0x00, 0x00, - 7, // 0x2a '*' - 0x00,0x00,0x00,0x20,0xa8,0x70,0xa8,0x20,0x00,0x00,0x00, + 7, // 0x2a '*' + 0x00, 0x00, 0x00, 0x20, 0xa8, 0x70, 0xa8, 0x20, 0x00, 0x00, 0x00, - 7, // 0x2b '+' - 0x00,0x00,0x00,0x10,0x10,0x7c,0x10,0x10,0x00,0x00,0x00, + 7, // 0x2b '+' + 0x00, 0x00, 0x00, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00, - 7, // 0x2c ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x60, + 7, // 0x2c ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x60, - 7, // 0x2d '-' - 0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2d '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x2e '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00, + 7, // 0x2e '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, - 7, // 0x2f '/' - 0x00,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,0x00, + 7, // 0x2f '/' + 0x00, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x00, 0x00, - 7, // 0x30 '0' - 0x00,0x38,0x44,0x4c,0x54,0x64,0x44,0x44,0x38,0x00,0x00, + 7, // 0x30 '0' + 0x00, 0x38, 0x44, 0x4c, 0x54, 0x64, 0x44, 0x44, 0x38, 0x00, 0x00, - 7, // 0x31 '1' - 0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x7c,0x00,0x00, + 7, // 0x31 '1' + 0x00, 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, - 7, // 0x32 '2' - 0x00,0x38,0x44,0x04,0x08,0x10,0x20,0x44,0x7c,0x00,0x00, + 7, // 0x32 '2' + 0x00, 0x38, 0x44, 0x04, 0x08, 0x10, 0x20, 0x44, 0x7c, 0x00, 0x00, - 7, // 0x33 '3' - 0x00,0x7c,0x48,0x10,0x38,0x04,0x04,0x44,0x38,0x00,0x00, + 7, // 0x33 '3' + 0x00, 0x7c, 0x48, 0x10, 0x38, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, - 7, // 0x34 '4' - 0x00,0x08,0x10,0x20,0x48,0x48,0x7c,0x08,0x1c,0x00,0x00, + 7, // 0x34 '4' + 0x00, 0x08, 0x10, 0x20, 0x48, 0x48, 0x7c, 0x08, 0x1c, 0x00, 0x00, - 7, // 0x35 '5' - 0x00,0x7c,0x40,0x40,0x78,0x04,0x04,0x44,0x38,0x00,0x00, + 7, // 0x35 '5' + 0x00, 0x7c, 0x40, 0x40, 0x78, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, - 7, // 0x36 '6' - 0x00,0x18,0x20,0x40,0x78,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x36 '6' + 0x00, 0x18, 0x20, 0x40, 0x78, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 7, // 0x37 '7' - 0x00,0x7c,0x44,0x04,0x08,0x10,0x10,0x10,0x10,0x00,0x00, + 7, // 0x37 '7' + 0x00, 0x7c, 0x44, 0x04, 0x08, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - 7, // 0x38 '8' - 0x00,0x38,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x38 '8' + 0x00, 0x38, 0x44, 0x44, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 7, // 0x39 '9' - 0x00,0x38,0x44,0x44,0x44,0x3c,0x04,0x08,0x30,0x00,0x00, + 7, // 0x39 '9' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x3c, 0x04, 0x08, 0x30, 0x00, 0x00, - 7, // 0x3a ':' - 0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x30,0x00,0x00,0x00, + 7, // 0x3a ':' + 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, - 7, // 0x3b ';' - 0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x30,0x30,0x60,0x00, + 7, // 0x3b ';' + 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x30, 0x60, 0x00, - 7, // 0x3c '<' - 0x00,0x00,0x04,0x08,0x10,0x20,0x10,0x08,0x04,0x00,0x00, + 7, // 0x3c '<' + 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, - 7, // 0x3d '=' - 0x00,0x00,0x00,0x00,0xfc,0x00,0xfc,0x00,0x00,0x00,0x00, + 7, // 0x3d '=' + 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, - 7, // 0x3e '>' - 0x00,0x00,0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x00,0x00, + 7, // 0x3e '>' + 0x00, 0x00, 0x40, 0x20, 0x10, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, - 7, // 0x3f '?' - 0x00,0x70,0x88,0x88,0x10,0x20,0x20,0x00,0x20,0x00,0x00, + 7, // 0x3f '?' + 0x00, 0x70, 0x88, 0x88, 0x10, 0x20, 0x20, 0x00, 0x20, 0x00, 0x00, - 7, // 0x40 '@' - 0x00,0x30,0x48,0x04,0x34,0x54,0x54,0x54,0x28,0x00,0x00, + 7, // 0x40 '@' + 0x00, 0x30, 0x48, 0x04, 0x34, 0x54, 0x54, 0x54, 0x28, 0x00, 0x00, - 7, // 0x41 'A' - 0x00,0x10,0x28,0x44,0x44,0x7c,0x44,0x44,0x44,0x00,0x00, + 7, // 0x41 'A' + 0x00, 0x10, 0x28, 0x44, 0x44, 0x7c, 0x44, 0x44, 0x44, 0x00, 0x00, - 7, // 0x42 'B' - 0x00,0x78,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00,0x00, + 7, // 0x42 'B' + 0x00, 0x78, 0x44, 0x44, 0x78, 0x44, 0x44, 0x44, 0x78, 0x00, 0x00, - 7, // 0x43 'C' - 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00, + 7, // 0x43 'C' + 0x00, 0x38, 0x44, 0x40, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, - 7, // 0x44 'D' - 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00, + 7, // 0x44 'D' + 0x00, 0x70, 0x48, 0x44, 0x44, 0x44, 0x44, 0x48, 0x70, 0x00, 0x00, - 7, // 0x45 'E' - 0x00,0x7c,0x40,0x40,0x70,0x40,0x40,0x40,0x7c,0x00,0x00, + 7, // 0x45 'E' + 0x00, 0x7c, 0x40, 0x40, 0x70, 0x40, 0x40, 0x40, 0x7c, 0x00, 0x00, - 7, // 0x46 'F' - 0x00,0x7c,0x40,0x40,0x70,0x40,0x40,0x40,0x40,0x00,0x00, + 7, // 0x46 'F' + 0x00, 0x7c, 0x40, 0x40, 0x70, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, - 7, // 0x47 'G' - 0x00,0x38,0x44,0x40,0x40,0x5c,0x44,0x44,0x38,0x00,0x00, + 7, // 0x47 'G' + 0x00, 0x38, 0x44, 0x40, 0x40, 0x5c, 0x44, 0x44, 0x38, 0x00, 0x00, - 7, // 0x48 'H' - 0x00,0x44,0x44,0x44,0x7c,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x48 'H' + 0x00, 0x44, 0x44, 0x44, 0x7c, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, - 7, // 0x49 'I' - 0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 7, // 0x49 'I' + 0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, - 7, // 0x4a 'J' - 0x00,0x1c,0x08,0x08,0x08,0x08,0x08,0x48,0x30,0x00,0x00, + 7, // 0x4a 'J' + 0x00, 0x1c, 0x08, 0x08, 0x08, 0x08, 0x08, 0x48, 0x30, 0x00, 0x00, - 7, // 0x4b 'K' - 0x00,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x44,0x00,0x00, + 7, // 0x4b 'K' + 0x00, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x44, 0x00, 0x00, - 7, // 0x4c 'L' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7c,0x00,0x00, + 7, // 0x4c 'L' + 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7c, 0x00, 0x00, - 7, // 0x4d 'M' - 0x00,0x44,0x6c,0x54,0x54,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x4d 'M' + 0x00, 0x44, 0x6c, 0x54, 0x54, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, - 7, // 0x4e 'N' - 0x00,0x44,0x44,0x64,0x54,0x4c,0x44,0x44,0x44,0x00,0x00, + 7, // 0x4e 'N' + 0x00, 0x44, 0x44, 0x64, 0x54, 0x4c, 0x44, 0x44, 0x44, 0x00, 0x00, - 7, // 0x4f 'O' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x4f 'O' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 7, // 0x50 'P' - 0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00, + 7, // 0x50 'P' + 0x00, 0x78, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, 0x00, 0x00, - 7, // 0x51 'Q' - 0x00,0x38,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00, + 7, // 0x51 'Q' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x54, 0x48, 0x34, 0x00, 0x00, - 7, // 0x52 'R' - 0x00,0x78,0x44,0x44,0x44,0x78,0x50,0x48,0x44,0x00,0x00, + 7, // 0x52 'R' + 0x00, 0x78, 0x44, 0x44, 0x44, 0x78, 0x50, 0x48, 0x44, 0x00, 0x00, - 7, // 0x53 'S' - 0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x44,0x38,0x00,0x00, + 7, // 0x53 'S' + 0x00, 0x38, 0x44, 0x40, 0x38, 0x04, 0x44, 0x44, 0x38, 0x00, 0x00, - 7, // 0x54 'T' - 0x00,0x7c,0x54,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, + 7, // 0x54 'T' + 0x00, 0x7c, 0x54, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - 7, // 0x55 'U' - 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x55 'U' + 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 7, // 0x56 'V' - 0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00, + 7, // 0x56 'V' + 0x00, 0x44, 0x44, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, - 7, // 0x57 'W' - 0x00,0x44,0x44,0x44,0x44,0x54,0x54,0x6c,0x44,0x00,0x00, + 7, // 0x57 'W' + 0x00, 0x44, 0x44, 0x44, 0x44, 0x54, 0x54, 0x6c, 0x44, 0x00, 0x00, - 7, // 0x58 'X' - 0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00, + 7, // 0x58 'X' + 0x00, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x44, 0x00, 0x00, - 7, // 0x59 'Y' - 0x00,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x38,0x00,0x00, + 7, // 0x59 'Y' + 0x00, 0x44, 0x44, 0x44, 0x28, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, - 7, // 0x5a 'Z' - 0x00,0x7c,0x04,0x08,0x10,0x20,0x40,0x44,0x7c,0x00,0x00, + 7, // 0x5a 'Z' + 0x00, 0x7c, 0x04, 0x08, 0x10, 0x20, 0x40, 0x44, 0x7c, 0x00, 0x00, - 7, // 0x5b '[' - 0x00,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00,0x00, + 7, // 0x5b '[' + 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00, 0x00, - 7, // 0x5c '\' - 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00,0x00, + 7, // 0x5c '\' + 0x00, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x00, 0x00, - 7, // 0x5d ']' - 0x00,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x38,0x00,0x00, + 7, // 0x5d ']' + 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x00, 0x00, - 7, // 0x5e '^' - 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x5e '^' + 0x00, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x5f '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00, + 7, // 0x5f '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, - 7, // 0x60 '`' - 0x00,0x20,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x60 '`' + 0x00, 0x20, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x61 'a' - 0x00,0x00,0x00,0x38,0x04,0x3c,0x44,0x44,0x3c,0x00,0x00, + 7, // 0x61 'a' + 0x00, 0x00, 0x00, 0x38, 0x04, 0x3c, 0x44, 0x44, 0x3c, 0x00, 0x00, - 7, // 0x62 'b' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x78,0x00,0x00, + 7, // 0x62 'b' + 0x00, 0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x44, 0x78, 0x00, 0x00, - 7, // 0x63 'c' - 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x44,0x38,0x00,0x00, + 7, // 0x63 'c' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, - 7, // 0x64 'd' - 0x00,0x04,0x04,0x3c,0x44,0x44,0x44,0x44,0x3c,0x00,0x00, + 7, // 0x64 'd' + 0x00, 0x04, 0x04, 0x3c, 0x44, 0x44, 0x44, 0x44, 0x3c, 0x00, 0x00, - 7, // 0x65 'e' - 0x00,0x00,0x00,0x38,0x44,0x7c,0x40,0x44,0x38,0x00,0x00, + 7, // 0x65 'e' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x7c, 0x40, 0x44, 0x38, 0x00, 0x00, - 7, // 0x66 'f' - 0x00,0x18,0x24,0x20,0x70,0x20,0x20,0x20,0x70,0x00,0x00, + 7, // 0x66 'f' + 0x00, 0x18, 0x24, 0x20, 0x70, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, - 7, // 0x67 'g' - 0x00,0x00,0x00,0x3c,0x44,0x44,0x44,0x3c,0x04,0x44,0x38, + 7, // 0x67 'g' + 0x00, 0x00, 0x00, 0x3c, 0x44, 0x44, 0x44, 0x3c, 0x04, 0x44, 0x38, - 7, // 0x68 'h' - 0x00,0x40,0x40,0x40,0x58,0x64,0x44,0x44,0x44,0x00,0x00, + 7, // 0x68 'h' + 0x00, 0x40, 0x40, 0x40, 0x58, 0x64, 0x44, 0x44, 0x44, 0x00, 0x00, - 7, // 0x69 'i' - 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 7, // 0x69 'i' + 0x00, 0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, - 7, // 0x6a 'j' - 0x00,0x08,0x00,0x18,0x08,0x08,0x08,0x08,0x48,0x30,0x00, + 7, // 0x6a 'j' + 0x00, 0x08, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x48, 0x30, 0x00, - 7, // 0x6b 'k' - 0x00,0x40,0x40,0x44,0x48,0x50,0x68,0x44,0x44,0x00,0x00, + 7, // 0x6b 'k' + 0x00, 0x40, 0x40, 0x44, 0x48, 0x50, 0x68, 0x44, 0x44, 0x00, 0x00, - 7, // 0x6c 'l' - 0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 7, // 0x6c 'l' + 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, - 7, // 0x6d 'm' - 0x00,0x00,0x00,0xa8,0x54,0x54,0x54,0x54,0x54,0x00,0x00, + 7, // 0x6d 'm' + 0x00, 0x00, 0x00, 0xa8, 0x54, 0x54, 0x54, 0x54, 0x54, 0x00, 0x00, - 7, // 0x6e 'n' - 0x00,0x00,0x00,0xb8,0x44,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x6e 'n' + 0x00, 0x00, 0x00, 0xb8, 0x44, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, - 7, // 0x6f 'o' - 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x6f 'o' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 7, // 0x70 'p' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40, + 7, // 0x70 'p' + 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, - 7, // 0x71 'q' - 0x00,0x00,0x00,0x3c,0x44,0x44,0x44,0x44,0x3c,0x04,0x04, + 7, // 0x71 'q' + 0x00, 0x00, 0x00, 0x3c, 0x44, 0x44, 0x44, 0x44, 0x3c, 0x04, 0x04, - 7, // 0x72 'r' - 0x00,0x00,0x00,0x58,0x64,0x44,0x40,0x40,0x40,0x00,0x00, + 7, // 0x72 'r' + 0x00, 0x00, 0x00, 0x58, 0x64, 0x44, 0x40, 0x40, 0x40, 0x00, 0x00, - 7, // 0x73 's' - 0x00,0x00,0x00,0x3c,0x40,0x38,0x04,0x04,0x78,0x00,0x00, + 7, // 0x73 's' + 0x00, 0x00, 0x00, 0x3c, 0x40, 0x38, 0x04, 0x04, 0x78, 0x00, 0x00, - 7, // 0x74 't' - 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x24,0x18,0x00,0x00, + 7, // 0x74 't' + 0x00, 0x20, 0x20, 0x70, 0x20, 0x20, 0x20, 0x24, 0x18, 0x00, 0x00, - 7, // 0x75 'u' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x3a,0x00,0x00, + 7, // 0x75 'u' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x3a, 0x00, 0x00, - 7, // 0x76 'v' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x28,0x10,0x00,0x00, + 7, // 0x76 'v' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x28, 0x10, 0x00, 0x00, - 7, // 0x77 'w' - 0x00,0x00,0x00,0x44,0x44,0x54,0x54,0x6c,0x44,0x00,0x00, + 7, // 0x77 'w' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x54, 0x54, 0x6c, 0x44, 0x00, 0x00, - 7, // 0x78 'x' - 0x00,0x00,0x00,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, + 7, // 0x78 'x' + 0x00, 0x00, 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x00, 0x00, - 7, // 0x79 'y' - 0x00,0x00,0x00,0x44,0x44,0x44,0x3c,0x04,0x08,0x30,0x00, + 7, // 0x79 'y' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x3c, 0x04, 0x08, 0x30, 0x00, - 7, // 0x7a 'z' - 0x00,0x00,0x00,0x7c,0x08,0x10,0x20,0x44,0x7c,0x00,0x00, + 7, // 0x7a 'z' + 0x00, 0x00, 0x00, 0x7c, 0x08, 0x10, 0x20, 0x44, 0x7c, 0x00, 0x00, - 7, // 0x7b '{' - 0x00,0x0c,0x10,0x10,0x10,0x60,0x10,0x10,0x0c,0x00,0x00, + 7, // 0x7b '{' + 0x00, 0x0c, 0x10, 0x10, 0x10, 0x60, 0x10, 0x10, 0x0c, 0x00, 0x00, - 7, // 0x7c '|' - 0x00,0x20,0x20,0x20,0x00,0x20,0x20,0x20,0x20,0x00,0x00, + 7, // 0x7c '|' + 0x00, 0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, - 7, // 0x7d '}' - 0x00,0x60,0x10,0x10,0x10,0x0c,0x10,0x10,0x60,0x00,0x00, + 7, // 0x7d '}' + 0x00, 0x60, 0x10, 0x10, 0x10, 0x0c, 0x10, 0x10, 0x60, 0x00, 0x00, - 7, // 0x7e '~' - 0x00,0x00,0x64,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x7e '~' + 0x00, 0x00, 0x64, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x7f '' - 0x00,0x00,0x00,0x10,0x28,0x44,0x44,0x7c,0x00,0x00,0x00, - 0 -}; + 7, // 0x7f '' + 0x00, 0x00, 0x00, 0x10, 0x28, 0x44, 0x44, 0x7c, 0x00, 0x00, 0x00, 0}; -const int8u gse7x11_bold[] = -{ - 11, 0, 32, 128-32, +const int8u gse7x11_bold[] = { + 11, 0, 32, 128 - 32, - 0x00,0x00,0x0c,0x00,0x18,0x00,0x24,0x00,0x30,0x00,0x3c,0x00,0x48,0x00,0x54,0x00,0x60,0x00, - 0x6c,0x00,0x78,0x00,0x84,0x00,0x90,0x00,0x9c,0x00,0xa8,0x00,0xb4,0x00,0xc0,0x00,0xcc,0x00, - 0xd8,0x00,0xe4,0x00,0xf0,0x00,0xfc,0x00,0x08,0x01,0x14,0x01,0x20,0x01,0x2c,0x01,0x38,0x01, - 0x44,0x01,0x50,0x01,0x5c,0x01,0x68,0x01,0x74,0x01,0x80,0x01,0x8c,0x01,0x98,0x01,0xa4,0x01, - 0xb0,0x01,0xbc,0x01,0xc8,0x01,0xd4,0x01,0xe0,0x01,0xec,0x01,0xf8,0x01,0x04,0x02,0x10,0x02, - 0x1c,0x02,0x28,0x02,0x34,0x02,0x40,0x02,0x4c,0x02,0x58,0x02,0x64,0x02,0x70,0x02,0x7c,0x02, - 0x88,0x02,0x94,0x02,0xa0,0x02,0xac,0x02,0xb8,0x02,0xc4,0x02,0xd0,0x02,0xdc,0x02,0xe8,0x02, - 0xf4,0x02,0x00,0x03,0x0c,0x03,0x18,0x03,0x24,0x03,0x30,0x03,0x3c,0x03,0x48,0x03,0x54,0x03, - 0x60,0x03,0x6c,0x03,0x78,0x03,0x84,0x03,0x90,0x03,0x9c,0x03,0xa8,0x03,0xb4,0x03,0xc0,0x03, - 0xcc,0x03,0xd8,0x03,0xe4,0x03,0xf0,0x03,0xfc,0x03,0x08,0x04,0x14,0x04,0x20,0x04,0x2c,0x04, - 0x38,0x04,0x44,0x04,0x50,0x04,0x5c,0x04,0x68,0x04,0x74,0x04, + 0x00, 0x00, 0x0c, 0x00, 0x18, 0x00, 0x24, 0x00, 0x30, 0x00, 0x3c, 0x00, 0x48, 0x00, 0x54, 0x00, 0x60, 0x00, + 0x6c, 0x00, 0x78, 0x00, 0x84, 0x00, 0x90, 0x00, 0x9c, 0x00, 0xa8, 0x00, 0xb4, 0x00, 0xc0, 0x00, 0xcc, 0x00, + 0xd8, 0x00, 0xe4, 0x00, 0xf0, 0x00, 0xfc, 0x00, 0x08, 0x01, 0x14, 0x01, 0x20, 0x01, 0x2c, 0x01, 0x38, 0x01, + 0x44, 0x01, 0x50, 0x01, 0x5c, 0x01, 0x68, 0x01, 0x74, 0x01, 0x80, 0x01, 0x8c, 0x01, 0x98, 0x01, 0xa4, 0x01, + 0xb0, 0x01, 0xbc, 0x01, 0xc8, 0x01, 0xd4, 0x01, 0xe0, 0x01, 0xec, 0x01, 0xf8, 0x01, 0x04, 0x02, 0x10, 0x02, + 0x1c, 0x02, 0x28, 0x02, 0x34, 0x02, 0x40, 0x02, 0x4c, 0x02, 0x58, 0x02, 0x64, 0x02, 0x70, 0x02, 0x7c, 0x02, + 0x88, 0x02, 0x94, 0x02, 0xa0, 0x02, 0xac, 0x02, 0xb8, 0x02, 0xc4, 0x02, 0xd0, 0x02, 0xdc, 0x02, 0xe8, 0x02, + 0xf4, 0x02, 0x00, 0x03, 0x0c, 0x03, 0x18, 0x03, 0x24, 0x03, 0x30, 0x03, 0x3c, 0x03, 0x48, 0x03, 0x54, 0x03, + 0x60, 0x03, 0x6c, 0x03, 0x78, 0x03, 0x84, 0x03, 0x90, 0x03, 0x9c, 0x03, 0xa8, 0x03, 0xb4, 0x03, 0xc0, 0x03, + 0xcc, 0x03, 0xd8, 0x03, 0xe4, 0x03, 0xf0, 0x03, 0xfc, 0x03, 0x08, 0x04, 0x14, 0x04, 0x20, 0x04, 0x2c, 0x04, + 0x38, 0x04, 0x44, 0x04, 0x50, 0x04, 0x5c, 0x04, 0x68, 0x04, 0x74, 0x04, - 7, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x21 '!' - 0x00,0x30,0x30,0x30,0x30,0x30,0x00,0x30,0x30,0x00,0x00, + 7, // 0x21 '!' + 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x00, - 7, // 0x22 '"' - 0x00,0x6c,0x6c,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x22 '"' + 0x00, 0x6c, 0x6c, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x23 '#' - 0x00,0x48,0x48,0xfc,0x48,0x48,0xfc,0x48,0x48,0x00,0x00, + 7, // 0x23 '#' + 0x00, 0x48, 0x48, 0xfc, 0x48, 0x48, 0xfc, 0x48, 0x48, 0x00, 0x00, - 7, // 0x24 '$' - 0x30,0x30,0x78,0xcc,0xc0,0x78,0x0c,0xcc,0x78,0x30,0x30, + 7, // 0x24 '$' + 0x30, 0x30, 0x78, 0xcc, 0xc0, 0x78, 0x0c, 0xcc, 0x78, 0x30, 0x30, - 7, // 0x25 '%' - 0x00,0x00,0xc4,0x0c,0x18,0x30,0x60,0xc0,0x8c,0x00,0x00, + 7, // 0x25 '%' + 0x00, 0x00, 0xc4, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x8c, 0x00, 0x00, - 7, // 0x26 '&' - 0x00,0x30,0x58,0x58,0x30,0x74,0xdc,0xd8,0x6c,0x00,0x00, + 7, // 0x26 '&' + 0x00, 0x30, 0x58, 0x58, 0x30, 0x74, 0xdc, 0xd8, 0x6c, 0x00, 0x00, - 7, // 0x27 ''' - 0x00,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x27 ''' + 0x00, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x28 '(' - 0x00,0x0c,0x18,0x30,0x30,0x30,0x30,0x18,0x0c,0x00,0x00, + 7, // 0x28 '(' + 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x00, 0x00, - 7, // 0x29 ')' - 0x00,0xc0,0x60,0x30,0x30,0x30,0x30,0x60,0xc0,0x00,0x00, + 7, // 0x29 ')' + 0x00, 0xc0, 0x60, 0x30, 0x30, 0x30, 0x30, 0x60, 0xc0, 0x00, 0x00, - 7, // 0x2a '*' - 0x00,0x00,0x00,0x20,0xa8,0x70,0xa8,0x20,0x00,0x00,0x00, + 7, // 0x2a '*' + 0x00, 0x00, 0x00, 0x20, 0xa8, 0x70, 0xa8, 0x20, 0x00, 0x00, 0x00, - 7, // 0x2b '+' - 0x00,0x00,0x00,0x30,0x30,0xfc,0x30,0x30,0x00,0x00,0x00, + 7, // 0x2b '+' + 0x00, 0x00, 0x00, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x00, 0x00, 0x00, - 7, // 0x2c ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x60,0x00, + 7, // 0x2c ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x60, 0x00, - 7, // 0x2d '-' - 0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2d '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x2e '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00, + 7, // 0x2e '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, - 7, // 0x2f '/' - 0x00,0x0c,0x0c,0x18,0x18,0x30,0x30,0x60,0x60,0x00,0x00, + 7, // 0x2f '/' + 0x00, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0x00, 0x00, - 7, // 0x30 '0' - 0x00,0x78,0xcc,0xcc,0xdc,0xec,0xcc,0xcc,0x78,0x00,0x00, + 7, // 0x30 '0' + 0x00, 0x78, 0xcc, 0xcc, 0xdc, 0xec, 0xcc, 0xcc, 0x78, 0x00, 0x00, - 7, // 0x31 '1' - 0x00,0x30,0x70,0xf0,0x30,0x30,0x30,0x30,0xfc,0x00,0x00, + 7, // 0x31 '1' + 0x00, 0x30, 0x70, 0xf0, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x00, 0x00, - 7, // 0x32 '2' - 0x00,0x78,0xcc,0xcc,0x18,0x30,0x60,0xcc,0xfc,0x00,0x00, + 7, // 0x32 '2' + 0x00, 0x78, 0xcc, 0xcc, 0x18, 0x30, 0x60, 0xcc, 0xfc, 0x00, 0x00, - 7, // 0x33 '3' - 0x00,0xfc,0x98,0x30,0x78,0x0c,0x0c,0xcc,0x78,0x00,0x00, + 7, // 0x33 '3' + 0x00, 0xfc, 0x98, 0x30, 0x78, 0x0c, 0x0c, 0xcc, 0x78, 0x00, 0x00, - 7, // 0x34 '4' - 0x00,0x18,0x30,0x68,0xd8,0xd8,0xfc,0x18,0x3c,0x00,0x00, + 7, // 0x34 '4' + 0x00, 0x18, 0x30, 0x68, 0xd8, 0xd8, 0xfc, 0x18, 0x3c, 0x00, 0x00, - 7, // 0x35 '5' - 0x00,0xfc,0xc0,0xc0,0xf8,0x0c,0x0c,0xcc,0x78,0x00,0x00, + 7, // 0x35 '5' + 0x00, 0xfc, 0xc0, 0xc0, 0xf8, 0x0c, 0x0c, 0xcc, 0x78, 0x00, 0x00, - 7, // 0x36 '6' - 0x00,0x38,0x60,0xc0,0xf8,0xcc,0xcc,0xcc,0x78,0x00,0x00, + 7, // 0x36 '6' + 0x00, 0x38, 0x60, 0xc0, 0xf8, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, - 7, // 0x37 '7' - 0x00,0xfc,0x8c,0x0c,0x18,0x30,0x30,0x30,0x30,0x00,0x00, + 7, // 0x37 '7' + 0x00, 0xfc, 0x8c, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, - 7, // 0x38 '8' - 0x00,0x78,0xcc,0xcc,0x78,0xcc,0xcc,0xcc,0x78,0x00,0x00, + 7, // 0x38 '8' + 0x00, 0x78, 0xcc, 0xcc, 0x78, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, - 7, // 0x39 '9' - 0x00,0x78,0xcc,0xcc,0xcc,0x7c,0x0c,0x18,0x70,0x00,0x00, + 7, // 0x39 '9' + 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x18, 0x70, 0x00, 0x00, - 7, // 0x3a ':' - 0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x00,0x00,0x00, + 7, // 0x3a ':' + 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, - 7, // 0x3b ';' - 0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x30,0x60,0x00, + 7, // 0x3b ';' + 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x30, 0x60, 0x00, - 7, // 0x3c '<' - 0x00,0x00,0x0c,0x18,0x30,0x60,0x30,0x18,0x0c,0x00,0x00, + 7, // 0x3c '<' + 0x00, 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x00, - 7, // 0x3d '=' - 0x00,0x00,0x00,0x00,0xfc,0x00,0xfc,0x00,0x00,0x00,0x00, + 7, // 0x3d '=' + 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, - 7, // 0x3e '>' - 0x00,0x00,0x60,0x30,0x18,0x0c,0x18,0x30,0x60,0x00,0x00, + 7, // 0x3e '>' + 0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, - 7, // 0x3f '?' - 0x00,0x78,0xcc,0xcc,0x18,0x30,0x30,0x00,0x30,0x00,0x00, + 7, // 0x3f '?' + 0x00, 0x78, 0xcc, 0xcc, 0x18, 0x30, 0x30, 0x00, 0x30, 0x00, 0x00, - 7, // 0x40 '@' - 0x00,0x70,0x88,0x04,0x74,0xb4,0xb4,0xb4,0x68,0x00,0x00, + 7, // 0x40 '@' + 0x00, 0x70, 0x88, 0x04, 0x74, 0xb4, 0xb4, 0xb4, 0x68, 0x00, 0x00, - 7, // 0x41 'A' - 0x00,0x30,0x78,0xcc,0xcc,0xfc,0xcc,0xcc,0xcc,0x00,0x00, + 7, // 0x41 'A' + 0x00, 0x30, 0x78, 0xcc, 0xcc, 0xfc, 0xcc, 0xcc, 0xcc, 0x00, 0x00, - 7, // 0x42 'B' - 0x00,0xf8,0xcc,0xcc,0xf8,0xcc,0xcc,0xcc,0xf8,0x00,0x00, + 7, // 0x42 'B' + 0x00, 0xf8, 0xcc, 0xcc, 0xf8, 0xcc, 0xcc, 0xcc, 0xf8, 0x00, 0x00, - 7, // 0x43 'C' - 0x00,0x78,0xcc,0xc0,0xc0,0xc0,0xc0,0xcc,0x78,0x00,0x00, + 7, // 0x43 'C' + 0x00, 0x78, 0xcc, 0xc0, 0xc0, 0xc0, 0xc0, 0xcc, 0x78, 0x00, 0x00, - 7, // 0x44 'D' - 0x00,0xf0,0xd8,0xcc,0xcc,0xcc,0xcc,0xd8,0xf0,0x00,0x00, + 7, // 0x44 'D' + 0x00, 0xf0, 0xd8, 0xcc, 0xcc, 0xcc, 0xcc, 0xd8, 0xf0, 0x00, 0x00, - 7, // 0x45 'E' - 0x00,0xfc,0xc4,0xd0,0xf0,0xd0,0xc0,0xc4,0xfc,0x00,0x00, + 7, // 0x45 'E' + 0x00, 0xfc, 0xc4, 0xd0, 0xf0, 0xd0, 0xc0, 0xc4, 0xfc, 0x00, 0x00, - 7, // 0x46 'F' - 0x00,0xfc,0xc4,0xd0,0xf0,0xd0,0xc0,0xc0,0xc0,0x00,0x00, + 7, // 0x46 'F' + 0x00, 0xfc, 0xc4, 0xd0, 0xf0, 0xd0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, - 7, // 0x47 'G' - 0x00,0x78,0xcc,0xc0,0xc0,0xdc,0xcc,0xcc,0x78,0x00,0x00, + 7, // 0x47 'G' + 0x00, 0x78, 0xcc, 0xc0, 0xc0, 0xdc, 0xcc, 0xcc, 0x78, 0x00, 0x00, - 7, // 0x48 'H' - 0x00,0xcc,0xcc,0xcc,0xfc,0xcc,0xcc,0xcc,0xcc,0x00,0x00, + 7, // 0x48 'H' + 0x00, 0xcc, 0xcc, 0xcc, 0xfc, 0xcc, 0xcc, 0xcc, 0xcc, 0x00, 0x00, - 7, // 0x49 'I' - 0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00, + 7, // 0x49 'I' + 0x00, 0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, - 7, // 0x4a 'J' - 0x00,0x3c,0x18,0x18,0x18,0x18,0xd8,0xd8,0x70,0x00,0x00, + 7, // 0x4a 'J' + 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0x70, 0x00, 0x00, - 7, // 0x4b 'K' - 0x00,0xcc,0xcc,0xd8,0xf0,0xd8,0xcc,0xcc,0xcc,0x00,0x00, + 7, // 0x4b 'K' + 0x00, 0xcc, 0xcc, 0xd8, 0xf0, 0xd8, 0xcc, 0xcc, 0xcc, 0x00, 0x00, - 7, // 0x4c 'L' - 0x00,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc4,0xfc,0x00,0x00, + 7, // 0x4c 'L' + 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc4, 0xfc, 0x00, 0x00, - 7, // 0x4d 'M' - 0x00,0x84,0xcc,0xfc,0xb4,0xcc,0xcc,0xcc,0xcc,0x00,0x00, + 7, // 0x4d 'M' + 0x00, 0x84, 0xcc, 0xfc, 0xb4, 0xcc, 0xcc, 0xcc, 0xcc, 0x00, 0x00, - 7, // 0x4e 'N' - 0x00,0xcc,0xcc,0xec,0xfc,0xdc,0xcc,0xcc,0xcc,0x00,0x00, + 7, // 0x4e 'N' + 0x00, 0xcc, 0xcc, 0xec, 0xfc, 0xdc, 0xcc, 0xcc, 0xcc, 0x00, 0x00, - 7, // 0x4f 'O' - 0x00,0x78,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00, + 7, // 0x4f 'O' + 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, - 7, // 0x50 'P' - 0x00,0xf8,0xcc,0xcc,0xcc,0xf8,0xc0,0xc0,0xc0,0x00,0x00, + 7, // 0x50 'P' + 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0xf8, 0xc0, 0xc0, 0xc0, 0x00, 0x00, - 7, // 0x51 'Q' - 0x00,0x78,0xcc,0xcc,0xcc,0xcc,0xdc,0x78,0x18,0x0c,0x00, + 7, // 0x51 'Q' + 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xdc, 0x78, 0x18, 0x0c, 0x00, - 7, // 0x52 'R' - 0x00,0xf8,0xcc,0xcc,0xcc,0xf8,0xd8,0xcc,0xcc,0x00,0x00, + 7, // 0x52 'R' + 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0xf8, 0xd8, 0xcc, 0xcc, 0x00, 0x00, - 7, // 0x53 'S' - 0x00,0x78,0xcc,0xe0,0x70,0x38,0x1c,0xcc,0x78,0x00,0x00, + 7, // 0x53 'S' + 0x00, 0x78, 0xcc, 0xe0, 0x70, 0x38, 0x1c, 0xcc, 0x78, 0x00, 0x00, - 7, // 0x54 'T' - 0x00,0xfc,0xb4,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00, + 7, // 0x54 'T' + 0x00, 0xfc, 0xb4, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, - 7, // 0x55 'U' - 0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00, + 7, // 0x55 'U' + 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, - 7, // 0x56 'V' - 0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x30,0x00,0x00, + 7, // 0x56 'V' + 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x00, 0x00, - 7, // 0x57 'W' - 0x00,0xcc,0xcc,0xcc,0xcc,0xb4,0xfc,0xcc,0x84,0x00,0x00, + 7, // 0x57 'W' + 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xb4, 0xfc, 0xcc, 0x84, 0x00, 0x00, - 7, // 0x58 'X' - 0x00,0xcc,0xcc,0x78,0x30,0x78,0xcc,0xcc,0xcc,0x00,0x00, + 7, // 0x58 'X' + 0x00, 0xcc, 0xcc, 0x78, 0x30, 0x78, 0xcc, 0xcc, 0xcc, 0x00, 0x00, - 7, // 0x59 'Y' - 0x00,0xcc,0xcc,0xcc,0x78,0x30,0x30,0x30,0x78,0x00,0x00, + 7, // 0x59 'Y' + 0x00, 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, - 7, // 0x5a 'Z' - 0x00,0xfc,0x8c,0x18,0x30,0x60,0xc0,0xc4,0xfc,0x00,0x00, + 7, // 0x5a 'Z' + 0x00, 0xfc, 0x8c, 0x18, 0x30, 0x60, 0xc0, 0xc4, 0xfc, 0x00, 0x00, - 7, // 0x5b '[' - 0x00,0x78,0x60,0x60,0x60,0x60,0x60,0x60,0x78,0x00,0x00, + 7, // 0x5b '[' + 0x00, 0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78, 0x00, 0x00, - 7, // 0x5c '\' - 0x00,0x60,0x60,0x30,0x30,0x18,0x18,0x0c,0x0c,0x00,0x00, + 7, // 0x5c '\' + 0x00, 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x0c, 0x0c, 0x00, 0x00, - 7, // 0x5d ']' - 0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x78,0x00,0x00, + 7, // 0x5d ']' + 0x00, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00, 0x00, - 7, // 0x5e '^' - 0x00,0x10,0x38,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x5e '^' + 0x00, 0x10, 0x38, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x5f '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00, + 7, // 0x5f '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, - 7, // 0x60 '`' - 0x00,0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x60 '`' + 0x00, 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x61 'a' - 0x00,0x00,0x00,0x70,0x18,0x78,0xd8,0xd8,0x6c,0x00,0x00, + 7, // 0x61 'a' + 0x00, 0x00, 0x00, 0x70, 0x18, 0x78, 0xd8, 0xd8, 0x6c, 0x00, 0x00, - 7, // 0x62 'b' - 0x00,0x60,0x60,0x60,0x78,0x6c,0x6c,0x6c,0x78,0x00,0x00, + 7, // 0x62 'b' + 0x00, 0x60, 0x60, 0x60, 0x78, 0x6c, 0x6c, 0x6c, 0x78, 0x00, 0x00, - 7, // 0x63 'c' - 0x00,0x00,0x00,0x78,0xcc,0xc0,0xc0,0xcc,0x78,0x00,0x00, + 7, // 0x63 'c' + 0x00, 0x00, 0x00, 0x78, 0xcc, 0xc0, 0xc0, 0xcc, 0x78, 0x00, 0x00, - 7, // 0x64 'd' - 0x00,0x18,0x18,0x18,0x78,0xd8,0xd8,0xd8,0x6c,0x00,0x00, + 7, // 0x64 'd' + 0x00, 0x18, 0x18, 0x18, 0x78, 0xd8, 0xd8, 0xd8, 0x6c, 0x00, 0x00, - 7, // 0x65 'e' - 0x00,0x00,0x00,0x78,0xcc,0xfc,0xc0,0xcc,0x78,0x00,0x00, + 7, // 0x65 'e' + 0x00, 0x00, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0xcc, 0x78, 0x00, 0x00, - 7, // 0x66 'f' - 0x00,0x18,0x34,0x30,0x78,0x30,0x30,0x30,0x78,0x00,0x00, + 7, // 0x66 'f' + 0x00, 0x18, 0x34, 0x30, 0x78, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, - 7, // 0x67 'g' - 0x00,0x00,0x00,0x6c,0xd8,0xd8,0xd8,0x78,0x18,0xd8,0x70, + 7, // 0x67 'g' + 0x00, 0x00, 0x00, 0x6c, 0xd8, 0xd8, 0xd8, 0x78, 0x18, 0xd8, 0x70, - 7, // 0x68 'h' - 0x00,0xc0,0xc0,0xd8,0xec,0xcc,0xcc,0xcc,0xcc,0x00,0x00, + 7, // 0x68 'h' + 0x00, 0xc0, 0xc0, 0xd8, 0xec, 0xcc, 0xcc, 0xcc, 0xcc, 0x00, 0x00, - 7, // 0x69 'i' - 0x00,0x30,0x00,0x70,0x30,0x30,0x30,0x30,0x78,0x00,0x00, + 7, // 0x69 'i' + 0x00, 0x30, 0x00, 0x70, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, - 7, // 0x6a 'j' - 0x00,0x0c,0x00,0x1c,0x0c,0x0c,0x0c,0x0c,0x6c,0x6c,0x38, + 7, // 0x6a 'j' + 0x00, 0x0c, 0x00, 0x1c, 0x0c, 0x0c, 0x0c, 0x0c, 0x6c, 0x6c, 0x38, - 7, // 0x6b 'k' - 0x00,0xc0,0xc0,0xcc,0xcc,0xd8,0xf0,0xd8,0xcc,0x00,0x00, + 7, // 0x6b 'k' + 0x00, 0xc0, 0xc0, 0xcc, 0xcc, 0xd8, 0xf0, 0xd8, 0xcc, 0x00, 0x00, - 7, // 0x6c 'l' - 0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00, + 7, // 0x6c 'l' + 0x00, 0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, - 7, // 0x6d 'm' - 0x00,0x00,0x00,0xe8,0xfc,0xd4,0xd4,0xc4,0xc4,0x00,0x00, + 7, // 0x6d 'm' + 0x00, 0x00, 0x00, 0xe8, 0xfc, 0xd4, 0xd4, 0xc4, 0xc4, 0x00, 0x00, - 7, // 0x6e 'n' - 0x00,0x00,0x00,0xd8,0x6c,0x6c,0x6c,0x6c,0x6c,0x00,0x00, + 7, // 0x6e 'n' + 0x00, 0x00, 0x00, 0xd8, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, - 7, // 0x6f 'o' - 0x00,0x00,0x00,0x78,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00, + 7, // 0x6f 'o' + 0x00, 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, - 7, // 0x70 'p' - 0x00,0x00,0x00,0xf8,0xcc,0xcc,0xcc,0xf8,0xc0,0xc0,0xc0, + 7, // 0x70 'p' + 0x00, 0x00, 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0xf8, 0xc0, 0xc0, 0xc0, - 7, // 0x71 'q' - 0x00,0x00,0x00,0x7c,0xcc,0xcc,0xcc,0x7c,0x0c,0x0c,0x0c, + 7, // 0x71 'q' + 0x00, 0x00, 0x00, 0x7c, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x0c, - 7, // 0x72 'r' - 0x00,0x00,0x00,0xd8,0xec,0xcc,0xc0,0xc0,0xc0,0x00,0x00, + 7, // 0x72 'r' + 0x00, 0x00, 0x00, 0xd8, 0xec, 0xcc, 0xc0, 0xc0, 0xc0, 0x00, 0x00, - 7, // 0x73 's' - 0x00,0x00,0x00,0x78,0xcc,0x60,0x18,0xcc,0x78,0x00,0x00, + 7, // 0x73 's' + 0x00, 0x00, 0x00, 0x78, 0xcc, 0x60, 0x18, 0xcc, 0x78, 0x00, 0x00, - 7, // 0x74 't' - 0x00,0x20,0x60,0x60,0xf0,0x60,0x60,0x68,0x30,0x00,0x00, + 7, // 0x74 't' + 0x00, 0x20, 0x60, 0x60, 0xf0, 0x60, 0x60, 0x68, 0x30, 0x00, 0x00, - 7, // 0x75 'u' - 0x00,0x00,0x00,0xd8,0xd8,0xd8,0xd8,0xd8,0x6c,0x00,0x00, + 7, // 0x75 'u' + 0x00, 0x00, 0x00, 0xd8, 0xd8, 0xd8, 0xd8, 0xd8, 0x6c, 0x00, 0x00, - 7, // 0x76 'v' - 0x00,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0x78,0x30,0x00,0x00, + 7, // 0x76 'v' + 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x00, 0x00, - 7, // 0x77 'w' - 0x00,0x00,0x00,0xcc,0xcc,0xb4,0xfc,0xcc,0x84,0x00,0x00, + 7, // 0x77 'w' + 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xb4, 0xfc, 0xcc, 0x84, 0x00, 0x00, - 7, // 0x78 'x' - 0x00,0x00,0x00,0xcc,0x78,0x30,0x78,0xcc,0xcc,0x00,0x00, + 7, // 0x78 'x' + 0x00, 0x00, 0x00, 0xcc, 0x78, 0x30, 0x78, 0xcc, 0xcc, 0x00, 0x00, - 7, // 0x79 'y' - 0x00,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0x18,0xf0, + 7, // 0x79 'y' + 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x18, 0xf0, - 7, // 0x7a 'z' - 0x00,0x00,0x00,0xfc,0x98,0x30,0x60,0xc4,0xfc,0x00,0x00, + 7, // 0x7a 'z' + 0x00, 0x00, 0x00, 0xfc, 0x98, 0x30, 0x60, 0xc4, 0xfc, 0x00, 0x00, - 7, // 0x7b '{' - 0x1c,0x30,0x30,0x30,0xe0,0x30,0x30,0x30,0x1c,0x00,0x00, + 7, // 0x7b '{' + 0x1c, 0x30, 0x30, 0x30, 0xe0, 0x30, 0x30, 0x30, 0x1c, 0x00, 0x00, - 7, // 0x7c '|' - 0x30,0x30,0x30,0x30,0x00,0x30,0x30,0x30,0x30,0x00,0x00, + 7, // 0x7c '|' + 0x30, 0x30, 0x30, 0x30, 0x00, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, - 7, // 0x7d '}' - 0xe0,0x30,0x30,0x30,0x1c,0x30,0x30,0x30,0xe0,0x00,0x00, + 7, // 0x7d '}' + 0xe0, 0x30, 0x30, 0x30, 0x1c, 0x30, 0x30, 0x30, 0xe0, 0x00, 0x00, - 7, // 0x7e '~' - 0x00,0x34,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x7e '~' + 0x00, 0x34, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x7f '' - 0x00,0x00,0x00,0x30,0x78,0xcc,0xcc,0xfc,0x00,0x00,0x00, - 0 -}; + 7, // 0x7f '' + 0x00, 0x00, 0x00, 0x30, 0x78, 0xcc, 0xcc, 0xfc, 0x00, 0x00, 0x00, 0}; -const int8u gse7x15[] = -{ - 15, 0, 32, 128-32, +const int8u gse7x15[] = { + 15, 0, 32, 128 - 32, - 0x00,0x00,0x10,0x00,0x20,0x00,0x30,0x00,0x40,0x00,0x50,0x00,0x60,0x00,0x70,0x00,0x80,0x00, - 0x90,0x00,0xa0,0x00,0xb0,0x00,0xc0,0x00,0xd0,0x00,0xe0,0x00,0xf0,0x00,0x00,0x01,0x10,0x01, - 0x20,0x01,0x30,0x01,0x40,0x01,0x50,0x01,0x60,0x01,0x70,0x01,0x80,0x01,0x90,0x01,0xa0,0x01, - 0xb0,0x01,0xc0,0x01,0xd0,0x01,0xe0,0x01,0xf0,0x01,0x00,0x02,0x10,0x02,0x20,0x02,0x30,0x02, - 0x40,0x02,0x50,0x02,0x60,0x02,0x70,0x02,0x80,0x02,0x90,0x02,0xa0,0x02,0xb0,0x02,0xc0,0x02, - 0xd0,0x02,0xe0,0x02,0xf0,0x02,0x00,0x03,0x10,0x03,0x20,0x03,0x30,0x03,0x40,0x03,0x50,0x03, - 0x60,0x03,0x70,0x03,0x80,0x03,0x90,0x03,0xa0,0x03,0xb0,0x03,0xc0,0x03,0xd0,0x03,0xe0,0x03, - 0xf0,0x03,0x00,0x04,0x10,0x04,0x20,0x04,0x30,0x04,0x40,0x04,0x50,0x04,0x60,0x04,0x70,0x04, - 0x80,0x04,0x90,0x04,0xa0,0x04,0xb0,0x04,0xc0,0x04,0xd0,0x04,0xe0,0x04,0xf0,0x04,0x00,0x05, - 0x10,0x05,0x20,0x05,0x30,0x05,0x40,0x05,0x50,0x05,0x60,0x05,0x70,0x05,0x80,0x05,0x90,0x05, - 0xa0,0x05,0xb0,0x05,0xc0,0x05,0xd0,0x05,0xe0,0x05,0xf0,0x05, + 0x00, 0x00, 0x10, 0x00, 0x20, 0x00, 0x30, 0x00, 0x40, 0x00, 0x50, 0x00, 0x60, 0x00, 0x70, 0x00, 0x80, 0x00, + 0x90, 0x00, 0xa0, 0x00, 0xb0, 0x00, 0xc0, 0x00, 0xd0, 0x00, 0xe0, 0x00, 0xf0, 0x00, 0x00, 0x01, 0x10, 0x01, + 0x20, 0x01, 0x30, 0x01, 0x40, 0x01, 0x50, 0x01, 0x60, 0x01, 0x70, 0x01, 0x80, 0x01, 0x90, 0x01, 0xa0, 0x01, + 0xb0, 0x01, 0xc0, 0x01, 0xd0, 0x01, 0xe0, 0x01, 0xf0, 0x01, 0x00, 0x02, 0x10, 0x02, 0x20, 0x02, 0x30, 0x02, + 0x40, 0x02, 0x50, 0x02, 0x60, 0x02, 0x70, 0x02, 0x80, 0x02, 0x90, 0x02, 0xa0, 0x02, 0xb0, 0x02, 0xc0, 0x02, + 0xd0, 0x02, 0xe0, 0x02, 0xf0, 0x02, 0x00, 0x03, 0x10, 0x03, 0x20, 0x03, 0x30, 0x03, 0x40, 0x03, 0x50, 0x03, + 0x60, 0x03, 0x70, 0x03, 0x80, 0x03, 0x90, 0x03, 0xa0, 0x03, 0xb0, 0x03, 0xc0, 0x03, 0xd0, 0x03, 0xe0, 0x03, + 0xf0, 0x03, 0x00, 0x04, 0x10, 0x04, 0x20, 0x04, 0x30, 0x04, 0x40, 0x04, 0x50, 0x04, 0x60, 0x04, 0x70, 0x04, + 0x80, 0x04, 0x90, 0x04, 0xa0, 0x04, 0xb0, 0x04, 0xc0, 0x04, 0xd0, 0x04, 0xe0, 0x04, 0xf0, 0x04, 0x00, 0x05, + 0x10, 0x05, 0x20, 0x05, 0x30, 0x05, 0x40, 0x05, 0x50, 0x05, 0x60, 0x05, 0x70, 0x05, 0x80, 0x05, 0x90, 0x05, + 0xa0, 0x05, 0xb0, 0x05, 0xc0, 0x05, 0xd0, 0x05, 0xe0, 0x05, 0xf0, 0x05, - 7, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x21 '!' - 0x00,0x00,0x10,0x38,0x38,0x38,0x38,0x10,0x10,0x00,0x10,0x10,0x00,0x00,0x00, + 7, // 0x21 '!' + 0x00, 0x00, 0x10, 0x38, 0x38, 0x38, 0x38, 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, - 7, // 0x22 '"' - 0x00,0x00,0x24,0x24,0x24,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x22 '"' + 0x00, 0x00, 0x24, 0x24, 0x24, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x23 '#' - 0x00,0x00,0x48,0x48,0x48,0xfc,0x48,0x48,0xfc,0x48,0x48,0x48,0x00,0x00,0x00, + 7, // 0x23 '#' + 0x00, 0x00, 0x48, 0x48, 0x48, 0xfc, 0x48, 0x48, 0xfc, 0x48, 0x48, 0x48, 0x00, 0x00, 0x00, - 7, // 0x24 '$' - 0x00,0x00,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x54,0x38,0x10,0x00,0x00,0x00, + 7, // 0x24 '$' + 0x00, 0x00, 0x10, 0x38, 0x54, 0x50, 0x38, 0x14, 0x54, 0x54, 0x38, 0x10, 0x00, 0x00, 0x00, - 7, // 0x25 '%' - 0x00,0x00,0x44,0x44,0x08,0x08,0x10,0x10,0x20,0x20,0x44,0x44,0x00,0x00,0x00, + 7, // 0x25 '%' + 0x00, 0x00, 0x44, 0x44, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x44, 0x44, 0x00, 0x00, 0x00, - 7, // 0x26 '&' - 0x00,0x00,0x00,0x30,0x48,0x48,0x30,0x60,0x94,0x98,0x90,0x6c,0x00,0x00,0x00, + 7, // 0x26 '&' + 0x00, 0x00, 0x00, 0x30, 0x48, 0x48, 0x30, 0x60, 0x94, 0x98, 0x90, 0x6c, 0x00, 0x00, 0x00, - 7, // 0x27 ''' - 0x00,0x00,0x20,0x20,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x27 ''' + 0x00, 0x00, 0x20, 0x20, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x28 '(' - 0x00,0x04,0x08,0x10,0x20,0x20,0x20,0x20,0x20,0x10,0x08,0x04,0x00,0x00,0x00, + 7, // 0x28 '(' + 0x00, 0x04, 0x08, 0x10, 0x20, 0x20, 0x20, 0x20, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, - 7, // 0x29 ')' - 0x00,0x40,0x20,0x10,0x08,0x08,0x08,0x08,0x08,0x10,0x20,0x40,0x00,0x00,0x00, + 7, // 0x29 ')' + 0x00, 0x40, 0x20, 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, 0x00, - 7, // 0x2a '*' - 0x00,0x00,0x00,0x00,0x00,0x20,0xa8,0x70,0xa8,0x20,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2a '*' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xa8, 0x70, 0xa8, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x2b '+' - 0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x7c,0x10,0x10,0x10,0x00,0x00,0x00,0x00, + 7, // 0x2b '+' + 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, - 7, // 0x2c ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x60,0x00, + 7, // 0x2c ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x60, 0x00, - 7, // 0x2d '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2d '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x2e '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00, + 7, // 0x2e '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, - 7, // 0x2f '/' - 0x00,0x00,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,0x00,0x00, + 7, // 0x2f '/' + 0x00, 0x00, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x00, 0x00, 0x00, - 7, // 0x30 '0' - 0x00,0x00,0x38,0x44,0x44,0x4c,0x54,0x64,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x30 '0' + 0x00, 0x00, 0x38, 0x44, 0x44, 0x4c, 0x54, 0x64, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x31 '1' - 0x00,0x00,0x10,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x7c,0x00,0x00,0x00, + 7, // 0x31 '1' + 0x00, 0x00, 0x10, 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, - 7, // 0x32 '2' - 0x00,0x00,0x38,0x44,0x44,0x04,0x08,0x10,0x20,0x40,0x44,0x7c,0x00,0x00,0x00, + 7, // 0x32 '2' + 0x00, 0x00, 0x38, 0x44, 0x44, 0x04, 0x08, 0x10, 0x20, 0x40, 0x44, 0x7c, 0x00, 0x00, 0x00, - 7, // 0x33 '3' - 0x00,0x00,0x7c,0x44,0x08,0x10,0x38,0x04,0x04,0x04,0x44,0x38,0x00,0x00,0x00, + 7, // 0x33 '3' + 0x00, 0x00, 0x7c, 0x44, 0x08, 0x10, 0x38, 0x04, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x34 '4' - 0x00,0x00,0x08,0x10,0x20,0x40,0x48,0x48,0x7c,0x08,0x08,0x1c,0x00,0x00,0x00, + 7, // 0x34 '4' + 0x00, 0x00, 0x08, 0x10, 0x20, 0x40, 0x48, 0x48, 0x7c, 0x08, 0x08, 0x1c, 0x00, 0x00, 0x00, - 7, // 0x35 '5' - 0x00,0x00,0x7c,0x40,0x40,0x40,0x78,0x04,0x04,0x04,0x44,0x38,0x00,0x00,0x00, + 7, // 0x35 '5' + 0x00, 0x00, 0x7c, 0x40, 0x40, 0x40, 0x78, 0x04, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x36 '6' - 0x00,0x00,0x18,0x20,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x36 '6' + 0x00, 0x00, 0x18, 0x20, 0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x37 '7' - 0x00,0x00,0x7c,0x44,0x04,0x04,0x08,0x08,0x10,0x10,0x10,0x10,0x00,0x00,0x00, + 7, // 0x37 '7' + 0x00, 0x00, 0x7c, 0x44, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, - 7, // 0x38 '8' - 0x00,0x00,0x38,0x44,0x44,0x44,0x38,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x38 '8' + 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x39 '9' - 0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x3c,0x04,0x04,0x08,0x30,0x00,0x00,0x00, + 7, // 0x39 '9' + 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x3c, 0x04, 0x04, 0x08, 0x30, 0x00, 0x00, 0x00, - 7, // 0x3a ':' - 0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00, + 7, // 0x3a ':' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, - 7, // 0x3b ';' - 0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x30,0x30,0x60,0x00,0x00, + 7, // 0x3b ';' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x60, 0x00, 0x00, - 7, // 0x3c '<' - 0x00,0x00,0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00,0x00,0x00, + 7, // 0x3c '<' + 0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, - 7, // 0x3d '=' - 0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x3d '=' + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x3e '>' - 0x00,0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00,0x00,0x00, + 7, // 0x3e '>' + 0x00, 0x00, 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, 0x00, - 7, // 0x3f '?' - 0x00,0x00,0x78,0x84,0x84,0x84,0x08,0x10,0x20,0x20,0x00,0x20,0x00,0x00,0x00, + 7, // 0x3f '?' + 0x00, 0x00, 0x78, 0x84, 0x84, 0x84, 0x08, 0x10, 0x20, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, - 7, // 0x40 '@' - 0x00,0x00,0x00,0x30,0x48,0x04,0x34,0x54,0x54,0x54,0x54,0x28,0x00,0x00,0x00, + 7, // 0x40 '@' + 0x00, 0x00, 0x00, 0x30, 0x48, 0x04, 0x34, 0x54, 0x54, 0x54, 0x54, 0x28, 0x00, 0x00, 0x00, - 7, // 0x41 'A' - 0x00,0x00,0x10,0x28,0x44,0x44,0x44,0x7c,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x41 'A' + 0x00, 0x00, 0x10, 0x28, 0x44, 0x44, 0x44, 0x7c, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, - 7, // 0x42 'B' - 0x00,0x00,0x78,0x44,0x44,0x44,0x78,0x44,0x44,0x44,0x44,0x78,0x00,0x00,0x00, + 7, // 0x42 'B' + 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x78, 0x44, 0x44, 0x44, 0x44, 0x78, 0x00, 0x00, 0x00, - 7, // 0x43 'C' - 0x00,0x00,0x38,0x44,0x44,0x40,0x40,0x40,0x40,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x43 'C' + 0x00, 0x00, 0x38, 0x44, 0x44, 0x40, 0x40, 0x40, 0x40, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x44 'D' - 0x00,0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00,0x00, + 7, // 0x44 'D' + 0x00, 0x00, 0x70, 0x48, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x48, 0x70, 0x00, 0x00, 0x00, - 7, // 0x45 'E' - 0x00,0x00,0x7c,0x40,0x40,0x40,0x70,0x40,0x40,0x40,0x40,0x7c,0x00,0x00,0x00, + 7, // 0x45 'E' + 0x00, 0x00, 0x7c, 0x40, 0x40, 0x40, 0x70, 0x40, 0x40, 0x40, 0x40, 0x7c, 0x00, 0x00, 0x00, - 7, // 0x46 'F' - 0x00,0x00,0x7c,0x40,0x40,0x40,0x70,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 7, // 0x46 'F' + 0x00, 0x00, 0x7c, 0x40, 0x40, 0x40, 0x70, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, - 7, // 0x47 'G' - 0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x5c,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x47 'G' + 0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x40, 0x5c, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x48 'H' - 0x00,0x00,0x44,0x44,0x44,0x44,0x7c,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x48 'H' + 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x7c, 0x44, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, - 7, // 0x49 'I' - 0x00,0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, + 7, // 0x49 'I' + 0x00, 0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, - 7, // 0x4a 'J' - 0x00,0x00,0x1c,0x08,0x08,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00,0x00, + 7, // 0x4a 'J' + 0x00, 0x00, 0x1c, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x48, 0x48, 0x30, 0x00, 0x00, 0x00, - 7, // 0x4b 'K' - 0x00,0x00,0x44,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x4b 'K' + 0x00, 0x00, 0x44, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, - 7, // 0x4c 'L' - 0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7c,0x00,0x00,0x00, + 7, // 0x4c 'L' + 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7c, 0x00, 0x00, 0x00, - 7, // 0x4d 'M' - 0x00,0x00,0x44,0x6c,0x54,0x54,0x44,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x4d 'M' + 0x00, 0x00, 0x44, 0x6c, 0x54, 0x54, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, - 7, // 0x4e 'N' - 0x00,0x00,0x44,0x44,0x44,0x64,0x54,0x4c,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x4e 'N' + 0x00, 0x00, 0x44, 0x44, 0x44, 0x64, 0x54, 0x4c, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, - 7, // 0x4f 'O' - 0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x4f 'O' + 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x50 'P' - 0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 7, // 0x50 'P' + 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, - 7, // 0x51 'Q' - 0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00,0x00, + 7, // 0x51 'Q' + 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x54, 0x48, 0x34, 0x00, 0x00, 0x00, - 7, // 0x52 'R' - 0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x50,0x48,0x44,0x44,0x00,0x00,0x00, + 7, // 0x52 'R' + 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x44, 0x78, 0x50, 0x48, 0x44, 0x44, 0x00, 0x00, 0x00, - 7, // 0x53 'S' - 0x00,0x00,0x38,0x44,0x44,0x40,0x38,0x04,0x04,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x53 'S' + 0x00, 0x00, 0x38, 0x44, 0x44, 0x40, 0x38, 0x04, 0x04, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x54 'T' - 0x00,0x00,0x7c,0x54,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x00, + 7, // 0x54 'T' + 0x00, 0x00, 0x7c, 0x54, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, - 7, // 0x55 'U' - 0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x55 'U' + 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x56 'V' - 0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00,0x00, + 7, // 0x56 'V' + 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, 0x00, - 7, // 0x57 'W' - 0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x54,0x54,0x6c,0x44,0x00,0x00,0x00, + 7, // 0x57 'W' + 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x54, 0x54, 0x6c, 0x44, 0x00, 0x00, 0x00, - 7, // 0x58 'X' - 0x00,0x00,0x44,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x58 'X' + 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, - 7, // 0x59 'Y' - 0x00,0x00,0x44,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, + 7, // 0x59 'Y' + 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, - 7, // 0x5a 'Z' - 0x00,0x00,0x7c,0x04,0x04,0x08,0x10,0x20,0x40,0x40,0x40,0x7c,0x00,0x00,0x00, + 7, // 0x5a 'Z' + 0x00, 0x00, 0x7c, 0x04, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x40, 0x7c, 0x00, 0x00, 0x00, - 7, // 0x5b '[' - 0x00,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00,0x00, + 7, // 0x5b '[' + 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00, 0x00, - 7, // 0x5c '\' - 0x00,0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00,0x00,0x00, + 7, // 0x5c '\' + 0x00, 0x00, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x00, 0x00, 0x00, - 7, // 0x5d ']' - 0x00,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x38,0x00,0x00, + 7, // 0x5d ']' + 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x00, 0x00, - 7, // 0x5e '^' - 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x5e '^' + 0x00, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x5f '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00, + 7, // 0x5f '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, - 7, // 0x60 '`' - 0x00,0x20,0x20,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x60 '`' + 0x00, 0x20, 0x20, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x38,0x44,0x04,0x3c,0x44,0x44,0x44,0x3a,0x00,0x00,0x00, + 7, // 0x61 'a' + 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x04, 0x3c, 0x44, 0x44, 0x44, 0x3a, 0x00, 0x00, 0x00, - 7, // 0x62 'b' - 0x00,0x00,0x40,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x00,0x00,0x00, + 7, // 0x62 'b' + 0x00, 0x00, 0x40, 0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x44, 0x44, 0x78, 0x00, 0x00, 0x00, - 7, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00,0x00, + 7, // 0x63 'c' + 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x64 'd' - 0x00,0x00,0x04,0x04,0x04,0x3c,0x44,0x44,0x44,0x44,0x44,0x3a,0x00,0x00,0x00, + 7, // 0x64 'd' + 0x00, 0x00, 0x04, 0x04, 0x04, 0x3c, 0x44, 0x44, 0x44, 0x44, 0x44, 0x3a, 0x00, 0x00, 0x00, - 7, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x38,0x44,0x44,0x7c,0x40,0x40,0x44,0x38,0x00,0x00,0x00, + 7, // 0x65 'e' + 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x7c, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x66 'f' - 0x00,0x00,0x18,0x24,0x20,0x70,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00, + 7, // 0x66 'f' + 0x00, 0x00, 0x18, 0x24, 0x20, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, 0x00, - 7, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x3a,0x44,0x44,0x44,0x44,0x44,0x3c,0x04,0x44,0x38,0x00, + 7, // 0x67 'g' + 0x00, 0x00, 0x00, 0x00, 0x3a, 0x44, 0x44, 0x44, 0x44, 0x44, 0x3c, 0x04, 0x44, 0x38, 0x00, - 7, // 0x68 'h' - 0x00,0x00,0x40,0x40,0x40,0x58,0x64,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x68 'h' + 0x00, 0x00, 0x40, 0x40, 0x40, 0x58, 0x64, 0x44, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, - 7, // 0x69 'i' - 0x00,0x00,0x10,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, + 7, // 0x69 'i' + 0x00, 0x00, 0x10, 0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, - 7, // 0x6a 'j' - 0x00,0x00,0x08,0x08,0x00,0x18,0x08,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00, + 7, // 0x6a 'j' + 0x00, 0x00, 0x08, 0x08, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x08, 0x48, 0x48, 0x30, 0x00, - 7, // 0x6b 'k' - 0x00,0x00,0x40,0x40,0x44,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00,0x00, + 7, // 0x6b 'k' + 0x00, 0x00, 0x40, 0x40, 0x44, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x00, 0x00, 0x00, - 7, // 0x6c 'l' - 0x00,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, + 7, // 0x6c 'l' + 0x00, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, - 7, // 0x6d 'm' - 0x00,0x00,0x00,0x00,0xa8,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x00,0x00,0x00, + 7, // 0x6d 'm' + 0x00, 0x00, 0x00, 0x00, 0xa8, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x00, 0x00, 0x00, - 7, // 0x6e 'n' - 0x00,0x00,0x00,0x00,0xb8,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x6e 'n' + 0x00, 0x00, 0x00, 0x00, 0xb8, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, - 7, // 0x6f 'o' - 0x00,0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x6f 'o' + 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00, + 7, // 0x70 'p' + 0x00, 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, 0x00, - 7, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x3c,0x44,0x44,0x44,0x44,0x44,0x3c,0x04,0x04,0x04,0x00, + 7, // 0x71 'q' + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x44, 0x44, 0x44, 0x44, 0x44, 0x3c, 0x04, 0x04, 0x04, 0x00, - 7, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x58,0x64,0x44,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 7, // 0x72 'r' + 0x00, 0x00, 0x00, 0x00, 0x58, 0x64, 0x44, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, - 7, // 0x73 's' - 0x00,0x00,0x00,0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x73 's' + 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x38, 0x04, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x74 't' - 0x00,0x00,0x20,0x20,0x20,0x70,0x20,0x20,0x20,0x20,0x24,0x18,0x00,0x00,0x00, + 7, // 0x74 't' + 0x00, 0x00, 0x20, 0x20, 0x20, 0x70, 0x20, 0x20, 0x20, 0x20, 0x24, 0x18, 0x00, 0x00, 0x00, - 7, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x3a,0x00,0x00,0x00, + 7, // 0x75 'u' + 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x3a, 0x00, 0x00, 0x00, - 7, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00,0x00, + 7, // 0x76 'v' + 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, 0x00, - 7, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x54,0x54,0x6c,0x44,0x00,0x00,0x00, + 7, // 0x77 'w' + 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x54, 0x54, 0x6c, 0x44, 0x00, 0x00, 0x00, - 7, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x78 'x' + 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, - 7, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x3c,0x04,0x08,0x70,0x00, + 7, // 0x79 'y' + 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x3c, 0x04, 0x08, 0x70, 0x00, - 7, // 0x7a 'z' - 0x00,0x00,0x00,0x00,0x7c,0x04,0x08,0x10,0x20,0x40,0x40,0x7c,0x00,0x00,0x00, + 7, // 0x7a 'z' + 0x00, 0x00, 0x00, 0x00, 0x7c, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x7c, 0x00, 0x00, 0x00, - 7, // 0x7b '{' - 0x00,0x0c,0x10,0x10,0x10,0x10,0x10,0x60,0x10,0x10,0x10,0x10,0x0c,0x00,0x00, + 7, // 0x7b '{' + 0x00, 0x0c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x60, 0x10, 0x10, 0x10, 0x10, 0x0c, 0x00, 0x00, - 7, // 0x7c '|' - 0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x00, + 7, // 0x7c '|' + 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, - 7, // 0x7d '}' - 0x00,0x60,0x10,0x10,0x10,0x10,0x10,0x0c,0x10,0x10,0x10,0x10,0x60,0x00,0x00, + 7, // 0x7d '}' + 0x00, 0x60, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0c, 0x10, 0x10, 0x10, 0x10, 0x60, 0x00, 0x00, - 7, // 0x7e '~' - 0x00,0x00,0x64,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x7e '~' + 0x00, 0x00, 0x64, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x7f '' - 0x00,0x00,0x00,0x00,0x00,0x10,0x28,0x44,0x44,0x7c,0x00,0x00,0x00,0x00,0x00, - 0 -}; + 7, // 0x7f '' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x28, 0x44, 0x44, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0}; -const int8u gse7x15_bold[] = -{ - 15, 0, 32, 128-32, +const int8u gse7x15_bold[] = { + 15, 0, 32, 128 - 32, - 0x00,0x00,0x10,0x00,0x20,0x00,0x30,0x00,0x40,0x00,0x50,0x00,0x60,0x00,0x70,0x00,0x80,0x00, - 0x90,0x00,0xa0,0x00,0xb0,0x00,0xc0,0x00,0xd0,0x00,0xe0,0x00,0xf0,0x00,0x00,0x01,0x10,0x01, - 0x20,0x01,0x30,0x01,0x40,0x01,0x50,0x01,0x60,0x01,0x70,0x01,0x80,0x01,0x90,0x01,0xa0,0x01, - 0xb0,0x01,0xc0,0x01,0xd0,0x01,0xe0,0x01,0xf0,0x01,0x00,0x02,0x10,0x02,0x20,0x02,0x30,0x02, - 0x40,0x02,0x50,0x02,0x60,0x02,0x70,0x02,0x80,0x02,0x90,0x02,0xa0,0x02,0xb0,0x02,0xc0,0x02, - 0xd0,0x02,0xe0,0x02,0xf0,0x02,0x00,0x03,0x10,0x03,0x20,0x03,0x30,0x03,0x40,0x03,0x50,0x03, - 0x60,0x03,0x70,0x03,0x80,0x03,0x90,0x03,0xa0,0x03,0xb0,0x03,0xc0,0x03,0xd0,0x03,0xe0,0x03, - 0xf0,0x03,0x00,0x04,0x10,0x04,0x20,0x04,0x30,0x04,0x40,0x04,0x50,0x04,0x60,0x04,0x70,0x04, - 0x80,0x04,0x90,0x04,0xa0,0x04,0xb0,0x04,0xc0,0x04,0xd0,0x04,0xe0,0x04,0xf0,0x04,0x00,0x05, - 0x10,0x05,0x20,0x05,0x30,0x05,0x40,0x05,0x50,0x05,0x60,0x05,0x70,0x05,0x80,0x05,0x90,0x05, - 0xa0,0x05,0xb0,0x05,0xc0,0x05,0xd0,0x05,0xe0,0x05,0xf0,0x05, + 0x00, 0x00, 0x10, 0x00, 0x20, 0x00, 0x30, 0x00, 0x40, 0x00, 0x50, 0x00, 0x60, 0x00, 0x70, 0x00, 0x80, 0x00, + 0x90, 0x00, 0xa0, 0x00, 0xb0, 0x00, 0xc0, 0x00, 0xd0, 0x00, 0xe0, 0x00, 0xf0, 0x00, 0x00, 0x01, 0x10, 0x01, + 0x20, 0x01, 0x30, 0x01, 0x40, 0x01, 0x50, 0x01, 0x60, 0x01, 0x70, 0x01, 0x80, 0x01, 0x90, 0x01, 0xa0, 0x01, + 0xb0, 0x01, 0xc0, 0x01, 0xd0, 0x01, 0xe0, 0x01, 0xf0, 0x01, 0x00, 0x02, 0x10, 0x02, 0x20, 0x02, 0x30, 0x02, + 0x40, 0x02, 0x50, 0x02, 0x60, 0x02, 0x70, 0x02, 0x80, 0x02, 0x90, 0x02, 0xa0, 0x02, 0xb0, 0x02, 0xc0, 0x02, + 0xd0, 0x02, 0xe0, 0x02, 0xf0, 0x02, 0x00, 0x03, 0x10, 0x03, 0x20, 0x03, 0x30, 0x03, 0x40, 0x03, 0x50, 0x03, + 0x60, 0x03, 0x70, 0x03, 0x80, 0x03, 0x90, 0x03, 0xa0, 0x03, 0xb0, 0x03, 0xc0, 0x03, 0xd0, 0x03, 0xe0, 0x03, + 0xf0, 0x03, 0x00, 0x04, 0x10, 0x04, 0x20, 0x04, 0x30, 0x04, 0x40, 0x04, 0x50, 0x04, 0x60, 0x04, 0x70, 0x04, + 0x80, 0x04, 0x90, 0x04, 0xa0, 0x04, 0xb0, 0x04, 0xc0, 0x04, 0xd0, 0x04, 0xe0, 0x04, 0xf0, 0x04, 0x00, 0x05, + 0x10, 0x05, 0x20, 0x05, 0x30, 0x05, 0x40, 0x05, 0x50, 0x05, 0x60, 0x05, 0x70, 0x05, 0x80, 0x05, 0x90, 0x05, + 0xa0, 0x05, 0xb0, 0x05, 0xc0, 0x05, 0xd0, 0x05, 0xe0, 0x05, 0xf0, 0x05, - 7, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x21 '!' - 0x00,0x00,0x00,0x30,0x78,0x78,0x78,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00, + 7, // 0x21 '!' + 0x00, 0x00, 0x00, 0x30, 0x78, 0x78, 0x78, 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, - 7, // 0x22 '"' - 0x00,0x00,0x6c,0x6c,0x6c,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x22 '"' + 0x00, 0x00, 0x6c, 0x6c, 0x6c, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x23 '#' - 0x00,0x00,0x48,0x48,0x48,0xfc,0x48,0x48,0xfc,0x48,0x48,0x48,0x00,0x00,0x00, + 7, // 0x23 '#' + 0x00, 0x00, 0x48, 0x48, 0x48, 0xfc, 0x48, 0x48, 0xfc, 0x48, 0x48, 0x48, 0x00, 0x00, 0x00, - 7, // 0x24 '$' - 0x00,0x30,0x30,0x78,0xcc,0xe0,0x70,0x38,0x1c,0xcc,0x78,0x30,0x30,0x00,0x00, + 7, // 0x24 '$' + 0x00, 0x30, 0x30, 0x78, 0xcc, 0xe0, 0x70, 0x38, 0x1c, 0xcc, 0x78, 0x30, 0x30, 0x00, 0x00, - 7, // 0x25 '%' - 0x00,0x00,0x00,0x64,0x6c,0x08,0x18,0x10,0x30,0x20,0x6c,0x4c,0x00,0x00,0x00, + 7, // 0x25 '%' + 0x00, 0x00, 0x00, 0x64, 0x6c, 0x08, 0x18, 0x10, 0x30, 0x20, 0x6c, 0x4c, 0x00, 0x00, 0x00, - 7, // 0x26 '&' - 0x00,0x00,0x00,0x30,0x58,0x58,0x30,0x74,0xdc,0xd8,0xd8,0x6c,0x00,0x00,0x00, + 7, // 0x26 '&' + 0x00, 0x00, 0x00, 0x30, 0x58, 0x58, 0x30, 0x74, 0xdc, 0xd8, 0xd8, 0x6c, 0x00, 0x00, 0x00, - 7, // 0x27 ''' - 0x00,0x00,0x30,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x27 ''' + 0x00, 0x00, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x28 '(' - 0x00,0x0c,0x18,0x30,0x60,0x60,0x60,0x60,0x60,0x30,0x18,0x0c,0x00,0x00,0x00, + 7, // 0x28 '(' + 0x00, 0x0c, 0x18, 0x30, 0x60, 0x60, 0x60, 0x60, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, - 7, // 0x29 ')' - 0x00,0xc0,0x60,0x30,0x18,0x18,0x18,0x18,0x18,0x30,0x60,0xc0,0x00,0x00,0x00, + 7, // 0x29 ')' + 0x00, 0xc0, 0x60, 0x30, 0x18, 0x18, 0x18, 0x18, 0x18, 0x30, 0x60, 0xc0, 0x00, 0x00, 0x00, - 7, // 0x2a '*' - 0x00,0x00,0x00,0x00,0x00,0x20,0xa8,0x70,0xa8,0x20,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2a '*' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xa8, 0x70, 0xa8, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x2b '+' - 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0xfc,0x30,0x30,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2b '+' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x2c ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x60,0x00, + 7, // 0x2c ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x60, 0x00, - 7, // 0x2d '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2d '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x2e '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00, + 7, // 0x2e '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, - 7, // 0x2f '/' - 0x00,0x00,0x0c,0x0c,0x18,0x18,0x30,0x30,0x60,0x60,0xc0,0xc0,0x00,0x00,0x00, + 7, // 0x2f '/' + 0x00, 0x00, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0xc0, 0xc0, 0x00, 0x00, 0x00, - 7, // 0x30 '0' - 0x00,0x00,0x78,0xcc,0xcc,0xcc,0xdc,0xec,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x30 '0' + 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xdc, 0xec, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, - 7, // 0x31 '1' - 0x00,0x00,0x30,0x30,0x70,0xf0,0x30,0x30,0x30,0x30,0x30,0xfc,0x00,0x00,0x00, + 7, // 0x31 '1' + 0x00, 0x00, 0x30, 0x30, 0x70, 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x00, 0x00, 0x00, - 7, // 0x32 '2' - 0x00,0x00,0x78,0xcc,0xcc,0x0c,0x18,0x30,0x60,0xc0,0xcc,0xfc,0x00,0x00,0x00, + 7, // 0x32 '2' + 0x00, 0x00, 0x78, 0xcc, 0xcc, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0xcc, 0xfc, 0x00, 0x00, 0x00, - 7, // 0x33 '3' - 0x00,0x00,0xfc,0x8c,0x18,0x30,0x78,0x0c,0x0c,0x0c,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x33 '3' + 0x00, 0x00, 0xfc, 0x8c, 0x18, 0x30, 0x78, 0x0c, 0x0c, 0x0c, 0xcc, 0x78, 0x00, 0x00, 0x00, - 7, // 0x34 '4' - 0x00,0x00,0x18,0x30,0x60,0xc8,0xd8,0xd8,0xfc,0x18,0x18,0x3c,0x00,0x00,0x00, + 7, // 0x34 '4' + 0x00, 0x00, 0x18, 0x30, 0x60, 0xc8, 0xd8, 0xd8, 0xfc, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, - 7, // 0x35 '5' - 0x00,0x00,0xfc,0xc0,0xc0,0xc0,0xf8,0x0c,0x0c,0x0c,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x35 '5' + 0x00, 0x00, 0xfc, 0xc0, 0xc0, 0xc0, 0xf8, 0x0c, 0x0c, 0x0c, 0xcc, 0x78, 0x00, 0x00, 0x00, - 7, // 0x36 '6' - 0x00,0x00,0x38,0x60,0xc0,0xc0,0xf8,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x36 '6' + 0x00, 0x00, 0x38, 0x60, 0xc0, 0xc0, 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, - 7, // 0x37 '7' - 0x00,0x00,0xfc,0x8c,0x0c,0x0c,0x18,0x18,0x30,0x30,0x30,0x30,0x00,0x00,0x00, + 7, // 0x37 '7' + 0x00, 0x00, 0xfc, 0x8c, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, - 7, // 0x38 '8' - 0x00,0x00,0x78,0xcc,0xcc,0xcc,0x78,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x38 '8' + 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, - 7, // 0x39 '9' - 0x00,0x00,0x78,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0x0c,0x18,0x70,0x00,0x00,0x00, + 7, // 0x39 '9' + 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x18, 0x70, 0x00, 0x00, 0x00, - 7, // 0x3a ':' - 0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00, + 7, // 0x3a ':' + 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, - 7, // 0x3b ';' - 0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x60,0x00, + 7, // 0x3b ';' + 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x60, 0x00, - 7, // 0x3c '<' - 0x00,0x00,0x00,0x0c,0x18,0x30,0x60,0xc0,0x60,0x30,0x18,0x0c,0x00,0x00,0x00, + 7, // 0x3c '<' + 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, - 7, // 0x3d '=' - 0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0xfc,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x3d '=' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x3e '>' - 0x00,0x00,0x00,0xc0,0x60,0x30,0x18,0x0c,0x18,0x30,0x60,0xc0,0x00,0x00,0x00, + 7, // 0x3e '>' + 0x00, 0x00, 0x00, 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x00, 0x00, 0x00, - 7, // 0x3f '?' - 0x00,0x00,0x78,0xcc,0xcc,0x18,0x30,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00, + 7, // 0x3f '?' + 0x00, 0x00, 0x78, 0xcc, 0xcc, 0x18, 0x30, 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, - 7, // 0x40 '@' - 0x00,0x00,0x00,0x70,0x88,0x04,0x74,0xb4,0xb4,0xb4,0xb4,0x68,0x00,0x00,0x00, + 7, // 0x40 '@' + 0x00, 0x00, 0x00, 0x70, 0x88, 0x04, 0x74, 0xb4, 0xb4, 0xb4, 0xb4, 0x68, 0x00, 0x00, 0x00, - 7, // 0x41 'A' - 0x00,0x00,0x30,0x78,0xcc,0xcc,0xcc,0xfc,0xcc,0xcc,0xcc,0xcc,0x00,0x00,0x00, + 7, // 0x41 'A' + 0x00, 0x00, 0x30, 0x78, 0xcc, 0xcc, 0xcc, 0xfc, 0xcc, 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x00, - 7, // 0x42 'B' - 0x00,0x00,0xf8,0xcc,0xcc,0xcc,0xf8,0xcc,0xcc,0xcc,0xcc,0xf8,0x00,0x00,0x00, + 7, // 0x42 'B' + 0x00, 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0xf8, 0x00, 0x00, 0x00, - 7, // 0x43 'C' - 0x00,0x00,0x78,0xcc,0xc4,0xc0,0xc0,0xc0,0xc0,0xc4,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x43 'C' + 0x00, 0x00, 0x78, 0xcc, 0xc4, 0xc0, 0xc0, 0xc0, 0xc0, 0xc4, 0xcc, 0x78, 0x00, 0x00, 0x00, - 7, // 0x44 'D' - 0x00,0x00,0xf0,0xd8,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xd8,0xf0,0x00,0x00,0x00, + 7, // 0x44 'D' + 0x00, 0x00, 0xf0, 0xd8, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xd8, 0xf0, 0x00, 0x00, 0x00, - 7, // 0x45 'E' - 0x00,0x00,0xfc,0xc4,0xc0,0xd0,0xf0,0xd0,0xc0,0xc0,0xc4,0xfc,0x00,0x00,0x00, + 7, // 0x45 'E' + 0x00, 0x00, 0xfc, 0xc4, 0xc0, 0xd0, 0xf0, 0xd0, 0xc0, 0xc0, 0xc4, 0xfc, 0x00, 0x00, 0x00, - 7, // 0x46 'F' - 0x00,0x00,0xfc,0xc4,0xc0,0xd0,0xf0,0xd0,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00, + 7, // 0x46 'F' + 0x00, 0x00, 0xfc, 0xc4, 0xc0, 0xd0, 0xf0, 0xd0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, - 7, // 0x47 'G' - 0x00,0x00,0x78,0xcc,0xc0,0xc0,0xc0,0xdc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x47 'G' + 0x00, 0x00, 0x78, 0xcc, 0xc0, 0xc0, 0xc0, 0xdc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, - 7, // 0x48 'H' - 0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xfc,0xcc,0xcc,0xcc,0xcc,0xcc,0x00,0x00,0x00, + 7, // 0x48 'H' + 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xfc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x00, - 7, // 0x49 'I' - 0x00,0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00, + 7, // 0x49 'I' + 0x00, 0x00, 0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, - 7, // 0x4a 'J' - 0x00,0x00,0x3c,0x18,0x18,0x18,0x18,0x18,0x18,0xd8,0xd8,0x70,0x00,0x00,0x00, + 7, // 0x4a 'J' + 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, - 7, // 0x4b 'K' - 0x00,0x00,0xcc,0xcc,0xd8,0xd8,0xf0,0xd8,0xd8,0xcc,0xcc,0xcc,0x00,0x00,0x00, + 7, // 0x4b 'K' + 0x00, 0x00, 0xcc, 0xcc, 0xd8, 0xd8, 0xf0, 0xd8, 0xd8, 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x00, - 7, // 0x4c 'L' - 0x00,0x00,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc4,0xfc,0x00,0x00,0x00, + 7, // 0x4c 'L' + 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc4, 0xfc, 0x00, 0x00, 0x00, - 7, // 0x4d 'M' - 0x00,0x00,0x84,0xcc,0xfc,0xb4,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x00,0x00,0x00, + 7, // 0x4d 'M' + 0x00, 0x00, 0x84, 0xcc, 0xfc, 0xb4, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x00, - 7, // 0x4e 'N' - 0x00,0x00,0xcc,0xcc,0xcc,0xec,0xfc,0xdc,0xcc,0xcc,0xcc,0xcc,0x00,0x00,0x00, + 7, // 0x4e 'N' + 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xec, 0xfc, 0xdc, 0xcc, 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x00, - 7, // 0x4f 'O' - 0x00,0x00,0x78,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x4f 'O' + 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, - 7, // 0x50 'P' - 0x00,0x00,0xf8,0xcc,0xcc,0xcc,0xcc,0xf8,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00, + 7, // 0x50 'P' + 0x00, 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0xf8, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, - 7, // 0x51 'Q' - 0x00,0x00,0x78,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xdc,0x78,0x18,0x0c,0x00,0x00, + 7, // 0x51 'Q' + 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xdc, 0x78, 0x18, 0x0c, 0x00, 0x00, - 7, // 0x52 'R' - 0x00,0x00,0xf8,0xcc,0xcc,0xcc,0xcc,0xf8,0xd8,0xcc,0xcc,0xcc,0x00,0x00,0x00, + 7, // 0x52 'R' + 0x00, 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0xf8, 0xd8, 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x00, - 7, // 0x53 'S' - 0x00,0x00,0x78,0xcc,0xcc,0xe0,0x70,0x38,0x1c,0xcc,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x53 'S' + 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xe0, 0x70, 0x38, 0x1c, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, - 7, // 0x54 'T' - 0x00,0x00,0xfc,0xb4,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00,0x00, + 7, // 0x54 'T' + 0x00, 0x00, 0xfc, 0xb4, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, - 7, // 0x55 'U' - 0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x55 'U' + 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, - 7, // 0x56 'V' - 0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x30,0x00,0x00,0x00, + 7, // 0x56 'V' + 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x00, 0x00, 0x00, - 7, // 0x57 'W' - 0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xb4,0xfc,0xcc,0x84,0x00,0x00,0x00, + 7, // 0x57 'W' + 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xb4, 0xfc, 0xcc, 0x84, 0x00, 0x00, 0x00, - 7, // 0x58 'X' - 0x00,0x00,0xcc,0xcc,0xcc,0x78,0x30,0x78,0xcc,0xcc,0xcc,0xcc,0x00,0x00,0x00, + 7, // 0x58 'X' + 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x00, - 7, // 0x59 'Y' - 0x00,0x00,0xcc,0xcc,0xcc,0xcc,0x78,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00, + 7, // 0x59 'Y' + 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, - 7, // 0x5a 'Z' - 0x00,0x00,0xfc,0x8c,0x0c,0x18,0x30,0x60,0xc0,0xc0,0xc4,0xfc,0x00,0x00,0x00, + 7, // 0x5a 'Z' + 0x00, 0x00, 0xfc, 0x8c, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0xc0, 0xc4, 0xfc, 0x00, 0x00, 0x00, - 7, // 0x5b '[' - 0x00,0x78,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x78,0x00,0x00, + 7, // 0x5b '[' + 0x00, 0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78, 0x00, 0x00, - 7, // 0x5c '\' - 0x00,0x00,0xc0,0xc0,0x60,0x60,0x30,0x30,0x18,0x18,0x0c,0x0c,0x00,0x00,0x00, + 7, // 0x5c '\' + 0x00, 0x00, 0xc0, 0xc0, 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x0c, 0x0c, 0x00, 0x00, 0x00, - 7, // 0x5d ']' - 0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x78,0x00,0x00, + 7, // 0x5d ']' + 0x00, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00, 0x00, - 7, // 0x5e '^' - 0x00,0x10,0x38,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x5e '^' + 0x00, 0x10, 0x38, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x5f '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00, + 7, // 0x5f '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, - 7, // 0x60 '`' - 0x00,0x30,0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x60 '`' + 0x00, 0x30, 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x70,0xd8,0x18,0x78,0xd8,0xd8,0xd8,0x6c,0x00,0x00,0x00, + 7, // 0x61 'a' + 0x00, 0x00, 0x00, 0x00, 0x70, 0xd8, 0x18, 0x78, 0xd8, 0xd8, 0xd8, 0x6c, 0x00, 0x00, 0x00, - 7, // 0x62 'b' - 0x00,0x00,0x60,0x60,0x60,0x78,0x6c,0x6c,0x6c,0x6c,0x6c,0x78,0x00,0x00,0x00, + 7, // 0x62 'b' + 0x00, 0x00, 0x60, 0x60, 0x60, 0x78, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x78, 0x00, 0x00, 0x00, - 7, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x78,0xcc,0xc0,0xc0,0xc0,0xc0,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x63 'c' + 0x00, 0x00, 0x00, 0x00, 0x78, 0xcc, 0xc0, 0xc0, 0xc0, 0xc0, 0xcc, 0x78, 0x00, 0x00, 0x00, - 7, // 0x64 'd' - 0x00,0x00,0x18,0x18,0x18,0x78,0xd8,0xd8,0xd8,0xd8,0xd8,0x6c,0x00,0x00,0x00, + 7, // 0x64 'd' + 0x00, 0x00, 0x18, 0x18, 0x18, 0x78, 0xd8, 0xd8, 0xd8, 0xd8, 0xd8, 0x6c, 0x00, 0x00, 0x00, - 7, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x78,0xcc,0xcc,0xfc,0xc0,0xc0,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x65 'e' + 0x00, 0x00, 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xfc, 0xc0, 0xc0, 0xcc, 0x78, 0x00, 0x00, 0x00, - 7, // 0x66 'f' - 0x00,0x00,0x30,0x68,0x60,0x60,0xf0,0x60,0x60,0x60,0x60,0xf0,0x00,0x00,0x00, + 7, // 0x66 'f' + 0x00, 0x00, 0x30, 0x68, 0x60, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, - 7, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x6c,0xd8,0xd8,0xd8,0xd8,0xd8,0x78,0x18,0xd8,0x70,0x00, + 7, // 0x67 'g' + 0x00, 0x00, 0x00, 0x00, 0x6c, 0xd8, 0xd8, 0xd8, 0xd8, 0xd8, 0x78, 0x18, 0xd8, 0x70, 0x00, - 7, // 0x68 'h' - 0x00,0x00,0xc0,0xc0,0xc0,0xd8,0xec,0xcc,0xcc,0xcc,0xcc,0xcc,0x00,0x00,0x00, + 7, // 0x68 'h' + 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xd8, 0xec, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x00, - 7, // 0x69 'i' - 0x00,0x00,0x30,0x30,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00, + 7, // 0x69 'i' + 0x00, 0x00, 0x30, 0x30, 0x00, 0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, - 7, // 0x6a 'j' - 0x00,0x00,0x18,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0xd8,0xd8,0x70,0x00, + 7, // 0x6a 'j' + 0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0x70, 0x00, - 7, // 0x6b 'k' - 0x00,0x00,0xc0,0xc0,0xcc,0xcc,0xcc,0xd8,0xf0,0xd8,0xcc,0xcc,0x00,0x00,0x00, + 7, // 0x6b 'k' + 0x00, 0x00, 0xc0, 0xc0, 0xcc, 0xcc, 0xcc, 0xd8, 0xf0, 0xd8, 0xcc, 0xcc, 0x00, 0x00, 0x00, - 7, // 0x6c 'l' - 0x00,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00, + 7, // 0x6c 'l' + 0x00, 0x00, 0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, - 7, // 0x6d 'm' - 0x00,0x00,0x00,0x00,0xe8,0xfc,0xd4,0xd4,0xd4,0xc4,0xc4,0xc4,0x00,0x00,0x00, + 7, // 0x6d 'm' + 0x00, 0x00, 0x00, 0x00, 0xe8, 0xfc, 0xd4, 0xd4, 0xd4, 0xc4, 0xc4, 0xc4, 0x00, 0x00, 0x00, - 7, // 0x6e 'n' - 0x00,0x00,0x00,0x00,0xd8,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x00,0x00,0x00, + 7, // 0x6e 'n' + 0x00, 0x00, 0x00, 0x00, 0xd8, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, - 7, // 0x6f 'o' - 0x00,0x00,0x00,0x00,0x78,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x6f 'o' + 0x00, 0x00, 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, - 7, // 0x70 'p' - 0x00,0x00,0x00,0x00,0xf8,0xcc,0xcc,0xcc,0xcc,0xcc,0xf8,0xc0,0xc0,0xc0,0x00, + 7, // 0x70 'p' + 0x00, 0x00, 0x00, 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xf8, 0xc0, 0xc0, 0xc0, 0x00, - 7, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x7c,0xcc,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0x0c,0x0c,0x00, + 7, // 0x71 'q' + 0x00, 0x00, 0x00, 0x00, 0x7c, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x0c, 0x00, - 7, // 0x72 'r' - 0x00,0x00,0x00,0x00,0xd8,0xec,0xcc,0xc0,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00, + 7, // 0x72 'r' + 0x00, 0x00, 0x00, 0x00, 0xd8, 0xec, 0xcc, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, - 7, // 0x73 's' - 0x00,0x00,0x00,0x00,0x78,0xcc,0xe0,0x70,0x38,0x1c,0xcc,0x78,0x00,0x00,0x00, + 7, // 0x73 's' + 0x00, 0x00, 0x00, 0x00, 0x78, 0xcc, 0xe0, 0x70, 0x38, 0x1c, 0xcc, 0x78, 0x00, 0x00, 0x00, - 7, // 0x74 't' - 0x00,0x00,0x20,0x60,0x60,0xf0,0x60,0x60,0x60,0x60,0x6c,0x38,0x00,0x00,0x00, + 7, // 0x74 't' + 0x00, 0x00, 0x20, 0x60, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x6c, 0x38, 0x00, 0x00, 0x00, - 7, // 0x75 'u' - 0x00,0x00,0x00,0x00,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0x6c,0x00,0x00,0x00, + 7, // 0x75 'u' + 0x00, 0x00, 0x00, 0x00, 0xd8, 0xd8, 0xd8, 0xd8, 0xd8, 0xd8, 0xd8, 0x6c, 0x00, 0x00, 0x00, - 7, // 0x76 'v' - 0x00,0x00,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x30,0x00,0x00,0x00, + 7, // 0x76 'v' + 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x00, 0x00, 0x00, - 7, // 0x77 'w' - 0x00,0x00,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xb4,0xfc,0xcc,0x84,0x00,0x00,0x00, + 7, // 0x77 'w' + 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xb4, 0xfc, 0xcc, 0x84, 0x00, 0x00, 0x00, - 7, // 0x78 'x' - 0x00,0x00,0x00,0x00,0xcc,0xcc,0x78,0x30,0x78,0xcc,0xcc,0xcc,0x00,0x00,0x00, + 7, // 0x78 'x' + 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0x78, 0x30, 0x78, 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x00, - 7, // 0x79 'y' - 0x00,0x00,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0x18,0xf0,0x00, + 7, // 0x79 'y' + 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x18, 0xf0, 0x00, - 7, // 0x7a 'z' - 0x00,0x00,0x00,0x00,0xfc,0x8c,0x18,0x30,0x60,0xc0,0xc4,0xfc,0x00,0x00,0x00, + 7, // 0x7a 'z' + 0x00, 0x00, 0x00, 0x00, 0xfc, 0x8c, 0x18, 0x30, 0x60, 0xc0, 0xc4, 0xfc, 0x00, 0x00, 0x00, - 7, // 0x7b '{' - 0x00,0x1c,0x30,0x30,0x30,0x30,0x30,0xe0,0x30,0x30,0x30,0x30,0x1c,0x00,0x00, + 7, // 0x7b '{' + 0x00, 0x1c, 0x30, 0x30, 0x30, 0x30, 0x30, 0xe0, 0x30, 0x30, 0x30, 0x30, 0x1c, 0x00, 0x00, - 7, // 0x7c '|' - 0x00,0x30,0x30,0x30,0x30,0x30,0x00,0x00,0x30,0x30,0x30,0x30,0x30,0x00,0x00, + 7, // 0x7c '|' + 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, - 7, // 0x7d '}' - 0x00,0xe0,0x30,0x30,0x30,0x30,0x30,0x1c,0x30,0x30,0x30,0x30,0xe0,0x00,0x00, + 7, // 0x7d '}' + 0x00, 0xe0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x1c, 0x30, 0x30, 0x30, 0x30, 0xe0, 0x00, 0x00, - 7, // 0x7e '~' - 0x00,0x00,0x34,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x7e '~' + 0x00, 0x00, 0x34, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x7f '' - 0x00,0x00,0x00,0x00,0x00,0x30,0x78,0xcc,0xcc,0xfc,0x00,0x00,0x00,0x00,0x00, - 0 -}; + 7, // 0x7f '' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x78, 0xcc, 0xcc, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0}; -const int8u gse8x16[] = -{ - 16, 0, 32, 128-32, +const int8u gse8x16[] = { + 16, 0, 32, 128 - 32, - 0x00,0x00,0x11,0x00,0x22,0x00,0x33,0x00,0x44,0x00,0x55,0x00,0x66,0x00,0x77,0x00,0x88,0x00, - 0x99,0x00,0xaa,0x00,0xbb,0x00,0xcc,0x00,0xdd,0x00,0xee,0x00,0xff,0x00,0x10,0x01,0x21,0x01, - 0x32,0x01,0x43,0x01,0x54,0x01,0x65,0x01,0x76,0x01,0x87,0x01,0x98,0x01,0xa9,0x01,0xba,0x01, - 0xcb,0x01,0xdc,0x01,0xed,0x01,0xfe,0x01,0x0f,0x02,0x20,0x02,0x31,0x02,0x42,0x02,0x53,0x02, - 0x64,0x02,0x75,0x02,0x86,0x02,0x97,0x02,0xa8,0x02,0xb9,0x02,0xca,0x02,0xdb,0x02,0xec,0x02, - 0xfd,0x02,0x0e,0x03,0x1f,0x03,0x30,0x03,0x41,0x03,0x52,0x03,0x63,0x03,0x74,0x03,0x85,0x03, - 0x96,0x03,0xa7,0x03,0xb8,0x03,0xc9,0x03,0xda,0x03,0xeb,0x03,0xfc,0x03,0x0d,0x04,0x1e,0x04, - 0x2f,0x04,0x40,0x04,0x51,0x04,0x62,0x04,0x73,0x04,0x84,0x04,0x95,0x04,0xa6,0x04,0xb7,0x04, - 0xc8,0x04,0xd9,0x04,0xea,0x04,0xfb,0x04,0x0c,0x05,0x1d,0x05,0x2e,0x05,0x3f,0x05,0x50,0x05, - 0x61,0x05,0x72,0x05,0x83,0x05,0x94,0x05,0xa5,0x05,0xb6,0x05,0xc7,0x05,0xd8,0x05,0xe9,0x05, - 0xfa,0x05,0x0b,0x06,0x1c,0x06,0x2d,0x06,0x3e,0x06,0x4f,0x06, + 0x00, 0x00, 0x11, 0x00, 0x22, 0x00, 0x33, 0x00, 0x44, 0x00, 0x55, 0x00, 0x66, 0x00, 0x77, 0x00, 0x88, 0x00, + 0x99, 0x00, 0xaa, 0x00, 0xbb, 0x00, 0xcc, 0x00, 0xdd, 0x00, 0xee, 0x00, 0xff, 0x00, 0x10, 0x01, 0x21, 0x01, + 0x32, 0x01, 0x43, 0x01, 0x54, 0x01, 0x65, 0x01, 0x76, 0x01, 0x87, 0x01, 0x98, 0x01, 0xa9, 0x01, 0xba, 0x01, + 0xcb, 0x01, 0xdc, 0x01, 0xed, 0x01, 0xfe, 0x01, 0x0f, 0x02, 0x20, 0x02, 0x31, 0x02, 0x42, 0x02, 0x53, 0x02, + 0x64, 0x02, 0x75, 0x02, 0x86, 0x02, 0x97, 0x02, 0xa8, 0x02, 0xb9, 0x02, 0xca, 0x02, 0xdb, 0x02, 0xec, 0x02, + 0xfd, 0x02, 0x0e, 0x03, 0x1f, 0x03, 0x30, 0x03, 0x41, 0x03, 0x52, 0x03, 0x63, 0x03, 0x74, 0x03, 0x85, 0x03, + 0x96, 0x03, 0xa7, 0x03, 0xb8, 0x03, 0xc9, 0x03, 0xda, 0x03, 0xeb, 0x03, 0xfc, 0x03, 0x0d, 0x04, 0x1e, 0x04, + 0x2f, 0x04, 0x40, 0x04, 0x51, 0x04, 0x62, 0x04, 0x73, 0x04, 0x84, 0x04, 0x95, 0x04, 0xa6, 0x04, 0xb7, 0x04, + 0xc8, 0x04, 0xd9, 0x04, 0xea, 0x04, 0xfb, 0x04, 0x0c, 0x05, 0x1d, 0x05, 0x2e, 0x05, 0x3f, 0x05, 0x50, 0x05, + 0x61, 0x05, 0x72, 0x05, 0x83, 0x05, 0x94, 0x05, 0xa5, 0x05, 0xb6, 0x05, 0xc7, 0x05, 0xd8, 0x05, 0xe9, 0x05, + 0xfa, 0x05, 0x0b, 0x06, 0x1c, 0x06, 0x2d, 0x06, 0x3e, 0x06, 0x4f, 0x06, - 8, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x21 '!' - 0x00,0x00,0x10,0x38,0x38,0x38,0x38,0x10,0x10,0x00,0x10,0x10,0x00,0x00,0x00,0x00, + 8, // 0x21 '!' + 0x00, 0x00, 0x10, 0x38, 0x38, 0x38, 0x38, 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, - 8, // 0x22 '"' - 0x00,0x24,0x24,0x24,0x24,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x22 '"' + 0x00, 0x24, 0x24, 0x24, 0x24, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x23 '#' - 0x00,0x00,0x24,0x24,0x24,0x7e,0x24,0x24,0x7e,0x24,0x24,0x24,0x00,0x00,0x00,0x00, + 8, // 0x23 '#' + 0x00, 0x00, 0x24, 0x24, 0x24, 0x7e, 0x24, 0x24, 0x7e, 0x24, 0x24, 0x24, 0x00, 0x00, 0x00, 0x00, - 8, // 0x24 '$' - 0x00,0x14,0x14,0x3e,0x55,0x54,0x54,0x3e,0x15,0x15,0x55,0x3e,0x14,0x14,0x00,0x00, + 8, // 0x24 '$' + 0x00, 0x14, 0x14, 0x3e, 0x55, 0x54, 0x54, 0x3e, 0x15, 0x15, 0x55, 0x3e, 0x14, 0x14, 0x00, 0x00, - 8, // 0x25 '%' - 0x00,0x00,0x32,0x56,0x6c,0x04,0x08,0x08,0x10,0x13,0x25,0x26,0x00,0x00,0x00,0x00, + 8, // 0x25 '%' + 0x00, 0x00, 0x32, 0x56, 0x6c, 0x04, 0x08, 0x08, 0x10, 0x13, 0x25, 0x26, 0x00, 0x00, 0x00, 0x00, - 8, // 0x26 '&' - 0x00,0x00,0x18,0x24,0x24,0x24,0x18,0x28,0x45,0x46,0x44,0x3b,0x00,0x00,0x00,0x00, + 8, // 0x26 '&' + 0x00, 0x00, 0x18, 0x24, 0x24, 0x24, 0x18, 0x28, 0x45, 0x46, 0x44, 0x3b, 0x00, 0x00, 0x00, 0x00, - 8, // 0x27 ''' - 0x00,0x00,0x08,0x08,0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x27 ''' + 0x00, 0x00, 0x08, 0x08, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x28 '(' - 0x00,0x04,0x08,0x10,0x10,0x20,0x20,0x20,0x20,0x10,0x10,0x08,0x04,0x00,0x00,0x00, + 8, // 0x28 '(' + 0x00, 0x04, 0x08, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x10, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, - 8, // 0x29 ')' - 0x00,0x10,0x08,0x04,0x04,0x02,0x02,0x02,0x02,0x04,0x04,0x08,0x10,0x00,0x00,0x00, + 8, // 0x29 ')' + 0x00, 0x10, 0x08, 0x04, 0x04, 0x02, 0x02, 0x02, 0x02, 0x04, 0x04, 0x08, 0x10, 0x00, 0x00, 0x00, - 8, // 0x2a '*' - 0x00,0x00,0x00,0x00,0x66,0x24,0x18,0xff,0x18,0x24,0x66,0x00,0x00,0x00,0x00,0x00, + 8, // 0x2a '*' + 0x00, 0x00, 0x00, 0x00, 0x66, 0x24, 0x18, 0xff, 0x18, 0x24, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x2b '+' - 0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x7f,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00, + 8, // 0x2b '+' + 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x7f, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x2c ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x20,0x00, + 8, // 0x2c ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x20, 0x00, - 8, // 0x2d '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x2d '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x2e '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00, + 8, // 0x2e '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 8, // 0x2f '/' - 0x00,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,0x00,0x00, + 8, // 0x2f '/' + 0x00, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x00, 0x00, 0x00, - 8, // 0x30 '0' - 0x00,0x00,0x3c,0x42,0x42,0x46,0x4a,0x52,0x62,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x30 '0' + 0x00, 0x00, 0x3c, 0x42, 0x42, 0x46, 0x4a, 0x52, 0x62, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x31 '1' - 0x00,0x00,0x08,0x08,0x18,0x38,0x08,0x08,0x08,0x08,0x08,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x31 '1' + 0x00, 0x00, 0x08, 0x08, 0x18, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x32 '2' - 0x00,0x00,0x3c,0x42,0x42,0x02,0x04,0x08,0x10,0x20,0x42,0x7e,0x00,0x00,0x00,0x00, + 8, // 0x32 '2' + 0x00, 0x00, 0x3c, 0x42, 0x42, 0x02, 0x04, 0x08, 0x10, 0x20, 0x42, 0x7e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x33 '3' - 0x00,0x00,0x7e,0x42,0x04,0x08,0x1c,0x02,0x02,0x02,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x33 '3' + 0x00, 0x00, 0x7e, 0x42, 0x04, 0x08, 0x1c, 0x02, 0x02, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x34 '4' - 0x00,0x00,0x04,0x08,0x10,0x24,0x44,0x44,0x7e,0x04,0x04,0x0e,0x00,0x00,0x00,0x00, + 8, // 0x34 '4' + 0x00, 0x00, 0x04, 0x08, 0x10, 0x24, 0x44, 0x44, 0x7e, 0x04, 0x04, 0x0e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x35 '5' - 0x00,0x00,0x7e,0x42,0x40,0x40,0x7c,0x02,0x02,0x02,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x35 '5' + 0x00, 0x00, 0x7e, 0x42, 0x40, 0x40, 0x7c, 0x02, 0x02, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x36 '6' - 0x00,0x00,0x1c,0x20,0x40,0x40,0x7c,0x42,0x42,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x36 '6' + 0x00, 0x00, 0x1c, 0x20, 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x37 '7' - 0x00,0x00,0x7e,0x42,0x42,0x02,0x04,0x08,0x10,0x10,0x10,0x10,0x00,0x00,0x00,0x00, + 8, // 0x37 '7' + 0x00, 0x00, 0x7e, 0x42, 0x42, 0x02, 0x04, 0x08, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, - 8, // 0x38 '8' - 0x00,0x00,0x3c,0x42,0x42,0x42,0x3c,0x42,0x42,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x38 '8' + 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x39 '9' - 0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x3e,0x02,0x02,0x04,0x38,0x00,0x00,0x00,0x00, + 8, // 0x39 '9' + 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x04, 0x38, 0x00, 0x00, 0x00, 0x00, - 8, // 0x3a ':' - 0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x3a ':' + 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x3b ';' - 0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x60,0x40,0x00, + 8, // 0x3b ';' + 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x60, 0x40, 0x00, - 8, // 0x3c '<' - 0x00,0x00,0x00,0x02,0x04,0x08,0x10,0x20,0x10,0x08,0x04,0x02,0x00,0x00,0x00,0x00, + 8, // 0x3c '<' + 0x00, 0x00, 0x00, 0x02, 0x04, 0x08, 0x10, 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, 0x00, 0x00, 0x00, - 8, // 0x3d '=' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x00,0x7f,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x3d '=' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x3e '>' - 0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x04,0x08,0x10,0x20,0x00,0x00,0x00,0x00, + 8, // 0x3e '>' + 0x00, 0x00, 0x00, 0x20, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, - 8, // 0x3f '?' - 0x00,0x00,0x3c,0x42,0x42,0x42,0x04,0x08,0x08,0x00,0x08,0x08,0x00,0x00,0x00,0x00, + 8, // 0x3f '?' + 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x04, 0x08, 0x08, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, - 8, // 0x40 '@' - 0x00,0x00,0x3c,0x42,0x01,0x39,0x49,0x49,0x49,0x49,0x49,0x36,0x00,0x00,0x00,0x00, + 8, // 0x40 '@' + 0x00, 0x00, 0x3c, 0x42, 0x01, 0x39, 0x49, 0x49, 0x49, 0x49, 0x49, 0x36, 0x00, 0x00, 0x00, 0x00, - 8, // 0x41 'A' - 0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x7e,0x42,0x42,0x42,0x42,0x00,0x00,0x00,0x00, + 8, // 0x41 'A' + 0x00, 0x00, 0x18, 0x24, 0x42, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, - 8, // 0x42 'B' - 0x00,0x00,0x7c,0x22,0x22,0x22,0x3c,0x22,0x22,0x22,0x22,0x7c,0x00,0x00,0x00,0x00, + 8, // 0x42 'B' + 0x00, 0x00, 0x7c, 0x22, 0x22, 0x22, 0x3c, 0x22, 0x22, 0x22, 0x22, 0x7c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x43 'C' - 0x00,0x00,0x3c,0x42,0x42,0x40,0x40,0x40,0x40,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x43 'C' + 0x00, 0x00, 0x3c, 0x42, 0x42, 0x40, 0x40, 0x40, 0x40, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x44 'D' - 0x00,0x00,0x7c,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x7c,0x00,0x00,0x00,0x00, + 8, // 0x44 'D' + 0x00, 0x00, 0x7c, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x7c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x45 'E' - 0x00,0x00,0x7e,0x22,0x20,0x28,0x38,0x28,0x20,0x20,0x22,0x7e,0x00,0x00,0x00,0x00, + 8, // 0x45 'E' + 0x00, 0x00, 0x7e, 0x22, 0x20, 0x28, 0x38, 0x28, 0x20, 0x20, 0x22, 0x7e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x46 'F' - 0x00,0x00,0x7e,0x22,0x20,0x28,0x38,0x28,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, + 8, // 0x46 'F' + 0x00, 0x00, 0x7e, 0x22, 0x20, 0x28, 0x38, 0x28, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, 0x00, 0x00, - 8, // 0x47 'G' - 0x00,0x00,0x3c,0x42,0x42,0x40,0x40,0x4e,0x42,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x47 'G' + 0x00, 0x00, 0x3c, 0x42, 0x42, 0x40, 0x40, 0x4e, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x48 'H' - 0x00,0x00,0x42,0x42,0x42,0x42,0x7e,0x42,0x42,0x42,0x42,0x42,0x00,0x00,0x00,0x00, + 8, // 0x48 'H' + 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, - 8, // 0x49 'I' - 0x00,0x00,0x1c,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1c,0x00,0x00,0x00,0x00, + 8, // 0x49 'I' + 0x00, 0x00, 0x1c, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x1c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x4a 'J' - 0x00,0x00,0x0e,0x04,0x04,0x04,0x04,0x04,0x04,0x44,0x44,0x38,0x00,0x00,0x00,0x00, + 8, // 0x4a 'J' + 0x00, 0x00, 0x0e, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, - 8, // 0x4b 'K' - 0x00,0x00,0x62,0x22,0x24,0x28,0x30,0x28,0x24,0x22,0x22,0x62,0x00,0x00,0x00,0x00, + 8, // 0x4b 'K' + 0x00, 0x00, 0x62, 0x22, 0x24, 0x28, 0x30, 0x28, 0x24, 0x22, 0x22, 0x62, 0x00, 0x00, 0x00, 0x00, - 8, // 0x4c 'L' - 0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x22,0x7e,0x00,0x00,0x00,0x00, + 8, // 0x4c 'L' + 0x00, 0x00, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x7e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x4d 'M' - 0x00,0x00,0x41,0x63,0x55,0x49,0x41,0x41,0x41,0x41,0x41,0x41,0x00,0x00,0x00,0x00, + 8, // 0x4d 'M' + 0x00, 0x00, 0x41, 0x63, 0x55, 0x49, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x00, 0x00, 0x00, 0x00, - 8, // 0x4e 'N' - 0x00,0x00,0x42,0x42,0x62,0x52,0x4a,0x46,0x42,0x42,0x42,0x42,0x00,0x00,0x00,0x00, + 8, // 0x4e 'N' + 0x00, 0x00, 0x42, 0x42, 0x62, 0x52, 0x4a, 0x46, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, - 8, // 0x4f 'O' - 0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x4f 'O' + 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x50 'P' - 0x00,0x00,0x7c,0x22,0x22,0x22,0x22,0x3c,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, + 8, // 0x50 'P' + 0x00, 0x00, 0x7c, 0x22, 0x22, 0x22, 0x22, 0x3c, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, 0x00, 0x00, - 8, // 0x51 'Q' - 0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x42,0x4a,0x44,0x3a,0x02,0x00,0x00,0x00, + 8, // 0x51 'Q' + 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x4a, 0x44, 0x3a, 0x02, 0x00, 0x00, 0x00, - 8, // 0x52 'R' - 0x00,0x00,0x7c,0x22,0x22,0x22,0x22,0x3c,0x28,0x24,0x22,0x62,0x00,0x00,0x00,0x00, + 8, // 0x52 'R' + 0x00, 0x00, 0x7c, 0x22, 0x22, 0x22, 0x22, 0x3c, 0x28, 0x24, 0x22, 0x62, 0x00, 0x00, 0x00, 0x00, - 8, // 0x53 'S' - 0x00,0x00,0x3c,0x42,0x42,0x40,0x30,0x0c,0x02,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x53 'S' + 0x00, 0x00, 0x3c, 0x42, 0x42, 0x40, 0x30, 0x0c, 0x02, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x54 'T' - 0x00,0x00,0x7f,0x49,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1c,0x00,0x00,0x00,0x00, + 8, // 0x54 'T' + 0x00, 0x00, 0x7f, 0x49, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x1c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x55 'U' - 0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x55 'U' + 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x56 'V' - 0x00,0x00,0x41,0x41,0x41,0x41,0x22,0x22,0x14,0x14,0x08,0x08,0x00,0x00,0x00,0x00, + 8, // 0x56 'V' + 0x00, 0x00, 0x41, 0x41, 0x41, 0x41, 0x22, 0x22, 0x14, 0x14, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, - 8, // 0x57 'W' - 0x00,0x00,0x41,0x41,0x41,0x41,0x41,0x49,0x49,0x55,0x63,0x41,0x00,0x00,0x00,0x00, + 8, // 0x57 'W' + 0x00, 0x00, 0x41, 0x41, 0x41, 0x41, 0x41, 0x49, 0x49, 0x55, 0x63, 0x41, 0x00, 0x00, 0x00, 0x00, - 8, // 0x58 'X' - 0x00,0x00,0x42,0x42,0x42,0x24,0x18,0x18,0x24,0x42,0x42,0x42,0x00,0x00,0x00,0x00, + 8, // 0x58 'X' + 0x00, 0x00, 0x42, 0x42, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, - 8, // 0x59 'Y' - 0x00,0x00,0x22,0x22,0x22,0x22,0x14,0x08,0x08,0x08,0x08,0x1c,0x00,0x00,0x00,0x00, + 8, // 0x59 'Y' + 0x00, 0x00, 0x22, 0x22, 0x22, 0x22, 0x14, 0x08, 0x08, 0x08, 0x08, 0x1c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x5a 'Z' - 0x00,0x00,0x7e,0x42,0x02,0x04,0x08,0x10,0x20,0x40,0x42,0x7e,0x00,0x00,0x00,0x00, + 8, // 0x5a 'Z' + 0x00, 0x00, 0x7e, 0x42, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x42, 0x7e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x5b '[' - 0x00,0x1e,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1e,0x00,0x00,0x00, + 8, // 0x5b '[' + 0x00, 0x1e, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1e, 0x00, 0x00, 0x00, - 8, // 0x5c '\' - 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x02,0x02,0x00,0x00,0x00, + 8, // 0x5c '\' + 0x00, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, - 8, // 0x5d ']' - 0x00,0x3c,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x3c,0x00,0x00,0x00, + 8, // 0x5d ']' + 0x00, 0x3c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x3c, 0x00, 0x00, 0x00, - 8, // 0x5e '^' - 0x00,0x00,0x08,0x14,0x22,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x5e '^' + 0x00, 0x00, 0x08, 0x14, 0x22, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x5f '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00, + 8, // 0x5f '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 8, // 0x60 '`' - 0x00,0x00,0x08,0x08,0x08,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x60 '`' + 0x00, 0x00, 0x08, 0x08, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x04,0x3c,0x44,0x44,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x61 'a' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x04, 0x3c, 0x44, 0x44, 0x3e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x62 'b' - 0x00,0x00,0x60,0x20,0x20,0x38,0x24,0x22,0x22,0x22,0x22,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x62 'b' + 0x00, 0x00, 0x60, 0x20, 0x20, 0x38, 0x24, 0x22, 0x22, 0x22, 0x22, 0x3c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x40,0x40,0x40,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x63 'c' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x40, 0x40, 0x40, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x64 'd' - 0x00,0x00,0x0c,0x04,0x04,0x1c,0x24,0x44,0x44,0x44,0x44,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x64 'd' + 0x00, 0x00, 0x0c, 0x04, 0x04, 0x1c, 0x24, 0x44, 0x44, 0x44, 0x44, 0x3e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x7e,0x40,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x65 'e' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x7e, 0x40, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x66 'f' - 0x00,0x00,0x0c,0x12,0x10,0x10,0x38,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00,0x00, + 8, // 0x66 'f' + 0x00, 0x00, 0x0c, 0x12, 0x10, 0x10, 0x38, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, 0x00, - 8, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x3e,0x44,0x44,0x44,0x44,0x44,0x3c,0x04,0x44,0x38,0x00, + 8, // 0x67 'g' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x44, 0x44, 0x44, 0x44, 0x44, 0x3c, 0x04, 0x44, 0x38, 0x00, - 8, // 0x68 'h' - 0x00,0x00,0x60,0x20,0x20,0x2c,0x32,0x22,0x22,0x22,0x22,0x62,0x00,0x00,0x00,0x00, + 8, // 0x68 'h' + 0x00, 0x00, 0x60, 0x20, 0x20, 0x2c, 0x32, 0x22, 0x22, 0x22, 0x22, 0x62, 0x00, 0x00, 0x00, 0x00, - 8, // 0x69 'i' - 0x00,0x00,0x08,0x08,0x00,0x18,0x08,0x08,0x08,0x08,0x08,0x1c,0x00,0x00,0x00,0x00, + 8, // 0x69 'i' + 0x00, 0x00, 0x08, 0x08, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x08, 0x1c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x6a 'j' - 0x00,0x00,0x04,0x04,0x00,0x0c,0x04,0x04,0x04,0x04,0x04,0x44,0x44,0x38,0x00,0x00, + 8, // 0x6a 'j' + 0x00, 0x00, 0x04, 0x04, 0x00, 0x0c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x44, 0x44, 0x38, 0x00, 0x00, - 8, // 0x6b 'k' - 0x00,0x00,0x60,0x20,0x20,0x22,0x24,0x28,0x38,0x24,0x22,0x62,0x00,0x00,0x00,0x00, + 8, // 0x6b 'k' + 0x00, 0x00, 0x60, 0x20, 0x20, 0x22, 0x24, 0x28, 0x38, 0x24, 0x22, 0x62, 0x00, 0x00, 0x00, 0x00, - 8, // 0x6c 'l' - 0x00,0x00,0x18,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1c,0x00,0x00,0x00,0x00, + 8, // 0x6c 'l' + 0x00, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x1c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x6d 'm' - 0x00,0x00,0x00,0x00,0x00,0x76,0x49,0x49,0x49,0x49,0x41,0x41,0x00,0x00,0x00,0x00, + 8, // 0x6d 'm' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x49, 0x49, 0x49, 0x49, 0x41, 0x41, 0x00, 0x00, 0x00, 0x00, - 8, // 0x6e 'n' - 0x00,0x00,0x00,0x00,0x00,0x5c,0x22,0x22,0x22,0x22,0x22,0x22,0x00,0x00,0x00,0x00, + 8, // 0x6e 'n' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, - 8, // 0x6f 'o' - 0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x6f 'o' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0x7c,0x22,0x22,0x22,0x22,0x22,0x3c,0x20,0x20,0x70,0x00, + 8, // 0x70 'p' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x22, 0x22, 0x22, 0x22, 0x22, 0x3c, 0x20, 0x20, 0x70, 0x00, - 8, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x3e,0x44,0x44,0x44,0x44,0x44,0x3c,0x04,0x04,0x0e,0x00, + 8, // 0x71 'q' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x44, 0x44, 0x44, 0x44, 0x44, 0x3c, 0x04, 0x04, 0x0e, 0x00, - 8, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0x7c,0x22,0x22,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, + 8, // 0x72 'r' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x22, 0x22, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, 0x00, 0x00, - 8, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x40,0x3c,0x02,0x42,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x73 's' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x40, 0x3c, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x74 't' - 0x00,0x00,0x10,0x10,0x10,0x7c,0x10,0x10,0x10,0x10,0x12,0x0c,0x00,0x00,0x00,0x00, + 8, // 0x74 't' + 0x00, 0x00, 0x10, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x12, 0x0c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x75 'u' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x3e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0x41,0x41,0x41,0x41,0x22,0x14,0x08,0x00,0x00,0x00,0x00, + 8, // 0x76 'v' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x41, 0x41, 0x41, 0x22, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00, - 8, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x41,0x41,0x41,0x49,0x49,0x55,0x22,0x00,0x00,0x00,0x00, + 8, // 0x77 'w' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x41, 0x41, 0x49, 0x49, 0x55, 0x22, 0x00, 0x00, 0x00, 0x00, - 8, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x24,0x18,0x24,0x42,0x42,0x00,0x00,0x00,0x00, + 8, // 0x78 'x' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x24, 0x18, 0x24, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, - 8, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x3e,0x02,0x04,0x78,0x00, + 8, // 0x79 'y' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x04, 0x78, 0x00, - 8, // 0x7a 'z' - 0x00,0x00,0x00,0x00,0x00,0x7e,0x44,0x08,0x10,0x20,0x42,0x7e,0x00,0x00,0x00,0x00, + 8, // 0x7a 'z' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x44, 0x08, 0x10, 0x20, 0x42, 0x7e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x7b '{' - 0x00,0x06,0x08,0x08,0x08,0x08,0x08,0x30,0x08,0x08,0x08,0x08,0x08,0x06,0x00,0x00, + 8, // 0x7b '{' + 0x00, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x30, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06, 0x00, 0x00, - 8, // 0x7c '|' - 0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x00,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x00, + 8, // 0x7c '|' + 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, - 8, // 0x7d '}' - 0x00,0x30,0x08,0x08,0x08,0x08,0x08,0x06,0x08,0x08,0x08,0x08,0x08,0x30,0x00,0x00, + 8, // 0x7d '}' + 0x00, 0x30, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x30, 0x00, 0x00, - 8, // 0x7e '~' - 0x00,0x00,0x39,0x4e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x7e '~' + 0x00, 0x00, 0x39, 0x4e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x7f '' - 0x00,0x00,0x00,0x00,0x00,0x08,0x14,0x22,0x41,0x41,0x7f,0x00,0x00,0x00,0x00,0x00, - 0 -}; + 8, // 0x7f '' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x14, 0x22, 0x41, 0x41, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0}; -const int8u gse8x16_bold[] = -{ - 16, 0, 32, 128-32, +const int8u gse8x16_bold[] = { + 16, 0, 32, 128 - 32, - 0x00,0x00,0x11,0x00,0x22,0x00,0x33,0x00,0x44,0x00,0x55,0x00,0x66,0x00,0x77,0x00,0x88,0x00, - 0x99,0x00,0xaa,0x00,0xbb,0x00,0xcc,0x00,0xdd,0x00,0xee,0x00,0xff,0x00,0x10,0x01,0x21,0x01, - 0x32,0x01,0x43,0x01,0x54,0x01,0x65,0x01,0x76,0x01,0x87,0x01,0x98,0x01,0xa9,0x01,0xba,0x01, - 0xcb,0x01,0xdc,0x01,0xed,0x01,0xfe,0x01,0x0f,0x02,0x20,0x02,0x31,0x02,0x42,0x02,0x53,0x02, - 0x64,0x02,0x75,0x02,0x86,0x02,0x97,0x02,0xa8,0x02,0xb9,0x02,0xca,0x02,0xdb,0x02,0xec,0x02, - 0xfd,0x02,0x0e,0x03,0x1f,0x03,0x30,0x03,0x41,0x03,0x52,0x03,0x63,0x03,0x74,0x03,0x85,0x03, - 0x96,0x03,0xa7,0x03,0xb8,0x03,0xc9,0x03,0xda,0x03,0xeb,0x03,0xfc,0x03,0x0d,0x04,0x1e,0x04, - 0x2f,0x04,0x40,0x04,0x51,0x04,0x62,0x04,0x73,0x04,0x84,0x04,0x95,0x04,0xa6,0x04,0xb7,0x04, - 0xc8,0x04,0xd9,0x04,0xea,0x04,0xfb,0x04,0x0c,0x05,0x1d,0x05,0x2e,0x05,0x3f,0x05,0x50,0x05, - 0x61,0x05,0x72,0x05,0x83,0x05,0x94,0x05,0xa5,0x05,0xb6,0x05,0xc7,0x05,0xd8,0x05,0xe9,0x05, - 0xfa,0x05,0x0b,0x06,0x1c,0x06,0x2d,0x06,0x3e,0x06,0x4f,0x06, + 0x00, 0x00, 0x11, 0x00, 0x22, 0x00, 0x33, 0x00, 0x44, 0x00, 0x55, 0x00, 0x66, 0x00, 0x77, 0x00, 0x88, 0x00, + 0x99, 0x00, 0xaa, 0x00, 0xbb, 0x00, 0xcc, 0x00, 0xdd, 0x00, 0xee, 0x00, 0xff, 0x00, 0x10, 0x01, 0x21, 0x01, + 0x32, 0x01, 0x43, 0x01, 0x54, 0x01, 0x65, 0x01, 0x76, 0x01, 0x87, 0x01, 0x98, 0x01, 0xa9, 0x01, 0xba, 0x01, + 0xcb, 0x01, 0xdc, 0x01, 0xed, 0x01, 0xfe, 0x01, 0x0f, 0x02, 0x20, 0x02, 0x31, 0x02, 0x42, 0x02, 0x53, 0x02, + 0x64, 0x02, 0x75, 0x02, 0x86, 0x02, 0x97, 0x02, 0xa8, 0x02, 0xb9, 0x02, 0xca, 0x02, 0xdb, 0x02, 0xec, 0x02, + 0xfd, 0x02, 0x0e, 0x03, 0x1f, 0x03, 0x30, 0x03, 0x41, 0x03, 0x52, 0x03, 0x63, 0x03, 0x74, 0x03, 0x85, 0x03, + 0x96, 0x03, 0xa7, 0x03, 0xb8, 0x03, 0xc9, 0x03, 0xda, 0x03, 0xeb, 0x03, 0xfc, 0x03, 0x0d, 0x04, 0x1e, 0x04, + 0x2f, 0x04, 0x40, 0x04, 0x51, 0x04, 0x62, 0x04, 0x73, 0x04, 0x84, 0x04, 0x95, 0x04, 0xa6, 0x04, 0xb7, 0x04, + 0xc8, 0x04, 0xd9, 0x04, 0xea, 0x04, 0xfb, 0x04, 0x0c, 0x05, 0x1d, 0x05, 0x2e, 0x05, 0x3f, 0x05, 0x50, 0x05, + 0x61, 0x05, 0x72, 0x05, 0x83, 0x05, 0x94, 0x05, 0xa5, 0x05, 0xb6, 0x05, 0xc7, 0x05, 0xd8, 0x05, 0xe9, 0x05, + 0xfa, 0x05, 0x0b, 0x06, 0x1c, 0x06, 0x2d, 0x06, 0x3e, 0x06, 0x4f, 0x06, - 8, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x21 '!' - 0x00,0x00,0x18,0x3c,0x3c,0x3c,0x3c,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00, + 8, // 0x21 '!' + 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 8, // 0x22 '"' - 0x00,0x66,0x66,0x66,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x22 '"' + 0x00, 0x66, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x23 '#' - 0x00,0x00,0x66,0x66,0x66,0xff,0x66,0x66,0xff,0x66,0x66,0x66,0x00,0x00,0x00,0x00, + 8, // 0x23 '#' + 0x00, 0x00, 0x66, 0x66, 0x66, 0xff, 0x66, 0x66, 0xff, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, - 8, // 0x24 '$' - 0x00,0x08,0x08,0x3e,0x6b,0x6b,0x68,0x3e,0x0b,0x6b,0x6b,0x3e,0x08,0x08,0x00,0x00, + 8, // 0x24 '$' + 0x00, 0x08, 0x08, 0x3e, 0x6b, 0x6b, 0x68, 0x3e, 0x0b, 0x6b, 0x6b, 0x3e, 0x08, 0x08, 0x00, 0x00, - 8, // 0x25 '%' - 0x00,0x00,0x66,0xbe,0xcc,0x0c,0x18,0x18,0x30,0x33,0x65,0x66,0x00,0x00,0x00,0x00, + 8, // 0x25 '%' + 0x00, 0x00, 0x66, 0xbe, 0xcc, 0x0c, 0x18, 0x18, 0x30, 0x33, 0x65, 0x66, 0x00, 0x00, 0x00, 0x00, - 8, // 0x26 '&' - 0x00,0x00,0x1c,0x36,0x36,0x36,0x1c,0x3b,0x6e,0x66,0x66,0x3b,0x00,0x00,0x00,0x00, + 8, // 0x26 '&' + 0x00, 0x00, 0x1c, 0x36, 0x36, 0x36, 0x1c, 0x3b, 0x6e, 0x66, 0x66, 0x3b, 0x00, 0x00, 0x00, 0x00, - 8, // 0x27 ''' - 0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x27 ''' + 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x28 '(' - 0x00,0x06,0x0c,0x18,0x18,0x30,0x30,0x30,0x30,0x18,0x18,0x0c,0x06,0x00,0x00,0x00, + 8, // 0x28 '(' + 0x00, 0x06, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x30, 0x30, 0x18, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x00, - 8, // 0x29 ')' - 0x00,0x30,0x18,0x0c,0x0c,0x06,0x06,0x06,0x06,0x0c,0x0c,0x18,0x30,0x00,0x00,0x00, + 8, // 0x29 ')' + 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x06, 0x06, 0x06, 0x06, 0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, - 8, // 0x2a '*' - 0x00,0x00,0x00,0x00,0x66,0x24,0x18,0xff,0x18,0x24,0x66,0x00,0x00,0x00,0x00,0x00, + 8, // 0x2a '*' + 0x00, 0x00, 0x00, 0x00, 0x66, 0x24, 0x18, 0xff, 0x18, 0x24, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x2b '+' - 0x00,0x00,0x00,0x00,0x18,0x18,0x18,0xff,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00, + 8, // 0x2b '+' + 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x2c ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x20,0x00, + 8, // 0x2c ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x20, 0x00, - 8, // 0x2d '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x2d '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x2e '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00, + 8, // 0x2e '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 8, // 0x2f '/' - 0x00,0x03,0x03,0x06,0x06,0x0c,0x0c,0x18,0x18,0x30,0x30,0x60,0x60,0x00,0x00,0x00, + 8, // 0x2f '/' + 0x00, 0x03, 0x03, 0x06, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0x00, 0x00, 0x00, - 8, // 0x30 '0' - 0x00,0x00,0x3e,0x63,0x63,0x67,0x6b,0x73,0x63,0x63,0x63,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x30 '0' + 0x00, 0x00, 0x3e, 0x63, 0x63, 0x67, 0x6b, 0x73, 0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x31 '1' - 0x00,0x00,0x0c,0x0c,0x1c,0x3c,0x0c,0x0c,0x0c,0x0c,0x0c,0x3f,0x00,0x00,0x00,0x00, + 8, // 0x31 '1' + 0x00, 0x00, 0x0c, 0x0c, 0x1c, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3f, 0x00, 0x00, 0x00, 0x00, - 8, // 0x32 '2' - 0x00,0x00,0x3e,0x63,0x63,0x03,0x06,0x0c,0x18,0x30,0x61,0x7f,0x00,0x00,0x00,0x00, + 8, // 0x32 '2' + 0x00, 0x00, 0x3e, 0x63, 0x63, 0x03, 0x06, 0x0c, 0x18, 0x30, 0x61, 0x7f, 0x00, 0x00, 0x00, 0x00, - 8, // 0x33 '3' - 0x00,0x00,0x7f,0x43,0x06,0x0c,0x1e,0x03,0x03,0x03,0x63,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x33 '3' + 0x00, 0x00, 0x7f, 0x43, 0x06, 0x0c, 0x1e, 0x03, 0x03, 0x03, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x34 '4' - 0x00,0x00,0x06,0x0c,0x18,0x32,0x66,0x66,0x7f,0x06,0x06,0x0f,0x00,0x00,0x00,0x00, + 8, // 0x34 '4' + 0x00, 0x00, 0x06, 0x0c, 0x18, 0x32, 0x66, 0x66, 0x7f, 0x06, 0x06, 0x0f, 0x00, 0x00, 0x00, 0x00, - 8, // 0x35 '5' - 0x00,0x00,0x7f,0x61,0x60,0x60,0x7e,0x03,0x03,0x03,0x63,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x35 '5' + 0x00, 0x00, 0x7f, 0x61, 0x60, 0x60, 0x7e, 0x03, 0x03, 0x03, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x36 '6' - 0x00,0x00,0x1e,0x30,0x60,0x60,0x7e,0x63,0x63,0x63,0x63,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x36 '6' + 0x00, 0x00, 0x1e, 0x30, 0x60, 0x60, 0x7e, 0x63, 0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x37 '7' - 0x00,0x00,0x7f,0x63,0x63,0x03,0x06,0x0c,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, + 8, // 0x37 '7' + 0x00, 0x00, 0x7f, 0x63, 0x63, 0x03, 0x06, 0x0c, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 8, // 0x38 '8' - 0x00,0x00,0x3e,0x63,0x63,0x63,0x3e,0x63,0x63,0x63,0x63,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x38 '8' + 0x00, 0x00, 0x3e, 0x63, 0x63, 0x63, 0x3e, 0x63, 0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x39 '9' - 0x00,0x00,0x3e,0x63,0x63,0x63,0x63,0x3f,0x03,0x03,0x06,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x39 '9' + 0x00, 0x00, 0x3e, 0x63, 0x63, 0x63, 0x63, 0x3f, 0x03, 0x03, 0x06, 0x3c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x3a ':' - 0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00, + 8, // 0x3a ':' + 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x3b ';' - 0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x60,0x40,0x00, + 8, // 0x3b ';' + 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x60, 0x40, 0x00, - 8, // 0x3c '<' - 0x00,0x00,0x00,0x06,0x0c,0x18,0x30,0x60,0x30,0x18,0x0c,0x06,0x00,0x00,0x00,0x00, + 8, // 0x3c '<' + 0x00, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x00, 0x00, - 8, // 0x3d '=' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x00,0x7f,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x3d '=' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x3e '>' - 0x00,0x00,0x00,0x30,0x18,0x0c,0x06,0x03,0x06,0x0c,0x18,0x30,0x00,0x00,0x00,0x00, + 8, // 0x3e '>' + 0x00, 0x00, 0x00, 0x30, 0x18, 0x0c, 0x06, 0x03, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, - 8, // 0x3f '?' - 0x00,0x00,0x3e,0x63,0x63,0x63,0x06,0x0c,0x0c,0x00,0x0c,0x0c,0x00,0x00,0x00,0x00, + 8, // 0x3f '?' + 0x00, 0x00, 0x3e, 0x63, 0x63, 0x63, 0x06, 0x0c, 0x0c, 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x40 '@' - 0x00,0x00,0x7c,0x86,0x03,0x73,0xdb,0xdb,0xdb,0xdb,0xdb,0x6e,0x00,0x00,0x00,0x00, + 8, // 0x40 '@' + 0x00, 0x00, 0x7c, 0x86, 0x03, 0x73, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x6e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x41 'A' - 0x00,0x00,0x08,0x1c,0x36,0x63,0x63,0x63,0x7f,0x63,0x63,0x63,0x00,0x00,0x00,0x00, + 8, // 0x41 'A' + 0x00, 0x00, 0x08, 0x1c, 0x36, 0x63, 0x63, 0x63, 0x7f, 0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00, - 8, // 0x42 'B' - 0x00,0x00,0x7e,0x33,0x33,0x33,0x3e,0x33,0x33,0x33,0x33,0x7e,0x00,0x00,0x00,0x00, + 8, // 0x42 'B' + 0x00, 0x00, 0x7e, 0x33, 0x33, 0x33, 0x3e, 0x33, 0x33, 0x33, 0x33, 0x7e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x43 'C' - 0x00,0x00,0x1e,0x33,0x61,0x60,0x60,0x60,0x60,0x61,0x33,0x1e,0x00,0x00,0x00,0x00, + 8, // 0x43 'C' + 0x00, 0x00, 0x1e, 0x33, 0x61, 0x60, 0x60, 0x60, 0x60, 0x61, 0x33, 0x1e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x44 'D' - 0x00,0x00,0x7c,0x36,0x33,0x33,0x33,0x33,0x33,0x33,0x36,0x7c,0x00,0x00,0x00,0x00, + 8, // 0x44 'D' + 0x00, 0x00, 0x7c, 0x36, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x36, 0x7c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x45 'E' - 0x00,0x00,0x7f,0x33,0x31,0x34,0x3c,0x34,0x30,0x31,0x33,0x7f,0x00,0x00,0x00,0x00, + 8, // 0x45 'E' + 0x00, 0x00, 0x7f, 0x33, 0x31, 0x34, 0x3c, 0x34, 0x30, 0x31, 0x33, 0x7f, 0x00, 0x00, 0x00, 0x00, - 8, // 0x46 'F' - 0x00,0x00,0x7f,0x33,0x31,0x34,0x3c,0x34,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00, + 8, // 0x46 'F' + 0x00, 0x00, 0x7f, 0x33, 0x31, 0x34, 0x3c, 0x34, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, 0x00, - 8, // 0x47 'G' - 0x00,0x00,0x1f,0x33,0x61,0x60,0x60,0x6f,0x63,0x63,0x33,0x1e,0x00,0x00,0x00,0x00, + 8, // 0x47 'G' + 0x00, 0x00, 0x1f, 0x33, 0x61, 0x60, 0x60, 0x6f, 0x63, 0x63, 0x33, 0x1e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x48 'H' - 0x00,0x00,0x63,0x63,0x63,0x63,0x7f,0x63,0x63,0x63,0x63,0x63,0x00,0x00,0x00,0x00, + 8, // 0x48 'H' + 0x00, 0x00, 0x63, 0x63, 0x63, 0x63, 0x7f, 0x63, 0x63, 0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00, - 8, // 0x49 'I' - 0x00,0x00,0x1e,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x00, + 8, // 0x49 'I' + 0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x4a 'J' - 0x00,0x00,0x0f,0x06,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x4a 'J' + 0x00, 0x00, 0x0f, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x4b 'K' - 0x00,0x00,0x73,0x33,0x36,0x36,0x3c,0x36,0x36,0x33,0x33,0x73,0x00,0x00,0x00,0x00, + 8, // 0x4b 'K' + 0x00, 0x00, 0x73, 0x33, 0x36, 0x36, 0x3c, 0x36, 0x36, 0x33, 0x33, 0x73, 0x00, 0x00, 0x00, 0x00, - 8, // 0x4c 'L' - 0x00,0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x33,0x7f,0x00,0x00,0x00,0x00, + 8, // 0x4c 'L' + 0x00, 0x00, 0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x33, 0x7f, 0x00, 0x00, 0x00, 0x00, - 8, // 0x4d 'M' - 0x00,0x00,0x63,0x63,0x77,0x77,0x7f,0x6b,0x6b,0x63,0x63,0x63,0x00,0x00,0x00,0x00, + 8, // 0x4d 'M' + 0x00, 0x00, 0x63, 0x63, 0x77, 0x77, 0x7f, 0x6b, 0x6b, 0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00, - 8, // 0x4e 'N' - 0x00,0x00,0x63,0x63,0x73,0x7b,0x6f,0x67,0x63,0x63,0x63,0x63,0x00,0x00,0x00,0x00, + 8, // 0x4e 'N' + 0x00, 0x00, 0x63, 0x63, 0x73, 0x7b, 0x6f, 0x67, 0x63, 0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00, - 8, // 0x4f 'O' - 0x00,0x00,0x1c,0x36,0x63,0x63,0x63,0x63,0x63,0x63,0x36,0x1c,0x00,0x00,0x00,0x00, + 8, // 0x4f 'O' + 0x00, 0x00, 0x1c, 0x36, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x50 'P' - 0x00,0x00,0x7e,0x33,0x33,0x33,0x33,0x3e,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00, + 8, // 0x50 'P' + 0x00, 0x00, 0x7e, 0x33, 0x33, 0x33, 0x33, 0x3e, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, 0x00, - 8, // 0x51 'Q' - 0x00,0x00,0x1c,0x36,0x63,0x63,0x63,0x63,0x63,0x6f,0x36,0x1e,0x03,0x00,0x00,0x00, + 8, // 0x51 'Q' + 0x00, 0x00, 0x1c, 0x36, 0x63, 0x63, 0x63, 0x63, 0x63, 0x6f, 0x36, 0x1e, 0x03, 0x00, 0x00, 0x00, - 8, // 0x52 'R' - 0x00,0x00,0x7e,0x33,0x33,0x33,0x33,0x3e,0x36,0x33,0x33,0x73,0x00,0x00,0x00,0x00, + 8, // 0x52 'R' + 0x00, 0x00, 0x7e, 0x33, 0x33, 0x33, 0x33, 0x3e, 0x36, 0x33, 0x33, 0x73, 0x00, 0x00, 0x00, 0x00, - 8, // 0x53 'S' - 0x00,0x00,0x3e,0x63,0x63,0x30,0x18,0x0c,0x06,0x63,0x63,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x53 'S' + 0x00, 0x00, 0x3e, 0x63, 0x63, 0x30, 0x18, 0x0c, 0x06, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x54 'T' - 0x00,0x00,0x3f,0x3f,0x2d,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x00, + 8, // 0x54 'T' + 0x00, 0x00, 0x3f, 0x3f, 0x2d, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x55 'U' - 0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x55 'U' + 0x00, 0x00, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x56 'V' - 0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x36,0x1c,0x08,0x00,0x00,0x00,0x00, + 8, // 0x56 'V' + 0x00, 0x00, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x36, 0x1c, 0x08, 0x00, 0x00, 0x00, 0x00, - 8, // 0x57 'W' - 0x00,0x00,0x63,0x63,0x63,0x6b,0x6b,0x7f,0x77,0x77,0x63,0x63,0x00,0x00,0x00,0x00, + 8, // 0x57 'W' + 0x00, 0x00, 0x63, 0x63, 0x63, 0x6b, 0x6b, 0x7f, 0x77, 0x77, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00, - 8, // 0x58 'X' - 0x00,0x00,0x63,0x63,0x63,0x36,0x1c,0x1c,0x36,0x63,0x63,0x63,0x00,0x00,0x00,0x00, + 8, // 0x58 'X' + 0x00, 0x00, 0x63, 0x63, 0x63, 0x36, 0x1c, 0x1c, 0x36, 0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00, - 8, // 0x59 'Y' - 0x00,0x00,0x33,0x33,0x33,0x33,0x1e,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x00, + 8, // 0x59 'Y' + 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x5a 'Z' - 0x00,0x00,0x7f,0x63,0x43,0x06,0x0c,0x18,0x30,0x61,0x63,0x7f,0x00,0x00,0x00,0x00, + 8, // 0x5a 'Z' + 0x00, 0x00, 0x7f, 0x63, 0x43, 0x06, 0x0c, 0x18, 0x30, 0x61, 0x63, 0x7f, 0x00, 0x00, 0x00, 0x00, - 8, // 0x5b '[' - 0x00,0x1f,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1f,0x00,0x00,0x00, + 8, // 0x5b '[' + 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, - 8, // 0x5c '\' - 0x00,0x60,0x60,0x30,0x30,0x18,0x18,0x0c,0x0c,0x06,0x06,0x03,0x03,0x00,0x00,0x00, + 8, // 0x5c '\' + 0x00, 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x0c, 0x0c, 0x06, 0x06, 0x03, 0x03, 0x00, 0x00, 0x00, - 8, // 0x5d ']' - 0x00,0x7c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x7c,0x00,0x00,0x00, + 8, // 0x5d ']' + 0x00, 0x7c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x7c, 0x00, 0x00, 0x00, - 8, // 0x5e '^' - 0x00,0x00,0x08,0x1c,0x36,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x5e '^' + 0x00, 0x00, 0x08, 0x1c, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x5f '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00, + 8, // 0x5f '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 8, // 0x60 '`' - 0x00,0x00,0x18,0x18,0x18,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x60 '`' + 0x00, 0x00, 0x18, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x3c,0x66,0x06,0x3e,0x66,0x66,0x3b,0x00,0x00,0x00,0x00, + 8, // 0x61 'a' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x06, 0x3e, 0x66, 0x66, 0x3b, 0x00, 0x00, 0x00, 0x00, - 8, // 0x62 'b' - 0x00,0x00,0x70,0x30,0x30,0x3c,0x36,0x33,0x33,0x33,0x33,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x62 'b' + 0x00, 0x00, 0x70, 0x30, 0x30, 0x3c, 0x36, 0x33, 0x33, 0x33, 0x33, 0x3e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x3e,0x63,0x63,0x60,0x60,0x63,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x63 'c' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x63, 0x63, 0x60, 0x60, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x64 'd' - 0x00,0x00,0x0e,0x06,0x06,0x1e,0x36,0x66,0x66,0x66,0x66,0x3b,0x00,0x00,0x00,0x00, + 8, // 0x64 'd' + 0x00, 0x00, 0x0e, 0x06, 0x06, 0x1e, 0x36, 0x66, 0x66, 0x66, 0x66, 0x3b, 0x00, 0x00, 0x00, 0x00, - 8, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x3e,0x63,0x63,0x7f,0x60,0x63,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x65 'e' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x63, 0x63, 0x7f, 0x60, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x66 'f' - 0x00,0x00,0x0e,0x1b,0x1b,0x18,0x3c,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, + 8, // 0x66 'f' + 0x00, 0x00, 0x0e, 0x1b, 0x1b, 0x18, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, - 8, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x3b,0x66,0x66,0x66,0x66,0x66,0x3e,0x06,0x66,0x3c,0x00, + 8, // 0x67 'g' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x66, 0x3c, 0x00, - 8, // 0x68 'h' - 0x00,0x00,0x70,0x30,0x30,0x36,0x3b,0x33,0x33,0x33,0x33,0x73,0x00,0x00,0x00,0x00, + 8, // 0x68 'h' + 0x00, 0x00, 0x70, 0x30, 0x30, 0x36, 0x3b, 0x33, 0x33, 0x33, 0x33, 0x73, 0x00, 0x00, 0x00, 0x00, - 8, // 0x69 'i' - 0x00,0x00,0x0c,0x0c,0x00,0x1c,0x0c,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x00, + 8, // 0x69 'i' + 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x1c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x6a 'j' - 0x00,0x00,0x06,0x06,0x00,0x0e,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3c,0x00,0x00, + 8, // 0x6a 'j' + 0x00, 0x00, 0x06, 0x06, 0x00, 0x0e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00, 0x00, - 8, // 0x6b 'k' - 0x00,0x00,0x70,0x30,0x30,0x33,0x33,0x36,0x3c,0x36,0x33,0x73,0x00,0x00,0x00,0x00, + 8, // 0x6b 'k' + 0x00, 0x00, 0x70, 0x30, 0x30, 0x33, 0x33, 0x36, 0x3c, 0x36, 0x33, 0x73, 0x00, 0x00, 0x00, 0x00, - 8, // 0x6c 'l' - 0x00,0x00,0x1c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x00, + 8, // 0x6c 'l' + 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x6d 'm' - 0x00,0x00,0x00,0x00,0x00,0x76,0x7f,0x6b,0x6b,0x6b,0x63,0x63,0x00,0x00,0x00,0x00, + 8, // 0x6d 'm' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x7f, 0x6b, 0x6b, 0x6b, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00, - 8, // 0x6e 'n' - 0x00,0x00,0x00,0x00,0x00,0x6e,0x33,0x33,0x33,0x33,0x33,0x33,0x00,0x00,0x00,0x00, + 8, // 0x6e 'n' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x00, 0x00, 0x00, 0x00, - 8, // 0x6f 'o' - 0x00,0x00,0x00,0x00,0x00,0x3e,0x63,0x63,0x63,0x63,0x63,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x6f 'o' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x63, 0x63, 0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0x6e,0x33,0x33,0x33,0x33,0x33,0x3e,0x30,0x30,0x78,0x00, + 8, // 0x70 'p' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3e, 0x30, 0x30, 0x78, 0x00, - 8, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x3b,0x66,0x66,0x66,0x66,0x66,0x3e,0x06,0x06,0x0f,0x00, + 8, // 0x71 'q' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x06, 0x0f, 0x00, - 8, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0x6e,0x3b,0x33,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00, + 8, // 0x72 'r' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x3b, 0x33, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, 0x00, - 8, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x3e,0x63,0x60,0x3e,0x03,0x63,0x3e,0x00,0x00,0x00,0x00, + 8, // 0x73 's' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x63, 0x60, 0x3e, 0x03, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x74 't' - 0x00,0x00,0x08,0x18,0x18,0x7e,0x18,0x18,0x18,0x18,0x1b,0x0e,0x00,0x00,0x00,0x00, + 8, // 0x74 't' + 0x00, 0x00, 0x08, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x1b, 0x0e, 0x00, 0x00, 0x00, 0x00, - 8, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x3b,0x00,0x00,0x00,0x00, + 8, // 0x75 'u' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3b, 0x00, 0x00, 0x00, 0x00, - 8, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x63,0x63,0x36,0x1c,0x08,0x00,0x00,0x00,0x00, + 8, // 0x76 'v' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x63, 0x63, 0x63, 0x36, 0x1c, 0x08, 0x00, 0x00, 0x00, 0x00, - 8, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x6b,0x6b,0x7f,0x36,0x36,0x00,0x00,0x00,0x00, + 8, // 0x77 'w' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x63, 0x6b, 0x6b, 0x7f, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, - 8, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x36,0x1c,0x36,0x63,0x63,0x00,0x00,0x00,0x00, + 8, // 0x78 'x' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x63, 0x36, 0x1c, 0x36, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00, - 8, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x63,0x3f,0x03,0x06,0x7c,0x00, + 8, // 0x79 'y' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x3f, 0x03, 0x06, 0x7c, 0x00, - 8, // 0x7a 'z' - 0x00,0x00,0x00,0x00,0x00,0x7f,0x63,0x06,0x0c,0x18,0x31,0x7f,0x00,0x00,0x00,0x00, + 8, // 0x7a 'z' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x63, 0x06, 0x0c, 0x18, 0x31, 0x7f, 0x00, 0x00, 0x00, 0x00, - 8, // 0x7b '{' - 0x00,0x03,0x04,0x0c,0x0c,0x0c,0x08,0x30,0x08,0x0c,0x0c,0x0c,0x04,0x03,0x00,0x00, + 8, // 0x7b '{' + 0x00, 0x03, 0x04, 0x0c, 0x0c, 0x0c, 0x08, 0x30, 0x08, 0x0c, 0x0c, 0x0c, 0x04, 0x03, 0x00, 0x00, - 8, // 0x7c '|' - 0x00,0x00,0x0c,0x0c,0x0c,0x0c,0x0c,0x00,0x0c,0x0c,0x0c,0x0c,0x0c,0x00,0x00,0x00, + 8, // 0x7c '|' + 0x00, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x00, 0x00, 0x00, - 8, // 0x7d '}' - 0x00,0x60,0x10,0x18,0x18,0x18,0x08,0x06,0x08,0x18,0x18,0x18,0x10,0x60,0x00,0x00, + 8, // 0x7d '}' + 0x00, 0x60, 0x10, 0x18, 0x18, 0x18, 0x08, 0x06, 0x08, 0x18, 0x18, 0x18, 0x10, 0x60, 0x00, 0x00, - 8, // 0x7e '~' - 0x00,0x00,0x3b,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x7e '~' + 0x00, 0x00, 0x3b, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x7f '' - 0x00,0x00,0x00,0x00,0x00,0x08,0x1c,0x36,0x63,0x63,0x7f,0x00,0x00,0x00,0x00,0x00, - 0 -}; + 8, // 0x7f '' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x1c, 0x36, 0x63, 0x63, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0}; -const int8u mcs11_prop[] = -{ - 11, 2, 32, 128-32, - 0x00,0x00,0x0C,0x00,0x18,0x00,0x24,0x00,0x30,0x00,0x3C,0x00,0x48,0x00,0x54,0x00,0x60,0x00, - 0x6C,0x00,0x78,0x00,0x84,0x00,0x90,0x00,0x9C,0x00,0xA8,0x00,0xB4,0x00,0xC0,0x00,0xCC,0x00, - 0xD8,0x00,0xE4,0x00,0xF0,0x00,0xFC,0x00,0x08,0x01,0x14,0x01,0x20,0x01,0x2C,0x01,0x38,0x01, - 0x44,0x01,0x50,0x01,0x5C,0x01,0x68,0x01,0x74,0x01,0x80,0x01,0x8C,0x01,0x98,0x01,0xA4,0x01, - 0xB0,0x01,0xBC,0x01,0xC8,0x01,0xD4,0x01,0xE0,0x01,0xEC,0x01,0xF8,0x01,0x04,0x02,0x10,0x02, - 0x1C,0x02,0x28,0x02,0x34,0x02,0x40,0x02,0x4C,0x02,0x58,0x02,0x64,0x02,0x70,0x02,0x7C,0x02, - 0x88,0x02,0x94,0x02,0xA0,0x02,0xAC,0x02,0xB8,0x02,0xC4,0x02,0xD0,0x02,0xDC,0x02,0xE8,0x02, - 0xF4,0x02,0x00,0x03,0x0C,0x03,0x18,0x03,0x24,0x03,0x30,0x03,0x3C,0x03,0x48,0x03,0x54,0x03, - 0x60,0x03,0x6C,0x03,0x78,0x03,0x84,0x03,0x90,0x03,0x9C,0x03,0xA8,0x03,0xB4,0x03,0xC0,0x03, - 0xCC,0x03,0xD8,0x03,0xE4,0x03,0xF0,0x03,0xFC,0x03,0x08,0x04,0x14,0x04,0x20,0x04,0x2C,0x04, - 0x38,0x04,0x44,0x04,0x50,0x04,0x5C,0x04,0x68,0x04,0x74,0x04, +const int8u mcs11_prop[] = { + 11, 2, 32, 128 - 32, 0x00, 0x00, 0x0C, 0x00, 0x18, 0x00, 0x24, 0x00, 0x30, 0x00, 0x3C, 0x00, 0x48, 0x00, + 0x54, 0x00, 0x60, 0x00, 0x6C, 0x00, 0x78, 0x00, 0x84, 0x00, 0x90, 0x00, 0x9C, 0x00, 0xA8, 0x00, 0xB4, 0x00, + 0xC0, 0x00, 0xCC, 0x00, 0xD8, 0x00, 0xE4, 0x00, 0xF0, 0x00, 0xFC, 0x00, 0x08, 0x01, 0x14, 0x01, 0x20, 0x01, + 0x2C, 0x01, 0x38, 0x01, 0x44, 0x01, 0x50, 0x01, 0x5C, 0x01, 0x68, 0x01, 0x74, 0x01, 0x80, 0x01, 0x8C, 0x01, + 0x98, 0x01, 0xA4, 0x01, 0xB0, 0x01, 0xBC, 0x01, 0xC8, 0x01, 0xD4, 0x01, 0xE0, 0x01, 0xEC, 0x01, 0xF8, 0x01, + 0x04, 0x02, 0x10, 0x02, 0x1C, 0x02, 0x28, 0x02, 0x34, 0x02, 0x40, 0x02, 0x4C, 0x02, 0x58, 0x02, 0x64, 0x02, + 0x70, 0x02, 0x7C, 0x02, 0x88, 0x02, 0x94, 0x02, 0xA0, 0x02, 0xAC, 0x02, 0xB8, 0x02, 0xC4, 0x02, 0xD0, 0x02, + 0xDC, 0x02, 0xE8, 0x02, 0xF4, 0x02, 0x00, 0x03, 0x0C, 0x03, 0x18, 0x03, 0x24, 0x03, 0x30, 0x03, 0x3C, 0x03, + 0x48, 0x03, 0x54, 0x03, 0x60, 0x03, 0x6C, 0x03, 0x78, 0x03, 0x84, 0x03, 0x90, 0x03, 0x9C, 0x03, 0xA8, 0x03, + 0xB4, 0x03, 0xC0, 0x03, 0xCC, 0x03, 0xD8, 0x03, 0xE4, 0x03, 0xF0, 0x03, 0xFC, 0x03, 0x08, 0x04, 0x14, 0x04, + 0x20, 0x04, 0x2C, 0x04, 0x38, 0x04, 0x44, 0x04, 0x50, 0x04, 0x5C, 0x04, 0x68, 0x04, 0x74, 0x04, - 5, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x21 '!' - 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00, + 4, // 0x21 '!' + 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x00, - 4, // 0x22 '"' - 0x50,0x50,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x22 '"' + 0x50, 0x50, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x23 '#' - 0x00,0x28,0x28,0x7C,0x28,0x28,0x28,0x7C,0x28,0x28,0x00, + 6, // 0x23 '#' + 0x00, 0x28, 0x28, 0x7C, 0x28, 0x28, 0x28, 0x7C, 0x28, 0x28, 0x00, - 6, // 0x24 '$' - 0x10,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x10, + 6, // 0x24 '$' + 0x10, 0x10, 0x38, 0x54, 0x50, 0x38, 0x14, 0x54, 0x38, 0x10, 0x10, - 6, // 0x25 '%' - 0x00,0x00,0x68,0xA8,0xD0,0x10,0x20,0x2C,0x54,0x58,0x00, + 6, // 0x25 '%' + 0x00, 0x00, 0x68, 0xA8, 0xD0, 0x10, 0x20, 0x2C, 0x54, 0x58, 0x00, - 6, // 0x26 '&' - 0x00,0x20,0x50,0x50,0x50,0x20,0x54,0x54,0x48,0x34,0x00, + 6, // 0x26 '&' + 0x00, 0x20, 0x50, 0x50, 0x50, 0x20, 0x54, 0x54, 0x48, 0x34, 0x00, - 3, // 0x27 ''' - 0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 3, // 0x27 ''' + 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x28 '(' - 0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10, + 4, // 0x28 '(' + 0x10, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x10, - 5, // 0x29 ')' - 0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40, + 5, // 0x29 ')' + 0x40, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x40, - 6, // 0x2A '*' - 0x00,0x00,0x28,0x7C,0x38,0x7C,0x28,0x00,0x00,0x00,0x00, + 6, // 0x2A '*' + 0x00, 0x00, 0x28, 0x7C, 0x38, 0x7C, 0x28, 0x00, 0x00, 0x00, 0x00, - 6, // 0x2B '+' - 0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, + 6, // 0x2B '+' + 0x00, 0x00, 0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x00, 0x00, - 4, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0xC0, + 4, // 0x2C ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0xC0, - 6, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, + 6, // 0x2D '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00, + 4, // 0x2E '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, - 7, // 0x2F '/' - 0x00,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40, + 7, // 0x2F '/' + 0x00, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, - 6, // 0x30 '0' - 0x00,0x38,0x44,0x44,0x54,0x54,0x54,0x44,0x44,0x38,0x00, + 6, // 0x30 '0' + 0x00, 0x38, 0x44, 0x44, 0x54, 0x54, 0x54, 0x44, 0x44, 0x38, 0x00, - 4, // 0x31 '1' - 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00, + 4, // 0x31 '1' + 0x00, 0x20, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, - 6, // 0x32 '2' - 0x00,0x38,0x44,0x44,0x04,0x08,0x10,0x20,0x40,0x7C,0x00, + 6, // 0x32 '2' + 0x00, 0x38, 0x44, 0x44, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00, - 6, // 0x33 '3' - 0x00,0x38,0x44,0x04,0x04,0x38,0x04,0x04,0x44,0x38,0x00, + 6, // 0x33 '3' + 0x00, 0x38, 0x44, 0x04, 0x04, 0x38, 0x04, 0x04, 0x44, 0x38, 0x00, - 6, // 0x34 '4' - 0x00,0x08,0x18,0x18,0x28,0x28,0x48,0x7C,0x08,0x08,0x00, + 6, // 0x34 '4' + 0x00, 0x08, 0x18, 0x18, 0x28, 0x28, 0x48, 0x7C, 0x08, 0x08, 0x00, - 6, // 0x35 '5' - 0x00,0x7C,0x40,0x40,0x78,0x44,0x04,0x04,0x44,0x38,0x00, + 6, // 0x35 '5' + 0x00, 0x7C, 0x40, 0x40, 0x78, 0x44, 0x04, 0x04, 0x44, 0x38, 0x00, - 6, // 0x36 '6' - 0x00,0x38,0x44,0x40,0x40,0x78,0x44,0x44,0x44,0x38,0x00, + 6, // 0x36 '6' + 0x00, 0x38, 0x44, 0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x38, 0x00, - 6, // 0x37 '7' - 0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x00, + 6, // 0x37 '7' + 0x00, 0x7C, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x20, 0x00, - 6, // 0x38 '8' - 0x00,0x38,0x44,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00, + 6, // 0x38 '8' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, - 6, // 0x39 '9' - 0x00,0x38,0x44,0x44,0x44,0x3C,0x04,0x04,0x44,0x38,0x00, + 6, // 0x39 '9' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x04, 0x44, 0x38, 0x00, - 4, // 0x3A ':' - 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x00, + 4, // 0x3A ':' + 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, - 4, // 0x3B ';' - 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0xC0, + 4, // 0x3B ';' + 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0xC0, - 6, // 0x3C '<' - 0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00, + 6, // 0x3C '<' + 0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, - 6, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00, + 6, // 0x3D '=' + 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, - 6, // 0x3E '>' - 0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00, + 6, // 0x3E '>' + 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, - 6, // 0x3F '?' - 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x10,0x00,0x10,0x00, + 6, // 0x3F '?' + 0x00, 0x38, 0x44, 0x04, 0x04, 0x08, 0x10, 0x10, 0x00, 0x10, 0x00, - 6, // 0x40 '@' - 0x00,0x38,0x44,0x44,0x5C,0x54,0x54,0x4C,0x40,0x38,0x00, + 6, // 0x40 '@' + 0x00, 0x38, 0x44, 0x44, 0x5C, 0x54, 0x54, 0x4C, 0x40, 0x38, 0x00, - 6, // 0x41 'A' - 0x00,0x38,0x44,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x00, + 6, // 0x41 'A' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x44, 0x00, - 6, // 0x42 'B' - 0x00,0x78,0x44,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00, + 6, // 0x42 'B' + 0x00, 0x78, 0x44, 0x44, 0x44, 0x78, 0x44, 0x44, 0x44, 0x78, 0x00, - 6, // 0x43 'C' - 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x40,0x44,0x38,0x00, + 6, // 0x43 'C' + 0x00, 0x38, 0x44, 0x40, 0x40, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, - 6, // 0x44 'D' - 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x44,0x48,0x70,0x00, + 6, // 0x44 'D' + 0x00, 0x70, 0x48, 0x44, 0x44, 0x44, 0x44, 0x44, 0x48, 0x70, 0x00, - 6, // 0x45 'E' - 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x7C,0x00, + 6, // 0x45 'E' + 0x00, 0x7C, 0x40, 0x40, 0x40, 0x78, 0x40, 0x40, 0x40, 0x7C, 0x00, - 6, // 0x46 'F' - 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00, + 6, // 0x46 'F' + 0x00, 0x7C, 0x40, 0x40, 0x40, 0x78, 0x40, 0x40, 0x40, 0x40, 0x00, - 6, // 0x47 'G' - 0x00,0x38,0x44,0x40,0x40,0x5C,0x44,0x44,0x4C,0x34,0x00, + 6, // 0x47 'G' + 0x00, 0x38, 0x44, 0x40, 0x40, 0x5C, 0x44, 0x44, 0x4C, 0x34, 0x00, - 6, // 0x48 'H' - 0x00,0x44,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00, + 6, // 0x48 'H' + 0x00, 0x44, 0x44, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x44, 0x44, 0x00, - 4, // 0x49 'I' - 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00, + 4, // 0x49 'I' + 0x00, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, - 6, // 0x4A 'J' - 0x00,0x1C,0x08,0x08,0x08,0x08,0x08,0x08,0x48,0x30,0x00, + 6, // 0x4A 'J' + 0x00, 0x1C, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x48, 0x30, 0x00, - 6, // 0x4B 'K' - 0x00,0x44,0x48,0x50,0x60,0x60,0x50,0x48,0x44,0x44,0x00, + 6, // 0x4B 'K' + 0x00, 0x44, 0x48, 0x50, 0x60, 0x60, 0x50, 0x48, 0x44, 0x44, 0x00, - 6, // 0x4C 'L' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00, + 6, // 0x4C 'L' + 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7C, 0x00, - 8, // 0x4D 'M' - 0x00,0x41,0x63,0x55,0x49,0x49,0x41,0x41,0x41,0x41,0x00, + 8, // 0x4D 'M' + 0x00, 0x41, 0x63, 0x55, 0x49, 0x49, 0x41, 0x41, 0x41, 0x41, 0x00, - 7, // 0x4E 'N' - 0x00,0x42,0x42,0x62,0x52,0x4A,0x46,0x42,0x42,0x42,0x00, + 7, // 0x4E 'N' + 0x00, 0x42, 0x42, 0x62, 0x52, 0x4A, 0x46, 0x42, 0x42, 0x42, 0x00, - 6, // 0x4F 'O' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00, + 6, // 0x4F 'O' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, - 6, // 0x50 'P' - 0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x40,0x00, + 6, // 0x50 'P' + 0x00, 0x78, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, 0x40, 0x00, - 6, // 0x51 'Q' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00, + 6, // 0x51 'Q' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x54, 0x48, 0x34, 0x00, - 6, // 0x52 'R' - 0x00,0x78,0x44,0x44,0x44,0x78,0x44,0x44,0x44,0x44,0x00, + 6, // 0x52 'R' + 0x00, 0x78, 0x44, 0x44, 0x44, 0x78, 0x44, 0x44, 0x44, 0x44, 0x00, - 6, // 0x53 'S' - 0x00,0x38,0x44,0x40,0x40,0x38,0x04,0x04,0x44,0x38,0x00, + 6, // 0x53 'S' + 0x00, 0x38, 0x44, 0x40, 0x40, 0x38, 0x04, 0x04, 0x44, 0x38, 0x00, - 6, // 0x54 'T' - 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00, + 6, // 0x54 'T' + 0x00, 0x7C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, - 6, // 0x55 'U' - 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00, + 6, // 0x55 'U' + 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, - 6, // 0x56 'V' - 0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00, + 6, // 0x56 'V' + 0x00, 0x44, 0x44, 0x44, 0x44, 0x28, 0x28, 0x28, 0x10, 0x10, 0x00, - 8, // 0x57 'W' - 0x00,0x41,0x41,0x41,0x41,0x49,0x49,0x49,0x55,0x22,0x00, + 8, // 0x57 'W' + 0x00, 0x41, 0x41, 0x41, 0x41, 0x49, 0x49, 0x49, 0x55, 0x22, 0x00, - 6, // 0x58 'X' - 0x00,0x44,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00, + 6, // 0x58 'X' + 0x00, 0x44, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x44, 0x00, - 6, // 0x59 'Y' - 0x00,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x10,0x00, + 6, // 0x59 'Y' + 0x00, 0x44, 0x44, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, - 6, // 0x5A 'Z' - 0x00,0x7C,0x04,0x04,0x08,0x10,0x20,0x40,0x40,0x7C,0x00, + 6, // 0x5A 'Z' + 0x00, 0x7C, 0x04, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x7C, 0x00, - 5, // 0x5B '[' - 0x30,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x30, + 5, // 0x5B '[' + 0x30, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x30, - 7, // 0x5C '\' - 0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00, + 7, // 0x5C '\' + 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x00, - 4, // 0x5D ']' - 0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x60, + 4, // 0x5D ']' + 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x60, - 6, // 0x5E '^' - 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x5E '^' + 0x00, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00, + 6, // 0x5F '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, - 4, // 0x60 '`' - 0x00,0x40,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x60 '`' + 0x00, 0x40, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x61 'a' - 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x44,0x3C,0x00, + 6, // 0x61 'a' + 0x00, 0x00, 0x00, 0x38, 0x04, 0x3C, 0x44, 0x44, 0x44, 0x3C, 0x00, - 6, // 0x62 'b' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x00, + 6, // 0x62 'b' + 0x00, 0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x44, 0x44, 0x78, 0x00, - 6, // 0x63 'c' - 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x44,0x38,0x00, + 6, // 0x63 'c' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, - 6, // 0x64 'd' - 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x00, + 6, // 0x64 'd' + 0x00, 0x04, 0x04, 0x3C, 0x44, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x00, - 6, // 0x65 'e' - 0x00,0x00,0x00,0x38,0x44,0x44,0x7C,0x40,0x44,0x38,0x00, + 6, // 0x65 'e' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x7C, 0x40, 0x44, 0x38, 0x00, - 4, // 0x66 'f' - 0x00,0x10,0x20,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x00, + 4, // 0x66 'f' + 0x00, 0x10, 0x20, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, - 6, // 0x67 'g' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x3C,0x04,0x44,0x38, + 6, // 0x67 'g' + 0x00, 0x00, 0x00, 0x3C, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x44, 0x38, - 6, // 0x68 'h' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x44,0x00, + 6, // 0x68 'h' + 0x00, 0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x00, - 2, // 0x69 'i' - 0x00,0x40,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00, + 2, // 0x69 'i' + 0x00, 0x40, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, - 3, // 0x6A 'j' - 0x00,0x20,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + 3, // 0x6A 'j' + 0x00, 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xA0, 0x40, - 5, // 0x6B 'k' - 0x00,0x40,0x40,0x48,0x50,0x60,0x60,0x50,0x48,0x48,0x00, + 5, // 0x6B 'k' + 0x00, 0x40, 0x40, 0x48, 0x50, 0x60, 0x60, 0x50, 0x48, 0x48, 0x00, - 2, // 0x6C 'l' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00, + 2, // 0x6C 'l' + 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, - 8, // 0x6D 'm' - 0x00,0x00,0x00,0x76,0x49,0x49,0x49,0x49,0x41,0x41,0x00, + 8, // 0x6D 'm' + 0x00, 0x00, 0x00, 0x76, 0x49, 0x49, 0x49, 0x49, 0x41, 0x41, 0x00, - 6, // 0x6E 'n' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x44,0x00, + 6, // 0x6E 'n' + 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x00, - 6, // 0x6F 'o' - 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x38,0x00, + 6, // 0x6F 'o' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, - 6, // 0x70 'p' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40, + 6, // 0x70 'p' + 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, - 6, // 0x71 'q' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x04, + 6, // 0x71 'q' + 0x00, 0x00, 0x00, 0x3C, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x04, - 6, // 0x72 'r' - 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x20,0x20,0x20,0x00, + 6, // 0x72 'r' + 0x00, 0x00, 0x00, 0x58, 0x24, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, - 6, // 0x73 's' - 0x00,0x00,0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x38,0x00, + 6, // 0x73 's' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x38, 0x04, 0x44, 0x38, 0x00, - 5, // 0x74 't' - 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x20,0x28,0x10,0x00, + 5, // 0x74 't' + 0x00, 0x20, 0x20, 0x70, 0x20, 0x20, 0x20, 0x20, 0x28, 0x10, 0x00, - 6, // 0x75 'u' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x4C,0x34,0x00, + 6, // 0x75 'u' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x4C, 0x34, 0x00, - 6, // 0x76 'v' - 0x00,0x00,0x00,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00, + 6, // 0x76 'v' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, - 8, // 0x77 'w' - 0x00,0x00,0x00,0x41,0x41,0x41,0x41,0x49,0x49,0x36,0x00, + 8, // 0x77 'w' + 0x00, 0x00, 0x00, 0x41, 0x41, 0x41, 0x41, 0x49, 0x49, 0x36, 0x00, - 6, // 0x78 'x' - 0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00, + 6, // 0x78 'x' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x00, - 6, // 0x79 'y' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x3C,0x04,0x08,0x70, + 6, // 0x79 'y' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x08, 0x70, - 6, // 0x7A 'z' - 0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00, + 6, // 0x7A 'z' + 0x00, 0x00, 0x00, 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00, - 5, // 0x7B '{' - 0x18,0x20,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x20,0x18, + 5, // 0x7B '{' + 0x18, 0x20, 0x20, 0x20, 0x20, 0xC0, 0x20, 0x20, 0x20, 0x20, 0x18, - 3, // 0x7C '|' - 0x00,0x40,0x40,0x40,0x40,0x00,0x40,0x40,0x40,0x40,0x00, + 3, // 0x7C '|' + 0x00, 0x40, 0x40, 0x40, 0x40, 0x00, 0x40, 0x40, 0x40, 0x40, 0x00, - 5, // 0x7D '}' - 0xC0,0x20,0x20,0x20,0x20,0x18,0x20,0x20,0x20,0x20,0xC0, + 5, // 0x7D '}' + 0xC0, 0x20, 0x20, 0x20, 0x20, 0x18, 0x20, 0x20, 0x20, 0x20, 0xC0, - 6, // 0x7E '~' - 0x00,0x24,0x54,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x7E '~' + 0x00, 0x24, 0x54, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x7F '' - 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00,0x00, + 6, // 0x7F '' + 0x00, 0x10, 0x38, 0x6C, 0x44, 0x44, 0x7C, 0x00, 0x00, 0x00, 0x00, - 0 -}; + 0}; -const int8u mcs11_prop_condensed[] = -{ - 11, 2, 32, 128-32, - 0x00,0x00,0x0C,0x00,0x18,0x00,0x24,0x00,0x30,0x00,0x3C,0x00,0x48,0x00,0x54,0x00,0x60,0x00, - 0x6C,0x00,0x78,0x00,0x84,0x00,0x90,0x00,0x9C,0x00,0xA8,0x00,0xB4,0x00,0xC0,0x00,0xCC,0x00, - 0xD8,0x00,0xE4,0x00,0xF0,0x00,0xFC,0x00,0x08,0x01,0x14,0x01,0x20,0x01,0x2C,0x01,0x38,0x01, - 0x44,0x01,0x50,0x01,0x5C,0x01,0x68,0x01,0x74,0x01,0x80,0x01,0x8C,0x01,0x98,0x01,0xA4,0x01, - 0xB0,0x01,0xBC,0x01,0xC8,0x01,0xD4,0x01,0xE0,0x01,0xEC,0x01,0xF8,0x01,0x04,0x02,0x10,0x02, - 0x1C,0x02,0x28,0x02,0x34,0x02,0x40,0x02,0x4C,0x02,0x58,0x02,0x64,0x02,0x70,0x02,0x7C,0x02, - 0x88,0x02,0x94,0x02,0xA0,0x02,0xAC,0x02,0xB8,0x02,0xC4,0x02,0xD0,0x02,0xDC,0x02,0xE8,0x02, - 0xF4,0x02,0x00,0x03,0x0C,0x03,0x18,0x03,0x24,0x03,0x30,0x03,0x3C,0x03,0x48,0x03,0x54,0x03, - 0x60,0x03,0x6C,0x03,0x78,0x03,0x84,0x03,0x90,0x03,0x9C,0x03,0xA8,0x03,0xB4,0x03,0xC0,0x03, - 0xCC,0x03,0xD8,0x03,0xE4,0x03,0xF0,0x03,0xFC,0x03,0x08,0x04,0x14,0x04,0x20,0x04,0x2C,0x04, - 0x38,0x04,0x44,0x04,0x50,0x04,0x5C,0x04,0x68,0x04,0x74,0x04, +const int8u mcs11_prop_condensed[] = { + 11, 2, 32, 128 - 32, 0x00, 0x00, 0x0C, 0x00, 0x18, 0x00, 0x24, 0x00, 0x30, 0x00, 0x3C, 0x00, 0x48, 0x00, + 0x54, 0x00, 0x60, 0x00, 0x6C, 0x00, 0x78, 0x00, 0x84, 0x00, 0x90, 0x00, 0x9C, 0x00, 0xA8, 0x00, 0xB4, 0x00, + 0xC0, 0x00, 0xCC, 0x00, 0xD8, 0x00, 0xE4, 0x00, 0xF0, 0x00, 0xFC, 0x00, 0x08, 0x01, 0x14, 0x01, 0x20, 0x01, + 0x2C, 0x01, 0x38, 0x01, 0x44, 0x01, 0x50, 0x01, 0x5C, 0x01, 0x68, 0x01, 0x74, 0x01, 0x80, 0x01, 0x8C, 0x01, + 0x98, 0x01, 0xA4, 0x01, 0xB0, 0x01, 0xBC, 0x01, 0xC8, 0x01, 0xD4, 0x01, 0xE0, 0x01, 0xEC, 0x01, 0xF8, 0x01, + 0x04, 0x02, 0x10, 0x02, 0x1C, 0x02, 0x28, 0x02, 0x34, 0x02, 0x40, 0x02, 0x4C, 0x02, 0x58, 0x02, 0x64, 0x02, + 0x70, 0x02, 0x7C, 0x02, 0x88, 0x02, 0x94, 0x02, 0xA0, 0x02, 0xAC, 0x02, 0xB8, 0x02, 0xC4, 0x02, 0xD0, 0x02, + 0xDC, 0x02, 0xE8, 0x02, 0xF4, 0x02, 0x00, 0x03, 0x0C, 0x03, 0x18, 0x03, 0x24, 0x03, 0x30, 0x03, 0x3C, 0x03, + 0x48, 0x03, 0x54, 0x03, 0x60, 0x03, 0x6C, 0x03, 0x78, 0x03, 0x84, 0x03, 0x90, 0x03, 0x9C, 0x03, 0xA8, 0x03, + 0xB4, 0x03, 0xC0, 0x03, 0xCC, 0x03, 0xD8, 0x03, 0xE4, 0x03, 0xF0, 0x03, 0xFC, 0x03, 0x08, 0x04, 0x14, 0x04, + 0x20, 0x04, 0x2C, 0x04, 0x38, 0x04, 0x44, 0x04, 0x50, 0x04, 0x5C, 0x04, 0x68, 0x04, 0x74, 0x04, - 3, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 3, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 3, // 0x21 '!' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x40,0x00, + 3, // 0x21 '!' + 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x40, 0x00, - 4, // 0x22 '"' - 0x50,0x50,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x22 '"' + 0x50, 0x50, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x23 '#' - 0x00,0x50,0x50,0xF8,0x50,0x50,0x50,0xF8,0x50,0x50,0x00, + 5, // 0x23 '#' + 0x00, 0x50, 0x50, 0xF8, 0x50, 0x50, 0x50, 0xF8, 0x50, 0x50, 0x00, - 5, // 0x24 '$' - 0x00,0x40,0x60,0x90,0x80,0x60,0x10,0x90,0x60,0x20,0x00, + 5, // 0x24 '$' + 0x00, 0x40, 0x60, 0x90, 0x80, 0x60, 0x10, 0x90, 0x60, 0x20, 0x00, - 5, // 0x25 '%' - 0x00,0x00,0x90,0x90,0x20,0x20,0x40,0x40,0x90,0x90,0x00, + 5, // 0x25 '%' + 0x00, 0x00, 0x90, 0x90, 0x20, 0x20, 0x40, 0x40, 0x90, 0x90, 0x00, - 5, // 0x26 '&' - 0x00,0x40,0xA0,0xA0,0xA0,0x40,0xA8,0x90,0x90,0x68,0x00, + 5, // 0x26 '&' + 0x00, 0x40, 0xA0, 0xA0, 0xA0, 0x40, 0xA8, 0x90, 0x90, 0x68, 0x00, - 5, // 0x27 ''' - 0x00,0x00,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x27 ''' + 0x00, 0x00, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x28 '(' - 0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10, + 5, // 0x28 '(' + 0x10, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x10, - 4, // 0x29 ')' - 0x80,0x40,0x40,0x20,0x20,0x20,0x20,0x20,0x40,0x40,0x80, + 4, // 0x29 ')' + 0x80, 0x40, 0x40, 0x20, 0x20, 0x20, 0x20, 0x20, 0x40, 0x40, 0x80, - 5, // 0x2A '*' - 0x00,0x00,0x90,0x60,0xF0,0x60,0x90,0x00,0x00,0x00,0x00, + 5, // 0x2A '*' + 0x00, 0x00, 0x90, 0x60, 0xF0, 0x60, 0x90, 0x00, 0x00, 0x00, 0x00, - 5, // 0x2B '+' - 0x00,0x00,0x00,0x20,0x20,0xF8,0x20,0x20,0x00,0x00,0x00, + 5, // 0x2B '+' + 0x00, 0x00, 0x00, 0x20, 0x20, 0xF8, 0x20, 0x20, 0x00, 0x00, 0x00, - 4, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0xC0, + 4, // 0x2C ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0xC0, - 5, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x00, + 5, // 0x2D '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x00, + 4, // 0x2E '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, - 6, // 0x2F '/' - 0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x00, + 6, // 0x2F '/' + 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, 0x00, - 5, // 0x30 '0' - 0x00,0x70,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0xE0,0x00, + 5, // 0x30 '0' + 0x00, 0x70, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0xE0, 0x00, - 3, // 0x31 '1' - 0x00,0x40,0xC0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00, + 3, // 0x31 '1' + 0x00, 0x40, 0xC0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, - 5, // 0x32 '2' - 0x00,0x60,0x90,0x90,0x10,0x10,0x20,0x40,0x80,0xF0,0x00, + 5, // 0x32 '2' + 0x00, 0x60, 0x90, 0x90, 0x10, 0x10, 0x20, 0x40, 0x80, 0xF0, 0x00, - 5, // 0x33 '3' - 0x00,0x60,0x90,0x10,0x10,0x60,0x10,0x10,0x90,0x60,0x00, + 5, // 0x33 '3' + 0x00, 0x60, 0x90, 0x10, 0x10, 0x60, 0x10, 0x10, 0x90, 0x60, 0x00, - 5, // 0x34 '4' - 0x00,0x10,0x30,0x30,0x50,0x50,0x90,0xF0,0x10,0x10,0x00, + 5, // 0x34 '4' + 0x00, 0x10, 0x30, 0x30, 0x50, 0x50, 0x90, 0xF0, 0x10, 0x10, 0x00, - 5, // 0x35 '5' - 0x00,0xF0,0x80,0x80,0xE0,0x90,0x10,0x10,0x90,0x60,0x00, + 5, // 0x35 '5' + 0x00, 0xF0, 0x80, 0x80, 0xE0, 0x90, 0x10, 0x10, 0x90, 0x60, 0x00, - 5, // 0x36 '6' - 0x00,0x60,0x90,0x80,0x80,0xE0,0x90,0x90,0x90,0x60,0x00, + 5, // 0x36 '6' + 0x00, 0x60, 0x90, 0x80, 0x80, 0xE0, 0x90, 0x90, 0x90, 0x60, 0x00, - 5, // 0x37 '7' - 0x00,0xF0,0x10,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x00, + 5, // 0x37 '7' + 0x00, 0xF0, 0x10, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x40, 0x00, - 5, // 0x38 '8' - 0x00,0x60,0x90,0x90,0x90,0x60,0x90,0x90,0x90,0x60,0x00, + 5, // 0x38 '8' + 0x00, 0x60, 0x90, 0x90, 0x90, 0x60, 0x90, 0x90, 0x90, 0x60, 0x00, - 5, // 0x39 '9' - 0x00,0x60,0x90,0x90,0x90,0x70,0x10,0x10,0x90,0x60,0x00, + 5, // 0x39 '9' + 0x00, 0x60, 0x90, 0x90, 0x90, 0x70, 0x10, 0x10, 0x90, 0x60, 0x00, - 4, // 0x3A ':' - 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x00, + 4, // 0x3A ':' + 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, - 4, // 0x3B ';' - 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0xC0, + 4, // 0x3B ';' + 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0xC0, - 6, // 0x3C '<' - 0x00,0x08,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x08,0x00, + 6, // 0x3C '<' + 0x00, 0x08, 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, 0x10, 0x08, 0x00, - 5, // 0x3D '=' - 0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0xF0,0x00,0x00,0x00, + 5, // 0x3D '=' + 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, - 6, // 0x3E '>' - 0x00,0x80,0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x80,0x00, + 6, // 0x3E '>' + 0x00, 0x80, 0x40, 0x20, 0x10, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, - 5, // 0x3F '?' - 0x00,0x60,0x90,0x10,0x10,0x20,0x40,0x00,0x40,0x00,0x00, + 5, // 0x3F '?' + 0x00, 0x60, 0x90, 0x10, 0x10, 0x20, 0x40, 0x00, 0x40, 0x00, 0x00, - 5, // 0x40 '@' - 0x00,0x60,0x90,0x90,0xB0,0xB0,0xB0,0x80,0x80,0x70,0x00, + 5, // 0x40 '@' + 0x00, 0x60, 0x90, 0x90, 0xB0, 0xB0, 0xB0, 0x80, 0x80, 0x70, 0x00, - 5, // 0x41 'A' - 0x00,0x60,0x90,0x90,0x90,0xF0,0x90,0x90,0x90,0x90,0x00, + 5, // 0x41 'A' + 0x00, 0x60, 0x90, 0x90, 0x90, 0xF0, 0x90, 0x90, 0x90, 0x90, 0x00, - 5, // 0x42 'B' - 0x00,0xE0,0x90,0x90,0x90,0xE0,0x90,0x90,0x90,0xE0,0x00, + 5, // 0x42 'B' + 0x00, 0xE0, 0x90, 0x90, 0x90, 0xE0, 0x90, 0x90, 0x90, 0xE0, 0x00, - 5, // 0x43 'C' - 0x00,0x60,0x90,0x80,0x80,0x80,0x80,0x80,0x90,0x60,0x00, + 5, // 0x43 'C' + 0x00, 0x60, 0x90, 0x80, 0x80, 0x80, 0x80, 0x80, 0x90, 0x60, 0x00, - 5, // 0x44 'D' - 0x00,0xE0,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0xE0,0x00, + 5, // 0x44 'D' + 0x00, 0xE0, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0xE0, 0x00, - 5, // 0x45 'E' - 0x00,0xF0,0x80,0x80,0x80,0xF0,0x80,0x80,0x80,0xF0,0x00, + 5, // 0x45 'E' + 0x00, 0xF0, 0x80, 0x80, 0x80, 0xF0, 0x80, 0x80, 0x80, 0xF0, 0x00, - 5, // 0x46 'F' - 0x00,0xF0,0x80,0x80,0x80,0xF0,0x80,0x80,0x80,0x80,0x00, + 5, // 0x46 'F' + 0x00, 0xF0, 0x80, 0x80, 0x80, 0xF0, 0x80, 0x80, 0x80, 0x80, 0x00, - 5, // 0x47 'G' - 0x00,0x70,0x80,0x80,0x80,0xB0,0x90,0x90,0x90,0x60,0x00, + 5, // 0x47 'G' + 0x00, 0x70, 0x80, 0x80, 0x80, 0xB0, 0x90, 0x90, 0x90, 0x60, 0x00, - 5, // 0x48 'H' - 0x00,0x90,0x90,0x90,0x90,0xF0,0x90,0x90,0x90,0x90,0x00, + 5, // 0x48 'H' + 0x00, 0x90, 0x90, 0x90, 0x90, 0xF0, 0x90, 0x90, 0x90, 0x90, 0x00, - 4, // 0x49 'I' - 0x00,0xE0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xE0,0x00, + 4, // 0x49 'I' + 0x00, 0xE0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xE0, 0x00, - 5, // 0x4A 'J' - 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0xA0,0xA0,0x40,0x00, + 5, // 0x4A 'J' + 0x00, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0xA0, 0xA0, 0x40, 0x00, - 5, // 0x4B 'K' - 0x00,0x90,0x90,0xA0,0xA0,0xC0,0xA0,0xA0,0x90,0x90,0x00, + 5, // 0x4B 'K' + 0x00, 0x90, 0x90, 0xA0, 0xA0, 0xC0, 0xA0, 0xA0, 0x90, 0x90, 0x00, - 5, // 0x4C 'L' - 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xF0,0x00, + 5, // 0x4C 'L' + 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xF0, 0x00, - 6, // 0x4D 'M' - 0x00,0x88,0xD8,0xA8,0xA8,0xA8,0x88,0x88,0x88,0x88,0x00, + 6, // 0x4D 'M' + 0x00, 0x88, 0xD8, 0xA8, 0xA8, 0xA8, 0x88, 0x88, 0x88, 0x88, 0x00, - 5, // 0x4E 'N' - 0x00,0x90,0x90,0xD0,0xD0,0xB0,0xB0,0x90,0x90,0x90,0x00, + 5, // 0x4E 'N' + 0x00, 0x90, 0x90, 0xD0, 0xD0, 0xB0, 0xB0, 0x90, 0x90, 0x90, 0x00, - 5, // 0x4F 'O' - 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00, + 5, // 0x4F 'O' + 0x00, 0x60, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x60, 0x00, - 5, // 0x50 'P' - 0x00,0xE0,0x90,0x90,0x90,0x90,0xE0,0x80,0x80,0x80,0x00, + 5, // 0x50 'P' + 0x00, 0xE0, 0x90, 0x90, 0x90, 0x90, 0xE0, 0x80, 0x80, 0x80, 0x00, - 5, // 0x51 'Q' - 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x30, + 5, // 0x51 'Q' + 0x00, 0x60, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x60, 0x30, - 5, // 0x52 'R' - 0x00,0xE0,0x90,0x90,0x90,0x90,0xE0,0xA0,0x90,0x90,0x00, + 5, // 0x52 'R' + 0x00, 0xE0, 0x90, 0x90, 0x90, 0x90, 0xE0, 0xA0, 0x90, 0x90, 0x00, - 5, // 0x53 'S' - 0x00,0x60,0x90,0x80,0x80,0x60,0x10,0x10,0x90,0x60,0x00, + 5, // 0x53 'S' + 0x00, 0x60, 0x90, 0x80, 0x80, 0x60, 0x10, 0x10, 0x90, 0x60, 0x00, - 6, // 0x54 'T' - 0x00,0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00, + 6, // 0x54 'T' + 0x00, 0xF8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, - 5, // 0x55 'U' - 0x00,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00, + 5, // 0x55 'U' + 0x00, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x60, 0x00, - 6, // 0x56 'V' - 0x00,0x88,0x88,0x88,0x88,0x50,0x50,0x50,0x20,0x20,0x00, + 6, // 0x56 'V' + 0x00, 0x88, 0x88, 0x88, 0x88, 0x50, 0x50, 0x50, 0x20, 0x20, 0x00, - 6, // 0x57 'W' - 0x00,0x88,0x88,0x88,0xA8,0xA8,0xA8,0xA8,0xA8,0x50,0x00, + 6, // 0x57 'W' + 0x00, 0x88, 0x88, 0x88, 0xA8, 0xA8, 0xA8, 0xA8, 0xA8, 0x50, 0x00, - 5, // 0x58 'X' - 0x00,0x90,0x90,0x90,0x60,0x60,0x90,0x90,0x90,0x90,0x00, + 5, // 0x58 'X' + 0x00, 0x90, 0x90, 0x90, 0x60, 0x60, 0x90, 0x90, 0x90, 0x90, 0x00, - 6, // 0x59 'Y' - 0x00,0x88,0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x20,0x00, + 6, // 0x59 'Y' + 0x00, 0x88, 0x88, 0x88, 0x50, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, - 5, // 0x5A 'Z' - 0x00,0xF0,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0xF0,0x00, + 5, // 0x5A 'Z' + 0x00, 0xF0, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, 0xF0, 0x00, - 4, // 0x5B '[' - 0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x60,0x00, + 4, // 0x5B '[' + 0x60, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x60, 0x00, - 6, // 0x5C '\' - 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00, + 6, // 0x5C '\' + 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x00, - 4, // 0x5D ']' - 0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x60,0x00, + 4, // 0x5D ']' + 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x60, 0x00, - 5, // 0x5E '^' - 0x00,0x20,0x50,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x5E '^' + 0x00, 0x20, 0x50, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00, + 5, // 0x5F '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, - 5, // 0x60 '`' - 0x00,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x60 '`' + 0x00, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x61 'a' - 0x00,0x00,0x00,0x60,0x90,0x10,0x70,0x90,0x90,0x70,0x00, + 5, // 0x61 'a' + 0x00, 0x00, 0x00, 0x60, 0x90, 0x10, 0x70, 0x90, 0x90, 0x70, 0x00, - 5, // 0x62 'b' - 0x00,0x80,0x80,0x80,0xE0,0x90,0x90,0x90,0x90,0xE0,0x00, + 5, // 0x62 'b' + 0x00, 0x80, 0x80, 0x80, 0xE0, 0x90, 0x90, 0x90, 0x90, 0xE0, 0x00, - 5, // 0x63 'c' - 0x00,0x00,0x00,0x60,0x90,0x80,0x80,0x80,0x90,0x60,0x00, + 5, // 0x63 'c' + 0x00, 0x00, 0x00, 0x60, 0x90, 0x80, 0x80, 0x80, 0x90, 0x60, 0x00, - 5, // 0x64 'd' - 0x00,0x10,0x10,0x10,0x70,0x90,0x90,0x90,0x90,0x70,0x00, + 5, // 0x64 'd' + 0x00, 0x10, 0x10, 0x10, 0x70, 0x90, 0x90, 0x90, 0x90, 0x70, 0x00, - 5, // 0x65 'e' - 0x00,0x00,0x00,0x60,0x90,0x90,0xF0,0x80,0x90,0x60,0x00, + 5, // 0x65 'e' + 0x00, 0x00, 0x00, 0x60, 0x90, 0x90, 0xF0, 0x80, 0x90, 0x60, 0x00, - 4, // 0x66 'f' - 0x00,0x20,0x40,0x40,0xE0,0x40,0x40,0x40,0x40,0x40,0x00, + 4, // 0x66 'f' + 0x00, 0x20, 0x40, 0x40, 0xE0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, - 5, // 0x67 'g' - 0x00,0x00,0x00,0x70,0x90,0x90,0x90,0x70,0x10,0x90,0x60, + 5, // 0x67 'g' + 0x00, 0x00, 0x00, 0x70, 0x90, 0x90, 0x90, 0x70, 0x10, 0x90, 0x60, - 5, // 0x68 'h' - 0x00,0x80,0x80,0x80,0xE0,0x90,0x90,0x90,0x90,0x90,0x00, + 5, // 0x68 'h' + 0x00, 0x80, 0x80, 0x80, 0xE0, 0x90, 0x90, 0x90, 0x90, 0x90, 0x00, - 2, // 0x69 'i' - 0x00,0x80,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00, + 2, // 0x69 'i' + 0x00, 0x80, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, - 4, // 0x6A 'j' - 0x00,0x20,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + 4, // 0x6A 'j' + 0x00, 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xA0, 0x40, - 5, // 0x6B 'k' - 0x00,0x80,0x80,0x90,0x90,0xA0,0xC0,0xA0,0x90,0x90,0x00, + 5, // 0x6B 'k' + 0x00, 0x80, 0x80, 0x90, 0x90, 0xA0, 0xC0, 0xA0, 0x90, 0x90, 0x00, - 2, // 0x6C 'l' - 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00, + 2, // 0x6C 'l' + 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, - 6, // 0x6D 'm' - 0x00,0x00,0x00,0xD0,0xA8,0xA8,0xA8,0x88,0x88,0x88,0x00, + 6, // 0x6D 'm' + 0x00, 0x00, 0x00, 0xD0, 0xA8, 0xA8, 0xA8, 0x88, 0x88, 0x88, 0x00, - 5, // 0x6E 'n' - 0x00,0x00,0x00,0xA0,0xD0,0x90,0x90,0x90,0x90,0x90,0x00, + 5, // 0x6E 'n' + 0x00, 0x00, 0x00, 0xA0, 0xD0, 0x90, 0x90, 0x90, 0x90, 0x90, 0x00, - 5, // 0x6F 'o' - 0x00,0x00,0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x60,0x00, + 5, // 0x6F 'o' + 0x00, 0x00, 0x00, 0x60, 0x90, 0x90, 0x90, 0x90, 0x90, 0x60, 0x00, - 5, // 0x70 'p' - 0x00,0x00,0x00,0xE0,0x90,0x90,0x90,0x90,0xE0,0x80,0x80, + 5, // 0x70 'p' + 0x00, 0x00, 0x00, 0xE0, 0x90, 0x90, 0x90, 0x90, 0xE0, 0x80, 0x80, - 5, // 0x71 'q' - 0x00,0x00,0x00,0x70,0x90,0x90,0x90,0x90,0x70,0x10,0x10, + 5, // 0x71 'q' + 0x00, 0x00, 0x00, 0x70, 0x90, 0x90, 0x90, 0x90, 0x70, 0x10, 0x10, - 6, // 0x72 'r' - 0x00,0x00,0x00,0xB8,0x48,0x40,0x40,0x40,0x40,0x40,0x00, + 6, // 0x72 'r' + 0x00, 0x00, 0x00, 0xB8, 0x48, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, - 5, // 0x73 's' - 0x00,0x00,0x00,0x60,0x90,0x40,0x20,0x10,0x90,0x60,0x00, + 5, // 0x73 's' + 0x00, 0x00, 0x00, 0x60, 0x90, 0x40, 0x20, 0x10, 0x90, 0x60, 0x00, - 4, // 0x74 't' - 0x00,0x40,0x40,0xE0,0x40,0x40,0x40,0x40,0x40,0x20,0x00, + 4, // 0x74 't' + 0x00, 0x40, 0x40, 0xE0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x20, 0x00, - 5, // 0x75 'u' - 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0x90,0x90,0x70,0x00, + 5, // 0x75 'u' + 0x00, 0x00, 0x00, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x70, 0x00, - 6, // 0x76 'v' - 0x00,0x00,0x00,0x88,0x88,0x88,0x50,0x50,0x20,0x20,0x00, + 6, // 0x76 'v' + 0x00, 0x00, 0x00, 0x88, 0x88, 0x88, 0x50, 0x50, 0x20, 0x20, 0x00, - 6, // 0x77 'w' - 0x00,0x00,0x00,0x88,0x88,0x88,0xA8,0xA8,0xA8,0x50,0x00, + 6, // 0x77 'w' + 0x00, 0x00, 0x00, 0x88, 0x88, 0x88, 0xA8, 0xA8, 0xA8, 0x50, 0x00, - 5, // 0x78 'x' - 0x00,0x00,0x00,0x90,0x90,0x60,0x60,0x90,0x90,0x90,0x00, + 5, // 0x78 'x' + 0x00, 0x00, 0x00, 0x90, 0x90, 0x60, 0x60, 0x90, 0x90, 0x90, 0x00, - 5, // 0x79 'y' - 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0x70,0x10,0x20,0xC0, + 5, // 0x79 'y' + 0x00, 0x00, 0x00, 0x90, 0x90, 0x90, 0x90, 0x70, 0x10, 0x20, 0xC0, - 5, // 0x7A 'z' - 0x00,0x00,0x00,0xF0,0x10,0x20,0x40,0x80,0x80,0xF0,0x00, + 5, // 0x7A 'z' + 0x00, 0x00, 0x00, 0xF0, 0x10, 0x20, 0x40, 0x80, 0x80, 0xF0, 0x00, - 5, // 0x7B '{' - 0x30,0x40,0x40,0x40,0x40,0x80,0x40,0x40,0x40,0x40,0x30, + 5, // 0x7B '{' + 0x30, 0x40, 0x40, 0x40, 0x40, 0x80, 0x40, 0x40, 0x40, 0x40, 0x30, - 3, // 0x7C '|' - 0x00,0x40,0x40,0x40,0x40,0x00,0x40,0x40,0x40,0x40,0x00, + 3, // 0x7C '|' + 0x00, 0x40, 0x40, 0x40, 0x40, 0x00, 0x40, 0x40, 0x40, 0x40, 0x00, - 5, // 0x7D '}' - 0xC0,0x20,0x20,0x20,0x20,0x10,0x20,0x20,0x20,0x20,0xC0, + 5, // 0x7D '}' + 0xC0, 0x20, 0x20, 0x20, 0x20, 0x10, 0x20, 0x20, 0x20, 0x20, 0xC0, - 5, // 0x7E '~' - 0x00,0x40,0xA8,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x7E '~' + 0x00, 0x40, 0xA8, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x7F '' - 0x00,0x20,0x70,0xD8,0x88,0x88,0xF8,0x00,0x00,0x00,0x00, + 5, // 0x7F '' + 0x00, 0x20, 0x70, 0xD8, 0x88, 0x88, 0xF8, 0x00, 0x00, 0x00, 0x00, - 0 -}; + 0}; -const int8u mcs12_prop[] = -{ - 12, 3, 32, 128-32, - 0x00,0x00,0x0D,0x00,0x1A,0x00,0x27,0x00,0x34,0x00,0x41,0x00,0x4E,0x00,0x5B,0x00,0x68,0x00, - 0x75,0x00,0x82,0x00,0x8F,0x00,0x9C,0x00,0xA9,0x00,0xB6,0x00,0xC3,0x00,0xD0,0x00,0xDD,0x00, - 0xEA,0x00,0xF7,0x00,0x04,0x01,0x11,0x01,0x1E,0x01,0x2B,0x01,0x38,0x01,0x45,0x01,0x52,0x01, - 0x5F,0x01,0x6C,0x01,0x79,0x01,0x86,0x01,0x93,0x01,0xA0,0x01,0xAD,0x01,0xBA,0x01,0xC7,0x01, - 0xD4,0x01,0xE1,0x01,0xEE,0x01,0xFB,0x01,0x08,0x02,0x15,0x02,0x22,0x02,0x2F,0x02,0x3C,0x02, - 0x49,0x02,0x62,0x02,0x6F,0x02,0x7C,0x02,0x89,0x02,0x96,0x02,0xA3,0x02,0xB0,0x02,0xBD,0x02, - 0xCA,0x02,0xD7,0x02,0xF0,0x02,0xFD,0x02,0x0A,0x03,0x17,0x03,0x24,0x03,0x31,0x03,0x3E,0x03, - 0x4B,0x03,0x58,0x03,0x65,0x03,0x72,0x03,0x7F,0x03,0x8C,0x03,0x99,0x03,0xA6,0x03,0xB3,0x03, - 0xC0,0x03,0xCD,0x03,0xDA,0x03,0xE7,0x03,0xF4,0x03,0x01,0x04,0x1A,0x04,0x27,0x04,0x34,0x04, - 0x41,0x04,0x4E,0x04,0x5B,0x04,0x68,0x04,0x75,0x04,0x82,0x04,0x8F,0x04,0xA8,0x04,0xB5,0x04, - 0xC2,0x04,0xCF,0x04,0xDC,0x04,0xE9,0x04,0xF6,0x04,0x03,0x05, +const int8u mcs12_prop[] = { + 12, 3, 32, 128 - 32, 0x00, 0x00, 0x0D, 0x00, 0x1A, 0x00, 0x27, 0x00, 0x34, 0x00, 0x41, 0x00, 0x4E, 0x00, + 0x5B, 0x00, 0x68, 0x00, 0x75, 0x00, 0x82, 0x00, 0x8F, 0x00, 0x9C, 0x00, 0xA9, 0x00, 0xB6, 0x00, 0xC3, 0x00, + 0xD0, 0x00, 0xDD, 0x00, 0xEA, 0x00, 0xF7, 0x00, 0x04, 0x01, 0x11, 0x01, 0x1E, 0x01, 0x2B, 0x01, 0x38, 0x01, + 0x45, 0x01, 0x52, 0x01, 0x5F, 0x01, 0x6C, 0x01, 0x79, 0x01, 0x86, 0x01, 0x93, 0x01, 0xA0, 0x01, 0xAD, 0x01, + 0xBA, 0x01, 0xC7, 0x01, 0xD4, 0x01, 0xE1, 0x01, 0xEE, 0x01, 0xFB, 0x01, 0x08, 0x02, 0x15, 0x02, 0x22, 0x02, + 0x2F, 0x02, 0x3C, 0x02, 0x49, 0x02, 0x62, 0x02, 0x6F, 0x02, 0x7C, 0x02, 0x89, 0x02, 0x96, 0x02, 0xA3, 0x02, + 0xB0, 0x02, 0xBD, 0x02, 0xCA, 0x02, 0xD7, 0x02, 0xF0, 0x02, 0xFD, 0x02, 0x0A, 0x03, 0x17, 0x03, 0x24, 0x03, + 0x31, 0x03, 0x3E, 0x03, 0x4B, 0x03, 0x58, 0x03, 0x65, 0x03, 0x72, 0x03, 0x7F, 0x03, 0x8C, 0x03, 0x99, 0x03, + 0xA6, 0x03, 0xB3, 0x03, 0xC0, 0x03, 0xCD, 0x03, 0xDA, 0x03, 0xE7, 0x03, 0xF4, 0x03, 0x01, 0x04, 0x1A, 0x04, + 0x27, 0x04, 0x34, 0x04, 0x41, 0x04, 0x4E, 0x04, 0x5B, 0x04, 0x68, 0x04, 0x75, 0x04, 0x82, 0x04, 0x8F, 0x04, + 0xA8, 0x04, 0xB5, 0x04, 0xC2, 0x04, 0xCF, 0x04, 0xDC, 0x04, 0xE9, 0x04, 0xF6, 0x04, 0x03, 0x05, - 5, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x21 '!' - 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, + 4, // 0x21 '!' + 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x00, 0x00, - 4, // 0x22 '"' - 0x50,0x50,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x22 '"' + 0x50, 0x50, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x23 '#' - 0x28,0x28,0x28,0x7C,0x28,0x28,0x28,0x7C,0x28,0x28,0x28,0x00, + 6, // 0x23 '#' + 0x28, 0x28, 0x28, 0x7C, 0x28, 0x28, 0x28, 0x7C, 0x28, 0x28, 0x28, 0x00, - 6, // 0x24 '$' - 0x10,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x10,0x00, + 6, // 0x24 '$' + 0x10, 0x10, 0x38, 0x54, 0x50, 0x38, 0x14, 0x54, 0x38, 0x10, 0x10, 0x00, - 7, // 0x25 '%' - 0x32,0x54,0x64,0x08,0x08,0x10,0x10,0x26,0x2A,0x4C,0x00,0x00, + 7, // 0x25 '%' + 0x32, 0x54, 0x64, 0x08, 0x08, 0x10, 0x10, 0x26, 0x2A, 0x4C, 0x00, 0x00, - 7, // 0x26 '&' - 0x00,0x30,0x48,0x48,0x48,0x30,0x4A,0x4A,0x44,0x3A,0x00,0x00, + 7, // 0x26 '&' + 0x00, 0x30, 0x48, 0x48, 0x48, 0x30, 0x4A, 0x4A, 0x44, 0x3A, 0x00, 0x00, - 3, // 0x27 ''' - 0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 3, // 0x27 ''' + 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x28 '(' - 0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10,0x00, + 5, // 0x28 '(' + 0x10, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x10, 0x00, - 5, // 0x29 ')' - 0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40,0x00, + 5, // 0x29 ')' + 0x40, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x40, 0x00, - 6, // 0x2A '*' - 0x00,0x00,0x10,0x54,0x38,0x7C,0x38,0x54,0x10,0x00,0x00,0x00, + 6, // 0x2A '*' + 0x00, 0x00, 0x10, 0x54, 0x38, 0x7C, 0x38, 0x54, 0x10, 0x00, 0x00, 0x00, - 6, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, + 6, // 0x2B '+' + 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x00, 0x00, - 4, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x40,0x80, + 4, // 0x2C ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x40, 0x80, - 6, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, + 6, // 0x2D '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00, + 4, // 0x2E '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, - 7, // 0x2F '/' - 0x00,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00, + 7, // 0x2F '/' + 0x00, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x00, - 7, // 0x30 '0' - 0x00,0x38,0x44,0x44,0x54,0x54,0x54,0x44,0x44,0x38,0x00,0x00, + 7, // 0x30 '0' + 0x00, 0x38, 0x44, 0x44, 0x54, 0x54, 0x54, 0x44, 0x44, 0x38, 0x00, 0x00, - 4, // 0x31 '1' - 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00, + 4, // 0x31 '1' + 0x00, 0x20, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, - 7, // 0x32 '2' - 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, + 7, // 0x32 '2' + 0x00, 0x38, 0x44, 0x04, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00, 0x00, - 7, // 0x33 '3' - 0x00,0x38,0x44,0x04,0x04,0x38,0x04,0x04,0x44,0x38,0x00,0x00, + 7, // 0x33 '3' + 0x00, 0x38, 0x44, 0x04, 0x04, 0x38, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, - 6, // 0x34 '4' - 0x00,0x08,0x18,0x28,0x28,0x48,0x48,0x7C,0x08,0x08,0x00,0x00, + 6, // 0x34 '4' + 0x00, 0x08, 0x18, 0x28, 0x28, 0x48, 0x48, 0x7C, 0x08, 0x08, 0x00, 0x00, - 7, // 0x35 '5' - 0x00,0x7C,0x40,0x40,0x78,0x44,0x04,0x04,0x44,0x38,0x00,0x00, + 7, // 0x35 '5' + 0x00, 0x7C, 0x40, 0x40, 0x78, 0x44, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, - 7, // 0x36 '6' - 0x00,0x38,0x44,0x40,0x78,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x36 '6' + 0x00, 0x38, 0x44, 0x40, 0x78, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 6, // 0x37 '7' - 0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x00,0x00, + 6, // 0x37 '7' + 0x00, 0x7C, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x20, 0x00, 0x00, - 7, // 0x38 '8' - 0x00,0x38,0x44,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x38 '8' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 7, // 0x39 '9' - 0x00,0x38,0x44,0x44,0x44,0x3C,0x04,0x04,0x44,0x38,0x00,0x00, + 7, // 0x39 '9' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, - 4, // 0x3A ':' - 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x00,0x00, + 4, // 0x3A ':' + 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, - 4, // 0x3B ';' - 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x40,0x80, + 4, // 0x3B ';' + 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x40, 0x80, - 6, // 0x3C '<' - 0x00,0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00, + 6, // 0x3C '<' + 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, - 6, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00,0x00, + 6, // 0x3D '=' + 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, - 6, // 0x3E '>' - 0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00, + 6, // 0x3E '>' + 0x00, 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, - 6, // 0x3F '?' - 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x10,0x00,0x10,0x00,0x00, + 6, // 0x3F '?' + 0x00, 0x38, 0x44, 0x04, 0x04, 0x08, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, - 7, // 0x40 '@' - 0x00,0x38,0x44,0x44,0x5C,0x54,0x54,0x4C,0x40,0x38,0x00,0x00, + 7, // 0x40 '@' + 0x00, 0x38, 0x44, 0x44, 0x5C, 0x54, 0x54, 0x4C, 0x40, 0x38, 0x00, 0x00, - 7, // 0x41 'A' - 0x00,0x38,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x41 'A' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, - 7, // 0x42 'B' - 0x00,0x78,0x44,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00,0x00, + 7, // 0x42 'B' + 0x00, 0x78, 0x44, 0x44, 0x44, 0x78, 0x44, 0x44, 0x44, 0x78, 0x00, 0x00, - 6, // 0x43 'C' - 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00, + 6, // 0x43 'C' + 0x00, 0x38, 0x44, 0x40, 0x40, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, - 7, // 0x44 'D' - 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00, + 7, // 0x44 'D' + 0x00, 0x70, 0x48, 0x44, 0x44, 0x44, 0x44, 0x44, 0x48, 0x70, 0x00, 0x00, - 6, // 0x45 'E' - 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x7C,0x00,0x00, + 6, // 0x45 'E' + 0x00, 0x7C, 0x40, 0x40, 0x40, 0x78, 0x40, 0x40, 0x40, 0x7C, 0x00, 0x00, - 6, // 0x46 'F' - 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00,0x00, + 6, // 0x46 'F' + 0x00, 0x7C, 0x40, 0x40, 0x40, 0x78, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, - 7, // 0x47 'G' - 0x00,0x38,0x44,0x40,0x40,0x5C,0x44,0x44,0x4C,0x34,0x00,0x00, + 7, // 0x47 'G' + 0x00, 0x38, 0x44, 0x40, 0x40, 0x5C, 0x44, 0x44, 0x4C, 0x34, 0x00, 0x00, - 7, // 0x48 'H' - 0x00,0x44,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x48 'H' + 0x00, 0x44, 0x44, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, - 5, // 0x49 'I' - 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 5, // 0x49 'I' + 0x00, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, - 6, // 0x4A 'J' - 0x00,0x1C,0x08,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00, + 6, // 0x4A 'J' + 0x00, 0x1C, 0x08, 0x08, 0x08, 0x08, 0x08, 0x48, 0x48, 0x30, 0x00, 0x00, - 6, // 0x4B 'K' - 0x00,0x44,0x48,0x50,0x60,0x60,0x50,0x48,0x44,0x44,0x00,0x00, + 6, // 0x4B 'K' + 0x00, 0x44, 0x48, 0x50, 0x60, 0x60, 0x50, 0x48, 0x44, 0x44, 0x00, 0x00, - 6, // 0x4C 'L' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00, + 6, // 0x4C 'L' + 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7C, 0x00, 0x00, - 9, // 0x4D 'M' - 0x00,0x00,0x41,0x00,0x63,0x00,0x55,0x00,0x49,0x00,0x49,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00, + 9, // 0x4D 'M' + 0x00, 0x00, 0x41, 0x00, 0x63, 0x00, 0x55, 0x00, 0x49, 0x00, 0x49, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, + 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x4E 'N' - 0x00,0x44,0x64,0x64,0x54,0x54,0x4C,0x4C,0x44,0x44,0x00,0x00, + 7, // 0x4E 'N' + 0x00, 0x44, 0x64, 0x64, 0x54, 0x54, 0x4C, 0x4C, 0x44, 0x44, 0x00, 0x00, - 7, // 0x4F 'O' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x4F 'O' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 7, // 0x50 'P' - 0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00, + 7, // 0x50 'P' + 0x00, 0x78, 0x44, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, 0x00, 0x00, - 7, // 0x51 'Q' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00, + 7, // 0x51 'Q' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x54, 0x48, 0x34, 0x00, 0x00, - 7, // 0x52 'R' - 0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x48,0x44,0x44,0x00,0x00, + 7, // 0x52 'R' + 0x00, 0x78, 0x44, 0x44, 0x44, 0x44, 0x78, 0x48, 0x44, 0x44, 0x00, 0x00, - 7, // 0x53 'S' - 0x00,0x38,0x44,0x40,0x40,0x38,0x04,0x04,0x44,0x38,0x00,0x00, + 7, // 0x53 'S' + 0x00, 0x38, 0x44, 0x40, 0x40, 0x38, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, - 6, // 0x54 'T' - 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, + 6, // 0x54 'T' + 0x00, 0x7C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - 7, // 0x55 'U' - 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x55 'U' + 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 6, // 0x56 'V' - 0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00,0x00, + 6, // 0x56 'V' + 0x00, 0x44, 0x44, 0x44, 0x44, 0x28, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, - 9, // 0x57 'W' - 0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x49,0x00,0x49,0x00,0x55,0x00,0x22,0x00,0x00,0x00,0x00,0x00, + 9, // 0x57 'W' + 0x00, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x49, 0x00, 0x49, 0x00, 0x55, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x58 'X' - 0x00,0x44,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00, + 7, // 0x58 'X' + 0x00, 0x44, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x44, 0x00, 0x00, - 7, // 0x59 'Y' - 0x00,0x44,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x00,0x00, + 7, // 0x59 'Y' + 0x00, 0x44, 0x44, 0x44, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - 6, // 0x5A 'Z' - 0x00,0x7C,0x04,0x04,0x08,0x10,0x20,0x40,0x40,0x7C,0x00,0x00, + 6, // 0x5A 'Z' + 0x00, 0x7C, 0x04, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x7C, 0x00, 0x00, - 4, // 0x5B '[' - 0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70,0x00, + 4, // 0x5B '[' + 0x70, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x70, 0x00, - 7, // 0x5C '\' - 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00, + 7, // 0x5C '\' + 0x00, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x00, - 4, // 0x5D ']' - 0xE0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xE0,0x00, + 4, // 0x5D ']' + 0xE0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xE0, 0x00, - 6, // 0x5E '^' - 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x5E '^' + 0x00, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00, + 6, // 0x5F '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, - 4, // 0x60 '`' - 0x00,0x40,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x60 '`' + 0x00, 0x40, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x61 'a' - 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x44,0x3C,0x00,0x00, + 7, // 0x61 'a' + 0x00, 0x00, 0x00, 0x38, 0x04, 0x3C, 0x44, 0x44, 0x44, 0x3C, 0x00, 0x00, - 7, // 0x62 'b' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x00,0x00, + 7, // 0x62 'b' + 0x00, 0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x44, 0x44, 0x78, 0x00, 0x00, - 6, // 0x63 'c' - 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x44,0x38,0x00,0x00, + 6, // 0x63 'c' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, - 7, // 0x64 'd' - 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x00,0x00, + 7, // 0x64 'd' + 0x00, 0x04, 0x04, 0x3C, 0x44, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x00, 0x00, - 7, // 0x65 'e' - 0x00,0x00,0x00,0x38,0x44,0x44,0x7C,0x40,0x44,0x38,0x00,0x00, + 7, // 0x65 'e' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x7C, 0x40, 0x44, 0x38, 0x00, 0x00, - 4, // 0x66 'f' - 0x00,0x30,0x40,0xE0,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 4, // 0x66 'f' + 0x00, 0x30, 0x40, 0xE0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, - 7, // 0x67 'g' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x78, + 7, // 0x67 'g' + 0x00, 0x00, 0x00, 0x3C, 0x44, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x78, - 7, // 0x68 'h' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x68 'h' + 0x00, 0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, - 3, // 0x69 'i' - 0x00,0x40,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 3, // 0x69 'i' + 0x00, 0x40, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, - 5, // 0x6A 'j' - 0x00,0x10,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x90,0x60, + 5, // 0x6A 'j' + 0x00, 0x10, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x90, 0x60, - 6, // 0x6B 'k' - 0x00,0x40,0x40,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00, + 6, // 0x6B 'k' + 0x00, 0x40, 0x40, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x00, 0x00, - 3, // 0x6C 'l' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 3, // 0x6C 'l' + 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, - 9, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x76,0x00,0x49,0x00,0x49,0x00,0x49,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00, + 9, // 0x6D 'm' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x00, 0x49, 0x00, 0x49, 0x00, 0x49, 0x00, 0x41, 0x00, 0x41, 0x00, + 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x6E 'n' - 0x00,0x00,0x00,0x58,0x64,0x44,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x6E 'n' + 0x00, 0x00, 0x00, 0x58, 0x64, 0x44, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, - 7, // 0x6F 'o' - 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x6F 'o' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 7, // 0x70 'p' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x40,0x40, + 7, // 0x70 'p' + 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, - 7, // 0x71 'q' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x04, + 7, // 0x71 'q' + 0x00, 0x00, 0x00, 0x3C, 0x44, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x04, - 6, // 0x72 'r' - 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 6, // 0x72 'r' + 0x00, 0x00, 0x00, 0x58, 0x24, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, - 7, // 0x73 's' - 0x00,0x00,0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x38,0x00,0x00, + 7, // 0x73 's' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x38, 0x04, 0x44, 0x38, 0x00, 0x00, - 5, // 0x74 't' - 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x20,0x20,0x18,0x00,0x00, + 5, // 0x74 't' + 0x00, 0x20, 0x20, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x18, 0x00, 0x00, - 7, // 0x75 'u' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x4C,0x34,0x00,0x00, + 7, // 0x75 'u' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x4C, 0x34, 0x00, 0x00, - 6, // 0x76 'v' - 0x00,0x00,0x00,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00, + 6, // 0x76 'v' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, - 9, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x49,0x00,0x49,0x00,0x49,0x00,0x36,0x00,0x00,0x00,0x00,0x00, + 9, // 0x77 'w' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x49, 0x00, 0x49, 0x00, 0x49, 0x00, + 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x78 'x' - 0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, + 7, // 0x78 'x' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x00, 0x00, - 7, // 0x79 'y' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x3C,0x08,0x70, + 7, // 0x79 'y' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x08, 0x70, - 6, // 0x7A 'z' - 0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, + 6, // 0x7A 'z' + 0x00, 0x00, 0x00, 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00, 0x00, - 5, // 0x7B '{' - 0x18,0x20,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x20,0x18,0x00, + 5, // 0x7B '{' + 0x18, 0x20, 0x20, 0x20, 0x20, 0xC0, 0x20, 0x20, 0x20, 0x20, 0x18, 0x00, - 3, // 0x7C '|' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00, + 3, // 0x7C '|' + 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, - 5, // 0x7D '}' - 0xC0,0x20,0x20,0x20,0x20,0x18,0x20,0x20,0x20,0x20,0xC0,0x00, + 5, // 0x7D '}' + 0xC0, 0x20, 0x20, 0x20, 0x20, 0x18, 0x20, 0x20, 0x20, 0x20, 0xC0, 0x00, - 7, // 0x7E '~' - 0x00,0x60,0x92,0x92,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x7E '~' + 0x00, 0x60, 0x92, 0x92, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x7F '' - 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00,0x00,0x00, + 7, // 0x7F '' + 0x00, 0x10, 0x38, 0x6C, 0x44, 0x44, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, - 0 -}; + 0}; -const int8u mcs13_prop[] = -{ - 13, 4, 32, 128-32, - 0x00,0x00,0x0E,0x00,0x1C,0x00,0x2A,0x00,0x38,0x00,0x46,0x00,0x54,0x00,0x62,0x00,0x70,0x00, - 0x7E,0x00,0x8C,0x00,0x9A,0x00,0xA8,0x00,0xB6,0x00,0xC4,0x00,0xD2,0x00,0xE0,0x00,0xEE,0x00, - 0xFC,0x00,0x0A,0x01,0x18,0x01,0x26,0x01,0x34,0x01,0x42,0x01,0x50,0x01,0x5E,0x01,0x6C,0x01, - 0x7A,0x01,0x88,0x01,0x96,0x01,0xA4,0x01,0xB2,0x01,0xC0,0x01,0xCE,0x01,0xDC,0x01,0xEA,0x01, - 0xF8,0x01,0x06,0x02,0x14,0x02,0x22,0x02,0x30,0x02,0x3E,0x02,0x4C,0x02,0x5A,0x02,0x68,0x02, - 0x76,0x02,0x91,0x02,0x9F,0x02,0xAD,0x02,0xBB,0x02,0xC9,0x02,0xD7,0x02,0xE5,0x02,0xF3,0x02, - 0x01,0x03,0x0F,0x03,0x2A,0x03,0x38,0x03,0x46,0x03,0x54,0x03,0x62,0x03,0x70,0x03,0x7E,0x03, - 0x8C,0x03,0x9A,0x03,0xA8,0x03,0xB6,0x03,0xC4,0x03,0xD2,0x03,0xE0,0x03,0xEE,0x03,0xFC,0x03, - 0x0A,0x04,0x18,0x04,0x26,0x04,0x34,0x04,0x42,0x04,0x50,0x04,0x6B,0x04,0x79,0x04,0x87,0x04, - 0x95,0x04,0xA3,0x04,0xB1,0x04,0xBF,0x04,0xCD,0x04,0xDB,0x04,0xE9,0x04,0x04,0x05,0x12,0x05, - 0x20,0x05,0x2E,0x05,0x3C,0x05,0x4A,0x05,0x58,0x05,0x66,0x05, +const int8u mcs13_prop[] = { + 13, 4, 32, 128 - 32, 0x00, 0x00, 0x0E, 0x00, 0x1C, 0x00, 0x2A, 0x00, 0x38, 0x00, 0x46, 0x00, 0x54, 0x00, + 0x62, 0x00, 0x70, 0x00, 0x7E, 0x00, 0x8C, 0x00, 0x9A, 0x00, 0xA8, 0x00, 0xB6, 0x00, 0xC4, 0x00, 0xD2, 0x00, + 0xE0, 0x00, 0xEE, 0x00, 0xFC, 0x00, 0x0A, 0x01, 0x18, 0x01, 0x26, 0x01, 0x34, 0x01, 0x42, 0x01, 0x50, 0x01, + 0x5E, 0x01, 0x6C, 0x01, 0x7A, 0x01, 0x88, 0x01, 0x96, 0x01, 0xA4, 0x01, 0xB2, 0x01, 0xC0, 0x01, 0xCE, 0x01, + 0xDC, 0x01, 0xEA, 0x01, 0xF8, 0x01, 0x06, 0x02, 0x14, 0x02, 0x22, 0x02, 0x30, 0x02, 0x3E, 0x02, 0x4C, 0x02, + 0x5A, 0x02, 0x68, 0x02, 0x76, 0x02, 0x91, 0x02, 0x9F, 0x02, 0xAD, 0x02, 0xBB, 0x02, 0xC9, 0x02, 0xD7, 0x02, + 0xE5, 0x02, 0xF3, 0x02, 0x01, 0x03, 0x0F, 0x03, 0x2A, 0x03, 0x38, 0x03, 0x46, 0x03, 0x54, 0x03, 0x62, 0x03, + 0x70, 0x03, 0x7E, 0x03, 0x8C, 0x03, 0x9A, 0x03, 0xA8, 0x03, 0xB6, 0x03, 0xC4, 0x03, 0xD2, 0x03, 0xE0, 0x03, + 0xEE, 0x03, 0xFC, 0x03, 0x0A, 0x04, 0x18, 0x04, 0x26, 0x04, 0x34, 0x04, 0x42, 0x04, 0x50, 0x04, 0x6B, 0x04, + 0x79, 0x04, 0x87, 0x04, 0x95, 0x04, 0xA3, 0x04, 0xB1, 0x04, 0xBF, 0x04, 0xCD, 0x04, 0xDB, 0x04, 0xE9, 0x04, + 0x04, 0x05, 0x12, 0x05, 0x20, 0x05, 0x2E, 0x05, 0x3C, 0x05, 0x4A, 0x05, 0x58, 0x05, 0x66, 0x05, - 5, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x21 '!' - 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, + 4, // 0x21 '!' + 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x00, 0x00, - 4, // 0x22 '"' - 0x00,0x50,0x50,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x22 '"' + 0x00, 0x50, 0x50, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x23 '#' - 0x00,0x28,0x28,0x28,0x7C,0x28,0x28,0x28,0x7C,0x28,0x28,0x28,0x00, + 6, // 0x23 '#' + 0x00, 0x28, 0x28, 0x28, 0x7C, 0x28, 0x28, 0x28, 0x7C, 0x28, 0x28, 0x28, 0x00, - 6, // 0x24 '$' - 0x00,0x10,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x10,0x00, + 6, // 0x24 '$' + 0x00, 0x10, 0x10, 0x38, 0x54, 0x50, 0x38, 0x14, 0x54, 0x38, 0x10, 0x10, 0x00, - 7, // 0x25 '%' - 0x00,0x32,0x54,0x64,0x08,0x08,0x10,0x10,0x26,0x2A,0x4C,0x00,0x00, + 7, // 0x25 '%' + 0x00, 0x32, 0x54, 0x64, 0x08, 0x08, 0x10, 0x10, 0x26, 0x2A, 0x4C, 0x00, 0x00, - 7, // 0x26 '&' - 0x00,0x30,0x48,0x48,0x48,0x30,0x4A,0x4A,0x44,0x3A,0x00,0x00,0x00, + 7, // 0x26 '&' + 0x00, 0x30, 0x48, 0x48, 0x48, 0x30, 0x4A, 0x4A, 0x44, 0x3A, 0x00, 0x00, 0x00, - 3, // 0x27 ''' - 0x00,0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 3, // 0x27 ''' + 0x00, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x28 '(' - 0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10,0x00,0x00, + 5, // 0x28 '(' + 0x10, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x10, 0x00, 0x00, - 5, // 0x29 ')' - 0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40,0x00,0x00, + 5, // 0x29 ')' + 0x40, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x40, 0x00, 0x00, - 6, // 0x2A '*' - 0x00,0x00,0x10,0x54,0x38,0x7C,0x38,0x54,0x10,0x00,0x00,0x00,0x00, + 6, // 0x2A '*' + 0x00, 0x00, 0x10, 0x54, 0x38, 0x7C, 0x38, 0x54, 0x10, 0x00, 0x00, 0x00, 0x00, - 6, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00,0x00, + 6, // 0x2B '+' + 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, - 4, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x20,0x40,0x80, + 4, // 0x2C ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x20, 0x40, 0x80, - 6, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x2D '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00, + 4, // 0x2E '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, - 7, // 0x2F '/' - 0x00,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,0x00, + 7, // 0x2F '/' + 0x00, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x00, 0x00, - 7, // 0x30 '0' - 0x00,0x38,0x44,0x44,0x54,0x54,0x54,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x30 '0' + 0x00, 0x38, 0x44, 0x44, 0x54, 0x54, 0x54, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, - 4, // 0x31 '1' - 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00, + 4, // 0x31 '1' + 0x00, 0x20, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, - 7, // 0x32 '2' - 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00,0x00, + 7, // 0x32 '2' + 0x00, 0x38, 0x44, 0x04, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00, 0x00, 0x00, - 7, // 0x33 '3' - 0x00,0x38,0x44,0x04,0x04,0x38,0x04,0x04,0x44,0x38,0x00,0x00,0x00, + 7, // 0x33 '3' + 0x00, 0x38, 0x44, 0x04, 0x04, 0x38, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, - 6, // 0x34 '4' - 0x00,0x08,0x18,0x28,0x28,0x48,0x48,0x7C,0x08,0x08,0x00,0x00,0x00, + 6, // 0x34 '4' + 0x00, 0x08, 0x18, 0x28, 0x28, 0x48, 0x48, 0x7C, 0x08, 0x08, 0x00, 0x00, 0x00, - 7, // 0x35 '5' - 0x00,0x7C,0x40,0x40,0x78,0x44,0x04,0x04,0x44,0x38,0x00,0x00,0x00, + 7, // 0x35 '5' + 0x00, 0x7C, 0x40, 0x40, 0x78, 0x44, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x36 '6' - 0x00,0x38,0x44,0x40,0x78,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x36 '6' + 0x00, 0x38, 0x44, 0x40, 0x78, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, - 6, // 0x37 '7' - 0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x00,0x00,0x00, + 6, // 0x37 '7' + 0x00, 0x7C, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, - 7, // 0x38 '8' - 0x00,0x38,0x44,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x38 '8' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x39 '9' - 0x00,0x38,0x44,0x44,0x44,0x3C,0x04,0x04,0x44,0x38,0x00,0x00,0x00, + 7, // 0x39 '9' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, - 4, // 0x3A ':' - 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00, + 4, // 0x3A ':' + 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, - 4, // 0x3B ';' - 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x20,0x40,0x80, + 4, // 0x3B ';' + 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x20, 0x40, 0x80, - 6, // 0x3C '<' - 0x00,0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00,0x00, + 6, // 0x3C '<' + 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, - 6, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, + 6, // 0x3D '=' + 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x3E '>' - 0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00,0x00, + 6, // 0x3E '>' + 0x00, 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, - 6, // 0x3F '?' - 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x10,0x00,0x10,0x00,0x00,0x00, + 6, // 0x3F '?' + 0x00, 0x38, 0x44, 0x04, 0x04, 0x08, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, - 7, // 0x40 '@' - 0x00,0x38,0x44,0x44,0x5C,0x54,0x54,0x4C,0x40,0x38,0x00,0x00,0x00, + 7, // 0x40 '@' + 0x00, 0x38, 0x44, 0x44, 0x5C, 0x54, 0x54, 0x4C, 0x40, 0x38, 0x00, 0x00, 0x00, - 7, // 0x41 'A' - 0x00,0x38,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x41 'A' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, - 7, // 0x42 'B' - 0x00,0x78,0x44,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00,0x00,0x00, + 7, // 0x42 'B' + 0x00, 0x78, 0x44, 0x44, 0x44, 0x78, 0x44, 0x44, 0x44, 0x78, 0x00, 0x00, 0x00, - 6, // 0x43 'C' - 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00,0x00, + 6, // 0x43 'C' + 0x00, 0x38, 0x44, 0x40, 0x40, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x44 'D' - 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00,0x00, + 7, // 0x44 'D' + 0x00, 0x70, 0x48, 0x44, 0x44, 0x44, 0x44, 0x44, 0x48, 0x70, 0x00, 0x00, 0x00, - 6, // 0x45 'E' - 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x7C,0x00,0x00,0x00, + 6, // 0x45 'E' + 0x00, 0x7C, 0x40, 0x40, 0x40, 0x78, 0x40, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00, - 6, // 0x46 'F' - 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 6, // 0x46 'F' + 0x00, 0x7C, 0x40, 0x40, 0x40, 0x78, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, - 7, // 0x47 'G' - 0x00,0x38,0x44,0x40,0x40,0x5C,0x44,0x44,0x4C,0x34,0x00,0x00,0x00, + 7, // 0x47 'G' + 0x00, 0x38, 0x44, 0x40, 0x40, 0x5C, 0x44, 0x44, 0x4C, 0x34, 0x00, 0x00, 0x00, - 7, // 0x48 'H' - 0x00,0x44,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x48 'H' + 0x00, 0x44, 0x44, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, - 5, // 0x49 'I' - 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00, + 5, // 0x49 'I' + 0x00, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, 0x00, - 6, // 0x4A 'J' - 0x00,0x1C,0x08,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00,0x00, + 6, // 0x4A 'J' + 0x00, 0x1C, 0x08, 0x08, 0x08, 0x08, 0x08, 0x48, 0x48, 0x30, 0x00, 0x00, 0x00, - 6, // 0x4B 'K' - 0x00,0x44,0x48,0x50,0x60,0x60,0x50,0x48,0x44,0x44,0x00,0x00,0x00, + 6, // 0x4B 'K' + 0x00, 0x44, 0x48, 0x50, 0x60, 0x60, 0x50, 0x48, 0x44, 0x44, 0x00, 0x00, 0x00, - 6, // 0x4C 'L' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00,0x00, + 6, // 0x4C 'L' + 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00, - 9, // 0x4D 'M' - 0x00,0x00,0x41,0x00,0x63,0x00,0x55,0x00,0x49,0x00,0x49,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x4D 'M' + 0x00, 0x00, 0x41, 0x00, 0x63, 0x00, 0x55, 0x00, 0x49, 0x00, 0x49, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, + 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x4E 'N' - 0x00,0x44,0x64,0x64,0x54,0x54,0x4C,0x4C,0x44,0x44,0x00,0x00,0x00, + 7, // 0x4E 'N' + 0x00, 0x44, 0x64, 0x64, 0x54, 0x54, 0x4C, 0x4C, 0x44, 0x44, 0x00, 0x00, 0x00, - 7, // 0x4F 'O' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x4F 'O' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x50 'P' - 0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00,0x00, + 7, // 0x50 'P' + 0x00, 0x78, 0x44, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, - 7, // 0x51 'Q' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00,0x00, + 7, // 0x51 'Q' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x54, 0x48, 0x34, 0x00, 0x00, 0x00, - 7, // 0x52 'R' - 0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x48,0x44,0x44,0x00,0x00,0x00, + 7, // 0x52 'R' + 0x00, 0x78, 0x44, 0x44, 0x44, 0x44, 0x78, 0x48, 0x44, 0x44, 0x00, 0x00, 0x00, - 7, // 0x53 'S' - 0x00,0x38,0x44,0x40,0x40,0x38,0x04,0x04,0x44,0x38,0x00,0x00,0x00, + 7, // 0x53 'S' + 0x00, 0x38, 0x44, 0x40, 0x40, 0x38, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, - 6, // 0x54 'T' - 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x00, + 6, // 0x54 'T' + 0x00, 0x7C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, - 7, // 0x55 'U' - 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x55 'U' + 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, - 6, // 0x56 'V' - 0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00,0x00,0x00, + 6, // 0x56 'V' + 0x00, 0x44, 0x44, 0x44, 0x44, 0x28, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, 0x00, - 9, // 0x57 'W' - 0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x49,0x00,0x49,0x00,0x55,0x00,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x57 'W' + 0x00, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x49, 0x00, 0x49, 0x00, 0x55, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x58 'X' - 0x00,0x44,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x58 'X' + 0x00, 0x44, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, - 7, // 0x59 'Y' - 0x00,0x44,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x00,0x00,0x00, + 7, // 0x59 'Y' + 0x00, 0x44, 0x44, 0x44, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, - 6, // 0x5A 'Z' - 0x00,0x7C,0x04,0x04,0x08,0x10,0x20,0x40,0x40,0x7C,0x00,0x00,0x00, + 6, // 0x5A 'Z' + 0x00, 0x7C, 0x04, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00, - 4, // 0x5B '[' - 0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70,0x00,0x00, + 4, // 0x5B '[' + 0x70, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x70, 0x00, 0x00, - 7, // 0x5C '\' - 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00,0x00, + 7, // 0x5C '\' + 0x00, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x00, 0x00, - 4, // 0x5D ']' - 0xE0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xE0,0x00,0x00, + 4, // 0x5D ']' + 0xE0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xE0, 0x00, 0x00, - 6, // 0x5E '^' - 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x5E '^' + 0x00, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00, + 6, // 0x5F '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, - 4, // 0x60 '`' - 0x00,0x40,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x60 '`' + 0x00, 0x40, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x61 'a' - 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x44,0x3C,0x00,0x00,0x00, + 7, // 0x61 'a' + 0x00, 0x00, 0x00, 0x38, 0x04, 0x3C, 0x44, 0x44, 0x44, 0x3C, 0x00, 0x00, 0x00, - 7, // 0x62 'b' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x00,0x00,0x00, + 7, // 0x62 'b' + 0x00, 0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x44, 0x44, 0x78, 0x00, 0x00, 0x00, - 6, // 0x63 'c' - 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x44,0x38,0x00,0x00,0x00, + 6, // 0x63 'c' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x64 'd' - 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x00,0x00,0x00, + 7, // 0x64 'd' + 0x00, 0x04, 0x04, 0x3C, 0x44, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x00, 0x00, 0x00, - 7, // 0x65 'e' - 0x00,0x00,0x00,0x38,0x44,0x44,0x7C,0x40,0x44,0x38,0x00,0x00,0x00, + 7, // 0x65 'e' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x7C, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00, - 4, // 0x66 'f' - 0x00,0x30,0x40,0xE0,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 4, // 0x66 'f' + 0x00, 0x30, 0x40, 0xE0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, - 7, // 0x67 'g' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x44,0x38, + 7, // 0x67 'g' + 0x00, 0x00, 0x00, 0x3C, 0x44, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x44, 0x38, - 7, // 0x68 'h' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x68 'h' + 0x00, 0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, - 3, // 0x69 'i' - 0x00,0x40,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 3, // 0x69 'i' + 0x00, 0x40, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, - 5, // 0x6A 'j' - 0x00,0x10,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x90,0x60,0x00, + 5, // 0x6A 'j' + 0x00, 0x10, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x90, 0x60, 0x00, - 6, // 0x6B 'k' - 0x00,0x40,0x40,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00,0x00, + 6, // 0x6B 'k' + 0x00, 0x40, 0x40, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x00, 0x00, 0x00, - 3, // 0x6C 'l' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 3, // 0x6C 'l' + 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, - 9, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x76,0x00,0x49,0x00,0x49,0x00,0x49,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x6D 'm' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x00, 0x49, 0x00, 0x49, 0x00, 0x49, 0x00, 0x41, 0x00, 0x41, 0x00, + 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x6E 'n' - 0x00,0x00,0x00,0x58,0x64,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x6E 'n' + 0x00, 0x00, 0x00, 0x58, 0x64, 0x44, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, - 7, // 0x6F 'o' - 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x6F 'o' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x70 'p' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40, + 7, // 0x70 'p' + 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, - 7, // 0x71 'q' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x04,0x04, + 7, // 0x71 'q' + 0x00, 0x00, 0x00, 0x3C, 0x44, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x04, 0x04, - 6, // 0x72 'r' - 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00, + 6, // 0x72 'r' + 0x00, 0x00, 0x00, 0x58, 0x24, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, 0x00, - 7, // 0x73 's' - 0x00,0x00,0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x38,0x00,0x00,0x00, + 7, // 0x73 's' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x38, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, - 5, // 0x74 't' - 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x20,0x20,0x18,0x00,0x00,0x00, + 5, // 0x74 't' + 0x00, 0x20, 0x20, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x18, 0x00, 0x00, 0x00, - 7, // 0x75 'u' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x4C,0x34,0x00,0x00,0x00, + 7, // 0x75 'u' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x4C, 0x34, 0x00, 0x00, 0x00, - 6, // 0x76 'v' - 0x00,0x00,0x00,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00,0x00, + 6, // 0x76 'v' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, 0x00, - 9, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x49,0x00,0x49,0x00,0x49,0x00,0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x77 'w' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x49, 0x00, 0x49, 0x00, 0x49, 0x00, + 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x78 'x' - 0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00,0x00, + 7, // 0x78 'x' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x00, 0x00, 0x00, - 7, // 0x79 'y' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x08,0x70, + 7, // 0x79 'y' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x08, 0x70, - 6, // 0x7A 'z' - 0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00,0x00, + 6, // 0x7A 'z' + 0x00, 0x00, 0x00, 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00, 0x00, 0x00, - 5, // 0x7B '{' - 0x18,0x20,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x20,0x18,0x00,0x00, + 5, // 0x7B '{' + 0x18, 0x20, 0x20, 0x20, 0x20, 0xC0, 0x20, 0x20, 0x20, 0x20, 0x18, 0x00, 0x00, - 3, // 0x7C '|' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 3, // 0x7C '|' + 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, - 5, // 0x7D '}' - 0xC0,0x20,0x20,0x20,0x20,0x18,0x20,0x20,0x20,0x20,0xC0,0x00,0x00, + 5, // 0x7D '}' + 0xC0, 0x20, 0x20, 0x20, 0x20, 0x18, 0x20, 0x20, 0x20, 0x20, 0xC0, 0x00, 0x00, - 7, // 0x7E '~' - 0x00,0x60,0x92,0x92,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x7E '~' + 0x00, 0x60, 0x92, 0x92, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x7F '' - 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x7F '' + 0x00, 0x10, 0x38, 0x6C, 0x44, 0x44, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0 -}; + 0}; -const int8u mcs5x10_mono[] = -{ - 10, 2, 32, 128-32, - 0x00,0x00,0x0B,0x00,0x16,0x00,0x21,0x00,0x2C,0x00,0x37,0x00,0x42,0x00,0x4D,0x00,0x58,0x00, - 0x63,0x00,0x6E,0x00,0x79,0x00,0x84,0x00,0x8F,0x00,0x9A,0x00,0xA5,0x00,0xB0,0x00,0xBB,0x00, - 0xC6,0x00,0xD1,0x00,0xDC,0x00,0xE7,0x00,0xF2,0x00,0xFD,0x00,0x08,0x01,0x13,0x01,0x1E,0x01, - 0x29,0x01,0x34,0x01,0x3F,0x01,0x4A,0x01,0x55,0x01,0x60,0x01,0x6B,0x01,0x76,0x01,0x81,0x01, - 0x8C,0x01,0x97,0x01,0xA2,0x01,0xAD,0x01,0xB8,0x01,0xC3,0x01,0xCE,0x01,0xD9,0x01,0xE4,0x01, - 0xEF,0x01,0xFA,0x01,0x05,0x02,0x10,0x02,0x1B,0x02,0x26,0x02,0x31,0x02,0x3C,0x02,0x47,0x02, - 0x52,0x02,0x5D,0x02,0x68,0x02,0x73,0x02,0x7E,0x02,0x89,0x02,0x94,0x02,0x9F,0x02,0xAA,0x02, - 0xB5,0x02,0xC0,0x02,0xCB,0x02,0xD6,0x02,0xE1,0x02,0xEC,0x02,0xF7,0x02,0x02,0x03,0x0D,0x03, - 0x18,0x03,0x23,0x03,0x2E,0x03,0x39,0x03,0x44,0x03,0x4F,0x03,0x5A,0x03,0x65,0x03,0x70,0x03, - 0x7B,0x03,0x86,0x03,0x91,0x03,0x9C,0x03,0xA7,0x03,0xB2,0x03,0xBD,0x03,0xC8,0x03,0xD3,0x03, - 0xDE,0x03,0xE9,0x03,0xF4,0x03,0xFF,0x03,0x0A,0x04,0x15,0x04, +const int8u mcs5x10_mono[] = { + 10, 2, 32, 128 - 32, 0x00, 0x00, 0x0B, 0x00, 0x16, 0x00, 0x21, 0x00, 0x2C, 0x00, 0x37, 0x00, 0x42, 0x00, + 0x4D, 0x00, 0x58, 0x00, 0x63, 0x00, 0x6E, 0x00, 0x79, 0x00, 0x84, 0x00, 0x8F, 0x00, 0x9A, 0x00, 0xA5, 0x00, + 0xB0, 0x00, 0xBB, 0x00, 0xC6, 0x00, 0xD1, 0x00, 0xDC, 0x00, 0xE7, 0x00, 0xF2, 0x00, 0xFD, 0x00, 0x08, 0x01, + 0x13, 0x01, 0x1E, 0x01, 0x29, 0x01, 0x34, 0x01, 0x3F, 0x01, 0x4A, 0x01, 0x55, 0x01, 0x60, 0x01, 0x6B, 0x01, + 0x76, 0x01, 0x81, 0x01, 0x8C, 0x01, 0x97, 0x01, 0xA2, 0x01, 0xAD, 0x01, 0xB8, 0x01, 0xC3, 0x01, 0xCE, 0x01, + 0xD9, 0x01, 0xE4, 0x01, 0xEF, 0x01, 0xFA, 0x01, 0x05, 0x02, 0x10, 0x02, 0x1B, 0x02, 0x26, 0x02, 0x31, 0x02, + 0x3C, 0x02, 0x47, 0x02, 0x52, 0x02, 0x5D, 0x02, 0x68, 0x02, 0x73, 0x02, 0x7E, 0x02, 0x89, 0x02, 0x94, 0x02, + 0x9F, 0x02, 0xAA, 0x02, 0xB5, 0x02, 0xC0, 0x02, 0xCB, 0x02, 0xD6, 0x02, 0xE1, 0x02, 0xEC, 0x02, 0xF7, 0x02, + 0x02, 0x03, 0x0D, 0x03, 0x18, 0x03, 0x23, 0x03, 0x2E, 0x03, 0x39, 0x03, 0x44, 0x03, 0x4F, 0x03, 0x5A, 0x03, + 0x65, 0x03, 0x70, 0x03, 0x7B, 0x03, 0x86, 0x03, 0x91, 0x03, 0x9C, 0x03, 0xA7, 0x03, 0xB2, 0x03, 0xBD, 0x03, + 0xC8, 0x03, 0xD3, 0x03, 0xDE, 0x03, 0xE9, 0x03, 0xF4, 0x03, 0xFF, 0x03, 0x0A, 0x04, 0x15, 0x04, - 5, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x21 '!' - 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00, + 5, // 0x21 '!' + 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x00, - 5, // 0x22 '"' - 0x00,0x50,0x50,0xA0,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x22 '"' + 0x00, 0x50, 0x50, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x23 '#' - 0x00,0x50,0x50,0xF8,0x50,0x50,0x50,0xF8,0x50,0x50, + 5, // 0x23 '#' + 0x00, 0x50, 0x50, 0xF8, 0x50, 0x50, 0x50, 0xF8, 0x50, 0x50, - 5, // 0x24 '$' - 0x00,0x40,0x60,0x90,0x80,0x60,0x10,0x90,0x60,0x20, + 5, // 0x24 '$' + 0x00, 0x40, 0x60, 0x90, 0x80, 0x60, 0x10, 0x90, 0x60, 0x20, - 5, // 0x25 '%' - 0x00,0x00,0x90,0x90,0x20,0x20,0x40,0x40,0x90,0x90, + 5, // 0x25 '%' + 0x00, 0x00, 0x90, 0x90, 0x20, 0x20, 0x40, 0x40, 0x90, 0x90, - 5, // 0x26 '&' - 0x00,0x40,0xA0,0xA0,0xA0,0x40,0xA8,0x90,0x90,0x68, + 5, // 0x26 '&' + 0x00, 0x40, 0xA0, 0xA0, 0xA0, 0x40, 0xA8, 0x90, 0x90, 0x68, - 5, // 0x27 ''' - 0x00,0x20,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x27 ''' + 0x00, 0x20, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x28 '(' - 0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x20,0x20,0x10, + 5, // 0x28 '(' + 0x10, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x10, - 5, // 0x29 ')' - 0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x20,0x20,0x40, + 5, // 0x29 ')' + 0x40, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x40, - 5, // 0x2A '*' - 0x00,0x00,0x90,0x60,0xF0,0x60,0x90,0x00,0x00,0x00, + 5, // 0x2A '*' + 0x00, 0x00, 0x90, 0x60, 0xF0, 0x60, 0x90, 0x00, 0x00, 0x00, - 5, // 0x2B '+' - 0x00,0x00,0x00,0x20,0x20,0xF8,0x20,0x20,0x00,0x00, + 5, // 0x2B '+' + 0x00, 0x00, 0x00, 0x20, 0x20, 0xF8, 0x20, 0x20, 0x00, 0x00, - 5, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0xC0, + 5, // 0x2C ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0xC0, - 5, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00, + 5, // 0x2D '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x00, - 5, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00, + 5, // 0x2E '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, - 5, // 0x2F '/' - 0x00,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x00, + 5, // 0x2F '/' + 0x00, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x00, - 5, // 0x30 '0' - 0x00,0x70,0x90,0x90,0x90,0x90,0x90,0x90,0xE0,0x00, + 5, // 0x30 '0' + 0x00, 0x70, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0xE0, 0x00, - 5, // 0x31 '1' - 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00, + 5, // 0x31 '1' + 0x00, 0x20, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, - 5, // 0x32 '2' - 0x00,0x60,0x90,0x90,0x10,0x20,0x40,0x80,0xF0,0x00, + 5, // 0x32 '2' + 0x00, 0x60, 0x90, 0x90, 0x10, 0x20, 0x40, 0x80, 0xF0, 0x00, - 5, // 0x33 '3' - 0x00,0x60,0x90,0x10,0x60,0x10,0x10,0x90,0x60,0x00, + 5, // 0x33 '3' + 0x00, 0x60, 0x90, 0x10, 0x60, 0x10, 0x10, 0x90, 0x60, 0x00, - 5, // 0x34 '4' - 0x00,0x10,0x30,0x50,0x50,0x90,0xF0,0x10,0x10,0x00, + 5, // 0x34 '4' + 0x00, 0x10, 0x30, 0x50, 0x50, 0x90, 0xF0, 0x10, 0x10, 0x00, - 5, // 0x35 '5' - 0x00,0xF0,0x80,0x80,0xE0,0x10,0x10,0x90,0x60,0x00, + 5, // 0x35 '5' + 0x00, 0xF0, 0x80, 0x80, 0xE0, 0x10, 0x10, 0x90, 0x60, 0x00, - 5, // 0x36 '6' - 0x00,0x60,0x80,0x80,0xE0,0x90,0x90,0x90,0x60,0x00, + 5, // 0x36 '6' + 0x00, 0x60, 0x80, 0x80, 0xE0, 0x90, 0x90, 0x90, 0x60, 0x00, - 5, // 0x37 '7' - 0x00,0xF0,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x00, + 5, // 0x37 '7' + 0x00, 0xF0, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x40, 0x00, - 5, // 0x38 '8' - 0x00,0x60,0x90,0x90,0x60,0x90,0x90,0x90,0x60,0x00, + 5, // 0x38 '8' + 0x00, 0x60, 0x90, 0x90, 0x60, 0x90, 0x90, 0x90, 0x60, 0x00, - 5, // 0x39 '9' - 0x00,0x60,0x90,0x90,0x90,0x70,0x10,0x10,0x60,0x00, + 5, // 0x39 '9' + 0x00, 0x60, 0x90, 0x90, 0x90, 0x70, 0x10, 0x10, 0x60, 0x00, - 5, // 0x3A ':' - 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x00, + 5, // 0x3A ':' + 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, - 5, // 0x3B ';' - 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0xC0, + 5, // 0x3B ';' + 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0xC0, - 5, // 0x3C '<' - 0x00,0x08,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x08, + 5, // 0x3C '<' + 0x00, 0x08, 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, 0x10, 0x08, - 5, // 0x3D '=' - 0x00,0x00,0x00,0x00,0xF0,0x00,0xF0,0x00,0x00,0x00, + 5, // 0x3D '=' + 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0xF0, 0x00, 0x00, 0x00, - 5, // 0x3E '>' - 0x00,0x80,0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x80, + 5, // 0x3E '>' + 0x00, 0x80, 0x40, 0x20, 0x10, 0x08, 0x10, 0x20, 0x40, 0x80, - 5, // 0x3F '?' - 0x00,0x60,0x90,0x10,0x10,0x20,0x40,0x00,0x40,0x00, + 5, // 0x3F '?' + 0x00, 0x60, 0x90, 0x10, 0x10, 0x20, 0x40, 0x00, 0x40, 0x00, - 5, // 0x40 '@' - 0x00,0x60,0x90,0x90,0xB0,0xB0,0x80,0x80,0x70,0x00, + 5, // 0x40 '@' + 0x00, 0x60, 0x90, 0x90, 0xB0, 0xB0, 0x80, 0x80, 0x70, 0x00, - 5, // 0x41 'A' - 0x00,0x60,0x90,0x90,0x90,0xF0,0x90,0x90,0x90,0x00, + 5, // 0x41 'A' + 0x00, 0x60, 0x90, 0x90, 0x90, 0xF0, 0x90, 0x90, 0x90, 0x00, - 5, // 0x42 'B' - 0x00,0xE0,0x90,0x90,0xE0,0x90,0x90,0x90,0xE0,0x00, + 5, // 0x42 'B' + 0x00, 0xE0, 0x90, 0x90, 0xE0, 0x90, 0x90, 0x90, 0xE0, 0x00, - 5, // 0x43 'C' - 0x00,0x60,0x90,0x80,0x80,0x80,0x80,0x90,0x60,0x00, + 5, // 0x43 'C' + 0x00, 0x60, 0x90, 0x80, 0x80, 0x80, 0x80, 0x90, 0x60, 0x00, - 5, // 0x44 'D' - 0x00,0xE0,0x90,0x90,0x90,0x90,0x90,0x90,0xE0,0x00, + 5, // 0x44 'D' + 0x00, 0xE0, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0xE0, 0x00, - 5, // 0x45 'E' - 0x00,0xF0,0x80,0x80,0xF0,0x80,0x80,0x80,0xF0,0x00, + 5, // 0x45 'E' + 0x00, 0xF0, 0x80, 0x80, 0xF0, 0x80, 0x80, 0x80, 0xF0, 0x00, - 5, // 0x46 'F' - 0x00,0xF0,0x80,0x80,0xF0,0x80,0x80,0x80,0x80,0x00, + 5, // 0x46 'F' + 0x00, 0xF0, 0x80, 0x80, 0xF0, 0x80, 0x80, 0x80, 0x80, 0x00, - 5, // 0x47 'G' - 0x00,0x60,0x90,0x80,0x80,0xB0,0x90,0x90,0x60,0x00, + 5, // 0x47 'G' + 0x00, 0x60, 0x90, 0x80, 0x80, 0xB0, 0x90, 0x90, 0x60, 0x00, - 5, // 0x48 'H' - 0x00,0x90,0x90,0x90,0x90,0xF0,0x90,0x90,0x90,0x00, + 5, // 0x48 'H' + 0x00, 0x90, 0x90, 0x90, 0x90, 0xF0, 0x90, 0x90, 0x90, 0x00, - 5, // 0x49 'I' - 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00, + 5, // 0x49 'I' + 0x00, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, - 5, // 0x4A 'J' - 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0xA0,0x40,0x00, + 5, // 0x4A 'J' + 0x00, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0xA0, 0x40, 0x00, - 5, // 0x4B 'K' - 0x00,0x90,0xA0,0xA0,0xC0,0xC0,0xA0,0xA0,0x90,0x00, + 5, // 0x4B 'K' + 0x00, 0x90, 0xA0, 0xA0, 0xC0, 0xC0, 0xA0, 0xA0, 0x90, 0x00, - 5, // 0x4C 'L' - 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xF0,0x00, + 5, // 0x4C 'L' + 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xF0, 0x00, - 5, // 0x4D 'M' - 0x00,0x90,0x90,0xF0,0xF0,0x90,0x90,0x90,0x90,0x00, + 5, // 0x4D 'M' + 0x00, 0x90, 0x90, 0xF0, 0xF0, 0x90, 0x90, 0x90, 0x90, 0x00, - 5, // 0x4E 'N' - 0x00,0x90,0x90,0xD0,0xD0,0xB0,0xB0,0x90,0x90,0x00, + 5, // 0x4E 'N' + 0x00, 0x90, 0x90, 0xD0, 0xD0, 0xB0, 0xB0, 0x90, 0x90, 0x00, - 5, // 0x4F 'O' - 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00, + 5, // 0x4F 'O' + 0x00, 0x60, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x60, 0x00, - 5, // 0x50 'P' - 0x00,0xE0,0x90,0x90,0x90,0xE0,0x80,0x80,0x80,0x00, + 5, // 0x50 'P' + 0x00, 0xE0, 0x90, 0x90, 0x90, 0xE0, 0x80, 0x80, 0x80, 0x00, - 5, // 0x51 'Q' - 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x30, + 5, // 0x51 'Q' + 0x00, 0x60, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x60, 0x30, - 5, // 0x52 'R' - 0x00,0xE0,0x90,0x90,0x90,0xE0,0xA0,0x90,0x90,0x00, + 5, // 0x52 'R' + 0x00, 0xE0, 0x90, 0x90, 0x90, 0xE0, 0xA0, 0x90, 0x90, 0x00, - 5, // 0x53 'S' - 0x00,0x60,0x90,0x80,0x60,0x10,0x90,0x90,0x60,0x00, + 5, // 0x53 'S' + 0x00, 0x60, 0x90, 0x80, 0x60, 0x10, 0x90, 0x90, 0x60, 0x00, - 5, // 0x54 'T' - 0x00,0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00, + 5, // 0x54 'T' + 0x00, 0xF8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, - 5, // 0x55 'U' - 0x00,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00, + 5, // 0x55 'U' + 0x00, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x60, 0x00, - 5, // 0x56 'V' - 0x00,0x90,0x90,0x90,0x50,0x50,0x50,0x20,0x20,0x00, + 5, // 0x56 'V' + 0x00, 0x90, 0x90, 0x90, 0x50, 0x50, 0x50, 0x20, 0x20, 0x00, - 5, // 0x57 'W' - 0x00,0x90,0x90,0x90,0x90,0x90,0xF0,0xF0,0x90,0x00, + 5, // 0x57 'W' + 0x00, 0x90, 0x90, 0x90, 0x90, 0x90, 0xF0, 0xF0, 0x90, 0x00, - 5, // 0x58 'X' - 0x00,0x90,0x90,0x90,0x60,0x60,0x90,0x90,0x90,0x00, + 5, // 0x58 'X' + 0x00, 0x90, 0x90, 0x90, 0x60, 0x60, 0x90, 0x90, 0x90, 0x00, - 5, // 0x59 'Y' - 0x00,0x88,0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x00, + 5, // 0x59 'Y' + 0x00, 0x88, 0x88, 0x88, 0x50, 0x20, 0x20, 0x20, 0x20, 0x00, - 5, // 0x5A 'Z' - 0x00,0xF0,0x10,0x20,0x20,0x40,0x40,0x80,0xF0,0x00, + 5, // 0x5A 'Z' + 0x00, 0xF0, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0xF0, 0x00, - 5, // 0x5B '[' - 0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x60, + 5, // 0x5B '[' + 0x60, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x60, - 5, // 0x5C '\' - 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08, + 5, // 0x5C '\' + 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, - 5, // 0x5D ']' - 0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x60, + 5, // 0x5D ']' + 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x60, - 5, // 0x5E '^' - 0x00,0x20,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x5E '^' + 0x00, 0x20, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00, + 5, // 0x5F '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, - 5, // 0x60 '`' - 0x00,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x60 '`' + 0x00, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x61 'a' - 0x00,0x00,0x00,0x60,0x10,0x70,0x90,0x90,0x70,0x00, + 5, // 0x61 'a' + 0x00, 0x00, 0x00, 0x60, 0x10, 0x70, 0x90, 0x90, 0x70, 0x00, - 5, // 0x62 'b' - 0x00,0x80,0x80,0xE0,0x90,0x90,0x90,0x90,0xE0,0x00, + 5, // 0x62 'b' + 0x00, 0x80, 0x80, 0xE0, 0x90, 0x90, 0x90, 0x90, 0xE0, 0x00, - 5, // 0x63 'c' - 0x00,0x00,0x00,0x60,0x90,0x80,0x80,0x90,0x60,0x00, + 5, // 0x63 'c' + 0x00, 0x00, 0x00, 0x60, 0x90, 0x80, 0x80, 0x90, 0x60, 0x00, - 5, // 0x64 'd' - 0x00,0x10,0x10,0x70,0x90,0x90,0x90,0x90,0x70,0x00, + 5, // 0x64 'd' + 0x00, 0x10, 0x10, 0x70, 0x90, 0x90, 0x90, 0x90, 0x70, 0x00, - 5, // 0x65 'e' - 0x00,0x00,0x00,0x60,0x90,0x90,0xF0,0x80,0x70,0x00, + 5, // 0x65 'e' + 0x00, 0x00, 0x00, 0x60, 0x90, 0x90, 0xF0, 0x80, 0x70, 0x00, - 5, // 0x66 'f' - 0x00,0x30,0x40,0xE0,0x40,0x40,0x40,0x40,0x40,0x00, + 5, // 0x66 'f' + 0x00, 0x30, 0x40, 0xE0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, - 5, // 0x67 'g' - 0x00,0x00,0x00,0x70,0x90,0x90,0x90,0x70,0x10,0xE0, + 5, // 0x67 'g' + 0x00, 0x00, 0x00, 0x70, 0x90, 0x90, 0x90, 0x70, 0x10, 0xE0, - 5, // 0x68 'h' - 0x00,0x80,0x80,0xE0,0x90,0x90,0x90,0x90,0x90,0x00, + 5, // 0x68 'h' + 0x00, 0x80, 0x80, 0xE0, 0x90, 0x90, 0x90, 0x90, 0x90, 0x00, - 5, // 0x69 'i' - 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0x20,0x70,0x00, + 5, // 0x69 'i' + 0x00, 0x20, 0x00, 0x60, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, - 5, // 0x6A 'j' - 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0x20,0x20,0xC0, + 5, // 0x6A 'j' + 0x00, 0x20, 0x00, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0xC0, - 5, // 0x6B 'k' - 0x00,0x80,0x80,0x90,0xA0,0xC0,0xA0,0x90,0x90,0x00, + 5, // 0x6B 'k' + 0x00, 0x80, 0x80, 0x90, 0xA0, 0xC0, 0xA0, 0x90, 0x90, 0x00, - 5, // 0x6C 'l' - 0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00, + 5, // 0x6C 'l' + 0x00, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, - 5, // 0x6D 'm' - 0x00,0x00,0x00,0x90,0xF0,0x90,0x90,0x90,0x90,0x00, + 5, // 0x6D 'm' + 0x00, 0x00, 0x00, 0x90, 0xF0, 0x90, 0x90, 0x90, 0x90, 0x00, - 5, // 0x6E 'n' - 0x00,0x00,0x00,0xE0,0x90,0x90,0x90,0x90,0x90,0x00, + 5, // 0x6E 'n' + 0x00, 0x00, 0x00, 0xE0, 0x90, 0x90, 0x90, 0x90, 0x90, 0x00, - 5, // 0x6F 'o' - 0x00,0x00,0x00,0x60,0x90,0x90,0x90,0x90,0x60,0x00, + 5, // 0x6F 'o' + 0x00, 0x00, 0x00, 0x60, 0x90, 0x90, 0x90, 0x90, 0x60, 0x00, - 5, // 0x70 'p' - 0x00,0x00,0x00,0xE0,0x90,0x90,0x90,0xE0,0x80,0x80, + 5, // 0x70 'p' + 0x00, 0x00, 0x00, 0xE0, 0x90, 0x90, 0x90, 0xE0, 0x80, 0x80, - 5, // 0x71 'q' - 0x00,0x00,0x00,0x70,0x90,0x90,0x90,0x70,0x10,0x10, + 5, // 0x71 'q' + 0x00, 0x00, 0x00, 0x70, 0x90, 0x90, 0x90, 0x70, 0x10, 0x10, - 5, // 0x72 'r' - 0x00,0x00,0x00,0xB0,0x50,0x40,0x40,0x40,0xE0,0x00, + 5, // 0x72 'r' + 0x00, 0x00, 0x00, 0xB0, 0x50, 0x40, 0x40, 0x40, 0xE0, 0x00, - 5, // 0x73 's' - 0x00,0x00,0x00,0x60,0x90,0x40,0x20,0x90,0x60,0x00, + 5, // 0x73 's' + 0x00, 0x00, 0x00, 0x60, 0x90, 0x40, 0x20, 0x90, 0x60, 0x00, - 5, // 0x74 't' - 0x00,0x40,0x40,0xE0,0x40,0x40,0x40,0x50,0x20,0x00, + 5, // 0x74 't' + 0x00, 0x40, 0x40, 0xE0, 0x40, 0x40, 0x40, 0x50, 0x20, 0x00, - 5, // 0x75 'u' - 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0x90,0x70,0x00, + 5, // 0x75 'u' + 0x00, 0x00, 0x00, 0x90, 0x90, 0x90, 0x90, 0x90, 0x70, 0x00, - 5, // 0x76 'v' - 0x00,0x00,0x00,0x90,0x90,0x50,0x50,0x20,0x20,0x00, + 5, // 0x76 'v' + 0x00, 0x00, 0x00, 0x90, 0x90, 0x50, 0x50, 0x20, 0x20, 0x00, - 5, // 0x77 'w' - 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0xF0,0x90,0x00, + 5, // 0x77 'w' + 0x00, 0x00, 0x00, 0x90, 0x90, 0x90, 0x90, 0xF0, 0x90, 0x00, - 5, // 0x78 'x' - 0x00,0x00,0x00,0x90,0x90,0x60,0x60,0x90,0x90,0x00, + 5, // 0x78 'x' + 0x00, 0x00, 0x00, 0x90, 0x90, 0x60, 0x60, 0x90, 0x90, 0x00, - 5, // 0x79 'y' - 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0x70,0x10,0xE0, + 5, // 0x79 'y' + 0x00, 0x00, 0x00, 0x90, 0x90, 0x90, 0x90, 0x70, 0x10, 0xE0, - 5, // 0x7A 'z' - 0x00,0x00,0x00,0xF0,0x10,0x20,0x40,0x80,0xF0,0x00, + 5, // 0x7A 'z' + 0x00, 0x00, 0x00, 0xF0, 0x10, 0x20, 0x40, 0x80, 0xF0, 0x00, - 5, // 0x7B '{' - 0x30,0x40,0x40,0x40,0x80,0x40,0x40,0x40,0x40,0x30, + 5, // 0x7B '{' + 0x30, 0x40, 0x40, 0x40, 0x80, 0x40, 0x40, 0x40, 0x40, 0x30, - 5, // 0x7C '|' - 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 5, // 0x7C '|' + 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 5, // 0x7D '}' - 0xC0,0x20,0x20,0x20,0x10,0x20,0x20,0x20,0x20,0xC0, + 5, // 0x7D '}' + 0xC0, 0x20, 0x20, 0x20, 0x10, 0x20, 0x20, 0x20, 0x20, 0xC0, - 5, // 0x7E '~' - 0x00,0x40,0xA8,0x10,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x7E '~' + 0x00, 0x40, 0xA8, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x7F '' - 0x00,0x20,0x70,0xD8,0x88,0x88,0xF8,0x00,0x00,0x00, + 5, // 0x7F '' + 0x00, 0x20, 0x70, 0xD8, 0x88, 0x88, 0xF8, 0x00, 0x00, 0x00, - 0 -}; + 0}; -const int8u mcs5x11_mono[] = -{ - 11, 3, 32, 128-32, - 0x00,0x00,0x0C,0x00,0x18,0x00,0x24,0x00,0x30,0x00,0x3C,0x00,0x48,0x00,0x54,0x00,0x60,0x00, - 0x6C,0x00,0x78,0x00,0x84,0x00,0x90,0x00,0x9C,0x00,0xA8,0x00,0xB4,0x00,0xC0,0x00,0xCC,0x00, - 0xD8,0x00,0xE4,0x00,0xF0,0x00,0xFC,0x00,0x08,0x01,0x14,0x01,0x20,0x01,0x2C,0x01,0x38,0x01, - 0x44,0x01,0x50,0x01,0x5C,0x01,0x68,0x01,0x74,0x01,0x80,0x01,0x8C,0x01,0x98,0x01,0xA4,0x01, - 0xB0,0x01,0xBC,0x01,0xC8,0x01,0xD4,0x01,0xE0,0x01,0xEC,0x01,0xF8,0x01,0x04,0x02,0x10,0x02, - 0x1C,0x02,0x28,0x02,0x34,0x02,0x40,0x02,0x4C,0x02,0x58,0x02,0x64,0x02,0x70,0x02,0x7C,0x02, - 0x88,0x02,0x94,0x02,0xA0,0x02,0xAC,0x02,0xB8,0x02,0xC4,0x02,0xD0,0x02,0xDC,0x02,0xE8,0x02, - 0xF4,0x02,0x00,0x03,0x0C,0x03,0x18,0x03,0x24,0x03,0x30,0x03,0x3C,0x03,0x48,0x03,0x54,0x03, - 0x60,0x03,0x6C,0x03,0x78,0x03,0x84,0x03,0x90,0x03,0x9C,0x03,0xA8,0x03,0xB4,0x03,0xC0,0x03, - 0xCC,0x03,0xD8,0x03,0xE4,0x03,0xF0,0x03,0xFC,0x03,0x08,0x04,0x14,0x04,0x20,0x04,0x2C,0x04, - 0x38,0x04,0x44,0x04,0x50,0x04,0x5C,0x04,0x68,0x04,0x74,0x04, +const int8u mcs5x11_mono[] = { + 11, 3, 32, 128 - 32, 0x00, 0x00, 0x0C, 0x00, 0x18, 0x00, 0x24, 0x00, 0x30, 0x00, 0x3C, 0x00, 0x48, 0x00, + 0x54, 0x00, 0x60, 0x00, 0x6C, 0x00, 0x78, 0x00, 0x84, 0x00, 0x90, 0x00, 0x9C, 0x00, 0xA8, 0x00, 0xB4, 0x00, + 0xC0, 0x00, 0xCC, 0x00, 0xD8, 0x00, 0xE4, 0x00, 0xF0, 0x00, 0xFC, 0x00, 0x08, 0x01, 0x14, 0x01, 0x20, 0x01, + 0x2C, 0x01, 0x38, 0x01, 0x44, 0x01, 0x50, 0x01, 0x5C, 0x01, 0x68, 0x01, 0x74, 0x01, 0x80, 0x01, 0x8C, 0x01, + 0x98, 0x01, 0xA4, 0x01, 0xB0, 0x01, 0xBC, 0x01, 0xC8, 0x01, 0xD4, 0x01, 0xE0, 0x01, 0xEC, 0x01, 0xF8, 0x01, + 0x04, 0x02, 0x10, 0x02, 0x1C, 0x02, 0x28, 0x02, 0x34, 0x02, 0x40, 0x02, 0x4C, 0x02, 0x58, 0x02, 0x64, 0x02, + 0x70, 0x02, 0x7C, 0x02, 0x88, 0x02, 0x94, 0x02, 0xA0, 0x02, 0xAC, 0x02, 0xB8, 0x02, 0xC4, 0x02, 0xD0, 0x02, + 0xDC, 0x02, 0xE8, 0x02, 0xF4, 0x02, 0x00, 0x03, 0x0C, 0x03, 0x18, 0x03, 0x24, 0x03, 0x30, 0x03, 0x3C, 0x03, + 0x48, 0x03, 0x54, 0x03, 0x60, 0x03, 0x6C, 0x03, 0x78, 0x03, 0x84, 0x03, 0x90, 0x03, 0x9C, 0x03, 0xA8, 0x03, + 0xB4, 0x03, 0xC0, 0x03, 0xCC, 0x03, 0xD8, 0x03, 0xE4, 0x03, 0xF0, 0x03, 0xFC, 0x03, 0x08, 0x04, 0x14, 0x04, + 0x20, 0x04, 0x2C, 0x04, 0x38, 0x04, 0x44, 0x04, 0x50, 0x04, 0x5C, 0x04, 0x68, 0x04, 0x74, 0x04, - 5, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x21 '!' - 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, + 5, // 0x21 '!' + 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x00, 0x00, - 5, // 0x22 '"' - 0x00,0x50,0x50,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x22 '"' + 0x00, 0x50, 0x50, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x23 '#' - 0x00,0x50,0x50,0xF8,0x50,0x50,0x50,0xF8,0x50,0x50,0x00, + 5, // 0x23 '#' + 0x00, 0x50, 0x50, 0xF8, 0x50, 0x50, 0x50, 0xF8, 0x50, 0x50, 0x00, - 5, // 0x24 '$' - 0x00,0x40,0x60,0x90,0x80,0x60,0x10,0x90,0x60,0x20,0x00, + 5, // 0x24 '$' + 0x00, 0x40, 0x60, 0x90, 0x80, 0x60, 0x10, 0x90, 0x60, 0x20, 0x00, - 5, // 0x25 '%' - 0x00,0x00,0x90,0x90,0x20,0x20,0x40,0x40,0x90,0x90,0x00, + 5, // 0x25 '%' + 0x00, 0x00, 0x90, 0x90, 0x20, 0x20, 0x40, 0x40, 0x90, 0x90, 0x00, - 5, // 0x26 '&' - 0x00,0x40,0xA0,0xA0,0x40,0xA8,0x90,0x90,0x68,0x00,0x00, + 5, // 0x26 '&' + 0x00, 0x40, 0xA0, 0xA0, 0x40, 0xA8, 0x90, 0x90, 0x68, 0x00, 0x00, - 5, // 0x27 ''' - 0x00,0x20,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x27 ''' + 0x00, 0x20, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x28 '(' - 0x00,0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x20,0x20,0x10, + 5, // 0x28 '(' + 0x00, 0x10, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x10, - 5, // 0x29 ')' - 0x00,0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x20,0x20,0x40, + 5, // 0x29 ')' + 0x00, 0x40, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x40, - 5, // 0x2A '*' - 0x00,0x00,0x90,0x60,0xF0,0x60,0x90,0x00,0x00,0x00,0x00, + 5, // 0x2A '*' + 0x00, 0x00, 0x90, 0x60, 0xF0, 0x60, 0x90, 0x00, 0x00, 0x00, 0x00, - 5, // 0x2B '+' - 0x00,0x00,0x00,0x20,0x20,0xF8,0x20,0x20,0x00,0x00,0x00, + 5, // 0x2B '+' + 0x00, 0x00, 0x00, 0x20, 0x20, 0xF8, 0x20, 0x20, 0x00, 0x00, 0x00, - 5, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x40,0x80, + 5, // 0x2C ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x40, 0x80, - 5, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x00, + 5, // 0x2D '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00, + 5, // 0x2E '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, - 5, // 0x2F '/' - 0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x00, + 5, // 0x2F '/' + 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, 0x00, - 5, // 0x30 '0' - 0x00,0x70,0x90,0x90,0x90,0x90,0x90,0x90,0xE0,0x00,0x00, + 5, // 0x30 '0' + 0x00, 0x70, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0xE0, 0x00, 0x00, - 5, // 0x31 '1' - 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 5, // 0x31 '1' + 0x00, 0x20, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, - 5, // 0x32 '2' - 0x00,0x60,0x90,0x90,0x10,0x20,0x40,0x80,0xF0,0x00,0x00, + 5, // 0x32 '2' + 0x00, 0x60, 0x90, 0x90, 0x10, 0x20, 0x40, 0x80, 0xF0, 0x00, 0x00, - 5, // 0x33 '3' - 0x00,0x60,0x90,0x10,0x60,0x10,0x10,0x90,0x60,0x00,0x00, + 5, // 0x33 '3' + 0x00, 0x60, 0x90, 0x10, 0x60, 0x10, 0x10, 0x90, 0x60, 0x00, 0x00, - 5, // 0x34 '4' - 0x00,0x10,0x30,0x50,0x50,0x90,0xF8,0x10,0x10,0x00,0x00, + 5, // 0x34 '4' + 0x00, 0x10, 0x30, 0x50, 0x50, 0x90, 0xF8, 0x10, 0x10, 0x00, 0x00, - 5, // 0x35 '5' - 0x00,0xF0,0x80,0xE0,0x90,0x10,0x10,0x90,0x60,0x00,0x00, + 5, // 0x35 '5' + 0x00, 0xF0, 0x80, 0xE0, 0x90, 0x10, 0x10, 0x90, 0x60, 0x00, 0x00, - 5, // 0x36 '6' - 0x00,0x60,0x90,0x80,0xE0,0x90,0x90,0x90,0x60,0x00,0x00, + 5, // 0x36 '6' + 0x00, 0x60, 0x90, 0x80, 0xE0, 0x90, 0x90, 0x90, 0x60, 0x00, 0x00, - 5, // 0x37 '7' - 0x00,0xF0,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x00,0x00, + 5, // 0x37 '7' + 0x00, 0xF0, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x40, 0x00, 0x00, - 5, // 0x38 '8' - 0x00,0x60,0x90,0x90,0x60,0x90,0x90,0x90,0x60,0x00,0x00, + 5, // 0x38 '8' + 0x00, 0x60, 0x90, 0x90, 0x60, 0x90, 0x90, 0x90, 0x60, 0x00, 0x00, - 5, // 0x39 '9' - 0x00,0x60,0x90,0x90,0x90,0x70,0x10,0x90,0x60,0x00,0x00, + 5, // 0x39 '9' + 0x00, 0x60, 0x90, 0x90, 0x90, 0x70, 0x10, 0x90, 0x60, 0x00, 0x00, - 5, // 0x3A ':' - 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x00,0x00, + 5, // 0x3A ':' + 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, - 5, // 0x3B ';' - 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x40,0x80, + 5, // 0x3B ';' + 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x40, 0x80, - 5, // 0x3C '<' - 0x00,0x08,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x08,0x00, + 5, // 0x3C '<' + 0x00, 0x08, 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, 0x10, 0x08, 0x00, - 5, // 0x3D '=' - 0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0xF0,0x00,0x00,0x00, + 5, // 0x3D '=' + 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, - 5, // 0x3E '>' - 0x00,0x80,0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x80,0x00, + 5, // 0x3E '>' + 0x00, 0x80, 0x40, 0x20, 0x10, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, - 5, // 0x3F '?' - 0x00,0x60,0x90,0x10,0x10,0x20,0x40,0x00,0x40,0x00,0x00, + 5, // 0x3F '?' + 0x00, 0x60, 0x90, 0x10, 0x10, 0x20, 0x40, 0x00, 0x40, 0x00, 0x00, - 5, // 0x40 '@' - 0x00,0x60,0x90,0x90,0xB0,0xB0,0x80,0x80,0x70,0x00,0x00, + 5, // 0x40 '@' + 0x00, 0x60, 0x90, 0x90, 0xB0, 0xB0, 0x80, 0x80, 0x70, 0x00, 0x00, - 5, // 0x41 'A' - 0x00,0x60,0x90,0x90,0x90,0xF0,0x90,0x90,0x90,0x00,0x00, + 5, // 0x41 'A' + 0x00, 0x60, 0x90, 0x90, 0x90, 0xF0, 0x90, 0x90, 0x90, 0x00, 0x00, - 5, // 0x42 'B' - 0x00,0xE0,0x90,0x90,0xE0,0x90,0x90,0x90,0xE0,0x00,0x00, + 5, // 0x42 'B' + 0x00, 0xE0, 0x90, 0x90, 0xE0, 0x90, 0x90, 0x90, 0xE0, 0x00, 0x00, - 5, // 0x43 'C' - 0x00,0x60,0x90,0x80,0x80,0x80,0x80,0x90,0x60,0x00,0x00, + 5, // 0x43 'C' + 0x00, 0x60, 0x90, 0x80, 0x80, 0x80, 0x80, 0x90, 0x60, 0x00, 0x00, - 5, // 0x44 'D' - 0x00,0xE0,0x90,0x90,0x90,0x90,0x90,0x90,0xE0,0x00,0x00, + 5, // 0x44 'D' + 0x00, 0xE0, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0xE0, 0x00, 0x00, - 5, // 0x45 'E' - 0x00,0xF0,0x80,0x80,0xE0,0x80,0x80,0x80,0xF0,0x00,0x00, + 5, // 0x45 'E' + 0x00, 0xF0, 0x80, 0x80, 0xE0, 0x80, 0x80, 0x80, 0xF0, 0x00, 0x00, - 5, // 0x46 'F' - 0x00,0xF0,0x80,0x80,0xE0,0x80,0x80,0x80,0x80,0x00,0x00, + 5, // 0x46 'F' + 0x00, 0xF0, 0x80, 0x80, 0xE0, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, - 5, // 0x47 'G' - 0x00,0x60,0x90,0x80,0x80,0xB0,0x90,0x90,0x60,0x00,0x00, + 5, // 0x47 'G' + 0x00, 0x60, 0x90, 0x80, 0x80, 0xB0, 0x90, 0x90, 0x60, 0x00, 0x00, - 5, // 0x48 'H' - 0x00,0x90,0x90,0x90,0xF0,0x90,0x90,0x90,0x90,0x00,0x00, + 5, // 0x48 'H' + 0x00, 0x90, 0x90, 0x90, 0xF0, 0x90, 0x90, 0x90, 0x90, 0x00, 0x00, - 5, // 0x49 'I' - 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 5, // 0x49 'I' + 0x00, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, - 5, // 0x4A 'J' - 0x00,0x70,0x20,0x20,0x20,0x20,0xA0,0xA0,0x40,0x00,0x00, + 5, // 0x4A 'J' + 0x00, 0x70, 0x20, 0x20, 0x20, 0x20, 0xA0, 0xA0, 0x40, 0x00, 0x00, - 5, // 0x4B 'K' - 0x00,0x90,0xA0,0xA0,0xC0,0xA0,0xA0,0x90,0x90,0x00,0x00, + 5, // 0x4B 'K' + 0x00, 0x90, 0xA0, 0xA0, 0xC0, 0xA0, 0xA0, 0x90, 0x90, 0x00, 0x00, - 5, // 0x4C 'L' - 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xF0,0x00,0x00, + 5, // 0x4C 'L' + 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xF0, 0x00, 0x00, - 5, // 0x4D 'M' - 0x00,0x90,0xF0,0xF0,0x90,0x90,0x90,0x90,0x90,0x00,0x00, + 5, // 0x4D 'M' + 0x00, 0x90, 0xF0, 0xF0, 0x90, 0x90, 0x90, 0x90, 0x90, 0x00, 0x00, - 5, // 0x4E 'N' - 0x00,0x90,0x90,0xD0,0xD0,0xB0,0xB0,0x90,0x90,0x00,0x00, + 5, // 0x4E 'N' + 0x00, 0x90, 0x90, 0xD0, 0xD0, 0xB0, 0xB0, 0x90, 0x90, 0x00, 0x00, - 5, // 0x4F 'O' - 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00,0x00, + 5, // 0x4F 'O' + 0x00, 0x60, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x60, 0x00, 0x00, - 5, // 0x50 'P' - 0x00,0xE0,0x90,0x90,0x90,0xE0,0x80,0x80,0x80,0x00,0x00, + 5, // 0x50 'P' + 0x00, 0xE0, 0x90, 0x90, 0x90, 0xE0, 0x80, 0x80, 0x80, 0x00, 0x00, - 5, // 0x51 'Q' - 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x30,0x00, + 5, // 0x51 'Q' + 0x00, 0x60, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x60, 0x30, 0x00, - 5, // 0x52 'R' - 0x00,0xE0,0x90,0x90,0x90,0xE0,0xA0,0x90,0x90,0x00,0x00, + 5, // 0x52 'R' + 0x00, 0xE0, 0x90, 0x90, 0x90, 0xE0, 0xA0, 0x90, 0x90, 0x00, 0x00, - 5, // 0x53 'S' - 0x00,0x60,0x90,0x80,0x60,0x10,0x90,0x90,0x60,0x00,0x00, + 5, // 0x53 'S' + 0x00, 0x60, 0x90, 0x80, 0x60, 0x10, 0x90, 0x90, 0x60, 0x00, 0x00, - 5, // 0x54 'T' - 0x00,0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00, + 5, // 0x54 'T' + 0x00, 0xF8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, - 5, // 0x55 'U' - 0x00,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00,0x00, + 5, // 0x55 'U' + 0x00, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x60, 0x00, 0x00, - 5, // 0x56 'V' - 0x00,0x90,0x90,0x90,0x50,0x50,0x50,0x20,0x20,0x00,0x00, + 5, // 0x56 'V' + 0x00, 0x90, 0x90, 0x90, 0x50, 0x50, 0x50, 0x20, 0x20, 0x00, 0x00, - 5, // 0x57 'W' - 0x00,0x90,0x90,0x90,0x90,0x90,0xF0,0xF0,0x90,0x00,0x00, + 5, // 0x57 'W' + 0x00, 0x90, 0x90, 0x90, 0x90, 0x90, 0xF0, 0xF0, 0x90, 0x00, 0x00, - 5, // 0x58 'X' - 0x00,0x90,0x90,0x90,0x60,0x60,0x90,0x90,0x90,0x00,0x00, + 5, // 0x58 'X' + 0x00, 0x90, 0x90, 0x90, 0x60, 0x60, 0x90, 0x90, 0x90, 0x00, 0x00, - 5, // 0x59 'Y' - 0x00,0x88,0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x00,0x00, + 5, // 0x59 'Y' + 0x00, 0x88, 0x88, 0x88, 0x50, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, - 5, // 0x5A 'Z' - 0x00,0xF0,0x10,0x20,0x20,0x40,0x40,0x80,0xF0,0x00,0x00, + 5, // 0x5A 'Z' + 0x00, 0xF0, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0xF0, 0x00, 0x00, - 5, // 0x5B '[' - 0x00,0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x60, + 5, // 0x5B '[' + 0x00, 0x60, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x60, - 5, // 0x5C '\' - 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00, + 5, // 0x5C '\' + 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x00, - 5, // 0x5D ']' - 0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x60, + 5, // 0x5D ']' + 0x00, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x60, - 5, // 0x5E '^' - 0x00,0x20,0x50,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x5E '^' + 0x00, 0x20, 0x50, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00, + 5, // 0x5F '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, - 5, // 0x60 '`' - 0x00,0x40,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x60 '`' + 0x00, 0x40, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x61 'a' - 0x00,0x00,0x00,0x60,0x10,0x70,0x90,0x90,0x70,0x00,0x00, + 5, // 0x61 'a' + 0x00, 0x00, 0x00, 0x60, 0x10, 0x70, 0x90, 0x90, 0x70, 0x00, 0x00, - 5, // 0x62 'b' - 0x00,0x80,0x80,0xE0,0x90,0x90,0x90,0x90,0xE0,0x00,0x00, + 5, // 0x62 'b' + 0x00, 0x80, 0x80, 0xE0, 0x90, 0x90, 0x90, 0x90, 0xE0, 0x00, 0x00, - 5, // 0x63 'c' - 0x00,0x00,0x00,0x60,0x90,0x80,0x80,0x90,0x60,0x00,0x00, + 5, // 0x63 'c' + 0x00, 0x00, 0x00, 0x60, 0x90, 0x80, 0x80, 0x90, 0x60, 0x00, 0x00, - 5, // 0x64 'd' - 0x00,0x10,0x10,0x70,0x90,0x90,0x90,0x90,0x70,0x00,0x00, + 5, // 0x64 'd' + 0x00, 0x10, 0x10, 0x70, 0x90, 0x90, 0x90, 0x90, 0x70, 0x00, 0x00, - 5, // 0x65 'e' - 0x00,0x00,0x00,0x60,0x90,0x90,0xF0,0x80,0x70,0x00,0x00, + 5, // 0x65 'e' + 0x00, 0x00, 0x00, 0x60, 0x90, 0x90, 0xF0, 0x80, 0x70, 0x00, 0x00, - 5, // 0x66 'f' - 0x00,0x30,0x40,0xE0,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 5, // 0x66 'f' + 0x00, 0x30, 0x40, 0xE0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, - 5, // 0x67 'g' - 0x00,0x00,0x00,0x70,0x90,0x90,0x90,0x90,0x70,0x10,0xE0, + 5, // 0x67 'g' + 0x00, 0x00, 0x00, 0x70, 0x90, 0x90, 0x90, 0x90, 0x70, 0x10, 0xE0, - 5, // 0x68 'h' - 0x00,0x80,0x80,0xE0,0x90,0x90,0x90,0x90,0x90,0x00,0x00, + 5, // 0x68 'h' + 0x00, 0x80, 0x80, 0xE0, 0x90, 0x90, 0x90, 0x90, 0x90, 0x00, 0x00, - 5, // 0x69 'i' - 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 5, // 0x69 'i' + 0x00, 0x20, 0x00, 0x60, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, - 5, // 0x6A 'j' - 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + 5, // 0x6A 'j' + 0x00, 0x20, 0x00, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0xA0, 0x40, - 5, // 0x6B 'k' - 0x00,0x80,0x80,0x90,0xA0,0xC0,0xA0,0x90,0x90,0x00,0x00, + 5, // 0x6B 'k' + 0x00, 0x80, 0x80, 0x90, 0xA0, 0xC0, 0xA0, 0x90, 0x90, 0x00, 0x00, - 5, // 0x6C 'l' - 0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 5, // 0x6C 'l' + 0x00, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, - 5, // 0x6D 'm' - 0x00,0x00,0x00,0x90,0xF0,0x90,0x90,0x90,0x90,0x00,0x00, + 5, // 0x6D 'm' + 0x00, 0x00, 0x00, 0x90, 0xF0, 0x90, 0x90, 0x90, 0x90, 0x00, 0x00, - 5, // 0x6E 'n' - 0x00,0x00,0x00,0xE0,0x90,0x90,0x90,0x90,0x90,0x00,0x00, + 5, // 0x6E 'n' + 0x00, 0x00, 0x00, 0xE0, 0x90, 0x90, 0x90, 0x90, 0x90, 0x00, 0x00, - 5, // 0x6F 'o' - 0x00,0x00,0x00,0x60,0x90,0x90,0x90,0x90,0x60,0x00,0x00, + 5, // 0x6F 'o' + 0x00, 0x00, 0x00, 0x60, 0x90, 0x90, 0x90, 0x90, 0x60, 0x00, 0x00, - 5, // 0x70 'p' - 0x00,0x00,0x00,0xE0,0x90,0x90,0x90,0x90,0xE0,0x80,0x80, + 5, // 0x70 'p' + 0x00, 0x00, 0x00, 0xE0, 0x90, 0x90, 0x90, 0x90, 0xE0, 0x80, 0x80, - 5, // 0x71 'q' - 0x00,0x00,0x00,0x70,0x90,0x90,0x90,0x90,0x70,0x10,0x10, + 5, // 0x71 'q' + 0x00, 0x00, 0x00, 0x70, 0x90, 0x90, 0x90, 0x90, 0x70, 0x10, 0x10, - 5, // 0x72 'r' - 0x00,0x00,0x00,0xA0,0x50,0x40,0x40,0x40,0xE0,0x00,0x00, + 5, // 0x72 'r' + 0x00, 0x00, 0x00, 0xA0, 0x50, 0x40, 0x40, 0x40, 0xE0, 0x00, 0x00, - 5, // 0x73 's' - 0x00,0x00,0x00,0x60,0x90,0x40,0x20,0x90,0x60,0x00,0x00, + 5, // 0x73 's' + 0x00, 0x00, 0x00, 0x60, 0x90, 0x40, 0x20, 0x90, 0x60, 0x00, 0x00, - 5, // 0x74 't' - 0x00,0x40,0x40,0xE0,0x40,0x40,0x40,0x40,0x30,0x00,0x00, + 5, // 0x74 't' + 0x00, 0x40, 0x40, 0xE0, 0x40, 0x40, 0x40, 0x40, 0x30, 0x00, 0x00, - 5, // 0x75 'u' - 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0x90,0x70,0x00,0x00, + 5, // 0x75 'u' + 0x00, 0x00, 0x00, 0x90, 0x90, 0x90, 0x90, 0x90, 0x70, 0x00, 0x00, - 5, // 0x76 'v' - 0x00,0x00,0x00,0x90,0x90,0x50,0x50,0x20,0x20,0x00,0x00, + 5, // 0x76 'v' + 0x00, 0x00, 0x00, 0x90, 0x90, 0x50, 0x50, 0x20, 0x20, 0x00, 0x00, - 5, // 0x77 'w' - 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0xF0,0x90,0x00,0x00, + 5, // 0x77 'w' + 0x00, 0x00, 0x00, 0x90, 0x90, 0x90, 0x90, 0xF0, 0x90, 0x00, 0x00, - 5, // 0x78 'x' - 0x00,0x00,0x00,0x90,0x90,0x60,0x60,0x90,0x90,0x00,0x00, + 5, // 0x78 'x' + 0x00, 0x00, 0x00, 0x90, 0x90, 0x60, 0x60, 0x90, 0x90, 0x00, 0x00, - 5, // 0x79 'y' - 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0x90,0x70,0x10,0xE0, + 5, // 0x79 'y' + 0x00, 0x00, 0x00, 0x90, 0x90, 0x90, 0x90, 0x90, 0x70, 0x10, 0xE0, - 5, // 0x7A 'z' - 0x00,0x00,0x00,0xF0,0x10,0x20,0x40,0x80,0xF0,0x00,0x00, + 5, // 0x7A 'z' + 0x00, 0x00, 0x00, 0xF0, 0x10, 0x20, 0x40, 0x80, 0xF0, 0x00, 0x00, - 5, // 0x7B '{' - 0x30,0x40,0x40,0x40,0x40,0x80,0x40,0x40,0x40,0x40,0x30, + 5, // 0x7B '{' + 0x30, 0x40, 0x40, 0x40, 0x40, 0x80, 0x40, 0x40, 0x40, 0x40, 0x30, - 5, // 0x7C '|' - 0x00,0x20,0x20,0x20,0x20,0x00,0x20,0x20,0x20,0x20,0x00, + 5, // 0x7C '|' + 0x00, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x00, - 5, // 0x7D '}' - 0xC0,0x20,0x20,0x20,0x20,0x10,0x20,0x20,0x20,0x20,0xC0, + 5, // 0x7D '}' + 0xC0, 0x20, 0x20, 0x20, 0x20, 0x10, 0x20, 0x20, 0x20, 0x20, 0xC0, - 5, // 0x7E '~' - 0x00,0x40,0xA8,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x7E '~' + 0x00, 0x40, 0xA8, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x7F '' - 0x00,0x20,0x70,0xD8,0x88,0x88,0xF8,0x00,0x00,0x00,0x00, + 5, // 0x7F '' + 0x00, 0x20, 0x70, 0xD8, 0x88, 0x88, 0xF8, 0x00, 0x00, 0x00, 0x00, - 0 -}; + 0}; -const int8u mcs6x10_mono[] = -{ - 10, 3, 32, 128-32, - 0x00,0x00,0x0B,0x00,0x16,0x00,0x21,0x00,0x2C,0x00,0x37,0x00,0x42,0x00,0x4D,0x00,0x58,0x00, - 0x63,0x00,0x6E,0x00,0x79,0x00,0x84,0x00,0x8F,0x00,0x9A,0x00,0xA5,0x00,0xB0,0x00,0xBB,0x00, - 0xC6,0x00,0xD1,0x00,0xDC,0x00,0xE7,0x00,0xF2,0x00,0xFD,0x00,0x08,0x01,0x13,0x01,0x1E,0x01, - 0x29,0x01,0x34,0x01,0x3F,0x01,0x4A,0x01,0x55,0x01,0x60,0x01,0x6B,0x01,0x76,0x01,0x81,0x01, - 0x8C,0x01,0x97,0x01,0xA2,0x01,0xAD,0x01,0xB8,0x01,0xC3,0x01,0xCE,0x01,0xD9,0x01,0xE4,0x01, - 0xEF,0x01,0xFA,0x01,0x05,0x02,0x10,0x02,0x1B,0x02,0x26,0x02,0x31,0x02,0x3C,0x02,0x47,0x02, - 0x52,0x02,0x5D,0x02,0x68,0x02,0x73,0x02,0x7E,0x02,0x89,0x02,0x94,0x02,0x9F,0x02,0xAA,0x02, - 0xB5,0x02,0xC0,0x02,0xCB,0x02,0xD6,0x02,0xE1,0x02,0xEC,0x02,0xF7,0x02,0x02,0x03,0x0D,0x03, - 0x18,0x03,0x23,0x03,0x2E,0x03,0x39,0x03,0x44,0x03,0x4F,0x03,0x5A,0x03,0x65,0x03,0x70,0x03, - 0x7B,0x03,0x86,0x03,0x91,0x03,0x9C,0x03,0xA7,0x03,0xB2,0x03,0xBD,0x03,0xC8,0x03,0xD3,0x03, - 0xDE,0x03,0xE9,0x03,0xF4,0x03,0xFF,0x03,0x0A,0x04,0x15,0x04, +const int8u mcs6x10_mono[] = { + 10, 3, 32, 128 - 32, 0x00, 0x00, 0x0B, 0x00, 0x16, 0x00, 0x21, 0x00, 0x2C, 0x00, 0x37, 0x00, 0x42, 0x00, + 0x4D, 0x00, 0x58, 0x00, 0x63, 0x00, 0x6E, 0x00, 0x79, 0x00, 0x84, 0x00, 0x8F, 0x00, 0x9A, 0x00, 0xA5, 0x00, + 0xB0, 0x00, 0xBB, 0x00, 0xC6, 0x00, 0xD1, 0x00, 0xDC, 0x00, 0xE7, 0x00, 0xF2, 0x00, 0xFD, 0x00, 0x08, 0x01, + 0x13, 0x01, 0x1E, 0x01, 0x29, 0x01, 0x34, 0x01, 0x3F, 0x01, 0x4A, 0x01, 0x55, 0x01, 0x60, 0x01, 0x6B, 0x01, + 0x76, 0x01, 0x81, 0x01, 0x8C, 0x01, 0x97, 0x01, 0xA2, 0x01, 0xAD, 0x01, 0xB8, 0x01, 0xC3, 0x01, 0xCE, 0x01, + 0xD9, 0x01, 0xE4, 0x01, 0xEF, 0x01, 0xFA, 0x01, 0x05, 0x02, 0x10, 0x02, 0x1B, 0x02, 0x26, 0x02, 0x31, 0x02, + 0x3C, 0x02, 0x47, 0x02, 0x52, 0x02, 0x5D, 0x02, 0x68, 0x02, 0x73, 0x02, 0x7E, 0x02, 0x89, 0x02, 0x94, 0x02, + 0x9F, 0x02, 0xAA, 0x02, 0xB5, 0x02, 0xC0, 0x02, 0xCB, 0x02, 0xD6, 0x02, 0xE1, 0x02, 0xEC, 0x02, 0xF7, 0x02, + 0x02, 0x03, 0x0D, 0x03, 0x18, 0x03, 0x23, 0x03, 0x2E, 0x03, 0x39, 0x03, 0x44, 0x03, 0x4F, 0x03, 0x5A, 0x03, + 0x65, 0x03, 0x70, 0x03, 0x7B, 0x03, 0x86, 0x03, 0x91, 0x03, 0x9C, 0x03, 0xA7, 0x03, 0xB2, 0x03, 0xBD, 0x03, + 0xC8, 0x03, 0xD3, 0x03, 0xDE, 0x03, 0xE9, 0x03, 0xF4, 0x03, 0xFF, 0x03, 0x0A, 0x04, 0x15, 0x04, - 6, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x21 '!' - 0x00,0x10,0x10,0x10,0x10,0x10,0x00,0x10,0x00,0x00, + 6, // 0x21 '!' + 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, - 6, // 0x22 '"' - 0x00,0x28,0x28,0x50,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x22 '"' + 0x00, 0x28, 0x28, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x23 '#' - 0x00,0x28,0x28,0x7C,0x28,0x28,0x7C,0x28,0x28,0x00, + 6, // 0x23 '#' + 0x00, 0x28, 0x28, 0x7C, 0x28, 0x28, 0x7C, 0x28, 0x28, 0x00, - 6, // 0x24 '$' - 0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x00, + 6, // 0x24 '$' + 0x10, 0x38, 0x54, 0x50, 0x38, 0x14, 0x54, 0x38, 0x10, 0x00, - 6, // 0x25 '%' - 0x00,0x08,0xC8,0xD0,0x10,0x20,0x2C,0x4C,0x40,0x00, + 6, // 0x25 '%' + 0x00, 0x08, 0xC8, 0xD0, 0x10, 0x20, 0x2C, 0x4C, 0x40, 0x00, - 6, // 0x26 '&' - 0x00,0x20,0x50,0x50,0x24,0x54,0x48,0x34,0x00,0x00, + 6, // 0x26 '&' + 0x00, 0x20, 0x50, 0x50, 0x24, 0x54, 0x48, 0x34, 0x00, 0x00, - 6, // 0x27 ''' - 0x00,0x10,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x27 ''' + 0x00, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x28 '(' - 0x08,0x10,0x10,0x20,0x20,0x20,0x10,0x10,0x08,0x00, + 6, // 0x28 '(' + 0x08, 0x10, 0x10, 0x20, 0x20, 0x20, 0x10, 0x10, 0x08, 0x00, - 6, // 0x29 ')' - 0x20,0x10,0x10,0x08,0x08,0x08,0x10,0x10,0x20,0x00, + 6, // 0x29 ')' + 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x10, 0x10, 0x20, 0x00, - 6, // 0x2A '*' - 0x00,0x00,0x28,0x7C,0x38,0x7C,0x28,0x00,0x00,0x00, + 6, // 0x2A '*' + 0x00, 0x00, 0x28, 0x7C, 0x38, 0x7C, 0x28, 0x00, 0x00, 0x00, - 6, // 0x2B '+' - 0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, + 6, // 0x2B '+' + 0x00, 0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x00, 0x00, - 6, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x20,0x40, + 6, // 0x2C ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x20, 0x40, - 6, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, + 6, // 0x2D '-' + 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00, + 6, // 0x2E '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, - 6, // 0x2F '/' - 0x00,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00, + 6, // 0x2F '/' + 0x00, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x00, - 6, // 0x30 '0' - 0x00,0x38,0x44,0x4C,0x54,0x64,0x44,0x38,0x00,0x00, + 6, // 0x30 '0' + 0x00, 0x38, 0x44, 0x4C, 0x54, 0x64, 0x44, 0x38, 0x00, 0x00, - 6, // 0x31 '1' - 0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 6, // 0x31 '1' + 0x00, 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, - 6, // 0x32 '2' - 0x00,0x38,0x44,0x04,0x18,0x20,0x40,0x7C,0x00,0x00, + 6, // 0x32 '2' + 0x00, 0x38, 0x44, 0x04, 0x18, 0x20, 0x40, 0x7C, 0x00, 0x00, - 6, // 0x33 '3' - 0x00,0x38,0x44,0x04,0x38,0x04,0x44,0x38,0x00,0x00, + 6, // 0x33 '3' + 0x00, 0x38, 0x44, 0x04, 0x38, 0x04, 0x44, 0x38, 0x00, 0x00, - 6, // 0x34 '4' - 0x00,0x08,0x18,0x28,0x48,0x7C,0x08,0x08,0x00,0x00, + 6, // 0x34 '4' + 0x00, 0x08, 0x18, 0x28, 0x48, 0x7C, 0x08, 0x08, 0x00, 0x00, - 6, // 0x35 '5' - 0x00,0x7C,0x40,0x40,0x78,0x04,0x44,0x38,0x00,0x00, + 6, // 0x35 '5' + 0x00, 0x7C, 0x40, 0x40, 0x78, 0x04, 0x44, 0x38, 0x00, 0x00, - 6, // 0x36 '6' - 0x00,0x38,0x40,0x40,0x78,0x44,0x44,0x38,0x00,0x00, + 6, // 0x36 '6' + 0x00, 0x38, 0x40, 0x40, 0x78, 0x44, 0x44, 0x38, 0x00, 0x00, - 6, // 0x37 '7' - 0x00,0x7C,0x04,0x08,0x10,0x20,0x20,0x20,0x00,0x00, + 6, // 0x37 '7' + 0x00, 0x7C, 0x04, 0x08, 0x10, 0x20, 0x20, 0x20, 0x00, 0x00, - 6, // 0x38 '8' - 0x00,0x38,0x44,0x44,0x38,0x44,0x44,0x38,0x00,0x00, + 6, // 0x38 '8' + 0x00, 0x38, 0x44, 0x44, 0x38, 0x44, 0x44, 0x38, 0x00, 0x00, - 6, // 0x39 '9' - 0x00,0x38,0x44,0x44,0x3C,0x04,0x04,0x38,0x00,0x00, + 6, // 0x39 '9' + 0x00, 0x38, 0x44, 0x44, 0x3C, 0x04, 0x04, 0x38, 0x00, 0x00, - 6, // 0x3A ':' - 0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x00,0x00, + 6, // 0x3A ':' + 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, - 6, // 0x3B ';' - 0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x20,0x40, + 6, // 0x3B ';' + 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x20, 0x40, - 6, // 0x3C '<' - 0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00, + 6, // 0x3C '<' + 0x04, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, - 6, // 0x3D '=' - 0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00, + 6, // 0x3D '=' + 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, - 6, // 0x3E '>' - 0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00, + 6, // 0x3E '>' + 0x40, 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, - 6, // 0x3F '?' - 0x00,0x38,0x44,0x04,0x18,0x10,0x00,0x10,0x00,0x00, + 6, // 0x3F '?' + 0x00, 0x38, 0x44, 0x04, 0x18, 0x10, 0x00, 0x10, 0x00, 0x00, - 6, // 0x40 '@' - 0x00,0x38,0x44,0x5C,0x54,0x5C,0x40,0x38,0x00,0x00, + 6, // 0x40 '@' + 0x00, 0x38, 0x44, 0x5C, 0x54, 0x5C, 0x40, 0x38, 0x00, 0x00, - 6, // 0x41 'A' - 0x00,0x38,0x44,0x44,0x44,0x7C,0x44,0x44,0x00,0x00, + 6, // 0x41 'A' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x00, 0x00, - 6, // 0x42 'B' - 0x00,0x78,0x44,0x44,0x78,0x44,0x44,0x78,0x00,0x00, + 6, // 0x42 'B' + 0x00, 0x78, 0x44, 0x44, 0x78, 0x44, 0x44, 0x78, 0x00, 0x00, - 6, // 0x43 'C' - 0x00,0x38,0x44,0x40,0x40,0x40,0x44,0x38,0x00,0x00, + 6, // 0x43 'C' + 0x00, 0x38, 0x44, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, - 6, // 0x44 'D' - 0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x00,0x00, + 6, // 0x44 'D' + 0x00, 0x78, 0x44, 0x44, 0x44, 0x44, 0x44, 0x78, 0x00, 0x00, - 6, // 0x45 'E' - 0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x7C,0x00,0x00, + 6, // 0x45 'E' + 0x00, 0x7C, 0x40, 0x40, 0x78, 0x40, 0x40, 0x7C, 0x00, 0x00, - 6, // 0x46 'F' - 0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x00,0x00, + 6, // 0x46 'F' + 0x00, 0x7C, 0x40, 0x40, 0x78, 0x40, 0x40, 0x40, 0x00, 0x00, - 6, // 0x47 'G' - 0x00,0x38,0x44,0x40,0x4C,0x44,0x44,0x3C,0x00,0x00, + 6, // 0x47 'G' + 0x00, 0x38, 0x44, 0x40, 0x4C, 0x44, 0x44, 0x3C, 0x00, 0x00, - 6, // 0x48 'H' - 0x00,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x00,0x00, + 6, // 0x48 'H' + 0x00, 0x44, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x44, 0x00, 0x00, - 6, // 0x49 'I' - 0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 6, // 0x49 'I' + 0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, - 6, // 0x4A 'J' - 0x00,0x1C,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00, + 6, // 0x4A 'J' + 0x00, 0x1C, 0x08, 0x08, 0x08, 0x48, 0x48, 0x30, 0x00, 0x00, - 6, // 0x4B 'K' - 0x00,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00, + 6, // 0x4B 'K' + 0x00, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x00, 0x00, - 6, // 0x4C 'L' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00, + 6, // 0x4C 'L' + 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7C, 0x00, 0x00, - 6, // 0x4D 'M' - 0x00,0x44,0x6C,0x54,0x54,0x44,0x44,0x44,0x00,0x00, + 6, // 0x4D 'M' + 0x00, 0x44, 0x6C, 0x54, 0x54, 0x44, 0x44, 0x44, 0x00, 0x00, - 6, // 0x4E 'N' - 0x00,0x44,0x44,0x64,0x54,0x4C,0x44,0x44,0x00,0x00, + 6, // 0x4E 'N' + 0x00, 0x44, 0x44, 0x64, 0x54, 0x4C, 0x44, 0x44, 0x00, 0x00, - 6, // 0x4F 'O' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 6, // 0x4F 'O' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 6, // 0x50 'P' - 0x00,0x78,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00, + 6, // 0x50 'P' + 0x00, 0x78, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, 0x00, 0x00, - 6, // 0x51 'Q' - 0x00,0x38,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00, + 6, // 0x51 'Q' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x54, 0x48, 0x34, 0x00, 0x00, - 6, // 0x52 'R' - 0x00,0x78,0x44,0x44,0x78,0x48,0x44,0x44,0x00,0x00, + 6, // 0x52 'R' + 0x00, 0x78, 0x44, 0x44, 0x78, 0x48, 0x44, 0x44, 0x00, 0x00, - 6, // 0x53 'S' - 0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x38,0x00,0x00, + 6, // 0x53 'S' + 0x00, 0x38, 0x44, 0x40, 0x38, 0x04, 0x44, 0x38, 0x00, 0x00, - 6, // 0x54 'T' - 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, + 6, // 0x54 'T' + 0x00, 0x7C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - 6, // 0x55 'U' - 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 6, // 0x55 'U' + 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 6, // 0x56 'V' - 0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x10,0x00,0x00, + 6, // 0x56 'V' + 0x00, 0x44, 0x44, 0x44, 0x44, 0x28, 0x28, 0x10, 0x00, 0x00, - 6, // 0x57 'W' - 0x00,0x44,0x44,0x54,0x54,0x54,0x54,0x28,0x00,0x00, + 6, // 0x57 'W' + 0x00, 0x44, 0x44, 0x54, 0x54, 0x54, 0x54, 0x28, 0x00, 0x00, - 6, // 0x58 'X' - 0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, + 6, // 0x58 'X' + 0x00, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x00, 0x00, - 6, // 0x59 'Y' - 0x00,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x00,0x00, + 6, // 0x59 'Y' + 0x00, 0x44, 0x44, 0x44, 0x28, 0x10, 0x10, 0x10, 0x00, 0x00, - 6, // 0x5A 'Z' - 0x00,0x78,0x08,0x10,0x20,0x40,0x40,0x78,0x00,0x00, + 6, // 0x5A 'Z' + 0x00, 0x78, 0x08, 0x10, 0x20, 0x40, 0x40, 0x78, 0x00, 0x00, - 6, // 0x5B '[' - 0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00, + 6, // 0x5B '[' + 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00, - 6, // 0x5C '\' - 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00, + 6, // 0x5C '\' + 0x00, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x00, - 6, // 0x5D ']' - 0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x38,0x00, + 6, // 0x5D ']' + 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x00, - 6, // 0x5E '^' - 0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x5E '^' + 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00, + 6, // 0x5F '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, - 6, // 0x60 '`' - 0x00,0x10,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x60 '`' + 0x00, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x61 'a' - 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x3C,0x00,0x00, + 6, // 0x61 'a' + 0x00, 0x00, 0x00, 0x38, 0x04, 0x3C, 0x44, 0x3C, 0x00, 0x00, - 6, // 0x62 'b' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x78,0x00,0x00, + 6, // 0x62 'b' + 0x00, 0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x78, 0x00, 0x00, - 6, // 0x63 'c' - 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x3C,0x00,0x00, + 6, // 0x63 'c' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x3C, 0x00, 0x00, - 6, // 0x64 'd' - 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x3C,0x00,0x00, + 6, // 0x64 'd' + 0x00, 0x04, 0x04, 0x3C, 0x44, 0x44, 0x44, 0x3C, 0x00, 0x00, - 6, // 0x65 'e' - 0x00,0x00,0x00,0x38,0x44,0x78,0x40,0x3C,0x00,0x00, + 6, // 0x65 'e' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x78, 0x40, 0x3C, 0x00, 0x00, - 6, // 0x66 'f' - 0x00,0x0C,0x10,0x10,0x38,0x10,0x10,0x10,0x00,0x00, + 6, // 0x66 'f' + 0x00, 0x0C, 0x10, 0x10, 0x38, 0x10, 0x10, 0x10, 0x00, 0x00, - 6, // 0x67 'g' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x3C,0x04,0x38, + 6, // 0x67 'g' + 0x00, 0x00, 0x00, 0x3C, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x38, - 6, // 0x68 'h' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x00,0x00, + 6, // 0x68 'h' + 0x00, 0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, - 6, // 0x69 'i' - 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x38,0x00,0x00, + 6, // 0x69 'i' + 0x00, 0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, - 6, // 0x6A 'j' - 0x00,0x08,0x00,0x18,0x08,0x08,0x08,0x08,0x48,0x30, + 6, // 0x6A 'j' + 0x00, 0x08, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x48, 0x30, - 6, // 0x6B 'k' - 0x00,0x40,0x40,0x48,0x50,0x60,0x50,0x48,0x00,0x00, + 6, // 0x6B 'k' + 0x00, 0x40, 0x40, 0x48, 0x50, 0x60, 0x50, 0x48, 0x00, 0x00, - 6, // 0x6C 'l' - 0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 6, // 0x6C 'l' + 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, - 6, // 0x6D 'm' - 0x00,0x00,0x00,0x68,0x54,0x54,0x44,0x44,0x00,0x00, + 6, // 0x6D 'm' + 0x00, 0x00, 0x00, 0x68, 0x54, 0x54, 0x44, 0x44, 0x00, 0x00, - 6, // 0x6E 'n' - 0x00,0x00,0x00,0x58,0x64,0x44,0x44,0x44,0x00,0x00, + 6, // 0x6E 'n' + 0x00, 0x00, 0x00, 0x58, 0x64, 0x44, 0x44, 0x44, 0x00, 0x00, - 6, // 0x6F 'o' - 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x38,0x00,0x00, + 6, // 0x6F 'o' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 6, // 0x70 'p' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40, + 6, // 0x70 'p' + 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, - 6, // 0x71 'q' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x3C,0x04,0x04, + 6, // 0x71 'q' + 0x00, 0x00, 0x00, 0x3C, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x04, - 6, // 0x72 'r' - 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x70,0x00,0x00, + 6, // 0x72 'r' + 0x00, 0x00, 0x00, 0x58, 0x24, 0x20, 0x20, 0x70, 0x00, 0x00, - 6, // 0x73 's' - 0x00,0x00,0x00,0x38,0x40,0x38,0x04,0x78,0x00,0x00, + 6, // 0x73 's' + 0x00, 0x00, 0x00, 0x38, 0x40, 0x38, 0x04, 0x78, 0x00, 0x00, - 6, // 0x74 't' - 0x00,0x10,0x10,0x38,0x10,0x10,0x14,0x08,0x00,0x00, + 6, // 0x74 't' + 0x00, 0x10, 0x10, 0x38, 0x10, 0x10, 0x14, 0x08, 0x00, 0x00, - 6, // 0x75 'u' - 0x00,0x00,0x00,0x44,0x44,0x44,0x4C,0x34,0x00,0x00, + 6, // 0x75 'u' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x4C, 0x34, 0x00, 0x00, - 6, // 0x76 'v' - 0x00,0x00,0x00,0x44,0x44,0x44,0x28,0x10,0x00,0x00, + 6, // 0x76 'v' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x10, 0x00, 0x00, - 6, // 0x77 'w' - 0x00,0x00,0x00,0x44,0x44,0x54,0x7C,0x28,0x00,0x00, + 6, // 0x77 'w' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x54, 0x7C, 0x28, 0x00, 0x00, - 6, // 0x78 'x' - 0x00,0x00,0x00,0x48,0x48,0x30,0x48,0x48,0x00,0x00, + 6, // 0x78 'x' + 0x00, 0x00, 0x00, 0x48, 0x48, 0x30, 0x48, 0x48, 0x00, 0x00, - 6, // 0x79 'y' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x3C,0x04,0x38, + 6, // 0x79 'y' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x38, - 6, // 0x7A 'z' - 0x00,0x00,0x00,0x78,0x08,0x30,0x40,0x78,0x00,0x00, + 6, // 0x7A 'z' + 0x00, 0x00, 0x00, 0x78, 0x08, 0x30, 0x40, 0x78, 0x00, 0x00, - 6, // 0x7B '{' - 0x18,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x18,0x00, + 6, // 0x7B '{' + 0x18, 0x20, 0x20, 0x20, 0xC0, 0x20, 0x20, 0x20, 0x18, 0x00, - 6, // 0x7C '|' - 0x10,0x10,0x10,0x10,0x00,0x10,0x10,0x10,0x10,0x00, + 6, // 0x7C '|' + 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00, - 6, // 0x7D '}' - 0x60,0x10,0x10,0x10,0x0C,0x10,0x10,0x10,0x60,0x00, + 6, // 0x7D '}' + 0x60, 0x10, 0x10, 0x10, 0x0C, 0x10, 0x10, 0x10, 0x60, 0x00, - 6, // 0x7E '~' - 0x00,0x48,0xA8,0x90,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x7E '~' + 0x00, 0x48, 0xA8, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x7F '' - 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00, + 6, // 0x7F '' + 0x00, 0x10, 0x38, 0x6C, 0x44, 0x44, 0x7C, 0x00, 0x00, 0x00, - 0 -}; + 0}; -const int8u mcs6x11_mono[] = -{ - 11, 3, 32, 128-32, - 0x00,0x00,0x0C,0x00,0x18,0x00,0x24,0x00,0x30,0x00,0x3C,0x00,0x48,0x00,0x54,0x00,0x60,0x00, - 0x6C,0x00,0x78,0x00,0x84,0x00,0x90,0x00,0x9C,0x00,0xA8,0x00,0xB4,0x00,0xC0,0x00,0xCC,0x00, - 0xD8,0x00,0xE4,0x00,0xF0,0x00,0xFC,0x00,0x08,0x01,0x14,0x01,0x20,0x01,0x2C,0x01,0x38,0x01, - 0x44,0x01,0x50,0x01,0x5C,0x01,0x68,0x01,0x74,0x01,0x80,0x01,0x8C,0x01,0x98,0x01,0xA4,0x01, - 0xB0,0x01,0xBC,0x01,0xC8,0x01,0xD4,0x01,0xE0,0x01,0xEC,0x01,0xF8,0x01,0x04,0x02,0x10,0x02, - 0x1C,0x02,0x28,0x02,0x34,0x02,0x40,0x02,0x4C,0x02,0x58,0x02,0x64,0x02,0x70,0x02,0x7C,0x02, - 0x88,0x02,0x94,0x02,0xA0,0x02,0xAC,0x02,0xB8,0x02,0xC4,0x02,0xD0,0x02,0xDC,0x02,0xE8,0x02, - 0xF4,0x02,0x00,0x03,0x0C,0x03,0x18,0x03,0x24,0x03,0x30,0x03,0x3C,0x03,0x48,0x03,0x54,0x03, - 0x60,0x03,0x6C,0x03,0x78,0x03,0x84,0x03,0x90,0x03,0x9C,0x03,0xA8,0x03,0xB4,0x03,0xC0,0x03, - 0xCC,0x03,0xD8,0x03,0xE4,0x03,0xF0,0x03,0xFC,0x03,0x08,0x04,0x14,0x04,0x20,0x04,0x2C,0x04, - 0x38,0x04,0x44,0x04,0x50,0x04,0x5C,0x04,0x68,0x04,0x74,0x04, +const int8u mcs6x11_mono[] = { + 11, 3, 32, 128 - 32, 0x00, 0x00, 0x0C, 0x00, 0x18, 0x00, 0x24, 0x00, 0x30, 0x00, 0x3C, 0x00, 0x48, 0x00, + 0x54, 0x00, 0x60, 0x00, 0x6C, 0x00, 0x78, 0x00, 0x84, 0x00, 0x90, 0x00, 0x9C, 0x00, 0xA8, 0x00, 0xB4, 0x00, + 0xC0, 0x00, 0xCC, 0x00, 0xD8, 0x00, 0xE4, 0x00, 0xF0, 0x00, 0xFC, 0x00, 0x08, 0x01, 0x14, 0x01, 0x20, 0x01, + 0x2C, 0x01, 0x38, 0x01, 0x44, 0x01, 0x50, 0x01, 0x5C, 0x01, 0x68, 0x01, 0x74, 0x01, 0x80, 0x01, 0x8C, 0x01, + 0x98, 0x01, 0xA4, 0x01, 0xB0, 0x01, 0xBC, 0x01, 0xC8, 0x01, 0xD4, 0x01, 0xE0, 0x01, 0xEC, 0x01, 0xF8, 0x01, + 0x04, 0x02, 0x10, 0x02, 0x1C, 0x02, 0x28, 0x02, 0x34, 0x02, 0x40, 0x02, 0x4C, 0x02, 0x58, 0x02, 0x64, 0x02, + 0x70, 0x02, 0x7C, 0x02, 0x88, 0x02, 0x94, 0x02, 0xA0, 0x02, 0xAC, 0x02, 0xB8, 0x02, 0xC4, 0x02, 0xD0, 0x02, + 0xDC, 0x02, 0xE8, 0x02, 0xF4, 0x02, 0x00, 0x03, 0x0C, 0x03, 0x18, 0x03, 0x24, 0x03, 0x30, 0x03, 0x3C, 0x03, + 0x48, 0x03, 0x54, 0x03, 0x60, 0x03, 0x6C, 0x03, 0x78, 0x03, 0x84, 0x03, 0x90, 0x03, 0x9C, 0x03, 0xA8, 0x03, + 0xB4, 0x03, 0xC0, 0x03, 0xCC, 0x03, 0xD8, 0x03, 0xE4, 0x03, 0xF0, 0x03, 0xFC, 0x03, 0x08, 0x04, 0x14, 0x04, + 0x20, 0x04, 0x2C, 0x04, 0x38, 0x04, 0x44, 0x04, 0x50, 0x04, 0x5C, 0x04, 0x68, 0x04, 0x74, 0x04, - 6, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x21 '!' - 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, + 6, // 0x21 '!' + 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x00, 0x00, - 6, // 0x22 '"' - 0x00,0x28,0x28,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x22 '"' + 0x00, 0x28, 0x28, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x23 '#' - 0x00,0x28,0x28,0x7C,0x28,0x28,0x7C,0x28,0x28,0x00,0x00, + 6, // 0x23 '#' + 0x00, 0x28, 0x28, 0x7C, 0x28, 0x28, 0x7C, 0x28, 0x28, 0x00, 0x00, - 6, // 0x24 '$' - 0x00,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x00, + 6, // 0x24 '$' + 0x00, 0x10, 0x38, 0x54, 0x50, 0x38, 0x14, 0x54, 0x38, 0x10, 0x00, - 6, // 0x25 '%' - 0x00,0x68,0xA8,0xD0,0x10,0x20,0x2C,0x54,0x58,0x00,0x00, + 6, // 0x25 '%' + 0x00, 0x68, 0xA8, 0xD0, 0x10, 0x20, 0x2C, 0x54, 0x58, 0x00, 0x00, - 6, // 0x26 '&' - 0x00,0x20,0x50,0x50,0x20,0x54,0x54,0x48,0x34,0x00,0x00, + 6, // 0x26 '&' + 0x00, 0x20, 0x50, 0x50, 0x20, 0x54, 0x54, 0x48, 0x34, 0x00, 0x00, - 6, // 0x27 ''' - 0x00,0x10,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x27 ''' + 0x00, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x28 '(' - 0x08,0x10,0x10,0x20,0x20,0x20,0x20,0x10,0x10,0x08,0x00, + 6, // 0x28 '(' + 0x08, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x10, 0x10, 0x08, 0x00, - 6, // 0x29 ')' - 0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x00, + 6, // 0x29 ')' + 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x10, 0x10, 0x20, 0x00, - 6, // 0x2A '*' - 0x00,0x00,0x28,0x7C,0x38,0x7C,0x28,0x00,0x00,0x00,0x00, + 6, // 0x2A '*' + 0x00, 0x00, 0x28, 0x7C, 0x38, 0x7C, 0x28, 0x00, 0x00, 0x00, 0x00, - 6, // 0x2B '+' - 0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, + 6, // 0x2B '+' + 0x00, 0x00, 0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x00, 0x00, - 6, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x20,0x40, + 6, // 0x2C ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x20, 0x40, - 6, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, + 6, // 0x2D '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00, + 6, // 0x2E '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, - 6, // 0x2F '/' - 0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00, + 6, // 0x2F '/' + 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x00, - 6, // 0x30 '0' - 0x00,0x38,0x44,0x44,0x54,0x54,0x44,0x44,0x38,0x00,0x00, + 6, // 0x30 '0' + 0x00, 0x38, 0x44, 0x44, 0x54, 0x54, 0x44, 0x44, 0x38, 0x00, 0x00, - 6, // 0x31 '1' - 0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 6, // 0x31 '1' + 0x00, 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, - 6, // 0x32 '2' - 0x00,0x38,0x44,0x44,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, + 6, // 0x32 '2' + 0x00, 0x38, 0x44, 0x44, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00, 0x00, - 6, // 0x33 '3' - 0x00,0x38,0x44,0x04,0x38,0x04,0x04,0x44,0x38,0x00,0x00, + 6, // 0x33 '3' + 0x00, 0x38, 0x44, 0x04, 0x38, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, - 6, // 0x34 '4' - 0x00,0x08,0x18,0x28,0x28,0x48,0x7C,0x08,0x08,0x00,0x00, + 6, // 0x34 '4' + 0x00, 0x08, 0x18, 0x28, 0x28, 0x48, 0x7C, 0x08, 0x08, 0x00, 0x00, - 6, // 0x35 '5' - 0x00,0x7C,0x40,0x78,0x44,0x04,0x04,0x44,0x38,0x00,0x00, + 6, // 0x35 '5' + 0x00, 0x7C, 0x40, 0x78, 0x44, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, - 6, // 0x36 '6' - 0x00,0x38,0x44,0x40,0x78,0x44,0x44,0x44,0x38,0x00,0x00, + 6, // 0x36 '6' + 0x00, 0x38, 0x44, 0x40, 0x78, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 6, // 0x37 '7' - 0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x00,0x00, + 6, // 0x37 '7' + 0x00, 0x7C, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x00, 0x00, - 6, // 0x38 '8' - 0x00,0x38,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00, + 6, // 0x38 '8' + 0x00, 0x38, 0x44, 0x44, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 6, // 0x39 '9' - 0x00,0x38,0x44,0x44,0x3C,0x04,0x04,0x44,0x38,0x00,0x00, + 6, // 0x39 '9' + 0x00, 0x38, 0x44, 0x44, 0x3C, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, - 6, // 0x3A ':' - 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x00,0x00, + 6, // 0x3A ':' + 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, - 6, // 0x3B ';' - 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x20,0x40, + 6, // 0x3B ';' + 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x20, 0x40, - 6, // 0x3C '<' - 0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00, + 6, // 0x3C '<' + 0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, - 6, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00, + 6, // 0x3D '=' + 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, - 6, // 0x3E '>' - 0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00, + 6, // 0x3E '>' + 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, - 6, // 0x3F '?' - 0x00,0x38,0x44,0x04,0x08,0x10,0x10,0x00,0x10,0x00,0x00, + 6, // 0x3F '?' + 0x00, 0x38, 0x44, 0x04, 0x08, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, - 6, // 0x40 '@' - 0x00,0x38,0x44,0x5C,0x54,0x54,0x4C,0x40,0x38,0x00,0x00, + 6, // 0x40 '@' + 0x00, 0x38, 0x44, 0x5C, 0x54, 0x54, 0x4C, 0x40, 0x38, 0x00, 0x00, - 6, // 0x41 'A' - 0x00,0x38,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x00,0x00, + 6, // 0x41 'A' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x44, 0x00, 0x00, - 6, // 0x42 'B' - 0x00,0x78,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00,0x00, + 6, // 0x42 'B' + 0x00, 0x78, 0x44, 0x44, 0x78, 0x44, 0x44, 0x44, 0x78, 0x00, 0x00, - 6, // 0x43 'C' - 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00, + 6, // 0x43 'C' + 0x00, 0x38, 0x44, 0x40, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, - 6, // 0x44 'D' - 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00, + 6, // 0x44 'D' + 0x00, 0x70, 0x48, 0x44, 0x44, 0x44, 0x44, 0x48, 0x70, 0x00, 0x00, - 6, // 0x45 'E' - 0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x7C,0x00,0x00, + 6, // 0x45 'E' + 0x00, 0x7C, 0x40, 0x40, 0x78, 0x40, 0x40, 0x40, 0x7C, 0x00, 0x00, - 6, // 0x46 'F' - 0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00,0x00, + 6, // 0x46 'F' + 0x00, 0x7C, 0x40, 0x40, 0x78, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, - 6, // 0x47 'G' - 0x00,0x38,0x44,0x40,0x40,0x5C,0x44,0x4C,0x34,0x00,0x00, + 6, // 0x47 'G' + 0x00, 0x38, 0x44, 0x40, 0x40, 0x5C, 0x44, 0x4C, 0x34, 0x00, 0x00, - 6, // 0x48 'H' - 0x00,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00, + 6, // 0x48 'H' + 0x00, 0x44, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, - 6, // 0x49 'I' - 0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 6, // 0x49 'I' + 0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, - 6, // 0x4A 'J' - 0x00,0x1C,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00, + 6, // 0x4A 'J' + 0x00, 0x1C, 0x08, 0x08, 0x08, 0x08, 0x48, 0x48, 0x30, 0x00, 0x00, - 6, // 0x4B 'K' - 0x00,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x44,0x00,0x00, + 6, // 0x4B 'K' + 0x00, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x44, 0x00, 0x00, - 6, // 0x4C 'L' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00, + 6, // 0x4C 'L' + 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7C, 0x00, 0x00, - 6, // 0x4D 'M' - 0x00,0x44,0x6C,0x54,0x54,0x54,0x44,0x44,0x44,0x00,0x00, + 6, // 0x4D 'M' + 0x00, 0x44, 0x6C, 0x54, 0x54, 0x54, 0x44, 0x44, 0x44, 0x00, 0x00, - 6, // 0x4E 'N' - 0x00,0x44,0x64,0x64,0x54,0x54,0x4C,0x4C,0x44,0x00,0x00, + 6, // 0x4E 'N' + 0x00, 0x44, 0x64, 0x64, 0x54, 0x54, 0x4C, 0x4C, 0x44, 0x00, 0x00, - 6, // 0x4F 'O' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 6, // 0x4F 'O' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 6, // 0x50 'P' - 0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00, + 6, // 0x50 'P' + 0x00, 0x78, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, 0x00, 0x00, - 6, // 0x51 'Q' - 0x00,0x38,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00, + 6, // 0x51 'Q' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x54, 0x48, 0x34, 0x00, 0x00, - 6, // 0x52 'R' - 0x00,0x78,0x44,0x44,0x44,0x78,0x48,0x44,0x44,0x00,0x00, + 6, // 0x52 'R' + 0x00, 0x78, 0x44, 0x44, 0x44, 0x78, 0x48, 0x44, 0x44, 0x00, 0x00, - 6, // 0x53 'S' - 0x00,0x38,0x44,0x40,0x38,0x04,0x04,0x44,0x38,0x00,0x00, + 6, // 0x53 'S' + 0x00, 0x38, 0x44, 0x40, 0x38, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, - 6, // 0x54 'T' - 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, + 6, // 0x54 'T' + 0x00, 0x7C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - 6, // 0x55 'U' - 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 6, // 0x55 'U' + 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 6, // 0x56 'V' - 0x00,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00,0x00, + 6, // 0x56 'V' + 0x00, 0x44, 0x44, 0x44, 0x28, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, - 6, // 0x57 'W' - 0x00,0x44,0x44,0x54,0x54,0x54,0x54,0x54,0x28,0x00,0x00, + 6, // 0x57 'W' + 0x00, 0x44, 0x44, 0x54, 0x54, 0x54, 0x54, 0x54, 0x28, 0x00, 0x00, - 6, // 0x58 'X' - 0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00, + 6, // 0x58 'X' + 0x00, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x44, 0x00, 0x00, - 6, // 0x59 'Y' - 0x00,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x00,0x00, + 6, // 0x59 'Y' + 0x00, 0x44, 0x44, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - 6, // 0x5A 'Z' - 0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x40,0x7C,0x00,0x00, + 6, // 0x5A 'Z' + 0x00, 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x7C, 0x00, 0x00, - 6, // 0x5B '[' - 0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00, + 6, // 0x5B '[' + 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00, - 6, // 0x5C '\' - 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00, + 6, // 0x5C '\' + 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x00, - 6, // 0x5D ']' - 0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x38,0x00, + 6, // 0x5D ']' + 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x00, - 6, // 0x5E '^' - 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x5E '^' + 0x00, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00, + 6, // 0x5F '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, - 6, // 0x60 '`' - 0x00,0x20,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x60 '`' + 0x00, 0x20, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x61 'a' - 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x3C,0x00,0x00, + 6, // 0x61 'a' + 0x00, 0x00, 0x00, 0x38, 0x04, 0x3C, 0x44, 0x44, 0x3C, 0x00, 0x00, - 6, // 0x62 'b' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x78,0x00,0x00, + 6, // 0x62 'b' + 0x00, 0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x44, 0x78, 0x00, 0x00, - 6, // 0x63 'c' - 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x44,0x38,0x00,0x00, + 6, // 0x63 'c' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, - 6, // 0x64 'd' - 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x3C,0x00,0x00, + 6, // 0x64 'd' + 0x00, 0x04, 0x04, 0x3C, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x00, 0x00, - 6, // 0x65 'e' - 0x00,0x00,0x00,0x38,0x44,0x7C,0x40,0x44,0x38,0x00,0x00, + 6, // 0x65 'e' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x7C, 0x40, 0x44, 0x38, 0x00, 0x00, - 6, // 0x66 'f' - 0x00,0x0C,0x10,0x38,0x10,0x10,0x10,0x10,0x10,0x00,0x00, + 6, // 0x66 'f' + 0x00, 0x0C, 0x10, 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - 6, // 0x67 'g' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x78, + 6, // 0x67 'g' + 0x00, 0x00, 0x00, 0x3C, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x78, - 6, // 0x68 'h' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x00,0x00, + 6, // 0x68 'h' + 0x00, 0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, - 6, // 0x69 'i' - 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 6, // 0x69 'i' + 0x00, 0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, - 6, // 0x6A 'j' - 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x50,0x20, + 6, // 0x6A 'j' + 0x00, 0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x50, 0x20, - 6, // 0x6B 'k' - 0x00,0x40,0x40,0x4C,0x50,0x60,0x50,0x48,0x44,0x00,0x00, + 6, // 0x6B 'k' + 0x00, 0x40, 0x40, 0x4C, 0x50, 0x60, 0x50, 0x48, 0x44, 0x00, 0x00, - 6, // 0x6C 'l' - 0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 6, // 0x6C 'l' + 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, - 6, // 0x6D 'm' - 0x00,0x00,0x00,0x68,0x54,0x54,0x54,0x44,0x44,0x00,0x00, + 6, // 0x6D 'm' + 0x00, 0x00, 0x00, 0x68, 0x54, 0x54, 0x54, 0x44, 0x44, 0x00, 0x00, - 6, // 0x6E 'n' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x00,0x00, + 6, // 0x6E 'n' + 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, - 6, // 0x6F 'o' - 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 6, // 0x6F 'o' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 6, // 0x70 'p' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40, + 6, // 0x70 'p' + 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, - 6, // 0x71 'q' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x04, + 6, // 0x71 'q' + 0x00, 0x00, 0x00, 0x3C, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x04, - 6, // 0x72 'r' - 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x20,0x70,0x00,0x00, + 6, // 0x72 'r' + 0x00, 0x00, 0x00, 0x58, 0x24, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, - 6, // 0x73 's' - 0x00,0x00,0x00,0x38,0x44,0x30,0x08,0x44,0x38,0x00,0x00, + 6, // 0x73 's' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x30, 0x08, 0x44, 0x38, 0x00, 0x00, - 6, // 0x74 't' - 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x20,0x18,0x00,0x00, + 6, // 0x74 't' + 0x00, 0x20, 0x20, 0x70, 0x20, 0x20, 0x20, 0x20, 0x18, 0x00, 0x00, - 6, // 0x75 'u' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x4C,0x34,0x00,0x00, + 6, // 0x75 'u' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x4C, 0x34, 0x00, 0x00, - 6, // 0x76 'v' - 0x00,0x00,0x00,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00, + 6, // 0x76 'v' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, - 6, // 0x77 'w' - 0x00,0x00,0x00,0x44,0x44,0x44,0x54,0x7C,0x28,0x00,0x00, + 6, // 0x77 'w' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x54, 0x7C, 0x28, 0x00, 0x00, - 6, // 0x78 'x' - 0x00,0x00,0x00,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, + 6, // 0x78 'x' + 0x00, 0x00, 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x00, 0x00, - 6, // 0x79 'y' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x3C,0x08,0x70, + 6, // 0x79 'y' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x08, 0x70, - 6, // 0x7A 'z' - 0x00,0x00,0x00,0x7C,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, + 6, // 0x7A 'z' + 0x00, 0x00, 0x00, 0x7C, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00, 0x00, - 6, // 0x7B '{' - 0x18,0x20,0x20,0x20,0xC0,0xC0,0x20,0x20,0x20,0x18,0x00, + 6, // 0x7B '{' + 0x18, 0x20, 0x20, 0x20, 0xC0, 0xC0, 0x20, 0x20, 0x20, 0x18, 0x00, - 6, // 0x7C '|' - 0x00,0x10,0x10,0x10,0x10,0x00,0x10,0x10,0x10,0x10,0x00, + 6, // 0x7C '|' + 0x00, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00, - 6, // 0x7D '}' - 0x60,0x10,0x10,0x10,0x0C,0x0C,0x10,0x10,0x10,0x60,0x00, + 6, // 0x7D '}' + 0x60, 0x10, 0x10, 0x10, 0x0C, 0x0C, 0x10, 0x10, 0x10, 0x60, 0x00, - 6, // 0x7E '~' - 0x00,0x24,0x54,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x7E '~' + 0x00, 0x24, 0x54, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x7F '' - 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00,0x00, + 6, // 0x7F '' + 0x00, 0x10, 0x38, 0x6C, 0x44, 0x44, 0x7C, 0x00, 0x00, 0x00, 0x00, - 0 -}; + 0}; -const int8u mcs7x12_mono_high[] = -{ - 12, 3, 32, 128-32, - 0x00,0x00,0x0D,0x00,0x1A,0x00,0x27,0x00,0x34,0x00,0x41,0x00,0x4E,0x00,0x5B,0x00,0x68,0x00, - 0x75,0x00,0x82,0x00,0x8F,0x00,0x9C,0x00,0xA9,0x00,0xB6,0x00,0xC3,0x00,0xD0,0x00,0xDD,0x00, - 0xEA,0x00,0xF7,0x00,0x04,0x01,0x11,0x01,0x1E,0x01,0x2B,0x01,0x38,0x01,0x45,0x01,0x52,0x01, - 0x5F,0x01,0x6C,0x01,0x79,0x01,0x86,0x01,0x93,0x01,0xA0,0x01,0xAD,0x01,0xBA,0x01,0xC7,0x01, - 0xD4,0x01,0xE1,0x01,0xEE,0x01,0xFB,0x01,0x08,0x02,0x15,0x02,0x22,0x02,0x2F,0x02,0x3C,0x02, - 0x49,0x02,0x56,0x02,0x63,0x02,0x70,0x02,0x7D,0x02,0x8A,0x02,0x97,0x02,0xA4,0x02,0xB1,0x02, - 0xBE,0x02,0xCB,0x02,0xD8,0x02,0xE5,0x02,0xF2,0x02,0xFF,0x02,0x0C,0x03,0x19,0x03,0x26,0x03, - 0x33,0x03,0x40,0x03,0x4D,0x03,0x5A,0x03,0x67,0x03,0x74,0x03,0x81,0x03,0x8E,0x03,0x9B,0x03, - 0xA8,0x03,0xB5,0x03,0xC2,0x03,0xCF,0x03,0xDC,0x03,0xE9,0x03,0xF6,0x03,0x03,0x04,0x10,0x04, - 0x1D,0x04,0x2A,0x04,0x37,0x04,0x44,0x04,0x51,0x04,0x5E,0x04,0x6B,0x04,0x78,0x04,0x85,0x04, - 0x92,0x04,0x9F,0x04,0xAC,0x04,0xB9,0x04,0xC6,0x04,0xD3,0x04, +const int8u mcs7x12_mono_high[] = { + 12, 3, 32, 128 - 32, 0x00, 0x00, 0x0D, 0x00, 0x1A, 0x00, 0x27, 0x00, 0x34, 0x00, 0x41, 0x00, 0x4E, 0x00, + 0x5B, 0x00, 0x68, 0x00, 0x75, 0x00, 0x82, 0x00, 0x8F, 0x00, 0x9C, 0x00, 0xA9, 0x00, 0xB6, 0x00, 0xC3, 0x00, + 0xD0, 0x00, 0xDD, 0x00, 0xEA, 0x00, 0xF7, 0x00, 0x04, 0x01, 0x11, 0x01, 0x1E, 0x01, 0x2B, 0x01, 0x38, 0x01, + 0x45, 0x01, 0x52, 0x01, 0x5F, 0x01, 0x6C, 0x01, 0x79, 0x01, 0x86, 0x01, 0x93, 0x01, 0xA0, 0x01, 0xAD, 0x01, + 0xBA, 0x01, 0xC7, 0x01, 0xD4, 0x01, 0xE1, 0x01, 0xEE, 0x01, 0xFB, 0x01, 0x08, 0x02, 0x15, 0x02, 0x22, 0x02, + 0x2F, 0x02, 0x3C, 0x02, 0x49, 0x02, 0x56, 0x02, 0x63, 0x02, 0x70, 0x02, 0x7D, 0x02, 0x8A, 0x02, 0x97, 0x02, + 0xA4, 0x02, 0xB1, 0x02, 0xBE, 0x02, 0xCB, 0x02, 0xD8, 0x02, 0xE5, 0x02, 0xF2, 0x02, 0xFF, 0x02, 0x0C, 0x03, + 0x19, 0x03, 0x26, 0x03, 0x33, 0x03, 0x40, 0x03, 0x4D, 0x03, 0x5A, 0x03, 0x67, 0x03, 0x74, 0x03, 0x81, 0x03, + 0x8E, 0x03, 0x9B, 0x03, 0xA8, 0x03, 0xB5, 0x03, 0xC2, 0x03, 0xCF, 0x03, 0xDC, 0x03, 0xE9, 0x03, 0xF6, 0x03, + 0x03, 0x04, 0x10, 0x04, 0x1D, 0x04, 0x2A, 0x04, 0x37, 0x04, 0x44, 0x04, 0x51, 0x04, 0x5E, 0x04, 0x6B, 0x04, + 0x78, 0x04, 0x85, 0x04, 0x92, 0x04, 0x9F, 0x04, 0xAC, 0x04, 0xB9, 0x04, 0xC6, 0x04, 0xD3, 0x04, - 7, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x21 '!' - 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x10,0x00,0x00, + 7, // 0x21 '!' + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, - 7, // 0x22 '"' - 0x28,0x28,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x22 '"' + 0x28, 0x28, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x23 '#' - 0x24,0x24,0x24,0x7E,0x24,0x24,0x24,0x7E,0x24,0x24,0x24,0x00, + 7, // 0x23 '#' + 0x24, 0x24, 0x24, 0x7E, 0x24, 0x24, 0x24, 0x7E, 0x24, 0x24, 0x24, 0x00, - 7, // 0x24 '$' - 0x10,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x10,0x00, + 7, // 0x24 '$' + 0x10, 0x10, 0x38, 0x54, 0x50, 0x38, 0x14, 0x54, 0x38, 0x10, 0x10, 0x00, - 7, // 0x25 '%' - 0x32,0x54,0x64,0x08,0x08,0x10,0x10,0x26,0x2A,0x4C,0x00,0x00, + 7, // 0x25 '%' + 0x32, 0x54, 0x64, 0x08, 0x08, 0x10, 0x10, 0x26, 0x2A, 0x4C, 0x00, 0x00, - 7, // 0x26 '&' - 0x00,0x20,0x50,0x50,0x50,0x20,0x54,0x54,0x48,0x34,0x00,0x00, + 7, // 0x26 '&' + 0x00, 0x20, 0x50, 0x50, 0x50, 0x20, 0x54, 0x54, 0x48, 0x34, 0x00, 0x00, - 7, // 0x27 ''' - 0x10,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x27 ''' + 0x10, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x28 '(' - 0x08,0x10,0x10,0x20,0x20,0x20,0x20,0x20,0x10,0x10,0x08,0x00, + 7, // 0x28 '(' + 0x08, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x20, 0x10, 0x10, 0x08, 0x00, - 7, // 0x29 ')' - 0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x00, + 7, // 0x29 ')' + 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x10, 0x20, 0x00, - 7, // 0x2A '*' - 0x00,0x00,0x10,0x54,0x38,0x7C,0x38,0x54,0x10,0x00,0x00,0x00, + 7, // 0x2A '*' + 0x00, 0x00, 0x10, 0x54, 0x38, 0x7C, 0x38, 0x54, 0x10, 0x00, 0x00, 0x00, - 7, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, + 7, // 0x2B '+' + 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x00, 0x00, - 7, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x20,0x40, + 7, // 0x2C ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x20, 0x40, - 7, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2D '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00, + 7, // 0x2E '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, - 7, // 0x2F '/' - 0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,0x00, + 7, // 0x2F '/' + 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x00, 0x00, - 7, // 0x30 '0' - 0x00,0x38,0x44,0x44,0x54,0x54,0x54,0x44,0x44,0x38,0x00,0x00, + 7, // 0x30 '0' + 0x00, 0x38, 0x44, 0x44, 0x54, 0x54, 0x54, 0x44, 0x44, 0x38, 0x00, 0x00, - 7, // 0x31 '1' - 0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 7, // 0x31 '1' + 0x00, 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, - 7, // 0x32 '2' - 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, + 7, // 0x32 '2' + 0x00, 0x38, 0x44, 0x04, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00, 0x00, - 7, // 0x33 '3' - 0x00,0x38,0x44,0x04,0x04,0x38,0x04,0x04,0x44,0x38,0x00,0x00, + 7, // 0x33 '3' + 0x00, 0x38, 0x44, 0x04, 0x04, 0x38, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, - 7, // 0x34 '4' - 0x00,0x08,0x18,0x28,0x28,0x48,0x48,0x7C,0x08,0x08,0x00,0x00, + 7, // 0x34 '4' + 0x00, 0x08, 0x18, 0x28, 0x28, 0x48, 0x48, 0x7C, 0x08, 0x08, 0x00, 0x00, - 7, // 0x35 '5' - 0x00,0x7C,0x40,0x40,0x78,0x44,0x04,0x04,0x44,0x38,0x00,0x00, + 7, // 0x35 '5' + 0x00, 0x7C, 0x40, 0x40, 0x78, 0x44, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, - 7, // 0x36 '6' - 0x00,0x38,0x44,0x40,0x78,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x36 '6' + 0x00, 0x38, 0x44, 0x40, 0x78, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 7, // 0x37 '7' - 0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x00,0x00, + 7, // 0x37 '7' + 0x00, 0x7C, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x20, 0x00, 0x00, - 7, // 0x38 '8' - 0x00,0x38,0x44,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x38 '8' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 7, // 0x39 '9' - 0x00,0x38,0x44,0x44,0x44,0x3C,0x04,0x04,0x44,0x38,0x00,0x00, + 7, // 0x39 '9' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, - 7, // 0x3A ':' - 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x30,0x30,0x00,0x00, + 7, // 0x3A ':' + 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, - 7, // 0x3B ';' - 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x30,0x30,0x20,0x40, + 7, // 0x3B ';' + 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x30, 0x30, 0x20, 0x40, - 7, // 0x3C '<' - 0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00,0x00, + 7, // 0x3C '<' + 0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, - 7, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00,0x00, + 7, // 0x3D '=' + 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, - 7, // 0x3E '>' - 0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00,0x00, + 7, // 0x3E '>' + 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, - 7, // 0x3F '?' - 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x10,0x00,0x10,0x00,0x00, + 7, // 0x3F '?' + 0x00, 0x38, 0x44, 0x04, 0x04, 0x08, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, - 7, // 0x40 '@' - 0x00,0x38,0x44,0x44,0x5C,0x54,0x54,0x4C,0x40,0x38,0x00,0x00, + 7, // 0x40 '@' + 0x00, 0x38, 0x44, 0x44, 0x5C, 0x54, 0x54, 0x4C, 0x40, 0x38, 0x00, 0x00, - 7, // 0x41 'A' - 0x00,0x38,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x41 'A' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, - 7, // 0x42 'B' - 0x00,0x78,0x44,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00,0x00, + 7, // 0x42 'B' + 0x00, 0x78, 0x44, 0x44, 0x44, 0x78, 0x44, 0x44, 0x44, 0x78, 0x00, 0x00, - 7, // 0x43 'C' - 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00, + 7, // 0x43 'C' + 0x00, 0x38, 0x44, 0x40, 0x40, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, - 7, // 0x44 'D' - 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00, + 7, // 0x44 'D' + 0x00, 0x70, 0x48, 0x44, 0x44, 0x44, 0x44, 0x44, 0x48, 0x70, 0x00, 0x00, - 7, // 0x45 'E' - 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x7C,0x00,0x00, + 7, // 0x45 'E' + 0x00, 0x7C, 0x40, 0x40, 0x40, 0x78, 0x40, 0x40, 0x40, 0x7C, 0x00, 0x00, - 7, // 0x46 'F' - 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00,0x00, + 7, // 0x46 'F' + 0x00, 0x7C, 0x40, 0x40, 0x40, 0x78, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, - 7, // 0x47 'G' - 0x00,0x38,0x44,0x40,0x40,0x5C,0x44,0x44,0x4C,0x34,0x00,0x00, + 7, // 0x47 'G' + 0x00, 0x38, 0x44, 0x40, 0x40, 0x5C, 0x44, 0x44, 0x4C, 0x34, 0x00, 0x00, - 7, // 0x48 'H' - 0x00,0x44,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x48 'H' + 0x00, 0x44, 0x44, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, - 7, // 0x49 'I' - 0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 7, // 0x49 'I' + 0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, - 7, // 0x4A 'J' - 0x00,0x1C,0x08,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00, + 7, // 0x4A 'J' + 0x00, 0x1C, 0x08, 0x08, 0x08, 0x08, 0x08, 0x48, 0x48, 0x30, 0x00, 0x00, - 7, // 0x4B 'K' - 0x00,0x44,0x48,0x50,0x60,0x60,0x50,0x48,0x44,0x44,0x00,0x00, + 7, // 0x4B 'K' + 0x00, 0x44, 0x48, 0x50, 0x60, 0x60, 0x50, 0x48, 0x44, 0x44, 0x00, 0x00, - 7, // 0x4C 'L' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00, + 7, // 0x4C 'L' + 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7C, 0x00, 0x00, - 7, // 0x4D 'M' - 0x00,0x44,0x6C,0x6C,0x54,0x54,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x4D 'M' + 0x00, 0x44, 0x6C, 0x6C, 0x54, 0x54, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, - 7, // 0x4E 'N' - 0x00,0x44,0x64,0x64,0x54,0x54,0x4C,0x4C,0x44,0x44,0x00,0x00, + 7, // 0x4E 'N' + 0x00, 0x44, 0x64, 0x64, 0x54, 0x54, 0x4C, 0x4C, 0x44, 0x44, 0x00, 0x00, - 7, // 0x4F 'O' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x4F 'O' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 7, // 0x50 'P' - 0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00, + 7, // 0x50 'P' + 0x00, 0x78, 0x44, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, 0x00, 0x00, - 7, // 0x51 'Q' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00, + 7, // 0x51 'Q' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x54, 0x48, 0x34, 0x00, 0x00, - 7, // 0x52 'R' - 0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x48,0x44,0x44,0x00,0x00, + 7, // 0x52 'R' + 0x00, 0x78, 0x44, 0x44, 0x44, 0x44, 0x78, 0x48, 0x44, 0x44, 0x00, 0x00, - 7, // 0x53 'S' - 0x00,0x38,0x44,0x40,0x40,0x38,0x04,0x04,0x44,0x38,0x00,0x00, + 7, // 0x53 'S' + 0x00, 0x38, 0x44, 0x40, 0x40, 0x38, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, - 7, // 0x54 'T' - 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, + 7, // 0x54 'T' + 0x00, 0x7C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - 7, // 0x55 'U' - 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x55 'U' + 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 7, // 0x56 'V' - 0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00,0x00, + 7, // 0x56 'V' + 0x00, 0x44, 0x44, 0x44, 0x44, 0x28, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, - 7, // 0x57 'W' - 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x54,0x54,0x28,0x00,0x00, + 7, // 0x57 'W' + 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x54, 0x54, 0x28, 0x00, 0x00, - 7, // 0x58 'X' - 0x00,0x44,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00, + 7, // 0x58 'X' + 0x00, 0x44, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x44, 0x00, 0x00, - 7, // 0x59 'Y' - 0x00,0x44,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x00,0x00, + 7, // 0x59 'Y' + 0x00, 0x44, 0x44, 0x44, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - 7, // 0x5A 'Z' - 0x00,0x7C,0x04,0x04,0x08,0x10,0x20,0x40,0x40,0x7C,0x00,0x00, + 7, // 0x5A 'Z' + 0x00, 0x7C, 0x04, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x7C, 0x00, 0x00, - 7, // 0x5B '[' - 0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00, + 7, // 0x5B '[' + 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00, - 7, // 0x5C '\' - 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00, + 7, // 0x5C '\' + 0x00, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x00, - 7, // 0x5D ']' - 0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x38,0x00, + 7, // 0x5D ']' + 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x00, - 7, // 0x5E '^' - 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x5E '^' + 0x00, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00, + 7, // 0x5F '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, - 7, // 0x60 '`' - 0x00,0x20,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x60 '`' + 0x00, 0x20, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x61 'a' - 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x44,0x3C,0x00,0x00, + 7, // 0x61 'a' + 0x00, 0x00, 0x00, 0x38, 0x04, 0x3C, 0x44, 0x44, 0x44, 0x3C, 0x00, 0x00, - 7, // 0x62 'b' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x00,0x00, + 7, // 0x62 'b' + 0x00, 0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x44, 0x44, 0x78, 0x00, 0x00, - 7, // 0x63 'c' - 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x44,0x38,0x00,0x00, + 7, // 0x63 'c' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, - 7, // 0x64 'd' - 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x00,0x00, + 7, // 0x64 'd' + 0x00, 0x04, 0x04, 0x3C, 0x44, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x00, 0x00, - 7, // 0x65 'e' - 0x00,0x00,0x00,0x38,0x44,0x44,0x7C,0x40,0x44,0x38,0x00,0x00, + 7, // 0x65 'e' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x7C, 0x40, 0x44, 0x38, 0x00, 0x00, - 7, // 0x66 'f' - 0x00,0x0C,0x10,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, + 7, // 0x66 'f' + 0x00, 0x0C, 0x10, 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - 7, // 0x67 'g' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x78, + 7, // 0x67 'g' + 0x00, 0x00, 0x00, 0x3C, 0x44, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x78, - 7, // 0x68 'h' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x68 'h' + 0x00, 0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, - 7, // 0x69 'i' - 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 7, // 0x69 'i' + 0x00, 0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, - 7, // 0x6A 'j' - 0x00,0x08,0x00,0x18,0x08,0x08,0x08,0x08,0x08,0x08,0x48,0x30, + 7, // 0x6A 'j' + 0x00, 0x08, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x48, 0x30, - 7, // 0x6B 'k' - 0x00,0x40,0x40,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00, + 7, // 0x6B 'k' + 0x00, 0x40, 0x40, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x00, 0x00, - 7, // 0x6C 'l' - 0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 7, // 0x6C 'l' + 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, - 7, // 0x6D 'm' - 0x00,0x00,0x00,0x68,0x54,0x54,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x6D 'm' + 0x00, 0x00, 0x00, 0x68, 0x54, 0x54, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, - 7, // 0x6E 'n' - 0x00,0x00,0x00,0x58,0x64,0x44,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x6E 'n' + 0x00, 0x00, 0x00, 0x58, 0x64, 0x44, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, - 7, // 0x6F 'o' - 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x6F 'o' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 7, // 0x70 'p' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x40,0x40, + 7, // 0x70 'p' + 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, - 7, // 0x71 'q' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x04, + 7, // 0x71 'q' + 0x00, 0x00, 0x00, 0x3C, 0x44, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x04, - 7, // 0x72 'r' - 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 7, // 0x72 'r' + 0x00, 0x00, 0x00, 0x58, 0x24, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, - 7, // 0x73 's' - 0x00,0x00,0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x38,0x00,0x00, + 7, // 0x73 's' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x38, 0x04, 0x44, 0x38, 0x00, 0x00, - 7, // 0x74 't' - 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x20,0x24,0x18,0x00,0x00, + 7, // 0x74 't' + 0x00, 0x20, 0x20, 0x70, 0x20, 0x20, 0x20, 0x20, 0x24, 0x18, 0x00, 0x00, - 7, // 0x75 'u' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x4C,0x34,0x00,0x00, + 7, // 0x75 'u' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x4C, 0x34, 0x00, 0x00, - 7, // 0x76 'v' - 0x00,0x00,0x00,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00, + 7, // 0x76 'v' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, - 7, // 0x77 'w' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x54,0x54,0x28,0x00,0x00, + 7, // 0x77 'w' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x54, 0x54, 0x28, 0x00, 0x00, - 7, // 0x78 'x' - 0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, + 7, // 0x78 'x' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x00, 0x00, - 7, // 0x79 'y' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x3C,0x08,0x70, + 7, // 0x79 'y' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x08, 0x70, - 7, // 0x7A 'z' - 0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, + 7, // 0x7A 'z' + 0x00, 0x00, 0x00, 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00, 0x00, - 7, // 0x7B '{' - 0x18,0x20,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x20,0x18,0x00, + 7, // 0x7B '{' + 0x18, 0x20, 0x20, 0x20, 0x20, 0xC0, 0x20, 0x20, 0x20, 0x20, 0x18, 0x00, - 7, // 0x7C '|' - 0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00, + 7, // 0x7C '|' + 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, - 7, // 0x7D '}' - 0x60,0x10,0x10,0x10,0x10,0x0C,0x10,0x10,0x10,0x10,0x60,0x00, + 7, // 0x7D '}' + 0x60, 0x10, 0x10, 0x10, 0x10, 0x0C, 0x10, 0x10, 0x10, 0x10, 0x60, 0x00, - 7, // 0x7E '~' - 0x00,0x60,0x92,0x92,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x7E '~' + 0x00, 0x60, 0x92, 0x92, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x7F '' - 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00,0x00,0x00, + 7, // 0x7F '' + 0x00, 0x10, 0x38, 0x6C, 0x44, 0x44, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, - 0 -}; + 0}; -const int8u mcs7x12_mono_low[] = -{ - 12, 4, 32, 128-32, - 0x00,0x00,0x0D,0x00,0x1A,0x00,0x27,0x00,0x34,0x00,0x41,0x00,0x4E,0x00,0x5B,0x00,0x68,0x00, - 0x75,0x00,0x82,0x00,0x8F,0x00,0x9C,0x00,0xA9,0x00,0xB6,0x00,0xC3,0x00,0xD0,0x00,0xDD,0x00, - 0xEA,0x00,0xF7,0x00,0x04,0x01,0x11,0x01,0x1E,0x01,0x2B,0x01,0x38,0x01,0x45,0x01,0x52,0x01, - 0x5F,0x01,0x6C,0x01,0x79,0x01,0x86,0x01,0x93,0x01,0xA0,0x01,0xAD,0x01,0xBA,0x01,0xC7,0x01, - 0xD4,0x01,0xE1,0x01,0xEE,0x01,0xFB,0x01,0x08,0x02,0x15,0x02,0x22,0x02,0x2F,0x02,0x3C,0x02, - 0x49,0x02,0x56,0x02,0x63,0x02,0x70,0x02,0x7D,0x02,0x8A,0x02,0x97,0x02,0xA4,0x02,0xB1,0x02, - 0xBE,0x02,0xCB,0x02,0xD8,0x02,0xE5,0x02,0xF2,0x02,0xFF,0x02,0x0C,0x03,0x19,0x03,0x26,0x03, - 0x33,0x03,0x40,0x03,0x4D,0x03,0x5A,0x03,0x67,0x03,0x74,0x03,0x81,0x03,0x8E,0x03,0x9B,0x03, - 0xA8,0x03,0xB5,0x03,0xC2,0x03,0xCF,0x03,0xDC,0x03,0xE9,0x03,0xF6,0x03,0x03,0x04,0x10,0x04, - 0x1D,0x04,0x2A,0x04,0x37,0x04,0x44,0x04,0x51,0x04,0x5E,0x04,0x6B,0x04,0x78,0x04,0x85,0x04, - 0x92,0x04,0x9F,0x04,0xAC,0x04,0xB9,0x04,0xC6,0x04,0xD3,0x04, +const int8u mcs7x12_mono_low[] = { + 12, 4, 32, 128 - 32, 0x00, 0x00, 0x0D, 0x00, 0x1A, 0x00, 0x27, 0x00, 0x34, 0x00, 0x41, 0x00, 0x4E, 0x00, + 0x5B, 0x00, 0x68, 0x00, 0x75, 0x00, 0x82, 0x00, 0x8F, 0x00, 0x9C, 0x00, 0xA9, 0x00, 0xB6, 0x00, 0xC3, 0x00, + 0xD0, 0x00, 0xDD, 0x00, 0xEA, 0x00, 0xF7, 0x00, 0x04, 0x01, 0x11, 0x01, 0x1E, 0x01, 0x2B, 0x01, 0x38, 0x01, + 0x45, 0x01, 0x52, 0x01, 0x5F, 0x01, 0x6C, 0x01, 0x79, 0x01, 0x86, 0x01, 0x93, 0x01, 0xA0, 0x01, 0xAD, 0x01, + 0xBA, 0x01, 0xC7, 0x01, 0xD4, 0x01, 0xE1, 0x01, 0xEE, 0x01, 0xFB, 0x01, 0x08, 0x02, 0x15, 0x02, 0x22, 0x02, + 0x2F, 0x02, 0x3C, 0x02, 0x49, 0x02, 0x56, 0x02, 0x63, 0x02, 0x70, 0x02, 0x7D, 0x02, 0x8A, 0x02, 0x97, 0x02, + 0xA4, 0x02, 0xB1, 0x02, 0xBE, 0x02, 0xCB, 0x02, 0xD8, 0x02, 0xE5, 0x02, 0xF2, 0x02, 0xFF, 0x02, 0x0C, 0x03, + 0x19, 0x03, 0x26, 0x03, 0x33, 0x03, 0x40, 0x03, 0x4D, 0x03, 0x5A, 0x03, 0x67, 0x03, 0x74, 0x03, 0x81, 0x03, + 0x8E, 0x03, 0x9B, 0x03, 0xA8, 0x03, 0xB5, 0x03, 0xC2, 0x03, 0xCF, 0x03, 0xDC, 0x03, 0xE9, 0x03, 0xF6, 0x03, + 0x03, 0x04, 0x10, 0x04, 0x1D, 0x04, 0x2A, 0x04, 0x37, 0x04, 0x44, 0x04, 0x51, 0x04, 0x5E, 0x04, 0x6B, 0x04, + 0x78, 0x04, 0x85, 0x04, 0x92, 0x04, 0x9F, 0x04, 0xAC, 0x04, 0xB9, 0x04, 0xC6, 0x04, 0xD3, 0x04, - 7, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x21 '!' - 0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x10,0x00,0x00, + 7, // 0x21 '!' + 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, - 7, // 0x22 '"' - 0x28,0x28,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x22 '"' + 0x28, 0x28, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x23 '#' - 0x00,0x28,0x28,0x7C,0x28,0x28,0x28,0x7C,0x28,0x28,0x00,0x00, + 7, // 0x23 '#' + 0x00, 0x28, 0x28, 0x7C, 0x28, 0x28, 0x28, 0x7C, 0x28, 0x28, 0x00, 0x00, - 7, // 0x24 '$' - 0x00,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x00,0x00, + 7, // 0x24 '$' + 0x00, 0x10, 0x38, 0x54, 0x50, 0x38, 0x14, 0x54, 0x38, 0x10, 0x00, 0x00, - 7, // 0x25 '%' - 0x34,0x54,0x68,0x08,0x10,0x10,0x20,0x2C,0x54,0x58,0x00,0x00, + 7, // 0x25 '%' + 0x34, 0x54, 0x68, 0x08, 0x10, 0x10, 0x20, 0x2C, 0x54, 0x58, 0x00, 0x00, - 7, // 0x26 '&' - 0x00,0x20,0x50,0x50,0x20,0x54,0x54,0x48,0x34,0x00,0x00,0x00, + 7, // 0x26 '&' + 0x00, 0x20, 0x50, 0x50, 0x20, 0x54, 0x54, 0x48, 0x34, 0x00, 0x00, 0x00, - 7, // 0x27 ''' - 0x00,0x10,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x27 ''' + 0x00, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x28 '(' - 0x08,0x10,0x10,0x20,0x20,0x20,0x20,0x20,0x10,0x10,0x08,0x00, + 7, // 0x28 '(' + 0x08, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x20, 0x10, 0x10, 0x08, 0x00, - 7, // 0x29 ')' - 0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x00, + 7, // 0x29 ')' + 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x10, 0x20, 0x00, - 7, // 0x2A '*' - 0x00,0x00,0x10,0x54,0x38,0x7C,0x38,0x54,0x10,0x00,0x00,0x00, + 7, // 0x2A '*' + 0x00, 0x00, 0x10, 0x54, 0x38, 0x7C, 0x38, 0x54, 0x10, 0x00, 0x00, 0x00, - 7, // 0x2B '+' - 0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00,0x00, + 7, // 0x2B '+' + 0x00, 0x00, 0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, - 7, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x20,0x40,0x00, + 7, // 0x2C ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x20, 0x40, 0x00, - 7, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2D '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00, + 7, // 0x2E '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, - 7, // 0x2F '/' - 0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,0x00, + 7, // 0x2F '/' + 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x00, 0x00, - 7, // 0x30 '0' - 0x00,0x38,0x44,0x44,0x54,0x54,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x30 '0' + 0x00, 0x38, 0x44, 0x44, 0x54, 0x54, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x31 '1' - 0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, + 7, // 0x31 '1' + 0x00, 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, - 7, // 0x32 '2' - 0x00,0x38,0x44,0x44,0x08,0x10,0x20,0x40,0x7C,0x00,0x00,0x00, + 7, // 0x32 '2' + 0x00, 0x38, 0x44, 0x44, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00, 0x00, 0x00, - 7, // 0x33 '3' - 0x00,0x38,0x44,0x04,0x38,0x04,0x04,0x44,0x38,0x00,0x00,0x00, + 7, // 0x33 '3' + 0x00, 0x38, 0x44, 0x04, 0x38, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x34 '4' - 0x00,0x08,0x18,0x28,0x28,0x48,0x7C,0x08,0x08,0x00,0x00,0x00, + 7, // 0x34 '4' + 0x00, 0x08, 0x18, 0x28, 0x28, 0x48, 0x7C, 0x08, 0x08, 0x00, 0x00, 0x00, - 7, // 0x35 '5' - 0x00,0x7C,0x40,0x78,0x44,0x04,0x04,0x44,0x38,0x00,0x00,0x00, + 7, // 0x35 '5' + 0x00, 0x7C, 0x40, 0x78, 0x44, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x36 '6' - 0x00,0x38,0x44,0x40,0x78,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x36 '6' + 0x00, 0x38, 0x44, 0x40, 0x78, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x37 '7' - 0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x00,0x00,0x00, + 7, // 0x37 '7' + 0x00, 0x7C, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x00, 0x00, 0x00, - 7, // 0x38 '8' - 0x00,0x38,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x38 '8' + 0x00, 0x38, 0x44, 0x44, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x39 '9' - 0x00,0x38,0x44,0x44,0x44,0x3C,0x04,0x44,0x38,0x00,0x00,0x00, + 7, // 0x39 '9' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x3A ':' - 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x00,0x00,0x00, + 7, // 0x3A ':' + 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, - 7, // 0x3B ';' - 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x20,0x40,0x00, + 7, // 0x3B ';' + 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x20, 0x40, 0x00, - 7, // 0x3C '<' - 0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00,0x00, + 7, // 0x3C '<' + 0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, - 7, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00,0x00, + 7, // 0x3D '=' + 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, - 7, // 0x3E '>' - 0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00,0x00, + 7, // 0x3E '>' + 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, - 7, // 0x3F '?' - 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x10,0x00,0x10,0x00,0x00, + 7, // 0x3F '?' + 0x00, 0x38, 0x44, 0x04, 0x04, 0x08, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, - 7, // 0x40 '@' - 0x00,0x38,0x44,0x44,0x5C,0x54,0x4C,0x40,0x38,0x00,0x00,0x00, + 7, // 0x40 '@' + 0x00, 0x38, 0x44, 0x44, 0x5C, 0x54, 0x4C, 0x40, 0x38, 0x00, 0x00, 0x00, - 7, // 0x41 'A' - 0x00,0x38,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x41 'A' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, - 7, // 0x42 'B' - 0x00,0x78,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00,0x00,0x00, + 7, // 0x42 'B' + 0x00, 0x78, 0x44, 0x44, 0x78, 0x44, 0x44, 0x44, 0x78, 0x00, 0x00, 0x00, - 7, // 0x43 'C' - 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00,0x00, + 7, // 0x43 'C' + 0x00, 0x38, 0x44, 0x40, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x44 'D' - 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00,0x00, + 7, // 0x44 'D' + 0x00, 0x70, 0x48, 0x44, 0x44, 0x44, 0x44, 0x48, 0x70, 0x00, 0x00, 0x00, - 7, // 0x45 'E' - 0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x7C,0x00,0x00,0x00, + 7, // 0x45 'E' + 0x00, 0x7C, 0x40, 0x40, 0x78, 0x40, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00, - 7, // 0x46 'F' - 0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 7, // 0x46 'F' + 0x00, 0x7C, 0x40, 0x40, 0x78, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, - 7, // 0x47 'G' - 0x00,0x38,0x44,0x40,0x40,0x4C,0x44,0x4C,0x34,0x00,0x00,0x00, + 7, // 0x47 'G' + 0x00, 0x38, 0x44, 0x40, 0x40, 0x4C, 0x44, 0x4C, 0x34, 0x00, 0x00, 0x00, - 7, // 0x48 'H' - 0x00,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x48 'H' + 0x00, 0x44, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, - 7, // 0x49 'I' - 0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, + 7, // 0x49 'I' + 0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, - 7, // 0x4A 'J' - 0x00,0x1C,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00,0x00, + 7, // 0x4A 'J' + 0x00, 0x1C, 0x08, 0x08, 0x08, 0x08, 0x48, 0x48, 0x30, 0x00, 0x00, 0x00, - 7, // 0x4B 'K' - 0x00,0x44,0x48,0x50,0x60,0x60,0x50,0x48,0x44,0x00,0x00,0x00, + 7, // 0x4B 'K' + 0x00, 0x44, 0x48, 0x50, 0x60, 0x60, 0x50, 0x48, 0x44, 0x00, 0x00, 0x00, - 7, // 0x4C 'L' - 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00,0x00, + 7, // 0x4C 'L' + 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00, - 7, // 0x4D 'M' - 0x00,0x44,0x6C,0x54,0x54,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x4D 'M' + 0x00, 0x44, 0x6C, 0x54, 0x54, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, - 7, // 0x4E 'N' - 0x00,0x44,0x64,0x64,0x54,0x54,0x4C,0x4C,0x44,0x00,0x00,0x00, + 7, // 0x4E 'N' + 0x00, 0x44, 0x64, 0x64, 0x54, 0x54, 0x4C, 0x4C, 0x44, 0x00, 0x00, 0x00, - 7, // 0x4F 'O' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x4F 'O' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x50 'P' - 0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00,0x00, + 7, // 0x50 'P' + 0x00, 0x78, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, - 7, // 0x51 'Q' - 0x00,0x38,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00,0x00, + 7, // 0x51 'Q' + 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x54, 0x48, 0x34, 0x00, 0x00, 0x00, - 7, // 0x52 'R' - 0x00,0x78,0x44,0x44,0x44,0x78,0x48,0x44,0x44,0x00,0x00,0x00, + 7, // 0x52 'R' + 0x00, 0x78, 0x44, 0x44, 0x44, 0x78, 0x48, 0x44, 0x44, 0x00, 0x00, 0x00, - 7, // 0x53 'S' - 0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x53 'S' + 0x00, 0x38, 0x44, 0x40, 0x38, 0x04, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x54 'T' - 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x00, + 7, // 0x54 'T' + 0x00, 0x7C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, - 7, // 0x55 'U' - 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x55 'U' + 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x56 'V' - 0x00,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00,0x00,0x00, + 7, // 0x56 'V' + 0x00, 0x44, 0x44, 0x44, 0x28, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, 0x00, - 7, // 0x57 'W' - 0x00,0x44,0x44,0x44,0x44,0x44,0x54,0x54,0x28,0x00,0x00,0x00, + 7, // 0x57 'W' + 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x54, 0x54, 0x28, 0x00, 0x00, 0x00, - 7, // 0x58 'X' - 0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x58 'X' + 0x00, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, - 7, // 0x59 'Y' - 0x00,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x00,0x00,0x00, + 7, // 0x59 'Y' + 0x00, 0x44, 0x44, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, - 7, // 0x5A 'Z' - 0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x40,0x7C,0x00,0x00,0x00, + 7, // 0x5A 'Z' + 0x00, 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00, - 7, // 0x5B '[' - 0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00, + 7, // 0x5B '[' + 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00, - 7, // 0x5C '\' - 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00, + 7, // 0x5C '\' + 0x00, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x00, - 7, // 0x5D ']' - 0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x38,0x00, + 7, // 0x5D ']' + 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x00, - 7, // 0x5E '^' - 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x5E '^' + 0x00, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00, + 7, // 0x5F '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, - 7, // 0x60 '`' - 0x00,0x20,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x60 '`' + 0x00, 0x20, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x61 'a' - 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x3C,0x00,0x00,0x00, + 7, // 0x61 'a' + 0x00, 0x00, 0x00, 0x38, 0x04, 0x3C, 0x44, 0x44, 0x3C, 0x00, 0x00, 0x00, - 7, // 0x62 'b' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x78,0x00,0x00,0x00, + 7, // 0x62 'b' + 0x00, 0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x44, 0x78, 0x00, 0x00, 0x00, - 7, // 0x63 'c' - 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x44,0x38,0x00,0x00,0x00, + 7, // 0x63 'c' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x64 'd' - 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x3C,0x00,0x00,0x00, + 7, // 0x64 'd' + 0x00, 0x04, 0x04, 0x3C, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x00, 0x00, 0x00, - 7, // 0x65 'e' - 0x00,0x00,0x00,0x38,0x44,0x7C,0x40,0x44,0x38,0x00,0x00,0x00, + 7, // 0x65 'e' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x7C, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x66 'f' - 0x00,0x0C,0x10,0x38,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x00, + 7, // 0x66 'f' + 0x00, 0x0C, 0x10, 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, - 7, // 0x67 'g' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x44,0x38, + 7, // 0x67 'g' + 0x00, 0x00, 0x00, 0x3C, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x44, 0x38, - 7, // 0x68 'h' - 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x68 'h' + 0x00, 0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, - 7, // 0x69 'i' - 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, + 7, // 0x69 'i' + 0x00, 0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, - 7, // 0x6A 'j' - 0x00,0x08,0x00,0x18,0x08,0x08,0x08,0x08,0x08,0x48,0x48,0x30, + 7, // 0x6A 'j' + 0x00, 0x08, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x08, 0x48, 0x48, 0x30, - 7, // 0x6B 'k' - 0x00,0x40,0x40,0x4C,0x50,0x60,0x50,0x48,0x44,0x00,0x00,0x00, + 7, // 0x6B 'k' + 0x00, 0x40, 0x40, 0x4C, 0x50, 0x60, 0x50, 0x48, 0x44, 0x00, 0x00, 0x00, - 7, // 0x6C 'l' - 0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, + 7, // 0x6C 'l' + 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, - 7, // 0x6D 'm' - 0x00,0x00,0x00,0x68,0x54,0x54,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x6D 'm' + 0x00, 0x00, 0x00, 0x68, 0x54, 0x54, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, - 7, // 0x6E 'n' - 0x00,0x00,0x00,0x58,0x64,0x44,0x44,0x44,0x44,0x00,0x00,0x00, + 7, // 0x6E 'n' + 0x00, 0x00, 0x00, 0x58, 0x64, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, - 7, // 0x6F 'o' - 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, + 7, // 0x6F 'o' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x70 'p' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40, + 7, // 0x70 'p' + 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, - 7, // 0x71 'q' - 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x04,0x04, + 7, // 0x71 'q' + 0x00, 0x00, 0x00, 0x3C, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x04, 0x04, - 7, // 0x72 'r' - 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x20,0x70,0x00,0x00,0x00, + 7, // 0x72 'r' + 0x00, 0x00, 0x00, 0x58, 0x24, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, 0x00, - 7, // 0x73 's' - 0x00,0x00,0x00,0x38,0x44,0x30,0x08,0x44,0x38,0x00,0x00,0x00, + 7, // 0x73 's' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x30, 0x08, 0x44, 0x38, 0x00, 0x00, 0x00, - 7, // 0x74 't' - 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x24,0x18,0x00,0x00,0x00, + 7, // 0x74 't' + 0x00, 0x20, 0x20, 0x70, 0x20, 0x20, 0x20, 0x24, 0x18, 0x00, 0x00, 0x00, - 7, // 0x75 'u' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x4C,0x34,0x00,0x00,0x00, + 7, // 0x75 'u' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x4C, 0x34, 0x00, 0x00, 0x00, - 7, // 0x76 'v' - 0x00,0x00,0x00,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00,0x00, + 7, // 0x76 'v' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, 0x00, - 7, // 0x77 'w' - 0x00,0x00,0x00,0x44,0x44,0x44,0x54,0x54,0x28,0x00,0x00,0x00, + 7, // 0x77 'w' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x54, 0x54, 0x28, 0x00, 0x00, 0x00, - 7, // 0x78 'x' - 0x00,0x00,0x00,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00,0x00, + 7, // 0x78 'x' + 0x00, 0x00, 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x00, 0x00, 0x00, - 7, // 0x79 'y' - 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x08,0x70, + 7, // 0x79 'y' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x08, 0x70, - 7, // 0x7A 'z' - 0x00,0x00,0x00,0x7C,0x08,0x10,0x20,0x40,0x7C,0x00,0x00,0x00, + 7, // 0x7A 'z' + 0x00, 0x00, 0x00, 0x7C, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00, 0x00, 0x00, - 7, // 0x7B '{' - 0x18,0x20,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x20,0x18,0x00, + 7, // 0x7B '{' + 0x18, 0x20, 0x20, 0x20, 0x20, 0xC0, 0x20, 0x20, 0x20, 0x20, 0x18, 0x00, - 7, // 0x7C '|' - 0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00, + 7, // 0x7C '|' + 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, - 7, // 0x7D '}' - 0x60,0x10,0x10,0x10,0x10,0x0C,0x10,0x10,0x10,0x10,0x60,0x00, + 7, // 0x7D '}' + 0x60, 0x10, 0x10, 0x10, 0x10, 0x0C, 0x10, 0x10, 0x10, 0x10, 0x60, 0x00, - 7, // 0x7E '~' - 0x00,0x24,0x54,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x7E '~' + 0x00, 0x24, 0x54, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x7F '' - 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00,0x00,0x00, + 7, // 0x7F '' + 0x00, 0x10, 0x38, 0x6C, 0x44, 0x44, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, - 0 -}; + 0}; -const int8u verdana12[] = -{ - 12, 3, 32, 128-32, - 0x00,0x00,0x0D,0x00,0x1A,0x00,0x27,0x00,0x34,0x00,0x41,0x00,0x5A,0x00,0x67,0x00,0x74,0x00, - 0x81,0x00,0x8E,0x00,0x9B,0x00,0xA8,0x00,0xB5,0x00,0xC2,0x00,0xCF,0x00,0xDC,0x00,0xE9,0x00, - 0xF6,0x00,0x03,0x01,0x10,0x01,0x1D,0x01,0x2A,0x01,0x37,0x01,0x44,0x01,0x51,0x01,0x5E,0x01, - 0x6B,0x01,0x78,0x01,0x85,0x01,0x92,0x01,0x9F,0x01,0xAC,0x01,0xC5,0x01,0xD2,0x01,0xDF,0x01, - 0xEC,0x01,0xF9,0x01,0x06,0x02,0x13,0x02,0x20,0x02,0x2D,0x02,0x3A,0x02,0x47,0x02,0x54,0x02, - 0x61,0x02,0x7A,0x02,0x87,0x02,0xA0,0x02,0xAD,0x02,0xC6,0x02,0xD3,0x02,0xE0,0x02,0xED,0x02, - 0xFA,0x02,0x07,0x03,0x20,0x03,0x2D,0x03,0x3A,0x03,0x47,0x03,0x54,0x03,0x61,0x03,0x6E,0x03, - 0x7B,0x03,0x88,0x03,0x95,0x03,0xA2,0x03,0xAF,0x03,0xBC,0x03,0xC9,0x03,0xD6,0x03,0xE3,0x03, - 0xF0,0x03,0xFD,0x03,0x0A,0x04,0x17,0x04,0x24,0x04,0x31,0x04,0x4A,0x04,0x57,0x04,0x64,0x04, - 0x71,0x04,0x7E,0x04,0x8B,0x04,0x98,0x04,0xA5,0x04,0xB2,0x04,0xBF,0x04,0xCC,0x04,0xD9,0x04, - 0xE6,0x04,0xF3,0x04,0x00,0x05,0x0D,0x05,0x1A,0x05,0x27,0x05, +const int8u verdana12[] = { + 12, 3, 32, 128 - 32, 0x00, 0x00, 0x0D, 0x00, 0x1A, 0x00, 0x27, 0x00, 0x34, 0x00, 0x41, 0x00, 0x5A, 0x00, + 0x67, 0x00, 0x74, 0x00, 0x81, 0x00, 0x8E, 0x00, 0x9B, 0x00, 0xA8, 0x00, 0xB5, 0x00, 0xC2, 0x00, 0xCF, 0x00, + 0xDC, 0x00, 0xE9, 0x00, 0xF6, 0x00, 0x03, 0x01, 0x10, 0x01, 0x1D, 0x01, 0x2A, 0x01, 0x37, 0x01, 0x44, 0x01, + 0x51, 0x01, 0x5E, 0x01, 0x6B, 0x01, 0x78, 0x01, 0x85, 0x01, 0x92, 0x01, 0x9F, 0x01, 0xAC, 0x01, 0xC5, 0x01, + 0xD2, 0x01, 0xDF, 0x01, 0xEC, 0x01, 0xF9, 0x01, 0x06, 0x02, 0x13, 0x02, 0x20, 0x02, 0x2D, 0x02, 0x3A, 0x02, + 0x47, 0x02, 0x54, 0x02, 0x61, 0x02, 0x7A, 0x02, 0x87, 0x02, 0xA0, 0x02, 0xAD, 0x02, 0xC6, 0x02, 0xD3, 0x02, + 0xE0, 0x02, 0xED, 0x02, 0xFA, 0x02, 0x07, 0x03, 0x20, 0x03, 0x2D, 0x03, 0x3A, 0x03, 0x47, 0x03, 0x54, 0x03, + 0x61, 0x03, 0x6E, 0x03, 0x7B, 0x03, 0x88, 0x03, 0x95, 0x03, 0xA2, 0x03, 0xAF, 0x03, 0xBC, 0x03, 0xC9, 0x03, + 0xD6, 0x03, 0xE3, 0x03, 0xF0, 0x03, 0xFD, 0x03, 0x0A, 0x04, 0x17, 0x04, 0x24, 0x04, 0x31, 0x04, 0x4A, 0x04, + 0x57, 0x04, 0x64, 0x04, 0x71, 0x04, 0x7E, 0x04, 0x8B, 0x04, 0x98, 0x04, 0xA5, 0x04, 0xB2, 0x04, 0xBF, 0x04, + 0xCC, 0x04, 0xD9, 0x04, 0xE6, 0x04, 0xF3, 0x04, 0x00, 0x05, 0x0D, 0x05, 0x1A, 0x05, 0x27, 0x05, - 3, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 3, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x21 '!' - 0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, + 5, // 0x21 '!' + 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x00, 0x00, - 5, // 0x22 '"' - 0x00,0x00,0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x22 '"' + 0x00, 0x00, 0x50, 0x50, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x23 '#' - 0x00,0x00,0x00,0x00,0x28,0x7C,0x28,0x7C,0x28,0x00,0x00,0x00, + 7, // 0x23 '#' + 0x00, 0x00, 0x00, 0x00, 0x28, 0x7C, 0x28, 0x7C, 0x28, 0x00, 0x00, 0x00, - 7, // 0x24 '$' - 0x00,0x00,0x10,0x10,0x3C,0x50,0x30,0x18,0x14,0x78,0x10,0x10, + 7, // 0x24 '$' + 0x00, 0x00, 0x10, 0x10, 0x3C, 0x50, 0x30, 0x18, 0x14, 0x78, 0x10, 0x10, - 11, // 0x25 '%' - 0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x00,0x4A,0x00,0x4A,0x00,0x35,0x80,0x0A,0x40,0x0A,0x40,0x11,0x80,0x00,0x00,0x00,0x00, + 11, // 0x25 '%' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x00, 0x4A, 0x00, 0x4A, 0x00, 0x35, 0x80, 0x0A, 0x40, 0x0A, 0x40, + 0x11, 0x80, 0x00, 0x00, 0x00, 0x00, - 7, // 0x26 '&' - 0x00,0x00,0x00,0x30,0x48,0x48,0x32,0x4A,0x44,0x3A,0x00,0x00, + 7, // 0x26 '&' + 0x00, 0x00, 0x00, 0x30, 0x48, 0x48, 0x32, 0x4A, 0x44, 0x3A, 0x00, 0x00, - 3, // 0x27 ''' - 0x00,0x00,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 3, // 0x27 ''' + 0x00, 0x00, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x28 '(' - 0x00,0x00,0x10,0x20,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x10, + 4, // 0x28 '(' + 0x00, 0x00, 0x10, 0x20, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x20, 0x10, - 4, // 0x29 ')' - 0x00,0x00,0x80,0x40,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x80, + 4, // 0x29 ')' + 0x00, 0x00, 0x80, 0x40, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x40, 0x80, - 7, // 0x2A '*' - 0x00,0x10,0x54,0x38,0x54,0x10,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2A '*' + 0x00, 0x10, 0x54, 0x38, 0x54, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, + 7, // 0x2B '+' + 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x00, 0x00, - 3, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x80,0x00, + 3, // 0x2C ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x80, 0x00, - 5, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00, + 5, // 0x2D '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, - 3, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x00,0x00, + 3, // 0x2E '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, - 4, // 0x2F '/' - 0x00,0x00,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x80,0x80,0x00, + 4, // 0x2F '/' + 0x00, 0x00, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x40, 0x80, 0x80, 0x00, - 7, // 0x30 '0' - 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x30 '0' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 7, // 0x31 '1' - 0x00,0x00,0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x38,0x00,0x00, + 7, // 0x31 '1' + 0x00, 0x00, 0x00, 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, - 7, // 0x32 '2' - 0x00,0x00,0x00,0x38,0x44,0x04,0x08,0x10,0x20,0x7C,0x00,0x00, + 7, // 0x32 '2' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x04, 0x08, 0x10, 0x20, 0x7C, 0x00, 0x00, - 7, // 0x33 '3' - 0x00,0x00,0x00,0x38,0x44,0x04,0x18,0x04,0x44,0x38,0x00,0x00, + 7, // 0x33 '3' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x04, 0x18, 0x04, 0x44, 0x38, 0x00, 0x00, - 7, // 0x34 '4' - 0x00,0x00,0x00,0x08,0x18,0x28,0x48,0x7C,0x08,0x08,0x00,0x00, + 7, // 0x34 '4' + 0x00, 0x00, 0x00, 0x08, 0x18, 0x28, 0x48, 0x7C, 0x08, 0x08, 0x00, 0x00, - 7, // 0x35 '5' - 0x00,0x00,0x00,0x7C,0x40,0x78,0x04,0x04,0x44,0x38,0x00,0x00, + 7, // 0x35 '5' + 0x00, 0x00, 0x00, 0x7C, 0x40, 0x78, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, - 7, // 0x36 '6' - 0x00,0x00,0x00,0x18,0x20,0x40,0x78,0x44,0x44,0x38,0x00,0x00, + 7, // 0x36 '6' + 0x00, 0x00, 0x00, 0x18, 0x20, 0x40, 0x78, 0x44, 0x44, 0x38, 0x00, 0x00, - 7, // 0x37 '7' - 0x00,0x00,0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x10,0x00,0x00, + 7, // 0x37 '7' + 0x00, 0x00, 0x00, 0x7C, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x00, 0x00, - 7, // 0x38 '8' - 0x00,0x00,0x00,0x38,0x44,0x44,0x38,0x44,0x44,0x38,0x00,0x00, + 7, // 0x38 '8' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x38, 0x44, 0x44, 0x38, 0x00, 0x00, - 7, // 0x39 '9' - 0x00,0x00,0x00,0x38,0x44,0x44,0x3C,0x04,0x08,0x30,0x00,0x00, + 7, // 0x39 '9' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x3C, 0x04, 0x08, 0x30, 0x00, 0x00, - 4, // 0x3A ':' - 0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x00,0x40,0x40,0x00,0x00, + 4, // 0x3A ':' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x00, - 4, // 0x3B ';' - 0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x00,0x40,0x40,0x80,0x00, + 4, // 0x3B ';' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x80, 0x00, - 7, // 0x3C '<' - 0x00,0x00,0x00,0x00,0x04,0x18,0x60,0x18,0x04,0x00,0x00,0x00, + 7, // 0x3C '<' + 0x00, 0x00, 0x00, 0x00, 0x04, 0x18, 0x60, 0x18, 0x04, 0x00, 0x00, 0x00, - 7, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x7C,0x00,0x00,0x00,0x00, + 7, // 0x3D '=' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, - 7, // 0x3E '>' - 0x00,0x00,0x00,0x00,0x40,0x30,0x0C,0x30,0x40,0x00,0x00,0x00, + 7, // 0x3E '>' + 0x00, 0x00, 0x00, 0x00, 0x40, 0x30, 0x0C, 0x30, 0x40, 0x00, 0x00, 0x00, - 6, // 0x3F '?' - 0x00,0x00,0x00,0x70,0x08,0x08,0x10,0x20,0x00,0x20,0x00,0x00, + 6, // 0x3F '?' + 0x00, 0x00, 0x00, 0x70, 0x08, 0x08, 0x10, 0x20, 0x00, 0x20, 0x00, 0x00, - 10, // 0x40 '@' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x20,0x80,0x4E,0x80,0x52,0x80,0x52,0x80,0x4D,0x00,0x20,0x00,0x1F,0x00,0x00,0x00, + 10, // 0x40 '@' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x20, 0x80, 0x4E, 0x80, 0x52, 0x80, 0x52, 0x80, 0x4D, 0x00, + 0x20, 0x00, 0x1F, 0x00, 0x00, 0x00, - 8, // 0x41 'A' - 0x00,0x00,0x00,0x18,0x18,0x24,0x24,0x7E,0x42,0x42,0x00,0x00, + 8, // 0x41 'A' + 0x00, 0x00, 0x00, 0x18, 0x18, 0x24, 0x24, 0x7E, 0x42, 0x42, 0x00, 0x00, - 7, // 0x42 'B' - 0x00,0x00,0x00,0x70,0x48,0x48,0x78,0x44,0x44,0x78,0x00,0x00, + 7, // 0x42 'B' + 0x00, 0x00, 0x00, 0x70, 0x48, 0x48, 0x78, 0x44, 0x44, 0x78, 0x00, 0x00, - 8, // 0x43 'C' - 0x00,0x00,0x00,0x1C,0x22,0x40,0x40,0x40,0x22,0x1C,0x00,0x00, + 8, // 0x43 'C' + 0x00, 0x00, 0x00, 0x1C, 0x22, 0x40, 0x40, 0x40, 0x22, 0x1C, 0x00, 0x00, - 8, // 0x44 'D' - 0x00,0x00,0x00,0x78,0x44,0x42,0x42,0x42,0x44,0x78,0x00,0x00, + 8, // 0x44 'D' + 0x00, 0x00, 0x00, 0x78, 0x44, 0x42, 0x42, 0x42, 0x44, 0x78, 0x00, 0x00, - 7, // 0x45 'E' - 0x00,0x00,0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x7C,0x00,0x00, + 7, // 0x45 'E' + 0x00, 0x00, 0x00, 0x7C, 0x40, 0x40, 0x78, 0x40, 0x40, 0x7C, 0x00, 0x00, - 6, // 0x46 'F' - 0x00,0x00,0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x00,0x00, + 6, // 0x46 'F' + 0x00, 0x00, 0x00, 0x7C, 0x40, 0x40, 0x78, 0x40, 0x40, 0x40, 0x00, 0x00, - 8, // 0x47 'G' - 0x00,0x00,0x00,0x1C,0x22,0x40,0x4E,0x42,0x22,0x1C,0x00,0x00, + 8, // 0x47 'G' + 0x00, 0x00, 0x00, 0x1C, 0x22, 0x40, 0x4E, 0x42, 0x22, 0x1C, 0x00, 0x00, - 8, // 0x48 'H' - 0x00,0x00,0x00,0x42,0x42,0x42,0x7E,0x42,0x42,0x42,0x00,0x00, + 8, // 0x48 'H' + 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x7E, 0x42, 0x42, 0x42, 0x00, 0x00, - 5, // 0x49 'I' - 0x00,0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 5, // 0x49 'I' + 0x00, 0x00, 0x00, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, - 5, // 0x4A 'J' - 0x00,0x00,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0xE0,0x00,0x00, + 5, // 0x4A 'J' + 0x00, 0x00, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0xE0, 0x00, 0x00, - 7, // 0x4B 'K' - 0x00,0x00,0x00,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00, + 7, // 0x4B 'K' + 0x00, 0x00, 0x00, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x00, 0x00, - 6, // 0x4C 'L' - 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00, + 6, // 0x4C 'L' + 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7C, 0x00, 0x00, - 9, // 0x4D 'M' - 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x55,0x00,0x55,0x00,0x49,0x00,0x49,0x00,0x41,0x00,0x00,0x00,0x00,0x00, + 9, // 0x4D 'M' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x63, 0x00, 0x55, 0x00, 0x55, 0x00, 0x49, 0x00, 0x49, 0x00, + 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x4E 'N' - 0x00,0x00,0x00,0x42,0x62,0x52,0x4A,0x46,0x42,0x42,0x00,0x00, + 8, // 0x4E 'N' + 0x00, 0x00, 0x00, 0x42, 0x62, 0x52, 0x4A, 0x46, 0x42, 0x42, 0x00, 0x00, - 9, // 0x4F 'O' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00, + 9, // 0x4F 'O' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x22, 0x00, + 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x50 'P' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40,0x00,0x00, + 7, // 0x50 'P' + 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, 0x00, 0x00, - 9, // 0x51 'Q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x04,0x00,0x03,0x00, + 9, // 0x51 'Q' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x22, 0x00, + 0x1C, 0x00, 0x04, 0x00, 0x03, 0x00, - 7, // 0x52 'R' - 0x00,0x00,0x00,0x78,0x44,0x44,0x78,0x50,0x48,0x44,0x00,0x00, + 7, // 0x52 'R' + 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x78, 0x50, 0x48, 0x44, 0x00, 0x00, - 7, // 0x53 'S' - 0x00,0x00,0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x38,0x00,0x00, + 7, // 0x53 'S' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x38, 0x04, 0x44, 0x38, 0x00, 0x00, - 7, // 0x54 'T' - 0x00,0x00,0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, + 7, // 0x54 'T' + 0x00, 0x00, 0x00, 0xFE, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - 8, // 0x55 'U' - 0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00, + 8, // 0x55 'U' + 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00, - 8, // 0x56 'V' - 0x00,0x00,0x00,0x42,0x42,0x42,0x24,0x24,0x18,0x18,0x00,0x00, + 8, // 0x56 'V' + 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18, 0x00, 0x00, - 9, // 0x57 'W' - 0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x49,0x00,0x49,0x00,0x55,0x00,0x55,0x00,0x22,0x00,0x22,0x00,0x00,0x00,0x00,0x00, + 9, // 0x57 'W' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x49, 0x00, 0x49, 0x00, 0x55, 0x00, 0x55, 0x00, 0x22, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x58 'X' - 0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, + 7, // 0x58 'X' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x00, 0x00, - 7, // 0x59 'Y' - 0x00,0x00,0x00,0x44,0x44,0x28,0x28,0x10,0x10,0x10,0x00,0x00, + 7, // 0x59 'Y' + 0x00, 0x00, 0x00, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x10, 0x00, 0x00, - 7, // 0x5A 'Z' - 0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, + 7, // 0x5A 'Z' + 0x00, 0x00, 0x00, 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00, 0x00, - 4, // 0x5B '[' - 0x00,0x00,0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x60, + 4, // 0x5B '[' + 0x00, 0x00, 0x60, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x60, - 4, // 0x5C '\' - 0x00,0x00,0x80,0x80,0x40,0x40,0x40,0x20,0x20,0x10,0x10,0x00, + 4, // 0x5C '\' + 0x00, 0x00, 0x80, 0x80, 0x40, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x00, - 4, // 0x5D ']' - 0x00,0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x60, + 4, // 0x5D ']' + 0x00, 0x00, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x60, - 7, // 0x5E '^' - 0x00,0x00,0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x5E '^' + 0x00, 0x00, 0x00, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC, + 6, // 0x5F '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, - 6, // 0x60 '`' - 0x00,0x00,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x60 '`' + 0x00, 0x00, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x30,0x08,0x38,0x48,0x38,0x00,0x00, + 6, // 0x61 'a' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x08, 0x38, 0x48, 0x38, 0x00, 0x00, - 6, // 0x62 'b' - 0x00,0x00,0x40,0x40,0x40,0x70,0x48,0x48,0x48,0x70,0x00,0x00, + 6, // 0x62 'b' + 0x00, 0x00, 0x40, 0x40, 0x40, 0x70, 0x48, 0x48, 0x48, 0x70, 0x00, 0x00, - 6, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x40,0x40,0x38,0x00,0x00, + 6, // 0x63 'c' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x40, 0x40, 0x40, 0x38, 0x00, 0x00, - 6, // 0x64 'd' - 0x00,0x00,0x08,0x08,0x08,0x38,0x48,0x48,0x48,0x38,0x00,0x00, + 6, // 0x64 'd' + 0x00, 0x00, 0x08, 0x08, 0x08, 0x38, 0x48, 0x48, 0x48, 0x38, 0x00, 0x00, - 6, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x30,0x48,0x78,0x40,0x38,0x00,0x00, + 6, // 0x65 'e' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x48, 0x78, 0x40, 0x38, 0x00, 0x00, - 4, // 0x66 'f' - 0x00,0x00,0x30,0x40,0x40,0xE0,0x40,0x40,0x40,0x40,0x00,0x00, + 4, // 0x66 'f' + 0x00, 0x00, 0x30, 0x40, 0x40, 0xE0, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, - 6, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x38,0x48,0x48,0x48,0x38,0x08,0x30, + 6, // 0x67 'g' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x48, 0x48, 0x48, 0x38, 0x08, 0x30, - 6, // 0x68 'h' - 0x00,0x00,0x40,0x40,0x40,0x70,0x48,0x48,0x48,0x48,0x00,0x00, + 6, // 0x68 'h' + 0x00, 0x00, 0x40, 0x40, 0x40, 0x70, 0x48, 0x48, 0x48, 0x48, 0x00, 0x00, - 3, // 0x69 'i' - 0x00,0x00,0x00,0x40,0x00,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 3, // 0x69 'i' + 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, - 3, // 0x6A 'j' - 0x00,0x00,0x00,0x40,0x00,0xC0,0x40,0x40,0x40,0x40,0x40,0x80, + 3, // 0x6A 'j' + 0x00, 0x00, 0x00, 0x40, 0x00, 0xC0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x80, - 6, // 0x6B 'k' - 0x00,0x00,0x40,0x40,0x40,0x48,0x50,0x60,0x50,0x48,0x00,0x00, + 6, // 0x6B 'k' + 0x00, 0x00, 0x40, 0x40, 0x40, 0x48, 0x50, 0x60, 0x50, 0x48, 0x00, 0x00, - 3, // 0x6C 'l' - 0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 3, // 0x6C 'l' + 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, - 9, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x76,0x00,0x49,0x00,0x49,0x00,0x49,0x00,0x49,0x00,0x00,0x00,0x00,0x00, + 9, // 0x6D 'm' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x00, 0x49, 0x00, 0x49, 0x00, 0x49, 0x00, + 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x6E 'n' - 0x00,0x00,0x00,0x00,0x00,0x70,0x48,0x48,0x48,0x48,0x00,0x00, + 6, // 0x6E 'n' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x48, 0x48, 0x48, 0x48, 0x00, 0x00, - 6, // 0x6F 'o' - 0x00,0x00,0x00,0x00,0x00,0x30,0x48,0x48,0x48,0x30,0x00,0x00, + 6, // 0x6F 'o' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x48, 0x48, 0x48, 0x30, 0x00, 0x00, - 6, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0x70,0x48,0x48,0x48,0x70,0x40,0x40, + 6, // 0x70 'p' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x48, 0x48, 0x48, 0x70, 0x40, 0x40, - 6, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x38,0x48,0x48,0x48,0x38,0x08,0x08, + 6, // 0x71 'q' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x48, 0x48, 0x48, 0x38, 0x08, 0x08, - 4, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0x50,0x60,0x40,0x40,0x40,0x00,0x00, + 4, // 0x72 'r' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x60, 0x40, 0x40, 0x40, 0x00, 0x00, - 6, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x30,0x08,0x70,0x00,0x00, + 6, // 0x73 's' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x40, 0x30, 0x08, 0x70, 0x00, 0x00, - 4, // 0x74 't' - 0x00,0x00,0x00,0x00,0x40,0xF0,0x40,0x40,0x40,0x30,0x00,0x00, + 4, // 0x74 't' + 0x00, 0x00, 0x00, 0x00, 0x40, 0xF0, 0x40, 0x40, 0x40, 0x30, 0x00, 0x00, - 6, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0x48,0x48,0x48,0x48,0x38,0x00,0x00, + 6, // 0x75 'u' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0x48, 0x38, 0x00, 0x00, - 6, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0x48,0x48,0x48,0x30,0x30,0x00,0x00, + 6, // 0x76 'v' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0x30, 0x30, 0x00, 0x00, - 7, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x44,0x54,0x54,0x28,0x28,0x00,0x00, + 7, // 0x77 'w' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x54, 0x54, 0x28, 0x28, 0x00, 0x00, - 6, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0x48,0x48,0x30,0x48,0x48,0x00,0x00, + 6, // 0x78 'x' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x30, 0x48, 0x48, 0x00, 0x00, - 6, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0x48,0x48,0x48,0x30,0x10,0x20,0x20, + 6, // 0x79 'y' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0x30, 0x10, 0x20, 0x20, - 5, // 0x7A 'z' - 0x00,0x00,0x00,0x00,0x00,0x70,0x10,0x20,0x40,0x70,0x00,0x00, + 5, // 0x7A 'z' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x10, 0x20, 0x40, 0x70, 0x00, 0x00, - 6, // 0x7B '{' - 0x00,0x00,0x18,0x20,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x18, + 6, // 0x7B '{' + 0x00, 0x00, 0x18, 0x20, 0x20, 0x20, 0x20, 0xC0, 0x20, 0x20, 0x20, 0x18, - 5, // 0x7C '|' - 0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 5, // 0x7C '|' + 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 6, // 0x7D '}' - 0x00,0x00,0x60,0x10,0x10,0x10,0x10,0x0C,0x10,0x10,0x10,0x60, + 6, // 0x7D '}' + 0x00, 0x00, 0x60, 0x10, 0x10, 0x10, 0x10, 0x0C, 0x10, 0x10, 0x10, 0x60, - 7, // 0x7E '~' - 0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x58,0x00,0x00,0x00,0x00, + 7, // 0x7E '~' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x58, 0x00, 0x00, 0x00, 0x00, - 9, // 0x7F '' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x7F,0x00,0x00,0x00,0x00,0x00, + 9, // 0x7F '' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, + 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, - 0 -}; + 0}; -const int8u verdana12_bold[] = -{ - 12, 3, 32, 128-32, - 0x00,0x00,0x0D,0x00,0x1A,0x00,0x27,0x00,0x34,0x00,0x41,0x00,0x5A,0x00,0x67,0x00,0x74,0x00, - 0x81,0x00,0x8E,0x00,0x9B,0x00,0xA8,0x00,0xB5,0x00,0xC2,0x00,0xCF,0x00,0xDC,0x00,0xE9,0x00, - 0xF6,0x00,0x03,0x01,0x10,0x01,0x1D,0x01,0x2A,0x01,0x37,0x01,0x44,0x01,0x51,0x01,0x5E,0x01, - 0x6B,0x01,0x78,0x01,0x85,0x01,0x92,0x01,0x9F,0x01,0xAC,0x01,0xC5,0x01,0xD2,0x01,0xDF,0x01, - 0xEC,0x01,0xF9,0x01,0x06,0x02,0x13,0x02,0x20,0x02,0x2D,0x02,0x3A,0x02,0x47,0x02,0x54,0x02, - 0x61,0x02,0x6E,0x02,0x7B,0x02,0x88,0x02,0x95,0x02,0xA2,0x02,0xAF,0x02,0xBC,0x02,0xC9,0x02, - 0xD6,0x02,0xE3,0x02,0xFC,0x02,0x09,0x03,0x16,0x03,0x23,0x03,0x30,0x03,0x3D,0x03,0x4A,0x03, - 0x57,0x03,0x64,0x03,0x71,0x03,0x7E,0x03,0x8B,0x03,0x98,0x03,0xA5,0x03,0xB2,0x03,0xBF,0x03, - 0xCC,0x03,0xD9,0x03,0xE6,0x03,0xF3,0x03,0x00,0x04,0x0D,0x04,0x26,0x04,0x33,0x04,0x40,0x04, - 0x4D,0x04,0x5A,0x04,0x67,0x04,0x74,0x04,0x81,0x04,0x8E,0x04,0x9B,0x04,0xB4,0x04,0xC1,0x04, - 0xCE,0x04,0xDB,0x04,0xE8,0x04,0xF5,0x04,0x02,0x05,0x0F,0x05, +const int8u verdana12_bold[] = { + 12, 3, 32, 128 - 32, 0x00, 0x00, 0x0D, 0x00, 0x1A, 0x00, 0x27, 0x00, 0x34, 0x00, 0x41, 0x00, 0x5A, 0x00, + 0x67, 0x00, 0x74, 0x00, 0x81, 0x00, 0x8E, 0x00, 0x9B, 0x00, 0xA8, 0x00, 0xB5, 0x00, 0xC2, 0x00, 0xCF, 0x00, + 0xDC, 0x00, 0xE9, 0x00, 0xF6, 0x00, 0x03, 0x01, 0x10, 0x01, 0x1D, 0x01, 0x2A, 0x01, 0x37, 0x01, 0x44, 0x01, + 0x51, 0x01, 0x5E, 0x01, 0x6B, 0x01, 0x78, 0x01, 0x85, 0x01, 0x92, 0x01, 0x9F, 0x01, 0xAC, 0x01, 0xC5, 0x01, + 0xD2, 0x01, 0xDF, 0x01, 0xEC, 0x01, 0xF9, 0x01, 0x06, 0x02, 0x13, 0x02, 0x20, 0x02, 0x2D, 0x02, 0x3A, 0x02, + 0x47, 0x02, 0x54, 0x02, 0x61, 0x02, 0x6E, 0x02, 0x7B, 0x02, 0x88, 0x02, 0x95, 0x02, 0xA2, 0x02, 0xAF, 0x02, + 0xBC, 0x02, 0xC9, 0x02, 0xD6, 0x02, 0xE3, 0x02, 0xFC, 0x02, 0x09, 0x03, 0x16, 0x03, 0x23, 0x03, 0x30, 0x03, + 0x3D, 0x03, 0x4A, 0x03, 0x57, 0x03, 0x64, 0x03, 0x71, 0x03, 0x7E, 0x03, 0x8B, 0x03, 0x98, 0x03, 0xA5, 0x03, + 0xB2, 0x03, 0xBF, 0x03, 0xCC, 0x03, 0xD9, 0x03, 0xE6, 0x03, 0xF3, 0x03, 0x00, 0x04, 0x0D, 0x04, 0x26, 0x04, + 0x33, 0x04, 0x40, 0x04, 0x4D, 0x04, 0x5A, 0x04, 0x67, 0x04, 0x74, 0x04, 0x81, 0x04, 0x8E, 0x04, 0x9B, 0x04, + 0xB4, 0x04, 0xC1, 0x04, 0xCE, 0x04, 0xDB, 0x04, 0xE8, 0x04, 0xF5, 0x04, 0x02, 0x05, 0x0F, 0x05, - 3, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 3, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x21 '!' - 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x00,0x60,0x00,0x00, + 4, // 0x21 '!' + 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, - 5, // 0x22 '"' - 0x00,0x00,0xD8,0xD8,0xD8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x22 '"' + 0x00, 0x00, 0xD8, 0xD8, 0xD8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x23 '#' - 0x00,0x00,0x00,0x14,0x14,0x7E,0x28,0xFC,0x50,0x50,0x00,0x00, + 8, // 0x23 '#' + 0x00, 0x00, 0x00, 0x14, 0x14, 0x7E, 0x28, 0xFC, 0x50, 0x50, 0x00, 0x00, - 6, // 0x24 '$' - 0x00,0x00,0x20,0x20,0x70,0xE8,0xE0,0x38,0xB8,0x70,0x20,0x20, + 6, // 0x24 '$' + 0x00, 0x00, 0x20, 0x20, 0x70, 0xE8, 0xE0, 0x38, 0xB8, 0x70, 0x20, 0x20, - 11, // 0x25 '%' - 0x00,0x00,0x00,0x00,0x00,0x00,0x62,0x00,0x94,0x00,0x94,0x00,0x69,0x80,0x0A,0x40,0x0A,0x40,0x11,0x80,0x00,0x00,0x00,0x00, + 11, // 0x25 '%' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x00, 0x94, 0x00, 0x94, 0x00, 0x69, 0x80, 0x0A, 0x40, 0x0A, 0x40, + 0x11, 0x80, 0x00, 0x00, 0x00, 0x00, - 8, // 0x26 '&' - 0x00,0x00,0x00,0x70,0xD8,0xD8,0x76,0xDC,0xCC,0x76,0x00,0x00, + 8, // 0x26 '&' + 0x00, 0x00, 0x00, 0x70, 0xD8, 0xD8, 0x76, 0xDC, 0xCC, 0x76, 0x00, 0x00, - 3, // 0x27 ''' - 0x00,0x00,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 3, // 0x27 ''' + 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x28 '(' - 0x00,0x00,0x30,0x60,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x60,0x30, + 5, // 0x28 '(' + 0x00, 0x00, 0x30, 0x60, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x60, 0x30, - 5, // 0x29 ')' - 0x00,0x00,0xC0,0x60,0x30,0x30,0x30,0x30,0x30,0x30,0x60,0xC0, + 5, // 0x29 ')' + 0x00, 0x00, 0xC0, 0x60, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x60, 0xC0, - 6, // 0x2A '*' - 0x00,0x00,0x20,0xA8,0x70,0xA8,0x20,0x00,0x00,0x00,0x00,0x00, + 6, // 0x2A '*' + 0x00, 0x00, 0x20, 0xA8, 0x70, 0xA8, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, + 8, // 0x2B '+' + 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x00, 0x00, - 3, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x80,0x00, + 3, // 0x2C ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x80, 0x00, - 4, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0x00, + 4, // 0x2D '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, - 3, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x00,0x00, + 3, // 0x2E '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, - 6, // 0x2F '/' - 0x00,0x00,0x08,0x08,0x10,0x10,0x20,0x40,0x40,0x80,0x80,0x00, + 6, // 0x2F '/' + 0x00, 0x00, 0x08, 0x08, 0x10, 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0x00, - 6, // 0x30 '0' - 0x00,0x00,0x00,0x70,0xD8,0xD8,0xD8,0xD8,0xD8,0x70,0x00,0x00, + 6, // 0x30 '0' + 0x00, 0x00, 0x00, 0x70, 0xD8, 0xD8, 0xD8, 0xD8, 0xD8, 0x70, 0x00, 0x00, - 6, // 0x31 '1' - 0x00,0x00,0x00,0x30,0x70,0x30,0x30,0x30,0x30,0x78,0x00,0x00, + 6, // 0x31 '1' + 0x00, 0x00, 0x00, 0x30, 0x70, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, - 6, // 0x32 '2' - 0x00,0x00,0x00,0x70,0x98,0x18,0x30,0x60,0xC0,0xF8,0x00,0x00, + 6, // 0x32 '2' + 0x00, 0x00, 0x00, 0x70, 0x98, 0x18, 0x30, 0x60, 0xC0, 0xF8, 0x00, 0x00, - 6, // 0x33 '3' - 0x00,0x00,0x00,0x70,0x98,0x18,0x70,0x18,0x98,0x70,0x00,0x00, + 6, // 0x33 '3' + 0x00, 0x00, 0x00, 0x70, 0x98, 0x18, 0x70, 0x18, 0x98, 0x70, 0x00, 0x00, - 6, // 0x34 '4' - 0x00,0x00,0x00,0x18,0x38,0x58,0x98,0xFC,0x18,0x18,0x00,0x00, + 6, // 0x34 '4' + 0x00, 0x00, 0x00, 0x18, 0x38, 0x58, 0x98, 0xFC, 0x18, 0x18, 0x00, 0x00, - 6, // 0x35 '5' - 0x00,0x00,0x00,0xF8,0xC0,0xF0,0x18,0x18,0x98,0x70,0x00,0x00, + 6, // 0x35 '5' + 0x00, 0x00, 0x00, 0xF8, 0xC0, 0xF0, 0x18, 0x18, 0x98, 0x70, 0x00, 0x00, - 6, // 0x36 '6' - 0x00,0x00,0x00,0x70,0xC0,0xF0,0xD8,0xD8,0xD8,0x70,0x00,0x00, + 6, // 0x36 '6' + 0x00, 0x00, 0x00, 0x70, 0xC0, 0xF0, 0xD8, 0xD8, 0xD8, 0x70, 0x00, 0x00, - 6, // 0x37 '7' - 0x00,0x00,0x00,0xF8,0x18,0x30,0x30,0x60,0x60,0xC0,0x00,0x00, + 6, // 0x37 '7' + 0x00, 0x00, 0x00, 0xF8, 0x18, 0x30, 0x30, 0x60, 0x60, 0xC0, 0x00, 0x00, - 6, // 0x38 '8' - 0x00,0x00,0x00,0x70,0xD8,0xD8,0x70,0xD8,0xD8,0x70,0x00,0x00, + 6, // 0x38 '8' + 0x00, 0x00, 0x00, 0x70, 0xD8, 0xD8, 0x70, 0xD8, 0xD8, 0x70, 0x00, 0x00, - 6, // 0x39 '9' - 0x00,0x00,0x00,0x70,0xD8,0xD8,0xD8,0x78,0x18,0x70,0x00,0x00, + 6, // 0x39 '9' + 0x00, 0x00, 0x00, 0x70, 0xD8, 0xD8, 0xD8, 0x78, 0x18, 0x70, 0x00, 0x00, - 4, // 0x3A ':' - 0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x60,0x60,0x00,0x00, + 4, // 0x3A ':' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, - 4, // 0x3B ';' - 0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x60,0x60,0x40,0x00, + 4, // 0x3B ';' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x40, 0x00, - 8, // 0x3C '<' - 0x00,0x00,0x00,0x00,0x04,0x18,0x60,0x60,0x18,0x04,0x00,0x00, + 8, // 0x3C '<' + 0x00, 0x00, 0x00, 0x00, 0x04, 0x18, 0x60, 0x60, 0x18, 0x04, 0x00, 0x00, - 8, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x7C,0x00,0x00,0x00,0x00, + 8, // 0x3D '=' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, - 8, // 0x3E '>' - 0x00,0x00,0x00,0x00,0x40,0x30,0x0C,0x0C,0x30,0x40,0x00,0x00, + 8, // 0x3E '>' + 0x00, 0x00, 0x00, 0x00, 0x40, 0x30, 0x0C, 0x0C, 0x30, 0x40, 0x00, 0x00, - 6, // 0x3F '?' - 0x00,0x00,0x00,0xF0,0x18,0x18,0x30,0x60,0x00,0x60,0x00,0x00, + 6, // 0x3F '?' + 0x00, 0x00, 0x00, 0xF0, 0x18, 0x18, 0x30, 0x60, 0x00, 0x60, 0x00, 0x00, - 9, // 0x40 '@' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x42,0x00,0x9D,0x00,0xA5,0x00,0xA5,0x00,0x9E,0x00,0x40,0x00,0x3C,0x00,0x00,0x00, + 9, // 0x40 '@' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x9D, 0x00, 0xA5, 0x00, 0xA5, 0x00, 0x9E, 0x00, + 0x40, 0x00, 0x3C, 0x00, 0x00, 0x00, - 8, // 0x41 'A' - 0x00,0x00,0x00,0x38,0x38,0x6C,0x6C,0x7C,0xC6,0xC6,0x00,0x00, + 8, // 0x41 'A' + 0x00, 0x00, 0x00, 0x38, 0x38, 0x6C, 0x6C, 0x7C, 0xC6, 0xC6, 0x00, 0x00, - 7, // 0x42 'B' - 0x00,0x00,0x00,0xF8,0xCC,0xCC,0xF8,0xCC,0xCC,0xF8,0x00,0x00, + 7, // 0x42 'B' + 0x00, 0x00, 0x00, 0xF8, 0xCC, 0xCC, 0xF8, 0xCC, 0xCC, 0xF8, 0x00, 0x00, - 6, // 0x43 'C' - 0x00,0x00,0x00,0x70,0xC8,0xC0,0xC0,0xC0,0xC8,0x70,0x00,0x00, + 6, // 0x43 'C' + 0x00, 0x00, 0x00, 0x70, 0xC8, 0xC0, 0xC0, 0xC0, 0xC8, 0x70, 0x00, 0x00, - 7, // 0x44 'D' - 0x00,0x00,0x00,0xF8,0xCC,0xCC,0xCC,0xCC,0xCC,0xF8,0x00,0x00, + 7, // 0x44 'D' + 0x00, 0x00, 0x00, 0xF8, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xF8, 0x00, 0x00, - 6, // 0x45 'E' - 0x00,0x00,0x00,0xF8,0xC0,0xC0,0xF8,0xC0,0xC0,0xF8,0x00,0x00, + 6, // 0x45 'E' + 0x00, 0x00, 0x00, 0xF8, 0xC0, 0xC0, 0xF8, 0xC0, 0xC0, 0xF8, 0x00, 0x00, - 6, // 0x46 'F' - 0x00,0x00,0x00,0xF8,0xC0,0xC0,0xF8,0xC0,0xC0,0xC0,0x00,0x00, + 6, // 0x46 'F' + 0x00, 0x00, 0x00, 0xF8, 0xC0, 0xC0, 0xF8, 0xC0, 0xC0, 0xC0, 0x00, 0x00, - 7, // 0x47 'G' - 0x00,0x00,0x00,0x78,0xC4,0xC0,0xC0,0xDC,0xCC,0x7C,0x00,0x00, + 7, // 0x47 'G' + 0x00, 0x00, 0x00, 0x78, 0xC4, 0xC0, 0xC0, 0xDC, 0xCC, 0x7C, 0x00, 0x00, - 7, // 0x48 'H' - 0x00,0x00,0x00,0xCC,0xCC,0xCC,0xFC,0xCC,0xCC,0xCC,0x00,0x00, + 7, // 0x48 'H' + 0x00, 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0xCC, 0x00, 0x00, - 5, // 0x49 'I' - 0x00,0x00,0x00,0xF0,0x60,0x60,0x60,0x60,0x60,0xF0,0x00,0x00, + 5, // 0x49 'I' + 0x00, 0x00, 0x00, 0xF0, 0x60, 0x60, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, - 5, // 0x4A 'J' - 0x00,0x00,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0xE0,0x00,0x00, + 5, // 0x4A 'J' + 0x00, 0x00, 0x00, 0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0xE0, 0x00, 0x00, - 7, // 0x4B 'K' - 0x00,0x00,0x00,0xCC,0xD8,0xF0,0xE0,0xF0,0xD8,0xCC,0x00,0x00, + 7, // 0x4B 'K' + 0x00, 0x00, 0x00, 0xCC, 0xD8, 0xF0, 0xE0, 0xF0, 0xD8, 0xCC, 0x00, 0x00, - 6, // 0x4C 'L' - 0x00,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xF8,0x00,0x00, + 6, // 0x4C 'L' + 0x00, 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xF8, 0x00, 0x00, - 8, // 0x4D 'M' - 0x00,0x00,0x00,0x82,0xC6,0xEE,0xB6,0xB6,0x86,0x86,0x00,0x00, + 8, // 0x4D 'M' + 0x00, 0x00, 0x00, 0x82, 0xC6, 0xEE, 0xB6, 0xB6, 0x86, 0x86, 0x00, 0x00, - 7, // 0x4E 'N' - 0x00,0x00,0x00,0x84,0xC4,0xE4,0xB4,0x9C,0x8C,0x84,0x00,0x00, + 7, // 0x4E 'N' + 0x00, 0x00, 0x00, 0x84, 0xC4, 0xE4, 0xB4, 0x9C, 0x8C, 0x84, 0x00, 0x00, - 8, // 0x4F 'O' - 0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00, + 8, // 0x4F 'O' + 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, - 7, // 0x50 'P' - 0x00,0x00,0x00,0xF8,0xCC,0xCC,0xCC,0xF8,0xC0,0xC0,0x00,0x00, + 7, // 0x50 'P' + 0x00, 0x00, 0x00, 0xF8, 0xCC, 0xCC, 0xCC, 0xF8, 0xC0, 0xC0, 0x00, 0x00, - 8, // 0x51 'Q' - 0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x18,0x0E, + 8, // 0x51 'Q' + 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x18, 0x0E, - 7, // 0x52 'R' - 0x00,0x00,0x00,0xF8,0xCC,0xCC,0xF8,0xD8,0xCC,0xC6,0x00,0x00, + 7, // 0x52 'R' + 0x00, 0x00, 0x00, 0xF8, 0xCC, 0xCC, 0xF8, 0xD8, 0xCC, 0xC6, 0x00, 0x00, - 6, // 0x53 'S' - 0x00,0x00,0x00,0x70,0xC8,0xC0,0x70,0x18,0x98,0x70,0x00,0x00, + 6, // 0x53 'S' + 0x00, 0x00, 0x00, 0x70, 0xC8, 0xC0, 0x70, 0x18, 0x98, 0x70, 0x00, 0x00, - 6, // 0x54 'T' - 0x00,0x00,0x00,0xFC,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00, + 6, // 0x54 'T' + 0x00, 0x00, 0x00, 0xFC, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, - 7, // 0x55 'U' - 0x00,0x00,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x78,0x00,0x00, + 7, // 0x55 'U' + 0x00, 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x78, 0x00, 0x00, - 7, // 0x56 'V' - 0x00,0x00,0x00,0xCC,0xCC,0x78,0x78,0x78,0x30,0x30,0x00,0x00, + 7, // 0x56 'V' + 0x00, 0x00, 0x00, 0xCC, 0xCC, 0x78, 0x78, 0x78, 0x30, 0x30, 0x00, 0x00, - 11, // 0x57 'W' - 0x00,0x00,0x00,0x00,0x00,0x00,0xCC,0xC0,0xCC,0xC0,0x6D,0x80,0x6D,0x80,0x73,0x80,0x33,0x00,0x33,0x00,0x00,0x00,0x00,0x00, + 11, // 0x57 'W' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCC, 0xC0, 0xCC, 0xC0, 0x6D, 0x80, 0x6D, 0x80, 0x73, 0x80, 0x33, 0x00, + 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x58 'X' - 0x00,0x00,0x00,0xCC,0xCC,0x78,0x30,0x78,0xCC,0xCC,0x00,0x00, + 7, // 0x58 'X' + 0x00, 0x00, 0x00, 0xCC, 0xCC, 0x78, 0x30, 0x78, 0xCC, 0xCC, 0x00, 0x00, - 7, // 0x59 'Y' - 0x00,0x00,0x00,0xCC,0xCC,0x78,0x30,0x30,0x30,0x30,0x00,0x00, + 7, // 0x59 'Y' + 0x00, 0x00, 0x00, 0xCC, 0xCC, 0x78, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, - 6, // 0x5A 'Z' - 0x00,0x00,0x00,0xF8,0x18,0x30,0x60,0xC0,0xC0,0xF8,0x00,0x00, + 6, // 0x5A 'Z' + 0x00, 0x00, 0x00, 0xF8, 0x18, 0x30, 0x60, 0xC0, 0xC0, 0xF8, 0x00, 0x00, - 5, // 0x5B '[' - 0x00,0x00,0x70,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x70, + 5, // 0x5B '[' + 0x00, 0x00, 0x70, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x70, - 6, // 0x5C '\' - 0x00,0x00,0x80,0x80,0x40,0x40,0x20,0x10,0x10,0x08,0x08,0x00, + 6, // 0x5C '\' + 0x00, 0x00, 0x80, 0x80, 0x40, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x00, - 5, // 0x5D ']' - 0x00,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x70, + 5, // 0x5D ']' + 0x00, 0x00, 0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x70, - 8, // 0x5E '^' - 0x00,0x00,0x00,0x18,0x3C,0x66,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x5E '^' + 0x00, 0x00, 0x00, 0x18, 0x3C, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC, + 6, // 0x5F '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, - 6, // 0x60 '`' - 0x00,0x00,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x60 '`' + 0x00, 0x00, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x70,0x18,0x78,0xD8,0x78,0x00,0x00, + 6, // 0x61 'a' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x18, 0x78, 0xD8, 0x78, 0x00, 0x00, - 6, // 0x62 'b' - 0x00,0x00,0xC0,0xC0,0xC0,0xF0,0xD8,0xD8,0xD8,0xF0,0x00,0x00, + 6, // 0x62 'b' + 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xF0, 0xD8, 0xD8, 0xD8, 0xF0, 0x00, 0x00, - 5, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x70,0xC0,0xC0,0xC0,0x70,0x00,0x00, + 5, // 0x63 'c' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xC0, 0xC0, 0xC0, 0x70, 0x00, 0x00, - 6, // 0x64 'd' - 0x00,0x00,0x18,0x18,0x18,0x78,0xD8,0xD8,0xD8,0x78,0x00,0x00, + 6, // 0x64 'd' + 0x00, 0x00, 0x18, 0x18, 0x18, 0x78, 0xD8, 0xD8, 0xD8, 0x78, 0x00, 0x00, - 6, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x70,0xD8,0xF8,0xC0,0x78,0x00,0x00, + 6, // 0x65 'e' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xD8, 0xF8, 0xC0, 0x78, 0x00, 0x00, - 5, // 0x66 'f' - 0x00,0x00,0x38,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x00,0x00, + 5, // 0x66 'f' + 0x00, 0x00, 0x38, 0x60, 0x60, 0xF8, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, - 6, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x78,0xD8,0xD8,0xD8,0x78,0x18,0x70, + 6, // 0x67 'g' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xD8, 0xD8, 0xD8, 0x78, 0x18, 0x70, - 6, // 0x68 'h' - 0x00,0x00,0xC0,0xC0,0xC0,0xF0,0xD8,0xD8,0xD8,0xD8,0x00,0x00, + 6, // 0x68 'h' + 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xF0, 0xD8, 0xD8, 0xD8, 0xD8, 0x00, 0x00, - 3, // 0x69 'i' - 0x00,0x00,0x00,0xC0,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00, + 3, // 0x69 'i' + 0x00, 0x00, 0x00, 0xC0, 0x00, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0x00, - 4, // 0x6A 'j' - 0x00,0x00,0x00,0x60,0x00,0xE0,0x60,0x60,0x60,0x60,0x60,0xC0, + 4, // 0x6A 'j' + 0x00, 0x00, 0x00, 0x60, 0x00, 0xE0, 0x60, 0x60, 0x60, 0x60, 0x60, 0xC0, - 6, // 0x6B 'k' - 0x00,0x00,0xC0,0xC0,0xC0,0xD8,0xD8,0xF0,0xD8,0xD8,0x00,0x00, + 6, // 0x6B 'k' + 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xD8, 0xD8, 0xF0, 0xD8, 0xD8, 0x00, 0x00, - 3, // 0x6C 'l' - 0x00,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00, + 3, // 0x6C 'l' + 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0x00, - 9, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF6,0x00,0xDB,0x00,0xDB,0x00,0xDB,0x00,0xDB,0x00,0x00,0x00,0x00,0x00, + 9, // 0x6D 'm' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF6, 0x00, 0xDB, 0x00, 0xDB, 0x00, 0xDB, 0x00, + 0xDB, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x6E 'n' - 0x00,0x00,0x00,0x00,0x00,0xF0,0xD8,0xD8,0xD8,0xD8,0x00,0x00, + 6, // 0x6E 'n' + 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xD8, 0xD8, 0xD8, 0xD8, 0x00, 0x00, - 6, // 0x6F 'o' - 0x00,0x00,0x00,0x00,0x00,0x70,0xD8,0xD8,0xD8,0x70,0x00,0x00, + 6, // 0x6F 'o' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xD8, 0xD8, 0xD8, 0x70, 0x00, 0x00, - 6, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0xF0,0xD8,0xD8,0xD8,0xF0,0xC0,0xC0, + 6, // 0x70 'p' + 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xD8, 0xD8, 0xD8, 0xF0, 0xC0, 0xC0, - 6, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x78,0xD8,0xD8,0xD8,0x78,0x18,0x18, + 6, // 0x71 'q' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xD8, 0xD8, 0xD8, 0x78, 0x18, 0x18, - 4, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0xD0,0xE0,0xC0,0xC0,0xC0,0x00,0x00, + 4, // 0x72 'r' + 0x00, 0x00, 0x00, 0x00, 0x00, 0xD0, 0xE0, 0xC0, 0xC0, 0xC0, 0x00, 0x00, - 5, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x70,0xC0,0xF0,0x30,0xE0,0x00,0x00, + 5, // 0x73 's' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xC0, 0xF0, 0x30, 0xE0, 0x00, 0x00, - 5, // 0x74 't' - 0x00,0x00,0x00,0x60,0x60,0xF8,0x60,0x60,0x60,0x38,0x00,0x00, + 5, // 0x74 't' + 0x00, 0x00, 0x00, 0x60, 0x60, 0xF8, 0x60, 0x60, 0x60, 0x38, 0x00, 0x00, - 6, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0xD8,0xD8,0xD8,0xD8,0x78,0x00,0x00, + 6, // 0x75 'u' + 0x00, 0x00, 0x00, 0x00, 0x00, 0xD8, 0xD8, 0xD8, 0xD8, 0x78, 0x00, 0x00, - 6, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0xD8,0xD8,0xD8,0x70,0x70,0x00,0x00, + 6, // 0x76 'v' + 0x00, 0x00, 0x00, 0x00, 0x00, 0xD8, 0xD8, 0xD8, 0x70, 0x70, 0x00, 0x00, - 9, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xDB,0x00,0xDB,0x00,0xDB,0x00,0x66,0x00,0x66,0x00,0x00,0x00,0x00,0x00, + 9, // 0x77 'w' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDB, 0x00, 0xDB, 0x00, 0xDB, 0x00, 0x66, 0x00, + 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0xD8,0xD8,0x70,0xD8,0xD8,0x00,0x00, + 6, // 0x78 'x' + 0x00, 0x00, 0x00, 0x00, 0x00, 0xD8, 0xD8, 0x70, 0xD8, 0xD8, 0x00, 0x00, - 6, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0xD8,0xD8,0xD8,0x70,0x70,0x30,0x60, + 6, // 0x79 'y' + 0x00, 0x00, 0x00, 0x00, 0x00, 0xD8, 0xD8, 0xD8, 0x70, 0x70, 0x30, 0x60, - 5, // 0x7A 'z' - 0x00,0x00,0x00,0x00,0x00,0xF0,0x30,0x60,0xC0,0xF0,0x00,0x00, + 5, // 0x7A 'z' + 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x30, 0x60, 0xC0, 0xF0, 0x00, 0x00, - 6, // 0x7B '{' - 0x00,0x00,0x18,0x30,0x30,0x30,0xE0,0x30,0x30,0x30,0x30,0x18, + 6, // 0x7B '{' + 0x00, 0x00, 0x18, 0x30, 0x30, 0x30, 0xE0, 0x30, 0x30, 0x30, 0x30, 0x18, - 5, // 0x7C '|' - 0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 5, // 0x7C '|' + 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 6, // 0x7D '}' - 0x00,0x00,0xC0,0x60,0x60,0x60,0x38,0x60,0x60,0x60,0x60,0xC0, + 6, // 0x7D '}' + 0x00, 0x00, 0xC0, 0x60, 0x60, 0x60, 0x38, 0x60, 0x60, 0x60, 0x60, 0xC0, - 8, // 0x7E '~' - 0x00,0x00,0x00,0x00,0x00,0x00,0x62,0x92,0x8C,0x00,0x00,0x00, + 8, // 0x7E '~' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x92, 0x8C, 0x00, 0x00, 0x00, - 9, // 0x7F '' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x7F,0x00,0x00,0x00,0x00,0x00, + 9, // 0x7F '' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, + 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, - 0 -}; + 0}; -const int8u verdana13[] = -{ - 13, 3, 32, 128-32, - 0x00,0x00,0x0E,0x00,0x1C,0x00,0x2A,0x00,0x45,0x00,0x53,0x00,0x6E,0x00,0x7C,0x00,0x8A,0x00, - 0x98,0x00,0xA6,0x00,0xB4,0x00,0xCF,0x00,0xDD,0x00,0xEB,0x00,0xF9,0x00,0x07,0x01,0x15,0x01, - 0x23,0x01,0x31,0x01,0x3F,0x01,0x4D,0x01,0x5B,0x01,0x69,0x01,0x77,0x01,0x85,0x01,0x93,0x01, - 0xA1,0x01,0xAF,0x01,0xCA,0x01,0xE5,0x01,0x00,0x02,0x0E,0x02,0x29,0x02,0x37,0x02,0x45,0x02, - 0x60,0x02,0x7B,0x02,0x89,0x02,0x97,0x02,0xB2,0x02,0xC0,0x02,0xCE,0x02,0xDC,0x02,0xEA,0x02, - 0xF8,0x02,0x13,0x03,0x21,0x03,0x3C,0x03,0x4A,0x03,0x65,0x03,0x73,0x03,0x81,0x03,0x8F,0x03, - 0x9D,0x03,0xAB,0x03,0xC6,0x03,0xD4,0x03,0xE2,0x03,0xF0,0x03,0xFE,0x03,0x0C,0x04,0x1A,0x04, - 0x35,0x04,0x43,0x04,0x51,0x04,0x5F,0x04,0x6D,0x04,0x7B,0x04,0x89,0x04,0x97,0x04,0xA5,0x04, - 0xB3,0x04,0xC1,0x04,0xCF,0x04,0xDD,0x04,0xEB,0x04,0xF9,0x04,0x14,0x05,0x22,0x05,0x30,0x05, - 0x3E,0x05,0x4C,0x05,0x5A,0x05,0x68,0x05,0x76,0x05,0x84,0x05,0x92,0x05,0xAD,0x05,0xBB,0x05, - 0xC9,0x05,0xD7,0x05,0xE5,0x05,0xF3,0x05,0x01,0x06,0x1C,0x06, +const int8u verdana13[] = { + 13, 3, 32, 128 - 32, 0x00, 0x00, 0x0E, 0x00, 0x1C, 0x00, 0x2A, 0x00, 0x45, 0x00, 0x53, 0x00, 0x6E, 0x00, + 0x7C, 0x00, 0x8A, 0x00, 0x98, 0x00, 0xA6, 0x00, 0xB4, 0x00, 0xCF, 0x00, 0xDD, 0x00, 0xEB, 0x00, 0xF9, 0x00, + 0x07, 0x01, 0x15, 0x01, 0x23, 0x01, 0x31, 0x01, 0x3F, 0x01, 0x4D, 0x01, 0x5B, 0x01, 0x69, 0x01, 0x77, 0x01, + 0x85, 0x01, 0x93, 0x01, 0xA1, 0x01, 0xAF, 0x01, 0xCA, 0x01, 0xE5, 0x01, 0x00, 0x02, 0x0E, 0x02, 0x29, 0x02, + 0x37, 0x02, 0x45, 0x02, 0x60, 0x02, 0x7B, 0x02, 0x89, 0x02, 0x97, 0x02, 0xB2, 0x02, 0xC0, 0x02, 0xCE, 0x02, + 0xDC, 0x02, 0xEA, 0x02, 0xF8, 0x02, 0x13, 0x03, 0x21, 0x03, 0x3C, 0x03, 0x4A, 0x03, 0x65, 0x03, 0x73, 0x03, + 0x81, 0x03, 0x8F, 0x03, 0x9D, 0x03, 0xAB, 0x03, 0xC6, 0x03, 0xD4, 0x03, 0xE2, 0x03, 0xF0, 0x03, 0xFE, 0x03, + 0x0C, 0x04, 0x1A, 0x04, 0x35, 0x04, 0x43, 0x04, 0x51, 0x04, 0x5F, 0x04, 0x6D, 0x04, 0x7B, 0x04, 0x89, 0x04, + 0x97, 0x04, 0xA5, 0x04, 0xB3, 0x04, 0xC1, 0x04, 0xCF, 0x04, 0xDD, 0x04, 0xEB, 0x04, 0xF9, 0x04, 0x14, 0x05, + 0x22, 0x05, 0x30, 0x05, 0x3E, 0x05, 0x4C, 0x05, 0x5A, 0x05, 0x68, 0x05, 0x76, 0x05, 0x84, 0x05, 0x92, 0x05, + 0xAD, 0x05, 0xBB, 0x05, 0xC9, 0x05, 0xD7, 0x05, 0xE5, 0x05, 0xF3, 0x05, 0x01, 0x06, 0x1C, 0x06, - 4, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x21 '!' - 0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, + 4, // 0x21 '!' + 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x00, 0x00, - 5, // 0x22 '"' - 0x00,0x00,0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x22 '"' + 0x00, 0x00, 0x50, 0x50, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x23 '#' - 0x00,0x00,0x00,0x00,0x00,0x00,0x0A,0x00,0x0A,0x00,0x3F,0x00,0x14,0x00,0x14,0x00,0x7E,0x00,0x28,0x00,0x28,0x00,0x00,0x00,0x00,0x00, + 9, // 0x23 '#' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x0A, 0x00, 0x3F, 0x00, 0x14, 0x00, 0x14, 0x00, 0x7E, 0x00, + 0x28, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x24 '$' - 0x00,0x00,0x10,0x10,0x3C,0x50,0x50,0x38,0x14,0x14,0x78,0x10,0x10, + 7, // 0x24 '$' + 0x00, 0x00, 0x10, 0x10, 0x3C, 0x50, 0x50, 0x38, 0x14, 0x14, 0x78, 0x10, 0x10, - 12, // 0x25 '%' - 0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x00,0x49,0x00,0x4A,0x00,0x32,0x00,0x04,0xC0,0x05,0x20,0x09,0x20,0x08,0xC0,0x00,0x00,0x00,0x00, + 12, // 0x25 '%' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x00, 0x49, 0x00, 0x4A, 0x00, 0x32, 0x00, 0x04, 0xC0, 0x05, 0x20, + 0x09, 0x20, 0x08, 0xC0, 0x00, 0x00, 0x00, 0x00, - 8, // 0x26 '&' - 0x00,0x00,0x00,0x30,0x48,0x48,0x32,0x4A,0x44,0x46,0x39,0x00,0x00, + 8, // 0x26 '&' + 0x00, 0x00, 0x00, 0x30, 0x48, 0x48, 0x32, 0x4A, 0x44, 0x46, 0x39, 0x00, 0x00, - 3, // 0x27 ''' - 0x00,0x00,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 3, // 0x27 ''' + 0x00, 0x00, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x28 '(' - 0x00,0x00,0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10, + 5, // 0x28 '(' + 0x00, 0x00, 0x10, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x10, - 5, // 0x29 ')' - 0x00,0x00,0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40, + 5, // 0x29 ')' + 0x00, 0x00, 0x40, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x40, - 7, // 0x2A '*' - 0x00,0x00,0x10,0x54,0x38,0x54,0x10,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2A '*' + 0x00, 0x00, 0x10, 0x54, 0x38, 0x54, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x7F,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00, + 9, // 0x2B '+' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x7F, 0x00, 0x08, 0x00, + 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40, + 4, // 0x2C ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x40, - 5, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00, + 5, // 0x2D '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00, + 4, // 0x2E '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, - 5, // 0x2F '/' - 0x00,0x00,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x00, + 5, // 0x2F '/' + 0x00, 0x00, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, 0x00, - 7, // 0x30 '0' - 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x30 '0' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 7, // 0x31 '1' - 0x00,0x00,0x00,0x10,0x70,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00, + 7, // 0x31 '1' + 0x00, 0x00, 0x00, 0x10, 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7C, 0x00, 0x00, - 7, // 0x32 '2' - 0x00,0x00,0x00,0x38,0x44,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, + 7, // 0x32 '2' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00, 0x00, - 7, // 0x33 '3' - 0x00,0x00,0x00,0x38,0x44,0x04,0x18,0x04,0x04,0x44,0x38,0x00,0x00, + 7, // 0x33 '3' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x04, 0x18, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, - 7, // 0x34 '4' - 0x00,0x00,0x00,0x08,0x18,0x28,0x48,0x88,0xFC,0x08,0x08,0x00,0x00, + 7, // 0x34 '4' + 0x00, 0x00, 0x00, 0x08, 0x18, 0x28, 0x48, 0x88, 0xFC, 0x08, 0x08, 0x00, 0x00, - 7, // 0x35 '5' - 0x00,0x00,0x00,0x7C,0x40,0x40,0x78,0x04,0x04,0x44,0x38,0x00,0x00, + 7, // 0x35 '5' + 0x00, 0x00, 0x00, 0x7C, 0x40, 0x40, 0x78, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, - 7, // 0x36 '6' - 0x00,0x00,0x00,0x18,0x20,0x40,0x78,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x36 '6' + 0x00, 0x00, 0x00, 0x18, 0x20, 0x40, 0x78, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 7, // 0x37 '7' - 0x00,0x00,0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x00,0x00, + 7, // 0x37 '7' + 0x00, 0x00, 0x00, 0x7C, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x00, 0x00, - 7, // 0x38 '8' - 0x00,0x00,0x00,0x38,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x38 '8' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 7, // 0x39 '9' - 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x3C,0x04,0x08,0x30,0x00,0x00, + 7, // 0x39 '9' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x08, 0x30, 0x00, 0x00, - 5, // 0x3A ':' - 0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x20,0x20,0x00,0x00, + 5, // 0x3A ':' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, - 5, // 0x3B ';' - 0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x20,0x20,0x20,0x40, + 5, // 0x3B ';' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x20, 0x20, 0x20, 0x40, - 9, // 0x3C '<' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x18,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3C '<' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x18, 0x00, 0x60, 0x00, 0x18, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3D '=' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x7F, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x3E '>' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x0C,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3E '>' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x03, 0x00, 0x0C, 0x00, + 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x3F '?' - 0x00,0x00,0x00,0x70,0x08,0x08,0x10,0x20,0x20,0x00,0x20,0x00,0x00, + 6, // 0x3F '?' + 0x00, 0x00, 0x00, 0x70, 0x08, 0x08, 0x10, 0x20, 0x20, 0x00, 0x20, 0x00, 0x00, - 10, // 0x40 '@' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x20,0x80,0x4E,0x80,0x52,0x80,0x52,0x80,0x52,0x80,0x4D,0x00,0x20,0x00,0x1E,0x00,0x00,0x00, + 10, // 0x40 '@' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x20, 0x80, 0x4E, 0x80, 0x52, 0x80, 0x52, 0x80, 0x52, 0x80, + 0x4D, 0x00, 0x20, 0x00, 0x1E, 0x00, 0x00, 0x00, - 8, // 0x41 'A' - 0x00,0x00,0x00,0x18,0x18,0x24,0x24,0x24,0x7E,0x42,0x42,0x00,0x00, + 8, // 0x41 'A' + 0x00, 0x00, 0x00, 0x18, 0x18, 0x24, 0x24, 0x24, 0x7E, 0x42, 0x42, 0x00, 0x00, - 8, // 0x42 'B' - 0x00,0x00,0x00,0x78,0x44,0x44,0x7C,0x42,0x42,0x42,0x7C,0x00,0x00, + 8, // 0x42 'B' + 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x7C, 0x42, 0x42, 0x42, 0x7C, 0x00, 0x00, - 9, // 0x43 'C' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x43 'C' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x21, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, + 0x21, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x44 'D' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x42,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, + 9, // 0x44 'D' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x42, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, + 0x42, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x45 'E' - 0x00,0x00,0x00,0x7C,0x40,0x40,0x7C,0x40,0x40,0x40,0x7C,0x00,0x00, + 7, // 0x45 'E' + 0x00, 0x00, 0x00, 0x7C, 0x40, 0x40, 0x7C, 0x40, 0x40, 0x40, 0x7C, 0x00, 0x00, - 6, // 0x46 'F' - 0x00,0x00,0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00,0x00, + 6, // 0x46 'F' + 0x00, 0x00, 0x00, 0x7C, 0x40, 0x40, 0x78, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, - 9, // 0x47 'G' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x00,0x40,0x00,0x47,0x00,0x41,0x00,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x47 'G' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x21, 0x00, 0x40, 0x00, 0x40, 0x00, 0x47, 0x00, 0x41, 0x00, + 0x21, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x48 'H' - 0x00,0x00,0x00,0x42,0x42,0x42,0x7E,0x42,0x42,0x42,0x42,0x00,0x00, + 8, // 0x48 'H' + 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x7E, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, - 5, // 0x49 'I' - 0x00,0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 5, // 0x49 'I' + 0x00, 0x00, 0x00, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, - 5, // 0x4A 'J' - 0x00,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0xE0,0x00,0x00, + 5, // 0x4A 'J' + 0x00, 0x00, 0x00, 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xE0, 0x00, 0x00, - 8, // 0x4B 'K' - 0x00,0x00,0x00,0x42,0x44,0x48,0x50,0x70,0x48,0x44,0x42,0x00,0x00, + 8, // 0x4B 'K' + 0x00, 0x00, 0x00, 0x42, 0x44, 0x48, 0x50, 0x70, 0x48, 0x44, 0x42, 0x00, 0x00, - 6, // 0x4C 'L' - 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00, + 6, // 0x4C 'L' + 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7C, 0x00, 0x00, - 9, // 0x4D 'M' - 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x55,0x00,0x55,0x00,0x49,0x00,0x49,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00, + 9, // 0x4D 'M' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x63, 0x00, 0x55, 0x00, 0x55, 0x00, 0x49, 0x00, 0x49, 0x00, + 0x41, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x4E 'N' - 0x00,0x00,0x00,0x62,0x62,0x52,0x52,0x4A,0x4A,0x46,0x46,0x00,0x00, + 8, // 0x4E 'N' + 0x00, 0x00, 0x00, 0x62, 0x62, 0x52, 0x52, 0x4A, 0x4A, 0x46, 0x46, 0x00, 0x00, - 9, // 0x4F 'O' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00, + 9, // 0x4F 'O' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, + 0x22, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x50 'P' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00, + 7, // 0x50 'P' + 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, 0x00, 0x00, - 9, // 0x51 'Q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x04,0x00,0x03,0x00, + 9, // 0x51 'Q' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, + 0x22, 0x00, 0x1C, 0x00, 0x04, 0x00, 0x03, 0x00, - 8, // 0x52 'R' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x78,0x48,0x44,0x42,0x00,0x00, + 8, // 0x52 'R' + 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x78, 0x48, 0x44, 0x42, 0x00, 0x00, - 8, // 0x53 'S' - 0x00,0x00,0x00,0x3C,0x42,0x40,0x30,0x0C,0x02,0x42,0x3C,0x00,0x00, + 8, // 0x53 'S' + 0x00, 0x00, 0x00, 0x3C, 0x42, 0x40, 0x30, 0x0C, 0x02, 0x42, 0x3C, 0x00, 0x00, - 7, // 0x54 'T' - 0x00,0x00,0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, + 7, // 0x54 'T' + 0x00, 0x00, 0x00, 0xFE, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - 8, // 0x55 'U' - 0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00, + 8, // 0x55 'U' + 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00, - 8, // 0x56 'V' - 0x00,0x00,0x00,0x42,0x42,0x42,0x24,0x24,0x24,0x18,0x18,0x00,0x00, + 8, // 0x56 'V' + 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x24, 0x24, 0x24, 0x18, 0x18, 0x00, 0x00, - 11, // 0x57 'W' - 0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x40,0x44,0x40,0x2A,0x80,0x2A,0x80,0x2A,0x80,0x2A,0x80,0x11,0x00,0x11,0x00,0x00,0x00,0x00,0x00, + 11, // 0x57 'W' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x40, 0x44, 0x40, 0x2A, 0x80, 0x2A, 0x80, 0x2A, 0x80, 0x2A, 0x80, + 0x11, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x58 'X' - 0x00,0x00,0x00,0x42,0x42,0x24,0x18,0x18,0x24,0x42,0x42,0x00,0x00, + 8, // 0x58 'X' + 0x00, 0x00, 0x00, 0x42, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x42, 0x00, 0x00, - 7, // 0x59 'Y' - 0x00,0x00,0x00,0x82,0x44,0x28,0x10,0x10,0x10,0x10,0x10,0x00,0x00, + 7, // 0x59 'Y' + 0x00, 0x00, 0x00, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - 8, // 0x5A 'Z' - 0x00,0x00,0x00,0x7E,0x02,0x04,0x08,0x10,0x20,0x40,0x7E,0x00,0x00, + 8, // 0x5A 'Z' + 0x00, 0x00, 0x00, 0x7E, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7E, 0x00, 0x00, - 5, // 0x5B '[' - 0x00,0x00,0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70, + 5, // 0x5B '[' + 0x00, 0x00, 0x70, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x70, - 5, // 0x5C '\' - 0x00,0x00,0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00, + 5, // 0x5C '\' + 0x00, 0x00, 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x00, - 5, // 0x5D ']' - 0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70, + 5, // 0x5D ']' + 0x00, 0x00, 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x70, - 9, // 0x5E '^' - 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x14,0x00,0x22,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x5E '^' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x14, 0x00, 0x22, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE, + 7, // 0x5F '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, - 7, // 0x60 '`' - 0x00,0x00,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x60 '`' + 0x00, 0x00, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x3C,0x00,0x00, + 7, // 0x61 'a' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x04, 0x3C, 0x44, 0x44, 0x3C, 0x00, 0x00, - 7, // 0x62 'b' - 0x00,0x00,0x40,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x78,0x00,0x00, + 7, // 0x62 'b' + 0x00, 0x00, 0x40, 0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x44, 0x78, 0x00, 0x00, - 6, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x44,0x38,0x00,0x00, + 6, // 0x63 'c' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, - 7, // 0x64 'd' - 0x00,0x00,0x04,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x3C,0x00,0x00, + 7, // 0x64 'd' + 0x00, 0x00, 0x04, 0x04, 0x04, 0x3C, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x00, 0x00, - 7, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x7C,0x40,0x44,0x38,0x00,0x00, + 7, // 0x65 'e' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x7C, 0x40, 0x44, 0x38, 0x00, 0x00, - 4, // 0x66 'f' - 0x00,0x00,0x30,0x40,0x40,0xF0,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 4, // 0x66 'f' + 0x00, 0x00, 0x30, 0x40, 0x40, 0xF0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, - 7, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x38, + 7, // 0x67 'g' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x38, - 7, // 0x68 'h' - 0x00,0x00,0x40,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x68 'h' + 0x00, 0x00, 0x40, 0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, - 3, // 0x69 'i' - 0x00,0x00,0x40,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 3, // 0x69 'i' + 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, - 4, // 0x6A 'j' - 0x00,0x00,0x20,0x00,0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0xC0, + 4, // 0x6A 'j' + 0x00, 0x00, 0x20, 0x00, 0x00, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xC0, - 7, // 0x6B 'k' - 0x00,0x00,0x40,0x40,0x40,0x44,0x48,0x50,0x70,0x48,0x44,0x00,0x00, + 7, // 0x6B 'k' + 0x00, 0x00, 0x40, 0x40, 0x40, 0x44, 0x48, 0x50, 0x70, 0x48, 0x44, 0x00, 0x00, - 3, // 0x6C 'l' - 0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 3, // 0x6C 'l' + 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, - 11, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7B,0x80,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x00,0x00,0x00,0x00, + 11, // 0x6D 'm' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7B, 0x80, 0x44, 0x40, 0x44, 0x40, 0x44, 0x40, + 0x44, 0x40, 0x44, 0x40, 0x00, 0x00, 0x00, 0x00, - 7, // 0x6E 'n' - 0x00,0x00,0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x00,0x00, + 7, // 0x6E 'n' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, - 7, // 0x6F 'o' - 0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x38,0x00,0x00, + 7, // 0x6F 'o' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, - 7, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40, + 7, // 0x70 'p' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, - 7, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x04, + 7, // 0x71 'q' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x04, - 5, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0x58,0x60,0x40,0x40,0x40,0x40,0x00,0x00, + 5, // 0x72 'r' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x60, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, - 6, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x60,0x18,0x08,0x70,0x00,0x00, + 6, // 0x73 's' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x40, 0x60, 0x18, 0x08, 0x70, 0x00, 0x00, - 4, // 0x74 't' - 0x00,0x00,0x00,0x40,0x40,0xF0,0x40,0x40,0x40,0x40,0x30,0x00,0x00, + 4, // 0x74 't' + 0x00, 0x00, 0x00, 0x40, 0x40, 0xF0, 0x40, 0x40, 0x40, 0x40, 0x30, 0x00, 0x00, - 7, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x3C,0x00,0x00, + 7, // 0x75 'u' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x3C, 0x00, 0x00, - 7, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00, + 7, // 0x76 'v' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, - 9, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x49,0x00,0x49,0x00,0x55,0x00,0x55,0x00,0x22,0x00,0x22,0x00,0x00,0x00,0x00,0x00, + 9, // 0x77 'w' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x00, 0x49, 0x00, 0x55, 0x00, 0x55, 0x00, + 0x22, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0x44,0x28,0x10,0x10,0x28,0x44,0x00,0x00, + 7, // 0x78 'x' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x28, 0x10, 0x10, 0x28, 0x44, 0x00, 0x00, - 7, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0x44,0x28,0x28,0x28,0x10,0x10,0x10,0x20, + 7, // 0x79 'y' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x28, 0x28, 0x28, 0x10, 0x10, 0x10, 0x20, - 6, // 0x7A 'z' - 0x00,0x00,0x00,0x00,0x00,0x78,0x08,0x10,0x20,0x40,0x78,0x00,0x00, + 6, // 0x7A 'z' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x08, 0x10, 0x20, 0x40, 0x78, 0x00, 0x00, - 7, // 0x7B '{' - 0x00,0x00,0x0C,0x10,0x10,0x10,0x10,0x60,0x10,0x10,0x10,0x10,0x0C, + 7, // 0x7B '{' + 0x00, 0x00, 0x0C, 0x10, 0x10, 0x10, 0x10, 0x60, 0x10, 0x10, 0x10, 0x10, 0x0C, - 5, // 0x7C '|' - 0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 5, // 0x7C '|' + 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 7, // 0x7D '}' - 0x00,0x00,0x60,0x10,0x10,0x10,0x10,0x0C,0x10,0x10,0x10,0x10,0x60, + 7, // 0x7D '}' + 0x00, 0x00, 0x60, 0x10, 0x10, 0x10, 0x10, 0x0C, 0x10, 0x10, 0x10, 0x10, 0x60, - 9, // 0x7E '~' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x00,0x49,0x00,0x46,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x7E '~' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x00, 0x49, 0x00, 0x46, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x7F '' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x7F,0x80,0x00,0x00,0x00,0x00, + 11, // 0x7F '' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x80, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, + 0x40, 0x80, 0x7F, 0x80, 0x00, 0x00, 0x00, 0x00, - 0 -}; + 0}; -const int8u verdana13_bold[] = -{ - 13, 3, 32, 128-32, - 0x00,0x00,0x0E,0x00,0x1C,0x00,0x2A,0x00,0x45,0x00,0x53,0x00,0x6E,0x00,0x89,0x00,0x97,0x00, - 0xA5,0x00,0xB3,0x00,0xC1,0x00,0xDC,0x00,0xEA,0x00,0xF8,0x00,0x06,0x01,0x14,0x01,0x22,0x01, - 0x30,0x01,0x3E,0x01,0x4C,0x01,0x5A,0x01,0x68,0x01,0x76,0x01,0x84,0x01,0x92,0x01,0xA0,0x01, - 0xAE,0x01,0xBC,0x01,0xD7,0x01,0xF2,0x01,0x0D,0x02,0x1B,0x02,0x36,0x02,0x51,0x02,0x5F,0x02, - 0x6D,0x02,0x88,0x02,0x96,0x02,0xA4,0x02,0xBF,0x02,0xDA,0x02,0xE8,0x02,0xF6,0x02,0x04,0x03, - 0x12,0x03,0x2D,0x03,0x48,0x03,0x63,0x03,0x71,0x03,0x8C,0x03,0x9A,0x03,0xA8,0x03,0xB6,0x03, - 0xD1,0x03,0xDF,0x03,0xFA,0x03,0x08,0x04,0x16,0x04,0x24,0x04,0x32,0x04,0x40,0x04,0x4E,0x04, - 0x69,0x04,0x77,0x04,0x85,0x04,0x93,0x04,0xA1,0x04,0xAF,0x04,0xBD,0x04,0xCB,0x04,0xD9,0x04, - 0xE7,0x04,0xF5,0x04,0x03,0x05,0x11,0x05,0x1F,0x05,0x2D,0x05,0x48,0x05,0x56,0x05,0x64,0x05, - 0x72,0x05,0x80,0x05,0x8E,0x05,0x9C,0x05,0xAA,0x05,0xB8,0x05,0xC6,0x05,0xE1,0x05,0xEF,0x05, - 0xFD,0x05,0x0B,0x06,0x19,0x06,0x27,0x06,0x35,0x06,0x50,0x06, +const int8u verdana13_bold[] = { + 13, 3, 32, 128 - 32, 0x00, 0x00, 0x0E, 0x00, 0x1C, 0x00, 0x2A, 0x00, 0x45, 0x00, 0x53, 0x00, 0x6E, 0x00, + 0x89, 0x00, 0x97, 0x00, 0xA5, 0x00, 0xB3, 0x00, 0xC1, 0x00, 0xDC, 0x00, 0xEA, 0x00, 0xF8, 0x00, 0x06, 0x01, + 0x14, 0x01, 0x22, 0x01, 0x30, 0x01, 0x3E, 0x01, 0x4C, 0x01, 0x5A, 0x01, 0x68, 0x01, 0x76, 0x01, 0x84, 0x01, + 0x92, 0x01, 0xA0, 0x01, 0xAE, 0x01, 0xBC, 0x01, 0xD7, 0x01, 0xF2, 0x01, 0x0D, 0x02, 0x1B, 0x02, 0x36, 0x02, + 0x51, 0x02, 0x5F, 0x02, 0x6D, 0x02, 0x88, 0x02, 0x96, 0x02, 0xA4, 0x02, 0xBF, 0x02, 0xDA, 0x02, 0xE8, 0x02, + 0xF6, 0x02, 0x04, 0x03, 0x12, 0x03, 0x2D, 0x03, 0x48, 0x03, 0x63, 0x03, 0x71, 0x03, 0x8C, 0x03, 0x9A, 0x03, + 0xA8, 0x03, 0xB6, 0x03, 0xD1, 0x03, 0xDF, 0x03, 0xFA, 0x03, 0x08, 0x04, 0x16, 0x04, 0x24, 0x04, 0x32, 0x04, + 0x40, 0x04, 0x4E, 0x04, 0x69, 0x04, 0x77, 0x04, 0x85, 0x04, 0x93, 0x04, 0xA1, 0x04, 0xAF, 0x04, 0xBD, 0x04, + 0xCB, 0x04, 0xD9, 0x04, 0xE7, 0x04, 0xF5, 0x04, 0x03, 0x05, 0x11, 0x05, 0x1F, 0x05, 0x2D, 0x05, 0x48, 0x05, + 0x56, 0x05, 0x64, 0x05, 0x72, 0x05, 0x80, 0x05, 0x8E, 0x05, 0x9C, 0x05, 0xAA, 0x05, 0xB8, 0x05, 0xC6, 0x05, + 0xE1, 0x05, 0xEF, 0x05, 0xFD, 0x05, 0x0B, 0x06, 0x19, 0x06, 0x27, 0x06, 0x35, 0x06, 0x50, 0x06, - 4, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x21 '!' - 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x60,0x00,0x00, + 4, // 0x21 '!' + 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, - 7, // 0x22 '"' - 0x00,0x00,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x22 '"' + 0x00, 0x00, 0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x23 '#' - 0x00,0x00,0x00,0x00,0x00,0x00,0x0A,0x00,0x0A,0x00,0x3F,0x00,0x14,0x00,0x14,0x00,0x7E,0x00,0x28,0x00,0x28,0x00,0x00,0x00,0x00,0x00, + 9, // 0x23 '#' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x0A, 0x00, 0x3F, 0x00, 0x14, 0x00, 0x14, 0x00, 0x7E, 0x00, + 0x28, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x24 '$' - 0x00,0x00,0x08,0x08,0x3C,0x6A,0x68,0x3C,0x16,0x56,0x3C,0x10,0x10, + 8, // 0x24 '$' + 0x00, 0x00, 0x08, 0x08, 0x3C, 0x6A, 0x68, 0x3C, 0x16, 0x56, 0x3C, 0x10, 0x10, - 14, // 0x25 '%' - 0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x80,0x6C,0x80,0x6D,0x00,0x6D,0x70,0x3A,0xD8,0x02,0xD8,0x04,0xD8,0x04,0x70,0x00,0x00,0x00,0x00, + 14, // 0x25 '%' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x80, 0x6C, 0x80, 0x6D, 0x00, 0x6D, 0x70, 0x3A, 0xD8, 0x02, 0xD8, + 0x04, 0xD8, 0x04, 0x70, 0x00, 0x00, 0x00, 0x00, - 10, // 0x26 '&' - 0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x6C,0x00,0x6C,0x00,0x39,0x80,0x6D,0x00,0x66,0x00,0x63,0x00,0x3D,0x80,0x00,0x00,0x00,0x00, + 10, // 0x26 '&' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x39, 0x80, 0x6D, 0x00, 0x66, 0x00, + 0x63, 0x00, 0x3D, 0x80, 0x00, 0x00, 0x00, 0x00, - 4, // 0x27 ''' - 0x00,0x00,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x27 ''' + 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x28 '(' - 0x00,0x00,0x18,0x30,0x30,0x60,0x60,0x60,0x60,0x60,0x30,0x30,0x18, + 6, // 0x28 '(' + 0x00, 0x00, 0x18, 0x30, 0x30, 0x60, 0x60, 0x60, 0x60, 0x60, 0x30, 0x30, 0x18, - 6, // 0x29 ')' - 0x00,0x00,0x60,0x30,0x30,0x18,0x18,0x18,0x18,0x18,0x30,0x30,0x60, + 6, // 0x29 ')' + 0x00, 0x00, 0x60, 0x30, 0x30, 0x18, 0x18, 0x18, 0x18, 0x18, 0x30, 0x30, 0x60, - 8, // 0x2A '*' - 0x00,0x00,0x10,0x54,0x38,0x54,0x10,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x2A '*' + 0x00, 0x00, 0x10, 0x54, 0x38, 0x54, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x7F,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00, + 9, // 0x2B '+' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x7F, 0x00, 0x08, 0x00, + 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x40, + 4, // 0x2C ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x40, - 6, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00, + 6, // 0x2D '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00, + 4, // 0x2E '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, - 8, // 0x2F '/' - 0x00,0x00,0x06,0x06,0x0C,0x0C,0x18,0x18,0x18,0x30,0x30,0x60,0x60, + 8, // 0x2F '/' + 0x00, 0x00, 0x06, 0x06, 0x0C, 0x0C, 0x18, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, - 8, // 0x30 '0' - 0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x66,0x66,0x3C,0x00,0x00, + 8, // 0x30 '0' + 0x00, 0x00, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00, 0x00, - 8, // 0x31 '1' - 0x00,0x00,0x00,0x18,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00, + 8, // 0x31 '1' + 0x00, 0x00, 0x00, 0x18, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, - 8, // 0x32 '2' - 0x00,0x00,0x00,0x3C,0x66,0x06,0x0C,0x18,0x30,0x60,0x7E,0x00,0x00, + 8, // 0x32 '2' + 0x00, 0x00, 0x00, 0x3C, 0x66, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x7E, 0x00, 0x00, - 8, // 0x33 '3' - 0x00,0x00,0x00,0x3C,0x66,0x06,0x1C,0x06,0x06,0x66,0x3C,0x00,0x00, + 8, // 0x33 '3' + 0x00, 0x00, 0x00, 0x3C, 0x66, 0x06, 0x1C, 0x06, 0x06, 0x66, 0x3C, 0x00, 0x00, - 8, // 0x34 '4' - 0x00,0x00,0x00,0x04,0x0C,0x1C,0x2C,0x4C,0x7E,0x0C,0x0C,0x00,0x00, + 8, // 0x34 '4' + 0x00, 0x00, 0x00, 0x04, 0x0C, 0x1C, 0x2C, 0x4C, 0x7E, 0x0C, 0x0C, 0x00, 0x00, - 8, // 0x35 '5' - 0x00,0x00,0x00,0x3E,0x30,0x30,0x3C,0x06,0x06,0x66,0x3C,0x00,0x00, + 8, // 0x35 '5' + 0x00, 0x00, 0x00, 0x3E, 0x30, 0x30, 0x3C, 0x06, 0x06, 0x66, 0x3C, 0x00, 0x00, - 8, // 0x36 '6' - 0x00,0x00,0x00,0x1C,0x30,0x60,0x7C,0x66,0x66,0x66,0x3C,0x00,0x00, + 8, // 0x36 '6' + 0x00, 0x00, 0x00, 0x1C, 0x30, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x3C, 0x00, 0x00, - 8, // 0x37 '7' - 0x00,0x00,0x00,0x7E,0x06,0x0C,0x0C,0x18,0x18,0x30,0x30,0x00,0x00, + 8, // 0x37 '7' + 0x00, 0x00, 0x00, 0x7E, 0x06, 0x0C, 0x0C, 0x18, 0x18, 0x30, 0x30, 0x00, 0x00, - 8, // 0x38 '8' - 0x00,0x00,0x00,0x3C,0x66,0x66,0x3C,0x66,0x66,0x66,0x3C,0x00,0x00, + 8, // 0x38 '8' + 0x00, 0x00, 0x00, 0x3C, 0x66, 0x66, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x00, 0x00, - 8, // 0x39 '9' - 0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x3E,0x06,0x0C,0x38,0x00,0x00, + 8, // 0x39 '9' + 0x00, 0x00, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3E, 0x06, 0x0C, 0x38, 0x00, 0x00, - 4, // 0x3A ':' - 0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x00,0x00, + 4, // 0x3A ':' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, - 4, // 0x3B ';' - 0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x60,0x40, + 4, // 0x3B ';' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x60, 0x40, - 9, // 0x3C '<' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3C '<' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0C, 0x00, 0x30, 0x00, 0x40, 0x00, 0x30, 0x00, + 0x0C, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3D '=' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x3E '>' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x01,0x00,0x06,0x00,0x18,0x00,0x60,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3E '>' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x18, 0x00, 0x06, 0x00, 0x01, 0x00, 0x06, 0x00, + 0x18, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x3F '?' - 0x00,0x00,0x00,0x38,0x4C,0x0C,0x18,0x30,0x30,0x00,0x30,0x00,0x00, + 7, // 0x3F '?' + 0x00, 0x00, 0x00, 0x38, 0x4C, 0x0C, 0x18, 0x30, 0x30, 0x00, 0x30, 0x00, 0x00, - 11, // 0x40 '@' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x20,0x40,0x4F,0x40,0x5B,0x40,0x5B,0x40,0x5B,0x40,0x4F,0x80,0x20,0x00,0x1F,0x00,0x00,0x00, + 11, // 0x40 '@' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x80, 0x20, 0x40, 0x4F, 0x40, 0x5B, 0x40, 0x5B, 0x40, 0x5B, 0x40, + 0x4F, 0x80, 0x20, 0x00, 0x1F, 0x00, 0x00, 0x00, - 9, // 0x41 'A' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x1C,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x7F,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00, + 9, // 0x41 'A' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x1C, 0x00, 0x36, 0x00, 0x36, 0x00, 0x36, 0x00, 0x7F, 0x00, + 0x63, 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x42 'B' - 0x00,0x00,0x00,0x7C,0x66,0x66,0x7C,0x66,0x66,0x66,0x7C,0x00,0x00, + 8, // 0x42 'B' + 0x00, 0x00, 0x00, 0x7C, 0x66, 0x66, 0x7C, 0x66, 0x66, 0x66, 0x7C, 0x00, 0x00, - 8, // 0x43 'C' - 0x00,0x00,0x00,0x3C,0x62,0x60,0x60,0x60,0x60,0x62,0x3C,0x00,0x00, + 8, // 0x43 'C' + 0x00, 0x00, 0x00, 0x3C, 0x62, 0x60, 0x60, 0x60, 0x60, 0x62, 0x3C, 0x00, 0x00, - 9, // 0x44 'D' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x66,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x66,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, + 9, // 0x44 'D' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x66, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, + 0x66, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x45 'E' - 0x00,0x00,0x00,0x7E,0x60,0x60,0x7E,0x60,0x60,0x60,0x7E,0x00,0x00, + 8, // 0x45 'E' + 0x00, 0x00, 0x00, 0x7E, 0x60, 0x60, 0x7E, 0x60, 0x60, 0x60, 0x7E, 0x00, 0x00, - 8, // 0x46 'F' - 0x00,0x00,0x00,0x7E,0x60,0x60,0x7E,0x60,0x60,0x60,0x60,0x00,0x00, + 8, // 0x46 'F' + 0x00, 0x00, 0x00, 0x7E, 0x60, 0x60, 0x7E, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, - 9, // 0x47 'G' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x61,0x00,0x60,0x00,0x60,0x00,0x67,0x00,0x63,0x00,0x63,0x00,0x3F,0x00,0x00,0x00,0x00,0x00, + 9, // 0x47 'G' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x61, 0x00, 0x60, 0x00, 0x60, 0x00, 0x67, 0x00, 0x63, 0x00, + 0x63, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x48 'H' - 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7F,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00, + 9, // 0x48 'H' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x7F, 0x00, 0x63, 0x00, 0x63, 0x00, + 0x63, 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x49 'I' - 0x00,0x00,0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00, + 6, // 0x49 'I' + 0x00, 0x00, 0x00, 0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, - 6, // 0x4A 'J' - 0x00,0x00,0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0xF0,0x00,0x00, + 6, // 0x4A 'J' + 0x00, 0x00, 0x00, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xF0, 0x00, 0x00, - 8, // 0x4B 'K' - 0x00,0x00,0x00,0x66,0x6C,0x78,0x70,0x70,0x78,0x6C,0x66,0x00,0x00, + 8, // 0x4B 'K' + 0x00, 0x00, 0x00, 0x66, 0x6C, 0x78, 0x70, 0x70, 0x78, 0x6C, 0x66, 0x00, 0x00, - 7, // 0x4C 'L' - 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x7E,0x00,0x00, + 7, // 0x4C 'L' + 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7E, 0x00, 0x00, - 10, // 0x4D 'M' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x80,0x71,0x80,0x7B,0x80,0x5D,0x80,0x49,0x80,0x41,0x80,0x41,0x80,0x41,0x80,0x00,0x00,0x00,0x00, + 10, // 0x4D 'M' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x80, 0x71, 0x80, 0x7B, 0x80, 0x5D, 0x80, 0x49, 0x80, 0x41, 0x80, + 0x41, 0x80, 0x41, 0x80, 0x00, 0x00, 0x00, 0x00, - 9, // 0x4E 'N' - 0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x61,0x00,0x71,0x00,0x59,0x00,0x4D,0x00,0x47,0x00,0x43,0x00,0x41,0x00,0x00,0x00,0x00,0x00, + 9, // 0x4E 'N' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x61, 0x00, 0x71, 0x00, 0x59, 0x00, 0x4D, 0x00, 0x47, 0x00, + 0x43, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x4F 'O' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x4F 'O' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, + 0x63, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x50 'P' - 0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x7C,0x60,0x60,0x60,0x00,0x00, + 8, // 0x50 'P' + 0x00, 0x00, 0x00, 0x7C, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, 0x60, 0x00, 0x00, - 9, // 0x51 'Q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x0C,0x00,0x07,0x00, + 9, // 0x51 'Q' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, + 0x63, 0x00, 0x3E, 0x00, 0x0C, 0x00, 0x07, 0x00, - 8, // 0x52 'R' - 0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x7C,0x6C,0x66,0x63,0x00,0x00, + 8, // 0x52 'R' + 0x00, 0x00, 0x00, 0x7C, 0x66, 0x66, 0x66, 0x7C, 0x6C, 0x66, 0x63, 0x00, 0x00, - 8, // 0x53 'S' - 0x00,0x00,0x00,0x3C,0x62,0x60,0x7C,0x3E,0x06,0x46,0x3C,0x00,0x00, + 8, // 0x53 'S' + 0x00, 0x00, 0x00, 0x3C, 0x62, 0x60, 0x7C, 0x3E, 0x06, 0x46, 0x3C, 0x00, 0x00, - 8, // 0x54 'T' - 0x00,0x00,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00, + 8, // 0x54 'T' + 0x00, 0x00, 0x00, 0xFF, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, - 9, // 0x55 'U' - 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x55 'U' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, + 0x63, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x56 'V' - 0x00,0x00,0x00,0x66,0x66,0x66,0x3C,0x3C,0x3C,0x18,0x18,0x00,0x00, + 8, // 0x56 'V' + 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3C, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x00, - 12, // 0x57 'W' - 0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x60,0x66,0x60,0x66,0x60,0x36,0xC0,0x3F,0xC0,0x39,0xC0,0x19,0x80,0x19,0x80,0x00,0x00,0x00,0x00, + 12, // 0x57 'W' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x60, 0x66, 0x60, 0x66, 0x60, 0x36, 0xC0, 0x3F, 0xC0, 0x39, 0xC0, + 0x19, 0x80, 0x19, 0x80, 0x00, 0x00, 0x00, 0x00, - 8, // 0x58 'X' - 0x00,0x00,0x00,0x66,0x66,0x3C,0x18,0x18,0x3C,0x66,0x66,0x00,0x00, + 8, // 0x58 'X' + 0x00, 0x00, 0x00, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x3C, 0x66, 0x66, 0x00, 0x00, - 8, // 0x59 'Y' - 0x00,0x00,0x00,0x66,0x66,0x3C,0x3C,0x18,0x18,0x18,0x18,0x00,0x00, + 8, // 0x59 'Y' + 0x00, 0x00, 0x00, 0x66, 0x66, 0x3C, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, - 8, // 0x5A 'Z' - 0x00,0x00,0x00,0x7E,0x06,0x0E,0x1C,0x38,0x70,0x60,0x7E,0x00,0x00, + 8, // 0x5A 'Z' + 0x00, 0x00, 0x00, 0x7E, 0x06, 0x0E, 0x1C, 0x38, 0x70, 0x60, 0x7E, 0x00, 0x00, - 6, // 0x5B '[' - 0x00,0x00,0x78,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x78, + 6, // 0x5B '[' + 0x00, 0x00, 0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78, - 8, // 0x5C '\' - 0x00,0x00,0x60,0x60,0x30,0x30,0x18,0x18,0x18,0x0C,0x0C,0x06,0x06, + 8, // 0x5C '\' + 0x00, 0x00, 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x18, 0x0C, 0x0C, 0x06, 0x06, - 6, // 0x5D ']' - 0x00,0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x78, + 6, // 0x5D ']' + 0x00, 0x00, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, - 10, // 0x5E '^' - 0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x5E '^' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x1E, 0x00, 0x33, 0x00, 0x61, 0x80, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF, + 8, // 0x5F '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, - 8, // 0x60 '`' - 0x00,0x00,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x60 '`' + 0x00, 0x00, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x06,0x3E,0x66,0x66,0x3E,0x00,0x00, + 8, // 0x61 'a' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x06, 0x3E, 0x66, 0x66, 0x3E, 0x00, 0x00, - 8, // 0x62 'b' - 0x00,0x00,0x60,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x7C,0x00,0x00, + 8, // 0x62 'b' + 0x00, 0x00, 0x60, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x00, 0x00, - 7, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x60,0x60,0x60,0x60,0x3C,0x00,0x00, + 7, // 0x63 'c' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x60, 0x60, 0x60, 0x60, 0x3C, 0x00, 0x00, - 8, // 0x64 'd' - 0x00,0x00,0x06,0x06,0x06,0x3E,0x66,0x66,0x66,0x66,0x3E,0x00,0x00, + 8, // 0x64 'd' + 0x00, 0x00, 0x06, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x66, 0x66, 0x3E, 0x00, 0x00, - 8, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x7E,0x60,0x62,0x3C,0x00,0x00, + 8, // 0x65 'e' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x66, 0x7E, 0x60, 0x62, 0x3C, 0x00, 0x00, - 5, // 0x66 'f' - 0x00,0x00,0x38,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x60,0x00,0x00, + 5, // 0x66 'f' + 0x00, 0x00, 0x38, 0x60, 0x60, 0xF8, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, - 8, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x3E,0x66,0x66,0x66,0x66,0x3E,0x06,0x3C, + 8, // 0x67 'g' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x66, 0x66, 0x66, 0x66, 0x3E, 0x06, 0x3C, - 8, // 0x68 'h' - 0x00,0x00,0x60,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x66,0x00,0x00, + 8, // 0x68 'h' + 0x00, 0x00, 0x60, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, - 4, // 0x69 'i' - 0x00,0x00,0x00,0x60,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00, + 4, // 0x69 'i' + 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, - 5, // 0x6A 'j' - 0x00,0x00,0x00,0x30,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x30,0xE0, + 5, // 0x6A 'j' + 0x00, 0x00, 0x00, 0x30, 0x00, 0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xE0, - 8, // 0x6B 'k' - 0x00,0x00,0x60,0x60,0x60,0x66,0x6C,0x78,0x78,0x6C,0x66,0x00,0x00, + 8, // 0x6B 'k' + 0x00, 0x00, 0x60, 0x60, 0x60, 0x66, 0x6C, 0x78, 0x78, 0x6C, 0x66, 0x00, 0x00, - 4, // 0x6C 'l' - 0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00, + 4, // 0x6C 'l' + 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, - 12, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7D,0xC0,0x66,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0x00,0x00,0x00,0x00, + 12, // 0x6D 'm' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7D, 0xC0, 0x66, 0x60, 0x66, 0x60, 0x66, 0x60, + 0x66, 0x60, 0x66, 0x60, 0x00, 0x00, 0x00, 0x00, - 8, // 0x6E 'n' - 0x00,0x00,0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x66,0x66,0x00,0x00, + 8, // 0x6E 'n' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, - 8, // 0x6F 'o' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x3C,0x00,0x00, + 8, // 0x6F 'o' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00, 0x00, - 8, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x66,0x7C,0x60,0x60, + 8, // 0x70 'p' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, - 8, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x3E,0x66,0x66,0x66,0x66,0x3E,0x06,0x06, + 8, // 0x71 'q' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x66, 0x66, 0x66, 0x66, 0x3E, 0x06, 0x06, - 6, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0x6C,0x7C,0x60,0x60,0x60,0x60,0x00,0x00, + 6, // 0x72 'r' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x7C, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, - 7, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x60,0x78,0x3C,0x0C,0x78,0x00,0x00, + 7, // 0x73 's' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x60, 0x78, 0x3C, 0x0C, 0x78, 0x00, 0x00, - 5, // 0x74 't' - 0x00,0x00,0x00,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x38,0x00,0x00, + 5, // 0x74 't' + 0x00, 0x00, 0x00, 0x60, 0x60, 0xF8, 0x60, 0x60, 0x60, 0x60, 0x38, 0x00, 0x00, - 8, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x3E,0x00,0x00, + 8, // 0x75 'u' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3E, 0x00, 0x00, - 8, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x3C,0x3C,0x18,0x00,0x00, + 8, // 0x76 'v' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3C, 0x3C, 0x18, 0x00, 0x00, - 10, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6D,0x80,0x6D,0x80,0x6D,0x80,0x6D,0x80,0x33,0x00,0x33,0x00,0x00,0x00,0x00,0x00, + 10, // 0x77 'w' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6D, 0x80, 0x6D, 0x80, 0x6D, 0x80, 0x6D, 0x80, + 0x33, 0x00, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x3C,0x3C,0x66,0x66,0x00,0x00, + 8, // 0x78 'x' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x3C, 0x3C, 0x66, 0x66, 0x00, 0x00, - 8, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x3C,0x3C,0x18,0x18,0x30,0x30, + 8, // 0x79 'y' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x3C, 0x3C, 0x18, 0x18, 0x30, 0x30, - 7, // 0x7A 'z' - 0x00,0x00,0x00,0x00,0x00,0x7C,0x0C,0x18,0x30,0x60,0x7C,0x00,0x00, + 7, // 0x7A 'z' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x0C, 0x18, 0x30, 0x60, 0x7C, 0x00, 0x00, - 8, // 0x7B '{' - 0x00,0x00,0x0E,0x18,0x18,0x18,0x18,0x70,0x18,0x18,0x18,0x18,0x0E, + 8, // 0x7B '{' + 0x00, 0x00, 0x0E, 0x18, 0x18, 0x18, 0x18, 0x70, 0x18, 0x18, 0x18, 0x18, 0x0E, - 6, // 0x7C '|' - 0x00,0x00,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 6, // 0x7C '|' + 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, - 8, // 0x7D '}' - 0x00,0x00,0x70,0x18,0x18,0x18,0x18,0x0E,0x18,0x18,0x18,0x18,0x70, + 8, // 0x7D '}' + 0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x18, 0x0E, 0x18, 0x18, 0x18, 0x18, 0x70, - 9, // 0x7E '~' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x00,0x49,0x00,0x49,0x00,0x46,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x7E '~' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x00, 0x49, 0x00, 0x49, 0x00, + 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x7F '' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x7F,0x80,0x00,0x00,0x00,0x00, + 11, // 0x7F '' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x80, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, + 0x40, 0x80, 0x7F, 0x80, 0x00, 0x00, 0x00, 0x00, - 0 -}; + 0}; -const int8u verdana14[] = -{ - 14, 3, 32, 128-32, - 0x00,0x00,0x0F,0x00,0x1E,0x00,0x2D,0x00,0x4A,0x00,0x59,0x00,0x76,0x00,0x93,0x00,0xA2,0x00, - 0xB1,0x00,0xC0,0x00,0xCF,0x00,0xEC,0x00,0xFB,0x00,0x0A,0x01,0x19,0x01,0x28,0x01,0x37,0x01, - 0x46,0x01,0x55,0x01,0x64,0x01,0x73,0x01,0x82,0x01,0x91,0x01,0xA0,0x01,0xAF,0x01,0xBE,0x01, - 0xCD,0x01,0xDC,0x01,0xF9,0x01,0x16,0x02,0x33,0x02,0x42,0x02,0x5F,0x02,0x6E,0x02,0x7D,0x02, - 0x9A,0x02,0xB7,0x02,0xC6,0x02,0xD5,0x02,0xF2,0x02,0x0F,0x03,0x1E,0x03,0x2D,0x03,0x3C,0x03, - 0x4B,0x03,0x68,0x03,0x85,0x03,0xA2,0x03,0xB1,0x03,0xCE,0x03,0xDD,0x03,0xEC,0x03,0xFB,0x03, - 0x18,0x04,0x27,0x04,0x44,0x04,0x53,0x04,0x62,0x04,0x71,0x04,0x80,0x04,0x8F,0x04,0x9E,0x04, - 0xBB,0x04,0xCA,0x04,0xD9,0x04,0xE8,0x04,0xF7,0x04,0x06,0x05,0x15,0x05,0x24,0x05,0x33,0x05, - 0x42,0x05,0x51,0x05,0x60,0x05,0x6F,0x05,0x7E,0x05,0x8D,0x05,0xAA,0x05,0xB9,0x05,0xC8,0x05, - 0xD7,0x05,0xE6,0x05,0xF5,0x05,0x04,0x06,0x13,0x06,0x22,0x06,0x31,0x06,0x4E,0x06,0x5D,0x06, - 0x6C,0x06,0x7B,0x06,0x8A,0x06,0x99,0x06,0xA8,0x06,0xC5,0x06, +const int8u verdana14[] = { + 14, 3, 32, 128 - 32, 0x00, 0x00, 0x0F, 0x00, 0x1E, 0x00, 0x2D, 0x00, 0x4A, 0x00, 0x59, 0x00, 0x76, 0x00, + 0x93, 0x00, 0xA2, 0x00, 0xB1, 0x00, 0xC0, 0x00, 0xCF, 0x00, 0xEC, 0x00, 0xFB, 0x00, 0x0A, 0x01, 0x19, 0x01, + 0x28, 0x01, 0x37, 0x01, 0x46, 0x01, 0x55, 0x01, 0x64, 0x01, 0x73, 0x01, 0x82, 0x01, 0x91, 0x01, 0xA0, 0x01, + 0xAF, 0x01, 0xBE, 0x01, 0xCD, 0x01, 0xDC, 0x01, 0xF9, 0x01, 0x16, 0x02, 0x33, 0x02, 0x42, 0x02, 0x5F, 0x02, + 0x6E, 0x02, 0x7D, 0x02, 0x9A, 0x02, 0xB7, 0x02, 0xC6, 0x02, 0xD5, 0x02, 0xF2, 0x02, 0x0F, 0x03, 0x1E, 0x03, + 0x2D, 0x03, 0x3C, 0x03, 0x4B, 0x03, 0x68, 0x03, 0x85, 0x03, 0xA2, 0x03, 0xB1, 0x03, 0xCE, 0x03, 0xDD, 0x03, + 0xEC, 0x03, 0xFB, 0x03, 0x18, 0x04, 0x27, 0x04, 0x44, 0x04, 0x53, 0x04, 0x62, 0x04, 0x71, 0x04, 0x80, 0x04, + 0x8F, 0x04, 0x9E, 0x04, 0xBB, 0x04, 0xCA, 0x04, 0xD9, 0x04, 0xE8, 0x04, 0xF7, 0x04, 0x06, 0x05, 0x15, 0x05, + 0x24, 0x05, 0x33, 0x05, 0x42, 0x05, 0x51, 0x05, 0x60, 0x05, 0x6F, 0x05, 0x7E, 0x05, 0x8D, 0x05, 0xAA, 0x05, + 0xB9, 0x05, 0xC8, 0x05, 0xD7, 0x05, 0xE6, 0x05, 0xF5, 0x05, 0x04, 0x06, 0x13, 0x06, 0x22, 0x06, 0x31, 0x06, + 0x4E, 0x06, 0x5D, 0x06, 0x6C, 0x06, 0x7B, 0x06, 0x8A, 0x06, 0x99, 0x06, 0xA8, 0x06, 0xC5, 0x06, - 4, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x21 '!' - 0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, + 5, // 0x21 '!' + 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x00, 0x00, - 6, // 0x22 '"' - 0x00,0x00,0x48,0x48,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x22 '"' + 0x00, 0x00, 0x48, 0x48, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x23 '#' - 0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x09,0x00,0x12,0x00,0x3F,0x80,0x12,0x00,0x12,0x00,0x7F,0x00,0x24,0x00,0x24,0x00,0x00,0x00,0x00,0x00, + 10, // 0x23 '#' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x09, 0x00, 0x12, 0x00, 0x3F, 0x80, 0x12, 0x00, 0x12, 0x00, + 0x7F, 0x00, 0x24, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x24 '$' - 0x00,0x00,0x10,0x10,0x3E,0x50,0x50,0x30,0x1C,0x12,0x12,0x7C,0x10,0x10, + 8, // 0x24 '$' + 0x00, 0x00, 0x10, 0x10, 0x3E, 0x50, 0x50, 0x30, 0x1C, 0x12, 0x12, 0x7C, 0x10, 0x10, - 13, // 0x25 '%' - 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x80,0x49,0x00,0x49,0x00,0x4A,0x00,0x32,0x60,0x02,0x90,0x04,0x90,0x04,0x90,0x08,0x60,0x00,0x00,0x00,0x00, + 13, // 0x25 '%' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x80, 0x49, 0x00, 0x49, 0x00, 0x4A, 0x00, 0x32, 0x60, 0x02, 0x90, + 0x04, 0x90, 0x04, 0x90, 0x08, 0x60, 0x00, 0x00, 0x00, 0x00, - 10, // 0x26 '&' - 0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x39,0x00,0x45,0x00,0x42,0x00,0x43,0x00,0x3C,0x80,0x00,0x00,0x00,0x00, + 10, // 0x26 '&' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x44, 0x00, 0x44, 0x00, 0x44, 0x00, 0x39, 0x00, 0x45, 0x00, + 0x42, 0x00, 0x43, 0x00, 0x3C, 0x80, 0x00, 0x00, 0x00, 0x00, - 3, // 0x27 ''' - 0x00,0x00,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 3, // 0x27 ''' + 0x00, 0x00, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x28 '(' - 0x00,0x00,0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10, + 5, // 0x28 '(' + 0x00, 0x00, 0x10, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x10, - 5, // 0x29 ')' - 0x00,0x00,0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40, + 5, // 0x29 ')' + 0x00, 0x00, 0x40, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x40, - 8, // 0x2A '*' - 0x00,0x00,0x10,0x54,0x38,0x54,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x2A '*' + 0x00, 0x00, 0x10, 0x54, 0x38, 0x54, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x7F,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00, + 9, // 0x2B '+' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x7F, 0x00, + 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40, + 4, // 0x2C ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x40, - 5, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00, + 5, // 0x2D '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00, + 4, // 0x2E '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, - 5, // 0x2F '/' - 0x00,0x00,0x08,0x08,0x10,0x10,0x10,0x20,0x20,0x20,0x40,0x40,0x40,0x80, + 5, // 0x2F '/' + 0x00, 0x00, 0x08, 0x08, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x40, 0x40, 0x40, 0x80, - 8, // 0x30 '0' - 0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00, + 8, // 0x30 '0' + 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00, - 8, // 0x31 '1' - 0x00,0x00,0x00,0x08,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00, + 8, // 0x31 '1' + 0x00, 0x00, 0x00, 0x08, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00, - 8, // 0x32 '2' - 0x00,0x00,0x00,0x3C,0x42,0x42,0x02,0x04,0x18,0x20,0x40,0x7E,0x00,0x00, + 8, // 0x32 '2' + 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x02, 0x04, 0x18, 0x20, 0x40, 0x7E, 0x00, 0x00, - 8, // 0x33 '3' - 0x00,0x00,0x00,0x3C,0x42,0x02,0x02,0x1C,0x02,0x02,0x42,0x3C,0x00,0x00, + 8, // 0x33 '3' + 0x00, 0x00, 0x00, 0x3C, 0x42, 0x02, 0x02, 0x1C, 0x02, 0x02, 0x42, 0x3C, 0x00, 0x00, - 8, // 0x34 '4' - 0x00,0x00,0x00,0x04,0x0C,0x14,0x24,0x44,0x7F,0x04,0x04,0x04,0x00,0x00, + 8, // 0x34 '4' + 0x00, 0x00, 0x00, 0x04, 0x0C, 0x14, 0x24, 0x44, 0x7F, 0x04, 0x04, 0x04, 0x00, 0x00, - 8, // 0x35 '5' - 0x00,0x00,0x00,0x7E,0x40,0x40,0x7C,0x02,0x02,0x02,0x42,0x3C,0x00,0x00, + 8, // 0x35 '5' + 0x00, 0x00, 0x00, 0x7E, 0x40, 0x40, 0x7C, 0x02, 0x02, 0x02, 0x42, 0x3C, 0x00, 0x00, - 8, // 0x36 '6' - 0x00,0x00,0x00,0x1C,0x20,0x40,0x7C,0x42,0x42,0x42,0x42,0x3C,0x00,0x00, + 8, // 0x36 '6' + 0x00, 0x00, 0x00, 0x1C, 0x20, 0x40, 0x7C, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00, - 8, // 0x37 '7' - 0x00,0x00,0x00,0x7E,0x02,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x00,0x00, + 8, // 0x37 '7' + 0x00, 0x00, 0x00, 0x7E, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x00, 0x00, - 8, // 0x38 '8' - 0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x3C,0x42,0x42,0x42,0x3C,0x00,0x00, + 8, // 0x38 '8' + 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x3C, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00, - 8, // 0x39 '9' - 0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x3E,0x02,0x04,0x38,0x00,0x00, + 8, // 0x39 '9' + 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x42, 0x3E, 0x02, 0x04, 0x38, 0x00, 0x00, - 5, // 0x3A ':' - 0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00,0x20,0x20,0x00,0x00, + 5, // 0x3A ':' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, - 5, // 0x3B ';' - 0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00,0x20,0x20,0x20,0x40, + 5, // 0x3B ';' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x40, - 9, // 0x3C '<' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3C '<' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0C, 0x00, 0x30, 0x00, 0x40, 0x00, + 0x30, 0x00, 0x0C, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3D '=' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x7F, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x3E '>' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x01,0x00,0x06,0x00,0x18,0x00,0x60,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3E '>' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x18, 0x00, 0x06, 0x00, 0x01, 0x00, + 0x06, 0x00, 0x18, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x3F '?' - 0x00,0x00,0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x10,0x00,0x10,0x00,0x00, + 7, // 0x3F '?' + 0x00, 0x00, 0x00, 0x38, 0x44, 0x04, 0x04, 0x08, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, - 12, // 0x40 '@' - 0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x27,0x40,0x49,0x20,0x49,0x20,0x49,0x20,0x49,0x20,0x27,0xC0,0x30,0x00,0x0F,0x00,0x00,0x00, + 12, // 0x40 '@' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x30, 0xC0, 0x27, 0x40, 0x49, 0x20, 0x49, 0x20, 0x49, 0x20, + 0x49, 0x20, 0x27, 0xC0, 0x30, 0x00, 0x0F, 0x00, 0x00, 0x00, - 8, // 0x41 'A' - 0x00,0x00,0x00,0x18,0x18,0x24,0x24,0x42,0x42,0x7E,0x81,0x81,0x00,0x00, + 8, // 0x41 'A' + 0x00, 0x00, 0x00, 0x18, 0x18, 0x24, 0x24, 0x42, 0x42, 0x7E, 0x81, 0x81, 0x00, 0x00, - 8, // 0x42 'B' - 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x7C,0x42,0x42,0x42,0x7C,0x00,0x00, + 8, // 0x42 'B' + 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x7C, 0x42, 0x42, 0x42, 0x7C, 0x00, 0x00, - 9, // 0x43 'C' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x43 'C' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x21, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, + 0x40, 0x00, 0x21, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x44 'D' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x42,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, + 9, // 0x44 'D' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x42, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, + 0x41, 0x00, 0x42, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x45 'E' - 0x00,0x00,0x00,0x7E,0x40,0x40,0x40,0x7E,0x40,0x40,0x40,0x7E,0x00,0x00, + 8, // 0x45 'E' + 0x00, 0x00, 0x00, 0x7E, 0x40, 0x40, 0x40, 0x7E, 0x40, 0x40, 0x40, 0x7E, 0x00, 0x00, - 7, // 0x46 'F' - 0x00,0x00,0x00,0x7E,0x40,0x40,0x40,0x7C,0x40,0x40,0x40,0x40,0x00,0x00, + 7, // 0x46 'F' + 0x00, 0x00, 0x00, 0x7E, 0x40, 0x40, 0x40, 0x7C, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, - 9, // 0x47 'G' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x00,0x40,0x00,0x47,0x00,0x41,0x00,0x41,0x00,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x47 'G' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x21, 0x00, 0x40, 0x00, 0x40, 0x00, 0x47, 0x00, 0x41, 0x00, + 0x41, 0x00, 0x21, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x48 'H' - 0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x7F,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00, + 9, // 0x48 'H' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x7F, 0x00, 0x41, 0x00, + 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x49 'I' - 0x00,0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, + 5, // 0x49 'I' + 0x00, 0x00, 0x00, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, - 5, // 0x4A 'J' - 0x00,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xE0,0x00,0x00, + 5, // 0x4A 'J' + 0x00, 0x00, 0x00, 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xE0, 0x00, 0x00, - 8, // 0x4B 'K' - 0x00,0x00,0x00,0x42,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x42,0x00,0x00, + 8, // 0x4B 'K' + 0x00, 0x00, 0x00, 0x42, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x42, 0x00, 0x00, - 7, // 0x4C 'L' - 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7E,0x00,0x00, + 7, // 0x4C 'L' + 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7E, 0x00, 0x00, - 10, // 0x4D 'M' - 0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x52,0x80,0x52,0x80,0x52,0x80,0x4C,0x80,0x4C,0x80,0x40,0x80,0x40,0x80,0x00,0x00,0x00,0x00, + 10, // 0x4D 'M' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x80, 0x61, 0x80, 0x52, 0x80, 0x52, 0x80, 0x52, 0x80, 0x4C, 0x80, + 0x4C, 0x80, 0x40, 0x80, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, - 9, // 0x4E 'N' - 0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x00,0x61,0x00,0x51,0x00,0x51,0x00,0x49,0x00,0x45,0x00,0x45,0x00,0x43,0x00,0x43,0x00,0x00,0x00,0x00,0x00, + 9, // 0x4E 'N' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x61, 0x00, 0x51, 0x00, 0x51, 0x00, 0x49, 0x00, 0x45, 0x00, + 0x45, 0x00, 0x43, 0x00, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x4F 'O' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00, + 10, // 0x4F 'O' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x21, 0x00, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, + 0x40, 0x80, 0x21, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x50 'P' - 0x00,0x00,0x00,0x7C,0x42,0x42,0x42,0x42,0x7C,0x40,0x40,0x40,0x00,0x00, + 8, // 0x50 'P' + 0x00, 0x00, 0x00, 0x7C, 0x42, 0x42, 0x42, 0x42, 0x7C, 0x40, 0x40, 0x40, 0x00, 0x00, - 10, // 0x51 'Q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x02,0x00,0x01,0x80, + 10, // 0x51 'Q' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x21, 0x00, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, + 0x40, 0x80, 0x21, 0x00, 0x1E, 0x00, 0x02, 0x00, 0x01, 0x80, - 8, // 0x52 'R' - 0x00,0x00,0x00,0x7C,0x42,0x42,0x42,0x7C,0x48,0x44,0x42,0x41,0x00,0x00, + 8, // 0x52 'R' + 0x00, 0x00, 0x00, 0x7C, 0x42, 0x42, 0x42, 0x7C, 0x48, 0x44, 0x42, 0x41, 0x00, 0x00, - 8, // 0x53 'S' - 0x00,0x00,0x00,0x3C,0x42,0x40,0x40,0x3C,0x02,0x02,0x42,0x3C,0x00,0x00, + 8, // 0x53 'S' + 0x00, 0x00, 0x00, 0x3C, 0x42, 0x40, 0x40, 0x3C, 0x02, 0x02, 0x42, 0x3C, 0x00, 0x00, - 7, // 0x54 'T' - 0x00,0x00,0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, + 7, // 0x54 'T' + 0x00, 0x00, 0x00, 0xFE, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - 9, // 0x55 'U' - 0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00, + 9, // 0x55 'U' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, + 0x41, 0x00, 0x22, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x56 'V' - 0x00,0x00,0x00,0x81,0x81,0x42,0x42,0x42,0x24,0x24,0x18,0x18,0x00,0x00, + 8, // 0x56 'V' + 0x00, 0x00, 0x00, 0x81, 0x81, 0x42, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18, 0x00, 0x00, - 13, // 0x57 'W' - 0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x10,0x42,0x10,0x45,0x10,0x45,0x10,0x25,0x20,0x28,0xA0,0x28,0xA0,0x10,0x40,0x10,0x40,0x00,0x00,0x00,0x00, + 13, // 0x57 'W' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x10, 0x42, 0x10, 0x45, 0x10, 0x45, 0x10, 0x25, 0x20, 0x28, 0xA0, + 0x28, 0xA0, 0x10, 0x40, 0x10, 0x40, 0x00, 0x00, 0x00, 0x00, - 8, // 0x58 'X' - 0x00,0x00,0x00,0x42,0x42,0x24,0x18,0x18,0x18,0x24,0x42,0x42,0x00,0x00, + 8, // 0x58 'X' + 0x00, 0x00, 0x00, 0x42, 0x42, 0x24, 0x18, 0x18, 0x18, 0x24, 0x42, 0x42, 0x00, 0x00, - 7, // 0x59 'Y' - 0x00,0x00,0x00,0x82,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x10,0x00,0x00, + 7, // 0x59 'Y' + 0x00, 0x00, 0x00, 0x82, 0x44, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - 8, // 0x5A 'Z' - 0x00,0x00,0x00,0x7E,0x02,0x04,0x08,0x10,0x10,0x20,0x40,0x7E,0x00,0x00, + 8, // 0x5A 'Z' + 0x00, 0x00, 0x00, 0x7E, 0x02, 0x04, 0x08, 0x10, 0x10, 0x20, 0x40, 0x7E, 0x00, 0x00, - 5, // 0x5B '[' - 0x00,0x00,0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70, + 5, // 0x5B '[' + 0x00, 0x00, 0x70, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x70, - 5, // 0x5C '\' - 0x00,0x00,0x80,0x80,0x40,0x40,0x40,0x20,0x20,0x10,0x10,0x10,0x08,0x08, + 5, // 0x5C '\' + 0x00, 0x00, 0x80, 0x80, 0x40, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x10, 0x08, 0x08, - 5, // 0x5D ']' - 0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70, + 5, // 0x5D ']' + 0x00, 0x00, 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x70, - 10, // 0x5E '^' - 0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x12,0x00,0x21,0x00,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x5E '^' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x12, 0x00, 0x21, 0x00, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF, + 8, // 0x5F '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, - 8, // 0x60 '`' - 0x00,0x00,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x60 '`' + 0x00, 0x00, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x02,0x02,0x3E,0x42,0x42,0x3E,0x00,0x00, + 8, // 0x61 'a' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x02, 0x02, 0x3E, 0x42, 0x42, 0x3E, 0x00, 0x00, - 8, // 0x62 'b' - 0x00,0x00,0x40,0x40,0x40,0x5C,0x62,0x42,0x42,0x42,0x42,0x7C,0x00,0x00, + 8, // 0x62 'b' + 0x00, 0x00, 0x40, 0x40, 0x40, 0x5C, 0x62, 0x42, 0x42, 0x42, 0x42, 0x7C, 0x00, 0x00, - 6, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x44,0x38,0x00,0x00, + 6, // 0x63 'c' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, - 8, // 0x64 'd' - 0x00,0x00,0x02,0x02,0x02,0x3E,0x42,0x42,0x42,0x42,0x46,0x3A,0x00,0x00, + 8, // 0x64 'd' + 0x00, 0x00, 0x02, 0x02, 0x02, 0x3E, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00, - 8, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x7E,0x40,0x42,0x3C,0x00,0x00, + 8, // 0x65 'e' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x7E, 0x40, 0x42, 0x3C, 0x00, 0x00, - 4, // 0x66 'f' - 0x00,0x00,0x30,0x40,0x40,0xF0,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 4, // 0x66 'f' + 0x00, 0x00, 0x30, 0x40, 0x40, 0xF0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, - 8, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x3E,0x42,0x42,0x42,0x42,0x46,0x3A,0x02,0x3C, + 8, // 0x67 'g' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x02, 0x3C, - 8, // 0x68 'h' - 0x00,0x00,0x40,0x40,0x40,0x5C,0x62,0x42,0x42,0x42,0x42,0x42,0x00,0x00, + 8, // 0x68 'h' + 0x00, 0x00, 0x40, 0x40, 0x40, 0x5C, 0x62, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, - 3, // 0x69 'i' - 0x00,0x00,0x40,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 3, // 0x69 'i' + 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, - 4, // 0x6A 'j' - 0x00,0x00,0x20,0x00,0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xC0, + 4, // 0x6A 'j' + 0x00, 0x00, 0x20, 0x00, 0x00, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xC0, - 7, // 0x6B 'k' - 0x00,0x00,0x40,0x40,0x40,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00, + 7, // 0x6B 'k' + 0x00, 0x00, 0x40, 0x40, 0x40, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x00, 0x00, - 3, // 0x6C 'l' - 0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 3, // 0x6C 'l' + 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, - 11, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7B,0x80,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x00,0x00,0x00,0x00, + 11, // 0x6D 'm' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7B, 0x80, 0x44, 0x40, 0x44, 0x40, 0x44, 0x40, + 0x44, 0x40, 0x44, 0x40, 0x44, 0x40, 0x00, 0x00, 0x00, 0x00, - 8, // 0x6E 'n' - 0x00,0x00,0x00,0x00,0x00,0x5C,0x62,0x42,0x42,0x42,0x42,0x42,0x00,0x00, + 8, // 0x6E 'n' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x62, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, - 8, // 0x6F 'o' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00, + 8, // 0x6F 'o' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00, - 8, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0x5C,0x62,0x42,0x42,0x42,0x42,0x7C,0x40,0x40, + 8, // 0x70 'p' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x62, 0x42, 0x42, 0x42, 0x42, 0x7C, 0x40, 0x40, - 8, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x3E,0x42,0x42,0x42,0x42,0x46,0x3A,0x02,0x02, + 8, // 0x71 'q' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x02, 0x02, - 5, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0x58,0x60,0x40,0x40,0x40,0x40,0x40,0x00,0x00, + 5, // 0x72 'r' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x60, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, - 7, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x40,0x40,0x38,0x04,0x04,0x78,0x00,0x00, + 7, // 0x73 's' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x40, 0x40, 0x38, 0x04, 0x04, 0x78, 0x00, 0x00, - 5, // 0x74 't' - 0x00,0x00,0x00,0x40,0x40,0xF8,0x40,0x40,0x40,0x40,0x40,0x38,0x00,0x00, + 5, // 0x74 't' + 0x00, 0x00, 0x00, 0x40, 0x40, 0xF8, 0x40, 0x40, 0x40, 0x40, 0x40, 0x38, 0x00, 0x00, - 8, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x46,0x3A,0x00,0x00, + 8, // 0x75 'u' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00, - 7, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00,0x00, + 7, // 0x76 'v' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x28, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, - 11, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x40,0x44,0x40,0x2A,0x80,0x2A,0x80,0x2A,0x80,0x11,0x00,0x11,0x00,0x00,0x00,0x00,0x00, + 11, // 0x77 'w' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x40, 0x44, 0x40, 0x2A, 0x80, 0x2A, 0x80, + 0x2A, 0x80, 0x11, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, + 7, // 0x78 'x' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x00, 0x00, - 7, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x10,0x20, + 7, // 0x79 'y' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x28, 0x28, 0x28, 0x10, 0x10, 0x10, 0x20, - 7, // 0x7A 'z' - 0x00,0x00,0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, + 7, // 0x7A 'z' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00, 0x00, - 8, // 0x7B '{' - 0x00,0x00,0x0C,0x10,0x10,0x10,0x10,0x60,0x10,0x10,0x10,0x10,0x10,0x0C, + 8, // 0x7B '{' + 0x00, 0x00, 0x0C, 0x10, 0x10, 0x10, 0x10, 0x60, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0C, - 5, // 0x7C '|' - 0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 5, // 0x7C '|' + 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 8, // 0x7D '}' - 0x00,0x00,0x30,0x08,0x08,0x08,0x08,0x06,0x08,0x08,0x08,0x08,0x08,0x30, + 8, // 0x7D '}' + 0x00, 0x00, 0x30, 0x08, 0x08, 0x08, 0x08, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x30, - 10, // 0x7E '~' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x80,0x4C,0x80,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x7E '~' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x80, 0x4C, 0x80, + 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 12, // 0x7F '' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xE0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,0xE0,0x00,0x00,0x00,0x00, + 12, // 0x7F '' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xE0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x3F, 0xE0, 0x00, 0x00, 0x00, 0x00, - 0 -}; + 0}; -const int8u verdana14_bold[] = -{ - 14, 3, 32, 128-32, - 0x00,0x00,0x0F,0x00,0x1E,0x00,0x2D,0x00,0x4A,0x00,0x67,0x00,0x84,0x00,0xA1,0x00,0xB0,0x00, - 0xBF,0x00,0xCE,0x00,0xEB,0x00,0x08,0x01,0x17,0x01,0x26,0x01,0x35,0x01,0x44,0x01,0x61,0x01, - 0x7E,0x01,0x9B,0x01,0xB8,0x01,0xD5,0x01,0xF2,0x01,0x0F,0x02,0x2C,0x02,0x49,0x02,0x66,0x02, - 0x75,0x02,0x84,0x02,0xA1,0x02,0xBE,0x02,0xDB,0x02,0xEA,0x02,0x07,0x03,0x24,0x03,0x41,0x03, - 0x5E,0x03,0x7B,0x03,0x8A,0x03,0x99,0x03,0xB6,0x03,0xD3,0x03,0xE2,0x03,0xF1,0x03,0x0E,0x04, - 0x1D,0x04,0x3A,0x04,0x57,0x04,0x74,0x04,0x91,0x04,0xAE,0x04,0xCB,0x04,0xE8,0x04,0xF7,0x04, - 0x14,0x05,0x31,0x05,0x4E,0x05,0x6B,0x05,0x88,0x05,0x97,0x05,0xA6,0x05,0xB5,0x05,0xC4,0x05, - 0xE1,0x05,0xFE,0x05,0x1B,0x06,0x2A,0x06,0x39,0x06,0x48,0x06,0x57,0x06,0x66,0x06,0x75,0x06, - 0x84,0x06,0x93,0x06,0xA2,0x06,0xB1,0x06,0xC0,0x06,0xCF,0x06,0xEC,0x06,0xFB,0x06,0x0A,0x07, - 0x19,0x07,0x28,0x07,0x37,0x07,0x46,0x07,0x55,0x07,0x64,0x07,0x73,0x07,0x90,0x07,0x9F,0x07, - 0xAE,0x07,0xBD,0x07,0xDA,0x07,0xE9,0x07,0x06,0x08,0x23,0x08, +const int8u verdana14_bold[] = { + 14, 3, 32, 128 - 32, 0x00, 0x00, 0x0F, 0x00, 0x1E, 0x00, 0x2D, 0x00, 0x4A, 0x00, 0x67, 0x00, 0x84, 0x00, + 0xA1, 0x00, 0xB0, 0x00, 0xBF, 0x00, 0xCE, 0x00, 0xEB, 0x00, 0x08, 0x01, 0x17, 0x01, 0x26, 0x01, 0x35, 0x01, + 0x44, 0x01, 0x61, 0x01, 0x7E, 0x01, 0x9B, 0x01, 0xB8, 0x01, 0xD5, 0x01, 0xF2, 0x01, 0x0F, 0x02, 0x2C, 0x02, + 0x49, 0x02, 0x66, 0x02, 0x75, 0x02, 0x84, 0x02, 0xA1, 0x02, 0xBE, 0x02, 0xDB, 0x02, 0xEA, 0x02, 0x07, 0x03, + 0x24, 0x03, 0x41, 0x03, 0x5E, 0x03, 0x7B, 0x03, 0x8A, 0x03, 0x99, 0x03, 0xB6, 0x03, 0xD3, 0x03, 0xE2, 0x03, + 0xF1, 0x03, 0x0E, 0x04, 0x1D, 0x04, 0x3A, 0x04, 0x57, 0x04, 0x74, 0x04, 0x91, 0x04, 0xAE, 0x04, 0xCB, 0x04, + 0xE8, 0x04, 0xF7, 0x04, 0x14, 0x05, 0x31, 0x05, 0x4E, 0x05, 0x6B, 0x05, 0x88, 0x05, 0x97, 0x05, 0xA6, 0x05, + 0xB5, 0x05, 0xC4, 0x05, 0xE1, 0x05, 0xFE, 0x05, 0x1B, 0x06, 0x2A, 0x06, 0x39, 0x06, 0x48, 0x06, 0x57, 0x06, + 0x66, 0x06, 0x75, 0x06, 0x84, 0x06, 0x93, 0x06, 0xA2, 0x06, 0xB1, 0x06, 0xC0, 0x06, 0xCF, 0x06, 0xEC, 0x06, + 0xFB, 0x06, 0x0A, 0x07, 0x19, 0x07, 0x28, 0x07, 0x37, 0x07, 0x46, 0x07, 0x55, 0x07, 0x64, 0x07, 0x73, 0x07, + 0x90, 0x07, 0x9F, 0x07, 0xAE, 0x07, 0xBD, 0x07, 0xDA, 0x07, 0xE9, 0x07, 0x06, 0x08, 0x23, 0x08, - 4, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x21 '!' - 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x60,0x60,0x00,0x00, + 5, // 0x21 '!' + 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, - 7, // 0x22 '"' - 0x00,0x00,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x22 '"' + 0x00, 0x00, 0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x23 '#' - 0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x09,0x00,0x3F,0x80,0x3F,0x80,0x12,0x00,0x7F,0x00,0x7F,0x00,0x24,0x00,0x24,0x00,0x00,0x00,0x00,0x00, + 10, // 0x23 '#' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x09, 0x00, 0x3F, 0x80, 0x3F, 0x80, 0x12, 0x00, 0x7F, 0x00, + 0x7F, 0x00, 0x24, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x24 '$' - 0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x3E,0x00,0x69,0x00,0x68,0x00,0x7E,0x00,0x3F,0x00,0x0B,0x00,0x4B,0x00,0x3E,0x00,0x08,0x00,0x08,0x00, + 9, // 0x24 '$' + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x3E, 0x00, 0x69, 0x00, 0x68, 0x00, 0x7E, 0x00, 0x3F, 0x00, + 0x0B, 0x00, 0x4B, 0x00, 0x3E, 0x00, 0x08, 0x00, 0x08, 0x00, - 15, // 0x25 '%' - 0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x6C,0x40,0x6C,0x80,0x6C,0xB8,0x6D,0x6C,0x3A,0x6C,0x02,0x6C,0x04,0x6C,0x04,0x38,0x00,0x00,0x00,0x00, + 15, // 0x25 '%' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x40, 0x6C, 0x40, 0x6C, 0x80, 0x6C, 0xB8, 0x6D, 0x6C, 0x3A, 0x6C, + 0x02, 0x6C, 0x04, 0x6C, 0x04, 0x38, 0x00, 0x00, 0x00, 0x00, - 10, // 0x26 '&' - 0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x6C,0x00,0x6C,0x00,0x6C,0x00,0x39,0x80,0x6D,0x00,0x66,0x00,0x63,0x00,0x3D,0x80,0x00,0x00,0x00,0x00, + 10, // 0x26 '&' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x39, 0x80, 0x6D, 0x00, + 0x66, 0x00, 0x63, 0x00, 0x3D, 0x80, 0x00, 0x00, 0x00, 0x00, - 4, // 0x27 ''' - 0x00,0x00,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x27 ''' + 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x28 '(' - 0x00,0x00,0x18,0x30,0x30,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0x30,0x18, + 7, // 0x28 '(' + 0x00, 0x00, 0x18, 0x30, 0x30, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x30, 0x30, 0x18, - 7, // 0x29 ')' - 0x00,0x00,0x30,0x18,0x18,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x18,0x18,0x30, + 7, // 0x29 ')' + 0x00, 0x00, 0x30, 0x18, 0x18, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x18, 0x18, 0x30, - 9, // 0x2A '*' - 0x00,0x00,0x00,0x00,0x08,0x00,0x2A,0x00,0x1C,0x00,0x1C,0x00,0x2A,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x2A '*' + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x2A, 0x00, 0x1C, 0x00, 0x1C, 0x00, 0x2A, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x7F,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x2B '+' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x7F, 0x00, 0x08, 0x00, + 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x40, + 4, // 0x2C ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x40, - 6, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x2D '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00, + 4, // 0x2E '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, - 8, // 0x2F '/' - 0x00,0x00,0x06,0x06,0x0C,0x0C,0x0C,0x18,0x18,0x30,0x30,0x30,0x60,0x60, + 8, // 0x2F '/' + 0x00, 0x00, 0x06, 0x06, 0x0C, 0x0C, 0x0C, 0x18, 0x18, 0x30, 0x30, 0x30, 0x60, 0x60, - 9, // 0x30 '0' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x30 '0' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, + 0x63, 0x00, 0x63, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x31 '1' - 0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x3C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x3F,0x00,0x00,0x00,0x00,0x00, + 9, // 0x31 '1' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x3C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, + 0x0C, 0x00, 0x0C, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x32 '2' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x03,0x00,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x7F,0x00,0x00,0x00,0x00,0x00, + 9, // 0x32 '2' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x63, 0x00, 0x03, 0x00, 0x03, 0x00, 0x06, 0x00, 0x0C, 0x00, + 0x18, 0x00, 0x30, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x33 '3' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x03,0x00,0x03,0x00,0x1E,0x00,0x03,0x00,0x03,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x33 '3' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x63, 0x00, 0x03, 0x00, 0x03, 0x00, 0x1E, 0x00, 0x03, 0x00, + 0x03, 0x00, 0x63, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x34 '4' - 0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x0E,0x00,0x16,0x00,0x16,0x00,0x26,0x00,0x46,0x00,0x7F,0x00,0x06,0x00,0x06,0x00,0x00,0x00,0x00,0x00, + 9, // 0x34 '4' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0E, 0x00, 0x16, 0x00, 0x16, 0x00, 0x26, 0x00, 0x46, 0x00, + 0x7F, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x35 '5' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x30,0x00,0x30,0x00,0x3E,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x35 '5' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x30, 0x00, 0x30, 0x00, 0x3E, 0x00, 0x03, 0x00, 0x03, 0x00, + 0x03, 0x00, 0x63, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x36 '6' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x30,0x00,0x60,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x36 '6' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x30, 0x00, 0x60, 0x00, 0x7E, 0x00, 0x63, 0x00, 0x63, 0x00, + 0x63, 0x00, 0x63, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x37 '7' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x00,0x00,0x00,0x00, + 9, // 0x37 '7' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x03, 0x00, 0x06, 0x00, 0x06, 0x00, 0x0C, 0x00, 0x0C, 0x00, + 0x18, 0x00, 0x18, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x38 '8' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x38 '8' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x3E, 0x00, 0x63, 0x00, + 0x63, 0x00, 0x63, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x39 '9' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3F,0x00,0x03,0x00,0x06,0x00,0x3C,0x00,0x00,0x00,0x00,0x00, + 9, // 0x39 '9' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x3F, 0x00, + 0x03, 0x00, 0x06, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x3A ':' - 0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x00,0x00, + 5, // 0x3A ':' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, - 5, // 0x3B ';' - 0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x60,0x40, + 5, // 0x3B ';' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x40, - 10, // 0x3C '<' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x06,0x00,0x18,0x00,0x60,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x01,0x00,0x00,0x00,0x00,0x00, + 10, // 0x3C '<' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 0x18, 0x00, 0x60, 0x00, 0x60, 0x00, + 0x18, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x3D '=' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x3E '>' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x03,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x00,0x00,0x00,0x00, + 10, // 0x3E '>' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x03, 0x00, 0x03, 0x00, + 0x0C, 0x00, 0x30, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x3F '?' - 0x00,0x00,0x00,0x38,0x4C,0x0C,0x18,0x30,0x30,0x00,0x30,0x30,0x00,0x00, + 7, // 0x3F '?' + 0x00, 0x00, 0x00, 0x38, 0x4C, 0x0C, 0x18, 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x00, - 12, // 0x40 '@' - 0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x2F,0x40,0x5B,0x20,0x5B,0x20,0x5B,0x20,0x5B,0x20,0x2F,0xC0,0x30,0x00,0x0F,0x00,0x00,0x00, + 12, // 0x40 '@' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x30, 0xC0, 0x2F, 0x40, 0x5B, 0x20, 0x5B, 0x20, 0x5B, 0x20, + 0x5B, 0x20, 0x2F, 0xC0, 0x30, 0x00, 0x0F, 0x00, 0x00, 0x00, - 9, // 0x41 'A' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x1C,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x7F,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00, + 9, // 0x41 'A' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x1C, 0x00, 0x36, 0x00, 0x36, 0x00, 0x36, 0x00, 0x36, 0x00, + 0x7F, 0x00, 0x63, 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x42 'B' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x66,0x00,0x66,0x00,0x66,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x42 'B' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x66, 0x00, 0x66, 0x00, 0x66, 0x00, 0x7E, 0x00, 0x63, 0x00, + 0x63, 0x00, 0x63, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x43 'C' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x31,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x31,0x00,0x1E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x43 'C' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x31, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, + 0x60, 0x00, 0x31, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x44 'D' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x00,0x00,0x00,0x00, + 10, // 0x44 'D' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x63, 0x00, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, + 0x61, 0x80, 0x63, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x45 'E' - 0x00,0x00,0x00,0x7E,0x60,0x60,0x60,0x7E,0x60,0x60,0x60,0x7E,0x00,0x00, + 8, // 0x45 'E' + 0x00, 0x00, 0x00, 0x7E, 0x60, 0x60, 0x60, 0x7E, 0x60, 0x60, 0x60, 0x7E, 0x00, 0x00, - 8, // 0x46 'F' - 0x00,0x00,0x00,0x7E,0x60,0x60,0x60,0x7E,0x60,0x60,0x60,0x60,0x00,0x00, + 8, // 0x46 'F' + 0x00, 0x00, 0x00, 0x7E, 0x60, 0x60, 0x60, 0x7E, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, - 10, // 0x47 'G' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x30,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x67,0x80,0x61,0x80,0x31,0x80,0x1F,0x80,0x00,0x00,0x00,0x00, + 10, // 0x47 'G' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x30, 0x80, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x67, 0x80, + 0x61, 0x80, 0x31, 0x80, 0x1F, 0x80, 0x00, 0x00, 0x00, 0x00, - 10, // 0x48 'H' - 0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x7F,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x00,0x00,0x00,0x00, + 10, // 0x48 'H' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x7F, 0x80, 0x61, 0x80, + 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x00, 0x00, 0x00, 0x00, - 6, // 0x49 'I' - 0x00,0x00,0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00, + 6, // 0x49 'I' + 0x00, 0x00, 0x00, 0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, - 7, // 0x4A 'J' - 0x00,0x00,0x00,0x7C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0xF8,0x00,0x00, + 7, // 0x4A 'J' + 0x00, 0x00, 0x00, 0x7C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0xF8, 0x00, 0x00, - 9, // 0x4B 'K' - 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x66,0x00,0x6C,0x00,0x78,0x00,0x70,0x00,0x78,0x00,0x6C,0x00,0x66,0x00,0x63,0x00,0x00,0x00,0x00,0x00, + 9, // 0x4B 'K' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x66, 0x00, 0x6C, 0x00, 0x78, 0x00, 0x70, 0x00, 0x78, 0x00, + 0x6C, 0x00, 0x66, 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x4C 'L' - 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x7F,0x00,0x00, + 8, // 0x4C 'L' + 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7F, 0x00, 0x00, - 11, // 0x4D 'M' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x71,0xC0,0x71,0xC0,0x5A,0xC0,0x5A,0xC0,0x4C,0xC0,0x4C,0xC0,0x40,0xC0,0x40,0xC0,0x00,0x00,0x00,0x00, + 11, // 0x4D 'M' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xC0, 0x71, 0xC0, 0x71, 0xC0, 0x5A, 0xC0, 0x5A, 0xC0, 0x4C, 0xC0, + 0x4C, 0xC0, 0x40, 0xC0, 0x40, 0xC0, 0x00, 0x00, 0x00, 0x00, - 10, // 0x4E 'N' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x80,0x70,0x80,0x58,0x80,0x58,0x80,0x4C,0x80,0x46,0x80,0x46,0x80,0x43,0x80,0x41,0x80,0x00,0x00,0x00,0x00, + 10, // 0x4E 'N' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x80, 0x70, 0x80, 0x58, 0x80, 0x58, 0x80, 0x4C, 0x80, 0x46, 0x80, + 0x46, 0x80, 0x43, 0x80, 0x41, 0x80, 0x00, 0x00, 0x00, 0x00, - 11, // 0x4F 'O' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00, + 11, // 0x4F 'O' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x31, 0x80, 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, + 0x60, 0xC0, 0x31, 0x80, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x50 'P' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00, + 9, // 0x50 'P' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x7E, 0x00, + 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x51 'Q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x06,0x00,0x03,0xC0, + 11, // 0x51 'Q' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x31, 0x80, 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, + 0x60, 0xC0, 0x31, 0x80, 0x1F, 0x00, 0x06, 0x00, 0x03, 0xC0, - 9, // 0x52 'R' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x6C,0x00,0x66,0x00,0x63,0x00,0x61,0x80,0x00,0x00,0x00,0x00, + 9, // 0x52 'R' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x7E, 0x00, 0x6C, 0x00, + 0x66, 0x00, 0x63, 0x00, 0x61, 0x80, 0x00, 0x00, 0x00, 0x00, - 9, // 0x53 'S' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x61,0x00,0x60,0x00,0x70,0x00,0x3E,0x00,0x07,0x00,0x03,0x00,0x43,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, + 9, // 0x53 'S' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x61, 0x00, 0x60, 0x00, 0x70, 0x00, 0x3E, 0x00, 0x07, 0x00, + 0x03, 0x00, 0x43, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x54 'T' - 0x00,0x00,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00, + 8, // 0x54 'T' + 0x00, 0x00, 0x00, 0xFF, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, - 10, // 0x55 'U' - 0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x3F,0x00,0x00,0x00,0x00,0x00, + 10, // 0x55 'U' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, + 0x61, 0x80, 0x61, 0x80, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x56 'V' - 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x1C,0x00,0x00,0x00,0x00,0x00, + 9, // 0x56 'V' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x36, 0x00, 0x36, 0x00, 0x36, 0x00, + 0x1C, 0x00, 0x1C, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, - 14, // 0x57 'W' - 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x18,0x63,0x18,0x63,0x18,0x33,0x30,0x37,0xB0,0x34,0xB0,0x1C,0xE0,0x18,0x60,0x18,0x60,0x00,0x00,0x00,0x00, + 14, // 0x57 'W' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x18, 0x63, 0x18, 0x63, 0x18, 0x33, 0x30, 0x37, 0xB0, 0x34, 0xB0, + 0x1C, 0xE0, 0x18, 0x60, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, - 9, // 0x58 'X' - 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x1C,0x00,0x36,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00, + 9, // 0x58 'X' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x63, 0x00, 0x36, 0x00, 0x1C, 0x00, 0x1C, 0x00, 0x1C, 0x00, + 0x36, 0x00, 0x63, 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x59 'Y' - 0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00, + 10, // 0x59 'Y' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x80, 0x61, 0x80, 0x33, 0x00, 0x1E, 0x00, 0x0C, 0x00, 0x0C, 0x00, + 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x5A 'Z' - 0x00,0x00,0x00,0x7E,0x0C,0x0C,0x18,0x18,0x30,0x30,0x60,0x7E,0x00,0x00, + 8, // 0x5A 'Z' + 0x00, 0x00, 0x00, 0x7E, 0x0C, 0x0C, 0x18, 0x18, 0x30, 0x30, 0x60, 0x7E, 0x00, 0x00, - 6, // 0x5B '[' - 0x00,0x00,0x78,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x78, + 6, // 0x5B '[' + 0x00, 0x00, 0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78, - 8, // 0x5C '\' - 0x00,0x00,0x60,0x60,0x30,0x30,0x30,0x18,0x18,0x0C,0x0C,0x0C,0x06,0x06, + 8, // 0x5C '\' + 0x00, 0x00, 0x60, 0x60, 0x30, 0x30, 0x30, 0x18, 0x18, 0x0C, 0x0C, 0x0C, 0x06, 0x06, - 6, // 0x5D ']' - 0x00,0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x78, + 6, // 0x5D ']' + 0x00, 0x00, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, - 10, // 0x5E '^' - 0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x5E '^' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x1E, 0x00, 0x33, 0x00, 0x61, 0x80, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x80, + 9, // 0x5F '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x80, - 9, // 0x60 '`' - 0x00,0x00,0x00,0x00,0x30,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x60 '`' + 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x06,0x3E,0x66,0x66,0x66,0x3E,0x00,0x00, + 8, // 0x61 'a' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x06, 0x3E, 0x66, 0x66, 0x66, 0x3E, 0x00, 0x00, - 8, // 0x62 'b' - 0x00,0x00,0x60,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x66,0x7C,0x00,0x00, + 8, // 0x62 'b' + 0x00, 0x00, 0x60, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x00, 0x00, - 7, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x62,0x60,0x60,0x60,0x62,0x3C,0x00,0x00, + 7, // 0x63 'c' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x62, 0x60, 0x60, 0x60, 0x62, 0x3C, 0x00, 0x00, - 8, // 0x64 'd' - 0x00,0x00,0x06,0x06,0x06,0x3E,0x66,0x66,0x66,0x66,0x66,0x3E,0x00,0x00, + 8, // 0x64 'd' + 0x00, 0x00, 0x06, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3E, 0x00, 0x00, - 8, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x66,0x7E,0x60,0x62,0x3C,0x00,0x00, + 8, // 0x65 'e' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x66, 0x66, 0x7E, 0x60, 0x62, 0x3C, 0x00, 0x00, - 5, // 0x66 'f' - 0x00,0x00,0x38,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00, + 5, // 0x66 'f' + 0x00, 0x00, 0x38, 0x60, 0x60, 0xF8, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, - 8, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x3E,0x66,0x66,0x66,0x66,0x66,0x3E,0x06,0x3C, + 8, // 0x67 'g' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3E, 0x06, 0x3C, - 8, // 0x68 'h' - 0x00,0x00,0x60,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00, + 8, // 0x68 'h' + 0x00, 0x00, 0x60, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, - 4, // 0x69 'i' - 0x00,0x00,0x60,0x60,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00, + 4, // 0x69 'i' + 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, - 5, // 0x6A 'j' - 0x00,0x00,0x30,0x30,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xE0, + 5, // 0x6A 'j' + 0x00, 0x00, 0x30, 0x30, 0x00, 0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xE0, - 8, // 0x6B 'k' - 0x00,0x00,0x60,0x60,0x60,0x66,0x6C,0x78,0x78,0x6C,0x66,0x63,0x00,0x00, + 8, // 0x6B 'k' + 0x00, 0x00, 0x60, 0x60, 0x60, 0x66, 0x6C, 0x78, 0x78, 0x6C, 0x66, 0x63, 0x00, 0x00, - 4, // 0x6C 'l' - 0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00, + 4, // 0x6C 'l' + 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, - 12, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6C,0xC0,0x77,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0x00,0x00,0x00,0x00, + 12, // 0x6D 'm' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0xC0, 0x77, 0x60, 0x66, 0x60, 0x66, 0x60, + 0x66, 0x60, 0x66, 0x60, 0x66, 0x60, 0x00, 0x00, 0x00, 0x00, - 8, // 0x6E 'n' - 0x00,0x00,0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00, + 8, // 0x6E 'n' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, - 8, // 0x6F 'o' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x66,0x3C,0x00,0x00, + 8, // 0x6F 'o' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00, 0x00, - 8, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x66,0x66,0x7C,0x60,0x60, + 8, // 0x70 'p' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, - 8, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x3E,0x66,0x66,0x66,0x66,0x66,0x3E,0x06,0x06, + 8, // 0x71 'q' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3E, 0x06, 0x06, - 6, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0x6C,0x7C,0x60,0x60,0x60,0x60,0x60,0x00,0x00, + 6, // 0x72 'r' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x7C, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, - 7, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x3C,0x60,0x60,0x38,0x0C,0x0C,0x78,0x00,0x00, + 7, // 0x73 's' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x60, 0x60, 0x38, 0x0C, 0x0C, 0x78, 0x00, 0x00, - 5, // 0x74 't' - 0x00,0x00,0x00,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x60,0x38,0x00,0x00, + 5, // 0x74 't' + 0x00, 0x00, 0x00, 0x60, 0x60, 0xF8, 0x60, 0x60, 0x60, 0x60, 0x60, 0x38, 0x00, 0x00, - 8, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x3E,0x00,0x00, + 8, // 0x75 'u' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3E, 0x00, 0x00, - 8, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x3C,0x3C,0x3C,0x18,0x00,0x00, + 8, // 0x76 'v' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3C, 0x3C, 0x3C, 0x18, 0x00, 0x00, - 12, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x60,0x66,0x60,0x66,0x60,0x69,0x60,0x39,0xC0,0x30,0xC0,0x30,0xC0,0x00,0x00,0x00,0x00, + 12, // 0x77 'w' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x60, 0x66, 0x60, 0x66, 0x60, 0x69, 0x60, + 0x39, 0xC0, 0x30, 0xC0, 0x30, 0xC0, 0x00, 0x00, 0x00, 0x00, - 8, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x3C,0x18,0x3C,0x66,0x66,0x00,0x00, + 8, // 0x78 'x' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x3C, 0x18, 0x3C, 0x66, 0x66, 0x00, 0x00, - 8, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x3C,0x3C,0x3C,0x18,0x18,0x30, + 8, // 0x79 'y' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3C, 0x3C, 0x3C, 0x18, 0x18, 0x30, - 7, // 0x7A 'z' - 0x00,0x00,0x00,0x00,0x00,0x7C,0x0C,0x18,0x38,0x30,0x60,0x7C,0x00,0x00, + 7, // 0x7A 'z' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x0C, 0x18, 0x38, 0x30, 0x60, 0x7C, 0x00, 0x00, - 9, // 0x7B '{' - 0x00,0x00,0x00,0x00,0x0E,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x70,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x0E,0x00, + 9, // 0x7B '{' + 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x70, 0x00, 0x18, 0x00, + 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x0E, 0x00, - 6, // 0x7C '|' - 0x00,0x00,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 6, // 0x7C '|' + 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, - 9, // 0x7D '}' - 0x00,0x00,0x00,0x00,0x38,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x07,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x38,0x00, + 9, // 0x7D '}' + 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x07, 0x00, 0x0C, 0x00, + 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x38, 0x00, - 10, // 0x7E '~' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x80,0x48,0x80,0x44,0x80,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x7E '~' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x80, 0x48, 0x80, 0x44, 0x80, + 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 12, // 0x7F '' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xE0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,0xE0,0x00,0x00,0x00,0x00, + 12, // 0x7F '' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xE0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x3F, 0xE0, 0x00, 0x00, 0x00, 0x00, - 0 -}; + 0}; -const int8u verdana16[] = -{ - 16, 4, 32, 128-32, - 0x00,0x00,0x11,0x00,0x22,0x00,0x33,0x00,0x54,0x00,0x65,0x00,0x86,0x00,0xA7,0x00,0xB8,0x00, - 0xC9,0x00,0xDA,0x00,0xFB,0x00,0x1C,0x01,0x2D,0x01,0x3E,0x01,0x4F,0x01,0x60,0x01,0x71,0x01, - 0x82,0x01,0x93,0x01,0xA4,0x01,0xB5,0x01,0xC6,0x01,0xD7,0x01,0xE8,0x01,0xF9,0x01,0x0A,0x02, - 0x1B,0x02,0x2C,0x02,0x4D,0x02,0x6E,0x02,0x8F,0x02,0xA0,0x02,0xC1,0x02,0xE2,0x02,0xF3,0x02, - 0x14,0x03,0x35,0x03,0x46,0x03,0x57,0x03,0x78,0x03,0x99,0x03,0xAA,0x03,0xBB,0x03,0xCC,0x03, - 0xDD,0x03,0xFE,0x03,0x1F,0x04,0x40,0x04,0x51,0x04,0x72,0x04,0x93,0x04,0xB4,0x04,0xD5,0x04, - 0xF6,0x04,0x17,0x05,0x38,0x05,0x59,0x05,0x7A,0x05,0x9B,0x05,0xAC,0x05,0xBD,0x05,0xCE,0x05, - 0xEF,0x05,0x00,0x06,0x11,0x06,0x22,0x06,0x33,0x06,0x44,0x06,0x55,0x06,0x66,0x06,0x77,0x06, - 0x88,0x06,0x99,0x06,0xAA,0x06,0xBB,0x06,0xCC,0x06,0xDD,0x06,0xFE,0x06,0x0F,0x07,0x20,0x07, - 0x31,0x07,0x42,0x07,0x53,0x07,0x64,0x07,0x75,0x07,0x86,0x07,0x97,0x07,0xB8,0x07,0xC9,0x07, - 0xDA,0x07,0xEB,0x07,0xFC,0x07,0x0D,0x08,0x1E,0x08,0x3F,0x08, +const int8u verdana16[] = { + 16, 4, 32, 128 - 32, 0x00, 0x00, 0x11, 0x00, 0x22, 0x00, 0x33, 0x00, 0x54, 0x00, 0x65, 0x00, 0x86, 0x00, + 0xA7, 0x00, 0xB8, 0x00, 0xC9, 0x00, 0xDA, 0x00, 0xFB, 0x00, 0x1C, 0x01, 0x2D, 0x01, 0x3E, 0x01, 0x4F, 0x01, + 0x60, 0x01, 0x71, 0x01, 0x82, 0x01, 0x93, 0x01, 0xA4, 0x01, 0xB5, 0x01, 0xC6, 0x01, 0xD7, 0x01, 0xE8, 0x01, + 0xF9, 0x01, 0x0A, 0x02, 0x1B, 0x02, 0x2C, 0x02, 0x4D, 0x02, 0x6E, 0x02, 0x8F, 0x02, 0xA0, 0x02, 0xC1, 0x02, + 0xE2, 0x02, 0xF3, 0x02, 0x14, 0x03, 0x35, 0x03, 0x46, 0x03, 0x57, 0x03, 0x78, 0x03, 0x99, 0x03, 0xAA, 0x03, + 0xBB, 0x03, 0xCC, 0x03, 0xDD, 0x03, 0xFE, 0x03, 0x1F, 0x04, 0x40, 0x04, 0x51, 0x04, 0x72, 0x04, 0x93, 0x04, + 0xB4, 0x04, 0xD5, 0x04, 0xF6, 0x04, 0x17, 0x05, 0x38, 0x05, 0x59, 0x05, 0x7A, 0x05, 0x9B, 0x05, 0xAC, 0x05, + 0xBD, 0x05, 0xCE, 0x05, 0xEF, 0x05, 0x00, 0x06, 0x11, 0x06, 0x22, 0x06, 0x33, 0x06, 0x44, 0x06, 0x55, 0x06, + 0x66, 0x06, 0x77, 0x06, 0x88, 0x06, 0x99, 0x06, 0xAA, 0x06, 0xBB, 0x06, 0xCC, 0x06, 0xDD, 0x06, 0xFE, 0x06, + 0x0F, 0x07, 0x20, 0x07, 0x31, 0x07, 0x42, 0x07, 0x53, 0x07, 0x64, 0x07, 0x75, 0x07, 0x86, 0x07, 0x97, 0x07, + 0xB8, 0x07, 0xC9, 0x07, 0xDA, 0x07, 0xEB, 0x07, 0xFC, 0x07, 0x0D, 0x08, 0x1E, 0x08, 0x3F, 0x08, - 5, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x21 '!' - 0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x20,0x00,0x00,0x00, + 5, // 0x21 '!' + 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, - 5, // 0x22 '"' - 0x00,0x00,0x00,0x50,0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x22 '"' + 0x00, 0x00, 0x00, 0x50, 0x50, 0x50, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x23 '#' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x09,0x00,0x3F,0x80,0x12,0x00,0x12,0x00,0x7F,0x00,0x24,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x23 '#' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x09, 0x00, 0x3F, 0x80, 0x12, 0x00, 0x12, 0x00, + 0x7F, 0x00, 0x24, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x24 '$' - 0x00,0x00,0x00,0x10,0x10,0x3E,0x50,0x50,0x30,0x1C,0x12,0x12,0x7C,0x10,0x10,0x00, + 8, // 0x24 '$' + 0x00, 0x00, 0x00, 0x10, 0x10, 0x3E, 0x50, 0x50, 0x30, 0x1C, 0x12, 0x12, 0x7C, 0x10, 0x10, 0x00, - 13, // 0x25 '%' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x44,0x80,0x45,0x00,0x45,0x00,0x3A,0xE0,0x05,0x10,0x05,0x10,0x09,0x10,0x10,0xE0,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x25 '%' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x40, 0x44, 0x80, 0x45, 0x00, 0x45, 0x00, 0x3A, 0xE0, + 0x05, 0x10, 0x05, 0x10, 0x09, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x26 '&' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x38,0x80,0x45,0x00,0x42,0x00,0x46,0x00,0x39,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x26 '&' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x44, 0x00, 0x44, 0x00, 0x44, 0x00, 0x38, 0x80, + 0x45, 0x00, 0x42, 0x00, 0x46, 0x00, 0x39, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 3, // 0x27 ''' - 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 3, // 0x27 ''' + 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x28 '(' - 0x00,0x00,0x00,0x08,0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10,0x08, + 6, // 0x28 '(' + 0x00, 0x00, 0x00, 0x08, 0x10, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x10, 0x08, - 6, // 0x29 ')' - 0x00,0x00,0x00,0x40,0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40, + 6, // 0x29 ')' + 0x00, 0x00, 0x00, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x10, 0x20, 0x40, - 9, // 0x2A '*' - 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x2A,0x00,0x1C,0x00,0x2A,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x2A '*' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x2A, 0x00, 0x1C, 0x00, 0x2A, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x7F,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x2B '+' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x7F, 0x00, + 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40,0x00, + 5, // 0x2C ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x40, 0x00, - 7, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2D '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00, + 5, // 0x2E '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, - 6, // 0x2F '/' - 0x00,0x00,0x00,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x00, + 6, // 0x2F '/' + 0x00, 0x00, 0x00, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, 0x00, - 8, // 0x30 '0' - 0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00,0x00, + 8, // 0x30 '0' + 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00, 0x00, - 8, // 0x31 '1' - 0x00,0x00,0x00,0x00,0x08,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00,0x00, + 8, // 0x31 '1' + 0x00, 0x00, 0x00, 0x00, 0x08, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00, 0x00, - 8, // 0x32 '2' - 0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x02,0x04,0x18,0x20,0x40,0x7E,0x00,0x00,0x00, + 8, // 0x32 '2' + 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x02, 0x04, 0x18, 0x20, 0x40, 0x7E, 0x00, 0x00, 0x00, - 8, // 0x33 '3' - 0x00,0x00,0x00,0x00,0x3C,0x42,0x02,0x02,0x1C,0x02,0x02,0x42,0x3C,0x00,0x00,0x00, + 8, // 0x33 '3' + 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x02, 0x02, 0x1C, 0x02, 0x02, 0x42, 0x3C, 0x00, 0x00, 0x00, - 8, // 0x34 '4' - 0x00,0x00,0x00,0x00,0x04,0x0C,0x14,0x24,0x44,0x7F,0x04,0x04,0x04,0x00,0x00,0x00, + 8, // 0x34 '4' + 0x00, 0x00, 0x00, 0x00, 0x04, 0x0C, 0x14, 0x24, 0x44, 0x7F, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, - 8, // 0x35 '5' - 0x00,0x00,0x00,0x00,0x3E,0x20,0x20,0x20,0x3C,0x02,0x02,0x42,0x3C,0x00,0x00,0x00, + 8, // 0x35 '5' + 0x00, 0x00, 0x00, 0x00, 0x3E, 0x20, 0x20, 0x20, 0x3C, 0x02, 0x02, 0x42, 0x3C, 0x00, 0x00, 0x00, - 8, // 0x36 '6' - 0x00,0x00,0x00,0x00,0x1C,0x20,0x40,0x7C,0x42,0x42,0x42,0x42,0x3C,0x00,0x00,0x00, + 8, // 0x36 '6' + 0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x40, 0x7C, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00, 0x00, - 8, // 0x37 '7' - 0x00,0x00,0x00,0x00,0x7E,0x02,0x04,0x04,0x08,0x08,0x10,0x10,0x10,0x00,0x00,0x00, + 8, // 0x37 '7' + 0x00, 0x00, 0x00, 0x00, 0x7E, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, - 8, // 0x38 '8' - 0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x3C,0x42,0x42,0x42,0x3C,0x00,0x00,0x00, + 8, // 0x38 '8' + 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x3C, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00, 0x00, - 8, // 0x39 '9' - 0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x3E,0x02,0x04,0x38,0x00,0x00,0x00, + 8, // 0x39 '9' + 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x42, 0x3E, 0x02, 0x04, 0x38, 0x00, 0x00, 0x00, - 6, // 0x3A ':' - 0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00, + 6, // 0x3A ':' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, - 6, // 0x3B ';' - 0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00,0x20,0x20,0x20,0x40,0x00, + 6, // 0x3B ';' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x40, 0x00, - 9, // 0x3C '<' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3C '<' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0C, 0x00, 0x30, 0x00, + 0x40, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3D '=' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x3E '>' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x01,0x00,0x06,0x00,0x18,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3E '>' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x18, 0x00, 0x06, 0x00, + 0x01, 0x00, 0x06, 0x00, 0x18, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x3F '?' - 0x00,0x00,0x00,0x00,0x38,0x44,0x04,0x08,0x10,0x10,0x00,0x10,0x10,0x00,0x00,0x00, + 7, // 0x3F '?' + 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x04, 0x08, 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, - 13, // 0x40 '@' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x10,0x40,0x27,0xA0,0x48,0x90,0x48,0x90,0x48,0x90,0x48,0x90,0x48,0x90,0x27,0xE0,0x10,0x00,0x0F,0x80,0x00,0x00, + 13, // 0x40 '@' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x80, 0x10, 0x40, 0x27, 0xA0, 0x48, 0x90, 0x48, 0x90, + 0x48, 0x90, 0x48, 0x90, 0x48, 0x90, 0x27, 0xE0, 0x10, 0x00, 0x0F, 0x80, 0x00, 0x00, - 9, // 0x41 'A' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x14,0x00,0x14,0x00,0x22,0x00,0x22,0x00,0x3E,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x41 'A' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x14, 0x00, 0x14, 0x00, 0x22, 0x00, + 0x22, 0x00, 0x3E, 0x00, 0x41, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x42 'B' - 0x00,0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x7C,0x42,0x42,0x42,0x7C,0x00,0x00,0x00, + 8, // 0x42 'B' + 0x00, 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x7C, 0x42, 0x42, 0x42, 0x7C, 0x00, 0x00, 0x00, - 9, // 0x43 'C' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x43 'C' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x21, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, + 0x40, 0x00, 0x40, 0x00, 0x21, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x44 'D' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x42,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x44 'D' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x42, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, + 0x41, 0x00, 0x41, 0x00, 0x42, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x45 'E' - 0x00,0x00,0x00,0x00,0x7E,0x40,0x40,0x40,0x7E,0x40,0x40,0x40,0x7E,0x00,0x00,0x00, + 8, // 0x45 'E' + 0x00, 0x00, 0x00, 0x00, 0x7E, 0x40, 0x40, 0x40, 0x7E, 0x40, 0x40, 0x40, 0x7E, 0x00, 0x00, 0x00, - 8, // 0x46 'F' - 0x00,0x00,0x00,0x00,0x7E,0x40,0x40,0x40,0x7C,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 8, // 0x46 'F' + 0x00, 0x00, 0x00, 0x00, 0x7E, 0x40, 0x40, 0x40, 0x7C, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, - 9, // 0x47 'G' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x47,0x00,0x41,0x00,0x21,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x47 'G' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x21, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, + 0x47, 0x00, 0x41, 0x00, 0x21, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x48 'H' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x7F,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x48 'H' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x7F, 0x00, + 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x49 'I' - 0x00,0x00,0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00, + 5, // 0x49 'I' + 0x00, 0x00, 0x00, 0x00, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, 0x00, - 6, // 0x4A 'J' - 0x00,0x00,0x00,0x00,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0xF0,0x00,0x00,0x00, + 6, // 0x4A 'J' + 0x00, 0x00, 0x00, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0xF0, 0x00, 0x00, 0x00, - 8, // 0x4B 'K' - 0x00,0x00,0x00,0x00,0x42,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x42,0x00,0x00,0x00, + 8, // 0x4B 'K' + 0x00, 0x00, 0x00, 0x00, 0x42, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x42, 0x00, 0x00, 0x00, - 7, // 0x4C 'L' - 0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7E,0x00,0x00,0x00, + 7, // 0x4C 'L' + 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7E, 0x00, 0x00, 0x00, - 11, // 0x4D 'M' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x51,0x40,0x51,0x40,0x4A,0x40,0x4A,0x40,0x44,0x40,0x44,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x4D 'M' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xC0, 0x60, 0xC0, 0x51, 0x40, 0x51, 0x40, 0x4A, 0x40, + 0x4A, 0x40, 0x44, 0x40, 0x44, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x4E 'N' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x00,0x61,0x00,0x51,0x00,0x51,0x00,0x49,0x00,0x45,0x00,0x45,0x00,0x43,0x00,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x4E 'N' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x61, 0x00, 0x51, 0x00, 0x51, 0x00, 0x49, 0x00, + 0x45, 0x00, 0x45, 0x00, 0x43, 0x00, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x4F 'O' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x4F 'O' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x21, 0x00, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, + 0x40, 0x80, 0x40, 0x80, 0x21, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x50 'P' - 0x00,0x00,0x00,0x00,0x7C,0x42,0x42,0x42,0x42,0x7C,0x40,0x40,0x40,0x00,0x00,0x00, + 8, // 0x50 'P' + 0x00, 0x00, 0x00, 0x00, 0x7C, 0x42, 0x42, 0x42, 0x42, 0x7C, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, - 10, // 0x51 'Q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x02,0x00,0x01,0x80,0x00,0x00, + 10, // 0x51 'Q' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x21, 0x00, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, + 0x40, 0x80, 0x40, 0x80, 0x21, 0x00, 0x1E, 0x00, 0x02, 0x00, 0x01, 0x80, 0x00, 0x00, - 9, // 0x52 'R' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x42,0x00,0x42,0x00,0x42,0x00,0x44,0x00,0x78,0x00,0x44,0x00,0x42,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x52 'R' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x44, 0x00, + 0x78, 0x00, 0x44, 0x00, 0x42, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x53 'S' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x41,0x00,0x40,0x00,0x40,0x00,0x3E,0x00,0x01,0x00,0x01,0x00,0x41,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x53 'S' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x41, 0x00, 0x40, 0x00, 0x40, 0x00, 0x3E, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x41, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x54 'T' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x54 'T' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, + 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x55 'U' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x55 'U' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, + 0x41, 0x00, 0x41, 0x00, 0x22, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x56 'V' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x22,0x00,0x14,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x56 'V' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x22, 0x00, 0x22, 0x00, + 0x14, 0x00, 0x14, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 13, // 0x57 'W' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x10,0x42,0x10,0x45,0x10,0x45,0x10,0x25,0x20,0x28,0xA0,0x28,0xA0,0x10,0x40,0x10,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x57 'W' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x10, 0x42, 0x10, 0x45, 0x10, 0x45, 0x10, 0x25, 0x20, + 0x28, 0xA0, 0x28, 0xA0, 0x10, 0x40, 0x10, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x58 'X' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x14,0x00,0x08,0x00,0x14,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x58 'X' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x41, 0x00, 0x22, 0x00, 0x14, 0x00, 0x08, 0x00, + 0x14, 0x00, 0x22, 0x00, 0x41, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x59 'Y' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x22,0x00,0x22,0x00,0x14,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x59 'Y' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x22, 0x00, 0x22, 0x00, 0x14, 0x00, 0x14, 0x00, + 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x5A 'Z' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x01,0x00,0x02,0x00,0x04,0x00,0x08,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x5A 'Z' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x08, 0x00, + 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x5B '[' - 0x00,0x00,0x00,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00, + 6, // 0x5B '[' + 0x00, 0x00, 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00, - 6, // 0x5C '\' - 0x00,0x00,0x00,0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00, + 6, // 0x5C '\' + 0x00, 0x00, 0x00, 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x00, - 6, // 0x5D ']' - 0x00,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70,0x00, + 6, // 0x5D ']' + 0x00, 0x00, 0x00, 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x70, 0x00, - 11, // 0x5E '^' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x0A,0x00,0x11,0x00,0x20,0x80,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x5E '^' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0A, 0x00, 0x11, 0x00, 0x20, 0x80, 0x40, 0x40, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00, + 8, // 0x5F '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, - 8, // 0x60 '`' - 0x00,0x00,0x00,0x10,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x60 '`' + 0x00, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x02,0x02,0x3E,0x42,0x42,0x3E,0x00,0x00,0x00, + 8, // 0x61 'a' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x02, 0x02, 0x3E, 0x42, 0x42, 0x3E, 0x00, 0x00, 0x00, - 8, // 0x62 'b' - 0x00,0x00,0x00,0x40,0x40,0x40,0x5C,0x62,0x42,0x42,0x42,0x42,0x7C,0x00,0x00,0x00, + 8, // 0x62 'b' + 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x5C, 0x62, 0x42, 0x42, 0x42, 0x42, 0x7C, 0x00, 0x00, 0x00, - 8, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x40,0x40,0x40,0x42,0x3C,0x00,0x00,0x00, + 8, // 0x63 'c' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x40, 0x40, 0x40, 0x42, 0x3C, 0x00, 0x00, 0x00, - 8, // 0x64 'd' - 0x00,0x00,0x00,0x02,0x02,0x02,0x3E,0x42,0x42,0x42,0x42,0x46,0x3A,0x00,0x00,0x00, + 8, // 0x64 'd' + 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x3E, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00, 0x00, - 8, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x7E,0x40,0x42,0x3C,0x00,0x00,0x00, + 8, // 0x65 'e' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x7E, 0x40, 0x42, 0x3C, 0x00, 0x00, 0x00, - 6, // 0x66 'f' - 0x00,0x00,0x00,0x1C,0x20,0x20,0x78,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00, + 6, // 0x66 'f' + 0x00, 0x00, 0x00, 0x1C, 0x20, 0x20, 0x78, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, - 8, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x42,0x42,0x42,0x42,0x46,0x3A,0x02,0x02,0x3C, + 8, // 0x67 'g' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x02, 0x02, 0x3C, - 8, // 0x68 'h' - 0x00,0x00,0x00,0x40,0x40,0x40,0x5C,0x62,0x42,0x42,0x42,0x42,0x42,0x00,0x00,0x00, + 8, // 0x68 'h' + 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x5C, 0x62, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, - 3, // 0x69 'i' - 0x00,0x00,0x00,0x40,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 3, // 0x69 'i' + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, - 4, // 0x6A 'j' - 0x00,0x00,0x00,0x20,0x00,0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xC0, + 4, // 0x6A 'j' + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xC0, - 7, // 0x6B 'k' - 0x00,0x00,0x00,0x40,0x40,0x40,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00,0x00, + 7, // 0x6B 'k' + 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x00, 0x00, 0x00, - 3, // 0x6C 'l' - 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 3, // 0x6C 'l' + 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, - 11, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x59,0x80,0x66,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x6D 'm' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x80, 0x66, 0x40, 0x44, 0x40, + 0x44, 0x40, 0x44, 0x40, 0x44, 0x40, 0x44, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x6E 'n' - 0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0x62,0x42,0x42,0x42,0x42,0x42,0x00,0x00,0x00, + 8, // 0x6E 'n' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x62, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, - 8, // 0x6F 'o' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00,0x00, + 8, // 0x6F 'o' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00, 0x00, - 8, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0x62,0x42,0x42,0x42,0x42,0x7C,0x40,0x40,0x40, + 8, // 0x70 'p' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x62, 0x42, 0x42, 0x42, 0x42, 0x7C, 0x40, 0x40, 0x40, - 8, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x42,0x42,0x42,0x42,0x46,0x3A,0x02,0x02,0x02, + 8, // 0x71 'q' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x02, 0x02, 0x02, - 5, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x60,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 5, // 0x72 'r' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x60, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, - 7, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x40,0x40,0x38,0x04,0x04,0x78,0x00,0x00,0x00, + 7, // 0x73 's' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x40, 0x40, 0x38, 0x04, 0x04, 0x78, 0x00, 0x00, 0x00, - 6, // 0x74 't' - 0x00,0x00,0x00,0x00,0x20,0x20,0x78,0x20,0x20,0x20,0x20,0x20,0x18,0x00,0x00,0x00, + 6, // 0x74 't' + 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x78, 0x20, 0x20, 0x20, 0x20, 0x20, 0x18, 0x00, 0x00, 0x00, - 8, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x46,0x3A,0x00,0x00,0x00, + 8, // 0x75 'u' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00, 0x00, - 8, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x24,0x24,0x24,0x18,0x18,0x00,0x00,0x00, + 8, // 0x76 'v' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x24, 0x24, 0x24, 0x18, 0x18, 0x00, 0x00, 0x00, - 11, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x40,0x44,0x40,0x2A,0x80,0x2A,0x80,0x2A,0x80,0x11,0x00,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x77 'w' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x40, 0x44, 0x40, 0x2A, 0x80, + 0x2A, 0x80, 0x2A, 0x80, 0x11, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00,0x00, + 7, // 0x78 'x' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x00, 0x00, 0x00, - 8, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x24,0x24,0x24,0x18,0x18,0x10,0x10,0x20, + 8, // 0x79 'y' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x24, 0x24, 0x24, 0x18, 0x18, 0x10, 0x10, 0x20, - 7, // 0x7A 'z' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00,0x00, + 7, // 0x7A 'z' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00, 0x00, 0x00, - 8, // 0x7B '{' - 0x00,0x00,0x00,0x0C,0x10,0x10,0x10,0x10,0x60,0x10,0x10,0x10,0x10,0x10,0x0C,0x00, + 8, // 0x7B '{' + 0x00, 0x00, 0x00, 0x0C, 0x10, 0x10, 0x10, 0x10, 0x60, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0C, 0x00, - 7, // 0x7C '|' - 0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00, + 7, // 0x7C '|' + 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, - 8, // 0x7D '}' - 0x00,0x00,0x00,0x30,0x08,0x08,0x08,0x08,0x06,0x08,0x08,0x08,0x08,0x08,0x30,0x00, + 8, // 0x7D '}' + 0x00, 0x00, 0x00, 0x30, 0x08, 0x08, 0x08, 0x08, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x30, 0x00, - 11, // 0x7E '~' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x80,0x4C,0x80,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x7E '~' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x80, 0x4C, 0x80, + 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 13, // 0x7F '' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF0,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x3F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x7F '' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xF0, 0x20, 0x10, 0x20, 0x10, 0x20, 0x10, 0x20, 0x10, 0x20, 0x10, + 0x20, 0x10, 0x20, 0x10, 0x20, 0x10, 0x3F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0 -}; + 0}; -const int8u verdana16_bold[] = -{ - 16, 4, 32, 128-32, - 0x00,0x00,0x11,0x00,0x22,0x00,0x33,0x00,0x54,0x00,0x75,0x00,0xA6,0x00,0xC7,0x00,0xD8,0x00, - 0xE9,0x00,0xFA,0x00,0x1B,0x01,0x3C,0x01,0x4D,0x01,0x5E,0x01,0x6F,0x01,0x90,0x01,0xB1,0x01, - 0xD2,0x01,0xF3,0x01,0x14,0x02,0x35,0x02,0x56,0x02,0x77,0x02,0x98,0x02,0xB9,0x02,0xDA,0x02, - 0xEB,0x02,0xFC,0x02,0x1D,0x03,0x3E,0x03,0x5F,0x03,0x70,0x03,0x91,0x03,0xB2,0x03,0xD3,0x03, - 0xF4,0x03,0x15,0x04,0x36,0x04,0x57,0x04,0x78,0x04,0x99,0x04,0xAA,0x04,0xBB,0x04,0xDC,0x04, - 0xED,0x04,0x0E,0x05,0x2F,0x05,0x50,0x05,0x71,0x05,0x92,0x05,0xB3,0x05,0xD4,0x05,0xE5,0x05, - 0x06,0x06,0x27,0x06,0x48,0x06,0x69,0x06,0x8A,0x06,0xAB,0x06,0xBC,0x06,0xDD,0x06,0xEE,0x06, - 0x0F,0x07,0x30,0x07,0x51,0x07,0x72,0x07,0x93,0x07,0xA4,0x07,0xC5,0x07,0xE6,0x07,0xF7,0x07, - 0x18,0x08,0x39,0x08,0x4A,0x08,0x5B,0x08,0x6C,0x08,0x7D,0x08,0x9E,0x08,0xBF,0x08,0xE0,0x08, - 0x01,0x09,0x22,0x09,0x33,0x09,0x44,0x09,0x55,0x09,0x76,0x09,0x97,0x09,0xB8,0x09,0xD9,0x09, - 0xFA,0x09,0x0B,0x0A,0x2C,0x0A,0x3D,0x0A,0x5E,0x0A,0x7F,0x0A, +const int8u verdana16_bold[] = { + 16, 4, 32, 128 - 32, 0x00, 0x00, 0x11, 0x00, 0x22, 0x00, 0x33, 0x00, 0x54, 0x00, 0x75, 0x00, 0xA6, 0x00, + 0xC7, 0x00, 0xD8, 0x00, 0xE9, 0x00, 0xFA, 0x00, 0x1B, 0x01, 0x3C, 0x01, 0x4D, 0x01, 0x5E, 0x01, 0x6F, 0x01, + 0x90, 0x01, 0xB1, 0x01, 0xD2, 0x01, 0xF3, 0x01, 0x14, 0x02, 0x35, 0x02, 0x56, 0x02, 0x77, 0x02, 0x98, 0x02, + 0xB9, 0x02, 0xDA, 0x02, 0xEB, 0x02, 0xFC, 0x02, 0x1D, 0x03, 0x3E, 0x03, 0x5F, 0x03, 0x70, 0x03, 0x91, 0x03, + 0xB2, 0x03, 0xD3, 0x03, 0xF4, 0x03, 0x15, 0x04, 0x36, 0x04, 0x57, 0x04, 0x78, 0x04, 0x99, 0x04, 0xAA, 0x04, + 0xBB, 0x04, 0xDC, 0x04, 0xED, 0x04, 0x0E, 0x05, 0x2F, 0x05, 0x50, 0x05, 0x71, 0x05, 0x92, 0x05, 0xB3, 0x05, + 0xD4, 0x05, 0xE5, 0x05, 0x06, 0x06, 0x27, 0x06, 0x48, 0x06, 0x69, 0x06, 0x8A, 0x06, 0xAB, 0x06, 0xBC, 0x06, + 0xDD, 0x06, 0xEE, 0x06, 0x0F, 0x07, 0x30, 0x07, 0x51, 0x07, 0x72, 0x07, 0x93, 0x07, 0xA4, 0x07, 0xC5, 0x07, + 0xE6, 0x07, 0xF7, 0x07, 0x18, 0x08, 0x39, 0x08, 0x4A, 0x08, 0x5B, 0x08, 0x6C, 0x08, 0x7D, 0x08, 0x9E, 0x08, + 0xBF, 0x08, 0xE0, 0x08, 0x01, 0x09, 0x22, 0x09, 0x33, 0x09, 0x44, 0x09, 0x55, 0x09, 0x76, 0x09, 0x97, 0x09, + 0xB8, 0x09, 0xD9, 0x09, 0xFA, 0x09, 0x0B, 0x0A, 0x2C, 0x0A, 0x3D, 0x0A, 0x5E, 0x0A, 0x7F, 0x0A, - 4, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x21 '!' - 0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00, + 6, // 0x21 '!' + 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, - 7, // 0x22 '"' - 0x00,0x00,0x00,0x6C,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x22 '"' + 0x00, 0x00, 0x00, 0x6C, 0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x23 '#' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x09,0x00,0x3F,0x80,0x3F,0x80,0x12,0x00,0x7F,0x00,0x7F,0x00,0x24,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x23 '#' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x09, 0x00, 0x3F, 0x80, 0x3F, 0x80, 0x12, 0x00, + 0x7F, 0x00, 0x7F, 0x00, 0x24, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x24 '$' - 0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x3E,0x00,0x69,0x00,0x68,0x00,0x78,0x00,0x3E,0x00,0x0F,0x00,0x0B,0x00,0x4B,0x00,0x3E,0x00,0x08,0x00,0x08,0x00,0x00,0x00, + 9, // 0x24 '$' + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x3E, 0x00, 0x69, 0x00, 0x68, 0x00, 0x78, 0x00, 0x3E, 0x00, + 0x0F, 0x00, 0x0B, 0x00, 0x4B, 0x00, 0x3E, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, - 17, // 0x25 '%' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x20,0x00,0x66,0x20,0x00,0x66,0x40,0x00,0x66,0x5E,0x00,0x66,0xB3,0x00,0x3D,0x33,0x00,0x01,0x33,0x00,0x02,0x33,0x00,0x02,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 17, // 0x25 '%' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x20, 0x00, 0x66, 0x20, 0x00, + 0x66, 0x40, 0x00, 0x66, 0x5E, 0x00, 0x66, 0xB3, 0x00, 0x3D, 0x33, 0x00, 0x01, 0x33, 0x00, 0x02, 0x33, 0x00, + 0x02, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x26 '&' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x66,0x00,0x66,0x00,0x66,0xC0,0x3C,0xC0,0x66,0x80,0x63,0x00,0x63,0x80,0x3C,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x26 '&' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x66, 0x00, 0x66, 0x00, 0x66, 0xC0, 0x3C, 0xC0, + 0x66, 0x80, 0x63, 0x00, 0x63, 0x80, 0x3C, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x27 ''' - 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x27 ''' + 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x28 '(' - 0x00,0x00,0x00,0x0C,0x18,0x30,0x30,0x60,0x60,0x60,0x60,0x60,0x30,0x30,0x18,0x0C, + 7, // 0x28 '(' + 0x00, 0x00, 0x00, 0x0C, 0x18, 0x30, 0x30, 0x60, 0x60, 0x60, 0x60, 0x60, 0x30, 0x30, 0x18, 0x0C, - 7, // 0x29 ')' - 0x00,0x00,0x00,0x60,0x30,0x18,0x18,0x0C,0x0C,0x0C,0x0C,0x0C,0x18,0x18,0x30,0x60, + 7, // 0x29 ')' + 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x18, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x18, 0x18, 0x30, 0x60, - 9, // 0x2A '*' - 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x49,0x00,0x2A,0x00,0x1C,0x00,0x2A,0x00,0x49,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x2A '*' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x49, 0x00, 0x2A, 0x00, 0x1C, 0x00, 0x2A, 0x00, 0x49, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x3F,0x80,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x2B '+' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x3F, 0x80, + 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x60,0x60,0xC0,0xC0, + 5, // 0x2C ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x60, 0x60, 0xC0, 0xC0, - 7, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2D '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00, + 5, // 0x2E '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, - 9, // 0x2F '/' - 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x30,0x00,0x60,0x00,0x60,0x00,0x00,0x00, + 9, // 0x2F '/' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x06, 0x00, 0x06, 0x00, 0x0C, 0x00, 0x0C, 0x00, + 0x18, 0x00, 0x18, 0x00, 0x30, 0x00, 0x30, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, - 9, // 0x30 '0' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x30 '0' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, + 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x31 '1' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x3C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x31 '1' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x3C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, + 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x32 '2' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x32 '2' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x63, 0x00, 0x63, 0x00, 0x03, 0x00, 0x06, 0x00, + 0x0C, 0x00, 0x18, 0x00, 0x30, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x33 '3' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x03,0x00,0x0E,0x00,0x03,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x33 '3' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x63, 0x00, 0x63, 0x00, 0x03, 0x00, 0x0E, 0x00, + 0x03, 0x00, 0x63, 0x00, 0x63, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x34 '4' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x0E,0x00,0x16,0x00,0x26,0x00,0x46,0x00,0x7F,0x80,0x06,0x00,0x06,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x34 '4' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0E, 0x00, 0x16, 0x00, 0x26, 0x00, 0x46, 0x00, + 0x7F, 0x80, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x35 '5' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x30,0x00,0x30,0x00,0x3E,0x00,0x03,0x00,0x03,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x35 '5' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x30, 0x00, 0x30, 0x00, 0x3E, 0x00, 0x03, 0x00, + 0x03, 0x00, 0x63, 0x00, 0x63, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x36 '6' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x30,0x00,0x60,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x36 '6' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x30, 0x00, 0x60, 0x00, 0x7E, 0x00, 0x63, 0x00, + 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x37 '7' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x37 '7' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x03, 0x00, 0x03, 0x00, 0x06, 0x00, 0x06, 0x00, + 0x0C, 0x00, 0x0C, 0x00, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x38 '8' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x38 '8' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x3E, 0x00, + 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x39 '9' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3F,0x00,0x03,0x00,0x06,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x39 '9' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, + 0x3F, 0x00, 0x03, 0x00, 0x06, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x3A ':' - 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00, + 5, // 0x3A ':' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, - 5, // 0x3B ';' - 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x38,0x30,0x30,0x60,0x60, + 5, // 0x3B ';' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x38, 0x30, 0x30, 0x60, 0x60, - 11, // 0x3C '<' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x03,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x3C '<' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x0C, 0x00, 0x30, 0x00, 0x40, 0x00, + 0x30, 0x00, 0x0C, 0x00, 0x03, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x80,0x00,0x00,0x00,0x00,0x3F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x3D '=' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x80, 0x00, 0x00, 0x00, 0x00, + 0x3F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x3E '>' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x18,0x00,0x06,0x00,0x01,0x80,0x00,0x40,0x01,0x80,0x06,0x00,0x18,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x3E '>' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x18, 0x00, 0x06, 0x00, 0x01, 0x80, 0x00, 0x40, + 0x01, 0x80, 0x06, 0x00, 0x18, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x3F '?' - 0x00,0x00,0x00,0x00,0x3C,0x66,0x06,0x0C,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00, + 8, // 0x3F '?' + 0x00, 0x00, 0x00, 0x00, 0x3C, 0x66, 0x06, 0x0C, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, - 13, // 0x40 '@' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x30,0x60,0x27,0xA0,0x4D,0x90,0x4D,0x90,0x4D,0x90,0x4D,0x90,0x27,0xE0,0x30,0x00,0x0F,0x80,0x00,0x00,0x00,0x00, + 13, // 0x40 '@' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x80, 0x30, 0x60, 0x27, 0xA0, 0x4D, 0x90, 0x4D, 0x90, + 0x4D, 0x90, 0x4D, 0x90, 0x27, 0xE0, 0x30, 0x00, 0x0F, 0x80, 0x00, 0x00, 0x00, 0x00, - 10, // 0x41 'A' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x0C,0x00,0x1E,0x00,0x1E,0x00,0x33,0x00,0x33,0x00,0x7F,0x80,0x61,0x80,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x41 'A' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x33, 0x00, + 0x33, 0x00, 0x7F, 0x80, 0x61, 0x80, 0x61, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x42 'B' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7F,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x42 'B' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x7F, 0x00, + 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x43 'C' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x61,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x61,0x80,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x43 'C' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x31, 0x80, 0x61, 0x80, 0x60, 0x00, 0x60, 0x00, + 0x60, 0x00, 0x61, 0x80, 0x31, 0x80, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x44 'D' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x44 'D' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x63, 0x00, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, + 0x61, 0x80, 0x61, 0x80, 0x63, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x45 'E' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x45 'E' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x7F, 0x00, + 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x46 'F' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x46 'F' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x7F, 0x00, + 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x47 'G' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x61,0x80,0x60,0x00,0x60,0x00,0x63,0x80,0x61,0x80,0x31,0x80,0x1F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x47 'G' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x31, 0x80, 0x61, 0x80, 0x60, 0x00, 0x60, 0x00, + 0x63, 0x80, 0x61, 0x80, 0x31, 0x80, 0x1F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x48 'H' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x7F,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x48 'H' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, 0x7F, 0xC0, + 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x49 'I' - 0x00,0x00,0x00,0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00, + 6, // 0x49 'I' + 0x00, 0x00, 0x00, 0x00, 0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, - 7, // 0x4A 'J' - 0x00,0x00,0x00,0x00,0x7C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0xF8,0x00,0x00,0x00, + 7, // 0x4A 'J' + 0x00, 0x00, 0x00, 0x00, 0x7C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0xF8, 0x00, 0x00, 0x00, - 9, // 0x4B 'K' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x66,0x00,0x6C,0x00,0x78,0x00,0x78,0x00,0x6C,0x00,0x66,0x00,0x63,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x4B 'K' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x66, 0x00, 0x6C, 0x00, 0x78, 0x00, 0x78, 0x00, + 0x6C, 0x00, 0x66, 0x00, 0x63, 0x00, 0x61, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x4C 'L' - 0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x7F,0x00,0x00,0x00, + 8, // 0x4C 'L' + 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7F, 0x00, 0x00, 0x00, - 12, // 0x4D 'M' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0xE0,0x70,0xE0,0x59,0x60,0x59,0x60,0x4E,0x60,0x4E,0x60,0x44,0x60,0x44,0x60,0x40,0x60,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x4D 'M' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xE0, 0x70, 0xE0, 0x59, 0x60, 0x59, 0x60, 0x4E, 0x60, + 0x4E, 0x60, 0x44, 0x60, 0x44, 0x60, 0x40, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x4E 'N' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x80,0x70,0x80,0x58,0x80,0x58,0x80,0x4C,0x80,0x46,0x80,0x46,0x80,0x43,0x80,0x43,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x4E 'N' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x80, 0x70, 0x80, 0x58, 0x80, 0x58, 0x80, 0x4C, 0x80, + 0x46, 0x80, 0x46, 0x80, 0x43, 0x80, 0x43, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x4F 'O' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x4F 'O' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x31, 0x80, 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, + 0x60, 0xC0, 0x60, 0xC0, 0x31, 0x80, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x50 'P' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x50 'P' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, + 0x7E, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x51 'Q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x03,0x00,0x01,0xC0,0x00,0x00, + 11, // 0x51 'Q' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x31, 0x80, 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, + 0x60, 0xC0, 0x60, 0xC0, 0x31, 0x80, 0x1F, 0x00, 0x03, 0x00, 0x01, 0xC0, 0x00, 0x00, - 9, // 0x52 'R' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x6C,0x00,0x66,0x00,0x63,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x52 'R' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x7E, 0x00, + 0x6C, 0x00, 0x66, 0x00, 0x63, 0x00, 0x61, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x53 'S' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x70,0x00,0x3E,0x00,0x07,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x53 'S' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x63, 0x00, 0x63, 0x00, 0x70, 0x00, 0x3E, 0x00, + 0x07, 0x00, 0x63, 0x00, 0x63, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x54 'T' - 0x00,0x00,0x00,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00, + 8, // 0x54 'T' + 0x00, 0x00, 0x00, 0x00, 0xFF, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, - 10, // 0x55 'U' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x55 'U' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, + 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x56 'V' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x00,0x33,0x00,0x1E,0x00,0x1E,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x56 'V' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x33, 0x00, 0x33, 0x00, + 0x1E, 0x00, 0x1E, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 14, // 0x57 'W' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x18,0x63,0x18,0x63,0x18,0x33,0x30,0x37,0xB0,0x34,0xB0,0x1C,0xE0,0x18,0x60,0x18,0x60,0x00,0x00,0x00,0x00,0x00,0x00, + 14, // 0x57 'W' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x18, 0x63, 0x18, 0x63, 0x18, 0x33, 0x30, 0x37, 0xB0, + 0x34, 0xB0, 0x1C, 0xE0, 0x18, 0x60, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x58 'X' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x33,0x00,0x33,0x00,0x1E,0x00,0x0C,0x00,0x1E,0x00,0x33,0x00,0x33,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x58 'X' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x80, 0x33, 0x00, 0x33, 0x00, 0x1E, 0x00, 0x0C, 0x00, + 0x1E, 0x00, 0x33, 0x00, 0x33, 0x00, 0x61, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x59 'Y' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x59 'Y' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x80, 0x61, 0x80, 0x33, 0x00, 0x1E, 0x00, 0x0C, 0x00, + 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x5A 'Z' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x30,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x5A 'Z' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x06, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x18, 0x00, + 0x18, 0x00, 0x30, 0x00, 0x30, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x5B '[' - 0x00,0x00,0x00,0x78,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x78,0x00, + 6, // 0x5B '[' + 0x00, 0x00, 0x00, 0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78, 0x00, - 9, // 0x5C '\' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x30,0x00,0x30,0x00,0x18,0x00,0x18,0x00,0x0C,0x00,0x0C,0x00,0x06,0x00,0x06,0x00,0x03,0x00,0x03,0x00,0x00,0x00, + 9, // 0x5C '\' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x30, 0x00, 0x30, 0x00, 0x18, 0x00, 0x18, 0x00, + 0x0C, 0x00, 0x0C, 0x00, 0x06, 0x00, 0x06, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, - 6, // 0x5D ']' - 0x00,0x00,0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x78,0x00, + 6, // 0x5D ']' + 0x00, 0x00, 0x00, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00, - 10, // 0x5E '^' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x5E '^' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x1E, 0x00, 0x33, 0x00, 0x61, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x80,0x00,0x00, + 9, // 0x5F '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x80, 0x00, 0x00, - 9, // 0x60 '`' - 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x60 '`' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x03,0x00,0x3F,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x61 'a' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x03, 0x00, 0x3F, 0x00, + 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x62 'b' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x6E,0x00,0x73,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x62 'b' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x6E, 0x00, 0x73, 0x00, 0x63, 0x00, + 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x63,0x60,0x60,0x60,0x63,0x3E,0x00,0x00,0x00, + 8, // 0x63 'c' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x63, 0x60, 0x60, 0x60, 0x63, 0x3E, 0x00, 0x00, 0x00, - 9, // 0x64 'd' - 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x3F,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x67,0x00,0x3B,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x64 'd' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x3F, 0x00, 0x63, 0x00, 0x63, 0x00, + 0x63, 0x00, 0x63, 0x00, 0x67, 0x00, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x7F,0x00,0x60,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x65 'e' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x63, 0x00, 0x63, 0x00, + 0x7F, 0x00, 0x60, 0x00, 0x63, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x66 'f' - 0x00,0x00,0x00,0x38,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, + 5, // 0x66 'f' + 0x00, 0x00, 0x00, 0x38, 0x60, 0x60, 0xF8, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, - 9, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x67,0x00,0x3B,0x00,0x03,0x00,0x03,0x00,0x3E,0x00, + 9, // 0x67 'g' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x63, 0x00, 0x63, 0x00, + 0x63, 0x00, 0x63, 0x00, 0x67, 0x00, 0x3B, 0x00, 0x03, 0x00, 0x03, 0x00, 0x3E, 0x00, - 9, // 0x68 'h' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x6E,0x00,0x73,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x68 'h' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x6E, 0x00, 0x73, 0x00, 0x63, 0x00, + 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x69 'i' - 0x00,0x00,0x00,0x60,0x60,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, + 4, // 0x69 'i' + 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, - 5, // 0x6A 'j' - 0x00,0x00,0x00,0x30,0x30,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xE0, + 5, // 0x6A 'j' + 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xE0, - 8, // 0x6B 'k' - 0x00,0x00,0x00,0x60,0x60,0x60,0x66,0x6C,0x78,0x78,0x6C,0x66,0x63,0x00,0x00,0x00, + 8, // 0x6B 'k' + 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x66, 0x6C, 0x78, 0x78, 0x6C, 0x66, 0x63, 0x00, 0x00, 0x00, - 4, // 0x6C 'l' - 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, + 4, // 0x6C 'l' + 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, - 14, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x70,0x73,0x98,0x63,0x18,0x63,0x18,0x63,0x18,0x63,0x18,0x63,0x18,0x00,0x00,0x00,0x00,0x00,0x00, + 14, // 0x6D 'm' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6E, 0x70, 0x73, 0x98, 0x63, 0x18, + 0x63, 0x18, 0x63, 0x18, 0x63, 0x18, 0x63, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x6E 'n' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x00,0x73,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x6E 'n' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6E, 0x00, 0x73, 0x00, 0x63, 0x00, + 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x6F 'o' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x6F 'o' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x63, 0x00, 0x63, 0x00, + 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x00,0x73,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x60,0x00,0x60,0x00,0x60,0x00, + 9, // 0x70 'p' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6E, 0x00, 0x73, 0x00, 0x63, 0x00, + 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x7E, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, - 9, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x67,0x00,0x3B,0x00,0x03,0x00,0x03,0x00,0x03,0x00, + 9, // 0x71 'q' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x63, 0x00, 0x63, 0x00, + 0x63, 0x00, 0x63, 0x00, 0x67, 0x00, 0x3B, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, - 6, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0x00,0x6C,0x7C,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, + 6, // 0x72 'r' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x7C, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, - 8, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x60,0x70,0x3C,0x0E,0x06,0x7C,0x00,0x00,0x00, + 8, // 0x73 's' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x60, 0x70, 0x3C, 0x0E, 0x06, 0x7C, 0x00, 0x00, 0x00, - 6, // 0x74 't' - 0x00,0x00,0x00,0x00,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x60,0x38,0x00,0x00,0x00, + 6, // 0x74 't' + 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0xF8, 0x60, 0x60, 0x60, 0x60, 0x60, 0x38, 0x00, 0x00, 0x00, - 9, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x67,0x00,0x3B,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x75 'u' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, + 0x63, 0x00, 0x63, 0x00, 0x67, 0x00, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x76 'v' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, + 0x36, 0x00, 0x36, 0x00, 0x1C, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 12, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x60,0x66,0x60,0x66,0x60,0x69,0x60,0x39,0xC0,0x30,0xC0,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x77 'w' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x60, 0x66, 0x60, 0x66, 0x60, + 0x69, 0x60, 0x39, 0xC0, 0x30, 0xC0, 0x30, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x1C,0x00,0x36,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x78 'x' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x63, 0x00, 0x36, 0x00, + 0x1C, 0x00, 0x36, 0x00, 0x63, 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00, + 9, // 0x79 'y' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, + 0x36, 0x00, 0x36, 0x00, 0x1C, 0x00, 0x1C, 0x00, 0x0C, 0x00, 0x18, 0x00, 0x18, 0x00, - 8, // 0x7A 'z' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x06,0x0C,0x18,0x30,0x60,0x7E,0x00,0x00,0x00, + 8, // 0x7A 'z' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x7E, 0x00, 0x00, 0x00, - 9, // 0x7B '{' - 0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x70,0x00,0x18,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x07,0x00,0x00,0x00, + 9, // 0x7B '{' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x18, 0x00, 0x70, 0x00, + 0x18, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x07, 0x00, 0x00, 0x00, - 8, // 0x7C '|' - 0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00, + 8, // 0x7C '|' + 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, - 9, // 0x7D '}' - 0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x0C,0x00,0x07,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x70,0x00,0x00,0x00, + 9, // 0x7D '}' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x0C, 0x00, 0x07, 0x00, + 0x0C, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x70, 0x00, 0x00, 0x00, - 11, // 0x7E '~' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x44,0x40,0x44,0x40,0x43,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x7E '~' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x40, 0x44, 0x40, + 0x44, 0x40, 0x43, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 13, // 0x7F '' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF0,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x3F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x7F '' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xF0, 0x20, 0x10, 0x20, 0x10, 0x20, 0x10, 0x20, 0x10, 0x20, 0x10, + 0x20, 0x10, 0x20, 0x10, 0x20, 0x10, 0x3F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0 -}; + 0}; -const int8u verdana17[] = -{ - 17, 4, 32, 128-32, - 0x00,0x00,0x12,0x00,0x24,0x00,0x36,0x00,0x59,0x00,0x7C,0x00,0x9F,0x00,0xC2,0x00,0xD4,0x00, - 0xE6,0x00,0xF8,0x00,0x1B,0x01,0x3E,0x01,0x50,0x01,0x62,0x01,0x74,0x01,0x86,0x01,0xA9,0x01, - 0xCC,0x01,0xEF,0x01,0x12,0x02,0x35,0x02,0x58,0x02,0x7B,0x02,0x9E,0x02,0xC1,0x02,0xE4,0x02, - 0xF6,0x02,0x08,0x03,0x2B,0x03,0x4E,0x03,0x71,0x03,0x83,0x03,0xA6,0x03,0xC9,0x03,0xEC,0x03, - 0x0F,0x04,0x32,0x04,0x55,0x04,0x67,0x04,0x8A,0x04,0xAD,0x04,0xBF,0x04,0xD1,0x04,0xF4,0x04, - 0x06,0x05,0x29,0x05,0x4C,0x05,0x6F,0x05,0x81,0x05,0xA4,0x05,0xC7,0x05,0xEA,0x05,0x0D,0x06, - 0x30,0x06,0x53,0x06,0x76,0x06,0x99,0x06,0xBC,0x06,0xDF,0x06,0xF1,0x06,0x03,0x07,0x15,0x07, - 0x38,0x07,0x5B,0x07,0x7E,0x07,0x90,0x07,0xB3,0x07,0xC5,0x07,0xE8,0x07,0xFA,0x07,0x0C,0x08, - 0x2F,0x08,0x52,0x08,0x64,0x08,0x76,0x08,0x88,0x08,0x9A,0x08,0xBD,0x08,0xE0,0x08,0x03,0x09, - 0x26,0x09,0x49,0x09,0x5B,0x09,0x6D,0x09,0x7F,0x09,0xA2,0x09,0xB4,0x09,0xD7,0x09,0xFA,0x09, - 0x0C,0x0A,0x1E,0x0A,0x41,0x0A,0x53,0x0A,0x76,0x0A,0x99,0x0A, +const int8u verdana17[] = { + 17, 4, 32, 128 - 32, 0x00, 0x00, 0x12, 0x00, 0x24, 0x00, 0x36, 0x00, 0x59, 0x00, 0x7C, 0x00, 0x9F, 0x00, + 0xC2, 0x00, 0xD4, 0x00, 0xE6, 0x00, 0xF8, 0x00, 0x1B, 0x01, 0x3E, 0x01, 0x50, 0x01, 0x62, 0x01, 0x74, 0x01, + 0x86, 0x01, 0xA9, 0x01, 0xCC, 0x01, 0xEF, 0x01, 0x12, 0x02, 0x35, 0x02, 0x58, 0x02, 0x7B, 0x02, 0x9E, 0x02, + 0xC1, 0x02, 0xE4, 0x02, 0xF6, 0x02, 0x08, 0x03, 0x2B, 0x03, 0x4E, 0x03, 0x71, 0x03, 0x83, 0x03, 0xA6, 0x03, + 0xC9, 0x03, 0xEC, 0x03, 0x0F, 0x04, 0x32, 0x04, 0x55, 0x04, 0x67, 0x04, 0x8A, 0x04, 0xAD, 0x04, 0xBF, 0x04, + 0xD1, 0x04, 0xF4, 0x04, 0x06, 0x05, 0x29, 0x05, 0x4C, 0x05, 0x6F, 0x05, 0x81, 0x05, 0xA4, 0x05, 0xC7, 0x05, + 0xEA, 0x05, 0x0D, 0x06, 0x30, 0x06, 0x53, 0x06, 0x76, 0x06, 0x99, 0x06, 0xBC, 0x06, 0xDF, 0x06, 0xF1, 0x06, + 0x03, 0x07, 0x15, 0x07, 0x38, 0x07, 0x5B, 0x07, 0x7E, 0x07, 0x90, 0x07, 0xB3, 0x07, 0xC5, 0x07, 0xE8, 0x07, + 0xFA, 0x07, 0x0C, 0x08, 0x2F, 0x08, 0x52, 0x08, 0x64, 0x08, 0x76, 0x08, 0x88, 0x08, 0x9A, 0x08, 0xBD, 0x08, + 0xE0, 0x08, 0x03, 0x09, 0x26, 0x09, 0x49, 0x09, 0x5B, 0x09, 0x6D, 0x09, 0x7F, 0x09, 0xA2, 0x09, 0xB4, 0x09, + 0xD7, 0x09, 0xFA, 0x09, 0x0C, 0x0A, 0x1E, 0x0A, 0x41, 0x0A, 0x53, 0x0A, 0x76, 0x0A, 0x99, 0x0A, - 5, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x21 '!' - 0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x20,0x00,0x00,0x00, + 6, // 0x21 '!' + 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, - 6, // 0x22 '"' - 0x00,0x00,0x00,0x48,0x48,0x48,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 6, // 0x22 '"' + 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x23 '#' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x80,0x04,0x80,0x09,0x00,0x3F,0xC0,0x09,0x00,0x12,0x00,0x7F,0x80,0x12,0x00,0x24,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x23 '#' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x80, 0x04, 0x80, 0x09, 0x00, 0x3F, 0xC0, 0x09, 0x00, + 0x12, 0x00, 0x7F, 0x80, 0x12, 0x00, 0x24, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x24 '$' - 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x3E,0x00,0x49,0x00,0x48,0x00,0x48,0x00,0x3E,0x00,0x09,0x00,0x09,0x00,0x49,0x00,0x3E,0x00,0x08,0x00,0x08,0x00,0x00,0x00, + 9, // 0x24 '$' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x3E, 0x00, 0x49, 0x00, 0x48, 0x00, 0x48, 0x00, + 0x3E, 0x00, 0x09, 0x00, 0x09, 0x00, 0x49, 0x00, 0x3E, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, - 15, // 0x25 '%' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x20,0x44,0x40,0x44,0x80,0x44,0x80,0x45,0x38,0x39,0x44,0x02,0x44,0x04,0x44,0x04,0x44,0x08,0x38,0x00,0x00,0x00,0x00,0x00,0x00, + 15, // 0x25 '%' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x20, 0x44, 0x40, 0x44, 0x80, 0x44, 0x80, 0x45, 0x38, + 0x39, 0x44, 0x02, 0x44, 0x04, 0x44, 0x04, 0x44, 0x08, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x26 '&' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x42,0x00,0x42,0x00,0x44,0x00,0x38,0x80,0x44,0x80,0x42,0x80,0x41,0x00,0x22,0x80,0x1C,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x26 '&' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x42, 0x00, 0x44, 0x00, 0x38, 0x80, + 0x44, 0x80, 0x42, 0x80, 0x41, 0x00, 0x22, 0x80, 0x1C, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x27 ''' - 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x27 ''' + 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x28 '(' - 0x00,0x00,0x00,0x08,0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10,0x08, + 6, // 0x28 '(' + 0x00, 0x00, 0x00, 0x08, 0x10, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x10, 0x08, - 6, // 0x29 ')' - 0x00,0x00,0x00,0x40,0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40, + 6, // 0x29 ')' + 0x00, 0x00, 0x00, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x10, 0x20, 0x40, - 9, // 0x2A '*' - 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x49,0x00,0x2A,0x00,0x1C,0x00,0x2A,0x00,0x49,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x2A '*' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x49, 0x00, 0x2A, 0x00, 0x1C, 0x00, 0x2A, 0x00, 0x49, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x7F,0xC0,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x2B '+' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, + 0x7F, 0xC0, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40,0x00, + 5, // 0x2C ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x40, 0x00, - 7, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2D '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00, + 5, // 0x2E '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, - 6, // 0x2F '/' - 0x00,0x00,0x00,0x04,0x08,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x40,0x40,0x80,0x80,0x00, + 6, // 0x2F '/' + 0x00, 0x00, 0x00, 0x04, 0x08, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, 0x00, - 9, // 0x30 '0' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x30 '0' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, + 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x22, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x31 '1' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x38,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x31 '1' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x38, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, + 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x32 '2' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x41,0x00,0x01,0x00,0x01,0x00,0x02,0x00,0x0C,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x32 '2' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x41, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x0C, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x33 '3' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x41,0x00,0x01,0x00,0x02,0x00,0x1C,0x00,0x02,0x00,0x01,0x00,0x01,0x00,0x42,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x33 '3' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x41, 0x00, 0x01, 0x00, 0x02, 0x00, 0x1C, 0x00, + 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, 0x42, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x34 '4' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x06,0x00,0x0A,0x00,0x12,0x00,0x22,0x00,0x42,0x00,0x7F,0x80,0x02,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x34 '4' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0A, 0x00, 0x12, 0x00, 0x22, 0x00, + 0x42, 0x00, 0x7F, 0x80, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x35 '5' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x7C,0x00,0x02,0x00,0x01,0x00,0x01,0x00,0x42,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x35 '5' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x7C, 0x00, + 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, 0x42, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x36 '6' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x30,0x00,0x20,0x00,0x40,0x00,0x7C,0x00,0x42,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x36 '6' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x30, 0x00, 0x20, 0x00, 0x40, 0x00, 0x7C, 0x00, + 0x42, 0x00, 0x41, 0x00, 0x41, 0x00, 0x22, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x37 '7' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x01,0x00,0x02,0x00,0x02,0x00,0x04,0x00,0x04,0x00,0x08,0x00,0x10,0x00,0x10,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x37 '7' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02, 0x00, 0x04, 0x00, + 0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x10, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x38 '8' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x3E,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x38 '8' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x3E, 0x00, + 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x39 '9' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x21,0x00,0x1F,0x00,0x01,0x00,0x02,0x00,0x06,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x39 '9' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x41, 0x00, 0x41, 0x00, 0x21, 0x00, + 0x1F, 0x00, 0x01, 0x00, 0x02, 0x00, 0x06, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x3A ':' - 0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00, + 6, // 0x3A ':' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, - 6, // 0x3B ';' - 0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40,0x00, + 6, // 0x3B ';' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x40, 0x00, - 11, // 0x3C '<' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x06,0x00,0x18,0x00,0x60,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x3C '<' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x06, 0x00, 0x18, 0x00, 0x60, 0x00, + 0x60, 0x00, 0x18, 0x00, 0x06, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xC0,0x00,0x00,0x00,0x00,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x3D '=' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xC0, + 0x00, 0x00, 0x00, 0x00, 0x3F, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x3E '>' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0xC0,0x00,0xC0,0x03,0x00,0x0C,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x3E '>' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x03, 0x00, 0x00, 0xC0, + 0x00, 0xC0, 0x03, 0x00, 0x0C, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x3F '?' - 0x00,0x00,0x00,0x00,0x3C,0x42,0x02,0x02,0x0C,0x10,0x10,0x00,0x10,0x10,0x00,0x00,0x00, + 8, // 0x3F '?' + 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x02, 0x02, 0x0C, 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, - 14, // 0x40 '@' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xC0,0x18,0x20,0x20,0x10,0x27,0xC8,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x27,0xF0,0x20,0x00,0x18,0x00,0x07,0xC0,0x00,0x00, + 14, // 0x40 '@' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xC0, 0x18, 0x20, 0x20, 0x10, 0x27, 0xC8, 0x48, 0x48, + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x27, 0xF0, 0x20, 0x00, 0x18, 0x00, 0x07, 0xC0, 0x00, 0x00, - 10, // 0x41 'A' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x12,0x00,0x12,0x00,0x21,0x00,0x21,0x00,0x21,0x00,0x7F,0x80,0x40,0x80,0x80,0x40,0x80,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x41 'A' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x12, 0x00, 0x12, 0x00, 0x21, 0x00, 0x21, 0x00, + 0x21, 0x00, 0x7F, 0x80, 0x40, 0x80, 0x80, 0x40, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x42 'B' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x7E,0x00,0x41,0x00,0x40,0x80,0x40,0x80,0x41,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x42 'B' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x7E, 0x00, + 0x41, 0x00, 0x40, 0x80, 0x40, 0x80, 0x41, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x43 'C' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0x80,0x20,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x20,0x00,0x30,0x80,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x43 'C' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x30, 0x80, 0x20, 0x00, 0x40, 0x00, 0x40, 0x00, + 0x40, 0x00, 0x40, 0x00, 0x20, 0x00, 0x30, 0x80, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x44 'D' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x41,0x80,0x40,0x80,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x80,0x41,0x80,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x44 'D' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x41, 0x80, 0x40, 0x80, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x80, 0x41, 0x80, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x45 'E' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x45 'E' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x7F, 0x00, + 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x46 'F' - 0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x7E,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 8, // 0x46 'F' + 0x00, 0x00, 0x00, 0x00, 0x7F, 0x40, 0x40, 0x40, 0x7E, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, - 11, // 0x47 'G' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x20,0x40,0x40,0x00,0x40,0x00,0x43,0xC0,0x40,0x40,0x20,0x40,0x30,0x40,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x47 'G' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x30, 0xC0, 0x20, 0x40, 0x40, 0x00, 0x40, 0x00, + 0x43, 0xC0, 0x40, 0x40, 0x20, 0x40, 0x30, 0x40, 0x0F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x48 'H' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x7F,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x48 'H' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, 0x7F, 0x80, + 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x49 'I' - 0x00,0x00,0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00, + 5, // 0x49 'I' + 0x00, 0x00, 0x00, 0x00, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, 0x00, - 6, // 0x4A 'J' - 0x00,0x00,0x00,0x00,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0xF0,0x00,0x00,0x00, + 6, // 0x4A 'J' + 0x00, 0x00, 0x00, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0xF0, 0x00, 0x00, 0x00, - 10, // 0x4B 'K' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x42,0x00,0x44,0x00,0x48,0x00,0x50,0x00,0x68,0x00,0x44,0x00,0x42,0x00,0x41,0x00,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x4B 'K' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x42, 0x00, 0x44, 0x00, 0x48, 0x00, 0x50, 0x00, + 0x68, 0x00, 0x44, 0x00, 0x42, 0x00, 0x41, 0x00, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x4C 'L' - 0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7F,0x00,0x00,0x00, + 8, // 0x4C 'L' + 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7F, 0x00, 0x00, 0x00, - 11, // 0x4D 'M' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x51,0x40,0x51,0x40,0x4A,0x40,0x4A,0x40,0x44,0x40,0x44,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x4D 'M' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xC0, 0x60, 0xC0, 0x51, 0x40, 0x51, 0x40, 0x4A, 0x40, + 0x4A, 0x40, 0x44, 0x40, 0x44, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x4E 'N' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x80,0x60,0x80,0x50,0x80,0x48,0x80,0x48,0x80,0x44,0x80,0x44,0x80,0x42,0x80,0x41,0x80,0x41,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x4E 'N' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x80, 0x60, 0x80, 0x50, 0x80, 0x48, 0x80, 0x48, 0x80, + 0x44, 0x80, 0x44, 0x80, 0x42, 0x80, 0x41, 0x80, 0x41, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x4F 'O' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x31,0x80,0x20,0x80,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x80,0x31,0x80,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x4F 'O' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x31, 0x80, 0x20, 0x80, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x20, 0x80, 0x31, 0x80, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x50 'P' - 0x00,0x00,0x00,0x00,0x7C,0x42,0x41,0x41,0x42,0x7C,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 8, // 0x50 'P' + 0x00, 0x00, 0x00, 0x00, 0x7C, 0x42, 0x41, 0x41, 0x42, 0x7C, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, - 11, // 0x51 'Q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x31,0x80,0x20,0x80,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x80,0x31,0x80,0x0E,0x00,0x02,0x00,0x02,0x00,0x01,0xC0, + 11, // 0x51 'Q' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x31, 0x80, 0x20, 0x80, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x20, 0x80, 0x31, 0x80, 0x0E, 0x00, 0x02, 0x00, 0x02, 0x00, 0x01, 0xC0, - 10, // 0x52 'R' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x42,0x00,0x42,0x00,0x42,0x00,0x44,0x00,0x78,0x00,0x44,0x00,0x42,0x00,0x41,0x00,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x52 'R' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x44, 0x00, + 0x78, 0x00, 0x44, 0x00, 0x42, 0x00, 0x41, 0x00, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x53 'S' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x20,0x80,0x40,0x00,0x40,0x00,0x38,0x00,0x07,0x00,0x00,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x53 'S' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x20, 0x80, 0x40, 0x00, 0x40, 0x00, 0x38, 0x00, + 0x07, 0x00, 0x00, 0x80, 0x40, 0x80, 0x21, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x54 'T' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x80,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x54 'T' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x80, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, + 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x55 'U' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x55 'U' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, + 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, 0x21, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x56 'V' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x40,0x80,0x40,0x40,0x80,0x40,0x80,0x21,0x00,0x21,0x00,0x21,0x00,0x12,0x00,0x12,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x56 'V' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x80, 0x40, 0x40, 0x80, 0x40, 0x80, 0x21, 0x00, + 0x21, 0x00, 0x21, 0x00, 0x12, 0x00, 0x12, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 15, // 0x57 'W' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x04,0x41,0x04,0x22,0x88,0x22,0x88,0x22,0x88,0x14,0x50,0x14,0x50,0x14,0x50,0x08,0x20,0x08,0x20,0x00,0x00,0x00,0x00,0x00,0x00, + 15, // 0x57 'W' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x04, 0x41, 0x04, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, + 0x14, 0x50, 0x14, 0x50, 0x14, 0x50, 0x08, 0x20, 0x08, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x58 'X' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x21,0x00,0x12,0x00,0x12,0x00,0x0C,0x00,0x0C,0x00,0x12,0x00,0x12,0x00,0x21,0x00,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x58 'X' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x21, 0x00, 0x12, 0x00, 0x12, 0x00, 0x0C, 0x00, + 0x0C, 0x00, 0x12, 0x00, 0x12, 0x00, 0x21, 0x00, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x59 'Y' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x41,0x00,0x22,0x00,0x22,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x59 'Y' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x41, 0x00, 0x22, 0x00, 0x22, 0x00, 0x14, 0x00, + 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x5A 'Z' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x00,0x80,0x01,0x00,0x02,0x00,0x04,0x00,0x08,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x5A 'Z' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x80, 0x00, 0x80, 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, + 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x7F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x5B '[' - 0x00,0x00,0x00,0x3C,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3C, + 6, // 0x5B '[' + 0x00, 0x00, 0x00, 0x3C, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3C, - 6, // 0x5C '\' - 0x00,0x00,0x00,0x80,0x40,0x40,0x40,0x20,0x20,0x10,0x10,0x10,0x08,0x08,0x08,0x04,0x00, + 6, // 0x5C '\' + 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x10, 0x08, 0x08, 0x08, 0x04, 0x00, - 6, // 0x5D ']' - 0x00,0x00,0x00,0x78,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x78, + 6, // 0x5D ']' + 0x00, 0x00, 0x00, 0x78, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x78, - 11, // 0x5E '^' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x0A,0x00,0x11,0x00,0x20,0x80,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x5E '^' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0A, 0x00, 0x11, 0x00, 0x20, 0x80, 0x40, 0x40, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x80,0x00,0x00, + 9, // 0x5F '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x80, 0x00, 0x00, - 9, // 0x60 '`' - 0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x60 '`' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x22,0x02,0x3E,0x42,0x42,0x46,0x3A,0x00,0x00,0x00, + 8, // 0x61 'a' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x22, 0x02, 0x3E, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00, 0x00, - 9, // 0x62 'b' - 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x5C,0x00,0x62,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x62 'b' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x5C, 0x00, 0x62, 0x00, 0x41, 0x00, + 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x42, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x22,0x40,0x40,0x40,0x40,0x22,0x1C,0x00,0x00,0x00, + 7, // 0x63 'c' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x22, 0x40, 0x40, 0x40, 0x40, 0x22, 0x1C, 0x00, 0x00, 0x00, - 9, // 0x64 'd' - 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x1F,0x00,0x21,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x23,0x00,0x1D,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x64 'd' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x1F, 0x00, 0x21, 0x00, 0x41, 0x00, + 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x23, 0x00, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x24,0x42,0x7E,0x40,0x40,0x22,0x1C,0x00,0x00,0x00, + 8, // 0x65 'e' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x42, 0x7E, 0x40, 0x40, 0x22, 0x1C, 0x00, 0x00, 0x00, - 6, // 0x66 'f' - 0x00,0x00,0x00,0x1C,0x20,0x20,0x7C,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00, + 6, // 0x66 'f' + 0x00, 0x00, 0x00, 0x1C, 0x20, 0x20, 0x7C, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, - 9, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x21,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x23,0x00,0x1D,0x00,0x01,0x00,0x22,0x00,0x1C,0x00, + 9, // 0x67 'g' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x21, 0x00, 0x41, 0x00, + 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x23, 0x00, 0x1D, 0x00, 0x01, 0x00, 0x22, 0x00, 0x1C, 0x00, - 9, // 0x68 'h' - 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x5E,0x00,0x61,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x68 'h' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x5E, 0x00, 0x61, 0x00, 0x41, 0x00, + 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 3, // 0x69 'i' - 0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 3, // 0x69 'i' + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, - 5, // 0x6A 'j' - 0x00,0x00,0x00,0x00,0x10,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xE0, + 5, // 0x6A 'j' + 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xE0, - 8, // 0x6B 'k' - 0x00,0x00,0x00,0x40,0x40,0x40,0x42,0x44,0x48,0x50,0x70,0x48,0x44,0x42,0x00,0x00,0x00, + 8, // 0x6B 'k' + 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x42, 0x44, 0x48, 0x50, 0x70, 0x48, 0x44, 0x42, 0x00, 0x00, 0x00, - 3, // 0x6C 'l' - 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 3, // 0x6C 'l' + 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, - 13, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0xE0,0x63,0x10,0x42,0x10,0x42,0x10,0x42,0x10,0x42,0x10,0x42,0x10,0x42,0x10,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x6D 'm' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0xE0, 0x63, 0x10, 0x42, 0x10, + 0x42, 0x10, 0x42, 0x10, 0x42, 0x10, 0x42, 0x10, 0x42, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x6E 'n' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5E,0x00,0x61,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x6E 'n' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5E, 0x00, 0x61, 0x00, 0x41, 0x00, + 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x6F 'o' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x6F 'o' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x22, 0x00, 0x41, 0x00, + 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x22, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0x00,0x62,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x40,0x00,0x40,0x00,0x40,0x00, + 9, // 0x70 'p' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x62, 0x00, 0x41, 0x00, + 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x42, 0x00, 0x7C, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, - 9, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x21,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x23,0x00,0x1D,0x00,0x01,0x00,0x01,0x00,0x01,0x00, + 9, // 0x71 'q' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x21, 0x00, 0x41, 0x00, + 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x23, 0x00, 0x1D, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, - 6, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 6, // 0x72 'r' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x60, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, - 8, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x40,0x30,0x0C,0x02,0x42,0x3C,0x00,0x00,0x00, + 8, // 0x73 's' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x40, 0x30, 0x0C, 0x02, 0x42, 0x3C, 0x00, 0x00, 0x00, - 6, // 0x74 't' - 0x00,0x00,0x00,0x00,0x20,0x20,0x7C,0x20,0x20,0x20,0x20,0x20,0x20,0x1C,0x00,0x00,0x00, + 6, // 0x74 't' + 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x7C, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x1C, 0x00, 0x00, 0x00, - 9, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x43,0x00,0x3D,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x75 'u' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, + 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x43, 0x00, 0x3D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x24,0x24,0x24,0x18,0x18,0x18,0x00,0x00,0x00, + 8, // 0x76 'v' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x24, 0x24, 0x24, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, - 11, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x40,0x44,0x40,0x2A,0x80,0x2A,0x80,0x2A,0x80,0x2A,0x80,0x11,0x00,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x77 'w' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x40, 0x44, 0x40, 0x2A, 0x80, + 0x2A, 0x80, 0x2A, 0x80, 0x2A, 0x80, 0x11, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x22,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x14,0x00,0x22,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x78 'x' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x22, 0x00, 0x14, 0x00, + 0x08, 0x00, 0x08, 0x00, 0x14, 0x00, 0x22, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x24,0x24,0x24,0x18,0x18,0x18,0x10,0x10,0x20, + 8, // 0x79 'y' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x24, 0x24, 0x24, 0x18, 0x18, 0x18, 0x10, 0x10, 0x20, - 8, // 0x7A 'z' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x02,0x04,0x08,0x10,0x20,0x40,0x7E,0x00,0x00,0x00, + 8, // 0x7A 'z' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7E, 0x00, 0x00, 0x00, - 9, // 0x7B '{' - 0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0x60,0x00,0x10,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x07,0x00, + 9, // 0x7B '{' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x10, 0x00, + 0x60, 0x00, 0x10, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x07, 0x00, - 6, // 0x7C '|' - 0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 6, // 0x7C '|' + 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 9, // 0x7D '}' - 0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x04,0x00,0x03,0x00,0x04,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x70,0x00, + 9, // 0x7D '}' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x04, 0x00, + 0x03, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x70, 0x00, - 11, // 0x7E '~' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x44,0x40,0x44,0x40,0x43,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x7E '~' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x40, + 0x44, 0x40, 0x44, 0x40, 0x43, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 14, // 0x7F '' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF8,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x3F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, + 14, // 0x7F '' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xF8, 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, + 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, 0x3F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0 -}; + 0}; -const int8u verdana17_bold[] = -{ - 17, 4, 32, 128-32, - 0x00,0x00,0x12,0x00,0x24,0x00,0x36,0x00,0x59,0x00,0x7C,0x00,0xB0,0x00,0xD3,0x00,0xE5,0x00, - 0xF7,0x00,0x09,0x01,0x2C,0x01,0x4F,0x01,0x61,0x01,0x73,0x01,0x85,0x01,0xA8,0x01,0xCB,0x01, - 0xEE,0x01,0x11,0x02,0x34,0x02,0x57,0x02,0x7A,0x02,0x9D,0x02,0xC0,0x02,0xE3,0x02,0x06,0x03, - 0x18,0x03,0x2A,0x03,0x4D,0x03,0x70,0x03,0x93,0x03,0xB6,0x03,0xD9,0x03,0xFC,0x03,0x1F,0x04, - 0x42,0x04,0x65,0x04,0x88,0x04,0xAB,0x04,0xCE,0x04,0xF1,0x04,0x03,0x05,0x15,0x05,0x38,0x05, - 0x5B,0x05,0x7E,0x05,0xA1,0x05,0xC4,0x05,0xE7,0x05,0x0A,0x06,0x2D,0x06,0x50,0x06,0x73,0x06, - 0x96,0x06,0xB9,0x06,0xDC,0x06,0xFF,0x06,0x22,0x07,0x45,0x07,0x57,0x07,0x7A,0x07,0x8C,0x07, - 0xAF,0x07,0xD2,0x07,0xF5,0x07,0x18,0x08,0x3B,0x08,0x4D,0x08,0x70,0x08,0x93,0x08,0xA5,0x08, - 0xC8,0x08,0xEB,0x08,0xFD,0x08,0x0F,0x09,0x32,0x09,0x44,0x09,0x67,0x09,0x8A,0x09,0xAD,0x09, - 0xD0,0x09,0xF3,0x09,0x05,0x0A,0x17,0x0A,0x29,0x0A,0x4C,0x0A,0x6F,0x0A,0x92,0x0A,0xB5,0x0A, - 0xD8,0x0A,0xEA,0x0A,0x0D,0x0B,0x1F,0x0B,0x42,0x0B,0x65,0x0B, +const int8u verdana17_bold[] = { + 17, 4, 32, 128 - 32, 0x00, 0x00, 0x12, 0x00, 0x24, 0x00, 0x36, 0x00, 0x59, 0x00, 0x7C, 0x00, 0xB0, 0x00, + 0xD3, 0x00, 0xE5, 0x00, 0xF7, 0x00, 0x09, 0x01, 0x2C, 0x01, 0x4F, 0x01, 0x61, 0x01, 0x73, 0x01, 0x85, 0x01, + 0xA8, 0x01, 0xCB, 0x01, 0xEE, 0x01, 0x11, 0x02, 0x34, 0x02, 0x57, 0x02, 0x7A, 0x02, 0x9D, 0x02, 0xC0, 0x02, + 0xE3, 0x02, 0x06, 0x03, 0x18, 0x03, 0x2A, 0x03, 0x4D, 0x03, 0x70, 0x03, 0x93, 0x03, 0xB6, 0x03, 0xD9, 0x03, + 0xFC, 0x03, 0x1F, 0x04, 0x42, 0x04, 0x65, 0x04, 0x88, 0x04, 0xAB, 0x04, 0xCE, 0x04, 0xF1, 0x04, 0x03, 0x05, + 0x15, 0x05, 0x38, 0x05, 0x5B, 0x05, 0x7E, 0x05, 0xA1, 0x05, 0xC4, 0x05, 0xE7, 0x05, 0x0A, 0x06, 0x2D, 0x06, + 0x50, 0x06, 0x73, 0x06, 0x96, 0x06, 0xB9, 0x06, 0xDC, 0x06, 0xFF, 0x06, 0x22, 0x07, 0x45, 0x07, 0x57, 0x07, + 0x7A, 0x07, 0x8C, 0x07, 0xAF, 0x07, 0xD2, 0x07, 0xF5, 0x07, 0x18, 0x08, 0x3B, 0x08, 0x4D, 0x08, 0x70, 0x08, + 0x93, 0x08, 0xA5, 0x08, 0xC8, 0x08, 0xEB, 0x08, 0xFD, 0x08, 0x0F, 0x09, 0x32, 0x09, 0x44, 0x09, 0x67, 0x09, + 0x8A, 0x09, 0xAD, 0x09, 0xD0, 0x09, 0xF3, 0x09, 0x05, 0x0A, 0x17, 0x0A, 0x29, 0x0A, 0x4C, 0x0A, 0x6F, 0x0A, + 0x92, 0x0A, 0xB5, 0x0A, 0xD8, 0x0A, 0xEA, 0x0A, 0x0D, 0x0B, 0x1F, 0x0B, 0x42, 0x0B, 0x65, 0x0B, - 5, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x21 '!' - 0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00, + 6, // 0x21 '!' + 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, - 8, // 0x22 '"' - 0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 8, // 0x22 '"' + 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 12, // 0x23 '#' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x40,0x04,0x40,0x3F,0xE0,0x3F,0xE0,0x08,0x80,0x11,0x00,0x7F,0xC0,0x7F,0xC0,0x22,0x00,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x23 '#' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x40, 0x04, 0x40, 0x3F, 0xE0, 0x3F, 0xE0, 0x08, 0x80, + 0x11, 0x00, 0x7F, 0xC0, 0x7F, 0xC0, 0x22, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x24 '$' - 0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x1F,0x00,0x34,0x80,0x64,0x00,0x74,0x00,0x3C,0x00,0x0F,0x00,0x0B,0x80,0x09,0x80,0x4B,0x00,0x3E,0x00,0x08,0x00,0x08,0x00,0x00,0x00, + 10, // 0x24 '$' + 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x1F, 0x00, 0x34, 0x80, 0x64, 0x00, 0x74, 0x00, 0x3C, 0x00, + 0x0F, 0x00, 0x0B, 0x80, 0x09, 0x80, 0x4B, 0x00, 0x3E, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, - 18, // 0x25 '%' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x08,0x00,0x66,0x10,0x00,0x66,0x20,0x00,0x66,0x2F,0x00,0x66,0x59,0x80,0x66,0x99,0x80,0x3D,0x19,0x80,0x01,0x19,0x80,0x02,0x19,0x80,0x04,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 18, // 0x25 '%' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x08, 0x00, 0x66, 0x10, 0x00, + 0x66, 0x20, 0x00, 0x66, 0x2F, 0x00, 0x66, 0x59, 0x80, 0x66, 0x99, 0x80, 0x3D, 0x19, 0x80, 0x01, 0x19, 0x80, + 0x02, 0x19, 0x80, 0x04, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 12, // 0x26 '&' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x33,0x00,0x36,0x00,0x1C,0x60,0x36,0x60,0x63,0x60,0x61,0xC0,0x31,0xC0,0x1F,0x60,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x26 '&' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x33, 0x00, 0x33, 0x00, 0x36, 0x00, 0x1C, 0x60, + 0x36, 0x60, 0x63, 0x60, 0x61, 0xC0, 0x31, 0xC0, 0x1F, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x27 ''' - 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x27 ''' + 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x28 '(' - 0x00,0x00,0x00,0x0C,0x18,0x30,0x30,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0x30,0x18,0x0C, + 8, // 0x28 '(' + 0x00, 0x00, 0x00, 0x0C, 0x18, 0x30, 0x30, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x30, 0x30, 0x18, 0x0C, - 8, // 0x29 ')' - 0x00,0x00,0x00,0x30,0x18,0x0C,0x0C,0x06,0x06,0x06,0x06,0x06,0x06,0x0C,0x0C,0x18,0x30, + 8, // 0x29 ')' + 0x00, 0x00, 0x00, 0x30, 0x18, 0x0C, 0x0C, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0C, 0x0C, 0x18, 0x30, - 10, // 0x2A '*' - 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x49,0x00,0x2A,0x00,0x1C,0x00,0x2A,0x00,0x49,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x2A '*' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x49, 0x00, 0x2A, 0x00, 0x1C, 0x00, 0x2A, 0x00, 0x49, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 12, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x7F,0xC0,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x2B '+' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, + 0x7F, 0xC0, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x60,0x60,0xC0,0xC0,0x00, + 5, // 0x2C ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x60, 0x60, 0xC0, 0xC0, 0x00, - 7, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2D '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x00, + 5, // 0x2E '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, - 10, // 0x2F '/' - 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x30,0x00,0x60,0x00,0x60,0x00,0x00,0x00, + 10, // 0x2F '/' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x01, 0x80, 0x03, 0x00, 0x03, 0x00, 0x06, 0x00, 0x06, 0x00, + 0x0C, 0x00, 0x18, 0x00, 0x18, 0x00, 0x30, 0x00, 0x30, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, - 10, // 0x30 '0' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x30 '0' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x33, 0x00, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, + 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x33, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x31 '1' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x3C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x31 '1' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x3C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, + 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x32 '2' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x61,0x80,0x61,0x80,0x01,0x80,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x32 '2' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x61, 0x80, 0x61, 0x80, 0x01, 0x80, 0x03, 0x00, + 0x06, 0x00, 0x0C, 0x00, 0x18, 0x00, 0x30, 0x00, 0x7F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x33 '3' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x61,0x80,0x61,0x80,0x01,0x80,0x0F,0x00,0x03,0x00,0x01,0x80,0x61,0x80,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x33 '3' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x61, 0x80, 0x61, 0x80, 0x01, 0x80, 0x0F, 0x00, + 0x03, 0x00, 0x01, 0x80, 0x61, 0x80, 0x63, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x34 '4' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x07,0x00,0x0B,0x00,0x13,0x00,0x23,0x00,0x43,0x00,0x7F,0xC0,0x03,0x00,0x03,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x34 '4' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x07, 0x00, 0x0B, 0x00, 0x13, 0x00, 0x23, 0x00, + 0x43, 0x00, 0x7F, 0xC0, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x35 '5' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x80,0x30,0x00,0x30,0x00,0x3E,0x00,0x03,0x00,0x01,0x80,0x01,0x80,0x61,0x80,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x35 '5' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x80, 0x30, 0x00, 0x30, 0x00, 0x3E, 0x00, 0x03, 0x00, + 0x01, 0x80, 0x01, 0x80, 0x61, 0x80, 0x63, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x36 '6' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x38,0x00,0x30,0x00,0x6E,0x00,0x73,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x36 '6' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x38, 0x00, 0x30, 0x00, 0x6E, 0x00, 0x73, 0x00, + 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x33, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x37 '7' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x01,0x80,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x37 '7' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x80, 0x01, 0x80, 0x03, 0x00, 0x03, 0x00, 0x06, 0x00, + 0x06, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x38 '8' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x3F,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x38 '8' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x3F, 0x00, + 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x39 '9' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x03,0x00,0x07,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x39 '9' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x33, 0x00, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, + 0x33, 0x80, 0x1D, 0x80, 0x03, 0x00, 0x07, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x3A ':' - 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x00, + 6, // 0x3A ':' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, - 6, // 0x3B ';' - 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x38,0x30,0x30,0x60,0x60,0x00, + 6, // 0x3B ';' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x00, 0x00, 0x38, 0x30, 0x30, 0x60, 0x60, 0x00, - 12, // 0x3C '<' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x03,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x3C '<' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x0C, 0x00, 0x30, 0x00, + 0x40, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x03, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 12, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x3D '=' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xC0, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x7F, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 12, // 0x3E '>' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x01,0x80,0x00,0x40,0x01,0x80,0x06,0x00,0x18,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x3E '>' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x18, 0x00, 0x06, 0x00, 0x01, 0x80, + 0x00, 0x40, 0x01, 0x80, 0x06, 0x00, 0x18, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x3F '?' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3F '?' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x63, 0x00, 0x03, 0x00, 0x06, 0x00, 0x0C, 0x00, + 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 14, // 0x40 '@' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xC0,0x18,0x20,0x20,0x10,0x27,0xC8,0x4C,0xC8,0x4C,0xC8,0x4C,0xC8,0x4C,0xC8,0x27,0xF0,0x20,0x00,0x18,0x00,0x07,0xC0,0x00,0x00, + 14, // 0x40 '@' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xC0, 0x18, 0x20, 0x20, 0x10, 0x27, 0xC8, 0x4C, 0xC8, + 0x4C, 0xC8, 0x4C, 0xC8, 0x4C, 0xC8, 0x27, 0xF0, 0x20, 0x00, 0x18, 0x00, 0x07, 0xC0, 0x00, 0x00, - 11, // 0x41 'A' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x1B,0x00,0x1B,0x00,0x31,0x80,0x3F,0x80,0x31,0x80,0x60,0xC0,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x41 'A' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x1B, 0x00, 0x1B, 0x00, + 0x31, 0x80, 0x3F, 0x80, 0x31, 0x80, 0x60, 0xC0, 0x60, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x42 'B' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x7F,0x00,0x61,0x80,0x60,0xC0,0x60,0xC0,0x61,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x42 'B' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x7F, 0x00, + 0x61, 0x80, 0x60, 0xC0, 0x60, 0xC0, 0x61, 0x80, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x43 'C' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x30,0xC0,0x30,0xC0,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x30,0xC0,0x30,0xC0,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x43 'C' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x80, 0x30, 0xC0, 0x30, 0xC0, 0x60, 0x00, 0x60, 0x00, + 0x60, 0x00, 0x60, 0x00, 0x30, 0xC0, 0x30, 0xC0, 0x0F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x44 'D' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x61,0x80,0x61,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x61,0x80,0x61,0x80,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x44 'D' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x61, 0x80, 0x61, 0x80, 0x60, 0xC0, 0x60, 0xC0, + 0x60, 0xC0, 0x60, 0xC0, 0x61, 0x80, 0x61, 0x80, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x45 'E' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x45 'E' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x80, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x7F, 0x80, + 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x7F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x46 'F' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x46 'F' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x7F, 0x00, + 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x47 'G' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x30,0xC0,0x30,0xC0,0x60,0x00,0x60,0x00,0x63,0xC0,0x60,0xC0,0x30,0xC0,0x30,0xC0,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x47 'G' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x80, 0x30, 0xC0, 0x30, 0xC0, 0x60, 0x00, 0x60, 0x00, + 0x63, 0xC0, 0x60, 0xC0, 0x30, 0xC0, 0x30, 0xC0, 0x0F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x48 'H' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x7F,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x48 'H' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, 0x7F, 0xC0, + 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x49 'I' - 0x00,0x00,0x00,0x00,0x7E,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x00,0x00,0x00, + 8, // 0x49 'I' + 0x00, 0x00, 0x00, 0x00, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00, 0x00, 0x00, - 8, // 0x4A 'J' - 0x00,0x00,0x00,0x00,0x3E,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x0C,0xF8,0x00,0x00,0x00, + 8, // 0x4A 'J' + 0x00, 0x00, 0x00, 0x00, 0x3E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0C, 0xF8, 0x00, 0x00, 0x00, - 11, // 0x4B 'K' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x61,0x80,0x63,0x00,0x66,0x00,0x6C,0x00,0x7C,0x00,0x76,0x00,0x63,0x00,0x61,0x80,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x4B 'K' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xC0, 0x61, 0x80, 0x63, 0x00, 0x66, 0x00, 0x6C, 0x00, + 0x7C, 0x00, 0x76, 0x00, 0x63, 0x00, 0x61, 0x80, 0x60, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x4C 'L' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x4C 'L' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, + 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x7F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 13, // 0x4D 'M' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x70,0x70,0x70,0x70,0xF0,0x58,0xB0,0x59,0xB0,0x4D,0x30,0x4F,0x30,0x46,0x30,0x46,0x30,0x40,0x30,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x4D 'M' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x70, 0x70, 0x70, 0x70, 0xF0, 0x58, 0xB0, 0x59, 0xB0, + 0x4D, 0x30, 0x4F, 0x30, 0x46, 0x30, 0x46, 0x30, 0x40, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x4E 'N' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x40,0x70,0x40,0x58,0x40,0x4C,0x40,0x4C,0x40,0x46,0x40,0x43,0x40,0x43,0x40,0x41,0xC0,0x40,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x4E 'N' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x40, 0x70, 0x40, 0x58, 0x40, 0x4C, 0x40, 0x4C, 0x40, + 0x46, 0x40, 0x43, 0x40, 0x43, 0x40, 0x41, 0xC0, 0x40, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 12, // 0x4F 'O' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x30,0xC0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0xC0,0x30,0xC0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x4F 'O' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x30, 0xC0, 0x30, 0xC0, 0x60, 0x60, 0x60, 0x60, + 0x60, 0x60, 0x60, 0x60, 0x30, 0xC0, 0x30, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x50 'P' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x50 'P' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x63, 0x00, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, + 0x63, 0x00, 0x7E, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 12, // 0x51 'Q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x30,0xC0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0xC0,0x30,0xC0,0x0F,0x80,0x03,0x00,0x03,0x00,0x01,0xE0, + 12, // 0x51 'Q' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x30, 0xC0, 0x30, 0xC0, 0x60, 0x60, 0x60, 0x60, + 0x60, 0x60, 0x60, 0x60, 0x30, 0xC0, 0x30, 0xC0, 0x0F, 0x80, 0x03, 0x00, 0x03, 0x00, 0x01, 0xE0, - 11, // 0x52 'R' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x61,0x80,0x60,0xC0,0x60,0xC0,0x61,0x80,0x7F,0x00,0x63,0x00,0x61,0x80,0x60,0xC0,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x52 'R' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x61, 0x80, 0x60, 0xC0, 0x60, 0xC0, 0x61, 0x80, + 0x7F, 0x00, 0x63, 0x00, 0x61, 0x80, 0x60, 0xC0, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x53 'S' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x61,0x80,0x60,0x00,0x3E,0x00,0x1F,0x00,0x01,0x80,0x61,0x80,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x53 'S' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x31, 0x80, 0x61, 0x80, 0x60, 0x00, 0x3E, 0x00, + 0x1F, 0x00, 0x01, 0x80, 0x61, 0x80, 0x63, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x54 'T' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x54 'T' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x80, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, + 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x55 'U' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x55 'U' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, + 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, 0x31, 0x80, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x56 'V' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x31,0x80,0x31,0x80,0x1B,0x00,0x1B,0x00,0x0E,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x56 'V' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, 0x31, 0x80, 0x31, 0x80, + 0x31, 0x80, 0x1B, 0x00, 0x1B, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 16, // 0x57 'W' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x86,0x61,0x86,0x63,0xC6,0x32,0x4C,0x36,0x6C,0x36,0x6C,0x34,0x2C,0x1C,0x38,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00, + 16, // 0x57 'W' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x86, 0x61, 0x86, 0x63, 0xC6, 0x32, 0x4C, 0x36, 0x6C, + 0x36, 0x6C, 0x34, 0x2C, 0x1C, 0x38, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x58 'X' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x31,0x80,0x31,0x80,0x1B,0x00,0x0E,0x00,0x0E,0x00,0x1B,0x00,0x31,0x80,0x31,0x80,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x58 'X' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xC0, 0x31, 0x80, 0x31, 0x80, 0x1B, 0x00, 0x0E, 0x00, + 0x0E, 0x00, 0x1B, 0x00, 0x31, 0x80, 0x31, 0x80, 0x60, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x59 'Y' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x59 'Y' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x61, 0x80, 0x61, 0x80, 0x33, 0x00, 0x1E, 0x00, + 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x5A 'Z' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x01,0x80,0x03,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x60,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x5A 'Z' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x80, 0x01, 0x80, 0x03, 0x00, 0x06, 0x00, 0x0C, 0x00, + 0x0C, 0x00, 0x18, 0x00, 0x30, 0x00, 0x60, 0x00, 0x7F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x5B '[' - 0x00,0x00,0x00,0x3E,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3E, + 8, // 0x5B '[' + 0x00, 0x00, 0x00, 0x3E, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3E, - 10, // 0x5C '\' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x30,0x00,0x30,0x00,0x18,0x00,0x18,0x00,0x0C,0x00,0x06,0x00,0x06,0x00,0x03,0x00,0x03,0x00,0x01,0x80,0x01,0x80,0x00,0x00, + 10, // 0x5C '\' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x30, 0x00, 0x30, 0x00, 0x18, 0x00, 0x18, 0x00, + 0x0C, 0x00, 0x06, 0x00, 0x06, 0x00, 0x03, 0x00, 0x03, 0x00, 0x01, 0x80, 0x01, 0x80, 0x00, 0x00, - 8, // 0x5D ']' - 0x00,0x00,0x00,0x7C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x7C, + 8, // 0x5D ']' + 0x00, 0x00, 0x00, 0x7C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x7C, - 12, // 0x5E '^' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x0E,0x00,0x1B,0x00,0x31,0x80,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x5E '^' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0E, 0x00, 0x1B, 0x00, 0x31, 0x80, 0x60, 0xC0, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xC0,0x00,0x00, + 10, // 0x5F '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xC0, 0x00, 0x00, - 10, // 0x60 '`' - 0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x60 '`' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x03,0x00,0x03,0x00,0x3F,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x61 'a' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x03, 0x00, 0x03, 0x00, + 0x3F, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x62 'b' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x6E,0x00,0x73,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x62 'b' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x6E, 0x00, 0x73, 0x00, 0x61, 0x80, + 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x63, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x33,0x60,0x60,0x60,0x60,0x33,0x1E,0x00,0x00,0x00, + 8, // 0x63 'c' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x33, 0x60, 0x60, 0x60, 0x60, 0x33, 0x1E, 0x00, 0x00, 0x00, - 10, // 0x64 'd' - 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x01,0x80,0x1F,0x80,0x31,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x64 'd' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x1F, 0x80, 0x31, 0x80, 0x61, 0x80, + 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x33, 0x80, 0x1D, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x63,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x33,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x65 'e' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x33, 0x00, 0x63, 0x00, + 0x7F, 0x00, 0x60, 0x00, 0x60, 0x00, 0x33, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x66 'f' - 0x00,0x00,0x00,0x1C,0x30,0x30,0x7C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00,0x00, + 6, // 0x66 'f' + 0x00, 0x00, 0x00, 0x1C, 0x30, 0x30, 0x7C, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, - 10, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x31,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x01,0x80,0x03,0x00,0x3E,0x00, + 10, // 0x67 'g' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x80, 0x31, 0x80, 0x61, 0x80, + 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x33, 0x80, 0x1D, 0x80, 0x01, 0x80, 0x03, 0x00, 0x3E, 0x00, - 10, // 0x68 'h' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x6F,0x00,0x71,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x68 'h' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x6F, 0x00, 0x71, 0x80, 0x61, 0x80, + 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x69 'i' - 0x00,0x00,0x00,0x60,0x60,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, + 4, // 0x69 'i' + 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, - 6, // 0x6A 'j' - 0x00,0x00,0x00,0x18,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF0, + 6, // 0x6A 'j' + 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xF0, - 9, // 0x6B 'k' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x63,0x00,0x66,0x00,0x6C,0x00,0x78,0x00,0x7C,0x00,0x66,0x00,0x63,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x6B 'k' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x63, 0x00, 0x66, 0x00, 0x6C, 0x00, + 0x78, 0x00, 0x7C, 0x00, 0x66, 0x00, 0x63, 0x00, 0x61, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x6C 'l' - 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, + 4, // 0x6C 'l' + 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, - 14, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x70,0x73,0x98,0x63,0x18,0x63,0x18,0x63,0x18,0x63,0x18,0x63,0x18,0x63,0x18,0x00,0x00,0x00,0x00,0x00,0x00, + 14, // 0x6D 'm' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6E, 0x70, 0x73, 0x98, 0x63, 0x18, + 0x63, 0x18, 0x63, 0x18, 0x63, 0x18, 0x63, 0x18, 0x63, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x6E 'n' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6F,0x00,0x71,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x6E 'n' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6F, 0x00, 0x71, 0x80, 0x61, 0x80, + 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x6F 'o' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x6F 'o' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x33, 0x00, 0x61, 0x80, + 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x33, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x00,0x73,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x60,0x00,0x60,0x00,0x60,0x00, + 10, // 0x70 'p' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6E, 0x00, 0x73, 0x00, 0x61, 0x80, + 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x63, 0x00, 0x7E, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, - 10, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x31,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x01,0x80,0x01,0x80,0x01,0x80, + 10, // 0x71 'q' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x80, 0x31, 0x80, 0x61, 0x80, + 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x33, 0x80, 0x1D, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, - 7, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x7E,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, + 7, // 0x72 'r' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6E, 0x7E, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, - 8, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x62,0x60,0x7C,0x3E,0x06,0x46,0x3C,0x00,0x00,0x00, + 8, // 0x73 's' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x62, 0x60, 0x7C, 0x3E, 0x06, 0x46, 0x3C, 0x00, 0x00, 0x00, - 6, // 0x74 't' - 0x00,0x00,0x00,0x00,0x60,0x60,0xFC,0x60,0x60,0x60,0x60,0x60,0x60,0x3C,0x00,0x00,0x00, + 6, // 0x74 't' + 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0xFC, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x3C, 0x00, 0x00, 0x00, - 10, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x80,0x3D,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x75 'u' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, + 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x63, 0x80, 0x3D, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x76 'v' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, + 0x36, 0x00, 0x36, 0x00, 0x36, 0x00, 0x1C, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 14, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x18,0x63,0x18,0x33,0x30,0x37,0xB0,0x34,0xB0,0x1C,0xE0,0x1C,0xE0,0x0C,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 14, // 0x77 'w' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x18, 0x63, 0x18, 0x33, 0x30, + 0x37, 0xB0, 0x34, 0xB0, 0x1C, 0xE0, 0x1C, 0xE0, 0x0C, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x36,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x78 'x' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x63, 0x00, 0x36, 0x00, + 0x1C, 0x00, 0x1C, 0x00, 0x36, 0x00, 0x63, 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00, + 9, // 0x79 'y' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, + 0x36, 0x00, 0x36, 0x00, 0x36, 0x00, 0x1C, 0x00, 0x1C, 0x00, 0x0C, 0x00, 0x18, 0x00, 0x18, 0x00, - 8, // 0x7A 'z' - 0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x06,0x0C,0x18,0x18,0x30,0x60,0x7E,0x00,0x00,0x00, + 8, // 0x7A 'z' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x06, 0x0C, 0x18, 0x18, 0x30, 0x60, 0x7E, 0x00, 0x00, 0x00, - 10, // 0x7B '{' - 0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x70,0x00,0x18,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x07,0x80, + 10, // 0x7B '{' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x18, 0x00, + 0x70, 0x00, 0x18, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x07, 0x80, - 8, // 0x7C '|' - 0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 8, // 0x7C '|' + 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 10, // 0x7D '}' - 0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x06,0x00,0x03,0x80,0x06,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x78,0x00, + 10, // 0x7D '}' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x06, 0x00, + 0x03, 0x80, 0x06, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x78, 0x00, - 12, // 0x7E '~' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x20,0x24,0x20,0x46,0x20,0x42,0x40,0x41,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x7E '~' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x20, 0x24, 0x20, + 0x46, 0x20, 0x42, 0x40, 0x41, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 14, // 0x7F '' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF8,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x3F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, + 14, // 0x7F '' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xF8, 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, + 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, 0x3F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0 -}; + 0}; -const int8u verdana18[] = -{ - 18, 4, 32, 128-32, - 0x00,0x00,0x13,0x00,0x26,0x00,0x39,0x00,0x5E,0x00,0x83,0x00,0xA8,0x00,0xCD,0x00,0xE0,0x00, - 0xF3,0x00,0x06,0x01,0x2B,0x01,0x50,0x01,0x63,0x01,0x76,0x01,0x89,0x01,0x9C,0x01,0xC1,0x01, - 0xE6,0x01,0x0B,0x02,0x30,0x02,0x55,0x02,0x7A,0x02,0x9F,0x02,0xC4,0x02,0xE9,0x02,0x0E,0x03, - 0x21,0x03,0x34,0x03,0x59,0x03,0x7E,0x03,0xA3,0x03,0xB6,0x03,0xDB,0x03,0x00,0x04,0x25,0x04, - 0x4A,0x04,0x6F,0x04,0x94,0x04,0xB9,0x04,0xDE,0x04,0x03,0x05,0x16,0x05,0x29,0x05,0x4E,0x05, - 0x61,0x05,0x86,0x05,0xAB,0x05,0xD0,0x05,0xF5,0x05,0x1A,0x06,0x3F,0x06,0x64,0x06,0x89,0x06, - 0xAE,0x06,0xD3,0x06,0xF8,0x06,0x1D,0x07,0x42,0x07,0x67,0x07,0x7A,0x07,0x8D,0x07,0xA0,0x07, - 0xC5,0x07,0xEA,0x07,0x0F,0x08,0x34,0x08,0x59,0x08,0x6C,0x08,0x91,0x08,0xB6,0x08,0xC9,0x08, - 0xEE,0x08,0x13,0x09,0x26,0x09,0x39,0x09,0x5E,0x09,0x71,0x09,0x96,0x09,0xBB,0x09,0xE0,0x09, - 0x05,0x0A,0x2A,0x0A,0x3D,0x0A,0x50,0x0A,0x63,0x0A,0x88,0x0A,0xAD,0x0A,0xD2,0x0A,0xF7,0x0A, - 0x1C,0x0B,0x41,0x0B,0x66,0x0B,0x79,0x0B,0x9E,0x0B,0xC3,0x0B, +const int8u verdana18[] = { + 18, 4, 32, 128 - 32, 0x00, 0x00, 0x13, 0x00, 0x26, 0x00, 0x39, 0x00, 0x5E, 0x00, 0x83, 0x00, 0xA8, 0x00, + 0xCD, 0x00, 0xE0, 0x00, 0xF3, 0x00, 0x06, 0x01, 0x2B, 0x01, 0x50, 0x01, 0x63, 0x01, 0x76, 0x01, 0x89, 0x01, + 0x9C, 0x01, 0xC1, 0x01, 0xE6, 0x01, 0x0B, 0x02, 0x30, 0x02, 0x55, 0x02, 0x7A, 0x02, 0x9F, 0x02, 0xC4, 0x02, + 0xE9, 0x02, 0x0E, 0x03, 0x21, 0x03, 0x34, 0x03, 0x59, 0x03, 0x7E, 0x03, 0xA3, 0x03, 0xB6, 0x03, 0xDB, 0x03, + 0x00, 0x04, 0x25, 0x04, 0x4A, 0x04, 0x6F, 0x04, 0x94, 0x04, 0xB9, 0x04, 0xDE, 0x04, 0x03, 0x05, 0x16, 0x05, + 0x29, 0x05, 0x4E, 0x05, 0x61, 0x05, 0x86, 0x05, 0xAB, 0x05, 0xD0, 0x05, 0xF5, 0x05, 0x1A, 0x06, 0x3F, 0x06, + 0x64, 0x06, 0x89, 0x06, 0xAE, 0x06, 0xD3, 0x06, 0xF8, 0x06, 0x1D, 0x07, 0x42, 0x07, 0x67, 0x07, 0x7A, 0x07, + 0x8D, 0x07, 0xA0, 0x07, 0xC5, 0x07, 0xEA, 0x07, 0x0F, 0x08, 0x34, 0x08, 0x59, 0x08, 0x6C, 0x08, 0x91, 0x08, + 0xB6, 0x08, 0xC9, 0x08, 0xEE, 0x08, 0x13, 0x09, 0x26, 0x09, 0x39, 0x09, 0x5E, 0x09, 0x71, 0x09, 0x96, 0x09, + 0xBB, 0x09, 0xE0, 0x09, 0x05, 0x0A, 0x2A, 0x0A, 0x3D, 0x0A, 0x50, 0x0A, 0x63, 0x0A, 0x88, 0x0A, 0xAD, 0x0A, + 0xD2, 0x0A, 0xF7, 0x0A, 0x1C, 0x0B, 0x41, 0x0B, 0x66, 0x0B, 0x79, 0x0B, 0x9E, 0x0B, 0xC3, 0x0B, - 5, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x21 '!' - 0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x20,0x00,0x00,0x00, + 6, // 0x21 '!' + 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, - 7, // 0x22 '"' - 0x00,0x00,0x00,0x48,0x48,0x48,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x22 '"' + 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 12, // 0x23 '#' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x80,0x04,0x80,0x09,0x00,0x3F,0xC0,0x09,0x00,0x11,0x00,0x12,0x00,0x7F,0x80,0x12,0x00,0x24,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x23 '#' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x80, 0x04, 0x80, 0x09, 0x00, 0x3F, 0xC0, 0x09, 0x00, + 0x11, 0x00, 0x12, 0x00, 0x7F, 0x80, 0x12, 0x00, 0x24, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x24 '$' - 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x3E,0x00,0x49,0x00,0x48,0x00,0x48,0x00,0x38,0x00,0x0E,0x00,0x09,0x00,0x09,0x00,0x49,0x00,0x3E,0x00,0x08,0x00,0x08,0x00,0x08,0x00, + 10, // 0x24 '$' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x3E, 0x00, 0x49, 0x00, 0x48, 0x00, 0x48, 0x00, + 0x38, 0x00, 0x0E, 0x00, 0x09, 0x00, 0x09, 0x00, 0x49, 0x00, 0x3E, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, - 16, // 0x25 '%' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x20,0x44,0x40,0x44,0x40,0x44,0x80,0x44,0x80,0x38,0x9C,0x01,0x22,0x01,0x22,0x02,0x22,0x02,0x22,0x04,0x1C,0x00,0x00,0x00,0x00,0x00,0x00, + 16, // 0x25 '%' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x20, 0x44, 0x40, 0x44, 0x40, 0x44, 0x80, 0x44, 0x80, + 0x38, 0x9C, 0x01, 0x22, 0x01, 0x22, 0x02, 0x22, 0x02, 0x22, 0x04, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 12, // 0x26 '&' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x21,0x00,0x21,0x00,0x1E,0x40,0x24,0x40,0x42,0x40,0x41,0x40,0x40,0x80,0x21,0x40,0x1E,0x20,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x26 '&' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x21, 0x00, 0x21, 0x00, 0x21, 0x00, 0x1E, 0x40, + 0x24, 0x40, 0x42, 0x40, 0x41, 0x40, 0x40, 0x80, 0x21, 0x40, 0x1E, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x27 ''' - 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 4, // 0x27 ''' + 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x28 '(' - 0x00,0x00,0x00,0x08,0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10,0x08, + 7, // 0x28 '(' + 0x00, 0x00, 0x00, 0x08, 0x10, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x10, 0x08, - 7, // 0x29 ')' - 0x00,0x00,0x00,0x20,0x10,0x08,0x08,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x08,0x08,0x10,0x20, + 7, // 0x29 ')' + 0x00, 0x00, 0x00, 0x20, 0x10, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x08, 0x08, 0x10, 0x20, - 10, // 0x2A '*' - 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x49,0x00,0x2A,0x00,0x1C,0x00,0x2A,0x00,0x49,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x2A '*' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x49, 0x00, 0x2A, 0x00, 0x1C, 0x00, 0x2A, 0x00, 0x49, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 12, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x3F,0xE0,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x2B '+' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, + 0x02, 0x00, 0x3F, 0xE0, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40,0x40, + 5, // 0x2C ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x40, 0x40, - 7, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2D '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00, + 5, // 0x2E '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, - 7, // 0x2F '/' - 0x00,0x00,0x00,0x02,0x04,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x80,0x00, + 7, // 0x2F '/' + 0x00, 0x00, 0x00, 0x02, 0x04, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x40, 0x80, 0x00, - 10, // 0x30 '0' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x30 '0' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x21, 0x00, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, + 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, 0x21, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x31 '1' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x1C,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x31 '1' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x1C, 0x00, 0x04, 0x00, 0x04, 0x00, + 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x32 '2' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x41,0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x01,0x00,0x02,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x32 '2' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x41, 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, + 0x01, 0x00, 0x02, 0x00, 0x0C, 0x00, 0x30, 0x00, 0x40, 0x00, 0x7F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x33 '3' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x40,0x80,0x00,0x80,0x01,0x00,0x0E,0x00,0x01,0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x41,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x33 '3' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x40, 0x80, 0x00, 0x80, 0x01, 0x00, 0x0E, 0x00, + 0x01, 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x41, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x34 '4' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x03,0x00,0x05,0x00,0x09,0x00,0x11,0x00,0x21,0x00,0x41,0x00,0x7F,0xC0,0x01,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x34 '4' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, 0x05, 0x00, 0x09, 0x00, 0x11, 0x00, + 0x21, 0x00, 0x41, 0x00, 0x7F, 0xC0, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x35 '5' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x80,0x20,0x00,0x20,0x00,0x20,0x00,0x3E,0x00,0x01,0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x41,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x35 '5' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x80, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x3E, 0x00, + 0x01, 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x41, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x36 '6' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x5E,0x00,0x61,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x36 '6' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x5E, 0x00, + 0x61, 0x00, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, 0x21, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x37 '7' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x01,0x00,0x02,0x00,0x02,0x00,0x04,0x00,0x04,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0x10,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x37 '7' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02, 0x00, 0x04, 0x00, + 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x10, 0x00, 0x10, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x38 '8' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x38 '8' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x21, 0x00, 0x40, 0x80, 0x40, 0x80, 0x21, 0x00, + 0x1E, 0x00, 0x21, 0x00, 0x40, 0x80, 0x40, 0x80, 0x21, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x39 '9' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x20,0x80,0x1F,0x80,0x00,0x80,0x01,0x00,0x02,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x39 '9' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x21, 0x00, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, + 0x20, 0x80, 0x1F, 0x80, 0x00, 0x80, 0x01, 0x00, 0x02, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x3A ':' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x00,0x00,0x00,0x00,0x10,0x10,0x00,0x00,0x00, + 7, // 0x3A ':' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, - 7, // 0x3B ';' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x20,0x20, + 7, // 0x3B ';' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x20, 0x20, - 12, // 0x3C '<' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x03,0x00,0x0C,0x00,0x30,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x3C '<' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x0C, 0x00, + 0x30, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x03, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 12, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xE0,0x00,0x00,0x00,0x00,0x3F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x3D '=' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xE0, + 0x00, 0x00, 0x00, 0x00, 0x3F, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 12, // 0x3E '>' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0xC0,0x00,0xC0,0x03,0x00,0x0C,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x3E '>' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x03, 0x00, + 0x00, 0xC0, 0x00, 0xC0, 0x03, 0x00, 0x0C, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x3F '?' - 0x00,0x00,0x00,0x00,0x3C,0x42,0x02,0x02,0x04,0x08,0x10,0x10,0x00,0x10,0x10,0x00,0x00,0x00, + 8, // 0x3F '?' + 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x02, 0x02, 0x04, 0x08, 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, - 15, // 0x40 '@' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x18,0x60,0x20,0x10,0x23,0xD0,0x44,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x44,0x48,0x23,0xF0,0x20,0x00,0x18,0x00,0x07,0xC0,0x00,0x00, + 15, // 0x40 '@' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x18, 0x60, 0x20, 0x10, 0x23, 0xD0, 0x44, 0x48, + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x44, 0x48, 0x23, 0xF0, 0x20, 0x00, 0x18, 0x00, 0x07, 0xC0, 0x00, 0x00, - 10, // 0x41 'A' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x12,0x00,0x12,0x00,0x12,0x00,0x21,0x00,0x21,0x00,0x40,0x80,0x7F,0x80,0x40,0x80,0x80,0x40,0x80,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x41 'A' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x12, 0x00, 0x12, 0x00, 0x12, 0x00, 0x21, 0x00, + 0x21, 0x00, 0x40, 0x80, 0x7F, 0x80, 0x40, 0x80, 0x80, 0x40, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x42 'B' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x7E,0x00,0x41,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x41,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x42 'B' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x7E, 0x00, + 0x41, 0x00, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, 0x41, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x43 'C' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x20,0x40,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x20,0x40,0x30,0xC0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x43 'C' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x30, 0xC0, 0x20, 0x40, 0x40, 0x00, 0x40, 0x00, + 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x20, 0x40, 0x30, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x44 'D' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x41,0x80,0x40,0x80,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x80,0x41,0x80,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x44 'D' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x41, 0x80, 0x40, 0x80, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x80, 0x41, 0x80, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x45 'E' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x45 'E' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x7F, 0x00, + 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x46 'F' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x40,0x00,0x40,0x00,0x40,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x46 'F' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x80, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x7F, 0x00, + 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 12, // 0x47 'G' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x30,0x60,0x20,0x20,0x40,0x00,0x40,0x00,0x41,0xE0,0x40,0x20,0x40,0x20,0x20,0x20,0x30,0x20,0x0F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x47 'G' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x80, 0x30, 0x60, 0x20, 0x20, 0x40, 0x00, 0x40, 0x00, + 0x41, 0xE0, 0x40, 0x20, 0x40, 0x20, 0x20, 0x20, 0x30, 0x20, 0x0F, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x48 'H' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7F,0xC0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x48 'H' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7F, 0xC0, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x49 'I' - 0x00,0x00,0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00, + 5, // 0x49 'I' + 0x00, 0x00, 0x00, 0x00, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, 0x00, - 7, // 0x4A 'J' - 0x00,0x00,0x00,0x00,0x3C,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x08,0xF0,0x00,0x00,0x00, + 7, // 0x4A 'J' + 0x00, 0x00, 0x00, 0x00, 0x3C, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x08, 0xF0, 0x00, 0x00, 0x00, - 10, // 0x4B 'K' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x41,0x00,0x42,0x00,0x44,0x00,0x48,0x00,0x50,0x00,0x68,0x00,0x44,0x00,0x42,0x00,0x41,0x00,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x4B 'K' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x41, 0x00, 0x42, 0x00, 0x44, 0x00, 0x48, 0x00, + 0x50, 0x00, 0x68, 0x00, 0x44, 0x00, 0x42, 0x00, 0x41, 0x00, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x4C 'L' - 0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7F,0x00,0x00,0x00, + 8, // 0x4C 'L' + 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7F, 0x00, 0x00, 0x00, - 13, // 0x4D 'M' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x30,0x50,0x50,0x50,0x50,0x48,0x90,0x48,0x90,0x45,0x10,0x45,0x10,0x42,0x10,0x42,0x10,0x40,0x10,0x40,0x10,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x4D 'M' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x50, 0x50, 0x50, 0x50, 0x48, 0x90, 0x48, 0x90, + 0x45, 0x10, 0x45, 0x10, 0x42, 0x10, 0x42, 0x10, 0x40, 0x10, 0x40, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x4E 'N' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x60,0x40,0x50,0x40,0x48,0x40,0x48,0x40,0x44,0x40,0x42,0x40,0x42,0x40,0x41,0x40,0x40,0xC0,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x4E 'N' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x60, 0x40, 0x50, 0x40, 0x48, 0x40, 0x48, 0x40, + 0x44, 0x40, 0x42, 0x40, 0x42, 0x40, 0x41, 0x40, 0x40, 0xC0, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 12, // 0x4F 'O' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x20,0x40,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x20,0x40,0x30,0xC0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x4F 'O' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x30, 0xC0, 0x20, 0x40, 0x40, 0x20, 0x40, 0x20, + 0x40, 0x20, 0x40, 0x20, 0x40, 0x20, 0x20, 0x40, 0x30, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x50 'P' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x41,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x41,0x00,0x7E,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x50 'P' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x41, 0x00, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, + 0x41, 0x00, 0x7E, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 12, // 0x51 'Q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x20,0x40,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x20,0x40,0x30,0xC0,0x0F,0x00,0x01,0x00,0x01,0x00,0x00,0xE0, + 12, // 0x51 'Q' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x30, 0xC0, 0x20, 0x40, 0x40, 0x20, 0x40, 0x20, + 0x40, 0x20, 0x40, 0x20, 0x40, 0x20, 0x20, 0x40, 0x30, 0xC0, 0x0F, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0xE0, - 10, // 0x52 'R' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x42,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x42,0x00,0x41,0x00,0x40,0x80,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x52 'R' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x42, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, + 0x42, 0x00, 0x7C, 0x00, 0x42, 0x00, 0x41, 0x00, 0x40, 0x80, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x53 'S' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x20,0x80,0x40,0x00,0x40,0x00,0x20,0x00,0x1E,0x00,0x01,0x00,0x00,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x53 'S' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x20, 0x80, 0x40, 0x00, 0x40, 0x00, 0x20, 0x00, + 0x1E, 0x00, 0x01, 0x00, 0x00, 0x80, 0x40, 0x80, 0x21, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x54 'T' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x80,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x54 'T' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x80, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, + 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x55 'U' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x55 'U' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x20, 0x80, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x56 'V' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x40,0x80,0x40,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x21,0x00,0x12,0x00,0x12,0x00,0x12,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x56 'V' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x80, 0x40, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, + 0x21, 0x00, 0x21, 0x00, 0x12, 0x00, 0x12, 0x00, 0x12, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 15, // 0x57 'W' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x04,0x41,0x04,0x22,0x88,0x22,0x88,0x22,0x88,0x12,0x90,0x14,0x50,0x14,0x50,0x14,0x50,0x08,0x20,0x08,0x20,0x00,0x00,0x00,0x00,0x00,0x00, + 15, // 0x57 'W' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x04, 0x41, 0x04, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, + 0x12, 0x90, 0x14, 0x50, 0x14, 0x50, 0x14, 0x50, 0x08, 0x20, 0x08, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x58 'X' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x21,0x00,0x21,0x00,0x12,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x12,0x00,0x21,0x00,0x21,0x00,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x58 'X' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x21, 0x00, 0x21, 0x00, 0x12, 0x00, 0x0C, 0x00, + 0x0C, 0x00, 0x0C, 0x00, 0x12, 0x00, 0x21, 0x00, 0x21, 0x00, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x59 'Y' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x41,0x00,0x22,0x00,0x22,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x59 'Y' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x41, 0x00, 0x22, 0x00, 0x22, 0x00, 0x14, 0x00, + 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x5A 'Z' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x00,0x80,0x01,0x00,0x02,0x00,0x04,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x5A 'Z' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x80, 0x00, 0x80, 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, + 0x08, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x7F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x5B '[' - 0x00,0x00,0x00,0x3C,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3C, + 7, // 0x5B '[' + 0x00, 0x00, 0x00, 0x3C, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3C, - 7, // 0x5C '\' - 0x00,0x00,0x00,0x80,0x40,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x04,0x02,0x00, + 7, // 0x5C '\' + 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x04, 0x02, 0x00, - 7, // 0x5D ']' - 0x00,0x00,0x00,0x78,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x78, + 7, // 0x5D ']' + 0x00, 0x00, 0x00, 0x78, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x78, - 12, // 0x5E '^' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x09,0x00,0x10,0x80,0x20,0x40,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x5E '^' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x09, 0x00, 0x10, 0x80, 0x20, 0x40, 0x40, 0x20, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xC0,0x00,0x00, + 10, // 0x5F '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xC0, 0x00, 0x00, - 10, // 0x60 '`' - 0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x60 '`' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x01,0x00,0x3F,0x00,0x41,0x00,0x41,0x00,0x43,0x00,0x3D,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x61 'a' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x21, 0x00, + 0x01, 0x00, 0x3F, 0x00, 0x41, 0x00, 0x41, 0x00, 0x43, 0x00, 0x3D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x62 'b' - 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x5C,0x00,0x62,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x62 'b' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x5C, 0x00, 0x62, 0x00, + 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x42, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x21,0x40,0x40,0x40,0x40,0x21,0x1E,0x00,0x00,0x00, + 8, // 0x63 'c' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x21, 0x40, 0x40, 0x40, 0x40, 0x21, 0x1E, 0x00, 0x00, 0x00, - 9, // 0x64 'd' - 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x1F,0x00,0x21,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x23,0x00,0x1D,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x64 'd' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x1F, 0x00, 0x21, 0x00, + 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x23, 0x00, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x65 'e' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x22, 0x00, + 0x41, 0x00, 0x7F, 0x00, 0x40, 0x00, 0x40, 0x00, 0x21, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x66 'f' - 0x00,0x00,0x00,0x1C,0x20,0x20,0x20,0x7C,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00, + 6, // 0x66 'f' + 0x00, 0x00, 0x00, 0x1C, 0x20, 0x20, 0x20, 0x7C, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, - 9, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x21,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x23,0x00,0x1D,0x00,0x01,0x00,0x22,0x00,0x1C,0x00, + 9, // 0x67 'g' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x21, 0x00, + 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x23, 0x00, 0x1D, 0x00, 0x01, 0x00, 0x22, 0x00, 0x1C, 0x00, - 9, // 0x68 'h' - 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x5E,0x00,0x61,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x68 'h' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x5E, 0x00, 0x61, 0x00, + 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 3, // 0x69 'i' - 0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 3, // 0x69 'i' + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, - 5, // 0x6A 'j' - 0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xE0, + 5, // 0x6A 'j' + 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xE0, - 9, // 0x6B 'k' - 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x42,0x00,0x44,0x00,0x48,0x00,0x50,0x00,0x68,0x00,0x44,0x00,0x42,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x6B 'k' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x42, 0x00, 0x44, 0x00, + 0x48, 0x00, 0x50, 0x00, 0x68, 0x00, 0x44, 0x00, 0x42, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 3, // 0x6C 'l' - 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 3, // 0x6C 'l' + 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, - 15, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2E,0x70,0x31,0x88,0x21,0x08,0x21,0x08,0x21,0x08,0x21,0x08,0x21,0x08,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00, + 15, // 0x6D 'm' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2E, 0x70, 0x31, 0x88, + 0x21, 0x08, 0x21, 0x08, 0x21, 0x08, 0x21, 0x08, 0x21, 0x08, 0x21, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x6E 'n' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5E,0x00,0x61,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x6E 'n' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5E, 0x00, 0x61, 0x00, + 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x6F 'o' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x6F 'o' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x21, 0x00, + 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, 0x21, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0x00,0x62,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x40,0x00,0x40,0x00,0x40,0x00, + 9, // 0x70 'p' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x62, 0x00, + 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x42, 0x00, 0x7C, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, - 9, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x21,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x23,0x00,0x1D,0x00,0x01,0x00,0x01,0x00,0x01,0x00, + 9, // 0x71 'q' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x21, 0x00, + 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x23, 0x00, 0x1D, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, - 6, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, + 6, // 0x72 'r' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x60, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, - 8, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x40,0x30,0x0C,0x02,0x42,0x3C,0x00,0x00,0x00, + 8, // 0x73 's' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x40, 0x30, 0x0C, 0x02, 0x42, 0x3C, 0x00, 0x00, 0x00, - 6, // 0x74 't' - 0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x7C,0x20,0x20,0x20,0x20,0x20,0x20,0x1C,0x00,0x00,0x00, + 6, // 0x74 't' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x7C, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x1C, 0x00, 0x00, 0x00, - 9, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x43,0x00,0x3D,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x75 'u' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x41, 0x00, + 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x43, 0x00, 0x3D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x22,0x00,0x22,0x00,0x14,0x00,0x14,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x76 'v' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x41, 0x00, + 0x22, 0x00, 0x22, 0x00, 0x22, 0x00, 0x14, 0x00, 0x14, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 13, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x10,0x42,0x10,0x25,0x20,0x25,0x20,0x28,0xA0,0x28,0xA0,0x10,0x40,0x10,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x77 'w' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x10, 0x42, 0x10, + 0x25, 0x20, 0x25, 0x20, 0x28, 0xA0, 0x28, 0xA0, 0x10, 0x40, 0x10, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x22,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x14,0x00,0x22,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x78 'x' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x22, 0x00, + 0x14, 0x00, 0x08, 0x00, 0x08, 0x00, 0x14, 0x00, 0x22, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x22,0x00,0x22,0x00,0x14,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0x10,0x00, + 9, // 0x79 'y' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x41, 0x00, + 0x22, 0x00, 0x22, 0x00, 0x22, 0x00, 0x14, 0x00, 0x14, 0x00, 0x08, 0x00, 0x08, 0x00, 0x10, 0x00, 0x10, 0x00, - 9, // 0x7A 'z' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x02,0x00,0x04,0x00,0x08,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x7A 'z' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x02, 0x00, + 0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x7B '{' - 0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0x60,0x00,0x10,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x07,0x00, + 10, // 0x7B '{' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, + 0x10, 0x00, 0x60, 0x00, 0x10, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x07, 0x00, - 7, // 0x7C '|' - 0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 7, // 0x7C '|' + 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 10, // 0x7D '}' - 0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x02,0x00,0x01,0x80,0x02,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x38,0x00, + 10, // 0x7D '}' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, + 0x02, 0x00, 0x01, 0x80, 0x02, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x38, 0x00, - 12, // 0x7E '~' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x20,0x24,0x20,0x42,0x40,0x41,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x7E '~' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x20, + 0x24, 0x20, 0x42, 0x40, 0x41, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 15, // 0x7F '' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF8,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x3F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, + 15, // 0x7F '' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xF8, 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, + 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, 0x3F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0 -}; + 0}; -const int8u verdana18_bold[] = -{ - 18, 4, 32, 128-32, - 0x00,0x00,0x13,0x00,0x26,0x00,0x4B,0x00,0x70,0x00,0x95,0x00,0xCC,0x00,0xF1,0x00,0x04,0x01, - 0x17,0x01,0x2A,0x01,0x4F,0x01,0x74,0x01,0x87,0x01,0x9A,0x01,0xAD,0x01,0xD2,0x01,0xF7,0x01, - 0x1C,0x02,0x41,0x02,0x66,0x02,0x8B,0x02,0xB0,0x02,0xD5,0x02,0xFA,0x02,0x1F,0x03,0x44,0x03, - 0x57,0x03,0x6A,0x03,0x8F,0x03,0xB4,0x03,0xD9,0x03,0xFE,0x03,0x23,0x04,0x48,0x04,0x6D,0x04, - 0x92,0x04,0xB7,0x04,0xDC,0x04,0x01,0x05,0x26,0x05,0x4B,0x05,0x5E,0x05,0x71,0x05,0x96,0x05, - 0xBB,0x05,0xE0,0x05,0x05,0x06,0x2A,0x06,0x4F,0x06,0x74,0x06,0x99,0x06,0xBE,0x06,0xE3,0x06, - 0x08,0x07,0x2D,0x07,0x52,0x07,0x77,0x07,0x9C,0x07,0xC1,0x07,0xD4,0x07,0xF9,0x07,0x0C,0x08, - 0x31,0x08,0x56,0x08,0x7B,0x08,0xA0,0x08,0xC5,0x08,0xD8,0x08,0xFD,0x08,0x22,0x09,0x35,0x09, - 0x5A,0x09,0x7F,0x09,0x92,0x09,0xA5,0x09,0xCA,0x09,0xDD,0x09,0x02,0x0A,0x27,0x0A,0x4C,0x0A, - 0x71,0x0A,0x96,0x0A,0xA9,0x0A,0xCE,0x0A,0xE1,0x0A,0x06,0x0B,0x2B,0x0B,0x50,0x0B,0x75,0x0B, - 0x9A,0x0B,0xBF,0x0B,0xE4,0x0B,0xF7,0x0B,0x1C,0x0C,0x41,0x0C, +const int8u verdana18_bold[] = { + 18, 4, 32, 128 - 32, 0x00, 0x00, 0x13, 0x00, 0x26, 0x00, 0x4B, 0x00, 0x70, 0x00, 0x95, 0x00, 0xCC, 0x00, + 0xF1, 0x00, 0x04, 0x01, 0x17, 0x01, 0x2A, 0x01, 0x4F, 0x01, 0x74, 0x01, 0x87, 0x01, 0x9A, 0x01, 0xAD, 0x01, + 0xD2, 0x01, 0xF7, 0x01, 0x1C, 0x02, 0x41, 0x02, 0x66, 0x02, 0x8B, 0x02, 0xB0, 0x02, 0xD5, 0x02, 0xFA, 0x02, + 0x1F, 0x03, 0x44, 0x03, 0x57, 0x03, 0x6A, 0x03, 0x8F, 0x03, 0xB4, 0x03, 0xD9, 0x03, 0xFE, 0x03, 0x23, 0x04, + 0x48, 0x04, 0x6D, 0x04, 0x92, 0x04, 0xB7, 0x04, 0xDC, 0x04, 0x01, 0x05, 0x26, 0x05, 0x4B, 0x05, 0x5E, 0x05, + 0x71, 0x05, 0x96, 0x05, 0xBB, 0x05, 0xE0, 0x05, 0x05, 0x06, 0x2A, 0x06, 0x4F, 0x06, 0x74, 0x06, 0x99, 0x06, + 0xBE, 0x06, 0xE3, 0x06, 0x08, 0x07, 0x2D, 0x07, 0x52, 0x07, 0x77, 0x07, 0x9C, 0x07, 0xC1, 0x07, 0xD4, 0x07, + 0xF9, 0x07, 0x0C, 0x08, 0x31, 0x08, 0x56, 0x08, 0x7B, 0x08, 0xA0, 0x08, 0xC5, 0x08, 0xD8, 0x08, 0xFD, 0x08, + 0x22, 0x09, 0x35, 0x09, 0x5A, 0x09, 0x7F, 0x09, 0x92, 0x09, 0xA5, 0x09, 0xCA, 0x09, 0xDD, 0x09, 0x02, 0x0A, + 0x27, 0x0A, 0x4C, 0x0A, 0x71, 0x0A, 0x96, 0x0A, 0xA9, 0x0A, 0xCE, 0x0A, 0xE1, 0x0A, 0x06, 0x0B, 0x2B, 0x0B, + 0x50, 0x0B, 0x75, 0x0B, 0x9A, 0x0B, 0xBF, 0x0B, 0xE4, 0x0B, 0xF7, 0x0B, 0x1C, 0x0C, 0x41, 0x0C, - 5, // 0x20 ' ' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x20 ' ' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x21 '!' - 0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00, + 6, // 0x21 '!' + 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, - 9, // 0x22 '"' - 0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x22 '"' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x36, 0x00, 0x36, 0x00, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 13, // 0x23 '#' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x20,0x04,0x20,0x08,0x40,0x3F,0xF0,0x3F,0xF0,0x08,0x40,0x10,0x80,0x7F,0xE0,0x7F,0xE0,0x21,0x00,0x21,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x23 '#' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x20, 0x04, 0x20, 0x08, 0x40, 0x3F, 0xF0, 0x3F, 0xF0, + 0x08, 0x40, 0x10, 0x80, 0x7F, 0xE0, 0x7F, 0xE0, 0x21, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x24 '$' - 0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x1F,0x80,0x34,0xC0,0x64,0xC0,0x64,0x00,0x3C,0x00,0x07,0x80,0x04,0xC0,0x64,0xC0,0x65,0x80,0x3F,0x00,0x04,0x00,0x04,0x00,0x00,0x00, + 11, // 0x24 '$' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x1F, 0x80, 0x34, 0xC0, 0x64, 0xC0, 0x64, 0x00, + 0x3C, 0x00, 0x07, 0x80, 0x04, 0xC0, 0x64, 0xC0, 0x65, 0x80, 0x3F, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, - 19, // 0x25 '%' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x08,0x00,0x63,0x10,0x00,0x63,0x10,0x00,0x63,0x20,0x00,0x63,0x2F,0x80,0x63,0x58,0xC0,0x3E,0x98,0xC0,0x00,0x98,0xC0,0x01,0x18,0xC0,0x01,0x18,0xC0,0x02,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 19, // 0x25 '%' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x08, 0x00, 0x63, 0x10, 0x00, + 0x63, 0x10, 0x00, 0x63, 0x20, 0x00, 0x63, 0x2F, 0x80, 0x63, 0x58, 0xC0, 0x3E, 0x98, 0xC0, 0x00, 0x98, 0xC0, + 0x01, 0x18, 0xC0, 0x01, 0x18, 0xC0, 0x02, 0x0F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 13, // 0x26 '&' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x33,0x00,0x33,0x00,0x1E,0x60,0x36,0x60,0x63,0x60,0x61,0xC0,0x60,0xC0,0x30,0xE0,0x1F,0x30,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x26 '&' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x33, 0x00, 0x33, 0x00, 0x33, 0x00, 0x1E, 0x60, + 0x36, 0x60, 0x63, 0x60, 0x61, 0xC0, 0x60, 0xC0, 0x30, 0xE0, 0x1F, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x27 ''' - 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 5, // 0x27 ''' + 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x28 '(' - 0x00,0x00,0x00,0x06,0x0C,0x18,0x30,0x30,0x60,0x60,0x60,0x60,0x60,0x30,0x30,0x18,0x0C,0x06, + 8, // 0x28 '(' + 0x00, 0x00, 0x00, 0x06, 0x0C, 0x18, 0x30, 0x30, 0x60, 0x60, 0x60, 0x60, 0x60, 0x30, 0x30, 0x18, 0x0C, 0x06, - 8, // 0x29 ')' - 0x00,0x00,0x00,0x60,0x30,0x18,0x0C,0x0C,0x06,0x06,0x06,0x06,0x06,0x0C,0x0C,0x18,0x30,0x60, + 8, // 0x29 ')' + 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0C, 0x0C, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0C, 0x0C, 0x18, 0x30, 0x60, - 11, // 0x2A '*' - 0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x24,0x80,0x15,0x00,0x0E,0x00,0x15,0x00,0x24,0x80,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x2A '*' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x24, 0x80, 0x15, 0x00, 0x0E, 0x00, 0x15, 0x00, 0x24, 0x80, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 13, // 0x2B '+' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x3F,0xE0,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x2B '+' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, + 0x3F, 0xE0, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x2C ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x60,0x60,0x60,0xC0,0xC0, + 5, // 0x2C ',' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x60, 0x60, 0x60, 0xC0, 0xC0, - 7, // 0x2D '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 7, // 0x2D '-' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 5, // 0x2E '.' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x00, + 5, // 0x2E '.' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, - 10, // 0x2F '/' - 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x30,0x00,0x60,0x00,0x60,0x00,0x00,0x00, + 10, // 0x2F '/' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x01, 0x80, 0x03, 0x00, 0x03, 0x00, 0x06, 0x00, 0x06, 0x00, + 0x0C, 0x00, 0x0C, 0x00, 0x18, 0x00, 0x18, 0x00, 0x30, 0x00, 0x30, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, - 11, // 0x30 '0' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x30 '0' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x31, 0x80, 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, + 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, 0x31, 0x80, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x31 '1' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x1E,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x1F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x31 '1' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x1E, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, + 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x1F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x32 '2' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x61,0x80,0x60,0xC0,0x00,0xC0,0x01,0x80,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x7F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x32 '2' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x61, 0x80, 0x60, 0xC0, 0x00, 0xC0, 0x01, 0x80, + 0x03, 0x00, 0x06, 0x00, 0x0C, 0x00, 0x18, 0x00, 0x30, 0x00, 0x7F, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x33 '3' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x61,0x80,0x60,0xC0,0x00,0xC0,0x01,0x80,0x0F,0x00,0x01,0x80,0x00,0xC0,0x60,0xC0,0x61,0x80,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x33 '3' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x61, 0x80, 0x60, 0xC0, 0x00, 0xC0, 0x01, 0x80, + 0x0F, 0x00, 0x01, 0x80, 0x00, 0xC0, 0x60, 0xC0, 0x61, 0x80, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x34 '4' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x03,0x80,0x05,0x80,0x09,0x80,0x11,0x80,0x21,0x80,0x41,0x80,0x7F,0xE0,0x01,0x80,0x01,0x80,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x34 '4' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x03, 0x80, 0x05, 0x80, 0x09, 0x80, 0x11, 0x80, + 0x21, 0x80, 0x41, 0x80, 0x7F, 0xE0, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x35 '5' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xC0,0x30,0x00,0x30,0x00,0x30,0x00,0x3F,0x00,0x01,0x80,0x00,0xC0,0x00,0xC0,0x60,0xC0,0x61,0x80,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x35 '5' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xC0, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x3F, 0x00, + 0x01, 0x80, 0x00, 0xC0, 0x00, 0xC0, 0x60, 0xC0, 0x61, 0x80, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x36 '6' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x18,0x00,0x30,0x00,0x60,0x00,0x6F,0x00,0x71,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x36 '6' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x80, 0x18, 0x00, 0x30, 0x00, 0x60, 0x00, 0x6F, 0x00, + 0x71, 0x80, 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, 0x31, 0x80, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x37 '7' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xC0,0x00,0xC0,0x01,0x80,0x01,0x80,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x37 '7' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xC0, 0x00, 0xC0, 0x01, 0x80, 0x01, 0x80, 0x03, 0x00, + 0x03, 0x00, 0x06, 0x00, 0x06, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x38 '8' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x38 '8' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x31, 0x80, 0x60, 0xC0, 0x60, 0xC0, 0x31, 0x80, + 0x1F, 0x00, 0x31, 0x80, 0x60, 0xC0, 0x60, 0xC0, 0x31, 0x80, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x39 '9' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0xC0,0x1E,0xC0,0x00,0xC0,0x01,0x80,0x03,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x39 '9' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x31, 0x80, 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, + 0x31, 0xC0, 0x1E, 0xC0, 0x00, 0xC0, 0x01, 0x80, 0x03, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x3A ':' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x00, + 6, // 0x3A ':' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, - 6, // 0x3B ';' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x38,0x30,0x30,0x30,0x60,0x60, + 6, // 0x3B ';' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x00, 0x00, 0x38, 0x30, 0x30, 0x30, 0x60, 0x60, - 13, // 0x3C '<' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0xC0,0x03,0x00,0x0C,0x00,0x30,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0xC0,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x3C '<' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0xC0, 0x03, 0x00, 0x0C, 0x00, + 0x30, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x03, 0x00, 0x00, 0xC0, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 13, // 0x3D '=' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x3D '=' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xE0, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3F, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 13, // 0x3E '>' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x18,0x00,0x06,0x00,0x01,0x80,0x00,0x60,0x00,0x60,0x01,0x80,0x06,0x00,0x18,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x3E '>' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x18, 0x00, 0x06, 0x00, 0x01, 0x80, + 0x00, 0x60, 0x00, 0x60, 0x01, 0x80, 0x06, 0x00, 0x18, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 9, // 0x3F '?' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x03,0x00,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x3F '?' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x63, 0x00, 0x03, 0x00, 0x03, 0x00, 0x06, 0x00, + 0x0C, 0x00, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 14, // 0x40 '@' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x18,0x60,0x20,0x10,0x27,0xD0,0x4C,0xC8,0x4C,0xC8,0x4C,0xC8,0x4C,0xC8,0x4C,0xC8,0x27,0xF0,0x20,0x00,0x18,0x00,0x07,0xC0,0x00,0x00, + 14, // 0x40 '@' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x18, 0x60, 0x20, 0x10, 0x27, 0xD0, 0x4C, 0xC8, + 0x4C, 0xC8, 0x4C, 0xC8, 0x4C, 0xC8, 0x4C, 0xC8, 0x27, 0xF0, 0x20, 0x00, 0x18, 0x00, 0x07, 0xC0, 0x00, 0x00, - 12, // 0x41 'A' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x0F,0x00,0x0F,0x00,0x19,0x80,0x19,0x80,0x30,0xC0,0x3F,0xC0,0x30,0xC0,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x41 'A' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x0F, 0x00, 0x0F, 0x00, 0x19, 0x80, + 0x19, 0x80, 0x30, 0xC0, 0x3F, 0xC0, 0x30, 0xC0, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x42 'B' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7F,0x00,0x61,0x80,0x60,0xC0,0x60,0xC0,0x61,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x42 'B' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x63, 0x00, + 0x7F, 0x00, 0x61, 0x80, 0x60, 0xC0, 0x60, 0xC0, 0x61, 0x80, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x43 'C' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x38,0xC0,0x30,0xC0,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x30,0xC0,0x38,0xC0,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x43 'C' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x80, 0x38, 0xC0, 0x30, 0xC0, 0x60, 0x00, 0x60, 0x00, + 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x30, 0xC0, 0x38, 0xC0, 0x0F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 12, // 0x44 'D' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x61,0xC0,0x60,0xC0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0xC0,0x61,0xC0,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x44 'D' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x61, 0xC0, 0x60, 0xC0, 0x60, 0x60, 0x60, 0x60, + 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0xC0, 0x61, 0xC0, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x45 'E' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x45 'E' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x80, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, + 0x7F, 0x80, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x7F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x46 'F' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x46 'F' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x80, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, + 0x7F, 0x80, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 12, // 0x47 'G' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xC0,0x38,0x60,0x30,0x60,0x60,0x00,0x60,0x00,0x63,0xE0,0x60,0x60,0x60,0x60,0x30,0x60,0x38,0x60,0x0F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x47 'G' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xC0, 0x38, 0x60, 0x30, 0x60, 0x60, 0x00, 0x60, 0x00, + 0x63, 0xE0, 0x60, 0x60, 0x60, 0x60, 0x30, 0x60, 0x38, 0x60, 0x0F, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 12, // 0x48 'H' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x7F,0xE0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x48 'H' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, + 0x7F, 0xE0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x49 'I' - 0x00,0x00,0x00,0x00,0x7E,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x00,0x00,0x00, + 8, // 0x49 'I' + 0x00, 0x00, 0x00, 0x00, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00, 0x00, 0x00, - 8, // 0x4A 'J' - 0x00,0x00,0x00,0x00,0x3E,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x0C,0xF8,0x00,0x00,0x00, + 8, // 0x4A 'J' + 0x00, 0x00, 0x00, 0x00, 0x3E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0C, 0xF8, 0x00, 0x00, 0x00, - 12, // 0x4B 'K' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0xC0,0x61,0x80,0x63,0x00,0x66,0x00,0x6C,0x00,0x7E,0x00,0x73,0x00,0x61,0x80,0x60,0xC0,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x4B 'K' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0xC0, 0x61, 0x80, 0x63, 0x00, 0x66, 0x00, + 0x6C, 0x00, 0x7E, 0x00, 0x73, 0x00, 0x61, 0x80, 0x60, 0xC0, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x4C 'L' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x4C 'L' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, + 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x7F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 14, // 0x4D 'M' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x38,0x70,0x38,0x70,0x78,0x58,0x58,0x58,0xD8,0x4C,0x98,0x4D,0x98,0x47,0x18,0x47,0x18,0x42,0x18,0x40,0x18,0x00,0x00,0x00,0x00,0x00,0x00, + 14, // 0x4D 'M' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x38, 0x70, 0x38, 0x70, 0x78, 0x58, 0x58, 0x58, 0xD8, + 0x4C, 0x98, 0x4D, 0x98, 0x47, 0x18, 0x47, 0x18, 0x42, 0x18, 0x40, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 12, // 0x4E 'N' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x20,0x70,0x20,0x58,0x20,0x4C,0x20,0x4C,0x20,0x46,0x20,0x43,0x20,0x43,0x20,0x41,0xA0,0x40,0xE0,0x40,0xE0,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x4E 'N' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x20, 0x70, 0x20, 0x58, 0x20, 0x4C, 0x20, 0x4C, 0x20, + 0x46, 0x20, 0x43, 0x20, 0x43, 0x20, 0x41, 0xA0, 0x40, 0xE0, 0x40, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 13, // 0x4F 'O' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x38,0xE0,0x30,0x60,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x30,0x60,0x38,0xE0,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x4F 'O' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x80, 0x38, 0xE0, 0x30, 0x60, 0x60, 0x30, 0x60, 0x30, + 0x60, 0x30, 0x60, 0x30, 0x60, 0x30, 0x30, 0x60, 0x38, 0xE0, 0x0F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x50 'P' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x61,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x61,0x80,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x50 'P' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x61, 0x80, 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, + 0x61, 0x80, 0x7F, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 13, // 0x51 'Q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x38,0xE0,0x30,0x60,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x30,0x60,0x38,0xE0,0x0F,0x80,0x03,0x00,0x03,0x80,0x01,0xF0, + 13, // 0x51 'Q' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x80, 0x38, 0xE0, 0x30, 0x60, 0x60, 0x30, 0x60, 0x30, + 0x60, 0x30, 0x60, 0x30, 0x60, 0x30, 0x30, 0x60, 0x38, 0xE0, 0x0F, 0x80, 0x03, 0x00, 0x03, 0x80, 0x01, 0xF0, - 12, // 0x52 'R' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x61,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x61,0x80,0x7F,0x00,0x61,0x80,0x60,0xC0,0x60,0x60,0x60,0x30,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x52 'R' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x61, 0x80, 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, + 0x61, 0x80, 0x7F, 0x00, 0x61, 0x80, 0x60, 0xC0, 0x60, 0x60, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x53 'S' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x30,0xC0,0x60,0xC0,0x60,0x00,0x7C,0x00,0x3F,0x80,0x03,0xC0,0x00,0xC0,0x60,0xC0,0x61,0x80,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x53 'S' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x80, 0x30, 0xC0, 0x60, 0xC0, 0x60, 0x00, 0x7C, 0x00, + 0x3F, 0x80, 0x03, 0xC0, 0x00, 0xC0, 0x60, 0xC0, 0x61, 0x80, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x54 'T' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x54 'T' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x80, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, + 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 12, // 0x55 'U' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0xC0,0x1F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 12, // 0x55 'U' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, + 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x30, 0xC0, 0x1F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x56 'V' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x31,0x80,0x31,0x80,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x0E,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x56 'V' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xC0, 0x60, 0xC0, 0x60, 0xC0, 0x31, 0x80, 0x31, 0x80, + 0x31, 0x80, 0x1B, 0x00, 0x1B, 0x00, 0x1B, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 16, // 0x57 'W' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x86,0x61,0x86,0x63,0xC6,0x33,0xCC,0x32,0x4C,0x32,0x4C,0x1E,0x78,0x1C,0x38,0x1C,0x38,0x0C,0x30,0x0C,0x30,0x00,0x00,0x00,0x00,0x00,0x00, + 16, // 0x57 'W' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x86, 0x61, 0x86, 0x63, 0xC6, 0x33, 0xCC, 0x32, 0x4C, + 0x32, 0x4C, 0x1E, 0x78, 0x1C, 0x38, 0x1C, 0x38, 0x0C, 0x30, 0x0C, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x58 'X' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x31,0x80,0x31,0x80,0x1B,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x1B,0x00,0x31,0x80,0x31,0x80,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x58 'X' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xC0, 0x31, 0x80, 0x31, 0x80, 0x1B, 0x00, 0x0E, 0x00, + 0x0E, 0x00, 0x0E, 0x00, 0x1B, 0x00, 0x31, 0x80, 0x31, 0x80, 0x60, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x59 'Y' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x1E,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x59 'Y' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x61, 0x80, 0x61, 0x80, 0x33, 0x00, 0x1E, 0x00, + 0x1E, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x5A 'Z' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x01,0x80,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x60,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x5A 'Z' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x80, 0x01, 0x80, 0x03, 0x00, 0x06, 0x00, 0x06, 0x00, + 0x0C, 0x00, 0x18, 0x00, 0x18, 0x00, 0x30, 0x00, 0x60, 0x00, 0x7F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x5B '[' - 0x00,0x00,0x00,0x3E,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3E, + 8, // 0x5B '[' + 0x00, 0x00, 0x00, 0x3E, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3E, - 10, // 0x5C '\' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x30,0x00,0x30,0x00,0x18,0x00,0x18,0x00,0x0C,0x00,0x0C,0x00,0x06,0x00,0x06,0x00,0x03,0x00,0x03,0x00,0x01,0x80,0x01,0x80,0x00,0x00, + 10, // 0x5C '\' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x30, 0x00, 0x30, 0x00, 0x18, 0x00, 0x18, 0x00, + 0x0C, 0x00, 0x0C, 0x00, 0x06, 0x00, 0x06, 0x00, 0x03, 0x00, 0x03, 0x00, 0x01, 0x80, 0x01, 0x80, 0x00, 0x00, - 8, // 0x5D ']' - 0x00,0x00,0x00,0x7C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x7C, + 8, // 0x5D ']' + 0x00, 0x00, 0x00, 0x7C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x7C, - 13, // 0x5E '^' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x0F,0x00,0x19,0x80,0x30,0xC0,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x5E '^' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0F, 0x00, 0x19, 0x80, 0x30, 0xC0, 0x60, 0x60, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x5F '_' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xE0,0x00,0x00, + 11, // 0x5F '_' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xE0, 0x00, 0x00, - 11, // 0x60 '`' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 11, // 0x60 '`' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x61 'a' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x01,0x80,0x01,0x80,0x3F,0x80,0x61,0x80,0x61,0x80,0x63,0x80,0x3D,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x61 'a' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x01, 0x80, + 0x01, 0x80, 0x3F, 0x80, 0x61, 0x80, 0x61, 0x80, 0x63, 0x80, 0x3D, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x62 'b' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x6E,0x00,0x73,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x62 'b' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x6E, 0x00, 0x73, 0x00, + 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x63, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 8, // 0x63 'c' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x33,0x60,0x60,0x60,0x60,0x33,0x1E,0x00,0x00,0x00, + 8, // 0x63 'c' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x33, 0x60, 0x60, 0x60, 0x60, 0x33, 0x1E, 0x00, 0x00, 0x00, - 10, // 0x64 'd' - 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x1F,0x80,0x31,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x64 'd' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x1F, 0x80, 0x31, 0x80, + 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x33, 0x80, 0x1D, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x65 'e' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x7F,0x80,0x60,0x00,0x60,0x00,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x65 'e' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x33, 0x00, + 0x61, 0x80, 0x7F, 0x80, 0x60, 0x00, 0x60, 0x00, 0x31, 0x80, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 6, // 0x66 'f' - 0x00,0x00,0x00,0x1C,0x30,0x30,0x30,0x7C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00,0x00, + 6, // 0x66 'f' + 0x00, 0x00, 0x00, 0x1C, 0x30, 0x30, 0x30, 0x7C, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, - 10, // 0x67 'g' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x31,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x01,0x80,0x03,0x00,0x3E,0x00, + 10, // 0x67 'g' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x80, 0x31, 0x80, + 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x33, 0x80, 0x1D, 0x80, 0x01, 0x80, 0x03, 0x00, 0x3E, 0x00, - 10, // 0x68 'h' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x6F,0x00,0x71,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x68 'h' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x6F, 0x00, 0x71, 0x80, + 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x69 'i' - 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, + 4, // 0x69 'i' + 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, - 6, // 0x6A 'j' - 0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF0, + 6, // 0x6A 'j' + 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xF0, - 10, // 0x6B 'k' - 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x61,0x80,0x63,0x00,0x66,0x00,0x6C,0x00,0x7E,0x00,0x73,0x00,0x61,0x80,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x6B 'k' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x61, 0x80, 0x63, 0x00, + 0x66, 0x00, 0x6C, 0x00, 0x7E, 0x00, 0x73, 0x00, 0x61, 0x80, 0x60, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 4, // 0x6C 'l' - 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, + 4, // 0x6C 'l' + 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, - 16, // 0x6D 'm' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6F,0x3C,0x71,0xC6,0x61,0x86,0x61,0x86,0x61,0x86,0x61,0x86,0x61,0x86,0x61,0x86,0x00,0x00,0x00,0x00,0x00,0x00, + 16, // 0x6D 'm' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6F, 0x3C, 0x71, 0xC6, + 0x61, 0x86, 0x61, 0x86, 0x61, 0x86, 0x61, 0x86, 0x61, 0x86, 0x61, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x6E 'n' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6F,0x00,0x71,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x6E 'n' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6F, 0x00, 0x71, 0x80, + 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x6F 'o' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x6F 'o' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x33, 0x00, + 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x33, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x70 'p' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x00,0x73,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x60,0x00,0x60,0x00,0x60,0x00, + 10, // 0x70 'p' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6E, 0x00, 0x73, 0x00, + 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x63, 0x00, 0x7E, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, - 10, // 0x71 'q' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x31,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x01,0x80,0x01,0x80,0x01,0x80, + 10, // 0x71 'q' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x80, 0x31, 0x80, + 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x33, 0x80, 0x1D, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, - 7, // 0x72 'r' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x7E,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, + 7, // 0x72 'r' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6E, 0x7E, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, - 9, // 0x73 's' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x61,0x00,0x60,0x00,0x7E,0x00,0x3F,0x00,0x03,0x00,0x43,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x73 's' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x61, 0x00, + 0x60, 0x00, 0x7E, 0x00, 0x3F, 0x00, 0x03, 0x00, 0x43, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 7, // 0x74 't' - 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x7E,0x30,0x30,0x30,0x30,0x30,0x30,0x1E,0x00,0x00,0x00, + 7, // 0x74 't' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x7E, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x1E, 0x00, 0x00, 0x00, - 10, // 0x75 'u' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x80,0x3D,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x75 'u' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x80, 0x61, 0x80, + 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x63, 0x80, 0x3D, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x76 'v' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x33,0x00,0x33,0x00,0x33,0x00,0x1E,0x00,0x1E,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x76 'v' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x80, 0x61, 0x80, + 0x33, 0x00, 0x33, 0x00, 0x33, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 14, // 0x77 'w' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x18,0x63,0x18,0x63,0x18,0x37,0xB0,0x34,0xB0,0x3C,0xF0,0x18,0x60,0x18,0x60,0x00,0x00,0x00,0x00,0x00,0x00, + 14, // 0x77 'w' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x18, 0x63, 0x18, + 0x63, 0x18, 0x37, 0xB0, 0x34, 0xB0, 0x3C, 0xF0, 0x18, 0x60, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x78 'x' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x33,0x00,0x33,0x00,0x1E,0x00,0x1E,0x00,0x33,0x00,0x33,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + 10, // 0x78 'x' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x80, 0x33, 0x00, + 0x33, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x33, 0x00, 0x33, 0x00, 0x61, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 10, // 0x79 'y' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x33,0x00,0x33,0x00,0x33,0x00,0x1E,0x00,0x1E,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00, + 10, // 0x79 'y' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x80, 0x61, 0x80, + 0x33, 0x00, 0x33, 0x00, 0x33, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x18, 0x00, 0x18, 0x00, - 9, // 0x7A 'z' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x60,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 9, // 0x7A 'z' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x03, 0x00, + 0x06, 0x00, 0x0C, 0x00, 0x18, 0x00, 0x30, 0x00, 0x60, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 11, // 0x7B '{' - 0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x70,0x00,0x18,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x07,0x80, + 11, // 0x7B '{' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, + 0x18, 0x00, 0x70, 0x00, 0x18, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x07, 0x80, - 8, // 0x7C '|' - 0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 8, // 0x7C '|' + 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 11, // 0x7D '}' - 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x03,0x00,0x01,0xC0,0x03,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x3C,0x00, + 11, // 0x7D '}' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, + 0x03, 0x00, 0x01, 0xC0, 0x03, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x3C, 0x00, - 13, // 0x7E '~' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x10,0x24,0x10,0x42,0x10,0x41,0x20,0x40,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 13, // 0x7E '~' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x10, + 0x24, 0x10, 0x42, 0x10, 0x41, 0x20, 0x40, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 15, // 0x7F '' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF8,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x3F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, + 15, // 0x7F '' + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xF8, 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, + 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, 0x3F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0 -}; - -} + 0}; +} // namespace agg diff --git a/deps/agg/src/agg_gsv_text.cpp b/deps/agg/src/agg_gsv_text.cpp index fac545c3f..6de7b9189 100644 --- a/deps/agg/src/agg_gsv_text.cpp +++ b/deps/agg/src/agg_gsv_text.cpp @@ -21,503 +21,286 @@ #include "agg_gsv_text.h" #include "agg_bounding_rect.h" - - -namespace agg -{ -int8u gsv_default_font[] = -{ - 0x40,0x00,0x6c,0x0f,0x15,0x00,0x0e,0x00,0xf9,0xff, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x0d,0x0a,0x0d,0x0a,0x46,0x6f,0x6e,0x74,0x20,0x28, - 0x63,0x29,0x20,0x4d,0x69,0x63,0x72,0x6f,0x50,0x72, - 0x6f,0x66,0x20,0x32,0x37,0x20,0x53,0x65,0x70,0x74, - 0x65,0x6d,0x62,0x2e,0x31,0x39,0x38,0x39,0x00,0x0d, - 0x0a,0x0d,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x02,0x00,0x12,0x00,0x34,0x00,0x46,0x00,0x94,0x00, - 0xd0,0x00,0x2e,0x01,0x3e,0x01,0x64,0x01,0x8a,0x01, - 0x98,0x01,0xa2,0x01,0xb4,0x01,0xba,0x01,0xc6,0x01, - 0xcc,0x01,0xf0,0x01,0xfa,0x01,0x18,0x02,0x38,0x02, - 0x44,0x02,0x68,0x02,0x98,0x02,0xa2,0x02,0xde,0x02, - 0x0e,0x03,0x24,0x03,0x40,0x03,0x48,0x03,0x52,0x03, - 0x5a,0x03,0x82,0x03,0xec,0x03,0xfa,0x03,0x26,0x04, - 0x4c,0x04,0x6a,0x04,0x7c,0x04,0x8a,0x04,0xb6,0x04, - 0xc4,0x04,0xca,0x04,0xe0,0x04,0xee,0x04,0xf8,0x04, - 0x0a,0x05,0x18,0x05,0x44,0x05,0x5e,0x05,0x8e,0x05, - 0xac,0x05,0xd6,0x05,0xe0,0x05,0xf6,0x05,0x00,0x06, - 0x12,0x06,0x1c,0x06,0x28,0x06,0x36,0x06,0x48,0x06, - 0x4e,0x06,0x60,0x06,0x6e,0x06,0x74,0x06,0x84,0x06, - 0xa6,0x06,0xc8,0x06,0xe6,0x06,0x08,0x07,0x2c,0x07, - 0x3c,0x07,0x68,0x07,0x7c,0x07,0x8c,0x07,0xa2,0x07, - 0xb0,0x07,0xb6,0x07,0xd8,0x07,0xec,0x07,0x10,0x08, - 0x32,0x08,0x54,0x08,0x64,0x08,0x88,0x08,0x98,0x08, - 0xac,0x08,0xb6,0x08,0xc8,0x08,0xd2,0x08,0xe4,0x08, - 0xf2,0x08,0x3e,0x09,0x48,0x09,0x94,0x09,0xc2,0x09, - 0xc4,0x09,0xd0,0x09,0xe2,0x09,0x04,0x0a,0x0e,0x0a, - 0x26,0x0a,0x34,0x0a,0x4a,0x0a,0x66,0x0a,0x70,0x0a, - 0x7e,0x0a,0x8e,0x0a,0x9a,0x0a,0xa6,0x0a,0xb4,0x0a, - 0xd8,0x0a,0xe2,0x0a,0xf6,0x0a,0x18,0x0b,0x22,0x0b, - 0x32,0x0b,0x56,0x0b,0x60,0x0b,0x6e,0x0b,0x7c,0x0b, - 0x8a,0x0b,0x9c,0x0b,0x9e,0x0b,0xb2,0x0b,0xc2,0x0b, - 0xd8,0x0b,0xf4,0x0b,0x08,0x0c,0x30,0x0c,0x56,0x0c, - 0x72,0x0c,0x90,0x0c,0xb2,0x0c,0xce,0x0c,0xe2,0x0c, - 0xfe,0x0c,0x10,0x0d,0x26,0x0d,0x36,0x0d,0x42,0x0d, - 0x4e,0x0d,0x5c,0x0d,0x78,0x0d,0x8c,0x0d,0x8e,0x0d, - 0x90,0x0d,0x92,0x0d,0x94,0x0d,0x96,0x0d,0x98,0x0d, - 0x9a,0x0d,0x9c,0x0d,0x9e,0x0d,0xa0,0x0d,0xa2,0x0d, - 0xa4,0x0d,0xa6,0x0d,0xa8,0x0d,0xaa,0x0d,0xac,0x0d, - 0xae,0x0d,0xb0,0x0d,0xb2,0x0d,0xb4,0x0d,0xb6,0x0d, - 0xb8,0x0d,0xba,0x0d,0xbc,0x0d,0xbe,0x0d,0xc0,0x0d, - 0xc2,0x0d,0xc4,0x0d,0xc6,0x0d,0xc8,0x0d,0xca,0x0d, - 0xcc,0x0d,0xce,0x0d,0xd0,0x0d,0xd2,0x0d,0xd4,0x0d, - 0xd6,0x0d,0xd8,0x0d,0xda,0x0d,0xdc,0x0d,0xde,0x0d, - 0xe0,0x0d,0xe2,0x0d,0xe4,0x0d,0xe6,0x0d,0xe8,0x0d, - 0xea,0x0d,0xec,0x0d,0x0c,0x0e,0x26,0x0e,0x48,0x0e, - 0x64,0x0e,0x88,0x0e,0x92,0x0e,0xa6,0x0e,0xb4,0x0e, - 0xd0,0x0e,0xee,0x0e,0x02,0x0f,0x16,0x0f,0x26,0x0f, - 0x3c,0x0f,0x58,0x0f,0x6c,0x0f,0x6c,0x0f,0x6c,0x0f, - 0x6c,0x0f,0x6c,0x0f,0x6c,0x0f,0x6c,0x0f,0x6c,0x0f, - 0x6c,0x0f,0x6c,0x0f,0x6c,0x0f,0x6c,0x0f,0x6c,0x0f, - 0x6c,0x0f,0x6c,0x0f,0x6c,0x0f,0x6c,0x0f,0x10,0x80, - 0x05,0x95,0x00,0x72,0x00,0xfb,0xff,0x7f,0x01,0x7f, - 0x01,0x01,0xff,0x01,0x05,0xfe,0x05,0x95,0xff,0x7f, - 0x00,0x7a,0x01,0x86,0xff,0x7a,0x01,0x87,0x01,0x7f, - 0xfe,0x7a,0x0a,0x87,0xff,0x7f,0x00,0x7a,0x01,0x86, - 0xff,0x7a,0x01,0x87,0x01,0x7f,0xfe,0x7a,0x05,0xf2, - 0x0b,0x95,0xf9,0x64,0x0d,0x9c,0xf9,0x64,0xfa,0x91, - 0x0e,0x00,0xf1,0xfa,0x0e,0x00,0x04,0xfc,0x08,0x99, - 0x00,0x63,0x04,0x9d,0x00,0x63,0x04,0x96,0xff,0x7f, - 0x01,0x7f,0x01,0x01,0x00,0x01,0xfe,0x02,0xfd,0x01, - 0xfc,0x00,0xfd,0x7f,0xfe,0x7e,0x00,0x7e,0x01,0x7e, - 0x01,0x7f,0x02,0x7f,0x06,0x7e,0x02,0x7f,0x02,0x7e, - 0xf2,0x89,0x02,0x7e,0x02,0x7f,0x06,0x7e,0x02,0x7f, - 0x01,0x7f,0x01,0x7e,0x00,0x7c,0xfe,0x7e,0xfd,0x7f, - 0xfc,0x00,0xfd,0x01,0xfe,0x02,0x00,0x01,0x01,0x01, - 0x01,0x7f,0xff,0x7f,0x10,0xfd,0x15,0x95,0xee,0x6b, - 0x05,0x95,0x02,0x7e,0x00,0x7e,0xff,0x7e,0xfe,0x7f, - 0xfe,0x00,0xfe,0x02,0x00,0x02,0x01,0x02,0x02,0x01, - 0x02,0x00,0x02,0x7f,0x03,0x7f,0x03,0x00,0x03,0x01, - 0x02,0x01,0xfc,0xf2,0xfe,0x7f,0xff,0x7e,0x00,0x7e, - 0x02,0x7e,0x02,0x00,0x02,0x01,0x01,0x02,0x00,0x02, - 0xfe,0x02,0xfe,0x00,0x07,0xf9,0x15,0x8d,0xff,0x7f, - 0x01,0x7f,0x01,0x01,0x00,0x01,0xff,0x01,0xff,0x00, - 0xff,0x7f,0xff,0x7e,0xfe,0x7b,0xfe,0x7d,0xfe,0x7e, - 0xfe,0x7f,0xfd,0x00,0xfd,0x01,0xff,0x02,0x00,0x03, - 0x01,0x02,0x06,0x04,0x02,0x02,0x01,0x02,0x00,0x02, - 0xff,0x02,0xfe,0x01,0xfe,0x7f,0xff,0x7e,0x00,0x7e, - 0x01,0x7d,0x02,0x7d,0x05,0x79,0x02,0x7e,0x03,0x7f, - 0x01,0x00,0x01,0x01,0x00,0x01,0xf1,0xfe,0xfe,0x01, - 0xff,0x02,0x00,0x03,0x01,0x02,0x02,0x02,0x00,0x86, - 0x01,0x7e,0x08,0x75,0x02,0x7e,0x02,0x7f,0x05,0x80, - 0x05,0x93,0xff,0x01,0x01,0x01,0x01,0x7f,0x00,0x7e, - 0xff,0x7e,0xff,0x7f,0x06,0xf1,0x0b,0x99,0xfe,0x7e, - 0xfe,0x7d,0xfe,0x7c,0xff,0x7b,0x00,0x7c,0x01,0x7b, - 0x02,0x7c,0x02,0x7d,0x02,0x7e,0xfe,0x9e,0xfe,0x7c, - 0xff,0x7d,0xff,0x7b,0x00,0x7c,0x01,0x7b,0x01,0x7d, - 0x02,0x7c,0x05,0x85,0x03,0x99,0x02,0x7e,0x02,0x7d, - 0x02,0x7c,0x01,0x7b,0x00,0x7c,0xff,0x7b,0xfe,0x7c, - 0xfe,0x7d,0xfe,0x7e,0x02,0x9e,0x02,0x7c,0x01,0x7d, - 0x01,0x7b,0x00,0x7c,0xff,0x7b,0xff,0x7d,0xfe,0x7c, - 0x09,0x85,0x08,0x95,0x00,0x74,0xfb,0x89,0x0a,0x7a, - 0x00,0x86,0xf6,0x7a,0x0d,0xf4,0x0d,0x92,0x00,0x6e, - 0xf7,0x89,0x12,0x00,0x04,0xf7,0x06,0x81,0xff,0x7f, - 0xff,0x01,0x01,0x01,0x01,0x7f,0x00,0x7e,0xff,0x7e, - 0xff,0x7f,0x06,0x84,0x04,0x89,0x12,0x00,0x04,0xf7, - 0x05,0x82,0xff,0x7f,0x01,0x7f,0x01,0x01,0xff,0x01, - 0x05,0xfe,0x00,0xfd,0x0e,0x18,0x00,0xeb,0x09,0x95, - 0xfd,0x7f,0xfe,0x7d,0xff,0x7b,0x00,0x7d,0x01,0x7b, - 0x02,0x7d,0x03,0x7f,0x02,0x00,0x03,0x01,0x02,0x03, - 0x01,0x05,0x00,0x03,0xff,0x05,0xfe,0x03,0xfd,0x01, - 0xfe,0x00,0x0b,0xeb,0x06,0x91,0x02,0x01,0x03,0x03, - 0x00,0x6b,0x09,0x80,0x04,0x90,0x00,0x01,0x01,0x02, - 0x01,0x01,0x02,0x01,0x04,0x00,0x02,0x7f,0x01,0x7f, - 0x01,0x7e,0x00,0x7e,0xff,0x7e,0xfe,0x7d,0xf6,0x76, - 0x0e,0x00,0x03,0x80,0x05,0x95,0x0b,0x00,0xfa,0x78, - 0x03,0x00,0x02,0x7f,0x01,0x7f,0x01,0x7d,0x00,0x7e, - 0xff,0x7d,0xfe,0x7e,0xfd,0x7f,0xfd,0x00,0xfd,0x01, - 0xff,0x01,0xff,0x02,0x11,0xfc,0x0d,0x95,0xf6,0x72, - 0x0f,0x00,0xfb,0x8e,0x00,0x6b,0x07,0x80,0x0f,0x95, - 0xf6,0x00,0xff,0x77,0x01,0x01,0x03,0x01,0x03,0x00, - 0x03,0x7f,0x02,0x7e,0x01,0x7d,0x00,0x7e,0xff,0x7d, - 0xfe,0x7e,0xfd,0x7f,0xfd,0x00,0xfd,0x01,0xff,0x01, - 0xff,0x02,0x11,0xfc,0x10,0x92,0xff,0x02,0xfd,0x01, - 0xfe,0x00,0xfd,0x7f,0xfe,0x7d,0xff,0x7b,0x00,0x7b, - 0x01,0x7c,0x02,0x7e,0x03,0x7f,0x01,0x00,0x03,0x01, - 0x02,0x02,0x01,0x03,0x00,0x01,0xff,0x03,0xfe,0x02, - 0xfd,0x01,0xff,0x00,0xfd,0x7f,0xfe,0x7e,0xff,0x7d, - 0x10,0xf9,0x11,0x95,0xf6,0x6b,0xfc,0x95,0x0e,0x00, - 0x03,0xeb,0x08,0x95,0xfd,0x7f,0xff,0x7e,0x00,0x7e, - 0x01,0x7e,0x02,0x7f,0x04,0x7f,0x03,0x7f,0x02,0x7e, - 0x01,0x7e,0x00,0x7d,0xff,0x7e,0xff,0x7f,0xfd,0x7f, - 0xfc,0x00,0xfd,0x01,0xff,0x01,0xff,0x02,0x00,0x03, - 0x01,0x02,0x02,0x02,0x03,0x01,0x04,0x01,0x02,0x01, - 0x01,0x02,0x00,0x02,0xff,0x02,0xfd,0x01,0xfc,0x00, - 0x0c,0xeb,0x10,0x8e,0xff,0x7d,0xfe,0x7e,0xfd,0x7f, - 0xff,0x00,0xfd,0x01,0xfe,0x02,0xff,0x03,0x00,0x01, - 0x01,0x03,0x02,0x02,0x03,0x01,0x01,0x00,0x03,0x7f, - 0x02,0x7e,0x01,0x7c,0x00,0x7b,0xff,0x7b,0xfe,0x7d, - 0xfd,0x7f,0xfe,0x00,0xfd,0x01,0xff,0x02,0x10,0xfd, - 0x05,0x8e,0xff,0x7f,0x01,0x7f,0x01,0x01,0xff,0x01, - 0x00,0xf4,0xff,0x7f,0x01,0x7f,0x01,0x01,0xff,0x01, - 0x05,0xfe,0x05,0x8e,0xff,0x7f,0x01,0x7f,0x01,0x01, - 0xff,0x01,0x01,0xf3,0xff,0x7f,0xff,0x01,0x01,0x01, - 0x01,0x7f,0x00,0x7e,0xff,0x7e,0xff,0x7f,0x06,0x84, - 0x14,0x92,0xf0,0x77,0x10,0x77,0x04,0x80,0x04,0x8c, - 0x12,0x00,0xee,0xfa,0x12,0x00,0x04,0xfa,0x04,0x92, - 0x10,0x77,0xf0,0x77,0x14,0x80,0x03,0x90,0x00,0x01, - 0x01,0x02,0x01,0x01,0x02,0x01,0x04,0x00,0x02,0x7f, - 0x01,0x7f,0x01,0x7e,0x00,0x7e,0xff,0x7e,0xff,0x7f, - 0xfc,0x7e,0x00,0x7d,0x00,0xfb,0xff,0x7f,0x01,0x7f, - 0x01,0x01,0xff,0x01,0x09,0xfe,0x12,0x8d,0xff,0x02, - 0xfe,0x01,0xfd,0x00,0xfe,0x7f,0xff,0x7f,0xff,0x7d, - 0x00,0x7d,0x01,0x7e,0x02,0x7f,0x03,0x00,0x02,0x01, - 0x01,0x02,0xfb,0x88,0xfe,0x7e,0xff,0x7d,0x00,0x7d, - 0x01,0x7e,0x01,0x7f,0x07,0x8b,0xff,0x78,0x00,0x7e, - 0x02,0x7f,0x02,0x00,0x02,0x02,0x01,0x03,0x00,0x02, - 0xff,0x03,0xff,0x02,0xfe,0x02,0xfe,0x01,0xfd,0x01, - 0xfd,0x00,0xfd,0x7f,0xfe,0x7f,0xfe,0x7e,0xff,0x7e, - 0xff,0x7d,0x00,0x7d,0x01,0x7d,0x01,0x7e,0x02,0x7e, - 0x02,0x7f,0x03,0x7f,0x03,0x00,0x03,0x01,0x02,0x01, - 0x01,0x01,0xfe,0x8d,0xff,0x78,0x00,0x7e,0x01,0x7f, - 0x08,0xfb,0x09,0x95,0xf8,0x6b,0x08,0x95,0x08,0x6b, - 0xf3,0x87,0x0a,0x00,0x04,0xf9,0x04,0x95,0x00,0x6b, - 0x00,0x95,0x09,0x00,0x03,0x7f,0x01,0x7f,0x01,0x7e, - 0x00,0x7e,0xff,0x7e,0xff,0x7f,0xfd,0x7f,0xf7,0x80, - 0x09,0x00,0x03,0x7f,0x01,0x7f,0x01,0x7e,0x00,0x7d, - 0xff,0x7e,0xff,0x7f,0xfd,0x7f,0xf7,0x00,0x11,0x80, - 0x12,0x90,0xff,0x02,0xfe,0x02,0xfe,0x01,0xfc,0x00, - 0xfe,0x7f,0xfe,0x7e,0xff,0x7e,0xff,0x7d,0x00,0x7b, - 0x01,0x7d,0x01,0x7e,0x02,0x7e,0x02,0x7f,0x04,0x00, - 0x02,0x01,0x02,0x02,0x01,0x02,0x03,0xfb,0x04,0x95, - 0x00,0x6b,0x00,0x95,0x07,0x00,0x03,0x7f,0x02,0x7e, - 0x01,0x7e,0x01,0x7d,0x00,0x7b,0xff,0x7d,0xff,0x7e, - 0xfe,0x7e,0xfd,0x7f,0xf9,0x00,0x11,0x80,0x04,0x95, - 0x00,0x6b,0x00,0x95,0x0d,0x00,0xf3,0xf6,0x08,0x00, - 0xf8,0xf5,0x0d,0x00,0x02,0x80,0x04,0x95,0x00,0x6b, - 0x00,0x95,0x0d,0x00,0xf3,0xf6,0x08,0x00,0x06,0xf5, - 0x12,0x90,0xff,0x02,0xfe,0x02,0xfe,0x01,0xfc,0x00, - 0xfe,0x7f,0xfe,0x7e,0xff,0x7e,0xff,0x7d,0x00,0x7b, - 0x01,0x7d,0x01,0x7e,0x02,0x7e,0x02,0x7f,0x04,0x00, - 0x02,0x01,0x02,0x02,0x01,0x02,0x00,0x03,0xfb,0x80, - 0x05,0x00,0x03,0xf8,0x04,0x95,0x00,0x6b,0x0e,0x95, - 0x00,0x6b,0xf2,0x8b,0x0e,0x00,0x04,0xf5,0x04,0x95, - 0x00,0x6b,0x04,0x80,0x0c,0x95,0x00,0x70,0xff,0x7d, - 0xff,0x7f,0xfe,0x7f,0xfe,0x00,0xfe,0x01,0xff,0x01, - 0xff,0x03,0x00,0x02,0x0e,0xf9,0x04,0x95,0x00,0x6b, - 0x0e,0x95,0xf2,0x72,0x05,0x85,0x09,0x74,0x03,0x80, - 0x04,0x95,0x00,0x6b,0x00,0x80,0x0c,0x00,0x01,0x80, - 0x04,0x95,0x00,0x6b,0x00,0x95,0x08,0x6b,0x08,0x95, - 0xf8,0x6b,0x08,0x95,0x00,0x6b,0x04,0x80,0x04,0x95, - 0x00,0x6b,0x00,0x95,0x0e,0x6b,0x00,0x95,0x00,0x6b, - 0x04,0x80,0x09,0x95,0xfe,0x7f,0xfe,0x7e,0xff,0x7e, - 0xff,0x7d,0x00,0x7b,0x01,0x7d,0x01,0x7e,0x02,0x7e, - 0x02,0x7f,0x04,0x00,0x02,0x01,0x02,0x02,0x01,0x02, - 0x01,0x03,0x00,0x05,0xff,0x03,0xff,0x02,0xfe,0x02, - 0xfe,0x01,0xfc,0x00,0x0d,0xeb,0x04,0x95,0x00,0x6b, - 0x00,0x95,0x09,0x00,0x03,0x7f,0x01,0x7f,0x01,0x7e, - 0x00,0x7d,0xff,0x7e,0xff,0x7f,0xfd,0x7f,0xf7,0x00, - 0x11,0xf6,0x09,0x95,0xfe,0x7f,0xfe,0x7e,0xff,0x7e, - 0xff,0x7d,0x00,0x7b,0x01,0x7d,0x01,0x7e,0x02,0x7e, - 0x02,0x7f,0x04,0x00,0x02,0x01,0x02,0x02,0x01,0x02, - 0x01,0x03,0x00,0x05,0xff,0x03,0xff,0x02,0xfe,0x02, - 0xfe,0x01,0xfc,0x00,0x03,0xef,0x06,0x7a,0x04,0x82, - 0x04,0x95,0x00,0x6b,0x00,0x95,0x09,0x00,0x03,0x7f, - 0x01,0x7f,0x01,0x7e,0x00,0x7e,0xff,0x7e,0xff,0x7f, - 0xfd,0x7f,0xf7,0x00,0x07,0x80,0x07,0x75,0x03,0x80, - 0x11,0x92,0xfe,0x02,0xfd,0x01,0xfc,0x00,0xfd,0x7f, - 0xfe,0x7e,0x00,0x7e,0x01,0x7e,0x01,0x7f,0x02,0x7f, - 0x06,0x7e,0x02,0x7f,0x01,0x7f,0x01,0x7e,0x00,0x7d, - 0xfe,0x7e,0xfd,0x7f,0xfc,0x00,0xfd,0x01,0xfe,0x02, - 0x11,0xfd,0x08,0x95,0x00,0x6b,0xf9,0x95,0x0e,0x00, - 0x01,0xeb,0x04,0x95,0x00,0x71,0x01,0x7d,0x02,0x7e, - 0x03,0x7f,0x02,0x00,0x03,0x01,0x02,0x02,0x01,0x03, - 0x00,0x0f,0x04,0xeb,0x01,0x95,0x08,0x6b,0x08,0x95, - 0xf8,0x6b,0x09,0x80,0x02,0x95,0x05,0x6b,0x05,0x95, - 0xfb,0x6b,0x05,0x95,0x05,0x6b,0x05,0x95,0xfb,0x6b, - 0x07,0x80,0x03,0x95,0x0e,0x6b,0x00,0x95,0xf2,0x6b, - 0x11,0x80,0x01,0x95,0x08,0x76,0x00,0x75,0x08,0x95, - 0xf8,0x76,0x09,0xf5,0x11,0x95,0xf2,0x6b,0x00,0x95, - 0x0e,0x00,0xf2,0xeb,0x0e,0x00,0x03,0x80,0x03,0x93, - 0x00,0x6c,0x01,0x94,0x00,0x6c,0xff,0x94,0x05,0x00, - 0xfb,0xec,0x05,0x00,0x02,0x81,0x00,0x95,0x0e,0x68, - 0x00,0x83,0x06,0x93,0x00,0x6c,0x01,0x94,0x00,0x6c, - 0xfb,0x94,0x05,0x00,0xfb,0xec,0x05,0x00,0x03,0x81, - 0x03,0x87,0x08,0x05,0x08,0x7b,0xf0,0x80,0x08,0x04, - 0x08,0x7c,0x03,0xf9,0x01,0x80,0x10,0x00,0x01,0x80, - 0x06,0x95,0xff,0x7f,0xff,0x7e,0x00,0x7e,0x01,0x7f, - 0x01,0x01,0xff,0x01,0x05,0xef,0x0f,0x8e,0x00,0x72, - 0x00,0x8b,0xfe,0x02,0xfe,0x01,0xfd,0x00,0xfe,0x7f, - 0xfe,0x7e,0xff,0x7d,0x00,0x7e,0x01,0x7d,0x02,0x7e, - 0x02,0x7f,0x03,0x00,0x02,0x01,0x02,0x02,0x04,0xfd, - 0x04,0x95,0x00,0x6b,0x00,0x8b,0x02,0x02,0x02,0x01, - 0x03,0x00,0x02,0x7f,0x02,0x7e,0x01,0x7d,0x00,0x7e, - 0xff,0x7d,0xfe,0x7e,0xfe,0x7f,0xfd,0x00,0xfe,0x01, - 0xfe,0x02,0x0f,0xfd,0x0f,0x8b,0xfe,0x02,0xfe,0x01, - 0xfd,0x00,0xfe,0x7f,0xfe,0x7e,0xff,0x7d,0x00,0x7e, - 0x01,0x7d,0x02,0x7e,0x02,0x7f,0x03,0x00,0x02,0x01, - 0x02,0x02,0x03,0xfd,0x0f,0x95,0x00,0x6b,0x00,0x8b, - 0xfe,0x02,0xfe,0x01,0xfd,0x00,0xfe,0x7f,0xfe,0x7e, - 0xff,0x7d,0x00,0x7e,0x01,0x7d,0x02,0x7e,0x02,0x7f, - 0x03,0x00,0x02,0x01,0x02,0x02,0x04,0xfd,0x03,0x88, - 0x0c,0x00,0x00,0x02,0xff,0x02,0xff,0x01,0xfe,0x01, - 0xfd,0x00,0xfe,0x7f,0xfe,0x7e,0xff,0x7d,0x00,0x7e, - 0x01,0x7d,0x02,0x7e,0x02,0x7f,0x03,0x00,0x02,0x01, - 0x02,0x02,0x03,0xfd,0x0a,0x95,0xfe,0x00,0xfe,0x7f, - 0xff,0x7d,0x00,0x6f,0xfd,0x8e,0x07,0x00,0x03,0xf2, - 0x0f,0x8e,0x00,0x70,0xff,0x7d,0xff,0x7f,0xfe,0x7f, - 0xfd,0x00,0xfe,0x01,0x09,0x91,0xfe,0x02,0xfe,0x01, - 0xfd,0x00,0xfe,0x7f,0xfe,0x7e,0xff,0x7d,0x00,0x7e, - 0x01,0x7d,0x02,0x7e,0x02,0x7f,0x03,0x00,0x02,0x01, - 0x02,0x02,0x04,0xfd,0x04,0x95,0x00,0x6b,0x00,0x8a, - 0x03,0x03,0x02,0x01,0x03,0x00,0x02,0x7f,0x01,0x7d, - 0x00,0x76,0x04,0x80,0x03,0x95,0x01,0x7f,0x01,0x01, - 0xff,0x01,0xff,0x7f,0x01,0xf9,0x00,0x72,0x04,0x80, - 0x05,0x95,0x01,0x7f,0x01,0x01,0xff,0x01,0xff,0x7f, - 0x01,0xf9,0x00,0x6f,0xff,0x7d,0xfe,0x7f,0xfe,0x00, - 0x09,0x87,0x04,0x95,0x00,0x6b,0x0a,0x8e,0xf6,0x76, - 0x04,0x84,0x07,0x78,0x02,0x80,0x04,0x95,0x00,0x6b, - 0x04,0x80,0x04,0x8e,0x00,0x72,0x00,0x8a,0x03,0x03, - 0x02,0x01,0x03,0x00,0x02,0x7f,0x01,0x7d,0x00,0x76, - 0x00,0x8a,0x03,0x03,0x02,0x01,0x03,0x00,0x02,0x7f, - 0x01,0x7d,0x00,0x76,0x04,0x80,0x04,0x8e,0x00,0x72, - 0x00,0x8a,0x03,0x03,0x02,0x01,0x03,0x00,0x02,0x7f, - 0x01,0x7d,0x00,0x76,0x04,0x80,0x08,0x8e,0xfe,0x7f, - 0xfe,0x7e,0xff,0x7d,0x00,0x7e,0x01,0x7d,0x02,0x7e, - 0x02,0x7f,0x03,0x00,0x02,0x01,0x02,0x02,0x01,0x03, - 0x00,0x02,0xff,0x03,0xfe,0x02,0xfe,0x01,0xfd,0x00, - 0x0b,0xf2,0x04,0x8e,0x00,0x6b,0x00,0x92,0x02,0x02, - 0x02,0x01,0x03,0x00,0x02,0x7f,0x02,0x7e,0x01,0x7d, - 0x00,0x7e,0xff,0x7d,0xfe,0x7e,0xfe,0x7f,0xfd,0x00, - 0xfe,0x01,0xfe,0x02,0x0f,0xfd,0x0f,0x8e,0x00,0x6b, - 0x00,0x92,0xfe,0x02,0xfe,0x01,0xfd,0x00,0xfe,0x7f, - 0xfe,0x7e,0xff,0x7d,0x00,0x7e,0x01,0x7d,0x02,0x7e, - 0x02,0x7f,0x03,0x00,0x02,0x01,0x02,0x02,0x04,0xfd, - 0x04,0x8e,0x00,0x72,0x00,0x88,0x01,0x03,0x02,0x02, - 0x02,0x01,0x03,0x00,0x01,0xf2,0x0e,0x8b,0xff,0x02, - 0xfd,0x01,0xfd,0x00,0xfd,0x7f,0xff,0x7e,0x01,0x7e, - 0x02,0x7f,0x05,0x7f,0x02,0x7f,0x01,0x7e,0x00,0x7f, - 0xff,0x7e,0xfd,0x7f,0xfd,0x00,0xfd,0x01,0xff,0x02, - 0x0e,0xfd,0x05,0x95,0x00,0x6f,0x01,0x7d,0x02,0x7f, - 0x02,0x00,0xf8,0x8e,0x07,0x00,0x03,0xf2,0x04,0x8e, - 0x00,0x76,0x01,0x7d,0x02,0x7f,0x03,0x00,0x02,0x01, - 0x03,0x03,0x00,0x8a,0x00,0x72,0x04,0x80,0x02,0x8e, - 0x06,0x72,0x06,0x8e,0xfa,0x72,0x08,0x80,0x03,0x8e, - 0x04,0x72,0x04,0x8e,0xfc,0x72,0x04,0x8e,0x04,0x72, - 0x04,0x8e,0xfc,0x72,0x07,0x80,0x03,0x8e,0x0b,0x72, - 0x00,0x8e,0xf5,0x72,0x0e,0x80,0x02,0x8e,0x06,0x72, - 0x06,0x8e,0xfa,0x72,0xfe,0x7c,0xfe,0x7e,0xfe,0x7f, - 0xff,0x00,0x0f,0x87,0x0e,0x8e,0xf5,0x72,0x00,0x8e, - 0x0b,0x00,0xf5,0xf2,0x0b,0x00,0x03,0x80,0x09,0x99, - 0xfe,0x7f,0xff,0x7f,0xff,0x7e,0x00,0x7e,0x01,0x7e, - 0x01,0x7f,0x01,0x7e,0x00,0x7e,0xfe,0x7e,0x01,0x8e, - 0xff,0x7e,0x00,0x7e,0x01,0x7e,0x01,0x7f,0x01,0x7e, - 0x00,0x7e,0xff,0x7e,0xfc,0x7e,0x04,0x7e,0x01,0x7e, - 0x00,0x7e,0xff,0x7e,0xff,0x7f,0xff,0x7e,0x00,0x7e, - 0x01,0x7e,0xff,0x8e,0x02,0x7e,0x00,0x7e,0xff,0x7e, - 0xff,0x7f,0xff,0x7e,0x00,0x7e,0x01,0x7e,0x01,0x7f, - 0x02,0x7f,0x05,0x87,0x04,0x95,0x00,0x77,0x00,0xfd, - 0x00,0x77,0x04,0x80,0x05,0x99,0x02,0x7f,0x01,0x7f, - 0x01,0x7e,0x00,0x7e,0xff,0x7e,0xff,0x7f,0xff,0x7e, - 0x00,0x7e,0x02,0x7e,0xff,0x8e,0x01,0x7e,0x00,0x7e, - 0xff,0x7e,0xff,0x7f,0xff,0x7e,0x00,0x7e,0x01,0x7e, - 0x04,0x7e,0xfc,0x7e,0xff,0x7e,0x00,0x7e,0x01,0x7e, - 0x01,0x7f,0x01,0x7e,0x00,0x7e,0xff,0x7e,0x01,0x8e, - 0xfe,0x7e,0x00,0x7e,0x01,0x7e,0x01,0x7f,0x01,0x7e, - 0x00,0x7e,0xff,0x7e,0xff,0x7f,0xfe,0x7f,0x09,0x87, - 0x03,0x86,0x00,0x02,0x01,0x03,0x02,0x01,0x02,0x00, - 0x02,0x7f,0x04,0x7d,0x02,0x7f,0x02,0x00,0x02,0x01, - 0x01,0x02,0xee,0xfe,0x01,0x02,0x02,0x01,0x02,0x00, - 0x02,0x7f,0x04,0x7d,0x02,0x7f,0x02,0x00,0x02,0x01, - 0x01,0x03,0x00,0x02,0x03,0xf4,0x10,0x80,0x03,0x80, - 0x07,0x15,0x08,0x6b,0xfe,0x85,0xf5,0x00,0x10,0xfb, - 0x0d,0x95,0xf6,0x00,0x00,0x6b,0x0a,0x00,0x02,0x02, - 0x00,0x08,0xfe,0x02,0xf6,0x00,0x0e,0xf4,0x03,0x80, - 0x00,0x15,0x0a,0x00,0x02,0x7e,0x00,0x7e,0x00,0x7d, - 0x00,0x7e,0xfe,0x7f,0xf6,0x00,0x0a,0x80,0x02,0x7e, - 0x01,0x7e,0x00,0x7d,0xff,0x7d,0xfe,0x7f,0xf6,0x00, - 0x10,0x80,0x03,0x80,0x00,0x15,0x0c,0x00,0xff,0x7e, - 0x03,0xed,0x03,0xfd,0x00,0x03,0x02,0x00,0x00,0x12, - 0x02,0x03,0x0a,0x00,0x00,0x6b,0x02,0x00,0x00,0x7d, - 0xfe,0x83,0xf4,0x00,0x11,0x80,0x0f,0x80,0xf4,0x00, - 0x00,0x15,0x0c,0x00,0xff,0xf6,0xf5,0x00,0x0f,0xf5, - 0x04,0x95,0x07,0x76,0x00,0x0a,0x07,0x80,0xf9,0x76, - 0x00,0x75,0xf8,0x80,0x07,0x0c,0x09,0xf4,0xf9,0x0c, - 0x09,0xf4,0x03,0x92,0x02,0x03,0x07,0x00,0x03,0x7d, - 0x00,0x7b,0xfc,0x7e,0x04,0x7d,0x00,0x7a,0xfd,0x7e, - 0xf9,0x00,0xfe,0x02,0x06,0x89,0x02,0x00,0x06,0xf5, - 0x03,0x95,0x00,0x6b,0x0c,0x15,0x00,0x6b,0x02,0x80, - 0x03,0x95,0x00,0x6b,0x0c,0x15,0x00,0x6b,0xf8,0x96, - 0x03,0x00,0x07,0xea,0x03,0x80,0x00,0x15,0x0c,0x80, - 0xf7,0x76,0xfd,0x00,0x03,0x80,0x0a,0x75,0x03,0x80, - 0x03,0x80,0x07,0x13,0x02,0x02,0x03,0x00,0x00,0x6b, - 0x02,0x80,0x03,0x80,0x00,0x15,0x09,0x6b,0x09,0x15, - 0x00,0x6b,0x03,0x80,0x03,0x80,0x00,0x15,0x00,0xf6, - 0x0d,0x00,0x00,0x8a,0x00,0x6b,0x03,0x80,0x07,0x80, - 0xfd,0x00,0xff,0x03,0x00,0x04,0x00,0x07,0x00,0x04, - 0x01,0x02,0x03,0x01,0x06,0x00,0x03,0x7f,0x01,0x7e, - 0x01,0x7c,0x00,0x79,0xff,0x7c,0xff,0x7d,0xfd,0x00, - 0xfa,0x00,0x0e,0x80,0x03,0x80,0x00,0x15,0x0c,0x00, - 0x00,0x6b,0x02,0x80,0x03,0x80,0x00,0x15,0x0a,0x00, - 0x02,0x7f,0x01,0x7d,0x00,0x7b,0xff,0x7e,0xfe,0x7f, - 0xf6,0x00,0x10,0xf7,0x11,0x8f,0xff,0x03,0xff,0x02, - 0xfe,0x01,0xfa,0x00,0xfd,0x7f,0xff,0x7e,0x00,0x7c, - 0x00,0x79,0x00,0x7b,0x01,0x7e,0x03,0x00,0x06,0x00, - 0x02,0x00,0x01,0x03,0x01,0x02,0x03,0xfb,0x03,0x95, - 0x0c,0x00,0xfa,0x80,0x00,0x6b,0x09,0x80,0x03,0x95, - 0x00,0x77,0x06,0x7a,0x06,0x06,0x00,0x09,0xfa,0xf1, - 0xfa,0x7a,0x0e,0x80,0x03,0x87,0x00,0x0b,0x02,0x02, - 0x03,0x00,0x02,0x7e,0x01,0x02,0x04,0x00,0x02,0x7e, - 0x00,0x75,0xfe,0x7e,0xfc,0x00,0xff,0x01,0xfe,0x7f, - 0xfd,0x00,0xfe,0x02,0x07,0x8e,0x00,0x6b,0x09,0x80, - 0x03,0x80,0x0e,0x15,0xf2,0x80,0x0e,0x6b,0x03,0x80, - 0x03,0x95,0x00,0x6b,0x0e,0x00,0x00,0x7d,0xfe,0x98, - 0x00,0x6b,0x05,0x80,0x03,0x95,0x00,0x75,0x02,0x7d, - 0x0a,0x00,0x00,0x8e,0x00,0x6b,0x02,0x80,0x03,0x95, - 0x00,0x6b,0x10,0x00,0x00,0x15,0xf8,0x80,0x00,0x6b, - 0x0a,0x80,0x03,0x95,0x00,0x6b,0x10,0x00,0x00,0x15, - 0xf8,0x80,0x00,0x6b,0x0a,0x00,0x00,0x7d,0x02,0x83, - 0x10,0x80,0x03,0x95,0x00,0x6b,0x09,0x00,0x03,0x02, - 0x00,0x08,0xfd,0x02,0xf7,0x00,0x0e,0x89,0x00,0x6b, - 0x03,0x80,0x03,0x95,0x00,0x6b,0x09,0x00,0x03,0x02, - 0x00,0x08,0xfd,0x02,0xf7,0x00,0x0e,0xf4,0x03,0x92, - 0x02,0x03,0x07,0x00,0x03,0x7d,0x00,0x70,0xfd,0x7e, - 0xf9,0x00,0xfe,0x02,0x03,0x89,0x09,0x00,0x02,0xf5, - 0x03,0x80,0x00,0x15,0x00,0xf5,0x07,0x00,0x00,0x08, - 0x02,0x03,0x06,0x00,0x02,0x7d,0x00,0x70,0xfe,0x7e, - 0xfa,0x00,0xfe,0x02,0x00,0x08,0x0c,0xf6,0x0f,0x80, - 0x00,0x15,0xf6,0x00,0xfe,0x7d,0x00,0x79,0x02,0x7e, - 0x0a,0x00,0xf4,0xf7,0x07,0x09,0x07,0xf7,0x03,0x8c, - 0x01,0x02,0x01,0x01,0x05,0x00,0x02,0x7f,0x01,0x7e, - 0x00,0x74,0x00,0x86,0xff,0x01,0xfe,0x01,0xfb,0x00, - 0xff,0x7f,0xff,0x7f,0x00,0x7c,0x01,0x7e,0x01,0x00, - 0x05,0x00,0x02,0x00,0x01,0x02,0x03,0xfe,0x04,0x8e, - 0x02,0x01,0x04,0x00,0x02,0x7f,0x01,0x7e,0x00,0x77, - 0xff,0x7e,0xfe,0x7f,0xfc,0x00,0xfe,0x01,0xff,0x02, - 0x00,0x09,0x01,0x02,0x02,0x02,0x03,0x01,0x02,0x01, - 0x01,0x01,0x01,0x02,0x02,0xeb,0x03,0x80,0x00,0x15, - 0x03,0x00,0x02,0x7e,0x00,0x7b,0xfe,0x7e,0xfd,0x00, - 0x03,0x80,0x04,0x00,0x03,0x7e,0x00,0x78,0xfd,0x7e, - 0xf9,0x00,0x0c,0x80,0x03,0x8c,0x02,0x02,0x02,0x01, - 0x03,0x00,0x02,0x7f,0x01,0x7d,0xfe,0x7e,0xf9,0x7d, - 0xff,0x7e,0x00,0x7d,0x03,0x7f,0x02,0x00,0x03,0x01, - 0x02,0x01,0x02,0xfe,0x0d,0x8c,0xff,0x02,0xfe,0x01, - 0xfc,0x00,0xfe,0x7f,0xff,0x7e,0x00,0x77,0x01,0x7e, - 0x02,0x7f,0x04,0x00,0x02,0x01,0x01,0x02,0x00,0x0f, - 0xff,0x02,0xfe,0x01,0xf9,0x00,0x0c,0xeb,0x03,0x88, - 0x0a,0x00,0x00,0x02,0x00,0x03,0xfe,0x02,0xfa,0x00, - 0xff,0x7e,0xff,0x7d,0x00,0x7b,0x01,0x7c,0x01,0x7f, - 0x06,0x00,0x02,0x02,0x03,0xfe,0x03,0x8f,0x06,0x77, - 0x06,0x09,0xfa,0x80,0x00,0x71,0xff,0x87,0xfb,0x79, - 0x07,0x87,0x05,0x79,0x02,0x80,0x03,0x8d,0x02,0x02, - 0x06,0x00,0x02,0x7e,0x00,0x7d,0xfc,0x7d,0x04,0x7e, - 0x00,0x7d,0xfe,0x7e,0xfa,0x00,0xfe,0x02,0x04,0x85, - 0x02,0x00,0x06,0xf9,0x03,0x8f,0x00,0x73,0x01,0x7e, - 0x07,0x00,0x02,0x02,0x00,0x0d,0x00,0xf3,0x01,0x7e, - 0x03,0x80,0x03,0x8f,0x00,0x73,0x01,0x7e,0x07,0x00, - 0x02,0x02,0x00,0x0d,0x00,0xf3,0x01,0x7e,0xf8,0x90, - 0x03,0x00,0x08,0xf0,0x03,0x80,0x00,0x15,0x00,0xf3, - 0x02,0x00,0x06,0x07,0xfa,0xf9,0x07,0x78,0x03,0x80, - 0x03,0x80,0x04,0x0c,0x02,0x03,0x04,0x00,0x00,0x71, - 0x02,0x80,0x03,0x80,0x00,0x0f,0x06,0x77,0x06,0x09, - 0x00,0x71,0x02,0x80,0x03,0x80,0x00,0x0f,0x0a,0xf1, - 0x00,0x0f,0xf6,0xf8,0x0a,0x00,0x02,0xf9,0x05,0x80, - 0xff,0x01,0xff,0x04,0x00,0x05,0x01,0x03,0x01,0x02, - 0x06,0x00,0x02,0x7e,0x00,0x7d,0x00,0x7b,0x00,0x7c, - 0xfe,0x7f,0xfa,0x00,0x0b,0x80,0x03,0x80,0x00,0x0f, - 0x00,0xfb,0x01,0x03,0x01,0x02,0x05,0x00,0x02,0x7e, - 0x01,0x7d,0x00,0x76,0x03,0x80,0x10,0x80,0x10,0x80, - 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, - 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, - 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, - 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, - 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, - 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, - 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, - 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, - 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, - 0x10,0x80,0x0a,0x8f,0x02,0x7f,0x01,0x7e,0x00,0x76, - 0xff,0x7f,0xfe,0x7f,0xfb,0x00,0xff,0x01,0xff,0x01, - 0x00,0x0a,0x01,0x02,0x01,0x01,0x05,0x00,0xf9,0x80, - 0x00,0x6b,0x0c,0x86,0x0d,0x8a,0xff,0x03,0xfe,0x02, - 0xfb,0x00,0xff,0x7e,0xff,0x7d,0x00,0x7b,0x01,0x7c, - 0x01,0x7f,0x05,0x00,0x02,0x01,0x01,0x03,0x03,0xfc, - 0x03,0x80,0x00,0x0f,0x00,0xfb,0x01,0x03,0x01,0x02, - 0x04,0x00,0x01,0x7e,0x01,0x7d,0x00,0x76,0x00,0x8a, - 0x01,0x03,0x02,0x02,0x03,0x00,0x02,0x7e,0x01,0x7d, - 0x00,0x76,0x03,0x80,0x03,0x8f,0x00,0x74,0x01,0x7e, - 0x02,0x7f,0x04,0x00,0x02,0x01,0x01,0x01,0x00,0x8d, - 0x00,0x6e,0xff,0x7e,0xfe,0x7f,0xfb,0x00,0xfe,0x01, - 0x0c,0x85,0x03,0x8d,0x01,0x02,0x03,0x00,0x02,0x7e, - 0x01,0x02,0x03,0x00,0x02,0x7e,0x00,0x74,0xfe,0x7f, - 0xfd,0x00,0xff,0x01,0xfe,0x7f,0xfd,0x00,0xff,0x01, - 0x00,0x0c,0x06,0x82,0x00,0x6b,0x08,0x86,0x03,0x80, - 0x0a,0x0f,0xf6,0x80,0x0a,0x71,0x03,0x80,0x03,0x8f, - 0x00,0x73,0x01,0x7e,0x07,0x00,0x02,0x02,0x00,0x0d, - 0x00,0xf3,0x01,0x7e,0x00,0x7e,0x03,0x82,0x03,0x8f, - 0x00,0x79,0x02,0x7e,0x08,0x00,0x00,0x89,0x00,0x71, - 0x02,0x80,0x03,0x8f,0x00,0x73,0x01,0x7e,0x03,0x00, - 0x02,0x02,0x00,0x0d,0x00,0xf3,0x01,0x7e,0x03,0x00, - 0x02,0x02,0x00,0x0d,0x00,0xf3,0x01,0x7e,0x03,0x80, - 0x03,0x8f,0x00,0x73,0x01,0x7e,0x03,0x00,0x02,0x02, - 0x00,0x0d,0x00,0xf3,0x01,0x7e,0x03,0x00,0x02,0x02, - 0x00,0x0d,0x00,0xf3,0x01,0x7e,0x00,0x7e,0x03,0x82, - 0x03,0x8d,0x00,0x02,0x02,0x00,0x00,0x71,0x08,0x00, - 0x02,0x02,0x00,0x06,0xfe,0x02,0xf8,0x00,0x0c,0xf6, - 0x03,0x8f,0x00,0x71,0x07,0x00,0x02,0x02,0x00,0x06, - 0xfe,0x02,0xf9,0x00,0x0c,0x85,0x00,0x71,0x02,0x80, - 0x03,0x8f,0x00,0x71,0x07,0x00,0x03,0x02,0x00,0x06, - 0xfd,0x02,0xf9,0x00,0x0c,0xf6,0x03,0x8d,0x02,0x02, - 0x06,0x00,0x02,0x7e,0x00,0x75,0xfe,0x7e,0xfa,0x00, - 0xfe,0x02,0x04,0x85,0x06,0x00,0x02,0xf9,0x03,0x80, - 0x00,0x0f,0x00,0xf8,0x04,0x00,0x00,0x06,0x02,0x02, - 0x04,0x00,0x02,0x7e,0x00,0x75,0xfe,0x7e,0xfc,0x00, - 0xfe,0x02,0x00,0x05,0x0a,0xf9,0x0d,0x80,0x00,0x0f, - 0xf7,0x00,0xff,0x7e,0x00,0x7b,0x01,0x7e,0x09,0x00, - 0xf6,0xfa,0x04,0x06,0x08,0xfa -}; +namespace agg { +int8u gsv_default_font[] = { + 0x40, 0x00, 0x6c, 0x0f, 0x15, 0x00, 0x0e, 0x00, 0xf9, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x46, 0x6f, 0x6e, 0x74, 0x20, 0x28, 0x63, 0x29, 0x20, 0x4d, 0x69, 0x63, 0x72, 0x6f, + 0x50, 0x72, 0x6f, 0x66, 0x20, 0x32, 0x37, 0x20, 0x53, 0x65, 0x70, 0x74, 0x65, 0x6d, 0x62, 0x2e, 0x31, 0x39, 0x38, + 0x39, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x12, + 0x00, 0x34, 0x00, 0x46, 0x00, 0x94, 0x00, 0xd0, 0x00, 0x2e, 0x01, 0x3e, 0x01, 0x64, 0x01, 0x8a, 0x01, 0x98, 0x01, + 0xa2, 0x01, 0xb4, 0x01, 0xba, 0x01, 0xc6, 0x01, 0xcc, 0x01, 0xf0, 0x01, 0xfa, 0x01, 0x18, 0x02, 0x38, 0x02, 0x44, + 0x02, 0x68, 0x02, 0x98, 0x02, 0xa2, 0x02, 0xde, 0x02, 0x0e, 0x03, 0x24, 0x03, 0x40, 0x03, 0x48, 0x03, 0x52, 0x03, + 0x5a, 0x03, 0x82, 0x03, 0xec, 0x03, 0xfa, 0x03, 0x26, 0x04, 0x4c, 0x04, 0x6a, 0x04, 0x7c, 0x04, 0x8a, 0x04, 0xb6, + 0x04, 0xc4, 0x04, 0xca, 0x04, 0xe0, 0x04, 0xee, 0x04, 0xf8, 0x04, 0x0a, 0x05, 0x18, 0x05, 0x44, 0x05, 0x5e, 0x05, + 0x8e, 0x05, 0xac, 0x05, 0xd6, 0x05, 0xe0, 0x05, 0xf6, 0x05, 0x00, 0x06, 0x12, 0x06, 0x1c, 0x06, 0x28, 0x06, 0x36, + 0x06, 0x48, 0x06, 0x4e, 0x06, 0x60, 0x06, 0x6e, 0x06, 0x74, 0x06, 0x84, 0x06, 0xa6, 0x06, 0xc8, 0x06, 0xe6, 0x06, + 0x08, 0x07, 0x2c, 0x07, 0x3c, 0x07, 0x68, 0x07, 0x7c, 0x07, 0x8c, 0x07, 0xa2, 0x07, 0xb0, 0x07, 0xb6, 0x07, 0xd8, + 0x07, 0xec, 0x07, 0x10, 0x08, 0x32, 0x08, 0x54, 0x08, 0x64, 0x08, 0x88, 0x08, 0x98, 0x08, 0xac, 0x08, 0xb6, 0x08, + 0xc8, 0x08, 0xd2, 0x08, 0xe4, 0x08, 0xf2, 0x08, 0x3e, 0x09, 0x48, 0x09, 0x94, 0x09, 0xc2, 0x09, 0xc4, 0x09, 0xd0, + 0x09, 0xe2, 0x09, 0x04, 0x0a, 0x0e, 0x0a, 0x26, 0x0a, 0x34, 0x0a, 0x4a, 0x0a, 0x66, 0x0a, 0x70, 0x0a, 0x7e, 0x0a, + 0x8e, 0x0a, 0x9a, 0x0a, 0xa6, 0x0a, 0xb4, 0x0a, 0xd8, 0x0a, 0xe2, 0x0a, 0xf6, 0x0a, 0x18, 0x0b, 0x22, 0x0b, 0x32, + 0x0b, 0x56, 0x0b, 0x60, 0x0b, 0x6e, 0x0b, 0x7c, 0x0b, 0x8a, 0x0b, 0x9c, 0x0b, 0x9e, 0x0b, 0xb2, 0x0b, 0xc2, 0x0b, + 0xd8, 0x0b, 0xf4, 0x0b, 0x08, 0x0c, 0x30, 0x0c, 0x56, 0x0c, 0x72, 0x0c, 0x90, 0x0c, 0xb2, 0x0c, 0xce, 0x0c, 0xe2, + 0x0c, 0xfe, 0x0c, 0x10, 0x0d, 0x26, 0x0d, 0x36, 0x0d, 0x42, 0x0d, 0x4e, 0x0d, 0x5c, 0x0d, 0x78, 0x0d, 0x8c, 0x0d, + 0x8e, 0x0d, 0x90, 0x0d, 0x92, 0x0d, 0x94, 0x0d, 0x96, 0x0d, 0x98, 0x0d, 0x9a, 0x0d, 0x9c, 0x0d, 0x9e, 0x0d, 0xa0, + 0x0d, 0xa2, 0x0d, 0xa4, 0x0d, 0xa6, 0x0d, 0xa8, 0x0d, 0xaa, 0x0d, 0xac, 0x0d, 0xae, 0x0d, 0xb0, 0x0d, 0xb2, 0x0d, + 0xb4, 0x0d, 0xb6, 0x0d, 0xb8, 0x0d, 0xba, 0x0d, 0xbc, 0x0d, 0xbe, 0x0d, 0xc0, 0x0d, 0xc2, 0x0d, 0xc4, 0x0d, 0xc6, + 0x0d, 0xc8, 0x0d, 0xca, 0x0d, 0xcc, 0x0d, 0xce, 0x0d, 0xd0, 0x0d, 0xd2, 0x0d, 0xd4, 0x0d, 0xd6, 0x0d, 0xd8, 0x0d, + 0xda, 0x0d, 0xdc, 0x0d, 0xde, 0x0d, 0xe0, 0x0d, 0xe2, 0x0d, 0xe4, 0x0d, 0xe6, 0x0d, 0xe8, 0x0d, 0xea, 0x0d, 0xec, + 0x0d, 0x0c, 0x0e, 0x26, 0x0e, 0x48, 0x0e, 0x64, 0x0e, 0x88, 0x0e, 0x92, 0x0e, 0xa6, 0x0e, 0xb4, 0x0e, 0xd0, 0x0e, + 0xee, 0x0e, 0x02, 0x0f, 0x16, 0x0f, 0x26, 0x0f, 0x3c, 0x0f, 0x58, 0x0f, 0x6c, 0x0f, 0x6c, 0x0f, 0x6c, 0x0f, 0x6c, + 0x0f, 0x6c, 0x0f, 0x6c, 0x0f, 0x6c, 0x0f, 0x6c, 0x0f, 0x6c, 0x0f, 0x6c, 0x0f, 0x6c, 0x0f, 0x6c, 0x0f, 0x6c, 0x0f, + 0x6c, 0x0f, 0x6c, 0x0f, 0x6c, 0x0f, 0x6c, 0x0f, 0x10, 0x80, 0x05, 0x95, 0x00, 0x72, 0x00, 0xfb, 0xff, 0x7f, 0x01, + 0x7f, 0x01, 0x01, 0xff, 0x01, 0x05, 0xfe, 0x05, 0x95, 0xff, 0x7f, 0x00, 0x7a, 0x01, 0x86, 0xff, 0x7a, 0x01, 0x87, + 0x01, 0x7f, 0xfe, 0x7a, 0x0a, 0x87, 0xff, 0x7f, 0x00, 0x7a, 0x01, 0x86, 0xff, 0x7a, 0x01, 0x87, 0x01, 0x7f, 0xfe, + 0x7a, 0x05, 0xf2, 0x0b, 0x95, 0xf9, 0x64, 0x0d, 0x9c, 0xf9, 0x64, 0xfa, 0x91, 0x0e, 0x00, 0xf1, 0xfa, 0x0e, 0x00, + 0x04, 0xfc, 0x08, 0x99, 0x00, 0x63, 0x04, 0x9d, 0x00, 0x63, 0x04, 0x96, 0xff, 0x7f, 0x01, 0x7f, 0x01, 0x01, 0x00, + 0x01, 0xfe, 0x02, 0xfd, 0x01, 0xfc, 0x00, 0xfd, 0x7f, 0xfe, 0x7e, 0x00, 0x7e, 0x01, 0x7e, 0x01, 0x7f, 0x02, 0x7f, + 0x06, 0x7e, 0x02, 0x7f, 0x02, 0x7e, 0xf2, 0x89, 0x02, 0x7e, 0x02, 0x7f, 0x06, 0x7e, 0x02, 0x7f, 0x01, 0x7f, 0x01, + 0x7e, 0x00, 0x7c, 0xfe, 0x7e, 0xfd, 0x7f, 0xfc, 0x00, 0xfd, 0x01, 0xfe, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x7f, + 0xff, 0x7f, 0x10, 0xfd, 0x15, 0x95, 0xee, 0x6b, 0x05, 0x95, 0x02, 0x7e, 0x00, 0x7e, 0xff, 0x7e, 0xfe, 0x7f, 0xfe, + 0x00, 0xfe, 0x02, 0x00, 0x02, 0x01, 0x02, 0x02, 0x01, 0x02, 0x00, 0x02, 0x7f, 0x03, 0x7f, 0x03, 0x00, 0x03, 0x01, + 0x02, 0x01, 0xfc, 0xf2, 0xfe, 0x7f, 0xff, 0x7e, 0x00, 0x7e, 0x02, 0x7e, 0x02, 0x00, 0x02, 0x01, 0x01, 0x02, 0x00, + 0x02, 0xfe, 0x02, 0xfe, 0x00, 0x07, 0xf9, 0x15, 0x8d, 0xff, 0x7f, 0x01, 0x7f, 0x01, 0x01, 0x00, 0x01, 0xff, 0x01, + 0xff, 0x00, 0xff, 0x7f, 0xff, 0x7e, 0xfe, 0x7b, 0xfe, 0x7d, 0xfe, 0x7e, 0xfe, 0x7f, 0xfd, 0x00, 0xfd, 0x01, 0xff, + 0x02, 0x00, 0x03, 0x01, 0x02, 0x06, 0x04, 0x02, 0x02, 0x01, 0x02, 0x00, 0x02, 0xff, 0x02, 0xfe, 0x01, 0xfe, 0x7f, + 0xff, 0x7e, 0x00, 0x7e, 0x01, 0x7d, 0x02, 0x7d, 0x05, 0x79, 0x02, 0x7e, 0x03, 0x7f, 0x01, 0x00, 0x01, 0x01, 0x00, + 0x01, 0xf1, 0xfe, 0xfe, 0x01, 0xff, 0x02, 0x00, 0x03, 0x01, 0x02, 0x02, 0x02, 0x00, 0x86, 0x01, 0x7e, 0x08, 0x75, + 0x02, 0x7e, 0x02, 0x7f, 0x05, 0x80, 0x05, 0x93, 0xff, 0x01, 0x01, 0x01, 0x01, 0x7f, 0x00, 0x7e, 0xff, 0x7e, 0xff, + 0x7f, 0x06, 0xf1, 0x0b, 0x99, 0xfe, 0x7e, 0xfe, 0x7d, 0xfe, 0x7c, 0xff, 0x7b, 0x00, 0x7c, 0x01, 0x7b, 0x02, 0x7c, + 0x02, 0x7d, 0x02, 0x7e, 0xfe, 0x9e, 0xfe, 0x7c, 0xff, 0x7d, 0xff, 0x7b, 0x00, 0x7c, 0x01, 0x7b, 0x01, 0x7d, 0x02, + 0x7c, 0x05, 0x85, 0x03, 0x99, 0x02, 0x7e, 0x02, 0x7d, 0x02, 0x7c, 0x01, 0x7b, 0x00, 0x7c, 0xff, 0x7b, 0xfe, 0x7c, + 0xfe, 0x7d, 0xfe, 0x7e, 0x02, 0x9e, 0x02, 0x7c, 0x01, 0x7d, 0x01, 0x7b, 0x00, 0x7c, 0xff, 0x7b, 0xff, 0x7d, 0xfe, + 0x7c, 0x09, 0x85, 0x08, 0x95, 0x00, 0x74, 0xfb, 0x89, 0x0a, 0x7a, 0x00, 0x86, 0xf6, 0x7a, 0x0d, 0xf4, 0x0d, 0x92, + 0x00, 0x6e, 0xf7, 0x89, 0x12, 0x00, 0x04, 0xf7, 0x06, 0x81, 0xff, 0x7f, 0xff, 0x01, 0x01, 0x01, 0x01, 0x7f, 0x00, + 0x7e, 0xff, 0x7e, 0xff, 0x7f, 0x06, 0x84, 0x04, 0x89, 0x12, 0x00, 0x04, 0xf7, 0x05, 0x82, 0xff, 0x7f, 0x01, 0x7f, + 0x01, 0x01, 0xff, 0x01, 0x05, 0xfe, 0x00, 0xfd, 0x0e, 0x18, 0x00, 0xeb, 0x09, 0x95, 0xfd, 0x7f, 0xfe, 0x7d, 0xff, + 0x7b, 0x00, 0x7d, 0x01, 0x7b, 0x02, 0x7d, 0x03, 0x7f, 0x02, 0x00, 0x03, 0x01, 0x02, 0x03, 0x01, 0x05, 0x00, 0x03, + 0xff, 0x05, 0xfe, 0x03, 0xfd, 0x01, 0xfe, 0x00, 0x0b, 0xeb, 0x06, 0x91, 0x02, 0x01, 0x03, 0x03, 0x00, 0x6b, 0x09, + 0x80, 0x04, 0x90, 0x00, 0x01, 0x01, 0x02, 0x01, 0x01, 0x02, 0x01, 0x04, 0x00, 0x02, 0x7f, 0x01, 0x7f, 0x01, 0x7e, + 0x00, 0x7e, 0xff, 0x7e, 0xfe, 0x7d, 0xf6, 0x76, 0x0e, 0x00, 0x03, 0x80, 0x05, 0x95, 0x0b, 0x00, 0xfa, 0x78, 0x03, + 0x00, 0x02, 0x7f, 0x01, 0x7f, 0x01, 0x7d, 0x00, 0x7e, 0xff, 0x7d, 0xfe, 0x7e, 0xfd, 0x7f, 0xfd, 0x00, 0xfd, 0x01, + 0xff, 0x01, 0xff, 0x02, 0x11, 0xfc, 0x0d, 0x95, 0xf6, 0x72, 0x0f, 0x00, 0xfb, 0x8e, 0x00, 0x6b, 0x07, 0x80, 0x0f, + 0x95, 0xf6, 0x00, 0xff, 0x77, 0x01, 0x01, 0x03, 0x01, 0x03, 0x00, 0x03, 0x7f, 0x02, 0x7e, 0x01, 0x7d, 0x00, 0x7e, + 0xff, 0x7d, 0xfe, 0x7e, 0xfd, 0x7f, 0xfd, 0x00, 0xfd, 0x01, 0xff, 0x01, 0xff, 0x02, 0x11, 0xfc, 0x10, 0x92, 0xff, + 0x02, 0xfd, 0x01, 0xfe, 0x00, 0xfd, 0x7f, 0xfe, 0x7d, 0xff, 0x7b, 0x00, 0x7b, 0x01, 0x7c, 0x02, 0x7e, 0x03, 0x7f, + 0x01, 0x00, 0x03, 0x01, 0x02, 0x02, 0x01, 0x03, 0x00, 0x01, 0xff, 0x03, 0xfe, 0x02, 0xfd, 0x01, 0xff, 0x00, 0xfd, + 0x7f, 0xfe, 0x7e, 0xff, 0x7d, 0x10, 0xf9, 0x11, 0x95, 0xf6, 0x6b, 0xfc, 0x95, 0x0e, 0x00, 0x03, 0xeb, 0x08, 0x95, + 0xfd, 0x7f, 0xff, 0x7e, 0x00, 0x7e, 0x01, 0x7e, 0x02, 0x7f, 0x04, 0x7f, 0x03, 0x7f, 0x02, 0x7e, 0x01, 0x7e, 0x00, + 0x7d, 0xff, 0x7e, 0xff, 0x7f, 0xfd, 0x7f, 0xfc, 0x00, 0xfd, 0x01, 0xff, 0x01, 0xff, 0x02, 0x00, 0x03, 0x01, 0x02, + 0x02, 0x02, 0x03, 0x01, 0x04, 0x01, 0x02, 0x01, 0x01, 0x02, 0x00, 0x02, 0xff, 0x02, 0xfd, 0x01, 0xfc, 0x00, 0x0c, + 0xeb, 0x10, 0x8e, 0xff, 0x7d, 0xfe, 0x7e, 0xfd, 0x7f, 0xff, 0x00, 0xfd, 0x01, 0xfe, 0x02, 0xff, 0x03, 0x00, 0x01, + 0x01, 0x03, 0x02, 0x02, 0x03, 0x01, 0x01, 0x00, 0x03, 0x7f, 0x02, 0x7e, 0x01, 0x7c, 0x00, 0x7b, 0xff, 0x7b, 0xfe, + 0x7d, 0xfd, 0x7f, 0xfe, 0x00, 0xfd, 0x01, 0xff, 0x02, 0x10, 0xfd, 0x05, 0x8e, 0xff, 0x7f, 0x01, 0x7f, 0x01, 0x01, + 0xff, 0x01, 0x00, 0xf4, 0xff, 0x7f, 0x01, 0x7f, 0x01, 0x01, 0xff, 0x01, 0x05, 0xfe, 0x05, 0x8e, 0xff, 0x7f, 0x01, + 0x7f, 0x01, 0x01, 0xff, 0x01, 0x01, 0xf3, 0xff, 0x7f, 0xff, 0x01, 0x01, 0x01, 0x01, 0x7f, 0x00, 0x7e, 0xff, 0x7e, + 0xff, 0x7f, 0x06, 0x84, 0x14, 0x92, 0xf0, 0x77, 0x10, 0x77, 0x04, 0x80, 0x04, 0x8c, 0x12, 0x00, 0xee, 0xfa, 0x12, + 0x00, 0x04, 0xfa, 0x04, 0x92, 0x10, 0x77, 0xf0, 0x77, 0x14, 0x80, 0x03, 0x90, 0x00, 0x01, 0x01, 0x02, 0x01, 0x01, + 0x02, 0x01, 0x04, 0x00, 0x02, 0x7f, 0x01, 0x7f, 0x01, 0x7e, 0x00, 0x7e, 0xff, 0x7e, 0xff, 0x7f, 0xfc, 0x7e, 0x00, + 0x7d, 0x00, 0xfb, 0xff, 0x7f, 0x01, 0x7f, 0x01, 0x01, 0xff, 0x01, 0x09, 0xfe, 0x12, 0x8d, 0xff, 0x02, 0xfe, 0x01, + 0xfd, 0x00, 0xfe, 0x7f, 0xff, 0x7f, 0xff, 0x7d, 0x00, 0x7d, 0x01, 0x7e, 0x02, 0x7f, 0x03, 0x00, 0x02, 0x01, 0x01, + 0x02, 0xfb, 0x88, 0xfe, 0x7e, 0xff, 0x7d, 0x00, 0x7d, 0x01, 0x7e, 0x01, 0x7f, 0x07, 0x8b, 0xff, 0x78, 0x00, 0x7e, + 0x02, 0x7f, 0x02, 0x00, 0x02, 0x02, 0x01, 0x03, 0x00, 0x02, 0xff, 0x03, 0xff, 0x02, 0xfe, 0x02, 0xfe, 0x01, 0xfd, + 0x01, 0xfd, 0x00, 0xfd, 0x7f, 0xfe, 0x7f, 0xfe, 0x7e, 0xff, 0x7e, 0xff, 0x7d, 0x00, 0x7d, 0x01, 0x7d, 0x01, 0x7e, + 0x02, 0x7e, 0x02, 0x7f, 0x03, 0x7f, 0x03, 0x00, 0x03, 0x01, 0x02, 0x01, 0x01, 0x01, 0xfe, 0x8d, 0xff, 0x78, 0x00, + 0x7e, 0x01, 0x7f, 0x08, 0xfb, 0x09, 0x95, 0xf8, 0x6b, 0x08, 0x95, 0x08, 0x6b, 0xf3, 0x87, 0x0a, 0x00, 0x04, 0xf9, + 0x04, 0x95, 0x00, 0x6b, 0x00, 0x95, 0x09, 0x00, 0x03, 0x7f, 0x01, 0x7f, 0x01, 0x7e, 0x00, 0x7e, 0xff, 0x7e, 0xff, + 0x7f, 0xfd, 0x7f, 0xf7, 0x80, 0x09, 0x00, 0x03, 0x7f, 0x01, 0x7f, 0x01, 0x7e, 0x00, 0x7d, 0xff, 0x7e, 0xff, 0x7f, + 0xfd, 0x7f, 0xf7, 0x00, 0x11, 0x80, 0x12, 0x90, 0xff, 0x02, 0xfe, 0x02, 0xfe, 0x01, 0xfc, 0x00, 0xfe, 0x7f, 0xfe, + 0x7e, 0xff, 0x7e, 0xff, 0x7d, 0x00, 0x7b, 0x01, 0x7d, 0x01, 0x7e, 0x02, 0x7e, 0x02, 0x7f, 0x04, 0x00, 0x02, 0x01, + 0x02, 0x02, 0x01, 0x02, 0x03, 0xfb, 0x04, 0x95, 0x00, 0x6b, 0x00, 0x95, 0x07, 0x00, 0x03, 0x7f, 0x02, 0x7e, 0x01, + 0x7e, 0x01, 0x7d, 0x00, 0x7b, 0xff, 0x7d, 0xff, 0x7e, 0xfe, 0x7e, 0xfd, 0x7f, 0xf9, 0x00, 0x11, 0x80, 0x04, 0x95, + 0x00, 0x6b, 0x00, 0x95, 0x0d, 0x00, 0xf3, 0xf6, 0x08, 0x00, 0xf8, 0xf5, 0x0d, 0x00, 0x02, 0x80, 0x04, 0x95, 0x00, + 0x6b, 0x00, 0x95, 0x0d, 0x00, 0xf3, 0xf6, 0x08, 0x00, 0x06, 0xf5, 0x12, 0x90, 0xff, 0x02, 0xfe, 0x02, 0xfe, 0x01, + 0xfc, 0x00, 0xfe, 0x7f, 0xfe, 0x7e, 0xff, 0x7e, 0xff, 0x7d, 0x00, 0x7b, 0x01, 0x7d, 0x01, 0x7e, 0x02, 0x7e, 0x02, + 0x7f, 0x04, 0x00, 0x02, 0x01, 0x02, 0x02, 0x01, 0x02, 0x00, 0x03, 0xfb, 0x80, 0x05, 0x00, 0x03, 0xf8, 0x04, 0x95, + 0x00, 0x6b, 0x0e, 0x95, 0x00, 0x6b, 0xf2, 0x8b, 0x0e, 0x00, 0x04, 0xf5, 0x04, 0x95, 0x00, 0x6b, 0x04, 0x80, 0x0c, + 0x95, 0x00, 0x70, 0xff, 0x7d, 0xff, 0x7f, 0xfe, 0x7f, 0xfe, 0x00, 0xfe, 0x01, 0xff, 0x01, 0xff, 0x03, 0x00, 0x02, + 0x0e, 0xf9, 0x04, 0x95, 0x00, 0x6b, 0x0e, 0x95, 0xf2, 0x72, 0x05, 0x85, 0x09, 0x74, 0x03, 0x80, 0x04, 0x95, 0x00, + 0x6b, 0x00, 0x80, 0x0c, 0x00, 0x01, 0x80, 0x04, 0x95, 0x00, 0x6b, 0x00, 0x95, 0x08, 0x6b, 0x08, 0x95, 0xf8, 0x6b, + 0x08, 0x95, 0x00, 0x6b, 0x04, 0x80, 0x04, 0x95, 0x00, 0x6b, 0x00, 0x95, 0x0e, 0x6b, 0x00, 0x95, 0x00, 0x6b, 0x04, + 0x80, 0x09, 0x95, 0xfe, 0x7f, 0xfe, 0x7e, 0xff, 0x7e, 0xff, 0x7d, 0x00, 0x7b, 0x01, 0x7d, 0x01, 0x7e, 0x02, 0x7e, + 0x02, 0x7f, 0x04, 0x00, 0x02, 0x01, 0x02, 0x02, 0x01, 0x02, 0x01, 0x03, 0x00, 0x05, 0xff, 0x03, 0xff, 0x02, 0xfe, + 0x02, 0xfe, 0x01, 0xfc, 0x00, 0x0d, 0xeb, 0x04, 0x95, 0x00, 0x6b, 0x00, 0x95, 0x09, 0x00, 0x03, 0x7f, 0x01, 0x7f, + 0x01, 0x7e, 0x00, 0x7d, 0xff, 0x7e, 0xff, 0x7f, 0xfd, 0x7f, 0xf7, 0x00, 0x11, 0xf6, 0x09, 0x95, 0xfe, 0x7f, 0xfe, + 0x7e, 0xff, 0x7e, 0xff, 0x7d, 0x00, 0x7b, 0x01, 0x7d, 0x01, 0x7e, 0x02, 0x7e, 0x02, 0x7f, 0x04, 0x00, 0x02, 0x01, + 0x02, 0x02, 0x01, 0x02, 0x01, 0x03, 0x00, 0x05, 0xff, 0x03, 0xff, 0x02, 0xfe, 0x02, 0xfe, 0x01, 0xfc, 0x00, 0x03, + 0xef, 0x06, 0x7a, 0x04, 0x82, 0x04, 0x95, 0x00, 0x6b, 0x00, 0x95, 0x09, 0x00, 0x03, 0x7f, 0x01, 0x7f, 0x01, 0x7e, + 0x00, 0x7e, 0xff, 0x7e, 0xff, 0x7f, 0xfd, 0x7f, 0xf7, 0x00, 0x07, 0x80, 0x07, 0x75, 0x03, 0x80, 0x11, 0x92, 0xfe, + 0x02, 0xfd, 0x01, 0xfc, 0x00, 0xfd, 0x7f, 0xfe, 0x7e, 0x00, 0x7e, 0x01, 0x7e, 0x01, 0x7f, 0x02, 0x7f, 0x06, 0x7e, + 0x02, 0x7f, 0x01, 0x7f, 0x01, 0x7e, 0x00, 0x7d, 0xfe, 0x7e, 0xfd, 0x7f, 0xfc, 0x00, 0xfd, 0x01, 0xfe, 0x02, 0x11, + 0xfd, 0x08, 0x95, 0x00, 0x6b, 0xf9, 0x95, 0x0e, 0x00, 0x01, 0xeb, 0x04, 0x95, 0x00, 0x71, 0x01, 0x7d, 0x02, 0x7e, + 0x03, 0x7f, 0x02, 0x00, 0x03, 0x01, 0x02, 0x02, 0x01, 0x03, 0x00, 0x0f, 0x04, 0xeb, 0x01, 0x95, 0x08, 0x6b, 0x08, + 0x95, 0xf8, 0x6b, 0x09, 0x80, 0x02, 0x95, 0x05, 0x6b, 0x05, 0x95, 0xfb, 0x6b, 0x05, 0x95, 0x05, 0x6b, 0x05, 0x95, + 0xfb, 0x6b, 0x07, 0x80, 0x03, 0x95, 0x0e, 0x6b, 0x00, 0x95, 0xf2, 0x6b, 0x11, 0x80, 0x01, 0x95, 0x08, 0x76, 0x00, + 0x75, 0x08, 0x95, 0xf8, 0x76, 0x09, 0xf5, 0x11, 0x95, 0xf2, 0x6b, 0x00, 0x95, 0x0e, 0x00, 0xf2, 0xeb, 0x0e, 0x00, + 0x03, 0x80, 0x03, 0x93, 0x00, 0x6c, 0x01, 0x94, 0x00, 0x6c, 0xff, 0x94, 0x05, 0x00, 0xfb, 0xec, 0x05, 0x00, 0x02, + 0x81, 0x00, 0x95, 0x0e, 0x68, 0x00, 0x83, 0x06, 0x93, 0x00, 0x6c, 0x01, 0x94, 0x00, 0x6c, 0xfb, 0x94, 0x05, 0x00, + 0xfb, 0xec, 0x05, 0x00, 0x03, 0x81, 0x03, 0x87, 0x08, 0x05, 0x08, 0x7b, 0xf0, 0x80, 0x08, 0x04, 0x08, 0x7c, 0x03, + 0xf9, 0x01, 0x80, 0x10, 0x00, 0x01, 0x80, 0x06, 0x95, 0xff, 0x7f, 0xff, 0x7e, 0x00, 0x7e, 0x01, 0x7f, 0x01, 0x01, + 0xff, 0x01, 0x05, 0xef, 0x0f, 0x8e, 0x00, 0x72, 0x00, 0x8b, 0xfe, 0x02, 0xfe, 0x01, 0xfd, 0x00, 0xfe, 0x7f, 0xfe, + 0x7e, 0xff, 0x7d, 0x00, 0x7e, 0x01, 0x7d, 0x02, 0x7e, 0x02, 0x7f, 0x03, 0x00, 0x02, 0x01, 0x02, 0x02, 0x04, 0xfd, + 0x04, 0x95, 0x00, 0x6b, 0x00, 0x8b, 0x02, 0x02, 0x02, 0x01, 0x03, 0x00, 0x02, 0x7f, 0x02, 0x7e, 0x01, 0x7d, 0x00, + 0x7e, 0xff, 0x7d, 0xfe, 0x7e, 0xfe, 0x7f, 0xfd, 0x00, 0xfe, 0x01, 0xfe, 0x02, 0x0f, 0xfd, 0x0f, 0x8b, 0xfe, 0x02, + 0xfe, 0x01, 0xfd, 0x00, 0xfe, 0x7f, 0xfe, 0x7e, 0xff, 0x7d, 0x00, 0x7e, 0x01, 0x7d, 0x02, 0x7e, 0x02, 0x7f, 0x03, + 0x00, 0x02, 0x01, 0x02, 0x02, 0x03, 0xfd, 0x0f, 0x95, 0x00, 0x6b, 0x00, 0x8b, 0xfe, 0x02, 0xfe, 0x01, 0xfd, 0x00, + 0xfe, 0x7f, 0xfe, 0x7e, 0xff, 0x7d, 0x00, 0x7e, 0x01, 0x7d, 0x02, 0x7e, 0x02, 0x7f, 0x03, 0x00, 0x02, 0x01, 0x02, + 0x02, 0x04, 0xfd, 0x03, 0x88, 0x0c, 0x00, 0x00, 0x02, 0xff, 0x02, 0xff, 0x01, 0xfe, 0x01, 0xfd, 0x00, 0xfe, 0x7f, + 0xfe, 0x7e, 0xff, 0x7d, 0x00, 0x7e, 0x01, 0x7d, 0x02, 0x7e, 0x02, 0x7f, 0x03, 0x00, 0x02, 0x01, 0x02, 0x02, 0x03, + 0xfd, 0x0a, 0x95, 0xfe, 0x00, 0xfe, 0x7f, 0xff, 0x7d, 0x00, 0x6f, 0xfd, 0x8e, 0x07, 0x00, 0x03, 0xf2, 0x0f, 0x8e, + 0x00, 0x70, 0xff, 0x7d, 0xff, 0x7f, 0xfe, 0x7f, 0xfd, 0x00, 0xfe, 0x01, 0x09, 0x91, 0xfe, 0x02, 0xfe, 0x01, 0xfd, + 0x00, 0xfe, 0x7f, 0xfe, 0x7e, 0xff, 0x7d, 0x00, 0x7e, 0x01, 0x7d, 0x02, 0x7e, 0x02, 0x7f, 0x03, 0x00, 0x02, 0x01, + 0x02, 0x02, 0x04, 0xfd, 0x04, 0x95, 0x00, 0x6b, 0x00, 0x8a, 0x03, 0x03, 0x02, 0x01, 0x03, 0x00, 0x02, 0x7f, 0x01, + 0x7d, 0x00, 0x76, 0x04, 0x80, 0x03, 0x95, 0x01, 0x7f, 0x01, 0x01, 0xff, 0x01, 0xff, 0x7f, 0x01, 0xf9, 0x00, 0x72, + 0x04, 0x80, 0x05, 0x95, 0x01, 0x7f, 0x01, 0x01, 0xff, 0x01, 0xff, 0x7f, 0x01, 0xf9, 0x00, 0x6f, 0xff, 0x7d, 0xfe, + 0x7f, 0xfe, 0x00, 0x09, 0x87, 0x04, 0x95, 0x00, 0x6b, 0x0a, 0x8e, 0xf6, 0x76, 0x04, 0x84, 0x07, 0x78, 0x02, 0x80, + 0x04, 0x95, 0x00, 0x6b, 0x04, 0x80, 0x04, 0x8e, 0x00, 0x72, 0x00, 0x8a, 0x03, 0x03, 0x02, 0x01, 0x03, 0x00, 0x02, + 0x7f, 0x01, 0x7d, 0x00, 0x76, 0x00, 0x8a, 0x03, 0x03, 0x02, 0x01, 0x03, 0x00, 0x02, 0x7f, 0x01, 0x7d, 0x00, 0x76, + 0x04, 0x80, 0x04, 0x8e, 0x00, 0x72, 0x00, 0x8a, 0x03, 0x03, 0x02, 0x01, 0x03, 0x00, 0x02, 0x7f, 0x01, 0x7d, 0x00, + 0x76, 0x04, 0x80, 0x08, 0x8e, 0xfe, 0x7f, 0xfe, 0x7e, 0xff, 0x7d, 0x00, 0x7e, 0x01, 0x7d, 0x02, 0x7e, 0x02, 0x7f, + 0x03, 0x00, 0x02, 0x01, 0x02, 0x02, 0x01, 0x03, 0x00, 0x02, 0xff, 0x03, 0xfe, 0x02, 0xfe, 0x01, 0xfd, 0x00, 0x0b, + 0xf2, 0x04, 0x8e, 0x00, 0x6b, 0x00, 0x92, 0x02, 0x02, 0x02, 0x01, 0x03, 0x00, 0x02, 0x7f, 0x02, 0x7e, 0x01, 0x7d, + 0x00, 0x7e, 0xff, 0x7d, 0xfe, 0x7e, 0xfe, 0x7f, 0xfd, 0x00, 0xfe, 0x01, 0xfe, 0x02, 0x0f, 0xfd, 0x0f, 0x8e, 0x00, + 0x6b, 0x00, 0x92, 0xfe, 0x02, 0xfe, 0x01, 0xfd, 0x00, 0xfe, 0x7f, 0xfe, 0x7e, 0xff, 0x7d, 0x00, 0x7e, 0x01, 0x7d, + 0x02, 0x7e, 0x02, 0x7f, 0x03, 0x00, 0x02, 0x01, 0x02, 0x02, 0x04, 0xfd, 0x04, 0x8e, 0x00, 0x72, 0x00, 0x88, 0x01, + 0x03, 0x02, 0x02, 0x02, 0x01, 0x03, 0x00, 0x01, 0xf2, 0x0e, 0x8b, 0xff, 0x02, 0xfd, 0x01, 0xfd, 0x00, 0xfd, 0x7f, + 0xff, 0x7e, 0x01, 0x7e, 0x02, 0x7f, 0x05, 0x7f, 0x02, 0x7f, 0x01, 0x7e, 0x00, 0x7f, 0xff, 0x7e, 0xfd, 0x7f, 0xfd, + 0x00, 0xfd, 0x01, 0xff, 0x02, 0x0e, 0xfd, 0x05, 0x95, 0x00, 0x6f, 0x01, 0x7d, 0x02, 0x7f, 0x02, 0x00, 0xf8, 0x8e, + 0x07, 0x00, 0x03, 0xf2, 0x04, 0x8e, 0x00, 0x76, 0x01, 0x7d, 0x02, 0x7f, 0x03, 0x00, 0x02, 0x01, 0x03, 0x03, 0x00, + 0x8a, 0x00, 0x72, 0x04, 0x80, 0x02, 0x8e, 0x06, 0x72, 0x06, 0x8e, 0xfa, 0x72, 0x08, 0x80, 0x03, 0x8e, 0x04, 0x72, + 0x04, 0x8e, 0xfc, 0x72, 0x04, 0x8e, 0x04, 0x72, 0x04, 0x8e, 0xfc, 0x72, 0x07, 0x80, 0x03, 0x8e, 0x0b, 0x72, 0x00, + 0x8e, 0xf5, 0x72, 0x0e, 0x80, 0x02, 0x8e, 0x06, 0x72, 0x06, 0x8e, 0xfa, 0x72, 0xfe, 0x7c, 0xfe, 0x7e, 0xfe, 0x7f, + 0xff, 0x00, 0x0f, 0x87, 0x0e, 0x8e, 0xf5, 0x72, 0x00, 0x8e, 0x0b, 0x00, 0xf5, 0xf2, 0x0b, 0x00, 0x03, 0x80, 0x09, + 0x99, 0xfe, 0x7f, 0xff, 0x7f, 0xff, 0x7e, 0x00, 0x7e, 0x01, 0x7e, 0x01, 0x7f, 0x01, 0x7e, 0x00, 0x7e, 0xfe, 0x7e, + 0x01, 0x8e, 0xff, 0x7e, 0x00, 0x7e, 0x01, 0x7e, 0x01, 0x7f, 0x01, 0x7e, 0x00, 0x7e, 0xff, 0x7e, 0xfc, 0x7e, 0x04, + 0x7e, 0x01, 0x7e, 0x00, 0x7e, 0xff, 0x7e, 0xff, 0x7f, 0xff, 0x7e, 0x00, 0x7e, 0x01, 0x7e, 0xff, 0x8e, 0x02, 0x7e, + 0x00, 0x7e, 0xff, 0x7e, 0xff, 0x7f, 0xff, 0x7e, 0x00, 0x7e, 0x01, 0x7e, 0x01, 0x7f, 0x02, 0x7f, 0x05, 0x87, 0x04, + 0x95, 0x00, 0x77, 0x00, 0xfd, 0x00, 0x77, 0x04, 0x80, 0x05, 0x99, 0x02, 0x7f, 0x01, 0x7f, 0x01, 0x7e, 0x00, 0x7e, + 0xff, 0x7e, 0xff, 0x7f, 0xff, 0x7e, 0x00, 0x7e, 0x02, 0x7e, 0xff, 0x8e, 0x01, 0x7e, 0x00, 0x7e, 0xff, 0x7e, 0xff, + 0x7f, 0xff, 0x7e, 0x00, 0x7e, 0x01, 0x7e, 0x04, 0x7e, 0xfc, 0x7e, 0xff, 0x7e, 0x00, 0x7e, 0x01, 0x7e, 0x01, 0x7f, + 0x01, 0x7e, 0x00, 0x7e, 0xff, 0x7e, 0x01, 0x8e, 0xfe, 0x7e, 0x00, 0x7e, 0x01, 0x7e, 0x01, 0x7f, 0x01, 0x7e, 0x00, + 0x7e, 0xff, 0x7e, 0xff, 0x7f, 0xfe, 0x7f, 0x09, 0x87, 0x03, 0x86, 0x00, 0x02, 0x01, 0x03, 0x02, 0x01, 0x02, 0x00, + 0x02, 0x7f, 0x04, 0x7d, 0x02, 0x7f, 0x02, 0x00, 0x02, 0x01, 0x01, 0x02, 0xee, 0xfe, 0x01, 0x02, 0x02, 0x01, 0x02, + 0x00, 0x02, 0x7f, 0x04, 0x7d, 0x02, 0x7f, 0x02, 0x00, 0x02, 0x01, 0x01, 0x03, 0x00, 0x02, 0x03, 0xf4, 0x10, 0x80, + 0x03, 0x80, 0x07, 0x15, 0x08, 0x6b, 0xfe, 0x85, 0xf5, 0x00, 0x10, 0xfb, 0x0d, 0x95, 0xf6, 0x00, 0x00, 0x6b, 0x0a, + 0x00, 0x02, 0x02, 0x00, 0x08, 0xfe, 0x02, 0xf6, 0x00, 0x0e, 0xf4, 0x03, 0x80, 0x00, 0x15, 0x0a, 0x00, 0x02, 0x7e, + 0x00, 0x7e, 0x00, 0x7d, 0x00, 0x7e, 0xfe, 0x7f, 0xf6, 0x00, 0x0a, 0x80, 0x02, 0x7e, 0x01, 0x7e, 0x00, 0x7d, 0xff, + 0x7d, 0xfe, 0x7f, 0xf6, 0x00, 0x10, 0x80, 0x03, 0x80, 0x00, 0x15, 0x0c, 0x00, 0xff, 0x7e, 0x03, 0xed, 0x03, 0xfd, + 0x00, 0x03, 0x02, 0x00, 0x00, 0x12, 0x02, 0x03, 0x0a, 0x00, 0x00, 0x6b, 0x02, 0x00, 0x00, 0x7d, 0xfe, 0x83, 0xf4, + 0x00, 0x11, 0x80, 0x0f, 0x80, 0xf4, 0x00, 0x00, 0x15, 0x0c, 0x00, 0xff, 0xf6, 0xf5, 0x00, 0x0f, 0xf5, 0x04, 0x95, + 0x07, 0x76, 0x00, 0x0a, 0x07, 0x80, 0xf9, 0x76, 0x00, 0x75, 0xf8, 0x80, 0x07, 0x0c, 0x09, 0xf4, 0xf9, 0x0c, 0x09, + 0xf4, 0x03, 0x92, 0x02, 0x03, 0x07, 0x00, 0x03, 0x7d, 0x00, 0x7b, 0xfc, 0x7e, 0x04, 0x7d, 0x00, 0x7a, 0xfd, 0x7e, + 0xf9, 0x00, 0xfe, 0x02, 0x06, 0x89, 0x02, 0x00, 0x06, 0xf5, 0x03, 0x95, 0x00, 0x6b, 0x0c, 0x15, 0x00, 0x6b, 0x02, + 0x80, 0x03, 0x95, 0x00, 0x6b, 0x0c, 0x15, 0x00, 0x6b, 0xf8, 0x96, 0x03, 0x00, 0x07, 0xea, 0x03, 0x80, 0x00, 0x15, + 0x0c, 0x80, 0xf7, 0x76, 0xfd, 0x00, 0x03, 0x80, 0x0a, 0x75, 0x03, 0x80, 0x03, 0x80, 0x07, 0x13, 0x02, 0x02, 0x03, + 0x00, 0x00, 0x6b, 0x02, 0x80, 0x03, 0x80, 0x00, 0x15, 0x09, 0x6b, 0x09, 0x15, 0x00, 0x6b, 0x03, 0x80, 0x03, 0x80, + 0x00, 0x15, 0x00, 0xf6, 0x0d, 0x00, 0x00, 0x8a, 0x00, 0x6b, 0x03, 0x80, 0x07, 0x80, 0xfd, 0x00, 0xff, 0x03, 0x00, + 0x04, 0x00, 0x07, 0x00, 0x04, 0x01, 0x02, 0x03, 0x01, 0x06, 0x00, 0x03, 0x7f, 0x01, 0x7e, 0x01, 0x7c, 0x00, 0x79, + 0xff, 0x7c, 0xff, 0x7d, 0xfd, 0x00, 0xfa, 0x00, 0x0e, 0x80, 0x03, 0x80, 0x00, 0x15, 0x0c, 0x00, 0x00, 0x6b, 0x02, + 0x80, 0x03, 0x80, 0x00, 0x15, 0x0a, 0x00, 0x02, 0x7f, 0x01, 0x7d, 0x00, 0x7b, 0xff, 0x7e, 0xfe, 0x7f, 0xf6, 0x00, + 0x10, 0xf7, 0x11, 0x8f, 0xff, 0x03, 0xff, 0x02, 0xfe, 0x01, 0xfa, 0x00, 0xfd, 0x7f, 0xff, 0x7e, 0x00, 0x7c, 0x00, + 0x79, 0x00, 0x7b, 0x01, 0x7e, 0x03, 0x00, 0x06, 0x00, 0x02, 0x00, 0x01, 0x03, 0x01, 0x02, 0x03, 0xfb, 0x03, 0x95, + 0x0c, 0x00, 0xfa, 0x80, 0x00, 0x6b, 0x09, 0x80, 0x03, 0x95, 0x00, 0x77, 0x06, 0x7a, 0x06, 0x06, 0x00, 0x09, 0xfa, + 0xf1, 0xfa, 0x7a, 0x0e, 0x80, 0x03, 0x87, 0x00, 0x0b, 0x02, 0x02, 0x03, 0x00, 0x02, 0x7e, 0x01, 0x02, 0x04, 0x00, + 0x02, 0x7e, 0x00, 0x75, 0xfe, 0x7e, 0xfc, 0x00, 0xff, 0x01, 0xfe, 0x7f, 0xfd, 0x00, 0xfe, 0x02, 0x07, 0x8e, 0x00, + 0x6b, 0x09, 0x80, 0x03, 0x80, 0x0e, 0x15, 0xf2, 0x80, 0x0e, 0x6b, 0x03, 0x80, 0x03, 0x95, 0x00, 0x6b, 0x0e, 0x00, + 0x00, 0x7d, 0xfe, 0x98, 0x00, 0x6b, 0x05, 0x80, 0x03, 0x95, 0x00, 0x75, 0x02, 0x7d, 0x0a, 0x00, 0x00, 0x8e, 0x00, + 0x6b, 0x02, 0x80, 0x03, 0x95, 0x00, 0x6b, 0x10, 0x00, 0x00, 0x15, 0xf8, 0x80, 0x00, 0x6b, 0x0a, 0x80, 0x03, 0x95, + 0x00, 0x6b, 0x10, 0x00, 0x00, 0x15, 0xf8, 0x80, 0x00, 0x6b, 0x0a, 0x00, 0x00, 0x7d, 0x02, 0x83, 0x10, 0x80, 0x03, + 0x95, 0x00, 0x6b, 0x09, 0x00, 0x03, 0x02, 0x00, 0x08, 0xfd, 0x02, 0xf7, 0x00, 0x0e, 0x89, 0x00, 0x6b, 0x03, 0x80, + 0x03, 0x95, 0x00, 0x6b, 0x09, 0x00, 0x03, 0x02, 0x00, 0x08, 0xfd, 0x02, 0xf7, 0x00, 0x0e, 0xf4, 0x03, 0x92, 0x02, + 0x03, 0x07, 0x00, 0x03, 0x7d, 0x00, 0x70, 0xfd, 0x7e, 0xf9, 0x00, 0xfe, 0x02, 0x03, 0x89, 0x09, 0x00, 0x02, 0xf5, + 0x03, 0x80, 0x00, 0x15, 0x00, 0xf5, 0x07, 0x00, 0x00, 0x08, 0x02, 0x03, 0x06, 0x00, 0x02, 0x7d, 0x00, 0x70, 0xfe, + 0x7e, 0xfa, 0x00, 0xfe, 0x02, 0x00, 0x08, 0x0c, 0xf6, 0x0f, 0x80, 0x00, 0x15, 0xf6, 0x00, 0xfe, 0x7d, 0x00, 0x79, + 0x02, 0x7e, 0x0a, 0x00, 0xf4, 0xf7, 0x07, 0x09, 0x07, 0xf7, 0x03, 0x8c, 0x01, 0x02, 0x01, 0x01, 0x05, 0x00, 0x02, + 0x7f, 0x01, 0x7e, 0x00, 0x74, 0x00, 0x86, 0xff, 0x01, 0xfe, 0x01, 0xfb, 0x00, 0xff, 0x7f, 0xff, 0x7f, 0x00, 0x7c, + 0x01, 0x7e, 0x01, 0x00, 0x05, 0x00, 0x02, 0x00, 0x01, 0x02, 0x03, 0xfe, 0x04, 0x8e, 0x02, 0x01, 0x04, 0x00, 0x02, + 0x7f, 0x01, 0x7e, 0x00, 0x77, 0xff, 0x7e, 0xfe, 0x7f, 0xfc, 0x00, 0xfe, 0x01, 0xff, 0x02, 0x00, 0x09, 0x01, 0x02, + 0x02, 0x02, 0x03, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0xeb, 0x03, 0x80, 0x00, 0x15, 0x03, 0x00, 0x02, + 0x7e, 0x00, 0x7b, 0xfe, 0x7e, 0xfd, 0x00, 0x03, 0x80, 0x04, 0x00, 0x03, 0x7e, 0x00, 0x78, 0xfd, 0x7e, 0xf9, 0x00, + 0x0c, 0x80, 0x03, 0x8c, 0x02, 0x02, 0x02, 0x01, 0x03, 0x00, 0x02, 0x7f, 0x01, 0x7d, 0xfe, 0x7e, 0xf9, 0x7d, 0xff, + 0x7e, 0x00, 0x7d, 0x03, 0x7f, 0x02, 0x00, 0x03, 0x01, 0x02, 0x01, 0x02, 0xfe, 0x0d, 0x8c, 0xff, 0x02, 0xfe, 0x01, + 0xfc, 0x00, 0xfe, 0x7f, 0xff, 0x7e, 0x00, 0x77, 0x01, 0x7e, 0x02, 0x7f, 0x04, 0x00, 0x02, 0x01, 0x01, 0x02, 0x00, + 0x0f, 0xff, 0x02, 0xfe, 0x01, 0xf9, 0x00, 0x0c, 0xeb, 0x03, 0x88, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x03, 0xfe, 0x02, + 0xfa, 0x00, 0xff, 0x7e, 0xff, 0x7d, 0x00, 0x7b, 0x01, 0x7c, 0x01, 0x7f, 0x06, 0x00, 0x02, 0x02, 0x03, 0xfe, 0x03, + 0x8f, 0x06, 0x77, 0x06, 0x09, 0xfa, 0x80, 0x00, 0x71, 0xff, 0x87, 0xfb, 0x79, 0x07, 0x87, 0x05, 0x79, 0x02, 0x80, + 0x03, 0x8d, 0x02, 0x02, 0x06, 0x00, 0x02, 0x7e, 0x00, 0x7d, 0xfc, 0x7d, 0x04, 0x7e, 0x00, 0x7d, 0xfe, 0x7e, 0xfa, + 0x00, 0xfe, 0x02, 0x04, 0x85, 0x02, 0x00, 0x06, 0xf9, 0x03, 0x8f, 0x00, 0x73, 0x01, 0x7e, 0x07, 0x00, 0x02, 0x02, + 0x00, 0x0d, 0x00, 0xf3, 0x01, 0x7e, 0x03, 0x80, 0x03, 0x8f, 0x00, 0x73, 0x01, 0x7e, 0x07, 0x00, 0x02, 0x02, 0x00, + 0x0d, 0x00, 0xf3, 0x01, 0x7e, 0xf8, 0x90, 0x03, 0x00, 0x08, 0xf0, 0x03, 0x80, 0x00, 0x15, 0x00, 0xf3, 0x02, 0x00, + 0x06, 0x07, 0xfa, 0xf9, 0x07, 0x78, 0x03, 0x80, 0x03, 0x80, 0x04, 0x0c, 0x02, 0x03, 0x04, 0x00, 0x00, 0x71, 0x02, + 0x80, 0x03, 0x80, 0x00, 0x0f, 0x06, 0x77, 0x06, 0x09, 0x00, 0x71, 0x02, 0x80, 0x03, 0x80, 0x00, 0x0f, 0x0a, 0xf1, + 0x00, 0x0f, 0xf6, 0xf8, 0x0a, 0x00, 0x02, 0xf9, 0x05, 0x80, 0xff, 0x01, 0xff, 0x04, 0x00, 0x05, 0x01, 0x03, 0x01, + 0x02, 0x06, 0x00, 0x02, 0x7e, 0x00, 0x7d, 0x00, 0x7b, 0x00, 0x7c, 0xfe, 0x7f, 0xfa, 0x00, 0x0b, 0x80, 0x03, 0x80, + 0x00, 0x0f, 0x00, 0xfb, 0x01, 0x03, 0x01, 0x02, 0x05, 0x00, 0x02, 0x7e, 0x01, 0x7d, 0x00, 0x76, 0x03, 0x80, 0x10, + 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, + 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, + 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, + 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, + 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0x80, + 0x0a, 0x8f, 0x02, 0x7f, 0x01, 0x7e, 0x00, 0x76, 0xff, 0x7f, 0xfe, 0x7f, 0xfb, 0x00, 0xff, 0x01, 0xff, 0x01, 0x00, + 0x0a, 0x01, 0x02, 0x01, 0x01, 0x05, 0x00, 0xf9, 0x80, 0x00, 0x6b, 0x0c, 0x86, 0x0d, 0x8a, 0xff, 0x03, 0xfe, 0x02, + 0xfb, 0x00, 0xff, 0x7e, 0xff, 0x7d, 0x00, 0x7b, 0x01, 0x7c, 0x01, 0x7f, 0x05, 0x00, 0x02, 0x01, 0x01, 0x03, 0x03, + 0xfc, 0x03, 0x80, 0x00, 0x0f, 0x00, 0xfb, 0x01, 0x03, 0x01, 0x02, 0x04, 0x00, 0x01, 0x7e, 0x01, 0x7d, 0x00, 0x76, + 0x00, 0x8a, 0x01, 0x03, 0x02, 0x02, 0x03, 0x00, 0x02, 0x7e, 0x01, 0x7d, 0x00, 0x76, 0x03, 0x80, 0x03, 0x8f, 0x00, + 0x74, 0x01, 0x7e, 0x02, 0x7f, 0x04, 0x00, 0x02, 0x01, 0x01, 0x01, 0x00, 0x8d, 0x00, 0x6e, 0xff, 0x7e, 0xfe, 0x7f, + 0xfb, 0x00, 0xfe, 0x01, 0x0c, 0x85, 0x03, 0x8d, 0x01, 0x02, 0x03, 0x00, 0x02, 0x7e, 0x01, 0x02, 0x03, 0x00, 0x02, + 0x7e, 0x00, 0x74, 0xfe, 0x7f, 0xfd, 0x00, 0xff, 0x01, 0xfe, 0x7f, 0xfd, 0x00, 0xff, 0x01, 0x00, 0x0c, 0x06, 0x82, + 0x00, 0x6b, 0x08, 0x86, 0x03, 0x80, 0x0a, 0x0f, 0xf6, 0x80, 0x0a, 0x71, 0x03, 0x80, 0x03, 0x8f, 0x00, 0x73, 0x01, + 0x7e, 0x07, 0x00, 0x02, 0x02, 0x00, 0x0d, 0x00, 0xf3, 0x01, 0x7e, 0x00, 0x7e, 0x03, 0x82, 0x03, 0x8f, 0x00, 0x79, + 0x02, 0x7e, 0x08, 0x00, 0x00, 0x89, 0x00, 0x71, 0x02, 0x80, 0x03, 0x8f, 0x00, 0x73, 0x01, 0x7e, 0x03, 0x00, 0x02, + 0x02, 0x00, 0x0d, 0x00, 0xf3, 0x01, 0x7e, 0x03, 0x00, 0x02, 0x02, 0x00, 0x0d, 0x00, 0xf3, 0x01, 0x7e, 0x03, 0x80, + 0x03, 0x8f, 0x00, 0x73, 0x01, 0x7e, 0x03, 0x00, 0x02, 0x02, 0x00, 0x0d, 0x00, 0xf3, 0x01, 0x7e, 0x03, 0x00, 0x02, + 0x02, 0x00, 0x0d, 0x00, 0xf3, 0x01, 0x7e, 0x00, 0x7e, 0x03, 0x82, 0x03, 0x8d, 0x00, 0x02, 0x02, 0x00, 0x00, 0x71, + 0x08, 0x00, 0x02, 0x02, 0x00, 0x06, 0xfe, 0x02, 0xf8, 0x00, 0x0c, 0xf6, 0x03, 0x8f, 0x00, 0x71, 0x07, 0x00, 0x02, + 0x02, 0x00, 0x06, 0xfe, 0x02, 0xf9, 0x00, 0x0c, 0x85, 0x00, 0x71, 0x02, 0x80, 0x03, 0x8f, 0x00, 0x71, 0x07, 0x00, + 0x03, 0x02, 0x00, 0x06, 0xfd, 0x02, 0xf9, 0x00, 0x0c, 0xf6, 0x03, 0x8d, 0x02, 0x02, 0x06, 0x00, 0x02, 0x7e, 0x00, + 0x75, 0xfe, 0x7e, 0xfa, 0x00, 0xfe, 0x02, 0x04, 0x85, 0x06, 0x00, 0x02, 0xf9, 0x03, 0x80, 0x00, 0x0f, 0x00, 0xf8, + 0x04, 0x00, 0x00, 0x06, 0x02, 0x02, 0x04, 0x00, 0x02, 0x7e, 0x00, 0x75, 0xfe, 0x7e, 0xfc, 0x00, 0xfe, 0x02, 0x00, + 0x05, 0x0a, 0xf9, 0x0d, 0x80, 0x00, 0x0f, 0xf7, 0x00, 0xff, 0x7e, 0x00, 0x7b, 0x01, 0x7e, 0x09, 0x00, 0xf6, 0xfa, + 0x04, 0x06, 0x08, 0xfa}; //------------------------------------------------------------------------- -gsv_text::gsv_text() : - m_x(0.0), - m_y(0.0), - m_start_x(0.0), - m_width(10.0), - m_height(0.0), - m_space(0.0), - m_line_space(0.0), - m_text(m_chr), - m_text_buf(), - m_cur_chr(m_chr), - m_font(gsv_default_font), - m_loaded_font(), - m_status(initial), - m_big_endian(false), - m_flip(false) +gsv_text::gsv_text() + : m_x(0.0) + , m_y(0.0) + , m_start_x(0.0) + , m_width(10.0) + , m_height(0.0) + , m_space(0.0) + , m_line_space(0.0) + , m_text(m_chr) + , m_text_buf() + , m_cur_chr(m_chr) + , m_font(gsv_default_font) + , m_loaded_font() + , m_status(initial) + , m_big_endian(false) + , m_flip(false) { m_chr[0] = m_chr[1] = 0; int t = 1; - if(*(char*)&t == 0) m_big_endian = true; + if (*(char*)&t == 0) + m_big_endian = true; } //------------------------------------------------------------------------- void gsv_text::font(const void* font) { m_font = font; - if(m_font == 0) m_font = &m_loaded_font[0]; + if (m_font == 0) + m_font = &m_loaded_font[0]; } //------------------------------------------------------------------------- void gsv_text::size(double height, double width) { m_height = height; - m_width = width; + m_width = width; } //------------------------------------------------------------------------- @@ -537,7 +320,7 @@ void gsv_text::start_point(double x, double y) { m_x = m_start_x = x; m_y = y; - //if(m_flip) m_y += m_height; + // if(m_flip) m_y += m_height; } //------------------------------------------------------------------------- @@ -545,14 +328,14 @@ void gsv_text::load_font(const char* file) { m_loaded_font.resize(0); FILE* fd = fopen(file, "rb"); - if(fd) + if (fd) { unsigned len; fseek(fd, 0l, SEEK_END); len = ftell(fd); fseek(fd, 0l, SEEK_SET); - if(len > 0) + if (len > 0) { m_loaded_font.resize(len); if (fread(&m_loaded_font[0], 1, len, fd) == len) @@ -567,14 +350,14 @@ void gsv_text::load_font(const char* file) //------------------------------------------------------------------------- void gsv_text::text(const char* text) { - if(text == 0) + if (text == 0) { m_chr[0] = 0; m_text = m_chr; return; } unsigned new_size = strlen(text) + 1; - if(new_size > m_text_buf.size()) + if (new_size > m_text_buf.size()) { m_text_buf.resize(new_size); } @@ -586,15 +369,17 @@ void gsv_text::text(const char* text) void gsv_text::rewind(unsigned) { m_status = initial; - if(m_font == 0) return; + if (m_font == 0) + return; m_indices = (int8u*)m_font; double base_height = value(m_indices + 4); m_indices += value(m_indices); - m_glyphs = (int8*)(m_indices + 257*2); + m_glyphs = (int8*)(m_indices + 257 * 2); m_h = m_height / base_height; m_w = (m_width == 0.0) ? m_h : m_width / base_height; - if(m_flip) m_h = -m_h; + if (m_flip) + m_h = -m_h; m_cur_chr = m_text; } @@ -606,61 +391,60 @@ unsigned gsv_text::vertex(double* x, double* y) int dx, dy; bool quit = false; - while(!quit) + while (!quit) { - switch(m_status) + switch (m_status) { - case initial: - if(m_font == 0) - { - quit = true; - break; - } - m_status = next_char; - - case next_char: - if(*m_cur_chr == 0) - { - quit = true; - break; - } - idx = (*m_cur_chr++) & 0xFF; - if(idx == '\n') - { - m_x = m_start_x; - m_y -= m_flip ? -m_height - m_line_space : m_height + m_line_space; - break; - } - idx <<= 1; - m_bglyph = m_glyphs + value(m_indices + idx); - m_eglyph = m_glyphs + value(m_indices + idx + 2); - m_status = start_glyph; - - case start_glyph: - *x = m_x; - *y = m_y; - m_status = glyph; - return path_cmd_move_to; - - case glyph: - if(m_bglyph >= m_eglyph) - { + case initial: + if (m_font == 0) + { + quit = true; + break; + } m_status = next_char; - m_x += m_space; - break; - } - dx = int(*m_bglyph++); - yf = (yc = *m_bglyph++) & 0x80; - yc <<= 1; - yc >>= 1; - dy = int(yc); - m_x += double(dx) * m_w; - m_y += double(dy) * m_h; - *x = m_x; - *y = m_y; - return yf ? path_cmd_move_to : path_cmd_line_to; - } + case next_char: + if (*m_cur_chr == 0) + { + quit = true; + break; + } + idx = (*m_cur_chr++) & 0xFF; + if (idx == '\n') + { + m_x = m_start_x; + m_y -= m_flip ? -m_height - m_line_space : m_height + m_line_space; + break; + } + idx <<= 1; + m_bglyph = m_glyphs + value(m_indices + idx); + m_eglyph = m_glyphs + value(m_indices + idx + 2); + m_status = start_glyph; + + case start_glyph: + *x = m_x; + *y = m_y; + m_status = glyph; + return path_cmd_move_to; + + case glyph: + if (m_bglyph >= m_eglyph) + { + m_status = next_char; + m_x += m_space; + break; + } + dx = int(*m_bglyph++); + yf = (yc = *m_bglyph++) & 0x80; + yc <<= 1; + yc >>= 1; + dy = int(yc); + m_x += double(dx) * m_w; + m_y += double(dy) * m_h; + *x = m_x; + *y = m_y; + return yf ? path_cmd_move_to : path_cmd_line_to; + } } return path_cmd_stop; } @@ -673,5 +457,4 @@ double gsv_text::text_width() return x2 - x1; } - -} +} // namespace agg diff --git a/deps/agg/src/agg_image_filters.cpp b/deps/agg/src/agg_image_filters.cpp index bc3aa9719..df99e57db 100644 --- a/deps/agg/src/agg_image_filters.cpp +++ b/deps/agg/src/agg_image_filters.cpp @@ -17,12 +17,9 @@ // //---------------------------------------------------------------------------- - #include "agg_image_filters.h" - -namespace agg -{ +namespace agg { //-------------------------------------------------------------------- void image_filter_lut::realloc_lut(double radius) { @@ -30,14 +27,12 @@ void image_filter_lut::realloc_lut(double radius) m_diameter = uceil(radius) * 2; m_start = -int(m_diameter / 2 - 1); unsigned size = m_diameter << image_subpixel_shift; - if(size > m_weight_array.size()) + if (size > m_weight_array.size()) { m_weight_array.resize(size); } } - - //-------------------------------------------------------------------- // This function normalizes integer values and corrects the rounding // errors. It doesn't do anything with the source floating point values @@ -50,36 +45,37 @@ void image_filter_lut::normalize() unsigned i; int flip = 1; - for(i = 0; i < image_subpixel_scale; i++) + for (i = 0; i < image_subpixel_scale; i++) { - for(;;) + for (;;) { int sum = 0; unsigned j; - for(j = 0; j < m_diameter; j++) + for (j = 0; j < m_diameter; j++) { sum += m_weight_array[j * image_subpixel_scale + i]; } - if(sum == image_filter_scale) break; + if (sum == image_filter_scale) + break; double k = (sum > 0) ? double(image_filter_scale) / double(sum) : 1; sum = 0; - for(j = 0; j < m_diameter; j++) + for (j = 0; j < m_diameter; j++) { - sum += m_weight_array[j * image_subpixel_scale + i] = - iround(m_weight_array[j * image_subpixel_scale + i] * k); + sum += m_weight_array[j * image_subpixel_scale + i] = + iround(m_weight_array[j * image_subpixel_scale + i] * k); } sum -= image_filter_scale; int inc = (sum > 0) ? -1 : 1; - for(j = 0; j < m_diameter && sum; j++) + for (j = 0; j < m_diameter && sum; j++) { flip ^= 1; - unsigned idx = flip ? m_diameter/2 + j/2 : m_diameter/2 - j/2; + unsigned idx = flip ? m_diameter / 2 + j / 2 : m_diameter / 2 - j / 2; int v = m_weight_array[idx * image_subpixel_scale + i]; - if(v < image_filter_scale) + if (v < image_filter_scale) { m_weight_array[idx * image_subpixel_scale + i] += inc; sum += inc; @@ -90,7 +86,7 @@ void image_filter_lut::normalize() unsigned pivot = m_diameter << (image_subpixel_shift - 1); - for(i = 0; i < pivot; i++) + for (i = 0; i < pivot; i++) { m_weight_array[pivot + i] = m_weight_array[pivot - i]; } @@ -98,6 +94,4 @@ void image_filter_lut::normalize() m_weight_array[0] = m_weight_array[end]; } - -} - +} // namespace agg diff --git a/deps/agg/src/agg_line_aa_basics.cpp b/deps/agg/src/agg_line_aa_basics.cpp index 4d706c173..9a357eeea 100644 --- a/deps/agg/src/agg_line_aa_basics.cpp +++ b/deps/agg/src/agg_line_aa_basics.cpp @@ -16,8 +16,7 @@ #include #include "agg_line_aa_basics.h" -namespace agg -{ +namespace agg { //------------------------------------------------------------------------- // The number of the octant is determined as a 3-bit value as follows: // bit 0 = vertical flag @@ -42,25 +41,20 @@ namespace agg // [2] | [3] // <3> // 0,1,2,3,4,5,6,7 -const int8u line_parameters::s_orthogonal_quadrant[8] = { 0,0,1,1,3,3,2,2 }; -const int8u line_parameters::s_diagonal_quadrant[8] = { 0,1,2,1,0,3,2,3 }; - - +const int8u line_parameters::s_orthogonal_quadrant[8] = {0, 0, 1, 1, 3, 3, 2, 2}; +const int8u line_parameters::s_diagonal_quadrant[8] = {0, 1, 2, 1, 0, 3, 2, 3}; //------------------------------------------------------------------------- -void bisectrix(const line_parameters& l1, - const line_parameters& l2, - int* x, int* y) +void bisectrix(const line_parameters& l1, const line_parameters& l2, int* x, int* y) { double k = double(l2.len) / double(l1.len); double tx = l2.x2 - (l2.x1 - l1.x1) * k; double ty = l2.y2 - (l2.y1 - l1.y1) * k; - //All bisectrices must be on the right of the line - //If the next point is on the left (l1 => l2.2) - //then the bisectix should be rotated by 180 degrees. - if(double(l2.x2 - l2.x1) * double(l2.y1 - l1.y1) < - double(l2.y2 - l2.y1) * double(l2.x1 - l1.x1) + 100.0) + // All bisectrices must be on the right of the line + // If the next point is on the left (l1 => l2.2) + // then the bisectix should be rotated by 180 degrees. + if (double(l2.x2 - l2.x1) * double(l2.y1 - l1.y1) < double(l2.y2 - l2.y1) * double(l2.x1 - l1.x1) + 100.0) { tx -= (tx - l2.x1) * 2.0; ty -= (ty - l2.y1) * 2.0; @@ -69,7 +63,7 @@ void bisectrix(const line_parameters& l1, // Check if the bisectrix is too short double dx = tx - l2.x1; double dy = ty - l2.y1; - if((int)sqrt(dx * dx + dy * dy) < line_subpixel_scale) + if ((int)sqrt(dx * dx + dy * dy) < line_subpixel_scale) { *x = (l2.x1 + l2.x1 + (l2.y1 - l1.y1) + (l2.y2 - l2.y1)) >> 1; *y = (l2.y1 + l2.y1 - (l2.x1 - l1.x1) - (l2.x2 - l2.x1)) >> 1; @@ -79,4 +73,4 @@ void bisectrix(const line_parameters& l1, *y = iround(ty); } -} +} // namespace agg diff --git a/deps/agg/src/agg_line_profile_aa.cpp b/deps/agg/src/agg_line_profile_aa.cpp index cb4ceb7cd..dac7b5ff3 100644 --- a/deps/agg/src/agg_line_profile_aa.cpp +++ b/deps/agg/src/agg_line_profile_aa.cpp @@ -15,22 +15,24 @@ #include "agg_renderer_outline_aa.h" -namespace agg -{ +namespace agg { //--------------------------------------------------------------------- void line_profile_aa::width(double w) { - if(w < 0.0) w = 0.0; + if (w < 0.0) + w = 0.0; - if(w < m_smoother_width) w += w; - else w += m_smoother_width; + if (w < m_smoother_width) + w += w; + else + w += m_smoother_width; w *= 0.5; w -= m_smoother_width; double s = m_smoother_width; - if(w < 0.0) + if (w < 0.0) { s += w; w = 0.0; @@ -38,29 +40,29 @@ void line_profile_aa::width(double w) set(w, s); } - //--------------------------------------------------------------------- line_profile_aa::value_type* line_profile_aa::profile(double w) { m_subpixel_width = uround(w * subpixel_scale); unsigned size = m_subpixel_width + subpixel_scale * 6; - if(size > m_profile.size()) + if (size > m_profile.size()) { m_profile.resize(size); } return &m_profile[0]; } - //--------------------------------------------------------------------- void line_profile_aa::set(double center_width, double smoother_width) { double base_val = 1.0; - if(center_width == 0.0) center_width = 1.0 / subpixel_scale; - if(smoother_width == 0.0) smoother_width = 1.0 / subpixel_scale; + if (center_width == 0.0) + center_width = 1.0 / subpixel_scale; + if (smoother_width == 0.0) + smoother_width = 1.0 / subpixel_scale; double width = center_width + smoother_width; - if(width < m_min_width) + if (width < m_min_width) { double k = width / m_min_width; base_val *= k; @@ -73,44 +75,36 @@ void line_profile_aa::set(double center_width, double smoother_width) unsigned subpixel_center_width = unsigned(center_width * subpixel_scale); unsigned subpixel_smoother_width = unsigned(smoother_width * 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; unsigned i; unsigned val = m_gamma[unsigned(base_val * aa_mask)]; ch = ch_center; - for(i = 0; i < subpixel_center_width; i++) + for (i = 0; i < subpixel_center_width; i++) { *ch++ = (value_type)val; } - for(i = 0; i < subpixel_smoother_width; i++) + for (i = 0; i < subpixel_smoother_width; i++) { - *ch_smoother++ = - m_gamma[unsigned((base_val - - base_val * - (double(i) / subpixel_smoother_width)) * aa_mask)]; + *ch_smoother++ = m_gamma[unsigned((base_val - base_val * (double(i) / subpixel_smoother_width)) * aa_mask)]; } - unsigned n_smoother = profile_size() - - subpixel_smoother_width - - subpixel_center_width - - subpixel_scale*2; + unsigned n_smoother = profile_size() - subpixel_smoother_width - subpixel_center_width - subpixel_scale * 2; val = m_gamma[0]; - for(i = 0; i < n_smoother; i++) + for (i = 0; i < n_smoother; i++) { *ch_smoother++ = (value_type)val; } ch = ch_center; - for(i = 0; i < subpixel_scale*2; i++) + for (i = 0; i < subpixel_scale * 2; i++) { *--ch = *ch_center++; } } - -} - +} // namespace agg diff --git a/deps/agg/src/agg_pixfmt_rgba.cpp b/deps/agg/src/agg_pixfmt_rgba.cpp index 58222272e..9f1963ea2 100644 --- a/deps/agg/src/agg_pixfmt_rgba.cpp +++ b/deps/agg/src/agg_pixfmt_rgba.cpp @@ -16,14 +16,15 @@ MAPNIK_DISABLE_WARNING_PUSH MAPNIK_DISABLE_WARNING_POP -namespace agg -{ - +namespace agg { template -void comp_op_rgba_hue::blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) +void comp_op_rgba_hue::blend_pix(value_type* p, + unsigned sr, + unsigned sg, + unsigned sb, + unsigned sa, + unsigned cover) { if (cover < 255) { @@ -38,24 +39,27 @@ void comp_op_rgba_hue::blend_pix(value_type* p, using namespace boost; using namespace gil; using namespace hsv_color_space; - rgb8_pixel_t rgb_src(sr,sg,sb); - rgb8_pixel_t rgb_dst(p[Order::R],p[Order::G],p[Order::B]); - hsv32f_pixel_t hsv_src,hsv_dst; + rgb8_pixel_t rgb_src(sr, sg, sb); + rgb8_pixel_t rgb_dst(p[Order::R], p[Order::G], p[Order::B]); + hsv32f_pixel_t hsv_src, hsv_dst; color_convert(rgb_src, hsv_src); color_convert(rgb_dst, hsv_dst); - get_color(hsv_dst,hue_t()) = get_color(hsv_src,hue_t()); + get_color(hsv_dst, hue_t()) = get_color(hsv_src, hue_t()); color_convert(hsv_dst, rgb_dst); - p[Order::R] = get_color(rgb_dst,red_t()); - p[Order::G] = get_color(rgb_dst,green_t()); - p[Order::B] = get_color(rgb_dst,blue_t()); + p[Order::R] = get_color(rgb_dst, red_t()); + p[Order::G] = get_color(rgb_dst, green_t()); + p[Order::B] = get_color(rgb_dst, blue_t()); p[Order::A] = (value_type)(sa + p[Order::A] - ((sa * p[Order::A] + base_mask) >> base_shift)); } } template -void comp_op_rgba_saturation::blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) +void comp_op_rgba_saturation::blend_pix(value_type* p, + unsigned sr, + unsigned sg, + unsigned sb, + unsigned sa, + unsigned cover) { if (cover < 255) { @@ -70,24 +74,27 @@ void comp_op_rgba_saturation::blend_pix(value_type* p, using namespace boost; using namespace gil; using namespace hsv_color_space; - rgb8_pixel_t rgb_src(sr,sg,sb); - rgb8_pixel_t rgb_dst(p[Order::R],p[Order::G],p[Order::B]); - hsv32f_pixel_t hsv_src,hsv_dst; - color_convert( rgb_src, hsv_src); - color_convert( rgb_dst, hsv_dst); - get_color(hsv_dst,saturation_t()) = get_color(hsv_src,saturation_t()); + rgb8_pixel_t rgb_src(sr, sg, sb); + rgb8_pixel_t rgb_dst(p[Order::R], p[Order::G], p[Order::B]); + hsv32f_pixel_t hsv_src, hsv_dst; + color_convert(rgb_src, hsv_src); + color_convert(rgb_dst, hsv_dst); + get_color(hsv_dst, saturation_t()) = get_color(hsv_src, saturation_t()); color_convert(hsv_dst, rgb_dst); - p[Order::R] = get_color(rgb_dst,red_t()); - p[Order::G] = get_color(rgb_dst,green_t()); - p[Order::B] = get_color(rgb_dst,blue_t()); + p[Order::R] = get_color(rgb_dst, red_t()); + p[Order::G] = get_color(rgb_dst, green_t()); + p[Order::B] = get_color(rgb_dst, blue_t()); p[Order::A] = (value_type)(sa + p[Order::A] - ((sa * p[Order::A] + base_mask) >> base_shift)); } } template -void comp_op_rgba_color::blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) +void comp_op_rgba_color::blend_pix(value_type* p, + unsigned sr, + unsigned sg, + unsigned sb, + unsigned sa, + unsigned cover) { if (cover < 255) { @@ -102,26 +109,29 @@ void comp_op_rgba_color::blend_pix(value_type* p, using namespace boost; using namespace gil; using namespace hsl_color_space; - rgb8_pixel_t rgb_src(sr,sg,sb); - rgb8_pixel_t rgb_dst(p[Order::R],p[Order::G],p[Order::B]); - hsl32f_pixel_t hsl_src,hsl_dst; - color_convert( rgb_src, hsl_src); - color_convert( rgb_dst, hsl_dst); - get_color(hsl_dst,hue_t()) = get_color(hsl_src,hue_t()); - get_color(hsl_dst,saturation_t()) = get_color(hsl_src,saturation_t()); - get_color(hsl_dst,lightness_t()) = get_color(hsl_dst,lightness_t()); + rgb8_pixel_t rgb_src(sr, sg, sb); + rgb8_pixel_t rgb_dst(p[Order::R], p[Order::G], p[Order::B]); + hsl32f_pixel_t hsl_src, hsl_dst; + color_convert(rgb_src, hsl_src); + color_convert(rgb_dst, hsl_dst); + get_color(hsl_dst, hue_t()) = get_color(hsl_src, hue_t()); + get_color(hsl_dst, saturation_t()) = get_color(hsl_src, saturation_t()); + get_color(hsl_dst, lightness_t()) = get_color(hsl_dst, lightness_t()); color_convert(hsl_dst, rgb_dst); - p[Order::R] = get_color(rgb_dst,red_t()); - p[Order::G] = get_color(rgb_dst,green_t()); - p[Order::B] = get_color(rgb_dst,blue_t()); + p[Order::R] = get_color(rgb_dst, red_t()); + p[Order::G] = get_color(rgb_dst, green_t()); + p[Order::B] = get_color(rgb_dst, blue_t()); p[Order::A] = (value_type)(sa + p[Order::A] - ((sa * p[Order::A] + base_mask) >> base_shift)); } } template -void comp_op_rgba_value::blend_pix(value_type* p, - unsigned sr, unsigned sg, unsigned sb, - unsigned sa, unsigned cover) +void comp_op_rgba_value::blend_pix(value_type* p, + unsigned sr, + unsigned sg, + unsigned sb, + unsigned sa, + unsigned cover) { if (cover < 255) { @@ -136,26 +146,23 @@ void comp_op_rgba_value::blend_pix(value_type* p, using namespace boost; using namespace gil; using namespace hsv_color_space; - rgb8_pixel_t rgb_src(sr,sg,sb); - rgb8_pixel_t rgb_dst(p[Order::R],p[Order::G],p[Order::B]); - hsv32f_pixel_t hsv_src,hsv_dst; - color_convert( rgb_src, hsv_src); - color_convert( rgb_dst, hsv_dst); - get_color(hsv_dst,value_t()) = get_color(hsv_src,value_t()); + rgb8_pixel_t rgb_src(sr, sg, sb); + rgb8_pixel_t rgb_dst(p[Order::R], p[Order::G], p[Order::B]); + hsv32f_pixel_t hsv_src, hsv_dst; + color_convert(rgb_src, hsv_src); + color_convert(rgb_dst, hsv_dst); + get_color(hsv_dst, value_t()) = get_color(hsv_src, value_t()); color_convert(hsv_dst, rgb_dst); - p[Order::R] = get_color(rgb_dst,red_t()); - p[Order::G] = get_color(rgb_dst,green_t()); - p[Order::B] = get_color(rgb_dst,blue_t()); + p[Order::R] = get_color(rgb_dst, red_t()); + p[Order::G] = get_color(rgb_dst, green_t()); + p[Order::B] = get_color(rgb_dst, blue_t()); p[Order::A] = (value_type)(sa + p[Order::A] - ((sa * p[Order::A] + base_mask) >> base_shift)); } } - template struct comp_op_rgba_hue; template struct comp_op_rgba_saturation; template struct comp_op_rgba_color; template struct comp_op_rgba_value; - - -} +} // namespace agg diff --git a/deps/agg/src/agg_rounded_rect.cpp b/deps/agg/src/agg_rounded_rect.cpp index 6307d60d9..cc4b0623f 100644 --- a/deps/agg/src/agg_rounded_rect.cpp +++ b/deps/agg/src/agg_rounded_rect.cpp @@ -20,17 +20,32 @@ #include #include "agg_rounded_rect.h" - -namespace agg -{ +namespace agg { //------------------------------------------------------------------------ -rounded_rect::rounded_rect(double x1, double y1, double x2, double y2, double r) : - m_x1(x1), m_y1(y1), m_x2(x2), m_y2(y2), - m_rx1(r), m_ry1(r), m_rx2(r), m_ry2(r), - m_rx3(r), m_ry3(r), m_rx4(r), m_ry4(r) +rounded_rect::rounded_rect(double x1, double y1, double x2, double y2, double r) + : m_x1(x1) + , m_y1(y1) + , m_x2(x2) + , m_y2(y2) + , m_rx1(r) + , m_ry1(r) + , m_rx2(r) + , m_ry2(r) + , m_rx3(r) + , m_ry3(r) + , m_rx4(r) + , m_ry4(r) { - if(x1 > x2) { m_x1 = x2; m_x2 = x1; } - if(y1 > y2) { m_y1 = y2; m_y2 = y1; } + if (x1 > x2) + { + m_x1 = x2; + m_x2 = x1; + } + if (y1 > y2) + { + m_y1 = y2; + m_y2 = y1; + } } //-------------------------------------------------------------------- @@ -40,8 +55,16 @@ void rounded_rect::rect(double x1, double y1, double x2, double y2) m_y1 = y1; m_x2 = x2; m_y2 = y2; - if(x1 > x2) { m_x1 = x2; m_x2 = x1; } - if(y1 > y2) { m_y1 = y2; m_y2 = y1; } + if (x1 > x2) + { + m_x1 = x2; + m_x2 = x1; + } + if (y1 > y2) + { + m_y1 = y2; + m_y2 = y1; + } } //-------------------------------------------------------------------- @@ -58,8 +81,7 @@ void rounded_rect::radius(double rx, double ry) } //-------------------------------------------------------------------- -void rounded_rect::radius(double rx_bottom, double ry_bottom, - double rx_top, double ry_top) +void rounded_rect::radius(double rx_bottom, double ry_bottom, double rx_top, double ry_top) { m_rx1 = m_rx2 = rx_bottom; m_rx3 = m_rx4 = rx_top; @@ -68,11 +90,23 @@ void rounded_rect::radius(double rx_bottom, double ry_bottom, } //-------------------------------------------------------------------- -void rounded_rect::radius(double rx1, double ry1, double rx2, double ry2, - double rx3, double ry3, double rx4, double ry4) +void rounded_rect::radius(double rx1, + double ry1, + double rx2, + double ry2, + double rx3, + double ry3, + double rx4, + double ry4) { - m_rx1 = rx1; m_ry1 = ry1; m_rx2 = rx2; m_ry2 = ry2; - m_rx3 = rx3; m_ry3 = ry3; m_rx4 = rx4; m_ry4 = ry4; + m_rx1 = rx1; + m_ry1 = ry1; + m_rx2 = rx2; + m_ry2 = ry2; + m_rx3 = rx3; + m_ry3 = ry3; + m_rx4 = rx4; + m_ry4 = ry4; } //-------------------------------------------------------------------- @@ -83,15 +117,29 @@ void rounded_rect::normalize_radius() double k = 1.0; double t; - t = dx / (m_rx1 + m_rx2); if(t < k) k = t; - t = dx / (m_rx3 + m_rx4); if(t < k) k = t; - t = dy / (m_ry1 + m_ry2); if(t < k) k = t; - t = dy / (m_ry3 + m_ry4); if(t < k) k = t; + t = dx / (m_rx1 + m_rx2); + if (t < k) + k = t; + t = dx / (m_rx3 + m_rx4); + if (t < k) + k = t; + t = dy / (m_ry1 + m_ry2); + if (t < k) + k = t; + t = dy / (m_ry3 + m_ry4); + if (t < k) + k = t; - if(k < 1.0) + if (k < 1.0) { - m_rx1 *= k; m_ry1 *= k; m_rx2 *= k; m_ry2 *= k; - m_rx3 *= k; m_ry3 *= k; m_rx4 *= k; m_ry4 *= k; + m_rx1 *= k; + m_ry1 *= k; + m_rx2 *= k; + m_ry2 *= k; + m_rx3 *= k; + m_ry3 *= k; + m_rx4 *= k; + m_ry4 *= k; } } @@ -105,60 +153,62 @@ void rounded_rect::rewind(unsigned) unsigned rounded_rect::vertex(double* x, double* y) { unsigned cmd = path_cmd_stop; - switch(m_status) + switch (m_status) { - case 0: - m_arc.init(m_x1 + m_rx1, m_y1 + m_ry1, m_rx1, m_ry1, - pi, pi+pi*0.5); - m_arc.rewind(0); - m_status++; + case 0: + m_arc.init(m_x1 + m_rx1, m_y1 + m_ry1, m_rx1, m_ry1, pi, pi + pi * 0.5); + m_arc.rewind(0); + m_status++; - case 1: - cmd = m_arc.vertex(x, y); - if(is_stop(cmd)) m_status++; - else return cmd; + case 1: + cmd = m_arc.vertex(x, y); + if (is_stop(cmd)) + m_status++; + else + return cmd; - case 2: - m_arc.init(m_x2 - m_rx2, m_y1 + m_ry2, m_rx2, m_ry2, - pi+pi*0.5, 0.0); - m_arc.rewind(0); - m_status++; + case 2: + m_arc.init(m_x2 - m_rx2, m_y1 + m_ry2, m_rx2, m_ry2, pi + pi * 0.5, 0.0); + m_arc.rewind(0); + m_status++; - case 3: - cmd = m_arc.vertex(x, y); - if(is_stop(cmd)) m_status++; - else return path_cmd_line_to; + case 3: + cmd = m_arc.vertex(x, y); + if (is_stop(cmd)) + m_status++; + else + return path_cmd_line_to; - case 4: - m_arc.init(m_x2 - m_rx3, m_y2 - m_ry3, m_rx3, m_ry3, - 0.0, pi*0.5); - m_arc.rewind(0); - m_status++; + case 4: + m_arc.init(m_x2 - m_rx3, m_y2 - m_ry3, m_rx3, m_ry3, 0.0, pi * 0.5); + m_arc.rewind(0); + m_status++; - case 5: - cmd = m_arc.vertex(x, y); - if(is_stop(cmd)) m_status++; - else return path_cmd_line_to; + case 5: + cmd = m_arc.vertex(x, y); + if (is_stop(cmd)) + m_status++; + else + return path_cmd_line_to; - case 6: - m_arc.init(m_x1 + m_rx4, m_y2 - m_ry4, m_rx4, m_ry4, - pi*0.5, pi); - m_arc.rewind(0); - m_status++; + case 6: + m_arc.init(m_x1 + m_rx4, m_y2 - m_ry4, m_rx4, m_ry4, pi * 0.5, pi); + m_arc.rewind(0); + m_status++; - case 7: - cmd = m_arc.vertex(x, y); - if(is_stop(cmd)) m_status++; - else return path_cmd_line_to; + case 7: + cmd = m_arc.vertex(x, y); + if (is_stop(cmd)) + m_status++; + else + return path_cmd_line_to; - case 8: - cmd = path_cmd_end_poly | path_flags_close | path_flags_ccw; - m_status++; - break; + case 8: + cmd = path_cmd_end_poly | path_flags_close | path_flags_ccw; + m_status++; + break; } return cmd; } - -} - +} // namespace agg diff --git a/deps/agg/src/agg_sqrt_tables.cpp b/deps/agg/src/agg_sqrt_tables.cpp index e8381be5c..7c81b1e5c 100644 --- a/deps/agg/src/agg_sqrt_tables.cpp +++ b/deps/agg/src/agg_sqrt_tables.cpp @@ -19,97 +19,80 @@ #include "agg_basics.h" -namespace agg -{ -int16u g_sqrt_table[1024] = //----------g_sqrt_table -{ - 0, - 2048,2896,3547,4096,4579,5017,5418,5793,6144,6476,6792,7094,7384,7663,7932,8192,8444, - 8689,8927,9159,9385,9606,9822,10033,10240,10443,10642,10837,11029,11217,11403,11585, - 11765,11942,12116,12288,12457,12625,12790,12953,13114,13273,13430,13585,13738,13890, - 14040,14189,14336,14482,14626,14768,14910,15050,15188,15326,15462,15597,15731,15864, - 15995,16126,16255,16384,16512,16638,16764,16888,17012,17135,17257,17378,17498,17618, - 17736,17854,17971,18087,18203,18318,18432,18545,18658,18770,18882,18992,19102,19212, - 19321,19429,19537,19644,19750,19856,19961,20066,20170,20274,20377,20480,20582,20684, - 20785,20886,20986,21085,21185,21283,21382,21480,21577,21674,21771,21867,21962,22058, - 22153,22247,22341,22435,22528,22621,22713,22806,22897,22989,23080,23170,23261,23351, - 23440,23530,23619,23707,23796,23884,23971,24059,24146,24232,24319,24405,24491,24576, - 24661,24746,24831,24915,24999,25083,25166,25249,25332,25415,25497,25580,25661,25743, - 25824,25905,25986,26067,26147,26227,26307,26387,26466,26545,26624,26703,26781,26859, - 26937,27015,27092,27170,27247,27324,27400,27477,27553,27629,27705,27780,27856,27931, - 28006,28081,28155,28230,28304,28378,28452,28525,28599,28672,28745,28818,28891,28963, - 29035,29108,29180,29251,29323,29394,29466,29537,29608,29678,29749,29819,29890,29960, - 30030,30099,30169,30238,30308,30377,30446,30515,30583,30652,30720,30788,30856,30924, - 30992,31059,31127,31194,31261,31328,31395,31462,31529,31595,31661,31727,31794,31859, - 31925,31991,32056,32122,32187,32252,32317,32382,32446,32511,32575,32640,32704,32768, - 32832,32896,32959,33023,33086,33150,33213,33276,33339,33402,33465,33527,33590,33652, - 33714,33776,33839,33900,33962,34024,34086,34147,34208,34270,34331,34392,34453,34514, - 34574,34635,34695,34756,34816,34876,34936,34996,35056,35116,35176,35235,35295,35354, - 35413,35472,35531,35590,35649,35708,35767,35825,35884,35942,36001,36059,36117,36175, - 36233,36291,36348,36406,36464,36521,36578,36636,36693,36750,36807,36864,36921,36978, - 37034,37091,37147,37204,37260,37316,37372,37429,37485,37540,37596,37652,37708,37763, - 37819,37874,37929,37985,38040,38095,38150,38205,38260,38315,38369,38424,38478,38533, - 38587,38642,38696,38750,38804,38858,38912,38966,39020,39073,39127,39181,39234,39287, - 39341,39394,39447,39500,39553,39606,39659,39712,39765,39818,39870,39923,39975,40028, - 40080,40132,40185,40237,40289,40341,40393,40445,40497,40548,40600,40652,40703,40755, - 40806,40857,40909,40960,41011,41062,41113,41164,41215,41266,41317,41368,41418,41469, - 41519,41570,41620,41671,41721,41771,41821,41871,41922,41972,42021,42071,42121,42171, - 42221,42270,42320,42369,42419,42468,42518,42567,42616,42665,42714,42763,42813,42861, - 42910,42959,43008,43057,43105,43154,43203,43251,43300,43348,43396,43445,43493,43541, - 43589,43637,43685,43733,43781,43829,43877,43925,43972,44020,44068,44115,44163,44210, - 44258,44305,44352,44400,44447,44494,44541,44588,44635,44682,44729,44776,44823,44869, - 44916,44963,45009,45056,45103,45149,45195,45242,45288,45334,45381,45427,45473,45519, - 45565,45611,45657,45703,45749,45795,45840,45886,45932,45977,46023,46069,46114,46160, - 46205,46250,46296,46341,46386,46431,46477,46522,46567,46612,46657,46702,46746,46791, - 46836,46881,46926,46970,47015,47059,47104,47149,47193,47237,47282,47326,47370,47415, - 47459,47503,47547,47591,47635,47679,47723,47767,47811,47855,47899,47942,47986,48030, - 48074,48117,48161,48204,48248,48291,48335,48378,48421,48465,48508,48551,48594,48637, - 48680,48723,48766,48809,48852,48895,48938,48981,49024,49067,49109,49152,49195,49237, - 49280,49322,49365,49407,49450,49492,49535,49577,49619,49661,49704,49746,49788,49830, - 49872,49914,49956,49998,50040,50082,50124,50166,50207,50249,50291,50332,50374,50416, - 50457,50499,50540,50582,50623,50665,50706,50747,50789,50830,50871,50912,50954,50995, - 51036,51077,51118,51159,51200,51241,51282,51323,51364,51404,51445,51486,51527,51567, - 51608,51649,51689,51730,51770,51811,51851,51892,51932,51972,52013,52053,52093,52134, - 52174,52214,52254,52294,52334,52374,52414,52454,52494,52534,52574,52614,52654,52694, - 52734,52773,52813,52853,52892,52932,52972,53011,53051,53090,53130,53169,53209,53248, - 53287,53327,53366,53405,53445,53484,53523,53562,53601,53640,53679,53719,53758,53797, - 53836,53874,53913,53952,53991,54030,54069,54108,54146,54185,54224,54262,54301,54340, - 54378,54417,54455,54494,54532,54571,54609,54647,54686,54724,54762,54801,54839,54877, - 54915,54954,54992,55030,55068,55106,55144,55182,55220,55258,55296,55334,55372,55410, - 55447,55485,55523,55561,55599,55636,55674,55712,55749,55787,55824,55862,55900,55937, - 55975,56012,56049,56087,56124,56162,56199,56236,56273,56311,56348,56385,56422,56459, - 56497,56534,56571,56608,56645,56682,56719,56756,56793,56830,56867,56903,56940,56977, - 57014,57051,57087,57124,57161,57198,57234,57271,57307,57344,57381,57417,57454,57490, - 57527,57563,57599,57636,57672,57709,57745,57781,57817,57854,57890,57926,57962,57999, - 58035,58071,58107,58143,58179,58215,58251,58287,58323,58359,58395,58431,58467,58503, - 58538,58574,58610,58646,58682,58717,58753,58789,58824,58860,58896,58931,58967,59002, - 59038,59073,59109,59144,59180,59215,59251,59286,59321,59357,59392,59427,59463,59498, - 59533,59568,59603,59639,59674,59709,59744,59779,59814,59849,59884,59919,59954,59989, - 60024,60059,60094,60129,60164,60199,60233,60268,60303,60338,60373,60407,60442,60477, - 60511,60546,60581,60615,60650,60684,60719,60753,60788,60822,60857,60891,60926,60960, - 60995,61029,61063,61098,61132,61166,61201,61235,61269,61303,61338,61372,61406,61440, - 61474,61508,61542,61576,61610,61644,61678,61712,61746,61780,61814,61848,61882,61916, - 61950,61984,62018,62051,62085,62119,62153,62186,62220,62254,62287,62321,62355,62388, - 62422,62456,62489,62523,62556,62590,62623,62657,62690,62724,62757,62790,62824,62857, - 62891,62924,62957,62991,63024,63057,63090,63124,63157,63190,63223,63256,63289,63323, - 63356,63389,63422,63455,63488,63521,63554,63587,63620,63653,63686,63719,63752,63785, - 63817,63850,63883,63916,63949,63982,64014,64047,64080,64113,64145,64178,64211,64243, - 64276,64309,64341,64374,64406,64439,64471,64504,64536,64569,64601,64634,64666,64699, - 64731,64763,64796,64828,64861,64893,64925,64957,64990,65022,65054,65086,65119,65151, - 65183,65215,65247,65279,65312,65344,65376,65408,65440,65472,65504 -}; +namespace agg { +int16u g_sqrt_table[1024] = //----------g_sqrt_table + {0, 2048, 2896, 3547, 4096, 4579, 5017, 5418, 5793, 6144, 6476, 6792, 7094, 7384, 7663, 7932, + 8192, 8444, 8689, 8927, 9159, 9385, 9606, 9822, 10033, 10240, 10443, 10642, 10837, 11029, 11217, 11403, + 11585, 11765, 11942, 12116, 12288, 12457, 12625, 12790, 12953, 13114, 13273, 13430, 13585, 13738, 13890, 14040, + 14189, 14336, 14482, 14626, 14768, 14910, 15050, 15188, 15326, 15462, 15597, 15731, 15864, 15995, 16126, 16255, + 16384, 16512, 16638, 16764, 16888, 17012, 17135, 17257, 17378, 17498, 17618, 17736, 17854, 17971, 18087, 18203, + 18318, 18432, 18545, 18658, 18770, 18882, 18992, 19102, 19212, 19321, 19429, 19537, 19644, 19750, 19856, 19961, + 20066, 20170, 20274, 20377, 20480, 20582, 20684, 20785, 20886, 20986, 21085, 21185, 21283, 21382, 21480, 21577, + 21674, 21771, 21867, 21962, 22058, 22153, 22247, 22341, 22435, 22528, 22621, 22713, 22806, 22897, 22989, 23080, + 23170, 23261, 23351, 23440, 23530, 23619, 23707, 23796, 23884, 23971, 24059, 24146, 24232, 24319, 24405, 24491, + 24576, 24661, 24746, 24831, 24915, 24999, 25083, 25166, 25249, 25332, 25415, 25497, 25580, 25661, 25743, 25824, + 25905, 25986, 26067, 26147, 26227, 26307, 26387, 26466, 26545, 26624, 26703, 26781, 26859, 26937, 27015, 27092, + 27170, 27247, 27324, 27400, 27477, 27553, 27629, 27705, 27780, 27856, 27931, 28006, 28081, 28155, 28230, 28304, + 28378, 28452, 28525, 28599, 28672, 28745, 28818, 28891, 28963, 29035, 29108, 29180, 29251, 29323, 29394, 29466, + 29537, 29608, 29678, 29749, 29819, 29890, 29960, 30030, 30099, 30169, 30238, 30308, 30377, 30446, 30515, 30583, + 30652, 30720, 30788, 30856, 30924, 30992, 31059, 31127, 31194, 31261, 31328, 31395, 31462, 31529, 31595, 31661, + 31727, 31794, 31859, 31925, 31991, 32056, 32122, 32187, 32252, 32317, 32382, 32446, 32511, 32575, 32640, 32704, + 32768, 32832, 32896, 32959, 33023, 33086, 33150, 33213, 33276, 33339, 33402, 33465, 33527, 33590, 33652, 33714, + 33776, 33839, 33900, 33962, 34024, 34086, 34147, 34208, 34270, 34331, 34392, 34453, 34514, 34574, 34635, 34695, + 34756, 34816, 34876, 34936, 34996, 35056, 35116, 35176, 35235, 35295, 35354, 35413, 35472, 35531, 35590, 35649, + 35708, 35767, 35825, 35884, 35942, 36001, 36059, 36117, 36175, 36233, 36291, 36348, 36406, 36464, 36521, 36578, + 36636, 36693, 36750, 36807, 36864, 36921, 36978, 37034, 37091, 37147, 37204, 37260, 37316, 37372, 37429, 37485, + 37540, 37596, 37652, 37708, 37763, 37819, 37874, 37929, 37985, 38040, 38095, 38150, 38205, 38260, 38315, 38369, + 38424, 38478, 38533, 38587, 38642, 38696, 38750, 38804, 38858, 38912, 38966, 39020, 39073, 39127, 39181, 39234, + 39287, 39341, 39394, 39447, 39500, 39553, 39606, 39659, 39712, 39765, 39818, 39870, 39923, 39975, 40028, 40080, + 40132, 40185, 40237, 40289, 40341, 40393, 40445, 40497, 40548, 40600, 40652, 40703, 40755, 40806, 40857, 40909, + 40960, 41011, 41062, 41113, 41164, 41215, 41266, 41317, 41368, 41418, 41469, 41519, 41570, 41620, 41671, 41721, + 41771, 41821, 41871, 41922, 41972, 42021, 42071, 42121, 42171, 42221, 42270, 42320, 42369, 42419, 42468, 42518, + 42567, 42616, 42665, 42714, 42763, 42813, 42861, 42910, 42959, 43008, 43057, 43105, 43154, 43203, 43251, 43300, + 43348, 43396, 43445, 43493, 43541, 43589, 43637, 43685, 43733, 43781, 43829, 43877, 43925, 43972, 44020, 44068, + 44115, 44163, 44210, 44258, 44305, 44352, 44400, 44447, 44494, 44541, 44588, 44635, 44682, 44729, 44776, 44823, + 44869, 44916, 44963, 45009, 45056, 45103, 45149, 45195, 45242, 45288, 45334, 45381, 45427, 45473, 45519, 45565, + 45611, 45657, 45703, 45749, 45795, 45840, 45886, 45932, 45977, 46023, 46069, 46114, 46160, 46205, 46250, 46296, + 46341, 46386, 46431, 46477, 46522, 46567, 46612, 46657, 46702, 46746, 46791, 46836, 46881, 46926, 46970, 47015, + 47059, 47104, 47149, 47193, 47237, 47282, 47326, 47370, 47415, 47459, 47503, 47547, 47591, 47635, 47679, 47723, + 47767, 47811, 47855, 47899, 47942, 47986, 48030, 48074, 48117, 48161, 48204, 48248, 48291, 48335, 48378, 48421, + 48465, 48508, 48551, 48594, 48637, 48680, 48723, 48766, 48809, 48852, 48895, 48938, 48981, 49024, 49067, 49109, + 49152, 49195, 49237, 49280, 49322, 49365, 49407, 49450, 49492, 49535, 49577, 49619, 49661, 49704, 49746, 49788, + 49830, 49872, 49914, 49956, 49998, 50040, 50082, 50124, 50166, 50207, 50249, 50291, 50332, 50374, 50416, 50457, + 50499, 50540, 50582, 50623, 50665, 50706, 50747, 50789, 50830, 50871, 50912, 50954, 50995, 51036, 51077, 51118, + 51159, 51200, 51241, 51282, 51323, 51364, 51404, 51445, 51486, 51527, 51567, 51608, 51649, 51689, 51730, 51770, + 51811, 51851, 51892, 51932, 51972, 52013, 52053, 52093, 52134, 52174, 52214, 52254, 52294, 52334, 52374, 52414, + 52454, 52494, 52534, 52574, 52614, 52654, 52694, 52734, 52773, 52813, 52853, 52892, 52932, 52972, 53011, 53051, + 53090, 53130, 53169, 53209, 53248, 53287, 53327, 53366, 53405, 53445, 53484, 53523, 53562, 53601, 53640, 53679, + 53719, 53758, 53797, 53836, 53874, 53913, 53952, 53991, 54030, 54069, 54108, 54146, 54185, 54224, 54262, 54301, + 54340, 54378, 54417, 54455, 54494, 54532, 54571, 54609, 54647, 54686, 54724, 54762, 54801, 54839, 54877, 54915, + 54954, 54992, 55030, 55068, 55106, 55144, 55182, 55220, 55258, 55296, 55334, 55372, 55410, 55447, 55485, 55523, + 55561, 55599, 55636, 55674, 55712, 55749, 55787, 55824, 55862, 55900, 55937, 55975, 56012, 56049, 56087, 56124, + 56162, 56199, 56236, 56273, 56311, 56348, 56385, 56422, 56459, 56497, 56534, 56571, 56608, 56645, 56682, 56719, + 56756, 56793, 56830, 56867, 56903, 56940, 56977, 57014, 57051, 57087, 57124, 57161, 57198, 57234, 57271, 57307, + 57344, 57381, 57417, 57454, 57490, 57527, 57563, 57599, 57636, 57672, 57709, 57745, 57781, 57817, 57854, 57890, + 57926, 57962, 57999, 58035, 58071, 58107, 58143, 58179, 58215, 58251, 58287, 58323, 58359, 58395, 58431, 58467, + 58503, 58538, 58574, 58610, 58646, 58682, 58717, 58753, 58789, 58824, 58860, 58896, 58931, 58967, 59002, 59038, + 59073, 59109, 59144, 59180, 59215, 59251, 59286, 59321, 59357, 59392, 59427, 59463, 59498, 59533, 59568, 59603, + 59639, 59674, 59709, 59744, 59779, 59814, 59849, 59884, 59919, 59954, 59989, 60024, 60059, 60094, 60129, 60164, + 60199, 60233, 60268, 60303, 60338, 60373, 60407, 60442, 60477, 60511, 60546, 60581, 60615, 60650, 60684, 60719, + 60753, 60788, 60822, 60857, 60891, 60926, 60960, 60995, 61029, 61063, 61098, 61132, 61166, 61201, 61235, 61269, + 61303, 61338, 61372, 61406, 61440, 61474, 61508, 61542, 61576, 61610, 61644, 61678, 61712, 61746, 61780, 61814, + 61848, 61882, 61916, 61950, 61984, 62018, 62051, 62085, 62119, 62153, 62186, 62220, 62254, 62287, 62321, 62355, + 62388, 62422, 62456, 62489, 62523, 62556, 62590, 62623, 62657, 62690, 62724, 62757, 62790, 62824, 62857, 62891, + 62924, 62957, 62991, 63024, 63057, 63090, 63124, 63157, 63190, 63223, 63256, 63289, 63323, 63356, 63389, 63422, + 63455, 63488, 63521, 63554, 63587, 63620, 63653, 63686, 63719, 63752, 63785, 63817, 63850, 63883, 63916, 63949, + 63982, 64014, 64047, 64080, 64113, 64145, 64178, 64211, 64243, 64276, 64309, 64341, 64374, 64406, 64439, 64471, + 64504, 64536, 64569, 64601, 64634, 64666, 64699, 64731, 64763, 64796, 64828, 64861, 64893, 64925, 64957, 64990, + 65022, 65054, 65086, 65119, 65151, 65183, 65215, 65247, 65279, 65312, 65344, 65376, 65408, 65440, 65472, 65504}; +int8 g_elder_bit_table[256] = //---------g_elder_bit_table + {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}; -int8 g_elder_bit_table[256] = //---------g_elder_bit_table -{ - 0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 -}; - -} +} // namespace agg diff --git a/deps/agg/src/agg_trans_affine.cpp b/deps/agg/src/agg_trans_affine.cpp index b5853b9d1..c4f80e036 100644 --- a/deps/agg/src/agg_trans_affine.cpp +++ b/deps/agg/src/agg_trans_affine.cpp @@ -18,51 +18,47 @@ //---------------------------------------------------------------------------- #include "agg_trans_affine.h" - - -namespace agg -{ +namespace agg { const trans_affine trans_affine::identity; //------------------------------------------------------------------------ -const trans_affine& trans_affine::parl_to_parl(const double* src, - const double* dst) +const trans_affine& trans_affine::parl_to_parl(const double* src, const double* dst) { - sx = src[2] - src[0]; + sx = src[2] - src[0]; shy = src[3] - src[1]; shx = src[4] - src[0]; - sy = src[5] - src[1]; - tx = src[0]; - ty = src[1]; + sy = src[5] - src[1]; + tx = src[0]; + ty = src[1]; invert(); - multiply(trans_affine(dst[2] - dst[0], dst[3] - dst[1], - dst[4] - dst[0], dst[5] - dst[1], - dst[0], dst[1])); + multiply(trans_affine(dst[2] - dst[0], dst[3] - dst[1], dst[4] - dst[0], dst[5] - dst[1], dst[0], dst[1])); return *this; } //------------------------------------------------------------------------ -const trans_affine& trans_affine::rect_to_parl(double x1, double y1, - double x2, double y2, - const double* parl) +const trans_affine& trans_affine::rect_to_parl(double x1, double y1, double x2, double y2, const double* parl) { double src[6]; - src[0] = x1; src[1] = y1; - src[2] = x2; src[3] = y1; - src[4] = x2; src[5] = y2; + src[0] = x1; + src[1] = y1; + src[2] = x2; + src[3] = y1; + src[4] = x2; + src[5] = y2; parl_to_parl(src, parl); return *this; } //------------------------------------------------------------------------ -const trans_affine& trans_affine::parl_to_rect(const double* parl, - double x1, double y1, - double x2, double y2) +const trans_affine& trans_affine::parl_to_rect(const double* parl, double x1, double y1, double x2, double y2) { double dst[6]; - dst[0] = x1; dst[1] = y1; - dst[2] = x2; dst[3] = y1; - dst[4] = x2; dst[5] = y2; + dst[0] = x1; + dst[1] = y1; + dst[2] = x2; + dst[3] = y1; + dst[4] = x2; + dst[5] = y2; parl_to_parl(parl, dst); return *this; } @@ -70,30 +66,29 @@ const trans_affine& trans_affine::parl_to_rect(const double* parl, //------------------------------------------------------------------------ const trans_affine& trans_affine::multiply(const trans_affine& m) { - double t0 = sx * m.sx + shy * m.shx; - double t2 = shx * m.sx + sy * m.shx; - double t4 = tx * m.sx + ty * m.shx + m.tx; - shy = sx * m.shy + shy * m.sy; - sy = shx * m.shy + sy * m.sy; - ty = tx * m.shy + ty * m.sy + m.ty; - sx = t0; + double t0 = sx * m.sx + shy * m.shx; + double t2 = shx * m.sx + sy * m.shx; + double t4 = tx * m.sx + ty * m.shx + m.tx; + shy = sx * m.shy + shy * m.sy; + sy = shx * m.shy + sy * m.sy; + ty = tx * m.shy + ty * m.sy + m.ty; + sx = t0; shx = t2; - tx = t4; + tx = t4; return *this; } - //------------------------------------------------------------------------ const trans_affine& trans_affine::invert() { - double d = determinant_reciprocal(); + double d = determinant_reciprocal(); - double t0 = sy * d; - sy = sx * d; + double t0 = sy * d; + sy = sx * d; shy = -shy * d; shx = -shx * d; - double t4 = -tx * t0 - ty * shx; + double t4 = -tx * t0 - ty * shx; ty = -tx * shy - ty * sy; sx = t0; @@ -101,13 +96,12 @@ const trans_affine& trans_affine::invert() return *this; } - //------------------------------------------------------------------------ const trans_affine& trans_affine::flip_x() { - sx = -sx; + sx = -sx; shy = -shy; - tx = -tx; + tx = -tx; return *this; } @@ -115,15 +109,15 @@ const trans_affine& trans_affine::flip_x() const trans_affine& trans_affine::flip_y() { shx = -shx; - sy = -sy; - ty = -ty; + sy = -sy; + ty = -ty; return *this; } //------------------------------------------------------------------------ const trans_affine& trans_affine::reset() { - sx = sy = 1.0; + sx = sy = 1.0; shy = shx = tx = ty = 0.0; return *this; } @@ -131,12 +125,8 @@ const trans_affine& trans_affine::reset() //------------------------------------------------------------------------ bool trans_affine::is_identity(double epsilon) const { - return is_equal_eps(sx, 1.0, epsilon) && - is_equal_eps(shy, 0.0, epsilon) && - is_equal_eps(shx, 0.0, epsilon) && - is_equal_eps(sy, 1.0, epsilon) && - is_equal_eps(tx, 0.0, epsilon) && - is_equal_eps(ty, 0.0, epsilon); + return is_equal_eps(sx, 1.0, epsilon) && is_equal_eps(shy, 0.0, epsilon) && is_equal_eps(shx, 0.0, epsilon) && + is_equal_eps(sy, 1.0, epsilon) && is_equal_eps(tx, 0.0, epsilon) && is_equal_eps(ty, 0.0, epsilon); } //------------------------------------------------------------------------ @@ -148,12 +138,8 @@ bool trans_affine::is_valid(double epsilon) const //------------------------------------------------------------------------ bool trans_affine::is_equal(const trans_affine& m, double epsilon) const { - return is_equal_eps(sx, m.sx, epsilon) && - is_equal_eps(shy, m.shy, epsilon) && - is_equal_eps(shx, m.shx, epsilon) && - is_equal_eps(sy, m.sy, epsilon) && - is_equal_eps(tx, m.tx, epsilon) && - is_equal_eps(ty, m.ty, epsilon); + return is_equal_eps(sx, m.sx, epsilon) && is_equal_eps(shy, m.shy, epsilon) && is_equal_eps(shx, m.shx, epsilon) && + is_equal_eps(sy, m.sy, epsilon) && is_equal_eps(tx, m.tx, epsilon) && is_equal_eps(ty, m.ty, epsilon); } //------------------------------------------------------------------------ @@ -165,7 +151,7 @@ double trans_affine::rotation() const double y2 = 0.0; transform(&x1, &y1); transform(&x2, &y2); - return std::atan2(y2-y1, x2-x1); + return std::atan2(y2 - y1, x2 - x1); } //------------------------------------------------------------------------ @@ -190,6 +176,4 @@ void trans_affine::scaling(double* x, double* y) const *y = y2 - y1; } - -} - +} // namespace agg diff --git a/deps/agg/src/agg_trans_double_path.cpp b/deps/agg/src/agg_trans_double_path.cpp index 686e30a51..7851033e0 100644 --- a/deps/agg/src/agg_trans_double_path.cpp +++ b/deps/agg/src/agg_trans_double_path.cpp @@ -16,21 +16,18 @@ #include "agg_math.h" #include "agg_trans_double_path.h" -namespace agg -{ +namespace agg { //------------------------------------------------------------------------ -trans_double_path::trans_double_path() : - m_base_length(0.0), - m_base_height(1.0), - m_kindex1(0.0), - m_kindex2(0.0), - m_status1(initial), - m_status2(initial), - m_preserve_x_scale(true) -{ -} - +trans_double_path::trans_double_path() + : m_base_length(0.0) + , m_base_height(1.0) + , m_kindex1(0.0) + , m_kindex2(0.0) + , m_status1(initial) + , m_status2(initial) + , m_preserve_x_scale(true) +{} //------------------------------------------------------------------------ void trans_double_path::reset() @@ -43,11 +40,10 @@ void trans_double_path::reset() m_status2 = initial; } - //------------------------------------------------------------------------ void trans_double_path::move_to1(double x, double y) { - if(m_status1 == initial) + if (m_status1 == initial) { m_src_vertices1.modify_last(vertex_dist(x, y)); m_status1 = making_path; @@ -58,21 +54,19 @@ void trans_double_path::move_to1(double x, double y) } } - //------------------------------------------------------------------------ void trans_double_path::line_to1(double x, double y) { - if(m_status1 == making_path) + if (m_status1 == making_path) { m_src_vertices1.add(vertex_dist(x, y)); } } - //------------------------------------------------------------------------ void trans_double_path::move_to2(double x, double y) { - if(m_status2 == initial) + if (m_status2 == initial) { m_src_vertices2.modify_last(vertex_dist(x, y)); m_status2 = making_path; @@ -83,17 +77,15 @@ void trans_double_path::move_to2(double x, double y) } } - //------------------------------------------------------------------------ void trans_double_path::line_to2(double x, double y) { - if(m_status2 == making_path) + if (m_status2 == making_path) { m_src_vertices2.add(vertex_dist(x, y)); } } - //------------------------------------------------------------------------ double trans_double_path::finalize_path(vertex_storage& vertices) { @@ -102,16 +94,13 @@ double trans_double_path::finalize_path(vertex_storage& vertices) double d; vertices.close(false); - if(vertices.size() > 2) + if (vertices.size() > 2) { - if(vertices[vertices.size() - 2].dist * 10.0 < - vertices[vertices.size() - 3].dist) + if (vertices[vertices.size() - 2].dist * 10.0 < vertices[vertices.size() - 3].dist) { - d = vertices[vertices.size() - 3].dist + - vertices[vertices.size() - 2].dist; + d = vertices[vertices.size() - 3].dist + vertices[vertices.size() - 2].dist; - vertices[vertices.size() - 2] = - vertices[vertices.size() - 1]; + vertices[vertices.size() - 2] = vertices[vertices.size() - 1]; vertices.remove_last(); vertices[vertices.size() - 2].dist = d; @@ -119,7 +108,7 @@ double trans_double_path::finalize_path(vertex_storage& vertices) } dist = 0; - for(i = 0; i < vertices.size(); i++) + for (i = 0; i < vertices.size(); i++) { vertex_dist& v = vertices[i]; d = v.dist; @@ -130,12 +119,11 @@ double trans_double_path::finalize_path(vertex_storage& vertices) return (vertices.size() - 1) / dist; } - //------------------------------------------------------------------------ void trans_double_path::finalize_paths() { - if(m_status1 == making_path && m_src_vertices1.size() > 1 && - m_status2 == making_path && m_src_vertices2.size() > 1) + if (m_status1 == making_path && m_src_vertices1.size() > 1 && m_status2 == making_path && + m_src_vertices2.size() > 1) { m_kindex1 = finalize_path(m_src_vertices1); m_kindex2 = finalize_path(m_src_vertices2); @@ -144,40 +132,33 @@ void trans_double_path::finalize_paths() } } - //------------------------------------------------------------------------ double trans_double_path::total_length1() const { - if(m_base_length >= 1e-10) return m_base_length; - return (m_status1 == ready) ? - m_src_vertices1[m_src_vertices1.size() - 1].dist : - 0.0; + if (m_base_length >= 1e-10) + return m_base_length; + return (m_status1 == ready) ? m_src_vertices1[m_src_vertices1.size() - 1].dist : 0.0; } - //------------------------------------------------------------------------ double trans_double_path::total_length2() const { - if(m_base_length >= 1e-10) return m_base_length; - return (m_status2 == ready) ? - m_src_vertices2[m_src_vertices2.size() - 1].dist : - 0.0; + if (m_base_length >= 1e-10) + return m_base_length; + return (m_status2 == ready) ? m_src_vertices2[m_src_vertices2.size() - 1].dist : 0.0; } - //------------------------------------------------------------------------ -void trans_double_path::transform1(const vertex_storage& vertices, - double kindex, double kx, - double *x, double* y) const +void trans_double_path::transform1(const vertex_storage& vertices, double kindex, double kx, double* x, double* y) const { double x1 = 0.0; double y1 = 0.0; double dx = 1.0; double dy = 1.0; - double d = 0.0; + double d = 0.0; double dd = 1.0; *x *= kx; - if(*x < 0.0) + if (*x < 0.0) { // Extrapolation on the left //-------------------------- @@ -186,88 +167,83 @@ void trans_double_path::transform1(const vertex_storage& vertices, dx = vertices[1].x - x1; dy = vertices[1].y - y1; dd = vertices[1].dist - vertices[0].dist; - d = *x; + d = *x; + } + else if (*x > vertices[vertices.size() - 1].dist) + { + // Extrapolation on the right + //-------------------------- + unsigned i = vertices.size() - 2; + unsigned j = vertices.size() - 1; + x1 = vertices[j].x; + y1 = vertices[j].y; + dx = x1 - vertices[i].x; + dy = y1 - vertices[i].y; + dd = vertices[j].dist - vertices[i].dist; + d = *x - vertices[j].dist; } else - if(*x > vertices[vertices.size() - 1].dist) + { + // Interpolation + //-------------------------- + unsigned i = 0; + unsigned j = vertices.size() - 1; + if (m_preserve_x_scale) { - // Extrapolation on the right - //-------------------------- - unsigned i = vertices.size() - 2; - unsigned j = vertices.size() - 1; - x1 = vertices[j].x; - y1 = vertices[j].y; - dx = x1 - vertices[i].x; - dy = y1 - vertices[i].y; - dd = vertices[j].dist - vertices[i].dist; - d = *x - vertices[j].dist; + unsigned k; + for (i = 0; (j - i) > 1;) + { + if (*x < vertices[k = (i + j) >> 1].dist) + { + j = k; + } + else + { + i = k; + } + } + d = vertices[i].dist; + dd = vertices[j].dist - d; + d = *x - d; } else { - // Interpolation - //-------------------------- - unsigned i = 0; - unsigned j = vertices.size() - 1; - if(m_preserve_x_scale) - { - unsigned k; - for(i = 0; (j - i) > 1; ) - { - if(*x < vertices[k = (i + j) >> 1].dist) - { - j = k; - } - else - { - i = k; - } - } - d = vertices[i].dist; - dd = vertices[j].dist - d; - d = *x - d; - } - else - { - i = unsigned(*x * kindex); - j = i + 1; - dd = vertices[j].dist - vertices[i].dist; - d = ((*x * kindex) - i) * dd; - } - x1 = vertices[i].x; - y1 = vertices[i].y; - dx = vertices[j].x - x1; - dy = vertices[j].y - y1; + i = unsigned(*x * kindex); + j = i + 1; + dd = vertices[j].dist - vertices[i].dist; + d = ((*x * kindex) - i) * dd; } + x1 = vertices[i].x; + y1 = vertices[i].y; + dx = vertices[j].x - x1; + dy = vertices[j].y - y1; + } *x = x1 + dx * d / dd; *y = y1 + dy * d / dd; } - //------------------------------------------------------------------------ -void trans_double_path::transform(double *x, double *y) const +void trans_double_path::transform(double* x, double* y) const { - if(m_status1 == ready && m_status2 == ready) + if (m_status1 == ready && m_status2 == ready) { - if(m_base_length > 1e-10) + if (m_base_length > 1e-10) { - *x *= m_src_vertices1[m_src_vertices1.size() - 1].dist / - m_base_length; + *x *= m_src_vertices1[m_src_vertices1.size() - 1].dist / m_base_length; } double x1 = *x; double y1 = *y; double x2 = *x; double y2 = *y; - double dd = m_src_vertices2[m_src_vertices2.size() - 1].dist / - m_src_vertices1[m_src_vertices1.size() - 1].dist; + double dd = m_src_vertices2[m_src_vertices2.size() - 1].dist / m_src_vertices1[m_src_vertices1.size() - 1].dist; transform1(m_src_vertices1, m_kindex1, 1.0, &x1, &y1); - transform1(m_src_vertices2, m_kindex2, dd, &x2, &y2); + transform1(m_src_vertices2, m_kindex2, dd, &x2, &y2); *x = x1 + *y * (x2 - x1) / m_base_height; *y = y1 + *y * (y2 - y1) / m_base_height; } } -} - +} // namespace agg diff --git a/deps/agg/src/agg_trans_single_path.cpp b/deps/agg/src/agg_trans_single_path.cpp index 9b1d7cb69..42fa8baa8 100644 --- a/deps/agg/src/agg_trans_single_path.cpp +++ b/deps/agg/src/agg_trans_single_path.cpp @@ -17,17 +17,15 @@ #include "agg_vertex_sequence.h" #include "agg_trans_single_path.h" -namespace agg -{ +namespace agg { //------------------------------------------------------------------------ -trans_single_path::trans_single_path() : - m_base_length(0.0), - m_kindex(0.0), - m_status(initial), - m_preserve_x_scale(true) -{ -} +trans_single_path::trans_single_path() + : m_base_length(0.0) + , m_kindex(0.0) + , m_status(initial) + , m_preserve_x_scale(true) +{} //------------------------------------------------------------------------ void trans_single_path::reset() @@ -40,7 +38,7 @@ void trans_single_path::reset() //------------------------------------------------------------------------ void trans_single_path::move_to(double x, double y) { - if(m_status == initial) + if (m_status == initial) { m_src_vertices.modify_last(vertex_dist(x, y)); m_status = making_path; @@ -54,33 +52,29 @@ void trans_single_path::move_to(double x, double y) //------------------------------------------------------------------------ void trans_single_path::line_to(double x, double y) { - if(m_status == making_path) + if (m_status == making_path) { m_src_vertices.add(vertex_dist(x, y)); } } - //------------------------------------------------------------------------ void trans_single_path::finalize_path() { - if(m_status == making_path && m_src_vertices.size() > 1) + if (m_status == making_path && m_src_vertices.size() > 1) { unsigned i; double dist; double d; m_src_vertices.close(false); - if(m_src_vertices.size() > 2) + if (m_src_vertices.size() > 2) { - if(m_src_vertices[m_src_vertices.size() - 2].dist * 10.0 < - m_src_vertices[m_src_vertices.size() - 3].dist) + if (m_src_vertices[m_src_vertices.size() - 2].dist * 10.0 < m_src_vertices[m_src_vertices.size() - 3].dist) { - d = m_src_vertices[m_src_vertices.size() - 3].dist + - m_src_vertices[m_src_vertices.size() - 2].dist; + d = m_src_vertices[m_src_vertices.size() - 3].dist + m_src_vertices[m_src_vertices.size() - 2].dist; - m_src_vertices[m_src_vertices.size() - 2] = - m_src_vertices[m_src_vertices.size() - 1]; + m_src_vertices[m_src_vertices.size() - 2] = m_src_vertices[m_src_vertices.size() - 1]; m_src_vertices.remove_last(); m_src_vertices[m_src_vertices.size() - 2].dist = d; @@ -88,7 +82,7 @@ void trans_single_path::finalize_path() } dist = 0.0; - for(i = 0; i < m_src_vertices.size(); i++) + for (i = 0; i < m_src_vertices.size(); i++) { vertex_dist& v = m_src_vertices[i]; double dd = v.dist; @@ -100,36 +94,31 @@ void trans_single_path::finalize_path() } } - - //------------------------------------------------------------------------ double trans_single_path::total_length() const { - if(m_base_length >= 1e-10) return m_base_length; - return (m_status == ready) ? - m_src_vertices[m_src_vertices.size() - 1].dist : - 0.0; + if (m_base_length >= 1e-10) + return m_base_length; + return (m_status == ready) ? m_src_vertices[m_src_vertices.size() - 1].dist : 0.0; } - //------------------------------------------------------------------------ -void trans_single_path::transform(double *x, double *y) const +void trans_single_path::transform(double* x, double* y) const { - if(m_status == ready) + if (m_status == ready) { - if(m_base_length > 1e-10) + if (m_base_length > 1e-10) { - *x *= m_src_vertices[m_src_vertices.size() - 1].dist / - m_base_length; + *x *= m_src_vertices[m_src_vertices.size() - 1].dist / m_base_length; } double x1 = 0.0; double y1 = 0.0; double dx = 1.0; double dy = 1.0; - double d = 0.0; + double d = 0.0; double dd = 1.0; - if(*x < 0.0) + if (*x < 0.0) { // Extrapolation on the left //-------------------------- @@ -138,58 +127,57 @@ void trans_single_path::transform(double *x, double *y) const dx = m_src_vertices[1].x - x1; dy = m_src_vertices[1].y - y1; dd = m_src_vertices[1].dist - m_src_vertices[0].dist; - d = *x; + d = *x; + } + else if (*x > m_src_vertices[m_src_vertices.size() - 1].dist) + { + // Extrapolation on the right + //-------------------------- + unsigned i = m_src_vertices.size() - 2; + unsigned j = m_src_vertices.size() - 1; + x1 = m_src_vertices[j].x; + y1 = m_src_vertices[j].y; + dx = x1 - m_src_vertices[i].x; + dy = y1 - m_src_vertices[i].y; + dd = m_src_vertices[j].dist - m_src_vertices[i].dist; + d = *x - m_src_vertices[j].dist; } else - if(*x > m_src_vertices[m_src_vertices.size() - 1].dist) + { + // Interpolation + //-------------------------- + unsigned i = 0; + unsigned j = m_src_vertices.size() - 1; + if (m_preserve_x_scale) { - // Extrapolation on the right - //-------------------------- - unsigned i = m_src_vertices.size() - 2; - unsigned j = m_src_vertices.size() - 1; - x1 = m_src_vertices[j].x; - y1 = m_src_vertices[j].y; - dx = x1 - m_src_vertices[i].x; - dy = y1 - m_src_vertices[i].y; - dd = m_src_vertices[j].dist - m_src_vertices[i].dist; - d = *x - m_src_vertices[j].dist; + unsigned k; + for (i = 0; (j - i) > 1;) + { + if (*x < m_src_vertices[k = (i + j) >> 1].dist) + { + j = k; + } + else + { + i = k; + } + } + d = m_src_vertices[i].dist; + dd = m_src_vertices[j].dist - d; + d = *x - d; } else { - // Interpolation - //-------------------------- - unsigned i = 0; - unsigned j = m_src_vertices.size() - 1; - if(m_preserve_x_scale) - { - unsigned k; - for(i = 0; (j - i) > 1; ) - { - if(*x < m_src_vertices[k = (i + j) >> 1].dist) - { - j = k; - } - else - { - i = k; - } - } - d = m_src_vertices[i].dist; - dd = m_src_vertices[j].dist - d; - d = *x - d; - } - else - { - i = unsigned(*x * m_kindex); - j = i + 1; - dd = m_src_vertices[j].dist - m_src_vertices[i].dist; - d = ((*x * m_kindex) - i) * dd; - } - x1 = m_src_vertices[i].x; - y1 = m_src_vertices[i].y; - dx = m_src_vertices[j].x - x1; - dy = m_src_vertices[j].y - y1; + i = unsigned(*x * m_kindex); + j = i + 1; + dd = m_src_vertices[j].dist - m_src_vertices[i].dist; + d = ((*x * m_kindex) - i) * dd; } + x1 = m_src_vertices[i].x; + y1 = m_src_vertices[i].y; + dx = m_src_vertices[j].x - x1; + dy = m_src_vertices[j].y - y1; + } double x2 = x1 + dx * d / dd; double y2 = y1 + dy * d / dd; *x = x2 - *y * dy / dd; @@ -197,6 +185,4 @@ void trans_single_path::transform(double *x, double *y) const } } - -} - +} // namespace agg diff --git a/deps/agg/src/agg_trans_warp_magnifier.cpp b/deps/agg/src/agg_trans_warp_magnifier.cpp index eef5254eb..d253e7fc1 100644 --- a/deps/agg/src/agg_trans_warp_magnifier.cpp +++ b/deps/agg/src/agg_trans_warp_magnifier.cpp @@ -16,8 +16,7 @@ #include #include "agg_trans_warp_magnifier.h" -namespace agg -{ +namespace agg { //------------------------------------------------------------------------ void trans_warp_magnifier::transform(double* x, double* y) const @@ -25,7 +24,7 @@ void trans_warp_magnifier::transform(double* x, double* y) const double dx = *x - m_xc; double dy = *y - m_yc; double r = sqrt(dx * dx + dy * dy); - if(r < m_radius) + if (r < m_radius) { *x = m_xc + dx * m_magn; *y = m_yc + dy * m_magn; @@ -46,7 +45,7 @@ void trans_warp_magnifier::inverse_transform(double* x, double* y) const double dy = *y - m_yc; double r = sqrt(dx * dx + dy * dy); - if(r < m_radius * m_magn) + if (r < m_radius * m_magn) { *x = m_xc + dx / m_magn; *y = m_yc + dy / m_magn; @@ -60,11 +59,10 @@ void trans_warp_magnifier::inverse_transform(double* x, double* y) const // Old version //----------------- - //trans_warp_magnifier t(*this); - //t.magnification(1.0 / m_magn); - //t.radius(m_radius * m_magn); - //t.transform(x, y); + // trans_warp_magnifier t(*this); + // t.magnification(1.0 / m_magn); + // t.radius(m_radius * m_magn); + // t.transform(x, y); } - -} +} // namespace agg diff --git a/deps/agg/src/agg_vcgen_bspline.cpp b/deps/agg/src/agg_vcgen_bspline.cpp index 5bb377f5e..20bfa5eb7 100644 --- a/deps/agg/src/agg_vcgen_bspline.cpp +++ b/deps/agg/src/agg_vcgen_bspline.cpp @@ -15,21 +15,18 @@ #include "agg_vcgen_bspline.h" -namespace agg -{ +namespace agg { //------------------------------------------------------------------------ -vcgen_bspline::vcgen_bspline() : - m_src_vertices(), - m_spline_x(), - m_spline_y(), - m_interpolation_step(1.0/50.0), - m_closed(0), - m_status(initial), - m_src_vertex(0) -{ -} - +vcgen_bspline::vcgen_bspline() + : m_src_vertices() + , m_spline_x() + , m_spline_y() + , m_interpolation_step(1.0 / 50.0) + , m_closed(0) + , m_status(initial) + , m_src_vertex(0) +{} //------------------------------------------------------------------------ void vcgen_bspline::remove_all() @@ -40,18 +37,17 @@ void vcgen_bspline::remove_all() m_src_vertex = 0; } - //------------------------------------------------------------------------ void vcgen_bspline::add_vertex(double x, double y, unsigned cmd) { m_status = initial; - if(is_move_to(cmd)) + if (is_move_to(cmd)) { m_src_vertices.modify_last(point_d(x, y)); } else { - if(is_vertex(cmd)) + if (is_vertex(cmd)) { m_src_vertices.add(point_d(x, y)); } @@ -62,16 +58,15 @@ void vcgen_bspline::add_vertex(double x, double y, unsigned cmd) } } - //------------------------------------------------------------------------ void vcgen_bspline::rewind(unsigned) { m_cur_abscissa = 0.0; m_max_abscissa = 0.0; m_src_vertex = 0; - if(m_status == initial && m_src_vertices.size() > 2) + if (m_status == initial && m_src_vertices.size() > 2) { - if(m_closed) + if (m_closed) { m_spline_x.init(m_src_vertices.size() + 8); m_spline_y.init(m_src_vertices.size() + 8); @@ -90,7 +85,7 @@ void vcgen_bspline::rewind(unsigned) m_spline_y.init(m_src_vertices.size()); } unsigned i; - for(i = 0; i < m_src_vertices.size(); i++) + for (i = 0; i < m_src_vertices.size(); i++) { double x = m_closed ? i + 4 : i; m_spline_x.add_point(x, m_src_vertices[i].x); @@ -98,7 +93,7 @@ void vcgen_bspline::rewind(unsigned) } m_cur_abscissa = 0.0; m_max_abscissa = m_src_vertices.size() - 1; - if(m_closed) + if (m_closed) { m_cur_abscissa = 4.0; m_max_abscissa += 5.0; @@ -117,78 +112,73 @@ void vcgen_bspline::rewind(unsigned) m_status = ready; } - - - - - //------------------------------------------------------------------------ unsigned vcgen_bspline::vertex(double* x, double* y) { unsigned cmd = path_cmd_line_to; - while(!is_stop(cmd)) + while (!is_stop(cmd)) { - switch(m_status) + switch (m_status) { - case initial: - rewind(0); + case initial: + rewind(0); - case ready: - if(m_src_vertices.size() < 2) - { - cmd = path_cmd_stop; - break; - } - - if(m_src_vertices.size() == 2) - { - *x = m_src_vertices[m_src_vertex].x; - *y = m_src_vertices[m_src_vertex].y; - m_src_vertex++; - if(m_src_vertex == 1) return path_cmd_move_to; - if(m_src_vertex == 2) return path_cmd_line_to; - cmd = path_cmd_stop; - break; - } - - cmd = path_cmd_move_to; - m_status = polygon; - m_src_vertex = 0; - - case polygon: - if(m_cur_abscissa >= m_max_abscissa) - { - if(m_closed) + case ready: + if (m_src_vertices.size() < 2) { - m_status = end_poly; + cmd = path_cmd_stop; break; } - else + + if (m_src_vertices.size() == 2) { - *x = m_src_vertices[m_src_vertices.size() - 1].x; - *y = m_src_vertices[m_src_vertices.size() - 1].y; - m_status = end_poly; - return path_cmd_line_to; + *x = m_src_vertices[m_src_vertex].x; + *y = m_src_vertices[m_src_vertex].y; + m_src_vertex++; + if (m_src_vertex == 1) + return path_cmd_move_to; + if (m_src_vertex == 2) + return path_cmd_line_to; + cmd = path_cmd_stop; + break; } - } - *x = m_spline_x.get_stateful(m_cur_abscissa); - *y = m_spline_y.get_stateful(m_cur_abscissa); - m_src_vertex++; - m_cur_abscissa += m_interpolation_step; - return (m_src_vertex == 1) ? path_cmd_move_to : path_cmd_line_to; + cmd = path_cmd_move_to; + m_status = polygon; + m_src_vertex = 0; - case end_poly: - m_status = stop; - return path_cmd_end_poly | m_closed; + case polygon: + if (m_cur_abscissa >= m_max_abscissa) + { + if (m_closed) + { + m_status = end_poly; + break; + } + else + { + *x = m_src_vertices[m_src_vertices.size() - 1].x; + *y = m_src_vertices[m_src_vertices.size() - 1].y; + m_status = end_poly; + return path_cmd_line_to; + } + } - case stop: - return path_cmd_stop; + *x = m_spline_x.get_stateful(m_cur_abscissa); + *y = m_spline_y.get_stateful(m_cur_abscissa); + m_src_vertex++; + m_cur_abscissa += m_interpolation_step; + return (m_src_vertex == 1) ? path_cmd_move_to : path_cmd_line_to; + + case end_poly: + m_status = stop; + return path_cmd_end_poly | m_closed; + + case stop: + return path_cmd_stop; } } return cmd; } - -} - +} // namespace agg diff --git a/deps/agg/src/agg_vcgen_contour.cpp b/deps/agg/src/agg_vcgen_contour.cpp index cb3829e6e..6638f1555 100644 --- a/deps/agg/src/agg_vcgen_contour.cpp +++ b/deps/agg/src/agg_vcgen_contour.cpp @@ -20,22 +20,20 @@ #include #include "agg_vcgen_contour.h" -namespace agg -{ +namespace agg { //------------------------------------------------------------------------ -vcgen_contour::vcgen_contour() : - m_stroker(), - m_width(1), - m_src_vertices(), - m_out_vertices(), - m_status(initial), - m_src_vertex(0), - m_closed(0), - m_orientation(0), - m_auto_detect(false) -{ -} +vcgen_contour::vcgen_contour() + : m_stroker() + , m_width(1) + , m_src_vertices() + , m_out_vertices() + , m_status(initial) + , m_src_vertex(0) + , m_closed(0) + , m_orientation(0) + , m_auto_detect(false) +{} //------------------------------------------------------------------------ void vcgen_contour::remove_all() @@ -50,22 +48,22 @@ void vcgen_contour::remove_all() void vcgen_contour::add_vertex(double x, double y, unsigned cmd) { m_status = initial; - if(is_move_to(cmd)) + if (is_move_to(cmd)) { m_src_vertices.modify_last(vertex_dist(x, y)); } else { - if(is_vertex(cmd)) + if (is_vertex(cmd)) { m_src_vertices.add(vertex_dist(x, y)); } else { - if(is_end_poly(cmd)) + if (is_end_poly(cmd)) { m_closed = get_close_flag(cmd); - if(m_orientation == path_flags_none) + if (m_orientation == path_flags_none) { m_orientation = get_orientation(cmd); } @@ -77,19 +75,17 @@ void vcgen_contour::add_vertex(double x, double y, unsigned cmd) //------------------------------------------------------------------------ void vcgen_contour::rewind(unsigned) { - if(m_status == initial) + if (m_status == initial) { m_src_vertices.close(true); - if(m_auto_detect) + if (m_auto_detect) { - if(!is_oriented(m_orientation)) + if (!is_oriented(m_orientation)) { - m_orientation = (calc_polygon_area(m_src_vertices) > 0.0) ? - path_flags_ccw : - path_flags_cw; + m_orientation = (calc_polygon_area(m_src_vertices) > 0.0) ? path_flags_ccw : path_flags_cw; } } - if(is_oriented(m_orientation)) + if (is_oriented(m_orientation)) { m_stroker.width(is_ccw(m_orientation) ? m_width : -m_width); } @@ -102,64 +98,65 @@ void vcgen_contour::rewind(unsigned) unsigned vcgen_contour::vertex(double* x, double* y) { unsigned cmd = path_cmd_line_to; - while(!is_stop(cmd)) + while (!is_stop(cmd)) { - switch(m_status) + switch (m_status) { - case initial: - rewind(0); + case initial: + rewind(0); - case ready: - if(m_src_vertices.size() < 2 + unsigned(m_closed != 0)) - { - cmd = path_cmd_stop; - break; - } - m_status = outline; - cmd = path_cmd_move_to; - m_src_vertex = 0; - m_out_vertex = 0; - - case outline: - if(m_src_vertex >= m_src_vertices.size()) - { - m_status = end_poly; - break; - } - m_stroker.calc_join(m_out_vertices, - m_src_vertices.prev(m_src_vertex), - m_src_vertices.curr(m_src_vertex), - m_src_vertices.next(m_src_vertex), - m_src_vertices.prev(m_src_vertex).dist, - m_src_vertices.curr(m_src_vertex).dist); - ++m_src_vertex; - m_status = out_vertices; - m_out_vertex = 0; - - case out_vertices: - if(m_out_vertex >= m_out_vertices.size()) - { + case ready: + if (m_src_vertices.size() < 2 + unsigned(m_closed != 0)) + { + cmd = path_cmd_stop; + break; + } m_status = outline; - } - else - { - const point_d& c = m_out_vertices[m_out_vertex++]; - *x = c.x; - *y = c.y; - return cmd; - } - break; + cmd = path_cmd_move_to; + m_src_vertex = 0; + m_out_vertex = 0; - case end_poly: - if(!m_closed) return path_cmd_stop; - m_status = stop; - return path_cmd_end_poly | path_flags_close | path_flags_ccw; + case outline: + if (m_src_vertex >= m_src_vertices.size()) + { + m_status = end_poly; + break; + } + m_stroker.calc_join(m_out_vertices, + m_src_vertices.prev(m_src_vertex), + m_src_vertices.curr(m_src_vertex), + m_src_vertices.next(m_src_vertex), + m_src_vertices.prev(m_src_vertex).dist, + m_src_vertices.curr(m_src_vertex).dist); + ++m_src_vertex; + m_status = out_vertices; + m_out_vertex = 0; - case stop: - return path_cmd_stop; + case out_vertices: + if (m_out_vertex >= m_out_vertices.size()) + { + m_status = outline; + } + else + { + const point_d& c = m_out_vertices[m_out_vertex++]; + *x = c.x; + *y = c.y; + return cmd; + } + break; + + case end_poly: + if (!m_closed) + return path_cmd_stop; + m_status = stop; + return path_cmd_end_poly | path_flags_close | path_flags_ccw; + + case stop: + return path_cmd_stop; } } return cmd; } -} +} // namespace agg diff --git a/deps/agg/src/agg_vcgen_dash.cpp b/deps/agg/src/agg_vcgen_dash.cpp index 6bfa5db71..ce39d38cb 100644 --- a/deps/agg/src/agg_vcgen_dash.cpp +++ b/deps/agg/src/agg_vcgen_dash.cpp @@ -21,25 +21,21 @@ #include "agg_vcgen_dash.h" #include "agg_shorten_path.h" -namespace agg -{ +namespace agg { //------------------------------------------------------------------------ -vcgen_dash::vcgen_dash() : - m_total_dash_len(0.0), - m_num_dashes(0), - m_dash_start(0.0), - m_shorten(0.0), - m_curr_dash_start(0.0), - m_curr_dash(0), - m_src_vertices(), - m_closed(0), - m_status(initial), - m_src_vertex(0) -{ -} - - +vcgen_dash::vcgen_dash() + : m_total_dash_len(0.0) + , m_num_dashes(0) + , m_dash_start(0.0) + , m_shorten(0.0) + , m_curr_dash_start(0.0) + , m_curr_dash(0) + , m_src_vertices() + , m_closed(0) + , m_status(initial) + , m_src_vertex(0) +{} //------------------------------------------------------------------------ void vcgen_dash::remove_all_dashes() @@ -50,11 +46,10 @@ void vcgen_dash::remove_all_dashes() m_curr_dash = 0; } - //------------------------------------------------------------------------ void vcgen_dash::add_dash(double dash_len, double gap_len) { - if(m_num_dashes < max_dashes-1) + if (m_num_dashes < max_dashes - 1) { m_total_dash_len += dash_len + gap_len; m_dashes[m_num_dashes++] = dash_len; @@ -62,7 +57,6 @@ void vcgen_dash::add_dash(double dash_len, double gap_len) } } - //------------------------------------------------------------------------ void vcgen_dash::dash_start(double ds) { @@ -70,20 +64,20 @@ void vcgen_dash::dash_start(double ds) calc_dash_start(std::fabs(ds)); } - //------------------------------------------------------------------------ void vcgen_dash::calc_dash_start(double ds) { m_curr_dash = 0; m_curr_dash_start = 0.0; - while(ds > 0.0) + while (ds > 0.0) { - if(ds > m_dashes[m_curr_dash]) + if (ds > m_dashes[m_curr_dash]) { ds -= m_dashes[m_curr_dash]; ++m_curr_dash; m_curr_dash_start = 0.0; - if(m_curr_dash >= m_num_dashes) m_curr_dash = 0; + if (m_curr_dash >= m_num_dashes) + m_curr_dash = 0; } else { @@ -93,7 +87,6 @@ void vcgen_dash::calc_dash_start(double ds) } } - //------------------------------------------------------------------------ void vcgen_dash::remove_all() { @@ -102,18 +95,17 @@ void vcgen_dash::remove_all() m_closed = 0; } - //------------------------------------------------------------------------ void vcgen_dash::add_vertex(double x, double y, unsigned cmd) { m_status = initial; - if(is_move_to(cmd)) + if (is_move_to(cmd)) { m_src_vertices.modify_last(vertex_dist(x, y)); } else { - if(is_vertex(cmd)) + if (is_vertex(cmd)) { m_src_vertices.add(vertex_dist(x, y)); } @@ -124,11 +116,10 @@ void vcgen_dash::add_vertex(double x, double y, unsigned cmd) } } - //------------------------------------------------------------------------ void vcgen_dash::rewind(unsigned) { - if(m_status == initial) + if (m_status == initial) { m_src_vertices.close(m_closed != 0); shorten_path(m_src_vertices, m_shorten, m_closed); @@ -137,99 +128,90 @@ void vcgen_dash::rewind(unsigned) m_src_vertex = 0; } - //------------------------------------------------------------------------ unsigned vcgen_dash::vertex(double* x, double* y) { unsigned cmd = path_cmd_move_to; - while(!is_stop(cmd)) + while (!is_stop(cmd)) { - switch(m_status) + switch (m_status) { - case initial: - rewind(0); + case initial: + rewind(0); - case ready: - if(m_num_dashes < 2 || m_src_vertices.size() < 2) - { - cmd = path_cmd_stop; - break; - } - m_status = polyline; - m_src_vertex = 1; - m_v1 = &m_src_vertices[0]; - m_v2 = &m_src_vertices[1]; - m_curr_rest = m_v1->dist; - *x = m_v1->x; - *y = m_v1->y; - if(m_dash_start >= 0.0) calc_dash_start(m_dash_start); - return path_cmd_move_to; - - case polyline: - { - double dash_rest = m_dashes[m_curr_dash] - m_curr_dash_start; - - unsigned cmd2 = (m_curr_dash & 1) ? - path_cmd_move_to : - path_cmd_line_to; - - if(m_curr_rest > dash_rest) - { - m_curr_rest -= dash_rest; - ++m_curr_dash; - if(m_curr_dash >= m_num_dashes) m_curr_dash = 0; - m_curr_dash_start = 0.0; - *x = m_v2->x - (m_v2->x - m_v1->x) * m_curr_rest / m_v1->dist; - *y = m_v2->y - (m_v2->y - m_v1->y) * m_curr_rest / m_v1->dist; - } - else - { - m_curr_dash_start += m_curr_rest; - *x = m_v2->x; - *y = m_v2->y; - ++m_src_vertex; - m_v1 = m_v2; - m_curr_rest = m_v1->dist; - if(m_closed) + case ready: + if (m_num_dashes < 2 || m_src_vertices.size() < 2) { - if(m_src_vertex > m_src_vertices.size()) - { - m_status = stop; - } - else - { - m_v2 = &m_src_vertices - [ - (m_src_vertex >= m_src_vertices.size()) ? 0 : - m_src_vertex - ]; - } + cmd = path_cmd_stop; + break; + } + m_status = polyline; + m_src_vertex = 1; + m_v1 = &m_src_vertices[0]; + m_v2 = &m_src_vertices[1]; + m_curr_rest = m_v1->dist; + *x = m_v1->x; + *y = m_v1->y; + if (m_dash_start >= 0.0) + calc_dash_start(m_dash_start); + return path_cmd_move_to; + + case polyline: { + double dash_rest = m_dashes[m_curr_dash] - m_curr_dash_start; + + unsigned cmd2 = (m_curr_dash & 1) ? path_cmd_move_to : path_cmd_line_to; + + if (m_curr_rest > dash_rest) + { + m_curr_rest -= dash_rest; + ++m_curr_dash; + if (m_curr_dash >= m_num_dashes) + m_curr_dash = 0; + m_curr_dash_start = 0.0; + *x = m_v2->x - (m_v2->x - m_v1->x) * m_curr_rest / m_v1->dist; + *y = m_v2->y - (m_v2->y - m_v1->y) * m_curr_rest / m_v1->dist; } else { - if(m_src_vertex >= m_src_vertices.size()) + m_curr_dash_start += m_curr_rest; + *x = m_v2->x; + *y = m_v2->y; + ++m_src_vertex; + m_v1 = m_v2; + m_curr_rest = m_v1->dist; + if (m_closed) { - m_status = stop; + if (m_src_vertex > m_src_vertices.size()) + { + m_status = stop; + } + else + { + m_v2 = &m_src_vertices[(m_src_vertex >= m_src_vertices.size()) ? 0 : m_src_vertex]; + } } else { - m_v2 = &m_src_vertices[m_src_vertex]; + if (m_src_vertex >= m_src_vertices.size()) + { + m_status = stop; + } + else + { + m_v2 = &m_src_vertices[m_src_vertex]; + } } } + return cmd2; } - return cmd2; - } - break; - - case stop: - cmd = path_cmd_stop; break; - } + case stop: + cmd = path_cmd_stop; + break; + } } return path_cmd_stop; } - -} - +} // namespace agg diff --git a/deps/agg/src/agg_vcgen_markers_term.cpp b/deps/agg/src/agg_vcgen_markers_term.cpp index 89cd93ee8..ad1ead119 100644 --- a/deps/agg/src/agg_vcgen_markers_term.cpp +++ b/deps/agg/src/agg_vcgen_markers_term.cpp @@ -19,8 +19,7 @@ #include "agg_vcgen_markers_term.h" -namespace agg -{ +namespace agg { //------------------------------------------------------------------------ void vcgen_markers_term::remove_all() @@ -28,13 +27,12 @@ void vcgen_markers_term::remove_all() m_markers.remove_all(); } - //------------------------------------------------------------------------ void vcgen_markers_term::add_vertex(double x, double y, unsigned cmd) { - if(is_move_to(cmd)) + if (is_move_to(cmd)) { - if(m_markers.size() & 1) + if (m_markers.size() & 1) { // Initial state, the first coordinate was added. // If two of more calls of start_vertex() occures @@ -48,9 +46,9 @@ void vcgen_markers_term::add_vertex(double x, double y, unsigned cmd) } else { - if(is_vertex(cmd)) + if (is_vertex(cmd)) { - if(m_markers.size() & 1) + if (m_markers.size() & 1) { // Initial state, the first coordinate was added. // Add three more points, 0,1,1,0 @@ -60,7 +58,7 @@ void vcgen_markers_term::add_vertex(double x, double y, unsigned cmd) } else { - if(m_markers.size()) + if (m_markers.size()) { // Replace two last points: 0,1,1,0 -> 0,1,2,1 m_markers[m_markers.size() - 1] = m_markers[m_markers.size() - 2]; @@ -71,7 +69,6 @@ void vcgen_markers_term::add_vertex(double x, double y, unsigned cmd) } } - //------------------------------------------------------------------------ void vcgen_markers_term::rewind(unsigned path_id) { @@ -79,18 +76,17 @@ void vcgen_markers_term::rewind(unsigned path_id) m_curr_idx = m_curr_id; } - //------------------------------------------------------------------------ unsigned vcgen_markers_term::vertex(double* x, double* y) { - if(m_curr_id > 2 || m_curr_idx >= m_markers.size()) + if (m_curr_id > 2 || m_curr_idx >= m_markers.size()) { return path_cmd_stop; } const coord_type& c = m_markers[m_curr_idx]; *x = c.x; *y = c.y; - if(m_curr_idx & 1) + if (m_curr_idx & 1) { m_curr_idx += 3; return path_cmd_line_to; @@ -99,5 +95,4 @@ unsigned vcgen_markers_term::vertex(double* x, double* y) return path_cmd_move_to; } - -} +} // namespace agg diff --git a/deps/agg/src/agg_vcgen_stroke.cpp b/deps/agg/src/agg_vcgen_stroke.cpp index 3ee336f03..1c1dbc435 100644 --- a/deps/agg/src/agg_vcgen_stroke.cpp +++ b/deps/agg/src/agg_vcgen_stroke.cpp @@ -20,21 +20,19 @@ #include "agg_vcgen_stroke.h" #include "agg_shorten_path.h" -namespace agg -{ +namespace agg { //------------------------------------------------------------------------ -vcgen_stroke::vcgen_stroke() : - m_stroker(), - m_src_vertices(), - m_out_vertices(), - m_shorten(0.0), - m_closed(0), - m_status(initial), - m_src_vertex(0), - m_out_vertex(0) -{ -} +vcgen_stroke::vcgen_stroke() + : m_stroker() + , m_src_vertices() + , m_out_vertices() + , m_shorten(0.0) + , m_closed(0) + , m_status(initial) + , m_src_vertex(0) + , m_out_vertex(0) +{} //------------------------------------------------------------------------ void vcgen_stroke::remove_all() @@ -44,18 +42,17 @@ void vcgen_stroke::remove_all() m_status = initial; } - //------------------------------------------------------------------------ void vcgen_stroke::add_vertex(double x, double y, unsigned cmd) { m_status = initial; - if(is_move_to(cmd)) + if (is_move_to(cmd)) { m_src_vertices.modify_last(vertex_dist(x, y)); } else { - if(is_vertex(cmd)) + if (is_vertex(cmd)) { m_src_vertices.add(vertex_dist(x, y)); } @@ -69,145 +66,142 @@ void vcgen_stroke::add_vertex(double x, double y, unsigned cmd) //------------------------------------------------------------------------ void vcgen_stroke::rewind(unsigned) { - if(m_status == initial) + if (m_status == initial) { m_src_vertices.close(m_closed != 0); shorten_path(m_src_vertices, m_shorten, m_closed); - if(m_src_vertices.size() < 3) m_closed = 0; + if (m_src_vertices.size() < 3) + m_closed = 0; } m_status = ready; m_src_vertex = 0; m_out_vertex = 0; } - //------------------------------------------------------------------------ unsigned vcgen_stroke::vertex(double* x, double* y) { unsigned cmd = path_cmd_line_to; - while(!is_stop(cmd)) + while (!is_stop(cmd)) { - switch(m_status) + switch (m_status) { - case initial: - rewind(0); + case initial: + rewind(0); - case ready: - if(m_src_vertices.size() < 2 + unsigned(m_closed != 0)) - { + case ready: + if (m_src_vertices.size() < 2 + unsigned(m_closed != 0)) + { + cmd = path_cmd_stop; + break; + } + m_status = m_closed ? outline1 : cap1; + cmd = path_cmd_move_to; + m_src_vertex = 0; + m_out_vertex = 0; + break; + + case cap1: + m_stroker.calc_cap(m_out_vertices, m_src_vertices[0], m_src_vertices[1], m_src_vertices[0].dist); + m_src_vertex = 1; + m_prev_status = outline1; + m_status = out_vertices; + m_out_vertex = 0; + break; + + case cap2: + m_stroker.calc_cap(m_out_vertices, + m_src_vertices[m_src_vertices.size() - 1], + m_src_vertices[m_src_vertices.size() - 2], + m_src_vertices[m_src_vertices.size() - 2].dist); + m_prev_status = outline2; + m_status = out_vertices; + m_out_vertex = 0; + break; + + case outline1: + if (m_closed) + { + if (m_src_vertex >= m_src_vertices.size()) + { + m_prev_status = close_first; + m_status = end_poly1; + break; + } + } + else + { + if (m_src_vertex >= m_src_vertices.size() - 1) + { + m_status = cap2; + break; + } + } + m_stroker.calc_join(m_out_vertices, + m_src_vertices.prev(m_src_vertex), + m_src_vertices.curr(m_src_vertex), + m_src_vertices.next(m_src_vertex), + m_src_vertices.prev(m_src_vertex).dist, + m_src_vertices.curr(m_src_vertex).dist); + ++m_src_vertex; + m_prev_status = m_status; + m_status = out_vertices; + m_out_vertex = 0; + break; + + case close_first: + m_status = outline2; + cmd = path_cmd_move_to; + + case outline2: + if (m_src_vertex <= unsigned(m_closed == 0)) + { + m_status = end_poly2; + m_prev_status = stop; + break; + } + + --m_src_vertex; + m_stroker.calc_join(m_out_vertices, + m_src_vertices.next(m_src_vertex), + m_src_vertices.curr(m_src_vertex), + m_src_vertices.prev(m_src_vertex), + m_src_vertices.curr(m_src_vertex).dist, + m_src_vertices.prev(m_src_vertex).dist); + + m_prev_status = m_status; + m_status = out_vertices; + m_out_vertex = 0; + break; + + case out_vertices: + if (m_out_vertex >= m_out_vertices.size()) + { + m_status = m_prev_status; + } + else + { + const point_d& c = m_out_vertices[m_out_vertex++]; + *x = c.x; + *y = c.y; + return cmd; + } + break; + + case end_poly1: + m_status = m_prev_status; + return path_cmd_end_poly | path_flags_close | path_flags_ccw; + + case end_poly2: + m_status = m_prev_status; + return path_cmd_end_poly | path_flags_close | path_flags_cw; + + case stop: cmd = path_cmd_stop; break; - } - m_status = m_closed ? outline1 : cap1; - cmd = path_cmd_move_to; - m_src_vertex = 0; - m_out_vertex = 0; - break; - - case cap1: - m_stroker.calc_cap(m_out_vertices, - m_src_vertices[0], - m_src_vertices[1], - m_src_vertices[0].dist); - m_src_vertex = 1; - m_prev_status = outline1; - m_status = out_vertices; - m_out_vertex = 0; - break; - - case cap2: - m_stroker.calc_cap(m_out_vertices, - m_src_vertices[m_src_vertices.size() - 1], - m_src_vertices[m_src_vertices.size() - 2], - m_src_vertices[m_src_vertices.size() - 2].dist); - m_prev_status = outline2; - m_status = out_vertices; - m_out_vertex = 0; - break; - - case outline1: - if(m_closed) - { - if(m_src_vertex >= m_src_vertices.size()) - { - m_prev_status = close_first; - m_status = end_poly1; - break; - } - } - else - { - if(m_src_vertex >= m_src_vertices.size() - 1) - { - m_status = cap2; - break; - } - } - m_stroker.calc_join(m_out_vertices, - m_src_vertices.prev(m_src_vertex), - m_src_vertices.curr(m_src_vertex), - m_src_vertices.next(m_src_vertex), - m_src_vertices.prev(m_src_vertex).dist, - m_src_vertices.curr(m_src_vertex).dist); - ++m_src_vertex; - m_prev_status = m_status; - m_status = out_vertices; - m_out_vertex = 0; - break; - - case close_first: - m_status = outline2; - cmd = path_cmd_move_to; - - case outline2: - if(m_src_vertex <= unsigned(m_closed == 0)) - { - m_status = end_poly2; - m_prev_status = stop; - break; - } - - --m_src_vertex; - m_stroker.calc_join(m_out_vertices, - m_src_vertices.next(m_src_vertex), - m_src_vertices.curr(m_src_vertex), - m_src_vertices.prev(m_src_vertex), - m_src_vertices.curr(m_src_vertex).dist, - m_src_vertices.prev(m_src_vertex).dist); - - m_prev_status = m_status; - m_status = out_vertices; - m_out_vertex = 0; - break; - - case out_vertices: - if(m_out_vertex >= m_out_vertices.size()) - { - m_status = m_prev_status; - } - else - { - const point_d& c = m_out_vertices[m_out_vertex++]; - *x = c.x; - *y = c.y; - return cmd; - } - break; - - case end_poly1: - m_status = m_prev_status; - return path_cmd_end_poly | path_flags_close | path_flags_ccw; - - case end_poly2: - m_status = m_prev_status; - return path_cmd_end_poly | path_flags_close | path_flags_cw; - - case stop: - cmd = path_cmd_stop; - break; } } return cmd; } -} +} // namespace agg diff --git a/deps/agg/src/agg_vpgen_clip_polygon.cpp b/deps/agg/src/agg_vpgen_clip_polygon.cpp index 12e293507..7535901a9 100644 --- a/deps/agg/src/agg_vpgen_clip_polygon.cpp +++ b/deps/agg/src/agg_vpgen_clip_polygon.cpp @@ -16,8 +16,7 @@ #include "agg_vpgen_clip_polygon.h" #include "agg_clip_liang_barsky.h" -namespace agg -{ +namespace agg { //------------------------------------------------------------------------ // Determine the clipping code of the vertex according to the @@ -39,22 +38,28 @@ namespace agg // unsigned vpgen_clip_polygon::clipping_flags(double x, double y) { - if(x < m_clip_box.x1) + if (x < m_clip_box.x1) { - if(y > m_clip_box.y2) return 6; - if(y < m_clip_box.y1) return 12; + if (y > m_clip_box.y2) + return 6; + if (y < m_clip_box.y1) + return 12; return 4; } - if(x > m_clip_box.x2) + if (x > m_clip_box.x2) { - if(y > m_clip_box.y2) return 3; - if(y < m_clip_box.y1) return 9; + if (y > m_clip_box.y2) + return 3; + if (y < m_clip_box.y1) + return 9; return 1; } - if(y > m_clip_box.y2) return 2; - if(y < m_clip_box.y1) return 8; + if (y > m_clip_box.y2) + return 2; + if (y < m_clip_box.y1) + return 8; return 0; } @@ -72,18 +77,17 @@ void vpgen_clip_polygon::move_to(double x, double y) m_vertex = 0; m_num_vertices = 0; m_clip_flags = clipping_flags(x, y); - if(m_clip_flags == 0) + if (m_clip_flags == 0) { m_x[0] = x; m_y[0] = y; m_num_vertices = 1; } - m_x1 = x; - m_y1 = y; + m_x1 = x; + m_y1 = y; m_cmd = path_cmd_move_to; } - //---------------------------------------------------------------------------- void vpgen_clip_polygon::line_to(double x, double y) { @@ -91,9 +95,9 @@ void vpgen_clip_polygon::line_to(double x, double y) m_num_vertices = 0; unsigned flags = clipping_flags(x, y); - if(m_clip_flags == flags) + if (m_clip_flags == flags) { - if(flags == 0) + if (flags == 0) { m_x[0] = x; m_y[0] = y; @@ -102,10 +106,7 @@ void vpgen_clip_polygon::line_to(double x, double y) } else { - m_num_vertices = clip_liang_barsky(m_x1, m_y1, - x, y, - m_clip_box, - m_x, m_y); + m_num_vertices = clip_liang_barsky(m_x1, m_y1, x, y, m_clip_box, m_x, m_y); } m_clip_flags = flags; @@ -113,11 +114,10 @@ void vpgen_clip_polygon::line_to(double x, double y) m_y1 = y; } - //---------------------------------------------------------------------------- unsigned vpgen_clip_polygon::vertex(double* x, double* y) { - if(m_vertex < m_num_vertices) + if (m_vertex < m_num_vertices) { *x = m_x[m_vertex]; *y = m_y[m_vertex]; @@ -129,5 +129,4 @@ unsigned vpgen_clip_polygon::vertex(double* x, double* y) return path_cmd_stop; } - -} +} // namespace agg diff --git a/deps/agg/src/agg_vpgen_clip_polyline.cpp b/deps/agg/src/agg_vpgen_clip_polyline.cpp index 8b5d65121..5a57b1174 100644 --- a/deps/agg/src/agg_vpgen_clip_polyline.cpp +++ b/deps/agg/src/agg_vpgen_clip_polyline.cpp @@ -16,8 +16,7 @@ #include "agg_vpgen_clip_polyline.h" #include "agg_clip_liang_barsky.h" -namespace agg -{ +namespace agg { //---------------------------------------------------------------------------- void vpgen_clip_polyline::reset() { @@ -45,9 +44,9 @@ void vpgen_clip_polyline::line_to(double x, double y) m_vertex = 0; m_num_vertices = 0; - if((flags & 4) == 0) + if ((flags & 4) == 0) { - if((flags & 1) != 0 || m_move_to) + if ((flags & 1) != 0 || m_move_to) { m_x[0] = m_x1; m_y[0] = m_y1; @@ -66,7 +65,7 @@ void vpgen_clip_polyline::line_to(double x, double y) //---------------------------------------------------------------------------- unsigned vpgen_clip_polyline::vertex(double* x, double* y) { - if(m_vertex < m_num_vertices) + if (m_vertex < m_num_vertices) { *x = m_x[m_vertex]; *y = m_y[m_vertex]; @@ -74,4 +73,4 @@ unsigned vpgen_clip_polyline::vertex(double* x, double* y) } return path_cmd_stop; } -} +} // namespace agg diff --git a/deps/agg/src/agg_vpgen_segmentator.cpp b/deps/agg/src/agg_vpgen_segmentator.cpp index 7d5ccfcdd..efdd074ab 100644 --- a/deps/agg/src/agg_vpgen_segmentator.cpp +++ b/deps/agg/src/agg_vpgen_segmentator.cpp @@ -16,8 +16,7 @@ #include #include "agg_vpgen_segmentator.h" -namespace agg -{ +namespace agg { void vpgen_segmentator::move_to(double x, double y) { @@ -34,22 +33,25 @@ void vpgen_segmentator::line_to(double x, double y) { m_x1 += m_dx; m_y1 += m_dy; - m_dx = x - m_x1; - m_dy = y - m_y1; + m_dx = x - m_x1; + m_dy = y - m_y1; double len = sqrt(m_dx * m_dx + m_dy * m_dy) * m_approximation_scale; - if(len < 1e-30) len = 1e-30; + if (len < 1e-30) + len = 1e-30; m_ddl = 1.0 / len; - m_dl = (m_cmd == path_cmd_move_to) ? 0.0 : m_ddl; - if(m_cmd == path_cmd_stop) m_cmd = path_cmd_line_to; + m_dl = (m_cmd == path_cmd_move_to) ? 0.0 : m_ddl; + if (m_cmd == path_cmd_stop) + m_cmd = path_cmd_line_to; } unsigned vpgen_segmentator::vertex(double* x, double* y) { - if(m_cmd == path_cmd_stop) return path_cmd_stop; + if (m_cmd == path_cmd_stop) + return path_cmd_stop; unsigned cmd = m_cmd; m_cmd = path_cmd_line_to; - if(m_dl >= 1.0 - m_ddl) + if (m_dl >= 1.0 - m_ddl) { m_dl = 1.0; m_cmd = path_cmd_stop; @@ -63,5 +65,4 @@ unsigned vpgen_segmentator::vertex(double* x, double* y) return cmd; } -} - +} // namespace agg diff --git a/deps/boost/geometry/extensions/algorithms/closest_point.hpp b/deps/boost/geometry/extensions/algorithms/closest_point.hpp index f3a0794d4..9d7ecae64 100644 --- a/deps/boost/geometry/extensions/algorithms/closest_point.hpp +++ b/deps/boost/geometry/extensions/algorithms/closest_point.hpp @@ -35,30 +35,28 @@ #include - -namespace boost { namespace geometry -{ +namespace boost { +namespace geometry { #ifndef DOXYGEN_NO_DETAIL -namespace detail { namespace closest_point { +namespace detail { +namespace closest_point { - -template +template struct point_point { - template + template static inline void apply(Point1 const& point1, Point2 const& point2, Strategy const& strategy, Result& result) { - result.distance - = strategy.apply_point_point(point1, point2); + result.distance = strategy.apply_point_point(point1, point2); geometry::convert(point2, result.closest_point); } }; -template +template struct point_range { - template + template static inline void apply(Point const& point, Range const& range, Strategy const& strategy, Result& result) { // This should not occur (see exception on empty input below) @@ -81,7 +79,7 @@ struct point_range strategy.apply(point, *prev, *it, result); // Check other segments - for(prev = it++; it != boost::end(range); prev = it++) + for (prev = it++; it != boost::end(range); prev = it++) { Result other; strategy.apply(point, *prev, *it, other); @@ -93,72 +91,44 @@ struct point_range } }; - - - -}} // namespace detail::closest_point +} // namespace closest_point +} // namespace detail #endif // DOXYGEN_NO_DETAIL - #ifndef DOXYGEN_NO_DISPATCH -namespace dispatch -{ +namespace dispatch { -template -< - typename Geometry1, typename Geometry2, - typename Tag1 = typename tag::type, - typename Tag2 = typename tag::type, - bool Reverse = reverse_dispatch::type::value -> +template::type, + typename Tag2 = typename tag::type, + bool Reverse = reverse_dispatch::type::value> struct closest_point : not_implemented -{ -}; - - -template -< - typename Geometry1, typename Geometry2, - typename Tag1, typename Tag2 -> -struct closest_point -{ - template - static inline void apply(Geometry1 const& geometry1, Geometry2 const& geometry2, - Strategy const& strategy, Result& result) - { - // Reversed version just calls dispatch with reversed arguments - closest_point - < - Geometry2, Geometry1, Tag2, Tag1, false - >::apply(geometry2, geometry1, strategy, result); - } - -}; - - -template -struct closest_point - < - Point1, Point2, - point_tag, point_tag, false - > : public detail::closest_point::point_point {}; +template +struct closest_point +{ + template + static inline void + apply(Geometry1 const& geometry1, Geometry2 const& geometry2, Strategy const& strategy, Result& result) + { + // Reversed version just calls dispatch with reversed arguments + closest_point::apply(geometry2, geometry1, strategy, result); + } +}; + +template +struct closest_point + : public detail::closest_point::point_point +{}; template -struct closest_point - < - Point, Segment, - point_tag, segment_tag, - false - > +struct closest_point { - template - static inline void apply(Point const& point, Segment const& segment, - Strategy const& strategy, Result& result) + template + static inline void apply(Point const& point, Segment const& segment, Strategy const& strategy, Result& result) { - typename point_type::type p[2]; geometry::detail::assign_point_from_index<0>(segment, p[0]); geometry::detail::assign_point_from_index<1>(segment, p[1]); @@ -167,30 +137,20 @@ struct closest_point } }; - -template -struct closest_point - : detail::closest_point::point_range +template +struct closest_point : detail::closest_point::point_range {}; // template -struct closest_point - < - Point, Linestring, - point_tag, linestring_tag, - false - > +struct closest_point : detail::closest_point::point_range {}; - } // namespace dispatch #endif // DOXYGEN_NO_DISPATCH - - -template +template inline void closest_point(Geometry1 const& geometry1, Geometry2 const& geometry2, Result& result) { concepts::check(); @@ -205,15 +165,10 @@ inline void closest_point(Geometry1 const& geometry1, Geometry2 const& geometry2 strategy::distance::calculate_closest_point<> info_strategy; - - dispatch::closest_point - < - Geometry1, - Geometry2 - >::apply(geometry1, geometry2, info_strategy, result); + dispatch::closest_point::apply(geometry1, geometry2, info_strategy, result); } - -}} // namespace boost::geometry +} // namespace geometry +} // namespace boost #endif // BOOST_GEOMETRY_ALGORITHMS_CLOSEST_POINT_HPP diff --git a/deps/boost/geometry/extensions/strategies/cartesian/closest_point.hpp b/deps/boost/geometry/extensions/strategies/cartesian/closest_point.hpp index e92812e3a..0c395d1e6 100644 --- a/deps/boost/geometry/extensions/strategies/cartesian/closest_point.hpp +++ b/deps/boost/geometry/extensions/strategies/cartesian/closest_point.hpp @@ -31,11 +31,10 @@ #include +namespace boost { +namespace geometry { -namespace boost { namespace geometry -{ - -template +template struct closest_point_result { typedef Point point_type; @@ -48,54 +47,38 @@ struct closest_point_result {} }; +namespace strategy { +namespace distance { -namespace strategy { namespace distance -{ - -template -< - typename CalculationType = void, - typename Strategy = pythagoras -> +template> struct calculate_closest_point { -public : + public: // The three typedefs below are necessary to calculate distances // from segments defined in integer coordinates. // Integer coordinates can still result in FP distances. // There is a division, which must be represented in FP. // So promote. - template + template struct calculation_type - : promote_floating_point - < - typename strategy::distance::services::return_type - < - Strategy, - Point, - PointOfSegment - >::type - > + : promote_floating_point< + typename strategy::distance::services::return_type::type> {}; - -public : + public: // Helper function - template - inline typename calculation_type::type - apply_point_point(Point1 const& p1, Point2 const& p2) const + template + inline typename calculation_type::type apply_point_point(Point1 const& p1, Point2 const& p2) const { Strategy point_point_strategy; boost::ignore_unused_variable_warning(point_point_strategy); return point_point_strategy.apply(p1, p2); } - template - inline void apply(Point const& p, - PointOfSegment const& p1, PointOfSegment const& p2, - Result& result) const + template + inline void apply(Point const& p, PointOfSegment const& p1, PointOfSegment const& p2, Result& result) const { assert_dimension_equal(); @@ -103,12 +86,9 @@ public : //// A projected point of points in Integer coordinates must be able to be //// represented in FP. - typedef model::point - < - calculation_type, - dimension::value, - typename coordinate_system::type - > fp_point_type; + typedef model:: + point::value, typename coordinate_system::type> + fp_point_type; // For convenience typedef fp_point_type fp_vector_type; @@ -129,7 +109,7 @@ public : result.distance = apply_point_point(p, p1); result.closest_point = p1; } - else if(c1 > c2) + else if (c1 > c2) { result.distance = apply_point_point(p, p2); result.closest_point = p2; @@ -155,10 +135,10 @@ public : } }; -}} // namespace strategy::distance - - -}} // namespace boost::geometry +} // namespace distance +} // namespace strategy +} // namespace geometry +} // namespace boost #endif // BOOST_GEOMETRY_STRATEGY_CARTESIAN_CLOSEST_POINT_HPP diff --git a/deps/boost/gil/extension/toolbox/hsl.hpp b/deps/boost/gil/extension/toolbox/hsl.hpp index fd5ad57a6..83013865f 100644 --- a/deps/boost/gil/extension/toolbox/hsl.hpp +++ b/deps/boost/gil/extension/toolbox/hsl.hpp @@ -25,261 +25,242 @@ MAPNIK_DISABLE_WARNING_PUSH MAPNIK_DISABLE_WARNING_POP -namespace boost { namespace gil { +namespace boost { +namespace gil { /// \addtogroup ColorNameModel /// \{ -namespace hsl_color_space -{ +namespace hsl_color_space { /// \brief Hue -struct hue_t {}; +struct hue_t +{}; /// \brief Saturation -struct saturation_t {}; +struct saturation_t +{}; /// \brief Lightness -struct lightness_t {}; -} +struct lightness_t +{}; +} // namespace hsl_color_space /// \} /// \ingroup ColorSpaceModel -typedef mpl::vector3< hsl_color_space::hue_t - , hsl_color_space::saturation_t - , hsl_color_space::lightness_t - > hsl_t; +typedef mpl::vector3 hsl_t; /// \ingroup LayoutModel typedef layout hsl_layout_t; #if BOOST_VERSION >= 106800 using bits32f = boost::gil::float32_t; -GIL_DEFINE_ALL_TYPEDEFS( 32f, float32_t, hsl ); +GIL_DEFINE_ALL_TYPEDEFS(32f, float32_t, hsl); #else -GIL_DEFINE_ALL_TYPEDEFS( 32f, hsl ); +GIL_DEFINE_ALL_TYPEDEFS(32f, hsl); #endif /// \ingroup ColorConvert /// \brief RGB to HSL -template <> -struct default_color_converter_impl< rgb_t, hsl_t > +template<> +struct default_color_converter_impl { - template - void operator()( const P1& src, P2& dst ) const - { - using namespace hsl_color_space; + template + void operator()(const P1& src, P2& dst) const + { + using namespace hsl_color_space; - // only bits32f for hsl is supported - bits32f temp_red = channel_convert( get_color( src, red_t() )); - bits32f temp_green = channel_convert( get_color( src, green_t() )); - bits32f temp_blue = channel_convert( get_color( src, blue_t() )); + // only bits32f for hsl is supported + bits32f temp_red = channel_convert(get_color(src, red_t())); + bits32f temp_green = channel_convert(get_color(src, green_t())); + bits32f temp_blue = channel_convert(get_color(src, blue_t())); - bits32f hue, saturation, lightness; - bits32f min_color, max_color; + bits32f hue, saturation, lightness; + bits32f min_color, max_color; - if( temp_red < temp_green ) - { - min_color = std::min( temp_blue, temp_red ); - max_color = std::max( temp_blue, temp_green ); - } - else - { - min_color = std::min( temp_blue, temp_green ); - max_color = std::max( temp_blue, temp_red ); - } + if (temp_red < temp_green) + { + min_color = std::min(temp_blue, temp_red); + max_color = std::max(temp_blue, temp_green); + } + else + { + min_color = std::min(temp_blue, temp_green); + max_color = std::max(temp_blue, temp_red); + } - if ( max_color - min_color < 0.001 ) - { - // rgb color is gray + if (max_color - min_color < 0.001) + { + // rgb color is gray - hue = 0.f; - saturation = 0.f; + hue = 0.f; + saturation = 0.f; - // doesn't matter which rgb channel we use. - lightness = temp_red; - } - else - { + // doesn't matter which rgb channel we use. + lightness = temp_red; + } + else + { + bits32f diff = max_color - min_color; - bits32f diff = max_color - min_color; + // lightness calculation - // lightness calculation + lightness = (min_color + max_color) / 2.f; - lightness = ( min_color + max_color ) / 2.f; + // saturation calculation - // saturation calculation + if (lightness < 0.5f) + { + saturation = diff / (min_color + max_color); + } + else + { + saturation = (max_color - min_color) / (2.f - diff); + } - if( lightness < 0.5f ) - { - saturation = diff - / ( min_color + max_color ); - } - else - { - saturation = ( max_color - min_color ) - / ( 2.f - diff ); + // hue calculation + if (std::abs(max_color - temp_red) < 0.0001f) + { + // max_color is red + hue = (temp_green - temp_blue) / diff; + } + else if (std::abs(max_color - temp_green) < 0.0001f) + { + // max_color is green + // 2.0 + (b - r) / (maxColor - minColor) + hue = 2.f + (temp_blue - temp_red) / diff; + } + else + { + // max_color is blue + // 4.0 + (r - g) / (maxColor - minColor) + hue = 4.f + (temp_red - temp_green) / diff; + } - } + hue /= 6.f; - // hue calculation - if( std::abs( max_color - temp_red ) < 0.0001f ) - { - // max_color is red - hue = ( temp_green - temp_blue ) - / diff; + if (hue < 0.f) + { + hue += 1.f; + } + } - } - else if( std::abs( max_color - temp_green) < 0.0001f ) - { - // max_color is green - // 2.0 + (b - r) / (maxColor - minColor) - hue = 2.f - + ( temp_blue - temp_red ) - / diff; - - } - else - { - // max_color is blue - // 4.0 + (r - g) / (maxColor - minColor) - hue = 4.f - + ( temp_red - temp_green ) - / diff; - } - - hue /= 6.f; - - if( hue < 0.f ) - { - hue += 1.f; - } - } - - get_color( dst,hue_t() ) = hue; - get_color( dst,saturation_t() ) = saturation; - get_color( dst,lightness_t() ) = lightness; - } + get_color(dst, hue_t()) = hue; + get_color(dst, saturation_t()) = saturation; + get_color(dst, lightness_t()) = lightness; + } }; /// \ingroup ColorConvert /// \brief HSL to RGB -template <> -struct default_color_converter_impl +template<> +struct default_color_converter_impl { - template - void operator()( const P1& src, P2& dst) const - { - using namespace hsl_color_space; + template + void operator()(const P1& src, P2& dst) const + { + using namespace hsl_color_space; - bits32f red, green, blue; + bits32f red, green, blue; - if( std::abs( get_color( src, saturation_t() )) < 0.0001 ) - { - // If saturation is 0, the color is a shade of gray - red = get_color( src, lightness_t() ); - green = get_color( src, lightness_t() ); - blue = get_color( src, lightness_t() ); - } - else - { - float temp1, temp2; - float tempr, tempg, tempb; + if (std::abs(get_color(src, saturation_t())) < 0.0001) + { + // If saturation is 0, the color is a shade of gray + red = get_color(src, lightness_t()); + green = get_color(src, lightness_t()); + blue = get_color(src, lightness_t()); + } + else + { + float temp1, temp2; + float tempr, tempg, tempb; - //Set the temporary values - if( get_color( src, lightness_t() ) < 0.5 ) - { - temp2 = get_color( src, lightness_t() ) - * ( 1.f + get_color( src, saturation_t() ) ); - } - else - { - temp2 = ( get_color( src, lightness_t() ) + get_color( src, saturation_t() )) - - ( get_color( src, lightness_t() ) * get_color( src, saturation_t() )); - } + // Set the temporary values + if (get_color(src, lightness_t()) < 0.5) + { + temp2 = get_color(src, lightness_t()) * (1.f + get_color(src, saturation_t())); + } + else + { + temp2 = (get_color(src, lightness_t()) + get_color(src, saturation_t())) - + (get_color(src, lightness_t()) * get_color(src, saturation_t())); + } - temp1 = 2.f - * get_color( src, lightness_t() ) - - temp2; + temp1 = 2.f * get_color(src, lightness_t()) - temp2; - tempr = get_color( src, hue_t() ) + 1.f / 3.f; + tempr = get_color(src, hue_t()) + 1.f / 3.f; - if( tempr > 1.f ) - { - tempr--; - } + if (tempr > 1.f) + { + tempr--; + } - tempg = get_color( src, hue_t() ); - tempb = get_color( src, hue_t() ) - 1.f / 3.f; + tempg = get_color(src, hue_t()); + tempb = get_color(src, hue_t()) - 1.f / 3.f; - if( tempb < 0.f ) - { - tempb++; - } + if (tempb < 0.f) + { + tempb++; + } - //Red - if( tempr < 1.f / 6.f ) - { - red = temp1 + ( temp2 - temp1 ) * 6.f * tempr; - } - else if( tempr < 0.5f ) - { - red = temp2; - } - else if( tempr < 2.f / 3.f ) - { - red = temp1 + (temp2 - temp1) - * (( 2.f / 3.f ) - tempr) * 6.f; - } - else - { - red = temp1; - } + // Red + if (tempr < 1.f / 6.f) + { + red = temp1 + (temp2 - temp1) * 6.f * tempr; + } + else if (tempr < 0.5f) + { + red = temp2; + } + else if (tempr < 2.f / 3.f) + { + red = temp1 + (temp2 - temp1) * ((2.f / 3.f) - tempr) * 6.f; + } + else + { + red = temp1; + } - //Green - if( tempg < 1.f / 6.f ) - { - green = temp1 + ( temp2 - temp1 ) * 6.f * tempg; - } - else if( tempg < 0.5f ) - { - green = temp2; - } - else if( tempg < 2.f / 3.f ) - { - green = temp1 + ( temp2 - temp1 ) - * (( 2.f / 3.f ) - tempg) * 6.f; - } - else - { - green = temp1; - } + // Green + if (tempg < 1.f / 6.f) + { + green = temp1 + (temp2 - temp1) * 6.f * tempg; + } + else if (tempg < 0.5f) + { + green = temp2; + } + else if (tempg < 2.f / 3.f) + { + green = temp1 + (temp2 - temp1) * ((2.f / 3.f) - tempg) * 6.f; + } + else + { + green = temp1; + } - //Blue - if( tempb < 1.f / 6.f ) - { - blue = temp1 + (temp2 - temp1) * 6.f * tempb; - } - else if( tempb < 0.5f ) - { - blue = temp2; - } - else if( tempb < 2.f / 3.f ) - { - blue = temp1 + (temp2 - temp1) - * (( 2.f / 3.f ) - tempb) * 6.f; - } - else - { - blue = temp1; - } - } + // Blue + if (tempb < 1.f / 6.f) + { + blue = temp1 + (temp2 - temp1) * 6.f * tempb; + } + else if (tempb < 0.5f) + { + blue = temp2; + } + else if (tempb < 2.f / 3.f) + { + blue = temp1 + (temp2 - temp1) * ((2.f / 3.f) - tempb) * 6.f; + } + else + { + blue = temp1; + } + } - get_color(dst,red_t()) = - channel_convert::type>( red ); - get_color(dst,green_t())= - channel_convert::type>( green ); - get_color(dst,blue_t()) = - channel_convert::type>( blue ); - } + get_color(dst, red_t()) = channel_convert::type>(red); + get_color(dst, green_t()) = channel_convert::type>(green); + get_color(dst, blue_t()) = channel_convert::type>(blue); + } }; -} } // namespace boost::gil +} // namespace gil +} // namespace boost #endif // GIL_HSL_H diff --git a/deps/boost/gil/extension/toolbox/hsv.hpp b/deps/boost/gil/extension/toolbox/hsv.hpp index 94850acb6..f1df961eb 100644 --- a/deps/boost/gil/extension/toolbox/hsv.hpp +++ b/deps/boost/gil/extension/toolbox/hsv.hpp @@ -25,235 +25,224 @@ MAPNIK_DISABLE_WARNING_PUSH MAPNIK_DISABLE_WARNING_POP -namespace boost { namespace gil { +namespace boost { +namespace gil { /// \addtogroup ColorNameModel /// \{ -namespace hsv_color_space -{ +namespace hsv_color_space { /// \brief Hue -struct hue_t {}; +struct hue_t +{}; /// \brief Saturation -struct saturation_t{}; +struct saturation_t +{}; /// \brief Value -struct value_t {}; -} +struct value_t +{}; +} // namespace hsv_color_space /// \} /// \ingroup ColorSpaceModel -typedef mpl::vector3< hsv_color_space::hue_t - , hsv_color_space::saturation_t - , hsv_color_space::value_t - > hsv_t; +typedef mpl::vector3 hsv_t; /// \ingroup LayoutModel typedef layout hsv_layout_t; - #if BOOST_VERSION >= 106800 using bits32 = uint32_t; using bits32f = float32_t; -GIL_DEFINE_ALL_TYPEDEFS( 32f, float32_t, hsv ) +GIL_DEFINE_ALL_TYPEDEFS(32f, float32_t, hsv) #else -GIL_DEFINE_ALL_TYPEDEFS( 32f, hsv ); +GIL_DEFINE_ALL_TYPEDEFS(32f, hsv); #endif /// \ingroup ColorConvert /// \brief RGB to HSV -template <> -struct default_color_converter_impl< rgb_t, hsv_t > +template<> +struct default_color_converter_impl { - template - void operator()( const P1& src, P2& dst ) const - { - using namespace hsv_color_space; + template + void operator()(const P1& src, P2& dst) const + { + using namespace hsv_color_space; - // only bits32f for hsv is supported - bits32f temp_red = channel_convert( get_color( src, red_t() )); - bits32f temp_green = channel_convert( get_color( src, green_t() )); - bits32f temp_blue = channel_convert( get_color( src, blue_t() )); + // only bits32f for hsv is supported + bits32f temp_red = channel_convert(get_color(src, red_t())); + bits32f temp_green = channel_convert(get_color(src, green_t())); + bits32f temp_blue = channel_convert(get_color(src, blue_t())); - bits32f hue, saturation, value; - bits32f min_color, max_color; + bits32f hue, saturation, value; + bits32f min_color, max_color; - if( temp_red < temp_green ) - { - min_color = std::min( temp_blue, temp_red ); - max_color = std::max( temp_blue, temp_green ); - } - else - { - min_color = std::min( temp_blue, temp_green ); - max_color = std::max( temp_blue, temp_red ); - } + if (temp_red < temp_green) + { + min_color = std::min(temp_blue, temp_red); + max_color = std::max(temp_blue, temp_green); + } + else + { + min_color = std::min(temp_blue, temp_green); + max_color = std::max(temp_blue, temp_red); + } - value = max_color; + value = max_color; - bits32f diff = max_color - min_color; + bits32f diff = max_color - min_color; - if( max_color < 0.0001f ) - { - saturation = 0.f; - } - else - { - saturation = diff / max_color; - } + if (max_color < 0.0001f) + { + saturation = 0.f; + } + else + { + saturation = diff / max_color; + } + if (saturation < 0.0001f) + { + // it doesn't matter what value it has + hue = 0.f; + } + else + { + if (temp_red == max_color) + { + hue = (temp_green - temp_blue) / diff; + } + else if (temp_green == max_color) + { + hue = 2.f + (temp_blue - temp_red) / diff; + } + else + { + hue = 4.f + (temp_red - temp_green) / diff; + } - if( saturation < 0.0001f ) - { - //it doesn't matter what value it has - hue = 0.f; - } - else - { - if( temp_red == max_color ) - { - hue = ( temp_green - temp_blue ) - / diff; - } - else if( temp_green == max_color ) - { - hue = 2.f + ( temp_blue - temp_red ) - / diff; - } - else - { - hue = 4.f + ( temp_red - temp_green ) - / diff; - } + // to bring it to a number between 0 and 1 + hue /= 6.f; - //to bring it to a number between 0 and 1 - hue /= 6.f; + if (hue < 0.f) + { + hue++; + } + } - if( hue < 0.f ) - { - hue++; - } - } - - get_color( dst, hue_t() ) = hue; - get_color( dst, saturation_t() ) = saturation; - get_color( dst, value_t() ) = value; - } + get_color(dst, hue_t()) = hue; + get_color(dst, saturation_t()) = saturation; + get_color(dst, value_t()) = value; + } }; /// \ingroup ColorConvert /// \brief HSV to RGB -template <> -struct default_color_converter_impl +template<> +struct default_color_converter_impl { - template - void operator()( const P1& src, P2& dst) const - { - using namespace hsv_color_space; + template + void operator()(const P1& src, P2& dst) const + { + using namespace hsv_color_space; - bits32f red, green, blue; + bits32f red, green, blue; - //If saturation is 0, the color is a shade of gray - if( std::abs( get_color( src, saturation_t() )) < 0.0001f ) - { - // If saturation is 0, the color is a shade of gray - red = get_color( src, value_t() ); - green = get_color( src, value_t() ); - blue = get_color( src, value_t() ); - } - else - { - bits32f frac, p, q, t, h; - bits32 i; + // If saturation is 0, the color is a shade of gray + if (std::abs(get_color(src, saturation_t())) < 0.0001f) + { + // If saturation is 0, the color is a shade of gray + red = get_color(src, value_t()); + green = get_color(src, value_t()); + blue = get_color(src, value_t()); + } + else + { + bits32f frac, p, q, t, h; + bits32 i; - //to bring hue to a number between 0 and 6, better for the calculations - h = get_color( src, hue_t() ); - h *= 6.f; + // to bring hue to a number between 0 and 6, better for the calculations + h = get_color(src, hue_t()); + h *= 6.f; - i = static_cast( floor( h )); + i = static_cast(floor(h)); - frac = h - i; + frac = h - i; - // p = value * (1 - saturation) - p = get_color( src, value_t() ) - * ( 1.f - get_color( src, saturation_t() )); + // p = value * (1 - saturation) + p = get_color(src, value_t()) * (1.f - get_color(src, saturation_t())); - // q = value * (1 - saturation * hue_frac) - // it drops with increasing distance from floor(hue) - q = get_color( src, value_t() ) - * ( 1.f - ( get_color( src, saturation_t() ) * frac )); + // q = value * (1 - saturation * hue_frac) + // it drops with increasing distance from floor(hue) + q = get_color(src, value_t()) * (1.f - (get_color(src, saturation_t()) * frac)); - // t = value * (1 - (saturation * (1 - hue_frac)) - // it grows with increasing distance from floor(hue) - t = get_color( src, value_t() ) - * ( 1.f - ( get_color( src, saturation_t() ) * ( 1.f - frac ))); + // t = value * (1 - (saturation * (1 - hue_frac)) + // it grows with increasing distance from floor(hue) + t = get_color(src, value_t()) * (1.f - (get_color(src, saturation_t()) * (1.f - frac))); - switch( i % 6 ) - { - case 0: // red to yellow + switch (i % 6) { - red = get_color( src, value_t() ); - green = t; - blue = p; + case 0: // red to yellow + { + red = get_color(src, value_t()); + green = t; + blue = p; - break; + break; + } + + case 1: // yellow to green + { + red = q; + green = get_color(src, value_t()); + blue = p; + + break; + } + + case 2: // green to cyan + { + red = p; + green = get_color(src, value_t()); + blue = t; + + break; + } + + case 3: // cyan to blue + { + red = p; + green = q; + blue = get_color(src, value_t()); + + break; + } + + case 4: // blue to magenta + { + red = t; + green = p; + blue = get_color(src, value_t()); + + break; + } + + case 5: // magenta to red + { + red = get_color(src, value_t()); + green = p; + blue = q; + + break; + } } + } - case 1: // yellow to green - { - red = q; - green = get_color( src, value_t() ); - blue = p; - - break; - } - - case 2: // green to cyan - { - red = p; - green = get_color( src, value_t() ); - blue = t; - - break; - } - - case 3: // cyan to blue - { - red = p; - green = q; - blue = get_color( src, value_t() ); - - break; - } - - case 4: // blue to magenta - { - red = t; - green = p; - blue = get_color( src, value_t() ); - - break; - } - - case 5: // magenta to red - { - red = get_color( src, value_t() ); - green = p; - blue = q; - - break; - } - - } - } - - get_color(dst,red_t()) = - channel_convert::type>( red ); - get_color(dst,green_t())= - channel_convert::type>( green ); - get_color(dst,blue_t()) = - channel_convert::type>( blue ); - } + get_color(dst, red_t()) = channel_convert::type>(red); + get_color(dst, green_t()) = channel_convert::type>(green); + get_color(dst, blue_t()) = channel_convert::type>(blue); + } }; -} } // namespace boost::gil +} // namespace gil +} // namespace boost #endif // GIL_HSV_H diff --git a/deps/mapnik/sparsehash/internal/densehashtable.h b/deps/mapnik/sparsehash/internal/densehashtable.h index c0a2fedca..608a43f47 100644 --- a/deps/mapnik/sparsehash/internal/densehashtable.h +++ b/deps/mapnik/sparsehash/internal/densehashtable.h @@ -91,32 +91,32 @@ #include #include -#include // for FILE, fwrite, fread -#include // For swap(), eg -#include // For iterator tags -#include // for numeric_limits -#include // For uninitialized_fill -#include // for pair +#include // for FILE, fwrite, fread +#include // For swap(), eg +#include // For iterator tags +#include // for numeric_limits +#include // For uninitialized_fill +#include // for pair #include #include #include -#include // For length_error +#include // For length_error _START_GOOGLE_NAMESPACE_ -namespace base { // just to make google->opensource transition easier -using GOOGLE_NAMESPACE::true_type; +namespace base { // just to make google->opensource transition easier using GOOGLE_NAMESPACE::false_type; using GOOGLE_NAMESPACE::integral_constant; using GOOGLE_NAMESPACE::is_same; using GOOGLE_NAMESPACE::remove_const; -} +using GOOGLE_NAMESPACE::true_type; +} // namespace base // The probing method // Linear probing // #define JUMP_(key, num_probes) ( 1 ) // Quadratic probing -#define JUMP_(key, num_probes) ( num_probes ) +#define JUMP_(key, num_probes) (num_probes) // Hashtable class, used to implement the hashed associative containers // hash_set and hash_map. @@ -135,1168 +135,1299 @@ using GOOGLE_NAMESPACE::remove_const; // if they are both associated with the same Value). // Alloc: STL allocator to use to allocate memory. -template +template class dense_hashtable; -template +template struct dense_hashtable_iterator; -template +template struct dense_hashtable_const_iterator; // We're just an array, but we need to skip over empty and deleted elements -template -struct dense_hashtable_iterator { - private: - typedef typename A::template rebind::other value_alloc_type; +template +struct dense_hashtable_iterator +{ + private: + typedef typename A::template rebind::other value_alloc_type; - public: - typedef dense_hashtable_iterator iterator; - typedef dense_hashtable_const_iterator const_iterator; + public: + typedef dense_hashtable_iterator iterator; + typedef dense_hashtable_const_iterator const_iterator; - typedef std::forward_iterator_tag iterator_category; // very little defined! - typedef V value_type; - typedef typename value_alloc_type::difference_type difference_type; - typedef typename value_alloc_type::size_type size_type; - typedef typename value_alloc_type::reference reference; - typedef typename value_alloc_type::pointer pointer; + typedef std::forward_iterator_tag iterator_category; // very little defined! + typedef V value_type; + typedef typename value_alloc_type::difference_type difference_type; + typedef typename value_alloc_type::size_type size_type; + typedef typename value_alloc_type::reference reference; + typedef typename value_alloc_type::pointer pointer; - // "Real" constructor and default constructor - dense_hashtable_iterator(const dense_hashtable *h, - pointer it, pointer it_end, bool advance) - : ht(h), pos(it), end(it_end) { - if (advance) advance_past_empty_and_deleted(); - } - dense_hashtable_iterator() { } - // The default destructor is fine; we don't define one - // The default operator= is fine; we don't define one + // "Real" constructor and default constructor + dense_hashtable_iterator(const dense_hashtable* h, + pointer it, + pointer it_end, + bool advance) + : ht(h) + , pos(it) + , end(it_end) + { + if (advance) + advance_past_empty_and_deleted(); + } + dense_hashtable_iterator() {} + // The default destructor is fine; we don't define one + // The default operator= is fine; we don't define one - // Happy dereferencer - reference operator*() const { return *pos; } - pointer operator->() const { return &(operator*()); } + // Happy dereferencer + reference operator*() const { return *pos; } + pointer operator->() const { return &(operator*()); } - // Arithmetic. The only hard part is making sure that - // we're not on an empty or marked-deleted array element - void advance_past_empty_and_deleted() { - while ( pos != end && (ht->test_empty(*this) || ht->test_deleted(*this)) ) - ++pos; - } - iterator& operator++() { - assert(pos != end); ++pos; advance_past_empty_and_deleted(); return *this; - } - iterator operator++(int) { iterator tmp(*this); ++*this; return tmp; } + // Arithmetic. The only hard part is making sure that + // we're not on an empty or marked-deleted array element + void advance_past_empty_and_deleted() + { + while (pos != end && (ht->test_empty(*this) || ht->test_deleted(*this))) + ++pos; + } + iterator& operator++() + { + assert(pos != end); + ++pos; + advance_past_empty_and_deleted(); + return *this; + } + iterator operator++(int) + { + iterator tmp(*this); + ++*this; + return tmp; + } - // Comparison. - bool operator==(const iterator& it) const { return pos == it.pos; } - bool operator!=(const iterator& it) const { return pos != it.pos; } + // Comparison. + bool operator==(const iterator& it) const { return pos == it.pos; } + bool operator!=(const iterator& it) const { return pos != it.pos; } - - // The actual data - const dense_hashtable *ht; - pointer pos, end; + // The actual data + const dense_hashtable* ht; + pointer pos, end; }; - // Now do it all again, but with const-ness! -template -struct dense_hashtable_const_iterator { - private: - typedef typename A::template rebind::other value_alloc_type; +template +struct dense_hashtable_const_iterator +{ + private: + typedef typename A::template rebind::other value_alloc_type; - public: - typedef dense_hashtable_iterator iterator; - typedef dense_hashtable_const_iterator const_iterator; + public: + typedef dense_hashtable_iterator iterator; + typedef dense_hashtable_const_iterator const_iterator; - typedef std::forward_iterator_tag iterator_category; // very little defined! - typedef V value_type; - typedef typename value_alloc_type::difference_type difference_type; - typedef typename value_alloc_type::size_type size_type; - typedef typename value_alloc_type::const_reference reference; - typedef typename value_alloc_type::const_pointer pointer; + typedef std::forward_iterator_tag iterator_category; // very little defined! + typedef V value_type; + typedef typename value_alloc_type::difference_type difference_type; + typedef typename value_alloc_type::size_type size_type; + typedef typename value_alloc_type::const_reference reference; + typedef typename value_alloc_type::const_pointer pointer; - // "Real" constructor and default constructor - dense_hashtable_const_iterator( - const dense_hashtable *h, - pointer it, pointer it_end, bool advance) - : ht(h), pos(it), end(it_end) { - if (advance) advance_past_empty_and_deleted(); - } - dense_hashtable_const_iterator() - : ht(NULL), pos(pointer()), end(pointer()) { } - // This lets us convert regular iterators to const iterators - dense_hashtable_const_iterator(const iterator &it) - : ht(it.ht), pos(it.pos), end(it.end) { } - // The default destructor is fine; we don't define one - // The default operator= is fine; we don't define one + // "Real" constructor and default constructor + dense_hashtable_const_iterator(const dense_hashtable* h, + pointer it, + pointer it_end, + bool advance) + : ht(h) + , pos(it) + , end(it_end) + { + if (advance) + advance_past_empty_and_deleted(); + } + dense_hashtable_const_iterator() + : ht(NULL) + , pos(pointer()) + , end(pointer()) + {} + // This lets us convert regular iterators to const iterators + dense_hashtable_const_iterator(const iterator& it) + : ht(it.ht) + , pos(it.pos) + , end(it.end) + {} + // The default destructor is fine; we don't define one + // The default operator= is fine; we don't define one - // Happy dereferencer - reference operator*() const { return *pos; } - pointer operator->() const { return &(operator*()); } + // Happy dereferencer + reference operator*() const { return *pos; } + pointer operator->() const { return &(operator*()); } - // Arithmetic. The only hard part is making sure that - // we're not on an empty or marked-deleted array element - void advance_past_empty_and_deleted() { - while ( pos != end && (ht->test_empty(*this) || ht->test_deleted(*this)) ) - ++pos; - } - const_iterator& operator++() { - assert(pos != end); ++pos; advance_past_empty_and_deleted(); return *this; - } - const_iterator operator++(int) { const_iterator tmp(*this); ++*this; return tmp; } + // Arithmetic. The only hard part is making sure that + // we're not on an empty or marked-deleted array element + void advance_past_empty_and_deleted() + { + while (pos != end && (ht->test_empty(*this) || ht->test_deleted(*this))) + ++pos; + } + const_iterator& operator++() + { + assert(pos != end); + ++pos; + advance_past_empty_and_deleted(); + return *this; + } + const_iterator operator++(int) + { + const_iterator tmp(*this); + ++*this; + return tmp; + } - // Comparison. - bool operator==(const const_iterator& it) const { return pos == it.pos; } - bool operator!=(const const_iterator& it) const { return pos != it.pos; } + // Comparison. + bool operator==(const const_iterator& it) const { return pos == it.pos; } + bool operator!=(const const_iterator& it) const { return pos != it.pos; } - - // The actual data - const dense_hashtable *ht; - pointer pos, end; + // The actual data + const dense_hashtable* ht; + pointer pos, end; }; -template -class dense_hashtable { - private: - typedef typename Alloc::template rebind::other value_alloc_type; +template +class dense_hashtable +{ + private: + typedef typename Alloc::template rebind::other value_alloc_type; - public: - typedef Key key_type; - typedef Value value_type; - typedef HashFcn hasher; - typedef EqualKey key_equal; - typedef Alloc allocator_type; + public: + typedef Key key_type; + typedef Value value_type; + typedef HashFcn hasher; + typedef EqualKey key_equal; + typedef Alloc allocator_type; - typedef typename value_alloc_type::size_type size_type; - typedef typename value_alloc_type::difference_type difference_type; - typedef typename value_alloc_type::reference reference; - typedef typename value_alloc_type::const_reference const_reference; - typedef typename value_alloc_type::pointer pointer; - typedef typename value_alloc_type::const_pointer const_pointer; - typedef dense_hashtable_iterator - iterator; + typedef typename value_alloc_type::size_type size_type; + typedef typename value_alloc_type::difference_type difference_type; + typedef typename value_alloc_type::reference reference; + typedef typename value_alloc_type::const_reference const_reference; + typedef typename value_alloc_type::pointer pointer; + typedef typename value_alloc_type::const_pointer const_pointer; + typedef dense_hashtable_iterator iterator; - typedef dense_hashtable_const_iterator - const_iterator; + typedef dense_hashtable_const_iterator const_iterator; - // These come from tr1. For us they're the same as regular iterators. - typedef iterator local_iterator; - typedef const_iterator const_local_iterator; + // These come from tr1. For us they're the same as regular iterators. + typedef iterator local_iterator; + typedef const_iterator const_local_iterator; - // How full we let the table get before we resize, by default. - // Knuth says .8 is good -- higher causes us to probe too much, - // though it saves memory. - static const int HT_OCCUPANCY_PCT; // defined at the bottom of this file + // How full we let the table get before we resize, by default. + // Knuth says .8 is good -- higher causes us to probe too much, + // though it saves memory. + static const int HT_OCCUPANCY_PCT; // defined at the bottom of this file - // How empty we let the table get before we resize lower, by default. - // (0.0 means never resize lower.) - // It should be less than OCCUPANCY_PCT / 2 or we thrash resizing - static const int HT_EMPTY_PCT; // defined at the bottom of this file + // How empty we let the table get before we resize lower, by default. + // (0.0 means never resize lower.) + // It should be less than OCCUPANCY_PCT / 2 or we thrash resizing + static const int HT_EMPTY_PCT; // defined at the bottom of this file - // Minimum size we're willing to let hashtables be. - // Must be a power of two, and at least 4. - // Note, however, that for a given hashtable, the initial size is a - // function of the first constructor arg, and may be >HT_MIN_BUCKETS. - static const size_type HT_MIN_BUCKETS = 4; + // Minimum size we're willing to let hashtables be. + // Must be a power of two, and at least 4. + // Note, however, that for a given hashtable, the initial size is a + // function of the first constructor arg, and may be >HT_MIN_BUCKETS. + static const size_type HT_MIN_BUCKETS = 4; - // By default, if you don't specify a hashtable size at - // construction-time, we use this size. Must be a power of two, and - // at least HT_MIN_BUCKETS. - static const size_type HT_DEFAULT_STARTING_BUCKETS = 32; + // By default, if you don't specify a hashtable size at + // construction-time, we use this size. Must be a power of two, and + // at least HT_MIN_BUCKETS. + static const size_type HT_DEFAULT_STARTING_BUCKETS = 32; - // ITERATOR FUNCTIONS - iterator begin() { return iterator(this, table, - table + num_buckets, true); } - iterator end() { return iterator(this, table + num_buckets, - table + num_buckets, true); } - const_iterator begin() const { return const_iterator(this, table, - table+num_buckets,true);} - const_iterator end() const { return const_iterator(this, table + num_buckets, - table+num_buckets,true);} + // ITERATOR FUNCTIONS + iterator begin() { return iterator(this, table, table + num_buckets, true); } + iterator end() { return iterator(this, table + num_buckets, table + num_buckets, true); } + const_iterator begin() const { return const_iterator(this, table, table + num_buckets, true); } + const_iterator end() const { return const_iterator(this, table + num_buckets, table + num_buckets, true); } - // These come from tr1 unordered_map. They iterate over 'bucket' n. - // We'll just consider bucket n to be the n-th element of the table. - local_iterator begin(size_type i) { - return local_iterator(this, table + i, table + i+1, false); - } - local_iterator end(size_type i) { - local_iterator it = begin(i); - if (!test_empty(i) && !test_deleted(i)) - ++it; - return it; - } - const_local_iterator begin(size_type i) const { - return const_local_iterator(this, table + i, table + i+1, false); - } - const_local_iterator end(size_type i) const { - const_local_iterator it = begin(i); - if (!test_empty(i) && !test_deleted(i)) - ++it; - return it; - } - - // ACCESSOR FUNCTIONS for the things we templatize on, basically - hasher hash_funct() const { return settings; } - key_equal key_eq() const { return key_info; } - allocator_type get_allocator() const { - return allocator_type(val_info); - } - - // Accessor function for statistics gathering. - int num_table_copies() const { return settings.num_ht_copies(); } - - private: - // Annoyingly, we can't copy values around, because they might have - // const components (they're probably pair). We use - // explicit destructor invocation and placement new to get around - // this. Arg. - void set_value(pointer dst, const_reference src) { - dst->~value_type(); // delete the old value, if any - new(dst) value_type(src); - } - - void destroy_buckets(size_type first, size_type last) { - for ( ; first != last; ++first) - table[first].~value_type(); - } - - // DELETE HELPER FUNCTIONS - // This lets the user describe a key that will indicate deleted - // table entries. This key should be an "impossible" entry -- - // if you try to insert it for real, you won't be able to retrieve it! - // (NB: while you pass in an entire value, only the key part is looked - // at. This is just because I don't know how to assign just a key.) - private: - void squash_deleted() { // gets rid of any deleted entries we have - if ( num_deleted ) { // get rid of deleted before writing - dense_hashtable tmp(*this); // copying will get rid of deleted - swap(tmp); // now we are tmp + // These come from tr1 unordered_map. They iterate over 'bucket' n. + // We'll just consider bucket n to be the n-th element of the table. + local_iterator begin(size_type i) { return local_iterator(this, table + i, table + i + 1, false); } + local_iterator end(size_type i) + { + local_iterator it = begin(i); + if (!test_empty(i) && !test_deleted(i)) + ++it; + return it; } - assert(num_deleted == 0); - } - - // Test if the given key is the deleted indicator. Requires - // num_deleted > 0, for correctness of read(), and because that - // guarantees that key_info.delkey is valid. - bool test_deleted_key(const key_type& key) const { - assert(num_deleted > 0); - return equals(key_info.delkey, key); - } - - public: - void set_deleted_key(const key_type &key) { - // the empty indicator (if specified) and the deleted indicator - // must be different - assert((!settings.use_empty() || !equals(key, get_key(val_info.emptyval))) - && "Passed the empty-key to set_deleted_key"); - // It's only safe to change what "deleted" means if we purge deleted guys - squash_deleted(); - settings.set_use_deleted(true); - key_info.delkey = key; - } - void clear_deleted_key() { - squash_deleted(); - settings.set_use_deleted(false); - } - key_type deleted_key() const { - assert(settings.use_deleted() - && "Must set deleted key before calling deleted_key"); - return key_info.delkey; - } - - // These are public so the iterators can use them - // True if the item at position bucknum is "deleted" marker - bool test_deleted(size_type bucknum) const { - // Invariant: !use_deleted() implies num_deleted is 0. - assert(settings.use_deleted() || num_deleted == 0); - return num_deleted > 0 && test_deleted_key(get_key(table[bucknum])); - } - bool test_deleted(const iterator &it) const { - // Invariant: !use_deleted() implies num_deleted is 0. - assert(settings.use_deleted() || num_deleted == 0); - return num_deleted > 0 && test_deleted_key(get_key(*it)); - } - bool test_deleted(const const_iterator &it) const { - // Invariant: !use_deleted() implies num_deleted is 0. - assert(settings.use_deleted() || num_deleted == 0); - return num_deleted > 0 && test_deleted_key(get_key(*it)); - } - - private: - void check_use_deleted(const char* caller) { - (void)caller; // could log it if the assert failed - assert(settings.use_deleted()); - } - - // Set it so test_deleted is true. true if object didn't used to be deleted. - bool set_deleted(iterator &it) { - check_use_deleted("set_deleted()"); - bool retval = !test_deleted(it); - // &* converts from iterator to value-type. - set_key(&(*it), key_info.delkey); - return retval; - } - // Set it so test_deleted is false. true if object used to be deleted. - bool clear_deleted(iterator &it) { - check_use_deleted("clear_deleted()"); - // Happens automatically when we assign something else in its place. - return test_deleted(it); - } - - // We also allow to set/clear the deleted bit on a const iterator. - // We allow a const_iterator for the same reason you can delete a - // const pointer: it's convenient, and semantically you can't use - // 'it' after it's been deleted anyway, so its const-ness doesn't - // really matter. - bool set_deleted(const_iterator &it) { - check_use_deleted("set_deleted()"); - bool retval = !test_deleted(it); - set_key(const_cast(&(*it)), key_info.delkey); - return retval; - } - // Set it so test_deleted is false. true if object used to be deleted. - bool clear_deleted(const_iterator &it) { - check_use_deleted("clear_deleted()"); - return test_deleted(it); - } - - // EMPTY HELPER FUNCTIONS - // This lets the user describe a key that will indicate empty (unused) - // table entries. This key should be an "impossible" entry -- - // if you try to insert it for real, you won't be able to retrieve it! - // (NB: while you pass in an entire value, only the key part is looked - // at. This is just because I don't know how to assign just a key.) - public: - // These are public so the iterators can use them - // True if the item at position bucknum is "empty" marker - bool test_empty(size_type bucknum) const { - assert(settings.use_empty()); // we always need to know what's empty! - return equals(get_key(val_info.emptyval), get_key(table[bucknum])); - } - bool test_empty(const iterator &it) const { - assert(settings.use_empty()); // we always need to know what's empty! - return equals(get_key(val_info.emptyval), get_key(*it)); - } - bool test_empty(const const_iterator &it) const { - assert(settings.use_empty()); // we always need to know what's empty! - return equals(get_key(val_info.emptyval), get_key(*it)); - } - - private: - void fill_range_with_empty(pointer table_start, pointer table_end) { - std::uninitialized_fill(table_start, table_end, val_info.emptyval); - } - - public: - // TODO(csilvers): change all callers of this to pass in a key instead, - // and take a const key_type instead of const value_type. - void set_empty_key(const_reference val) { - // Once you set the empty key, you can't change it - assert(!settings.use_empty() && "Calling set_empty_key multiple times"); - // The deleted indicator (if specified) and the empty indicator - // must be different. - assert((!settings.use_deleted() || !equals(get_key(val), key_info.delkey)) - && "Setting the empty key the same as the deleted key"); - settings.set_use_empty(true); - set_value(&val_info.emptyval, val); - - assert(!table); // must set before first use - // num_buckets was set in constructor even though table was NULL - table = val_info.allocate(num_buckets); - assert(table); - fill_range_with_empty(table, table + num_buckets); - } - // TODO(user): return a key_type rather than a value_type - value_type empty_key() const { - assert(settings.use_empty()); - return val_info.emptyval; - } - - // FUNCTIONS CONCERNING SIZE - public: - size_type size() const { return num_elements - num_deleted; } - size_type max_size() const { return val_info.max_size(); } - bool empty() const { return size() == 0; } - size_type bucket_count() const { return num_buckets; } - size_type max_bucket_count() const { return max_size(); } - size_type nonempty_bucket_count() const { return num_elements; } - // These are tr1 methods. Their idea of 'bucket' doesn't map well to - // what we do. We just say every bucket has 0 or 1 items in it. - size_type bucket_size(size_type i) const { - return begin(i) == end(i) ? 0 : 1; - } - - private: - // Because of the above, size_type(-1) is never legal; use it for errors - static const size_type ILLEGAL_BUCKET = size_type(-1); - - // Used after a string of deletes. Returns true if we actually shrunk. - // TODO(csilvers): take a delta so we can take into account inserts - // done after shrinking. Maybe make part of the Settings class? - bool maybe_shrink() { - assert(num_elements >= num_deleted); - assert((bucket_count() & (bucket_count()-1)) == 0); // is a power of two - assert(bucket_count() >= HT_MIN_BUCKETS); - bool retval = false; - - // If you construct a hashtable with < HT_DEFAULT_STARTING_BUCKETS, - // we'll never shrink until you get relatively big, and we'll never - // shrink below HT_DEFAULT_STARTING_BUCKETS. Otherwise, something - // like "dense_hash_set x; x.insert(4); x.erase(4);" will - // shrink us down to HT_MIN_BUCKETS buckets, which is too small. - const size_type num_remain = num_elements - num_deleted; - const size_type shrink_threshold = settings.shrink_threshold(); - if (shrink_threshold > 0 && num_remain < shrink_threshold && - bucket_count() > HT_DEFAULT_STARTING_BUCKETS) { - const float shrink_factor = settings.shrink_factor(); - size_type sz = bucket_count() / 2; // find how much we should shrink - while (sz > HT_DEFAULT_STARTING_BUCKETS && - num_remain < sz * shrink_factor) { - sz /= 2; // stay a power of 2 - } - dense_hashtable tmp(*this, sz); // Do the actual resizing - swap(tmp); // now we are tmp - retval = true; + const_local_iterator begin(size_type i) const + { + return const_local_iterator(this, table + i, table + i + 1, false); } - settings.set_consider_shrink(false); // because we just considered it - return retval; - } - - // We'll let you resize a hashtable -- though this makes us copy all! - // When you resize, you say, "make it big enough for this many more elements" - // Returns true if we actually resized, false if size was already ok. - bool resize_delta(size_type delta) { - bool did_resize = false; - if ( settings.consider_shrink() ) { // see if lots of deletes happened - if ( maybe_shrink() ) - did_resize = true; + const_local_iterator end(size_type i) const + { + const_local_iterator it = begin(i); + if (!test_empty(i) && !test_deleted(i)) + ++it; + return it; } - if (num_elements >= - (std::numeric_limits::max)() - delta) { - throw std::length_error("resize overflow"); + + // ACCESSOR FUNCTIONS for the things we templatize on, basically + hasher hash_funct() const { return settings; } + key_equal key_eq() const { return key_info; } + allocator_type get_allocator() const { return allocator_type(val_info); } + + // Accessor function for statistics gathering. + int num_table_copies() const { return settings.num_ht_copies(); } + + private: + // Annoyingly, we can't copy values around, because they might have + // const components (they're probably pair). We use + // explicit destructor invocation and placement new to get around + // this. Arg. + void set_value(pointer dst, const_reference src) + { + dst->~value_type(); // delete the old value, if any + new (dst) value_type(src); } - if ( bucket_count() >= HT_MIN_BUCKETS && - (num_elements + delta) <= settings.enlarge_threshold() ) - return did_resize; // we're ok as we are - // Sometimes, we need to resize just to get rid of all the - // "deleted" buckets that are clogging up the hashtable. So when - // deciding whether to resize, count the deleted buckets (which - // are currently taking up room). But later, when we decide what - // size to resize to, *don't* count deleted buckets, since they - // get discarded during the resize. - const size_type needed_size = settings.min_buckets(num_elements + delta, 0); - if ( needed_size <= bucket_count() ) // we have enough buckets - return did_resize; - - size_type resize_to = - settings.min_buckets(num_elements - num_deleted + delta, bucket_count()); - - if (resize_to < needed_size && // may double resize_to - resize_to < (std::numeric_limits::max)() / 2) { - // This situation means that we have enough deleted elements, - // that once we purge them, we won't actually have needed to - // grow. But we may want to grow anyway: if we just purge one - // element, say, we'll have to grow anyway next time we - // insert. Might as well grow now, since we're already going - // through the trouble of copying (in order to purge the - // deleted elements). - const size_type target = - static_cast(settings.shrink_size(resize_to*2)); - if (num_elements - num_deleted + delta >= target) { - // Good, we won't be below the shrink threshhold even if we double. - resize_to *= 2; - } + void destroy_buckets(size_type first, size_type last) + { + for (; first != last; ++first) + table[first].~value_type(); } - dense_hashtable tmp(*this, resize_to); - swap(tmp); // now we are tmp - return true; - } - // We require table be not-NULL and empty before calling this. - void resize_table(size_type /*old_size*/, size_type new_size, - base::true_type) { - table = val_info.realloc_or_die(table, new_size); - } - - void resize_table(size_type old_size, size_type new_size, base::false_type) { - val_info.deallocate(table, old_size); - table = val_info.allocate(new_size); - } - - // Used to actually do the rehashing when we grow/shrink a hashtable - void copy_from(const dense_hashtable &ht, size_type min_buckets_wanted) { - clear_to_size(settings.min_buckets(ht.size(), min_buckets_wanted)); - - // We use a normal iterator to get non-deleted bcks from ht - // We could use insert() here, but since we know there are - // no duplicates and no deleted items, we can be more efficient - assert((bucket_count() & (bucket_count()-1)) == 0); // a power of two - for ( const_iterator it = ht.begin(); it != ht.end(); ++it ) { - size_type num_probes = 0; // how many times we've probed - size_type bucknum; - const size_type bucket_count_minus_one = bucket_count() - 1; - for (bucknum = hash(get_key(*it)) & bucket_count_minus_one; - !test_empty(bucknum); // not empty - bucknum = (bucknum + JUMP_(key, num_probes)) & bucket_count_minus_one) { - ++num_probes; - assert(num_probes < bucket_count() - && "Hashtable is full: an error in key_equal<> or hash<>"); - } - set_value(&table[bucknum], *it); // copies the value to here - num_elements++; + // DELETE HELPER FUNCTIONS + // This lets the user describe a key that will indicate deleted + // table entries. This key should be an "impossible" entry -- + // if you try to insert it for real, you won't be able to retrieve it! + // (NB: while you pass in an entire value, only the key part is looked + // at. This is just because I don't know how to assign just a key.) + private: + void squash_deleted() + { // gets rid of any deleted entries we have + if (num_deleted) + { // get rid of deleted before writing + dense_hashtable tmp(*this); // copying will get rid of deleted + swap(tmp); // now we are tmp + } + assert(num_deleted == 0); } - settings.inc_num_ht_copies(); - } - // Required by the spec for hashed associative container - public: - // Though the docs say this should be num_buckets, I think it's much - // more useful as num_elements. As a special feature, calling with - // req_elements==0 will cause us to shrink if we can, saving space. - void resize(size_type req_elements) { // resize to this or larger - if ( settings.consider_shrink() || req_elements == 0 ) - maybe_shrink(); - if ( req_elements > num_elements ) - resize_delta(req_elements - num_elements); - } - - // Get and change the value of shrink_factor and enlarge_factor. The - // description at the beginning of this file explains how to choose - // the values. Setting the shrink parameter to 0.0 ensures that the - // table never shrinks. - void get_resizing_parameters(float* shrink, float* grow) const { - *shrink = settings.shrink_factor(); - *grow = settings.enlarge_factor(); - } - void set_resizing_parameters(float shrink, float grow) { - settings.set_resizing_parameters(shrink, grow); - settings.reset_thresholds(bucket_count()); - } - - // CONSTRUCTORS -- as required by the specs, we take a size, - // but also let you specify a hashfunction, key comparator, - // and key extractor. We also define a copy constructor and =. - // DESTRUCTOR -- needs to free the table - explicit dense_hashtable(size_type expected_max_items_in_table = 0, - const HashFcn& hf = HashFcn(), - const EqualKey& eql = EqualKey(), - const ExtractKey& ext = ExtractKey(), - const SetKey& set = SetKey(), - const Alloc& alloc = Alloc()) - : settings(hf), - key_info(ext, set, eql), - num_deleted(0), - num_elements(0), - num_buckets(expected_max_items_in_table == 0 - ? HT_DEFAULT_STARTING_BUCKETS - : settings.min_buckets(expected_max_items_in_table, 0)), - val_info(alloc_impl(alloc)), - table(NULL) { - // table is NULL until emptyval is set. However, we set num_buckets - // here so we know how much space to allocate once emptyval is set - settings.reset_thresholds(bucket_count()); - } - - // As a convenience for resize(), we allow an optional second argument - // which lets you make this new hashtable a different size than ht - dense_hashtable(const dense_hashtable& ht, - size_type min_buckets_wanted = HT_DEFAULT_STARTING_BUCKETS) - : settings(ht.settings), - key_info(ht.key_info), - num_deleted(0), - num_elements(0), - num_buckets(0), - val_info(ht.val_info), - table(NULL) { - if (!ht.settings.use_empty()) { - // If use_empty isn't set, copy_from will crash, so we do our own copying. - assert(ht.empty()); - num_buckets = settings.min_buckets(ht.size(), min_buckets_wanted); - settings.reset_thresholds(bucket_count()); - return; + // Test if the given key is the deleted indicator. Requires + // num_deleted > 0, for correctness of read(), and because that + // guarantees that key_info.delkey is valid. + bool test_deleted_key(const key_type& key) const + { + assert(num_deleted > 0); + return equals(key_info.delkey, key); } - settings.reset_thresholds(bucket_count()); - copy_from(ht, min_buckets_wanted); // copy_from() ignores deleted entries - } - dense_hashtable& operator= (const dense_hashtable& ht) { - if (&ht == this) return *this; // don't copy onto ourselves - if (!ht.settings.use_empty()) { - assert(ht.empty()); - dense_hashtable empty_table(ht); // empty table with ht's thresholds - this->swap(empty_table); - return *this; + public: + void set_deleted_key(const key_type& key) + { + // the empty indicator (if specified) and the deleted indicator + // must be different + assert((!settings.use_empty() || !equals(key, get_key(val_info.emptyval))) && + "Passed the empty-key to set_deleted_key"); + // It's only safe to change what "deleted" means if we purge deleted guys + squash_deleted(); + settings.set_use_deleted(true); + key_info.delkey = key; } - settings = ht.settings; - key_info = ht.key_info; - set_value(&val_info.emptyval, ht.val_info.emptyval); - // copy_from() calls clear and sets num_deleted to 0 too - copy_from(ht, HT_MIN_BUCKETS); - // we purposefully don't copy the allocator, which may not be copyable - return *this; - } - - ~dense_hashtable() { - if (table) { - destroy_buckets(0, num_buckets); - val_info.deallocate(table, num_buckets); + void clear_deleted_key() + { + squash_deleted(); + settings.set_use_deleted(false); } - } - - // Many STL algorithms use swap instead of copy constructors - void swap(dense_hashtable& ht) { - std::swap(settings, ht.settings); - std::swap(key_info, ht.key_info); - std::swap(num_deleted, ht.num_deleted); - std::swap(num_elements, ht.num_elements); - std::swap(num_buckets, ht.num_buckets); - { value_type tmp; // for annoying reasons, swap() doesn't work - set_value(&tmp, val_info.emptyval); - set_value(&val_info.emptyval, ht.val_info.emptyval); - set_value(&ht.val_info.emptyval, tmp); + key_type deleted_key() const + { + assert(settings.use_deleted() && "Must set deleted key before calling deleted_key"); + return key_info.delkey; } - std::swap(table, ht.table); - settings.reset_thresholds(bucket_count()); // also resets consider_shrink - ht.settings.reset_thresholds(ht.bucket_count()); - // we purposefully don't swap the allocator, which may not be swap-able - } - private: - void clear_to_size(size_type new_num_buckets) { - if (!table) { - table = val_info.allocate(new_num_buckets); - } else { - destroy_buckets(0, num_buckets); - if (new_num_buckets != num_buckets) { // resize, if necessary - typedef base::integral_constant >::value> - realloc_ok; - resize_table(num_buckets, new_num_buckets, realloc_ok()); - } + // These are public so the iterators can use them + // True if the item at position bucknum is "deleted" marker + bool test_deleted(size_type bucknum) const + { + // Invariant: !use_deleted() implies num_deleted is 0. + assert(settings.use_deleted() || num_deleted == 0); + return num_deleted > 0 && test_deleted_key(get_key(table[bucknum])); } - assert(table); - fill_range_with_empty(table, table + new_num_buckets); - num_elements = 0; - num_deleted = 0; - num_buckets = new_num_buckets; // our new size - settings.reset_thresholds(bucket_count()); - } - - public: - // It's always nice to be able to clear a table without deallocating it - void clear() { - // If the table is already empty, and the number of buckets is - // already as we desire, there's nothing to do. - const size_type new_num_buckets = settings.min_buckets(0, 0); - if (num_elements == 0 && new_num_buckets == num_buckets) { - return; + bool test_deleted(const iterator& it) const + { + // Invariant: !use_deleted() implies num_deleted is 0. + assert(settings.use_deleted() || num_deleted == 0); + return num_deleted > 0 && test_deleted_key(get_key(*it)); } - clear_to_size(new_num_buckets); - } - - // Clear the table without resizing it. - // Mimicks the stl_hashtable's behaviour when clear()-ing in that it - // does not modify the bucket count - void clear_no_resize() { - if (num_elements > 0) { - assert(table); - destroy_buckets(0, num_buckets); - fill_range_with_empty(table, table + num_buckets); + bool test_deleted(const const_iterator& it) const + { + // Invariant: !use_deleted() implies num_deleted is 0. + assert(settings.use_deleted() || num_deleted == 0); + return num_deleted > 0 && test_deleted_key(get_key(*it)); } - // don't consider to shrink before another erase() - settings.reset_thresholds(bucket_count()); - num_elements = 0; - num_deleted = 0; - } - // LOOKUP ROUTINES - private: - // Returns a pair of positions: 1st where the object is, 2nd where - // it would go if you wanted to insert it. 1st is ILLEGAL_BUCKET - // if object is not found; 2nd is ILLEGAL_BUCKET if it is. - // Note: because of deletions where-to-insert is not trivial: it's the - // first deleted bucket we see, as long as we don't find the key later - std::pair find_position(const key_type &key) const { - size_type num_probes = 0; // how many times we've probed - const size_type bucket_count_minus_one = bucket_count() - 1; - size_type bucknum = hash(key) & bucket_count_minus_one; - size_type insert_pos = ILLEGAL_BUCKET; // where we would insert - while ( 1 ) { // probe until something happens - if ( test_empty(bucknum) ) { // bucket is empty - if ( insert_pos == ILLEGAL_BUCKET ) // found no prior place to insert - return std::pair(ILLEGAL_BUCKET, bucknum); + private: + void check_use_deleted(const char* caller) + { + (void)caller; // could log it if the assert failed + assert(settings.use_deleted()); + } + + // Set it so test_deleted is true. true if object didn't used to be deleted. + bool set_deleted(iterator& it) + { + check_use_deleted("set_deleted()"); + bool retval = !test_deleted(it); + // &* converts from iterator to value-type. + set_key(&(*it), key_info.delkey); + return retval; + } + // Set it so test_deleted is false. true if object used to be deleted. + bool clear_deleted(iterator& it) + { + check_use_deleted("clear_deleted()"); + // Happens automatically when we assign something else in its place. + return test_deleted(it); + } + + // We also allow to set/clear the deleted bit on a const iterator. + // We allow a const_iterator for the same reason you can delete a + // const pointer: it's convenient, and semantically you can't use + // 'it' after it's been deleted anyway, so its const-ness doesn't + // really matter. + bool set_deleted(const_iterator& it) + { + check_use_deleted("set_deleted()"); + bool retval = !test_deleted(it); + set_key(const_cast(&(*it)), key_info.delkey); + return retval; + } + // Set it so test_deleted is false. true if object used to be deleted. + bool clear_deleted(const_iterator& it) + { + check_use_deleted("clear_deleted()"); + return test_deleted(it); + } + + // EMPTY HELPER FUNCTIONS + // This lets the user describe a key that will indicate empty (unused) + // table entries. This key should be an "impossible" entry -- + // if you try to insert it for real, you won't be able to retrieve it! + // (NB: while you pass in an entire value, only the key part is looked + // at. This is just because I don't know how to assign just a key.) + public: + // These are public so the iterators can use them + // True if the item at position bucknum is "empty" marker + bool test_empty(size_type bucknum) const + { + assert(settings.use_empty()); // we always need to know what's empty! + return equals(get_key(val_info.emptyval), get_key(table[bucknum])); + } + bool test_empty(const iterator& it) const + { + assert(settings.use_empty()); // we always need to know what's empty! + return equals(get_key(val_info.emptyval), get_key(*it)); + } + bool test_empty(const const_iterator& it) const + { + assert(settings.use_empty()); // we always need to know what's empty! + return equals(get_key(val_info.emptyval), get_key(*it)); + } + + private: + void fill_range_with_empty(pointer table_start, pointer table_end) + { + std::uninitialized_fill(table_start, table_end, val_info.emptyval); + } + + public: + // TODO(csilvers): change all callers of this to pass in a key instead, + // and take a const key_type instead of const value_type. + void set_empty_key(const_reference val) + { + // Once you set the empty key, you can't change it + assert(!settings.use_empty() && "Calling set_empty_key multiple times"); + // The deleted indicator (if specified) and the empty indicator + // must be different. + assert((!settings.use_deleted() || !equals(get_key(val), key_info.delkey)) && + "Setting the empty key the same as the deleted key"); + settings.set_use_empty(true); + set_value(&val_info.emptyval, val); + + assert(!table); // must set before first use + // num_buckets was set in constructor even though table was NULL + table = val_info.allocate(num_buckets); + assert(table); + fill_range_with_empty(table, table + num_buckets); + } + // TODO(user): return a key_type rather than a value_type + value_type empty_key() const + { + assert(settings.use_empty()); + return val_info.emptyval; + } + + // FUNCTIONS CONCERNING SIZE + public: + size_type size() const { return num_elements - num_deleted; } + size_type max_size() const { return val_info.max_size(); } + bool empty() const { return size() == 0; } + size_type bucket_count() const { return num_buckets; } + size_type max_bucket_count() const { return max_size(); } + size_type nonempty_bucket_count() const { return num_elements; } + // These are tr1 methods. Their idea of 'bucket' doesn't map well to + // what we do. We just say every bucket has 0 or 1 items in it. + size_type bucket_size(size_type i) const { return begin(i) == end(i) ? 0 : 1; } + + private: + // Because of the above, size_type(-1) is never legal; use it for errors + static const size_type ILLEGAL_BUCKET = size_type(-1); + + // Used after a string of deletes. Returns true if we actually shrunk. + // TODO(csilvers): take a delta so we can take into account inserts + // done after shrinking. Maybe make part of the Settings class? + bool maybe_shrink() + { + assert(num_elements >= num_deleted); + assert((bucket_count() & (bucket_count() - 1)) == 0); // is a power of two + assert(bucket_count() >= HT_MIN_BUCKETS); + bool retval = false; + + // If you construct a hashtable with < HT_DEFAULT_STARTING_BUCKETS, + // we'll never shrink until you get relatively big, and we'll never + // shrink below HT_DEFAULT_STARTING_BUCKETS. Otherwise, something + // like "dense_hash_set x; x.insert(4); x.erase(4);" will + // shrink us down to HT_MIN_BUCKETS buckets, which is too small. + const size_type num_remain = num_elements - num_deleted; + const size_type shrink_threshold = settings.shrink_threshold(); + if (shrink_threshold > 0 && num_remain < shrink_threshold && bucket_count() > HT_DEFAULT_STARTING_BUCKETS) + { + const float shrink_factor = settings.shrink_factor(); + size_type sz = bucket_count() / 2; // find how much we should shrink + while (sz > HT_DEFAULT_STARTING_BUCKETS && num_remain < sz * shrink_factor) + { + sz /= 2; // stay a power of 2 + } + dense_hashtable tmp(*this, sz); // Do the actual resizing + swap(tmp); // now we are tmp + retval = true; + } + settings.set_consider_shrink(false); // because we just considered it + return retval; + } + + // We'll let you resize a hashtable -- though this makes us copy all! + // When you resize, you say, "make it big enough for this many more elements" + // Returns true if we actually resized, false if size was already ok. + bool resize_delta(size_type delta) + { + bool did_resize = false; + if (settings.consider_shrink()) + { // see if lots of deletes happened + if (maybe_shrink()) + did_resize = true; + } + if (num_elements >= (std::numeric_limits::max)() - delta) + { + throw std::length_error("resize overflow"); + } + if (bucket_count() >= HT_MIN_BUCKETS && (num_elements + delta) <= settings.enlarge_threshold()) + return did_resize; // we're ok as we are + + // Sometimes, we need to resize just to get rid of all the + // "deleted" buckets that are clogging up the hashtable. So when + // deciding whether to resize, count the deleted buckets (which + // are currently taking up room). But later, when we decide what + // size to resize to, *don't* count deleted buckets, since they + // get discarded during the resize. + const size_type needed_size = settings.min_buckets(num_elements + delta, 0); + if (needed_size <= bucket_count()) // we have enough buckets + return did_resize; + + size_type resize_to = settings.min_buckets(num_elements - num_deleted + delta, bucket_count()); + + if (resize_to < needed_size && // may double resize_to + resize_to < (std::numeric_limits::max)() / 2) + { + // This situation means that we have enough deleted elements, + // that once we purge them, we won't actually have needed to + // grow. But we may want to grow anyway: if we just purge one + // element, say, we'll have to grow anyway next time we + // insert. Might as well grow now, since we're already going + // through the trouble of copying (in order to purge the + // deleted elements). + const size_type target = static_cast(settings.shrink_size(resize_to * 2)); + if (num_elements - num_deleted + delta >= target) + { + // Good, we won't be below the shrink threshhold even if we double. + resize_to *= 2; + } + } + dense_hashtable tmp(*this, resize_to); + swap(tmp); // now we are tmp + return true; + } + + // We require table be not-NULL and empty before calling this. + void resize_table(size_type /*old_size*/, size_type new_size, base::true_type) + { + table = val_info.realloc_or_die(table, new_size); + } + + void resize_table(size_type old_size, size_type new_size, base::false_type) + { + val_info.deallocate(table, old_size); + table = val_info.allocate(new_size); + } + + // Used to actually do the rehashing when we grow/shrink a hashtable + void copy_from(const dense_hashtable& ht, size_type min_buckets_wanted) + { + clear_to_size(settings.min_buckets(ht.size(), min_buckets_wanted)); + + // We use a normal iterator to get non-deleted bcks from ht + // We could use insert() here, but since we know there are + // no duplicates and no deleted items, we can be more efficient + assert((bucket_count() & (bucket_count() - 1)) == 0); // a power of two + for (const_iterator it = ht.begin(); it != ht.end(); ++it) + { + size_type num_probes = 0; // how many times we've probed + size_type bucknum; + const size_type bucket_count_minus_one = bucket_count() - 1; + for (bucknum = hash(get_key(*it)) & bucket_count_minus_one; !test_empty(bucknum); // not empty + bucknum = (bucknum + JUMP_(key, num_probes)) & bucket_count_minus_one) + { + ++num_probes; + assert(num_probes < bucket_count() && "Hashtable is full: an error in key_equal<> or hash<>"); + } + set_value(&table[bucknum], *it); // copies the value to here + num_elements++; + } + settings.inc_num_ht_copies(); + } + + // Required by the spec for hashed associative container + public: + // Though the docs say this should be num_buckets, I think it's much + // more useful as num_elements. As a special feature, calling with + // req_elements==0 will cause us to shrink if we can, saving space. + void resize(size_type req_elements) + { // resize to this or larger + if (settings.consider_shrink() || req_elements == 0) + maybe_shrink(); + if (req_elements > num_elements) + resize_delta(req_elements - num_elements); + } + + // Get and change the value of shrink_factor and enlarge_factor. The + // description at the beginning of this file explains how to choose + // the values. Setting the shrink parameter to 0.0 ensures that the + // table never shrinks. + void get_resizing_parameters(float* shrink, float* grow) const + { + *shrink = settings.shrink_factor(); + *grow = settings.enlarge_factor(); + } + void set_resizing_parameters(float shrink, float grow) + { + settings.set_resizing_parameters(shrink, grow); + settings.reset_thresholds(bucket_count()); + } + + // CONSTRUCTORS -- as required by the specs, we take a size, + // but also let you specify a hashfunction, key comparator, + // and key extractor. We also define a copy constructor and =. + // DESTRUCTOR -- needs to free the table + explicit dense_hashtable(size_type expected_max_items_in_table = 0, + const HashFcn& hf = HashFcn(), + const EqualKey& eql = EqualKey(), + const ExtractKey& ext = ExtractKey(), + const SetKey& set = SetKey(), + const Alloc& alloc = Alloc()) + : settings(hf) + , key_info(ext, set, eql) + , num_deleted(0) + , num_elements(0) + , num_buckets(expected_max_items_in_table == 0 ? HT_DEFAULT_STARTING_BUCKETS + : settings.min_buckets(expected_max_items_in_table, 0)) + , val_info(alloc_impl(alloc)) + , table(NULL) + { + // table is NULL until emptyval is set. However, we set num_buckets + // here so we know how much space to allocate once emptyval is set + settings.reset_thresholds(bucket_count()); + } + + // As a convenience for resize(), we allow an optional second argument + // which lets you make this new hashtable a different size than ht + dense_hashtable(const dense_hashtable& ht, size_type min_buckets_wanted = HT_DEFAULT_STARTING_BUCKETS) + : settings(ht.settings) + , key_info(ht.key_info) + , num_deleted(0) + , num_elements(0) + , num_buckets(0) + , val_info(ht.val_info) + , table(NULL) + { + if (!ht.settings.use_empty()) + { + // If use_empty isn't set, copy_from will crash, so we do our own copying. + assert(ht.empty()); + num_buckets = settings.min_buckets(ht.size(), min_buckets_wanted); + settings.reset_thresholds(bucket_count()); + return; + } + settings.reset_thresholds(bucket_count()); + copy_from(ht, min_buckets_wanted); // copy_from() ignores deleted entries + } + + dense_hashtable& operator=(const dense_hashtable& ht) + { + if (&ht == this) + return *this; // don't copy onto ourselves + if (!ht.settings.use_empty()) + { + assert(ht.empty()); + dense_hashtable empty_table(ht); // empty table with ht's thresholds + this->swap(empty_table); + return *this; + } + settings = ht.settings; + key_info = ht.key_info; + set_value(&val_info.emptyval, ht.val_info.emptyval); + // copy_from() calls clear and sets num_deleted to 0 too + copy_from(ht, HT_MIN_BUCKETS); + // we purposefully don't copy the allocator, which may not be copyable + return *this; + } + + ~dense_hashtable() + { + if (table) + { + destroy_buckets(0, num_buckets); + val_info.deallocate(table, num_buckets); + } + } + + // Many STL algorithms use swap instead of copy constructors + void swap(dense_hashtable& ht) + { + std::swap(settings, ht.settings); + std::swap(key_info, ht.key_info); + std::swap(num_deleted, ht.num_deleted); + std::swap(num_elements, ht.num_elements); + std::swap(num_buckets, ht.num_buckets); + { + value_type tmp; // for annoying reasons, swap() doesn't work + set_value(&tmp, val_info.emptyval); + set_value(&val_info.emptyval, ht.val_info.emptyval); + set_value(&ht.val_info.emptyval, tmp); + } + std::swap(table, ht.table); + settings.reset_thresholds(bucket_count()); // also resets consider_shrink + ht.settings.reset_thresholds(ht.bucket_count()); + // we purposefully don't swap the allocator, which may not be swap-able + } + + private: + void clear_to_size(size_type new_num_buckets) + { + if (!table) + { + table = val_info.allocate(new_num_buckets); + } else - return std::pair(ILLEGAL_BUCKET, insert_pos); - - } else if ( test_deleted(bucknum) ) {// keep searching, but mark to insert - if ( insert_pos == ILLEGAL_BUCKET ) - insert_pos = bucknum; - - } else if ( equals(key, get_key(table[bucknum])) ) { - return std::pair(bucknum, ILLEGAL_BUCKET); - } - ++num_probes; // we're doing another probe - bucknum = (bucknum + JUMP_(key, num_probes)) & bucket_count_minus_one; - assert(num_probes < bucket_count() - && "Hashtable is full: an error in key_equal<> or hash<>"); - } - } - - public: - - iterator find(const key_type& key) { - if ( size() == 0 ) return end(); - std::pair pos = find_position(key); - if ( pos.first == ILLEGAL_BUCKET ) // alas, not there - return end(); - else - return iterator(this, table + pos.first, table + num_buckets, false); - } - - const_iterator find(const key_type& key) const { - if ( size() == 0 ) return end(); - std::pair pos = find_position(key); - if ( pos.first == ILLEGAL_BUCKET ) // alas, not there - return end(); - else - return const_iterator(this, table + pos.first, table+num_buckets, false); - } - - // This is a tr1 method: the bucket a given key is in, or what bucket - // it would be put in, if it were to be inserted. Shrug. - size_type bucket(const key_type& key) const { - std::pair pos = find_position(key); - return pos.first == ILLEGAL_BUCKET ? pos.second : pos.first; - } - - // Counts how many elements have key key. For maps, it's either 0 or 1. - size_type count(const key_type &key) const { - std::pair pos = find_position(key); - return pos.first == ILLEGAL_BUCKET ? 0 : 1; - } - - // Likewise, equal_range doesn't really make sense for us. Oh well. - std::pair equal_range(const key_type& key) { - iterator pos = find(key); // either an iterator or end - if (pos == end()) { - return std::pair(pos, pos); - } else { - const iterator startpos = pos++; - return std::pair(startpos, pos); - } - } - std::pair equal_range(const key_type& key) - const { - const_iterator pos = find(key); // either an iterator or end - if (pos == end()) { - return std::pair(pos, pos); - } else { - const const_iterator startpos = pos++; - return std::pair(startpos, pos); - } - } - - - // INSERTION ROUTINES - private: - // Private method used by insert_noresize and find_or_insert. - iterator insert_at(const_reference obj, size_type pos) { - if (size() >= max_size()) { - throw std::length_error("insert overflow"); - } - if ( test_deleted(pos) ) { // just replace if it's been del. - // shrug: shouldn't need to be const. - const_iterator delpos(this, table + pos, table + num_buckets, false); - clear_deleted(delpos); - assert( num_deleted > 0); - --num_deleted; // used to be, now it isn't - } else { - ++num_elements; // replacing an empty bucket - } - set_value(&table[pos], obj); - return iterator(this, table + pos, table + num_buckets, false); - } - - // If you know *this is big enough to hold obj, use this routine - std::pair insert_noresize(const_reference obj) { - // First, double-check we're not inserting delkey or emptyval - assert((!settings.use_empty() || !equals(get_key(obj), - get_key(val_info.emptyval))) - && "Inserting the empty key"); - assert((!settings.use_deleted() || !equals(get_key(obj), key_info.delkey)) - && "Inserting the deleted key"); - const std::pair pos = find_position(get_key(obj)); - if ( pos.first != ILLEGAL_BUCKET) { // object was already there - return std::pair(iterator(this, table + pos.first, - table + num_buckets, false), - false); // false: we didn't insert - } else { // pos.second says where to put it - return std::pair(insert_at(obj, pos.second), true); - } - } - - // Specializations of insert(it, it) depending on the power of the iterator: - // (1) Iterator supports operator-, resize before inserting - template - void insert(ForwardIterator f, ForwardIterator l, std::forward_iterator_tag) { - size_t dist = std::distance(f, l); - if (dist >= (std::numeric_limits::max)()) { - throw std::length_error("insert-range overflow"); - } - resize_delta(static_cast(dist)); - for ( ; dist > 0; --dist, ++f) { - insert_noresize(*f); - } - } - - // (2) Arbitrary iterator, can't tell how much to resize - template - void insert(InputIterator f, InputIterator l, std::input_iterator_tag) { - for ( ; f != l; ++f) - insert(*f); - } - - public: - // This is the normal insert routine, used by the outside world - std::pair insert(const_reference obj) { - resize_delta(1); // adding an object, grow if need be - return insert_noresize(obj); - } - - // When inserting a lot at a time, we specialize on the type of iterator - template - void insert(InputIterator f, InputIterator l) { - // specializes on iterator type - insert(f, l, - typename std::iterator_traits::iterator_category()); - } - - // DefaultValue is a functor that takes a key and returns a value_type - // representing the default value to be inserted if none is found. - template - value_type& find_or_insert(const key_type& key) { - // First, double-check we're not inserting emptykey or delkey - assert((!settings.use_empty() || !equals(key, get_key(val_info.emptyval))) - && "Inserting the empty key"); - assert((!settings.use_deleted() || !equals(key, key_info.delkey)) - && "Inserting the deleted key"); - const std::pair pos = find_position(key); - DefaultValue default_value; - if ( pos.first != ILLEGAL_BUCKET) { // object was already there - return table[pos.first]; - } else if (resize_delta(1)) { // needed to rehash to make room - // Since we resized, we can't use pos, so recalculate where to insert. - return *insert_noresize(default_value(key)).first; - } else { // no need to rehash, insert right here - return *insert_at(default_value(key), pos.second); - } - } - - - // DELETION ROUTINES - size_type erase(const key_type& key) { - // First, double-check we're not trying to erase delkey or emptyval. - assert((!settings.use_empty() || !equals(key, get_key(val_info.emptyval))) - && "Erasing the empty key"); - assert((!settings.use_deleted() || !equals(key, key_info.delkey)) - && "Erasing the deleted key"); - const_iterator pos = find(key); // shrug: shouldn't need to be const - if ( pos != end() ) { - assert(!test_deleted(pos)); // or find() shouldn't have returned it - set_deleted(pos); - ++num_deleted; - settings.set_consider_shrink(true); // will think about shrink after next insert - return 1; // because we deleted one thing - } else { - return 0; // because we deleted nothing - } - } - - // We return the iterator past the deleted item. - void erase(iterator pos) { - if ( pos == end() ) return; // sanity check - if ( set_deleted(pos) ) { // true if object has been newly deleted - ++num_deleted; - settings.set_consider_shrink(true); // will think about shrink after next insert - } - } - - void erase(iterator f, iterator l) { - for ( ; f != l; ++f) { - if ( set_deleted(f) ) // should always be true - ++num_deleted; - } - settings.set_consider_shrink(true); // will think about shrink after next insert - } - - // We allow you to erase a const_iterator just like we allow you to - // erase an iterator. This is in parallel to 'delete': you can delete - // a const pointer just like a non-const pointer. The logic is that - // you can't use the object after it's erased anyway, so it doesn't matter - // if it's const or not. - void erase(const_iterator pos) { - if ( pos == end() ) return; // sanity check - if ( set_deleted(pos) ) { // true if object has been newly deleted - ++num_deleted; - settings.set_consider_shrink(true); // will think about shrink after next insert - } - } - void erase(const_iterator f, const_iterator l) { - for ( ; f != l; ++f) { - if ( set_deleted(f) ) // should always be true - ++num_deleted; - } - settings.set_consider_shrink(true); // will think about shrink after next insert - } - - - // COMPARISON - bool operator==(const dense_hashtable& ht) const { - if (size() != ht.size()) { - return false; - } else if (this == &ht) { - return true; - } else { - // Iterate through the elements in "this" and see if the - // corresponding element is in ht - for ( const_iterator it = begin(); it != end(); ++it ) { - const_iterator it2 = ht.find(get_key(*it)); - if ((it2 == ht.end()) || (*it != *it2)) { - return false; + { + destroy_buckets(0, num_buckets); + if (new_num_buckets != num_buckets) + { // resize, if necessary + typedef base::integral_constant< + bool, + base::is_same>::value> + realloc_ok; + resize_table(num_buckets, new_num_buckets, realloc_ok()); + } } - } - return true; + assert(table); + fill_range_with_empty(table, table + new_num_buckets); + num_elements = 0; + num_deleted = 0; + num_buckets = new_num_buckets; // our new size + settings.reset_thresholds(bucket_count()); } - } - bool operator!=(const dense_hashtable& ht) const { - return !(*this == ht); - } - - // I/O - // We support reading and writing hashtables to disk. Alas, since - // I don't know how to write a hasher or key_equal, you have to make - // sure everything but the table is the same. We compact before writing. - private: - // Every time the disk format changes, this should probably change too - typedef unsigned long MagicNumberType; - static const MagicNumberType MAGIC_NUMBER = 0x13578642; - - public: - // I/O -- this is an add-on for writing hash table to disk - // - // INPUT and OUTPUT must be either a FILE, *or* a C++ stream - // (istream, ostream, etc) *or* a class providing - // Read(void*, size_t) and Write(const void*, size_t) - // (respectively), which writes a buffer into a stream - // (which the INPUT/OUTPUT instance presumably owns). - - typedef sparsehash_internal::pod_serializer NopointerSerializer; - - // ValueSerializer: a functor. operator()(OUTPUT*, const value_type&) - template - bool serialize(ValueSerializer serializer, OUTPUT *fp) { - squash_deleted(); // so we don't have to worry about delkey - if ( !sparsehash_internal::write_bigendian_number(fp, MAGIC_NUMBER, 4) ) - return false; - if ( !sparsehash_internal::write_bigendian_number(fp, num_buckets, 8) ) - return false; - if ( !sparsehash_internal::write_bigendian_number(fp, num_elements, 8) ) - return false; - // Now write a bitmap of non-empty buckets. - for ( size_type i = 0; i < num_buckets; i += 8 ) { - unsigned char bits = 0; - for ( int bit = 0; bit < 8; ++bit ) { - if ( i + bit < num_buckets && !test_empty(i + bit) ) - bits |= (1 << bit); - } - if ( !sparsehash_internal::write_data(fp, &bits, sizeof(bits)) ) - return false; - for ( int bit = 0; bit < 8; ++bit ) { - if ( bits & (1 << bit) ) { - if ( !serializer(fp, table[i + bit]) ) return false; + public: + // It's always nice to be able to clear a table without deallocating it + void clear() + { + // If the table is already empty, and the number of buckets is + // already as we desire, there's nothing to do. + const size_type new_num_buckets = settings.min_buckets(0, 0); + if (num_elements == 0 && new_num_buckets == num_buckets) + { + return; } - } + clear_to_size(new_num_buckets); } - return true; - } - // INPUT: anything we've written an overload of read_data() for. - // ValueSerializer: a functor. operator()(INPUT*, value_type*) - template - bool unserialize(ValueSerializer serializer, INPUT *fp) { - assert(settings.use_empty() && "empty_key not set for read"); - - clear(); // just to be consistent - MagicNumberType magic_read; - if ( !sparsehash_internal::read_bigendian_number(fp, &magic_read, 4) ) - return false; - if ( magic_read != MAGIC_NUMBER ) { - return false; - } - size_type new_num_buckets; - if ( !sparsehash_internal::read_bigendian_number(fp, &new_num_buckets, 8) ) - return false; - clear_to_size(new_num_buckets); - if ( !sparsehash_internal::read_bigendian_number(fp, &num_elements, 8) ) - return false; - - // Read the bitmap of non-empty buckets. - for (size_type i = 0; i < num_buckets; i += 8) { - unsigned char bits; - if ( !sparsehash_internal::read_data(fp, &bits, sizeof(bits)) ) - return false; - for ( int bit = 0; bit < 8; ++bit ) { - if ( i + bit < num_buckets && (bits & (1 << bit)) ) { // not empty - if ( !serializer(fp, &table[i + bit]) ) return false; + // Clear the table without resizing it. + // Mimicks the stl_hashtable's behaviour when clear()-ing in that it + // does not modify the bucket count + void clear_no_resize() + { + if (num_elements > 0) + { + assert(table); + destroy_buckets(0, num_buckets); + fill_range_with_empty(table, table + num_buckets); } - } - } - return true; - } - - private: - template - class alloc_impl : public A { - public: - typedef typename A::pointer pointer; - typedef typename A::size_type size_type; - - // Convert a normal allocator to one that has realloc_or_die() - alloc_impl(const A& a) : A(a) { } - - // realloc_or_die should only be used when using the default - // allocator (libc_allocator_with_realloc). - pointer realloc_or_die(pointer /*ptr*/, size_type /*n*/) { - fprintf(stderr, "realloc_or_die is only supported for " - "libc_allocator_with_realloc\n"); - //exit(1); - return NULL; - } - }; - - // A template specialization of alloc_impl for - // libc_allocator_with_realloc that can handle realloc_or_die. - template - class alloc_impl > - : public libc_allocator_with_realloc { - public: - typedef typename libc_allocator_with_realloc::pointer pointer; - typedef typename libc_allocator_with_realloc::size_type size_type; - - alloc_impl(const libc_allocator_with_realloc& a) - : libc_allocator_with_realloc(a) { } - - pointer realloc_or_die(pointer ptr, size_type n) { - pointer retval = this->reallocate(ptr, n); - if (retval == NULL) { - fprintf(stderr, "sparsehash: FATAL ERROR: failed to reallocate " - "%lu elements for ptr %p", static_cast(n), ptr); - //exit(1); - } - return retval; - } - }; - - // Package allocator with emptyval to eliminate memory needed for - // the zero-size allocator. - // If new fields are added to this class, we should add them to - // operator= and swap. - class ValInfo : public alloc_impl { - public: - typedef typename alloc_impl::value_type value_type; - - ValInfo(const alloc_impl& a) - : alloc_impl(a), emptyval() { } - ValInfo(const ValInfo& v) - : alloc_impl(v), emptyval(v.emptyval) { } - - value_type emptyval; // which key marks unused entries - }; - - - // Package functors with another class to eliminate memory needed for - // zero-size functors. Since ExtractKey and hasher's operator() might - // have the same function signature, they must be packaged in - // different classes. - struct Settings : - sparsehash_internal::sh_hashtable_settings { - explicit Settings(const hasher& hf) - : sparsehash_internal::sh_hashtable_settings( - hf, HT_OCCUPANCY_PCT / 100.0f, HT_EMPTY_PCT / 100.0f) {} - }; - - // Packages ExtractKey and SetKey functors. - class KeyInfo : public ExtractKey, public SetKey, public EqualKey { - public: - KeyInfo(const ExtractKey& ek, const SetKey& sk, const EqualKey& eq) - : ExtractKey(ek), - SetKey(sk), - EqualKey(eq) { + // don't consider to shrink before another erase() + settings.reset_thresholds(bucket_count()); + num_elements = 0; + num_deleted = 0; } - // We want to return the exact same type as ExtractKey: Key or const Key& - typename ExtractKey::result_type get_key(const_reference v) const { - return ExtractKey::operator()(v); - } - void set_key(pointer v, const key_type& k) const { - SetKey::operator()(v, k); - } - bool equals(const key_type& a, const key_type& b) const { - return EqualKey::operator()(a, b); + // LOOKUP ROUTINES + private: + // Returns a pair of positions: 1st where the object is, 2nd where + // it would go if you wanted to insert it. 1st is ILLEGAL_BUCKET + // if object is not found; 2nd is ILLEGAL_BUCKET if it is. + // Note: because of deletions where-to-insert is not trivial: it's the + // first deleted bucket we see, as long as we don't find the key later + std::pair find_position(const key_type& key) const + { + size_type num_probes = 0; // how many times we've probed + const size_type bucket_count_minus_one = bucket_count() - 1; + size_type bucknum = hash(key) & bucket_count_minus_one; + size_type insert_pos = ILLEGAL_BUCKET; // where we would insert + while (1) + { // probe until something happens + if (test_empty(bucknum)) + { // bucket is empty + if (insert_pos == ILLEGAL_BUCKET) // found no prior place to insert + return std::pair(ILLEGAL_BUCKET, bucknum); + else + return std::pair(ILLEGAL_BUCKET, insert_pos); + } + else if (test_deleted(bucknum)) + { // keep searching, but mark to insert + if (insert_pos == ILLEGAL_BUCKET) + insert_pos = bucknum; + } + else if (equals(key, get_key(table[bucknum]))) + { + return std::pair(bucknum, ILLEGAL_BUCKET); + } + ++num_probes; // we're doing another probe + bucknum = (bucknum + JUMP_(key, num_probes)) & bucket_count_minus_one; + assert(num_probes < bucket_count() && "Hashtable is full: an error in key_equal<> or hash<>"); + } } - // Which key marks deleted entries. - // TODO(csilvers): make a pointer, and get rid of use_deleted (benchmark!) - typename base::remove_const::type delkey; - }; + public: - // Utility functions to access the templated operators - size_type hash(const key_type& v) const { - return settings.hash(v); - } - bool equals(const key_type& a, const key_type& b) const { - return key_info.equals(a, b); - } - typename ExtractKey::result_type get_key(const_reference v) const { - return key_info.get_key(v); - } - void set_key(pointer v, const key_type& k) const { - key_info.set_key(v, k); - } + iterator find(const key_type& key) + { + if (size() == 0) + return end(); + std::pair pos = find_position(key); + if (pos.first == ILLEGAL_BUCKET) // alas, not there + return end(); + else + return iterator(this, table + pos.first, table + num_buckets, false); + } - private: - // Actual data - Settings settings; - KeyInfo key_info; + const_iterator find(const key_type& key) const + { + if (size() == 0) + return end(); + std::pair pos = find_position(key); + if (pos.first == ILLEGAL_BUCKET) // alas, not there + return end(); + else + return const_iterator(this, table + pos.first, table + num_buckets, false); + } - size_type num_deleted; // how many occupied buckets are marked deleted - size_type num_elements; - size_type num_buckets; - ValInfo val_info; // holds emptyval, and also the allocator - pointer table; + // This is a tr1 method: the bucket a given key is in, or what bucket + // it would be put in, if it were to be inserted. Shrug. + size_type bucket(const key_type& key) const + { + std::pair pos = find_position(key); + return pos.first == ILLEGAL_BUCKET ? pos.second : pos.first; + } + + // Counts how many elements have key key. For maps, it's either 0 or 1. + size_type count(const key_type& key) const + { + std::pair pos = find_position(key); + return pos.first == ILLEGAL_BUCKET ? 0 : 1; + } + + // Likewise, equal_range doesn't really make sense for us. Oh well. + std::pair equal_range(const key_type& key) + { + iterator pos = find(key); // either an iterator or end + if (pos == end()) + { + return std::pair(pos, pos); + } + else + { + const iterator startpos = pos++; + return std::pair(startpos, pos); + } + } + std::pair equal_range(const key_type& key) const + { + const_iterator pos = find(key); // either an iterator or end + if (pos == end()) + { + return std::pair(pos, pos); + } + else + { + const const_iterator startpos = pos++; + return std::pair(startpos, pos); + } + } + + // INSERTION ROUTINES + private: + // Private method used by insert_noresize and find_or_insert. + iterator insert_at(const_reference obj, size_type pos) + { + if (size() >= max_size()) + { + throw std::length_error("insert overflow"); + } + if (test_deleted(pos)) + { // just replace if it's been del. + // shrug: shouldn't need to be const. + const_iterator delpos(this, table + pos, table + num_buckets, false); + clear_deleted(delpos); + assert(num_deleted > 0); + --num_deleted; // used to be, now it isn't + } + else + { + ++num_elements; // replacing an empty bucket + } + set_value(&table[pos], obj); + return iterator(this, table + pos, table + num_buckets, false); + } + + // If you know *this is big enough to hold obj, use this routine + std::pair insert_noresize(const_reference obj) + { + // First, double-check we're not inserting delkey or emptyval + assert((!settings.use_empty() || !equals(get_key(obj), get_key(val_info.emptyval))) && + "Inserting the empty key"); + assert((!settings.use_deleted() || !equals(get_key(obj), key_info.delkey)) && "Inserting the deleted key"); + const std::pair pos = find_position(get_key(obj)); + if (pos.first != ILLEGAL_BUCKET) + { // object was already there + return std::pair(iterator(this, table + pos.first, table + num_buckets, false), + false); // false: we didn't insert + } + else + { // pos.second says where to put it + return std::pair(insert_at(obj, pos.second), true); + } + } + + // Specializations of insert(it, it) depending on the power of the iterator: + // (1) Iterator supports operator-, resize before inserting + template + void insert(ForwardIterator f, ForwardIterator l, std::forward_iterator_tag) + { + size_t dist = std::distance(f, l); + if (dist >= (std::numeric_limits::max)()) + { + throw std::length_error("insert-range overflow"); + } + resize_delta(static_cast(dist)); + for (; dist > 0; --dist, ++f) + { + insert_noresize(*f); + } + } + + // (2) Arbitrary iterator, can't tell how much to resize + template + void insert(InputIterator f, InputIterator l, std::input_iterator_tag) + { + for (; f != l; ++f) + insert(*f); + } + + public: + // This is the normal insert routine, used by the outside world + std::pair insert(const_reference obj) + { + resize_delta(1); // adding an object, grow if need be + return insert_noresize(obj); + } + + // When inserting a lot at a time, we specialize on the type of iterator + template + void insert(InputIterator f, InputIterator l) + { + // specializes on iterator type + insert(f, l, typename std::iterator_traits::iterator_category()); + } + + // DefaultValue is a functor that takes a key and returns a value_type + // representing the default value to be inserted if none is found. + template + value_type& find_or_insert(const key_type& key) + { + // First, double-check we're not inserting emptykey or delkey + assert((!settings.use_empty() || !equals(key, get_key(val_info.emptyval))) && "Inserting the empty key"); + assert((!settings.use_deleted() || !equals(key, key_info.delkey)) && "Inserting the deleted key"); + const std::pair pos = find_position(key); + DefaultValue default_value; + if (pos.first != ILLEGAL_BUCKET) + { // object was already there + return table[pos.first]; + } + else if (resize_delta(1)) + { // needed to rehash to make room + // Since we resized, we can't use pos, so recalculate where to insert. + return *insert_noresize(default_value(key)).first; + } + else + { // no need to rehash, insert right here + return *insert_at(default_value(key), pos.second); + } + } + + // DELETION ROUTINES + size_type erase(const key_type& key) + { + // First, double-check we're not trying to erase delkey or emptyval. + assert((!settings.use_empty() || !equals(key, get_key(val_info.emptyval))) && "Erasing the empty key"); + assert((!settings.use_deleted() || !equals(key, key_info.delkey)) && "Erasing the deleted key"); + const_iterator pos = find(key); // shrug: shouldn't need to be const + if (pos != end()) + { + assert(!test_deleted(pos)); // or find() shouldn't have returned it + set_deleted(pos); + ++num_deleted; + settings.set_consider_shrink(true); // will think about shrink after next insert + return 1; // because we deleted one thing + } + else + { + return 0; // because we deleted nothing + } + } + + // We return the iterator past the deleted item. + void erase(iterator pos) + { + if (pos == end()) + return; // sanity check + if (set_deleted(pos)) + { // true if object has been newly deleted + ++num_deleted; + settings.set_consider_shrink(true); // will think about shrink after next insert + } + } + + void erase(iterator f, iterator l) + { + for (; f != l; ++f) + { + if (set_deleted(f)) // should always be true + ++num_deleted; + } + settings.set_consider_shrink(true); // will think about shrink after next insert + } + + // We allow you to erase a const_iterator just like we allow you to + // erase an iterator. This is in parallel to 'delete': you can delete + // a const pointer just like a non-const pointer. The logic is that + // you can't use the object after it's erased anyway, so it doesn't matter + // if it's const or not. + void erase(const_iterator pos) + { + if (pos == end()) + return; // sanity check + if (set_deleted(pos)) + { // true if object has been newly deleted + ++num_deleted; + settings.set_consider_shrink(true); // will think about shrink after next insert + } + } + void erase(const_iterator f, const_iterator l) + { + for (; f != l; ++f) + { + if (set_deleted(f)) // should always be true + ++num_deleted; + } + settings.set_consider_shrink(true); // will think about shrink after next insert + } + + // COMPARISON + bool operator==(const dense_hashtable& ht) const + { + if (size() != ht.size()) + { + return false; + } + else if (this == &ht) + { + return true; + } + else + { + // Iterate through the elements in "this" and see if the + // corresponding element is in ht + for (const_iterator it = begin(); it != end(); ++it) + { + const_iterator it2 = ht.find(get_key(*it)); + if ((it2 == ht.end()) || (*it != *it2)) + { + return false; + } + } + return true; + } + } + bool operator!=(const dense_hashtable& ht) const { return !(*this == ht); } + + // I/O + // We support reading and writing hashtables to disk. Alas, since + // I don't know how to write a hasher or key_equal, you have to make + // sure everything but the table is the same. We compact before writing. + private: + // Every time the disk format changes, this should probably change too + typedef unsigned long MagicNumberType; + static const MagicNumberType MAGIC_NUMBER = 0x13578642; + + public: + // I/O -- this is an add-on for writing hash table to disk + // + // INPUT and OUTPUT must be either a FILE, *or* a C++ stream + // (istream, ostream, etc) *or* a class providing + // Read(void*, size_t) and Write(const void*, size_t) + // (respectively), which writes a buffer into a stream + // (which the INPUT/OUTPUT instance presumably owns). + + typedef sparsehash_internal::pod_serializer NopointerSerializer; + + // ValueSerializer: a functor. operator()(OUTPUT*, const value_type&) + template + bool serialize(ValueSerializer serializer, OUTPUT* fp) + { + squash_deleted(); // so we don't have to worry about delkey + if (!sparsehash_internal::write_bigendian_number(fp, MAGIC_NUMBER, 4)) + return false; + if (!sparsehash_internal::write_bigendian_number(fp, num_buckets, 8)) + return false; + if (!sparsehash_internal::write_bigendian_number(fp, num_elements, 8)) + return false; + // Now write a bitmap of non-empty buckets. + for (size_type i = 0; i < num_buckets; i += 8) + { + unsigned char bits = 0; + for (int bit = 0; bit < 8; ++bit) + { + if (i + bit < num_buckets && !test_empty(i + bit)) + bits |= (1 << bit); + } + if (!sparsehash_internal::write_data(fp, &bits, sizeof(bits))) + return false; + for (int bit = 0; bit < 8; ++bit) + { + if (bits & (1 << bit)) + { + if (!serializer(fp, table[i + bit])) + return false; + } + } + } + return true; + } + + // INPUT: anything we've written an overload of read_data() for. + // ValueSerializer: a functor. operator()(INPUT*, value_type*) + template + bool unserialize(ValueSerializer serializer, INPUT* fp) + { + assert(settings.use_empty() && "empty_key not set for read"); + + clear(); // just to be consistent + MagicNumberType magic_read; + if (!sparsehash_internal::read_bigendian_number(fp, &magic_read, 4)) + return false; + if (magic_read != MAGIC_NUMBER) + { + return false; + } + size_type new_num_buckets; + if (!sparsehash_internal::read_bigendian_number(fp, &new_num_buckets, 8)) + return false; + clear_to_size(new_num_buckets); + if (!sparsehash_internal::read_bigendian_number(fp, &num_elements, 8)) + return false; + + // Read the bitmap of non-empty buckets. + for (size_type i = 0; i < num_buckets; i += 8) + { + unsigned char bits; + if (!sparsehash_internal::read_data(fp, &bits, sizeof(bits))) + return false; + for (int bit = 0; bit < 8; ++bit) + { + if (i + bit < num_buckets && (bits & (1 << bit))) + { // not empty + if (!serializer(fp, &table[i + bit])) + return false; + } + } + } + return true; + } + + private: + template + class alloc_impl : public A + { + public: + typedef typename A::pointer pointer; + typedef typename A::size_type size_type; + + // Convert a normal allocator to one that has realloc_or_die() + alloc_impl(const A& a) + : A(a) + {} + + // realloc_or_die should only be used when using the default + // allocator (libc_allocator_with_realloc). + pointer realloc_or_die(pointer /*ptr*/, size_type /*n*/) + { + fprintf(stderr, + "realloc_or_die is only supported for " + "libc_allocator_with_realloc\n"); + // exit(1); + return NULL; + } + }; + + // A template specialization of alloc_impl for + // libc_allocator_with_realloc that can handle realloc_or_die. + template + class alloc_impl> : public libc_allocator_with_realloc + { + public: + typedef typename libc_allocator_with_realloc::pointer pointer; + typedef typename libc_allocator_with_realloc::size_type size_type; + + alloc_impl(const libc_allocator_with_realloc& a) + : libc_allocator_with_realloc(a) + {} + + pointer realloc_or_die(pointer ptr, size_type n) + { + pointer retval = this->reallocate(ptr, n); + if (retval == NULL) + { + fprintf(stderr, + "sparsehash: FATAL ERROR: failed to reallocate " + "%lu elements for ptr %p", + static_cast(n), + ptr); + // exit(1); + } + return retval; + } + }; + + // Package allocator with emptyval to eliminate memory needed for + // the zero-size allocator. + // If new fields are added to this class, we should add them to + // operator= and swap. + class ValInfo : public alloc_impl + { + public: + typedef typename alloc_impl::value_type value_type; + + ValInfo(const alloc_impl& a) + : alloc_impl(a) + , emptyval() + {} + ValInfo(const ValInfo& v) + : alloc_impl(v) + , emptyval(v.emptyval) + {} + + value_type emptyval; // which key marks unused entries + }; + + // Package functors with another class to eliminate memory needed for + // zero-size functors. Since ExtractKey and hasher's operator() might + // have the same function signature, they must be packaged in + // different classes. + struct Settings : sparsehash_internal::sh_hashtable_settings + { + explicit Settings(const hasher& hf) + : sparsehash_internal::sh_hashtable_settings( + hf, + HT_OCCUPANCY_PCT / 100.0f, + HT_EMPTY_PCT / 100.0f) + {} + }; + + // Packages ExtractKey and SetKey functors. + class KeyInfo : public ExtractKey, + public SetKey, + public EqualKey + { + public: + KeyInfo(const ExtractKey& ek, const SetKey& sk, const EqualKey& eq) + : ExtractKey(ek) + , SetKey(sk) + , EqualKey(eq) + {} + + // We want to return the exact same type as ExtractKey: Key or const Key& + typename ExtractKey::result_type get_key(const_reference v) const { return ExtractKey::operator()(v); } + void set_key(pointer v, const key_type& k) const { SetKey::operator()(v, k); } + bool equals(const key_type& a, const key_type& b) const { return EqualKey::operator()(a, b); } + + // Which key marks deleted entries. + // TODO(csilvers): make a pointer, and get rid of use_deleted (benchmark!) + typename base::remove_const::type delkey; + }; + + // Utility functions to access the templated operators + size_type hash(const key_type& v) const { return settings.hash(v); } + bool equals(const key_type& a, const key_type& b) const { return key_info.equals(a, b); } + typename ExtractKey::result_type get_key(const_reference v) const { return key_info.get_key(v); } + void set_key(pointer v, const key_type& k) const { key_info.set_key(v, k); } + + private: + // Actual data + Settings settings; + KeyInfo key_info; + + size_type num_deleted; // how many occupied buckets are marked deleted + size_type num_elements; + size_type num_buckets; + ValInfo val_info; // holds emptyval, and also the allocator + pointer table; }; - // We need a global swap as well -template -inline void swap(dense_hashtable &x, - dense_hashtable &y) { - x.swap(y); +template +inline void swap(dense_hashtable& x, dense_hashtable& y) +{ + x.swap(y); } #undef JUMP_ -template -const typename dense_hashtable::size_type - dense_hashtable::ILLEGAL_BUCKET; +template +const typename dense_hashtable::size_type + dense_hashtable::ILLEGAL_BUCKET; // How full we let the table get before we resize. Knuth says .8 is // good -- higher causes us to probe too much, though saves memory. @@ -1304,15 +1435,14 @@ const typename dense_hashtable::size_type // more space (a trade-off densehashtable explicitly chooses to make). // Feel free to play around with different values, though, via // max_load_factor() and/or set_resizing_parameters(). -template -const int dense_hashtable::HT_OCCUPANCY_PCT = 50; +template +const int dense_hashtable::HT_OCCUPANCY_PCT = 50; // How empty we let the table get before we resize lower. // It should be less than OCCUPANCY_PCT / 2 or we thrash resizing. -template -const int dense_hashtable::HT_EMPTY_PCT - = static_cast(0.4 * - dense_hashtable::HT_OCCUPANCY_PCT); +template +const int dense_hashtable::HT_EMPTY_PCT = + static_cast(0.4 * dense_hashtable::HT_OCCUPANCY_PCT); _END_GOOGLE_NAMESPACE_ diff --git a/deps/mapnik/sparsehash/internal/hashtable-common.h b/deps/mapnik/sparsehash/internal/hashtable-common.h index fa403e6aa..73d7c14eb 100644 --- a/deps/mapnik/sparsehash/internal/hashtable-common.h +++ b/deps/mapnik/sparsehash/internal/hashtable-common.h @@ -43,9 +43,9 @@ #include #include #include -#include // for size_t +#include // for size_t #include -#include // For length_error +#include // For length_error _START_GOOGLE_NAMESPACE_ @@ -80,15 +80,15 @@ namespace sparsehash_internal { // ----- low-level I/O for FILE* ---- template -inline bool read_data_internal(Ignored*, FILE* fp, - void* data, size_t length) { - return fread(data, length, 1, fp) == 1; +inline bool read_data_internal(Ignored*, FILE* fp, void* data, size_t length) +{ + return fread(data, length, 1, fp) == 1; } template -inline bool write_data_internal(Ignored*, FILE* fp, - const void* data, size_t length) { - return fwrite(data, length, 1, fp) == 1; +inline bool write_data_internal(Ignored*, FILE* fp, const void* data, size_t length) +{ + return fwrite(data, length, 1, fp) == 1; } // ----- 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 // the istream/ostream is a template type. So we jump through hoops. template -inline bool read_data_internal_for_istream(ISTREAM* fp, - void* data, size_t length) { - return fp->read(reinterpret_cast(data), length).good(); +inline bool read_data_internal_for_istream(ISTREAM* fp, void* data, size_t length) +{ + return fp->read(reinterpret_cast(data), length).good(); } template -inline bool read_data_internal(Ignored*, std::istream* fp, - void* data, size_t length) { - return read_data_internal_for_istream(fp, data, length); +inline bool read_data_internal(Ignored*, std::istream* fp, void* data, size_t length) +{ + return read_data_internal_for_istream(fp, data, length); } template -inline bool write_data_internal_for_ostream(OSTREAM* fp, - const void* data, size_t length) { - return fp->write(reinterpret_cast(data), length).good(); +inline bool write_data_internal_for_ostream(OSTREAM* fp, const void* data, size_t length) +{ + return fp->write(reinterpret_cast(data), length).good(); } template -inline bool write_data_internal(Ignored*, std::ostream* fp, - const void* data, size_t length) { - return write_data_internal_for_ostream(fp, data, length); +inline bool write_data_internal(Ignored*, std::ostream* fp, const void* data, size_t length) +{ + return write_data_internal_for_ostream(fp, data, length); } // ----- low-level I/O for custom streams ---- // The INPUT type needs to support a Read() method that takes a // buffer and a length and returns the number of bytes read. -template -inline bool read_data_internal(INPUT* fp, void*, - void* data, size_t length) { - return static_cast(fp->Read(data, length)) == length; +template +inline bool read_data_internal(INPUT* fp, void*, void* data, size_t length) +{ + return static_cast(fp->Read(data, length)) == length; } // The OUTPUT type needs to support a Write() operation that takes // a buffer and a length and returns the number of bytes written. -template -inline bool write_data_internal(OUTPUT* fp, void*, - const void* data, size_t length) { - return static_cast(fp->Write(data, length)) == length; +template +inline bool write_data_internal(OUTPUT* fp, void*, const void* data, size_t length) +{ + return static_cast(fp->Write(data, length)) == length; } // ----- low-level I/O: the public API ---- -template -inline bool read_data(INPUT* fp, void* data, size_t length) { - return read_data_internal(fp, fp, data, length); +template +inline bool read_data(INPUT* fp, void* data, size_t length) +{ + return read_data_internal(fp, fp, data, length); } -template -inline bool write_data(OUTPUT* fp, const void* data, size_t length) { - return write_data_internal(fp, fp, data, length); +template +inline bool write_data(OUTPUT* fp, const void* data, size_t length) +{ + return write_data_internal(fp, fp, data, length); } // 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 // 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). -template -bool read_bigendian_number(INPUT* fp, IntType* value, size_t length) { - *value = 0; - unsigned char byte; - for (size_t i = 0; i < length; ++i) { - if (!read_data(fp, &byte, sizeof(byte))) return false; - *value |= static_cast(byte) << ((length - 1 - i) * 8); - } - return true; +template +bool read_bigendian_number(INPUT* fp, IntType* value, size_t length) +{ + *value = 0; + unsigned char byte; + for (size_t i = 0; i < length; ++i) + { + if (!read_data(fp, &byte, sizeof(byte))) + return false; + *value |= static_cast(byte) << ((length - 1 - i) * 8); + } + return true; } -template -bool write_bigendian_number(OUTPUT* fp, IntType value, size_t length) { - unsigned char byte; - for (size_t i = 0; i < length; ++i) { - byte = (sizeof(value) <= length-1 - i) - ? 0 : static_cast((value >> ((length-1 - i) * 8)) & 255); - if (!write_data(fp, &byte, sizeof(byte))) return false; - } - return true; +template +bool write_bigendian_number(OUTPUT* fp, IntType value, size_t length) +{ + unsigned char byte; + for (size_t i = 0; i < length; ++i) + { + byte = + (sizeof(value) <= length - 1 - i) ? 0 : static_cast((value >> ((length - 1 - i) * 8)) & 255); + if (!write_data(fp, &byte, sizeof(byte))) + return false; + } + return true; } // 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, // however, we don't try to normalize endianness. // This is the type used for NopointerSerializer. -template struct pod_serializer { - template - bool operator()(INPUT* fp, value_type* value) const { - return read_data(fp, value, sizeof(*value)); - } +template +struct pod_serializer +{ + template + bool operator()(INPUT* fp, value_type* value) const + { + return read_data(fp, value, sizeof(*value)); + } - template - bool operator()(OUTPUT* fp, const value_type& value) const { - return write_data(fp, &value, sizeof(value)); - } + template + bool operator()(OUTPUT* fp, const value_type& value) const + { + return write_data(fp, &value, sizeof(value)); + } }; - // Settings contains parameters for growing and shrinking the table. // It also packages zero-size functor (ie. hasher). // @@ -206,165 +217,136 @@ template struct pod_serializer { // for sure that the hash is the identity hash. If it's not, this // is needless work (and possibly, though not likely, harmful). -template -class sh_hashtable_settings : public HashFunc { - public: - typedef Key key_type; - typedef HashFunc hasher; - typedef SizeType size_type; +template +class sh_hashtable_settings : public HashFunc +{ + public: + typedef Key key_type; + typedef HashFunc hasher; + typedef SizeType size_type; - public: - sh_hashtable_settings(const hasher& hf, - const float ht_occupancy_flt, - const float ht_empty_flt) - : hasher(hf), - enlarge_threshold_(0), - shrink_threshold_(0), - consider_shrink_(false), - use_empty_(false), - use_deleted_(false), - num_ht_copies_(0) { - set_enlarge_factor(ht_occupancy_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::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(x * enlarge_factor_); - } - size_type shrink_size(size_type x) const { - return static_cast(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(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(sz * enlarge) ) { - // This just prevents overflowing size_type, since sz can exceed - // max_size() here. - if (static_cast(sz * 2) < sz) { - throw std::length_error("resize overflow"); // protect against overflow - } - sz *= 2; + public: + sh_hashtable_settings(const hasher& hf, const float ht_occupancy_flt, const float ht_empty_flt) + : hasher(hf) + , enlarge_threshold_(0) + , shrink_threshold_(0) + , consider_shrink_(false) + , use_empty_(false) + , use_deleted_(false) + , num_ht_copies_(0) + { + set_enlarge_factor(ht_occupancy_flt); + set_shrink_factor(ht_empty_flt); } - return sz; - } - private: - template class hash_munger { - public: - static size_t MungedHash(size_t hash) { - return hash; + size_type hash(const key_type& v) const + { + // We munge the hash value when we don't trust hasher::operator(). + return hash_munger::MungedHash(hasher::operator()(v)); } - }; - // This matches when the hashtable key is a pointer. - template class hash_munger { - 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_; + 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(x * enlarge_factor_); } + size_type shrink_size(size_type x) const { return static_cast(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(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(sz * enlarge)) + { + // This just prevents overflowing size_type, since sz can exceed + // max_size() here. + if (static_cast(sz * 2) < sz) + { + throw std::length_error("resize overflow"); // protect against overflow + } + sz *= 2; + } + return sz; + } + + private: + template + class hash_munger + { + public: + static size_t MungedHash(size_t hash) { return hash; } + }; + // This matches when the hashtable key is a pointer. + template + class hash_munger + { + 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_ -#endif // UTIL_GTL_HASHTABLE_COMMON_H_ +#endif // UTIL_GTL_HASHTABLE_COMMON_H_ diff --git a/deps/mapnik/sparsehash/internal/libc_allocator_with_realloc.h b/deps/mapnik/sparsehash/internal/libc_allocator_with_realloc.h index 3689701b9..dcf095dae 100644 --- a/deps/mapnik/sparsehash/internal/libc_allocator_with_realloc.h +++ b/deps/mapnik/sparsehash/internal/libc_allocator_with_realloc.h @@ -33,87 +33,82 @@ #define UTIL_GTL_LIBC_ALLOCATOR_WITH_REALLOC_H_ #include -#include // for malloc/realloc/free -#include // for ptrdiff_t -#include // for placement new +#include // for malloc/realloc/free +#include // for ptrdiff_t +#include // for placement new _START_GOOGLE_NAMESPACE_ template -class libc_allocator_with_realloc { - public: - typedef T value_type; - typedef size_t size_type; - typedef ptrdiff_t difference_type; +class libc_allocator_with_realloc +{ + public: + typedef T value_type; + typedef size_t size_type; + typedef ptrdiff_t difference_type; - typedef T* pointer; - typedef const T* const_pointer; - typedef T& reference; - typedef const T& const_reference; + typedef T* pointer; + typedef const T* const_pointer; + typedef T& reference; + typedef const T& const_reference; - libc_allocator_with_realloc() {} - libc_allocator_with_realloc(const libc_allocator_with_realloc&) {} - ~libc_allocator_with_realloc() {} + libc_allocator_with_realloc() {} + libc_allocator_with_realloc(const libc_allocator_with_realloc&) {} + ~libc_allocator_with_realloc() {} - pointer address(reference r) const { return &r; } - const_pointer address(const_reference r) const { return &r; } + pointer address(reference r) const { return &r; } + const_pointer address(const_reference r) const { return &r; } - pointer allocate(size_type n, const_pointer = 0) { - return static_cast(malloc(n * sizeof(value_type))); - } - void deallocate(pointer p, size_type) { - free(p); - } - pointer reallocate(pointer p, size_type n) { - return static_cast(realloc(p, n * sizeof(value_type))); - } + pointer allocate(size_type n, const_pointer = 0) { return static_cast(malloc(n * sizeof(value_type))); } + void deallocate(pointer p, size_type) { free(p); } + pointer reallocate(pointer p, size_type n) { return static_cast(realloc(p, n * sizeof(value_type))); } - size_type max_size() const { - return static_cast(-1) / sizeof(value_type); - } + size_type max_size() const { return static_cast(-1) / sizeof(value_type); } - void construct(pointer p, const value_type& val) { - new(p) value_type(val); - } - void destroy(pointer p) { p->~value_type(); } + void construct(pointer p, const value_type& val) { new (p) value_type(val); } + void destroy(pointer p) { p->~value_type(); } - template - libc_allocator_with_realloc(const libc_allocator_with_realloc&) {} + template + libc_allocator_with_realloc(const libc_allocator_with_realloc&) + {} - template - struct rebind { - typedef libc_allocator_with_realloc other; - }; + template + struct rebind + { + typedef libc_allocator_with_realloc other; + }; }; // libc_allocator_with_realloc specialization. template<> -class libc_allocator_with_realloc { - public: - typedef void value_type; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef void* pointer; - typedef const void* const_pointer; +class libc_allocator_with_realloc +{ + public: + typedef void value_type; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef void* pointer; + typedef const void* const_pointer; - template - struct rebind { - typedef libc_allocator_with_realloc other; - }; + template + struct rebind + { + typedef libc_allocator_with_realloc other; + }; }; template -inline bool operator==(const libc_allocator_with_realloc&, - const libc_allocator_with_realloc&) { - return true; +inline bool operator==(const libc_allocator_with_realloc&, const libc_allocator_with_realloc&) +{ + return true; } template -inline bool operator!=(const libc_allocator_with_realloc&, - const libc_allocator_with_realloc&) { - return false; +inline bool operator!=(const libc_allocator_with_realloc&, const libc_allocator_with_realloc&) +{ + return false; } _END_GOOGLE_NAMESPACE_ -#endif // UTIL_GTL_LIBC_ALLOCATOR_WITH_REALLOC_H_ +#endif // UTIL_GTL_LIBC_ALLOCATOR_WITH_REALLOC_H_ diff --git a/deps/mapnik/sparsehash/template_util.h b/deps/mapnik/sparsehash/template_util.h index d6f7fa64e..35b4c798e 100644 --- a/deps/mapnik/sparsehash/template_util.h +++ b/deps/mapnik/sparsehash/template_util.h @@ -56,14 +56,16 @@ _START_GOOGLE_NAMESPACE_ // sizeof(big_) typedef char small_; -struct big_ { - char dummy[2]; +struct big_ +{ + char dummy[2]; }; // Identity metafunction. -template -struct identity_ { - typedef T type; +template +struct identity_ +{ + typedef T type; }; // integral_constant, defined in tr1, is a wrapper for an integer @@ -72,63 +74,64 @@ struct identity_ { // general integer_constant for compatibility with tr1. template -struct integral_constant { - static const T value = v; - typedef T value_type; - typedef integral_constant type; +struct integral_constant +{ + static const T value = v; + typedef T value_type; + typedef integral_constant type; }; -template const T integral_constant::value; - +template +const T integral_constant::value; // 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_. -typedef integral_constant true_type; +typedef integral_constant true_type; typedef integral_constant false_type; -typedef true_type true_; +typedef true_type true_; typedef false_type false_; // if_ is a templatized conditional statement. // if_ is a compile time evaluation of cond. // if_<>::type contains A if cond is true, B otherwise. template -struct if_{ - typedef A type; +struct if_ +{ + typedef A type; }; template -struct if_ { - typedef B type; +struct if_ +{ + typedef B type; }; - // type_equals_ is a template type comparator, similar to Loki IsSameType. // type_equals_::value is true iff "A" is the same type as "B". // // New code should prefer base::is_same, defined in base/type_traits.h. // It is functionally identical, but is_same is the standard spelling. template -struct type_equals_ : public false_ { -}; +struct type_equals_ : public false_ +{}; template -struct type_equals_ : public true_ { -}; +struct type_equals_ : public true_ +{}; // and_ is a template && operator. // and_::value evaluates "A::value && B::value". template -struct and_ : public integral_constant { -}; +struct and_ : public integral_constant +{}; // or_ is a template || operator. // or_::value evaluates "A::value || B::value". template -struct or_ : public integral_constant { -}; - +struct or_ : public integral_constant +{}; _END_GOOGLE_NAMESPACE_ -#endif // BASE_TEMPLATE_UTIL_H_ +#endif // BASE_TEMPLATE_UTIL_H_ diff --git a/deps/mapnik/sparsehash/type_traits.h b/deps/mapnik/sparsehash/type_traits.h index c11904c82..d93004219 100644 --- a/deps/mapnik/sparsehash/type_traits.h +++ b/deps/mapnik/sparsehash/type_traits.h @@ -58,106 +58,188 @@ #define BASE_TYPE_TRAITS_H_ #include -#include // For pair +#include // For pair -#include // For true_type and false_type +#include // For true_type and false_type _START_GOOGLE_NAMESPACE_ -template struct is_integral; -template struct is_floating_point; -template struct is_pointer; +template +struct is_integral; +template +struct is_floating_point; +template +struct is_pointer; // MSVC can't compile this correctly, and neither can gcc 3.3.5 (at least) #if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3) // is_enum uses is_convertible, which is not available on MSVC. -template struct is_enum; +template +struct is_enum; #endif -template struct is_reference; -template struct is_pod; -template struct has_trivial_constructor; -template struct has_trivial_copy; -template struct has_trivial_assign; -template struct has_trivial_destructor; -template struct remove_const; -template struct remove_volatile; -template struct remove_cv; -template struct remove_reference; -template struct add_reference; -template struct remove_pointer; -template struct is_same; +template +struct is_reference; +template +struct is_pod; +template +struct has_trivial_constructor; +template +struct has_trivial_copy; +template +struct has_trivial_assign; +template +struct has_trivial_destructor; +template +struct remove_const; +template +struct remove_volatile; +template +struct remove_cv; +template +struct remove_reference; +template +struct add_reference; +template +struct remove_pointer; +template +struct is_same; #if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3) -template struct is_convertible; +template +struct is_convertible; #endif // 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. -template struct is_integral : false_type { }; -template<> struct is_integral : true_type { }; -template<> struct is_integral : true_type { }; -template<> struct is_integral : true_type { }; -template<> struct is_integral : true_type { }; +template +struct is_integral : false_type +{}; +template<> +struct is_integral : true_type +{}; +template<> +struct is_integral : true_type +{}; +template<> +struct is_integral : true_type +{}; +template<> +struct is_integral : true_type +{}; #if defined(_MSC_VER) // wchar_t is not by default a distinct type from unsigned short in // Microsoft C. // 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 -template<> struct is_integral : true_type { }; +template<> +struct is_integral : true_type +{}; #endif -template<> struct is_integral : true_type { }; -template<> struct is_integral : true_type { }; -template<> struct is_integral : true_type { }; -template<> struct is_integral : true_type { }; -template<> struct is_integral : true_type { }; -template<> struct is_integral : true_type { }; +template<> +struct is_integral : true_type +{}; +template<> +struct is_integral : true_type +{}; +template<> +struct is_integral : true_type +{}; +template<> +struct is_integral : true_type +{}; +template<> +struct is_integral : true_type +{}; +template<> +struct is_integral : true_type +{}; #ifdef HAVE_LONG_LONG -template<> struct is_integral : true_type { }; -template<> struct is_integral : true_type { }; +template<> +struct is_integral : true_type +{}; +template<> +struct is_integral : true_type +{}; #endif -template struct is_integral : is_integral { }; -template struct is_integral : is_integral { }; -template struct is_integral : is_integral { }; +template +struct is_integral : is_integral +{}; +template +struct is_integral : is_integral +{}; +template +struct is_integral : is_integral +{}; // 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. -template struct is_floating_point : false_type { }; -template<> struct is_floating_point : true_type { }; -template<> struct is_floating_point : true_type { }; -template<> struct is_floating_point : true_type { }; -template struct is_floating_point - : is_floating_point { }; -template struct is_floating_point - : is_floating_point { }; -template struct is_floating_point - : is_floating_point { }; +template +struct is_floating_point : false_type +{}; +template<> +struct is_floating_point : true_type +{}; +template<> +struct is_floating_point : true_type +{}; +template<> +struct is_floating_point : true_type +{}; +template +struct is_floating_point : is_floating_point +{}; +template +struct is_floating_point : is_floating_point +{}; +template +struct is_floating_point : is_floating_point +{}; // 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 // the underlying type is. -template struct is_pointer : false_type { }; -template struct is_pointer : true_type { }; -template struct is_pointer : is_pointer { }; -template struct is_pointer : is_pointer { }; -template struct is_pointer : is_pointer { }; +template +struct is_pointer : false_type +{}; +template +struct is_pointer : true_type +{}; +template +struct is_pointer : is_pointer +{}; +template +struct is_pointer : is_pointer +{}; +template +struct is_pointer : is_pointer +{}; #if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3) namespace internal { -template struct is_class_or_union { - template static small_ tester(void (U::*)()); - template static big_ tester(...); - static const bool value = sizeof(tester(0)) == sizeof(small_); +template +struct is_class_or_union +{ + template + static small_ tester(void (U::*)()); + template + static big_ tester(...); + static const bool value = sizeof(tester(0)) == sizeof(small_); }; // is_convertible chokes if the first argument is an array. That's why // we use add_reference here. -template struct is_enum_impl - : is_convertible::type, int> { }; +template +struct is_enum_impl : is_convertible::type, int> +{}; -template struct is_enum_impl : false_type { }; +template +struct is_enum_impl : false_type +{}; -} // namespace internal +} // namespace internal // Specified by TR1 [4.5.1] primary type categories. @@ -174,127 +256,212 @@ template struct is_enum_impl : false_type { }; // 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 // inaccessible conversion operators). -template struct is_enum - : internal::is_enum_impl< - is_same::value || - is_integral::value || - is_floating_point::value || - is_reference::value || - internal::is_class_or_union::value, - T> { }; +template +struct is_enum + : internal::is_enum_impl::value || is_integral::value || is_floating_point::value || + is_reference::value || internal::is_class_or_union::value, + T> +{}; -template struct is_enum : is_enum { }; -template struct is_enum : is_enum { }; -template struct is_enum : is_enum { }; +template +struct is_enum : is_enum +{}; +template +struct is_enum : is_enum +{}; +template +struct is_enum : is_enum +{}; #endif // is_reference is false except for reference types. -template struct is_reference : false_type {}; -template struct is_reference : true_type {}; - +template +struct is_reference : false_type +{}; +template +struct is_reference : true_type +{}; // We can't get is_pod right without compiler help, so fail conservatively. // We will assume it's false except for arithmetic types, enumerations, // pointers and cv-qualified versions thereof. Note that std::pair // is not a POD even if T and U are PODs. -template struct is_pod - : integral_constant::value || - is_floating_point::value || +template +struct is_pod : integral_constant::value || is_floating_point::value || #if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3) - // is_enum is not available on MSVC. - is_enum::value || + // is_enum is not available on MSVC. + is_enum::value || #endif - is_pointer::value)> { }; -template struct is_pod : is_pod { }; -template struct is_pod : is_pod { }; -template struct is_pod : is_pod { }; - + is_pointer::value)> +{}; +template +struct is_pod : is_pod +{}; +template +struct is_pod : is_pod +{}; +template +struct is_pod : is_pod +{}; // We can't get has_trivial_constructor right without compiler help, so // 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 // constructors. (3) array of a type with a trivial constructor. // (4) const versions thereof. -template struct has_trivial_constructor : is_pod { }; -template struct has_trivial_constructor > - : integral_constant::value && - has_trivial_constructor::value)> { }; -template struct has_trivial_constructor - : has_trivial_constructor { }; -template struct has_trivial_constructor - : has_trivial_constructor { }; +template +struct has_trivial_constructor : is_pod +{}; +template +struct has_trivial_constructor> + : integral_constant::value && has_trivial_constructor::value)> +{}; +template +struct has_trivial_constructor : has_trivial_constructor +{}; +template +struct has_trivial_constructor : has_trivial_constructor +{}; // We can't get has_trivial_copy right without compiler help, so 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 copy // constructors. (3) array of a type with a trivial copy constructor. // (4) const versions thereof. -template struct has_trivial_copy : is_pod { }; -template struct has_trivial_copy > - : integral_constant::value && - has_trivial_copy::value)> { }; -template struct has_trivial_copy - : has_trivial_copy { }; -template struct has_trivial_copy : has_trivial_copy { }; +template +struct has_trivial_copy : is_pod +{}; +template +struct has_trivial_copy> + : integral_constant::value && has_trivial_copy::value)> +{}; +template +struct has_trivial_copy : has_trivial_copy +{}; +template +struct has_trivial_copy : has_trivial_copy +{}; // We can't get has_trivial_assign right without compiler help, so 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 copy // constructors. (3) array of a type with a trivial assign constructor. -template struct has_trivial_assign : is_pod { }; -template struct has_trivial_assign > - : integral_constant::value && - has_trivial_assign::value)> { }; -template struct has_trivial_assign - : has_trivial_assign { }; +template +struct has_trivial_assign : is_pod +{}; +template +struct has_trivial_assign> + : integral_constant::value && has_trivial_assign::value)> +{}; +template +struct has_trivial_assign : has_trivial_assign +{}; // We can't get has_trivial_destructor right without compiler help, so // 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 // destructors. (3) array of a type with a trivial destructor. // (4) const versions thereof. -template struct has_trivial_destructor : is_pod { }; -template struct has_trivial_destructor > - : integral_constant::value && - has_trivial_destructor::value)> { }; -template struct has_trivial_destructor - : has_trivial_destructor { }; -template struct has_trivial_destructor - : has_trivial_destructor { }; +template +struct has_trivial_destructor : is_pod +{}; +template +struct has_trivial_destructor> + : integral_constant::value && has_trivial_destructor::value)> +{}; +template +struct has_trivial_destructor : has_trivial_destructor +{}; +template +struct has_trivial_destructor : has_trivial_destructor +{}; // Specified by TR1 [4.7.1] -template struct remove_const { typedef T type; }; -template struct remove_const { typedef T type; }; -template struct remove_volatile { typedef T type; }; -template struct remove_volatile { typedef T type; }; -template struct remove_cv { - typedef typename remove_const::type>::type type; +template +struct remove_const +{ + typedef T type; +}; +template +struct remove_const +{ + typedef T type; +}; +template +struct remove_volatile +{ + typedef T type; +}; +template +struct remove_volatile +{ + typedef T type; +}; +template +struct remove_cv +{ + typedef typename remove_const::type>::type type; }; - // Specified by TR1 [4.7.2] Reference modifications. -template struct remove_reference { typedef T type; }; -template struct remove_reference { typedef T type; }; +template +struct remove_reference +{ + typedef T type; +}; +template +struct remove_reference +{ + typedef T type; +}; -template struct add_reference { typedef T& type; }; -template struct add_reference { typedef T& type; }; +template +struct add_reference +{ + typedef T& type; +}; +template +struct add_reference +{ + typedef T& type; +}; // Specified by TR1 [4.7.4] Pointer modifications. -template struct remove_pointer { typedef T type; }; -template struct remove_pointer { typedef T type; }; -template struct remove_pointer { typedef T type; }; -template struct remove_pointer { typedef T type; }; -template struct remove_pointer { - typedef T type; }; +template +struct remove_pointer +{ + typedef T type; +}; +template +struct remove_pointer +{ + typedef T type; +}; +template +struct remove_pointer +{ + typedef T type; +}; +template +struct remove_pointer +{ + typedef T type; +}; +template +struct remove_pointer +{ + typedef T type; +}; // Specified by TR1 [4.6] Relationships between types -template struct is_same : public false_type { }; -template struct is_same : public true_type { }; +template +struct is_same : public false_type +{}; +template +struct is_same : public true_type +{}; // Specified by TR1 [4.6] Relationships between types #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 // _Modern C++ Design_ for more details on this sort of trick. -template -struct ConvertHelper { - static small_ Test(To); - static big_ Test(...); - static From Create(); +template +struct ConvertHelper +{ + static small_ Test(To); + static big_ Test(...); + static From Create(); }; -} // namespace internal +} // namespace internal // Inherits from true_type if From is convertible to To, false_type otherwise. -template +template struct is_convertible : integral_constant::Test( - internal::ConvertHelper::Create())) - == sizeof(small_)> { -}; + sizeof(internal::ConvertHelper::Test(internal::ConvertHelper::Create())) == + sizeof(small_)> +{}; #endif _END_GOOGLE_NAMESPACE_ @@ -333,10 +500,10 @@ _END_GOOGLE_NAMESPACE_ // 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 // 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 PROPAGATE_POD_FROM_TEMPLATE_ARGUMENT(TemplateName) \ +#define PROPAGATE_POD_FROM_TEMPLATE_ARGUMENT(TemplateName) \ typedef int Dummy_Type_For_PROPAGATE_POD_FROM_TEMPLATE_ARGUMENT #define ENFORCE_POD(TypeName) typedef int Dummy_Type_For_ENFORCE_POD -#endif // BASE_TYPE_TRAITS_H_ +#endif // BASE_TYPE_TRAITS_H_ diff --git a/include/mapnik/debug.hpp b/include/mapnik/debug.hpp index 33f0f1ff1..161bb8298 100644 --- a/include/mapnik/debug.hpp +++ b/include/mapnik/debug.hpp @@ -96,7 +96,10 @@ class MAPNIK_DECL logger : public singleton, } // 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) { @@ -208,7 +211,10 @@ class base_log : public util::noncopyable private: #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_; std::string object_name_; diff --git a/include/mapnik/hextree.hpp b/include/mapnik/hextree.hpp index 7a0f160cc..06aa63f06 100644 --- a/include/mapnik/hextree.hpp +++ b/include/mapnik/hextree.hpp @@ -152,7 +152,10 @@ class hextree : private util::noncopyable ~hextree() {} - void setMaxColors(unsigned max_colors) { max_colors_ = max_colors; } + void setMaxColors(unsigned max_colors) + { + max_colors_ = max_colors; + } 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_ std::uint8_t preprocessAlpha(std::uint8_t a) const diff --git a/include/mapnik/jpeg_io.hpp b/include/mapnik/jpeg_io.hpp index efcb0ca99..3bda0e5be 100644 --- a/include/mapnik/jpeg_io.hpp +++ b/include/mapnik/jpeg_io.hpp @@ -29,7 +29,8 @@ #include #include -extern "C" { +extern "C" +{ #include } diff --git a/include/mapnik/offset_converter.hpp b/include/mapnik/offset_converter.hpp index 610a0c1b4..938f119d3 100644 --- a/include/mapnik/offset_converter.hpp +++ b/include/mapnik/offset_converter.hpp @@ -640,7 +640,10 @@ struct offset_converter 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_; double offset_; diff --git a/include/mapnik/png_io.hpp b/include/mapnik/png_io.hpp index 6e5d6195b..9fe070695 100644 --- a/include/mapnik/png_io.hpp +++ b/include/mapnik/png_io.hpp @@ -36,7 +36,8 @@ MAPNIK_DISABLE_WARNING_PUSH // zlib #include // for Z_DEFAULT_COMPRESSION -extern "C" { +extern "C" +{ #include } #include diff --git a/include/mapnik/svg/svg_renderer_agg.hpp b/include/mapnik/svg/svg_renderer_agg.hpp index 671d11bb9..fe8de7ad9 100644 --- a/include/mapnik/svg/svg_renderer_agg.hpp +++ b/include/mapnik/svg/svg_renderer_agg.hpp @@ -492,8 +492,14 @@ class renderer_agg : util::noncopyable } #endif - inline VertexSource& source() const { return source_; } - inline AttributeSource const& attributes() const { return attributes_; } + inline VertexSource& source() const + { + return source_; + } + inline AttributeSource const& attributes() const + { + return attributes_; + } private: diff --git a/include/mapnik/text/color_font_renderer.hpp b/include/mapnik/text/color_font_renderer.hpp index 24cff7d8d..11906b16d 100644 --- a/include/mapnik/text/color_font_renderer.hpp +++ b/include/mapnik/text/color_font_renderer.hpp @@ -34,7 +34,8 @@ MAPNIK_DISABLE_WARNING_PUSH MAPNIK_DISABLE_WARNING_POP // freetype2 -extern "C" { +extern "C" +{ #include #include FT_FREETYPE_H #include FT_STROKER_H diff --git a/include/mapnik/text/face.hpp b/include/mapnik/text/face.hpp index 1dd9421ff..14ed280c3 100644 --- a/include/mapnik/text/face.hpp +++ b/include/mapnik/text/face.hpp @@ -31,7 +31,8 @@ MAPNIK_DISABLE_WARNING_PUSH #include -extern "C" { +extern "C" +{ #include #include FT_FREETYPE_H #include FT_STROKER_H diff --git a/include/mapnik/text/renderer.hpp b/include/mapnik/text/renderer.hpp index d5d877fde..9fd3ec5fc 100644 --- a/include/mapnik/text/renderer.hpp +++ b/include/mapnik/text/renderer.hpp @@ -43,7 +43,8 @@ MAPNIK_DISABLE_WARNING_PUSH MAPNIK_DISABLE_WARNING_POP // freetype2 -extern "C" { +extern "C" +{ #include #include FT_FREETYPE_H #include FT_STROKER_H diff --git a/include/mapnik/tiff_io.hpp b/include/mapnik/tiff_io.hpp index 6e818f34f..1d34f4e3d 100644 --- a/include/mapnik/tiff_io.hpp +++ b/include/mapnik/tiff_io.hpp @@ -32,7 +32,8 @@ MAPNIK_DISABLE_WARNING_PUSH #include -extern "C" { +extern "C" +{ #include #define RealTIFFOpen TIFFClientOpen #define RealTIFFClose TIFFClose diff --git a/include/mapnik/util/file_io.hpp b/include/mapnik/util/file_io.hpp index 3648dcd87..e29cadfa0 100644 --- a/include/mapnik/util/file_io.hpp +++ b/include/mapnik/util/file_io.hpp @@ -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 { diff --git a/include/mapnik/util/singleton.hpp b/include/mapnik/util/singleton.hpp index bfc86913f..897fcee69 100644 --- a/include/mapnik/util/singleton.hpp +++ b/include/mapnik/util/singleton.hpp @@ -77,7 +77,10 @@ class singleton singleton(const singleton& rhs); 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() { diff --git a/include/mapnik/webp_io.hpp b/include/mapnik/webp_io.hpp index 404bcbaf3..64134a4cb 100644 --- a/include/mapnik/webp_io.hpp +++ b/include/mapnik/webp_io.hpp @@ -31,7 +31,8 @@ #include MAPNIK_DISABLE_WARNING_PUSH #include -extern "C" { +extern "C" +{ #include } MAPNIK_DISABLE_WARNING_POP diff --git a/plugins/input/CMakeLists.txt b/plugins/input/CMakeLists.txt index dbc06c835..7a5336492 100644 --- a/plugins/input/CMakeLists.txt +++ b/plugins/input/CMakeLists.txt @@ -13,7 +13,7 @@ endif() macro(add_plugin_target plugin_target output_name) add_library(${plugin_target} ${_plugin_linkage}) - set_target_properties(${plugin_target} PROPERTIES + set_target_properties(${plugin_target} PROPERTIES OUTPUT_NAME "${output_name}" POSITION_INDEPENDENT_CODE ${_plugin_fpic} PREFIX "${_plugin_prefix}" @@ -89,7 +89,7 @@ if(BUILD_SHARED_PLUGINS AND WIN32) file(COPY ${m_deps} DESTINATION "@MAPNIK_OUTPUT_DIR@") ]] m_copy_dlls_str @ONLY ) - file (GENERATE OUTPUT "copy_dlls_$.cmake" + file (GENERATE OUTPUT "copy_dlls_$.cmake" CONTENT "${m_copy_dlls_str}" ) add_custom_target(copy_plugin_dependencies ALL diff --git a/plugins/input/base/CMakeLists.txt b/plugins/input/base/CMakeLists.txt index 2e080bd29..bf76706b8 100644 --- a/plugins/input/base/CMakeLists.txt +++ b/plugins/input/base/CMakeLists.txt @@ -2,8 +2,8 @@ add_library(datasource-base INTERFACE) add_library(mapnik::datasource-base ALIAS datasource-base) -target_include_directories(datasource-base INTERFACE - $ +target_include_directories(datasource-base INTERFACE + $ $ ) target_link_libraries(datasource-base INTERFACE mapnik::core) diff --git a/plugins/input/base/include/mapnik/datasource_plugin.hpp b/plugins/input/base/include/mapnik/datasource_plugin.hpp index 32d67dcfa..ee6f7a854 100644 --- a/plugins/input/base/include/mapnik/datasource_plugin.hpp +++ b/plugins/input/base/include/mapnik/datasource_plugin.hpp @@ -29,7 +29,10 @@ class MAPNIK_DECL datasource_plugin }; #define DATASOURCE_PLUGIN_IMPL(classname, pluginclassname) \ - const char* classname::name() const { return kName; } \ + const char* classname::name() const \ + { \ + return kName; \ + } \ mapnik::datasource_ptr classname::create(mapnik::parameters const& params) const \ { \ return std::make_shared(params); \ diff --git a/plugins/input/csv/CMakeLists.txt b/plugins/input/csv/CMakeLists.txt index 9d9d028b9..bb2739dd1 100644 --- a/plugins/input/csv/CMakeLists.txt +++ b/plugins/input/csv/CMakeLists.txt @@ -8,8 +8,8 @@ target_sources(input-csv ${_plugin_visibility} csv_utils.cpp ) target_link_libraries(input-csv ${_plugin_visibility} - mapnik::mapnik - mapnik::wkt + mapnik::mapnik + mapnik::wkt mapnik::json mapnik::datasource-base ) diff --git a/plugins/input/gdal/CMakeLists.txt b/plugins/input/gdal/CMakeLists.txt index c6ae1f633..440c545b3 100644 --- a/plugins/input/gdal/CMakeLists.txt +++ b/plugins/input/gdal/CMakeLists.txt @@ -6,9 +6,8 @@ target_sources(input-gdal ${_plugin_visibility} gdal_featureset.cpp ) target_include_directories(input-gdal ${_plugin_visibility} ${GDAL_INCLUDE_DIRS}) -target_link_libraries(input-gdal ${_plugin_visibility} +target_link_libraries(input-gdal ${_plugin_visibility} mapnik::mapnik mapnik::datasource-base ${GDAL_LIBRARIES} ) - diff --git a/plugins/input/geobuf/CMakeLists.txt b/plugins/input/geobuf/CMakeLists.txt index 4bd67c6e4..8bcf7b132 100644 --- a/plugins/input/geobuf/CMakeLists.txt +++ b/plugins/input/geobuf/CMakeLists.txt @@ -4,8 +4,7 @@ target_sources(input-geobuf ${_plugin_visibility} geobuf_datasource.cpp geobuf_featureset.cpp ) -target_link_libraries(input-geobuf ${_plugin_visibility} +target_link_libraries(input-geobuf ${_plugin_visibility} mapnik::mapnik mapnik::datasource-base ) - diff --git a/plugins/input/geojson/CMakeLists.txt b/plugins/input/geojson/CMakeLists.txt index cf86e73d5..d6919a405 100644 --- a/plugins/input/geojson/CMakeLists.txt +++ b/plugins/input/geojson/CMakeLists.txt @@ -1,8 +1,8 @@ add_plugin_target(input-geojson "geojson") target_sources(input-geojson ${_plugin_visibility} - geojson_datasource.cpp - geojson_featureset.cpp - geojson_index_featureset.cpp + geojson_datasource.cpp + geojson_featureset.cpp + geojson_index_featureset.cpp geojson_memory_index_featureset.cpp ) target_link_libraries(input-geojson ${_plugin_visibility} diff --git a/plugins/input/ogr/ogr_layer_ptr.hpp b/plugins/input/ogr/ogr_layer_ptr.hpp index eab1a0774..a0ee45a55 100644 --- a/plugins/input/ogr/ogr_layer_ptr.hpp +++ b/plugins/input/ogr/ogr_layer_ptr.hpp @@ -144,11 +144,20 @@ class ogr_layer_ptr #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: diff --git a/plugins/input/pgraster/CMakeLists.txt b/plugins/input/pgraster/CMakeLists.txt index e75370c28..21a58e733 100644 --- a/plugins/input/pgraster/CMakeLists.txt +++ b/plugins/input/pgraster/CMakeLists.txt @@ -2,12 +2,12 @@ mapnik_find_package(PostgreSQL REQUIRED) add_plugin_target(input-pgraster "pgraster") target_sources(input-pgraster ${_plugin_visibility} - pgraster_datasource.cpp - pgraster_featureset.cpp + pgraster_datasource.cpp + pgraster_featureset.cpp pgraster_wkb_reader.cpp ) target_link_libraries(input-pgraster ${_plugin_visibility} - mapnik::mapnik + mapnik::mapnik mapnik::datasource-base PostgreSQL::PostgreSQL ) diff --git a/plugins/input/pgraster/pgraster_datasource.cpp b/plugins/input/pgraster/pgraster_datasource.cpp index 9ee183703..cdd03507a 100644 --- a/plugins/input/pgraster/pgraster_datasource.cpp +++ b/plugins/input/pgraster/pgraster_datasource.cpp @@ -56,7 +56,6 @@ DATASOURCE_PLUGIN_EXPORT(pgraster_datasource_plugin); DATASOURCE_PLUGIN_EMPTY_AFTER_LOAD(pgraster_datasource_plugin); DATASOURCE_PLUGIN_EMPTY_BEFORE_UNLOAD(pgraster_datasource_plugin); - const std::string pgraster_datasource::RASTER_COLUMNS = "raster_columns"; const std::string pgraster_datasource::RASTER_OVERVIEWS = "raster_overviews"; const std::string pgraster_datasource::SPATIAL_REF_SYS = "spatial_ref_system"; diff --git a/plugins/input/postgis/CMakeLists.txt b/plugins/input/postgis/CMakeLists.txt index 7eaae3402..e26e9b8c9 100644 --- a/plugins/input/postgis/CMakeLists.txt +++ b/plugins/input/postgis/CMakeLists.txt @@ -2,11 +2,11 @@ mapnik_find_package(PostgreSQL REQUIRED) add_plugin_target(input-postgis "postgis") target_sources(input-postgis ${_plugin_visibility} - postgis_datasource.cpp - postgis_featureset.cpp + postgis_datasource.cpp + postgis_featureset.cpp ) target_link_libraries(input-postgis ${_plugin_visibility} - mapnik::mapnik + mapnik::mapnik mapnik::datasource-base PostgreSQL::PostgreSQL ) diff --git a/plugins/input/postgis/connection.hpp b/plugins/input/postgis/connection.hpp index e5b0dbab8..a514192ea 100644 --- a/plugins/input/postgis/connection.hpp +++ b/plugins/input/postgis/connection.hpp @@ -33,7 +33,8 @@ #include #include -extern "C" { +extern "C" +{ #include "libpq-fe.h" } @@ -236,11 +237,20 @@ class Connection return std::make_shared(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() { diff --git a/plugins/input/postgis/resultset.hpp b/plugins/input/postgis/resultset.hpp index 30744a010..91486e2c4 100644 --- a/plugins/input/postgis/resultset.hpp +++ b/plugins/input/postgis/resultset.hpp @@ -23,7 +23,8 @@ #ifndef POSTGIS_RESULTSET_HPP #define POSTGIS_RESULTSET_HPP -extern "C" { +extern "C" +{ #include "libpq-fe.h" } diff --git a/plugins/input/raster/CMakeLists.txt b/plugins/input/raster/CMakeLists.txt index 5adca0106..ca3826a70 100644 --- a/plugins/input/raster/CMakeLists.txt +++ b/plugins/input/raster/CMakeLists.txt @@ -4,7 +4,7 @@ target_sources(input-raster ${_plugin_visibility} raster_featureset.cpp raster_info.cpp ) -target_link_libraries(input-raster ${_plugin_visibility} +target_link_libraries(input-raster ${_plugin_visibility} mapnik::mapnik mapnik::datasource-base ) diff --git a/plugins/input/shape/CMakeLists.txt b/plugins/input/shape/CMakeLists.txt index 695312b23..930d85f11 100644 --- a/plugins/input/shape/CMakeLists.txt +++ b/plugins/input/shape/CMakeLists.txt @@ -1,13 +1,13 @@ add_plugin_target(input-shape "shape") target_sources(input-shape ${_plugin_visibility} - dbfile.cpp + dbfile.cpp dbf_test.cpp shape_datasource.cpp shape_featureset.cpp shape_index_featureset.cpp shape_io.cpp shape_utils.cpp ) -target_link_libraries(input-shape ${_plugin_visibility} +target_link_libraries(input-shape ${_plugin_visibility} mapnik::mapnik mapnik::datasource-base ) diff --git a/plugins/input/shape/shapefile.hpp b/plugins/input/shape/shapefile.hpp index 5798f22ef..2eac16d92 100644 --- a/plugins/input/shape/shapefile.hpp +++ b/plugins/input/shape/shapefile.hpp @@ -171,15 +171,30 @@ class shape_file : public mapnik::util::mapped_memory_file file_.read(reinterpret_cast(&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 diff --git a/plugins/input/sqlite/CMakeLists.txt b/plugins/input/sqlite/CMakeLists.txt index d3e9bc821..5d93c3756 100644 --- a/plugins/input/sqlite/CMakeLists.txt +++ b/plugins/input/sqlite/CMakeLists.txt @@ -6,7 +6,7 @@ target_sources(input-sqlite ${_plugin_visibility} sqlite_featureset.cpp ) target_link_libraries(input-sqlite ${_plugin_visibility} - mapnik::mapnik + mapnik::mapnik mapnik::datasource-base SQLite::SQLite3 ) diff --git a/plugins/input/sqlite/sqlite_connection.hpp b/plugins/input/sqlite/sqlite_connection.hpp index 7e23eaf31..96804b453 100644 --- a/plugins/input/sqlite/sqlite_connection.hpp +++ b/plugins/input/sqlite/sqlite_connection.hpp @@ -39,7 +39,8 @@ MAPNIK_DISABLE_WARNING_PUSH MAPNIK_DISABLE_WARNING_POP // sqlite -extern "C" { +extern "C" +{ #include } @@ -160,7 +161,10 @@ class sqlite_connection return rc; } - sqlite3* operator*() { return db_; } + sqlite3* operator*() + { + return db_; + } bool load_extension(std::string const& ext_path) { diff --git a/plugins/input/sqlite/sqlite_prepared.hpp b/plugins/input/sqlite/sqlite_prepared.hpp index 7d2de2b06..1de13707e 100644 --- a/plugins/input/sqlite/sqlite_prepared.hpp +++ b/plugins/input/sqlite/sqlite_prepared.hpp @@ -39,7 +39,8 @@ #include "sqlite_connection.hpp" // sqlite -extern "C" { +extern "C" +{ #include } diff --git a/plugins/input/sqlite/sqlite_resultset.hpp b/plugins/input/sqlite/sqlite_resultset.hpp index e3c318d70..0934ee8dd 100644 --- a/plugins/input/sqlite/sqlite_resultset.hpp +++ b/plugins/input/sqlite/sqlite_resultset.hpp @@ -32,7 +32,8 @@ #include // sqlite -extern "C" { +extern "C" +{ #include } diff --git a/plugins/input/sqlite/sqlite_utils.hpp b/plugins/input/sqlite/sqlite_utils.hpp index 636b49d0e..662461604 100644 --- a/plugins/input/sqlite/sqlite_utils.hpp +++ b/plugins/input/sqlite/sqlite_utils.hpp @@ -45,7 +45,8 @@ MAPNIK_DISABLE_WARNING_PUSH MAPNIK_DISABLE_WARNING_POP // sqlite -extern "C" { +extern "C" +{ #include } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6bf3714ce..3bb1323b5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,7 +7,7 @@ if(BUILD_SHARED_LIBS) endif() target_link_libraries(mapnik PUBLIC mapnik::core mapnik::datasource-base) -target_link_libraries(mapnik PRIVATE +target_link_libraries(mapnik PRIVATE mapnik::agg # expr: if(BUILD_SHARED_PLUGINS == OFF && is build) then add link target $<$>,$>:input-csv> @@ -42,7 +42,7 @@ if(NOT BUILD_SHARED_PLUGINS) target_include_directories(mapnik PRIVATE "${PROJECT_SOURCE_DIR}/plugins") endif() -set_target_properties(mapnik PROPERTIES +set_target_properties(mapnik PROPERTIES POSITION_INDEPENDENT_CODE ON DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}" OUTPUT_NAME "mapnik" @@ -132,7 +132,7 @@ target_sources(mapnik PRIVATE simplify.cpp symbolizer_enumerations.cpp symbolizer_keys.cpp - symbolizer.cpp + symbolizer.cpp transform_expression_grammar_x3.cpp transform_expression.cpp twkb.cpp @@ -145,7 +145,7 @@ target_sources(mapnik PRIVATE wkb.cpp xml_tree.cpp ) -target_sources(mapnik PRIVATE +target_sources(mapnik PRIVATE ../deps/agg/src/agg_arc.cpp ../deps/agg/src/agg_arrowhead.cpp ../deps/agg/src/agg_bezier_arc.cpp @@ -189,7 +189,7 @@ target_sources(mapnik PRIVATE agg/process_text_symbolizer.cpp ) -target_sources(mapnik PRIVATE +target_sources(mapnik PRIVATE css/css_color_grammar_x3.cpp css/css_grammar_x3.cpp ) @@ -247,12 +247,12 @@ target_sources(mapnik PRIVATE text/formatting/list.cpp text/formatting/registry.cpp text/formatting/text.cpp - + text/placements/base.cpp text/placements/dummy.cpp text/placements/list.cpp text/placements/registry.cpp - text/placements/simple.cpp + text/placements/simple.cpp ) target_sources(mapnik PRIVATE @@ -293,8 +293,8 @@ if(USE_TIFF) endif() if(USE_WEBP) - target_sources(mapnik PRIVATE - webp_reader.cpp + target_sources(mapnik PRIVATE + webp_reader.cpp webp_io.cpp ) endif() @@ -302,7 +302,7 @@ endif() if(USE_GRID_RENDERER) target_sources(mapnik PRIVATE grid/grid_renderer.cpp - grid/grid.cpp + grid/grid.cpp grid/process_building_symbolizer.cpp grid/process_group_symbolizer.cpp grid/process_line_pattern_symbolizer.cpp diff --git a/src/font_engine_freetype.cpp b/src/font_engine_freetype.cpp index 4f27df10e..586146bb7 100644 --- a/src/font_engine_freetype.cpp +++ b/src/font_engine_freetype.cpp @@ -35,7 +35,8 @@ MAPNIK_DISABLE_WARNING_PUSH #include // freetype2 -extern "C" { +extern "C" +{ #include #include FT_FREETYPE_H #include FT_STROKER_H diff --git a/src/image_options.cpp b/src/image_options.cpp index 694c82327..75e751dc4 100644 --- a/src/image_options.cpp +++ b/src/image_options.cpp @@ -30,7 +30,8 @@ MAPNIK_DISABLE_WARNING_PUSH MAPNIK_DISABLE_WARNING_POP #if defined(HAVE_PNG) -extern "C" { +extern "C" +{ #include } #endif // HAVE_PNG diff --git a/src/image_util_png.cpp b/src/image_util_png.cpp index 84b0bb202..cfef4e38c 100644 --- a/src/image_util_png.cpp +++ b/src/image_util_png.cpp @@ -21,7 +21,8 @@ *****************************************************************************/ #if defined(HAVE_PNG) -extern "C" { +extern "C" +{ #include } #ifndef PNG_FAST_FILTERS // libpng < 1.6 diff --git a/src/jpeg_reader.cpp b/src/jpeg_reader.cpp index 1e14acb59..c27099f8f 100644 --- a/src/jpeg_reader.cpp +++ b/src/jpeg_reader.cpp @@ -26,7 +26,8 @@ #include // jpeg -extern "C" { +extern "C" +{ #include } diff --git a/src/json/CMakeLists.txt b/src/json/CMakeLists.txt index 0444942fc..91ca4fbc0 100644 --- a/src/json/CMakeLists.txt +++ b/src/json/CMakeLists.txt @@ -17,19 +17,19 @@ target_sources(json PRIVATE target_include_directories(json PRIVATE ${JPEG_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR} - ${MAPBOX_POLYLABEL_INCLUDE_DIRS} + ${MAPBOX_POLYLABEL_INCLUDE_DIRS} ${MAPBOX_GEOMETRY_INCLUDE_DIRS} ${MAPBOX_VARIANT_INCLUDE_DIRS} ) target_link_libraries(json PRIVATE mapnik::core ${ICUU_LIB}) -set_target_properties(json PROPERTIES +set_target_properties(json PROPERTIES POSITION_INDEPENDENT_CODE ON DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}" OUTPUT_NAME "mapnikjson" PREFIX "lib" IMPORT_PREFIX "lib" - VERSION ${MAPNIK_VERSION} + VERSION ${MAPNIK_VERSION} # see mapnik target for explanation SOVERSION ${MAPNIK_VERSION} LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" diff --git a/src/mapnik.cpp b/src/mapnik.cpp index 9dbe3a8e0..c36c083e4 100644 --- a/src/mapnik.cpp +++ b/src/mapnik.cpp @@ -40,7 +40,7 @@ void register_image_readers() } } // namespace mapnik -#if !defined(MAPNIK_STATIC_PLUGINS) || !defined(_WIN32) +#if !defined(MAPNIK_STATIC_PLUGINS) || !defined(_WIN32) namespace { class AutoSetup final { diff --git a/src/memory_datasource.cpp b/src/memory_datasource.cpp index 605f36ec6..60019011a 100644 --- a/src/memory_datasource.cpp +++ b/src/memory_datasource.cpp @@ -35,7 +35,6 @@ using mapnik::datasource; using mapnik::parameters; - DATASOURCE_PLUGIN_EXPORT(mapnik::memory_datasource_plugin) namespace mapnik { diff --git a/src/png_reader.cpp b/src/png_reader.cpp index 799cdeda5..2d866a3cb 100644 --- a/src/png_reader.cpp +++ b/src/png_reader.cpp @@ -25,7 +25,8 @@ #include #include -extern "C" { +extern "C" +{ #include } diff --git a/src/proj_transform.cpp b/src/proj_transform.cpp index 624e9147a..29be99f8b 100644 --- a/src/proj_transform.cpp +++ b/src/proj_transform.cpp @@ -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); if (transform_ == nullptr) { - throw std::runtime_error(std::string("Cannot initialize proj_transform (crs_to_crs) for given projections: '") + - source.params() + "'->'" + dest.params() + + throw std::runtime_error( + std::string("Cannot initialize proj_transform (crs_to_crs) for given projections: '") + + source.params() + "'->'" + dest.params() + #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 - "'"); + "'"); #endif } PJ* transform_gis = proj_normalize_for_visualization(ctx_, transform_); if (transform_gis == nullptr) { - throw std::runtime_error(std::string("Cannot initialize proj_transform (normalize) for given projections: '") + - source.params() + "'->'" + dest.params() + + throw std::runtime_error( + std::string("Cannot initialize proj_transform (normalize) for given projections: '") + + source.params() + "'->'" + dest.params() + #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 - "'"); + "'"); #endif } proj_destroy(transform_); diff --git a/src/text/face.cpp b/src/text/face.cpp index 524cc5ef6..7c9223e08 100644 --- a/src/text/face.cpp +++ b/src/text/face.cpp @@ -27,7 +27,8 @@ MAPNIK_DISABLE_WARNING_PUSH #include -extern "C" { +extern "C" +{ #include FT_GLYPH_H #include FT_TRUETYPE_TABLES_H } diff --git a/src/text/font_library.cpp b/src/text/font_library.cpp index f9f966dce..c37a3578a 100644 --- a/src/text/font_library.cpp +++ b/src/text/font_library.cpp @@ -33,7 +33,8 @@ MAPNIK_DISABLE_WARNING_PUSH #include // freetype2 -extern "C" { +extern "C" +{ #include #include FT_FREETYPE_H #include FT_MODULE_H diff --git a/src/tiff_reader.cpp b/src/tiff_reader.cpp index 4446add71..b8cbeb74c 100644 --- a/src/tiff_reader.cpp +++ b/src/tiff_reader.cpp @@ -24,7 +24,8 @@ #include #include #include -extern "C" { +extern "C" +{ #include } diff --git a/src/tiff_reader.hpp b/src/tiff_reader.hpp index edf9124d8..b4ff24804 100644 --- a/src/tiff_reader.hpp +++ b/src/tiff_reader.hpp @@ -3,7 +3,8 @@ #include #include #include -extern "C" { +extern "C" +{ #include } @@ -96,19 +97,49 @@ class tiff_reader : public image_reader unsigned width() const final; unsigned height() const final; boost::optional> 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; image_any read(unsigned x, unsigned y, unsigned width, unsigned height) final; // methods specific to tiff reader - unsigned bits_per_sample() const { return bps_; } - unsigned sample_format() const { return sample_format_; } - 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_; } + unsigned bits_per_sample() const + { + return bps_; + } + unsigned sample_format() const + { + return sample_format_; + } + 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: tiff_reader(const tiff_reader&); diff --git a/src/webp_reader.cpp b/src/webp_reader.cpp index 24b942525..6eedfefd9 100644 --- a/src/webp_reader.cpp +++ b/src/webp_reader.cpp @@ -27,7 +27,8 @@ #include MAPNIK_DISABLE_WARNING_PUSH #include -extern "C" { +extern "C" +{ #include #include } diff --git a/src/wkt/CMakeLists.txt b/src/wkt/CMakeLists.txt index 562cc67e9..54ca57f96 100644 --- a/src/wkt/CMakeLists.txt +++ b/src/wkt/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(wkt PRIVATE +target_sources(wkt PRIVATE geometry_to_wkt.cpp mapnik_wkt_generator_grammar.cpp wkt_factory.cpp @@ -9,19 +9,19 @@ target_include_directories(wkt PRIVATE ${MAPNIK_INCLUDE_PATH} ${JPEG_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR} - ${MAPBOX_POLYLABEL_INCLUDE_DIRS} + ${MAPBOX_POLYLABEL_INCLUDE_DIRS} ${MAPBOX_GEOMETRY_INCLUDE_DIRS} ${MAPBOX_VARIANT_INCLUDE_DIRS} ) target_link_libraries(wkt PRIVATE mapnik::core) -set_target_properties(wkt PROPERTIES +set_target_properties(wkt PROPERTIES POSITION_INDEPENDENT_CODE ON DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}" OUTPUT_NAME "mapnikwkt" PREFIX "lib" IMPORT_PREFIX "lib" - VERSION ${MAPNIK_VERSION} + VERSION ${MAPNIK_VERSION} # see mapnik target for explanation SOVERSION ${MAPNIK_VERSION} LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 191524ae6..ecd612ed9 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -9,7 +9,7 @@ FetchContent_Declare( GIT_TAG v2.13.7) 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 # might not be needed if catch updates its cmakes cmake_policy(SET CMP0110 OLD) @@ -17,7 +17,7 @@ endif() add_subdirectory(visual) -add_executable(mapnik-test-unit +add_executable(mapnik-test-unit unit/run.cpp unit/color/css_color.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/vertex_adapter.cpp ) -set_target_properties(mapnik-test-unit PROPERTIES +set_target_properties(mapnik-test-unit PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) target_link_libraries(mapnik-test-unit PUBLIC - Catch2::Catch2 + Catch2::Catch2 mapnik::agg mapnik::mapnik 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}") 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}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) target_link_libraries(agg_rasterizer_integer_overflow_test PUBLIC - Catch2::Catch2 - mapnik::mapnik + Catch2::Catch2 + mapnik::mapnik mapnik::agg mapnik::json ) 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) -set_target_properties(datasource_registration_test PROPERTIES +set_target_properties(datasource_registration_test PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" 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 Catch2::Catch2 - mapnik::mapnik + mapnik::mapnik mapnik::agg ) 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) -set_target_properties(font_registration_test PROPERTIES +set_target_properties(font_registration_test PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) target_link_libraries(font_registration_test PUBLIC - Catch2::Catch2 - mapnik::mapnik + Catch2::Catch2 + mapnik::mapnik mapnik::agg mapnik::json ) 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) -set_target_properties(map_xml_test PROPERTIES +set_target_properties(map_xml_test PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) target_link_libraries(map_xml_test PUBLIC - Catch2::Catch2 - mapnik::mapnik + Catch2::Catch2 + mapnik::mapnik mapnik::agg mapnik::json ) @@ -194,8 +194,8 @@ endif() catch_discover_tests(mapnik-test-unit WORKING_DIRECTORY "${MAPNIK_OUTPUT_DIR}" - PROPERTIES - ENVIRONMENT + PROPERTIES + ENVIRONMENT "PATH=${m_test_path}" ) catch_discover_tests(agg_rasterizer_integer_overflow_test WORKING_DIRECTORY "${MAPNIK_OUTPUT_DIR}") diff --git a/test/catch.hpp b/test/catch.hpp index 7e706f947..896ad6382 100644 --- a/test/catch.hpp +++ b/test/catch.hpp @@ -12,55 +12,54 @@ #define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED // start catch.hpp - #define CATCH_VERSION_MAJOR 2 #define CATCH_VERSION_MINOR 13 #define CATCH_VERSION_PATCH 7 #ifdef __clang__ -# pragma clang system_header +#pragma clang system_header #elif defined __GNUC__ -# pragma GCC system_header +#pragma GCC system_header #endif // start catch_suppress_warnings.h #ifdef __clang__ -# ifdef __ICC // icpc defines the __clang__ macro -# pragma warning(push) -# pragma warning(disable: 161 1682) -# else // __ICC -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wpadded" -# pragma clang diagnostic ignored "-Wswitch-enum" -# pragma clang diagnostic ignored "-Wcovered-switch-default" -# endif +#ifdef __ICC // icpc defines the __clang__ macro +#pragma warning(push) +#pragma warning(disable: 161 1682) +#else // __ICC +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#pragma clang diagnostic ignored "-Wswitch-enum" +#pragma clang diagnostic ignored "-Wcovered-switch-default" +#endif #elif defined __GNUC__ - // Because REQUIREs trigger GCC's -Wparentheses, and because still - // supported version of g++ have only buggy support for _Pragmas, - // Wparentheses have to be suppressed globally. -# pragma GCC diagnostic ignored "-Wparentheses" // See #674 for details +// Because REQUIREs trigger GCC's -Wparentheses, and because still +// supported version of g++ have only buggy support for _Pragmas, +// Wparentheses have to be suppressed globally. +#pragma GCC diagnostic ignored "-Wparentheses" // See #674 for details -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wunused-variable" -# pragma GCC diagnostic ignored "-Wpadded" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wpadded" #endif // end catch_suppress_warnings.h #if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER) -# define CATCH_IMPL -# define CATCH_CONFIG_ALL_PARTS +#define CATCH_IMPL +#define CATCH_CONFIG_ALL_PARTS #endif // In the impl file, we want to have access to all parts of the headers // Can also be used to sanely support PCHs #if defined(CATCH_CONFIG_ALL_PARTS) -# define CATCH_CONFIG_EXTERNAL_INTERFACES -# if defined(CATCH_CONFIG_DISABLE_MATCHERS) -# undef CATCH_CONFIG_DISABLE_MATCHERS -# endif -# if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER) -# define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER -# endif +#define CATCH_CONFIG_EXTERNAL_INTERFACES +#if defined(CATCH_CONFIG_DISABLE_MATCHERS) +#undef CATCH_CONFIG_DISABLE_MATCHERS +#endif +#if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER) +#define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER +#endif #endif #if !defined(CATCH_CONFIG_IMPL_ONLY) @@ -69,34 +68,33 @@ // See e.g.: // https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/TargetConditionals.h.auto.html #ifdef __APPLE__ -# include -# if (defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1) || \ - (defined(TARGET_OS_MAC) && TARGET_OS_MAC == 1) -# define CATCH_PLATFORM_MAC -# elif (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE == 1) -# define CATCH_PLATFORM_IPHONE -# endif +#include +#if (defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1) || (defined(TARGET_OS_MAC) && TARGET_OS_MAC == 1) +#define CATCH_PLATFORM_MAC +#elif (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE == 1) +#define CATCH_PLATFORM_IPHONE +#endif #elif defined(linux) || defined(__linux) || defined(__linux__) -# define CATCH_PLATFORM_LINUX +#define CATCH_PLATFORM_LINUX #elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__) -# define CATCH_PLATFORM_WINDOWS +#define CATCH_PLATFORM_WINDOWS #endif // end catch_platform.h #ifdef CATCH_IMPL -# ifndef CLARA_CONFIG_MAIN -# define CLARA_CONFIG_MAIN_NOT_DEFINED -# define CLARA_CONFIG_MAIN -# endif +#ifndef CLARA_CONFIG_MAIN +#define CLARA_CONFIG_MAIN_NOT_DEFINED +#define CLARA_CONFIG_MAIN +#endif #endif // start catch_user_interfaces.h namespace Catch { - unsigned int rngSeed(); +unsigned int rngSeed(); } // end catch_user_interfaces.h @@ -125,30 +123,30 @@ namespace Catch { #ifdef __cplusplus -# if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) -# define CATCH_CPP14_OR_GREATER -# endif +#if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) +#define CATCH_CPP14_OR_GREATER +#endif -# if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) -# define CATCH_CPP17_OR_GREATER -# endif +#if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) +#define CATCH_CPP17_OR_GREATER +#endif #endif // Only GCC compiler should be used in this block, so other compilers trying to // mask themselves as GCC should be ignored. #if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && !defined(__CUDACC__) && !defined(__LCC__) -# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic push" ) -# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic pop" ) +#define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma("GCC diagnostic push") +#define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma("GCC diagnostic pop") -# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) +#define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) #endif #if defined(__clang__) -# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic push" ) -# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic pop" ) +#define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma("clang diagnostic push") +#define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma("clang diagnostic pop") // As of this writing, IBM XL's implementation of __builtin_constant_p has a bug // which results in calls to destructors being emitted for each temporary, @@ -161,62 +159,60 @@ namespace Catch { // ``` // // Therefore, `CATCH_INTERNAL_IGNORE_BUT_WARN` is not implemented. -# if !defined(__ibmxl__) && !defined(__CUDACC__) -# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) /* NOLINT(cppcoreguidelines-pro-type-vararg, hicpp-vararg) */ -# endif +#if !defined(__ibmxl__) && !defined(__CUDACC__) +#define CATCH_INTERNAL_IGNORE_BUT_WARN(...) \ + (void)__builtin_constant_p(__VA_ARGS__) /* NOLINT(cppcoreguidelines-pro-type-vararg, hicpp-vararg) */ +#endif -# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) \ - _Pragma( "clang diagnostic ignored \"-Wglobal-constructors\"") +#define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + _Pragma("clang diagnostic ignored \"-Wexit-time-destructors\"") \ + _Pragma("clang diagnostic ignored \"-Wglobal-constructors\"") -# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ - _Pragma( "clang diagnostic ignored \"-Wparentheses\"" ) +#define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS _Pragma("clang diagnostic ignored \"-Wparentheses\"") -# define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \ - _Pragma( "clang diagnostic ignored \"-Wunused-variable\"" ) +#define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS _Pragma("clang diagnostic ignored \"-Wunused-variable\"") -# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ - _Pragma( "clang diagnostic ignored \"-Wgnu-zero-variadic-macro-arguments\"" ) +#define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ + _Pragma("clang diagnostic ignored \"-Wgnu-zero-variadic-macro-arguments\"") -# define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ - _Pragma( "clang diagnostic ignored \"-Wunused-template\"" ) +#define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS _Pragma("clang diagnostic ignored \"-Wunused-template\"") #endif // __clang__ //////////////////////////////////////////////////////////////////////////////// // Assume that non-Windows platforms support posix signals by default #if !defined(CATCH_PLATFORM_WINDOWS) - #define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS +#define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS #endif //////////////////////////////////////////////////////////////////////////////// // We know some environments not to support full POSIX signals #if defined(__CYGWIN__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(__DJGPP__) - #define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS +#define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS #endif #ifdef __OS400__ -# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS -# define CATCH_CONFIG_COLOUR_NONE +#define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS +#define CATCH_CONFIG_COLOUR_NONE #endif //////////////////////////////////////////////////////////////////////////////// // Android somehow still does not support std::to_string #if defined(__ANDROID__) -# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING -# define CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE +#define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING +#define CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE #endif //////////////////////////////////////////////////////////////////////////////// // Not all Windows environments support SEH properly #if defined(__MINGW32__) -# define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH +#define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH #endif //////////////////////////////////////////////////////////////////////////////// // PS4 #if defined(__ORBIS__) -# define CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE +#define CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE #endif //////////////////////////////////////////////////////////////////////////////// @@ -225,64 +221,63 @@ namespace Catch { // Required for some versions of Cygwin to declare gettimeofday // see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin -# define _BSD_SOURCE +#define _BSD_SOURCE // some versions of cygwin (most) do not support std::to_string. Use the libstd check. // https://gcc.gnu.org/onlinedocs/gcc-4.8.2/libstdc++/api/a01053_source.html line 2812-2813 -# if !((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \ - && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)) +#if !((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)) -# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING +#define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING -# endif +#endif #endif // __CYGWIN__ //////////////////////////////////////////////////////////////////////////////// // Visual C++ #if defined(_MSC_VER) -# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) ) -# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma( warning(pop) ) +#define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma(warning(push)) +#define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma(warning(pop)) // Universal Windows platform does not support SEH // Or console colours (or console at all...) -# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) -# define CATCH_CONFIG_COLOUR_NONE -# else -# define CATCH_INTERNAL_CONFIG_WINDOWS_SEH -# endif +#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) +#define CATCH_CONFIG_COLOUR_NONE +#else +#define CATCH_INTERNAL_CONFIG_WINDOWS_SEH +#endif // MSVC traditional preprocessor needs some workaround for __VA_ARGS__ // _MSVC_TRADITIONAL == 0 means new conformant preprocessor // _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor -# if !defined(__clang__) // Handle Clang masquerading for msvc -# if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL) -# define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -# endif // MSVC_TRADITIONAL -# endif // __clang__ +#if !defined(__clang__) // Handle Clang masquerading for msvc +#if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL) +#define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#endif // MSVC_TRADITIONAL +#endif // __clang__ #endif // _MSC_VER #if defined(_REENTRANT) || defined(_MSC_VER) // Enable async processing, as -pthread is specified or no additional linking is required -# define CATCH_INTERNAL_CONFIG_USE_ASYNC +#define CATCH_INTERNAL_CONFIG_USE_ASYNC #endif // _MSC_VER //////////////////////////////////////////////////////////////////////////////// // Check if we are compiled with -fno-exceptions or equivalent #if defined(__EXCEPTIONS) || defined(__cpp_exceptions) || defined(_CPPUNWIND) -# define CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED +#define CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED #endif //////////////////////////////////////////////////////////////////////////////// // DJGPP #ifdef __DJGPP__ -# define CATCH_INTERNAL_CONFIG_NO_WCHAR +#define CATCH_INTERNAL_CONFIG_NO_WCHAR #endif // __DJGPP__ //////////////////////////////////////////////////////////////////////////////// // Embarcadero C++Build #if defined(__BORLANDC__) - #define CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN +#define CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN #endif //////////////////////////////////////////////////////////////////////////////// @@ -292,8 +287,8 @@ namespace Catch { // handled by it. // Otherwise all supported compilers support COUNTER macro, // but user still might want to turn it off -#if ( !defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L ) - #define CATCH_INTERNAL_CONFIG_COUNTER +#if (!defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L) +#define CATCH_INTERNAL_CONFIG_COUNTER #endif //////////////////////////////////////////////////////////////////////////////// @@ -302,9 +297,9 @@ namespace Catch { // This means that it is detected as Windows, but does not provide // the same set of capabilities as real Windows does. #if defined(UNDER_RTSS) || defined(RTX64_BUILD) - #define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH - #define CATCH_INTERNAL_CONFIG_NO_ASYNC - #define CATCH_CONFIG_COLOUR_NONE +#define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH +#define CATCH_INTERNAL_CONFIG_NO_ASYNC +#define CATCH_CONFIG_COLOUR_NONE #endif #if !defined(_GLIBCXX_USE_C99_MATH_TR1) @@ -313,162 +308,175 @@ namespace Catch { // Various stdlib support checks that require __has_include #if defined(__has_include) - // Check if string_view is available and usable - #if __has_include() && defined(CATCH_CPP17_OR_GREATER) - # define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW - #endif +// Check if string_view is available and usable +#if __has_include() && defined(CATCH_CPP17_OR_GREATER) +#define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW +#endif - // Check if optional is available and usable - # if __has_include() && defined(CATCH_CPP17_OR_GREATER) - # define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL - # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) +// Check if optional is available and usable +#if __has_include() && defined(CATCH_CPP17_OR_GREATER) +#define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL +#endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) - // Check if byte is available and usable - # if __has_include() && defined(CATCH_CPP17_OR_GREATER) - # include - # if defined(__cpp_lib_byte) && (__cpp_lib_byte > 0) - # define CATCH_INTERNAL_CONFIG_CPP17_BYTE - # endif - # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) +// Check if byte is available and usable +#if __has_include() && defined(CATCH_CPP17_OR_GREATER) +#include +#if defined(__cpp_lib_byte) && (__cpp_lib_byte > 0) +#define CATCH_INTERNAL_CONFIG_CPP17_BYTE +#endif +#endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) - // Check if variant is available and usable - # if __has_include() && defined(CATCH_CPP17_OR_GREATER) - # if defined(__clang__) && (__clang_major__ < 8) - // work around clang bug with libstdc++ https://bugs.llvm.org/show_bug.cgi?id=31852 - // fix should be in clang 8, workaround in libstdc++ 8.2 - # include - # if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) - # define CATCH_CONFIG_NO_CPP17_VARIANT - # else - # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT - # endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) - # else - # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT - # endif // defined(__clang__) && (__clang_major__ < 8) - # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) +// Check if variant is available and usable +#if __has_include() && defined(CATCH_CPP17_OR_GREATER) +#if defined(__clang__) && (__clang_major__ < 8) +// work around clang bug with libstdc++ https://bugs.llvm.org/show_bug.cgi?id=31852 +// fix should be in clang 8, workaround in libstdc++ 8.2 +#include +#if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) +#define CATCH_CONFIG_NO_CPP17_VARIANT +#else +#define CATCH_INTERNAL_CONFIG_CPP17_VARIANT +#endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) +#else +#define CATCH_INTERNAL_CONFIG_CPP17_VARIANT +#endif // defined(__clang__) && (__clang_major__ < 8) +#endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) #endif // defined(__has_include) #if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER) -# define CATCH_CONFIG_COUNTER +#define CATCH_CONFIG_COUNTER #endif -#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH) && !defined(CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH) -# define CATCH_CONFIG_WINDOWS_SEH +#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && \ + !defined(CATCH_CONFIG_WINDOWS_SEH) && !defined(CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH) +#define CATCH_CONFIG_WINDOWS_SEH #endif // This is set by default, because we assume that unix compilers are posix-signal-compatible by default. -#if defined(CATCH_INTERNAL_CONFIG_POSIX_SIGNALS) && !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS) -# define CATCH_CONFIG_POSIX_SIGNALS +#if defined(CATCH_INTERNAL_CONFIG_POSIX_SIGNALS) && !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && \ + !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS) +#define CATCH_CONFIG_POSIX_SIGNALS #endif // This is set by default, because we assume that compilers with no wchar_t support are just rare exceptions. #if !defined(CATCH_INTERNAL_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_WCHAR) -# define CATCH_CONFIG_WCHAR +#define CATCH_CONFIG_WCHAR #endif -#if !defined(CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_CPP11_TO_STRING) -# define CATCH_CONFIG_CPP11_TO_STRING +#if !defined(CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) && \ + !defined(CATCH_CONFIG_CPP11_TO_STRING) +#define CATCH_CONFIG_CPP11_TO_STRING #endif -#if defined(CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_NO_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_CPP17_OPTIONAL) -# define CATCH_CONFIG_CPP17_OPTIONAL +#if defined(CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_NO_CPP17_OPTIONAL) && \ + !defined(CATCH_CONFIG_CPP17_OPTIONAL) +#define CATCH_CONFIG_CPP17_OPTIONAL #endif -#if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_CPP17_STRING_VIEW) -# define CATCH_CONFIG_CPP17_STRING_VIEW +#if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) && \ + !defined(CATCH_CONFIG_CPP17_STRING_VIEW) +#define CATCH_CONFIG_CPP17_STRING_VIEW #endif -#if defined(CATCH_INTERNAL_CONFIG_CPP17_VARIANT) && !defined(CATCH_CONFIG_NO_CPP17_VARIANT) && !defined(CATCH_CONFIG_CPP17_VARIANT) -# define CATCH_CONFIG_CPP17_VARIANT +#if defined(CATCH_INTERNAL_CONFIG_CPP17_VARIANT) && !defined(CATCH_CONFIG_NO_CPP17_VARIANT) && \ + !defined(CATCH_CONFIG_CPP17_VARIANT) +#define CATCH_CONFIG_CPP17_VARIANT #endif -#if defined(CATCH_INTERNAL_CONFIG_CPP17_BYTE) && !defined(CATCH_CONFIG_NO_CPP17_BYTE) && !defined(CATCH_CONFIG_CPP17_BYTE) -# define CATCH_CONFIG_CPP17_BYTE +#if defined(CATCH_INTERNAL_CONFIG_CPP17_BYTE) && !defined(CATCH_CONFIG_NO_CPP17_BYTE) && \ + !defined(CATCH_CONFIG_CPP17_BYTE) +#define CATCH_CONFIG_CPP17_BYTE #endif #if defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT) -# define CATCH_INTERNAL_CONFIG_NEW_CAPTURE +#define CATCH_INTERNAL_CONFIG_NEW_CAPTURE #endif -#if defined(CATCH_INTERNAL_CONFIG_NEW_CAPTURE) && !defined(CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NEW_CAPTURE) -# define CATCH_CONFIG_NEW_CAPTURE +#if defined(CATCH_INTERNAL_CONFIG_NEW_CAPTURE) && !defined(CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE) && \ + !defined(CATCH_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NEW_CAPTURE) +#define CATCH_CONFIG_NEW_CAPTURE #endif #if !defined(CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) -# define CATCH_CONFIG_DISABLE_EXCEPTIONS +#define CATCH_CONFIG_DISABLE_EXCEPTIONS #endif -#if defined(CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_NO_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_POLYFILL_ISNAN) -# define CATCH_CONFIG_POLYFILL_ISNAN +#if defined(CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_NO_POLYFILL_ISNAN) && \ + !defined(CATCH_CONFIG_POLYFILL_ISNAN) +#define CATCH_CONFIG_POLYFILL_ISNAN #endif -#if defined(CATCH_INTERNAL_CONFIG_USE_ASYNC) && !defined(CATCH_INTERNAL_CONFIG_NO_ASYNC) && !defined(CATCH_CONFIG_NO_USE_ASYNC) && !defined(CATCH_CONFIG_USE_ASYNC) -# define CATCH_CONFIG_USE_ASYNC +#if defined(CATCH_INTERNAL_CONFIG_USE_ASYNC) && !defined(CATCH_INTERNAL_CONFIG_NO_ASYNC) && \ + !defined(CATCH_CONFIG_NO_USE_ASYNC) && !defined(CATCH_CONFIG_USE_ASYNC) +#define CATCH_CONFIG_USE_ASYNC #endif -#if defined(CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE) && !defined(CATCH_CONFIG_NO_ANDROID_LOGWRITE) && !defined(CATCH_CONFIG_ANDROID_LOGWRITE) -# define CATCH_CONFIG_ANDROID_LOGWRITE +#if defined(CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE) && !defined(CATCH_CONFIG_NO_ANDROID_LOGWRITE) && \ + !defined(CATCH_CONFIG_ANDROID_LOGWRITE) +#define CATCH_CONFIG_ANDROID_LOGWRITE #endif -#if defined(CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_NO_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_GLOBAL_NEXTAFTER) -# define CATCH_CONFIG_GLOBAL_NEXTAFTER +#if defined(CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_NO_GLOBAL_NEXTAFTER) && \ + !defined(CATCH_CONFIG_GLOBAL_NEXTAFTER) +#define CATCH_CONFIG_GLOBAL_NEXTAFTER #endif // Even if we do not think the compiler has that warning, we still have // to provide a macro that can be used by the code. #if !defined(CATCH_INTERNAL_START_WARNINGS_SUPPRESSION) -# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION +#define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION #endif #if !defined(CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION) -# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION +#define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION #endif #if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS +#define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS #endif #if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS +#define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS #endif #if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS +#define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS #endif #if !defined(CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS +#define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS #endif // The goal of this macro is to avoid evaluation of the arguments, but // still have the compiler warn on problems inside... #if !defined(CATCH_INTERNAL_IGNORE_BUT_WARN) -# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) +#define CATCH_INTERNAL_IGNORE_BUT_WARN(...) #endif #if defined(__APPLE__) && defined(__apple_build_version__) && (__clang_major__ < 10) -# undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS +#undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS #elif defined(__clang__) && (__clang_major__ < 5) -# undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS +#undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS #endif #if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS +#define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS #endif #if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) -#define CATCH_TRY if ((true)) -#define CATCH_CATCH_ALL if ((false)) +#define CATCH_TRY if ((true)) +#define CATCH_CATCH_ALL if ((false)) #define CATCH_CATCH_ANON(type) if ((false)) #else -#define CATCH_TRY try -#define CATCH_CATCH_ALL catch (...) +#define CATCH_TRY try +#define CATCH_CATCH_ALL catch (...) #define CATCH_CATCH_ANON(type) catch (type) #endif -#if defined(CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_NO_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) +#if defined(CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) && \ + !defined(CATCH_CONFIG_NO_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) #define CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR #endif // end catch_compiler_capabilities.h -#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line -#define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) +#define INTERNAL_CATCH_UNIQUE_NAME_LINE2(name, line) name##line +#define INTERNAL_CATCH_UNIQUE_NAME_LINE(name, line) INTERNAL_CATCH_UNIQUE_NAME_LINE2(name, line) #ifdef CATCH_CONFIG_COUNTER -# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ ) +#define INTERNAL_CATCH_UNIQUE_NAME(name) INTERNAL_CATCH_UNIQUE_NAME_LINE(name, __COUNTER__) #else -# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ ) +#define INTERNAL_CATCH_UNIQUE_NAME(name) INTERNAL_CATCH_UNIQUE_NAME_LINE(name, __LINE__) #endif #include @@ -476,84 +484,91 @@ namespace Catch { #include // We need a dummy global operator<< so we can bring it into Catch namespace later -struct Catch_global_namespace_dummy {}; +struct Catch_global_namespace_dummy +{}; std::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy); namespace Catch { - struct CaseSensitive { enum Choice { - Yes, - No - }; }; +struct CaseSensitive +{ + enum Choice { Yes, No }; +}; - class NonCopyable { - NonCopyable( NonCopyable const& ) = delete; - NonCopyable( NonCopyable && ) = delete; - NonCopyable& operator = ( NonCopyable const& ) = delete; - NonCopyable& operator = ( NonCopyable && ) = delete; +class NonCopyable +{ + NonCopyable(NonCopyable const&) = delete; + NonCopyable(NonCopyable&&) = delete; + NonCopyable& operator=(NonCopyable const&) = delete; + NonCopyable& operator=(NonCopyable&&) = delete; - protected: - NonCopyable(); - virtual ~NonCopyable(); - }; + protected: + NonCopyable(); + virtual ~NonCopyable(); +}; - struct SourceLineInfo { +struct SourceLineInfo +{ + SourceLineInfo() = delete; + SourceLineInfo(char const* _file, std::size_t _line) noexcept + : file(_file) + , line(_line) + {} - SourceLineInfo() = delete; - SourceLineInfo( char const* _file, std::size_t _line ) noexcept - : file( _file ), - line( _line ) - {} + SourceLineInfo(SourceLineInfo const& other) = default; + SourceLineInfo& operator=(SourceLineInfo const&) = default; + SourceLineInfo(SourceLineInfo&&) noexcept = default; + SourceLineInfo& operator=(SourceLineInfo&&) noexcept = default; - SourceLineInfo( SourceLineInfo const& other ) = default; - SourceLineInfo& operator = ( SourceLineInfo const& ) = default; - SourceLineInfo( SourceLineInfo&& ) noexcept = default; - SourceLineInfo& operator = ( SourceLineInfo&& ) noexcept = default; + bool empty() const noexcept { return file[0] == '\0'; } + bool operator==(SourceLineInfo const& other) const noexcept; + bool operator<(SourceLineInfo const& other) const noexcept; - bool empty() const noexcept { return file[0] == '\0'; } - bool operator == ( SourceLineInfo const& other ) const noexcept; - bool operator < ( SourceLineInfo const& other ) const noexcept; + char const* file; + std::size_t line; +}; - char const* file; - std::size_t line; - }; +std::ostream& operator<<(std::ostream& os, SourceLineInfo const& info); - std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ); +// Bring in operator<< from global namespace into Catch namespace +// This is necessary because the overload of operator<< above makes +// lookup stop at namespace Catch +using ::operator<<; - // Bring in operator<< from global namespace into Catch namespace - // This is necessary because the overload of operator<< above makes - // lookup stop at namespace Catch - using ::operator<<; - - // Use this in variadic streaming macros to allow - // >> +StreamEndStop - // as well as - // >> stuff +StreamEndStop - struct StreamEndStop { - std::string operator+() const; - }; - template - T const& operator + ( T const& value, StreamEndStop ) { - return value; - } +// Use this in variadic streaming macros to allow +// >> +StreamEndStop +// as well as +// >> stuff +StreamEndStop +struct StreamEndStop +{ + std::string operator+() const; +}; +template +T const& operator+(T const& value, StreamEndStop) +{ + return value; } +} // namespace Catch -#define CATCH_INTERNAL_LINEINFO \ - ::Catch::SourceLineInfo( __FILE__, static_cast( __LINE__ ) ) +#define CATCH_INTERNAL_LINEINFO ::Catch::SourceLineInfo(__FILE__, static_cast(__LINE__)) // end catch_common.h namespace Catch { - struct RegistrarForTagAliases { - RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo ); - }; +struct RegistrarForTagAliases +{ + RegistrarForTagAliases(char const* alias, char const* tag, SourceLineInfo const& lineInfo); +}; } // end namespace Catch -#define CATCH_REGISTER_TAG_ALIAS( alias, spec ) \ - CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ - CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - namespace{ Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME( AutoRegisterTagAlias )( alias, spec, CATCH_INTERNAL_LINEINFO ); } \ +#define CATCH_REGISTER_TAG_ALIAS(alias, spec) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace { \ + Catch::RegistrarForTagAliases \ + INTERNAL_CATCH_UNIQUE_NAME(AutoRegisterTagAlias)(alias, spec, CATCH_INTERNAL_LINEINFO); \ + } \ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION // end catch_tag_alias_autoregistrar.h @@ -565,28 +580,31 @@ namespace Catch { namespace Catch { - class TestSpec; +class TestSpec; - struct ITestInvoker { - virtual void invoke () const = 0; - virtual ~ITestInvoker(); - }; +struct ITestInvoker +{ + virtual void invoke() const = 0; + virtual ~ITestInvoker(); +}; - class TestCase; - struct IConfig; +class TestCase; +struct IConfig; - struct ITestCaseRegistry { - virtual ~ITestCaseRegistry(); - virtual std::vector const& getAllTests() const = 0; - virtual std::vector const& getAllTestsSorted( IConfig const& config ) const = 0; - }; +struct ITestCaseRegistry +{ + virtual ~ITestCaseRegistry(); + virtual std::vector const& getAllTests() const = 0; + virtual std::vector const& getAllTestsSorted(IConfig const& config) const = 0; +}; - bool isThrowSafe( TestCase const& testCase, IConfig const& config ); - bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ); - std::vector filterTests( std::vector const& testCases, TestSpec const& testSpec, IConfig const& config ); - std::vector const& getAllTestCasesSorted( IConfig const& config ); +bool isThrowSafe(TestCase const& testCase, IConfig const& config); +bool matchTest(TestCase const& testCase, TestSpec const& testSpec, IConfig const& config); +std::vector + filterTests(std::vector const& testCases, TestSpec const& testSpec, IConfig const& config); +std::vector const& getAllTestCasesSorted(IConfig const& config); -} +} // namespace Catch // end catch_interfaces_testcase.h // start catch_stringref.h @@ -598,96 +616,89 @@ namespace Catch { namespace Catch { - /// A non-owning string class (similar to the forthcoming std::string_view) - /// Note that, because a StringRef may be a substring of another string, - /// it may not be null terminated. - class StringRef { - public: - using size_type = std::size_t; - using const_iterator = const char*; +/// A non-owning string class (similar to the forthcoming std::string_view) +/// Note that, because a StringRef may be a substring of another string, +/// it may not be null terminated. +class StringRef +{ + public: + using size_type = std::size_t; + using const_iterator = const char*; - private: - static constexpr char const* const s_empty = ""; + private: + static constexpr char const* const s_empty = ""; - char const* m_start = s_empty; - size_type m_size = 0; + char const* m_start = s_empty; + size_type m_size = 0; - public: // construction - constexpr StringRef() noexcept = default; + public: // construction + constexpr StringRef() noexcept = default; - StringRef( char const* rawChars ) noexcept; + StringRef(char const* rawChars) noexcept; - constexpr StringRef( char const* rawChars, size_type size ) noexcept - : m_start( rawChars ), - m_size( size ) - {} + constexpr StringRef(char const* rawChars, size_type size) noexcept + : m_start(rawChars) + , m_size(size) + {} - StringRef( std::string const& stdString ) noexcept - : m_start( stdString.c_str() ), - m_size( stdString.size() ) - {} + StringRef(std::string const& stdString) noexcept + : m_start(stdString.c_str()) + , m_size(stdString.size()) + {} - explicit operator std::string() const { - return std::string(m_start, m_size); - } + explicit operator std::string() const { return std::string(m_start, m_size); } - public: // operators - auto operator == ( StringRef const& other ) const noexcept -> bool; - auto operator != (StringRef const& other) const noexcept -> bool { - return !(*this == other); - } + public: // operators + auto operator==(StringRef const& other) const noexcept -> bool; + auto operator!=(StringRef const& other) const noexcept -> bool { return !(*this == other); } - auto operator[] ( size_type index ) const noexcept -> char { - assert(index < m_size); - return m_start[index]; - } - - public: // named queries - constexpr auto empty() const noexcept -> bool { - return m_size == 0; - } - constexpr auto size() const noexcept -> size_type { - return m_size; - } - - // Returns the current start pointer. If the StringRef is not - // null-terminated, throws std::domain_exception - auto c_str() const -> char const*; - - public: // substrings and searches - // Returns a substring of [start, start + length). - // If start + length > size(), then the substring is [start, size()). - // If start > size(), then the substring is empty. - auto substr( size_type start, size_type length ) const noexcept -> StringRef; - - // Returns the current start pointer. May not be null-terminated. - auto data() const noexcept -> char const*; - - constexpr auto isNullTerminated() const noexcept -> bool { - return m_start[m_size] == '\0'; - } - - public: // iterators - constexpr const_iterator begin() const { return m_start; } - constexpr const_iterator end() const { return m_start + m_size; } - }; - - auto operator += ( std::string& lhs, StringRef const& sr ) -> std::string&; - auto operator << ( std::ostream& os, StringRef const& sr ) -> std::ostream&; - - constexpr auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef { - return StringRef( rawChars, size ); + auto operator[](size_type index) const noexcept -> char + { + assert(index < m_size); + return m_start[index]; } + + public: // named queries + constexpr auto empty() const noexcept -> bool { return m_size == 0; } + constexpr auto size() const noexcept -> size_type { return m_size; } + + // Returns the current start pointer. If the StringRef is not + // null-terminated, throws std::domain_exception + auto c_str() const -> char const*; + + public: // substrings and searches + // Returns a substring of [start, start + length). + // If start + length > size(), then the substring is [start, size()). + // If start > size(), then the substring is empty. + auto substr(size_type start, size_type length) const noexcept -> StringRef; + + // Returns the current start pointer. May not be null-terminated. + auto data() const noexcept -> char const*; + + constexpr auto isNullTerminated() const noexcept -> bool { return m_start[m_size] == '\0'; } + + public: // iterators + constexpr const_iterator begin() const { return m_start; } + constexpr const_iterator end() const { return m_start + m_size; } +}; + +auto operator+=(std::string& lhs, StringRef const& sr) -> std::string&; +auto operator<<(std::ostream& os, StringRef const& sr) -> std::ostream&; + +constexpr auto operator"" _sr(char const* rawChars, std::size_t size) noexcept -> StringRef +{ + return StringRef(rawChars, size); +} } // namespace Catch -constexpr auto operator "" _catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef { - return Catch::StringRef( rawChars, size ); +constexpr auto operator"" _catch_sr(char const* rawChars, std::size_t size) noexcept -> Catch::StringRef +{ + return Catch::StringRef(rawChars, size); } // end catch_stringref.h // start catch_preprocessor.hpp - #define CATCH_RECURSION_LEVEL0(...) __VA_ARGS__ #define CATCH_RECURSION_LEVEL1(...) CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(__VA_ARGS__))) #define CATCH_RECURSION_LEVEL2(...) CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(__VA_ARGS__))) @@ -699,9 +710,9 @@ constexpr auto operator "" _catch_sr( char const* rawChars, std::size_t size ) n #define INTERNAL_CATCH_EXPAND_VARGS(...) __VA_ARGS__ // MSVC needs more evaluations #define CATCH_RECURSION_LEVEL6(...) CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(__VA_ARGS__))) -#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL6(CATCH_RECURSION_LEVEL6(__VA_ARGS__)) +#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL6(CATCH_RECURSION_LEVEL6(__VA_ARGS__)) #else -#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL5(__VA_ARGS__) +#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL5(__VA_ARGS__) #endif #define CATCH_REC_END(...) @@ -710,41 +721,46 @@ constexpr auto operator "" _catch_sr( char const* rawChars, std::size_t size ) n #define CATCH_EMPTY() #define CATCH_DEFER(id) id CATCH_EMPTY() -#define CATCH_REC_GET_END2() 0, CATCH_REC_END -#define CATCH_REC_GET_END1(...) CATCH_REC_GET_END2 -#define CATCH_REC_GET_END(...) CATCH_REC_GET_END1 +#define CATCH_REC_GET_END2() 0, CATCH_REC_END +#define CATCH_REC_GET_END1(...) CATCH_REC_GET_END2 +#define CATCH_REC_GET_END(...) CATCH_REC_GET_END1 #define CATCH_REC_NEXT0(test, next, ...) next CATCH_REC_OUT -#define CATCH_REC_NEXT1(test, next) CATCH_DEFER ( CATCH_REC_NEXT0 ) ( test, next, 0) -#define CATCH_REC_NEXT(test, next) CATCH_REC_NEXT1(CATCH_REC_GET_END test, next) +#define CATCH_REC_NEXT1(test, next) CATCH_DEFER(CATCH_REC_NEXT0)(test, next, 0) +#define CATCH_REC_NEXT(test, next) CATCH_REC_NEXT1(CATCH_REC_GET_END test, next) -#define CATCH_REC_LIST0(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST1(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0) ) ( f, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST2(f, x, peek, ...) f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ ) +#define CATCH_REC_LIST0(f, x, peek, ...) , f(x) CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST1))(f, peek, __VA_ARGS__) +#define CATCH_REC_LIST1(f, x, peek, ...) , f(x) CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST0))(f, peek, __VA_ARGS__) +#define CATCH_REC_LIST2(f, x, peek, ...) f(x) CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST1))(f, peek, __VA_ARGS__) -#define CATCH_REC_LIST0_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST1_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0_UD) ) ( f, userdata, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST2_UD(f, userdata, x, peek, ...) f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ ) +#define CATCH_REC_LIST0_UD(f, userdata, x, peek, ...) \ + , f(userdata, x) CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD))(f, userdata, peek, __VA_ARGS__) +#define CATCH_REC_LIST1_UD(f, userdata, x, peek, ...) \ + , f(userdata, x) CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST0_UD))(f, userdata, peek, __VA_ARGS__) +#define CATCH_REC_LIST2_UD(f, userdata, x, peek, ...) \ + f(userdata, x) CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD))(f, userdata, peek, __VA_ARGS__) // Applies the function macro `f` to each of the remaining parameters, inserts commas between the results, // and passes userdata as the first parameter to each invocation, // e.g. CATCH_REC_LIST_UD(f, x, a, b, c) evaluates to f(x, a), f(x, b), f(x, c) -#define CATCH_REC_LIST_UD(f, userdata, ...) CATCH_RECURSE(CATCH_REC_LIST2_UD(f, userdata, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) +#define CATCH_REC_LIST_UD(f, userdata, ...) \ + CATCH_RECURSE(CATCH_REC_LIST2_UD(f, userdata, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) #define CATCH_REC_LIST(f, ...) CATCH_RECURSE(CATCH_REC_LIST2(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) #define INTERNAL_CATCH_EXPAND1(param) INTERNAL_CATCH_EXPAND2(param) -#define INTERNAL_CATCH_EXPAND2(...) INTERNAL_CATCH_NO## __VA_ARGS__ -#define INTERNAL_CATCH_DEF(...) INTERNAL_CATCH_DEF __VA_ARGS__ +#define INTERNAL_CATCH_EXPAND2(...) INTERNAL_CATCH_NO##__VA_ARGS__ +#define INTERNAL_CATCH_DEF(...) INTERNAL_CATCH_DEF __VA_ARGS__ #define INTERNAL_CATCH_NOINTERNAL_CATCH_DEF #define INTERNAL_CATCH_STRINGIZE(...) INTERNAL_CATCH_STRINGIZE2(__VA_ARGS__) #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define INTERNAL_CATCH_STRINGIZE2(...) #__VA_ARGS__ +#define INTERNAL_CATCH_STRINGIZE2(...) #__VA_ARGS__ #define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) #else // MSVC is adding extra space and needs another indirection to expand INTERNAL_CATCH_NOINTERNAL_CATCH_DEF #define INTERNAL_CATCH_STRINGIZE2(...) INTERNAL_CATCH_STRINGIZE3(__VA_ARGS__) #define INTERNAL_CATCH_STRINGIZE3(...) #__VA_ARGS__ -#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) (INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) + 1) +#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) \ + (INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) + 1) #endif #define INTERNAL_CATCH_MAKE_NAMESPACE2(...) ns_##__VA_ARGS__ @@ -754,587 +770,1187 @@ constexpr auto operator "" _catch_sr( char const* rawChars, std::size_t size ) n #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR #define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) decltype(get_wrapper()) -#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__)) +#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__)) #else -#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) INTERNAL_CATCH_EXPAND_VARGS(decltype(get_wrapper())) -#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__))) +#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) \ + INTERNAL_CATCH_EXPAND_VARGS(decltype(get_wrapper())) +#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) \ + INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__))) #endif -#define INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(...)\ - CATCH_REC_LIST(INTERNAL_CATCH_MAKE_TYPE_LIST,__VA_ARGS__) +#define INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(...) CATCH_REC_LIST(INTERNAL_CATCH_MAKE_TYPE_LIST, __VA_ARGS__) #define INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_0) INTERNAL_CATCH_REMOVE_PARENS(_0) -#define INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_0, _1) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_1) -#define INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_0, _1, _2) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_1, _2) -#define INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_0, _1, _2, _3) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_1, _2, _3) -#define INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_0, _1, _2, _3, _4) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_1, _2, _3, _4) -#define INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_0, _1, _2, _3, _4, _5) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_1, _2, _3, _4, _5) -#define INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_0, _1, _2, _3, _4, _5, _6) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_1, _2, _3, _4, _5, _6) -#define INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_0, _1, _2, _3, _4, _5, _6, _7) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_1, _2, _3, _4, _5, _6, _7) -#define INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_1, _2, _3, _4, _5, _6, _7, _8) -#define INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9) -#define INTERNAL_CATCH_REMOVE_PARENS_11_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) +#define INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_0, _1) \ + INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_1) +#define INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_0, _1, _2) \ + INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_1, _2) +#define INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_0, _1, _2, _3) \ + INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_1, _2, _3) +#define INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_0, _1, _2, _3, _4) \ + INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_1, _2, _3, _4) +#define INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_0, _1, _2, _3, _4, _5) \ + INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_1, _2, _3, _4, _5) +#define INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_0, _1, _2, _3, _4, _5, _6) \ + INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_1, _2, _3, _4, _5, _6) +#define INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_0, _1, _2, _3, _4, _5, _6, _7) \ + INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_1, _2, _3, _4, _5, _6, _7) +#define INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8) \ + INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_1, _2, _3, _4, _5, _6, _7, _8) +#define INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \ + INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9) +#define INTERNAL_CATCH_REMOVE_PARENS_11_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \ + INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) #define INTERNAL_CATCH_VA_NARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N -#define INTERNAL_CATCH_TYPE_GEN\ - template struct TypeList {};\ - template\ - constexpr auto get_wrapper() noexcept -> TypeList { return {}; }\ - template class...> struct TemplateTypeList{};\ - template class...Cs>\ - constexpr auto get_wrapper() noexcept -> TemplateTypeList { return {}; }\ - template\ - struct append;\ - template\ - struct rewrap;\ - template class, typename...>\ - struct create;\ - template class, typename>\ - struct convert;\ - \ - template \ - struct append { using type = T; };\ - template< template class L1, typename...E1, template class L2, typename...E2, typename...Rest>\ - struct append, L2, Rest...> { using type = typename append, Rest...>::type; };\ - template< template class L1, typename...E1, typename...Rest>\ - struct append, TypeList, Rest...> { using type = L1; };\ - \ - template< template class Container, template class List, typename...elems>\ - struct rewrap, List> { using type = TypeList>; };\ - template< template class Container, template class List, class...Elems, typename...Elements>\ - struct rewrap, List, Elements...> { using type = typename append>, typename rewrap, Elements...>::type>::type; };\ - \ - template