From 0306e77ff09f3df4c0c809c153e135d92bb6db73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Fri, 21 Feb 2014 12:18:11 +0100 Subject: [PATCH] remove void* parameter from platform::restart() --- include/llmr/platform/platform.hpp | 2 +- ios/MBXViewController.mm | 2 +- macosx/main.mm | 16 ++-------------- src/map/map.cpp | 14 +++++++------- src/map/tile.cpp | 3 +-- src/style/sprite.cpp | 2 +- 6 files changed, 13 insertions(+), 26 deletions(-) diff --git a/include/llmr/platform/platform.hpp b/include/llmr/platform/platform.hpp index 4431a662c..25778c561 100644 --- a/include/llmr/platform/platform.hpp +++ b/include/llmr/platform/platform.hpp @@ -15,7 +15,7 @@ class Tile; namespace platform { // Restarts painting. This could for example trigger the event loop of the controlling application. -void restart(void *obj); +void restart(); struct Response { int16_t code = -1; diff --git a/ios/MBXViewController.mm b/ios/MBXViewController.mm index 990045108..2c998f7af 100644 --- a/ios/MBXViewController.mm +++ b/ios/MBXViewController.mm @@ -397,7 +397,7 @@ namespace llmr { namespace platform { - void restart(void *) + void restart() { [[NSNotificationCenter defaultCenter] postNotificationName:MBXNeedsRenderNotification object:nil]; } diff --git a/macosx/main.mm b/macosx/main.mm index 1c1d77eee..472799d99 100644 --- a/macosx/main.mm +++ b/macosx/main.mm @@ -9,8 +9,6 @@ #include -NSString *const MBXNeedsRenderNotification = @"MBXNeedsRenderNotification"; - class MapView { public: MapView() : @@ -63,15 +61,9 @@ public: glfwSetScrollCallback(window, scroll); glfwSetCharCallback(window, character); glfwSetKeyCallback(window, key); - - renderObserver = [[NSNotificationCenter defaultCenter] addObserverForName:MBXNeedsRenderNotification - object:nil - queue:[NSOperationQueue mainQueue] - usingBlock: ^ (NSNotification * notification) { - dirty = true; - }]; } + static void character(GLFWwindow *window, unsigned int codepoint) { } @@ -216,7 +208,6 @@ public: } ~MapView() { - [[NSNotificationCenter defaultCenter] removeObserver:renderObserver]; glfwTerminate(); } @@ -233,8 +224,6 @@ public: GLFWwindow *window; llmr::Settings_MacOSX settings; llmr::Map map; - - id renderObserver; }; MapView *mapView; @@ -243,7 +232,7 @@ NSOperationQueue *queue; namespace llmr { namespace platform { -void restart(void *) { +void restart() { mapView->dirty = true; CGEventRef event = CGEventCreate(NULL); CGEventSetType(event, kCGEventMouseMoved); @@ -274,7 +263,6 @@ void request_http(std::string url, std::function background_fun dispatch_async(dispatch_get_main_queue(), ^(void) { foreground_callback(); }); - [[NSNotificationCenter defaultCenter] postNotificationName:MBXNeedsRenderNotification object:nil]; }]; } diff --git a/src/map/map.cpp b/src/map/map.cpp index 429b98e2b..d09b505f4 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -69,12 +69,12 @@ void Map::moveBy(double dx, double dy, double duration) { void Map::startPanning() { transform.startPanning(); - platform::restart(this); + platform::restart(); } void Map::stopPanning() { transform.stopPanning(); - platform::restart(this); + platform::restart(); } void Map::scaleBy(double ds, double cx, double cy, double duration) { @@ -89,12 +89,12 @@ void Map::scaleBy(double ds, double cx, double cy, double duration) { void Map::startScaling() { transform.startScaling(); - platform::restart(this); + platform::restart(); } void Map::stopScaling() { transform.stopScaling(); - platform::restart(this); + platform::restart(); } void Map::rotateBy(double cx, double cy, double sx, double sy, double ex, double ey, double duration) { @@ -107,12 +107,12 @@ void Map::rotateBy(double cx, double cy, double sx, double sy, double ex, double void Map::startRotating() { transform.startRotating(); - platform::restart(this); + platform::restart(); } void Map::stopRotating() { transform.stopRotating(); - platform::restart(this); + platform::restart(); } void Map::setLonLat(double lon, double lat, double duration) { @@ -233,7 +233,7 @@ void Map::cancelAnimations() { void Map::update() { updateTiles(); - platform::restart(this); + platform::restart(); } diff --git a/src/map/tile.cpp b/src/map/tile.cpp index 938024d47..f734a32e1 100644 --- a/src/map/tile.cpp +++ b/src/map/tile.cpp @@ -83,8 +83,7 @@ void Tile::request() { fprintf(stderr, "tile loading failed\n"); } }, []() { - // TODO: Make sure this gets passed the correct map ID/pointer. - platform::restart(nullptr); + platform::restart(); }); } diff --git a/src/style/sprite.cpp b/src/style/sprite.cpp index a3e5d145c..ed56a679f 100644 --- a/src/style/sprite.cpp +++ b/src/style/sprite.cpp @@ -36,7 +36,7 @@ void Sprite::load(const std::string& base_url, float pixelRatio) { std::lock_guard lock(sprite->mtx); if (sprite->img.size() && sprite->pos.size()) { sprite->loaded = true; - platform::restart(NULL); + platform::restart(); fprintf(stderr, "sprite loaded\n"); } };