Merge branch 'master' of github.com:mapbox/mapbox-gl-native into android-mason

This commit is contained in:
Leith Bade
2015-01-13 19:48:26 +11:00
2 changed files with 8 additions and 12 deletions

View File

@@ -58,13 +58,11 @@ void GLFWView::initialize(mbgl::Map *map_) {
glfwSetWindowUserPointer(window, this);
glfwMakeContextCurrent(window);
glfwSwapInterval(1);
int width, height;
glfwGetWindowSize(window, &width, &height);
int fbWidth, fbHeight;
glfwGetFramebufferSize(window, &fbWidth, &fbHeight);
resize(window, 0, 0);
resize(window, width, height);
glfwSetCursorPosCallback(window, mouseMove);
glfwSetMouseButtonCallback(window, mouseClick);
@@ -281,12 +279,6 @@ int GLFWView::run() {
map->start();
while (!glfwWindowShouldClose(window)) {
if (map->needsSwap()) {
glfwSwapBuffers(window);
map->swapped();
fps();
}
glfwWaitEvents();
}
@@ -310,7 +302,9 @@ void GLFWView::notify() {
}
void GLFWView::swap() {
glfwPostEmptyEvent();
glfwSwapBuffers(window);
map->swapped();
fps();
}
void GLFWView::notifyMapChange(mbgl::MapChange /*change*/, mbgl::timestamp /*delay*/) {

View File

@@ -8,6 +8,8 @@
namespace mbgl {
namespace util {
const static std::string tokenReservedChars = "{}()[]<>$=:;.,^";
// Replaces {tokens} in a string by calling the lookup function.
template <typename Lookup>
std::string replaceTokens(const std::string &source, const Lookup &lookup) {
@@ -22,7 +24,7 @@ std::string replaceTokens(const std::string &source, const Lookup &lookup) {
result.append(pos, brace);
pos = brace;
if (pos != end) {
for (brace++; brace != end && (std::isalnum(*brace) || *brace == '_'); brace++);
for (brace++; brace != end && tokenReservedChars.find(*brace) == std::string::npos; brace++);
if (brace != end && *brace == '}') {
result.append(lookup({ pos + 1, brace }));
pos = brace + 1;