From dbdc64592cbd9c2cfa05ddd694546a95b083b354 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Wed, 3 Dec 2014 11:59:39 +0100 Subject: [PATCH 1/3] don't set the window title on every frame this is a significant performance penalty, at least on OS X, and drops our frame rate below 60fps on even simple scenes. instead of showing the position of the map in the window, we should display it elsewhere --- platform/default/glfw_view.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/platform/default/glfw_view.cpp b/platform/default/glfw_view.cpp index ed37653bb..4ddcd9019 100644 --- a/platform/default/glfw_view.cpp +++ b/platform/default/glfw_view.cpp @@ -263,12 +263,6 @@ void GLFWView::notify() { void GLFWView::swap() { glfwPostEmptyEvent(); - - double lon, lat, zoom; - map->getLonLatZoom(lon, lat, zoom); - const double bearing = map->getBearing(); - const std::string title = mbgl::util::sprintf<128>("Mapbox GL – %.2f/%.6f/%.6f/%.1f", zoom, lat, lon, bearing); - glfwSetWindowTitle(window, title.c_str()); } void GLFWView::notify_map_change(mbgl::MapChange /*change*/, mbgl::timestamp /*delay*/) { From d3ab8951530b760afb19e685078b1480babc2209 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Wed, 3 Dec 2014 12:04:56 +0100 Subject: [PATCH 2/3] switch to a newer version of GLFW refs #679 --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index d04cafa2a..8c74ec189 100755 --- a/configure +++ b/configure @@ -25,7 +25,7 @@ case ${MASON_PLATFORM} in BOOST_VERSION=system ;; *) - GLFW_VERSION=a21f2377 + GLFW_VERSION=e1ae9af5 SQLITE_VERSION=system LIBPNG_VERSION=1.6.13 LIBJPEG_VERSION=v8d From dac76a0f9269a580706e52b730a98f9b1430bcdf Mon Sep 17 00:00:00 2001 From: Mike Morris Date: Tue, 25 Nov 2014 14:18:47 -0500 Subject: [PATCH 3/3] break out FileSource as an abstract class add CachingHTTPFileSource implementation --- gyp/mbgl-headless.gypi | 20 +++++++ gyp/mbgl-ios.gypi | 1 + gyp/mbgl-linux.gypi | 1 + gyp/mbgl-osx.gypi | 1 + include/mbgl/map/map.hpp | 4 +- .../default/caching_http_file_source.hpp | 52 ++++++++++++++++ include/mbgl/storage/file_source.hpp | 37 +++--------- ios/mapbox-gl-cocoa | 2 +- linux/main.cpp | 4 +- macosx/main.mm | 4 +- .../default/caching_http_file_source.cpp | 59 +++++++++++++------ src/map/map.cpp | 35 +++++------ test/headless.cpp | 4 +- 13 files changed, 151 insertions(+), 73 deletions(-) create mode 100644 include/mbgl/platform/default/caching_http_file_source.hpp rename src/storage/file_source.cpp => platform/default/caching_http_file_source.cpp (56%) diff --git a/gyp/mbgl-headless.gypi b/gyp/mbgl-headless.gypi index 08ac21181..da11c8781 100644 --- a/gyp/mbgl-headless.gypi +++ b/gyp/mbgl-headless.gypi @@ -4,12 +4,32 @@ 'product_name': 'mbgl-headless', 'type': 'static_library', 'standalone_static_library': 1, + 'variables': { + 'cflags_cc': [ + '<@(uv_cflags)', + ], + 'cflags': [ + '<@(uv_cflags)', + ], + }, 'include_dirs': [ '../include', ], + 'conditions': [ + ['OS == "mac"', { + 'xcode_settings': { + 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], + 'OTHER_CFLAGS': [ '<@(cflags)' ], + } + }, { + 'cflags_cc': [ '<@(cflags_cc)' ], + 'cflags': [ '<@(cflags)' ], + }] + ], 'sources': [ '../platform/default/headless_view.cpp', '../platform/default/headless_display.cpp', + '../platform/default/caching_http_file_source.cpp', ], }, ], diff --git a/gyp/mbgl-ios.gypi b/gyp/mbgl-ios.gypi index dd1c9c0c2..c26e72849 100644 --- a/gyp/mbgl-ios.gypi +++ b/gyp/mbgl-ios.gypi @@ -36,6 +36,7 @@ '../platform/darwin/string_nsstring.mm', '../platform/darwin/http_request_baton_cocoa.mm', '../platform/darwin/image.mm', + '../platform/default/caching_http_file_source.cpp', ], 'include_dirs': [ '../include', diff --git a/gyp/mbgl-linux.gypi b/gyp/mbgl-linux.gypi index 9d979ddf1..510703140 100644 --- a/gyp/mbgl-linux.gypi +++ b/gyp/mbgl-linux.gypi @@ -35,6 +35,7 @@ '../platform/default/image_reader.cpp', '../platform/default/png_reader.cpp', '../platform/default/jpeg_reader.cpp', + '../platform/default/caching_http_file_source.cpp', ], 'include_dirs': [ '../include', diff --git a/gyp/mbgl-osx.gypi b/gyp/mbgl-osx.gypi index 76c22f5ad..015ee13ab 100644 --- a/gyp/mbgl-osx.gypi +++ b/gyp/mbgl-osx.gypi @@ -11,6 +11,7 @@ '../platform/darwin/string_nsstring.mm', '../platform/darwin/http_request_baton_cocoa.mm', '../platform/darwin/image.mm', + '../platform/default/caching_http_file_source.cpp', ], 'include_dirs': [ '../include', diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index e97c63138..718efbf14 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -32,7 +32,7 @@ class Map : private util::noncopyable { typedef void (*stop_callback)(void *); public: - explicit Map(View &view); + explicit Map(View&, FileSource&); ~Map(); // Start the map render thread. It is asynchronous. @@ -177,7 +177,7 @@ private: Transform transform; TransformState state; - util::ptr fileSource; + FileSource& fileSource; util::ptr