summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore4
-rw-r--r--.gitmodules4
-rw-r--r--.travis.yml2
-rw-r--r--Makefile3
-rw-r--r--README.md3
-rwxr-xr-xbin/build-shaders.js133
-rw-r--r--bin/lazy-update.js12
-rw-r--r--bin/package.json8
-rwxr-xr-xconfigure24
-rw-r--r--gyp/npm_install.gypi20
-rw-r--r--gyp/shaders.gypi6
-rw-r--r--include/mbgl/platform/gl.hpp1
-rw-r--r--include/mbgl/util/utf.hpp14
-rw-r--r--include/mbgl/util/uv-messenger.h3
-rw-r--r--mapboxgl.gyp1
-rw-r--r--scripts/build-shaders.py104
-rwxr-xr-xscripts/compare_images.sh6
-rwxr-xr-xscripts/travis_before_install.sh28
-rwxr-xr-xscripts/travis_install_test_suite.sh9
-rwxr-xr-xscripts/travis_script.sh16
-rw-r--r--src/csscolorparser/csscolorparser.cpp15
-rw-r--r--src/geometry/debug_font_buffer.cpp14
-rw-r--r--src/geometry/debug_font_data.hpp (renamed from src/geometry/debug_font.cpp)200
-rw-r--r--src/storage/file_source.cpp6
-rw-r--r--src/util/uv-messenger.c9
-rw-r--r--src/util/uv-worker.c6
-rw-r--r--test/fixtures/fixture_request.cpp2
-rw-r--r--test/headless.cpp2
m---------test/suite0
29 files changed, 275 insertions, 380 deletions
diff --git a/.gitignore b/.gitignore
index 04eb4ad884..bce644c7e8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,15 +3,11 @@
*.o
*.actual.png
*.diff.png
-/node_modules
/mason_packages
-/macosx/build
-/ios/build
/config.gypi
/config-ios.gypi
/config/constants_local.cpp
/build
-/bin/node_modules
/include/mbgl/shader/shaders.hpp
/src/shader/shaders_gl.cpp
/src/shader/shaders_gles2.cpp
diff --git a/.gitmodules b/.gitmodules
index a1359e7398..850e0c7e2b 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,7 @@
[submodule "ios/mapbox-gl-cocoa"]
path = ios/mapbox-gl-cocoa
url = https://github.com/mapbox/mapbox-gl-cocoa.git
+
+[submodule "test/suite"]
+ path = test/suite
+ url = https://github.com/mapbox/mapbox-gl-test-suite.git
diff --git a/.travis.yml b/.travis.yml
index 065856d605..8edbe3c157 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -29,11 +29,11 @@ before_install:
- source ./scripts/flags.sh
- (git clone https://github.com/mapbox/mason.git ~/.mason ; sudo ln -s ~/.mason/mason /usr/local/bin/mason)
- ./scripts/travis_before_install.sh
+- if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then export LD_LIBRARY_PATH=`mason prefix mesa 10.3.1`/lib; fi
- if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then glxinfo; fi
install:
- make config.gypi
-- ./scripts/travis_install_test_suite.sh
- ulimit -c
before_script:
diff --git a/Makefile b/Makefile
index 3216cc4223..73e4c87999 100644
--- a/Makefile
+++ b/Makefile
@@ -130,5 +130,8 @@ lproj: build/linux/mapboxgl-app.xcodeproj
clean: clear_xcode_cache
-find ./deps/gyp -name "*.pyc" -exec rm {} \;
-rm -rf ./build/
+ -rm -rf ./macosx/build/
-rm -rf ./config.gypi ./config-ios.gypi
+
+distclean: clean
-rm -rf ./mason_packages
diff --git a/README.md b/README.md
index 069054c5f5..022377e990 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,6 @@ implemented in C++11, currently targeting iOS, OS X, and Ubuntu Linux.
- `pkg-config` (for build only)
- [Homebrew](http://brew.sh) (for build on OS X)
- Python 2.x (for build only)
- - Node.js (for build only)
# Build instructions
@@ -109,7 +108,7 @@ Or proceed to building the debug application with:
To trigger a complete rebuild, run `make clean` and then start over generating the Xcode projects or Makefiles as described above.
-This will also blow away the `mason_packages` directory. This means the Makefile and configure script will automatically install the dependencies again on the next try.
+If you are having trouble getting the dependencies right, you can blow away the `mason_packages` directory, or run `make distclean`. This means the Makefile and configure script will automatically install the dependencies again on the next try.
On OS X, you can also try clearing the Xcode cache with `make clear_xcode_cache`.
diff --git a/bin/build-shaders.js b/bin/build-shaders.js
deleted file mode 100755
index 329f8063f7..0000000000
--- a/bin/build-shaders.js
+++ /dev/null
@@ -1,133 +0,0 @@
-#!/usr/bin/env node
-'use strict';
-
-var fs = require('fs');
-var path = require('path');
-var mkdirp = require('mkdirp');
-
-try { var glsl = require('mapbox-glsl-optimizer'); } catch(err) {}
-
-module.exports = function(shader_type, prefix, suffix) {
- var name;
- var shaders = {};
-
- var shaderFiles = fs.readdirSync('src/shader');
-
- // Load shaders
- for (var i = 0; i < shaderFiles.length; i++) {
- var parts = shaderFiles[i].match(/^(.+)\.(vertex|fragment)\.glsl$/);
- if (parts) {
- name = parts[1];
- var type = parts[2];
- if (!(name in shaders)) {
- shaders[name] = {};
- }
- shaders[name][type] = fs.readFileSync(path.join('src/shader', shaderFiles[i]), 'utf8');
- }
- }
-
- var preamble = '';
- if (shader_type == 'gles2' || shader_type == 'gles3') {
- preamble = 'precision highp float;';
- } else {
- preamble = '#version 120';
- }
-
- for (var name in shaders) {
- shaders[name].vertex = preamble + '\n' + shaders[name].vertex;
- shaders[name].fragment = preamble + '\n' + shaders[name].fragment;
- }
-
- // Optimize shader
- if (glsl) {
- var target = shader_type == 'gles2' ? glsl.TARGET_OPENGLES20 : (shader_type == 'gles3' ? glsl.TARGET_OPENGLES30 : glsl.TARGET_OPENGL);
-
- var compiler = new glsl.Compiler(target);
- for (name in shaders) {
- var vertex_shader = new glsl.Shader(compiler, glsl.VERTEX_SHADER, shaders[name].vertex);
- if (vertex_shader.compiled()) {
- shaders[name].vertex = vertex_shader.output();
- } else {
- console.warn('failed to optimize %s vertex shader', name);
- process.exit(1);
- }
- vertex_shader.dispose();
-
- var fragment_shader = new glsl.Shader(compiler, glsl.FRAGMENT_SHADER, shaders[name].fragment);
- if (fragment_shader.compiled()) {
- shaders[name].fragment = fragment_shader.output();
- } else {
- console.warn('failed to optimize %s fragment shader', name);
- process.exit(1);
- }
- fragment_shader.dispose();
- }
- compiler.dispose();
- } else {
- console.warn('Not optimizing shaders');
- }
-
-
- // Save to file
- var lines = [];
- var consts = [];
- for (var name in shaders) {
- consts.push(name.toUpperCase() + '_SHADER');
-
- var line = '';
- line += ' {\n';
- line += ' ' + JSON.stringify(shaders[name].vertex) + ',\n';
- line += ' ' + JSON.stringify(shaders[name].fragment) + ',\n';
- line += ' }';
- lines.push(line);
- }
-
- var header = '// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.\n\n';
- header += '#ifndef MBGL_SHADER_SHADERS\n';
- header += '#define MBGL_SHADER_SHADERS\n';
- header += '\n';
- header += 'namespace mbgl {\n';
- header += '\n';
- header += 'struct shader_source {\n';
- header += ' const char *vertex;\n';
- header += ' const char *fragment;\n';
- header += '};\n';
- header += '\n';
- header += 'enum {\n';
- consts.push('SHADER_COUNT');
- header += ' ' + consts.join(',\n ') + '\n';
- header += '};\n';
- header += '\n';
- header += 'extern const shader_source shaders[SHADER_COUNT];\n';
- header += '\n';
- header += '}\n';
- header += '\n';
- header += '#endif\n';
-
-
- var code = '// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.\n';
- code += '#include <mbgl/platform/gl.hpp>\n';
- code += prefix + '\n';
- code += '#include <mbgl/shader/shaders.hpp>\n';
- code += '\n';
- code += 'namespace mbgl {\n';
- code += '\n';
- code += 'const shader_source shaders[SHADER_COUNT] = {\n';
- code += lines.join(',\n');
- code += '\n};\n';
- code += '\n}\n';
- code += suffix + '\n';
-
- var header_path = path.join(process.argv[2], 'include/mbgl/shader/shaders.hpp');
- mkdirp.sync(path.dirname(header_path));
- fs.writeFileSync(header_path, header);
- console.warn('wrote file ' + header_path);
- var file_path = path.join(process.argv[2], 'src/shader/shaders_' + shader_type + '.cpp');
- mkdirp.sync(path.dirname(file_path));
- fs.writeFileSync(file_path, code);
- console.warn('wrote file ' + file_path);
-
-};
-
-module.exports('gl', '#ifndef GL_ES_VERSION_2_0', '#endif');
-module.exports('gles2', '#ifdef GL_ES_VERSION_2_0', '#endif');
diff --git a/bin/lazy-update.js b/bin/lazy-update.js
deleted file mode 100644
index 0f3ea81ac5..0000000000
--- a/bin/lazy-update.js
+++ /dev/null
@@ -1,12 +0,0 @@
-var fs = require('fs');
-
-module.exports = function(file, content) {
- try {
- var existing = fs.readFileSync(file, 'utf8');
- if (existing != content) {
- fs.writeFileSync(file, content);
- }
- } catch(err) {
- fs.writeFileSync(file, content);
- }
-};
diff --git a/bin/package.json b/bin/package.json
deleted file mode 100644
index 1df8454600..0000000000
--- a/bin/package.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "name": "mbgl-native",
- "version": "0.0.1",
- "dependencies": {
- "mapbox-glsl-optimizer": "~0.1.0",
- "mkdirp": "^0.5.0"
- }
-}
diff --git a/configure b/configure
index cc96f038b0..8b82a72083 100755
--- a/configure
+++ b/configure
@@ -15,22 +15,6 @@ function finish {
}
trap finish EXIT
-# Install node
-if [[ ! -d ~/.nvm ]]; then
- git clone --depth 1 https://github.com/creationix/nvm.git ~/.nvm
-fi
-set +u
-. ~/.nvm/nvm.sh
-if [ ! `nvm use 0.10 > /dev/null; echo $?` = 0 ]; then
- >&2 echo -en "\033[1m\033[32m* "
- nvm install 0.10
- >&2 echo -en "\033[0m";
-else
- >&2 echo -en "\033[1m\033[32m* "
- nvm use 0.10
- >&2 echo -en "\033[0m";
-fi
-
# Install mason
if [[ ! -d ~/.mason ]]; then
>&2 echo -e "\033[1m\033[32m* Installing Mason\033[0m"
@@ -58,14 +42,8 @@ esac
function abort { >&2 echo -e "\033[1m\033[31m$1\033[0m"; exit 1; }
-NODE=`which node || abort 'Cannot find node'`
-NPM=`which npm || abort 'Cannot find npm'`
PYTHON=`which python || abort 'Cannot find python'`
->&2 echo -en "\033[1m\033[32m* Using npm "
->&2 ${NPM} --version
->&2 echo -en "\033[0m";
-
>&2 echo -en "\033[1m\033[32m* Using "
>&2 ${PYTHON} --version
>&2 echo -en "\033[0m";
@@ -86,8 +64,6 @@ CONFIG="# Do not edit. Generated by the configure script.
'libraries': []
},
'variables': {
- 'node': '${NODE}',
- 'npm': '${NPM}',
'python': '${PYTHON}',
"
diff --git a/gyp/npm_install.gypi b/gyp/npm_install.gypi
deleted file mode 100644
index ddd3081ad5..0000000000
--- a/gyp/npm_install.gypi
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- 'targets': [
- { 'target_name': 'npm_install',
- 'type': 'none',
- 'hard_dependency': 1,
- 'actions': [
- {
- 'action_name': 'npm install',
- 'inputs': [
- '../bin/package.json',
- ],
- 'outputs': [
- '../bin/node_modules',
- ],
- 'action': ['./scripts/npm_install.sh', '<@(npm)']
- }
- ],
- },
- ]
-}
diff --git a/gyp/shaders.gypi b/gyp/shaders.gypi
index 9435bd7d9c..edbcb61f23 100644
--- a/gyp/shaders.gypi
+++ b/gyp/shaders.gypi
@@ -4,13 +4,11 @@
'target_name': 'shaders',
'type': 'none',
'hard_dependency': 1,
- 'dependencies': [
- 'npm_install'
- ],
'actions': [
{
'action_name': 'Build Shaders',
'inputs': [
+ '../scripts/build-shaders.py',
'<!@(find src -name "*.glsl")'
],
'outputs': [
@@ -18,7 +16,7 @@
'<(SHARED_INTERMEDIATE_DIR)/src/shader/shaders_gl.cpp',
'<(SHARED_INTERMEDIATE_DIR)/src/shader/shaders_gles2.cpp',
],
- 'action': ['<@(node)', 'bin/build-shaders.js', '<(SHARED_INTERMEDIATE_DIR)'],
+ 'action': ['<@(python)', 'scripts/build-shaders.py', '<(SHARED_INTERMEDIATE_DIR)', '<@(_inputs)'],
}
],
'direct_dependent_settings': {
diff --git a/include/mbgl/platform/gl.hpp b/include/mbgl/platform/gl.hpp
index cc2a681d42..d5162f2c70 100644
--- a/include/mbgl/platform/gl.hpp
+++ b/include/mbgl/platform/gl.hpp
@@ -38,7 +38,6 @@
#else
#define GL_GLEXT_PROTOTYPES
#include <GL/gl.h>
- #include <GL/glu.h>
#include <GL/glext.h>
#endif
diff --git a/include/mbgl/util/utf.hpp b/include/mbgl/util/utf.hpp
index bb63179123..ddf0ff3069 100644
--- a/include/mbgl/util/utf.hpp
+++ b/include/mbgl/util/utf.hpp
@@ -4,10 +4,11 @@
#include <memory>
// g++/libstdc++ is missing c++11 codecvt support
-#if ! defined(__clang__) || defined(__linux__)
+#if 1//! defined(__clang__) || defined(__linux__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
-#include <boost/locale.hpp>
+//#include <boost/locale.hpp>
+#include <boost/regex/pending/unicode_iterator.hpp>
#pragma GCC diagnostic pop
#else
// Assume that codecvt is present on clang on non-linux systems
@@ -19,13 +20,16 @@ namespace mbgl {
namespace util {
-#if ! defined(__clang__) || defined(__linux__)
+#if 1 //! defined(__clang__) || defined(__linux__)
class utf8_to_utf32 {
public:
explicit utf8_to_utf32() {}
- std::u32string convert(std::string const& utf8) {
- return boost::locale::conv::utf_to_utf<char32_t>(utf8);
+ std::u32string convert(std::string const& utf8)
+ {
+ boost::u8_to_u32_iterator<std::string::const_iterator> begin(utf8.begin());
+ boost::u8_to_u32_iterator<std::string::const_iterator> end(utf8.end());
+ return std::u32string(begin,end);
}
};
diff --git a/include/mbgl/util/uv-messenger.h b/include/mbgl/util/uv-messenger.h
index 82b8ef2d9c..946867fe8b 100644
--- a/include/mbgl/util/uv-messenger.h
+++ b/include/mbgl/util/uv-messenger.h
@@ -15,13 +15,14 @@ struct uv_messenger_s {
uv_mutex_t mutex;
uv_async_t async;
uv_messenger_cb callback;
+ uv_messenger_stop_cb stop_callback;
void *data;
void *queue[2];
};
int uv_messenger_init(uv_loop_t *loop, uv_messenger_t *msgr, uv_messenger_cb callback);
void uv_messenger_send(uv_messenger_t *msgr, void *arg);
-void uv_messenger_stop(uv_messenger_t *msgr);
+void uv_messenger_stop(uv_messenger_t *msgr, uv_messenger_stop_cb stop_callback);
void uv_messenger_ref(uv_messenger_t *msgr);
void uv_messenger_unref(uv_messenger_t *msgr);
diff --git a/mapboxgl.gyp b/mapboxgl.gyp
index cca803b338..69cc31016a 100644
--- a/mapboxgl.gyp
+++ b/mapboxgl.gyp
@@ -2,7 +2,6 @@
'includes': [
'./gyp/common.gypi',
'./gyp/shaders.gypi',
- './gyp/npm_install.gypi',
'./gyp/styles.gypi',
'./gyp/fixtures.gypi',
'./gyp/certificates.gypi',
diff --git a/scripts/build-shaders.py b/scripts/build-shaders.py
new file mode 100644
index 0000000000..c1d7f7f28d
--- /dev/null
+++ b/scripts/build-shaders.py
@@ -0,0 +1,104 @@
+#!/usr/bin/env python
+
+import sys, re, os, errno
+
+
+output_dir = sys.argv[1]
+file_names = sys.argv[2:]
+
+
+def mkdir_p(path):
+ try:
+ os.makedirs(path)
+ except OSError as exc: # Python >2.5
+ if exc.errno == errno.EEXIST and os.path.isdir(path):
+ pass
+ else: raise
+
+# Load all shaders
+shaders = {}
+for file_name in file_names:
+ parts = re.search('/(\w+)\.(vertex|fragment)\.glsl$', file_name)
+ if parts:
+ shader_name = parts.group(1)
+ shader_type = parts.group(2)
+ if not shader_name in shaders:
+ shaders[shader_name] = {}
+ with open(file_name, "r") as f:
+ shaders[shader_name][shader_type] = f.read()
+
+
+def write_header():
+ header = """// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
+
+#ifndef MBGL_SHADER_SHADERS
+#define MBGL_SHADER_SHADERS
+
+namespace mbgl {
+
+struct shader_source {
+ const char *vertex;
+ const char *fragment;
+};
+
+enum {
+%s
+ SHADER_COUNT
+};
+
+extern const shader_source shaders[SHADER_COUNT];
+
+}
+
+#endif
+""" % '\n'.join([' %s_SHADER,' % name.upper() for name in shaders.keys()])
+ header_path = os.path.join(output_dir, 'include/mbgl/shader/shaders.hpp')
+ mkdir_p(os.path.dirname(header_path))
+ with open(header_path, 'w') as f: f.write(header)
+
+
+def write_source(shader_platform, prefix, suffix):
+ if shader_platform == 'gles2' or shader_platform == 'gles3':
+ # OpenGL ES
+ preamble = 'precision highp float;';
+ else:
+ # Desktop OpenGL
+ preamble = '#version 120';
+
+ shader_lines = [(""" {{
+ R"{name}_vert({preamble}\n{vertex}){name}_vert",
+ R"{name}_frag({preamble}\n{fragment}){name}_frag",
+ }},
+""").format(
+ name = shader,
+ preamble = preamble,
+ vertex = shaders[shader]['vertex'],
+ fragment = shaders[shader]['fragment']
+) for shader in shaders]
+
+ source = """// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
+#include <mbgl/platform/gl.hpp>
+{prefix}
+#include <mbgl/shader/shaders.hpp>
+
+namespace mbgl {{
+
+const shader_source shaders[SHADER_COUNT] = {{
+{shaders}
+}};
+
+}}
+{suffix}
+""".format(
+ prefix = prefix,
+ suffix = suffix,
+ shaders = ''.join(shader_lines)
+)
+
+ source_path = os.path.join(output_dir, 'src/shader/shaders_' + shader_platform + '.cpp')
+ mkdir_p(os.path.dirname(source_path))
+ with open(source_path, 'w') as f: f.write(source)
+
+write_header()
+write_source('gl', '#ifndef GL_ES_VERSION_2_0', '#endif')
+write_source('gles2', '#ifdef GL_ES_VERSION_2_0', '#endif')
diff --git a/scripts/compare_images.sh b/scripts/compare_images.sh
new file mode 100755
index 0000000000..f9e1a81edb
--- /dev/null
+++ b/scripts/compare_images.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+(cd ./test/suite/ && (./bin/compare_images.py || true))
diff --git a/scripts/travis_before_install.sh b/scripts/travis_before_install.sh
index f67aa270d6..2af2f7ae0f 100755
--- a/scripts/travis_before_install.sh
+++ b/scripts/travis_before_install.sh
@@ -24,30 +24,16 @@ if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
libboost1.55-dev libcurl4-openssl-dev \
libpng-dev libsqlite3-dev
- mapbox_time "install_mesa_deps" \
- sudo apt-get install -y libpthread-stubs0-dev \
- xserver-xorg-dev x11proto-xinerama-dev libx11-xcb-dev \
- libxcb-glx0-dev libxrender-dev llvm-3.4 mesa-utils && \
- sudo apt-get build-dep -y libgl1-mesa-dri libxcb-glx0-dev
-
- mapbox_time "build_mesa" \
- curl -sfo MesaLib-10.3.1.tar.gz http://ftp.de.debian.org/debian/pool/main/m/mesa/mesa_10.3.1.orig.tar.gz && \
- tar -zxf MesaLib-10.3.1.tar.gz && \
- cd Mesa-10.3.1 && \
- ./autogen.sh --with-gallium-drivers=svga,swrast --disable-dri \
- --enable-xlib-glx --enable-glx-tls --with-llvm-prefix=/usr/lib/llvm-3.4 \
- --without-va && \
- echo $CXXFLAGS
- echo $CFLAGS
- echo $LDFLAGS
- make -j$JOBS && sudo make install && \
- cd ../
-
mapbox_time "install_opengl" \
- sudo apt-get -y install libxi-dev x11proto-randr-dev \
+ sudo apt-get -y install mesa-utils libxi-dev x11proto-randr-dev \
x11proto-xext-dev libxrandr-dev \
x11proto-xf86vidmode-dev libxxf86vm-dev \
- libxcursor-dev libxinerama-dev
+ libxcursor-dev libxinerama-dev \
+ llvm-3.4 # required for mesa
+
+
+ mapbox_time "install_mesa" \
+ mason install mesa 10.3.1
mapbox_time "install_awscli" \
sudo pip install awscli
diff --git a/scripts/travis_install_test_suite.sh b/scripts/travis_install_test_suite.sh
deleted file mode 100755
index cb2422d70c..0000000000
--- a/scripts/travis_install_test_suite.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/env bash
-
-if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
- #
- # we'll need the test suite on Linux
- #
- mapbox_time "install_test_suite" \
- npm install git+https://github.com/mapbox/mapbox-gl-test-suite.git
-fi
diff --git a/scripts/travis_script.sh b/scripts/travis_script.sh
index 5fa5a3f5f3..c224617314 100755
--- a/scripts/travis_script.sh
+++ b/scripts/travis_script.sh
@@ -13,16 +13,18 @@ if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
mapbox_time "compile_tests" \
make test -j$JOBS BUILDTYPE=${BUILDTYPE}
+ mapbox_time "checkout_test_suite" \
+ git submodule update --init test/suite
+
mapbox_time "run_tests" \
./scripts/run_tests.sh
- mapbox_time_start "compare_results"
- (cd ./node_modules/mapbox-gl-test-suite/ && (./bin/compare_images.js || true))
- mapbox_time_finish
+ mapbox_time "compare_results" \
+ ./scripts/compare_images.sh
if [ ! -z "${AWS_ACCESS_KEY_ID}" ] && [ ! -z "${AWS_SECRET_ACCESS_KEY}" ] ; then
mapbox_time_start "deploy_results"
- (cd ./node_modules/mapbox-gl-test-suite/ && ./bin/deploy_results.sh)
+ (cd ./test/suite/ && ./bin/deploy_results.sh)
mapbox_time_finish
fi
@@ -39,10 +41,8 @@ elif [[ ${TRAVIS_OS_NAME} == "osx" ]]; then
#
# build iOS
#
- git submodule init
-
- mapbox_time "load_submodules" \
- git submodule update
+ mapbox_time "checkout_cocoa_bindings" \
+ git submodule update --init ios/mapbox-gl-cocoa
mapbox_time "create_ios_project" \
make build/ios/mapbox-gl-cocoa/app/mapboxgl-app.xcodeproj
diff --git a/src/csscolorparser/csscolorparser.cpp b/src/csscolorparser/csscolorparser.cpp
index d52c6280cf..938470f192 100644
--- a/src/csscolorparser/csscolorparser.cpp
+++ b/src/csscolorparser/csscolorparser.cpp
@@ -29,12 +29,12 @@
#include <sstream>
#include <cmath>
#include <algorithm>
-#include <map>
using namespace CSSColorParser;
// http://www.w3.org/TR/css3-color/
-const std::map<std::string, Color> kCSSColorTable = {
+struct NamedColor { const char *const name; const Color color; };
+const NamedColor namedColors[] = {
{ "transparent", { 0, 0, 0, 0 } }, { "aliceblue", { 240, 248, 255, 1 } },
{ "antiquewhite", { 250, 235, 215, 1 } }, { "aqua", { 0, 255, 255, 1 } },
{ "aquamarine", { 127, 255, 212, 1 } }, { "azure", { 240, 255, 255, 1 } },
@@ -111,6 +111,8 @@ const std::map<std::string, Color> kCSSColorTable = {
{ "yellow", { 255, 255, 0, 1 } }, { "yellowgreen", { 154, 205, 50, 1 } }
};
+const size_t namedColorCount = sizeof (namedColors) / sizeof (NamedColor);
+
template <typename T>
uint8_t clamp_css_byte(T i) { // Clamp to integer 0 .. 255.
@@ -187,10 +189,11 @@ Color CSSColorParser::parse(const std::string& css_str) {
// Convert to lowercase.
std::transform(str.begin(), str.end(), str.begin(), ::tolower);
- // Color keywords (and transparent) lookup.
- auto it = kCSSColorTable.find(str);
- if (it != kCSSColorTable.end()) {
- return it->second;
+
+ for (size_t i = 0; i < namedColorCount; i++) {
+ if (str == namedColors[i].name) {
+ return namedColors[i].color;
+ }
}
// #abc and #abc123 syntax.
diff --git a/src/geometry/debug_font_buffer.cpp b/src/geometry/debug_font_buffer.cpp
index 2a0924a1c4..6c233f88df 100644
--- a/src/geometry/debug_font_buffer.cpp
+++ b/src/geometry/debug_font_buffer.cpp
@@ -3,7 +3,7 @@
#include <cmath>
#include <cstring>
-#include "debug_font.cpp"
+#include "debug_font_data.hpp"
using namespace mbgl;
@@ -12,19 +12,11 @@ void DebugFontBuffer::addText(const char *text, double left, double baseline, do
const size_t len = strlen(text);
for (size_t i = 0; i < len; ++i) {
- if (text[i] < 32 || (unsigned char)(text[i]) > 127) {
+ if (text[i] < 32 || (unsigned char)(text[i]) >= 127) {
continue;
}
- auto it = simplex.find((int)text[i]);
- if (it == simplex.end()) {
- continue;
- }
-
- const glyph& glyph = it->second;
- if (!glyph.width) {
- continue;
- }
+ const glyph& glyph = simplex[text[i] - 32];
int16_t prev_x = -1, prev_y = -1, prev = false;
for (int32_t j = 0; j < glyph.length; j += 2) {
diff --git a/src/geometry/debug_font.cpp b/src/geometry/debug_font_data.hpp
index 8ee9f6811f..26c54cb480 100644
--- a/src/geometry/debug_font.cpp
+++ b/src/geometry/debug_font_data.hpp
@@ -1,3 +1,5 @@
+// This is an implementation file, so omit include guards.
+
#include <cstdint>
#include <map>
@@ -97,11 +99,6 @@ const int8_t simplex_93[] = { 5, 25, 7, 24, 8, 23, 9, 21, 9, 19, 8, 17, 7, 16, 6
const int8_t simplex_94[] = { 3, 6, 3, 8, 4, 11, 6, 12, 8, 12, 10, 11, 14, 8, 16, 7, 18, 7, 20, 8, 21, 10, -1, -1, 3, 8, 4, 10, 6, 11, 8, 11, 10, 10, 14, 7, 16, 6, 18, 6, 20, 7, 21, 10, 21, 12 };
struct glyph {
- glyph() : width(0), length(0), data(nullptr) { }
- glyph(uint8_t width_, uint8_t length_, const int8_t *data_)
- : width(width_),
- length(length_),
- data(data_) {}
uint8_t width;
uint8_t length;
const int8_t *data;
@@ -109,100 +106,101 @@ struct glyph {
// Font data From Hershey Simplex Font
// http://paulbourke.net/dataformats/hershey/
-const std::map<char, glyph> simplex = {
- { ' ', { 16, 0, nullptr } },
- { '!', { 10, sizeof(simplex_1), simplex_1 } },
- { '"', { 16, sizeof(simplex_2), simplex_2 } },
- { '#', { 21, sizeof(simplex_3), simplex_3 } },
- { '$', { 20, sizeof(simplex_4), simplex_4 } },
- { '%', { 24, sizeof(simplex_5), simplex_5 } },
- { '&', { 26, sizeof(simplex_6), simplex_6 } },
- { '\'', { 10, sizeof(simplex_7), simplex_7 } },
- { '(', { 14, sizeof(simplex_8), simplex_8 } },
- { ')', { 14, sizeof(simplex_9), simplex_9 } },
- { '*', { 16, sizeof(simplex_10), simplex_10 } },
- { '+', { 26, sizeof(simplex_11), simplex_11 } },
- { ',', { 10, sizeof(simplex_12), simplex_12 } },
- { '-', { 26, sizeof(simplex_13), simplex_13 } },
- { '.', { 10, sizeof(simplex_14), simplex_14 } },
- { '/', { 22, sizeof(simplex_15), simplex_15 } },
- { '0', { 20, sizeof(simplex_16), simplex_16 } },
- { '1', { 20, sizeof(simplex_17), simplex_17 } },
- { '2', { 20, sizeof(simplex_18), simplex_18 } },
- { '3', { 20, sizeof(simplex_19), simplex_19 } },
- { '4', { 20, sizeof(simplex_20), simplex_20 } },
- { '5', { 20, sizeof(simplex_21), simplex_21 } },
- { '6', { 20, sizeof(simplex_22), simplex_22 } },
- { '7', { 20, sizeof(simplex_23), simplex_23 } },
- { '8', { 20, sizeof(simplex_24), simplex_24 } },
- { '9', { 20, sizeof(simplex_25), simplex_25 } },
- { ':', { 10, sizeof(simplex_26), simplex_26 } },
- { ';', { 10, sizeof(simplex_27), simplex_27 } },
- { '<', { 24, sizeof(simplex_28), simplex_28 } },
- { '=', { 26, sizeof(simplex_29), simplex_29 } },
- { '>', { 24, sizeof(simplex_30), simplex_30 } },
- { '?', { 18, sizeof(simplex_31), simplex_31 } },
- { '@', { 27, sizeof(simplex_32), simplex_32 } },
- { 'A', { 18, sizeof(simplex_33), simplex_33 } },
- { 'B', { 21, sizeof(simplex_34), simplex_34 } },
- { 'C', { 21, sizeof(simplex_35), simplex_35 } },
- { 'D', { 21, sizeof(simplex_36), simplex_36 } },
- { 'E', { 19, sizeof(simplex_37), simplex_37 } },
- { 'F', { 18, sizeof(simplex_38), simplex_38 } },
- { 'G', { 21, sizeof(simplex_39), simplex_39 } },
- { 'H', { 22, sizeof(simplex_40), simplex_40 } },
- { 'I', { 8, sizeof(simplex_41), simplex_41 } },
- { 'J', { 16, sizeof(simplex_42), simplex_42 } },
- { 'K', { 21, sizeof(simplex_43), simplex_43 } },
- { 'L', { 17, sizeof(simplex_44), simplex_44 } },
- { 'M', { 24, sizeof(simplex_45), simplex_45 } },
- { 'N', { 22, sizeof(simplex_46), simplex_46 } },
- { 'O', { 22, sizeof(simplex_47), simplex_47 } },
- { 'P', { 21, sizeof(simplex_48), simplex_48 } },
- { 'Q', { 22, sizeof(simplex_49), simplex_49 } },
- { 'R', { 21, sizeof(simplex_50), simplex_50 } },
- { 'S', { 20, sizeof(simplex_51), simplex_51 } },
- { 'T', { 16, sizeof(simplex_52), simplex_52 } },
- { 'U', { 22, sizeof(simplex_53), simplex_53 } },
- { 'V', { 18, sizeof(simplex_54), simplex_54 } },
- { 'W', { 24, sizeof(simplex_55), simplex_55 } },
- { 'X', { 20, sizeof(simplex_56), simplex_56 } },
- { 'Y', { 18, sizeof(simplex_57), simplex_57 } },
- { 'Z', { 20, sizeof(simplex_58), simplex_58 } },
- { '[', { 14, sizeof(simplex_59), simplex_59 } },
- { '\\', { 14, sizeof(simplex_60), simplex_60 } },
- { ']', { 14, sizeof(simplex_61), simplex_61 } },
- { '^', { 16, sizeof(simplex_62), simplex_62 } },
- { '_', { 16, sizeof(simplex_63), simplex_63 } },
- { '`', { 10, sizeof(simplex_64), simplex_64 } },
- { 'a', { 19, sizeof(simplex_65), simplex_65 } },
- { 'b', { 19, sizeof(simplex_66), simplex_66 } },
- { 'c', { 18, sizeof(simplex_67), simplex_67 } },
- { 'd', { 19, sizeof(simplex_68), simplex_68 } },
- { 'e', { 18, sizeof(simplex_69), simplex_69 } },
- { 'f', { 12, sizeof(simplex_70), simplex_70 } },
- { 'g', { 19, sizeof(simplex_71), simplex_71 } },
- { 'h', { 19, sizeof(simplex_72), simplex_72 } },
- { 'i', { 8, sizeof(simplex_73), simplex_73 } },
- { 'j', { 10, sizeof(simplex_74), simplex_74 } },
- { 'k', { 17, sizeof(simplex_75), simplex_75 } },
- { 'l', { 8, sizeof(simplex_76), simplex_76 } },
- { 'm', { 30, sizeof(simplex_77), simplex_77 } },
- { 'n', { 19, sizeof(simplex_78), simplex_78 } },
- { 'o', { 19, sizeof(simplex_79), simplex_79 } },
- { 'p', { 19, sizeof(simplex_80), simplex_80 } },
- { 'q', { 19, sizeof(simplex_81), simplex_81 } },
- { 'r', { 13, sizeof(simplex_82), simplex_82 } },
- { 's', { 17, sizeof(simplex_83), simplex_83 } },
- { 't', { 12, sizeof(simplex_84), simplex_84 } },
- { 'u', { 19, sizeof(simplex_85), simplex_85 } },
- { 'v', { 16, sizeof(simplex_86), simplex_86 } },
- { 'w', { 22, sizeof(simplex_87), simplex_87 } },
- { 'x', { 17, sizeof(simplex_88), simplex_88 } },
- { 'y', { 16, sizeof(simplex_89), simplex_89 } },
- { 'z', { 17, sizeof(simplex_90), simplex_90 } },
- { '{', { 14, sizeof(simplex_91), simplex_91 } },
- { '|', { 8, sizeof(simplex_92), simplex_92 } },
- { '}', { 14, sizeof(simplex_93), simplex_93 } },
- { '~', { 24, sizeof(simplex_94), simplex_94 } }
+
+const glyph simplex[] = {
+ /* 32 */ { 16, 0, nullptr },
+ /* 33 ! */ { 10, sizeof(simplex_1), simplex_1 },
+ /* 34 " */ { 16, sizeof(simplex_2), simplex_2 },
+ /* 35 # */ { 21, sizeof(simplex_3), simplex_3 },
+ /* 36 $ */ { 20, sizeof(simplex_4), simplex_4 },
+ /* 37 % */ { 24, sizeof(simplex_5), simplex_5 },
+ /* 38 & */ { 26, sizeof(simplex_6), simplex_6 },
+ /* 39 ' */ { 10, sizeof(simplex_7), simplex_7 },
+ /* 40 ( */ { 14, sizeof(simplex_8), simplex_8 },
+ /* 41 ) */ { 14, sizeof(simplex_9), simplex_9 },
+ /* 42 * */ { 16, sizeof(simplex_10), simplex_10 },
+ /* 43 + */ { 26, sizeof(simplex_11), simplex_11 },
+ /* 44 , */ { 10, sizeof(simplex_12), simplex_12 },
+ /* 45 - */ { 26, sizeof(simplex_13), simplex_13 },
+ /* 46 . */ { 10, sizeof(simplex_14), simplex_14 },
+ /* 47 / */ { 22, sizeof(simplex_15), simplex_15 },
+ /* 48 0 */ { 20, sizeof(simplex_16), simplex_16 },
+ /* 49 1 */ { 20, sizeof(simplex_17), simplex_17 },
+ /* 50 2 */ { 20, sizeof(simplex_18), simplex_18 },
+ /* 51 3 */ { 20, sizeof(simplex_19), simplex_19 },
+ /* 52 4 */ { 20, sizeof(simplex_20), simplex_20 },
+ /* 53 5 */ { 20, sizeof(simplex_21), simplex_21 },
+ /* 54 6 */ { 20, sizeof(simplex_22), simplex_22 },
+ /* 55 7 */ { 20, sizeof(simplex_23), simplex_23 },
+ /* 56 8 */ { 20, sizeof(simplex_24), simplex_24 },
+ /* 57 9 */ { 20, sizeof(simplex_25), simplex_25 },
+ /* 58 : */ { 10, sizeof(simplex_26), simplex_26 },
+ /* 59 ; */ { 10, sizeof(simplex_27), simplex_27 },
+ /* 60 < */ { 24, sizeof(simplex_28), simplex_28 },
+ /* 61 = */ { 26, sizeof(simplex_29), simplex_29 },
+ /* 62 > */ { 24, sizeof(simplex_30), simplex_30 },
+ /* 63 ? */ { 18, sizeof(simplex_31), simplex_31 },
+ /* 64 @ */ { 27, sizeof(simplex_32), simplex_32 },
+ /* 65 A */ { 18, sizeof(simplex_33), simplex_33 },
+ /* 66 B */ { 21, sizeof(simplex_34), simplex_34 },
+ /* 67 C */ { 21, sizeof(simplex_35), simplex_35 },
+ /* 68 D */ { 21, sizeof(simplex_36), simplex_36 },
+ /* 69 E */ { 19, sizeof(simplex_37), simplex_37 },
+ /* 70 F */ { 18, sizeof(simplex_38), simplex_38 },
+ /* 71 G */ { 21, sizeof(simplex_39), simplex_39 },
+ /* 72 H */ { 22, sizeof(simplex_40), simplex_40 },
+ /* 73 I */ { 8, sizeof(simplex_41), simplex_41 },
+ /* 74 J */ { 16, sizeof(simplex_42), simplex_42 },
+ /* 75 K */ { 21, sizeof(simplex_43), simplex_43 },
+ /* 76 L */ { 17, sizeof(simplex_44), simplex_44 },
+ /* 77 M */ { 24, sizeof(simplex_45), simplex_45 },
+ /* 78 N */ { 22, sizeof(simplex_46), simplex_46 },
+ /* 79 O */ { 22, sizeof(simplex_47), simplex_47 },
+ /* 80 P */ { 21, sizeof(simplex_48), simplex_48 },
+ /* 81 Q */ { 22, sizeof(simplex_49), simplex_49 },
+ /* 82 R */ { 21, sizeof(simplex_50), simplex_50 },
+ /* 83 S */ { 20, sizeof(simplex_51), simplex_51 },
+ /* 84 T */ { 16, sizeof(simplex_52), simplex_52 },
+ /* 85 U */ { 22, sizeof(simplex_53), simplex_53 },
+ /* 86 V */ { 18, sizeof(simplex_54), simplex_54 },
+ /* 87 W */ { 24, sizeof(simplex_55), simplex_55 },
+ /* 88 X */ { 20, sizeof(simplex_56), simplex_56 },
+ /* 89 Y */ { 18, sizeof(simplex_57), simplex_57 },
+ /* 90 Z */ { 20, sizeof(simplex_58), simplex_58 },
+ /* 91 [ */ { 14, sizeof(simplex_59), simplex_59 },
+ /* 92 \ */ { 14, sizeof(simplex_60), simplex_60 },
+ /* 93 ] */ { 14, sizeof(simplex_61), simplex_61 },
+ /* 94 ^ */ { 16, sizeof(simplex_62), simplex_62 },
+ /* 95 _ */ { 16, sizeof(simplex_63), simplex_63 },
+ /* 96 ` */ { 10, sizeof(simplex_64), simplex_64 },
+ /* 97 a */ { 19, sizeof(simplex_65), simplex_65 },
+ /* 98 b */ { 19, sizeof(simplex_66), simplex_66 },
+ /* 99 c */ { 18, sizeof(simplex_67), simplex_67 },
+ /* 100 d */ { 19, sizeof(simplex_68), simplex_68 },
+ /* 101 e */ { 18, sizeof(simplex_69), simplex_69 },
+ /* 102 f */ { 12, sizeof(simplex_70), simplex_70 },
+ /* 103 g */ { 19, sizeof(simplex_71), simplex_71 },
+ /* 104 h */ { 19, sizeof(simplex_72), simplex_72 },
+ /* 105 i */ { 8, sizeof(simplex_73), simplex_73 },
+ /* 106 j */ { 10, sizeof(simplex_74), simplex_74 },
+ /* 107 k */ { 17, sizeof(simplex_75), simplex_75 },
+ /* 108 l */ { 8, sizeof(simplex_76), simplex_76 },
+ /* 109 m */ { 30, sizeof(simplex_77), simplex_77 },
+ /* 110 n */ { 19, sizeof(simplex_78), simplex_78 },
+ /* 111 o */ { 19, sizeof(simplex_79), simplex_79 },
+ /* 112 p */ { 19, sizeof(simplex_80), simplex_80 },
+ /* 113 q */ { 19, sizeof(simplex_81), simplex_81 },
+ /* 114 r */ { 13, sizeof(simplex_82), simplex_82 },
+ /* 115 s */ { 17, sizeof(simplex_83), simplex_83 },
+ /* 116 t */ { 12, sizeof(simplex_84), simplex_84 },
+ /* 117 u */ { 19, sizeof(simplex_85), simplex_85 },
+ /* 118 v */ { 16, sizeof(simplex_86), simplex_86 },
+ /* 119 w */ { 22, sizeof(simplex_87), simplex_87 },
+ /* 120 x */ { 17, sizeof(simplex_88), simplex_88 },
+ /* 121 y */ { 16, sizeof(simplex_89), simplex_89 },
+ /* 122 z */ { 17, sizeof(simplex_90), simplex_90 },
+ /* 123 { */ { 14, sizeof(simplex_91), simplex_91 },
+ /* 124 | */ { 8, sizeof(simplex_92), simplex_92 },
+ /* 125 } */ { 14, sizeof(simplex_93), simplex_93 },
+ /* 126 ~ */ { 24, sizeof(simplex_94), simplex_94 },
};
diff --git a/src/storage/file_source.cpp b/src/storage/file_source.cpp
index 70b4abe4c7..a67f57dac4 100644
--- a/src/storage/file_source.cpp
+++ b/src/storage/file_source.cpp
@@ -23,9 +23,9 @@ FileSource::FileSource(uv_loop_t *loop_, const std::string &path)
FileSource::~FileSource() {
assert(thread_id == uv_thread_self());
- uv_messenger_stop(queue);
- // NOTE: We don't need to delete the messenger since it will be deleted by the
- // uv_messenger_stop() function.
+ uv_messenger_stop(queue, [](uv_messenger_t *msgr) {
+ delete msgr;
+ });
util::ptr<BaseRequest> req;
diff --git a/src/util/uv-messenger.c b/src/util/uv-messenger.c
index bfa1565768..935b6f1c41 100644
--- a/src/util/uv-messenger.c
+++ b/src/util/uv-messenger.c
@@ -2,6 +2,7 @@
#include <mbgl/util/queue.h>
#include <stdlib.h>
+#include <assert.h>
typedef struct {
void *data;
@@ -46,6 +47,7 @@ int uv_messenger_init(uv_loop_t *loop, uv_messenger_t *msgr, uv_messenger_cb cal
}
msgr->callback = callback;
+ msgr->stop_callback = NULL;
QUEUE_INIT(&msgr->queue);
@@ -73,9 +75,12 @@ void uv_messenger_unref(uv_messenger_t *msgr) {
}
void uv__messenger_stop_callback(uv_handle_t *handle) {
- free((uv_messenger_t *)handle->data);
+ uv_messenger_t *msgr = (uv_messenger_t *)handle->data;
+ msgr->stop_callback(msgr);
}
-void uv_messenger_stop(uv_messenger_t *msgr) {
+void uv_messenger_stop(uv_messenger_t *msgr, uv_messenger_stop_cb stop_callback) {
+ assert(!msgr->stop_callback);
+ msgr->stop_callback = stop_callback;
uv_close((uv_handle_t *)&msgr->async, uv__messenger_stop_callback);
}
diff --git a/src/util/uv-worker.c b/src/util/uv-worker.c
index 8b0cc6dda7..d2aa908019 100644
--- a/src/util/uv-worker.c
+++ b/src/util/uv-worker.c
@@ -18,6 +18,10 @@ struct uv__worker_thread_s {
uv_thread_t thread;
};
+void uv__worker_free_messenger(uv_messenger_t *msgr) {
+ free(msgr);
+}
+
void uv__worker_thread_finished(uv__worker_thread_t *worker_thread) {
uv_worker_t *worker = worker_thread->worker;
@@ -35,7 +39,7 @@ void uv__worker_thread_finished(uv__worker_thread_t *worker_thread) {
worker->count--;
if (worker->count == 0) {
uv_chan_destroy(&worker->chan);
- uv_messenger_stop(worker->msgr);
+ uv_messenger_stop(worker->msgr, uv__worker_free_messenger);
if (worker->close_cb) {
worker->close_cb(worker);
}
diff --git a/test/fixtures/fixture_request.cpp b/test/fixtures/fixture_request.cpp
index f3b41681a6..cc01760ae1 100644
--- a/test/fixtures/fixture_request.cpp
+++ b/test/fixtures/fixture_request.cpp
@@ -16,7 +16,7 @@ const std::string base_directory = []{
fn.erase(fn.find_last_of("/"));
fn.erase(fn.find_last_of("/"));
fn.erase(fn.find_last_of("/"));
- return fn + "/node_modules/mapbox-gl-test-suite/";
+ return fn + "/test/suite/";
}();
namespace mbgl {
diff --git a/test/headless.cpp b/test/headless.cpp
index 0f4e100271..4605d7f288 100644
--- a/test/headless.cpp
+++ b/test/headless.cpp
@@ -20,7 +20,7 @@ const std::string base_directory = []{
std::string fn = __FILE__;
fn.erase(fn.find_last_of("/"));
fn.erase(fn.find_last_of("/"));
- return fn + "/node_modules/mapbox-gl-test-suite/";
+ return fn + "/test/suite/";
}();
auto display_ = std::make_shared<mbgl::HeadlessDisplay>();
diff --git a/test/suite b/test/suite
new file mode 160000
+Subproject 1651a3df444ff83c98f6eff00679d6b84dc8845